@tsocial/tvweb-sdk.dop 5.10.1 → 5.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* Version: 5.
|
|
2
|
-
import t,{useRef as r,useMemo as n,useCallback as o,useContext as a,Component as i,useState as s,useEffect as c,useReducer as l,forwardRef as u,useImperativeHandle as d,useLayoutEffect as f}from"react";import p from"prop-types";import h,{ThemeContext as m,keyframes as g,createGlobalStyle as v,css as y,ThemeProvider as b}from"styled-components";import C from"react-dom";function w(e){return(w="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 k(e,t,r,n,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,o)}function B(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){k(a,n,o,i,s,"next",e)}function s(e){k(a,n,o,i,s,"throw",e)}i(void 0)}))}}function E(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 S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(){return(A=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 _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function I(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t){return(T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function P(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function x(e,t,r){return(x=P()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&T(o,r.prototype),o}).apply(null,arguments)}function R(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function N(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}(e,t)||D(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e){return function(e){if(Array.isArray(e))return M(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||D(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,t){if(e){if("string"==typeof e)return M(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(e,t):void 0}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function U(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=D(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw a}}}}var j={not_supported:{code:"not_supported",msg:{en:"Camera is not well-supported on this device/browser. Please try another one.",vi:"Camera không được hỗ trợ. Vui lòng thử trình duyệt hoặc thiết bị khác."}},camera_timeout:{code:"camera_timeout",msg:{en:"Can't access camera. Please check camera permission, try again or try another browser/device",vi:"Không thể truy cập camera. Vui lòng kiểm tra quyền truy cập camera, đóng các tab/app khác đang sử dụng camera hoặc thử lại trên trình duyệt/thiết bị khác."}},wrong_orientation:{code:"wrong_orientation",msg:{en:"You are using landscape mode. Please rotate screen to portrait mode and retry.",vi:"Bạn đang sử dụng chế độ màn hình xoay ngang. Vui lòng quay màn hình theo chiều dọc và thực hiện lại."}},unable_to_load_model:{code:"unable_to_load_model",msg:{en:"Unable to load model on this device/browser. Please try another one.",vi:"Không thể load model. Vui lòng thử trình duyệt hoặc thiết bị khác."}},no_permission:{code:"no_permission",msg:{en:"Please grant the permission to access the camera.",vi:"Vui lòng cấp quyền để truy cập camera."}},no_face:{code:"no_face",msg:{en:"Face not found",vi:"Không tìm thấy khuôn mặt"}},partial_face:{code:"partial_face",msg:{en:"Face out of the box",vi:"Không tìm thấy toàn bộ khuôn mặt"}},multiple_faces:{code:"multiple_faces",msg:{en:"Too many faces",vi:"Quá nhiều khuôn mặt"}},face_too_small:{code:"face_too_small",msg:{en:"Face too small",vi:"Khuôn mặt quá nhỏ"}},face_too_large:{code:"face_too_large",msg:{en:"Face too large",vi:"Khuôn mặt quá to"}},face_out_of_box:{code:"face_out_of_box",msg:{en:"Face is out of box",vi:"Khuôn mặt không nằm trọn vẹn trong khung ảnh"}},liveness_too_fast:{code:"liveness_too_fast",msg:{en:"Please turn your face SLOWLY",vi:"Vui lòng quay CHẬM lại"}},liveness_terminated:{code:"liveness_terminated",msg:{en:"Please try again.",vi:"Vui lòng thực hiện lại."}},liveness_terminated_face_tracking:{code:"liveness_terminated_face_tracking",msg:{en:"You need to turn your face SLOWLY.\nPlease try again.",vi:"Bạn cần quay CHẬM lại.\nVui lòng thực hiện lại."}},liveness_terminated_no_face:{code:"liveness_terminated_no_face",msg:{en:"Your face was missing for too long.\nPlease try again.",vi:"Khuôn mặt không nằm trong khung hình.\nXin vui lòng thử lại."}},liveness_terminated_time_out:{code:"liveness_terminated_time_out",msg:{en:"You need to complete gestures as instructed within <%= x %> seconds.\nPlease try again.",vi:"Bạn cần hoàn thành động tác theo chỉ dẫn trong <%= x %> giây.\nXin vui lòng thử lại."}},card_sanity_not_good:{code:"card_sanity_not_good",msg:{en:"Card sanity not good",vi:"Card sanity chưa đạt"}},api_call_error:{code:"api_call_error",msg:{en:"Api call error",vi:"Lỗi call api"}},upload_error:{code:"upload_error",msg:{en:"Upload error",vi:"Lỗi upload"}},sanity_check_error:{code:"sanity_check_error",msg:{en:"Sanity check error",vi:"Lỗi check sanity"}},read_id_card_error:{code:"read_id_card_error",msg:{en:"Read id card error",vi:"Lỗi read id card"}},detect_id_tampering_error:{code:"detect_id_tampering_error",msg:{en:"Detect id tampering error",vi:"Lỗi detect id tampering"}},detect_id_card_error:{code:"detect_id_card_error",msg:{en:"Can't detect id card type",vi:"Không thể detect id card type"}},missing_front_id_card:{code:"missing_front_id_card",msg:{en:"Missing front id",vi:"Không tìm thấy front id"}},server_error:{code:"server_error",msg:"Server error"},client_web_setting_not_found:{code:"client_web_setting_not_found",msg:"Client Web Setting Not Found"},id_detector_validate_angle_error:{code:"id_detector_validate_angle_error",msg:{en:"Please place ID card straight, not tilted",vi:"Vui lòng đặt giấy tờ thẳng, không bị nghiêng khi chụp"}},id_detector_no_cards:{code:"id_detector_no_cards",msg:{en:"Please capture the <%= side %> side of ID card\n (occupy 50-95% of the frame)",vi:"Vui lòng chụp mặt <%= side %> của giấy tờ\n (chiếm 50-95% khung hình)"}},id_detector_card_too_small:{code:"id_detector_card_too_small",msg:{en:"Please move ID card CLOSER\n (occupy 50-95% of the frame)",vi:"Vui lòng đưa giấy tờ lại GẦN hơn\n (chiếm 50-95% khung hình)"}},id_detector_error_incomplete:{code:"id_detector_error_incomplete",msg:{en:"Please move ID card FARTHER\n (occupy 50-95% of the frame)",vi:"Vui lòng đưa giấy tờ ra XA hơn\n (chiếm 50-95% khung hình)"}},glare_detected:{code:"glare_detected",msg:{en:"Glare is detected. Please adjust the shooting angle",vi:"Ảnh bị chói / lóa. Vui lòng điều chỉnh góc chụp."}},id_detector_error_front_side_no_faces:{code:"id_detector_error_front_side_no_faces",msg:{en:"Please capture the front side of ID card",vi:"Vui lòng chụp mặt trước của giấy tờ"}},id_detector_error_front_side_multiple_faces:{code:"id_detector_error_front_side_multiple_faces",msg:{en:"Please capture the front side of one ID card only (remove other items out of the frame)",vi:"Vui lòng chụp mặt trước 1 giấy tờ duy nhất"}},id_detector_error_back_side_has_faces:{code:"id_detector_error_back_side_has_faces",msg:{en:"Please capture the back side of ID card",vi:"Vui lòng chụp mặt sau của giấy tờ"}},id_detector_error_blur:{code:"id_detector_error_blur",msg:{en:"Blurry photo detected. Please capture again for a clearer image",vi:"Ảnh bị mờ. Vui lòng chụp lại để có ảnh rõ nét hơn"}},not_frontal_face:{code:"not_frontal_face",msg:{en:"Please look straight to camera.",vi:"Vui lòng nhìn thẳng vào camera."}},not_readable:{code:"CameraInUseError",msg:{vi:"Camera đang được sử dụng bởi ứng dụng/tab khác.",en:"Camera already in use by another app/tab."}}},F={FRONTAL:"frontal",LEFT:"left",RIGHT:"right",UP:"up",DOWN:"down"},V=Object.freeze({__proto__:null,ErrorDuration:{SHORT:500,LONG:1500,TERMINATE:3e3},Errors:j,FaceDirection:F,Mode:{ACTIVE:"active",PASSIVE:"passive"},Messages:{REMAIN_TIME:{en:"Remaining time: <%= x %> seconds",vi:"Thời gian còn lại: <%= x %> giây"}},TrackLivenessEvents:{start_camera:"user_activity.start",show_warmup:"user_activity.show",capture_up_face:"user_activity.up",capture_left_face:"user_activity.left",capture_right_face:"user_activity.right",capture_frontal_face:"user_activity.frontal",finish_capture:"user_activity",finish_load_model:"sdk.load_model",show_alert:"sdk_ui.show_alert",liveness_detection_done:"sdk_mode.liveness"},IDCardSide:{FRONT:"front",BACK:"back"},IDCardType:{VN:"vn.national_id"},IDCardMessage:{REMAINING_TIME:{en:"Remaining time: <%= x %> seconds",vi:"Thời gian còn lại: <%= x %> giây"},TIMEOUT_INSTRUCTION:{en:"You need to take the picture within <%= x %> seconds.\nPlease try again.",vi:"Bạn cần hoàn thành việc chụp giấy tờ trong <%= x %> giây.\nVui lòng thử lại."}}});function z(e,t,r,n,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,o)}function K(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){z(a,n,o,i,s,"next",e)}function s(e){z(a,n,o,i,s,"throw",e)}i(void 0)}))}}function H(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function q(){return(q=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 Q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function W(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(r),!0).forEach((function(t){H(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function G(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(e,t)||Y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Y(e,t){if(e){if("string"==typeof e)return $(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$(e,t):void 0}}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Z(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=Y(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw a}}}}var J=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},ee=function(e,t){return e===t||e!=e&&t!=t},te=function(e,t){for(var r=e.length;r--;)if(ee(e[r][0],t))return r;return-1},re=Array.prototype.splice;function ne(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ne.prototype.clear=function(){this.__data__=[],this.size=0},ne.prototype.delete=function(e){var t=this.__data__,r=te(t,e);return!(r<0||(r==t.length-1?t.pop():re.call(t,r,1),--this.size,0))},ne.prototype.get=function(e){var t=this.__data__,r=te(t,e);return r<0?void 0:t[r][1]},ne.prototype.has=function(e){return te(this.__data__,e)>-1},ne.prototype.set=function(e,t){var r=this.__data__,n=te(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var oe=ne,ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ie(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var se,ce="object"==w(ae)&&ae&&ae.Object===Object&&ae,le="object"==("undefined"==typeof self?"undefined":w(self))&&self&&self.Object===Object&&self,ue=ce||le||Function("return this")(),de=ue.Symbol,fe=Object.prototype,pe=fe.hasOwnProperty,he=fe.toString,me=de?de.toStringTag:void 0,ge=Object.prototype.toString,ve=de?de.toStringTag:void 0,ye=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ve&&ve in Object(e)?function(e){var t=pe.call(e,me),r=e[me];try{e[me]=void 0;var n=!0}catch(e){}var o=he.call(e);return n&&(t?e[me]=r:delete e[me]),o}(e):function(e){return ge.call(e)}(e)},be=function(e){var t=w(e);return null!=e&&("object"==t||"function"==t)},Ce=function(e){if(!be(e))return!1;var t=ye(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},we=ue["__core-js_shared__"],ke=(se=/[^.]+$/.exec(we&&we.keys&&we.keys.IE_PROTO||""))?"Symbol(src)_1."+se:"",Be=Function.prototype.toString,Ee=function(e){if(null!=e){try{return Be.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Se=/^\[object .+?Constructor\]$/,Ae=Function.prototype,_e=Object.prototype,Ie=Ae.toString,Te=_e.hasOwnProperty,Pe=RegExp("^"+Ie.call(Te).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xe=function(e){return!(!be(e)||function(e){return!!ke&&ke in e}(e))&&(Ce(e)?Pe:Se).test(Ee(e))},Re=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return xe(r)?r:void 0},Ne=Re(ue,"Map"),Le=Re(Object,"create"),Oe=Object.prototype.hasOwnProperty,De=Object.prototype.hasOwnProperty;function Me(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Me.prototype.clear=function(){this.__data__=Le?Le(null):{},this.size=0},Me.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Me.prototype.get=function(e){var t=this.__data__;if(Le){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Oe.call(t,e)?t[e]:void 0},Me.prototype.has=function(e){var t=this.__data__;return Le?void 0!==t[e]:De.call(t,e)},Me.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Le&&void 0===t?"__lodash_hash_undefined__":t,this};var Ue=Me,je=function(e,t){var r=e.__data__;return function(e){var t=w(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map};function Fe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Fe.prototype.clear=function(){this.size=0,this.__data__={hash:new Ue,map:new(Ne||oe),string:new Ue}},Fe.prototype.delete=function(e){var t=je(this,e).delete(e);return this.size-=t?1:0,t},Fe.prototype.get=function(e){return je(this,e).get(e)},Fe.prototype.has=function(e){return je(this,e).has(e)},Fe.prototype.set=function(e,t){var r=je(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};var Ve=Fe;function ze(e){var t=this.__data__=new oe(e);this.size=t.size}ze.prototype.clear=function(){this.__data__=new oe,this.size=0},ze.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ze.prototype.get=function(e){return this.__data__.get(e)},ze.prototype.has=function(e){return this.__data__.has(e)},ze.prototype.set=function(e,t){var r=this.__data__;if(r instanceof oe){var n=r.__data__;if(!Ne||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ve(n)}return r.set(e,t),this.size=r.size,this};var Ke=ze,He=function(){try{var e=Re(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),qe=function(e,t,r){"__proto__"==t&&He?He(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},Qe=Object.prototype.hasOwnProperty,We=function(e,t,r){var n=e[t];Qe.call(e,t)&&ee(n,r)&&(void 0!==r||t in e)||qe(e,t,r)},Ge=function(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a<i;){var s=t[a],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),o?qe(r,s,c):We(r,s,c)}return r},Xe=function(e){return null!=e&&"object"==w(e)},Ye=function(e){return Xe(e)&&"[object Arguments]"==ye(e)},$e=Object.prototype,Ze=$e.hasOwnProperty,Je=$e.propertyIsEnumerable,et=Ye(function(){return arguments}())?Ye:function(e){return Xe(e)&&Ze.call(e,"callee")&&!Je.call(e,"callee")},tt=Array.isArray,rt=function(){return!1},nt=ie((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?ue.Buffer:void 0,a=(o?o.isBuffer:void 0)||rt;e.exports=a})),ot=/^(?:0|[1-9]\d*)$/,at=function(e,t){var r=w(e);return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&ot.test(e))&&e>-1&&e%1==0&&e<t},it=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},st={};st["[object Float32Array]"]=st["[object Float64Array]"]=st["[object Int8Array]"]=st["[object Int16Array]"]=st["[object Int32Array]"]=st["[object Uint8Array]"]=st["[object Uint8ClampedArray]"]=st["[object Uint16Array]"]=st["[object Uint32Array]"]=!0,st["[object Arguments]"]=st["[object Array]"]=st["[object ArrayBuffer]"]=st["[object Boolean]"]=st["[object DataView]"]=st["[object Date]"]=st["[object Error]"]=st["[object Function]"]=st["[object Map]"]=st["[object Number]"]=st["[object Object]"]=st["[object RegExp]"]=st["[object Set]"]=st["[object String]"]=st["[object WeakMap]"]=!1;var ct=function(e){return function(t){return e(t)}},lt=ie((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r&&ce.process,a=function(){try{return n&&n.require&&n.require("util").types||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a})),ut=lt&<.isTypedArray,dt=ut?ct(ut):function(e){return Xe(e)&&it(e.length)&&!!st[ye(e)]},ft=Object.prototype.hasOwnProperty,pt=function(e,t){var r=tt(e),n=!r&&et(e),o=!r&&!n&&nt(e),a=!r&&!n&&!o&&dt(e),i=r||n||o||a,s=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var l in e)!t&&!ft.call(e,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||at(l,c))||s.push(l);return s},ht=Object.prototype,mt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ht)},gt=function(e,t){return function(r){return e(t(r))}},vt=gt(Object.keys,Object),yt=Object.prototype.hasOwnProperty,bt=function(e){return null!=e&&it(e.length)&&!Ce(e)},Ct=function(e){return bt(e)?pt(e):function(e){if(!mt(e))return vt(e);var t=[];for(var r in Object(e))yt.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)},wt=Object.prototype.hasOwnProperty,kt=function(e){if(!be(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=mt(e),r=[];for(var n in e)("constructor"!=n||!t&&wt.call(e,n))&&r.push(n);return r},Bt=function(e){return bt(e)?pt(e,!0):kt(e)},Et=ie((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?ue.Buffer:void 0,a=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=a?a(r):new e.constructor(r);return e.copy(n),n}})),St=function(){return[]},At=Object.prototype.propertyIsEnumerable,_t=Object.getOwnPropertySymbols,It=_t?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a}(_t(e),(function(t){return At.call(e,t)})))}:St,Tt=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e},Pt=gt(Object.getPrototypeOf,Object),xt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Tt(t,It(e)),e=Pt(e);return t}:St,Rt=function(e,t,r){var n=t(e);return tt(e)?n:Tt(n,r(e))},Nt=function(e){return Rt(e,Ct,It)},Lt=function(e){return Rt(e,Bt,xt)},Ot=Re(ue,"DataView"),Dt=Re(ue,"Promise"),Mt=Re(ue,"Set"),Ut=Re(ue,"WeakMap"),jt=Ee(Ot),Ft=Ee(Ne),Vt=Ee(Dt),zt=Ee(Mt),Kt=Ee(Ut),Ht=ye;(Ot&&"[object DataView]"!=Ht(new Ot(new ArrayBuffer(1)))||Ne&&"[object Map]"!=Ht(new Ne)||Dt&&"[object Promise]"!=Ht(Dt.resolve())||Mt&&"[object Set]"!=Ht(new Mt)||Ut&&"[object WeakMap]"!=Ht(new Ut))&&(Ht=function(e){var t=ye(e),r="[object Object]"==t?e.constructor:void 0,n=r?Ee(r):"";if(n)switch(n){case jt:return"[object DataView]";case Ft:return"[object Map]";case Vt:return"[object Promise]";case zt:return"[object Set]";case Kt:return"[object WeakMap]"}return t});var qt=Ht,Qt=Object.prototype.hasOwnProperty,Wt=ue.Uint8Array,Gt=function(e){var t=new e.constructor(e.byteLength);return new Wt(t).set(new Wt(e)),t},Xt=/\w*$/,Yt=de?de.prototype:void 0,$t=Yt?Yt.valueOf:void 0,Zt=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return Gt(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return function(e,t){var r=t?Gt(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var r=t?Gt(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,r);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return function(e){var t=new e.constructor(e.source,Xt.exec(e));return t.lastIndex=e.lastIndex,t}(e);case"[object Set]":return new n;case"[object Symbol]":return function(e){return $t?Object($t.call(e)):{}}(e)}},Jt=Object.create,er=function(){function e(){}return function(t){if(!be(t))return{};if(Jt)return Jt(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),tr=lt&<.isMap,rr=tr?ct(tr):function(e){return Xe(e)&&"[object Map]"==qt(e)},nr=lt&<.isSet,or=nr?ct(nr):function(e){return Xe(e)&&"[object Set]"==qt(e)},ar={};ar["[object Arguments]"]=ar["[object Array]"]=ar["[object ArrayBuffer]"]=ar["[object DataView]"]=ar["[object Boolean]"]=ar["[object Date]"]=ar["[object Float32Array]"]=ar["[object Float64Array]"]=ar["[object Int8Array]"]=ar["[object Int16Array]"]=ar["[object Int32Array]"]=ar["[object Map]"]=ar["[object Number]"]=ar["[object Object]"]=ar["[object RegExp]"]=ar["[object Set]"]=ar["[object String]"]=ar["[object Symbol]"]=ar["[object Uint8Array]"]=ar["[object Uint8ClampedArray]"]=ar["[object Uint16Array]"]=ar["[object Uint32Array]"]=!0,ar["[object Error]"]=ar["[object Function]"]=ar["[object WeakMap]"]=!1;var ir=function e(t,r,n,o,a,i){var s,c=1&r,l=2&r,u=4&r;if(n&&(s=a?n(t,o,a,i):n(t)),void 0!==s)return s;if(!be(t))return t;var d=tt(t);if(d){if(s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Qt.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(t),!c)return function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(t,s)}else{var f=qt(t),p="[object Function]"==f||"[object GeneratorFunction]"==f;if(nt(t))return Et(t,c);if("[object Object]"==f||"[object Arguments]"==f||p&&!a){if(s=l||p?{}:function(e){return"function"!=typeof e.constructor||mt(e)?{}:er(Pt(e))}(t),!c)return l?function(e,t){return Ge(e,xt(e),t)}(t,function(e,t){return e&&Ge(t,Bt(t),e)}(s,t)):function(e,t){return Ge(e,It(e),t)}(t,function(e,t){return e&&Ge(t,Ct(t),e)}(s,t))}else{if(!ar[f])return a?t:{};s=Zt(t,f,c)}}i||(i=new Ke);var h=i.get(t);if(h)return h;i.set(t,s),or(t)?t.forEach((function(o){s.add(e(o,r,n,o,t,i))})):rr(t)&&t.forEach((function(o,a){s.set(a,e(o,r,n,a,t,i))}));var m=d?void 0:(u?l?Lt:Nt:l?Bt:Ct)(t);return function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););}(m||t,(function(o,a){m&&(o=t[a=o]),We(s,a,e(o,r,n,a,t,i))})),s},sr=function(e){return"symbol"==w(e)||Xe(e)&&"[object Symbol]"==ye(e)},cr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lr=/^\w*$/;function ur(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function r(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(ur.Cache||Ve),r}ur.Cache=Ve;var dr=ur,fr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pr=/\\(\\)?/g,hr=function(e){var t=dr((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(fr,(function(e,r,n,o){t.push(n?o.replace(pr,"$1"):r||e)})),t}),(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}(),mr=de?de.prototype:void 0,gr=mr?mr.toString:void 0,vr=function e(t){if("string"==typeof t)return t;if(tt(t))return J(t,e)+"";if(sr(t))return gr?gr.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r},yr=function(e){return null==e?"":vr(e)},br=function(e,t){return tt(e)?e:function(e,t){if(tt(e))return!1;var r=w(e);return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!sr(e))||lr.test(e)||!cr.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:hr(yr(e))},Cr=function(e){if("string"==typeof e||sr(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},wr=function(e,t){return t.length<2?e:function(e,t){for(var r=0,n=(t=br(t,e)).length;null!=e&&r<n;)e=e[Cr(t[r++])];return r&&r==n?e:void 0}(e,function(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(o);++n<o;)a[n]=e[n+t];return a}(t,0,-1))},kr=function(e,t){return t=br(t,e),null==(e=wr(e,t))||delete e[Cr(function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}(t))]},Br=Function.prototype,Er=Object.prototype,Sr=Br.toString,Ar=Er.hasOwnProperty,_r=Sr.call(Object),Ir=function(e){return function(e){if(!Xe(e)||"[object Object]"!=ye(e))return!1;var t=Pt(e);if(null===t)return!0;var r=Ar.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Sr.call(r)==_r}(e)?void 0:e},Tr=de?de.isConcatSpreadable:void 0,Pr=function(e){return tt(e)||et(e)||!!(Tr&&e&&e[Tr])},xr=function e(t,r,n,o,a){var i=-1,s=t.length;for(n||(n=Pr),a||(a=[]);++i<s;){var c=t[i];r>0&&n(c)?r>1?e(c,r-1,n,o,a):Tt(a,c):o||(a[a.length]=c)}return a},Rr=function(e){return null!=e&&e.length?xr(e,1):[]},Nr=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)},Lr=Math.max,Or=function(e){return function(){return e}},Dr=He?function(e,t){return He(e,"toString",{configurable:!0,enumerable:!1,value:Or(t),writable:!0})}:function(e){return e},Mr=Date.now,Ur=function(e){var t=0,r=0;return function(){var n=Mr(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Dr),jr=function(e){return Ur(function(e,t,r){return t=Lr(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=Lr(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=n[o];return s[t]=r(i),Nr(e,this,s)}}(e,void 0,Rr),e+"")}((function(e,t){var r={};if(null==e)return r;var n=!1;t=J(t,(function(t){return t=br(t,e),n||(n=t.length>1),t})),Ge(e,Lt(e),r),n&&(r=ir(r,7,Ir));for(var o=t.length;o--;)kr(r,t[o]);return r})),Fr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return W(W({blazefaceModelUrl:"https://storage.googleapis.com/tfhub-tfjs-modules/tensorflow/tfjs-model/blazeface/1/default/1/model.json",opencvUrl:"https://unpkg.com/@tsocial/tv_web_sdk_resources@1.0.0/libs/opencv.js",idCardModelUrl:"https://unpkg.com/@tsocial/tv_web_sdk_resources@1.0.0/models/id-card/tflite/qtf16_model_224x224.tflite"},jr(e,["tfScriptUrls"])),{},{tfScriptUrls:W({tfUrl:"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@3.11.0",tfBackendWasmUrl:"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.11.0/dist/tf-backend-wasm.js",tfBackendCpuUrl:"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu@3.11.0",tfBackendWebGlUrl:"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl@3.11.0",tfLiteUrl:"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-tflite@0.0.1-alpha.7/dist/tf-tflite.min.js",blazefaceScriptUrl:"https://cdn.jsdelivr.net/npm/@tensorflow-models/blazeface@0.0.7"},null==e?void 0:e.tfScriptUrls)})};function Vr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.resourceRoot,r=e.initCustomUrls,n=void 0===r?{}:r;return t?W(W({blazefaceModelUrl:"".concat(t,"models/1.0.0/blazeface/model.json"),opencvUrl:"".concat(t,"opencv/3.4.0/cv.js"),idCardModelUrl:"".concat(t,"models/1.0.0/id_card/tflite/qtf16_model_224x224.tflite")},jr(n,["tfScriptUrls"])),{},{tfScriptUrls:W({tfUrl:"".concat(t,"tfjs/3.11.0/tf.js"),tfBackendWasmUrl:"".concat(t,"tfjs/3.11.0/backend-wasm.js"),tfBackendCpuUrl:"".concat(t,"tfjs/3.11.0/backend-cpu.js"),tfBackendWebGlUrl:"".concat(t,"tfjs/3.11.0/backend-webgl.js"),tfLiteUrl:"".concat(t,"tflite/0.0.1-alpha.7/tflite.min.js"),blazefaceScriptUrl:"".concat(t,"blazeface/0.0.7/bf.js")},null==n?void 0:n.tfScriptUrls)}):Fr(n)}var zr=t.createContext();function Kr(e){var r=e.value,n=e.children,o=W({},r),a=o.customUrls,i=o.resourceRoot;return i&&(o.customUrls=Vr({resourceRoot:i,initCustomUrls:a})),t.createElement(zr.Provider,{value:o},n)}function Hr(){var e=a(zr);if(void 0===e)throw new Error("useSDKSettings must be used within a SDKSettingsProvider");return e}Kr.propTypes={value:p.shape({lang:p.string,assetRoot:p.string,apiClient:p.shape({}),customUrls:p.shape({}),resourceRoot:p.string}).isRequired,children:p.node.isRequired};var qr,Qr=Object.freeze({__proto__:null,SDKSettingsProvider:Kr,useSDKSettings:Hr}),Wr=function(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}(Object.freeze({__proto__:null,default:{}})),Gr=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(ie((function(e,t){!function(e,t){t=t&&t.hasOwnProperty("default")?t.default:t;var r=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/read_id_card_info_sync",e,t)},e}(),n=function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};
|
|
1
|
+
/* Version: 5.11.2 - September 7, 2022 10:50:16 */
|
|
2
|
+
import t,{useRef as r,useMemo as n,useCallback as o,useContext as a,Component as i,useState as s,useEffect as c,useReducer as l,forwardRef as u,useImperativeHandle as d,useLayoutEffect as f}from"react";import p from"prop-types";import h,{ThemeContext as m,keyframes as g,createGlobalStyle as v,css as y,ThemeProvider as b}from"styled-components";import C from"react-dom";function w(e){return(w="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 k(e,t,r,n,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,o)}function B(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){k(a,n,o,i,s,"next",e)}function s(e){k(a,n,o,i,s,"throw",e)}i(void 0)}))}}function E(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 S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(){return(A=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 _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function I(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t){return(T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function P(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function x(e,t,r){return(x=P()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&T(o,r.prototype),o}).apply(null,arguments)}function R(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function N(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}(e,t)||D(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e){return function(e){if(Array.isArray(e))return M(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||D(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,t){if(e){if("string"==typeof e)return M(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(e,t):void 0}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function U(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=D(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw a}}}}var F={not_supported:{code:"not_supported",msg:{en:"Camera is not well-supported on this device/browser. Please try another one.",vi:"Camera không được hỗ trợ. Vui lòng thử trình duyệt hoặc thiết bị khác."}},camera_timeout:{code:"camera_timeout",msg:{en:"Can't access camera. Please check camera permission, try again or try another browser/device",vi:"Không thể truy cập camera. Vui lòng kiểm tra quyền truy cập camera, đóng các tab/app khác đang sử dụng camera hoặc thử lại trên trình duyệt/thiết bị khác."}},wrong_orientation:{code:"wrong_orientation",msg:{en:"You are using landscape mode. Please rotate screen to portrait mode and retry.",vi:"Bạn đang sử dụng chế độ màn hình xoay ngang. Vui lòng quay màn hình theo chiều dọc và thực hiện lại."}},unable_to_load_model:{code:"unable_to_load_model",msg:{en:"Unable to load model on this device/browser. Please try another one.",vi:"Không thể load model. Vui lòng thử trình duyệt hoặc thiết bị khác."}},no_permission:{code:"no_permission",msg:{en:"Please grant the permission to access the camera.",vi:"Vui lòng cấp quyền để truy cập camera."}},no_face:{code:"no_face",msg:{en:"Face not found",vi:"Không tìm thấy khuôn mặt"}},partial_face:{code:"partial_face",msg:{en:"Face out of the box",vi:"Không tìm thấy toàn bộ khuôn mặt"}},multiple_faces:{code:"multiple_faces",msg:{en:"Too many faces",vi:"Quá nhiều khuôn mặt"}},face_too_small:{code:"face_too_small",msg:{en:"Face too small",vi:"Khuôn mặt quá nhỏ"}},face_too_large:{code:"face_too_large",msg:{en:"Face too large",vi:"Khuôn mặt quá to"}},face_out_of_box:{code:"face_out_of_box",msg:{en:"Face is out of box",vi:"Khuôn mặt không nằm trọn vẹn trong khung ảnh"}},liveness_too_fast:{code:"liveness_too_fast",msg:{en:"Please turn your face SLOWLY",vi:"Vui lòng quay CHẬM lại"}},liveness_terminated:{code:"liveness_terminated",msg:{en:"Please try again.",vi:"Vui lòng thực hiện lại."}},liveness_terminated_face_tracking:{code:"liveness_terminated_face_tracking",msg:{en:"You need to turn your face SLOWLY.\nPlease try again.",vi:"Bạn cần quay CHẬM lại.\nVui lòng thực hiện lại."}},liveness_terminated_no_face:{code:"liveness_terminated_no_face",msg:{en:"Your face was missing for too long.\nPlease try again.",vi:"Khuôn mặt không nằm trong khung hình.\nXin vui lòng thử lại."}},liveness_terminated_time_out:{code:"liveness_terminated_time_out",msg:{en:"You need to complete gestures as instructed within <%= x %> seconds.\nPlease try again.",vi:"Bạn cần hoàn thành động tác theo chỉ dẫn trong <%= x %> giây.\nXin vui lòng thử lại."}},card_sanity_not_good:{code:"card_sanity_not_good",msg:{en:"Card sanity not good",vi:"Card sanity chưa đạt"}},api_call_error:{code:"api_call_error",msg:{en:"Api call error",vi:"Lỗi call api"}},upload_error:{code:"upload_error",msg:{en:"Upload error",vi:"Lỗi upload"}},sanity_check_error:{code:"sanity_check_error",msg:{en:"Sanity check error",vi:"Lỗi check sanity"}},read_id_card_error:{code:"read_id_card_error",msg:{en:"Read id card error",vi:"Lỗi read id card"}},detect_id_tampering_error:{code:"detect_id_tampering_error",msg:{en:"Detect id tampering error",vi:"Lỗi detect id tampering"}},detect_id_card_error:{code:"detect_id_card_error",msg:{en:"Can't detect id card type",vi:"Không thể detect id card type"}},missing_front_id_card:{code:"missing_front_id_card",msg:{en:"Missing front id",vi:"Không tìm thấy front id"}},server_error:{code:"server_error",msg:"Server error"},client_web_setting_not_found:{code:"client_web_setting_not_found",msg:"Client Web Setting Not Found"},id_detector_validate_angle_error:{code:"id_detector_validate_angle_error",msg:{en:"Please place ID card straight, not tilted",vi:"Vui lòng đặt giấy tờ thẳng, không bị nghiêng khi chụp"}},id_detector_no_cards:{code:"id_detector_no_cards",msg:{en:"Please capture the <%= side %> side of ID card\n (occupy 50-95% of the frame)",vi:"Vui lòng chụp mặt <%= side %> của giấy tờ\n (chiếm 50-95% khung hình)"}},id_detector_card_too_small:{code:"id_detector_card_too_small",msg:{en:"Please move ID card CLOSER\n (occupy 50-95% of the frame)",vi:"Vui lòng đưa giấy tờ lại GẦN hơn\n (chiếm 50-95% khung hình)"}},id_detector_error_incomplete:{code:"id_detector_error_incomplete",msg:{en:"Please move ID card FARTHER\n (occupy 50-95% of the frame)",vi:"Vui lòng đưa giấy tờ ra XA hơn\n (chiếm 50-95% khung hình)"}},glare_detected:{code:"glare_detected",msg:{en:"Glare is detected. Please adjust the shooting angle",vi:"Ảnh bị chói / lóa. Vui lòng điều chỉnh góc chụp."}},id_detector_error_front_side_no_faces:{code:"id_detector_error_front_side_no_faces",msg:{en:"Please capture the front side of ID card",vi:"Vui lòng chụp mặt trước của giấy tờ"}},id_detector_error_front_side_multiple_faces:{code:"id_detector_error_front_side_multiple_faces",msg:{en:"Please capture the front side of one ID card only (remove other items out of the frame)",vi:"Vui lòng chụp mặt trước 1 giấy tờ duy nhất"}},id_detector_error_back_side_has_faces:{code:"id_detector_error_back_side_has_faces",msg:{en:"Please capture the back side of ID card",vi:"Vui lòng chụp mặt sau của giấy tờ"}},id_detector_error_blur:{code:"id_detector_error_blur",msg:{en:"Blurry photo detected. Please capture again for a clearer image",vi:"Ảnh bị mờ. Vui lòng chụp lại để có ảnh rõ nét hơn"}},not_frontal_face:{code:"not_frontal_face",msg:{en:"Please look straight to camera.",vi:"Vui lòng nhìn thẳng vào camera."}},not_readable:{code:"CameraInUseError",msg:{vi:"Camera đang được sử dụng bởi ứng dụng/tab khác.",en:"Camera already in use by another app/tab."}}},j={FRONTAL:"frontal",LEFT:"left",RIGHT:"right",UP:"up",DOWN:"down"},V=Object.freeze({__proto__:null,ErrorDuration:{SHORT:500,LONG:1500,TERMINATE:3e3},Errors:F,FaceDirection:j,Mode:{ACTIVE:"active",PASSIVE:"passive"},Messages:{REMAIN_TIME:{en:"Remaining time: <%= x %> seconds",vi:"Thời gian còn lại: <%= x %> giây"}},TrackLivenessEvents:{start_camera:"user_activity.start",show_warmup:"user_activity.show",capture_up_face:"user_activity.up",capture_left_face:"user_activity.left",capture_right_face:"user_activity.right",capture_frontal_face:"user_activity.frontal",finish_capture:"user_activity",finish_load_model:"sdk.load_model",show_alert:"sdk_ui.show_alert",liveness_detection_done:"sdk_mode.liveness"},IDCardSide:{FRONT:"front",BACK:"back"},IDCardType:{VN:"vn.national_id"},IDCardMessage:{REMAINING_TIME:{en:"Remaining time: <%= x %> seconds",vi:"Thời gian còn lại: <%= x %> giây"},TIMEOUT_INSTRUCTION:{en:"You need to take the picture within <%= x %> seconds.\nPlease try again.",vi:"Bạn cần hoàn thành việc chụp giấy tờ trong <%= x %> giây.\nVui lòng thử lại."}}});function z(e,t,r,n,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,o)}function K(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){z(a,n,o,i,s,"next",e)}function s(e){z(a,n,o,i,s,"throw",e)}i(void 0)}))}}function H(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function q(){return(q=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 Q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function W(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(r),!0).forEach((function(t){H(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function G(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==s.return||s.return()}finally{if(o)throw a}}return r}}(e,t)||Y(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Y(e,t){if(e){if("string"==typeof e)return $(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$(e,t):void 0}}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Z(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=Y(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw a}}}}var J=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},ee=function(e,t){return e===t||e!=e&&t!=t},te=function(e,t){for(var r=e.length;r--;)if(ee(e[r][0],t))return r;return-1},re=Array.prototype.splice;function ne(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ne.prototype.clear=function(){this.__data__=[],this.size=0},ne.prototype.delete=function(e){var t=this.__data__,r=te(t,e);return!(r<0||(r==t.length-1?t.pop():re.call(t,r,1),--this.size,0))},ne.prototype.get=function(e){var t=this.__data__,r=te(t,e);return r<0?void 0:t[r][1]},ne.prototype.has=function(e){return te(this.__data__,e)>-1},ne.prototype.set=function(e,t){var r=this.__data__,n=te(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var oe=ne,ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ie(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var se,ce="object"==w(ae)&&ae&&ae.Object===Object&&ae,le="object"==("undefined"==typeof self?"undefined":w(self))&&self&&self.Object===Object&&self,ue=ce||le||Function("return this")(),de=ue.Symbol,fe=Object.prototype,pe=fe.hasOwnProperty,he=fe.toString,me=de?de.toStringTag:void 0,ge=Object.prototype.toString,ve=de?de.toStringTag:void 0,ye=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ve&&ve in Object(e)?function(e){var t=pe.call(e,me),r=e[me];try{e[me]=void 0;var n=!0}catch(e){}var o=he.call(e);return n&&(t?e[me]=r:delete e[me]),o}(e):function(e){return ge.call(e)}(e)},be=function(e){var t=w(e);return null!=e&&("object"==t||"function"==t)},Ce=function(e){if(!be(e))return!1;var t=ye(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},we=ue["__core-js_shared__"],ke=(se=/[^.]+$/.exec(we&&we.keys&&we.keys.IE_PROTO||""))?"Symbol(src)_1."+se:"",Be=Function.prototype.toString,Ee=function(e){if(null!=e){try{return Be.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Se=/^\[object .+?Constructor\]$/,Ae=Function.prototype,_e=Object.prototype,Ie=Ae.toString,Te=_e.hasOwnProperty,Pe=RegExp("^"+Ie.call(Te).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xe=function(e){return!(!be(e)||function(e){return!!ke&&ke in e}(e))&&(Ce(e)?Pe:Se).test(Ee(e))},Re=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return xe(r)?r:void 0},Ne=Re(ue,"Map"),Le=Re(Object,"create"),Oe=Object.prototype.hasOwnProperty,De=Object.prototype.hasOwnProperty;function Me(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Me.prototype.clear=function(){this.__data__=Le?Le(null):{},this.size=0},Me.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Me.prototype.get=function(e){var t=this.__data__;if(Le){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Oe.call(t,e)?t[e]:void 0},Me.prototype.has=function(e){var t=this.__data__;return Le?void 0!==t[e]:De.call(t,e)},Me.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Le&&void 0===t?"__lodash_hash_undefined__":t,this};var Ue=Me,Fe=function(e,t){var r=e.__data__;return function(e){var t=w(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map};function je(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}je.prototype.clear=function(){this.size=0,this.__data__={hash:new Ue,map:new(Ne||oe),string:new Ue}},je.prototype.delete=function(e){var t=Fe(this,e).delete(e);return this.size-=t?1:0,t},je.prototype.get=function(e){return Fe(this,e).get(e)},je.prototype.has=function(e){return Fe(this,e).has(e)},je.prototype.set=function(e,t){var r=Fe(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};var Ve=je;function ze(e){var t=this.__data__=new oe(e);this.size=t.size}ze.prototype.clear=function(){this.__data__=new oe,this.size=0},ze.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ze.prototype.get=function(e){return this.__data__.get(e)},ze.prototype.has=function(e){return this.__data__.has(e)},ze.prototype.set=function(e,t){var r=this.__data__;if(r instanceof oe){var n=r.__data__;if(!Ne||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ve(n)}return r.set(e,t),this.size=r.size,this};var Ke=ze,He=function(){try{var e=Re(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),qe=function(e,t,r){"__proto__"==t&&He?He(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r},Qe=Object.prototype.hasOwnProperty,We=function(e,t,r){var n=e[t];Qe.call(e,t)&&ee(n,r)&&(void 0!==r||t in e)||qe(e,t,r)},Ge=function(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a<i;){var s=t[a],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),o?qe(r,s,c):We(r,s,c)}return r},Xe=function(e){return null!=e&&"object"==w(e)},Ye=function(e){return Xe(e)&&"[object Arguments]"==ye(e)},$e=Object.prototype,Ze=$e.hasOwnProperty,Je=$e.propertyIsEnumerable,et=Ye(function(){return arguments}())?Ye:function(e){return Xe(e)&&Ze.call(e,"callee")&&!Je.call(e,"callee")},tt=Array.isArray,rt=function(){return!1},nt=ie((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?ue.Buffer:void 0,a=(o?o.isBuffer:void 0)||rt;e.exports=a})),ot=/^(?:0|[1-9]\d*)$/,at=function(e,t){var r=w(e);return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&ot.test(e))&&e>-1&&e%1==0&&e<t},it=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},st={};st["[object Float32Array]"]=st["[object Float64Array]"]=st["[object Int8Array]"]=st["[object Int16Array]"]=st["[object Int32Array]"]=st["[object Uint8Array]"]=st["[object Uint8ClampedArray]"]=st["[object Uint16Array]"]=st["[object Uint32Array]"]=!0,st["[object Arguments]"]=st["[object Array]"]=st["[object ArrayBuffer]"]=st["[object Boolean]"]=st["[object DataView]"]=st["[object Date]"]=st["[object Error]"]=st["[object Function]"]=st["[object Map]"]=st["[object Number]"]=st["[object Object]"]=st["[object RegExp]"]=st["[object Set]"]=st["[object String]"]=st["[object WeakMap]"]=!1;var ct=function(e){return function(t){return e(t)}},lt=ie((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r&&ce.process,a=function(){try{return n&&n.require&&n.require("util").types||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a})),ut=lt&<.isTypedArray,dt=ut?ct(ut):function(e){return Xe(e)&&it(e.length)&&!!st[ye(e)]},ft=Object.prototype.hasOwnProperty,pt=function(e,t){var r=tt(e),n=!r&&et(e),o=!r&&!n&&nt(e),a=!r&&!n&&!o&&dt(e),i=r||n||o||a,s=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var l in e)!t&&!ft.call(e,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||at(l,c))||s.push(l);return s},ht=Object.prototype,mt=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ht)},gt=function(e,t){return function(r){return e(t(r))}},vt=gt(Object.keys,Object),yt=Object.prototype.hasOwnProperty,bt=function(e){return null!=e&&it(e.length)&&!Ce(e)},Ct=function(e){return bt(e)?pt(e):function(e){if(!mt(e))return vt(e);var t=[];for(var r in Object(e))yt.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)},wt=Object.prototype.hasOwnProperty,kt=function(e){if(!be(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=mt(e),r=[];for(var n in e)("constructor"!=n||!t&&wt.call(e,n))&&r.push(n);return r},Bt=function(e){return bt(e)?pt(e,!0):kt(e)},Et=ie((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?ue.Buffer:void 0,a=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=a?a(r):new e.constructor(r);return e.copy(n),n}})),St=function(){return[]},At=Object.prototype.propertyIsEnumerable,_t=Object.getOwnPropertySymbols,It=_t?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a}(_t(e),(function(t){return At.call(e,t)})))}:St,Tt=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e},Pt=gt(Object.getPrototypeOf,Object),xt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Tt(t,It(e)),e=Pt(e);return t}:St,Rt=function(e,t,r){var n=t(e);return tt(e)?n:Tt(n,r(e))},Nt=function(e){return Rt(e,Ct,It)},Lt=function(e){return Rt(e,Bt,xt)},Ot=Re(ue,"DataView"),Dt=Re(ue,"Promise"),Mt=Re(ue,"Set"),Ut=Re(ue,"WeakMap"),Ft=Ee(Ot),jt=Ee(Ne),Vt=Ee(Dt),zt=Ee(Mt),Kt=Ee(Ut),Ht=ye;(Ot&&"[object DataView]"!=Ht(new Ot(new ArrayBuffer(1)))||Ne&&"[object Map]"!=Ht(new Ne)||Dt&&"[object Promise]"!=Ht(Dt.resolve())||Mt&&"[object Set]"!=Ht(new Mt)||Ut&&"[object WeakMap]"!=Ht(new Ut))&&(Ht=function(e){var t=ye(e),r="[object Object]"==t?e.constructor:void 0,n=r?Ee(r):"";if(n)switch(n){case Ft:return"[object DataView]";case jt:return"[object Map]";case Vt:return"[object Promise]";case zt:return"[object Set]";case Kt:return"[object WeakMap]"}return t});var qt=Ht,Qt=Object.prototype.hasOwnProperty,Wt=ue.Uint8Array,Gt=function(e){var t=new e.constructor(e.byteLength);return new Wt(t).set(new Wt(e)),t},Xt=/\w*$/,Yt=de?de.prototype:void 0,$t=Yt?Yt.valueOf:void 0,Zt=function(e,t,r){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return Gt(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return function(e,t){var r=t?Gt(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e,t){var r=t?Gt(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,r);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return function(e){var t=new e.constructor(e.source,Xt.exec(e));return t.lastIndex=e.lastIndex,t}(e);case"[object Set]":return new n;case"[object Symbol]":return function(e){return $t?Object($t.call(e)):{}}(e)}},Jt=Object.create,er=function(){function e(){}return function(t){if(!be(t))return{};if(Jt)return Jt(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),tr=lt&<.isMap,rr=tr?ct(tr):function(e){return Xe(e)&&"[object Map]"==qt(e)},nr=lt&<.isSet,or=nr?ct(nr):function(e){return Xe(e)&&"[object Set]"==qt(e)},ar={};ar["[object Arguments]"]=ar["[object Array]"]=ar["[object ArrayBuffer]"]=ar["[object DataView]"]=ar["[object Boolean]"]=ar["[object Date]"]=ar["[object Float32Array]"]=ar["[object Float64Array]"]=ar["[object Int8Array]"]=ar["[object Int16Array]"]=ar["[object Int32Array]"]=ar["[object Map]"]=ar["[object Number]"]=ar["[object Object]"]=ar["[object RegExp]"]=ar["[object Set]"]=ar["[object String]"]=ar["[object Symbol]"]=ar["[object Uint8Array]"]=ar["[object Uint8ClampedArray]"]=ar["[object Uint16Array]"]=ar["[object Uint32Array]"]=!0,ar["[object Error]"]=ar["[object Function]"]=ar["[object WeakMap]"]=!1;var ir=function e(t,r,n,o,a,i){var s,c=1&r,l=2&r,u=4&r;if(n&&(s=a?n(t,o,a,i):n(t)),void 0!==s)return s;if(!be(t))return t;var d=tt(t);if(d){if(s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Qt.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(t),!c)return function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}(t,s)}else{var f=qt(t),p="[object Function]"==f||"[object GeneratorFunction]"==f;if(nt(t))return Et(t,c);if("[object Object]"==f||"[object Arguments]"==f||p&&!a){if(s=l||p?{}:function(e){return"function"!=typeof e.constructor||mt(e)?{}:er(Pt(e))}(t),!c)return l?function(e,t){return Ge(e,xt(e),t)}(t,function(e,t){return e&&Ge(t,Bt(t),e)}(s,t)):function(e,t){return Ge(e,It(e),t)}(t,function(e,t){return e&&Ge(t,Ct(t),e)}(s,t))}else{if(!ar[f])return a?t:{};s=Zt(t,f,c)}}i||(i=new Ke);var h=i.get(t);if(h)return h;i.set(t,s),or(t)?t.forEach((function(o){s.add(e(o,r,n,o,t,i))})):rr(t)&&t.forEach((function(o,a){s.set(a,e(o,r,n,a,t,i))}));var m=d?void 0:(u?l?Lt:Nt:l?Bt:Ct)(t);return function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););}(m||t,(function(o,a){m&&(o=t[a=o]),We(s,a,e(o,r,n,a,t,i))})),s},sr=function(e){return"symbol"==w(e)||Xe(e)&&"[object Symbol]"==ye(e)},cr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lr=/^\w*$/;function ur(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function r(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(ur.Cache||Ve),r}ur.Cache=Ve;var dr=ur,fr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pr=/\\(\\)?/g,hr=function(e){var t=dr((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(fr,(function(e,r,n,o){t.push(n?o.replace(pr,"$1"):r||e)})),t}),(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}(),mr=de?de.prototype:void 0,gr=mr?mr.toString:void 0,vr=function e(t){if("string"==typeof t)return t;if(tt(t))return J(t,e)+"";if(sr(t))return gr?gr.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r},yr=function(e){return null==e?"":vr(e)},br=function(e,t){return tt(e)?e:function(e,t){if(tt(e))return!1;var r=w(e);return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!sr(e))||lr.test(e)||!cr.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:hr(yr(e))},Cr=function(e){if("string"==typeof e||sr(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},wr=function(e,t){return t.length<2?e:function(e,t){for(var r=0,n=(t=br(t,e)).length;null!=e&&r<n;)e=e[Cr(t[r++])];return r&&r==n?e:void 0}(e,function(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(o);++n<o;)a[n]=e[n+t];return a}(t,0,-1))},kr=function(e,t){return t=br(t,e),null==(e=wr(e,t))||delete e[Cr(function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}(t))]},Br=Function.prototype,Er=Object.prototype,Sr=Br.toString,Ar=Er.hasOwnProperty,_r=Sr.call(Object),Ir=function(e){return function(e){if(!Xe(e)||"[object Object]"!=ye(e))return!1;var t=Pt(e);if(null===t)return!0;var r=Ar.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Sr.call(r)==_r}(e)?void 0:e},Tr=de?de.isConcatSpreadable:void 0,Pr=function(e){return tt(e)||et(e)||!!(Tr&&e&&e[Tr])},xr=function e(t,r,n,o,a){var i=-1,s=t.length;for(n||(n=Pr),a||(a=[]);++i<s;){var c=t[i];r>0&&n(c)?r>1?e(c,r-1,n,o,a):Tt(a,c):o||(a[a.length]=c)}return a},Rr=function(e){return null!=e&&e.length?xr(e,1):[]},Nr=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)},Lr=Math.max,Or=function(e){return function(){return e}},Dr=He?function(e,t){return He(e,"toString",{configurable:!0,enumerable:!1,value:Or(t),writable:!0})}:function(e){return e},Mr=Date.now,Ur=function(e){var t=0,r=0;return function(){var n=Mr(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Dr),Fr=function(e){return Ur(function(e,t,r){return t=Lr(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=Lr(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=n[o];return s[t]=r(i),Nr(e,this,s)}}(e,void 0,Rr),e+"")}((function(e,t){var r={};if(null==e)return r;var n=!1;t=J(t,(function(t){return t=br(t,e),n||(n=t.length>1),t})),Ge(e,Lt(e),r),n&&(r=ir(r,7,Ir));for(var o=t.length;o--;)kr(r,t[o]);return r})),jr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return W(W({blazefaceModelUrl:"https://storage.googleapis.com/tfhub-tfjs-modules/tensorflow/tfjs-model/blazeface/1/default/1/model.json",opencvUrl:"https://unpkg.com/@tsocial/tv_web_sdk_resources@1.0.0/libs/opencv.js",idCardModelUrl:"https://unpkg.com/@tsocial/tv_web_sdk_resources@1.0.0/models/id-card/tflite/qtf16_model_224x224.tflite"},Fr(e,["tfScriptUrls"])),{},{tfScriptUrls:W({tfUrl:"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@3.11.0",tfBackendWasmUrl:"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.11.0/dist/tf-backend-wasm.js",tfBackendCpuUrl:"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu@3.11.0",tfBackendWebGlUrl:"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl@3.11.0",tfLiteUrl:"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-tflite@0.0.1-alpha.7/dist/tf-tflite.min.js",blazefaceScriptUrl:"https://cdn.jsdelivr.net/npm/@tensorflow-models/blazeface@0.0.7"},null==e?void 0:e.tfScriptUrls)})};function Vr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.resourceRoot,r=e.initCustomUrls,n=void 0===r?{}:r;return t?W(W({blazefaceModelUrl:"".concat(t,"models/1.0.0/blazeface/model.json"),opencvUrl:"".concat(t,"opencv/3.4.0/cv.js"),idCardModelUrl:"".concat(t,"models/1.0.0/id_card/tflite/qtf16_model_224x224.tflite")},Fr(n,["tfScriptUrls"])),{},{tfScriptUrls:W({tfUrl:"".concat(t,"tfjs/3.11.0/tf.js"),tfBackendWasmUrl:"".concat(t,"tfjs/3.11.0/backend-wasm.js"),tfBackendCpuUrl:"".concat(t,"tfjs/3.11.0/backend-cpu.js"),tfBackendWebGlUrl:"".concat(t,"tfjs/3.11.0/backend-webgl.js"),tfLiteUrl:"".concat(t,"tflite/0.0.1-alpha.7/tflite.min.js"),blazefaceScriptUrl:"".concat(t,"blazeface/0.0.7/bf.js")},null==n?void 0:n.tfScriptUrls)}):jr(n)}var zr=t.createContext();function Kr(e){var r=e.value,n=e.children,o=W({},r),a=o.customUrls,i=o.resourceRoot;return i&&(o.customUrls=Vr({resourceRoot:i,initCustomUrls:a})),t.createElement(zr.Provider,{value:o},n)}function Hr(){var e=a(zr);if(void 0===e)throw new Error("useSDKSettings must be used within a SDKSettingsProvider");return e}Kr.propTypes={value:p.shape({lang:p.string,assetRoot:p.string,apiClient:p.shape({}),customUrls:p.shape({}),resourceRoot:p.string}).isRequired,children:p.node.isRequired};var qr,Qr=Object.freeze({__proto__:null,SDKSettingsProvider:Kr,useSDKSettings:Hr}),Wr=function(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}(Object.freeze({__proto__:null,default:{}})),Gr=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(ie((function(e,t){!function(e,t){t=t&&t.hasOwnProperty("default")?t.default:t;var r=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/read_id_card_info_sync",e,t)},e}(),n=function(){return(n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};
|
|
3
3
|
/*! *****************************************************************************
|
|
4
4
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
5
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -13,7 +13,7 @@ import t,{useRef as r,useMemo as n,useCallback as o,useContext as a,Component as
|
|
|
13
13
|
|
|
14
14
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
15
15
|
and limitations under the License.
|
|
16
|
-
***************************************************************************** */function o(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==("undefined"==typeof Reflect?"undefined":w(Reflect))&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){if("object"==("undefined"==typeof Reflect?"undefined":w(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function i(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))}function s(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}var c=function(){function e(e){this.httpClient=e}return e.prototype.uploadImage=function(e){return this.httpClient.postFormData("/v1/images",e)},e.prototype.request=function(e){var t="application/pdf"===e.file.type;return this.httpClient.postFormData(t?"/v1/files":"/v1/images",e)},e.prototype.requestWithHeaders=function(e,t){return this.httpClient.postFormData("/v1/images",e,t)},e.prototype.download=function(e){return i(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return[4,this.httpClient.downloadFile("/v1/images/"+e)];case 1:return t=r.sent(),[4,URL.createObjectURL(t)];case 2:return[2,r.sent()]}}))}))},e.prototype.updateMetadata=function(e,t){return this.httpClient.patch("/v1/images/"+e,t)},e}(),l=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/files",e,t)},e.prototype.uploadFile=function(e){return this.httpClient.postFormData("/v1/files",e)},e.prototype.requestWithHeaders=function(e,t){return this.httpClient.postFormData("/v1/files",e,t)},e}(),u=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/compare_faces_sync",e,t)},e}(),d=function(){function e(e){this.httpClient=e}return e.prototype.getClientSettings=function(){return this.httpClient.get("/v1/client_settings")},e.prototype.request=function(){return this.httpClient.get("/v1/client_settings")},e}(),f=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_face_liveness_sync",e,t)},e}(),p=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_id_card_sanity_sync",e,t)},e}(),h=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_portrait_sanity_sync",e,t)},e}(),m=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/detect_id_card_tampering_sync",e,t)},e.prototype.requestWithAuthHeaders=function(e,t){return this.httpClient.post("/v1/detect_id_card_tampering_sync",e,t)},e}(),g=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/search_faces_sync",e,t)},e.prototype.indexFaces=function(e,t){return this.httpClient.post("/v1/index_faces_sync",e,t)},e.prototype.deleteFaces=function(e,t){return this.httpClient.post("/v1/delete_faces",e,t)},e.prototype.downloadFaceImage=function(e){return i(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return[4,this.httpClient.downloadFile("/v1/face_images/"+e)];case 1:return t=r.sent(),[2,URL.createObjectURL(t)]}}))}))},e}(),v=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.postFormData("/v1/convert_pdf_sync",e,t)},e}(),y=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/ekyc_pdf",e,t)},e}(),b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==ae?ae:"undefined"!=typeof self?self:{};function C(e,t){return e(t={exports:{}},t.exports),t.exports}var k=C((function(e){var t,r;t=b,r=function(){function e(e){var t=[];if(0===e.length)return"";if("string"!=typeof e[0])throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var r=e.shift();e[0]=r+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n<e.length;n++){var o=e[n];if("string"!=typeof o)throw new TypeError("Url must be a string. Received "+o);""!==o&&(n>0&&(o=o.replace(/^[\/]+/,"")),o=n<e.length-1?o.replace(/[\/]+$/,""):o.replace(/[\/]+$/,"/"),t.push(o))}var a=t.join("/"),i=(a=a.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return i.shift()+(i.length>0?"?":"")+i.join("&")}return function(){return e("object"==w(arguments[0])?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=r():t.urljoin=r()}));function B(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var E=function(e,t,r,n){t=t||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var i=1e3;n&&"number"==typeof n.maxKeys&&(i=n.maxKeys);var s=e.length;i>0&&s>i&&(s=i);for(var c=0;c<s;++c){var l,u,d,f,p=e[c].replace(a,"%20"),h=p.indexOf(r);h>=0?(l=p.substr(0,h),u=p.substr(h+1)):(l=p,u=""),d=decodeURIComponent(l),f=decodeURIComponent(u),B(o,d)?Array.isArray(o[d])?o[d].push(f):o[d]=[o[d],f]:o[d]=f}return o},S=function(e){switch(w(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},A=function(e,t,r,n){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==w(e)?Object.keys(e).map((function(n){var o=encodeURIComponent(S(n))+r;return Array.isArray(e[n])?e[n].map((function(e){return o+encodeURIComponent(S(e))})).join(t):o+encodeURIComponent(S(e[n]))})).join(t):n?encodeURIComponent(S(n))+r+encodeURIComponent(S(e)):""},_=C((function(e,t){t.decode=t.parse=E,t.encode=t.stringify=A})),I=(_.decode,_.parse,_.encode,_.stringify),T=function(){function e(e){this.authorizer=e.authorizer,this.domain=e.domain,this.onError=e.onError,this.configHeaders=e.headers}return e.prototype.get=function(e,t,r){var n=new URL(this.resolveUrl(e));return t&&(n.search=I(t)),this.request(n.toString(),{requestPath:e,method:"GET",headers:r})},e.prototype.post=function(e,t,r){var o=this.resolveUrl(e);return this.request(o,{requestPath:e,method:"POST",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.postFormData=function(e,t,r){var n,o=t instanceof FormData?t:(n=t,Object.entries(n).reduce((function(e,t){var r=t[0],n=t[1];return Array.isArray(n)?n.forEach((function(t,o){return e.append(r+"["+o+"]",n)})):!(n instanceof Object)||n instanceof File||n instanceof Date||n instanceof Blob?e.append(r,n):Object.entries(n).forEach((function(t,o){return e.append(r+"["+o+"]",n[o])})),e}),new FormData)),a=this.resolveUrl(e);return this.request(a,{requestPath:e,method:"POST",body:o,headers:r})},e.prototype.patch=function(e,t,r){var o=this.resolveUrl(e);return this.request(o,{requestPath:e,method:"PATCH",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.delete=function(e,t,r){var o=this.resolveUrl(e);return this.request(o,{requestPath:e,method:"DELETE",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.downloadFile=function(e){var t=this.resolveUrl(e);return this.request(t,{requestPath:e,method:"GET"},"blob")},e.prototype.request=function(e,t,r){return void 0===r&&(r="json"),i(this,void 0,void 0,(function(){var o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return o={},a={},this.authorizer&&(o=this.authorizer.getHeaders(t)),this.configHeaders&&(a=this.configHeaders),t.headers=n(n(n({},t.headers),o),a),[4,fetch(e,t)];case 1:return i=s.sent(),[4,"blob"===r?i.blob():i.json()];case 2:if((c=s.sent()).errors&&this.onError)throw this.onError(c.errors),c;return[2,c]}}))}))},e.prototype.resolveUrl=function(e){return k(this.domain,e)},e}(),P=function(){function e(e){this.mocks=e}return e.prototype.get=function(e,t){return this.findInMocks(e,t)},e.prototype.post=function(e,t){return this.findInMocks(e)},e.prototype.postFormData=function(e,t){return this.findInMocks(e)},e.prototype.patch=function(e,t){return this.findInMocks(e)},e.prototype.delete=function(e,t){return this.findInMocks(e)},e.prototype.downloadFile=function(e){return this.findInMocks(e)},e.prototype.resolveUrl=function(e){return this.mocks.resolveUrl?this.mocks.resolveUrl(e):e},e.prototype.findInMocks=function(e,t){return i(this,void 0,void 0,(function(){return s(this,(function(r){return this.mocks[e]?"function"==typeof this.mocks[e]?[2,Promise.resolve(this.mocks[e](t))]:[2,Promise.resolve(this.mocks[e])]:[2,Promise.reject(new Error(e+" is not presented in mocks"))]}))}))},e}(),x=C((function(e,t){var r;e.exports=r=r||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},o=n.lib={},a=o.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},i=o.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<o;a++){var i=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=i<<24-(n+a)%4*8}else for(a=0;a<o;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],o=function(t){t=t;var r=987654321,n=4294967295;return function(){var o=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return o/=4294967296,(o+=.5)*(e.random()>.5?1:-1)}},a=0;a<t;a+=4){var s=o(4294967296*(r||e.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new i.init(n,t)}}),s=n.enc={},c=s.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var a=t[o>>>2]>>>24-o%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new i.init(r,t/2)}},l=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var a=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new i.init(r,t)}},u=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},d=o.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,o=r.sigBytes,a=this.blockSize,s=o/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,o);if(c){for(var u=0;u<c;u+=a)this._doProcessBlock(n,u);var d=n.splice(0,c);r.sigBytes-=l}return new i.init(d,l)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(o.Hasher=d.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}}),n.algo={});return n}(Math)})),R=C((function(e,t){var r,n,o;e.exports=(n=(r=o=x).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],a=0;a<r;a+=3)for(var i=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)o.push(n.charAt(i>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a<r.length;a++)o[r.charCodeAt(a)]=a}var i=r.charAt(64);if(i){var s=e.indexOf(i);-1!==s&&(t=s)}return function(e,t,r){for(var o=[],a=0,i=0;i<t;i++)if(i%4){var s=r[e.charCodeAt(i-1)]<<i%4*2,c=r[e.charCodeAt(i)]>>>6-i%4*2;o[a>>>2]|=(s|c)<<24-a%4*8,a++}return n.create(o,a)}(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)})),N=(C((function(e,t){var r;e.exports=(r=x,function(e){var t=r,n=t.lib,o=n.WordArray,a=n.Hasher,i=t.algo,s=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)t(n)&&(o<8&&(s[o]=r(e.pow(n,.5))),c[o]=r(e.pow(n,1/3)),o++),n++}();var l=[],u=i.SHA256=a.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],a=r[2],i=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=0;p<64;p++){if(p<16)l[p]=0|e[t+p];else{var h=l[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,g=l[p-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;l[p]=m+l[p-7]+v+l[p-16]}var y=n&o^n&a^o&a,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),C=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&u^~s&d)+c[p]+l[p];f=d,d=u,u=s,s=i+C|0,i=a,a=o,o=n,n=C+(b+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+a|0,r[3]=r[3]+i|0,r[4]=r[4]+s|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=e.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=a._createHelper(u),t.HmacSHA256=a._createHmacHelper(u)}(Math),r.SHA256)})),C((function(e,t){var r,n,o;e.exports=(n=(r=x).lib.Base,o=r.enc.Utf8,void(r.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),i=this._iKey=t.clone(),s=a.words,c=i.words,l=0;l<r;l++)s[l]^=1549556828,c[l]^=909522486;a.sigBytes=i.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))})),C((function(e,t){e.exports=x.HmacSHA256}))),L=function(){function e(e,t){this.accessKey=e,this.keySecret=t}return e.prototype.getHeaders=function(e){var t=function(e){function t(e){return e<10?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+"T"+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+(0===(r=e.getTimezoneOffset())?"Z":(n=r>0?"-":"+",r=Math.abs(r),n+t(Math.floor(r/60))+":"+t(r%60)));var r,n}(new Date);return{Authorization:this.generateAuthorization(e.requestPath,e.method,t),"X-TV-Timestamp":t}},e.prototype.generateAuthorization=function(e,t,r){var n=this.computeStringToSign(e,t,r),o=R.stringify(this.computeSignature(n));return this.formatAuthToken("TV",o)},e.prototype.formatAuthToken=function(e,t){return e+" "+this.accessKey+":"+t},e.prototype.computeStringToSign=function(e,t,r){return t+"\n"+e+"\n"+r},e.prototype.computeSignature=function(e){return N(e,this.keySecret)},e}();function O(e){switch(e){case"testing":return"https://tv-testing.trustingsocial.com/api";case"staging":return"https://tv-staging.trustingsocial.com/api";case"production":return"https://vn-vision.trustingsocial.com/api";default:return e}}function D(e,t,r,n){void 0===r&&(r="production");var o=(void 0===n?{}:n).headers,a=new L(e,t),i=O(r);return new T({authorizer:a,domain:i,headers:o})}var M=function(){function e(e){void 0===e&&(e="production");var t=new T({domain:O(e)});this.imagesService=new c(t),this.detectIDTamperingService=new m(t)}return e.prototype.uploadImage=function(e,t){return this.imagesService.requestWithHeaders(e,t)},e.prototype.detectTampering=function(e,t){return this.detectIDTamperingService.requestWithAuthHeaders(e,t)},e}();function U(e){var t=e.headerIndex;return function(e,r,o){var a=o.value,c=n({},o);return c.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return i(this,void 0,void 0,(function(){var r,o,i,c;return s(this,(function(s){switch(s.label){case 0:return this.transactionEnabled?[4,this.transactionManager.begin()]:[3,4];case 1:return r=s.sent(),o=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var a=arguments[t],i=0,s=a.length;i<s;i++,o++)n[o]=a[i];return n}(e),(i=n({},o[t]))["X-TV-Transaction"]=r,o[t]=i,[4,a.apply(this,o)];case 2:return c=s.sent(),[4,this.transactionManager.end()];case 3:return s.sent(),[2,c];case 4:return[4,a.apply(this,e)];case 5:return[2,s.sent()]}}))}))},c}}function j(e){return void 0===e&&(e={encryptedField:"data"}),function(t,r,o){var a=o.value,c=n({},o);return c.value=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return i(this,void 0,void 0,(function(){var r,n;return s(this,(function(o){switch(o.label){case 0:return[4,a.apply(this,t)];case 1:return r=o.sent(),this.encryptionEnabled&&"string"==typeof r[e.encryptedField]?(n=this.encryptionService.decrypt(r[e.encryptedField],{transactionID:this.transactionManager.currentTransactionID}),[2,JSON.parse(n)]):[2,r]}}))}))},c}}var F=function(){function e(e){this.httpClient=e,this.transactionID="",this.totalTransactions=0,this.currentTransaction=0}return Object.defineProperty(e.prototype,"currentTransactionID",{get:function(){return this.transactionID},enumerable:!0,configurable:!0}),e.prototype.begin=function(){return i(this,void 0,void 0,(function(){var e,t,r=this;return s(this,(function(n){switch(n.label){case 0:return e=this.totalTransactions++,[4,new Promise((function(t,n){var o=window.performance.now(),a=setInterval((function(){e===r.currentTransaction&&(clearInterval(a),t(!0)),window.performance.now()-o>=3e3&&(clearInterval(a),n(new Error("Transaction timeout")))}),100)}))];case 1:return n.sent(),[4,this.httpClient.post("/v1/transactions",{})];case 2:return t=n.sent().data,this.transactionID=t.id,[2,t.id]}}))}))},e.prototype.end=function(){return i(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return[4,this.httpClient.post("/v1/transactions/"+this.transactionID+"/finish")];case 1:return e=t.sent(),this.transactionID="",this.currentTransaction++,[2,e]}}))}))},e}(),V={options:{usePureJavaScript:!1}},z={},K=z,H={};z.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var o=0,a=t.length,i=t.charAt(0),s=[0];for(o=0;o<e.length;++o){for(var c=0,l=e[o];c<s.length;++c)l+=s[c]<<8,s[c]=l%a,l=l/a|0;for(;l>0;)s.push(l%a),l=l/a|0}for(o=0;0===e[o]&&o<e.length-1;++o)n+=i;for(o=s.length-1;o>=0;--o)n+=t[s[o]]}else n=function(e,t){var r=0,n=t.length,o=t.charAt(0),a=[0];for(r=0;r<e.length();++r){for(var i=0,s=e.at(r);i<a.length;++i)s+=a[i]<<8,a[i]=s%n,s=s/n|0;for(;s>0;)a.push(s%n),s=s/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=o;for(r=a.length-1;r>=0;--r)c+=t[a[r]];return c}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join("\r\n")}return n},z.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var r=H[t];if(!r){r=H[t]=[];for(var n=0;n<t.length;++n)r[t.charCodeAt(n)]=n}e=e.replace(/\s/g,"");var o=t.length,a=t.charAt(0),i=[0];for(n=0;n<e.length;n++){var s=r[e.charCodeAt(n)];if(void 0===s)return;for(var c=0,l=s;c<i.length;++c)l+=i[c]*o,i[c]=255&l,l>>=8;for(;l>0;)i.push(255&l),l>>=8}for(var u=0;e[u]===a&&u<e.length-1;++u)i.push(0);return"undefined"!=typeof Buffer?Buffer.from(i.reverse()):new Uint8Array(i.reverse())},C((function(e){var t=e.exports=V.util=V.util||{};function r(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function n(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(t.isArrayBuffer(e)||t.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var r=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,r)}catch(e){for(var o=0;o<r.length;++o)this.putByte(r[o])}}else(e instanceof n||"object"==w(e)&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return t.nextTick=process.nextTick,void("function"==typeof setImmediate?t.setImmediate=setImmediate:t.setImmediate=t.nextTick);if("function"==typeof setImmediate)return t.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(t.nextTick=function(e){return setImmediate(e)});if(t.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",r=[];t.setImmediate=function(t){r.push(t),1===r.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(t){if(t.source===window&&t.data===e){t.stopPropagation();var n=r.slice();r.length=0,n.forEach((function(e){e()}))}}),!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),o=!0,a=document.createElement("div");r=[],new MutationObserver((function(){var e=r.slice();r.length=0,e.forEach((function(e){e()}))})).observe(a,{attributes:!0});var i=t.setImmediate;t.setImmediate=function(e){Date.now()-n>15?(n=Date.now(),i(e)):(r.push(e),1===r.length&&a.setAttribute("a",o=!o))}}t.nextTick=t.setImmediate}(),t.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,t.globalScope=t.isNodejs?b:"undefined"==typeof self?window:self,t.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},t.isArrayBufferView=function(e){return e&&t.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},t.ByteBuffer=n,t.ByteStringBuffer=n,t.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},t.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},t.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},t.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},t.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},t.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},t.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(t.encodeUtf8(e))},t.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},t.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},t.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},t.ByteStringBuffer.prototype.putInt=function(e,t){r(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},t.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},t.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},t.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},t.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},t.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},t.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},t.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},t.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},t.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},t.ByteStringBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},t.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},t.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},t.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},t.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},t.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},t.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},t.ByteStringBuffer.prototype.copy=function(){var e=t.createBuffer(this.data);return e.read=this.read,e},t.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},t.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},t.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},t.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},t.ByteStringBuffer.prototype.toString=function(){return t.decodeUtf8(this.bytes())},t.DataBuffer=function(e,r){r=r||{},this.read=r.readOffset||0,this.growSize=r.growSize||1024;var n=t.isArrayBuffer(e),o=t.isArrayBufferView(e);if(n||o)return this.data=n?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in r?r.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in r&&(this.write=r.writeOffset)},t.DataBuffer.prototype.length=function(){return this.write-this.read},t.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},t.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},t.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},t.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},t.DataBuffer.prototype.putBytes=function(e,r){if(t.isArrayBufferView(e)){var n=(o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-o.byteOffset;return this.accommodate(n),new Uint8Array(this.data.buffer,this.write).set(o),this.write+=n,this}if(t.isArrayBuffer(e)){var o=new Uint8Array(e);return this.accommodate(o.byteLength),new Uint8Array(this.data.buffer).set(o,this.write),this.write+=o.byteLength,this}if(e instanceof t.DataBuffer||"object"==w(e)&&"number"==typeof e.read&&"number"==typeof e.write&&t.isArrayBufferView(e.data))return o=new Uint8Array(e.data.byteLength,e.read,e.length()),this.accommodate(o.byteLength),new Uint8Array(e.data.byteLength,this.write).set(o),this.write+=o.byteLength,this;if(e instanceof t.ByteStringBuffer&&(e=e.data,r="binary"),r=r||"binary","string"==typeof e){var a;if("hex"===r)return this.accommodate(Math.ceil(e.length/2)),a=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.hex.decode(e,a,this.write),this;if("base64"===r)return this.accommodate(3*Math.ceil(e.length/4)),a=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.base64.decode(e,a,this.write),this;if("utf8"===r&&(e=t.encodeUtf8(e),r="binary"),"binary"===r||"raw"===r)return this.accommodate(e.length),a=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.raw.decode(a),this;if("utf16"===r)return this.accommodate(2*e.length),a=new Uint16Array(this.data.buffer,this.write),this.write+=t.text.utf16.encode(a),this;throw new Error("Invalid encoding: "+r)}throw Error("Invalid parameter: "+e)},t.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},t.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},t.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},t.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},t.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},t.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},t.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},t.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},t.DataBuffer.prototype.putInt=function(e,t){r(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},t.DataBuffer.prototype.putSignedInt=function(e,t){return r(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},t.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},t.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},t.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},t.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},t.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},t.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},t.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},t.DataBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},t.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},t.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},t.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},t.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},t.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},t.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},t.DataBuffer.prototype.copy=function(){return new t.DataBuffer(this)},t.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},t.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},t.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},t.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},t.DataBuffer.prototype.toString=function(e){var r=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return t.binary.raw.encode(r);if("hex"===e)return t.binary.hex.encode(r);if("base64"===e)return t.binary.base64.encode(r);if("utf8"===e)return t.text.utf8.decode(r);if("utf16"===e)return t.text.utf16.decode(r);throw new Error("Invalid encoding: "+e)},t.createBuffer=function(e,r){return r=r||"raw",void 0!==e&&"utf8"===r&&(e=t.encodeUtf8(e)),new t.ByteBuffer(e)},t.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},t.xorBytes=function(e,t,r){for(var n="",o="",a="",i=0,s=0;r>0;--r,++i)o=e.charCodeAt(i)^t.charCodeAt(i),s>=10&&(n+=a,a="",s=0),a+=String.fromCharCode(o),++s;return n+a},t.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},t.bytesToHex=function(e){return t.createBuffer(e).toHex()},t.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],i="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";t.encode64=function(e,t){for(var r,n,a,i="",s="",c=0;c<e.length;)r=e.charCodeAt(c++),n=e.charCodeAt(c++),a=e.charCodeAt(c++),i+=o.charAt(r>>2),i+=o.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=o.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":o.charAt(63&a)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+i},t.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,o,i="",s=0;s<e.length;)t=a[e.charCodeAt(s++)-43],r=a[e.charCodeAt(s++)-43],n=a[e.charCodeAt(s++)-43],o=a[e.charCodeAt(s++)-43],i+=String.fromCharCode(t<<2|r>>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==o&&(i+=String.fromCharCode((3&n)<<6|o)));return i},t.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},t.decodeUtf8=function(e){return decodeURIComponent(escape(e))},t.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:K.encode,decode:K.decode}},t.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},t.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var o=r=r||0,a=0;a<e.length;++a)n[o++]=e.charCodeAt(a);return t?o-r:n},t.binary.hex.encode=t.bytesToHex,t.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var o=0,a=r=r||0;for(1&e.length&&(o=1,n[a++]=parseInt(e[0],16));o<e.length;o+=2)n[a++]=parseInt(e.substr(o,2),16);return t?a-r:n},t.binary.base64.encode=function(e,t){for(var r,n,a,i="",s="",c=0;c<e.byteLength;)r=e[c++],n=e[c++],a=e[c++],i+=o.charAt(r>>2),i+=o.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=o.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":o.charAt(63&a)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+i},t.binary.base64.decode=function(e,t,r){var n,o,i,s,c=t;c||(c=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var l=0,u=r=r||0;l<e.length;)n=a[e.charCodeAt(l++)-43],o=a[e.charCodeAt(l++)-43],i=a[e.charCodeAt(l++)-43],s=a[e.charCodeAt(l++)-43],c[u++]=n<<2|o>>4,64!==i&&(c[u++]=(15&o)<<4|i>>2,64!==s&&(c[u++]=(3&i)<<6|s));return t?u-r:c.subarray(0,u)},t.binary.base58.encode=function(e,r){return t.binary.baseN.encode(e,i,r)},t.binary.base58.decode=function(e,r){return t.binary.baseN.decode(e,i,r)},t.text={utf8:{},utf16:{}},t.text.utf8.encode=function(e,r,n){e=t.encodeUtf8(e);var o=r;o||(o=new Uint8Array(e.length));for(var a=n=n||0,i=0;i<e.length;++i)o[a++]=e.charCodeAt(i);return r?a-n:o},t.text.utf8.decode=function(e){return t.decodeUtf8(String.fromCharCode.apply(null,e))},t.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var o=new Uint16Array(n.buffer),a=r=r||0,i=r,s=0;s<e.length;++s)o[i++]=e.charCodeAt(s),a+=2;return t?a-r:n},t.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},t.deflate=function(e,r,n){if(r=t.decode64(e.deflate(t.encode64(r)).rval),n){var o=2;32&r.charCodeAt(1)&&(o=6),r=r.substring(o,r.length-4)}return r},t.inflate=function(e,r,n){var o=e.inflate(t.encode64(r)).rval;return null===o?null:t.decode64(o)};var s=function(e,r,n){if(!e)throw new Error("WebStorage not available.");var o;if(null===n?o=e.removeItem(r):(n=t.encode64(JSON.stringify(n)),o=e.setItem(r,n)),void 0!==o&&!0!==o.rval){var a=new Error(o.error.message);throw a.id=o.error.id,a.name=o.error.name,a}},c=function(e,r){if(!e)throw new Error("WebStorage not available.");var n=e.getItem(r);if(e.init)if(null===n.rval){if(n.error){var o=new Error(n.error.message);throw o.id=n.error.id,o.name=n.error.name,o}n=null}else n=n.rval;return null!==n&&(n=JSON.parse(t.decode64(n))),n},l=function(e,t,r,n){var o=c(e,t);null===o&&(o={}),o[r]=n,s(e,t,o)},u=function(e,t,r){var n=c(e,t);return null!==n&&(n=r in n?n[r]:null),n},d=function(e,t,r){var n=c(e,t);if(null!==n&&r in n){delete n[r];var o=!0;for(var a in n){o=!1;break}o&&(n=null),s(e,t,n)}},f=function(e,t){s(e,t,null)},p=function(e,t,r){var n,o=null;void 0===r&&(r=["web","flash"]);var a=!1,i=null;for(var s in r){n=r[s];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");o=e.apply(this,t),a="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,o=e.apply(this,t),a=!0)}catch(e){i=e}if(a)break}if(!a)throw i;return o};t.setItem=function(e,t,r,n,o){p(l,arguments,o)},t.getItem=function(e,t,r,n){return p(u,arguments,n)},t.removeItem=function(e,t,r,n){p(d,arguments,n)},t.clearItems=function(e,t,r){p(f,arguments,r)},t.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),n=null===r?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?(80!==n.port&&"http"===n.scheme||443!==n.port&&"https"===n.scheme)&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var h=null;t.getQueryVariables=function(e){var t,r=function(e){for(var t={},r=e.split("&"),n=0;n<r.length;n++){var o,a,i=r[n].indexOf("=");i>0?(o=r[n].substring(0,i),a=r[n].substring(i+1)):(o=r[n],a=null),o in t||(t[o]=[]),o in Object.prototype||null===a||t[o].push(unescape(a))}return t};return void 0===e?(null===h&&(h="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=h):t=r(e),t},t.parseFragment=function(e){var r=e,n="",o=e.indexOf("?");o>0&&(r=e.substring(0,o),n=e.substring(o+1));var a=r.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:r,queryString:n,path:a,query:""===n?{}:t.getQueryVariables(n)}},t.makeRequest=function(e){var r=t.parseFragment(e),n={path:r.pathString,query:r.queryString,getPath:function(e){return void 0===e?r.path:r.path[e]},getQuery:function(e,t){var n;return void 0===e?n=r.query:(n=r.query[e])&&void 0!==t&&(n=n[t]),n},getQueryLast:function(e,t){var r=n.getQuery(e);return r?r[r.length-1]:t}};return n},t.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},t.setPath=function(e,t,r){if("object"==w(e)&&null!==e)for(var n=0,o=t.length;n<o;){var a=t[n++];if(n==o)e[a]=r;else{var i=a in e;(!i||i&&"object"!=w(e[a])||i&&null===e[a])&&(e[a]={}),e=e[a]}}},t.getPath=function(e,t,r){for(var n=0,o=t.length,a=!0;a&&n<o&&"object"==w(e)&&null!==e;){var i=t[n++];(a=i in e)&&(e=e[i])}return a?e:r},t.deletePath=function(e,t){if("object"==w(e)&&null!==e)for(var r=0,n=t.length;r<n;){var o=t[r++];if(r==n)delete e[o];else{if(!(o in e)||"object"!=w(e[o])||null===e[o])break;e=e[o]}}},t.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},t.format=function(e){for(var t,r,n=/%./g,o=0,a=[],i=0;t=n.exec(e);){(r=e.substring(i,n.lastIndex-2)).length>0&&a.push(r),i=n.lastIndex;var s=t[0][1];switch(s){case"s":case"o":o<arguments.length?a.push(arguments[1+o++]):a.push("<?>");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(e.substring(i)),a.join("")},t.formatNumber=function(e,t,r,n){var o=e,a=isNaN(t=Math.abs(t))?2:t,i=void 0===r?",":r,s=void 0===n?".":n,c=o<0?"-":"",l=parseInt(o=Math.abs(+o||0).toFixed(a),10)+"",u=l.length>3?l.length%3:0;return c+(u?l.substr(0,u)+s:"")+l.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?i+Math.abs(o-l).toFixed(a).slice(2):"")},t.formatSize=function(e){return e>=1073741824?t.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?t.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?t.formatNumber(e/1024,0)+" KiB":t.formatNumber(e,0)+" bytes"},t.bytesFromIP=function(e){return-1!==e.indexOf(".")?t.bytesFromIPv4(e):-1!==e.indexOf(":")?t.bytesFromIPv6(e):null},t.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var r=t.createBuffer(),n=0;n<e.length;++n){var o=parseInt(e[n],10);if(isNaN(o))return null;r.putByte(o)}return r.getBytes()},t.bytesFromIPv6=function(e){for(var r=0,n=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++r,!0}))).length+r),o=t.createBuffer(),a=0;a<8;++a)if(e[a]&&0!==e[a].length){var i=t.hexToBytes(e[a]);i.length<2&&o.putByte(0),o.putBytes(i)}else o.fillWithByte(0,n),n=0;return o.getBytes()},t.bytesToIP=function(e){return 4===e.length?t.bytesToIPv4(e):16===e.length?t.bytesToIPv6(e):null},t.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},t.bytesToIPv6=function(e){if(16!==e.length)return null;for(var r=[],n=[],o=0,a=0;a<e.length;a+=2){for(var i=t.bytesToHex(e[a]+e[a+1]);"0"===i[0]&&"0"!==i;)i=i.substr(1);if("0"===i){var s=n[n.length-1],c=r.length;s&&c===s.end+1?(s.end=c,s.end-s.start>n[o].end-n[o].start&&(o=n.length-1)):n.push({start:c,end:c})}r.push(i)}if(n.length>0){var l=n[o];l.end-l.start>0&&(r.splice(l.start,l.end-l.start+1,""),0===l.start&&r.unshift(""),7===l.end&&r.push(""))}return r.join(":")},t.estimateCores=function(e,r){if("function"==typeof e&&(r=e,e={}),e=e||{},"cores"in t&&!e.update)return r(null,t.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return t.cores=navigator.hardwareConcurrency,r(null,t.cores);if("undefined"==typeof Worker)return t.cores=1,r(null,t.cores);if("undefined"==typeof Blob)return t.cores=2,r(null,t.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){var t=Date.now(),r=t+4;self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(o,a,i){if(0===a){var s=Math.floor(o.reduce((function(e,t){return e+t}),0)/o.length);return t.cores=Math.max(1,s),URL.revokeObjectURL(n),r(null,t.cores)}!function(e,t){for(var r=[],o=[],a=0;a<e;++a){var i=new Worker(n);i.addEventListener("message",(function(n){if(o.push(n.data),o.length===e){for(var a=0;a<e;++a)r[a].terminate();t(null,o)}})),r.push(i)}for(a=0;a<e;++a)r[a].postMessage(a)}(i,(function(t,r){o.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var o=t[n],a=r[n]=[],i=0;i<e;++i)if(n!==i){var s=t[i];(o.st>s.st&&o.st<s.et||s.st>o.st&&s.st<o.et)&&a.push(i)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(i,r)),e(o,a-1,i)}))}([],5,16)}})),V.cipher=V.cipher||{},V.cipher.algorithms=V.cipher.algorithms||{},V.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=V.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new V.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},V.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=V.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new V.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},V.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),V.cipher.algorithms[e]=t},V.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in V.cipher.algorithms?V.cipher.algorithms[e]:null};var q=V.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};function Q(e,t){V.cipher.registerAlgorithm(e,(function(){return new V.aes.Algorithm(e,t)}))}q.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=V.util.createBuffer(),this.output=e.output||V.util.createBuffer(),this.mode.start(t)},q.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},q.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))},C((function(e){V.cipher=V.cipher||{};var t=e.exports=V.cipher.modes=V.cipher.modes||{};function r(e,t){if("string"==typeof e&&(e=V.util.createBuffer(e)),V.util.isArray(e)&&e.length>4){var r=e;e=V.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!V.util.isArray(e)){var o=[],a=t/4;for(n=0;n<a;++n)o.push(e.getInt32());e=o}return e}function n(e){e[e.length-1]=e[e.length-1]+1&4294967295}function o(e){return[e/4294967296|0,4294967295&e]}t.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.ecb.prototype.start=function(e){},t.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},t.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},t.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},t.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},t.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},t.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},t.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},t.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=V.util.createBuffer(),this._partialBytes=0},t.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)this._inBlock[o]=e.getInt32()^this._outBlock[o],t.putInt32(this._inBlock[o]);else{var a=(this.blockSize-n)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),o=0;o<this._ints;++o)this._partialBlock[o]=e.getInt32()^this._outBlock[o],this._partialOutput.putInt32(this._partialBlock[o]);if(a>0)e.read-=this.blockSize;else for(o=0;o<this._ints;++o)this._inBlock[o]=this._partialBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)this._inBlock[o]=e.getInt32(),t.putInt32(this._inBlock[o]^this._outBlock[o]);else{var a=(this.blockSize-n)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),o=0;o<this._ints;++o)this._partialBlock[o]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[o]^this._outBlock[o]);if(a>0)e.read-=this.blockSize;else for(o=0;o<this._ints;++o)this._inBlock[o]=this._partialBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=V.util.createBuffer(),this._partialBytes=0},t.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)t.putInt32(e.getInt32()^this._outBlock[o]),this._inBlock[o]=this._outBlock[o];else{var a=(this.blockSize-n)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(a>0)e.read-=this.blockSize;else for(o=0;o<this._ints;++o)this._inBlock[o]=this._outBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.ofb.prototype.decrypt=t.ofb.prototype.encrypt,t.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=V.util.createBuffer(),this._partialBytes=0},t.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ctr.prototype.encrypt=function(e,t,r){var o=e.length();if(0===o)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&o>=this.blockSize)for(var a=0;a<this._ints;++a)t.putInt32(e.getInt32()^this._outBlock[a]);else{var i=(this.blockSize-o)%this.blockSize;for(i>0&&(i=this.blockSize-i),this._partialOutput.clear(),a=0;a<this._ints;++a)this._partialOutput.putInt32(e.getInt32()^this._outBlock[a]);if(i>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=0}n(this._inBlock)},t.ctr.prototype.decrypt=t.ctr.prototype.encrypt,t.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=V.util.createBuffer(),this._partialBytes=0,this._R=3774873600},t.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=V.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?V.util.createBuffer(e.additionalData):V.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=V.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var a=r.length();if(12===a)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*a)))}this._inBlock=this._j0.slice(0),n(this._inBlock),this._partialBytes=0,t=V.util.createBuffer(t),this._aDataLength=o(8*t.length());var i=t.length()%this.blockSize;for(i&&t.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},t.gcm.prototype.encrypt=function(e,t,r){var o=e.length();if(0===o)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&o>=this.blockSize){for(var a=0;a<this._ints;++a)t.putInt32(this._outBlock[a]^=e.getInt32());this._cipherLength+=this.blockSize}else{var i=(this.blockSize-o)%this.blockSize;for(i>0&&(i=this.blockSize-i),this._partialOutput.clear(),a=0;a<this._ints;++a)this._partialOutput.putInt32(e.getInt32()^this._outBlock[a]);if(i<=0||r){if(r){var s=o%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}else this._cipherLength+=this.blockSize;for(a=0;a<this._ints;++a)this._outBlock[a]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),n(this._inBlock)},t.gcm.prototype.decrypt=function(e,t,r){var o=e.length();if(o<this.blockSize&&!(r&&o>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),n(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var a=0;a<this._ints;++a)t.putInt32(this._outBlock[a]^this._hashBlock[a]);o<this.blockSize?this._cipherLength+=o%this.blockSize:this._cipherLength+=this.blockSize},t.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=V.util.createBuffer();var n=this._aDataLength.concat(o(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,n);var a=[];this.cipher.encrypt(this._j0,a);for(var i=0;i<this._ints;++i)this.tag.putInt32(this._s[i]^a[i]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},t.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),o=0;o<128;++o)e[o/32|0]&1<<31-o%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n);return r},t.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},t.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,o=this._m[r][n];t[0]^=o[0],t[1]^=o[1],t[2]^=o[2],t[3]^=o[3]}return t},t.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},t.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,o=16*r,a=new Array(o),i=0;i<o;++i){var s=[0,0,0,0],c=(n-1-i%n)*t;s[i/n|0]=1<<t-1<<c,a[i]=this.generateSubHashTable(this.multiply(s,e),t)}return a},t.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,o=new Array(r);o[n]=e.slice(0);for(var a=n>>>1;a>0;)this.pow(o[2*a],o[a]=[]),a>>=1;for(a=2;a<n;){for(var i=1;i<a;++i){var s=o[a],c=o[i];o[a+i]=[s[0]^c[0],s[1]^c[1],s[2]^c[2],s[3]^c[3]]}a*=2}for(o[0]=[0,0,0,0],a=n+1;a<r;++a){var l=o[a^n];o[a]=[e[0]^l[0],e[1]^l[1],e[2]^l[2],e[3]^l[3]]}return o}})),V.aes=V.aes||{},V.aes.startEncrypting=function(e,t,r,n){var o=re({key:e,output:r,decrypt:!1,mode:n});return o.start(t),o},V.aes.createEncryptionCipher=function(e,t){return re({key:e,output:null,decrypt:!1,mode:t})},V.aes.startDecrypting=function(e,t,r,n){var o=re({key:e,output:r,decrypt:!0,mode:n});return o.start(t),o},V.aes.createDecryptionCipher=function(e,t){return re({key:e,output:null,decrypt:!0,mode:t})},V.aes.Algorithm=function(e,t){Z||J();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return te(r._w,e,t,!1)},decrypt:function(e,t){return te(r._w,e,t,!0)}}}),r._init=!1},V.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(V.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=V.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}}else r=V.util.createBuffer(r);if(!V.util.isArray(r)){t=r,r=[];var o=t.length();if(16===o||24===o||32===o)for(o>>>=2,n=0;n<o;++n)r.push(t.getInt32())}if(!V.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var a=this.mode.name,i=-1!==["CFB","OFB","CTR","GCM"].indexOf(a);this._w=ee(r,e.decrypt&&!i),this._init=!0}},V.aes._expandKey=function(e,t){return Z||J(),ee(e,t)},V.aes._updateBlock=te,Q("AES-ECB",V.cipher.modes.ecb),Q("AES-CBC",V.cipher.modes.cbc),Q("AES-CFB",V.cipher.modes.cfb),Q("AES-OFB",V.cipher.modes.ofb),Q("AES-CTR",V.cipher.modes.ctr),Q("AES-GCM",V.cipher.modes.gcm);var W,G,X,Y,$,Z=!1;function J(){Z=!0,X=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;for(W=new Array(256),G=new Array(256),Y=new Array(4),$=new Array(4),t=0;t<4;++t)Y[t]=new Array(256),$[t]=new Array(256);var r,n,o,a,i,s,c,l=0,u=0;for(t=0;t<256;++t){a=(a=u^u<<1^u<<2^u<<3^u<<4)>>8^255&a^99,W[l]=a,G[a]=l,s=(i=e[a])<<24^a<<16^a<<8^a^i,c=((r=e[l])^(n=e[r])^(o=e[n]))<<24^(l^o)<<16^(l^n^o)<<8^l^r^o;for(var d=0;d<4;++d)Y[d][l]=s,$[d][a]=c,s=s<<24|s>>>8,c=c<<24|c>>>8;0===l?l=u=1:(l=r^e[e[e[r^o]]],u^=e[e[u]])}}function ee(e,t){for(var r,n=e.slice(0),o=1,a=n.length,i=4*(a+6+1),s=a;s<i;++s)r=n[s-1],s%a==0?(r=W[r>>>16&255]<<24^W[r>>>8&255]<<16^W[255&r]<<8^W[r>>>24]^X[o]<<24,o++):a>6&&s%a==4&&(r=W[r>>>24]<<24^W[r>>>16&255]<<16^W[r>>>8&255]<<8^W[255&r]),n[s]=n[s-a]^r;if(t){for(var c,l=$[0],u=$[1],d=$[2],f=$[3],p=n.slice(0),h=(s=0,(i=n.length)-4);s<i;s+=4,h-=4)if(0===s||s===i-4)p[s]=n[h],p[s+1]=n[h+3],p[s+2]=n[h+2],p[s+3]=n[h+1];else for(var m=0;m<4;++m)c=n[h+m],p[s+(3&-m)]=l[W[c>>>24]]^u[W[c>>>16&255]]^d[W[c>>>8&255]]^f[W[255&c]];n=p}return n}function te(e,t,r,n){var o,a,i,s,c,l,u,d,f,p,h,m,g=e.length/4-1;n?(o=$[0],a=$[1],i=$[2],s=$[3],c=G):(o=Y[0],a=Y[1],i=Y[2],s=Y[3],c=W),l=t[0]^e[0],u=t[n?3:1]^e[1],d=t[2]^e[2],f=t[n?1:3]^e[3];for(var v=3,y=1;y<g;++y)p=o[l>>>24]^a[u>>>16&255]^i[d>>>8&255]^s[255&f]^e[++v],h=o[u>>>24]^a[d>>>16&255]^i[f>>>8&255]^s[255&l]^e[++v],m=o[d>>>24]^a[f>>>16&255]^i[l>>>8&255]^s[255&u]^e[++v],f=o[f>>>24]^a[l>>>16&255]^i[u>>>8&255]^s[255&d]^e[++v],l=p,u=h,d=m;r[0]=c[l>>>24]<<24^c[u>>>16&255]<<16^c[d>>>8&255]<<8^c[255&f]^e[++v],r[n?3:1]=c[u>>>24]<<24^c[d>>>16&255]<<16^c[f>>>8&255]<<8^c[255&l]^e[++v],r[2]=c[d>>>24]<<24^c[f>>>16&255]<<16^c[l>>>8&255]<<8^c[255&u]^e[++v],r[n?1:3]=c[f>>>24]<<24^c[l>>>16&255]<<16^c[u>>>8&255]<<8^c[255&d]^e[++v]}function re(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?V.cipher.createDecipher(r,e.key):V.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof V.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,n.call(t,r)},t}function ne(e,t){V.cipher.registerAlgorithm(e,(function(){return new V.des.Algorithm(e,t)}))}C((function(e){V.pki=V.pki||{};var t=e.exports=V.pki.oids=V.oids=V.oids||{};function r(e,r){t[e]=r,t[r]=e}function n(e,r){t[e]=r}r("1.2.840.113549.1.1.1","rsaEncryption"),r("1.2.840.113549.1.1.4","md5WithRSAEncryption"),r("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),r("1.2.840.113549.1.1.7","RSAES-OAEP"),r("1.2.840.113549.1.1.8","mgf1"),r("1.2.840.113549.1.1.9","pSpecified"),r("1.2.840.113549.1.1.10","RSASSA-PSS"),r("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),r("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),r("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),r("1.3.101.112","EdDSA25519"),r("1.2.840.10040.4.3","dsa-with-sha1"),r("1.3.14.3.2.7","desCBC"),r("1.3.14.3.2.26","sha1"),r("2.16.840.1.101.3.4.2.1","sha256"),r("2.16.840.1.101.3.4.2.2","sha384"),r("2.16.840.1.101.3.4.2.3","sha512"),r("1.2.840.113549.2.5","md5"),r("1.2.840.113549.1.7.1","data"),r("1.2.840.113549.1.7.2","signedData"),r("1.2.840.113549.1.7.3","envelopedData"),r("1.2.840.113549.1.7.4","signedAndEnvelopedData"),r("1.2.840.113549.1.7.5","digestedData"),r("1.2.840.113549.1.7.6","encryptedData"),r("1.2.840.113549.1.9.1","emailAddress"),r("1.2.840.113549.1.9.2","unstructuredName"),r("1.2.840.113549.1.9.3","contentType"),r("1.2.840.113549.1.9.4","messageDigest"),r("1.2.840.113549.1.9.5","signingTime"),r("1.2.840.113549.1.9.6","counterSignature"),r("1.2.840.113549.1.9.7","challengePassword"),r("1.2.840.113549.1.9.8","unstructuredAddress"),r("1.2.840.113549.1.9.14","extensionRequest"),r("1.2.840.113549.1.9.20","friendlyName"),r("1.2.840.113549.1.9.21","localKeyId"),r("1.2.840.113549.1.9.22.1","x509Certificate"),r("1.2.840.113549.1.12.10.1.1","keyBag"),r("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),r("1.2.840.113549.1.12.10.1.3","certBag"),r("1.2.840.113549.1.12.10.1.4","crlBag"),r("1.2.840.113549.1.12.10.1.5","secretBag"),r("1.2.840.113549.1.12.10.1.6","safeContentsBag"),r("1.2.840.113549.1.5.13","pkcs5PBES2"),r("1.2.840.113549.1.5.12","pkcs5PBKDF2"),r("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),r("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),r("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),r("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),r("1.2.840.113549.2.7","hmacWithSHA1"),r("1.2.840.113549.2.8","hmacWithSHA224"),r("1.2.840.113549.2.9","hmacWithSHA256"),r("1.2.840.113549.2.10","hmacWithSHA384"),r("1.2.840.113549.2.11","hmacWithSHA512"),r("1.2.840.113549.3.7","des-EDE3-CBC"),r("2.16.840.1.101.3.4.1.2","aes128-CBC"),r("2.16.840.1.101.3.4.1.22","aes192-CBC"),r("2.16.840.1.101.3.4.1.42","aes256-CBC"),r("2.5.4.3","commonName"),r("2.5.4.5","serialName"),r("2.5.4.6","countryName"),r("2.5.4.7","localityName"),r("2.5.4.8","stateOrProvinceName"),r("2.5.4.9","streetAddress"),r("2.5.4.10","organizationName"),r("2.5.4.11","organizationalUnitName"),r("2.5.4.13","description"),r("2.5.4.15","businessCategory"),r("2.5.4.17","postalCode"),r("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),r("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),r("2.16.840.1.113730.1.1","nsCertType"),r("2.16.840.1.113730.1.13","nsComment"),n("2.5.29.1","authorityKeyIdentifier"),n("2.5.29.2","keyAttributes"),n("2.5.29.3","certificatePolicies"),n("2.5.29.4","keyUsageRestriction"),n("2.5.29.5","policyMapping"),n("2.5.29.6","subtreesConstraint"),n("2.5.29.7","subjectAltName"),n("2.5.29.8","issuerAltName"),n("2.5.29.9","subjectDirectoryAttributes"),n("2.5.29.10","basicConstraints"),n("2.5.29.11","nameConstraints"),n("2.5.29.12","policyConstraints"),n("2.5.29.13","basicConstraints"),r("2.5.29.14","subjectKeyIdentifier"),r("2.5.29.15","keyUsage"),n("2.5.29.16","privateKeyUsagePeriod"),r("2.5.29.17","subjectAltName"),r("2.5.29.18","issuerAltName"),r("2.5.29.19","basicConstraints"),n("2.5.29.20","cRLNumber"),n("2.5.29.21","cRLReason"),n("2.5.29.22","expirationDate"),n("2.5.29.23","instructionCode"),n("2.5.29.24","invalidityDate"),n("2.5.29.25","cRLDistributionPoints"),n("2.5.29.26","issuingDistributionPoint"),n("2.5.29.27","deltaCRLIndicator"),n("2.5.29.28","issuingDistributionPoint"),n("2.5.29.29","certificateIssuer"),n("2.5.29.30","nameConstraints"),r("2.5.29.31","cRLDistributionPoints"),r("2.5.29.32","certificatePolicies"),n("2.5.29.33","policyMappings"),n("2.5.29.34","policyConstraints"),r("2.5.29.35","authorityKeyIdentifier"),n("2.5.29.36","policyConstraints"),r("2.5.29.37","extKeyUsage"),n("2.5.29.46","freshestCRL"),n("2.5.29.54","inhibitAnyPolicy"),r("1.3.6.1.4.1.11129.2.4.2","timestampList"),r("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),r("1.3.6.1.5.5.7.3.1","serverAuth"),r("1.3.6.1.5.5.7.3.2","clientAuth"),r("1.3.6.1.5.5.7.3.3","codeSigning"),r("1.3.6.1.5.5.7.3.4","emailProtection"),r("1.3.6.1.5.5.7.3.8","timeStamping")})),C((function(e){var t=e.exports=V.asn1=V.asn1||{};function r(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}t.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},t.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},t.create=function(e,r,n,o,a){if(V.util.isArray(o)){for(var i=[],s=0;s<o.length;++s)void 0!==o[s]&&i.push(o[s]);o=i}var c={tagClass:e,type:r,constructed:n,composed:n||V.util.isArray(o),value:o};return a&&"bitStringContents"in a&&(c.bitStringContents=a.bitStringContents,c.original=t.copy(c)),c},t.copy=function(e,r){var n;if(V.util.isArray(e)){n=[];for(var o=0;o<e.length;++o)n.push(t.copy(e[o],r));return n}return"string"==typeof e?e:(n={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:t.copy(e.value,r)},r&&!r.excludeBitStringContents&&(n.bitStringContents=e.bitStringContents),n)},t.equals=function(e,r,n){if(V.util.isArray(e)){if(!V.util.isArray(r))return!1;if(e.length!==r.length)return!1;for(var o=0;o<e.length;++o)if(!t.equals(e[o],r[o]))return!1;return!0}if(w(e)!=w(r))return!1;if("string"==typeof e)return e===r;var a=e.tagClass===r.tagClass&&e.type===r.type&&e.constructed===r.constructed&&e.composed===r.composed&&t.equals(e.value,r.value);return n&&n.includeBitStringContents&&(a=a&&e.bitStringContents===r.bitStringContents),a},t.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};t.fromDer=function(e,n){return void 0===n&&(n={strict:!0,decodeBitStrings:!0}),"boolean"==typeof n&&(n={strict:n,decodeBitStrings:!0}),"strict"in n||(n.strict=!0),"decodeBitStrings"in n||(n.decodeBitStrings=!0),"string"==typeof e&&(e=V.util.createBuffer(e)),function e(n,o,a,i){var s;r(n,o,2);var c=n.getByte();o--;var l=192&c,u=31&c;s=n.length();var d,f,p=function(e,t){var n=e.getByte();if(t--,128!==n){var o;if(128&n){var a=127&n;r(e,t,a),o=e.getInt(a<<3)}else o=n;if(o<0)throw new Error("Negative length: "+o);return o}}(n,o);if(o-=s-n.length(),void 0!==p&&p>o){if(i.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=n.length(),h.remaining=o,h.requested=p,h}p=o}var m=32==(32&c);if(m)if(d=[],void 0===p)for(;;){if(r(n,o,2),n.bytes(2)===String.fromCharCode(0,0)){n.getBytes(2),o-=2;break}s=n.length(),d.push(e(n,o,a+1,i)),o-=s-n.length()}else for(;p>0;)s=n.length(),d.push(e(n,p,a+1,i)),o-=s-n.length(),p-=s-n.length();if(void 0===d&&l===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&(f=n.bytes(p)),void 0===d&&i.decodeBitStrings&&l===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&p>1){var g=n.read,v=o,y=0;if(u===t.Type.BITSTRING&&(r(n,o,1),y=n.getByte(),o--),0===y)try{s=n.length();var b=e(n,o,a+1,{verbose:i.verbose,strict:!0,decodeBitStrings:!0}),C=s-n.length();o-=C,u==t.Type.BITSTRING&&C++;var w=b.tagClass;C!==p||w!==t.Class.UNIVERSAL&&w!==t.Class.CONTEXT_SPECIFIC||(d=[b])}catch(e){}void 0===d&&(n.read=g,o=v)}if(void 0===d){if(void 0===p){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=o}if(u===t.Type.BMPSTRING)for(d="";p>0;p-=2)r(n,o,2),d+=String.fromCharCode(n.getInt16()),o-=2;else d=n.getBytes(p)}var k=void 0===f?null:{bitStringContents:f};return t.create(l,u,m,d,k)}(e,e.length(),0,n)},t.toDer=function(e){var r=V.util.createBuffer(),n=e.tagClass|e.type,o=V.util.createBuffer(),a=!1;if("bitStringContents"in e&&(a=!0,e.original&&(a=t.equals(e,e.original))),a)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?n|=32:o.putByte(0);for(var i=0;i<e.value.length;++i)void 0!==e.value[i]&&o.putBuffer(t.toDer(e.value[i]))}else if(e.type===t.Type.BMPSTRING)for(i=0;i<e.value.length;++i)o.putInt16(e.value.charCodeAt(i));else e.type===t.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(r.putByte(n),o.length()<=127)r.putByte(127&o.length());else{var s=o.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);for(r.putByte(128|c.length),i=c.length-1;i>=0;--i)r.putByte(c.charCodeAt(i))}return r.putBuffer(o),r},t.oidToDer=function(e){var t,r,n,o,a=e.split("."),i=V.util.createBuffer();i.putByte(40*parseInt(a[0],10)+parseInt(a[1],10));for(var s=2;s<a.length;++s){t=!0,r=[],n=parseInt(a[s],10);do{o=127&n,n>>>=7,t||(o|=128),r.push(o),t=!1}while(n>0);for(var c=r.length-1;c>=0;--c)i.putByte(r[c])}return i},t.derToOid=function(e){var t;"string"==typeof e&&(e=V.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)n<<=7,128&(r=e.getByte())?n+=127&r:(t+="."+(n+r),n=0);return t},t.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,o=parseInt(e.substr(4,2),10),a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),s=0;if(e.length>11){var c=e.charAt(10),l=10;"+"!==c&&"-"!==c&&(s=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,o),t.setUTCHours(a,i,s,0),l&&("+"===(c=e.charAt(l))||"-"===c)){var u=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);u*=6e4,"+"===c?t.setTime(+t-u):t.setTime(+t+u)}return t},t.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,o=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),s=parseInt(e.substr(12,2),10),c=0,l=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var d=e.length-5,f=e.charAt(d);return"+"!==f&&"-"!==f||(l=60*parseInt(e.substr(d+1,2),10)+parseInt(e.substr(d+4,2),10),l*=6e4,"+"===f&&(l*=-1),u=!0),"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,n,o),t.setUTCHours(a,i,s,c),t.setTime(+t+l)):(t.setFullYear(r,n,o),t.setHours(a,i,s,c)),t},t.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+"Z"},t.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+"Z"},t.integerToDer=function(e){var t=V.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},t.derToInteger=function(e){"string"==typeof e&&(e=V.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},t.validate=function(e,r,n,o){var a=!1;if(e.tagClass!==r.tagClass&&void 0!==r.tagClass||e.type!==r.type&&void 0!==r.type)o&&(e.tagClass!==r.tagClass&&o.push("["+r.name+'] Expected tag class "'+r.tagClass+'", got "'+e.tagClass+'"'),e.type!==r.type&&o.push("["+r.name+'] Expected type "'+r.type+'", got "'+e.type+'"'));else if(e.constructed===r.constructed||void 0===r.constructed){if(a=!0,r.value&&V.util.isArray(r.value))for(var i=0,s=0;a&&s<r.value.length;++s)a=r.value[s].optional||!1,e.value[i]&&((a=t.validate(e.value[i],r.value[s],n,o))?++i:r.value[s].optional&&(a=!0)),!a&&o&&o.push("["+r.name+'] Tag class "'+r.tagClass+'", type "'+r.type+'" expected value length "'+r.value.length+'", got "'+e.value.length+'"');if(a&&n&&(r.capture&&(n[r.capture]=e.value),r.captureAsn1&&(n[r.captureAsn1]=e),r.captureBitStringContents&&"bitStringContents"in e&&(n[r.captureBitStringContents]=e.bitStringContents),r.captureBitStringValue&&"bitStringContents"in e))if(e.bitStringContents.length<2)n[r.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");n[r.captureBitStringValue]=e.bitStringContents.slice(1)}}else o&&o.push("["+r.name+'] Expected constructed "'+r.constructed+'", got "'+e.constructed+'"');return a};var n=/[^\\u0000-\\u00ff]/;t.prettyPrint=function(e,r,o){var a="";o=o||2,(r=r||0)>0&&(a+="\n");for(var i="",s=0;s<r*o;++s)i+=" ";switch(a+=i+"Tag: ",e.tagClass){case t.Class.UNIVERSAL:a+="Universal:";break;case t.Class.APPLICATION:a+="Application:";break;case t.Class.CONTEXT_SPECIFIC:a+="Context-Specific:";break;case t.Class.PRIVATE:a+="Private:"}if(e.tagClass===t.Class.UNIVERSAL)switch(a+=e.type,e.type){case t.Type.NONE:a+=" (None)";break;case t.Type.BOOLEAN:a+=" (Boolean)";break;case t.Type.INTEGER:a+=" (Integer)";break;case t.Type.BITSTRING:a+=" (Bit string)";break;case t.Type.OCTETSTRING:a+=" (Octet string)";break;case t.Type.NULL:a+=" (Null)";break;case t.Type.OID:a+=" (Object Identifier)";break;case t.Type.ODESC:a+=" (Object Descriptor)";break;case t.Type.EXTERNAL:a+=" (External or Instance of)";break;case t.Type.REAL:a+=" (Real)";break;case t.Type.ENUMERATED:a+=" (Enumerated)";break;case t.Type.EMBEDDED:a+=" (Embedded PDV)";break;case t.Type.UTF8:a+=" (UTF8)";break;case t.Type.ROID:a+=" (Relative Object Identifier)";break;case t.Type.SEQUENCE:a+=" (Sequence)";break;case t.Type.SET:a+=" (Set)";break;case t.Type.PRINTABLESTRING:a+=" (Printable String)";break;case t.Type.IA5String:a+=" (IA5String (ASCII))";break;case t.Type.UTCTIME:a+=" (UTC time)";break;case t.Type.GENERALIZEDTIME:a+=" (Generalized time)";break;case t.Type.BMPSTRING:a+=" (BMP String)"}else a+=e.type;if(a+="\n",a+=i+"Constructed: "+e.constructed+"\n",e.composed){var c=0,l="";for(s=0;s<e.value.length;++s)void 0!==e.value[s]&&(c+=1,l+=t.prettyPrint(e.value[s],r+1,o),s+1<e.value.length&&(l+=","));a+=i+"Sub values: "+c+l}else{if(a+=i+"Value: ",e.type===t.Type.OID){var u=t.derToOid(e.value);a+=u,V.pki&&V.pki.oids&&u in V.pki.oids&&(a+=" ("+V.pki.oids[u]+") ")}if(e.type===t.Type.INTEGER)try{a+=t.derToInteger(e.value)}catch(t){a+="0x"+V.util.bytesToHex(e.value)}else if(e.type===t.Type.BITSTRING){if(e.value.length>1?a+="0x"+V.util.bytesToHex(e.value.slice(1)):a+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?a+=" (1 unused bit shown)":d>1&&(a+=" ("+d+" unused bits shown)")}}else e.type===t.Type.OCTETSTRING?(n.test(e.value)||(a+="("+e.value+") "),a+="0x"+V.util.bytesToHex(e.value)):e.type===t.Type.UTF8?a+=V.util.decodeUtf8(e.value):e.type===t.Type.PRINTABLESTRING||e.type===t.Type.IA5String?a+=e.value:n.test(e.value)?a+="0x"+V.util.bytesToHex(e.value):0===e.value.length?a+="[null]":a+=e.value}return a}})),V.md=V.md||{},V.md.algorithms=V.md.algorithms||{},C((function(e){(e.exports=V.hmac=V.hmac||{}).create=function(){var e=null,t=null,r=null,n=null,o={start:function(o,a){if(null!==o)if("string"==typeof o){if(!((o=o.toLowerCase())in V.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=V.md.algorithms[o].create()}else t=o;if(null===a)a=e;else{if("string"==typeof a)a=V.util.createBuffer(a);else if(V.util.isArray(a)){var i=a;a=V.util.createBuffer();for(var s=0;s<i.length;++s)a.putByte(i[s])}var c=a.length();for(c>t.blockLength&&(t.start(),t.update(a.bytes()),a=t.digest()),r=V.util.createBuffer(),n=V.util.createBuffer(),c=a.length(),s=0;s<c;++s)i=a.at(s),r.putByte(54^i),n.putByte(92^i);if(c<t.blockLength)for(i=t.blockLength-c,s=0;s<i;++s)r.putByte(54),n.putByte(92);e=a,r=r.bytes(),n=n.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(n),t.update(e),t.digest()}};return o.digest=o.getMac,o}})),C((function(e){var t=e.exports=V.md5=V.md5||{};V.md.md5=V.md.algorithms.md5=t,t.create=function(){i||function(){r=String.fromCharCode(128),r+=V.util.fillString(String.fromCharCode(0),64),n=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],o=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],a=new Array(64);for(var e=0;e<64;++e)a[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));i=!0}();var e=null,t=V.util.createBuffer(),c=new Array(16),l={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var r=l.messageLengthSize/4,n=0;n<r;++n)l.fullMessageLength.push(0);return t=V.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},l}};return l.start(),l.update=function(r,n){"utf8"===n&&(r=V.util.encodeUtf8(r));var o=r.length;l.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=l.fullMessageLength.length-1;a>=0;--a)l.fullMessageLength[a]+=o[1],o[1]=o[0]+(l.fullMessageLength[a]/4294967296>>>0),l.fullMessageLength[a]=l.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(r),s(e,c,t),(t.read>2048||0===t.length())&&t.compact(),l},l.digest=function(){var n=V.util.createBuffer();n.putBytes(t.bytes());var o=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize&l.blockLength-1;n.putBytes(r.substr(0,l.blockLength-o));for(var a,i=0,u=l.fullMessageLength.length-1;u>=0;--u)i=(a=8*l.fullMessageLength[u]+i)/4294967296>>>0,n.putInt32Le(a>>>0);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};s(d,c,n);var f=V.util.createBuffer();return f.putInt32Le(d.h0),f.putInt32Le(d.h1),f.putInt32Le(d.h2),f.putInt32Le(d.h3),f},l};var r=null,n=null,o=null,a=null,i=!1;function s(e,t,r){for(var i,s,c,l,u,d,f,p=r.length();p>=64;){for(s=e.h0,c=e.h1,l=e.h2,u=e.h3,f=0;f<16;++f)t[f]=r.getInt32Le(),i=s+(u^c&(l^u))+a[f]+t[f],s=u,u=l,l=c,c+=i<<(d=o[f])|i>>>32-d;for(;f<32;++f)i=s+(l^u&(c^l))+a[f]+t[n[f]],s=u,u=l,l=c,c+=i<<(d=o[f])|i>>>32-d;for(;f<48;++f)i=s+(c^l^u)+a[f]+t[n[f]],s=u,u=l,l=c,c+=i<<(d=o[f])|i>>>32-d;for(;f<64;++f)i=s+(l^(c|~u))+a[f]+t[n[f]],s=u,u=l,l=c,c+=i<<(d=o[f])|i>>>32-d;e.h0=e.h0+s|0,e.h1=e.h1+c|0,e.h2=e.h2+l|0,e.h3=e.h3+u|0,p-=64}}})),C((function(e){var t=e.exports=V.pem=V.pem||{};function r(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},o=0;o<e.values.length;++o)r.push(e.values[o].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var a=0,i=-1;for(o=0;o<t.length;++o,++a)if(a>65&&-1!==i){var s=t[i];","===s?(++i,t=t.substr(0,i)+"\r\n "+t.substr(i)):t=t.substr(0,i)+"\r\n"+s+t.substr(i+1),a=o-i-1,i=-1,++o}else" "!==t[o]&&"\t"!==t[o]&&","!==t[o]||(i=o);return t}function n(e){return e.replace(/^\s+/,"")}t.encode=function(e,t){t=t||{};var n,o="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(o+=r(n={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(o+=r(n={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(n={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&n.values.push(e.dekInfo.parameters),o+=r(n)),e.headers)for(var a=0;a<e.headers.length;++a)o+=r(e.headers[a]);return e.procType&&(o+="\r\n"),(o+=V.util.encode64(e.body,t.maxline||64)+"\r\n")+"-----END "+e.type+"-----\r\n"},t.decode=function(e){for(var t,r=[],o=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,a=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,i=/\r?\n/;t=o.exec(e);){var s={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:V.util.decode64(t[3])};if(r.push(s),t[2]){for(var c=t[2].split(i),l=0;t&&l<c.length;){for(var u=c[l].replace(/\s+$/,""),d=l+1;d<c.length;++d){var f=c[d];if(!/\s/.test(f[0]))break;u+=f,l=d}if(t=u.match(a)){for(var p={name:t[1],values:[]},h=t[2].split(","),m=0;m<h.length;++m)p.values.push(n(h[m]));if(s.procType)if(s.contentDomain||"Content-Domain"!==p.name)if(s.dekInfo||"DEK-Info"!==p.name)s.headers.push(p);else{if(0===p.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');s.dekInfo={algorithm:h[0],parameters:h[1]||null}}else s.contentDomain=h[0]||"";else{if("Proc-Type"!==p.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==p.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');s.procType={version:h[0],type:h[1]}}}++l}if("ENCRYPTED"===s.procType&&!s.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}})),V.des=V.des||{},V.des.startEncrypting=function(e,t,r,n){var o=he({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return o.start(t),o},V.des.createEncryptionCipher=function(e,t){return he({key:e,output:null,decrypt:!1,mode:t})},V.des.startDecrypting=function(e,t,r,n){var o=he({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return o.start(t),o},V.des.createDecryptionCipher=function(e,t){return he({key:e,output:null,decrypt:!0,mode:t})},V.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return pe(r._keys,e,t,!1)},decrypt:function(e,t){return pe(r._keys,e,t,!0)}}}),r._init=!1},V.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=V.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],o=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],a=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],i=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],d=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],h=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],m=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,v=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C<g;C++){var w=e.getInt32(),k=e.getInt32();w^=(t=252645135&(w>>>4^k))<<4,w^=t=65535&((k^=t)>>>-16^w),w^=(t=858993459&(w>>>2^(k^=t<<-16)))<<2,w^=t=65535&((k^=t)>>>-16^w),w^=(t=1431655765&(w>>>1^(k^=t<<-16)))<<1,w^=t=16711935&((k^=t)>>>8^w),t=(w^=(t=1431655765&(w>>>1^(k^=t<<8)))<<1)<<8|(k^=t)>>>20&240,w=k<<24|k<<8&16711680|k>>>8&65280|k>>>24&240,k=t;for(var B=0;B<y.length;++B){y[B]?(w=w<<2|w>>>26,k=k<<2|k>>>26):(w=w<<1|w>>>27,k=k<<1|k>>>27);var E=r[(w&=-15)>>>28]|n[w>>>24&15]|o[w>>>20&15]|a[w>>>16&15]|i[w>>>12&15]|s[w>>>8&15]|c[w>>>4&15],S=l[(k&=-15)>>>28]|u[k>>>24&15]|d[k>>>20&15]|f[k>>>16&15]|p[k>>>12&15]|h[k>>>8&15]|m[k>>>4&15];t=65535&(S>>>16^E),v[b++]=E^t,v[b++]=S^t<<16}}return v}(t),this._init=!0}},ne("DES-ECB",V.cipher.modes.ecb),ne("DES-CBC",V.cipher.modes.cbc),ne("DES-CFB",V.cipher.modes.cfb),ne("DES-OFB",V.cipher.modes.ofb),ne("DES-CTR",V.cipher.modes.ctr),ne("3DES-ECB",V.cipher.modes.ecb),ne("3DES-CBC",V.cipher.modes.cbc),ne("3DES-CFB",V.cipher.modes.cfb),ne("3DES-OFB",V.cipher.modes.ofb),ne("3DES-CTR",V.cipher.modes.ctr);var oe=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],ie=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],se=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],ce=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],le=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],ue=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],de=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],fe=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function pe(e,t,r,n){var o,a,i=32===e.length?3:9;o=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var s=t[0],c=t[1];s^=(a=252645135&(s>>>4^c))<<4,s^=(a=65535&(s>>>16^(c^=a)))<<16,s^=a=858993459&((c^=a)>>>2^s),s^=a=16711935&((c^=a<<2)>>>8^s),s=(s^=(a=1431655765&(s>>>1^(c^=a<<8)))<<1)<<1|s>>>31,c=(c^=a)<<1|c>>>31;for(var l=0;l<i;l+=3){for(var u=o[l+1],d=o[l+2],f=o[l];f!=u;f+=d){var p=c^e[f],h=(c>>>4|c<<28)^e[f+1];a=s,s=c,c=a^(ie[p>>>24&63]|ce[p>>>16&63]|ue[p>>>8&63]|fe[63&p]|oe[h>>>24&63]|se[h>>>16&63]|le[h>>>8&63]|de[63&h])}a=s,s=c,c=a}c=c>>>1|c<<31,c^=a=1431655765&((s=s>>>1|s<<31)>>>1^c),c^=(a=16711935&(c>>>8^(s^=a<<1)))<<8,c^=(a=858993459&(c>>>2^(s^=a)))<<2,c^=a=65535&((s^=a)>>>16^c),c^=a=252645135&((s^=a<<16)>>>4^c),s^=a<<4,r[0]=s,r[1]=c}function he(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?V.cipher.createDecipher(r,e.key):V.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof V.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,n.call(t,r)},t}var me,ge=V.pkcs5=V.pkcs5||{};V.util.isNodejs&&!V.options.usePureJavaScript&&(me=t),V.pbkdf2=ge.pbkdf2=function(e,t,r,n,o,a){if("function"==typeof o&&(a=o,o=null),V.util.isNodejs&&!V.options.usePureJavaScript&&me.pbkdf2&&(null===o||"object"!=w(o))&&(me.pbkdf2Sync.length>4||!o||"sha1"===o))return"string"!=typeof o&&(o="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),a?4===me.pbkdf2Sync.length?me.pbkdf2(e,t,r,n,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):me.pbkdf2(e,t,r,n,o,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):4===me.pbkdf2Sync.length?me.pbkdf2Sync(e,t,r,n).toString("binary"):me.pbkdf2Sync(e,t,r,n,o).toString("binary");if(null==o&&(o="sha1"),"string"==typeof o){if(!(o in V.md.algorithms))throw new Error("Unknown hash algorithm: "+o);o=V.md[o].create()}var i=o.digestLength;if(n>4294967295*i){var s=new Error("Derived key is too long.");if(a)return a(s);throw s}var c=Math.ceil(n/i),l=n-(c-1)*i,u=V.hmac.create();u.start(o,e);var d,f,p,h="";if(!a){for(var m=1;m<=c;++m){u.start(null,null),u.update(t),u.update(V.util.int32ToBytes(m)),d=p=u.digest().getBytes();for(var g=2;g<=r;++g)u.start(null,null),u.update(p),f=u.digest().getBytes(),d=V.util.xorBytes(d,f,i),p=f;h+=m<c?d:d.substr(0,l)}return h}function v(){if(m>c)return a(null,h);u.start(null,null),u.update(t),u.update(V.util.int32ToBytes(m)),d=p=u.digest().getBytes(),g=2,y()}function y(){if(g<=r)return u.start(null,null),u.update(p),f=u.digest().getBytes(),d=V.util.xorBytes(d,f,i),p=f,++g,V.util.setImmediate(y);h+=m<c?d:d.substr(0,l),++m,v()}m=1,v()},C((function(e){var t=e.exports=V.sha256=V.sha256||{};V.md.sha256=V.md.algorithms.sha256=t,t.create=function(){n||(r=String.fromCharCode(128),r+=V.util.fillString(String.fromCharCode(0),64),o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=!0);var e=null,t=V.util.createBuffer(),i=new Array(64),s={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){s.messageLength=0,s.fullMessageLength=s.messageLength64=[];for(var r=s.messageLengthSize/4,n=0;n<r;++n)s.fullMessageLength.push(0);return t=V.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},s}};return s.start(),s.update=function(r,n){"utf8"===n&&(r=V.util.encodeUtf8(r));var o=r.length;s.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var c=s.fullMessageLength.length-1;c>=0;--c)s.fullMessageLength[c]+=o[1],o[1]=o[0]+(s.fullMessageLength[c]/4294967296>>>0),s.fullMessageLength[c]=s.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(r),a(e,i,t),(t.read>2048||0===t.length())&&t.compact(),s},s.digest=function(){var n=V.util.createBuffer();n.putBytes(t.bytes());var o,c=s.fullMessageLength[s.fullMessageLength.length-1]+s.messageLengthSize&s.blockLength-1;n.putBytes(r.substr(0,s.blockLength-c));for(var l=8*s.fullMessageLength[0],u=0;u<s.fullMessageLength.length-1;++u)l+=(o=8*s.fullMessageLength[u+1])/4294967296>>>0,n.putInt32(l>>>0),l=o>>>0;n.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};a(d,i,n);var f=V.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f.putInt32(d.h5),f.putInt32(d.h6),f.putInt32(d.h7),f},s};var r=null,n=!1,o=null;function a(e,t,r){for(var n,a,i,s,c,l,u,d,f,p,h,m,g,v=r.length();v>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,a=((a=t[c-15])>>>7|a<<25)^(a>>>18|a<<14)^a>>>3,t[c]=n+t[c-7]+a+t[c-16]|0;for(l=e.h0,u=e.h1,d=e.h2,f=e.h3,p=e.h4,h=e.h5,m=e.h6,g=e.h7,c=0;c<64;++c)i=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),s=l&u|d&(l^u),n=g+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(m^p&(h^m))+o[c]+t[c],g=m,m=h,h=p,p=f+n>>>0,f=d,d=u,u=l,l=n+(a=i+s)>>>0;e.h0=e.h0+l|0,e.h1=e.h1+u|0,e.h2=e.h2+d|0,e.h3=e.h3+f|0,e.h4=e.h4+p|0,e.h5=e.h5+h|0,e.h6=e.h6+m|0,e.h7=e.h7+g|0,v-=64}}})),C((function(e){var r=null;!V.util.isNodejs||V.options.usePureJavaScript||process.versions["node-webkit"]||(r=t),(e.exports=V.prng=V.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=e.md,o=new Array(32),a=0;a<32;++a)o[a]=n.create();function i(){if(t.pools[0].messageLength>=32)return s();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),s()}function s(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var o=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(o),t.generated=0}function c(e){var t=null,r=V.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)});var o=V.util.createBuffer();if(t)for(;o.length()<e;){var a=Math.max(1,Math.min(e-o.length(),65536)/4),i=new Uint32Array(Math.floor(a));try{t(i);for(var s=0;s<i.length;++s)o.putInt32(i[s])}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e}}if(o.length()<e)for(var c,l,u,d=Math.floor(65536*Math.random());o.length()<e;)for(l=16807*(65535&d),l+=(32767&(c=16807*(d>>16)))<<16,d=4294967295&(l=(2147483647&(l+=c>>15))+(l>>31)),s=0;s<3;++s)u=d>>>(s<<3),u^=Math.floor(256*Math.random()),o.putByte(String.fromCharCode(255&u));return o.getBytes(e)}return t.pools=o,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,o=t.plugin.increment,a=t.plugin.formatKey,i=t.plugin.formatSeed,c=V.util.createBuffer();t.key=null,function l(u){if(u)return r(u);if(c.length()>=e)return r(null,c.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return V.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return s(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),s(),e()}))}(l)}));var d=n(t.key,t.seed);t.generated+=d.length,c.putBytes(d),t.key=a(n(t.key,o(t.seed))),t.seed=i(n(t.key,t.seed)),V.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,o=t.plugin.formatKey,a=t.plugin.formatSeed;t.key=null;for(var s=V.util.createBuffer();s.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&i();var c=r(t.key,t.seed);t.generated+=c.length,s.putBytes(c),t.key=o(r(t.key,n(t.seed))),t.seed=a(r(t.key,t.seed))}return s.getBytes(e)},r?(t.seedFile=function(e,t){r.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return r.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,c(e))}catch(e){t(e)}},t.seedFileSync=c),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",o=0;o<r;o+=8)n+=String.fromCharCode(e>>o&255);t.collect(n)},t.registerWorker=function(e){e===self?t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})}:e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))},t}})),C((function(e){V.random&&V.random.getBytes?e.exports=V.random:function(t){var r={},n=new Array(4),o=V.util.createBuffer();function a(){var e=V.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=V.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),V.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=V.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return V.aes._updateBlock(e,t,n,!1),o.putInt32(n[0]),o.putInt32(n[1]),o.putInt32(n[2]),o.putInt32(n[3]),o.getBytes()},r.increment=function(e){return++e[3],e},r.md=V.md.sha256;var i=a(),s=null,c=V.util.globalScope,l=c.crypto||c.msCrypto;if(l&&l.getRandomValues&&(s=function(e){return l.getRandomValues(e)}),!V.util.isNodejs&&!s){if(i.collectInt(+new Date,32),"undefined"!=typeof navigator){var u="";for(var d in navigator)try{"string"==typeof navigator[d]&&(u+=navigator[d])}catch(e){}i.collect(u),u=null}t&&(t().mousemove((function(e){i.collectInt(e.clientX,16),i.collectInt(e.clientY,16)})),t().keypress((function(e){i.collectInt(e.charCode,8)})))}if(V.random)for(var d in i)V.random[d]=i[d];else V.random=i;V.random.createInstance=a,e.exports=V.random}("undefined"!=typeof jQuery?jQuery:null)}));var ve=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],ye=[1,2,3,5],be=function(e,t){return e<<t&65535|(65535&e)>>16-t},Ce=function(e,t){return(65535&e)>>t|e<<16-t&65535};V.rc2=V.rc2||{},V.rc2.expandKey=function(e,t){"string"==typeof e&&(e=V.util.createBuffer(e)),t=t||128;var r,n=e,o=e.length(),a=t,i=Math.ceil(a/8),s=255>>(7&a);for(r=o;r<128;r++)n.putByte(ve[n.at(r-1)+n.at(r-o)&255]);for(n.setAt(128-i,ve[n.at(128-i)&s]),r=127-i;r>=0;r--)n.setAt(r,ve[n.at(r+1)^n.at(r+i)]);return n};var we,ke=function(e,t,r){var n,o,a,i,s=!1,c=null,l=null,u=null,d=[];for(e=V.rc2.expandKey(e,t),a=0;a<64;a++)d.push(e.getInt16Le());r?(n=function(e){for(a=0;a<4;a++)e[a]+=d[i]+(e[(a+3)%4]&e[(a+2)%4])+(~e[(a+3)%4]&e[(a+1)%4]),e[a]=be(e[a],ye[a]),i++},o=function(e){for(a=0;a<4;a++)e[a]+=d[63&e[(a+3)%4]]}):(n=function(e){for(a=3;a>=0;a--)e[a]=Ce(e[a],ye[a]),e[a]-=d[i]+(e[(a+3)%4]&e[(a+2)%4])+(~e[(a+3)%4]&e[(a+1)%4]),i--},o=function(e){for(a=3;a>=0;a--)e[a]-=d[63&e[(a+3)%4]]});var f=function(e){var t=[];for(a=0;a<4;a++){var n=c.getInt16Le();null!==u&&(r?n^=u.getInt16Le():u.putInt16Le(n)),t.push(65535&n)}i=r?0:63;for(var o=0;o<e.length;o++)for(var s=0;s<e[o][0];s++)e[o][1](t);for(a=0;a<4;a++)null!==u&&(r?u.putInt16Le(t[a]):t[a]^=u.getInt16Le()),l.putInt16Le(t[a])},p=null;return p={start:function(e,t){e&&"string"==typeof e&&(e=V.util.createBuffer(e)),s=!1,c=V.util.createBuffer(),l=t||new V.util.createBuffer,u=e,p.output=l},update:function(e){for(s||c.putBuffer(e);c.length()>=8;)f([[5,n],[1,o],[6,n],[1,o],[5,n]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,c,!r);else{var n=8===c.length()?8:8-c.length();c.fillWithByte(n,n)}if(t&&(s=!0,p.update()),!r&&(t=0===c.length()))if(e)t=e(8,l,!r);else{var o=l.length(),a=l.at(o-1);a>o?t=!1:l.truncate(a)}return t}}};function Be(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function Ee(){return new Be(null)}function Se(e,t,r,n,o,a){for(var i=16383&t,s=t>>14;--a>=0;){var c=16383&this.data[e],l=this.data[e++]>>14,u=s*c+l*i;o=((c=i*c+((16383&u)<<14)+r.data[n]+o)>>28)+(u>>14)+s*l,r.data[n++]=268435455&c}return o}V.rc2.startEncrypting=function(e,t,r){var n=V.rc2.createEncryptionCipher(e,128);return n.start(t,r),n},V.rc2.createEncryptionCipher=function(e,t){return ke(e,t,!0)},V.rc2.startDecrypting=function(e,t,r){var n=V.rc2.createDecryptionCipher(e,128);return n.start(t,r),n},V.rc2.createDecryptionCipher=function(e,t){return ke(e,t,!1)},V.jsbn=V.jsbn||{},V.jsbn.BigInteger=Be,"undefined"==typeof navigator?(Be.prototype.am=Se,we=28):"Microsoft Internet Explorer"==navigator.appName?(Be.prototype.am=function(e,t,r,n,o,a){for(var i=32767&t,s=t>>15;--a>=0;){var c=32767&this.data[e],l=this.data[e++]>>15,u=s*c+l*i;o=((c=i*c+((32767&u)<<15)+r.data[n]+(1073741823&o))>>>30)+(u>>>15)+s*l+(o>>>30),r.data[n++]=1073741823&c}return o},we=30):"Netscape"!=navigator.appName?(Be.prototype.am=function(e,t,r,n,o,a){for(;--a>=0;){var i=t*this.data[e++]+r.data[n]+o;o=Math.floor(i/67108864),r.data[n++]=67108863&i}return o},we=26):(Be.prototype.am=Se,we=28),Be.prototype.DB=we,Be.prototype.DM=(1<<we)-1,Be.prototype.DV=1<<we,Be.prototype.FV=Math.pow(2,52),Be.prototype.F1=52-we,Be.prototype.F2=2*we-52;var Ae,_e,Ie=new Array;for(Ae="0".charCodeAt(0),_e=0;_e<=9;++_e)Ie[Ae++]=_e;for(Ae="a".charCodeAt(0),_e=10;_e<36;++_e)Ie[Ae++]=_e;for(Ae="A".charCodeAt(0),_e=10;_e<36;++_e)Ie[Ae++]=_e;function Te(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function Pe(e,t){var r=Ie[e.charCodeAt(t)];return null==r?-1:r}function xe(e){var t=Ee();return t.fromInt(e),t}function Re(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function Ne(e){this.m=e}function Le(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function Oe(e,t){return e&t}function De(e,t){return e|t}function Me(e,t){return e^t}function Ue(e,t){return e&~t}function je(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function Fe(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function Ve(){}function ze(e){return e}function Ke(e){this.r2=Ee(),this.q3=Ee(),Be.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}Ne.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},Ne.prototype.revert=function(e){return e},Ne.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},Ne.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},Ne.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},Le.prototype.convert=function(e){var t=Ee();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(Be.ZERO)>0&&this.m.subTo(t,t),t},Le.prototype.revert=function(e){var t=Ee();return e.copyTo(t),this.reduce(t),t},Le.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},Le.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},Le.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},Be.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},Be.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},Be.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,o=!1,a=0;--n>=0;){var i=8==r?255&e[n]:Pe(e,n);i<0?"-"==e.charAt(n)&&(o=!0):(o=!1,0==a?this.data[this.t++]=i:a+r>this.DB?(this.data[this.t-1]|=(i&(1<<this.DB-a)-1)<<a,this.data[this.t++]=i>>this.DB-a):this.data[this.t-1]|=i<<a,(a+=r)>=this.DB&&(a-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,a>0&&(this.data[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),o&&Be.ZERO.subTo(this,this)},Be.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},Be.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},Be.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},Be.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,o=this.DB-n,a=(1<<o)-1,i=Math.floor(e/this.DB),s=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+i+1]=this.data[r]>>o|s,s=(this.data[r]&a)<<n;for(r=i-1;r>=0;--r)t.data[r]=0;t.data[i]=s,t.t=this.t+i+1,t.s=this.s,t.clamp()},Be.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,o=this.DB-n,a=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var i=r+1;i<this.t;++i)t.data[i-r-1]|=(this.data[i]&a)<<o,t.data[i-r]=this.data[i]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&a)<<o),t.t=this.t-r,t.clamp()}},Be.prototype.subTo=function(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},Be.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),o=r.t;for(t.t=o+n.t;--o>=0;)t.data[o]=0;for(o=0;o<n.t;++o)t.data[o+r.t]=r.am(0,n.data[o],t,o,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&Be.ZERO.subTo(t,t)},Be.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},Be.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=Ee());var a=Ee(),i=this.s,s=e.s,c=this.DB-Re(n.data[n.t-1]);c>0?(n.lShiftTo(c,a),o.lShiftTo(c,r)):(n.copyTo(a),o.copyTo(r));var l=a.t,u=a.data[l-1];if(0!=u){var d=u*(1<<this.F1)+(l>1?a.data[l-2]>>this.F2:0),f=this.FV/d,p=(1<<this.F1)/d,h=1<<this.F2,m=r.t,g=m-l,v=null==t?Ee():t;for(a.dlShiftTo(g,v),r.compareTo(v)>=0&&(r.data[r.t++]=1,r.subTo(v,r)),Be.ONE.dlShiftTo(l,v),v.subTo(a,a);a.t<l;)a.data[a.t++]=0;for(;--g>=0;){var y=r.data[--m]==u?this.DM:Math.floor(r.data[m]*f+(r.data[m-1]+h)*p);if((r.data[m]+=a.am(0,y,r,g,0,l))<y)for(a.dlShiftTo(g,v),r.subTo(v,r);r.data[m]<--y;)r.subTo(v,r)}null!=t&&(r.drShiftTo(l,t),i!=s&&Be.ZERO.subTo(t,t)),r.t=l,r.clamp(),c>0&&r.rShiftTo(c,r),i<0&&Be.ZERO.subTo(r,r)}}},Be.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},Be.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},Be.prototype.exp=function(e,t){if(e>4294967295||e<1)return Be.ONE;var r=Ee(),n=Ee(),o=t.convert(this),a=Re(e)-1;for(o.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,o,r);else{var i=r;r=n,n=i}return t.revert(r)},Be.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,o=!1,a="",i=this.t,s=this.DB-i*this.DB%t;if(i-- >0)for(s<this.DB&&(r=this.data[i]>>s)>0&&(o=!0,a=Te(r));i>=0;)s<t?(r=(this.data[i]&(1<<s)-1)<<t-s,r|=this.data[--i]>>(s+=this.DB-t)):(r=this.data[i]>>(s-=t)&n,s<=0&&(s+=this.DB,--i)),r>0&&(o=!0),o&&(a+=Te(r));return o?a:"0"},Be.prototype.negate=function(){var e=Ee();return Be.ZERO.subTo(this,e),e},Be.prototype.abs=function(){return this.s<0?this.negate():this},Be.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},Be.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+Re(this.data[this.t-1]^this.s&this.DM)},Be.prototype.mod=function(e){var t=Ee();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(Be.ZERO)>0&&e.subTo(t,t),t},Be.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new Ne(t):new Le(t),this.exp(e,r)},Be.ZERO=xe(0),Be.ONE=xe(1),Ve.prototype.convert=ze,Ve.prototype.revert=ze,Ve.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},Ve.prototype.sqrTo=function(e,t){e.squareTo(t)},Ke.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Ee();return e.copyTo(t),this.reduce(t),t},Ke.prototype.revert=function(e){return e},Ke.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},Ke.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},Ke.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var He=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],qe=(1<<26)/He[He.length-1];if(Be.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},Be.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=xe(r),o=Ee(),a=Ee(),i="";for(this.divRemTo(n,o,a);o.signum()>0;)i=(r+a.intValue()).toString(e).substr(1)+i,o.divRemTo(n,o,a);return a.intValue().toString(e)+i},Be.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),o=!1,a=0,i=0,s=0;s<e.length;++s){var c=Pe(e,s);c<0?"-"==e.charAt(s)&&0==this.signum()&&(o=!0):(i=t*i+c,++a>=r&&(this.dMultiply(n),this.dAddOffset(i,0),a=0,i=0))}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(i,0)),o&&Be.ZERO.subTo(this,this)},Be.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(Be.ONE.shiftLeft(e-1),De,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(Be.ONE.shiftLeft(e-1),this);else{var n=new Array,o=7&e;n.length=1+(e>>3),t.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}},Be.prototype.bitwiseTo=function(e,t,r){var n,o,a=Math.min(e.t,this.t);for(n=0;n<a;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(o=e.s&this.DM,n=a;n<this.t;++n)r.data[n]=t(this.data[n],o);r.t=this.t}else{for(o=this.s&this.DM,n=a;n<e.t;++n)r.data[n]=t(o,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},Be.prototype.changeBit=function(e,t){var r=Be.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},Be.prototype.addTo=function(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},Be.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},Be.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},Be.prototype.multiplyLowerTo=function(e,t,r){var n,o=Math.min(this.t+e.t,t);for(r.s=0,r.t=o;o>0;)r.data[--o]=0;for(n=r.t-this.t;o<n;++o)r.data[o+this.t]=this.am(0,e.data[o],r,o,0,this.t);for(n=Math.min(e.t,t);o<n;++o)this.am(0,e.data[o],r,o,0,t-o);r.clamp()},Be.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},Be.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},Be.prototype.millerRabin=function(e){var t=this.subtract(Be.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,o=t.shiftRight(r),a={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},i=0;i<e;++i){do{n=new Be(this.bitLength(),a)}while(n.compareTo(Be.ONE)<=0||n.compareTo(t)>=0);var s=n.modPow(o,this);if(0!=s.compareTo(Be.ONE)&&0!=s.compareTo(t)){for(var c=1;c++<r&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(Be.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0},Be.prototype.clone=function(){var e=Ee();return this.copyTo(e),e},Be.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},Be.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},Be.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},Be.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},Be.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,o=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[o++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==o&&(128&this.s)!=(128&r)&&++o,(o>0||r!=this.s)&&(t[o++]=r);return t},Be.prototype.equals=function(e){return 0==this.compareTo(e)},Be.prototype.min=function(e){return this.compareTo(e)<0?this:e},Be.prototype.max=function(e){return this.compareTo(e)>0?this:e},Be.prototype.and=function(e){var t=Ee();return this.bitwiseTo(e,Oe,t),t},Be.prototype.or=function(e){var t=Ee();return this.bitwiseTo(e,De,t),t},Be.prototype.xor=function(e){var t=Ee();return this.bitwiseTo(e,Me,t),t},Be.prototype.andNot=function(e){var t=Ee();return this.bitwiseTo(e,Ue,t),t},Be.prototype.not=function(){for(var e=Ee(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},Be.prototype.shiftLeft=function(e){var t=Ee();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},Be.prototype.shiftRight=function(e){var t=Ee();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},Be.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+je(this.data[e]);return this.s<0?this.t*this.DB:-1},Be.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=Fe(this.data[r]^t);return e},Be.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},Be.prototype.setBit=function(e){return this.changeBit(e,De)},Be.prototype.clearBit=function(e){return this.changeBit(e,Ue)},Be.prototype.flipBit=function(e){return this.changeBit(e,Me)},Be.prototype.add=function(e){var t=Ee();return this.addTo(e,t),t},Be.prototype.subtract=function(e){var t=Ee();return this.subTo(e,t),t},Be.prototype.multiply=function(e){var t=Ee();return this.multiplyTo(e,t),t},Be.prototype.divide=function(e){var t=Ee();return this.divRemTo(e,t,null),t},Be.prototype.remainder=function(e){var t=Ee();return this.divRemTo(e,null,t),t},Be.prototype.divideAndRemainder=function(e){var t=Ee(),r=Ee();return this.divRemTo(e,t,r),new Array(t,r)},Be.prototype.modPow=function(e,t){var r,n,o=e.bitLength(),a=xe(1);if(o<=0)return a;r=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new Ne(t):t.isEven()?new Ke(t):new Le(t);var i=new Array,s=3,c=r-1,l=(1<<r)-1;if(i[1]=n.convert(this),r>1){var u=Ee();for(n.sqrTo(i[1],u);s<=l;)i[s]=Ee(),n.mulTo(u,i[s-2],i[s]),s+=2}var d,f,p=e.t-1,h=!0,m=Ee();for(o=Re(e.data[p])-1;p>=0;){for(o>=c?d=e.data[p]>>o-c&l:(d=(e.data[p]&(1<<o+1)-1)<<c-o,p>0&&(d|=e.data[p-1]>>this.DB+o-c)),s=r;0==(1&d);)d>>=1,--s;if((o-=s)<0&&(o+=this.DB,--p),h)i[d].copyTo(a),h=!1;else{for(;s>1;)n.sqrTo(a,m),n.sqrTo(m,a),s-=2;s>0?n.sqrTo(a,m):(f=a,a=m,m=f),n.mulTo(m,i[d],a)}for(;p>=0&&0==(e.data[p]&1<<o);)n.sqrTo(a,m),f=a,a=m,m=f,--o<0&&(o=this.DB-1,--p)}return n.revert(a)},Be.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return Be.ZERO;for(var r=e.clone(),n=this.clone(),o=xe(1),a=xe(0),i=xe(0),s=xe(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(o.isEven()&&a.isEven()||(o.addTo(this,o),a.subTo(e,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);r.compareTo(n)>=0?(r.subTo(n,r),t&&o.subTo(i,o),a.subTo(s,a)):(n.subTo(r,n),t&&i.subTo(o,i),s.subTo(a,s))}return 0!=n.compareTo(Be.ONE)?Be.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s},Be.prototype.pow=function(e){return this.exp(e,new Ve)},Be.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var o=t.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return t;for(o<a&&(a=o),a>0&&(t.rShiftTo(a,t),r.rShiftTo(a,r));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r},Be.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=He[He.length-1]){for(t=0;t<He.length;++t)if(r.data[0]==He[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<He.length;){for(var n=He[t],o=t+1;o<He.length&&n<qe;)n*=He[o++];for(n=r.modInt(n);t<o;)if(n%He[t++]==0)return!1}return r.millerRabin(e)},C((function(e){var t=e.exports=V.sha1=V.sha1||{};V.md.sha1=V.md.algorithms.sha1=t,t.create=function(){n||(r=String.fromCharCode(128),r+=V.util.fillString(String.fromCharCode(0),64),n=!0);var e=null,t=V.util.createBuffer(),a=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,n=0;n<r;++n)i.fullMessageLength.push(0);return t=V.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(r,n){"utf8"===n&&(r=V.util.encodeUtf8(r));var s=r.length;i.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=s[1],s[1]=s[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(r),o(e,a,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var n=V.util.createBuffer();n.putBytes(t.bytes());var s,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;n.putBytes(r.substr(0,i.blockLength-c));for(var l=8*i.fullMessageLength[0],u=0;u<i.fullMessageLength.length-1;++u)l+=(s=8*i.fullMessageLength[u+1])/4294967296>>>0,n.putInt32(l>>>0),l=s>>>0;n.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(d,a,n);var f=V.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f},i};var r=null,n=!1;function o(e,t,r){for(var n,o,a,i,s,c,l,u=r.length();u>=64;){for(o=e.h0,a=e.h1,i=e.h2,s=e.h3,c=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,n=(o<<5|o>>>27)+(s^a&(i^s))+c+1518500249+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;for(;l<20;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(o<<5|o>>>27)+(s^a&(i^s))+c+1518500249+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;for(;l<32;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(o<<5|o>>>27)+(a^i^s)+c+1859775393+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;for(;l<40;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(o<<5|o>>>27)+(a^i^s)+c+1859775393+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;for(;l<60;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(o<<5|o>>>27)+(a&i|s&(a^i))+c+2400959708+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;for(;l<80;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(o<<5|o>>>27)+(a^i^s)+c+3395469782+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;e.h0=e.h0+o|0,e.h1=e.h1+a|0,e.h2=e.h2+i|0,e.h3=e.h3+s|0,e.h4=e.h4+c|0,u-=64}}})),C((function(e){var t=e.exports=V.pkcs1=V.pkcs1||{};function r(e,t,r){r||(r=V.md.sha1.create());for(var n="",o=Math.ceil(t/r.digestLength),a=0;a<o;++a){var i=String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,255&a);r.start(),r.update(e+i),n+=r.digest().getBytes()}return n.substring(0,t)}t.encode_rsa_oaep=function(e,t,n){var o,a,i,s;"string"==typeof n?(o=n,a=arguments[3]||void 0,i=arguments[4]||void 0):n&&(o=n.label||void 0,a=n.seed||void 0,i=n.md||void 0,n.mgf1&&n.mgf1.md&&(s=n.mgf1.md)),i?i.start():i=V.md.sha1.create(),s||(s=i);var c=Math.ceil(e.n.bitLength()/8),l=c-2*i.digestLength-2;if(t.length>l)throw(h=new Error("RSAES-OAEP input message length is too long.")).length=t.length,h.maxLength=l,h;o||(o=""),i.update(o,"raw");for(var u=i.digest(),d="",f=l-t.length,p=0;p<f;p++)d+="\0";var h,m=u.getBytes()+d+""+t;if(a){if(a.length!==i.digestLength)throw(h=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=a.length,h.digestLength=i.digestLength,h}else a=V.random.getBytes(i.digestLength);var g=r(a,c-i.digestLength-1,s),v=V.util.xorBytes(m,g,m.length),y=r(v,i.digestLength,s);return"\0"+V.util.xorBytes(a,y,a.length)+v},t.decode_rsa_oaep=function(e,t,n){var o,a,i;"string"==typeof n?(o=n,a=arguments[3]||void 0):n&&(o=n.label||void 0,a=n.md||void 0,n.mgf1&&n.mgf1.md&&(i=n.mgf1.md));var s=Math.ceil(e.n.bitLength()/8);if(t.length!==s)throw(g=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,g.expectedLength=s,g;if(void 0===a?a=V.md.sha1.create():a.start(),i||(i=a),s<2*a.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");o||(o=""),a.update(o,"raw");for(var c=a.digest().getBytes(),l=t.charAt(0),u=t.substring(1,a.digestLength+1),d=t.substring(1+a.digestLength),f=r(d,a.digestLength,i),p=r(V.util.xorBytes(u,f,u.length),s-a.digestLength-1,i),h=V.util.xorBytes(d,p,d.length),m=h.substring(0,a.digestLength),g="\0"!==l,v=0;v<a.digestLength;++v)g|=c.charAt(v)!==m.charAt(v);for(var y=1,b=a.digestLength,C=a.digestLength;C<h.length;C++){var w=h.charCodeAt(C);g|=w&(y?65534:0),b+=y&=1&w^1}if(g||1!==h.charCodeAt(b))throw new Error("Invalid RSAES-OAEP padding.");return h.substring(b+1)}})),C((function(e){!function(){if(V.prime)e.exports=V.prime;else{var t=e.exports=V.prime=V.prime||{},r=V.jsbn.BigInteger,n=[6,4,2,4,2,4,6,2],o=new r(null);o.fromInt(30);var a=function(e,t){return e|t};t.generateProbablePrime=function(e,t,n){"function"==typeof t&&(n=t,t={});var o=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof o&&(o={name:o}),o.options=o.options||{};var a=t.prng||V.random,c={nextBytes:function(e){for(var t=a.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===o.name)return function(e,t,n,o){return"workers"in n?function(e,t,n,o){if("undefined"==typeof Worker)return i(e,t,n,o);var a=s(e,t),c=n.workers,l=n.workLoad||100,u=30*l/8,d=n.workerScript||"forge/prime.worker.js";if(-1===c)return V.util.estimateCores((function(e,t){e&&(t=2),c=t-1,f()}));function f(){c=Math.max(1,c);for(var n=[],i=0;i<c;++i)n[i]=new Worker(d);for(i=0;i<c;++i)n[i].addEventListener("message",p);var f=!1;function p(i){if(!f){var c=i.data;if(c.found){for(var d=0;d<n.length;++d)n[d].terminate();return f=!0,o(null,new r(c.prime,16))}a.bitLength()>e&&(a=s(e,t));var p=a.toString(16);i.target.postMessage({hex:p,workLoad:l}),a.dAddOffset(u,0)}}}f()}(e,t,n,o):i(e,t,n,o)}(e,c,o.options,n);throw new Error("Invalid prime generation algorithm: "+o.name)}}function i(e,t,r,o){var a=s(e,t),i=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(a.bitLength());"millerRabinTests"in r&&(i=r.millerRabinTests);var c=10;"maxBlockTime"in r&&(c=r.maxBlockTime),function e(t,r,o,a,i,c,l){var u=+new Date;do{if(t.bitLength()>r&&(t=s(r,o)),t.isProbablePrime(i))return l(null,t);t.dAddOffset(n[a++%8],0)}while(c<0||+new Date-u<c);V.util.setImmediate((function(){e(t,r,o,a,i,c,l)}))}(a,e,t,0,i,c,o)}function s(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),a,n),n.dAddOffset(31-n.mod(o).byteValue(),0),n}}()})),void 0===Qe)var Qe=V.jsbn.BigInteger;var We=V.util.isNodejs?t:null,Ge=V.asn1,Xe=V.util;V.pki=V.pki||{},V.pki.rsa=V.rsa=V.rsa||{};var Ye=V.pki,$e=[6,4,2,4,2,4,6,2],Ze={name:"PrivateKeyInfo",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Je={name:"RSAPrivateKey",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},et={name:"RSAPublicKey",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},tt=V.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},rt=function(e){var t;if(!(e.algorithm in Ye.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=Ye.oids[e.algorithm];var n=Ge.oidToDer(t).getBytes(),o=Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[]),a=Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[]);a.value.push(Ge.create(Ge.Class.UNIVERSAL,Ge.Type.OID,!1,n)),a.value.push(Ge.create(Ge.Class.UNIVERSAL,Ge.Type.NULL,!1,""));var i=Ge.create(Ge.Class.UNIVERSAL,Ge.Type.OCTETSTRING,!1,e.digest().getBytes());return o.value.push(a),o.value.push(i),Ge.toDer(o).getBytes()},nt=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var n;t.dP||(t.dP=t.d.mod(t.p.subtract(Qe.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(Qe.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{n=new Qe(V.util.bytesToHex(V.random.getBytes(t.n.bitLength()/8)),16)}while(n.compareTo(t.n)>=0||!n.gcd(t.n).equals(Qe.ONE));for(var o=(e=e.multiply(n.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);o.compareTo(a)<0;)o=o.add(t.p);return o.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a).multiply(n.modInverse(t.n)).mod(t.n)};function ot(e,t,r){var n=V.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var a=new Error("Message is too long for PKCS#1 v1.5 padding.");throw a.length=e.length,a.max=o-11,a}n.putByte(0),n.putByte(r);var i,s=o-3-e.length;if(0===r||1===r){i=0===r?0:255;for(var c=0;c<s;++c)n.putByte(i)}else for(;s>0;){var l=0,u=V.random.getBytes(s);for(c=0;c<s;++c)0===(i=u.charCodeAt(c))?++l:n.putByte(i);s=l}return n.putByte(0),n.putBytes(e),n}function at(e,t,r,n){var o=Math.ceil(t.n.bitLength()/8),a=V.util.createBuffer(e),i=a.getByte(),s=a.getByte();if(0!==i||r&&0!==s&&1!==s||!r&&2!=s||r&&0===s&&void 0===n)throw new Error("Encryption block is invalid.");var c=0;if(0===s){c=o-3-n;for(var l=0;l<c;++l)if(0!==a.getByte())throw new Error("Encryption block is invalid.")}else if(1===s)for(c=0;a.length()>1;){if(255!==a.getByte()){--a.read;break}++c}else if(2===s)for(c=0;a.length()>1;){if(0===a.getByte()){--a.read;break}++c}if(0!==a.getByte()||c!==o-3-a.length())throw new Error("Encryption block is invalid.");return a.getBytes()}function it(e,t,r){"function"==typeof t&&(r=t,t={});var n={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function o(){a(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?i(t,e.q):void a(e.qBits,i))}))}function a(e,t){V.prime.generateProbablePrime(e,n,t)}function i(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(Qe.ONE).gcd(e.e).compareTo(Qe.ONE))return e.p=null,void o();if(0!==e.q.subtract(Qe.ONE).gcd(e.e).compareTo(Qe.ONE))return e.q=null,void a(e.qBits,i);if(e.p1=e.p.subtract(Qe.ONE),e.q1=e.q.subtract(Qe.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(Qe.ONE))return e.p=e.q=null,void o();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,i);var c=e.e.modInverse(e.phi);e.keys={privateKey:Ye.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:Ye.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(n.prng=t.prng),o()}function st(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=V.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function ct(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function lt(e){return V.util.isNodejs&&"function"==typeof We[e]}function ut(e){return void 0!==Xe.globalScope&&"object"==w(Xe.globalScope.crypto)&&"object"==w(Xe.globalScope.crypto.subtle)&&"function"==typeof Xe.globalScope.crypto.subtle[e]}function dt(e){return void 0!==Xe.globalScope&&"object"==w(Xe.globalScope.msCrypto)&&"object"==w(Xe.globalScope.msCrypto.subtle)&&"function"==typeof Xe.globalScope.msCrypto.subtle[e]}function ft(e){for(var t=V.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}if(Ye.rsa.encrypt=function(e,t,r){var n,o=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(o=2===r,n=ot(e,t,r)):(n=V.util.createBuffer()).putBytes(e);for(var i=new Qe(n.toHex(),16),s=nt(i,t,o).toString(16),c=V.util.createBuffer(),l=a-Math.ceil(s.length/2);l>0;)c.putByte(0),--l;return c.putBytes(V.util.hexToBytes(s)),c.getBytes()},Ye.rsa.decrypt=function(e,t,r,n){var o=Math.ceil(t.n.bitLength()/8);if(e.length!==o){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=o,a}var i=new Qe(V.util.createBuffer(e).toHex(),16);if(i.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var s=nt(i,t,r).toString(16),c=V.util.createBuffer(),l=o-Math.ceil(s.length/2);l>0;)c.putByte(0),--l;return c.putBytes(V.util.hexToBytes(s)),!1!==n?at(c.getBytes(),t,r):c.getBytes()},Ye.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var n,o=(r=r||{}).prng||V.random,a={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},i=r.algorithm||"PRIMEINC";if("PRIMEINC"!==i)throw new Error("Invalid key generation algorithm: "+i);return(n={algorithm:i,state:0,bits:e,rng:a,eInt:t||65537,e:new Qe(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(n.eInt),n},Ye.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new Qe(null);r.fromInt(30);for(var n,o=0,a=function(e,t){return e|t},i=+new Date,s=0;null===e.keys&&(t<=0||s<t);){if(0===e.state){var c=null===e.p?e.pBits:e.qBits,l=c-1;0===e.pqState?(e.num=new Qe(c,e.rng),e.num.testBit(l)||e.num.bitwiseTo(Qe.ONE.shiftLeft(l),a,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),o=0,++e.pqState):1===e.pqState?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(ct(e.num.bitLength()))?++e.pqState:e.num.dAddOffset($e[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(Qe.ONE).gcd(e.e).compareTo(Qe.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(Qe.ONE),e.q1=e.q.subtract(Qe.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(Qe.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var u=e.e.modInverse(e.phi);e.keys={privateKey:Ye.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:Ye.rsa.setPublicKey(e.n,e.e)}}s+=(n=+new Date)-i,i=n}return null!==e.keys},Ye.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==w(e)?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(lt("generateKeyPair"))return We.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return n(e);n(null,{privateKey:Ye.privateKeyFromPem(r),publicKey:Ye.publicKeyFromPem(t)})}));if(ut("generateKey")&&ut("exportKey"))return Xe.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ft(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return Xe.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){n(e)})).then((function(e){if(e){var t=Ye.privateKeyFromAsn1(Ge.fromDer(V.util.createBuffer(e)));n(null,{privateKey:t,publicKey:Ye.setRsaPublicKey(t.n,t.e)})}}));if(dt("generateKey")&&dt("exportKey")){var o=Xe.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ft(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return o.oncomplete=function(e){var t=e.target.result,r=Xe.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=Ye.privateKeyFromAsn1(Ge.fromDer(V.util.createBuffer(t)));n(null,{privateKey:r,publicKey:Ye.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(o.onerror=function(e){n(e)})}}else if(lt("generateKeyPairSync")){var a=We.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Ye.privateKeyFromPem(a.privateKey),publicKey:Ye.publicKeyFromPem(a.publicKey)}}var i=Ye.rsa.createKeyPairGenerationState(e,t,r);if(!n)return Ye.rsa.stepKeyPairGenerationState(i,0),i.keys;it(i,r,n)},Ye.setRsaPublicKey=Ye.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,n){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return ot(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return V.pkcs1.encode_rsa_oaep(t,e,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,r,!0);return Ye.rsa.encrypt(o,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=at(t,r,!0),e===Ge.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===at(t,r,!0)}});var o=Ye.rsa.decrypt(t,r,!0,!1);return n.verify(e,o,r.n.bitLength())}};return r},Ye.setRsaPrivateKey=Ye.rsa.setPrivateKey=function(e,t,r,n,o,a,i,s){var c={n:e,e:t,d:r,p:n,q:o,dP:a,dQ:i,qInv:s,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=Ye.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:at};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return V.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,c,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:rt},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,c.n.bitLength());return Ye.rsa.encrypt(n,c,r)}};return c},Ye.wrapRsaPrivateKey=function(e){return Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,Ge.integerToDer(0).getBytes()),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.OID,!1,Ge.oidToDer(Ye.oids.rsaEncryption).getBytes()),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.NULL,!1,"")]),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.OCTETSTRING,!1,Ge.toDer(e).getBytes())])},Ye.privateKeyFromAsn1=function(e){var t,r,n,o,a,i,s,c,l={},u=[];if(Ge.validate(e,Ze,l,u)&&(e=Ge.fromDer(V.util.createBuffer(l.privateKey))),l={},u=[],!Ge.validate(e,Je,l,u)){var d=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw d.errors=u,d}return t=V.util.createBuffer(l.privateKeyModulus).toHex(),r=V.util.createBuffer(l.privateKeyPublicExponent).toHex(),n=V.util.createBuffer(l.privateKeyPrivateExponent).toHex(),o=V.util.createBuffer(l.privateKeyPrime1).toHex(),a=V.util.createBuffer(l.privateKeyPrime2).toHex(),i=V.util.createBuffer(l.privateKeyExponent1).toHex(),s=V.util.createBuffer(l.privateKeyExponent2).toHex(),c=V.util.createBuffer(l.privateKeyCoefficient).toHex(),Ye.setRsaPrivateKey(new Qe(t,16),new Qe(r,16),new Qe(n,16),new Qe(o,16),new Qe(a,16),new Qe(i,16),new Qe(s,16),new Qe(c,16))},Ye.privateKeyToAsn1=Ye.privateKeyToRSAPrivateKey=function(e){return Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,Ge.integerToDer(0).getBytes()),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.n)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.e)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.d)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.p)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.q)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.dP)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.dQ)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.qInv))])},Ye.publicKeyFromAsn1=function(e){var t={},r=[];if(Ge.validate(e,tt,t,r)){var n,o=Ge.derToOid(t.publicKeyOid);if(o!==Ye.oids.rsaEncryption)throw(n=new Error("Cannot read public key. Unknown OID.")).oid=o,n;e=t.rsaPublicKey}if(r=[],!Ge.validate(e,et,t,r))throw(n=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,n;var a=V.util.createBuffer(t.publicKeyModulus).toHex(),i=V.util.createBuffer(t.publicKeyExponent).toHex();return Ye.setRsaPublicKey(new Qe(a,16),new Qe(i,16))},Ye.publicKeyToAsn1=Ye.publicKeyToSubjectPublicKeyInfo=function(e){return Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.OID,!1,Ge.oidToDer(Ye.oids.rsaEncryption).getBytes()),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.NULL,!1,"")]),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.BITSTRING,!1,[Ye.publicKeyToRSAPublicKey(e)])])},Ye.publicKeyToRSAPublicKey=function(e){return Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.n)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.e))])},void 0===pt)var pt=V.jsbn.BigInteger;var ht=V.asn1,mt=V.pki=V.pki||{},gt=(mt.pbe=V.pbe=V.pbe||{},mt.oids),vt={name:"EncryptedPrivateKeyInfo",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},yt={name:"PBES2Algorithms",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},bt={name:"pkcs-12PbeParams",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,capture:"iterations"}]};function Ct(e,t){return e.start().update(t).digest().getBytes()}function wt(e){var t;if(e){if(!(t=mt.oids[ht.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return kt(t)}function kt(e){var t=V.md;switch(e){case"hmacWithSHA224":t=V.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}mt.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n,o,a,i=V.random.getBytesSync(r.saltSize),s=r.count,c=ht.integerToDer(s);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var l,u,d;switch(r.algorithm){case"aes128":n=16,l=16,u=gt["aes128-CBC"],d=V.aes.createEncryptionCipher;break;case"aes192":n=24,l=16,u=gt["aes192-CBC"],d=V.aes.createEncryptionCipher;break;case"aes256":n=32,l=16,u=gt["aes256-CBC"],d=V.aes.createEncryptionCipher;break;case"des":n=8,l=8,u=gt.desCBC,d=V.des.createEncryptionCipher;break;default:throw(v=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,v}var f="hmacWith"+r.prfAlgorithm.toUpperCase(),p=kt(f),h=V.pkcs5.pbkdf2(t,i,s,n,p),m=V.random.getBytesSync(l);(y=d(h)).start(m),y.update(ht.toDer(e)),y.finish(),a=y.output.getBytes();var g=function(e,t,r,n){var o=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,e),ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==n&&o.value.push(ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,V.util.hexToBytes(r.toString(16))),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(mt.oids[n]).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.NULL,!1,"")])),o}(i,c,n,f);o=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt.pkcs5PBES2).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt.pkcs5PBKDF2).getBytes()),g]),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(u).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,m)])])])}else{var v;if("3des"!==r.algorithm)throw(v=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,v;n=24;var y,b=new V.util.ByteBuffer(i);h=mt.pbe.generatePkcs12Key(t,b,1,s,n),m=mt.pbe.generatePkcs12Key(t,b,2,s,n),(y=V.des.createEncryptionCipher(h)).start(m),y.update(ht.toDer(e)),y.finish(),a=y.output.getBytes(),o=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,i),ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,c.getBytes())])])}return ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[o,ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,a)])},mt.decryptPrivateKeyInfo=function(e,t){var r=null,n={},o=[];if(!ht.validate(e,vt,n,o)){var a=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=o,a}var i=ht.derToOid(n.encryptionOid),s=mt.pbe.getCipher(i,n.encryptionParams,t),c=V.util.createBuffer(n.encryptedData);return s.update(c),s.finish()&&(r=ht.fromDer(s.output)),r},mt.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:ht.toDer(e).getBytes()};return V.pem.encode(r,{maxline:t})},mt.encryptedPrivateKeyFromPem=function(e){var t=V.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return ht.fromDer(t.body)},mt.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var n=mt.wrapRsaPrivateKey(mt.privateKeyToAsn1(e));return n=mt.encryptPrivateKeyInfo(n,t,r),mt.encryptedPrivateKeyToPem(n)}var o,a,i,s;switch(r.algorithm){case"aes128":o="AES-128-CBC",i=16,a=V.random.getBytesSync(16),s=V.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",i=24,a=V.random.getBytesSync(16),s=V.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",i=32,a=V.random.getBytesSync(16),s=V.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",i=24,a=V.random.getBytesSync(8),s=V.des.createEncryptionCipher;break;case"des":o="DES-CBC",i=8,a=V.random.getBytesSync(8),s=V.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw c.algorithm=r.algorithm,c}var l=s(V.pbe.opensslDeriveBytes(t,a.substr(0,8),i));l.start(a),l.update(ht.toDer(mt.privateKeyToAsn1(e))),l.finish();var u={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:V.util.bytesToHex(a).toUpperCase()},body:l.output.getBytes()};return V.pem.encode(u)},mt.decryptRsaPrivateKey=function(e,t){var r=null,n=V.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==n.type&&"PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type)throw(i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=i,i;if(n.procType&&"ENCRYPTED"===n.procType.type){var o,a;switch(n.dekInfo.algorithm){case"DES-CBC":o=8,a=V.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,a=V.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,a=V.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,a=V.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,a=V.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,a=function(e){return V.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":o=8,a=function(e){return V.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":o=16,a=function(e){return V.rc2.createDecryptionCipher(e,128)};break;default:var i;throw(i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".')).algorithm=n.dekInfo.algorithm,i}var s=V.util.hexToBytes(n.dekInfo.parameters),c=a(V.pbe.opensslDeriveBytes(t,s.substr(0,8),o));if(c.start(s),c.update(V.util.createBuffer(n.body)),!c.finish())return r;r=c.output.getBytes()}else r=n.body;return null!==(r="ENCRYPTED PRIVATE KEY"===n.type?mt.decryptPrivateKeyInfo(ht.fromDer(r),t):ht.fromDer(r))&&(r=mt.privateKeyFromAsn1(r)),r},mt.pbe.generatePkcs12Key=function(e,t,r,n,o,a){var i,s;if(null==a){if(!("sha1"in V.md))throw new Error('"sha1" hash algorithm unavailable.');a=V.md.sha1.create()}var c=a.digestLength,l=a.blockLength,u=new V.util.ByteBuffer,d=new V.util.ByteBuffer;if(null!=e){for(s=0;s<e.length;s++)d.putInt16(e.charCodeAt(s));d.putInt16(0)}var f=d.length(),p=t.length(),h=new V.util.ByteBuffer;h.fillWithByte(r,l);var m=l*Math.ceil(p/l),g=new V.util.ByteBuffer;for(s=0;s<m;s++)g.putByte(t.at(s%p));var v=l*Math.ceil(f/l),y=new V.util.ByteBuffer;for(s=0;s<v;s++)y.putByte(d.at(s%f));var b=g;b.putBuffer(y);for(var C=Math.ceil(o/c),w=1;w<=C;w++){var k=new V.util.ByteBuffer;k.putBytes(h.bytes()),k.putBytes(b.bytes());for(var B=0;B<n;B++)a.start(),a.update(k.getBytes()),k=a.digest();var E=new V.util.ByteBuffer;for(s=0;s<l;s++)E.putByte(k.at(s%c));var S=Math.ceil(p/l)+Math.ceil(f/l),A=new V.util.ByteBuffer;for(i=0;i<S;i++){var _=new V.util.ByteBuffer(b.getBytes(l)),I=511;for(s=E.length()-1;s>=0;s--)I>>=8,I+=E.at(s)+_.at(s),_.setAt(s,255&I);A.putBuffer(_)}b=A,u.putBuffer(k)}return u.truncate(u.length()-o),u},mt.pbe.getCipher=function(e,t,r){switch(e){case mt.oids.pkcs5PBES2:return mt.pbe.getCipherForPBES2(e,t,r);case mt.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case mt.oids["pbewithSHAAnd40BitRC2-CBC"]:return mt.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},mt.pbe.getCipherForPBES2=function(e,t,r){var n,o={},a=[];if(!ht.validate(t,yt,o,a))throw(n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,n;if((e=ht.derToOid(o.kdfOid))!==mt.oids.pkcs5PBKDF2)throw(n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,n.supportedOids=["pkcs5PBKDF2"],n;if((e=ht.derToOid(o.encOid))!==mt.oids["aes128-CBC"]&&e!==mt.oids["aes192-CBC"]&&e!==mt.oids["aes256-CBC"]&&e!==mt.oids["des-EDE3-CBC"]&&e!==mt.oids.desCBC)throw(n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n;var i,s,c=o.kdfSalt,l=V.util.createBuffer(o.kdfIterationCount);switch(l=l.getInt(l.length()<<3),mt.oids[e]){case"aes128-CBC":i=16,s=V.aes.createDecryptionCipher;break;case"aes192-CBC":i=24,s=V.aes.createDecryptionCipher;break;case"aes256-CBC":i=32,s=V.aes.createDecryptionCipher;break;case"des-EDE3-CBC":i=24,s=V.des.createDecryptionCipher;break;case"desCBC":i=8,s=V.des.createDecryptionCipher}var u=wt(o.prfOid),d=V.pkcs5.pbkdf2(r,c,l,i,u),f=o.encIv,p=s(d);return p.start(f),p},mt.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},o=[];if(!ht.validate(t,bt,n,o))throw(u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,u;var a,i,s,c=V.util.createBuffer(n.salt),l=V.util.createBuffer(n.iterations);switch(l=l.getInt(l.length()<<3),e){case mt.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:a=24,i=8,s=V.des.startDecrypting;break;case mt.oids["pbewithSHAAnd40BitRC2-CBC"]:a=5,i=8,s=function(e,t){var r=V.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var u;throw(u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,u}var d=wt(n.prfOid),f=mt.pbe.generatePkcs12Key(r,c,1,l,a,d);return d.start(),s(f,mt.pbe.generatePkcs12Key(r,c,2,l,i,d))},mt.pbe.opensslDeriveBytes=function(e,t,r,n){if(null==n){if(!("md5"in V.md))throw new Error('"md5" hash algorithm unavailable.');n=V.md.md5.create()}null===t&&(t="");for(var o=[Ct(n,e+t)],a=16,i=1;a<r;++i,a+=16)o.push(Ct(n,o[i-1]+e+t));return o.join("").substr(0,r)},C((function(e){var t=V.asn1,r=e.exports=V.pkcs7asn1=V.pkcs7asn1||{};V.pkcs7=V.pkcs7||{},V.pkcs7.asn1=r;var n={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};r.contentInfoValidator=n;var o={name:"EncryptedContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};r.envelopedDataValidator={name:"EnvelopedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(o)},r.encryptedDataValidator={name:"EncryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"}].concat(o)};var a={name:"SignerInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};r.signedDataValidator={name:"SignedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},n,{name:"SignedData.Certificates",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,capture:"signerInfos",optional:!0,value:[a]}]},r.recipientInfoValidator={name:"RecipientInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}})),C((function(e){V.mgf=V.mgf||{},(e.exports=V.mgf.mgf1=V.mgf1=V.mgf1||{}).create=function(e){return{generate:function(t,r){for(var n=new V.util.ByteBuffer,o=Math.ceil(r/e.digestLength),a=0;a<o;a++){var i=new V.util.ByteBuffer;i.putInt32(a),e.start(),e.update(t+i.getBytes()),n.putBuffer(e.digest())}return n.truncate(n.length()-r),n.getBytes()}}}})),V.mgf=V.mgf||{},V.mgf.mgf1=V.mgf1,C((function(e){(e.exports=V.pss=V.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,n=e.mgf,o=r.digestLength,a=e.salt||null;if("string"==typeof a&&(a=V.util.createBuffer(a)),"saltLength"in e)t=e.saltLength;else{if(null===a)throw new Error("Salt length not specified or specific salt not given.");t=a.length()}if(null!==a&&a.length()!==t)throw new Error("Given salt length does not match length of given salt.");var i=e.prng||V.random;return{encode:function(e,s){var c,l,u=s-1,d=Math.ceil(u/8),f=e.digest().getBytes();if(d<o+t+2)throw new Error("Message is too long to encrypt.");l=null===a?i.getBytesSync(t):a.bytes();var p=new V.util.ByteBuffer;p.fillWithByte(0,8),p.putBytes(f),p.putBytes(l),r.start(),r.update(p.getBytes());var h=r.digest().getBytes(),m=new V.util.ByteBuffer;m.fillWithByte(0,d-t-o-2),m.putByte(1),m.putBytes(l);var g=m.getBytes(),v=d-o-1,y=n.generate(h,v),b="";for(c=0;c<v;c++)b+=String.fromCharCode(g.charCodeAt(c)^y.charCodeAt(c));var C=65280>>8*d-u&255;return(b=String.fromCharCode(b.charCodeAt(0)&~C)+b.substr(1))+h+String.fromCharCode(188)},verify:function(e,a,i){var s,c=i-1,l=Math.ceil(c/8);if(a=a.substr(-l),l<o+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==a.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var u=l-o-1,d=a.substr(0,u),f=a.substr(u,o),p=65280>>8*l-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var h=n.generate(f,u),m="";for(s=0;s<u;s++)m+=String.fromCharCode(d.charCodeAt(s)^h.charCodeAt(s));m=String.fromCharCode(m.charCodeAt(0)&~p)+m.substr(1);var g=l-o-t-2;for(s=0;s<g;s++)if(0!==m.charCodeAt(s))throw new Error("Leftmost octets not zero as expected");if(1!==m.charCodeAt(g))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=m.substr(-t),y=new V.util.ByteBuffer;return y.fillWithByte(0,8),y.putBytes(e),y.putBytes(v),r.start(),r.update(y.getBytes()),f===r.digest().getBytes()}}}})),C((function(e){var t=V.asn1,r=e.exports=V.pki=V.pki||{},n=r.oids,o={};o.CN=n.commonName,o.commonName="CN",o.C=n.countryName,o.countryName="C",o.L=n.localityName,o.localityName="L",o.ST=n.stateOrProvinceName,o.stateOrProvinceName="ST",o.O=n.organizationName,o.organizationName="O",o.OU=n.organizationalUnitName,o.organizationalUnitName="OU",o.E=n.emailAddress,o.emailAddress="E";var a=V.pki.rsa.publicKeyValidator,i={name:"Certificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},a,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},s={name:"rsapss",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},c={name:"CertificationRequestInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},a,{name:"CertificationRequestInfo.attributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0}]}]}]},l={name:"CertificationRequest",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[c,{name:"CertificationRequest.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function u(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,o=0;null===n&&o<e.attributes.length;++o)r=e.attributes[o],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n}r.RDNAttributesAsArray=function(e,r){for(var a,i,s,c=[],l=0;l<e.value.length;++l){a=e.value[l];for(var u=0;u<a.value.length;++u)s={},i=a.value[u],s.type=t.derToOid(i.value[0].value),s.value=i.value[1].value,s.valueTagClass=i.value[1].type,s.type in n&&(s.name=n[s.type],s.name in o&&(s.shortName=o[s.name])),r&&(r.update(s.type),r.update(s.value)),c.push(s)}return c},r.CRIAttributesAsArray=function(e){for(var a=[],i=0;i<e.length;++i)for(var s=e[i],c=t.derToOid(s.value[0].value),l=s.value[1].value,u=0;u<l.length;++u){var d={};if(d.type=c,d.value=l[u].value,d.valueTagClass=l[u].type,d.type in n&&(d.name=n[d.type],d.name in o&&(d.shortName=o[d.name])),d.type===n.extensionRequest){d.extensions=[];for(var f=0;f<d.value.length;++f)d.extensions.push(r.certificateExtensionFromAsn1(d.value[f]))}a.push(d)}return a};var d=function(e,r,o){var a={};if(e!==n["RSASSA-PSS"])return a;o&&(a={hash:{algorithmOid:n.sha1},mgf:{algorithmOid:n.mgf1,hash:{algorithmOid:n.sha1}},saltLength:20});var i={},c=[];if(!t.validate(r,s,i,c)){var l=new Error("Cannot read RSASSA-PSS parameter block.");throw l.errors=c,l}return void 0!==i.hashOid&&(a.hash=a.hash||{},a.hash.algorithmOid=t.derToOid(i.hashOid)),void 0!==i.maskGenOid&&(a.mgf=a.mgf||{},a.mgf.algorithmOid=t.derToOid(i.maskGenOid),a.mgf.hash=a.mgf.hash||{},a.mgf.hash.algorithmOid=t.derToOid(i.maskGenHashOid)),void 0!==i.saltLength&&(a.saltLength=i.saltLength.charCodeAt(0)),a};function f(e){for(var r,n,o=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),a=e.attributes,i=0;i<a.length;++i){var s=(r=a[i]).value,c=t.Type.PRINTABLESTRING;"valueTagClass"in r&&(c=r.valueTagClass)===t.Type.UTF8&&(s=V.util.encodeUtf8(s)),n=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.type).getBytes()),t.create(t.Class.UNIVERSAL,c,!1,s)])]),o.value.push(n)}return o}function p(e){for(var a,i=0;i<e.length;++i){if(void 0===(a=e[i]).name&&(a.type&&a.type in r.oids?a.name=r.oids[a.type]:a.shortName&&a.shortName in o&&(a.name=r.oids[o[a.shortName]])),void 0===a.type){if(!a.name||!(a.name in r.oids))throw(c=new Error("Attribute type not specified.")).attribute=a,c;a.type=r.oids[a.name]}if(void 0===a.shortName&&a.name&&a.name in o&&(a.shortName=o[a.name]),a.type===n.extensionRequest&&(a.valueConstructed=!0,a.valueTagClass=t.Type.SEQUENCE,!a.value&&a.extensions)){a.value=[];for(var s=0;s<a.extensions.length;++s)a.value.push(r.certificateExtensionToAsn1(h(a.extensions[s])))}var c;if(void 0===a.value)throw(c=new Error("Attribute value not specified.")).attribute=a,c}}function h(e,o){if(o=o||{},void 0===e.name&&e.id&&e.id in r.oids&&(e.name=r.oids[e.id]),void 0===e.id){if(!e.name||!(e.name in r.oids))throw(C=new Error("Extension ID not specified.")).extension=e,C;e.id=r.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var a=0,i=0,s=0;e.digitalSignature&&(i|=128,a=7),e.nonRepudiation&&(i|=64,a=6),e.keyEncipherment&&(i|=32,a=5),e.dataEncipherment&&(i|=16,a=4),e.keyAgreement&&(i|=8,a=3),e.keyCertSign&&(i|=4,a=2),e.cRLSign&&(i|=2,a=1),e.encipherOnly&&(i|=1,a=0),e.decipherOnly&&(s|=128,a=7);var c=String.fromCharCode(a);0!==s?c+=String.fromCharCode(i)+String.fromCharCode(s):0!==i&&(c+=String.fromCharCode(i)),e.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c)}else if("basicConstraints"===e.name)e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);var l=e.value.value;for(var u in e)!0===e[u]&&(u in n?l.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n[u]).getBytes())):-1!==u.indexOf(".")&&l.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(u).getBytes())))}else if("nsCertType"===e.name)a=0,i=0,e.client&&(i|=128,a=7),e.server&&(i|=64,a=6),e.email&&(i|=32,a=5),e.objsign&&(i|=16,a=4),e.reserved&&(i|=8,a=3),e.sslCA&&(i|=4,a=2),e.emailCA&&(i|=2,a=1),e.objCA&&(i|=1,a=0),c=String.fromCharCode(a),0!==i&&(c+=String.fromCharCode(i)),e.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c);else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);for(var d=0;d<e.altNames.length;++d){if(c=(v=e.altNames[d]).value,7===v.type&&v.ip){if(null===(c=V.util.bytesFromIP(v.ip)))throw(C=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,C}else 8===v.type&&(c=v.oid?t.oidToDer(t.oidToDer(v.oid)):t.oidToDer(c));e.value.value.push(t.create(t.Class.CONTEXT_SPECIFIC,v.type,!1,c))}}else if("nsComment"===e.name&&o.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=t.create(t.Class.UNIVERSAL,t.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&o.cert){var p=o.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=p.toHex(),e.value=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===e.name&&o.cert){if(e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),l=e.value.value,e.keyIdentifier){var h=!0===e.keyIdentifier?o.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!1,h))}if(e.authorityCertIssuer){var m=[t.create(t.Class.CONTEXT_SPECIFIC,4,!0,[f(!0===e.authorityCertIssuer?o.cert.issuer:e.authorityCertIssuer)])];l.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var g=V.util.hexToBytes(!0===e.serialNumber?o.cert.serialNumber:e.serialNumber);l.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!1,g))}}else if("cRLDistributionPoints"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),l=e.value.value;var v,y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),b=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d<e.altNames.length;++d){if(c=(v=e.altNames[d]).value,7===v.type&&v.ip){if(null===(c=V.util.bytesFromIP(v.ip)))throw(C=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,C}else 8===v.type&&(c=v.oid?t.oidToDer(t.oidToDer(v.oid)):t.oidToDer(c));b.value.push(t.create(t.Class.CONTEXT_SPECIFIC,v.type,!1,c))}y.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[b])),l.push(y)}var C;if(void 0===e.value)throw(C=new Error("Extension value not specified.")).extension=e,C;return e}function m(e,r){switch(e){case n["RSASSA-PSS"]:var o=[];return void 0!==r.hash.algorithmOid&&o.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])),void 0!==r.mgf.algorithmOid&&o.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])])),void 0!==r.saltLength&&o.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.saltLength).getBytes())])),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,o);default:return t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")}}function g(e){var r=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return r;for(var n=e.attributes,o=0;o<n.length;++o){var a=n[o],i=a.value,s=t.Type.UTF8;"valueTagClass"in a&&(s=a.valueTagClass),s===t.Type.UTF8&&(i=V.util.encodeUtf8(i));var c=!1;"valueConstructed"in a&&(c=a.valueConstructed);var l=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,s,c,i)])]);r.value.push(l)}return r}r.certificateFromPem=function(e,n,o){var a=V.pem.decode(e)[0];if("CERTIFICATE"!==a.type&&"X509 CERTIFICATE"!==a.type&&"TRUSTED CERTIFICATE"!==a.type){var i=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw i.headerType=a.type,i}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=t.fromDer(a.body,o);return r.certificateFromAsn1(s,n)},r.certificateToPem=function(e,n){var o={type:"CERTIFICATE",body:t.toDer(r.certificateToAsn1(e)).getBytes()};return V.pem.encode(o,{maxline:n})},r.publicKeyFromPem=function(e){var n=V.pem.decode(e)[0];if("PUBLIC KEY"!==n.type&&"RSA PUBLIC KEY"!==n.type){var o=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var a=t.fromDer(n.body);return r.publicKeyFromAsn1(a)},r.publicKeyToPem=function(e,n){var o={type:"PUBLIC KEY",body:t.toDer(r.publicKeyToAsn1(e)).getBytes()};return V.pem.encode(o,{maxline:n})},r.publicKeyToRSAPublicKeyPem=function(e,n){var o={type:"RSA PUBLIC KEY",body:t.toDer(r.publicKeyToRSAPublicKey(e)).getBytes()};return V.pem.encode(o,{maxline:n})},r.getPublicKeyFingerprint=function(e,n){var o,a=(n=n||{}).md||V.md.sha1.create();switch(n.type||"RSAPublicKey"){case"RSAPublicKey":o=t.toDer(r.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":o=t.toDer(r.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+n.type+'".')}a.start(),a.update(o);var i=a.digest();if("hex"===n.encoding){var s=i.toHex();return n.delimiter?s.match(/.{2}/g).join(n.delimiter):s}if("binary"===n.encoding)return i.getBytes();if(n.encoding)throw new Error('Unknown encoding "'+n.encoding+'".');return i},r.certificationRequestFromPem=function(e,n,o){var a=V.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==a.type){var i=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw i.headerType=a.type,i}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=t.fromDer(a.body,o);return r.certificationRequestFromAsn1(s,n)},r.certificationRequestToPem=function(e,n){var o={type:"CERTIFICATE REQUEST",body:t.toDer(r.certificationRequestToAsn1(e)).getBytes()};return V.pem.encode(o,{maxline:n})},r.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return u(e.issuer,t)},e.issuer.addField=function(t){p([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return u(e.subject,t)},e.subject.addField=function(t){p([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){p(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){p(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)h(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,o=0;null===n&&o<e.extensions.length;++o)r=e.extensions[o],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(n=r);return n},e.sign=function(o,a){e.md=a||V.md.sha1.create();var i=n[e.md.algorithm+"WithRSAEncryption"];if(!i){var s=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw s.algorithm=e.md.algorithm,s}e.signatureOid=e.siginfo.algorithmOid=i,e.tbsCertificate=r.getTBSCertificate(e);var c=t.toDer(e.tbsCertificate);e.md.update(c.getBytes()),e.signature=o.sign(e.md)},e.verify=function(o){var a=!1;if(!e.issued(o)){var i=o.issuer,s=e.subject;throw(h=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.")).expectedIssuer=i.attributes,h.actualIssuer=s.attributes,h}var c=o.md;if(null===c){if(o.signatureOid in n)switch(n[o.signatureOid]){case"sha1WithRSAEncryption":c=V.md.sha1.create();break;case"md5WithRSAEncryption":c=V.md.md5.create();break;case"sha256WithRSAEncryption":c=V.md.sha256.create();break;case"sha384WithRSAEncryption":c=V.md.sha384.create();break;case"sha512WithRSAEncryption":c=V.md.sha512.create();break;case"RSASSA-PSS":c=V.md.sha256.create()}if(null===c)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=o.signatureOid,h;var l=o.tbsCertificate||r.getTBSCertificate(o),u=t.toDer(l);c.update(u.getBytes())}if(null!==c){var d;switch(o.signatureOid){case n.sha1WithRSAEncryption:d=void 0;break;case n["RSASSA-PSS"]:var f,p,h;if(void 0===(f=n[o.signatureParameters.mgf.hash.algorithmOid])||void 0===V.md[f])throw(h=new Error("Unsupported MGF hash function.")).oid=o.signatureParameters.mgf.hash.algorithmOid,h.name=f,h;if(void 0===(p=n[o.signatureParameters.mgf.algorithmOid])||void 0===V.mgf[p])throw(h=new Error("Unsupported MGF function.")).oid=o.signatureParameters.mgf.algorithmOid,h.name=p,h;if(p=V.mgf[p].create(V.md[f].create()),void 0===(f=n[o.signatureParameters.hash.algorithmOid])||void 0===V.md[f])throw{message:"Unsupported RSASSA-PSS hash function.",oid:o.signatureParameters.hash.algorithmOid,name:f};d=V.pss.create(V.md[f].create(),p,o.signatureParameters.saltLength)}a=e.publicKey.verify(c.digest().getBytes(),o.signature,d)}return a},e.isIssuer=function(t){var r=!1,n=e.issuer,o=t.subject;if(n.hash&&o.hash)r=n.hash===o.hash;else if(n.attributes.length===o.attributes.length){var a,i;r=!0;for(var s=0;r&&s<n.attributes.length;++s)a=n.attributes[s],i=o.attributes[s],a.type===i.type&&a.value===i.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=n.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var o=e.extensions[r];if(o.id===t){var a=e.generateSubjectKeyIdentifier().getBytes();return V.util.hexToBytes(o.subjectKeyIdentifier)===a}}return!1},e},r.certificateFromAsn1=function(e,o){var a={},s=[];if(!t.validate(e,i,a,s))throw(h=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.")).errors=s,h;if(t.derToOid(a.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=r.createCertificate();c.version=a.certVersion?a.certVersion.charCodeAt(0):0;var l=V.util.createBuffer(a.certSerialNumber);c.serialNumber=l.toHex(),c.signatureOid=V.asn1.derToOid(a.certSignatureOid),c.signatureParameters=d(c.signatureOid,a.certSignatureParams,!0),c.siginfo.algorithmOid=V.asn1.derToOid(a.certinfoSignatureOid),c.siginfo.parameters=d(c.siginfo.algorithmOid,a.certinfoSignatureParams,!1),c.signature=a.certSignature;var f=[];if(void 0!==a.certValidity1UTCTime&&f.push(t.utcTimeToDate(a.certValidity1UTCTime)),void 0!==a.certValidity2GeneralizedTime&&f.push(t.generalizedTimeToDate(a.certValidity2GeneralizedTime)),void 0!==a.certValidity3UTCTime&&f.push(t.utcTimeToDate(a.certValidity3UTCTime)),void 0!==a.certValidity4GeneralizedTime&&f.push(t.generalizedTimeToDate(a.certValidity4GeneralizedTime)),f.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=f[0],c.validity.notAfter=f[1],c.tbsCertificate=a.tbsCertificate,o){var h;if(c.md=null,c.signatureOid in n)switch(n[c.signatureOid]){case"sha1WithRSAEncryption":c.md=V.md.sha1.create();break;case"md5WithRSAEncryption":c.md=V.md.md5.create();break;case"sha256WithRSAEncryption":c.md=V.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=V.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=V.md.sha512.create();break;case"RSASSA-PSS":c.md=V.md.sha256.create()}if(null===c.md)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,h;var m=t.toDer(c.tbsCertificate);c.md.update(m.getBytes())}var g=V.md.sha1.create();c.issuer.getField=function(e){return u(c.issuer,e)},c.issuer.addField=function(e){p([e]),c.issuer.attributes.push(e)},c.issuer.attributes=r.RDNAttributesAsArray(a.certIssuer,g),a.certIssuerUniqueId&&(c.issuer.uniqueId=a.certIssuerUniqueId),c.issuer.hash=g.digest().toHex();var v=V.md.sha1.create();return c.subject.getField=function(e){return u(c.subject,e)},c.subject.addField=function(e){p([e]),c.subject.attributes.push(e)},c.subject.attributes=r.RDNAttributesAsArray(a.certSubject,v),a.certSubjectUniqueId&&(c.subject.uniqueId=a.certSubjectUniqueId),c.subject.hash=v.digest().toHex(),a.certExtensions?c.extensions=r.certificateExtensionsFromAsn1(a.certExtensions):c.extensions=[],c.publicKey=r.publicKeyFromAsn1(a.subjectPublicKeyInfo),c},r.certificateExtensionsFromAsn1=function(e){for(var t=[],n=0;n<e.value.length;++n)for(var o=e.value[n],a=0;a<o.value.length;++a)t.push(r.certificateExtensionFromAsn1(o.value[a]));return t},r.certificateExtensionFromAsn1=function(e){var r={};if(r.id=t.derToOid(e.value[0].value),r.critical=!1,e.value[1].type===t.Type.BOOLEAN?(r.critical=0!==e.value[1].value.charCodeAt(0),r.value=e.value[2].value):r.value=e.value[1].value,r.id in n)if(r.name=n[r.id],"keyUsage"===r.name){var o=0,a=0;(s=t.fromDer(r.value)).value.length>1&&(o=s.value.charCodeAt(1),a=s.value.length>2?s.value.charCodeAt(2):0),r.digitalSignature=128==(128&o),r.nonRepudiation=64==(64&o),r.keyEncipherment=32==(32&o),r.dataEncipherment=16==(16&o),r.keyAgreement=8==(8&o),r.keyCertSign=4==(4&o),r.cRLSign=2==(2&o),r.encipherOnly=1==(1&o),r.decipherOnly=128==(128&a)}else if("basicConstraints"===r.name){(s=t.fromDer(r.value)).value.length>0&&s.value[0].type===t.Type.BOOLEAN?r.cA=0!==s.value[0].value.charCodeAt(0):r.cA=!1;var i=null;s.value.length>0&&s.value[0].type===t.Type.INTEGER?i=s.value[0].value:s.value.length>1&&(i=s.value[1].value),null!==i&&(r.pathLenConstraint=t.derToInteger(i))}else if("extKeyUsage"===r.name)for(var s=t.fromDer(r.value),c=0;c<s.value.length;++c){var l=t.derToOid(s.value[c].value);l in n?r[n[l]]=!0:r[l]=!0}else if("nsCertType"===r.name)o=0,(s=t.fromDer(r.value)).value.length>1&&(o=s.value.charCodeAt(1)),r.client=128==(128&o),r.server=64==(64&o),r.email=32==(32&o),r.objsign=16==(16&o),r.reserved=8==(8&o),r.sslCA=4==(4&o),r.emailCA=2==(2&o),r.objCA=1==(1&o);else if("subjectAltName"===r.name||"issuerAltName"===r.name){var u;r.altNames=[],s=t.fromDer(r.value);for(var d=0;d<s.value.length;++d){var f={type:(u=s.value[d]).type,value:u.value};switch(r.altNames.push(f),u.type){case 1:case 2:case 6:break;case 7:f.ip=V.util.bytesToIP(u.value);break;case 8:f.oid=t.derToOid(u.value)}}}else"subjectKeyIdentifier"===r.name&&(s=t.fromDer(r.value),r.subjectKeyIdentifier=V.util.bytesToHex(s.value));return r},r.certificationRequestFromAsn1=function(e,o){var a={},i=[];if(!t.validate(e,l,a,i))throw(c=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.")).errors=i,c;if(t.derToOid(a.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var s=r.createCertificationRequest();if(s.version=a.csrVersion?a.csrVersion.charCodeAt(0):0,s.signatureOid=V.asn1.derToOid(a.csrSignatureOid),s.signatureParameters=d(s.signatureOid,a.csrSignatureParams,!0),s.siginfo.algorithmOid=V.asn1.derToOid(a.csrSignatureOid),s.siginfo.parameters=d(s.siginfo.algorithmOid,a.csrSignatureParams,!1),s.signature=a.csrSignature,s.certificationRequestInfo=a.certificationRequestInfo,o){var c;if(s.md=null,s.signatureOid in n)switch(n[s.signatureOid]){case"sha1WithRSAEncryption":s.md=V.md.sha1.create();break;case"md5WithRSAEncryption":s.md=V.md.md5.create();break;case"sha256WithRSAEncryption":s.md=V.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=V.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=V.md.sha512.create();break;case"RSASSA-PSS":s.md=V.md.sha256.create()}if(null===s.md)throw(c=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=s.signatureOid,c;var f=t.toDer(s.certificationRequestInfo);s.md.update(f.getBytes())}var h=V.md.sha1.create();return s.subject.getField=function(e){return u(s.subject,e)},s.subject.addField=function(e){p([e]),s.subject.attributes.push(e)},s.subject.attributes=r.RDNAttributesAsArray(a.certificationRequestInfoSubject,h),s.subject.hash=h.digest().toHex(),s.publicKey=r.publicKeyFromAsn1(a.subjectPublicKeyInfo),s.getAttribute=function(e){return u(s,e)},s.addAttribute=function(e){p([e]),s.attributes.push(e)},s.attributes=r.CRIAttributesAsArray(a.certificationRequestInfoAttributes||[]),s},r.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return u(e.subject,t)},e.subject.addField=function(t){p([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return u(e,t)},e.addAttribute=function(t){p([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){p(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){p(t),e.attributes=t},e.sign=function(o,a){e.md=a||V.md.sha1.create();var i=n[e.md.algorithm+"WithRSAEncryption"];if(!i){var s=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw s.algorithm=e.md.algorithm,s}e.signatureOid=e.siginfo.algorithmOid=i,e.certificationRequestInfo=r.getCertificationRequestInfo(e);var c=t.toDer(e.certificationRequestInfo);e.md.update(c.getBytes()),e.signature=o.sign(e.md)},e.verify=function(){var o=!1,a=e.md;if(null===a){if(e.signatureOid in n)switch(n[e.signatureOid]){case"sha1WithRSAEncryption":a=V.md.sha1.create();break;case"md5WithRSAEncryption":a=V.md.md5.create();break;case"sha256WithRSAEncryption":a=V.md.sha256.create();break;case"sha384WithRSAEncryption":a=V.md.sha384.create();break;case"sha512WithRSAEncryption":a=V.md.sha512.create();break;case"RSASSA-PSS":a=V.md.sha256.create()}if(null===a)throw(d=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=e.signatureOid,d;var i=e.certificationRequestInfo||r.getCertificationRequestInfo(e),s=t.toDer(i);a.update(s.getBytes())}if(null!==a){var c;switch(e.signatureOid){case n.sha1WithRSAEncryption:break;case n["RSASSA-PSS"]:var l,u,d;if(void 0===(l=n[e.signatureParameters.mgf.hash.algorithmOid])||void 0===V.md[l])throw(d=new Error("Unsupported MGF hash function.")).oid=e.signatureParameters.mgf.hash.algorithmOid,d.name=l,d;if(void 0===(u=n[e.signatureParameters.mgf.algorithmOid])||void 0===V.mgf[u])throw(d=new Error("Unsupported MGF function.")).oid=e.signatureParameters.mgf.algorithmOid,d.name=u,d;if(u=V.mgf[u].create(V.md[l].create()),void 0===(l=n[e.signatureParameters.hash.algorithmOid])||void 0===V.md[l])throw(d=new Error("Unsupported RSASSA-PSS hash function.")).oid=e.signatureParameters.hash.algorithmOid,d.name=l,d;c=V.pss.create(V.md[l].create(),u,e.signatureParameters.saltLength)}o=e.publicKey.verify(a.digest().getBytes(),e.signature,c)}return o},e};var v=new Date("1950-01-01T00:00:00Z"),y=new Date("2050-01-01T00:00:00Z");function b(e){return e>=v&&e<y?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(e)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(e))}r.getTBSCertificate=function(e){var n=b(e.validity.notBefore),o=b(e.validity.notAfter),a=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,V.util.hexToBytes(e.serialNumber)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.siginfo.algorithmOid).getBytes()),m(e.siginfo.algorithmOid,e.siginfo.parameters)]),f(e.issuer),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,o]),f(e.subject),r.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&a.value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&a.value.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&a.value.push(r.certificateExtensionsToAsn1(e.extensions)),a},r.getCertificationRequestInfo=function(e){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),f(e.subject),r.publicKeyToAsn1(e.publicKey),g(e)])},r.distinguishedNameToAsn1=function(e){return f(e)},r.certificateToAsn1=function(e){var n=e.tbsCertificate||r.getTBSCertificate(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.certificateExtensionsToAsn1=function(e){var n=t.create(t.Class.CONTEXT_SPECIFIC,3,!0,[]),o=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);n.value.push(o);for(var a=0;a<e.length;++a)o.value.push(r.certificateExtensionToAsn1(e[a]));return n},r.certificateExtensionToAsn1=function(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.id).getBytes())),e.critical&&r.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255)));var n=e.value;return"string"!=typeof e.value&&(n=t.toDer(n).getBytes()),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n)),r},r.certificationRequestToAsn1=function(e){var n=e.certificationRequestInfo||r.getCertificationRequestInfo(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.createCaStore=function(e){var n={certs:{}};function o(e){return a(e),n.certs[e.hash]||null}function a(e){if(!e.hash){var t=V.md.sha1.create();e.attributes=r.RDNAttributesAsArray(f(e),t),e.hash=t.digest().toHex()}}if(n.getIssuer=function(e){return o(e.issuer)},n.addCertificate=function(e){if("string"==typeof e&&(e=V.pki.certificateFromPem(e)),a(e.subject),!n.hasCertificate(e))if(e.subject.hash in n.certs){var t=n.certs[e.subject.hash];V.util.isArray(t)||(t=[t]),t.push(e),n.certs[e.subject.hash]=t}else n.certs[e.subject.hash]=e},n.hasCertificate=function(e){"string"==typeof e&&(e=V.pki.certificateFromPem(e));var n=o(e.subject);if(!n)return!1;V.util.isArray(n)||(n=[n]);for(var a=t.toDer(r.certificateToAsn1(e)).getBytes(),i=0;i<n.length;++i)if(a===t.toDer(r.certificateToAsn1(n[i])).getBytes())return!0;return!1},n.listAllCertificates=function(){var e=[];for(var t in n.certs)if(n.certs.hasOwnProperty(t)){var r=n.certs[t];if(V.util.isArray(r))for(var o=0;o<r.length;++o)e.push(r[o]);else e.push(r)}return e},n.removeCertificate=function(e){var i;if("string"==typeof e&&(e=V.pki.certificateFromPem(e)),a(e.subject),!n.hasCertificate(e))return null;var s=o(e.subject);if(!V.util.isArray(s))return i=n.certs[e.subject.hash],delete n.certs[e.subject.hash],i;for(var c=t.toDer(r.certificateToAsn1(e)).getBytes(),l=0;l<s.length;++l)c===t.toDer(r.certificateToAsn1(s[l])).getBytes()&&(i=s[l],s.splice(l,1));return 0===s.length&&delete n.certs[e.subject.hash],i},e)for(var i=0;i<e.length;++i){var s=e[i];n.addCertificate(s)}return n},r.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},r.verifyCertificateChain=function(e,t,n){"function"==typeof n&&(n={verify:n}),n=n||{};var o=(t=t.slice(0)).slice(0),a=n.validityCheckDate;void 0===a&&(a=new Date);var i=!0,s=null,c=0;do{var l=t.shift(),u=null,d=!1;if(a&&(a<l.validity.notBefore||a>l.validity.notAfter)&&(s={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:a}),null===s){if(null===(u=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(d=!0,u=l),u){var f=u;V.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){u=f.shift();try{p=u.verify(l)}catch(e){}}p||(s={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}null!==s||u&&!d||e.hasCertificate(l)||(s={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}if(null===s&&u&&!l.isIssuer(u)&&(s={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate}),null===s)for(var h={keyUsage:!0,basicConstraints:!0},m=0;null===s&&m<l.extensions.length;++m){var g=l.extensions[m];!g.critical||g.name in h||(s={message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}if(null===s&&(!i||0===t.length&&(!u||d))){var v=l.getExtension("basicConstraints"),y=l.getExtension("keyUsage");null!==y&&(y.keyCertSign&&null!==v||(s={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:r.certificateError.bad_certificate})),null!==s||null===v||v.cA||(s={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),null===s&&null!==y&&"pathLenConstraint"in v&&c-1>v.pathLenConstraint&&(s={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate})}var b=null===s||s.error,C=n.verify?n.verify(b,c,o):b;if(!0!==C)throw!0===b&&(s={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate}),(C||0===C)&&("object"!=w(C)||V.util.isArray(C)?"string"==typeof C&&(s.error=C):(C.message&&(s.message=C.message),C.error&&(s.error=C.error))),s;s=null,i=!1,++c}while(t.length>0);return!0}})),C((function(e){var t=V.asn1,r=V.pki,n=e.exports=V.pkcs12=V.pkcs12||{},o={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},a={name:"PFX",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},o,{name:"PFX.macData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},i={name:"SafeBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},s={name:"Attribute",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,capture:"values"}]},c={name:"CertBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:t.Class.UNIVERSAL,type:t.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function l(e,t,r,n){for(var o=[],a=0;a<e.length;a++)for(var i=0;i<e[a].safeBags.length;i++){var s=e[a].safeBags[i];void 0!==n&&s.type!==n||(null!==t?void 0!==s.attributes[t]&&s.attributes[t].indexOf(r)>=0&&o.push(s):o.push(s))}return o}function u(e){if(e.composed||e.constructed){for(var t=V.util.createBuffer(),r=0;r<e.value.length;++r)t.putBytes(e.value[r].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function d(e,n){var o={},a=[];if(!t.validate(e,V.pkcs7.asn1.encryptedDataValidator,o,a))throw(i=new Error("Cannot read EncryptedContentInfo.")).errors=a,i;var i,s=t.derToOid(o.contentType);if(s!==r.oids.data)throw(i=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.")).oid=s,i;s=t.derToOid(o.encAlgorithm);var c=r.pbe.getCipher(s,o.encParameter,n),l=u(o.encryptedContentAsn1),d=V.util.createBuffer(l.value);if(c.update(d),!c.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return c.output.getBytes()}function f(e,n,o){if(!n&&0===e.length)return[];if((e=t.fromDer(e,n)).tagClass!==t.Class.UNIVERSAL||e.type!==t.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var a=[],s=0;s<e.value.length;s++){var l=e.value[s],u={},d=[];if(!t.validate(l,i,u,d))throw(v=new Error("Cannot read SafeBag.")).errors=d,v;var f,h,m={type:t.derToOid(u.bagId),attributes:p(u.bagAttributes)};a.push(m);var g=u.bagValue.value[0];switch(m.type){case r.oids.pkcs8ShroudedKeyBag:if(null===(g=r.decryptPrivateKeyInfo(g,o)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case r.oids.keyBag:try{m.key=r.privateKeyFromAsn1(g)}catch(e){m.key=null,m.asn1=g}continue;case r.oids.certBag:f=c,h=function(){if(t.derToOid(u.certId)!==r.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=t.derToOid(u.certId),e}var o=t.fromDer(u.cert,n);try{m.cert=r.certificateFromAsn1(o,!0)}catch(e){m.cert=null,m.asn1=o}};break;default:var v;throw(v=new Error("Unsupported PKCS#12 SafeBag type.")).oid=m.type,v}if(void 0!==f&&!t.validate(g,f,u,d))throw(v=new Error("Cannot read PKCS#12 "+f.name)).errors=d,v;h()}return a}function p(e){var n={};if(void 0!==e)for(var o=0;o<e.length;++o){var a={},i=[];if(!t.validate(e[o],s,a,i)){var c=new Error("Cannot read PKCS#12 BagAttribute.");throw c.errors=i,c}var l=t.derToOid(a.oid);if(void 0!==r.oids[l]){n[r.oids[l]]=[];for(var u=0;u<a.values.length;++u)n[r.oids[l]].push(a.values[u].value)}}return n}n.pkcs12FromAsn1=function(e,i,s){"string"==typeof i?(s=i,i=!0):void 0===i&&(i=!0);var c={};if(!t.validate(e,a,c,[]))throw(p=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.")).errors=p,p;var p,h={version:c.version.charCodeAt(0),safeContents:[],getBags:function(e){var t,r={};return"localKeyId"in e?t=e.localKeyId:"localKeyIdHex"in e&&(t=V.util.hexToBytes(e.localKeyIdHex)),void 0===t&&!("friendlyName"in e)&&"bagType"in e&&(r[e.bagType]=l(h.safeContents,null,null,e.bagType)),void 0!==t&&(r.localKeyId=l(h.safeContents,"localKeyId",t,e.bagType)),"friendlyName"in e&&(r.friendlyName=l(h.safeContents,"friendlyName",e.friendlyName,e.bagType)),r},getBagsByFriendlyName:function(e,t){return l(h.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return l(h.safeContents,"localKeyId",e,t)}};if(3!==c.version.charCodeAt(0))throw(p=new Error("PKCS#12 PFX of version other than 3 not supported.")).version=c.version.charCodeAt(0),p;if(t.derToOid(c.contentType)!==r.oids.data)throw(p=new Error("Only PKCS#12 PFX in password integrity mode supported.")).oid=t.derToOid(c.contentType),p;var m=c.content.value[0];if(m.tagClass!==t.Class.UNIVERSAL||m.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(m=u(m),c.mac){var g=null,v=0,y=t.derToOid(c.macAlgorithm);switch(y){case r.oids.sha1:g=V.md.sha1.create(),v=20;break;case r.oids.sha256:g=V.md.sha256.create(),v=32;break;case r.oids.sha384:g=V.md.sha384.create(),v=48;break;case r.oids.sha512:g=V.md.sha512.create(),v=64;break;case r.oids.md5:g=V.md.md5.create(),v=16}if(null===g)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+y);var b=new V.util.ByteBuffer(c.macSalt),C="macIterations"in c?parseInt(V.util.bytesToHex(c.macIterations),16):1,w=n.generateKey(s,b,3,C,v,g),k=V.hmac.create();if(k.start(g,w),k.update(m.value),k.getMac().getBytes()!==c.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return function(e,n,a,i){if((n=t.fromDer(n,a)).tagClass!==t.Class.UNIVERSAL||n.type!==t.Type.SEQUENCE||!0!==n.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var s=0;s<n.value.length;s++){var c=n.value[s],l={},p=[];if(!t.validate(c,o,l,p))throw(v=new Error("Cannot read ContentInfo.")).errors=p,v;var h={encrypted:!1},m=null,g=l.content.value[0];switch(t.derToOid(l.contentType)){case r.oids.data:if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");m=u(g).value;break;case r.oids.encryptedData:m=d(g,i),h.encrypted=!0;break;default:var v;throw(v=new Error("Unsupported PKCS#12 contentType.")).contentType=t.derToOid(l.contentType),v}h.safeBags=f(m,a,i),e.safeContents.push(h)}}(h,m.value,i,s),h},n.toPkcs12Asn1=function(e,o,a,i){(i=i||{}).saltSize=i.saltSize||8,i.count=i.count||2048,i.algorithm=i.algorithm||i.encAlgorithm||"aes128","useMac"in i||(i.useMac=!0),"localKeyId"in i||(i.localKeyId=null),"generateLocalKeyId"in i||(i.generateLocalKeyId=!0);var s,c=i.localKeyId;if(null!==c)c=V.util.hexToBytes(c);else if(i.generateLocalKeyId)if(o){var l=V.util.isArray(o)?o[0]:o;"string"==typeof l&&(l=r.certificateFromPem(l)),(A=V.md.sha1.create()).update(t.toDer(r.certificateToAsn1(l)).getBytes()),c=A.digest().getBytes()}else c=V.random.getBytes(20);var u=[];null!==c&&u.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.localKeyId).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,c)])])),"friendlyName"in i&&u.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.friendlyName).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.BMPSTRING,!1,i.friendlyName)])])),u.length>0&&(s=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,u));var d=[],f=[];null!==o&&(f=V.util.isArray(o)?o:[o]);for(var p=[],h=0;h<f.length;++h){"string"==typeof(o=f[h])&&(o=r.certificateFromPem(o));var m=0===h?s:void 0,g=r.certificateToAsn1(o),v=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.certBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.x509Certificate).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(g).getBytes())])])]),m]);p.push(v)}if(p.length>0){var y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,p),b=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(y).getBytes())])]);d.push(b)}var C=null;if(null!==e){var w=r.wrapRsaPrivateKey(r.privateKeyToAsn1(e));C=null===a?t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.keyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[w]),s]):t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.pkcs8ShroudedKeyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[r.encryptPrivateKeyInfo(w,a,i)]),s]);var k=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[C]),B=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(k).getBytes())])]);d.push(B)}var E,S=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,d);if(i.useMac){var A=V.md.sha1.create(),_=new V.util.ByteBuffer(V.random.getBytes(i.saltSize)),I=i.count,T=(e=n.generateKey(a,_,3,I,20),V.hmac.create());T.start(A,e),T.update(t.toDer(S).getBytes());var P=T.getMac();E=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.sha1).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,P.getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,_.getBytes()),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(I).getBytes())])}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(3).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(S).getBytes())])]),E])},n.generateKey=V.pbe.generatePkcs12Key})),C((function(e){var t=V.asn1,r=e.exports=V.pki=V.pki||{};r.pemToDer=function(e){var t=V.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return V.util.createBuffer(t.body)},r.privateKeyFromPem=function(e){var n=V.pem.decode(e)[0];if("PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type){var o=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var a=t.fromDer(n.body);return r.privateKeyFromAsn1(a)},r.privateKeyToPem=function(e,n){var o={type:"RSA PRIVATE KEY",body:t.toDer(r.privateKeyToAsn1(e)).getBytes()};return V.pem.encode(o,{maxline:n})},r.privateKeyInfoToPem=function(e,r){var n={type:"PRIVATE KEY",body:t.toDer(e).getBytes()};return V.pem.encode(n,{maxline:r})}}));var Bt=function(e,t,r,n){var o=V.util.createBuffer(),a=e.length>>1,i=a+(1&e.length),s=e.substr(0,i),c=e.substr(a,i),l=V.util.createBuffer(),u=V.hmac.create();r=t+r;var d=Math.ceil(n/16),f=Math.ceil(n/20);u.start("MD5",s);var p=V.util.createBuffer();l.putBytes(r);for(var h=0;h<d;++h)u.start(null,null),u.update(l.getBytes()),l.putBuffer(u.digest()),u.start(null,null),u.update(l.bytes()+r),p.putBuffer(u.digest());u.start("SHA1",c);var m=V.util.createBuffer();for(l.clear(),l.putBytes(r),h=0;h<f;++h)u.start(null,null),u.update(l.getBytes()),l.putBuffer(u.digest()),u.start(null,null),u.update(l.bytes()+r),m.putBuffer(u.digest());return o.putBytes(V.util.xorBytes(p.getBytes(),m.getBytes(),n)),o},Et=function(e,t,r){var n=!1;try{var o=e.deflate(t.fragment.getBytes());t.fragment=V.util.createBuffer(o),t.length=o.length,n=!0}catch(e){}return n},St=function(e,t,r){var n=!1;try{var o=e.inflate(t.fragment.getBytes());t.fragment=V.util.createBuffer(o),t.length=o.length,n=!0}catch(e){}return n},At=function(e,t){var r=0;switch(t){case 1:r=e.getByte();break;case 2:r=e.getInt16();break;case 3:r=e.getInt24();break;case 4:r=e.getInt32()}return V.util.createBuffer(e.getBytes(r))},_t=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},It={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};It.SupportedVersions=[It.Versions.TLS_1_1,It.Versions.TLS_1_0],It.Version=It.SupportedVersions[0],It.MaxFragment=15360,It.ConnectionEnd={server:0,client:1},It.PRFAlgorithm={tls_prf_sha256:0},It.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},It.CipherType={stream:0,block:1,aead:2},It.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},It.CompressionMethod={none:0,deflate:1},It.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},It.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},It.Alert={},It.Alert.Level={warning:1,fatal:2},It.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},It.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},It.CipherSuites={},It.getCipherSuite=function(e){var t=null;for(var r in It.CipherSuites){var n=It.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},It.handleUnexpected=function(e,t){!e.open&&e.entity===It.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.unexpected_message}})},It.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(It.queue(e,It.createAlert(e,{level:It.Alert.Level.warning,description:It.Alert.Description.no_renegotiation})),It.flush(e)),e.process()},It.parseHelloMessage=function(e,t,r){var n=null,o=e.entity===It.ConnectionEnd.client;if(r<38)e.error(e,{message:o?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}});else{var a=t.fragment,i=a.length();if(n={version:{major:a.getByte(),minor:a.getByte()},random:V.util.createBuffer(a.getBytes(32)),session_id:At(a,1),extensions:[]},o?(n.cipher_suite=a.getBytes(2),n.compression_method=a.getByte()):(n.cipher_suites=At(a,2),n.compression_methods=At(a,1)),(i=r-(i-a.length()))>0){for(var s=At(a,2);s.length()>0;)n.extensions.push({type:[s.getByte(),s.getByte()],data:At(s,2)});if(!o)for(var c=0;c<n.extensions.length;++c){var l=n.extensions[c];if(0===l.type[0]&&0===l.type[1])for(var u=At(l.data,2);u.length()>0&&0===u.getByte();)e.session.extensions.server_name.serverNameList.push(At(u,2).getBytes())}}if(e.session.version&&(n.version.major!==e.session.version.major||n.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.protocol_version}});if(o)e.session.cipherSuite=It.getCipherSuite(n.cipher_suite);else for(var d=V.util.createBuffer(n.cipher_suites.bytes());d.length()>0&&(e.session.cipherSuite=It.getCipherSuite(d.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.handshake_failure},cipherSuite:V.util.bytesToHex(n.cipher_suite)});e.session.compressionMethod=o?n.compression_method:It.CompressionMethod.none}return n},It.createSecurityParameters=function(e,t){var r=e.entity===It.ConnectionEnd.client,n=t.random.bytes(),o=r?e.session.sp.client_random:n,a=r?n:It.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:It.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:o,server_random:a}},It.handleServerHello=function(e,t,r){var n=It.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var o=n.session_id.bytes();o.length>0&&o===e.session.id?(e.expect=Nt,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=Tt,e.session.resuming=!1,It.createSecurityParameters(e,n)),e.session.id=o,e.process()}},It.handleClientHello=function(e,t,r){var n=It.parseHelloMessage(e,t,r);if(!e.fail){var o=n.session_id.bytes(),a=null;if(e.sessionCache&&(null===(a=e.sessionCache.getSession(o))?o="":(a.version.major!==n.version.major||a.version.minor>n.version.minor)&&(a=null,o="")),0===o.length&&(o=V.random.getBytes(32)),e.session.id=o,e.session.clientHelloVersion=n.version,e.session.sp={},a)e.version=e.session.version=a.version,e.session.sp=a.sp;else{for(var i,s=1;s<It.SupportedVersions.length&&!((i=It.SupportedVersions[s]).minor<=n.version.minor);++s);e.version={major:i.major,minor:i.minor},e.session.version=e.version}null!==a?(e.expect=Ft,e.session.resuming=!0,e.session.sp.client_random=n.random.bytes()):(e.expect=!1!==e.verifyClient?Mt:Ut,e.session.resuming=!1,It.createSecurityParameters(e,n)),e.open=!0,It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createServerHello(e)})),e.session.resuming?(It.queue(e,It.createRecord(e,{type:It.ContentType.change_cipher_spec,data:It.createChangeCipherSpec()})),e.state.pending=It.createConnectionState(e),e.state.current.write=e.state.pending.write,It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createFinished(e)}))):(It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createCertificate(e)})),e.fail||(It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createServerKeyExchange(e)})),!1!==e.verifyClient&&It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createCertificateRequest(e)})),It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createServerHelloDone(e)})))),It.flush(e),e.process()}},It.handleCertificate=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}});var n,o,a=t.fragment,i={certificate_list:At(a,3)},s=[];try{for(;i.certificate_list.length()>0;)n=At(i.certificate_list,3),o=V.asn1.fromDer(n),n=V.pki.certificateFromAsn1(o,!0),s.push(n)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.bad_certificate}})}var c=e.entity===It.ConnectionEnd.client;!c&&!0!==e.verifyClient||0!==s.length?0===s.length?e.expect=c?Pt:Ut:(c?e.session.serverCertificate=s[0]:e.session.clientCertificate=s[0],It.verifyCertificateChain(e,s)&&(e.expect=c?Pt:Ut)):e.error(e,{message:c?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}}),e.process()},It.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.unsupported_certificate}});e.expect=xt,e.process()},It.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.unsupported_certificate}});var n=t.fragment,o={enc_pre_master_secret:At(n,2).getBytes()},a=null;if(e.getPrivateKey)try{a=e.getPrivateKey(e,e.session.serverCertificate),a=V.pki.privateKeyFromPem(a)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}})}if(null===a)return e.error(e,{message:"No private key set.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}});try{var i=e.session.sp;i.pre_master_secret=a.decrypt(o.enc_pre_master_secret);var s=e.session.clientHelloVersion;if(s.major!==i.pre_master_secret.charCodeAt(0)||s.minor!==i.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){i.pre_master_secret=V.random.getBytes(48)}e.expect=Ft,null!==e.session.clientCertificate&&(e.expect=jt),e.process()},It.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}});var n=t.fragment,o={certificate_types:At(n,1),certificate_authorities:At(n,2)};e.session.certificateRequest=o,e.expect=Rt,e.process()},It.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}});var n=t.fragment;n.read-=4;var o=n.bytes();n.read+=4;var a={signature:At(n,2).getBytes()},i=V.util.createBuffer();i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest()),i=i.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(i,a.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(o),e.session.sha1.update(o)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.handshake_failure}})}e.expect=Ft,e.process()},It.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.record_overflow}});if(null===e.serverCertificate){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.insufficient_security}},o=e.verify(e,n.alert.description,0,[]);if(!0!==o)return(o||0===o)&&("object"!=w(o)||V.util.isArray(o)?"number"==typeof o&&(n.alert.description=o):(o.message&&(n.message=o.message),o.alert&&(n.alert.description=o.alert))),e.error(e,n)}null!==e.session.certificateRequest&&(t=It.createRecord(e,{type:It.ContentType.handshake,data:It.createCertificate(e)}),It.queue(e,t)),t=It.createRecord(e,{type:It.ContentType.handshake,data:It.createClientKeyExchange(e)}),It.queue(e,t),e.expect=Dt;var a=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createCertificateVerify(e,t)})),It.queue(e,It.createRecord(e,{type:It.ContentType.change_cipher_spec,data:It.createChangeCipherSpec()})),e.state.pending=It.createConnectionState(e),e.state.current.write=e.state.pending.write,It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createFinished(e)})),e.expect=Nt,It.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return a(e,null);It.getClientSignature(e,a)},It.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}});var r=e.entity===It.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=It.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?Lt:Vt,e.process()},It.handleFinished=function(e,t,r){var n=t.fragment;n.read-=4;var o=n.bytes();n.read+=4;var a=t.fragment.getBytes();(n=V.util.createBuffer()).putBuffer(e.session.md5.digest()),n.putBuffer(e.session.sha1.digest());var i=e.entity===It.ConnectionEnd.client,s=i?"server finished":"client finished",c=e.session.sp;if((n=Bt(c.master_secret,s,n.getBytes(),12)).getBytes()!==a)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&i||!e.session.resuming&&!i)&&(It.queue(e,It.createRecord(e,{type:It.ContentType.change_cipher_spec,data:It.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createFinished(e)}))),e.expect=i?Ot:zt,e.handshaking=!1,++e.handshakes,e.peerCertificate=i?e.session.serverCertificate:e.session.clientCertificate,It.flush(e),e.isConnected=!0,e.connected(e),e.process()},It.handleAlert=function(e,t){var r,n=t.fragment,o={level:n.getByte(),description:n.getByte()};switch(o.description){case It.Alert.Description.close_notify:r="Connection closed.";break;case It.Alert.Description.unexpected_message:r="Unexpected message.";break;case It.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case It.Alert.Description.decryption_failed:r="Decryption failed.";break;case It.Alert.Description.record_overflow:r="Record overflow.";break;case It.Alert.Description.decompression_failure:r="Decompression failed.";break;case It.Alert.Description.handshake_failure:r="Handshake failure.";break;case It.Alert.Description.bad_certificate:r="Bad certificate.";break;case It.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case It.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case It.Alert.Description.certificate_expired:r="Certificate expired.";break;case It.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case It.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case It.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case It.Alert.Description.access_denied:r="Access denied.";break;case It.Alert.Description.decode_error:r="Decode error.";break;case It.Alert.Description.decrypt_error:r="Decrypt error.";break;case It.Alert.Description.export_restriction:r="Export restriction.";break;case It.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case It.Alert.Description.insufficient_security:r="Insufficient security.";break;case It.Alert.Description.internal_error:r="Internal error.";break;case It.Alert.Description.user_canceled:r="User canceled.";break;case It.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(o.description===It.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===It.ConnectionEnd.client?"server":"client",alert:o}),e.process()},It.handleHandshake=function(e,t){var r=t.fragment,n=r.getByte(),o=r.getInt24();if(o>r.length())return e.fragmented=t,t.fragment=V.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var a=r.bytes(o+4);r.read+=4,n in nr[e.entity][e.expect]?(e.entity!==It.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:V.md.md5.create(),sha1:V.md.sha1.create()}),n!==It.HandshakeType.hello_request&&n!==It.HandshakeType.certificate_verify&&n!==It.HandshakeType.finished&&(e.session.md5.update(a),e.session.sha1.update(a)),nr[e.entity][e.expect][n](e,t,o)):It.handleUnexpected(e,t)},It.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},It.handleHeartbeat=function(e,t){var r=t.fragment,n=r.getByte(),o=r.getInt16(),a=r.getBytes(o);if(n===It.HeartbeatMessageType.heartbeat_request){if(e.handshaking||o>a.length)return e.process();It.queue(e,It.createRecord(e,{type:It.ContentType.heartbeat,data:It.createHeartbeat(It.HeartbeatMessageType.heartbeat_response,a)})),It.flush(e)}else if(n===It.HeartbeatMessageType.heartbeat_response){if(a!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,V.util.createBuffer(a))}e.process()};var Tt=1,Pt=2,xt=3,Rt=4,Nt=5,Lt=6,Ot=7,Dt=8,Mt=1,Ut=2,jt=3,Ft=4,Vt=5,zt=6,Kt=It.handleUnexpected,Ht=It.handleChangeCipherSpec,qt=It.handleAlert,Qt=It.handleHandshake,Wt=It.handleApplicationData,Gt=It.handleHeartbeat,Xt=[];Xt[It.ConnectionEnd.client]=[[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Ht,qt,Kt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Wt,Gt],[Kt,qt,Qt,Kt,Gt]],Xt[It.ConnectionEnd.server]=[[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Ht,qt,Kt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Wt,Gt],[Kt,qt,Qt,Kt,Gt]];var Yt=It.handleHelloRequest,$t=It.handleServerHello,Zt=It.handleCertificate,Jt=It.handleServerKeyExchange,er=It.handleCertificateRequest,tr=It.handleServerHelloDone,rr=It.handleFinished,nr=[];nr[It.ConnectionEnd.client]=[[Kt,Kt,$t,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Zt,Jt,er,tr,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Jt,er,tr,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,er,tr,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,tr,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,rr],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt]];var or=It.handleClientHello,ar=It.handleClientKeyExchange,ir=It.handleCertificateVerify;nr[It.ConnectionEnd.server]=[[Kt,or,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Zt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,ar,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,ir,Kt,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,rr],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt]],It.generateKeys=function(e,t){var r=Bt,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var o=2*t.mac_key_length+2*t.enc_key_length,a=e.version.major===It.Versions.TLS_1_0.major&&e.version.minor===It.Versions.TLS_1_0.minor;a&&(o+=2*t.fixed_iv_length);var i=r(t.master_secret,"key expansion",n,o),s={client_write_MAC_key:i.getBytes(t.mac_key_length),server_write_MAC_key:i.getBytes(t.mac_key_length),client_write_key:i.getBytes(t.enc_key_length),server_write_key:i.getBytes(t.enc_key_length)};return a&&(s.client_write_IV=i.getBytes(t.fixed_iv_length),s.server_write_IV=i.getBytes(t.fixed_iv_length)),s},It.createConnectionState=function(e){var t=e.entity===It.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}}),!e.fail},e.session){var o=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(o),o.keys=It.generateKeys(e,o),n.read.macKey=t?o.keys.server_write_MAC_key:o.keys.client_write_MAC_key,n.write.macKey=t?o.keys.client_write_MAC_key:o.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,o),o.compression_algorithm){case It.CompressionMethod.none:break;case It.CompressionMethod.deflate:n.read.compressFunction=St,n.write.compressFunction=Et;break;default:throw new Error("Unsupported compression algorithm.")}}return n},It.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=V.util.createBuffer();return r.putInt32(t),r.putBytes(V.random.getBytes(28)),r},It.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},It.createAlert=function(e,t){var r=V.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),It.createRecord(e,{type:It.ContentType.alert,data:r})},It.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=V.util.createBuffer(),r=0;r<e.cipherSuites.length;++r){var n=e.cipherSuites[r];t.putByte(n.id[0]),t.putByte(n.id[1])}var o=t.length(),a=V.util.createBuffer();a.putByte(It.CompressionMethod.none);var i=a.length(),s=V.util.createBuffer();if(e.virtualHost){var c=V.util.createBuffer();c.putByte(0),c.putByte(0);var l=V.util.createBuffer();l.putByte(0),_t(l,2,V.util.createBuffer(e.virtualHost));var u=V.util.createBuffer();_t(u,2,l),_t(c,2,u),s.putBuffer(c)}var d=s.length();d>0&&(d+=2);var f=e.session.id,p=f.length+1+2+4+28+2+o+1+i+d,h=V.util.createBuffer();return h.putByte(It.HandshakeType.client_hello),h.putInt24(p),h.putByte(e.version.major),h.putByte(e.version.minor),h.putBytes(e.session.sp.client_random),_t(h,1,V.util.createBuffer(f)),_t(h,2,t),_t(h,1,a),d>0&&_t(h,2,s),h},It.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,n=V.util.createBuffer();return n.putByte(It.HandshakeType.server_hello),n.putInt24(r),n.putByte(e.version.major),n.putByte(e.version.minor),n.putBytes(e.session.sp.server_random),_t(n,1,V.util.createBuffer(t)),n.putByte(e.session.cipherSuite.id[0]),n.putByte(e.session.cipherSuite.id[1]),n.putByte(e.session.compressionMethod),n},It.createCertificate=function(e){var t,r=e.entity===It.ConnectionEnd.client,n=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,n=e.getCertificate(e,t));var o=V.util.createBuffer();if(null!==n)try{V.util.isArray(n)||(n=[n]);for(var a=null,i=0;i<n.length;++i){var s=V.pem.decode(n[i])[0];if("CERTIFICATE"!==s.type&&"X509 CERTIFICATE"!==s.type&&"TRUSTED CERTIFICATE"!==s.type){var c=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw c.headerType=s.type,c}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var l=V.util.createBuffer(s.body);null===a&&(a=V.asn1.fromDer(l.bytes(),!1));var u=V.util.createBuffer();_t(u,3,l),o.putBuffer(u)}n=V.pki.certificateFromAsn1(a),r?e.session.clientCertificate=n:e.session.serverCertificate=n}catch(t){return e.error(e,{message:"Could not send certificate list.",cause:t,send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.bad_certificate}})}var d=3+o.length(),f=V.util.createBuffer();return f.putByte(It.HandshakeType.certificate),f.putInt24(d),_t(f,3,o),f},It.createClientKeyExchange=function(e){var t=V.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(V.random.getBytes(46));var r=e.session.sp;r.pre_master_secret=t.getBytes();var n=(t=e.session.serverCertificate.publicKey.encrypt(r.pre_master_secret)).length+2,o=V.util.createBuffer();return o.putByte(It.HandshakeType.client_key_exchange),o.putInt24(n),o.putInt16(t.length),o.putBytes(t),o},It.createServerKeyExchange=function(e){return V.util.createBuffer()},It.getClientSignature=function(e,t){var r=V.util.createBuffer();r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest()),r=r.getBytes(),e.getSignature=e.getSignature||function(e,t,r){var n=null;if(e.getPrivateKey)try{n=e.getPrivateKey(e,e.session.clientCertificate),n=V.pki.privateKeyFromPem(n)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}})}null===n?e.error(e,{message:"No private key set.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}}):t=n.sign(t,null),r(e,t)},e.getSignature(e,r,t)},It.createCertificateVerify=function(e,t){var r=t.length+2,n=V.util.createBuffer();return n.putByte(It.HandshakeType.certificate_verify),n.putInt24(r),n.putInt16(t.length),n.putBytes(t),n},It.createCertificateRequest=function(e){var t=V.util.createBuffer();t.putByte(1);var r=V.util.createBuffer();for(var n in e.caStore.certs){var o=e.caStore.certs[n],a=V.pki.distinguishedNameToAsn1(o.subject),i=V.asn1.toDer(a);r.putInt16(i.length()),r.putBuffer(i)}var s=1+t.length()+2+r.length(),c=V.util.createBuffer();return c.putByte(It.HandshakeType.certificate_request),c.putInt24(s),_t(c,1,t),_t(c,2,r),c},It.createServerHelloDone=function(e){var t=V.util.createBuffer();return t.putByte(It.HandshakeType.server_hello_done),t.putInt24(0),t},It.createChangeCipherSpec=function(){var e=V.util.createBuffer();return e.putByte(1),e},It.createFinished=function(e){var t=V.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var r=e.entity===It.ConnectionEnd.client,n=e.session.sp,o=r?"client finished":"server finished";t=Bt(n.master_secret,o,t.getBytes(),12);var a=V.util.createBuffer();return a.putByte(It.HandshakeType.finished),a.putInt24(t.length()),a.putBuffer(t),a},It.createHeartbeat=function(e,t,r){void 0===r&&(r=t.length);var n=V.util.createBuffer();n.putByte(e),n.putInt16(r),n.putBytes(t);var o=n.length(),a=Math.max(16,o-r-3);return n.putBytes(V.random.getBytes(a)),n},It.queue=function(e,t){if(t&&(0!==t.fragment.length()||t.type!==It.ContentType.handshake&&t.type!==It.ContentType.alert&&t.type!==It.ContentType.change_cipher_spec)){if(t.type===It.ContentType.handshake){var r=t.fragment.bytes();e.session.md5.update(r),e.session.sha1.update(r),r=null}var n;if(t.fragment.length()<=It.MaxFragment)n=[t];else{n=[];for(var o=t.fragment.bytes();o.length>It.MaxFragment;)n.push(It.createRecord(e,{type:t.type,data:V.util.createBuffer(o.slice(0,It.MaxFragment))})),o=o.slice(It.MaxFragment);o.length>0&&n.push(It.createRecord(e,{type:t.type,data:V.util.createBuffer(o)}))}for(var a=0;a<n.length&&!e.fail;++a){var i=n[a];e.state.current.write.update(e,i)&&e.records.push(i)}}},It.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var sr=function(e){switch(e){case!0:return!0;case V.pki.certificateError.bad_certificate:return It.Alert.Description.bad_certificate;case V.pki.certificateError.unsupported_certificate:return It.Alert.Description.unsupported_certificate;case V.pki.certificateError.certificate_revoked:return It.Alert.Description.certificate_revoked;case V.pki.certificateError.certificate_expired:return It.Alert.Description.certificate_expired;case V.pki.certificateError.certificate_unknown:return It.Alert.Description.certificate_unknown;case V.pki.certificateError.unknown_ca:return It.Alert.Description.unknown_ca;default:return It.Alert.Description.bad_certificate}};for(var cr in It.verifyCertificateChain=function(e,t){try{var r={};for(var n in e.verifyOptions)r[n]=e.verifyOptions[n];r.verify=function(t,r,n){sr(t);var o=e.verify(e,t,r,n);if(!0!==o){if("object"==w(o)&&!V.util.isArray(o)){var a=new Error("The application rejected the certificate.");throw a.send=!0,a.alert={level:It.Alert.Level.fatal,description:It.Alert.Description.bad_certificate},o.message&&(a.message=o.message),o.alert&&(a.alert.description=o.alert),a}o!==t&&(o=function(e){switch(e){case!0:return!0;case It.Alert.Description.bad_certificate:return V.pki.certificateError.bad_certificate;case It.Alert.Description.unsupported_certificate:return V.pki.certificateError.unsupported_certificate;case It.Alert.Description.certificate_revoked:return V.pki.certificateError.certificate_revoked;case It.Alert.Description.certificate_expired:return V.pki.certificateError.certificate_expired;case It.Alert.Description.certificate_unknown:return V.pki.certificateError.certificate_unknown;case It.Alert.Description.unknown_ca:return V.pki.certificateError.unknown_ca;default:return V.pki.certificateError.bad_certificate}}(o))}return o},V.pki.verifyCertificateChain(e.caStore,t,r)}catch(t){var o=t;("object"!=w(o)||V.util.isArray(o))&&(o={send:!0,alert:{level:It.Alert.Level.fatal,description:sr(t)}}),"send"in o||(o.send=!0),"alert"in o||(o.alert={level:It.Alert.Level.fatal,description:sr(o.error)}),e.error(e,o)}return!e.fail},It.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{for(var n in(r={}).cache=e||{},r.capacity=Math.max(t||100,1),r.order=[],e)r.order.length<=t?r.order.push(n):delete e[n];r.getSession=function(e){var t=null,n=null;if(e?n=V.util.bytesToHex(e):r.order.length>0&&(n=r.order[0]),null!==n&&n in r.cache)for(var o in t=r.cache[n],delete r.cache[n],r.order)if(r.order[o]===n){r.order.splice(o,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var n=r.order.shift();delete r.cache[n]}n=V.util.bytesToHex(e),r.order.push(n),r.cache[n]=t}}return r},It.createConnection=function(e){var t;t=e.caStore?V.util.isArray(e.caStore)?V.pki.createCaStore(e.caStore):e.caStore:V.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var n in r=[],It.CipherSuites)r.push(It.CipherSuites[n]);var o=e.server?It.ConnectionEnd.server:It.ConnectionEnd.client,a=e.sessionCache?It.createSessionCache(e.sessionCache):null,i={version:{major:It.Version.major,minor:It.Version.minor},entity:o,sessionId:e.sessionId,caStore:t,sessionCache:a,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:V.util.createBuffer(),tlsData:V.util.createBuffer(),data:V.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===It.ConnectionEnd.client?"client":"server"),r.send&&(It.queue(t,It.createAlert(t,r.alert)),It.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){i.version={major:It.Version.major,minor:It.Version.minor},i.record=null,i.session=null,i.peerCertificate=null,i.state={pending:null,current:null},i.expect=(It.ConnectionEnd.client,0),i.fragmented=null,i.records=[],i.open=!1,i.handshakes=0,i.handshaking=!1,i.isConnected=!1,i.fail=!(e||void 0===e),i.input.clear(),i.tlsData.clear(),i.data.clear(),i.state.current=It.createConnectionState(i)}};return i.reset(),i.handshake=function(e){if(i.entity!==It.ConnectionEnd.client)i.error(i,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(i.handshaking)i.error(i,{message:"Handshake already in progress.",fatal:!1});else{i.fail&&!i.open&&0===i.handshakes&&(i.fail=!1),i.handshaking=!0;var t=null;(e=e||"").length>0&&(i.sessionCache&&(t=i.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&i.sessionCache&&null!==(t=i.sessionCache.getSession())&&(e=t.id),i.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:V.md.md5.create(),sha1:V.md.sha1.create()},t&&(i.version=t.version,i.session.sp=t.sp),i.session.sp.client_random=It.createRandom().getBytes(),i.open=!0,It.queue(i,It.createRecord(i,{type:It.ContentType.handshake,data:It.createClientHello(i)})),It.flush(i)}},i.process=function(e){var t=0;return e&&i.input.putBytes(e),i.fail||(null!==i.record&&i.record.ready&&i.record.fragment.isEmpty()&&(i.record=null),null===i.record&&(t=function(e){var t=0,r=e.input,n=r.length();if(n<5)t=5-n;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:V.util.createBuffer(),ready:!1};var o=e.record.version.major===e.version.major;o&&e.session&&e.session.version&&(o=e.record.version.minor===e.version.minor),o||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.protocol_version}})}return t}(i)),i.fail||null===i.record||i.record.ready||(t=function(e){var t=0,r=e.input,n=r.length();return n<e.record.length?t=e.record.length-n:(e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact(),e.state.current.read.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.unexpected_message}})),e.record.ready=!0)),t}(i)),!i.fail&&null!==i.record&&i.record.ready&&function(e,t){var r=t.type-It.ContentType.change_cipher_spec,n=Xt[e.entity][e.expect];r in n?n[r](e,t):It.handleUnexpected(e,t)}(i,i.record)),t},i.prepare=function(e){return It.queue(i,It.createRecord(i,{type:It.ContentType.application_data,data:V.util.createBuffer(e)})),It.flush(i)},i.prepareHeartbeatRequest=function(e,t){return e instanceof V.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),i.expectedHeartbeatPayload=e,It.queue(i,It.createRecord(i,{type:It.ContentType.heartbeat,data:It.createHeartbeat(It.HeartbeatMessageType.heartbeat_request,e,t)})),It.flush(i)},i.close=function(e){if(!i.fail&&i.sessionCache&&i.session){var t={id:i.session.id,version:i.session.version,sp:i.session.sp};t.sp.keys=null,i.sessionCache.setSession(t.id,t)}i.open&&(i.open=!1,i.input.clear(),(i.isConnected||i.handshaking)&&(i.isConnected=i.handshaking=!1,It.queue(i,It.createAlert(i,{level:It.Alert.Level.warning,description:It.Alert.Description.close_notify})),It.flush(i)),i.closed(i)),i.reset(e)},i},V.tls=V.tls||{},It)"function"!=typeof It[cr]&&(V.tls[cr]=It[cr]);V.tls.prf_tls1=Bt,V.tls.hmac_sha1=function(e,t,r){var n=V.hmac.create();n.start("SHA1",e);var o=V.util.createBuffer();return o.putInt32(t[0]),o.putInt32(t[1]),o.putByte(r.type),o.putByte(r.version.major),o.putByte(r.version.minor),o.putInt16(r.length),o.putBytes(r.fragment.bytes()),n.update(o.getBytes()),n.digest().getBytes()},V.tls.createSessionCache=It.createSessionCache,V.tls.createConnection=It.createConnection,C((function(e){var t=e.exports=V.tls;function r(e,r,o){var a=r.entity===V.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:V.cipher.createDecipher("AES-CBC",a?o.keys.server_write_key:o.keys.client_write_key),iv:a?o.keys.server_write_IV:o.keys.client_write_IV},e.write.cipherState={init:!1,cipher:V.cipher.createCipher("AES-CBC",a?o.keys.client_write_key:o.keys.server_write_key),iv:a?o.keys.client_write_IV:o.keys.server_write_IV},e.read.cipherFunction=i,e.write.cipherFunction=n,e.read.macLength=e.write.macLength=o.mac_length,e.read.macFunction=e.write.macFunction=t.hmac_sha1}function n(e,r){var n,a=!1,i=r.macFunction(r.macKey,r.sequenceNumber,e);e.fragment.putBytes(i),r.updateSequenceNumber(),n=e.version.minor===t.Versions.TLS_1_0.minor?r.cipherState.init?null:r.cipherState.iv:V.random.getBytesSync(16),r.cipherState.init=!0;var s=r.cipherState.cipher;return s.start({iv:n}),e.version.minor>=t.Versions.TLS_1_1.minor&&s.output.putBytes(n),s.update(e.fragment),s.finish(o)&&(e.fragment=s.output,e.length=e.fragment.length(),a=!0),a}function o(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function a(e,t,r){var n=!0;if(r){for(var o=t.length(),a=t.last(),i=o-1-a;i<o-1;++i)n=n&&t.at(i)==a;n&&t.truncate(a+1)}return n}function i(e,r){var n,o;n=e.version.minor===t.Versions.TLS_1_0.minor?r.cipherState.init?null:r.cipherState.iv:e.fragment.getBytes(16),r.cipherState.init=!0;var i=r.cipherState.cipher;i.start({iv:n}),i.update(e.fragment),o=i.finish(a);var s=r.macLength,c=V.random.getBytesSync(s),l=i.output.length();l>=s?(e.fragment=i.output.getBytes(l-s),c=i.output.getBytes(s)):e.fragment=i.output.getBytes(),e.fragment=V.util.createBuffer(e.fragment),e.length=e.fragment.length();var u=r.macFunction(r.macKey,r.sequenceNumber,e);return r.updateSequenceNumber(),function(e,t,r){var n=V.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),t===n.digest().getBytes()}(r.macKey,c,u)&&o}t.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},t.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r}})),V.debug=V.debug||{},V.debug.storage={},V.debug.get=function(e,t){var r;return void 0===e?r=V.debug.storage:e in V.debug.storage&&(r=void 0===t?V.debug.storage[e]:V.debug.storage[e][t]),r},V.debug.set=function(e,t,r){e in V.debug.storage||(V.debug.storage[e]={}),V.debug.storage[e][t]=r},V.debug.clear=function(e,t){void 0===e?V.debug.storage={}:e in V.debug.storage&&(void 0===t?delete V.debug.storage[e]:delete V.debug.storage[e][t])},C((function(e){var t=e.exports=V.sha512=V.sha512||{};V.md.sha512=V.md.algorithms.sha512=t;var r=V.sha384=V.sha512.sha384=V.sha512.sha384||{};r.create=function(){return t.create("SHA-384")},V.md.sha384=V.md.algorithms.sha384=r,V.sha512.sha256=V.sha512.sha256||{create:function(){return t.create("SHA-512/256")}},V.md["sha512/256"]=V.md.algorithms["sha512/256"]=V.sha512.sha256,V.sha512.sha224=V.sha512.sha224||{create:function(){return t.create("SHA-512/224")}},V.md["sha512/224"]=V.md.algorithms["sha512/224"]=V.sha512.sha224,t.create=function(e){if(o||(n=String.fromCharCode(128),n+=V.util.fillString(String.fromCharCode(0),128),a=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(i={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],i["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],i["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],i["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],o=!0),void 0===e&&(e="SHA-512"),!(e in i))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=i[e],r=null,c=V.util.createBuffer(),l=new Array(80),u=0;u<80;++u)l[u]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,n=0;n<e;++n)f.fullMessageLength.push(0);for(c=V.util.createBuffer(),r=new Array(t.length),n=0;n<t.length;++n)r[n]=t[n].slice(0);return f}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=V.util.encodeUtf8(e));var n=e.length;f.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var o=f.fullMessageLength.length-1;o>=0;--o)f.fullMessageLength[o]+=n[1],n[1]=n[0]+(f.fullMessageLength[o]/4294967296>>>0),f.fullMessageLength[o]=f.fullMessageLength[o]>>>0,n[0]=n[1]/4294967296>>>0;return c.putBytes(e),s(r,l,c),(c.read>2048||0===c.length())&&c.compact(),f},f.digest=function(){var t=V.util.createBuffer();t.putBytes(c.bytes());var o,a=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(n.substr(0,f.blockLength-a));for(var i=8*f.fullMessageLength[0],u=0;u<f.fullMessageLength.length-1;++u)i+=(o=8*f.fullMessageLength[u+1])/4294967296>>>0,t.putInt32(i>>>0),i=o>>>0;t.putInt32(i);var d=new Array(r.length);for(u=0;u<r.length;++u)d[u]=r[u].slice(0);s(d,l,t);var p,h=V.util.createBuffer();for(p="SHA-512"===e?d.length:"SHA-384"===e?d.length-2:d.length-4,u=0;u<p;++u)h.putInt32(d[u][0]),u===p-1&&"SHA-512/224"===e||h.putInt32(d[u][1]);return h},f};var n=null,o=!1,a=null,i=null;function s(e,t,r){for(var n,o,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k,B,E,S,A,_,I,T,P,x,R,N,L,O,D,M=r.length();M>=128;){for(P=0;P<16;++P)t[P][0]=r.getInt32()>>>0,t[P][1]=r.getInt32()>>>0;for(;P<80;++P)n=(((x=(N=t[P-2])[0])>>>19|(R=N[1])<<13)^(R>>>29|x<<3)^x>>>6)>>>0,o=((x<<13|R>>>19)^(R<<3|x>>>29)^(x<<26|R>>>6))>>>0,i=(((x=(O=t[P-15])[0])>>>1|(R=O[1])<<31)^(x>>>8|R<<24)^x>>>7)>>>0,s=((x<<31|R>>>1)^(x<<24|R>>>8)^(x<<25|R>>>7))>>>0,L=t[P-7],D=t[P-16],R=o+L[1]+s+D[1],t[P][0]=n+L[0]+i+D[0]+(R/4294967296>>>0)>>>0,t[P][1]=R>>>0;for(h=e[0][0],m=e[0][1],g=e[1][0],v=e[1][1],y=e[2][0],b=e[2][1],C=e[3][0],w=e[3][1],k=e[4][0],B=e[4][1],E=e[5][0],S=e[5][1],A=e[6][0],_=e[6][1],I=e[7][0],T=e[7][1],P=0;P<80;++P)u=((k>>>14|B<<18)^(k>>>18|B<<14)^(B>>>9|k<<23))>>>0,d=(A^k&(E^A))>>>0,c=((h>>>28|m<<4)^(m>>>2|h<<30)^(m>>>7|h<<25))>>>0,l=((h<<4|m>>>28)^(m<<30|h>>>2)^(m<<25|h>>>7))>>>0,f=(h&g|y&(h^g))>>>0,p=(m&v|b&(m^v))>>>0,R=T+(((k<<18|B>>>14)^(k<<14|B>>>18)^(B<<23|k>>>9))>>>0)+((_^B&(S^_))>>>0)+a[P][1]+t[P][1],n=I+u+d+a[P][0]+t[P][0]+(R/4294967296>>>0)>>>0,o=R>>>0,i=c+f+((R=l+p)/4294967296>>>0)>>>0,s=R>>>0,I=A,T=_,A=E,_=S,E=k,S=B,k=C+n+((R=w+o)/4294967296>>>0)>>>0,B=R>>>0,C=y,w=b,y=g,b=v,g=h,v=m,h=n+i+((R=o+s)/4294967296>>>0)>>>0,m=R>>>0;R=e[0][1]+m,e[0][0]=e[0][0]+h+(R/4294967296>>>0)>>>0,e[0][1]=R>>>0,R=e[1][1]+v,e[1][0]=e[1][0]+g+(R/4294967296>>>0)>>>0,e[1][1]=R>>>0,R=e[2][1]+b,e[2][0]=e[2][0]+y+(R/4294967296>>>0)>>>0,e[2][1]=R>>>0,R=e[3][1]+w,e[3][0]=e[3][0]+C+(R/4294967296>>>0)>>>0,e[3][1]=R>>>0,R=e[4][1]+B,e[4][0]=e[4][0]+k+(R/4294967296>>>0)>>>0,e[4][1]=R>>>0,R=e[5][1]+S,e[5][0]=e[5][0]+E+(R/4294967296>>>0)>>>0,e[5][1]=R>>>0,R=e[6][1]+_,e[6][0]=e[6][0]+A+(R/4294967296>>>0)>>>0,e[6][1]=R>>>0,R=e[7][1]+T,e[7][0]=e[7][0]+I+(R/4294967296>>>0)>>>0,e[7][1]=R>>>0,M-=128}}}));var lr=V.asn1,ur={privateKeyValidator:{name:"PrivateKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:lr.Class.UNIVERSAL,type:lr.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},publicKeyValidator:{name:"SubjectPublicKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:lr.Class.UNIVERSAL,type:lr.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}},dr=ur.publicKeyValidator,fr=ur.privateKeyValidator;if(void 0===pr)var pr=V.jsbn.BigInteger;var hr=V.util.ByteBuffer,mr="undefined"==typeof Buffer?Uint8Array:Buffer;V.pki=V.pki||{},V.pki.ed25519=V.ed25519=V.ed25519||{};var gr=V.ed25519;function vr(e){var t=e.message;if(t instanceof Uint8Array||t instanceof mr)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new hr(t,r)}else if(!(t instanceof hr))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new mr(t.length()),o=0;o<n.length;++o)n[o]=t.at(o);return n}gr.constants={},gr.constants.PUBLIC_KEY_BYTE_LENGTH=32,gr.constants.PRIVATE_KEY_BYTE_LENGTH=64,gr.constants.SEED_BYTE_LENGTH=32,gr.constants.SIGN_BYTE_LENGTH=64,gr.constants.HASH_BYTE_LENGTH=64,gr.generateKeyPair=function(e){var t=(e=e||{}).seed;if(void 0===t)t=V.random.getBytesSync(gr.constants.SEED_BYTE_LENGTH);else if("string"==typeof t){if(t.length!==gr.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+gr.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=vr({message:t,encoding:"binary"});for(var r=new mr(gr.constants.PUBLIC_KEY_BYTE_LENGTH),n=new mr(gr.constants.PRIVATE_KEY_BYTE_LENGTH),o=0;o<32;++o)n[o]=t[o];return function(e,t){var r,n=[Vr(),Vr(),Vr(),Vr()],o=Ar(t,32);for(o[0]&=248,o[31]&=127,o[31]|=64,Mr(n,o),xr(e,n),r=0;r<32;++r)t[r+32]=e[r]}(r,n),{publicKey:r,privateKey:n}},gr.privateKeyFromAsn1=function(e){var t={},r=[];if(!V.asn1.validate(e,fr,t,r)){var n=new Error("Invalid Key.");throw n.errors=r,n}var o=V.asn1.derToOid(t.privateKeyOid),a=V.oids.EdDSA25519;if(o!==a)throw new Error('Invalid OID "'+o+'"; OID must be "'+a+'".');var i=t.privateKey;return{privateKeyBytes:vr({message:V.asn1.fromDer(i).value,encoding:"binary"})}},gr.publicKeyFromAsn1=function(e){var t={},r=[];if(!V.asn1.validate(e,dr,t,r)){var n=new Error("Invalid Key.");throw n.errors=r,n}var o=V.asn1.derToOid(t.publicKeyOid),a=V.oids.EdDSA25519;if(o!==a)throw new Error('Invalid OID "'+o+'"; OID must be "'+a+'".');var i=t.ed25519PublicKey;if(i.length!==gr.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return vr({message:i,encoding:"binary"})},gr.publicKeyFromPrivateKey=function(e){var t=vr({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==gr.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+gr.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new mr(gr.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<r.length;++n)r[n]=t[32+n];return r},gr.sign=function(e){var t=vr(e=e||{}),r=vr({message:e.privateKey,encoding:"binary"});if(r.length===gr.constants.SEED_BYTE_LENGTH)r=gr.generateKeyPair({seed:r}).privateKey;else if(r.length!==gr.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+gr.constants.SEED_BYTE_LENGTH+" or "+gr.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length);!function(e,t,r,n){var o,a,i=new Float64Array(64),s=[Vr(),Vr(),Vr(),Vr()],c=Ar(n,32);for(c[0]&=248,c[31]&=127,c[31]|=64,o=0;o<r;++o)e[64+o]=t[o];for(o=0;o<32;++o)e[32+o]=c[32+o];var l=Ar(e.subarray(32),r+32);for(Ir(l),Mr(s,l),xr(e,s),o=32;o<64;++o)e[o]=n[o];var u=Ar(e,r+64);for(Ir(u),o=32;o<64;++o)i[o]=0;for(o=0;o<32;++o)i[o]=l[o];for(o=0;o<32;++o)for(a=0;a<32;a++)i[o+a]+=u[o]*c[a];_r(e.subarray(32),i)}(n,t,t.length,r);for(var o=new mr(gr.constants.SIGN_BYTE_LENGTH),a=0;a<o.length;++a)o[a]=n[a];return o},gr.verify=function(e){var t=vr(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=vr({message:e.signature,encoding:"binary"});if(r.length!==gr.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+gr.constants.SIGN_BYTE_LENGTH);var n=vr({message:e.publicKey,encoding:"binary"});if(n.length!==gr.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+gr.constants.PUBLIC_KEY_BYTE_LENGTH);var o,a=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length),i=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length);for(o=0;o<gr.constants.SIGN_BYTE_LENGTH;++o)a[o]=r[o];for(o=0;o<t.length;++o)a[o+gr.constants.SIGN_BYTE_LENGTH]=t[o];return function(e,t,r,n){var o,a=new mr(32),i=[Vr(),Vr(),Vr(),Vr()],s=[Vr(),Vr(),Vr(),Vr()];if(r<64)return-1;if(function(e,t){var r=Vr(),n=Vr(),o=Vr(),a=Vr(),i=Vr(),s=Vr(),c=Vr();return Ur(e[2],br),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),Hr(o,e[1]),qr(a,o,Cr),Kr(o,o,e[2]),zr(a,e[2],a),Hr(i,a),Hr(s,i),qr(c,s,i),qr(r,c,o),qr(r,r,a),function(e,t){var r,n=Vr();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)Hr(n,n),1!==r&&qr(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),qr(r,r,o),qr(r,r,a),qr(r,r,a),qr(e[0],r,a),Hr(n,e[0]),qr(n,n,a),Nr(n,o)&&qr(e[0],e[0],Sr),Hr(n,e[0]),qr(n,n,a),Nr(n,o)?-1:(Or(e[0])===t[31]>>7&&Kr(e[0],yr,e[0]),qr(e[3],e[0],e[1]),0)}(s,n))return-1;for(o=0;o<r;++o)e[o]=t[o];for(o=0;o<32;++o)e[o+32]=n[o];var c=Ar(e,r);if(Ir(c),Dr(i,s,c),Mr(s,t.subarray(32)),Tr(i,s),xr(a,i),r-=64,Lr(t,0,a,0)){for(o=0;o<r;++o)e[o]=0;return-1}for(o=0;o<r;++o)e[o]=t[o+64];return r}(i,a,a.length,n)>=0};var yr=Vr(),br=Vr([1]),Cr=Vr([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),wr=Vr([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),kr=Vr([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Br=Vr([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Er=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),Sr=Vr([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Ar(e,t){var r=V.md.sha512.create(),n=new hr(e);r.update(n.getBytes(t),"binary");var o=r.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(o,"binary");for(var a=new mr(gr.constants.HASH_BYTE_LENGTH),i=0;i<64;++i)a[i]=o.charCodeAt(i);return a}function _r(e,t){var r,n,o,a;for(n=63;n>=32;--n){for(r=0,o=n-32,a=n-12;o<a;++o)t[o]+=r-16*t[n]*Er[o-(n-32)],r=t[o]+128>>8,t[o]-=256*r;t[o]+=r,t[n]=0}for(r=0,o=0;o<32;++o)t[o]+=r-(t[31]>>4)*Er[o],r=t[o]>>8,t[o]&=255;for(o=0;o<32;++o)t[o]-=r*Er[o];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function Ir(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;_r(e,t)}function Tr(e,t){var r=Vr(),n=Vr(),o=Vr(),a=Vr(),i=Vr(),s=Vr(),c=Vr(),l=Vr(),u=Vr();Kr(r,e[1],e[0]),Kr(u,t[1],t[0]),qr(r,r,u),zr(n,e[0],e[1]),zr(u,t[0],t[1]),qr(n,n,u),qr(o,e[3],t[3]),qr(o,o,wr),qr(a,e[2],t[2]),zr(a,a,a),Kr(i,n,r),Kr(s,a,o),zr(c,a,o),zr(l,n,r),qr(e[0],i,s),qr(e[1],l,c),qr(e[2],c,s),qr(e[3],i,l)}function Pr(e,t,r){for(var n=0;n<4;++n)Fr(e[n],t[n],r)}function xr(e,t){var r=Vr(),n=Vr(),o=Vr();!function(e,t){var r,n=Vr();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)Hr(n,n),2!==r&&4!==r&&qr(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(o,t[2]),qr(r,t[0],o),qr(n,t[1],o),Rr(e,n),e[31]^=Or(r)<<7}function Rr(e,t){var r,n,o,a=Vr(),i=Vr();for(r=0;r<16;++r)i[r]=t[r];for(jr(i),jr(i),jr(i),n=0;n<2;++n){for(a[0]=i[0]-65517,r=1;r<15;++r)a[r]=i[r]-65535-(a[r-1]>>16&1),a[r-1]&=65535;a[15]=i[15]-32767-(a[14]>>16&1),o=a[15]>>16&1,a[14]&=65535,Fr(i,a,1-o)}for(r=0;r<16;r++)e[2*r]=255&i[r],e[2*r+1]=i[r]>>8}function Nr(e,t){var r=new mr(32),n=new mr(32);return Rr(r,e),Rr(n,t),Lr(r,0,n,0)}function Lr(e,t,r,n){return function(e,t,r,n,o){var a,i=0;for(a=0;a<32;++a)i|=e[t+a]^r[n+a];return(1&i-1>>>8)-1}(e,t,r,n)}function Or(e){var t=new mr(32);return Rr(t,e),1&t[0]}function Dr(e,t,r){var n,o;for(Ur(e[0],yr),Ur(e[1],br),Ur(e[2],br),Ur(e[3],yr),o=255;o>=0;--o)Pr(e,t,n=r[o/8|0]>>(7&o)&1),Tr(t,e),Tr(e,e),Pr(e,t,n)}function Mr(e,t){var r=[Vr(),Vr(),Vr(),Vr()];Ur(r[0],kr),Ur(r[1],Br),Ur(r[2],br),qr(r[3],kr,Br),Dr(e,r,t)}function Ur(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function jr(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function Fr(e,t,r){for(var n,o=~(r-1),a=0;a<16;++a)n=o&(e[a]^t[a]),e[a]^=n,t[a]^=n}function Vr(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function zr(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]+r[n]}function Kr(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]-r[n]}function Hr(e,t){qr(e,t,t)}function qr(e,t,r){var n,o,a=0,i=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,h=0,m=0,g=0,v=0,y=0,b=0,C=0,w=0,k=0,B=0,E=0,S=0,A=0,_=0,I=0,T=0,P=0,x=0,R=0,N=0,L=0,O=0,D=r[0],M=r[1],U=r[2],j=r[3],F=r[4],V=r[5],z=r[6],K=r[7],H=r[8],q=r[9],Q=r[10],W=r[11],G=r[12],X=r[13],Y=r[14],$=r[15];a+=(n=t[0])*D,i+=n*M,s+=n*U,c+=n*j,l+=n*F,u+=n*V,d+=n*z,f+=n*K,p+=n*H,h+=n*q,m+=n*Q,g+=n*W,v+=n*G,y+=n*X,b+=n*Y,C+=n*$,i+=(n=t[1])*D,s+=n*M,c+=n*U,l+=n*j,u+=n*F,d+=n*V,f+=n*z,p+=n*K,h+=n*H,m+=n*q,g+=n*Q,v+=n*W,y+=n*G,b+=n*X,C+=n*Y,w+=n*$,s+=(n=t[2])*D,c+=n*M,l+=n*U,u+=n*j,d+=n*F,f+=n*V,p+=n*z,h+=n*K,m+=n*H,g+=n*q,v+=n*Q,y+=n*W,b+=n*G,C+=n*X,w+=n*Y,k+=n*$,c+=(n=t[3])*D,l+=n*M,u+=n*U,d+=n*j,f+=n*F,p+=n*V,h+=n*z,m+=n*K,g+=n*H,v+=n*q,y+=n*Q,b+=n*W,C+=n*G,w+=n*X,k+=n*Y,B+=n*$,l+=(n=t[4])*D,u+=n*M,d+=n*U,f+=n*j,p+=n*F,h+=n*V,m+=n*z,g+=n*K,v+=n*H,y+=n*q,b+=n*Q,C+=n*W,w+=n*G,k+=n*X,B+=n*Y,E+=n*$,u+=(n=t[5])*D,d+=n*M,f+=n*U,p+=n*j,h+=n*F,m+=n*V,g+=n*z,v+=n*K,y+=n*H,b+=n*q,C+=n*Q,w+=n*W,k+=n*G,B+=n*X,E+=n*Y,S+=n*$,d+=(n=t[6])*D,f+=n*M,p+=n*U,h+=n*j,m+=n*F,g+=n*V,v+=n*z,y+=n*K,b+=n*H,C+=n*q,w+=n*Q,k+=n*W,B+=n*G,E+=n*X,S+=n*Y,A+=n*$,f+=(n=t[7])*D,p+=n*M,h+=n*U,m+=n*j,g+=n*F,v+=n*V,y+=n*z,b+=n*K,C+=n*H,w+=n*q,k+=n*Q,B+=n*W,E+=n*G,S+=n*X,A+=n*Y,_+=n*$,p+=(n=t[8])*D,h+=n*M,m+=n*U,g+=n*j,v+=n*F,y+=n*V,b+=n*z,C+=n*K,w+=n*H,k+=n*q,B+=n*Q,E+=n*W,S+=n*G,A+=n*X,_+=n*Y,I+=n*$,h+=(n=t[9])*D,m+=n*M,g+=n*U,v+=n*j,y+=n*F,b+=n*V,C+=n*z,w+=n*K,k+=n*H,B+=n*q,E+=n*Q,S+=n*W,A+=n*G,_+=n*X,I+=n*Y,T+=n*$,m+=(n=t[10])*D,g+=n*M,v+=n*U,y+=n*j,b+=n*F,C+=n*V,w+=n*z,k+=n*K,B+=n*H,E+=n*q,S+=n*Q,A+=n*W,_+=n*G,I+=n*X,T+=n*Y,P+=n*$,g+=(n=t[11])*D,v+=n*M,y+=n*U,b+=n*j,C+=n*F,w+=n*V,k+=n*z,B+=n*K,E+=n*H,S+=n*q,A+=n*Q,_+=n*W,I+=n*G,T+=n*X,P+=n*Y,x+=n*$,v+=(n=t[12])*D,y+=n*M,b+=n*U,C+=n*j,w+=n*F,k+=n*V,B+=n*z,E+=n*K,S+=n*H,A+=n*q,_+=n*Q,I+=n*W,T+=n*G,P+=n*X,x+=n*Y,R+=n*$,y+=(n=t[13])*D,b+=n*M,C+=n*U,w+=n*j,k+=n*F,B+=n*V,E+=n*z,S+=n*K,A+=n*H,_+=n*q,I+=n*Q,T+=n*W,P+=n*G,x+=n*X,R+=n*Y,N+=n*$,b+=(n=t[14])*D,C+=n*M,w+=n*U,k+=n*j,B+=n*F,E+=n*V,S+=n*z,A+=n*K,_+=n*H,I+=n*q,T+=n*Q,P+=n*W,x+=n*G,R+=n*X,N+=n*Y,L+=n*$,C+=(n=t[15])*D,i+=38*(k+=n*U),s+=38*(B+=n*j),c+=38*(E+=n*F),l+=38*(S+=n*V),u+=38*(A+=n*z),d+=38*(_+=n*K),f+=38*(I+=n*H),p+=38*(T+=n*q),h+=38*(P+=n*Q),m+=38*(x+=n*W),g+=38*(R+=n*G),v+=38*(N+=n*X),y+=38*(L+=n*Y),b+=38*(O+=n*$),a=(n=(a+=38*(w+=n*M))+(o=1)+65535)-65536*(o=Math.floor(n/65536)),i=(n=i+o+65535)-65536*(o=Math.floor(n/65536)),s=(n=s+o+65535)-65536*(o=Math.floor(n/65536)),c=(n=c+o+65535)-65536*(o=Math.floor(n/65536)),l=(n=l+o+65535)-65536*(o=Math.floor(n/65536)),u=(n=u+o+65535)-65536*(o=Math.floor(n/65536)),d=(n=d+o+65535)-65536*(o=Math.floor(n/65536)),f=(n=f+o+65535)-65536*(o=Math.floor(n/65536)),p=(n=p+o+65535)-65536*(o=Math.floor(n/65536)),h=(n=h+o+65535)-65536*(o=Math.floor(n/65536)),m=(n=m+o+65535)-65536*(o=Math.floor(n/65536)),g=(n=g+o+65535)-65536*(o=Math.floor(n/65536)),v=(n=v+o+65535)-65536*(o=Math.floor(n/65536)),y=(n=y+o+65535)-65536*(o=Math.floor(n/65536)),b=(n=b+o+65535)-65536*(o=Math.floor(n/65536)),C=(n=C+o+65535)-65536*(o=Math.floor(n/65536)),a=(n=(a+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(n/65536)),i=(n=i+o+65535)-65536*(o=Math.floor(n/65536)),s=(n=s+o+65535)-65536*(o=Math.floor(n/65536)),c=(n=c+o+65535)-65536*(o=Math.floor(n/65536)),l=(n=l+o+65535)-65536*(o=Math.floor(n/65536)),u=(n=u+o+65535)-65536*(o=Math.floor(n/65536)),d=(n=d+o+65535)-65536*(o=Math.floor(n/65536)),f=(n=f+o+65535)-65536*(o=Math.floor(n/65536)),p=(n=p+o+65535)-65536*(o=Math.floor(n/65536)),h=(n=h+o+65535)-65536*(o=Math.floor(n/65536)),m=(n=m+o+65535)-65536*(o=Math.floor(n/65536)),g=(n=g+o+65535)-65536*(o=Math.floor(n/65536)),v=(n=v+o+65535)-65536*(o=Math.floor(n/65536)),y=(n=y+o+65535)-65536*(o=Math.floor(n/65536)),b=(n=b+o+65535)-65536*(o=Math.floor(n/65536)),C=(n=C+o+65535)-65536*(o=Math.floor(n/65536)),a+=o-1+37*(o-1),e[0]=a,e[1]=i,e[2]=s,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=p,e[9]=h,e[10]=m,e[11]=g,e[12]=v,e[13]=y,e[14]=b,e[15]=C}V.kem=V.kem||{};var Qr=V.jsbn.BigInteger;function Wr(e,t,r,n){e.generate=function(e,o){for(var a=new V.util.ByteBuffer,i=Math.ceil(o/n)+r,s=new V.util.ByteBuffer,c=r;c<i;++c){s.putInt32(c),t.start(),t.update(e+s.getBytes());var l=t.digest();a.putBytes(l.getBytes(n))}return a.truncate(a.length()-o),a.getBytes()}}V.kem.rsa={},V.kem.rsa.create=function(e,t){var r=(t=t||{}).prng||V.random;return{encrypt:function(t,n){var o,a=Math.ceil(t.n.bitLength()/8);do{o=new Qr(V.util.bytesToHex(r.getBytesSync(a)),16).mod(t.n)}while(o.compareTo(Qr.ONE)<=0);var i=a-(o=V.util.hexToBytes(o.toString(16))).length;return i>0&&(o=V.util.fillString(String.fromCharCode(0),i)+o),{encapsulation:t.encrypt(o,"NONE"),key:e.generate(o,n)}},decrypt:function(t,r,n){var o=t.decrypt(r,"NONE");return e.generate(o,n)}}},V.kem.kdf1=function(e,t){Wr(this,e,0,t||e.digestLength)},V.kem.kdf2=function(e,t){Wr(this,e,1,t||e.digestLength)},V.log=V.log||{},V.log.levels=["none","error","warning","info","debug","verbose","max"];var Gr={},Xr=[],Yr=null;V.log.LEVEL_LOCKED=2,V.log.NO_LEVEL_CHECK=4,V.log.INTERPOLATE=8;for(var $r=0;$r<V.log.levels.length;++$r){var Zr=V.log.levels[$r];Gr[Zr]={index:$r,name:Zr.toUpperCase()}}V.log.logMessage=function(e){for(var t=Gr[e.level].index,r=0;r<Xr.length;++r){var n=Xr[r];n.flags&V.log.NO_LEVEL_CHECK?n.f(e):t<=Gr[n.level].index&&n.f(n,e)}},V.log.prepareStandard=function(e){"standard"in e||(e.standard=Gr[e.level].name+" ["+e.category+"] "+e.message)},V.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]||e.arguments),e.full=V.util.format.apply(this,t)}},V.log.prepareStandardFull=function(e){"standardFull"in e||(V.log.prepareStandard(e),e.standardFull=e.standard)};var Jr=["error","warning","info","debug","verbose"];for($r=0;$r<Jr.length;++$r)!function(e){V.log[e]=function(t,r){var n=Array.prototype.slice.call(arguments).slice(2),o={timestamp:new Date,level:e,category:t,message:r,arguments:n};V.log.logMessage(o)}}(Jr[$r]);if(V.log.makeLogger=function(e){var t={flags:0,f:e};return V.log.setLevel(t,"none"),t},V.log.setLevel=function(e,t){var r=!1;if(e&&!(e.flags&V.log.LEVEL_LOCKED))for(var n=0;n<V.log.levels.length;++n)if(t==V.log.levels[n]){e.level=t,r=!0;break}return r},V.log.lock=function(e,t){void 0===t||t?e.flags|=V.log.LEVEL_LOCKED:e.flags&=~V.log.LEVEL_LOCKED},V.log.addLogger=function(e){Xr.push(e)},"undefined"!=typeof console&&"log"in console){var en;if(console.error&&console.warn&&console.info&&console.debug){var tn={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},rn=function(e,t){V.log.prepareStandard(t);var r=tn[t.level],n=[t.standard];n=n.concat(t.arguments.slice()),r.apply(console,n)};en=V.log.makeLogger(rn)}else rn=function(e,t){V.log.prepareStandardFull(t),console.log(t.standardFull)},en=V.log.makeLogger(rn);V.log.setLevel(en,"debug"),V.log.addLogger(en),Yr=en}else console={log:function(){}};if(null!==Yr){var nn=V.util.getQueryVariables();"console.level"in nn&&V.log.setLevel(Yr,nn["console.level"].slice(-1)[0]),"console.lock"in nn&&"true"==nn["console.lock"].slice(-1)[0]&&V.log.lock(Yr)}V.log.consoleLogger=Yr,C((function(e){var t=V.asn1,r=e.exports=V.pkcs7=V.pkcs7||{};function n(e){var n={},o=[];if(!t.validate(e,r.asn1.recipientInfoValidator,n,o)){var a=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw a.errors=o,a}return{version:n.version.charCodeAt(0),issuer:V.pki.RDNAttributesAsArray(n.issuer),serialNumber:V.util.createBuffer(n.serial).toHex(),encryptedContent:{algorithm:t.derToOid(n.encAlgorithm),parameter:n.encParameter.value,content:n.encKey}}}function o(e){for(var r,n=[],o=0;o<e.length;++o)n.push((r=e[o],t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[V.pki.distinguishedNameToAsn1({attributes:r.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,V.util.hexToBytes(r.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.encryptedContent.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.encryptedContent.content)])));return n}function a(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[V.pki.distinguishedNameToAsn1({attributes:e.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,V.util.hexToBytes(e.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.digestAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&r.value.push(e.authenticatedAttributesAsn1),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var n=t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o<e.unauthenticatedAttributes.length;++o){var a=e.unauthenticatedAttributes[o];n.values.push(i(a))}r.value.push(n)}return r}function i(e){var r;if(e.type===V.pki.oids.contentType)r=t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.value).getBytes());else if(e.type===V.pki.oids.messageDigest)r=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===V.pki.oids.signingTime){var n=new Date("1950-01-01T00:00:00Z"),o=new Date("2050-01-01T00:00:00Z"),a=e.value;if("string"==typeof a){var i=Date.parse(a);a=isNaN(i)?13===a.length?t.utcTimeToDate(a):t.generalizedTimeToDate(a):new Date(i)}r=a>=n&&a<o?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(a)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(a))}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[r])])}function s(e,r,n){var o={};if(!t.validate(r,n,o,[])){var a=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw a.errors=a,a}if(t.derToOid(o.contentType)!==V.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(o.encryptedContent){var i="";if(V.util.isArray(o.encryptedContent))for(var s=0;s<o.encryptedContent.length;++s){if(o.encryptedContent[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");i+=o.encryptedContent[s].value}else i=o.encryptedContent;e.encryptedContent={algorithm:t.derToOid(o.encAlgorithm),parameter:V.util.createBuffer(o.encParameter.value),content:V.util.createBuffer(i)}}if(o.content){if(i="",V.util.isArray(o.content))for(s=0;s<o.content.length;++s){if(o.content[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");i+=o.content[s].value}else i=o.content;e.content=V.util.createBuffer(i)}return e.version=o.version.charCodeAt(0),e.rawCapture=o,o}function c(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case V.pki.oids["aes128-CBC"]:case V.pki.oids["aes192-CBC"]:case V.pki.oids["aes256-CBC"]:t=V.aes.createDecryptionCipher(e.encryptedContent.key);break;case V.pki.oids.desCBC:case V.pki.oids["des-EDE3-CBC"]:t=V.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}r.messageFromPem=function(e){var n=V.pem.decode(e)[0];if("PKCS7"!==n.type){var o=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var a=t.fromDer(n.body);return r.messageFromAsn1(a)},r.messageToPem=function(e,r){var n={type:"PKCS7",body:t.toDer(e.toAsn1()).getBytes()};return V.pem.encode(n,{maxline:r})},r.messageFromAsn1=function(e){var n={},o=[];if(!t.validate(e,r.asn1.contentInfoValidator,n,o)){var a=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw a.errors=o,a}var i,s=t.derToOid(n.contentType);switch(s){case V.pki.oids.envelopedData:i=r.createEnvelopedData();break;case V.pki.oids.encryptedData:i=r.createEncryptedData();break;case V.pki.oids.signedData:i=r.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return i.fromAsn1(n.content.value[0]),i},r.createSignedData=function(){var e=null;return e={type:V.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(s(e,t,r.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var n=e.rawCapture.certificates.value,o=0;o<n.length;++o)e.certificates.push(V.pki.certificateFromAsn1(n[o]))},toAsn1:function(){e.contentInfo||e.sign();for(var r=[],n=0;n<e.certificates.length;++n)r.push(V.pki.certificateToAsn1(e.certificates[n]));var o=[],a=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return r.length>0&&a.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,r)),o.length>0&&a.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,o)),a.value[0].value.push(t.create(t.Class.UNIVERSAL,t.Type.SET,!0,e.signerInfos)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),a])},addSigner:function(t){var r=t.issuer,n=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=V.pki.certificateFromPem(o)),r=o.issuer.attributes,n=o.serialNumber}var a=t.key;if(!a)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof a&&(a=V.pki.privateKeyFromPem(a));var i=t.digestAlgorithm||V.pki.oids.sha1;switch(i){case V.pki.oids.sha1:case V.pki.oids.sha256:case V.pki.oids.sha384:case V.pki.oids.sha512:case V.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+i)}var s=t.authenticatedAttributes||[];if(s.length>0){for(var c=!1,l=!1,u=0;u<s.length;++u){var d=s[u];if(c||d.type!==V.pki.oids.contentType){if(l||d.type!==V.pki.oids.messageDigest);else if(l=!0,c)break}else if(c=!0,l)break}if(!c||!l)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:a,version:1,issuer:r,serialNumber:n,digestAlgorithm:i,signatureAlgorithm:V.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:s,unauthenticatedAttributes:[]})},sign:function(r){var n;r=r||{},("object"!=w(e.content)||null===e.contentInfo)&&(e.contentInfo=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(V.pki.oids.data).getBytes())]),"content"in e&&(e.content instanceof V.util.ByteBuffer?n=e.content.bytes():"string"==typeof e.content&&(n=V.util.encodeUtf8(e.content)),r.detached?e.detachedContent=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n):e.contentInfo.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n)])))),0!==e.signers.length&&function(r){var n;if(!(n=e.detachedContent?e.detachedContent:(n=e.contentInfo.value[1]).value[0]))throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var o=t.derToOid(e.contentInfo.value[0].value),s=t.toDer(n);for(var c in s.getByte(),t.getBerValueLength(s),s=s.getBytes(),r)r[c].start().update(s);for(var l=new Date,u=0;u<e.signers.length;++u){var d=e.signers[u];if(0===d.authenticatedAttributes.length){if(o!==V.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{d.authenticatedAttributesAsn1=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[]),p=0;p<d.authenticatedAttributes.length;++p){var h=d.authenticatedAttributes[p];h.type===V.pki.oids.messageDigest?h.value=r[d.digestAlgorithm].digest():h.type===V.pki.oids.signingTime&&(h.value||(h.value=l)),f.value.push(i(h)),d.authenticatedAttributesAsn1.value.push(i(h))}s=t.toDer(f).getBytes(),d.md.start().update(s)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(a(e[r]));return t}(e.signers)}(function(){for(var r={},n=0;n<e.signers.length;++n){var o=e.signers[n];(a=o.digestAlgorithm)in r||(r[a]=V.md[V.pki.oids[a]].create()),0===o.authenticatedAttributes.length?o.md=r[a]:o.md=V.md[V.pki.oids[a]].create()}for(var a in e.digestAlgorithmIdentifiers=[],r)e.digestAlgorithmIdentifiers.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]));return r}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=V.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},r.createEncryptedData=function(){var e=null;return e={type:V.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:V.pki.oids["aes256-CBC"]},fromAsn1:function(t){s(e,t,r.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),c(e)}}},r.createEnvelopedData=function(){var e=null;return e={type:V.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:V.pki.oids["aes256-CBC"]},fromAsn1:function(t){var o=s(e,t,r.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(n(e[r]));return t}(o.recipientInfos.value)},toAsn1:function(){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,o(e.recipients)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,(r=e.encryptedContent,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(V.pki.oids.data).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.parameter.getBytes())]),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.content.getBytes())])]))])])]);var r},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var o=e.recipients[n],a=o.issuer;if(o.serialNumber===t.serialNumber&&a.length===r.length){for(var i=!0,s=0;s<r.length;++s)if(a[s].type!==r[s].type||a[s].value!==r[s].value){i=!1;break}if(i)return o}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case V.pki.oids.rsaEncryption:case V.pki.oids.desCBC:var n=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=V.util.createBuffer(n);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}c(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:V.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var n,o,a;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case V.pki.oids["aes128-CBC"]:n=16,o=16,a=V.aes.createEncryptionCipher;break;case V.pki.oids["aes192-CBC"]:n=24,o=16,a=V.aes.createEncryptionCipher;break;case V.pki.oids["aes256-CBC"]:n=32,o=16,a=V.aes.createEncryptionCipher;break;case V.pki.oids["des-EDE3-CBC"]:n=24,o=8,a=V.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=V.util.createBuffer(V.random.getBytes(n));else if(t.length()!=n)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+n+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=V.util.createBuffer(V.random.getBytes(o));var i=a(t);if(i.start(e.encryptedContent.parameter.copy()),i.update(e.content),!i.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=i.output}for(var s=0;s<e.recipients.length;++s){var c=e.recipients[s];if(void 0===c.encryptedContent.content)switch(c.encryptedContent.algorithm){case V.pki.oids.rsaEncryption:c.encryptedContent.content=c.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm)}}}}}})),C((function(e){var t=e.exports=V.ssh=V.ssh||{};function r(e,t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var n=V.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function n(e,t){e.putInt32(t.length),e.putString(t)}function o(){for(var e=V.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}t.privateKeyToPutty=function(e,t,a){var i=""===(t=t||"")?"none":"aes256-cbc",s="PuTTY-User-Key-File-2: ssh-rsa\r\n";s+="Encryption: "+i+"\r\n",s+="Comment: "+(a=a||"")+"\r\n";var c=V.util.createBuffer();n(c,"ssh-rsa"),r(c,e.e),r(c,e.n);var l=V.util.encode64(c.bytes(),64),u=Math.floor(l.length/66)+1;s+="Public-Lines: "+u+"\r\n",s+=l;var d,f=V.util.createBuffer();if(r(f,e.d),r(f,e.p),r(f,e.q),r(f,e.qInv),t){var p=f.length()+16-1;p-=p%16;var h=o(f.bytes());h.truncate(h.length()-p+f.length()),f.putBuffer(h);var m=V.util.createBuffer();m.putBuffer(o("\0\0\0\0",t)),m.putBuffer(o("\0\0\0",t));var g=V.aes.createEncryptionCipher(m.truncate(8),"CBC");g.start(V.util.createBuffer().fillWithByte(0,16)),g.update(f.copy()),g.finish();var v=g.output;v.truncate(16),d=V.util.encode64(v.bytes(),64)}else d=V.util.encode64(f.bytes(),64);s+="\r\nPrivate-Lines: "+(u=Math.floor(d.length/66)+1)+"\r\n",s+=d;var y=o("putty-private-key-file-mac-key",t),b=V.util.createBuffer();n(b,"ssh-rsa"),n(b,i),n(b,a),b.putInt32(c.length()),b.putBuffer(c),b.putInt32(f.length()),b.putBuffer(f);var C=V.hmac.create();return C.start("sha1",y),C.update(b.bytes()),s+"\r\nPrivate-MAC: "+C.digest().toHex()+"\r\n"},t.publicKeyToOpenSSH=function(e,t){t=t||"";var o=V.util.createBuffer();return n(o,"ssh-rsa"),r(o,e.e),r(o,e.n),"ssh-rsa "+V.util.encode64(o.bytes())+" "+t},t.privateKeyToOpenSSH=function(e,t){return t?V.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):V.pki.privateKeyToPem(e)},t.getPublicKeyFingerprint=function(e,t){var o=(t=t||{}).md||V.md.md5.create(),a=V.util.createBuffer();n(a,"ssh-rsa"),r(a,e.e),r(a,e.n),o.start(),o.update(a.getBytes());var i=o.digest();if("hex"===t.encoding){var s=i.toHex();return t.delimiter?s.match(/.{2}/g).join(t.delimiter):s}if("binary"===t.encoding)return i.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return i}}));var on="forge.task",an={},sn=0;V.debug.set(on,"tasks",an);var cn={};V.debug.set(on,"queues",cn);var ln="ready",un="running",dn="blocked",fn="sleeping",pn="done",hn="error",mn={ready:{}};mn.ready.stop=ln,mn.ready.start=un,mn.ready.cancel=pn,mn.ready.fail=hn,mn.running={},mn.running.stop=ln,mn.running.start=un,mn.running.block=dn,mn.running.unblock=un,mn.running.sleep=fn,mn.running.wakeup=un,mn.running.cancel=pn,mn.running.fail=hn,mn.blocked={},mn.blocked.stop=dn,mn.blocked.start=dn,mn.blocked.block=dn,mn.blocked.unblock=dn,mn.blocked.sleep=dn,mn.blocked.wakeup=dn,mn.blocked.cancel=pn,mn.blocked.fail=hn,mn.sleeping={},mn.sleeping.stop=fn,mn.sleeping.start=fn,mn.sleeping.block=fn,mn.sleeping.unblock=fn,mn.sleeping.sleep=fn,mn.sleeping.wakeup=fn,mn.sleeping.cancel=pn,mn.sleeping.fail=hn,mn.done={},mn.done.stop=pn,mn.done.start=pn,mn.done.block=pn,mn.done.unblock=pn,mn.done.sleep=pn,mn.done.wakeup=pn,mn.done.cancel=pn,mn.done.fail=hn,mn.error={},mn.error.stop=hn,mn.error.start=hn,mn.error.block=hn,mn.error.unblock=hn,mn.error.sleep=hn,mn.error.wakeup=hn,mn.error.cancel=hn,mn.error.fail=hn;var gn=function(e){this.id=-1,this.name=e.name||"?",this.parent=e.parent||null,this.run=e.run,this.subtasks=[],this.error=!1,this.state=ln,this.blocks=0,this.timeoutId=null,this.swapTime=null,this.userData=null,this.id=sn++,an[this.id]=this};gn.prototype.debug=function(e){e=e||"",V.log.debug(on,e,"[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",cn)},gn.prototype.next=function(e,t){"function"==typeof e&&(t=e,e=this.name);var r=new gn({run:t,name:e,parent:this});return r.state=un,r.type=this.type,r.successCallback=this.successCallback||null,r.failureCallback=this.failureCallback||null,this.subtasks.push(r),this},gn.prototype.parallel=function(e,t){return V.util.isArray(e)&&(t=e,e=this.name),this.next(e,(function(r){var n=r;n.block(t.length);for(var o=function(e,r){V.task.start({type:e,run:function(e){t[r](e)},success:function(e){n.unblock()},failure:function(e){n.unblock()}})},a=0;a<t.length;a++)o(e+"__parallel-"+r.id+"-"+a,a)}))},gn.prototype.stop=function(){this.state=mn[this.state].stop},gn.prototype.start=function(){this.error=!1,this.state=mn[this.state].start,this.state===un&&(this.start=new Date,this.run(this),vn(this,0))},gn.prototype.block=function(e){e=void 0===e?1:e,this.blocks+=e,this.blocks>0&&(this.state=mn[this.state].block)},gn.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==pn&&(this.state=un,vn(this,0)),this.blocks},gn.prototype.sleep=function(e){e=void 0===e?0:e,this.state=mn[this.state].sleep;var t=this;this.timeoutId=setTimeout((function(){t.timeoutId=null,t.state=un,vn(t,0)}),e)},gn.prototype.wait=function(e){e.wait(this)},gn.prototype.wakeup=function(){this.state===fn&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=un,vn(this,0))},gn.prototype.cancel=function(){this.state=mn[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},gn.prototype.fail=function(e){if(this.error=!0,yn(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,vn(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;yn(t,!0)}this.failureCallback&&this.failureCallback(this)}};var vn=function e(t,r){var n=r>30||+new Date-t.swapTime>20,o=function(r){if(r++,t.state===un)if(n&&(t.swapTime=+new Date),t.subtasks.length>0){var o=t.subtasks.shift();o.error=t.error,o.swapTime=t.swapTime,o.userData=t.userData,o.run(o),o.error||e(o,r)}else yn(t),t.error||null!==t.parent&&(t.parent.error=t.error,t.parent.swapTime=t.swapTime,t.parent.userData=t.userData,e(t.parent,r))};n?setTimeout(o,0):o(r)},yn=function(e,t){e.state=pn,delete an[e.id],null===e.parent&&(e.type in cn?0===cn[e.type].length?V.log.error(on,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):cn[e.type][0]!==e?V.log.error(on,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(cn[e.type].shift(),0===cn[e.type].length?delete cn[e.type]:cn[e.type][0].start()):V.log.error(on,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};V.task=V.task||{},V.task.start=function(e){var t=new gn({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in cn?cn[e.type].push(t):(cn[t.type]=[t],function(e){e.error=!1,e.state=mn[e.state].start,setTimeout((function(){e.state===un&&(e.swapTime=+new Date,e.run(e),vn(e,0))}),0)}(t))},V.task.cancel=function(e){e in cn&&(cn[e]=[cn[e][0]])},V.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e};var bn=V,Cn=function(){function e(e){this.secretKey=e}return e.prototype.encrypt=function(e,t){throw new Error("Method not implemented.")},e.prototype.decrypt=function(e,t){return function(e,t,r){void 0===r&&(r=bn.util.createBuffer(Uint8Array.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]).buffer));var n,o,a=bn.cipher.createDecipher("AES-CBC",t);return a.start({iv:r}),a.update(bn.util.createBuffer(bn.util.hexToBytes(e))),o=(n=a.output.data).charCodeAt(n.length-1),n.slice(0,-o)}(e,(r=this.secretKey,n=t.transactionID,""+r.slice(0,16)+n.slice(0,16)));var r,n},e}(),wn=function(){function e(e,t,n,o){void 0===n&&(n="production"),void 0===o&&(o={supportTransaction:!1,enableEncryption:!1}),this.transactionEnabled=o.supportTransaction||!1,this.encryptionEnabled=o.enableEncryption||!1;var a=D(e,t,n,{headers:o.httpHeaders});this.transactionManager=new F(a),this.encryptionService=new Cn(t),this.compareFaceService=new u(a),this.clientSettingsService=new d(a),this.convertPDFService=new v(a),this.ekycPDFService=new y(a),this.readIDCardService=new r(a),this.requestVerifyIDCardService=new p(a),this.requestVerifyPortraitSerivce=new h(a),this.imagesService=new c(a),this.fileService=new l(a),this.verifyFaceLivenessService=new f(a),this.searchFaceService=new g(a),this.detectIDTamperingService=new m(a),this.httpClient=a}return e.prototype.enableTransaction=function(){this.transactionEnabled=!0},e.prototype.disableTransaction=function(){this.transactionEnabled=!1},e.prototype.enableEncryption=function(){this.encryptionEnabled=!0},e.prototype.disableEncryption=function(){this.encryptionEnabled=!1},e.prototype.compareFaces=function(e,t){return this.compareFaceService.request(e,t)},e.prototype.clientSettings=function(){return this.clientSettingsService.request()},e.prototype.uploadImage=function(e){return this.imagesService.request(e)},e.prototype.uploadFile=function(e){return this.fileService.uploadFile(e)},e.prototype.convertPDF=function(e,t){return this.convertPDFService.request(e,t)},e.prototype.ekycPDF=function(e,t){return this.ekycPDFService.request(e,t)},e.prototype.readIDCard=function(e,t){return this.readIDCardService.request(e,t)},e.prototype.requestVerifyIDCard=function(e,t){return this.requestVerifyIDCardService.request(e,t)},e.prototype.requestVerifyPortrait=function(e,t){return this.requestVerifyPortraitSerivce.request(e,t)},e.prototype.verifyFaceLiveness=function(e,t){return this.verifyFaceLivenessService.request(e,t)},e.prototype.searchFaces=function(e,t){return this.searchFaceService.request(e,t)},e.prototype.deleteFaces=function(e,t){return this.searchFaceService.deleteFaces(e,t)},e.prototype.indexFaces=function(e,t){return this.searchFaceService.indexFaces(e,t)},e.prototype.downloadFaceImage=function(e){return this.searchFaceService.downloadFaceImage(e)},e.prototype.downloadImage=function(e){return this.imagesService.download(e)},e.prototype.updateMetadata=function(e,t){return this.imagesService.updateMetadata(e,t)},e.prototype.detectIDTampering=function(e,t){return this.detectIDTamperingService.request(e,t)},o([U({headerIndex:1}),j(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"compareFaces",null),o([U({headerIndex:1}),j(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"convertPDF",null),o([U({headerIndex:1}),j(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"readIDCard",null),o([U({headerIndex:1}),j(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"requestVerifyIDCard",null),o([U({headerIndex:1}),j(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"requestVerifyPortrait",null),o([U({headerIndex:1}),j(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"verifyFaceLiveness",null),o([U({headerIndex:1}),j(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"searchFaces",null),o([U({headerIndex:1}),j(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"deleteFaces",null),o([U({headerIndex:1}),j(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"indexFaces",null),o([U({headerIndex:1}),j(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"detectIDTampering",null),e}();e.ReadIDCard=r,e.UploadImage=c,e.UploadFile=l,e.CompareFaces=u,e.ClientSettings=d,e.VerifyFaceLiveness=f,e.RequestVerifyIDCard=p,e.RequestVerifyPortrait=h,e.DetectIDTampering=m,e.SearchFaces=g,e.ConvertPDF=v,e.EkycPDF=y,e.HttpClient=T,e.MockClient=P,e.TVAuthorizer=L,e.createHelpers=function(e,t,r){void 0===r&&(r="production");var n=new L(e,t),o=function(e){switch(e){case"testing":return"https://tv-testing.trustingsocial.com/api";case"staging":return"https://tv-staging.trustingsocial.com/api";case"production":default:return"https://vn-vision.trustingsocial.com/api"}}(r);return new T({authorizer:n,domain:o})},e.createHttpClient=D,e.SimpleTrustVisionAPI=M,e.default=wn,Object.defineProperty(e,"__esModule",{value:!0})}(t,Wr)}))),Xr=new Uint8Array(16);function Yr(){if(!qr&&!(qr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qr(Xr)}var $r=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Zr(e){return"string"==typeof e&&$r.test(e)}for(var Jr=[],en=0;en<256;++en)Jr.push((en+256).toString(16).substr(1));function tn(e,t,r){var n=(e=e||{}).random||(e.rng||Yr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=n[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(Jr[e[t+0]]+Jr[e[t+1]]+Jr[e[t+2]]+Jr[e[t+3]]+"-"+Jr[e[t+4]]+Jr[e[t+5]]+"-"+Jr[e[t+6]]+Jr[e[t+7]]+"-"+Jr[e[t+8]]+Jr[e[t+9]]+"-"+Jr[e[t+10]]+Jr[e[t+11]]+Jr[e[t+12]]+Jr[e[t+13]]+Jr[e[t+14]]+Jr[e[t+15]]).toLowerCase();if(!Zr(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var rn=function(e){return ir(e,5)},nn=ie((function(e){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){e.exports={BROWSER_TYPES:{CHROME:"Chrome",FIREFOX:"Firefox",OPERA:"Opera",YANDEX:"Yandex",SAFARI:"Safari",INTERNET_EXPLORER:"Internet Explorer",EDGE:"Edge",CHROMIUM:"Chromium",IE:"IE",MOBILE_SAFARI:"Mobile Safari",EDGE_CHROMIUM:"Edge Chromium"},DEVICE_TYPES:{MOBILE:"mobile",TABLET:"tablet",SMART_TV:"smarttv",CONSOLE:"console",WEARABLE:"wearable",BROWSER:void 0},OS_TYPES:{IOS:"iOS",ANDROID:"Android",WINDOWS_PHONE:"Windows Phone",WINDOWS:"Windows",MAC_OS:"Mac OS"},defaultData:{isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1}}},function(e,t,r){var n,o=r(2),a=r(0),i=a.BROWSER_TYPES,s=a.OS_TYPES,c=a.DEVICE_TYPES,l=r(4),u=l.checkType,d=l.broPayload,f=l.mobilePayload,p=l.wearPayload,h=l.consolePayload,m=l.stvPayload,g=l.getNavigatorInstance,v=l.isIOS13Check,y=new o,b=y.getBrowser(),C=y.getDevice(),w=y.getEngine(),k=y.getOS(),B=y.getUA(),E=i.CHROME,S=i.CHROMIUM,A=i.IE,_=i.INTERNET_EXPLORER,I=i.OPERA,T=i.FIREFOX,P=i.SAFARI,x=i.EDGE,R=i.YANDEX,N=i.MOBILE_SAFARI,L=c.MOBILE,O=c.TABLET,D=c.SMART_TV,M=c.BROWSER,U=c.WEARABLE,j=c.CONSOLE,F=s.ANDROID,V=s.WINDOWS_PHONE,z=s.IOS,K=s.WINDOWS,H=s.MAC_OS,q=function(){return k.name===s.WINDOWS&&"10"===k.version&&"string"==typeof B&&-1!==B.indexOf("Edg/")},Q=function(){return b.name===x},W=function(){return v("iPad")},G=C.type===D,X=C.type===j,Y=C.type===U,$=b.name===N||W(),Z=b.name===S,J=function(){switch(C.type){case L:case O:return!0;default:return!1}}()||W(),ee=C.type===L,te=C.type===O||W(),re=C.type===M,ne=k.name===F,oe=k.name===V,ae=k.name===z||W(),ie=b.name===E,se=b.name===T,ce=b.name===P||b.name===N,le=b.name===I,ue=b.name===_||b.name===A,de=k.version?k.version:"none",fe=k.name?k.name:"none",pe=b.major,he=b.version,me=b.name,ge=C.vendor?C.vendor:"none",ve=C.model?C.model:"none",ye=w.name,be=w.version,Ce=B,we=Q()||q(),ke=b.name===R,Be=C.type,Ee=(n=g())&&(/iPad|iPhone|iPod/.test(n.platform)||"MacIntel"===n.platform&&n.maxTouchPoints>1)&&!window.MSStream,Se=W(),Ae=v("iPhone"),_e=v("iPod"),Ie=function(){var e=g(),t=e&&e.userAgent.toLowerCase();return"string"==typeof t&&/electron/.test(t)}(),Te=q(),Pe=Q(),xe=k.name===K,Re=k.name===H,Ne=u(C.type);e.exports={deviceDetect:function(){var e=Ne.isBrowser,t=Ne.isMobile,r=Ne.isTablet,n=Ne.isSmartTV,o=Ne.isConsole,a=Ne.isWearable;return e?d(e,b,w,k,B):n?m(n,w,k,B):o?h(o,w,k,B):t||r?f(Ne,C,k,B):a?p(a,w,k,B):void 0},isSmartTV:G,isConsole:X,isWearable:Y,isMobileSafari:$,isChromium:Z,isMobile:J,isMobileOnly:ee,isTablet:te,isBrowser:re,isAndroid:ne,isWinPhone:oe,isIOS:ae,isChrome:ie,isFirefox:se,isSafari:ce,isOpera:le,isIE:ue,osVersion:de,osName:fe,fullBrowserVersion:pe,browserVersion:he,browserName:me,mobileVendor:ge,mobileModel:ve,engineName:ye,engineVersion:be,getUA:Ce,isEdge:we,isYandex:ke,deviceType:Be,isIOS13:Ee,isIPad13:Se,isIPhone13:Ae,isIPod13:_e,isElectron:Ie,isEdgeChromium:Te,isLegacyEdge:Pe,isWindows:xe,isMacOs:Re}},function(e,t,r){var n;
|
|
16
|
+
***************************************************************************** */function o(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==("undefined"==typeof Reflect?"undefined":w(Reflect))&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){if("object"==("undefined"==typeof Reflect?"undefined":w(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function i(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))}function s(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}var c=function(){function e(e){this.httpClient=e}return e.prototype.uploadImage=function(e){return this.httpClient.postFormData("/v1/images",e)},e.prototype.request=function(e){var t="application/pdf"===e.file.type;return this.httpClient.postFormData(t?"/v1/files":"/v1/images",e)},e.prototype.requestWithHeaders=function(e,t){return this.httpClient.postFormData("/v1/images",e,t)},e.prototype.download=function(e){return i(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return[4,this.httpClient.downloadFile("/v1/images/"+e)];case 1:return t=r.sent(),[4,URL.createObjectURL(t)];case 2:return[2,r.sent()]}}))}))},e.prototype.updateMetadata=function(e,t){return this.httpClient.patch("/v1/images/"+e,t)},e}(),l=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/files",e,t)},e.prototype.uploadFile=function(e){return this.httpClient.postFormData("/v1/files",e)},e.prototype.requestWithHeaders=function(e,t){return this.httpClient.postFormData("/v1/files",e,t)},e}(),u=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/compare_faces_sync",e,t)},e}(),d=function(){function e(e){this.httpClient=e}return e.prototype.getClientSettings=function(){return this.httpClient.get("/v1/client_settings")},e.prototype.request=function(){return this.httpClient.get("/v1/client_settings")},e}(),f=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_face_liveness_sync",e,t)},e}(),p=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_id_card_sanity_sync",e,t)},e}(),h=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/verify_portrait_sanity_sync",e,t)},e}(),m=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/detect_id_card_tampering_sync",e,t)},e.prototype.requestWithAuthHeaders=function(e,t){return this.httpClient.post("/v1/detect_id_card_tampering_sync",e,t)},e}(),g=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/search_faces_sync",e,t)},e.prototype.indexFaces=function(e,t){return this.httpClient.post("/v1/index_faces_sync",e,t)},e.prototype.deleteFaces=function(e,t){return this.httpClient.post("/v1/delete_faces",e,t)},e.prototype.downloadFaceImage=function(e){return i(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return[4,this.httpClient.downloadFile("/v1/face_images/"+e)];case 1:return t=r.sent(),[2,URL.createObjectURL(t)]}}))}))},e}(),v=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.postFormData("/v1/convert_pdf_sync",e,t)},e}(),y=function(){function e(e){this.httpClient=e}return e.prototype.request=function(e,t){return this.httpClient.post("/v1/ekyc_pdf",e,t)},e}(),b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==ae?ae:"undefined"!=typeof self?self:{};function C(e,t){return e(t={exports:{}},t.exports),t.exports}var k=C((function(e){var t,r;t=b,r=function(){function e(e){var t=[];if(0===e.length)return"";if("string"!=typeof e[0])throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var r=e.shift();e[0]=r+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var n=0;n<e.length;n++){var o=e[n];if("string"!=typeof o)throw new TypeError("Url must be a string. Received "+o);""!==o&&(n>0&&(o=o.replace(/^[\/]+/,"")),o=n<e.length-1?o.replace(/[\/]+$/,""):o.replace(/[\/]+$/,"/"),t.push(o))}var a=t.join("/"),i=(a=a.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return i.shift()+(i.length>0?"?":"")+i.join("&")}return function(){return e("object"==w(arguments[0])?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=r():t.urljoin=r()}));function B(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var E=function(e,t,r,n){t=t||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var i=1e3;n&&"number"==typeof n.maxKeys&&(i=n.maxKeys);var s=e.length;i>0&&s>i&&(s=i);for(var c=0;c<s;++c){var l,u,d,f,p=e[c].replace(a,"%20"),h=p.indexOf(r);h>=0?(l=p.substr(0,h),u=p.substr(h+1)):(l=p,u=""),d=decodeURIComponent(l),f=decodeURIComponent(u),B(o,d)?Array.isArray(o[d])?o[d].push(f):o[d]=[o[d],f]:o[d]=f}return o},S=function(e){switch(w(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},A=function(e,t,r,n){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==w(e)?Object.keys(e).map((function(n){var o=encodeURIComponent(S(n))+r;return Array.isArray(e[n])?e[n].map((function(e){return o+encodeURIComponent(S(e))})).join(t):o+encodeURIComponent(S(e[n]))})).join(t):n?encodeURIComponent(S(n))+r+encodeURIComponent(S(e)):""},_=C((function(e,t){t.decode=t.parse=E,t.encode=t.stringify=A})),I=(_.decode,_.parse,_.encode,_.stringify),T=function(){function e(e){this.authorizer=e.authorizer,this.domain=e.domain,this.onError=e.onError,this.configHeaders=e.headers}return e.prototype.get=function(e,t,r){var n=new URL(this.resolveUrl(e));return t&&(n.search=I(t)),this.request(n.toString(),{requestPath:e,method:"GET",headers:r})},e.prototype.post=function(e,t,r){var o=this.resolveUrl(e);return this.request(o,{requestPath:e,method:"POST",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.postFormData=function(e,t,r){var n,o=t instanceof FormData?t:(n=t,Object.entries(n).reduce((function(e,t){var r=t[0],n=t[1];return Array.isArray(n)?n.forEach((function(t,o){return e.append(r+"["+o+"]",n)})):!(n instanceof Object)||n instanceof File||n instanceof Date||n instanceof Blob?e.append(r,n):Object.entries(n).forEach((function(t,o){return e.append(r+"["+o+"]",n[o])})),e}),new FormData)),a=this.resolveUrl(e);return this.request(a,{requestPath:e,method:"POST",body:o,headers:r})},e.prototype.patch=function(e,t,r){var o=this.resolveUrl(e);return this.request(o,{requestPath:e,method:"PATCH",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.delete=function(e,t,r){var o=this.resolveUrl(e);return this.request(o,{requestPath:e,method:"DELETE",body:JSON.stringify(t),headers:n({"Content-Type":"application/json"},r)})},e.prototype.downloadFile=function(e){var t=this.resolveUrl(e);return this.request(t,{requestPath:e,method:"GET"},"blob")},e.prototype.request=function(e,t,r){return void 0===r&&(r="json"),i(this,void 0,void 0,(function(){var o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return o={},a={},this.authorizer&&(o=this.authorizer.getHeaders(t)),this.configHeaders&&(a=this.configHeaders),t.headers=n(n(n({},t.headers),o),a),[4,fetch(e,t)];case 1:return i=s.sent(),[4,"blob"===r?i.blob():i.json()];case 2:if((c=s.sent()).errors&&this.onError)throw this.onError(c.errors),c;return[2,c]}}))}))},e.prototype.resolveUrl=function(e){return k(this.domain,e)},e}(),P=function(){function e(e){this.mocks=e}return e.prototype.get=function(e,t){return this.findInMocks(e,t)},e.prototype.post=function(e,t){return this.findInMocks(e)},e.prototype.postFormData=function(e,t){return this.findInMocks(e)},e.prototype.patch=function(e,t){return this.findInMocks(e)},e.prototype.delete=function(e,t){return this.findInMocks(e)},e.prototype.downloadFile=function(e){return this.findInMocks(e)},e.prototype.resolveUrl=function(e){return this.mocks.resolveUrl?this.mocks.resolveUrl(e):e},e.prototype.findInMocks=function(e,t){return i(this,void 0,void 0,(function(){return s(this,(function(r){return this.mocks[e]?"function"==typeof this.mocks[e]?[2,Promise.resolve(this.mocks[e](t))]:[2,Promise.resolve(this.mocks[e])]:[2,Promise.reject(new Error(e+" is not presented in mocks"))]}))}))},e}(),x=C((function(e,t){var r;e.exports=r=r||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},o=n.lib={},a=o.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},i=o.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<o;a++){var i=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=i<<24-(n+a)%4*8}else for(a=0;a<o;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],o=function(t){t=t;var r=987654321,n=4294967295;return function(){var o=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return o/=4294967296,(o+=.5)*(e.random()>.5?1:-1)}},a=0;a<t;a+=4){var s=o(4294967296*(r||e.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new i.init(n,t)}}),s=n.enc={},c=s.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var a=t[o>>>2]>>>24-o%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new i.init(r,t/2)}},l=s.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var a=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new i.init(r,t)}},u=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},d=o.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,o=r.sigBytes,a=this.blockSize,s=o/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,o);if(c){for(var u=0;u<c;u+=a)this._doProcessBlock(n,u);var d=n.splice(0,c);r.sigBytes-=l}return new i.init(d,l)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(o.Hasher=d.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}}),n.algo={});return n}(Math)})),R=C((function(e,t){var r,n,o;e.exports=(n=(r=o=x).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],a=0;a<r;a+=3)for(var i=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)o.push(n.charAt(i>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a<r.length;a++)o[r.charCodeAt(a)]=a}var i=r.charAt(64);if(i){var s=e.indexOf(i);-1!==s&&(t=s)}return function(e,t,r){for(var o=[],a=0,i=0;i<t;i++)if(i%4){var s=r[e.charCodeAt(i-1)]<<i%4*2,c=r[e.charCodeAt(i)]>>>6-i%4*2;o[a>>>2]|=(s|c)<<24-a%4*8,a++}return n.create(o,a)}(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)})),N=(C((function(e,t){var r;e.exports=(r=x,function(e){var t=r,n=t.lib,o=n.WordArray,a=n.Hasher,i=t.algo,s=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)t(n)&&(o<8&&(s[o]=r(e.pow(n,.5))),c[o]=r(e.pow(n,1/3)),o++),n++}();var l=[],u=i.SHA256=a.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],a=r[2],i=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=0;p<64;p++){if(p<16)l[p]=0|e[t+p];else{var h=l[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,g=l[p-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;l[p]=m+l[p-7]+v+l[p-16]}var y=n&o^n&a^o&a,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),C=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&u^~s&d)+c[p]+l[p];f=d,d=u,u=s,s=i+C|0,i=a,a=o,o=n,n=C+(b+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+a|0,r[3]=r[3]+i|0,r[4]=r[4]+s|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=e.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=a._createHelper(u),t.HmacSHA256=a._createHmacHelper(u)}(Math),r.SHA256)})),C((function(e,t){var r,n,o;e.exports=(n=(r=x).lib.Base,o=r.enc.Utf8,void(r.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),i=this._iKey=t.clone(),s=a.words,c=i.words,l=0;l<r;l++)s[l]^=1549556828,c[l]^=909522486;a.sigBytes=i.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))})),C((function(e,t){e.exports=x.HmacSHA256}))),L=function(){function e(e,t){this.accessKey=e,this.keySecret=t}return e.prototype.getHeaders=function(e){var t=function(e){function t(e){return e<10?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+"T"+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+(0===(r=e.getTimezoneOffset())?"Z":(n=r>0?"-":"+",r=Math.abs(r),n+t(Math.floor(r/60))+":"+t(r%60)));var r,n}(new Date);return{Authorization:this.generateAuthorization(e.requestPath,e.method,t),"X-TV-Timestamp":t}},e.prototype.generateAuthorization=function(e,t,r){var n=this.computeStringToSign(e,t,r),o=R.stringify(this.computeSignature(n));return this.formatAuthToken("TV",o)},e.prototype.formatAuthToken=function(e,t){return e+" "+this.accessKey+":"+t},e.prototype.computeStringToSign=function(e,t,r){return t+"\n"+e+"\n"+r},e.prototype.computeSignature=function(e){return N(e,this.keySecret)},e}();function O(e){switch(e){case"testing":return"https://tv-testing.trustingsocial.com/api";case"staging":return"https://tv-staging.trustingsocial.com/api";case"production":return"https://vn-vision.trustingsocial.com/api";default:return e}}function D(e,t,r,n){void 0===r&&(r="production");var o=(void 0===n?{}:n).headers,a=new L(e,t),i=O(r);return new T({authorizer:a,domain:i,headers:o})}var M=function(){function e(e){void 0===e&&(e="production");var t=new T({domain:O(e)});this.imagesService=new c(t),this.detectIDTamperingService=new m(t)}return e.prototype.uploadImage=function(e,t){return this.imagesService.requestWithHeaders(e,t)},e.prototype.detectTampering=function(e,t){return this.detectIDTamperingService.requestWithAuthHeaders(e,t)},e}();function U(e){var t=e.headerIndex;return function(e,r,o){var a=o.value,c=n({},o);return c.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return i(this,void 0,void 0,(function(){var r,o,i,c;return s(this,(function(s){switch(s.label){case 0:return this.transactionEnabled?[4,this.transactionManager.begin()]:[3,4];case 1:return r=s.sent(),o=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var a=arguments[t],i=0,s=a.length;i<s;i++,o++)n[o]=a[i];return n}(e),(i=n({},o[t]))["X-TV-Transaction"]=r,o[t]=i,[4,a.apply(this,o)];case 2:return c=s.sent(),[4,this.transactionManager.end()];case 3:return s.sent(),[2,c];case 4:return[4,a.apply(this,e)];case 5:return[2,s.sent()]}}))}))},c}}function F(e){return void 0===e&&(e={encryptedField:"data"}),function(t,r,o){var a=o.value,c=n({},o);return c.value=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return i(this,void 0,void 0,(function(){var r,n;return s(this,(function(o){switch(o.label){case 0:return[4,a.apply(this,t)];case 1:return r=o.sent(),this.encryptionEnabled&&"string"==typeof r[e.encryptedField]?(n=this.encryptionService.decrypt(r[e.encryptedField],{transactionID:this.transactionManager.currentTransactionID}),[2,JSON.parse(n)]):[2,r]}}))}))},c}}var j=function(){function e(e){this.httpClient=e,this.transactionID="",this.totalTransactions=0,this.currentTransaction=0}return Object.defineProperty(e.prototype,"currentTransactionID",{get:function(){return this.transactionID},enumerable:!0,configurable:!0}),e.prototype.begin=function(){return i(this,void 0,void 0,(function(){var e,t,r=this;return s(this,(function(n){switch(n.label){case 0:return e=this.totalTransactions++,[4,new Promise((function(t,n){var o=window.performance.now(),a=setInterval((function(){e===r.currentTransaction&&(clearInterval(a),t(!0)),window.performance.now()-o>=3e3&&(clearInterval(a),n(new Error("Transaction timeout")))}),100)}))];case 1:return n.sent(),[4,this.httpClient.post("/v1/transactions",{})];case 2:return t=n.sent().data,this.transactionID=t.id,[2,t.id]}}))}))},e.prototype.end=function(){return i(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return[4,this.httpClient.post("/v1/transactions/"+this.transactionID+"/finish")];case 1:return e=t.sent(),this.transactionID="",this.currentTransaction++,[2,e]}}))}))},e}(),V={options:{usePureJavaScript:!1}},z={},K=z,H={};z.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var o=0,a=t.length,i=t.charAt(0),s=[0];for(o=0;o<e.length;++o){for(var c=0,l=e[o];c<s.length;++c)l+=s[c]<<8,s[c]=l%a,l=l/a|0;for(;l>0;)s.push(l%a),l=l/a|0}for(o=0;0===e[o]&&o<e.length-1;++o)n+=i;for(o=s.length-1;o>=0;--o)n+=t[s[o]]}else n=function(e,t){var r=0,n=t.length,o=t.charAt(0),a=[0];for(r=0;r<e.length();++r){for(var i=0,s=e.at(r);i<a.length;++i)s+=a[i]<<8,a[i]=s%n,s=s/n|0;for(;s>0;)a.push(s%n),s=s/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=o;for(r=a.length-1;r>=0;--r)c+=t[a[r]];return c}(e,t);if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join("\r\n")}return n},z.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var r=H[t];if(!r){r=H[t]=[];for(var n=0;n<t.length;++n)r[t.charCodeAt(n)]=n}e=e.replace(/\s/g,"");var o=t.length,a=t.charAt(0),i=[0];for(n=0;n<e.length;n++){var s=r[e.charCodeAt(n)];if(void 0===s)return;for(var c=0,l=s;c<i.length;++c)l+=i[c]*o,i[c]=255&l,l>>=8;for(;l>0;)i.push(255&l),l>>=8}for(var u=0;e[u]===a&&u<e.length-1;++u)i.push(0);return"undefined"!=typeof Buffer?Buffer.from(i.reverse()):new Uint8Array(i.reverse())},C((function(e){var t=e.exports=V.util=V.util||{};function r(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function n(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(t.isArrayBuffer(e)||t.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var r=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,r)}catch(e){for(var o=0;o<r.length;++o)this.putByte(r[o])}}else(e instanceof n||"object"==w(e)&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return t.nextTick=process.nextTick,void("function"==typeof setImmediate?t.setImmediate=setImmediate:t.setImmediate=t.nextTick);if("function"==typeof setImmediate)return t.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(t.nextTick=function(e){return setImmediate(e)});if(t.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",r=[];t.setImmediate=function(t){r.push(t),1===r.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(t){if(t.source===window&&t.data===e){t.stopPropagation();var n=r.slice();r.length=0,n.forEach((function(e){e()}))}}),!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),o=!0,a=document.createElement("div");r=[],new MutationObserver((function(){var e=r.slice();r.length=0,e.forEach((function(e){e()}))})).observe(a,{attributes:!0});var i=t.setImmediate;t.setImmediate=function(e){Date.now()-n>15?(n=Date.now(),i(e)):(r.push(e),1===r.length&&a.setAttribute("a",o=!o))}}t.nextTick=t.setImmediate}(),t.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,t.globalScope=t.isNodejs?b:"undefined"==typeof self?window:self,t.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},t.isArrayBufferView=function(e){return e&&t.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},t.ByteBuffer=n,t.ByteStringBuffer=n,t.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},t.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},t.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},t.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},t.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},t.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},t.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(t.encodeUtf8(e))},t.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},t.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},t.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},t.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},t.ByteStringBuffer.prototype.putInt=function(e,t){r(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},t.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},t.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},t.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},t.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},t.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},t.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},t.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},t.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},t.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},t.ByteStringBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},t.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},t.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},t.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},t.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},t.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},t.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},t.ByteStringBuffer.prototype.copy=function(){var e=t.createBuffer(this.data);return e.read=this.read,e},t.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},t.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},t.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},t.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},t.ByteStringBuffer.prototype.toString=function(){return t.decodeUtf8(this.bytes())},t.DataBuffer=function(e,r){r=r||{},this.read=r.readOffset||0,this.growSize=r.growSize||1024;var n=t.isArrayBuffer(e),o=t.isArrayBufferView(e);if(n||o)return this.data=n?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in r?r.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in r&&(this.write=r.writeOffset)},t.DataBuffer.prototype.length=function(){return this.write-this.read},t.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},t.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},t.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},t.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},t.DataBuffer.prototype.putBytes=function(e,r){if(t.isArrayBufferView(e)){var n=(o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-o.byteOffset;return this.accommodate(n),new Uint8Array(this.data.buffer,this.write).set(o),this.write+=n,this}if(t.isArrayBuffer(e)){var o=new Uint8Array(e);return this.accommodate(o.byteLength),new Uint8Array(this.data.buffer).set(o,this.write),this.write+=o.byteLength,this}if(e instanceof t.DataBuffer||"object"==w(e)&&"number"==typeof e.read&&"number"==typeof e.write&&t.isArrayBufferView(e.data))return o=new Uint8Array(e.data.byteLength,e.read,e.length()),this.accommodate(o.byteLength),new Uint8Array(e.data.byteLength,this.write).set(o),this.write+=o.byteLength,this;if(e instanceof t.ByteStringBuffer&&(e=e.data,r="binary"),r=r||"binary","string"==typeof e){var a;if("hex"===r)return this.accommodate(Math.ceil(e.length/2)),a=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.hex.decode(e,a,this.write),this;if("base64"===r)return this.accommodate(3*Math.ceil(e.length/4)),a=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.base64.decode(e,a,this.write),this;if("utf8"===r&&(e=t.encodeUtf8(e),r="binary"),"binary"===r||"raw"===r)return this.accommodate(e.length),a=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.raw.decode(a),this;if("utf16"===r)return this.accommodate(2*e.length),a=new Uint16Array(this.data.buffer,this.write),this.write+=t.text.utf16.encode(a),this;throw new Error("Invalid encoding: "+r)}throw Error("Invalid parameter: "+e)},t.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},t.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},t.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},t.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},t.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},t.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},t.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},t.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},t.DataBuffer.prototype.putInt=function(e,t){r(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},t.DataBuffer.prototype.putSignedInt=function(e,t){return r(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},t.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},t.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},t.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},t.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},t.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},t.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},t.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},t.DataBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},t.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},t.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},t.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},t.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},t.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},t.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},t.DataBuffer.prototype.copy=function(){return new t.DataBuffer(this)},t.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},t.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},t.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},t.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},t.DataBuffer.prototype.toString=function(e){var r=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return t.binary.raw.encode(r);if("hex"===e)return t.binary.hex.encode(r);if("base64"===e)return t.binary.base64.encode(r);if("utf8"===e)return t.text.utf8.decode(r);if("utf16"===e)return t.text.utf16.decode(r);throw new Error("Invalid encoding: "+e)},t.createBuffer=function(e,r){return r=r||"raw",void 0!==e&&"utf8"===r&&(e=t.encodeUtf8(e)),new t.ByteBuffer(e)},t.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},t.xorBytes=function(e,t,r){for(var n="",o="",a="",i=0,s=0;r>0;--r,++i)o=e.charCodeAt(i)^t.charCodeAt(i),s>=10&&(n+=a,a="",s=0),a+=String.fromCharCode(o),++s;return n+a},t.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},t.bytesToHex=function(e){return t.createBuffer(e).toHex()},t.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],i="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";t.encode64=function(e,t){for(var r,n,a,i="",s="",c=0;c<e.length;)r=e.charCodeAt(c++),n=e.charCodeAt(c++),a=e.charCodeAt(c++),i+=o.charAt(r>>2),i+=o.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=o.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":o.charAt(63&a)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+i},t.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,o,i="",s=0;s<e.length;)t=a[e.charCodeAt(s++)-43],r=a[e.charCodeAt(s++)-43],n=a[e.charCodeAt(s++)-43],o=a[e.charCodeAt(s++)-43],i+=String.fromCharCode(t<<2|r>>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==o&&(i+=String.fromCharCode((3&n)<<6|o)));return i},t.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},t.decodeUtf8=function(e){return decodeURIComponent(escape(e))},t.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:K.encode,decode:K.decode}},t.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},t.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var o=r=r||0,a=0;a<e.length;++a)n[o++]=e.charCodeAt(a);return t?o-r:n},t.binary.hex.encode=t.bytesToHex,t.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var o=0,a=r=r||0;for(1&e.length&&(o=1,n[a++]=parseInt(e[0],16));o<e.length;o+=2)n[a++]=parseInt(e.substr(o,2),16);return t?a-r:n},t.binary.base64.encode=function(e,t){for(var r,n,a,i="",s="",c=0;c<e.byteLength;)r=e[c++],n=e[c++],a=e[c++],i+=o.charAt(r>>2),i+=o.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=o.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":o.charAt(63&a)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+i},t.binary.base64.decode=function(e,t,r){var n,o,i,s,c=t;c||(c=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var l=0,u=r=r||0;l<e.length;)n=a[e.charCodeAt(l++)-43],o=a[e.charCodeAt(l++)-43],i=a[e.charCodeAt(l++)-43],s=a[e.charCodeAt(l++)-43],c[u++]=n<<2|o>>4,64!==i&&(c[u++]=(15&o)<<4|i>>2,64!==s&&(c[u++]=(3&i)<<6|s));return t?u-r:c.subarray(0,u)},t.binary.base58.encode=function(e,r){return t.binary.baseN.encode(e,i,r)},t.binary.base58.decode=function(e,r){return t.binary.baseN.decode(e,i,r)},t.text={utf8:{},utf16:{}},t.text.utf8.encode=function(e,r,n){e=t.encodeUtf8(e);var o=r;o||(o=new Uint8Array(e.length));for(var a=n=n||0,i=0;i<e.length;++i)o[a++]=e.charCodeAt(i);return r?a-n:o},t.text.utf8.decode=function(e){return t.decodeUtf8(String.fromCharCode.apply(null,e))},t.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var o=new Uint16Array(n.buffer),a=r=r||0,i=r,s=0;s<e.length;++s)o[i++]=e.charCodeAt(s),a+=2;return t?a-r:n},t.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},t.deflate=function(e,r,n){if(r=t.decode64(e.deflate(t.encode64(r)).rval),n){var o=2;32&r.charCodeAt(1)&&(o=6),r=r.substring(o,r.length-4)}return r},t.inflate=function(e,r,n){var o=e.inflate(t.encode64(r)).rval;return null===o?null:t.decode64(o)};var s=function(e,r,n){if(!e)throw new Error("WebStorage not available.");var o;if(null===n?o=e.removeItem(r):(n=t.encode64(JSON.stringify(n)),o=e.setItem(r,n)),void 0!==o&&!0!==o.rval){var a=new Error(o.error.message);throw a.id=o.error.id,a.name=o.error.name,a}},c=function(e,r){if(!e)throw new Error("WebStorage not available.");var n=e.getItem(r);if(e.init)if(null===n.rval){if(n.error){var o=new Error(n.error.message);throw o.id=n.error.id,o.name=n.error.name,o}n=null}else n=n.rval;return null!==n&&(n=JSON.parse(t.decode64(n))),n},l=function(e,t,r,n){var o=c(e,t);null===o&&(o={}),o[r]=n,s(e,t,o)},u=function(e,t,r){var n=c(e,t);return null!==n&&(n=r in n?n[r]:null),n},d=function(e,t,r){var n=c(e,t);if(null!==n&&r in n){delete n[r];var o=!0;for(var a in n){o=!1;break}o&&(n=null),s(e,t,n)}},f=function(e,t){s(e,t,null)},p=function(e,t,r){var n,o=null;void 0===r&&(r=["web","flash"]);var a=!1,i=null;for(var s in r){n=r[s];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");o=e.apply(this,t),a="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,o=e.apply(this,t),a=!0)}catch(e){i=e}if(a)break}if(!a)throw i;return o};t.setItem=function(e,t,r,n,o){p(l,arguments,o)},t.getItem=function(e,t,r,n){return p(u,arguments,n)},t.removeItem=function(e,t,r,n){p(d,arguments,n)},t.clearItems=function(e,t,r){p(f,arguments,r)},t.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),n=null===r?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?(80!==n.port&&"http"===n.scheme||443!==n.port&&"https"===n.scheme)&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var h=null;t.getQueryVariables=function(e){var t,r=function(e){for(var t={},r=e.split("&"),n=0;n<r.length;n++){var o,a,i=r[n].indexOf("=");i>0?(o=r[n].substring(0,i),a=r[n].substring(i+1)):(o=r[n],a=null),o in t||(t[o]=[]),o in Object.prototype||null===a||t[o].push(unescape(a))}return t};return void 0===e?(null===h&&(h="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=h):t=r(e),t},t.parseFragment=function(e){var r=e,n="",o=e.indexOf("?");o>0&&(r=e.substring(0,o),n=e.substring(o+1));var a=r.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:r,queryString:n,path:a,query:""===n?{}:t.getQueryVariables(n)}},t.makeRequest=function(e){var r=t.parseFragment(e),n={path:r.pathString,query:r.queryString,getPath:function(e){return void 0===e?r.path:r.path[e]},getQuery:function(e,t){var n;return void 0===e?n=r.query:(n=r.query[e])&&void 0!==t&&(n=n[t]),n},getQueryLast:function(e,t){var r=n.getQuery(e);return r?r[r.length-1]:t}};return n},t.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},t.setPath=function(e,t,r){if("object"==w(e)&&null!==e)for(var n=0,o=t.length;n<o;){var a=t[n++];if(n==o)e[a]=r;else{var i=a in e;(!i||i&&"object"!=w(e[a])||i&&null===e[a])&&(e[a]={}),e=e[a]}}},t.getPath=function(e,t,r){for(var n=0,o=t.length,a=!0;a&&n<o&&"object"==w(e)&&null!==e;){var i=t[n++];(a=i in e)&&(e=e[i])}return a?e:r},t.deletePath=function(e,t){if("object"==w(e)&&null!==e)for(var r=0,n=t.length;r<n;){var o=t[r++];if(r==n)delete e[o];else{if(!(o in e)||"object"!=w(e[o])||null===e[o])break;e=e[o]}}},t.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},t.format=function(e){for(var t,r,n=/%./g,o=0,a=[],i=0;t=n.exec(e);){(r=e.substring(i,n.lastIndex-2)).length>0&&a.push(r),i=n.lastIndex;var s=t[0][1];switch(s){case"s":case"o":o<arguments.length?a.push(arguments[1+o++]):a.push("<?>");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(e.substring(i)),a.join("")},t.formatNumber=function(e,t,r,n){var o=e,a=isNaN(t=Math.abs(t))?2:t,i=void 0===r?",":r,s=void 0===n?".":n,c=o<0?"-":"",l=parseInt(o=Math.abs(+o||0).toFixed(a),10)+"",u=l.length>3?l.length%3:0;return c+(u?l.substr(0,u)+s:"")+l.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?i+Math.abs(o-l).toFixed(a).slice(2):"")},t.formatSize=function(e){return e>=1073741824?t.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?t.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?t.formatNumber(e/1024,0)+" KiB":t.formatNumber(e,0)+" bytes"},t.bytesFromIP=function(e){return-1!==e.indexOf(".")?t.bytesFromIPv4(e):-1!==e.indexOf(":")?t.bytesFromIPv6(e):null},t.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var r=t.createBuffer(),n=0;n<e.length;++n){var o=parseInt(e[n],10);if(isNaN(o))return null;r.putByte(o)}return r.getBytes()},t.bytesFromIPv6=function(e){for(var r=0,n=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++r,!0}))).length+r),o=t.createBuffer(),a=0;a<8;++a)if(e[a]&&0!==e[a].length){var i=t.hexToBytes(e[a]);i.length<2&&o.putByte(0),o.putBytes(i)}else o.fillWithByte(0,n),n=0;return o.getBytes()},t.bytesToIP=function(e){return 4===e.length?t.bytesToIPv4(e):16===e.length?t.bytesToIPv6(e):null},t.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},t.bytesToIPv6=function(e){if(16!==e.length)return null;for(var r=[],n=[],o=0,a=0;a<e.length;a+=2){for(var i=t.bytesToHex(e[a]+e[a+1]);"0"===i[0]&&"0"!==i;)i=i.substr(1);if("0"===i){var s=n[n.length-1],c=r.length;s&&c===s.end+1?(s.end=c,s.end-s.start>n[o].end-n[o].start&&(o=n.length-1)):n.push({start:c,end:c})}r.push(i)}if(n.length>0){var l=n[o];l.end-l.start>0&&(r.splice(l.start,l.end-l.start+1,""),0===l.start&&r.unshift(""),7===l.end&&r.push(""))}return r.join(":")},t.estimateCores=function(e,r){if("function"==typeof e&&(r=e,e={}),e=e||{},"cores"in t&&!e.update)return r(null,t.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return t.cores=navigator.hardwareConcurrency,r(null,t.cores);if("undefined"==typeof Worker)return t.cores=1,r(null,t.cores);if("undefined"==typeof Blob)return t.cores=2,r(null,t.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){var t=Date.now(),r=t+4;self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(o,a,i){if(0===a){var s=Math.floor(o.reduce((function(e,t){return e+t}),0)/o.length);return t.cores=Math.max(1,s),URL.revokeObjectURL(n),r(null,t.cores)}!function(e,t){for(var r=[],o=[],a=0;a<e;++a){var i=new Worker(n);i.addEventListener("message",(function(n){if(o.push(n.data),o.length===e){for(var a=0;a<e;++a)r[a].terminate();t(null,o)}})),r.push(i)}for(a=0;a<e;++a)r[a].postMessage(a)}(i,(function(t,r){o.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var o=t[n],a=r[n]=[],i=0;i<e;++i)if(n!==i){var s=t[i];(o.st>s.st&&o.st<s.et||s.st>o.st&&s.st<o.et)&&a.push(i)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(i,r)),e(o,a-1,i)}))}([],5,16)}})),V.cipher=V.cipher||{},V.cipher.algorithms=V.cipher.algorithms||{},V.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=V.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new V.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},V.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=V.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new V.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},V.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),V.cipher.algorithms[e]=t},V.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in V.cipher.algorithms?V.cipher.algorithms[e]:null};var q=V.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};function Q(e,t){V.cipher.registerAlgorithm(e,(function(){return new V.aes.Algorithm(e,t)}))}q.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=V.util.createBuffer(),this.output=e.output||V.util.createBuffer(),this.mode.start(t)},q.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},q.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))},C((function(e){V.cipher=V.cipher||{};var t=e.exports=V.cipher.modes=V.cipher.modes||{};function r(e,t){if("string"==typeof e&&(e=V.util.createBuffer(e)),V.util.isArray(e)&&e.length>4){var r=e;e=V.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!V.util.isArray(e)){var o=[],a=t/4;for(n=0;n<a;++n)o.push(e.getInt32());e=o}return e}function n(e){e[e.length-1]=e[e.length-1]+1&4294967295}function o(e){return[e/4294967296|0,4294967295&e]}t.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.ecb.prototype.start=function(e){},t.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},t.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},t.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},t.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},t.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},t.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},t.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},t.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},t.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},t.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=V.util.createBuffer(),this._partialBytes=0},t.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)this._inBlock[o]=e.getInt32()^this._outBlock[o],t.putInt32(this._inBlock[o]);else{var a=(this.blockSize-n)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),o=0;o<this._ints;++o)this._partialBlock[o]=e.getInt32()^this._outBlock[o],this._partialOutput.putInt32(this._partialBlock[o]);if(a>0)e.read-=this.blockSize;else for(o=0;o<this._ints;++o)this._inBlock[o]=this._partialBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)this._inBlock[o]=e.getInt32(),t.putInt32(this._inBlock[o]^this._outBlock[o]);else{var a=(this.blockSize-n)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),o=0;o<this._ints;++o)this._partialBlock[o]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[o]^this._outBlock[o]);if(a>0)e.read-=this.blockSize;else for(o=0;o<this._ints;++o)this._inBlock[o]=this._partialBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=V.util.createBuffer(),this._partialBytes=0},t.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)t.putInt32(e.getInt32()^this._outBlock[o]),this._inBlock[o]=this._outBlock[o];else{var a=(this.blockSize-n)%this.blockSize;for(a>0&&(a=this.blockSize-a),this._partialOutput.clear(),o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(a>0)e.read-=this.blockSize;else for(o=0;o<this._ints;++o)this._inBlock[o]=this._outBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},t.ofb.prototype.decrypt=t.ofb.prototype.encrypt,t.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=V.util.createBuffer(),this._partialBytes=0},t.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=r(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},t.ctr.prototype.encrypt=function(e,t,r){var o=e.length();if(0===o)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&o>=this.blockSize)for(var a=0;a<this._ints;++a)t.putInt32(e.getInt32()^this._outBlock[a]);else{var i=(this.blockSize-o)%this.blockSize;for(i>0&&(i=this.blockSize-i),this._partialOutput.clear(),a=0;a<this._ints;++a)this._partialOutput.putInt32(e.getInt32()^this._outBlock[a]);if(i>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=0}n(this._inBlock)},t.ctr.prototype.decrypt=t.ctr.prototype.encrypt,t.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=V.util.createBuffer(),this._partialBytes=0,this._R=3774873600},t.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=V.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?V.util.createBuffer(e.additionalData):V.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=V.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var a=r.length();if(12===a)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*a)))}this._inBlock=this._j0.slice(0),n(this._inBlock),this._partialBytes=0,t=V.util.createBuffer(t),this._aDataLength=o(8*t.length());var i=t.length()%this.blockSize;for(i&&t.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},t.gcm.prototype.encrypt=function(e,t,r){var o=e.length();if(0===o)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&o>=this.blockSize){for(var a=0;a<this._ints;++a)t.putInt32(this._outBlock[a]^=e.getInt32());this._cipherLength+=this.blockSize}else{var i=(this.blockSize-o)%this.blockSize;for(i>0&&(i=this.blockSize-i),this._partialOutput.clear(),a=0;a<this._ints;++a)this._partialOutput.putInt32(e.getInt32()^this._outBlock[a]);if(i<=0||r){if(r){var s=o%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}else this._cipherLength+=this.blockSize;for(a=0;a<this._ints;++a)this._outBlock[a]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),n(this._inBlock)},t.gcm.prototype.decrypt=function(e,t,r){var o=e.length();if(o<this.blockSize&&!(r&&o>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),n(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var a=0;a<this._ints;++a)t.putInt32(this._outBlock[a]^this._hashBlock[a]);o<this.blockSize?this._cipherLength+=o%this.blockSize:this._cipherLength+=this.blockSize},t.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=V.util.createBuffer();var n=this._aDataLength.concat(o(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,n);var a=[];this.cipher.encrypt(this._j0,a);for(var i=0;i<this._ints;++i)this.tag.putInt32(this._s[i]^a[i]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},t.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),o=0;o<128;++o)e[o/32|0]&1<<31-o%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n);return r},t.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},t.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,o=this._m[r][n];t[0]^=o[0],t[1]^=o[1],t[2]^=o[2],t[3]^=o[3]}return t},t.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},t.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,o=16*r,a=new Array(o),i=0;i<o;++i){var s=[0,0,0,0],c=(n-1-i%n)*t;s[i/n|0]=1<<t-1<<c,a[i]=this.generateSubHashTable(this.multiply(s,e),t)}return a},t.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,o=new Array(r);o[n]=e.slice(0);for(var a=n>>>1;a>0;)this.pow(o[2*a],o[a]=[]),a>>=1;for(a=2;a<n;){for(var i=1;i<a;++i){var s=o[a],c=o[i];o[a+i]=[s[0]^c[0],s[1]^c[1],s[2]^c[2],s[3]^c[3]]}a*=2}for(o[0]=[0,0,0,0],a=n+1;a<r;++a){var l=o[a^n];o[a]=[e[0]^l[0],e[1]^l[1],e[2]^l[2],e[3]^l[3]]}return o}})),V.aes=V.aes||{},V.aes.startEncrypting=function(e,t,r,n){var o=re({key:e,output:r,decrypt:!1,mode:n});return o.start(t),o},V.aes.createEncryptionCipher=function(e,t){return re({key:e,output:null,decrypt:!1,mode:t})},V.aes.startDecrypting=function(e,t,r,n){var o=re({key:e,output:r,decrypt:!0,mode:n});return o.start(t),o},V.aes.createDecryptionCipher=function(e,t){return re({key:e,output:null,decrypt:!0,mode:t})},V.aes.Algorithm=function(e,t){Z||J();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return te(r._w,e,t,!1)},decrypt:function(e,t){return te(r._w,e,t,!0)}}}),r._init=!1},V.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(V.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=V.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}}else r=V.util.createBuffer(r);if(!V.util.isArray(r)){t=r,r=[];var o=t.length();if(16===o||24===o||32===o)for(o>>>=2,n=0;n<o;++n)r.push(t.getInt32())}if(!V.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var a=this.mode.name,i=-1!==["CFB","OFB","CTR","GCM"].indexOf(a);this._w=ee(r,e.decrypt&&!i),this._init=!0}},V.aes._expandKey=function(e,t){return Z||J(),ee(e,t)},V.aes._updateBlock=te,Q("AES-ECB",V.cipher.modes.ecb),Q("AES-CBC",V.cipher.modes.cbc),Q("AES-CFB",V.cipher.modes.cfb),Q("AES-OFB",V.cipher.modes.ofb),Q("AES-CTR",V.cipher.modes.ctr),Q("AES-GCM",V.cipher.modes.gcm);var W,G,X,Y,$,Z=!1;function J(){Z=!0,X=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;for(W=new Array(256),G=new Array(256),Y=new Array(4),$=new Array(4),t=0;t<4;++t)Y[t]=new Array(256),$[t]=new Array(256);var r,n,o,a,i,s,c,l=0,u=0;for(t=0;t<256;++t){a=(a=u^u<<1^u<<2^u<<3^u<<4)>>8^255&a^99,W[l]=a,G[a]=l,s=(i=e[a])<<24^a<<16^a<<8^a^i,c=((r=e[l])^(n=e[r])^(o=e[n]))<<24^(l^o)<<16^(l^n^o)<<8^l^r^o;for(var d=0;d<4;++d)Y[d][l]=s,$[d][a]=c,s=s<<24|s>>>8,c=c<<24|c>>>8;0===l?l=u=1:(l=r^e[e[e[r^o]]],u^=e[e[u]])}}function ee(e,t){for(var r,n=e.slice(0),o=1,a=n.length,i=4*(a+6+1),s=a;s<i;++s)r=n[s-1],s%a==0?(r=W[r>>>16&255]<<24^W[r>>>8&255]<<16^W[255&r]<<8^W[r>>>24]^X[o]<<24,o++):a>6&&s%a==4&&(r=W[r>>>24]<<24^W[r>>>16&255]<<16^W[r>>>8&255]<<8^W[255&r]),n[s]=n[s-a]^r;if(t){for(var c,l=$[0],u=$[1],d=$[2],f=$[3],p=n.slice(0),h=(s=0,(i=n.length)-4);s<i;s+=4,h-=4)if(0===s||s===i-4)p[s]=n[h],p[s+1]=n[h+3],p[s+2]=n[h+2],p[s+3]=n[h+1];else for(var m=0;m<4;++m)c=n[h+m],p[s+(3&-m)]=l[W[c>>>24]]^u[W[c>>>16&255]]^d[W[c>>>8&255]]^f[W[255&c]];n=p}return n}function te(e,t,r,n){var o,a,i,s,c,l,u,d,f,p,h,m,g=e.length/4-1;n?(o=$[0],a=$[1],i=$[2],s=$[3],c=G):(o=Y[0],a=Y[1],i=Y[2],s=Y[3],c=W),l=t[0]^e[0],u=t[n?3:1]^e[1],d=t[2]^e[2],f=t[n?1:3]^e[3];for(var v=3,y=1;y<g;++y)p=o[l>>>24]^a[u>>>16&255]^i[d>>>8&255]^s[255&f]^e[++v],h=o[u>>>24]^a[d>>>16&255]^i[f>>>8&255]^s[255&l]^e[++v],m=o[d>>>24]^a[f>>>16&255]^i[l>>>8&255]^s[255&u]^e[++v],f=o[f>>>24]^a[l>>>16&255]^i[u>>>8&255]^s[255&d]^e[++v],l=p,u=h,d=m;r[0]=c[l>>>24]<<24^c[u>>>16&255]<<16^c[d>>>8&255]<<8^c[255&f]^e[++v],r[n?3:1]=c[u>>>24]<<24^c[d>>>16&255]<<16^c[f>>>8&255]<<8^c[255&l]^e[++v],r[2]=c[d>>>24]<<24^c[f>>>16&255]<<16^c[l>>>8&255]<<8^c[255&u]^e[++v],r[n?1:3]=c[f>>>24]<<24^c[l>>>16&255]<<16^c[u>>>8&255]<<8^c[255&d]^e[++v]}function re(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?V.cipher.createDecipher(r,e.key):V.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof V.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,n.call(t,r)},t}function ne(e,t){V.cipher.registerAlgorithm(e,(function(){return new V.des.Algorithm(e,t)}))}C((function(e){V.pki=V.pki||{};var t=e.exports=V.pki.oids=V.oids=V.oids||{};function r(e,r){t[e]=r,t[r]=e}function n(e,r){t[e]=r}r("1.2.840.113549.1.1.1","rsaEncryption"),r("1.2.840.113549.1.1.4","md5WithRSAEncryption"),r("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),r("1.2.840.113549.1.1.7","RSAES-OAEP"),r("1.2.840.113549.1.1.8","mgf1"),r("1.2.840.113549.1.1.9","pSpecified"),r("1.2.840.113549.1.1.10","RSASSA-PSS"),r("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),r("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),r("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),r("1.3.101.112","EdDSA25519"),r("1.2.840.10040.4.3","dsa-with-sha1"),r("1.3.14.3.2.7","desCBC"),r("1.3.14.3.2.26","sha1"),r("2.16.840.1.101.3.4.2.1","sha256"),r("2.16.840.1.101.3.4.2.2","sha384"),r("2.16.840.1.101.3.4.2.3","sha512"),r("1.2.840.113549.2.5","md5"),r("1.2.840.113549.1.7.1","data"),r("1.2.840.113549.1.7.2","signedData"),r("1.2.840.113549.1.7.3","envelopedData"),r("1.2.840.113549.1.7.4","signedAndEnvelopedData"),r("1.2.840.113549.1.7.5","digestedData"),r("1.2.840.113549.1.7.6","encryptedData"),r("1.2.840.113549.1.9.1","emailAddress"),r("1.2.840.113549.1.9.2","unstructuredName"),r("1.2.840.113549.1.9.3","contentType"),r("1.2.840.113549.1.9.4","messageDigest"),r("1.2.840.113549.1.9.5","signingTime"),r("1.2.840.113549.1.9.6","counterSignature"),r("1.2.840.113549.1.9.7","challengePassword"),r("1.2.840.113549.1.9.8","unstructuredAddress"),r("1.2.840.113549.1.9.14","extensionRequest"),r("1.2.840.113549.1.9.20","friendlyName"),r("1.2.840.113549.1.9.21","localKeyId"),r("1.2.840.113549.1.9.22.1","x509Certificate"),r("1.2.840.113549.1.12.10.1.1","keyBag"),r("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),r("1.2.840.113549.1.12.10.1.3","certBag"),r("1.2.840.113549.1.12.10.1.4","crlBag"),r("1.2.840.113549.1.12.10.1.5","secretBag"),r("1.2.840.113549.1.12.10.1.6","safeContentsBag"),r("1.2.840.113549.1.5.13","pkcs5PBES2"),r("1.2.840.113549.1.5.12","pkcs5PBKDF2"),r("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),r("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),r("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),r("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),r("1.2.840.113549.2.7","hmacWithSHA1"),r("1.2.840.113549.2.8","hmacWithSHA224"),r("1.2.840.113549.2.9","hmacWithSHA256"),r("1.2.840.113549.2.10","hmacWithSHA384"),r("1.2.840.113549.2.11","hmacWithSHA512"),r("1.2.840.113549.3.7","des-EDE3-CBC"),r("2.16.840.1.101.3.4.1.2","aes128-CBC"),r("2.16.840.1.101.3.4.1.22","aes192-CBC"),r("2.16.840.1.101.3.4.1.42","aes256-CBC"),r("2.5.4.3","commonName"),r("2.5.4.5","serialName"),r("2.5.4.6","countryName"),r("2.5.4.7","localityName"),r("2.5.4.8","stateOrProvinceName"),r("2.5.4.9","streetAddress"),r("2.5.4.10","organizationName"),r("2.5.4.11","organizationalUnitName"),r("2.5.4.13","description"),r("2.5.4.15","businessCategory"),r("2.5.4.17","postalCode"),r("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),r("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),r("2.16.840.1.113730.1.1","nsCertType"),r("2.16.840.1.113730.1.13","nsComment"),n("2.5.29.1","authorityKeyIdentifier"),n("2.5.29.2","keyAttributes"),n("2.5.29.3","certificatePolicies"),n("2.5.29.4","keyUsageRestriction"),n("2.5.29.5","policyMapping"),n("2.5.29.6","subtreesConstraint"),n("2.5.29.7","subjectAltName"),n("2.5.29.8","issuerAltName"),n("2.5.29.9","subjectDirectoryAttributes"),n("2.5.29.10","basicConstraints"),n("2.5.29.11","nameConstraints"),n("2.5.29.12","policyConstraints"),n("2.5.29.13","basicConstraints"),r("2.5.29.14","subjectKeyIdentifier"),r("2.5.29.15","keyUsage"),n("2.5.29.16","privateKeyUsagePeriod"),r("2.5.29.17","subjectAltName"),r("2.5.29.18","issuerAltName"),r("2.5.29.19","basicConstraints"),n("2.5.29.20","cRLNumber"),n("2.5.29.21","cRLReason"),n("2.5.29.22","expirationDate"),n("2.5.29.23","instructionCode"),n("2.5.29.24","invalidityDate"),n("2.5.29.25","cRLDistributionPoints"),n("2.5.29.26","issuingDistributionPoint"),n("2.5.29.27","deltaCRLIndicator"),n("2.5.29.28","issuingDistributionPoint"),n("2.5.29.29","certificateIssuer"),n("2.5.29.30","nameConstraints"),r("2.5.29.31","cRLDistributionPoints"),r("2.5.29.32","certificatePolicies"),n("2.5.29.33","policyMappings"),n("2.5.29.34","policyConstraints"),r("2.5.29.35","authorityKeyIdentifier"),n("2.5.29.36","policyConstraints"),r("2.5.29.37","extKeyUsage"),n("2.5.29.46","freshestCRL"),n("2.5.29.54","inhibitAnyPolicy"),r("1.3.6.1.4.1.11129.2.4.2","timestampList"),r("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),r("1.3.6.1.5.5.7.3.1","serverAuth"),r("1.3.6.1.5.5.7.3.2","clientAuth"),r("1.3.6.1.5.5.7.3.3","codeSigning"),r("1.3.6.1.5.5.7.3.4","emailProtection"),r("1.3.6.1.5.5.7.3.8","timeStamping")})),C((function(e){var t=e.exports=V.asn1=V.asn1||{};function r(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}t.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},t.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},t.create=function(e,r,n,o,a){if(V.util.isArray(o)){for(var i=[],s=0;s<o.length;++s)void 0!==o[s]&&i.push(o[s]);o=i}var c={tagClass:e,type:r,constructed:n,composed:n||V.util.isArray(o),value:o};return a&&"bitStringContents"in a&&(c.bitStringContents=a.bitStringContents,c.original=t.copy(c)),c},t.copy=function(e,r){var n;if(V.util.isArray(e)){n=[];for(var o=0;o<e.length;++o)n.push(t.copy(e[o],r));return n}return"string"==typeof e?e:(n={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:t.copy(e.value,r)},r&&!r.excludeBitStringContents&&(n.bitStringContents=e.bitStringContents),n)},t.equals=function(e,r,n){if(V.util.isArray(e)){if(!V.util.isArray(r))return!1;if(e.length!==r.length)return!1;for(var o=0;o<e.length;++o)if(!t.equals(e[o],r[o]))return!1;return!0}if(w(e)!=w(r))return!1;if("string"==typeof e)return e===r;var a=e.tagClass===r.tagClass&&e.type===r.type&&e.constructed===r.constructed&&e.composed===r.composed&&t.equals(e.value,r.value);return n&&n.includeBitStringContents&&(a=a&&e.bitStringContents===r.bitStringContents),a},t.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};t.fromDer=function(e,n){return void 0===n&&(n={strict:!0,decodeBitStrings:!0}),"boolean"==typeof n&&(n={strict:n,decodeBitStrings:!0}),"strict"in n||(n.strict=!0),"decodeBitStrings"in n||(n.decodeBitStrings=!0),"string"==typeof e&&(e=V.util.createBuffer(e)),function e(n,o,a,i){var s;r(n,o,2);var c=n.getByte();o--;var l=192&c,u=31&c;s=n.length();var d,f,p=function(e,t){var n=e.getByte();if(t--,128!==n){var o;if(128&n){var a=127&n;r(e,t,a),o=e.getInt(a<<3)}else o=n;if(o<0)throw new Error("Negative length: "+o);return o}}(n,o);if(o-=s-n.length(),void 0!==p&&p>o){if(i.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=n.length(),h.remaining=o,h.requested=p,h}p=o}var m=32==(32&c);if(m)if(d=[],void 0===p)for(;;){if(r(n,o,2),n.bytes(2)===String.fromCharCode(0,0)){n.getBytes(2),o-=2;break}s=n.length(),d.push(e(n,o,a+1,i)),o-=s-n.length()}else for(;p>0;)s=n.length(),d.push(e(n,p,a+1,i)),o-=s-n.length(),p-=s-n.length();if(void 0===d&&l===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&(f=n.bytes(p)),void 0===d&&i.decodeBitStrings&&l===t.Class.UNIVERSAL&&u===t.Type.BITSTRING&&p>1){var g=n.read,v=o,y=0;if(u===t.Type.BITSTRING&&(r(n,o,1),y=n.getByte(),o--),0===y)try{s=n.length();var b=e(n,o,a+1,{verbose:i.verbose,strict:!0,decodeBitStrings:!0}),C=s-n.length();o-=C,u==t.Type.BITSTRING&&C++;var w=b.tagClass;C!==p||w!==t.Class.UNIVERSAL&&w!==t.Class.CONTEXT_SPECIFIC||(d=[b])}catch(e){}void 0===d&&(n.read=g,o=v)}if(void 0===d){if(void 0===p){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=o}if(u===t.Type.BMPSTRING)for(d="";p>0;p-=2)r(n,o,2),d+=String.fromCharCode(n.getInt16()),o-=2;else d=n.getBytes(p)}var k=void 0===f?null:{bitStringContents:f};return t.create(l,u,m,d,k)}(e,e.length(),0,n)},t.toDer=function(e){var r=V.util.createBuffer(),n=e.tagClass|e.type,o=V.util.createBuffer(),a=!1;if("bitStringContents"in e&&(a=!0,e.original&&(a=t.equals(e,e.original))),a)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?n|=32:o.putByte(0);for(var i=0;i<e.value.length;++i)void 0!==e.value[i]&&o.putBuffer(t.toDer(e.value[i]))}else if(e.type===t.Type.BMPSTRING)for(i=0;i<e.value.length;++i)o.putInt16(e.value.charCodeAt(i));else e.type===t.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(r.putByte(n),o.length()<=127)r.putByte(127&o.length());else{var s=o.length(),c="";do{c+=String.fromCharCode(255&s),s>>>=8}while(s>0);for(r.putByte(128|c.length),i=c.length-1;i>=0;--i)r.putByte(c.charCodeAt(i))}return r.putBuffer(o),r},t.oidToDer=function(e){var t,r,n,o,a=e.split("."),i=V.util.createBuffer();i.putByte(40*parseInt(a[0],10)+parseInt(a[1],10));for(var s=2;s<a.length;++s){t=!0,r=[],n=parseInt(a[s],10);do{o=127&n,n>>>=7,t||(o|=128),r.push(o),t=!1}while(n>0);for(var c=r.length-1;c>=0;--c)i.putByte(r[c])}return i},t.derToOid=function(e){var t;"string"==typeof e&&(e=V.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)n<<=7,128&(r=e.getByte())?n+=127&r:(t+="."+(n+r),n=0);return t},t.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,o=parseInt(e.substr(4,2),10),a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),s=0;if(e.length>11){var c=e.charAt(10),l=10;"+"!==c&&"-"!==c&&(s=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,o),t.setUTCHours(a,i,s,0),l&&("+"===(c=e.charAt(l))||"-"===c)){var u=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);u*=6e4,"+"===c?t.setTime(+t-u):t.setTime(+t+u)}return t},t.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,o=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),s=parseInt(e.substr(12,2),10),c=0,l=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var d=e.length-5,f=e.charAt(d);return"+"!==f&&"-"!==f||(l=60*parseInt(e.substr(d+1,2),10)+parseInt(e.substr(d+4,2),10),l*=6e4,"+"===f&&(l*=-1),u=!0),"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,n,o),t.setUTCHours(a,i,s,c),t.setTime(+t+l)):(t.setFullYear(r,n,o),t.setHours(a,i,s,c)),t},t.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+"Z"},t.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+"Z"},t.integerToDer=function(e){var t=V.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},t.derToInteger=function(e){"string"==typeof e&&(e=V.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},t.validate=function(e,r,n,o){var a=!1;if(e.tagClass!==r.tagClass&&void 0!==r.tagClass||e.type!==r.type&&void 0!==r.type)o&&(e.tagClass!==r.tagClass&&o.push("["+r.name+'] Expected tag class "'+r.tagClass+'", got "'+e.tagClass+'"'),e.type!==r.type&&o.push("["+r.name+'] Expected type "'+r.type+'", got "'+e.type+'"'));else if(e.constructed===r.constructed||void 0===r.constructed){if(a=!0,r.value&&V.util.isArray(r.value))for(var i=0,s=0;a&&s<r.value.length;++s)a=r.value[s].optional||!1,e.value[i]&&((a=t.validate(e.value[i],r.value[s],n,o))?++i:r.value[s].optional&&(a=!0)),!a&&o&&o.push("["+r.name+'] Tag class "'+r.tagClass+'", type "'+r.type+'" expected value length "'+r.value.length+'", got "'+e.value.length+'"');if(a&&n&&(r.capture&&(n[r.capture]=e.value),r.captureAsn1&&(n[r.captureAsn1]=e),r.captureBitStringContents&&"bitStringContents"in e&&(n[r.captureBitStringContents]=e.bitStringContents),r.captureBitStringValue&&"bitStringContents"in e))if(e.bitStringContents.length<2)n[r.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");n[r.captureBitStringValue]=e.bitStringContents.slice(1)}}else o&&o.push("["+r.name+'] Expected constructed "'+r.constructed+'", got "'+e.constructed+'"');return a};var n=/[^\\u0000-\\u00ff]/;t.prettyPrint=function(e,r,o){var a="";o=o||2,(r=r||0)>0&&(a+="\n");for(var i="",s=0;s<r*o;++s)i+=" ";switch(a+=i+"Tag: ",e.tagClass){case t.Class.UNIVERSAL:a+="Universal:";break;case t.Class.APPLICATION:a+="Application:";break;case t.Class.CONTEXT_SPECIFIC:a+="Context-Specific:";break;case t.Class.PRIVATE:a+="Private:"}if(e.tagClass===t.Class.UNIVERSAL)switch(a+=e.type,e.type){case t.Type.NONE:a+=" (None)";break;case t.Type.BOOLEAN:a+=" (Boolean)";break;case t.Type.INTEGER:a+=" (Integer)";break;case t.Type.BITSTRING:a+=" (Bit string)";break;case t.Type.OCTETSTRING:a+=" (Octet string)";break;case t.Type.NULL:a+=" (Null)";break;case t.Type.OID:a+=" (Object Identifier)";break;case t.Type.ODESC:a+=" (Object Descriptor)";break;case t.Type.EXTERNAL:a+=" (External or Instance of)";break;case t.Type.REAL:a+=" (Real)";break;case t.Type.ENUMERATED:a+=" (Enumerated)";break;case t.Type.EMBEDDED:a+=" (Embedded PDV)";break;case t.Type.UTF8:a+=" (UTF8)";break;case t.Type.ROID:a+=" (Relative Object Identifier)";break;case t.Type.SEQUENCE:a+=" (Sequence)";break;case t.Type.SET:a+=" (Set)";break;case t.Type.PRINTABLESTRING:a+=" (Printable String)";break;case t.Type.IA5String:a+=" (IA5String (ASCII))";break;case t.Type.UTCTIME:a+=" (UTC time)";break;case t.Type.GENERALIZEDTIME:a+=" (Generalized time)";break;case t.Type.BMPSTRING:a+=" (BMP String)"}else a+=e.type;if(a+="\n",a+=i+"Constructed: "+e.constructed+"\n",e.composed){var c=0,l="";for(s=0;s<e.value.length;++s)void 0!==e.value[s]&&(c+=1,l+=t.prettyPrint(e.value[s],r+1,o),s+1<e.value.length&&(l+=","));a+=i+"Sub values: "+c+l}else{if(a+=i+"Value: ",e.type===t.Type.OID){var u=t.derToOid(e.value);a+=u,V.pki&&V.pki.oids&&u in V.pki.oids&&(a+=" ("+V.pki.oids[u]+") ")}if(e.type===t.Type.INTEGER)try{a+=t.derToInteger(e.value)}catch(t){a+="0x"+V.util.bytesToHex(e.value)}else if(e.type===t.Type.BITSTRING){if(e.value.length>1?a+="0x"+V.util.bytesToHex(e.value.slice(1)):a+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?a+=" (1 unused bit shown)":d>1&&(a+=" ("+d+" unused bits shown)")}}else e.type===t.Type.OCTETSTRING?(n.test(e.value)||(a+="("+e.value+") "),a+="0x"+V.util.bytesToHex(e.value)):e.type===t.Type.UTF8?a+=V.util.decodeUtf8(e.value):e.type===t.Type.PRINTABLESTRING||e.type===t.Type.IA5String?a+=e.value:n.test(e.value)?a+="0x"+V.util.bytesToHex(e.value):0===e.value.length?a+="[null]":a+=e.value}return a}})),V.md=V.md||{},V.md.algorithms=V.md.algorithms||{},C((function(e){(e.exports=V.hmac=V.hmac||{}).create=function(){var e=null,t=null,r=null,n=null,o={start:function(o,a){if(null!==o)if("string"==typeof o){if(!((o=o.toLowerCase())in V.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=V.md.algorithms[o].create()}else t=o;if(null===a)a=e;else{if("string"==typeof a)a=V.util.createBuffer(a);else if(V.util.isArray(a)){var i=a;a=V.util.createBuffer();for(var s=0;s<i.length;++s)a.putByte(i[s])}var c=a.length();for(c>t.blockLength&&(t.start(),t.update(a.bytes()),a=t.digest()),r=V.util.createBuffer(),n=V.util.createBuffer(),c=a.length(),s=0;s<c;++s)i=a.at(s),r.putByte(54^i),n.putByte(92^i);if(c<t.blockLength)for(i=t.blockLength-c,s=0;s<i;++s)r.putByte(54),n.putByte(92);e=a,r=r.bytes(),n=n.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(n),t.update(e),t.digest()}};return o.digest=o.getMac,o}})),C((function(e){var t=e.exports=V.md5=V.md5||{};V.md.md5=V.md.algorithms.md5=t,t.create=function(){i||function(){r=String.fromCharCode(128),r+=V.util.fillString(String.fromCharCode(0),64),n=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],o=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],a=new Array(64);for(var e=0;e<64;++e)a[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));i=!0}();var e=null,t=V.util.createBuffer(),c=new Array(16),l={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var r=l.messageLengthSize/4,n=0;n<r;++n)l.fullMessageLength.push(0);return t=V.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},l}};return l.start(),l.update=function(r,n){"utf8"===n&&(r=V.util.encodeUtf8(r));var o=r.length;l.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=l.fullMessageLength.length-1;a>=0;--a)l.fullMessageLength[a]+=o[1],o[1]=o[0]+(l.fullMessageLength[a]/4294967296>>>0),l.fullMessageLength[a]=l.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(r),s(e,c,t),(t.read>2048||0===t.length())&&t.compact(),l},l.digest=function(){var n=V.util.createBuffer();n.putBytes(t.bytes());var o=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize&l.blockLength-1;n.putBytes(r.substr(0,l.blockLength-o));for(var a,i=0,u=l.fullMessageLength.length-1;u>=0;--u)i=(a=8*l.fullMessageLength[u]+i)/4294967296>>>0,n.putInt32Le(a>>>0);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};s(d,c,n);var f=V.util.createBuffer();return f.putInt32Le(d.h0),f.putInt32Le(d.h1),f.putInt32Le(d.h2),f.putInt32Le(d.h3),f},l};var r=null,n=null,o=null,a=null,i=!1;function s(e,t,r){for(var i,s,c,l,u,d,f,p=r.length();p>=64;){for(s=e.h0,c=e.h1,l=e.h2,u=e.h3,f=0;f<16;++f)t[f]=r.getInt32Le(),i=s+(u^c&(l^u))+a[f]+t[f],s=u,u=l,l=c,c+=i<<(d=o[f])|i>>>32-d;for(;f<32;++f)i=s+(l^u&(c^l))+a[f]+t[n[f]],s=u,u=l,l=c,c+=i<<(d=o[f])|i>>>32-d;for(;f<48;++f)i=s+(c^l^u)+a[f]+t[n[f]],s=u,u=l,l=c,c+=i<<(d=o[f])|i>>>32-d;for(;f<64;++f)i=s+(l^(c|~u))+a[f]+t[n[f]],s=u,u=l,l=c,c+=i<<(d=o[f])|i>>>32-d;e.h0=e.h0+s|0,e.h1=e.h1+c|0,e.h2=e.h2+l|0,e.h3=e.h3+u|0,p-=64}}})),C((function(e){var t=e.exports=V.pem=V.pem||{};function r(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},o=0;o<e.values.length;++o)r.push(e.values[o].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var a=0,i=-1;for(o=0;o<t.length;++o,++a)if(a>65&&-1!==i){var s=t[i];","===s?(++i,t=t.substr(0,i)+"\r\n "+t.substr(i)):t=t.substr(0,i)+"\r\n"+s+t.substr(i+1),a=o-i-1,i=-1,++o}else" "!==t[o]&&"\t"!==t[o]&&","!==t[o]||(i=o);return t}function n(e){return e.replace(/^\s+/,"")}t.encode=function(e,t){t=t||{};var n,o="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(o+=r(n={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(o+=r(n={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(n={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&n.values.push(e.dekInfo.parameters),o+=r(n)),e.headers)for(var a=0;a<e.headers.length;++a)o+=r(e.headers[a]);return e.procType&&(o+="\r\n"),(o+=V.util.encode64(e.body,t.maxline||64)+"\r\n")+"-----END "+e.type+"-----\r\n"},t.decode=function(e){for(var t,r=[],o=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,a=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,i=/\r?\n/;t=o.exec(e);){var s={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:V.util.decode64(t[3])};if(r.push(s),t[2]){for(var c=t[2].split(i),l=0;t&&l<c.length;){for(var u=c[l].replace(/\s+$/,""),d=l+1;d<c.length;++d){var f=c[d];if(!/\s/.test(f[0]))break;u+=f,l=d}if(t=u.match(a)){for(var p={name:t[1],values:[]},h=t[2].split(","),m=0;m<h.length;++m)p.values.push(n(h[m]));if(s.procType)if(s.contentDomain||"Content-Domain"!==p.name)if(s.dekInfo||"DEK-Info"!==p.name)s.headers.push(p);else{if(0===p.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');s.dekInfo={algorithm:h[0],parameters:h[1]||null}}else s.contentDomain=h[0]||"";else{if("Proc-Type"!==p.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==p.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');s.procType={version:h[0],type:h[1]}}}++l}if("ENCRYPTED"===s.procType&&!s.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}})),V.des=V.des||{},V.des.startEncrypting=function(e,t,r,n){var o=he({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return o.start(t),o},V.des.createEncryptionCipher=function(e,t){return he({key:e,output:null,decrypt:!1,mode:t})},V.des.startDecrypting=function(e,t,r,n){var o=he({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return o.start(t),o},V.des.createDecryptionCipher=function(e,t){return he({key:e,output:null,decrypt:!0,mode:t})},V.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return pe(r._keys,e,t,!1)},decrypt:function(e,t){return pe(r._keys,e,t,!0)}}}),r._init=!1},V.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=V.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],o=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],a=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],i=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],d=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],h=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],m=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,v=[],y=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C<g;C++){var w=e.getInt32(),k=e.getInt32();w^=(t=252645135&(w>>>4^k))<<4,w^=t=65535&((k^=t)>>>-16^w),w^=(t=858993459&(w>>>2^(k^=t<<-16)))<<2,w^=t=65535&((k^=t)>>>-16^w),w^=(t=1431655765&(w>>>1^(k^=t<<-16)))<<1,w^=t=16711935&((k^=t)>>>8^w),t=(w^=(t=1431655765&(w>>>1^(k^=t<<8)))<<1)<<8|(k^=t)>>>20&240,w=k<<24|k<<8&16711680|k>>>8&65280|k>>>24&240,k=t;for(var B=0;B<y.length;++B){y[B]?(w=w<<2|w>>>26,k=k<<2|k>>>26):(w=w<<1|w>>>27,k=k<<1|k>>>27);var E=r[(w&=-15)>>>28]|n[w>>>24&15]|o[w>>>20&15]|a[w>>>16&15]|i[w>>>12&15]|s[w>>>8&15]|c[w>>>4&15],S=l[(k&=-15)>>>28]|u[k>>>24&15]|d[k>>>20&15]|f[k>>>16&15]|p[k>>>12&15]|h[k>>>8&15]|m[k>>>4&15];t=65535&(S>>>16^E),v[b++]=E^t,v[b++]=S^t<<16}}return v}(t),this._init=!0}},ne("DES-ECB",V.cipher.modes.ecb),ne("DES-CBC",V.cipher.modes.cbc),ne("DES-CFB",V.cipher.modes.cfb),ne("DES-OFB",V.cipher.modes.ofb),ne("DES-CTR",V.cipher.modes.ctr),ne("3DES-ECB",V.cipher.modes.ecb),ne("3DES-CBC",V.cipher.modes.cbc),ne("3DES-CFB",V.cipher.modes.cfb),ne("3DES-OFB",V.cipher.modes.ofb),ne("3DES-CTR",V.cipher.modes.ctr);var oe=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],ie=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],se=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],ce=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],le=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],ue=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],de=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],fe=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function pe(e,t,r,n){var o,a,i=32===e.length?3:9;o=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var s=t[0],c=t[1];s^=(a=252645135&(s>>>4^c))<<4,s^=(a=65535&(s>>>16^(c^=a)))<<16,s^=a=858993459&((c^=a)>>>2^s),s^=a=16711935&((c^=a<<2)>>>8^s),s=(s^=(a=1431655765&(s>>>1^(c^=a<<8)))<<1)<<1|s>>>31,c=(c^=a)<<1|c>>>31;for(var l=0;l<i;l+=3){for(var u=o[l+1],d=o[l+2],f=o[l];f!=u;f+=d){var p=c^e[f],h=(c>>>4|c<<28)^e[f+1];a=s,s=c,c=a^(ie[p>>>24&63]|ce[p>>>16&63]|ue[p>>>8&63]|fe[63&p]|oe[h>>>24&63]|se[h>>>16&63]|le[h>>>8&63]|de[63&h])}a=s,s=c,c=a}c=c>>>1|c<<31,c^=a=1431655765&((s=s>>>1|s<<31)>>>1^c),c^=(a=16711935&(c>>>8^(s^=a<<1)))<<8,c^=(a=858993459&(c>>>2^(s^=a)))<<2,c^=a=65535&((s^=a)>>>16^c),c^=a=252645135&((s^=a<<16)>>>4^c),s^=a<<4,r[0]=s,r[1]=c}function he(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?V.cipher.createDecipher(r,e.key):V.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof V.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,n.call(t,r)},t}var me,ge=V.pkcs5=V.pkcs5||{};V.util.isNodejs&&!V.options.usePureJavaScript&&(me=t),V.pbkdf2=ge.pbkdf2=function(e,t,r,n,o,a){if("function"==typeof o&&(a=o,o=null),V.util.isNodejs&&!V.options.usePureJavaScript&&me.pbkdf2&&(null===o||"object"!=w(o))&&(me.pbkdf2Sync.length>4||!o||"sha1"===o))return"string"!=typeof o&&(o="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),a?4===me.pbkdf2Sync.length?me.pbkdf2(e,t,r,n,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):me.pbkdf2(e,t,r,n,o,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):4===me.pbkdf2Sync.length?me.pbkdf2Sync(e,t,r,n).toString("binary"):me.pbkdf2Sync(e,t,r,n,o).toString("binary");if(null==o&&(o="sha1"),"string"==typeof o){if(!(o in V.md.algorithms))throw new Error("Unknown hash algorithm: "+o);o=V.md[o].create()}var i=o.digestLength;if(n>4294967295*i){var s=new Error("Derived key is too long.");if(a)return a(s);throw s}var c=Math.ceil(n/i),l=n-(c-1)*i,u=V.hmac.create();u.start(o,e);var d,f,p,h="";if(!a){for(var m=1;m<=c;++m){u.start(null,null),u.update(t),u.update(V.util.int32ToBytes(m)),d=p=u.digest().getBytes();for(var g=2;g<=r;++g)u.start(null,null),u.update(p),f=u.digest().getBytes(),d=V.util.xorBytes(d,f,i),p=f;h+=m<c?d:d.substr(0,l)}return h}function v(){if(m>c)return a(null,h);u.start(null,null),u.update(t),u.update(V.util.int32ToBytes(m)),d=p=u.digest().getBytes(),g=2,y()}function y(){if(g<=r)return u.start(null,null),u.update(p),f=u.digest().getBytes(),d=V.util.xorBytes(d,f,i),p=f,++g,V.util.setImmediate(y);h+=m<c?d:d.substr(0,l),++m,v()}m=1,v()},C((function(e){var t=e.exports=V.sha256=V.sha256||{};V.md.sha256=V.md.algorithms.sha256=t,t.create=function(){n||(r=String.fromCharCode(128),r+=V.util.fillString(String.fromCharCode(0),64),o=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=!0);var e=null,t=V.util.createBuffer(),i=new Array(64),s={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){s.messageLength=0,s.fullMessageLength=s.messageLength64=[];for(var r=s.messageLengthSize/4,n=0;n<r;++n)s.fullMessageLength.push(0);return t=V.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},s}};return s.start(),s.update=function(r,n){"utf8"===n&&(r=V.util.encodeUtf8(r));var o=r.length;s.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var c=s.fullMessageLength.length-1;c>=0;--c)s.fullMessageLength[c]+=o[1],o[1]=o[0]+(s.fullMessageLength[c]/4294967296>>>0),s.fullMessageLength[c]=s.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(r),a(e,i,t),(t.read>2048||0===t.length())&&t.compact(),s},s.digest=function(){var n=V.util.createBuffer();n.putBytes(t.bytes());var o,c=s.fullMessageLength[s.fullMessageLength.length-1]+s.messageLengthSize&s.blockLength-1;n.putBytes(r.substr(0,s.blockLength-c));for(var l=8*s.fullMessageLength[0],u=0;u<s.fullMessageLength.length-1;++u)l+=(o=8*s.fullMessageLength[u+1])/4294967296>>>0,n.putInt32(l>>>0),l=o>>>0;n.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};a(d,i,n);var f=V.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f.putInt32(d.h5),f.putInt32(d.h6),f.putInt32(d.h7),f},s};var r=null,n=!1,o=null;function a(e,t,r){for(var n,a,i,s,c,l,u,d,f,p,h,m,g,v=r.length();v>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,a=((a=t[c-15])>>>7|a<<25)^(a>>>18|a<<14)^a>>>3,t[c]=n+t[c-7]+a+t[c-16]|0;for(l=e.h0,u=e.h1,d=e.h2,f=e.h3,p=e.h4,h=e.h5,m=e.h6,g=e.h7,c=0;c<64;++c)i=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),s=l&u|d&(l^u),n=g+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(m^p&(h^m))+o[c]+t[c],g=m,m=h,h=p,p=f+n>>>0,f=d,d=u,u=l,l=n+(a=i+s)>>>0;e.h0=e.h0+l|0,e.h1=e.h1+u|0,e.h2=e.h2+d|0,e.h3=e.h3+f|0,e.h4=e.h4+p|0,e.h5=e.h5+h|0,e.h6=e.h6+m|0,e.h7=e.h7+g|0,v-=64}}})),C((function(e){var r=null;!V.util.isNodejs||V.options.usePureJavaScript||process.versions["node-webkit"]||(r=t),(e.exports=V.prng=V.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=e.md,o=new Array(32),a=0;a<32;++a)o[a]=n.create();function i(){if(t.pools[0].messageLength>=32)return s();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),s()}function s(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var o=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(o),t.generated=0}function c(e){var t=null,r=V.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)});var o=V.util.createBuffer();if(t)for(;o.length()<e;){var a=Math.max(1,Math.min(e-o.length(),65536)/4),i=new Uint32Array(Math.floor(a));try{t(i);for(var s=0;s<i.length;++s)o.putInt32(i[s])}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e}}if(o.length()<e)for(var c,l,u,d=Math.floor(65536*Math.random());o.length()<e;)for(l=16807*(65535&d),l+=(32767&(c=16807*(d>>16)))<<16,d=4294967295&(l=(2147483647&(l+=c>>15))+(l>>31)),s=0;s<3;++s)u=d>>>(s<<3),u^=Math.floor(256*Math.random()),o.putByte(String.fromCharCode(255&u));return o.getBytes(e)}return t.pools=o,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,o=t.plugin.increment,a=t.plugin.formatKey,i=t.plugin.formatSeed,c=V.util.createBuffer();t.key=null,function l(u){if(u)return r(u);if(c.length()>=e)return r(null,c.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return V.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return s(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),s(),e()}))}(l)}));var d=n(t.key,t.seed);t.generated+=d.length,c.putBytes(d),t.key=a(n(t.key,o(t.seed))),t.seed=i(n(t.key,t.seed)),V.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,o=t.plugin.formatKey,a=t.plugin.formatSeed;t.key=null;for(var s=V.util.createBuffer();s.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&i();var c=r(t.key,t.seed);t.generated+=c.length,s.putBytes(c),t.key=o(r(t.key,n(t.seed))),t.seed=a(r(t.key,t.seed))}return s.getBytes(e)},r?(t.seedFile=function(e,t){r.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return r.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,c(e))}catch(e){t(e)}},t.seedFileSync=c),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",o=0;o<r;o+=8)n+=String.fromCharCode(e>>o&255);t.collect(n)},t.registerWorker=function(e){e===self?t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})}:e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))},t}})),C((function(e){V.random&&V.random.getBytes?e.exports=V.random:function(t){var r={},n=new Array(4),o=V.util.createBuffer();function a(){var e=V.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=V.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),V.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=V.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return V.aes._updateBlock(e,t,n,!1),o.putInt32(n[0]),o.putInt32(n[1]),o.putInt32(n[2]),o.putInt32(n[3]),o.getBytes()},r.increment=function(e){return++e[3],e},r.md=V.md.sha256;var i=a(),s=null,c=V.util.globalScope,l=c.crypto||c.msCrypto;if(l&&l.getRandomValues&&(s=function(e){return l.getRandomValues(e)}),!V.util.isNodejs&&!s){if(i.collectInt(+new Date,32),"undefined"!=typeof navigator){var u="";for(var d in navigator)try{"string"==typeof navigator[d]&&(u+=navigator[d])}catch(e){}i.collect(u),u=null}t&&(t().mousemove((function(e){i.collectInt(e.clientX,16),i.collectInt(e.clientY,16)})),t().keypress((function(e){i.collectInt(e.charCode,8)})))}if(V.random)for(var d in i)V.random[d]=i[d];else V.random=i;V.random.createInstance=a,e.exports=V.random}("undefined"!=typeof jQuery?jQuery:null)}));var ve=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],ye=[1,2,3,5],be=function(e,t){return e<<t&65535|(65535&e)>>16-t},Ce=function(e,t){return(65535&e)>>t|e<<16-t&65535};V.rc2=V.rc2||{},V.rc2.expandKey=function(e,t){"string"==typeof e&&(e=V.util.createBuffer(e)),t=t||128;var r,n=e,o=e.length(),a=t,i=Math.ceil(a/8),s=255>>(7&a);for(r=o;r<128;r++)n.putByte(ve[n.at(r-1)+n.at(r-o)&255]);for(n.setAt(128-i,ve[n.at(128-i)&s]),r=127-i;r>=0;r--)n.setAt(r,ve[n.at(r+1)^n.at(r+i)]);return n};var we,ke=function(e,t,r){var n,o,a,i,s=!1,c=null,l=null,u=null,d=[];for(e=V.rc2.expandKey(e,t),a=0;a<64;a++)d.push(e.getInt16Le());r?(n=function(e){for(a=0;a<4;a++)e[a]+=d[i]+(e[(a+3)%4]&e[(a+2)%4])+(~e[(a+3)%4]&e[(a+1)%4]),e[a]=be(e[a],ye[a]),i++},o=function(e){for(a=0;a<4;a++)e[a]+=d[63&e[(a+3)%4]]}):(n=function(e){for(a=3;a>=0;a--)e[a]=Ce(e[a],ye[a]),e[a]-=d[i]+(e[(a+3)%4]&e[(a+2)%4])+(~e[(a+3)%4]&e[(a+1)%4]),i--},o=function(e){for(a=3;a>=0;a--)e[a]-=d[63&e[(a+3)%4]]});var f=function(e){var t=[];for(a=0;a<4;a++){var n=c.getInt16Le();null!==u&&(r?n^=u.getInt16Le():u.putInt16Le(n)),t.push(65535&n)}i=r?0:63;for(var o=0;o<e.length;o++)for(var s=0;s<e[o][0];s++)e[o][1](t);for(a=0;a<4;a++)null!==u&&(r?u.putInt16Le(t[a]):t[a]^=u.getInt16Le()),l.putInt16Le(t[a])},p=null;return p={start:function(e,t){e&&"string"==typeof e&&(e=V.util.createBuffer(e)),s=!1,c=V.util.createBuffer(),l=t||new V.util.createBuffer,u=e,p.output=l},update:function(e){for(s||c.putBuffer(e);c.length()>=8;)f([[5,n],[1,o],[6,n],[1,o],[5,n]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,c,!r);else{var n=8===c.length()?8:8-c.length();c.fillWithByte(n,n)}if(t&&(s=!0,p.update()),!r&&(t=0===c.length()))if(e)t=e(8,l,!r);else{var o=l.length(),a=l.at(o-1);a>o?t=!1:l.truncate(a)}return t}}};function Be(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function Ee(){return new Be(null)}function Se(e,t,r,n,o,a){for(var i=16383&t,s=t>>14;--a>=0;){var c=16383&this.data[e],l=this.data[e++]>>14,u=s*c+l*i;o=((c=i*c+((16383&u)<<14)+r.data[n]+o)>>28)+(u>>14)+s*l,r.data[n++]=268435455&c}return o}V.rc2.startEncrypting=function(e,t,r){var n=V.rc2.createEncryptionCipher(e,128);return n.start(t,r),n},V.rc2.createEncryptionCipher=function(e,t){return ke(e,t,!0)},V.rc2.startDecrypting=function(e,t,r){var n=V.rc2.createDecryptionCipher(e,128);return n.start(t,r),n},V.rc2.createDecryptionCipher=function(e,t){return ke(e,t,!1)},V.jsbn=V.jsbn||{},V.jsbn.BigInteger=Be,"undefined"==typeof navigator?(Be.prototype.am=Se,we=28):"Microsoft Internet Explorer"==navigator.appName?(Be.prototype.am=function(e,t,r,n,o,a){for(var i=32767&t,s=t>>15;--a>=0;){var c=32767&this.data[e],l=this.data[e++]>>15,u=s*c+l*i;o=((c=i*c+((32767&u)<<15)+r.data[n]+(1073741823&o))>>>30)+(u>>>15)+s*l+(o>>>30),r.data[n++]=1073741823&c}return o},we=30):"Netscape"!=navigator.appName?(Be.prototype.am=function(e,t,r,n,o,a){for(;--a>=0;){var i=t*this.data[e++]+r.data[n]+o;o=Math.floor(i/67108864),r.data[n++]=67108863&i}return o},we=26):(Be.prototype.am=Se,we=28),Be.prototype.DB=we,Be.prototype.DM=(1<<we)-1,Be.prototype.DV=1<<we,Be.prototype.FV=Math.pow(2,52),Be.prototype.F1=52-we,Be.prototype.F2=2*we-52;var Ae,_e,Ie=new Array;for(Ae="0".charCodeAt(0),_e=0;_e<=9;++_e)Ie[Ae++]=_e;for(Ae="a".charCodeAt(0),_e=10;_e<36;++_e)Ie[Ae++]=_e;for(Ae="A".charCodeAt(0),_e=10;_e<36;++_e)Ie[Ae++]=_e;function Te(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function Pe(e,t){var r=Ie[e.charCodeAt(t)];return null==r?-1:r}function xe(e){var t=Ee();return t.fromInt(e),t}function Re(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function Ne(e){this.m=e}function Le(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function Oe(e,t){return e&t}function De(e,t){return e|t}function Me(e,t){return e^t}function Ue(e,t){return e&~t}function Fe(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function je(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function Ve(){}function ze(e){return e}function Ke(e){this.r2=Ee(),this.q3=Ee(),Be.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}Ne.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},Ne.prototype.revert=function(e){return e},Ne.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},Ne.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},Ne.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},Le.prototype.convert=function(e){var t=Ee();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(Be.ZERO)>0&&this.m.subTo(t,t),t},Le.prototype.revert=function(e){var t=Ee();return e.copyTo(t),this.reduce(t),t},Le.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},Le.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},Le.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},Be.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},Be.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},Be.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,o=!1,a=0;--n>=0;){var i=8==r?255&e[n]:Pe(e,n);i<0?"-"==e.charAt(n)&&(o=!0):(o=!1,0==a?this.data[this.t++]=i:a+r>this.DB?(this.data[this.t-1]|=(i&(1<<this.DB-a)-1)<<a,this.data[this.t++]=i>>this.DB-a):this.data[this.t-1]|=i<<a,(a+=r)>=this.DB&&(a-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,a>0&&(this.data[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),o&&Be.ZERO.subTo(this,this)},Be.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},Be.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},Be.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},Be.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,o=this.DB-n,a=(1<<o)-1,i=Math.floor(e/this.DB),s=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+i+1]=this.data[r]>>o|s,s=(this.data[r]&a)<<n;for(r=i-1;r>=0;--r)t.data[r]=0;t.data[i]=s,t.t=this.t+i+1,t.s=this.s,t.clamp()},Be.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,o=this.DB-n,a=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var i=r+1;i<this.t;++i)t.data[i-r-1]|=(this.data[i]&a)<<o,t.data[i-r]=this.data[i]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&a)<<o),t.t=this.t-r,t.clamp()}},Be.prototype.subTo=function(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},Be.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),o=r.t;for(t.t=o+n.t;--o>=0;)t.data[o]=0;for(o=0;o<n.t;++o)t.data[o+r.t]=r.am(0,n.data[o],t,o,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&Be.ZERO.subTo(t,t)},Be.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},Be.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=Ee());var a=Ee(),i=this.s,s=e.s,c=this.DB-Re(n.data[n.t-1]);c>0?(n.lShiftTo(c,a),o.lShiftTo(c,r)):(n.copyTo(a),o.copyTo(r));var l=a.t,u=a.data[l-1];if(0!=u){var d=u*(1<<this.F1)+(l>1?a.data[l-2]>>this.F2:0),f=this.FV/d,p=(1<<this.F1)/d,h=1<<this.F2,m=r.t,g=m-l,v=null==t?Ee():t;for(a.dlShiftTo(g,v),r.compareTo(v)>=0&&(r.data[r.t++]=1,r.subTo(v,r)),Be.ONE.dlShiftTo(l,v),v.subTo(a,a);a.t<l;)a.data[a.t++]=0;for(;--g>=0;){var y=r.data[--m]==u?this.DM:Math.floor(r.data[m]*f+(r.data[m-1]+h)*p);if((r.data[m]+=a.am(0,y,r,g,0,l))<y)for(a.dlShiftTo(g,v),r.subTo(v,r);r.data[m]<--y;)r.subTo(v,r)}null!=t&&(r.drShiftTo(l,t),i!=s&&Be.ZERO.subTo(t,t)),r.t=l,r.clamp(),c>0&&r.rShiftTo(c,r),i<0&&Be.ZERO.subTo(r,r)}}},Be.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},Be.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},Be.prototype.exp=function(e,t){if(e>4294967295||e<1)return Be.ONE;var r=Ee(),n=Ee(),o=t.convert(this),a=Re(e)-1;for(o.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,o,r);else{var i=r;r=n,n=i}return t.revert(r)},Be.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,o=!1,a="",i=this.t,s=this.DB-i*this.DB%t;if(i-- >0)for(s<this.DB&&(r=this.data[i]>>s)>0&&(o=!0,a=Te(r));i>=0;)s<t?(r=(this.data[i]&(1<<s)-1)<<t-s,r|=this.data[--i]>>(s+=this.DB-t)):(r=this.data[i]>>(s-=t)&n,s<=0&&(s+=this.DB,--i)),r>0&&(o=!0),o&&(a+=Te(r));return o?a:"0"},Be.prototype.negate=function(){var e=Ee();return Be.ZERO.subTo(this,e),e},Be.prototype.abs=function(){return this.s<0?this.negate():this},Be.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},Be.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+Re(this.data[this.t-1]^this.s&this.DM)},Be.prototype.mod=function(e){var t=Ee();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(Be.ZERO)>0&&e.subTo(t,t),t},Be.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new Ne(t):new Le(t),this.exp(e,r)},Be.ZERO=xe(0),Be.ONE=xe(1),Ve.prototype.convert=ze,Ve.prototype.revert=ze,Ve.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},Ve.prototype.sqrTo=function(e,t){e.squareTo(t)},Ke.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Ee();return e.copyTo(t),this.reduce(t),t},Ke.prototype.revert=function(e){return e},Ke.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},Ke.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},Ke.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var He=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],qe=(1<<26)/He[He.length-1];if(Be.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},Be.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=xe(r),o=Ee(),a=Ee(),i="";for(this.divRemTo(n,o,a);o.signum()>0;)i=(r+a.intValue()).toString(e).substr(1)+i,o.divRemTo(n,o,a);return a.intValue().toString(e)+i},Be.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),o=!1,a=0,i=0,s=0;s<e.length;++s){var c=Pe(e,s);c<0?"-"==e.charAt(s)&&0==this.signum()&&(o=!0):(i=t*i+c,++a>=r&&(this.dMultiply(n),this.dAddOffset(i,0),a=0,i=0))}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(i,0)),o&&Be.ZERO.subTo(this,this)},Be.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(Be.ONE.shiftLeft(e-1),De,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(Be.ONE.shiftLeft(e-1),this);else{var n=new Array,o=7&e;n.length=1+(e>>3),t.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}},Be.prototype.bitwiseTo=function(e,t,r){var n,o,a=Math.min(e.t,this.t);for(n=0;n<a;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(o=e.s&this.DM,n=a;n<this.t;++n)r.data[n]=t(this.data[n],o);r.t=this.t}else{for(o=this.s&this.DM,n=a;n<e.t;++n)r.data[n]=t(o,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},Be.prototype.changeBit=function(e,t){var r=Be.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},Be.prototype.addTo=function(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},Be.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},Be.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},Be.prototype.multiplyLowerTo=function(e,t,r){var n,o=Math.min(this.t+e.t,t);for(r.s=0,r.t=o;o>0;)r.data[--o]=0;for(n=r.t-this.t;o<n;++o)r.data[o+this.t]=this.am(0,e.data[o],r,o,0,this.t);for(n=Math.min(e.t,t);o<n;++o)this.am(0,e.data[o],r,o,0,t-o);r.clamp()},Be.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},Be.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},Be.prototype.millerRabin=function(e){var t=this.subtract(Be.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,o=t.shiftRight(r),a={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},i=0;i<e;++i){do{n=new Be(this.bitLength(),a)}while(n.compareTo(Be.ONE)<=0||n.compareTo(t)>=0);var s=n.modPow(o,this);if(0!=s.compareTo(Be.ONE)&&0!=s.compareTo(t)){for(var c=1;c++<r&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(Be.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0},Be.prototype.clone=function(){var e=Ee();return this.copyTo(e),e},Be.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},Be.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},Be.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},Be.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},Be.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,o=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[o++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==o&&(128&this.s)!=(128&r)&&++o,(o>0||r!=this.s)&&(t[o++]=r);return t},Be.prototype.equals=function(e){return 0==this.compareTo(e)},Be.prototype.min=function(e){return this.compareTo(e)<0?this:e},Be.prototype.max=function(e){return this.compareTo(e)>0?this:e},Be.prototype.and=function(e){var t=Ee();return this.bitwiseTo(e,Oe,t),t},Be.prototype.or=function(e){var t=Ee();return this.bitwiseTo(e,De,t),t},Be.prototype.xor=function(e){var t=Ee();return this.bitwiseTo(e,Me,t),t},Be.prototype.andNot=function(e){var t=Ee();return this.bitwiseTo(e,Ue,t),t},Be.prototype.not=function(){for(var e=Ee(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},Be.prototype.shiftLeft=function(e){var t=Ee();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},Be.prototype.shiftRight=function(e){var t=Ee();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},Be.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+Fe(this.data[e]);return this.s<0?this.t*this.DB:-1},Be.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=je(this.data[r]^t);return e},Be.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},Be.prototype.setBit=function(e){return this.changeBit(e,De)},Be.prototype.clearBit=function(e){return this.changeBit(e,Ue)},Be.prototype.flipBit=function(e){return this.changeBit(e,Me)},Be.prototype.add=function(e){var t=Ee();return this.addTo(e,t),t},Be.prototype.subtract=function(e){var t=Ee();return this.subTo(e,t),t},Be.prototype.multiply=function(e){var t=Ee();return this.multiplyTo(e,t),t},Be.prototype.divide=function(e){var t=Ee();return this.divRemTo(e,t,null),t},Be.prototype.remainder=function(e){var t=Ee();return this.divRemTo(e,null,t),t},Be.prototype.divideAndRemainder=function(e){var t=Ee(),r=Ee();return this.divRemTo(e,t,r),new Array(t,r)},Be.prototype.modPow=function(e,t){var r,n,o=e.bitLength(),a=xe(1);if(o<=0)return a;r=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new Ne(t):t.isEven()?new Ke(t):new Le(t);var i=new Array,s=3,c=r-1,l=(1<<r)-1;if(i[1]=n.convert(this),r>1){var u=Ee();for(n.sqrTo(i[1],u);s<=l;)i[s]=Ee(),n.mulTo(u,i[s-2],i[s]),s+=2}var d,f,p=e.t-1,h=!0,m=Ee();for(o=Re(e.data[p])-1;p>=0;){for(o>=c?d=e.data[p]>>o-c&l:(d=(e.data[p]&(1<<o+1)-1)<<c-o,p>0&&(d|=e.data[p-1]>>this.DB+o-c)),s=r;0==(1&d);)d>>=1,--s;if((o-=s)<0&&(o+=this.DB,--p),h)i[d].copyTo(a),h=!1;else{for(;s>1;)n.sqrTo(a,m),n.sqrTo(m,a),s-=2;s>0?n.sqrTo(a,m):(f=a,a=m,m=f),n.mulTo(m,i[d],a)}for(;p>=0&&0==(e.data[p]&1<<o);)n.sqrTo(a,m),f=a,a=m,m=f,--o<0&&(o=this.DB-1,--p)}return n.revert(a)},Be.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return Be.ZERO;for(var r=e.clone(),n=this.clone(),o=xe(1),a=xe(0),i=xe(0),s=xe(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(o.isEven()&&a.isEven()||(o.addTo(this,o),a.subTo(e,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;n.isEven();)n.rShiftTo(1,n),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);r.compareTo(n)>=0?(r.subTo(n,r),t&&o.subTo(i,o),a.subTo(s,a)):(n.subTo(r,n),t&&i.subTo(o,i),s.subTo(a,s))}return 0!=n.compareTo(Be.ONE)?Be.ZERO:s.compareTo(e)>=0?s.subtract(e):s.signum()<0?(s.addTo(e,s),s.signum()<0?s.add(e):s):s},Be.prototype.pow=function(e){return this.exp(e,new Ve)},Be.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var o=t.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return t;for(o<a&&(a=o),a>0&&(t.rShiftTo(a,t),r.rShiftTo(a,r));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r},Be.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=He[He.length-1]){for(t=0;t<He.length;++t)if(r.data[0]==He[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<He.length;){for(var n=He[t],o=t+1;o<He.length&&n<qe;)n*=He[o++];for(n=r.modInt(n);t<o;)if(n%He[t++]==0)return!1}return r.millerRabin(e)},C((function(e){var t=e.exports=V.sha1=V.sha1||{};V.md.sha1=V.md.algorithms.sha1=t,t.create=function(){n||(r=String.fromCharCode(128),r+=V.util.fillString(String.fromCharCode(0),64),n=!0);var e=null,t=V.util.createBuffer(),a=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,n=0;n<r;++n)i.fullMessageLength.push(0);return t=V.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(r,n){"utf8"===n&&(r=V.util.encodeUtf8(r));var s=r.length;i.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=s[1],s[1]=s[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(r),o(e,a,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var n=V.util.createBuffer();n.putBytes(t.bytes());var s,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;n.putBytes(r.substr(0,i.blockLength-c));for(var l=8*i.fullMessageLength[0],u=0;u<i.fullMessageLength.length-1;++u)l+=(s=8*i.fullMessageLength[u+1])/4294967296>>>0,n.putInt32(l>>>0),l=s>>>0;n.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(d,a,n);var f=V.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f},i};var r=null,n=!1;function o(e,t,r){for(var n,o,a,i,s,c,l,u=r.length();u>=64;){for(o=e.h0,a=e.h1,i=e.h2,s=e.h3,c=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,n=(o<<5|o>>>27)+(s^a&(i^s))+c+1518500249+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;for(;l<20;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(o<<5|o>>>27)+(s^a&(i^s))+c+1518500249+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;for(;l<32;++l)n=(n=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|n>>>31,t[l]=n,n=(o<<5|o>>>27)+(a^i^s)+c+1859775393+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;for(;l<40;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(o<<5|o>>>27)+(a^i^s)+c+1859775393+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;for(;l<60;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(o<<5|o>>>27)+(a&i|s&(a^i))+c+2400959708+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;for(;l<80;++l)n=(n=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|n>>>30,t[l]=n,n=(o<<5|o>>>27)+(a^i^s)+c+3395469782+n,c=s,s=i,i=(a<<30|a>>>2)>>>0,a=o,o=n;e.h0=e.h0+o|0,e.h1=e.h1+a|0,e.h2=e.h2+i|0,e.h3=e.h3+s|0,e.h4=e.h4+c|0,u-=64}}})),C((function(e){var t=e.exports=V.pkcs1=V.pkcs1||{};function r(e,t,r){r||(r=V.md.sha1.create());for(var n="",o=Math.ceil(t/r.digestLength),a=0;a<o;++a){var i=String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,255&a);r.start(),r.update(e+i),n+=r.digest().getBytes()}return n.substring(0,t)}t.encode_rsa_oaep=function(e,t,n){var o,a,i,s;"string"==typeof n?(o=n,a=arguments[3]||void 0,i=arguments[4]||void 0):n&&(o=n.label||void 0,a=n.seed||void 0,i=n.md||void 0,n.mgf1&&n.mgf1.md&&(s=n.mgf1.md)),i?i.start():i=V.md.sha1.create(),s||(s=i);var c=Math.ceil(e.n.bitLength()/8),l=c-2*i.digestLength-2;if(t.length>l)throw(h=new Error("RSAES-OAEP input message length is too long.")).length=t.length,h.maxLength=l,h;o||(o=""),i.update(o,"raw");for(var u=i.digest(),d="",f=l-t.length,p=0;p<f;p++)d+="\0";var h,m=u.getBytes()+d+""+t;if(a){if(a.length!==i.digestLength)throw(h=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=a.length,h.digestLength=i.digestLength,h}else a=V.random.getBytes(i.digestLength);var g=r(a,c-i.digestLength-1,s),v=V.util.xorBytes(m,g,m.length),y=r(v,i.digestLength,s);return"\0"+V.util.xorBytes(a,y,a.length)+v},t.decode_rsa_oaep=function(e,t,n){var o,a,i;"string"==typeof n?(o=n,a=arguments[3]||void 0):n&&(o=n.label||void 0,a=n.md||void 0,n.mgf1&&n.mgf1.md&&(i=n.mgf1.md));var s=Math.ceil(e.n.bitLength()/8);if(t.length!==s)throw(g=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,g.expectedLength=s,g;if(void 0===a?a=V.md.sha1.create():a.start(),i||(i=a),s<2*a.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");o||(o=""),a.update(o,"raw");for(var c=a.digest().getBytes(),l=t.charAt(0),u=t.substring(1,a.digestLength+1),d=t.substring(1+a.digestLength),f=r(d,a.digestLength,i),p=r(V.util.xorBytes(u,f,u.length),s-a.digestLength-1,i),h=V.util.xorBytes(d,p,d.length),m=h.substring(0,a.digestLength),g="\0"!==l,v=0;v<a.digestLength;++v)g|=c.charAt(v)!==m.charAt(v);for(var y=1,b=a.digestLength,C=a.digestLength;C<h.length;C++){var w=h.charCodeAt(C);g|=w&(y?65534:0),b+=y&=1&w^1}if(g||1!==h.charCodeAt(b))throw new Error("Invalid RSAES-OAEP padding.");return h.substring(b+1)}})),C((function(e){!function(){if(V.prime)e.exports=V.prime;else{var t=e.exports=V.prime=V.prime||{},r=V.jsbn.BigInteger,n=[6,4,2,4,2,4,6,2],o=new r(null);o.fromInt(30);var a=function(e,t){return e|t};t.generateProbablePrime=function(e,t,n){"function"==typeof t&&(n=t,t={});var o=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof o&&(o={name:o}),o.options=o.options||{};var a=t.prng||V.random,c={nextBytes:function(e){for(var t=a.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===o.name)return function(e,t,n,o){return"workers"in n?function(e,t,n,o){if("undefined"==typeof Worker)return i(e,t,n,o);var a=s(e,t),c=n.workers,l=n.workLoad||100,u=30*l/8,d=n.workerScript||"forge/prime.worker.js";if(-1===c)return V.util.estimateCores((function(e,t){e&&(t=2),c=t-1,f()}));function f(){c=Math.max(1,c);for(var n=[],i=0;i<c;++i)n[i]=new Worker(d);for(i=0;i<c;++i)n[i].addEventListener("message",p);var f=!1;function p(i){if(!f){var c=i.data;if(c.found){for(var d=0;d<n.length;++d)n[d].terminate();return f=!0,o(null,new r(c.prime,16))}a.bitLength()>e&&(a=s(e,t));var p=a.toString(16);i.target.postMessage({hex:p,workLoad:l}),a.dAddOffset(u,0)}}}f()}(e,t,n,o):i(e,t,n,o)}(e,c,o.options,n);throw new Error("Invalid prime generation algorithm: "+o.name)}}function i(e,t,r,o){var a=s(e,t),i=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(a.bitLength());"millerRabinTests"in r&&(i=r.millerRabinTests);var c=10;"maxBlockTime"in r&&(c=r.maxBlockTime),function e(t,r,o,a,i,c,l){var u=+new Date;do{if(t.bitLength()>r&&(t=s(r,o)),t.isProbablePrime(i))return l(null,t);t.dAddOffset(n[a++%8],0)}while(c<0||+new Date-u<c);V.util.setImmediate((function(){e(t,r,o,a,i,c,l)}))}(a,e,t,0,i,c,o)}function s(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),a,n),n.dAddOffset(31-n.mod(o).byteValue(),0),n}}()})),void 0===Qe)var Qe=V.jsbn.BigInteger;var We=V.util.isNodejs?t:null,Ge=V.asn1,Xe=V.util;V.pki=V.pki||{},V.pki.rsa=V.rsa=V.rsa||{};var Ye=V.pki,$e=[6,4,2,4,2,4,6,2],Ze={name:"PrivateKeyInfo",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Je={name:"RSAPrivateKey",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},et={name:"RSAPublicKey",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},tt=V.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:Ge.Class.UNIVERSAL,type:Ge.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},rt=function(e){var t;if(!(e.algorithm in Ye.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=Ye.oids[e.algorithm];var n=Ge.oidToDer(t).getBytes(),o=Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[]),a=Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[]);a.value.push(Ge.create(Ge.Class.UNIVERSAL,Ge.Type.OID,!1,n)),a.value.push(Ge.create(Ge.Class.UNIVERSAL,Ge.Type.NULL,!1,""));var i=Ge.create(Ge.Class.UNIVERSAL,Ge.Type.OCTETSTRING,!1,e.digest().getBytes());return o.value.push(a),o.value.push(i),Ge.toDer(o).getBytes()},nt=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var n;t.dP||(t.dP=t.d.mod(t.p.subtract(Qe.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(Qe.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{n=new Qe(V.util.bytesToHex(V.random.getBytes(t.n.bitLength()/8)),16)}while(n.compareTo(t.n)>=0||!n.gcd(t.n).equals(Qe.ONE));for(var o=(e=e.multiply(n.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);o.compareTo(a)<0;)o=o.add(t.p);return o.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a).multiply(n.modInverse(t.n)).mod(t.n)};function ot(e,t,r){var n=V.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var a=new Error("Message is too long for PKCS#1 v1.5 padding.");throw a.length=e.length,a.max=o-11,a}n.putByte(0),n.putByte(r);var i,s=o-3-e.length;if(0===r||1===r){i=0===r?0:255;for(var c=0;c<s;++c)n.putByte(i)}else for(;s>0;){var l=0,u=V.random.getBytes(s);for(c=0;c<s;++c)0===(i=u.charCodeAt(c))?++l:n.putByte(i);s=l}return n.putByte(0),n.putBytes(e),n}function at(e,t,r,n){var o=Math.ceil(t.n.bitLength()/8),a=V.util.createBuffer(e),i=a.getByte(),s=a.getByte();if(0!==i||r&&0!==s&&1!==s||!r&&2!=s||r&&0===s&&void 0===n)throw new Error("Encryption block is invalid.");var c=0;if(0===s){c=o-3-n;for(var l=0;l<c;++l)if(0!==a.getByte())throw new Error("Encryption block is invalid.")}else if(1===s)for(c=0;a.length()>1;){if(255!==a.getByte()){--a.read;break}++c}else if(2===s)for(c=0;a.length()>1;){if(0===a.getByte()){--a.read;break}++c}if(0!==a.getByte()||c!==o-3-a.length())throw new Error("Encryption block is invalid.");return a.getBytes()}function it(e,t,r){"function"==typeof t&&(r=t,t={});var n={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function o(){a(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?i(t,e.q):void a(e.qBits,i))}))}function a(e,t){V.prime.generateProbablePrime(e,n,t)}function i(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(Qe.ONE).gcd(e.e).compareTo(Qe.ONE))return e.p=null,void o();if(0!==e.q.subtract(Qe.ONE).gcd(e.e).compareTo(Qe.ONE))return e.q=null,void a(e.qBits,i);if(e.p1=e.p.subtract(Qe.ONE),e.q1=e.q.subtract(Qe.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(Qe.ONE))return e.p=e.q=null,void o();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,i);var c=e.e.modInverse(e.phi);e.keys={privateKey:Ye.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:Ye.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(n.prng=t.prng),o()}function st(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=V.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function ct(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function lt(e){return V.util.isNodejs&&"function"==typeof We[e]}function ut(e){return void 0!==Xe.globalScope&&"object"==w(Xe.globalScope.crypto)&&"object"==w(Xe.globalScope.crypto.subtle)&&"function"==typeof Xe.globalScope.crypto.subtle[e]}function dt(e){return void 0!==Xe.globalScope&&"object"==w(Xe.globalScope.msCrypto)&&"object"==w(Xe.globalScope.msCrypto.subtle)&&"function"==typeof Xe.globalScope.msCrypto.subtle[e]}function ft(e){for(var t=V.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}if(Ye.rsa.encrypt=function(e,t,r){var n,o=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(o=2===r,n=ot(e,t,r)):(n=V.util.createBuffer()).putBytes(e);for(var i=new Qe(n.toHex(),16),s=nt(i,t,o).toString(16),c=V.util.createBuffer(),l=a-Math.ceil(s.length/2);l>0;)c.putByte(0),--l;return c.putBytes(V.util.hexToBytes(s)),c.getBytes()},Ye.rsa.decrypt=function(e,t,r,n){var o=Math.ceil(t.n.bitLength()/8);if(e.length!==o){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=o,a}var i=new Qe(V.util.createBuffer(e).toHex(),16);if(i.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var s=nt(i,t,r).toString(16),c=V.util.createBuffer(),l=o-Math.ceil(s.length/2);l>0;)c.putByte(0),--l;return c.putBytes(V.util.hexToBytes(s)),!1!==n?at(c.getBytes(),t,r):c.getBytes()},Ye.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var n,o=(r=r||{}).prng||V.random,a={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},i=r.algorithm||"PRIMEINC";if("PRIMEINC"!==i)throw new Error("Invalid key generation algorithm: "+i);return(n={algorithm:i,state:0,bits:e,rng:a,eInt:t||65537,e:new Qe(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(n.eInt),n},Ye.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new Qe(null);r.fromInt(30);for(var n,o=0,a=function(e,t){return e|t},i=+new Date,s=0;null===e.keys&&(t<=0||s<t);){if(0===e.state){var c=null===e.p?e.pBits:e.qBits,l=c-1;0===e.pqState?(e.num=new Qe(c,e.rng),e.num.testBit(l)||e.num.bitwiseTo(Qe.ONE.shiftLeft(l),a,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),o=0,++e.pqState):1===e.pqState?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(ct(e.num.bitLength()))?++e.pqState:e.num.dAddOffset($e[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(Qe.ONE).gcd(e.e).compareTo(Qe.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(Qe.ONE),e.q1=e.q.subtract(Qe.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(Qe.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var u=e.e.modInverse(e.phi);e.keys={privateKey:Ye.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:Ye.rsa.setPublicKey(e.n,e.e)}}s+=(n=+new Date)-i,i=n}return null!==e.keys},Ye.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==w(e)?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(lt("generateKeyPair"))return We.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return n(e);n(null,{privateKey:Ye.privateKeyFromPem(r),publicKey:Ye.publicKeyFromPem(t)})}));if(ut("generateKey")&&ut("exportKey"))return Xe.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ft(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return Xe.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){n(e)})).then((function(e){if(e){var t=Ye.privateKeyFromAsn1(Ge.fromDer(V.util.createBuffer(e)));n(null,{privateKey:t,publicKey:Ye.setRsaPublicKey(t.n,t.e)})}}));if(dt("generateKey")&&dt("exportKey")){var o=Xe.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ft(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return o.oncomplete=function(e){var t=e.target.result,r=Xe.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=Ye.privateKeyFromAsn1(Ge.fromDer(V.util.createBuffer(t)));n(null,{privateKey:r,publicKey:Ye.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(o.onerror=function(e){n(e)})}}else if(lt("generateKeyPairSync")){var a=We.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:Ye.privateKeyFromPem(a.privateKey),publicKey:Ye.publicKeyFromPem(a.publicKey)}}var i=Ye.rsa.createKeyPairGenerationState(e,t,r);if(!n)return Ye.rsa.stepKeyPairGenerationState(i,0),i.keys;it(i,r,n)},Ye.setRsaPublicKey=Ye.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,n){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return ot(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return V.pkcs1.encode_rsa_oaep(t,e,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,r,!0);return Ye.rsa.encrypt(o,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=at(t,r,!0),e===Ge.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===at(t,r,!0)}});var o=Ye.rsa.decrypt(t,r,!0,!1);return n.verify(e,o,r.n.bitLength())}};return r},Ye.setRsaPrivateKey=Ye.rsa.setPrivateKey=function(e,t,r,n,o,a,i,s){var c={n:e,e:t,d:r,p:n,q:o,dP:a,dQ:i,qInv:s,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=Ye.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:at};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return V.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,c,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:rt},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,c.n.bitLength());return Ye.rsa.encrypt(n,c,r)}};return c},Ye.wrapRsaPrivateKey=function(e){return Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,Ge.integerToDer(0).getBytes()),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.OID,!1,Ge.oidToDer(Ye.oids.rsaEncryption).getBytes()),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.NULL,!1,"")]),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.OCTETSTRING,!1,Ge.toDer(e).getBytes())])},Ye.privateKeyFromAsn1=function(e){var t,r,n,o,a,i,s,c,l={},u=[];if(Ge.validate(e,Ze,l,u)&&(e=Ge.fromDer(V.util.createBuffer(l.privateKey))),l={},u=[],!Ge.validate(e,Je,l,u)){var d=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw d.errors=u,d}return t=V.util.createBuffer(l.privateKeyModulus).toHex(),r=V.util.createBuffer(l.privateKeyPublicExponent).toHex(),n=V.util.createBuffer(l.privateKeyPrivateExponent).toHex(),o=V.util.createBuffer(l.privateKeyPrime1).toHex(),a=V.util.createBuffer(l.privateKeyPrime2).toHex(),i=V.util.createBuffer(l.privateKeyExponent1).toHex(),s=V.util.createBuffer(l.privateKeyExponent2).toHex(),c=V.util.createBuffer(l.privateKeyCoefficient).toHex(),Ye.setRsaPrivateKey(new Qe(t,16),new Qe(r,16),new Qe(n,16),new Qe(o,16),new Qe(a,16),new Qe(i,16),new Qe(s,16),new Qe(c,16))},Ye.privateKeyToAsn1=Ye.privateKeyToRSAPrivateKey=function(e){return Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,Ge.integerToDer(0).getBytes()),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.n)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.e)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.d)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.p)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.q)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.dP)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.dQ)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.qInv))])},Ye.publicKeyFromAsn1=function(e){var t={},r=[];if(Ge.validate(e,tt,t,r)){var n,o=Ge.derToOid(t.publicKeyOid);if(o!==Ye.oids.rsaEncryption)throw(n=new Error("Cannot read public key. Unknown OID.")).oid=o,n;e=t.rsaPublicKey}if(r=[],!Ge.validate(e,et,t,r))throw(n=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,n;var a=V.util.createBuffer(t.publicKeyModulus).toHex(),i=V.util.createBuffer(t.publicKeyExponent).toHex();return Ye.setRsaPublicKey(new Qe(a,16),new Qe(i,16))},Ye.publicKeyToAsn1=Ye.publicKeyToSubjectPublicKeyInfo=function(e){return Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.OID,!1,Ge.oidToDer(Ye.oids.rsaEncryption).getBytes()),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.NULL,!1,"")]),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.BITSTRING,!1,[Ye.publicKeyToRSAPublicKey(e)])])},Ye.publicKeyToRSAPublicKey=function(e){return Ge.create(Ge.Class.UNIVERSAL,Ge.Type.SEQUENCE,!0,[Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.n)),Ge.create(Ge.Class.UNIVERSAL,Ge.Type.INTEGER,!1,st(e.e))])},void 0===pt)var pt=V.jsbn.BigInteger;var ht=V.asn1,mt=V.pki=V.pki||{},gt=(mt.pbe=V.pbe=V.pbe||{},mt.oids),vt={name:"EncryptedPrivateKeyInfo",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},yt={name:"PBES2Algorithms",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},bt={name:"pkcs-12PbeParams",tagClass:ht.Class.UNIVERSAL,type:ht.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:ht.Class.UNIVERSAL,type:ht.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:ht.Class.UNIVERSAL,type:ht.Type.INTEGER,constructed:!1,capture:"iterations"}]};function Ct(e,t){return e.start().update(t).digest().getBytes()}function wt(e){var t;if(e){if(!(t=mt.oids[ht.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return kt(t)}function kt(e){var t=V.md;switch(e){case"hmacWithSHA224":t=V.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}mt.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n,o,a,i=V.random.getBytesSync(r.saltSize),s=r.count,c=ht.integerToDer(s);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var l,u,d;switch(r.algorithm){case"aes128":n=16,l=16,u=gt["aes128-CBC"],d=V.aes.createEncryptionCipher;break;case"aes192":n=24,l=16,u=gt["aes192-CBC"],d=V.aes.createEncryptionCipher;break;case"aes256":n=32,l=16,u=gt["aes256-CBC"],d=V.aes.createEncryptionCipher;break;case"des":n=8,l=8,u=gt.desCBC,d=V.des.createEncryptionCipher;break;default:throw(v=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,v}var f="hmacWith"+r.prfAlgorithm.toUpperCase(),p=kt(f),h=V.pkcs5.pbkdf2(t,i,s,n,p),m=V.random.getBytesSync(l);(y=d(h)).start(m),y.update(ht.toDer(e)),y.finish(),a=y.output.getBytes();var g=function(e,t,r,n){var o=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,e),ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==n&&o.value.push(ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,V.util.hexToBytes(r.toString(16))),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(mt.oids[n]).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.NULL,!1,"")])),o}(i,c,n,f);o=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt.pkcs5PBES2).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt.pkcs5PBKDF2).getBytes()),g]),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(u).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,m)])])])}else{var v;if("3des"!==r.algorithm)throw(v=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,v;n=24;var y,b=new V.util.ByteBuffer(i);h=mt.pbe.generatePkcs12Key(t,b,1,s,n),m=mt.pbe.generatePkcs12Key(t,b,2,s,n),(y=V.des.createEncryptionCipher(h)).start(m),y.update(ht.toDer(e)),y.finish(),a=y.output.getBytes(),o=ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OID,!1,ht.oidToDer(gt["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,i),ht.create(ht.Class.UNIVERSAL,ht.Type.INTEGER,!1,c.getBytes())])])}return ht.create(ht.Class.UNIVERSAL,ht.Type.SEQUENCE,!0,[o,ht.create(ht.Class.UNIVERSAL,ht.Type.OCTETSTRING,!1,a)])},mt.decryptPrivateKeyInfo=function(e,t){var r=null,n={},o=[];if(!ht.validate(e,vt,n,o)){var a=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=o,a}var i=ht.derToOid(n.encryptionOid),s=mt.pbe.getCipher(i,n.encryptionParams,t),c=V.util.createBuffer(n.encryptedData);return s.update(c),s.finish()&&(r=ht.fromDer(s.output)),r},mt.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:ht.toDer(e).getBytes()};return V.pem.encode(r,{maxline:t})},mt.encryptedPrivateKeyFromPem=function(e){var t=V.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return ht.fromDer(t.body)},mt.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var n=mt.wrapRsaPrivateKey(mt.privateKeyToAsn1(e));return n=mt.encryptPrivateKeyInfo(n,t,r),mt.encryptedPrivateKeyToPem(n)}var o,a,i,s;switch(r.algorithm){case"aes128":o="AES-128-CBC",i=16,a=V.random.getBytesSync(16),s=V.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",i=24,a=V.random.getBytesSync(16),s=V.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",i=32,a=V.random.getBytesSync(16),s=V.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",i=24,a=V.random.getBytesSync(8),s=V.des.createEncryptionCipher;break;case"des":o="DES-CBC",i=8,a=V.random.getBytesSync(8),s=V.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw c.algorithm=r.algorithm,c}var l=s(V.pbe.opensslDeriveBytes(t,a.substr(0,8),i));l.start(a),l.update(ht.toDer(mt.privateKeyToAsn1(e))),l.finish();var u={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:V.util.bytesToHex(a).toUpperCase()},body:l.output.getBytes()};return V.pem.encode(u)},mt.decryptRsaPrivateKey=function(e,t){var r=null,n=V.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==n.type&&"PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type)throw(i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=i,i;if(n.procType&&"ENCRYPTED"===n.procType.type){var o,a;switch(n.dekInfo.algorithm){case"DES-CBC":o=8,a=V.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,a=V.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,a=V.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,a=V.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,a=V.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,a=function(e){return V.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":o=8,a=function(e){return V.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":o=16,a=function(e){return V.rc2.createDecryptionCipher(e,128)};break;default:var i;throw(i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".')).algorithm=n.dekInfo.algorithm,i}var s=V.util.hexToBytes(n.dekInfo.parameters),c=a(V.pbe.opensslDeriveBytes(t,s.substr(0,8),o));if(c.start(s),c.update(V.util.createBuffer(n.body)),!c.finish())return r;r=c.output.getBytes()}else r=n.body;return null!==(r="ENCRYPTED PRIVATE KEY"===n.type?mt.decryptPrivateKeyInfo(ht.fromDer(r),t):ht.fromDer(r))&&(r=mt.privateKeyFromAsn1(r)),r},mt.pbe.generatePkcs12Key=function(e,t,r,n,o,a){var i,s;if(null==a){if(!("sha1"in V.md))throw new Error('"sha1" hash algorithm unavailable.');a=V.md.sha1.create()}var c=a.digestLength,l=a.blockLength,u=new V.util.ByteBuffer,d=new V.util.ByteBuffer;if(null!=e){for(s=0;s<e.length;s++)d.putInt16(e.charCodeAt(s));d.putInt16(0)}var f=d.length(),p=t.length(),h=new V.util.ByteBuffer;h.fillWithByte(r,l);var m=l*Math.ceil(p/l),g=new V.util.ByteBuffer;for(s=0;s<m;s++)g.putByte(t.at(s%p));var v=l*Math.ceil(f/l),y=new V.util.ByteBuffer;for(s=0;s<v;s++)y.putByte(d.at(s%f));var b=g;b.putBuffer(y);for(var C=Math.ceil(o/c),w=1;w<=C;w++){var k=new V.util.ByteBuffer;k.putBytes(h.bytes()),k.putBytes(b.bytes());for(var B=0;B<n;B++)a.start(),a.update(k.getBytes()),k=a.digest();var E=new V.util.ByteBuffer;for(s=0;s<l;s++)E.putByte(k.at(s%c));var S=Math.ceil(p/l)+Math.ceil(f/l),A=new V.util.ByteBuffer;for(i=0;i<S;i++){var _=new V.util.ByteBuffer(b.getBytes(l)),I=511;for(s=E.length()-1;s>=0;s--)I>>=8,I+=E.at(s)+_.at(s),_.setAt(s,255&I);A.putBuffer(_)}b=A,u.putBuffer(k)}return u.truncate(u.length()-o),u},mt.pbe.getCipher=function(e,t,r){switch(e){case mt.oids.pkcs5PBES2:return mt.pbe.getCipherForPBES2(e,t,r);case mt.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case mt.oids["pbewithSHAAnd40BitRC2-CBC"]:return mt.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},mt.pbe.getCipherForPBES2=function(e,t,r){var n,o={},a=[];if(!ht.validate(t,yt,o,a))throw(n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,n;if((e=ht.derToOid(o.kdfOid))!==mt.oids.pkcs5PBKDF2)throw(n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,n.supportedOids=["pkcs5PBKDF2"],n;if((e=ht.derToOid(o.encOid))!==mt.oids["aes128-CBC"]&&e!==mt.oids["aes192-CBC"]&&e!==mt.oids["aes256-CBC"]&&e!==mt.oids["des-EDE3-CBC"]&&e!==mt.oids.desCBC)throw(n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n;var i,s,c=o.kdfSalt,l=V.util.createBuffer(o.kdfIterationCount);switch(l=l.getInt(l.length()<<3),mt.oids[e]){case"aes128-CBC":i=16,s=V.aes.createDecryptionCipher;break;case"aes192-CBC":i=24,s=V.aes.createDecryptionCipher;break;case"aes256-CBC":i=32,s=V.aes.createDecryptionCipher;break;case"des-EDE3-CBC":i=24,s=V.des.createDecryptionCipher;break;case"desCBC":i=8,s=V.des.createDecryptionCipher}var u=wt(o.prfOid),d=V.pkcs5.pbkdf2(r,c,l,i,u),f=o.encIv,p=s(d);return p.start(f),p},mt.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},o=[];if(!ht.validate(t,bt,n,o))throw(u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,u;var a,i,s,c=V.util.createBuffer(n.salt),l=V.util.createBuffer(n.iterations);switch(l=l.getInt(l.length()<<3),e){case mt.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:a=24,i=8,s=V.des.startDecrypting;break;case mt.oids["pbewithSHAAnd40BitRC2-CBC"]:a=5,i=8,s=function(e,t){var r=V.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var u;throw(u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,u}var d=wt(n.prfOid),f=mt.pbe.generatePkcs12Key(r,c,1,l,a,d);return d.start(),s(f,mt.pbe.generatePkcs12Key(r,c,2,l,i,d))},mt.pbe.opensslDeriveBytes=function(e,t,r,n){if(null==n){if(!("md5"in V.md))throw new Error('"md5" hash algorithm unavailable.');n=V.md.md5.create()}null===t&&(t="");for(var o=[Ct(n,e+t)],a=16,i=1;a<r;++i,a+=16)o.push(Ct(n,o[i-1]+e+t));return o.join("").substr(0,r)},C((function(e){var t=V.asn1,r=e.exports=V.pkcs7asn1=V.pkcs7asn1||{};V.pkcs7=V.pkcs7||{},V.pkcs7.asn1=r;var n={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};r.contentInfoValidator=n;var o={name:"EncryptedContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};r.envelopedDataValidator={name:"EnvelopedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(o)},r.encryptedDataValidator={name:"EncryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"}].concat(o)};var a={name:"SignerInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};r.signedDataValidator={name:"SignedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},n,{name:"SignedData.Certificates",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,capture:"signerInfos",optional:!0,value:[a]}]},r.recipientInfoValidator={name:"RecipientInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}})),C((function(e){V.mgf=V.mgf||{},(e.exports=V.mgf.mgf1=V.mgf1=V.mgf1||{}).create=function(e){return{generate:function(t,r){for(var n=new V.util.ByteBuffer,o=Math.ceil(r/e.digestLength),a=0;a<o;a++){var i=new V.util.ByteBuffer;i.putInt32(a),e.start(),e.update(t+i.getBytes()),n.putBuffer(e.digest())}return n.truncate(n.length()-r),n.getBytes()}}}})),V.mgf=V.mgf||{},V.mgf.mgf1=V.mgf1,C((function(e){(e.exports=V.pss=V.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,n=e.mgf,o=r.digestLength,a=e.salt||null;if("string"==typeof a&&(a=V.util.createBuffer(a)),"saltLength"in e)t=e.saltLength;else{if(null===a)throw new Error("Salt length not specified or specific salt not given.");t=a.length()}if(null!==a&&a.length()!==t)throw new Error("Given salt length does not match length of given salt.");var i=e.prng||V.random;return{encode:function(e,s){var c,l,u=s-1,d=Math.ceil(u/8),f=e.digest().getBytes();if(d<o+t+2)throw new Error("Message is too long to encrypt.");l=null===a?i.getBytesSync(t):a.bytes();var p=new V.util.ByteBuffer;p.fillWithByte(0,8),p.putBytes(f),p.putBytes(l),r.start(),r.update(p.getBytes());var h=r.digest().getBytes(),m=new V.util.ByteBuffer;m.fillWithByte(0,d-t-o-2),m.putByte(1),m.putBytes(l);var g=m.getBytes(),v=d-o-1,y=n.generate(h,v),b="";for(c=0;c<v;c++)b+=String.fromCharCode(g.charCodeAt(c)^y.charCodeAt(c));var C=65280>>8*d-u&255;return(b=String.fromCharCode(b.charCodeAt(0)&~C)+b.substr(1))+h+String.fromCharCode(188)},verify:function(e,a,i){var s,c=i-1,l=Math.ceil(c/8);if(a=a.substr(-l),l<o+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==a.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var u=l-o-1,d=a.substr(0,u),f=a.substr(u,o),p=65280>>8*l-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var h=n.generate(f,u),m="";for(s=0;s<u;s++)m+=String.fromCharCode(d.charCodeAt(s)^h.charCodeAt(s));m=String.fromCharCode(m.charCodeAt(0)&~p)+m.substr(1);var g=l-o-t-2;for(s=0;s<g;s++)if(0!==m.charCodeAt(s))throw new Error("Leftmost octets not zero as expected");if(1!==m.charCodeAt(g))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=m.substr(-t),y=new V.util.ByteBuffer;return y.fillWithByte(0,8),y.putBytes(e),y.putBytes(v),r.start(),r.update(y.getBytes()),f===r.digest().getBytes()}}}})),C((function(e){var t=V.asn1,r=e.exports=V.pki=V.pki||{},n=r.oids,o={};o.CN=n.commonName,o.commonName="CN",o.C=n.countryName,o.countryName="C",o.L=n.localityName,o.localityName="L",o.ST=n.stateOrProvinceName,o.stateOrProvinceName="ST",o.O=n.organizationName,o.organizationName="O",o.OU=n.organizationalUnitName,o.organizationalUnitName="OU",o.E=n.emailAddress,o.emailAddress="E";var a=V.pki.rsa.publicKeyValidator,i={name:"Certificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:t.Class.UNIVERSAL,type:t.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:t.Class.UNIVERSAL,type:t.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},a,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},s={name:"rsapss",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:t.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:t.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:t.Class.UNIVERSAL,type:t.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},c={name:"CertificationRequestInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},a,{name:"CertificationRequestInfo.attributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0}]}]}]},l={name:"CertificationRequest",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[c,{name:"CertificationRequest.signatureAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function u(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,o=0;null===n&&o<e.attributes.length;++o)r=e.attributes[o],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n}r.RDNAttributesAsArray=function(e,r){for(var a,i,s,c=[],l=0;l<e.value.length;++l){a=e.value[l];for(var u=0;u<a.value.length;++u)s={},i=a.value[u],s.type=t.derToOid(i.value[0].value),s.value=i.value[1].value,s.valueTagClass=i.value[1].type,s.type in n&&(s.name=n[s.type],s.name in o&&(s.shortName=o[s.name])),r&&(r.update(s.type),r.update(s.value)),c.push(s)}return c},r.CRIAttributesAsArray=function(e){for(var a=[],i=0;i<e.length;++i)for(var s=e[i],c=t.derToOid(s.value[0].value),l=s.value[1].value,u=0;u<l.length;++u){var d={};if(d.type=c,d.value=l[u].value,d.valueTagClass=l[u].type,d.type in n&&(d.name=n[d.type],d.name in o&&(d.shortName=o[d.name])),d.type===n.extensionRequest){d.extensions=[];for(var f=0;f<d.value.length;++f)d.extensions.push(r.certificateExtensionFromAsn1(d.value[f]))}a.push(d)}return a};var d=function(e,r,o){var a={};if(e!==n["RSASSA-PSS"])return a;o&&(a={hash:{algorithmOid:n.sha1},mgf:{algorithmOid:n.mgf1,hash:{algorithmOid:n.sha1}},saltLength:20});var i={},c=[];if(!t.validate(r,s,i,c)){var l=new Error("Cannot read RSASSA-PSS parameter block.");throw l.errors=c,l}return void 0!==i.hashOid&&(a.hash=a.hash||{},a.hash.algorithmOid=t.derToOid(i.hashOid)),void 0!==i.maskGenOid&&(a.mgf=a.mgf||{},a.mgf.algorithmOid=t.derToOid(i.maskGenOid),a.mgf.hash=a.mgf.hash||{},a.mgf.hash.algorithmOid=t.derToOid(i.maskGenHashOid)),void 0!==i.saltLength&&(a.saltLength=i.saltLength.charCodeAt(0)),a};function f(e){for(var r,n,o=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),a=e.attributes,i=0;i<a.length;++i){var s=(r=a[i]).value,c=t.Type.PRINTABLESTRING;"valueTagClass"in r&&(c=r.valueTagClass)===t.Type.UTF8&&(s=V.util.encodeUtf8(s)),n=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.type).getBytes()),t.create(t.Class.UNIVERSAL,c,!1,s)])]),o.value.push(n)}return o}function p(e){for(var a,i=0;i<e.length;++i){if(void 0===(a=e[i]).name&&(a.type&&a.type in r.oids?a.name=r.oids[a.type]:a.shortName&&a.shortName in o&&(a.name=r.oids[o[a.shortName]])),void 0===a.type){if(!a.name||!(a.name in r.oids))throw(c=new Error("Attribute type not specified.")).attribute=a,c;a.type=r.oids[a.name]}if(void 0===a.shortName&&a.name&&a.name in o&&(a.shortName=o[a.name]),a.type===n.extensionRequest&&(a.valueConstructed=!0,a.valueTagClass=t.Type.SEQUENCE,!a.value&&a.extensions)){a.value=[];for(var s=0;s<a.extensions.length;++s)a.value.push(r.certificateExtensionToAsn1(h(a.extensions[s])))}var c;if(void 0===a.value)throw(c=new Error("Attribute value not specified.")).attribute=a,c}}function h(e,o){if(o=o||{},void 0===e.name&&e.id&&e.id in r.oids&&(e.name=r.oids[e.id]),void 0===e.id){if(!e.name||!(e.name in r.oids))throw(C=new Error("Extension ID not specified.")).extension=e,C;e.id=r.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var a=0,i=0,s=0;e.digitalSignature&&(i|=128,a=7),e.nonRepudiation&&(i|=64,a=6),e.keyEncipherment&&(i|=32,a=5),e.dataEncipherment&&(i|=16,a=4),e.keyAgreement&&(i|=8,a=3),e.keyCertSign&&(i|=4,a=2),e.cRLSign&&(i|=2,a=1),e.encipherOnly&&(i|=1,a=0),e.decipherOnly&&(s|=128,a=7);var c=String.fromCharCode(a);0!==s?c+=String.fromCharCode(i)+String.fromCharCode(s):0!==i&&(c+=String.fromCharCode(i)),e.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c)}else if("basicConstraints"===e.name)e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);var l=e.value.value;for(var u in e)!0===e[u]&&(u in n?l.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(n[u]).getBytes())):-1!==u.indexOf(".")&&l.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(u).getBytes())))}else if("nsCertType"===e.name)a=0,i=0,e.client&&(i|=128,a=7),e.server&&(i|=64,a=6),e.email&&(i|=32,a=5),e.objsign&&(i|=16,a=4),e.reserved&&(i|=8,a=3),e.sslCA&&(i|=4,a=2),e.emailCA&&(i|=2,a=1),e.objCA&&(i|=1,a=0),c=String.fromCharCode(a),0!==i&&(c+=String.fromCharCode(i)),e.value=t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,c);else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);for(var d=0;d<e.altNames.length;++d){if(c=(v=e.altNames[d]).value,7===v.type&&v.ip){if(null===(c=V.util.bytesFromIP(v.ip)))throw(C=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,C}else 8===v.type&&(c=v.oid?t.oidToDer(t.oidToDer(v.oid)):t.oidToDer(c));e.value.value.push(t.create(t.Class.CONTEXT_SPECIFIC,v.type,!1,c))}}else if("nsComment"===e.name&&o.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=t.create(t.Class.UNIVERSAL,t.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&o.cert){var p=o.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=p.toHex(),e.value=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===e.name&&o.cert){if(e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),l=e.value.value,e.keyIdentifier){var h=!0===e.keyIdentifier?o.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!1,h))}if(e.authorityCertIssuer){var m=[t.create(t.Class.CONTEXT_SPECIFIC,4,!0,[f(!0===e.authorityCertIssuer?o.cert.issuer:e.authorityCertIssuer)])];l.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,m))}if(e.serialNumber){var g=V.util.hexToBytes(!0===e.serialNumber?o.cert.serialNumber:e.serialNumber);l.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!1,g))}}else if("cRLDistributionPoints"===e.name){e.value=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),l=e.value.value;var v,y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]),b=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d<e.altNames.length;++d){if(c=(v=e.altNames[d]).value,7===v.type&&v.ip){if(null===(c=V.util.bytesFromIP(v.ip)))throw(C=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,C}else 8===v.type&&(c=v.oid?t.oidToDer(t.oidToDer(v.oid)):t.oidToDer(c));b.value.push(t.create(t.Class.CONTEXT_SPECIFIC,v.type,!1,c))}y.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[b])),l.push(y)}var C;if(void 0===e.value)throw(C=new Error("Extension value not specified.")).extension=e,C;return e}function m(e,r){switch(e){case n["RSASSA-PSS"]:var o=[];return void 0!==r.hash.algorithmOid&&o.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])),void 0!==r.mgf.algorithmOid&&o.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.mgf.hash.algorithmOid).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])])])),void 0!==r.saltLength&&o.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.saltLength).getBytes())])),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,o);default:return t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")}}function g(e){var r=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return r;for(var n=e.attributes,o=0;o<n.length;++o){var a=n[o],i=a.value,s=t.Type.UTF8;"valueTagClass"in a&&(s=a.valueTagClass),s===t.Type.UTF8&&(i=V.util.encodeUtf8(i));var c=!1;"valueConstructed"in a&&(c=a.valueConstructed);var l=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,s,c,i)])]);r.value.push(l)}return r}r.certificateFromPem=function(e,n,o){var a=V.pem.decode(e)[0];if("CERTIFICATE"!==a.type&&"X509 CERTIFICATE"!==a.type&&"TRUSTED CERTIFICATE"!==a.type){var i=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw i.headerType=a.type,i}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=t.fromDer(a.body,o);return r.certificateFromAsn1(s,n)},r.certificateToPem=function(e,n){var o={type:"CERTIFICATE",body:t.toDer(r.certificateToAsn1(e)).getBytes()};return V.pem.encode(o,{maxline:n})},r.publicKeyFromPem=function(e){var n=V.pem.decode(e)[0];if("PUBLIC KEY"!==n.type&&"RSA PUBLIC KEY"!==n.type){var o=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var a=t.fromDer(n.body);return r.publicKeyFromAsn1(a)},r.publicKeyToPem=function(e,n){var o={type:"PUBLIC KEY",body:t.toDer(r.publicKeyToAsn1(e)).getBytes()};return V.pem.encode(o,{maxline:n})},r.publicKeyToRSAPublicKeyPem=function(e,n){var o={type:"RSA PUBLIC KEY",body:t.toDer(r.publicKeyToRSAPublicKey(e)).getBytes()};return V.pem.encode(o,{maxline:n})},r.getPublicKeyFingerprint=function(e,n){var o,a=(n=n||{}).md||V.md.sha1.create();switch(n.type||"RSAPublicKey"){case"RSAPublicKey":o=t.toDer(r.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":o=t.toDer(r.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+n.type+'".')}a.start(),a.update(o);var i=a.digest();if("hex"===n.encoding){var s=i.toHex();return n.delimiter?s.match(/.{2}/g).join(n.delimiter):s}if("binary"===n.encoding)return i.getBytes();if(n.encoding)throw new Error('Unknown encoding "'+n.encoding+'".');return i},r.certificationRequestFromPem=function(e,n,o){var a=V.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==a.type){var i=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw i.headerType=a.type,i}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=t.fromDer(a.body,o);return r.certificationRequestFromAsn1(s,n)},r.certificationRequestToPem=function(e,n){var o={type:"CERTIFICATE REQUEST",body:t.toDer(r.certificationRequestToAsn1(e)).getBytes()};return V.pem.encode(o,{maxline:n})},r.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return u(e.issuer,t)},e.issuer.addField=function(t){p([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return u(e.subject,t)},e.subject.addField=function(t){p([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){p(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){p(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)h(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,o=0;null===n&&o<e.extensions.length;++o)r=e.extensions[o],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(n=r);return n},e.sign=function(o,a){e.md=a||V.md.sha1.create();var i=n[e.md.algorithm+"WithRSAEncryption"];if(!i){var s=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw s.algorithm=e.md.algorithm,s}e.signatureOid=e.siginfo.algorithmOid=i,e.tbsCertificate=r.getTBSCertificate(e);var c=t.toDer(e.tbsCertificate);e.md.update(c.getBytes()),e.signature=o.sign(e.md)},e.verify=function(o){var a=!1;if(!e.issued(o)){var i=o.issuer,s=e.subject;throw(h=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.")).expectedIssuer=i.attributes,h.actualIssuer=s.attributes,h}var c=o.md;if(null===c){if(o.signatureOid in n)switch(n[o.signatureOid]){case"sha1WithRSAEncryption":c=V.md.sha1.create();break;case"md5WithRSAEncryption":c=V.md.md5.create();break;case"sha256WithRSAEncryption":c=V.md.sha256.create();break;case"sha384WithRSAEncryption":c=V.md.sha384.create();break;case"sha512WithRSAEncryption":c=V.md.sha512.create();break;case"RSASSA-PSS":c=V.md.sha256.create()}if(null===c)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=o.signatureOid,h;var l=o.tbsCertificate||r.getTBSCertificate(o),u=t.toDer(l);c.update(u.getBytes())}if(null!==c){var d;switch(o.signatureOid){case n.sha1WithRSAEncryption:d=void 0;break;case n["RSASSA-PSS"]:var f,p,h;if(void 0===(f=n[o.signatureParameters.mgf.hash.algorithmOid])||void 0===V.md[f])throw(h=new Error("Unsupported MGF hash function.")).oid=o.signatureParameters.mgf.hash.algorithmOid,h.name=f,h;if(void 0===(p=n[o.signatureParameters.mgf.algorithmOid])||void 0===V.mgf[p])throw(h=new Error("Unsupported MGF function.")).oid=o.signatureParameters.mgf.algorithmOid,h.name=p,h;if(p=V.mgf[p].create(V.md[f].create()),void 0===(f=n[o.signatureParameters.hash.algorithmOid])||void 0===V.md[f])throw{message:"Unsupported RSASSA-PSS hash function.",oid:o.signatureParameters.hash.algorithmOid,name:f};d=V.pss.create(V.md[f].create(),p,o.signatureParameters.saltLength)}a=e.publicKey.verify(c.digest().getBytes(),o.signature,d)}return a},e.isIssuer=function(t){var r=!1,n=e.issuer,o=t.subject;if(n.hash&&o.hash)r=n.hash===o.hash;else if(n.attributes.length===o.attributes.length){var a,i;r=!0;for(var s=0;r&&s<n.attributes.length;++s)a=n.attributes[s],i=o.attributes[s],a.type===i.type&&a.value===i.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=n.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var o=e.extensions[r];if(o.id===t){var a=e.generateSubjectKeyIdentifier().getBytes();return V.util.hexToBytes(o.subjectKeyIdentifier)===a}}return!1},e},r.certificateFromAsn1=function(e,o){var a={},s=[];if(!t.validate(e,i,a,s))throw(h=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.")).errors=s,h;if(t.derToOid(a.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=r.createCertificate();c.version=a.certVersion?a.certVersion.charCodeAt(0):0;var l=V.util.createBuffer(a.certSerialNumber);c.serialNumber=l.toHex(),c.signatureOid=V.asn1.derToOid(a.certSignatureOid),c.signatureParameters=d(c.signatureOid,a.certSignatureParams,!0),c.siginfo.algorithmOid=V.asn1.derToOid(a.certinfoSignatureOid),c.siginfo.parameters=d(c.siginfo.algorithmOid,a.certinfoSignatureParams,!1),c.signature=a.certSignature;var f=[];if(void 0!==a.certValidity1UTCTime&&f.push(t.utcTimeToDate(a.certValidity1UTCTime)),void 0!==a.certValidity2GeneralizedTime&&f.push(t.generalizedTimeToDate(a.certValidity2GeneralizedTime)),void 0!==a.certValidity3UTCTime&&f.push(t.utcTimeToDate(a.certValidity3UTCTime)),void 0!==a.certValidity4GeneralizedTime&&f.push(t.generalizedTimeToDate(a.certValidity4GeneralizedTime)),f.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=f[0],c.validity.notAfter=f[1],c.tbsCertificate=a.tbsCertificate,o){var h;if(c.md=null,c.signatureOid in n)switch(n[c.signatureOid]){case"sha1WithRSAEncryption":c.md=V.md.sha1.create();break;case"md5WithRSAEncryption":c.md=V.md.md5.create();break;case"sha256WithRSAEncryption":c.md=V.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=V.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=V.md.sha512.create();break;case"RSASSA-PSS":c.md=V.md.sha256.create()}if(null===c.md)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,h;var m=t.toDer(c.tbsCertificate);c.md.update(m.getBytes())}var g=V.md.sha1.create();c.issuer.getField=function(e){return u(c.issuer,e)},c.issuer.addField=function(e){p([e]),c.issuer.attributes.push(e)},c.issuer.attributes=r.RDNAttributesAsArray(a.certIssuer,g),a.certIssuerUniqueId&&(c.issuer.uniqueId=a.certIssuerUniqueId),c.issuer.hash=g.digest().toHex();var v=V.md.sha1.create();return c.subject.getField=function(e){return u(c.subject,e)},c.subject.addField=function(e){p([e]),c.subject.attributes.push(e)},c.subject.attributes=r.RDNAttributesAsArray(a.certSubject,v),a.certSubjectUniqueId&&(c.subject.uniqueId=a.certSubjectUniqueId),c.subject.hash=v.digest().toHex(),a.certExtensions?c.extensions=r.certificateExtensionsFromAsn1(a.certExtensions):c.extensions=[],c.publicKey=r.publicKeyFromAsn1(a.subjectPublicKeyInfo),c},r.certificateExtensionsFromAsn1=function(e){for(var t=[],n=0;n<e.value.length;++n)for(var o=e.value[n],a=0;a<o.value.length;++a)t.push(r.certificateExtensionFromAsn1(o.value[a]));return t},r.certificateExtensionFromAsn1=function(e){var r={};if(r.id=t.derToOid(e.value[0].value),r.critical=!1,e.value[1].type===t.Type.BOOLEAN?(r.critical=0!==e.value[1].value.charCodeAt(0),r.value=e.value[2].value):r.value=e.value[1].value,r.id in n)if(r.name=n[r.id],"keyUsage"===r.name){var o=0,a=0;(s=t.fromDer(r.value)).value.length>1&&(o=s.value.charCodeAt(1),a=s.value.length>2?s.value.charCodeAt(2):0),r.digitalSignature=128==(128&o),r.nonRepudiation=64==(64&o),r.keyEncipherment=32==(32&o),r.dataEncipherment=16==(16&o),r.keyAgreement=8==(8&o),r.keyCertSign=4==(4&o),r.cRLSign=2==(2&o),r.encipherOnly=1==(1&o),r.decipherOnly=128==(128&a)}else if("basicConstraints"===r.name){(s=t.fromDer(r.value)).value.length>0&&s.value[0].type===t.Type.BOOLEAN?r.cA=0!==s.value[0].value.charCodeAt(0):r.cA=!1;var i=null;s.value.length>0&&s.value[0].type===t.Type.INTEGER?i=s.value[0].value:s.value.length>1&&(i=s.value[1].value),null!==i&&(r.pathLenConstraint=t.derToInteger(i))}else if("extKeyUsage"===r.name)for(var s=t.fromDer(r.value),c=0;c<s.value.length;++c){var l=t.derToOid(s.value[c].value);l in n?r[n[l]]=!0:r[l]=!0}else if("nsCertType"===r.name)o=0,(s=t.fromDer(r.value)).value.length>1&&(o=s.value.charCodeAt(1)),r.client=128==(128&o),r.server=64==(64&o),r.email=32==(32&o),r.objsign=16==(16&o),r.reserved=8==(8&o),r.sslCA=4==(4&o),r.emailCA=2==(2&o),r.objCA=1==(1&o);else if("subjectAltName"===r.name||"issuerAltName"===r.name){var u;r.altNames=[],s=t.fromDer(r.value);for(var d=0;d<s.value.length;++d){var f={type:(u=s.value[d]).type,value:u.value};switch(r.altNames.push(f),u.type){case 1:case 2:case 6:break;case 7:f.ip=V.util.bytesToIP(u.value);break;case 8:f.oid=t.derToOid(u.value)}}}else"subjectKeyIdentifier"===r.name&&(s=t.fromDer(r.value),r.subjectKeyIdentifier=V.util.bytesToHex(s.value));return r},r.certificationRequestFromAsn1=function(e,o){var a={},i=[];if(!t.validate(e,l,a,i))throw(c=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.")).errors=i,c;if(t.derToOid(a.publicKeyOid)!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var s=r.createCertificationRequest();if(s.version=a.csrVersion?a.csrVersion.charCodeAt(0):0,s.signatureOid=V.asn1.derToOid(a.csrSignatureOid),s.signatureParameters=d(s.signatureOid,a.csrSignatureParams,!0),s.siginfo.algorithmOid=V.asn1.derToOid(a.csrSignatureOid),s.siginfo.parameters=d(s.siginfo.algorithmOid,a.csrSignatureParams,!1),s.signature=a.csrSignature,s.certificationRequestInfo=a.certificationRequestInfo,o){var c;if(s.md=null,s.signatureOid in n)switch(n[s.signatureOid]){case"sha1WithRSAEncryption":s.md=V.md.sha1.create();break;case"md5WithRSAEncryption":s.md=V.md.md5.create();break;case"sha256WithRSAEncryption":s.md=V.md.sha256.create();break;case"sha384WithRSAEncryption":s.md=V.md.sha384.create();break;case"sha512WithRSAEncryption":s.md=V.md.sha512.create();break;case"RSASSA-PSS":s.md=V.md.sha256.create()}if(null===s.md)throw(c=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=s.signatureOid,c;var f=t.toDer(s.certificationRequestInfo);s.md.update(f.getBytes())}var h=V.md.sha1.create();return s.subject.getField=function(e){return u(s.subject,e)},s.subject.addField=function(e){p([e]),s.subject.attributes.push(e)},s.subject.attributes=r.RDNAttributesAsArray(a.certificationRequestInfoSubject,h),s.subject.hash=h.digest().toHex(),s.publicKey=r.publicKeyFromAsn1(a.subjectPublicKeyInfo),s.getAttribute=function(e){return u(s,e)},s.addAttribute=function(e){p([e]),s.attributes.push(e)},s.attributes=r.CRIAttributesAsArray(a.certificationRequestInfoAttributes||[]),s},r.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return u(e.subject,t)},e.subject.addField=function(t){p([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return u(e,t)},e.addAttribute=function(t){p([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){p(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){p(t),e.attributes=t},e.sign=function(o,a){e.md=a||V.md.sha1.create();var i=n[e.md.algorithm+"WithRSAEncryption"];if(!i){var s=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw s.algorithm=e.md.algorithm,s}e.signatureOid=e.siginfo.algorithmOid=i,e.certificationRequestInfo=r.getCertificationRequestInfo(e);var c=t.toDer(e.certificationRequestInfo);e.md.update(c.getBytes()),e.signature=o.sign(e.md)},e.verify=function(){var o=!1,a=e.md;if(null===a){if(e.signatureOid in n)switch(n[e.signatureOid]){case"sha1WithRSAEncryption":a=V.md.sha1.create();break;case"md5WithRSAEncryption":a=V.md.md5.create();break;case"sha256WithRSAEncryption":a=V.md.sha256.create();break;case"sha384WithRSAEncryption":a=V.md.sha384.create();break;case"sha512WithRSAEncryption":a=V.md.sha512.create();break;case"RSASSA-PSS":a=V.md.sha256.create()}if(null===a)throw(d=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=e.signatureOid,d;var i=e.certificationRequestInfo||r.getCertificationRequestInfo(e),s=t.toDer(i);a.update(s.getBytes())}if(null!==a){var c;switch(e.signatureOid){case n.sha1WithRSAEncryption:break;case n["RSASSA-PSS"]:var l,u,d;if(void 0===(l=n[e.signatureParameters.mgf.hash.algorithmOid])||void 0===V.md[l])throw(d=new Error("Unsupported MGF hash function.")).oid=e.signatureParameters.mgf.hash.algorithmOid,d.name=l,d;if(void 0===(u=n[e.signatureParameters.mgf.algorithmOid])||void 0===V.mgf[u])throw(d=new Error("Unsupported MGF function.")).oid=e.signatureParameters.mgf.algorithmOid,d.name=u,d;if(u=V.mgf[u].create(V.md[l].create()),void 0===(l=n[e.signatureParameters.hash.algorithmOid])||void 0===V.md[l])throw(d=new Error("Unsupported RSASSA-PSS hash function.")).oid=e.signatureParameters.hash.algorithmOid,d.name=l,d;c=V.pss.create(V.md[l].create(),u,e.signatureParameters.saltLength)}o=e.publicKey.verify(a.digest().getBytes(),e.signature,c)}return o},e};var v=new Date("1950-01-01T00:00:00Z"),y=new Date("2050-01-01T00:00:00Z");function b(e){return e>=v&&e<y?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(e)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(e))}r.getTBSCertificate=function(e){var n=b(e.validity.notBefore),o=b(e.validity.notAfter),a=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,V.util.hexToBytes(e.serialNumber)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.siginfo.algorithmOid).getBytes()),m(e.siginfo.algorithmOid,e.siginfo.parameters)]),f(e.issuer),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,o]),f(e.subject),r.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&a.value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&a.value.push(t.create(t.Class.CONTEXT_SPECIFIC,2,!0,[t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&a.value.push(r.certificateExtensionsToAsn1(e.extensions)),a},r.getCertificationRequestInfo=function(e){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),f(e.subject),r.publicKeyToAsn1(e.publicKey),g(e)])},r.distinguishedNameToAsn1=function(e){return f(e)},r.certificateToAsn1=function(e){var n=e.tbsCertificate||r.getTBSCertificate(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.certificateExtensionsToAsn1=function(e){var n=t.create(t.Class.CONTEXT_SPECIFIC,3,!0,[]),o=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);n.value.push(o);for(var a=0;a<e.length;++a)o.value.push(r.certificateExtensionToAsn1(e[a]));return n},r.certificateExtensionToAsn1=function(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.id).getBytes())),e.critical&&r.value.push(t.create(t.Class.UNIVERSAL,t.Type.BOOLEAN,!1,String.fromCharCode(255)));var n=e.value;return"string"!=typeof e.value&&(n=t.toDer(n).getBytes()),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n)),r},r.certificationRequestToAsn1=function(e){var n=e.certificationRequestInfo||r.getCertificationRequestInfo(e);return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[n,t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},r.createCaStore=function(e){var n={certs:{}};function o(e){return a(e),n.certs[e.hash]||null}function a(e){if(!e.hash){var t=V.md.sha1.create();e.attributes=r.RDNAttributesAsArray(f(e),t),e.hash=t.digest().toHex()}}if(n.getIssuer=function(e){return o(e.issuer)},n.addCertificate=function(e){if("string"==typeof e&&(e=V.pki.certificateFromPem(e)),a(e.subject),!n.hasCertificate(e))if(e.subject.hash in n.certs){var t=n.certs[e.subject.hash];V.util.isArray(t)||(t=[t]),t.push(e),n.certs[e.subject.hash]=t}else n.certs[e.subject.hash]=e},n.hasCertificate=function(e){"string"==typeof e&&(e=V.pki.certificateFromPem(e));var n=o(e.subject);if(!n)return!1;V.util.isArray(n)||(n=[n]);for(var a=t.toDer(r.certificateToAsn1(e)).getBytes(),i=0;i<n.length;++i)if(a===t.toDer(r.certificateToAsn1(n[i])).getBytes())return!0;return!1},n.listAllCertificates=function(){var e=[];for(var t in n.certs)if(n.certs.hasOwnProperty(t)){var r=n.certs[t];if(V.util.isArray(r))for(var o=0;o<r.length;++o)e.push(r[o]);else e.push(r)}return e},n.removeCertificate=function(e){var i;if("string"==typeof e&&(e=V.pki.certificateFromPem(e)),a(e.subject),!n.hasCertificate(e))return null;var s=o(e.subject);if(!V.util.isArray(s))return i=n.certs[e.subject.hash],delete n.certs[e.subject.hash],i;for(var c=t.toDer(r.certificateToAsn1(e)).getBytes(),l=0;l<s.length;++l)c===t.toDer(r.certificateToAsn1(s[l])).getBytes()&&(i=s[l],s.splice(l,1));return 0===s.length&&delete n.certs[e.subject.hash],i},e)for(var i=0;i<e.length;++i){var s=e[i];n.addCertificate(s)}return n},r.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},r.verifyCertificateChain=function(e,t,n){"function"==typeof n&&(n={verify:n}),n=n||{};var o=(t=t.slice(0)).slice(0),a=n.validityCheckDate;void 0===a&&(a=new Date);var i=!0,s=null,c=0;do{var l=t.shift(),u=null,d=!1;if(a&&(a<l.validity.notBefore||a>l.validity.notAfter)&&(s={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:a}),null===s){if(null===(u=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(d=!0,u=l),u){var f=u;V.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){u=f.shift();try{p=u.verify(l)}catch(e){}}p||(s={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}null!==s||u&&!d||e.hasCertificate(l)||(s={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}if(null===s&&u&&!l.isIssuer(u)&&(s={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate}),null===s)for(var h={keyUsage:!0,basicConstraints:!0},m=0;null===s&&m<l.extensions.length;++m){var g=l.extensions[m];!g.critical||g.name in h||(s={message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}if(null===s&&(!i||0===t.length&&(!u||d))){var v=l.getExtension("basicConstraints"),y=l.getExtension("keyUsage");null!==y&&(y.keyCertSign&&null!==v||(s={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:r.certificateError.bad_certificate})),null!==s||null===v||v.cA||(s={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),null===s&&null!==y&&"pathLenConstraint"in v&&c-1>v.pathLenConstraint&&(s={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate})}var b=null===s||s.error,C=n.verify?n.verify(b,c,o):b;if(!0!==C)throw!0===b&&(s={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate}),(C||0===C)&&("object"!=w(C)||V.util.isArray(C)?"string"==typeof C&&(s.error=C):(C.message&&(s.message=C.message),C.error&&(s.error=C.error))),s;s=null,i=!1,++c}while(t.length>0);return!0}})),C((function(e){var t=V.asn1,r=V.pki,n=e.exports=V.pkcs12=V.pkcs12||{},o={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},a={name:"PFX",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},o,{name:"PFX.macData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:t.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},i={name:"SafeBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},s={name:"Attribute",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,capture:"values"}]},c={name:"CertBag",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:t.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:t.Class.UNIVERSAL,type:t.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function l(e,t,r,n){for(var o=[],a=0;a<e.length;a++)for(var i=0;i<e[a].safeBags.length;i++){var s=e[a].safeBags[i];void 0!==n&&s.type!==n||(null!==t?void 0!==s.attributes[t]&&s.attributes[t].indexOf(r)>=0&&o.push(s):o.push(s))}return o}function u(e){if(e.composed||e.constructed){for(var t=V.util.createBuffer(),r=0;r<e.value.length;++r)t.putBytes(e.value[r].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function d(e,n){var o={},a=[];if(!t.validate(e,V.pkcs7.asn1.encryptedDataValidator,o,a))throw(i=new Error("Cannot read EncryptedContentInfo.")).errors=a,i;var i,s=t.derToOid(o.contentType);if(s!==r.oids.data)throw(i=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.")).oid=s,i;s=t.derToOid(o.encAlgorithm);var c=r.pbe.getCipher(s,o.encParameter,n),l=u(o.encryptedContentAsn1),d=V.util.createBuffer(l.value);if(c.update(d),!c.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return c.output.getBytes()}function f(e,n,o){if(!n&&0===e.length)return[];if((e=t.fromDer(e,n)).tagClass!==t.Class.UNIVERSAL||e.type!==t.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var a=[],s=0;s<e.value.length;s++){var l=e.value[s],u={},d=[];if(!t.validate(l,i,u,d))throw(v=new Error("Cannot read SafeBag.")).errors=d,v;var f,h,m={type:t.derToOid(u.bagId),attributes:p(u.bagAttributes)};a.push(m);var g=u.bagValue.value[0];switch(m.type){case r.oids.pkcs8ShroudedKeyBag:if(null===(g=r.decryptPrivateKeyInfo(g,o)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case r.oids.keyBag:try{m.key=r.privateKeyFromAsn1(g)}catch(e){m.key=null,m.asn1=g}continue;case r.oids.certBag:f=c,h=function(){if(t.derToOid(u.certId)!==r.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=t.derToOid(u.certId),e}var o=t.fromDer(u.cert,n);try{m.cert=r.certificateFromAsn1(o,!0)}catch(e){m.cert=null,m.asn1=o}};break;default:var v;throw(v=new Error("Unsupported PKCS#12 SafeBag type.")).oid=m.type,v}if(void 0!==f&&!t.validate(g,f,u,d))throw(v=new Error("Cannot read PKCS#12 "+f.name)).errors=d,v;h()}return a}function p(e){var n={};if(void 0!==e)for(var o=0;o<e.length;++o){var a={},i=[];if(!t.validate(e[o],s,a,i)){var c=new Error("Cannot read PKCS#12 BagAttribute.");throw c.errors=i,c}var l=t.derToOid(a.oid);if(void 0!==r.oids[l]){n[r.oids[l]]=[];for(var u=0;u<a.values.length;++u)n[r.oids[l]].push(a.values[u].value)}}return n}n.pkcs12FromAsn1=function(e,i,s){"string"==typeof i?(s=i,i=!0):void 0===i&&(i=!0);var c={};if(!t.validate(e,a,c,[]))throw(p=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.")).errors=p,p;var p,h={version:c.version.charCodeAt(0),safeContents:[],getBags:function(e){var t,r={};return"localKeyId"in e?t=e.localKeyId:"localKeyIdHex"in e&&(t=V.util.hexToBytes(e.localKeyIdHex)),void 0===t&&!("friendlyName"in e)&&"bagType"in e&&(r[e.bagType]=l(h.safeContents,null,null,e.bagType)),void 0!==t&&(r.localKeyId=l(h.safeContents,"localKeyId",t,e.bagType)),"friendlyName"in e&&(r.friendlyName=l(h.safeContents,"friendlyName",e.friendlyName,e.bagType)),r},getBagsByFriendlyName:function(e,t){return l(h.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return l(h.safeContents,"localKeyId",e,t)}};if(3!==c.version.charCodeAt(0))throw(p=new Error("PKCS#12 PFX of version other than 3 not supported.")).version=c.version.charCodeAt(0),p;if(t.derToOid(c.contentType)!==r.oids.data)throw(p=new Error("Only PKCS#12 PFX in password integrity mode supported.")).oid=t.derToOid(c.contentType),p;var m=c.content.value[0];if(m.tagClass!==t.Class.UNIVERSAL||m.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(m=u(m),c.mac){var g=null,v=0,y=t.derToOid(c.macAlgorithm);switch(y){case r.oids.sha1:g=V.md.sha1.create(),v=20;break;case r.oids.sha256:g=V.md.sha256.create(),v=32;break;case r.oids.sha384:g=V.md.sha384.create(),v=48;break;case r.oids.sha512:g=V.md.sha512.create(),v=64;break;case r.oids.md5:g=V.md.md5.create(),v=16}if(null===g)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+y);var b=new V.util.ByteBuffer(c.macSalt),C="macIterations"in c?parseInt(V.util.bytesToHex(c.macIterations),16):1,w=n.generateKey(s,b,3,C,v,g),k=V.hmac.create();if(k.start(g,w),k.update(m.value),k.getMac().getBytes()!==c.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return function(e,n,a,i){if((n=t.fromDer(n,a)).tagClass!==t.Class.UNIVERSAL||n.type!==t.Type.SEQUENCE||!0!==n.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var s=0;s<n.value.length;s++){var c=n.value[s],l={},p=[];if(!t.validate(c,o,l,p))throw(v=new Error("Cannot read ContentInfo.")).errors=p,v;var h={encrypted:!1},m=null,g=l.content.value[0];switch(t.derToOid(l.contentType)){case r.oids.data:if(g.tagClass!==t.Class.UNIVERSAL||g.type!==t.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");m=u(g).value;break;case r.oids.encryptedData:m=d(g,i),h.encrypted=!0;break;default:var v;throw(v=new Error("Unsupported PKCS#12 contentType.")).contentType=t.derToOid(l.contentType),v}h.safeBags=f(m,a,i),e.safeContents.push(h)}}(h,m.value,i,s),h},n.toPkcs12Asn1=function(e,o,a,i){(i=i||{}).saltSize=i.saltSize||8,i.count=i.count||2048,i.algorithm=i.algorithm||i.encAlgorithm||"aes128","useMac"in i||(i.useMac=!0),"localKeyId"in i||(i.localKeyId=null),"generateLocalKeyId"in i||(i.generateLocalKeyId=!0);var s,c=i.localKeyId;if(null!==c)c=V.util.hexToBytes(c);else if(i.generateLocalKeyId)if(o){var l=V.util.isArray(o)?o[0]:o;"string"==typeof l&&(l=r.certificateFromPem(l)),(A=V.md.sha1.create()).update(t.toDer(r.certificateToAsn1(l)).getBytes()),c=A.digest().getBytes()}else c=V.random.getBytes(20);var u=[];null!==c&&u.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.localKeyId).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,c)])])),"friendlyName"in i&&u.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.friendlyName).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[t.create(t.Class.UNIVERSAL,t.Type.BMPSTRING,!1,i.friendlyName)])])),u.length>0&&(s=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,u));var d=[],f=[];null!==o&&(f=V.util.isArray(o)?o:[o]);for(var p=[],h=0;h<f.length;++h){"string"==typeof(o=f[h])&&(o=r.certificateFromPem(o));var m=0===h?s:void 0,g=r.certificateToAsn1(o),v=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.certBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.x509Certificate).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(g).getBytes())])])]),m]);p.push(v)}if(p.length>0){var y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,p),b=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(y).getBytes())])]);d.push(b)}var C=null;if(null!==e){var w=r.wrapRsaPrivateKey(r.privateKeyToAsn1(e));C=null===a?t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.keyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[w]),s]):t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.pkcs8ShroudedKeyBag).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[r.encryptPrivateKeyInfo(w,a,i)]),s]);var k=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[C]),B=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(k).getBytes())])]);d.push(B)}var E,S=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,d);if(i.useMac){var A=V.md.sha1.create(),_=new V.util.ByteBuffer(V.random.getBytes(i.saltSize)),I=i.count,T=(e=n.generateKey(a,_,3,I,20),V.hmac.create());T.start(A,e),T.update(t.toDer(S).getBytes());var P=T.getMac();E=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.sha1).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,P.getBytes())]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,_.getBytes()),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(I).getBytes())])}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(3).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.oids.data).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(S).getBytes())])]),E])},n.generateKey=V.pbe.generatePkcs12Key})),C((function(e){var t=V.asn1,r=e.exports=V.pki=V.pki||{};r.pemToDer=function(e){var t=V.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return V.util.createBuffer(t.body)},r.privateKeyFromPem=function(e){var n=V.pem.decode(e)[0];if("PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type){var o=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var a=t.fromDer(n.body);return r.privateKeyFromAsn1(a)},r.privateKeyToPem=function(e,n){var o={type:"RSA PRIVATE KEY",body:t.toDer(r.privateKeyToAsn1(e)).getBytes()};return V.pem.encode(o,{maxline:n})},r.privateKeyInfoToPem=function(e,r){var n={type:"PRIVATE KEY",body:t.toDer(e).getBytes()};return V.pem.encode(n,{maxline:r})}}));var Bt=function(e,t,r,n){var o=V.util.createBuffer(),a=e.length>>1,i=a+(1&e.length),s=e.substr(0,i),c=e.substr(a,i),l=V.util.createBuffer(),u=V.hmac.create();r=t+r;var d=Math.ceil(n/16),f=Math.ceil(n/20);u.start("MD5",s);var p=V.util.createBuffer();l.putBytes(r);for(var h=0;h<d;++h)u.start(null,null),u.update(l.getBytes()),l.putBuffer(u.digest()),u.start(null,null),u.update(l.bytes()+r),p.putBuffer(u.digest());u.start("SHA1",c);var m=V.util.createBuffer();for(l.clear(),l.putBytes(r),h=0;h<f;++h)u.start(null,null),u.update(l.getBytes()),l.putBuffer(u.digest()),u.start(null,null),u.update(l.bytes()+r),m.putBuffer(u.digest());return o.putBytes(V.util.xorBytes(p.getBytes(),m.getBytes(),n)),o},Et=function(e,t,r){var n=!1;try{var o=e.deflate(t.fragment.getBytes());t.fragment=V.util.createBuffer(o),t.length=o.length,n=!0}catch(e){}return n},St=function(e,t,r){var n=!1;try{var o=e.inflate(t.fragment.getBytes());t.fragment=V.util.createBuffer(o),t.length=o.length,n=!0}catch(e){}return n},At=function(e,t){var r=0;switch(t){case 1:r=e.getByte();break;case 2:r=e.getInt16();break;case 3:r=e.getInt24();break;case 4:r=e.getInt32()}return V.util.createBuffer(e.getBytes(r))},_t=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},It={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};It.SupportedVersions=[It.Versions.TLS_1_1,It.Versions.TLS_1_0],It.Version=It.SupportedVersions[0],It.MaxFragment=15360,It.ConnectionEnd={server:0,client:1},It.PRFAlgorithm={tls_prf_sha256:0},It.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},It.CipherType={stream:0,block:1,aead:2},It.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},It.CompressionMethod={none:0,deflate:1},It.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},It.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},It.Alert={},It.Alert.Level={warning:1,fatal:2},It.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},It.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},It.CipherSuites={},It.getCipherSuite=function(e){var t=null;for(var r in It.CipherSuites){var n=It.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},It.handleUnexpected=function(e,t){!e.open&&e.entity===It.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.unexpected_message}})},It.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(It.queue(e,It.createAlert(e,{level:It.Alert.Level.warning,description:It.Alert.Description.no_renegotiation})),It.flush(e)),e.process()},It.parseHelloMessage=function(e,t,r){var n=null,o=e.entity===It.ConnectionEnd.client;if(r<38)e.error(e,{message:o?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}});else{var a=t.fragment,i=a.length();if(n={version:{major:a.getByte(),minor:a.getByte()},random:V.util.createBuffer(a.getBytes(32)),session_id:At(a,1),extensions:[]},o?(n.cipher_suite=a.getBytes(2),n.compression_method=a.getByte()):(n.cipher_suites=At(a,2),n.compression_methods=At(a,1)),(i=r-(i-a.length()))>0){for(var s=At(a,2);s.length()>0;)n.extensions.push({type:[s.getByte(),s.getByte()],data:At(s,2)});if(!o)for(var c=0;c<n.extensions.length;++c){var l=n.extensions[c];if(0===l.type[0]&&0===l.type[1])for(var u=At(l.data,2);u.length()>0&&0===u.getByte();)e.session.extensions.server_name.serverNameList.push(At(u,2).getBytes())}}if(e.session.version&&(n.version.major!==e.session.version.major||n.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.protocol_version}});if(o)e.session.cipherSuite=It.getCipherSuite(n.cipher_suite);else for(var d=V.util.createBuffer(n.cipher_suites.bytes());d.length()>0&&(e.session.cipherSuite=It.getCipherSuite(d.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.handshake_failure},cipherSuite:V.util.bytesToHex(n.cipher_suite)});e.session.compressionMethod=o?n.compression_method:It.CompressionMethod.none}return n},It.createSecurityParameters=function(e,t){var r=e.entity===It.ConnectionEnd.client,n=t.random.bytes(),o=r?e.session.sp.client_random:n,a=r?n:It.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:It.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:o,server_random:a}},It.handleServerHello=function(e,t,r){var n=It.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var o=n.session_id.bytes();o.length>0&&o===e.session.id?(e.expect=Nt,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=Tt,e.session.resuming=!1,It.createSecurityParameters(e,n)),e.session.id=o,e.process()}},It.handleClientHello=function(e,t,r){var n=It.parseHelloMessage(e,t,r);if(!e.fail){var o=n.session_id.bytes(),a=null;if(e.sessionCache&&(null===(a=e.sessionCache.getSession(o))?o="":(a.version.major!==n.version.major||a.version.minor>n.version.minor)&&(a=null,o="")),0===o.length&&(o=V.random.getBytes(32)),e.session.id=o,e.session.clientHelloVersion=n.version,e.session.sp={},a)e.version=e.session.version=a.version,e.session.sp=a.sp;else{for(var i,s=1;s<It.SupportedVersions.length&&!((i=It.SupportedVersions[s]).minor<=n.version.minor);++s);e.version={major:i.major,minor:i.minor},e.session.version=e.version}null!==a?(e.expect=jt,e.session.resuming=!0,e.session.sp.client_random=n.random.bytes()):(e.expect=!1!==e.verifyClient?Mt:Ut,e.session.resuming=!1,It.createSecurityParameters(e,n)),e.open=!0,It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createServerHello(e)})),e.session.resuming?(It.queue(e,It.createRecord(e,{type:It.ContentType.change_cipher_spec,data:It.createChangeCipherSpec()})),e.state.pending=It.createConnectionState(e),e.state.current.write=e.state.pending.write,It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createFinished(e)}))):(It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createCertificate(e)})),e.fail||(It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createServerKeyExchange(e)})),!1!==e.verifyClient&&It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createCertificateRequest(e)})),It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createServerHelloDone(e)})))),It.flush(e),e.process()}},It.handleCertificate=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}});var n,o,a=t.fragment,i={certificate_list:At(a,3)},s=[];try{for(;i.certificate_list.length()>0;)n=At(i.certificate_list,3),o=V.asn1.fromDer(n),n=V.pki.certificateFromAsn1(o,!0),s.push(n)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.bad_certificate}})}var c=e.entity===It.ConnectionEnd.client;!c&&!0!==e.verifyClient||0!==s.length?0===s.length?e.expect=c?Pt:Ut:(c?e.session.serverCertificate=s[0]:e.session.clientCertificate=s[0],It.verifyCertificateChain(e,s)&&(e.expect=c?Pt:Ut)):e.error(e,{message:c?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}}),e.process()},It.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.unsupported_certificate}});e.expect=xt,e.process()},It.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.unsupported_certificate}});var n=t.fragment,o={enc_pre_master_secret:At(n,2).getBytes()},a=null;if(e.getPrivateKey)try{a=e.getPrivateKey(e,e.session.serverCertificate),a=V.pki.privateKeyFromPem(a)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}})}if(null===a)return e.error(e,{message:"No private key set.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}});try{var i=e.session.sp;i.pre_master_secret=a.decrypt(o.enc_pre_master_secret);var s=e.session.clientHelloVersion;if(s.major!==i.pre_master_secret.charCodeAt(0)||s.minor!==i.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){i.pre_master_secret=V.random.getBytes(48)}e.expect=jt,null!==e.session.clientCertificate&&(e.expect=Ft),e.process()},It.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}});var n=t.fragment,o={certificate_types:At(n,1),certificate_authorities:At(n,2)};e.session.certificateRequest=o,e.expect=Rt,e.process()},It.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}});var n=t.fragment;n.read-=4;var o=n.bytes();n.read+=4;var a={signature:At(n,2).getBytes()},i=V.util.createBuffer();i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest()),i=i.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(i,a.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(o),e.session.sha1.update(o)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.handshake_failure}})}e.expect=jt,e.process()},It.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.record_overflow}});if(null===e.serverCertificate){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.insufficient_security}},o=e.verify(e,n.alert.description,0,[]);if(!0!==o)return(o||0===o)&&("object"!=w(o)||V.util.isArray(o)?"number"==typeof o&&(n.alert.description=o):(o.message&&(n.message=o.message),o.alert&&(n.alert.description=o.alert))),e.error(e,n)}null!==e.session.certificateRequest&&(t=It.createRecord(e,{type:It.ContentType.handshake,data:It.createCertificate(e)}),It.queue(e,t)),t=It.createRecord(e,{type:It.ContentType.handshake,data:It.createClientKeyExchange(e)}),It.queue(e,t),e.expect=Dt;var a=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createCertificateVerify(e,t)})),It.queue(e,It.createRecord(e,{type:It.ContentType.change_cipher_spec,data:It.createChangeCipherSpec()})),e.state.pending=It.createConnectionState(e),e.state.current.write=e.state.pending.write,It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createFinished(e)})),e.expect=Nt,It.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return a(e,null);It.getClientSignature(e,a)},It.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.illegal_parameter}});var r=e.entity===It.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=It.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?Lt:Vt,e.process()},It.handleFinished=function(e,t,r){var n=t.fragment;n.read-=4;var o=n.bytes();n.read+=4;var a=t.fragment.getBytes();(n=V.util.createBuffer()).putBuffer(e.session.md5.digest()),n.putBuffer(e.session.sha1.digest());var i=e.entity===It.ConnectionEnd.client,s=i?"server finished":"client finished",c=e.session.sp;if((n=Bt(c.master_secret,s,n.getBytes(),12)).getBytes()!==a)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.decrypt_error}});e.session.md5.update(o),e.session.sha1.update(o),(e.session.resuming&&i||!e.session.resuming&&!i)&&(It.queue(e,It.createRecord(e,{type:It.ContentType.change_cipher_spec,data:It.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,It.queue(e,It.createRecord(e,{type:It.ContentType.handshake,data:It.createFinished(e)}))),e.expect=i?Ot:zt,e.handshaking=!1,++e.handshakes,e.peerCertificate=i?e.session.serverCertificate:e.session.clientCertificate,It.flush(e),e.isConnected=!0,e.connected(e),e.process()},It.handleAlert=function(e,t){var r,n=t.fragment,o={level:n.getByte(),description:n.getByte()};switch(o.description){case It.Alert.Description.close_notify:r="Connection closed.";break;case It.Alert.Description.unexpected_message:r="Unexpected message.";break;case It.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case It.Alert.Description.decryption_failed:r="Decryption failed.";break;case It.Alert.Description.record_overflow:r="Record overflow.";break;case It.Alert.Description.decompression_failure:r="Decompression failed.";break;case It.Alert.Description.handshake_failure:r="Handshake failure.";break;case It.Alert.Description.bad_certificate:r="Bad certificate.";break;case It.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case It.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case It.Alert.Description.certificate_expired:r="Certificate expired.";break;case It.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case It.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case It.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case It.Alert.Description.access_denied:r="Access denied.";break;case It.Alert.Description.decode_error:r="Decode error.";break;case It.Alert.Description.decrypt_error:r="Decrypt error.";break;case It.Alert.Description.export_restriction:r="Export restriction.";break;case It.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case It.Alert.Description.insufficient_security:r="Insufficient security.";break;case It.Alert.Description.internal_error:r="Internal error.";break;case It.Alert.Description.user_canceled:r="User canceled.";break;case It.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(o.description===It.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===It.ConnectionEnd.client?"server":"client",alert:o}),e.process()},It.handleHandshake=function(e,t){var r=t.fragment,n=r.getByte(),o=r.getInt24();if(o>r.length())return e.fragmented=t,t.fragment=V.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var a=r.bytes(o+4);r.read+=4,n in nr[e.entity][e.expect]?(e.entity!==It.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:V.md.md5.create(),sha1:V.md.sha1.create()}),n!==It.HandshakeType.hello_request&&n!==It.HandshakeType.certificate_verify&&n!==It.HandshakeType.finished&&(e.session.md5.update(a),e.session.sha1.update(a)),nr[e.entity][e.expect][n](e,t,o)):It.handleUnexpected(e,t)},It.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},It.handleHeartbeat=function(e,t){var r=t.fragment,n=r.getByte(),o=r.getInt16(),a=r.getBytes(o);if(n===It.HeartbeatMessageType.heartbeat_request){if(e.handshaking||o>a.length)return e.process();It.queue(e,It.createRecord(e,{type:It.ContentType.heartbeat,data:It.createHeartbeat(It.HeartbeatMessageType.heartbeat_response,a)})),It.flush(e)}else if(n===It.HeartbeatMessageType.heartbeat_response){if(a!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,V.util.createBuffer(a))}e.process()};var Tt=1,Pt=2,xt=3,Rt=4,Nt=5,Lt=6,Ot=7,Dt=8,Mt=1,Ut=2,Ft=3,jt=4,Vt=5,zt=6,Kt=It.handleUnexpected,Ht=It.handleChangeCipherSpec,qt=It.handleAlert,Qt=It.handleHandshake,Wt=It.handleApplicationData,Gt=It.handleHeartbeat,Xt=[];Xt[It.ConnectionEnd.client]=[[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Ht,qt,Kt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Wt,Gt],[Kt,qt,Qt,Kt,Gt]],Xt[It.ConnectionEnd.server]=[[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Ht,qt,Kt,Kt,Gt],[Kt,qt,Qt,Kt,Gt],[Kt,qt,Qt,Wt,Gt],[Kt,qt,Qt,Kt,Gt]];var Yt=It.handleHelloRequest,$t=It.handleServerHello,Zt=It.handleCertificate,Jt=It.handleServerKeyExchange,er=It.handleCertificateRequest,tr=It.handleServerHelloDone,rr=It.handleFinished,nr=[];nr[It.ConnectionEnd.client]=[[Kt,Kt,$t,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Zt,Jt,er,tr,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Jt,er,tr,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,er,tr,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,tr,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,rr],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Yt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt]];var or=It.handleClientHello,ar=It.handleClientKeyExchange,ir=It.handleCertificateVerify;nr[It.ConnectionEnd.server]=[[Kt,or,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Zt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,ar,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,ir,Kt,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,rr],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt],[Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt,Kt]],It.generateKeys=function(e,t){var r=Bt,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var o=2*t.mac_key_length+2*t.enc_key_length,a=e.version.major===It.Versions.TLS_1_0.major&&e.version.minor===It.Versions.TLS_1_0.minor;a&&(o+=2*t.fixed_iv_length);var i=r(t.master_secret,"key expansion",n,o),s={client_write_MAC_key:i.getBytes(t.mac_key_length),server_write_MAC_key:i.getBytes(t.mac_key_length),client_write_key:i.getBytes(t.enc_key_length),server_write_key:i.getBytes(t.enc_key_length)};return a&&(s.client_write_IV=i.getBytes(t.fixed_iv_length),s.server_write_IV=i.getBytes(t.fixed_iv_length)),s},It.createConnectionState=function(e){var t=e.entity===It.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}}),!e.fail},e.session){var o=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(o),o.keys=It.generateKeys(e,o),n.read.macKey=t?o.keys.server_write_MAC_key:o.keys.client_write_MAC_key,n.write.macKey=t?o.keys.client_write_MAC_key:o.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,o),o.compression_algorithm){case It.CompressionMethod.none:break;case It.CompressionMethod.deflate:n.read.compressFunction=St,n.write.compressFunction=Et;break;default:throw new Error("Unsupported compression algorithm.")}}return n},It.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=V.util.createBuffer();return r.putInt32(t),r.putBytes(V.random.getBytes(28)),r},It.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},It.createAlert=function(e,t){var r=V.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),It.createRecord(e,{type:It.ContentType.alert,data:r})},It.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=V.util.createBuffer(),r=0;r<e.cipherSuites.length;++r){var n=e.cipherSuites[r];t.putByte(n.id[0]),t.putByte(n.id[1])}var o=t.length(),a=V.util.createBuffer();a.putByte(It.CompressionMethod.none);var i=a.length(),s=V.util.createBuffer();if(e.virtualHost){var c=V.util.createBuffer();c.putByte(0),c.putByte(0);var l=V.util.createBuffer();l.putByte(0),_t(l,2,V.util.createBuffer(e.virtualHost));var u=V.util.createBuffer();_t(u,2,l),_t(c,2,u),s.putBuffer(c)}var d=s.length();d>0&&(d+=2);var f=e.session.id,p=f.length+1+2+4+28+2+o+1+i+d,h=V.util.createBuffer();return h.putByte(It.HandshakeType.client_hello),h.putInt24(p),h.putByte(e.version.major),h.putByte(e.version.minor),h.putBytes(e.session.sp.client_random),_t(h,1,V.util.createBuffer(f)),_t(h,2,t),_t(h,1,a),d>0&&_t(h,2,s),h},It.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,n=V.util.createBuffer();return n.putByte(It.HandshakeType.server_hello),n.putInt24(r),n.putByte(e.version.major),n.putByte(e.version.minor),n.putBytes(e.session.sp.server_random),_t(n,1,V.util.createBuffer(t)),n.putByte(e.session.cipherSuite.id[0]),n.putByte(e.session.cipherSuite.id[1]),n.putByte(e.session.compressionMethod),n},It.createCertificate=function(e){var t,r=e.entity===It.ConnectionEnd.client,n=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,n=e.getCertificate(e,t));var o=V.util.createBuffer();if(null!==n)try{V.util.isArray(n)||(n=[n]);for(var a=null,i=0;i<n.length;++i){var s=V.pem.decode(n[i])[0];if("CERTIFICATE"!==s.type&&"X509 CERTIFICATE"!==s.type&&"TRUSTED CERTIFICATE"!==s.type){var c=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw c.headerType=s.type,c}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var l=V.util.createBuffer(s.body);null===a&&(a=V.asn1.fromDer(l.bytes(),!1));var u=V.util.createBuffer();_t(u,3,l),o.putBuffer(u)}n=V.pki.certificateFromAsn1(a),r?e.session.clientCertificate=n:e.session.serverCertificate=n}catch(t){return e.error(e,{message:"Could not send certificate list.",cause:t,send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.bad_certificate}})}var d=3+o.length(),f=V.util.createBuffer();return f.putByte(It.HandshakeType.certificate),f.putInt24(d),_t(f,3,o),f},It.createClientKeyExchange=function(e){var t=V.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(V.random.getBytes(46));var r=e.session.sp;r.pre_master_secret=t.getBytes();var n=(t=e.session.serverCertificate.publicKey.encrypt(r.pre_master_secret)).length+2,o=V.util.createBuffer();return o.putByte(It.HandshakeType.client_key_exchange),o.putInt24(n),o.putInt16(t.length),o.putBytes(t),o},It.createServerKeyExchange=function(e){return V.util.createBuffer()},It.getClientSignature=function(e,t){var r=V.util.createBuffer();r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest()),r=r.getBytes(),e.getSignature=e.getSignature||function(e,t,r){var n=null;if(e.getPrivateKey)try{n=e.getPrivateKey(e,e.session.clientCertificate),n=V.pki.privateKeyFromPem(n)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}})}null===n?e.error(e,{message:"No private key set.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.internal_error}}):t=n.sign(t,null),r(e,t)},e.getSignature(e,r,t)},It.createCertificateVerify=function(e,t){var r=t.length+2,n=V.util.createBuffer();return n.putByte(It.HandshakeType.certificate_verify),n.putInt24(r),n.putInt16(t.length),n.putBytes(t),n},It.createCertificateRequest=function(e){var t=V.util.createBuffer();t.putByte(1);var r=V.util.createBuffer();for(var n in e.caStore.certs){var o=e.caStore.certs[n],a=V.pki.distinguishedNameToAsn1(o.subject),i=V.asn1.toDer(a);r.putInt16(i.length()),r.putBuffer(i)}var s=1+t.length()+2+r.length(),c=V.util.createBuffer();return c.putByte(It.HandshakeType.certificate_request),c.putInt24(s),_t(c,1,t),_t(c,2,r),c},It.createServerHelloDone=function(e){var t=V.util.createBuffer();return t.putByte(It.HandshakeType.server_hello_done),t.putInt24(0),t},It.createChangeCipherSpec=function(){var e=V.util.createBuffer();return e.putByte(1),e},It.createFinished=function(e){var t=V.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var r=e.entity===It.ConnectionEnd.client,n=e.session.sp,o=r?"client finished":"server finished";t=Bt(n.master_secret,o,t.getBytes(),12);var a=V.util.createBuffer();return a.putByte(It.HandshakeType.finished),a.putInt24(t.length()),a.putBuffer(t),a},It.createHeartbeat=function(e,t,r){void 0===r&&(r=t.length);var n=V.util.createBuffer();n.putByte(e),n.putInt16(r),n.putBytes(t);var o=n.length(),a=Math.max(16,o-r-3);return n.putBytes(V.random.getBytes(a)),n},It.queue=function(e,t){if(t&&(0!==t.fragment.length()||t.type!==It.ContentType.handshake&&t.type!==It.ContentType.alert&&t.type!==It.ContentType.change_cipher_spec)){if(t.type===It.ContentType.handshake){var r=t.fragment.bytes();e.session.md5.update(r),e.session.sha1.update(r),r=null}var n;if(t.fragment.length()<=It.MaxFragment)n=[t];else{n=[];for(var o=t.fragment.bytes();o.length>It.MaxFragment;)n.push(It.createRecord(e,{type:t.type,data:V.util.createBuffer(o.slice(0,It.MaxFragment))})),o=o.slice(It.MaxFragment);o.length>0&&n.push(It.createRecord(e,{type:t.type,data:V.util.createBuffer(o)}))}for(var a=0;a<n.length&&!e.fail;++a){var i=n[a];e.state.current.write.update(e,i)&&e.records.push(i)}}},It.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var sr=function(e){switch(e){case!0:return!0;case V.pki.certificateError.bad_certificate:return It.Alert.Description.bad_certificate;case V.pki.certificateError.unsupported_certificate:return It.Alert.Description.unsupported_certificate;case V.pki.certificateError.certificate_revoked:return It.Alert.Description.certificate_revoked;case V.pki.certificateError.certificate_expired:return It.Alert.Description.certificate_expired;case V.pki.certificateError.certificate_unknown:return It.Alert.Description.certificate_unknown;case V.pki.certificateError.unknown_ca:return It.Alert.Description.unknown_ca;default:return It.Alert.Description.bad_certificate}};for(var cr in It.verifyCertificateChain=function(e,t){try{var r={};for(var n in e.verifyOptions)r[n]=e.verifyOptions[n];r.verify=function(t,r,n){sr(t);var o=e.verify(e,t,r,n);if(!0!==o){if("object"==w(o)&&!V.util.isArray(o)){var a=new Error("The application rejected the certificate.");throw a.send=!0,a.alert={level:It.Alert.Level.fatal,description:It.Alert.Description.bad_certificate},o.message&&(a.message=o.message),o.alert&&(a.alert.description=o.alert),a}o!==t&&(o=function(e){switch(e){case!0:return!0;case It.Alert.Description.bad_certificate:return V.pki.certificateError.bad_certificate;case It.Alert.Description.unsupported_certificate:return V.pki.certificateError.unsupported_certificate;case It.Alert.Description.certificate_revoked:return V.pki.certificateError.certificate_revoked;case It.Alert.Description.certificate_expired:return V.pki.certificateError.certificate_expired;case It.Alert.Description.certificate_unknown:return V.pki.certificateError.certificate_unknown;case It.Alert.Description.unknown_ca:return V.pki.certificateError.unknown_ca;default:return V.pki.certificateError.bad_certificate}}(o))}return o},V.pki.verifyCertificateChain(e.caStore,t,r)}catch(t){var o=t;("object"!=w(o)||V.util.isArray(o))&&(o={send:!0,alert:{level:It.Alert.Level.fatal,description:sr(t)}}),"send"in o||(o.send=!0),"alert"in o||(o.alert={level:It.Alert.Level.fatal,description:sr(o.error)}),e.error(e,o)}return!e.fail},It.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{for(var n in(r={}).cache=e||{},r.capacity=Math.max(t||100,1),r.order=[],e)r.order.length<=t?r.order.push(n):delete e[n];r.getSession=function(e){var t=null,n=null;if(e?n=V.util.bytesToHex(e):r.order.length>0&&(n=r.order[0]),null!==n&&n in r.cache)for(var o in t=r.cache[n],delete r.cache[n],r.order)if(r.order[o]===n){r.order.splice(o,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var n=r.order.shift();delete r.cache[n]}n=V.util.bytesToHex(e),r.order.push(n),r.cache[n]=t}}return r},It.createConnection=function(e){var t;t=e.caStore?V.util.isArray(e.caStore)?V.pki.createCaStore(e.caStore):e.caStore:V.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var n in r=[],It.CipherSuites)r.push(It.CipherSuites[n]);var o=e.server?It.ConnectionEnd.server:It.ConnectionEnd.client,a=e.sessionCache?It.createSessionCache(e.sessionCache):null,i={version:{major:It.Version.major,minor:It.Version.minor},entity:o,sessionId:e.sessionId,caStore:t,sessionCache:a,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:V.util.createBuffer(),tlsData:V.util.createBuffer(),data:V.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===It.ConnectionEnd.client?"client":"server"),r.send&&(It.queue(t,It.createAlert(t,r.alert)),It.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){i.version={major:It.Version.major,minor:It.Version.minor},i.record=null,i.session=null,i.peerCertificate=null,i.state={pending:null,current:null},i.expect=(It.ConnectionEnd.client,0),i.fragmented=null,i.records=[],i.open=!1,i.handshakes=0,i.handshaking=!1,i.isConnected=!1,i.fail=!(e||void 0===e),i.input.clear(),i.tlsData.clear(),i.data.clear(),i.state.current=It.createConnectionState(i)}};return i.reset(),i.handshake=function(e){if(i.entity!==It.ConnectionEnd.client)i.error(i,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(i.handshaking)i.error(i,{message:"Handshake already in progress.",fatal:!1});else{i.fail&&!i.open&&0===i.handshakes&&(i.fail=!1),i.handshaking=!0;var t=null;(e=e||"").length>0&&(i.sessionCache&&(t=i.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&i.sessionCache&&null!==(t=i.sessionCache.getSession())&&(e=t.id),i.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:V.md.md5.create(),sha1:V.md.sha1.create()},t&&(i.version=t.version,i.session.sp=t.sp),i.session.sp.client_random=It.createRandom().getBytes(),i.open=!0,It.queue(i,It.createRecord(i,{type:It.ContentType.handshake,data:It.createClientHello(i)})),It.flush(i)}},i.process=function(e){var t=0;return e&&i.input.putBytes(e),i.fail||(null!==i.record&&i.record.ready&&i.record.fragment.isEmpty()&&(i.record=null),null===i.record&&(t=function(e){var t=0,r=e.input,n=r.length();if(n<5)t=5-n;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:V.util.createBuffer(),ready:!1};var o=e.record.version.major===e.version.major;o&&e.session&&e.session.version&&(o=e.record.version.minor===e.version.minor),o||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.protocol_version}})}return t}(i)),i.fail||null===i.record||i.record.ready||(t=function(e){var t=0,r=e.input,n=r.length();return n<e.record.length?t=e.record.length-n:(e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact(),e.state.current.read.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:It.Alert.Level.fatal,description:It.Alert.Description.unexpected_message}})),e.record.ready=!0)),t}(i)),!i.fail&&null!==i.record&&i.record.ready&&function(e,t){var r=t.type-It.ContentType.change_cipher_spec,n=Xt[e.entity][e.expect];r in n?n[r](e,t):It.handleUnexpected(e,t)}(i,i.record)),t},i.prepare=function(e){return It.queue(i,It.createRecord(i,{type:It.ContentType.application_data,data:V.util.createBuffer(e)})),It.flush(i)},i.prepareHeartbeatRequest=function(e,t){return e instanceof V.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),i.expectedHeartbeatPayload=e,It.queue(i,It.createRecord(i,{type:It.ContentType.heartbeat,data:It.createHeartbeat(It.HeartbeatMessageType.heartbeat_request,e,t)})),It.flush(i)},i.close=function(e){if(!i.fail&&i.sessionCache&&i.session){var t={id:i.session.id,version:i.session.version,sp:i.session.sp};t.sp.keys=null,i.sessionCache.setSession(t.id,t)}i.open&&(i.open=!1,i.input.clear(),(i.isConnected||i.handshaking)&&(i.isConnected=i.handshaking=!1,It.queue(i,It.createAlert(i,{level:It.Alert.Level.warning,description:It.Alert.Description.close_notify})),It.flush(i)),i.closed(i)),i.reset(e)},i},V.tls=V.tls||{},It)"function"!=typeof It[cr]&&(V.tls[cr]=It[cr]);V.tls.prf_tls1=Bt,V.tls.hmac_sha1=function(e,t,r){var n=V.hmac.create();n.start("SHA1",e);var o=V.util.createBuffer();return o.putInt32(t[0]),o.putInt32(t[1]),o.putByte(r.type),o.putByte(r.version.major),o.putByte(r.version.minor),o.putInt16(r.length),o.putBytes(r.fragment.bytes()),n.update(o.getBytes()),n.digest().getBytes()},V.tls.createSessionCache=It.createSessionCache,V.tls.createConnection=It.createConnection,C((function(e){var t=e.exports=V.tls;function r(e,r,o){var a=r.entity===V.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:V.cipher.createDecipher("AES-CBC",a?o.keys.server_write_key:o.keys.client_write_key),iv:a?o.keys.server_write_IV:o.keys.client_write_IV},e.write.cipherState={init:!1,cipher:V.cipher.createCipher("AES-CBC",a?o.keys.client_write_key:o.keys.server_write_key),iv:a?o.keys.client_write_IV:o.keys.server_write_IV},e.read.cipherFunction=i,e.write.cipherFunction=n,e.read.macLength=e.write.macLength=o.mac_length,e.read.macFunction=e.write.macFunction=t.hmac_sha1}function n(e,r){var n,a=!1,i=r.macFunction(r.macKey,r.sequenceNumber,e);e.fragment.putBytes(i),r.updateSequenceNumber(),n=e.version.minor===t.Versions.TLS_1_0.minor?r.cipherState.init?null:r.cipherState.iv:V.random.getBytesSync(16),r.cipherState.init=!0;var s=r.cipherState.cipher;return s.start({iv:n}),e.version.minor>=t.Versions.TLS_1_1.minor&&s.output.putBytes(n),s.update(e.fragment),s.finish(o)&&(e.fragment=s.output,e.length=e.fragment.length(),a=!0),a}function o(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function a(e,t,r){var n=!0;if(r){for(var o=t.length(),a=t.last(),i=o-1-a;i<o-1;++i)n=n&&t.at(i)==a;n&&t.truncate(a+1)}return n}function i(e,r){var n,o;n=e.version.minor===t.Versions.TLS_1_0.minor?r.cipherState.init?null:r.cipherState.iv:e.fragment.getBytes(16),r.cipherState.init=!0;var i=r.cipherState.cipher;i.start({iv:n}),i.update(e.fragment),o=i.finish(a);var s=r.macLength,c=V.random.getBytesSync(s),l=i.output.length();l>=s?(e.fragment=i.output.getBytes(l-s),c=i.output.getBytes(s)):e.fragment=i.output.getBytes(),e.fragment=V.util.createBuffer(e.fragment),e.length=e.fragment.length();var u=r.macFunction(r.macKey,r.sequenceNumber,e);return r.updateSequenceNumber(),function(e,t,r){var n=V.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),t===n.digest().getBytes()}(r.macKey,c,u)&&o}t.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r},t.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=t.BulkCipherAlgorithm.aes,e.cipher_type=t.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=t.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:r}})),V.debug=V.debug||{},V.debug.storage={},V.debug.get=function(e,t){var r;return void 0===e?r=V.debug.storage:e in V.debug.storage&&(r=void 0===t?V.debug.storage[e]:V.debug.storage[e][t]),r},V.debug.set=function(e,t,r){e in V.debug.storage||(V.debug.storage[e]={}),V.debug.storage[e][t]=r},V.debug.clear=function(e,t){void 0===e?V.debug.storage={}:e in V.debug.storage&&(void 0===t?delete V.debug.storage[e]:delete V.debug.storage[e][t])},C((function(e){var t=e.exports=V.sha512=V.sha512||{};V.md.sha512=V.md.algorithms.sha512=t;var r=V.sha384=V.sha512.sha384=V.sha512.sha384||{};r.create=function(){return t.create("SHA-384")},V.md.sha384=V.md.algorithms.sha384=r,V.sha512.sha256=V.sha512.sha256||{create:function(){return t.create("SHA-512/256")}},V.md["sha512/256"]=V.md.algorithms["sha512/256"]=V.sha512.sha256,V.sha512.sha224=V.sha512.sha224||{create:function(){return t.create("SHA-512/224")}},V.md["sha512/224"]=V.md.algorithms["sha512/224"]=V.sha512.sha224,t.create=function(e){if(o||(n=String.fromCharCode(128),n+=V.util.fillString(String.fromCharCode(0),128),a=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(i={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],i["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],i["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],i["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],o=!0),void 0===e&&(e="SHA-512"),!(e in i))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=i[e],r=null,c=V.util.createBuffer(),l=new Array(80),u=0;u<80;++u)l[u]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,n=0;n<e;++n)f.fullMessageLength.push(0);for(c=V.util.createBuffer(),r=new Array(t.length),n=0;n<t.length;++n)r[n]=t[n].slice(0);return f}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=V.util.encodeUtf8(e));var n=e.length;f.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var o=f.fullMessageLength.length-1;o>=0;--o)f.fullMessageLength[o]+=n[1],n[1]=n[0]+(f.fullMessageLength[o]/4294967296>>>0),f.fullMessageLength[o]=f.fullMessageLength[o]>>>0,n[0]=n[1]/4294967296>>>0;return c.putBytes(e),s(r,l,c),(c.read>2048||0===c.length())&&c.compact(),f},f.digest=function(){var t=V.util.createBuffer();t.putBytes(c.bytes());var o,a=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(n.substr(0,f.blockLength-a));for(var i=8*f.fullMessageLength[0],u=0;u<f.fullMessageLength.length-1;++u)i+=(o=8*f.fullMessageLength[u+1])/4294967296>>>0,t.putInt32(i>>>0),i=o>>>0;t.putInt32(i);var d=new Array(r.length);for(u=0;u<r.length;++u)d[u]=r[u].slice(0);s(d,l,t);var p,h=V.util.createBuffer();for(p="SHA-512"===e?d.length:"SHA-384"===e?d.length-2:d.length-4,u=0;u<p;++u)h.putInt32(d[u][0]),u===p-1&&"SHA-512/224"===e||h.putInt32(d[u][1]);return h},f};var n=null,o=!1,a=null,i=null;function s(e,t,r){for(var n,o,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k,B,E,S,A,_,I,T,P,x,R,N,L,O,D,M=r.length();M>=128;){for(P=0;P<16;++P)t[P][0]=r.getInt32()>>>0,t[P][1]=r.getInt32()>>>0;for(;P<80;++P)n=(((x=(N=t[P-2])[0])>>>19|(R=N[1])<<13)^(R>>>29|x<<3)^x>>>6)>>>0,o=((x<<13|R>>>19)^(R<<3|x>>>29)^(x<<26|R>>>6))>>>0,i=(((x=(O=t[P-15])[0])>>>1|(R=O[1])<<31)^(x>>>8|R<<24)^x>>>7)>>>0,s=((x<<31|R>>>1)^(x<<24|R>>>8)^(x<<25|R>>>7))>>>0,L=t[P-7],D=t[P-16],R=o+L[1]+s+D[1],t[P][0]=n+L[0]+i+D[0]+(R/4294967296>>>0)>>>0,t[P][1]=R>>>0;for(h=e[0][0],m=e[0][1],g=e[1][0],v=e[1][1],y=e[2][0],b=e[2][1],C=e[3][0],w=e[3][1],k=e[4][0],B=e[4][1],E=e[5][0],S=e[5][1],A=e[6][0],_=e[6][1],I=e[7][0],T=e[7][1],P=0;P<80;++P)u=((k>>>14|B<<18)^(k>>>18|B<<14)^(B>>>9|k<<23))>>>0,d=(A^k&(E^A))>>>0,c=((h>>>28|m<<4)^(m>>>2|h<<30)^(m>>>7|h<<25))>>>0,l=((h<<4|m>>>28)^(m<<30|h>>>2)^(m<<25|h>>>7))>>>0,f=(h&g|y&(h^g))>>>0,p=(m&v|b&(m^v))>>>0,R=T+(((k<<18|B>>>14)^(k<<14|B>>>18)^(B<<23|k>>>9))>>>0)+((_^B&(S^_))>>>0)+a[P][1]+t[P][1],n=I+u+d+a[P][0]+t[P][0]+(R/4294967296>>>0)>>>0,o=R>>>0,i=c+f+((R=l+p)/4294967296>>>0)>>>0,s=R>>>0,I=A,T=_,A=E,_=S,E=k,S=B,k=C+n+((R=w+o)/4294967296>>>0)>>>0,B=R>>>0,C=y,w=b,y=g,b=v,g=h,v=m,h=n+i+((R=o+s)/4294967296>>>0)>>>0,m=R>>>0;R=e[0][1]+m,e[0][0]=e[0][0]+h+(R/4294967296>>>0)>>>0,e[0][1]=R>>>0,R=e[1][1]+v,e[1][0]=e[1][0]+g+(R/4294967296>>>0)>>>0,e[1][1]=R>>>0,R=e[2][1]+b,e[2][0]=e[2][0]+y+(R/4294967296>>>0)>>>0,e[2][1]=R>>>0,R=e[3][1]+w,e[3][0]=e[3][0]+C+(R/4294967296>>>0)>>>0,e[3][1]=R>>>0,R=e[4][1]+B,e[4][0]=e[4][0]+k+(R/4294967296>>>0)>>>0,e[4][1]=R>>>0,R=e[5][1]+S,e[5][0]=e[5][0]+E+(R/4294967296>>>0)>>>0,e[5][1]=R>>>0,R=e[6][1]+_,e[6][0]=e[6][0]+A+(R/4294967296>>>0)>>>0,e[6][1]=R>>>0,R=e[7][1]+T,e[7][0]=e[7][0]+I+(R/4294967296>>>0)>>>0,e[7][1]=R>>>0,M-=128}}}));var lr=V.asn1,ur={privateKeyValidator:{name:"PrivateKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:lr.Class.UNIVERSAL,type:lr.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},publicKeyValidator:{name:"SubjectPublicKeyInfo",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:lr.Class.UNIVERSAL,type:lr.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:lr.Class.UNIVERSAL,type:lr.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:lr.Class.UNIVERSAL,type:lr.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}},dr=ur.publicKeyValidator,fr=ur.privateKeyValidator;if(void 0===pr)var pr=V.jsbn.BigInteger;var hr=V.util.ByteBuffer,mr="undefined"==typeof Buffer?Uint8Array:Buffer;V.pki=V.pki||{},V.pki.ed25519=V.ed25519=V.ed25519||{};var gr=V.ed25519;function vr(e){var t=e.message;if(t instanceof Uint8Array||t instanceof mr)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new hr(t,r)}else if(!(t instanceof hr))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new mr(t.length()),o=0;o<n.length;++o)n[o]=t.at(o);return n}gr.constants={},gr.constants.PUBLIC_KEY_BYTE_LENGTH=32,gr.constants.PRIVATE_KEY_BYTE_LENGTH=64,gr.constants.SEED_BYTE_LENGTH=32,gr.constants.SIGN_BYTE_LENGTH=64,gr.constants.HASH_BYTE_LENGTH=64,gr.generateKeyPair=function(e){var t=(e=e||{}).seed;if(void 0===t)t=V.random.getBytesSync(gr.constants.SEED_BYTE_LENGTH);else if("string"==typeof t){if(t.length!==gr.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+gr.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=vr({message:t,encoding:"binary"});for(var r=new mr(gr.constants.PUBLIC_KEY_BYTE_LENGTH),n=new mr(gr.constants.PRIVATE_KEY_BYTE_LENGTH),o=0;o<32;++o)n[o]=t[o];return function(e,t){var r,n=[Vr(),Vr(),Vr(),Vr()],o=Ar(t,32);for(o[0]&=248,o[31]&=127,o[31]|=64,Mr(n,o),xr(e,n),r=0;r<32;++r)t[r+32]=e[r]}(r,n),{publicKey:r,privateKey:n}},gr.privateKeyFromAsn1=function(e){var t={},r=[];if(!V.asn1.validate(e,fr,t,r)){var n=new Error("Invalid Key.");throw n.errors=r,n}var o=V.asn1.derToOid(t.privateKeyOid),a=V.oids.EdDSA25519;if(o!==a)throw new Error('Invalid OID "'+o+'"; OID must be "'+a+'".');var i=t.privateKey;return{privateKeyBytes:vr({message:V.asn1.fromDer(i).value,encoding:"binary"})}},gr.publicKeyFromAsn1=function(e){var t={},r=[];if(!V.asn1.validate(e,dr,t,r)){var n=new Error("Invalid Key.");throw n.errors=r,n}var o=V.asn1.derToOid(t.publicKeyOid),a=V.oids.EdDSA25519;if(o!==a)throw new Error('Invalid OID "'+o+'"; OID must be "'+a+'".');var i=t.ed25519PublicKey;if(i.length!==gr.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return vr({message:i,encoding:"binary"})},gr.publicKeyFromPrivateKey=function(e){var t=vr({message:(e=e||{}).privateKey,encoding:"binary"});if(t.length!==gr.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+gr.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new mr(gr.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<r.length;++n)r[n]=t[32+n];return r},gr.sign=function(e){var t=vr(e=e||{}),r=vr({message:e.privateKey,encoding:"binary"});if(r.length===gr.constants.SEED_BYTE_LENGTH)r=gr.generateKeyPair({seed:r}).privateKey;else if(r.length!==gr.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+gr.constants.SEED_BYTE_LENGTH+" or "+gr.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length);!function(e,t,r,n){var o,a,i=new Float64Array(64),s=[Vr(),Vr(),Vr(),Vr()],c=Ar(n,32);for(c[0]&=248,c[31]&=127,c[31]|=64,o=0;o<r;++o)e[64+o]=t[o];for(o=0;o<32;++o)e[32+o]=c[32+o];var l=Ar(e.subarray(32),r+32);for(Ir(l),Mr(s,l),xr(e,s),o=32;o<64;++o)e[o]=n[o];var u=Ar(e,r+64);for(Ir(u),o=32;o<64;++o)i[o]=0;for(o=0;o<32;++o)i[o]=l[o];for(o=0;o<32;++o)for(a=0;a<32;a++)i[o+a]+=u[o]*c[a];_r(e.subarray(32),i)}(n,t,t.length,r);for(var o=new mr(gr.constants.SIGN_BYTE_LENGTH),a=0;a<o.length;++a)o[a]=n[a];return o},gr.verify=function(e){var t=vr(e=e||{});if(void 0===e.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=vr({message:e.signature,encoding:"binary"});if(r.length!==gr.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+gr.constants.SIGN_BYTE_LENGTH);var n=vr({message:e.publicKey,encoding:"binary"});if(n.length!==gr.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+gr.constants.PUBLIC_KEY_BYTE_LENGTH);var o,a=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length),i=new mr(gr.constants.SIGN_BYTE_LENGTH+t.length);for(o=0;o<gr.constants.SIGN_BYTE_LENGTH;++o)a[o]=r[o];for(o=0;o<t.length;++o)a[o+gr.constants.SIGN_BYTE_LENGTH]=t[o];return function(e,t,r,n){var o,a=new mr(32),i=[Vr(),Vr(),Vr(),Vr()],s=[Vr(),Vr(),Vr(),Vr()];if(r<64)return-1;if(function(e,t){var r=Vr(),n=Vr(),o=Vr(),a=Vr(),i=Vr(),s=Vr(),c=Vr();return Ur(e[2],br),function(e,t){var r;for(r=0;r<16;++r)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(e[1],t),Hr(o,e[1]),qr(a,o,Cr),Kr(o,o,e[2]),zr(a,e[2],a),Hr(i,a),Hr(s,i),qr(c,s,i),qr(r,c,o),qr(r,r,a),function(e,t){var r,n=Vr();for(r=0;r<16;++r)n[r]=t[r];for(r=250;r>=0;--r)Hr(n,n),1!==r&&qr(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),qr(r,r,o),qr(r,r,a),qr(r,r,a),qr(e[0],r,a),Hr(n,e[0]),qr(n,n,a),Nr(n,o)&&qr(e[0],e[0],Sr),Hr(n,e[0]),qr(n,n,a),Nr(n,o)?-1:(Or(e[0])===t[31]>>7&&Kr(e[0],yr,e[0]),qr(e[3],e[0],e[1]),0)}(s,n))return-1;for(o=0;o<r;++o)e[o]=t[o];for(o=0;o<32;++o)e[o+32]=n[o];var c=Ar(e,r);if(Ir(c),Dr(i,s,c),Mr(s,t.subarray(32)),Tr(i,s),xr(a,i),r-=64,Lr(t,0,a,0)){for(o=0;o<r;++o)e[o]=0;return-1}for(o=0;o<r;++o)e[o]=t[o+64];return r}(i,a,a.length,n)>=0};var yr=Vr(),br=Vr([1]),Cr=Vr([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),wr=Vr([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),kr=Vr([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Br=Vr([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Er=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),Sr=Vr([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Ar(e,t){var r=V.md.sha512.create(),n=new hr(e);r.update(n.getBytes(t),"binary");var o=r.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(o,"binary");for(var a=new mr(gr.constants.HASH_BYTE_LENGTH),i=0;i<64;++i)a[i]=o.charCodeAt(i);return a}function _r(e,t){var r,n,o,a;for(n=63;n>=32;--n){for(r=0,o=n-32,a=n-12;o<a;++o)t[o]+=r-16*t[n]*Er[o-(n-32)],r=t[o]+128>>8,t[o]-=256*r;t[o]+=r,t[n]=0}for(r=0,o=0;o<32;++o)t[o]+=r-(t[31]>>4)*Er[o],r=t[o]>>8,t[o]&=255;for(o=0;o<32;++o)t[o]-=r*Er[o];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function Ir(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;_r(e,t)}function Tr(e,t){var r=Vr(),n=Vr(),o=Vr(),a=Vr(),i=Vr(),s=Vr(),c=Vr(),l=Vr(),u=Vr();Kr(r,e[1],e[0]),Kr(u,t[1],t[0]),qr(r,r,u),zr(n,e[0],e[1]),zr(u,t[0],t[1]),qr(n,n,u),qr(o,e[3],t[3]),qr(o,o,wr),qr(a,e[2],t[2]),zr(a,a,a),Kr(i,n,r),Kr(s,a,o),zr(c,a,o),zr(l,n,r),qr(e[0],i,s),qr(e[1],l,c),qr(e[2],c,s),qr(e[3],i,l)}function Pr(e,t,r){for(var n=0;n<4;++n)jr(e[n],t[n],r)}function xr(e,t){var r=Vr(),n=Vr(),o=Vr();!function(e,t){var r,n=Vr();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)Hr(n,n),2!==r&&4!==r&&qr(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(o,t[2]),qr(r,t[0],o),qr(n,t[1],o),Rr(e,n),e[31]^=Or(r)<<7}function Rr(e,t){var r,n,o,a=Vr(),i=Vr();for(r=0;r<16;++r)i[r]=t[r];for(Fr(i),Fr(i),Fr(i),n=0;n<2;++n){for(a[0]=i[0]-65517,r=1;r<15;++r)a[r]=i[r]-65535-(a[r-1]>>16&1),a[r-1]&=65535;a[15]=i[15]-32767-(a[14]>>16&1),o=a[15]>>16&1,a[14]&=65535,jr(i,a,1-o)}for(r=0;r<16;r++)e[2*r]=255&i[r],e[2*r+1]=i[r]>>8}function Nr(e,t){var r=new mr(32),n=new mr(32);return Rr(r,e),Rr(n,t),Lr(r,0,n,0)}function Lr(e,t,r,n){return function(e,t,r,n,o){var a,i=0;for(a=0;a<32;++a)i|=e[t+a]^r[n+a];return(1&i-1>>>8)-1}(e,t,r,n)}function Or(e){var t=new mr(32);return Rr(t,e),1&t[0]}function Dr(e,t,r){var n,o;for(Ur(e[0],yr),Ur(e[1],br),Ur(e[2],br),Ur(e[3],yr),o=255;o>=0;--o)Pr(e,t,n=r[o/8|0]>>(7&o)&1),Tr(t,e),Tr(e,e),Pr(e,t,n)}function Mr(e,t){var r=[Vr(),Vr(),Vr(),Vr()];Ur(r[0],kr),Ur(r[1],Br),Ur(r[2],br),qr(r[3],kr,Br),Dr(e,r,t)}function Ur(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function Fr(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function jr(e,t,r){for(var n,o=~(r-1),a=0;a<16;++a)n=o&(e[a]^t[a]),e[a]^=n,t[a]^=n}function Vr(e){var t,r=new Float64Array(16);if(e)for(t=0;t<e.length;++t)r[t]=e[t];return r}function zr(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]+r[n]}function Kr(e,t,r){for(var n=0;n<16;++n)e[n]=t[n]-r[n]}function Hr(e,t){qr(e,t,t)}function qr(e,t,r){var n,o,a=0,i=0,s=0,c=0,l=0,u=0,d=0,f=0,p=0,h=0,m=0,g=0,v=0,y=0,b=0,C=0,w=0,k=0,B=0,E=0,S=0,A=0,_=0,I=0,T=0,P=0,x=0,R=0,N=0,L=0,O=0,D=r[0],M=r[1],U=r[2],F=r[3],j=r[4],V=r[5],z=r[6],K=r[7],H=r[8],q=r[9],Q=r[10],W=r[11],G=r[12],X=r[13],Y=r[14],$=r[15];a+=(n=t[0])*D,i+=n*M,s+=n*U,c+=n*F,l+=n*j,u+=n*V,d+=n*z,f+=n*K,p+=n*H,h+=n*q,m+=n*Q,g+=n*W,v+=n*G,y+=n*X,b+=n*Y,C+=n*$,i+=(n=t[1])*D,s+=n*M,c+=n*U,l+=n*F,u+=n*j,d+=n*V,f+=n*z,p+=n*K,h+=n*H,m+=n*q,g+=n*Q,v+=n*W,y+=n*G,b+=n*X,C+=n*Y,w+=n*$,s+=(n=t[2])*D,c+=n*M,l+=n*U,u+=n*F,d+=n*j,f+=n*V,p+=n*z,h+=n*K,m+=n*H,g+=n*q,v+=n*Q,y+=n*W,b+=n*G,C+=n*X,w+=n*Y,k+=n*$,c+=(n=t[3])*D,l+=n*M,u+=n*U,d+=n*F,f+=n*j,p+=n*V,h+=n*z,m+=n*K,g+=n*H,v+=n*q,y+=n*Q,b+=n*W,C+=n*G,w+=n*X,k+=n*Y,B+=n*$,l+=(n=t[4])*D,u+=n*M,d+=n*U,f+=n*F,p+=n*j,h+=n*V,m+=n*z,g+=n*K,v+=n*H,y+=n*q,b+=n*Q,C+=n*W,w+=n*G,k+=n*X,B+=n*Y,E+=n*$,u+=(n=t[5])*D,d+=n*M,f+=n*U,p+=n*F,h+=n*j,m+=n*V,g+=n*z,v+=n*K,y+=n*H,b+=n*q,C+=n*Q,w+=n*W,k+=n*G,B+=n*X,E+=n*Y,S+=n*$,d+=(n=t[6])*D,f+=n*M,p+=n*U,h+=n*F,m+=n*j,g+=n*V,v+=n*z,y+=n*K,b+=n*H,C+=n*q,w+=n*Q,k+=n*W,B+=n*G,E+=n*X,S+=n*Y,A+=n*$,f+=(n=t[7])*D,p+=n*M,h+=n*U,m+=n*F,g+=n*j,v+=n*V,y+=n*z,b+=n*K,C+=n*H,w+=n*q,k+=n*Q,B+=n*W,E+=n*G,S+=n*X,A+=n*Y,_+=n*$,p+=(n=t[8])*D,h+=n*M,m+=n*U,g+=n*F,v+=n*j,y+=n*V,b+=n*z,C+=n*K,w+=n*H,k+=n*q,B+=n*Q,E+=n*W,S+=n*G,A+=n*X,_+=n*Y,I+=n*$,h+=(n=t[9])*D,m+=n*M,g+=n*U,v+=n*F,y+=n*j,b+=n*V,C+=n*z,w+=n*K,k+=n*H,B+=n*q,E+=n*Q,S+=n*W,A+=n*G,_+=n*X,I+=n*Y,T+=n*$,m+=(n=t[10])*D,g+=n*M,v+=n*U,y+=n*F,b+=n*j,C+=n*V,w+=n*z,k+=n*K,B+=n*H,E+=n*q,S+=n*Q,A+=n*W,_+=n*G,I+=n*X,T+=n*Y,P+=n*$,g+=(n=t[11])*D,v+=n*M,y+=n*U,b+=n*F,C+=n*j,w+=n*V,k+=n*z,B+=n*K,E+=n*H,S+=n*q,A+=n*Q,_+=n*W,I+=n*G,T+=n*X,P+=n*Y,x+=n*$,v+=(n=t[12])*D,y+=n*M,b+=n*U,C+=n*F,w+=n*j,k+=n*V,B+=n*z,E+=n*K,S+=n*H,A+=n*q,_+=n*Q,I+=n*W,T+=n*G,P+=n*X,x+=n*Y,R+=n*$,y+=(n=t[13])*D,b+=n*M,C+=n*U,w+=n*F,k+=n*j,B+=n*V,E+=n*z,S+=n*K,A+=n*H,_+=n*q,I+=n*Q,T+=n*W,P+=n*G,x+=n*X,R+=n*Y,N+=n*$,b+=(n=t[14])*D,C+=n*M,w+=n*U,k+=n*F,B+=n*j,E+=n*V,S+=n*z,A+=n*K,_+=n*H,I+=n*q,T+=n*Q,P+=n*W,x+=n*G,R+=n*X,N+=n*Y,L+=n*$,C+=(n=t[15])*D,i+=38*(k+=n*U),s+=38*(B+=n*F),c+=38*(E+=n*j),l+=38*(S+=n*V),u+=38*(A+=n*z),d+=38*(_+=n*K),f+=38*(I+=n*H),p+=38*(T+=n*q),h+=38*(P+=n*Q),m+=38*(x+=n*W),g+=38*(R+=n*G),v+=38*(N+=n*X),y+=38*(L+=n*Y),b+=38*(O+=n*$),a=(n=(a+=38*(w+=n*M))+(o=1)+65535)-65536*(o=Math.floor(n/65536)),i=(n=i+o+65535)-65536*(o=Math.floor(n/65536)),s=(n=s+o+65535)-65536*(o=Math.floor(n/65536)),c=(n=c+o+65535)-65536*(o=Math.floor(n/65536)),l=(n=l+o+65535)-65536*(o=Math.floor(n/65536)),u=(n=u+o+65535)-65536*(o=Math.floor(n/65536)),d=(n=d+o+65535)-65536*(o=Math.floor(n/65536)),f=(n=f+o+65535)-65536*(o=Math.floor(n/65536)),p=(n=p+o+65535)-65536*(o=Math.floor(n/65536)),h=(n=h+o+65535)-65536*(o=Math.floor(n/65536)),m=(n=m+o+65535)-65536*(o=Math.floor(n/65536)),g=(n=g+o+65535)-65536*(o=Math.floor(n/65536)),v=(n=v+o+65535)-65536*(o=Math.floor(n/65536)),y=(n=y+o+65535)-65536*(o=Math.floor(n/65536)),b=(n=b+o+65535)-65536*(o=Math.floor(n/65536)),C=(n=C+o+65535)-65536*(o=Math.floor(n/65536)),a=(n=(a+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(n/65536)),i=(n=i+o+65535)-65536*(o=Math.floor(n/65536)),s=(n=s+o+65535)-65536*(o=Math.floor(n/65536)),c=(n=c+o+65535)-65536*(o=Math.floor(n/65536)),l=(n=l+o+65535)-65536*(o=Math.floor(n/65536)),u=(n=u+o+65535)-65536*(o=Math.floor(n/65536)),d=(n=d+o+65535)-65536*(o=Math.floor(n/65536)),f=(n=f+o+65535)-65536*(o=Math.floor(n/65536)),p=(n=p+o+65535)-65536*(o=Math.floor(n/65536)),h=(n=h+o+65535)-65536*(o=Math.floor(n/65536)),m=(n=m+o+65535)-65536*(o=Math.floor(n/65536)),g=(n=g+o+65535)-65536*(o=Math.floor(n/65536)),v=(n=v+o+65535)-65536*(o=Math.floor(n/65536)),y=(n=y+o+65535)-65536*(o=Math.floor(n/65536)),b=(n=b+o+65535)-65536*(o=Math.floor(n/65536)),C=(n=C+o+65535)-65536*(o=Math.floor(n/65536)),a+=o-1+37*(o-1),e[0]=a,e[1]=i,e[2]=s,e[3]=c,e[4]=l,e[5]=u,e[6]=d,e[7]=f,e[8]=p,e[9]=h,e[10]=m,e[11]=g,e[12]=v,e[13]=y,e[14]=b,e[15]=C}V.kem=V.kem||{};var Qr=V.jsbn.BigInteger;function Wr(e,t,r,n){e.generate=function(e,o){for(var a=new V.util.ByteBuffer,i=Math.ceil(o/n)+r,s=new V.util.ByteBuffer,c=r;c<i;++c){s.putInt32(c),t.start(),t.update(e+s.getBytes());var l=t.digest();a.putBytes(l.getBytes(n))}return a.truncate(a.length()-o),a.getBytes()}}V.kem.rsa={},V.kem.rsa.create=function(e,t){var r=(t=t||{}).prng||V.random;return{encrypt:function(t,n){var o,a=Math.ceil(t.n.bitLength()/8);do{o=new Qr(V.util.bytesToHex(r.getBytesSync(a)),16).mod(t.n)}while(o.compareTo(Qr.ONE)<=0);var i=a-(o=V.util.hexToBytes(o.toString(16))).length;return i>0&&(o=V.util.fillString(String.fromCharCode(0),i)+o),{encapsulation:t.encrypt(o,"NONE"),key:e.generate(o,n)}},decrypt:function(t,r,n){var o=t.decrypt(r,"NONE");return e.generate(o,n)}}},V.kem.kdf1=function(e,t){Wr(this,e,0,t||e.digestLength)},V.kem.kdf2=function(e,t){Wr(this,e,1,t||e.digestLength)},V.log=V.log||{},V.log.levels=["none","error","warning","info","debug","verbose","max"];var Gr={},Xr=[],Yr=null;V.log.LEVEL_LOCKED=2,V.log.NO_LEVEL_CHECK=4,V.log.INTERPOLATE=8;for(var $r=0;$r<V.log.levels.length;++$r){var Zr=V.log.levels[$r];Gr[Zr]={index:$r,name:Zr.toUpperCase()}}V.log.logMessage=function(e){for(var t=Gr[e.level].index,r=0;r<Xr.length;++r){var n=Xr[r];n.flags&V.log.NO_LEVEL_CHECK?n.f(e):t<=Gr[n.level].index&&n.f(n,e)}},V.log.prepareStandard=function(e){"standard"in e||(e.standard=Gr[e.level].name+" ["+e.category+"] "+e.message)},V.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]||e.arguments),e.full=V.util.format.apply(this,t)}},V.log.prepareStandardFull=function(e){"standardFull"in e||(V.log.prepareStandard(e),e.standardFull=e.standard)};var Jr=["error","warning","info","debug","verbose"];for($r=0;$r<Jr.length;++$r)!function(e){V.log[e]=function(t,r){var n=Array.prototype.slice.call(arguments).slice(2),o={timestamp:new Date,level:e,category:t,message:r,arguments:n};V.log.logMessage(o)}}(Jr[$r]);if(V.log.makeLogger=function(e){var t={flags:0,f:e};return V.log.setLevel(t,"none"),t},V.log.setLevel=function(e,t){var r=!1;if(e&&!(e.flags&V.log.LEVEL_LOCKED))for(var n=0;n<V.log.levels.length;++n)if(t==V.log.levels[n]){e.level=t,r=!0;break}return r},V.log.lock=function(e,t){void 0===t||t?e.flags|=V.log.LEVEL_LOCKED:e.flags&=~V.log.LEVEL_LOCKED},V.log.addLogger=function(e){Xr.push(e)},"undefined"!=typeof console&&"log"in console){var en;if(console.error&&console.warn&&console.info&&console.debug){var tn={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},rn=function(e,t){V.log.prepareStandard(t);var r=tn[t.level],n=[t.standard];n=n.concat(t.arguments.slice()),r.apply(console,n)};en=V.log.makeLogger(rn)}else rn=function(e,t){V.log.prepareStandardFull(t),console.log(t.standardFull)},en=V.log.makeLogger(rn);V.log.setLevel(en,"debug"),V.log.addLogger(en),Yr=en}else console={log:function(){}};if(null!==Yr){var nn=V.util.getQueryVariables();"console.level"in nn&&V.log.setLevel(Yr,nn["console.level"].slice(-1)[0]),"console.lock"in nn&&"true"==nn["console.lock"].slice(-1)[0]&&V.log.lock(Yr)}V.log.consoleLogger=Yr,C((function(e){var t=V.asn1,r=e.exports=V.pkcs7=V.pkcs7||{};function n(e){var n={},o=[];if(!t.validate(e,r.asn1.recipientInfoValidator,n,o)){var a=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw a.errors=o,a}return{version:n.version.charCodeAt(0),issuer:V.pki.RDNAttributesAsArray(n.issuer),serialNumber:V.util.createBuffer(n.serial).toHex(),encryptedContent:{algorithm:t.derToOid(n.encAlgorithm),parameter:n.encParameter.value,content:n.encKey}}}function o(e){for(var r,n=[],o=0;o<e.length;++o)n.push((r=e[o],t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(r.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[V.pki.distinguishedNameToAsn1({attributes:r.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,V.util.hexToBytes(r.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.encryptedContent.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.encryptedContent.content)])));return n}function a(e){var r=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[V.pki.distinguishedNameToAsn1({attributes:e.issuer}),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,V.util.hexToBytes(e.serialNumber))]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.digestAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&r.value.push(e.authenticatedAttributesAsn1),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.signatureAlgorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),r.value.push(t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var n=t.create(t.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o<e.unauthenticatedAttributes.length;++o){var a=e.unauthenticatedAttributes[o];n.values.push(i(a))}r.value.push(n)}return r}function i(e){var r;if(e.type===V.pki.oids.contentType)r=t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.value).getBytes());else if(e.type===V.pki.oids.messageDigest)r=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===V.pki.oids.signingTime){var n=new Date("1950-01-01T00:00:00Z"),o=new Date("2050-01-01T00:00:00Z"),a=e.value;if("string"==typeof a){var i=Date.parse(a);a=isNaN(i)?13===a.length?t.utcTimeToDate(a):t.generalizedTimeToDate(a):new Date(i)}r=a>=n&&a<o?t.create(t.Class.UNIVERSAL,t.Type.UTCTIME,!1,t.dateToUtcTime(a)):t.create(t.Class.UNIVERSAL,t.Type.GENERALIZEDTIME,!1,t.dateToGeneralizedTime(a))}return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[r])])}function s(e,r,n){var o={};if(!t.validate(r,n,o,[])){var a=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw a.errors=a,a}if(t.derToOid(o.contentType)!==V.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(o.encryptedContent){var i="";if(V.util.isArray(o.encryptedContent))for(var s=0;s<o.encryptedContent.length;++s){if(o.encryptedContent[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");i+=o.encryptedContent[s].value}else i=o.encryptedContent;e.encryptedContent={algorithm:t.derToOid(o.encAlgorithm),parameter:V.util.createBuffer(o.encParameter.value),content:V.util.createBuffer(i)}}if(o.content){if(i="",V.util.isArray(o.content))for(s=0;s<o.content.length;++s){if(o.content[s].type!==t.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");i+=o.content[s].value}else i=o.content;e.content=V.util.createBuffer(i)}return e.version=o.version.charCodeAt(0),e.rawCapture=o,o}function c(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case V.pki.oids["aes128-CBC"]:case V.pki.oids["aes192-CBC"]:case V.pki.oids["aes256-CBC"]:t=V.aes.createDecryptionCipher(e.encryptedContent.key);break;case V.pki.oids.desCBC:case V.pki.oids["des-EDE3-CBC"]:t=V.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}r.messageFromPem=function(e){var n=V.pem.decode(e)[0];if("PKCS7"!==n.type){var o=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var a=t.fromDer(n.body);return r.messageFromAsn1(a)},r.messageToPem=function(e,r){var n={type:"PKCS7",body:t.toDer(e.toAsn1()).getBytes()};return V.pem.encode(n,{maxline:r})},r.messageFromAsn1=function(e){var n={},o=[];if(!t.validate(e,r.asn1.contentInfoValidator,n,o)){var a=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw a.errors=o,a}var i,s=t.derToOid(n.contentType);switch(s){case V.pki.oids.envelopedData:i=r.createEnvelopedData();break;case V.pki.oids.encryptedData:i=r.createEncryptedData();break;case V.pki.oids.signedData:i=r.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return i.fromAsn1(n.content.value[0]),i},r.createSignedData=function(){var e=null;return e={type:V.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(s(e,t,r.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var n=e.rawCapture.certificates.value,o=0;o<n.length;++o)e.certificates.push(V.pki.certificateFromAsn1(n[o]))},toAsn1:function(){e.contentInfo||e.sign();for(var r=[],n=0;n<e.certificates.length;++n)r.push(V.pki.certificateToAsn1(e.certificates[n]));var o=[],a=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return r.length>0&&a.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,r)),o.length>0&&a.value[0].value.push(t.create(t.Class.CONTEXT_SPECIFIC,1,!0,o)),a.value[0].value.push(t.create(t.Class.UNIVERSAL,t.Type.SET,!0,e.signerInfos)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),a])},addSigner:function(t){var r=t.issuer,n=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=V.pki.certificateFromPem(o)),r=o.issuer.attributes,n=o.serialNumber}var a=t.key;if(!a)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof a&&(a=V.pki.privateKeyFromPem(a));var i=t.digestAlgorithm||V.pki.oids.sha1;switch(i){case V.pki.oids.sha1:case V.pki.oids.sha256:case V.pki.oids.sha384:case V.pki.oids.sha512:case V.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+i)}var s=t.authenticatedAttributes||[];if(s.length>0){for(var c=!1,l=!1,u=0;u<s.length;++u){var d=s[u];if(c||d.type!==V.pki.oids.contentType){if(l||d.type!==V.pki.oids.messageDigest);else if(l=!0,c)break}else if(c=!0,l)break}if(!c||!l)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:a,version:1,issuer:r,serialNumber:n,digestAlgorithm:i,signatureAlgorithm:V.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:s,unauthenticatedAttributes:[]})},sign:function(r){var n;r=r||{},("object"!=w(e.content)||null===e.contentInfo)&&(e.contentInfo=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(V.pki.oids.data).getBytes())]),"content"in e&&(e.content instanceof V.util.ByteBuffer?n=e.content.bytes():"string"==typeof e.content&&(n=V.util.encodeUtf8(e.content)),r.detached?e.detachedContent=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n):e.contentInfo.value.push(t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,n)])))),0!==e.signers.length&&function(r){var n;if(!(n=e.detachedContent?e.detachedContent:(n=e.contentInfo.value[1]).value[0]))throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var o=t.derToOid(e.contentInfo.value[0].value),s=t.toDer(n);for(var c in s.getByte(),t.getBerValueLength(s),s=s.getBytes(),r)r[c].start().update(s);for(var l=new Date,u=0;u<e.signers.length;++u){var d=e.signers[u];if(0===d.authenticatedAttributes.length){if(o!==V.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{d.authenticatedAttributesAsn1=t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=t.create(t.Class.UNIVERSAL,t.Type.SET,!0,[]),p=0;p<d.authenticatedAttributes.length;++p){var h=d.authenticatedAttributes[p];h.type===V.pki.oids.messageDigest?h.value=r[d.digestAlgorithm].digest():h.type===V.pki.oids.signingTime&&(h.value||(h.value=l)),f.value.push(i(h)),d.authenticatedAttributesAsn1.value.push(i(h))}s=t.toDer(f).getBytes(),d.md.start().update(s)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(a(e[r]));return t}(e.signers)}(function(){for(var r={},n=0;n<e.signers.length;++n){var o=e.signers[n];(a=o.digestAlgorithm)in r||(r[a]=V.md[V.pki.oids[a]].create()),0===o.authenticatedAttributes.length?o.md=r[a]:o.md=V.md[V.pki.oids[a]].create()}for(var a in e.digestAlgorithmIdentifiers=[],r)e.digestAlgorithmIdentifiers.push(t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(a).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]));return r}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"==typeof t&&(t=V.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},r.createEncryptedData=function(){var e=null;return e={type:V.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:V.pki.oids["aes256-CBC"]},fromAsn1:function(t){s(e,t,r.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),c(e)}}},r.createEnvelopedData=function(){var e=null;return e={type:V.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:V.pki.oids["aes256-CBC"]},fromAsn1:function(t){var o=s(e,t,r.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(n(e[r]));return t}(o.recipientInfos.value)},toAsn1:function(){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(e.type).getBytes()),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(e.version).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SET,!0,o(e.recipients)),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,(r=e.encryptedContent,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(V.pki.oids.data).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(r.algorithm).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.parameter.getBytes())]),t.create(t.Class.CONTEXT_SPECIFIC,0,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,r.content.getBytes())])]))])])]);var r},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var o=e.recipients[n],a=o.issuer;if(o.serialNumber===t.serialNumber&&a.length===r.length){for(var i=!0,s=0;s<r.length;++s)if(a[s].type!==r[s].type||a[s].value!==r[s].value){i=!1;break}if(i)return o}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case V.pki.oids.rsaEncryption:case V.pki.oids.desCBC:var n=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=V.util.createBuffer(n);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}c(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:V.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var n,o,a;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case V.pki.oids["aes128-CBC"]:n=16,o=16,a=V.aes.createEncryptionCipher;break;case V.pki.oids["aes192-CBC"]:n=24,o=16,a=V.aes.createEncryptionCipher;break;case V.pki.oids["aes256-CBC"]:n=32,o=16,a=V.aes.createEncryptionCipher;break;case V.pki.oids["des-EDE3-CBC"]:n=24,o=8,a=V.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=V.util.createBuffer(V.random.getBytes(n));else if(t.length()!=n)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+n+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=V.util.createBuffer(V.random.getBytes(o));var i=a(t);if(i.start(e.encryptedContent.parameter.copy()),i.update(e.content),!i.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=i.output}for(var s=0;s<e.recipients.length;++s){var c=e.recipients[s];if(void 0===c.encryptedContent.content)switch(c.encryptedContent.algorithm){case V.pki.oids.rsaEncryption:c.encryptedContent.content=c.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm)}}}}}})),C((function(e){var t=e.exports=V.ssh=V.ssh||{};function r(e,t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var n=V.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function n(e,t){e.putInt32(t.length),e.putString(t)}function o(){for(var e=V.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}t.privateKeyToPutty=function(e,t,a){var i=""===(t=t||"")?"none":"aes256-cbc",s="PuTTY-User-Key-File-2: ssh-rsa\r\n";s+="Encryption: "+i+"\r\n",s+="Comment: "+(a=a||"")+"\r\n";var c=V.util.createBuffer();n(c,"ssh-rsa"),r(c,e.e),r(c,e.n);var l=V.util.encode64(c.bytes(),64),u=Math.floor(l.length/66)+1;s+="Public-Lines: "+u+"\r\n",s+=l;var d,f=V.util.createBuffer();if(r(f,e.d),r(f,e.p),r(f,e.q),r(f,e.qInv),t){var p=f.length()+16-1;p-=p%16;var h=o(f.bytes());h.truncate(h.length()-p+f.length()),f.putBuffer(h);var m=V.util.createBuffer();m.putBuffer(o("\0\0\0\0",t)),m.putBuffer(o("\0\0\0",t));var g=V.aes.createEncryptionCipher(m.truncate(8),"CBC");g.start(V.util.createBuffer().fillWithByte(0,16)),g.update(f.copy()),g.finish();var v=g.output;v.truncate(16),d=V.util.encode64(v.bytes(),64)}else d=V.util.encode64(f.bytes(),64);s+="\r\nPrivate-Lines: "+(u=Math.floor(d.length/66)+1)+"\r\n",s+=d;var y=o("putty-private-key-file-mac-key",t),b=V.util.createBuffer();n(b,"ssh-rsa"),n(b,i),n(b,a),b.putInt32(c.length()),b.putBuffer(c),b.putInt32(f.length()),b.putBuffer(f);var C=V.hmac.create();return C.start("sha1",y),C.update(b.bytes()),s+"\r\nPrivate-MAC: "+C.digest().toHex()+"\r\n"},t.publicKeyToOpenSSH=function(e,t){t=t||"";var o=V.util.createBuffer();return n(o,"ssh-rsa"),r(o,e.e),r(o,e.n),"ssh-rsa "+V.util.encode64(o.bytes())+" "+t},t.privateKeyToOpenSSH=function(e,t){return t?V.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):V.pki.privateKeyToPem(e)},t.getPublicKeyFingerprint=function(e,t){var o=(t=t||{}).md||V.md.md5.create(),a=V.util.createBuffer();n(a,"ssh-rsa"),r(a,e.e),r(a,e.n),o.start(),o.update(a.getBytes());var i=o.digest();if("hex"===t.encoding){var s=i.toHex();return t.delimiter?s.match(/.{2}/g).join(t.delimiter):s}if("binary"===t.encoding)return i.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return i}}));var on="forge.task",an={},sn=0;V.debug.set(on,"tasks",an);var cn={};V.debug.set(on,"queues",cn);var ln="ready",un="running",dn="blocked",fn="sleeping",pn="done",hn="error",mn={ready:{}};mn.ready.stop=ln,mn.ready.start=un,mn.ready.cancel=pn,mn.ready.fail=hn,mn.running={},mn.running.stop=ln,mn.running.start=un,mn.running.block=dn,mn.running.unblock=un,mn.running.sleep=fn,mn.running.wakeup=un,mn.running.cancel=pn,mn.running.fail=hn,mn.blocked={},mn.blocked.stop=dn,mn.blocked.start=dn,mn.blocked.block=dn,mn.blocked.unblock=dn,mn.blocked.sleep=dn,mn.blocked.wakeup=dn,mn.blocked.cancel=pn,mn.blocked.fail=hn,mn.sleeping={},mn.sleeping.stop=fn,mn.sleeping.start=fn,mn.sleeping.block=fn,mn.sleeping.unblock=fn,mn.sleeping.sleep=fn,mn.sleeping.wakeup=fn,mn.sleeping.cancel=pn,mn.sleeping.fail=hn,mn.done={},mn.done.stop=pn,mn.done.start=pn,mn.done.block=pn,mn.done.unblock=pn,mn.done.sleep=pn,mn.done.wakeup=pn,mn.done.cancel=pn,mn.done.fail=hn,mn.error={},mn.error.stop=hn,mn.error.start=hn,mn.error.block=hn,mn.error.unblock=hn,mn.error.sleep=hn,mn.error.wakeup=hn,mn.error.cancel=hn,mn.error.fail=hn;var gn=function(e){this.id=-1,this.name=e.name||"?",this.parent=e.parent||null,this.run=e.run,this.subtasks=[],this.error=!1,this.state=ln,this.blocks=0,this.timeoutId=null,this.swapTime=null,this.userData=null,this.id=sn++,an[this.id]=this};gn.prototype.debug=function(e){e=e||"",V.log.debug(on,e,"[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",cn)},gn.prototype.next=function(e,t){"function"==typeof e&&(t=e,e=this.name);var r=new gn({run:t,name:e,parent:this});return r.state=un,r.type=this.type,r.successCallback=this.successCallback||null,r.failureCallback=this.failureCallback||null,this.subtasks.push(r),this},gn.prototype.parallel=function(e,t){return V.util.isArray(e)&&(t=e,e=this.name),this.next(e,(function(r){var n=r;n.block(t.length);for(var o=function(e,r){V.task.start({type:e,run:function(e){t[r](e)},success:function(e){n.unblock()},failure:function(e){n.unblock()}})},a=0;a<t.length;a++)o(e+"__parallel-"+r.id+"-"+a,a)}))},gn.prototype.stop=function(){this.state=mn[this.state].stop},gn.prototype.start=function(){this.error=!1,this.state=mn[this.state].start,this.state===un&&(this.start=new Date,this.run(this),vn(this,0))},gn.prototype.block=function(e){e=void 0===e?1:e,this.blocks+=e,this.blocks>0&&(this.state=mn[this.state].block)},gn.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==pn&&(this.state=un,vn(this,0)),this.blocks},gn.prototype.sleep=function(e){e=void 0===e?0:e,this.state=mn[this.state].sleep;var t=this;this.timeoutId=setTimeout((function(){t.timeoutId=null,t.state=un,vn(t,0)}),e)},gn.prototype.wait=function(e){e.wait(this)},gn.prototype.wakeup=function(){this.state===fn&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=un,vn(this,0))},gn.prototype.cancel=function(){this.state=mn[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},gn.prototype.fail=function(e){if(this.error=!0,yn(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,vn(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;yn(t,!0)}this.failureCallback&&this.failureCallback(this)}};var vn=function e(t,r){var n=r>30||+new Date-t.swapTime>20,o=function(r){if(r++,t.state===un)if(n&&(t.swapTime=+new Date),t.subtasks.length>0){var o=t.subtasks.shift();o.error=t.error,o.swapTime=t.swapTime,o.userData=t.userData,o.run(o),o.error||e(o,r)}else yn(t),t.error||null!==t.parent&&(t.parent.error=t.error,t.parent.swapTime=t.swapTime,t.parent.userData=t.userData,e(t.parent,r))};n?setTimeout(o,0):o(r)},yn=function(e,t){e.state=pn,delete an[e.id],null===e.parent&&(e.type in cn?0===cn[e.type].length?V.log.error(on,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):cn[e.type][0]!==e?V.log.error(on,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(cn[e.type].shift(),0===cn[e.type].length?delete cn[e.type]:cn[e.type][0].start()):V.log.error(on,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};V.task=V.task||{},V.task.start=function(e){var t=new gn({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in cn?cn[e.type].push(t):(cn[t.type]=[t],function(e){e.error=!1,e.state=mn[e.state].start,setTimeout((function(){e.state===un&&(e.swapTime=+new Date,e.run(e),vn(e,0))}),0)}(t))},V.task.cancel=function(e){e in cn&&(cn[e]=[cn[e][0]])},V.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e};var bn=V,Cn=function(){function e(e){this.secretKey=e}return e.prototype.encrypt=function(e,t){throw new Error("Method not implemented.")},e.prototype.decrypt=function(e,t){return function(e,t,r){void 0===r&&(r=bn.util.createBuffer(Uint8Array.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]).buffer));var n,o,a=bn.cipher.createDecipher("AES-CBC",t);return a.start({iv:r}),a.update(bn.util.createBuffer(bn.util.hexToBytes(e))),o=(n=a.output.data).charCodeAt(n.length-1),n.slice(0,-o)}(e,(r=this.secretKey,n=t.transactionID,""+r.slice(0,16)+n.slice(0,16)));var r,n},e}(),wn=function(){function e(e,t,n,o){void 0===n&&(n="production"),void 0===o&&(o={supportTransaction:!1,enableEncryption:!1}),this.transactionEnabled=o.supportTransaction||!1,this.encryptionEnabled=o.enableEncryption||!1;var a=D(e,t,n,{headers:o.httpHeaders});this.transactionManager=new j(a),this.encryptionService=new Cn(t),this.compareFaceService=new u(a),this.clientSettingsService=new d(a),this.convertPDFService=new v(a),this.ekycPDFService=new y(a),this.readIDCardService=new r(a),this.requestVerifyIDCardService=new p(a),this.requestVerifyPortraitSerivce=new h(a),this.imagesService=new c(a),this.fileService=new l(a),this.verifyFaceLivenessService=new f(a),this.searchFaceService=new g(a),this.detectIDTamperingService=new m(a),this.httpClient=a}return e.prototype.enableTransaction=function(){this.transactionEnabled=!0},e.prototype.disableTransaction=function(){this.transactionEnabled=!1},e.prototype.enableEncryption=function(){this.encryptionEnabled=!0},e.prototype.disableEncryption=function(){this.encryptionEnabled=!1},e.prototype.compareFaces=function(e,t){return this.compareFaceService.request(e,t)},e.prototype.clientSettings=function(){return this.clientSettingsService.request()},e.prototype.uploadImage=function(e){return this.imagesService.request(e)},e.prototype.uploadFile=function(e){return this.fileService.uploadFile(e)},e.prototype.convertPDF=function(e,t){return this.convertPDFService.request(e,t)},e.prototype.ekycPDF=function(e,t){return this.ekycPDFService.request(e,t)},e.prototype.readIDCard=function(e,t){return this.readIDCardService.request(e,t)},e.prototype.requestVerifyIDCard=function(e,t){return this.requestVerifyIDCardService.request(e,t)},e.prototype.requestVerifyPortrait=function(e,t){return this.requestVerifyPortraitSerivce.request(e,t)},e.prototype.verifyFaceLiveness=function(e,t){return this.verifyFaceLivenessService.request(e,t)},e.prototype.searchFaces=function(e,t){return this.searchFaceService.request(e,t)},e.prototype.deleteFaces=function(e,t){return this.searchFaceService.deleteFaces(e,t)},e.prototype.indexFaces=function(e,t){return this.searchFaceService.indexFaces(e,t)},e.prototype.downloadFaceImage=function(e){return this.searchFaceService.downloadFaceImage(e)},e.prototype.downloadImage=function(e){return this.imagesService.download(e)},e.prototype.updateMetadata=function(e,t){return this.imagesService.updateMetadata(e,t)},e.prototype.detectIDTampering=function(e,t){return this.detectIDTamperingService.request(e,t)},o([U({headerIndex:1}),F(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"compareFaces",null),o([U({headerIndex:1}),F(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"convertPDF",null),o([U({headerIndex:1}),F(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"readIDCard",null),o([U({headerIndex:1}),F(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"requestVerifyIDCard",null),o([U({headerIndex:1}),F(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"requestVerifyPortrait",null),o([U({headerIndex:1}),F(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"verifyFaceLiveness",null),o([U({headerIndex:1}),F(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"searchFaces",null),o([U({headerIndex:1}),F(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"deleteFaces",null),o([U({headerIndex:1}),F(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"indexFaces",null),o([U({headerIndex:1}),F(),a("design:type",Function),a("design:paramtypes",[Object,Object]),a("design:returntype",Promise)],e.prototype,"detectIDTampering",null),e}();e.ReadIDCard=r,e.UploadImage=c,e.UploadFile=l,e.CompareFaces=u,e.ClientSettings=d,e.VerifyFaceLiveness=f,e.RequestVerifyIDCard=p,e.RequestVerifyPortrait=h,e.DetectIDTampering=m,e.SearchFaces=g,e.ConvertPDF=v,e.EkycPDF=y,e.HttpClient=T,e.MockClient=P,e.TVAuthorizer=L,e.createHelpers=function(e,t,r){void 0===r&&(r="production");var n=new L(e,t),o=function(e){switch(e){case"testing":return"https://tv-testing.trustingsocial.com/api";case"staging":return"https://tv-staging.trustingsocial.com/api";case"production":default:return"https://vn-vision.trustingsocial.com/api"}}(r);return new T({authorizer:n,domain:o})},e.createHttpClient=D,e.SimpleTrustVisionAPI=M,e.default=wn,Object.defineProperty(e,"__esModule",{value:!0})}(t,Wr)}))),Xr=new Uint8Array(16);function Yr(){if(!qr&&!(qr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qr(Xr)}var $r=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Zr(e){return"string"==typeof e&&$r.test(e)}for(var Jr=[],en=0;en<256;++en)Jr.push((en+256).toString(16).substr(1));function tn(e,t,r){var n=(e=e||{}).random||(e.rng||Yr)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=n[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(Jr[e[t+0]]+Jr[e[t+1]]+Jr[e[t+2]]+Jr[e[t+3]]+"-"+Jr[e[t+4]]+Jr[e[t+5]]+"-"+Jr[e[t+6]]+Jr[e[t+7]]+"-"+Jr[e[t+8]]+Jr[e[t+9]]+"-"+Jr[e[t+10]]+Jr[e[t+11]]+Jr[e[t+12]]+Jr[e[t+13]]+Jr[e[t+14]]+Jr[e[t+15]]).toLowerCase();if(!Zr(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var rn=function(e){return ir(e,5)},nn=ie((function(e){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){e.exports={BROWSER_TYPES:{CHROME:"Chrome",FIREFOX:"Firefox",OPERA:"Opera",YANDEX:"Yandex",SAFARI:"Safari",INTERNET_EXPLORER:"Internet Explorer",EDGE:"Edge",CHROMIUM:"Chromium",IE:"IE",MOBILE_SAFARI:"Mobile Safari",EDGE_CHROMIUM:"Edge Chromium"},DEVICE_TYPES:{MOBILE:"mobile",TABLET:"tablet",SMART_TV:"smarttv",CONSOLE:"console",WEARABLE:"wearable",BROWSER:void 0},OS_TYPES:{IOS:"iOS",ANDROID:"Android",WINDOWS_PHONE:"Windows Phone",WINDOWS:"Windows",MAC_OS:"Mac OS"},defaultData:{isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1}}},function(e,t,r){var n,o=r(2),a=r(0),i=a.BROWSER_TYPES,s=a.OS_TYPES,c=a.DEVICE_TYPES,l=r(4),u=l.checkType,d=l.broPayload,f=l.mobilePayload,p=l.wearPayload,h=l.consolePayload,m=l.stvPayload,g=l.getNavigatorInstance,v=l.isIOS13Check,y=new o,b=y.getBrowser(),C=y.getDevice(),w=y.getEngine(),k=y.getOS(),B=y.getUA(),E=i.CHROME,S=i.CHROMIUM,A=i.IE,_=i.INTERNET_EXPLORER,I=i.OPERA,T=i.FIREFOX,P=i.SAFARI,x=i.EDGE,R=i.YANDEX,N=i.MOBILE_SAFARI,L=c.MOBILE,O=c.TABLET,D=c.SMART_TV,M=c.BROWSER,U=c.WEARABLE,F=c.CONSOLE,j=s.ANDROID,V=s.WINDOWS_PHONE,z=s.IOS,K=s.WINDOWS,H=s.MAC_OS,q=function(){return k.name===s.WINDOWS&&"10"===k.version&&"string"==typeof B&&-1!==B.indexOf("Edg/")},Q=function(){return b.name===x},W=function(){return v("iPad")},G=C.type===D,X=C.type===F,Y=C.type===U,$=b.name===N||W(),Z=b.name===S,J=function(){switch(C.type){case L:case O:return!0;default:return!1}}()||W(),ee=C.type===L,te=C.type===O||W(),re=C.type===M,ne=k.name===j,oe=k.name===V,ae=k.name===z||W(),ie=b.name===E,se=b.name===T,ce=b.name===P||b.name===N,le=b.name===I,ue=b.name===_||b.name===A,de=k.version?k.version:"none",fe=k.name?k.name:"none",pe=b.major,he=b.version,me=b.name,ge=C.vendor?C.vendor:"none",ve=C.model?C.model:"none",ye=w.name,be=w.version,Ce=B,we=Q()||q(),ke=b.name===R,Be=C.type,Ee=(n=g())&&(/iPad|iPhone|iPod/.test(n.platform)||"MacIntel"===n.platform&&n.maxTouchPoints>1)&&!window.MSStream,Se=W(),Ae=v("iPhone"),_e=v("iPod"),Ie=function(){var e=g(),t=e&&e.userAgent.toLowerCase();return"string"==typeof t&&/electron/.test(t)}(),Te=q(),Pe=Q(),xe=k.name===K,Re=k.name===H,Ne=u(C.type);e.exports={deviceDetect:function(){var e=Ne.isBrowser,t=Ne.isMobile,r=Ne.isTablet,n=Ne.isSmartTV,o=Ne.isConsole,a=Ne.isWearable;return e?d(e,b,w,k,B):n?m(n,w,k,B):o?h(o,w,k,B):t||r?f(Ne,C,k,B):a?p(a,w,k,B):void 0},isSmartTV:G,isConsole:X,isWearable:Y,isMobileSafari:$,isChromium:Z,isMobile:J,isMobileOnly:ee,isTablet:te,isBrowser:re,isAndroid:ne,isWinPhone:oe,isIOS:ae,isChrome:ie,isFirefox:se,isSafari:ce,isOpera:le,isIE:ue,osVersion:de,osName:fe,fullBrowserVersion:pe,browserVersion:he,browserName:me,mobileVendor:ge,mobileModel:ve,engineName:ye,engineVersion:be,getUA:Ce,isEdge:we,isYandex:ke,deviceType:Be,isIOS13:Ee,isIPad13:Se,isIPhone13:Ae,isIPod13:_e,isElectron:Ie,isEdgeChromium:Te,isLegacyEdge:Pe,isWindows:xe,isMacOs:Re}},function(e,t,r){var n;
|
|
17
17
|
/*!
|
|
18
18
|
* UAParser.js v0.7.18
|
|
19
19
|
* Lightweight JavaScript-based User-Agent string parser
|
|
@@ -21,7 +21,7 @@ import t,{useRef as r,useMemo as n,useCallback as o,useContext as a,Component as
|
|
|
21
21
|
*
|
|
22
22
|
* Copyright © 2012-2016 Faisal Salman <fyzlman@gmail.com>
|
|
23
23
|
* Dual licensed under GPLv2 or MIT
|
|
24
|
-
*/!function(o,a){var i="function",s="undefined",c="object",l="model",u="name",d="type",f="vendor",p="version",h="architecture",m="console",g="mobile",v="tablet",y="smarttv",b="wearable",C={extend:function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"==typeof e?e.replace(/[^\d\.]/g,"").split(".")[0]:a},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},k={rgx:function(e,t){for(var r,n,o,s,l,u,d=0;d<t.length&&!l;){var f=t[d],p=t[d+1];for(r=n=0;r<f.length&&!l;)if(l=f[r++].exec(e))for(o=0;o<p.length;o++)u=l[++n],w(s=p[o])===c&&s.length>0?2==s.length?w(s[1])==i?this[s[0]]=s[1].call(this,u):this[s[0]]=s[1]:3==s.length?w(s[1])!==i||s[1].exec&&s[1].test?this[s[0]]=u?u.replace(s[1],s[2]):a:this[s[0]]=u?s[1].call(this,u,s[2]):a:4==s.length&&(this[s[0]]=u?s[3].call(this,u.replace(s[1],s[2])):a):this[s]=u||a;d+=2}},str:function(e,t){for(var r in t)if(w(t[r])===c&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(C.has(t[r][n],e))return"?"===r?a:r}else if(C.has(t[r],e))return"?"===r?a:r;return e}},B={browser:{oldsafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{amazon:{model:{"Fire Phone":["SD","KF"]}},sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"}}}},E={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[u,p],[/(opios)[\/\s]+([\w\.]+)/i],[[u,"Opera Mini"],p],[/\s(opr)\/([\w\.]+)/i],[[u,"Opera"],p],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]*)/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark)\/([\w\.-]+)/i],[u,p],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[u,"IE"],p],[/(edge|edgios|edgea)\/((\d+)?[\w\.]+)/i],[[u,"Edge"],p],[/(yabrowser)\/([\w\.]+)/i],[[u,"Yandex"],p],[/(puffin)\/([\w\.]+)/i],[[u,"Puffin"],p],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[[u,"UCBrowser"],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(micromessenger)\/([\w\.]+)/i],[[u,"WeChat"],p],[/(qqbrowserlite)\/([\w\.]+)/i],[u,p],[/(QQ)\/([\d\.]+)/i],[u,p],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],[u,p],[/(BIDUBrowser)[\/\s]?([\w\.]+)/i],[u,p],[/(2345Explorer)[\/\s]?([\w\.]+)/i],[u,p],[/(MetaSr)[\/\s]?([\w\.]+)/i],[u],[/(LBBROWSER)/i],[u],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],[p,[u,"Facebook"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[p,[u,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[u,/(.+)/,"$1 WebView"],p],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[[u,/(.+(?:g|us))(.+)/,"$1 $2"],p],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],[p,[u,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[u,p],[/(dolfin)\/([\w\.]+)/i],[[u,"Dolphin"],p],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[u,"Chrome"],p],[/(coast)\/([\w\.]+)/i],[[u,"Opera Coast"],p],[/fxios\/([\w\.-]+)/i],[p,[u,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[p,u],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[[u,"GSA"],p],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[u,[p,k.str,B.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[u,p],[/(navigator|netscape)\/([\w\.-]+)/i],[[u,"Netscape"],p],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[u,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,C.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/windows\s(ce|mobile);\sppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[h,/ower/,"",C.lowerize]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[[h,C.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[l,f,[d,v]],[/applecoremedia\/[\w\.]+ \((ipad)/],[l,[f,"Apple"],[d,v]],[/(apple\s{0,1}tv)/i],[[l,"Apple TV"],[f,"Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(hp).+(tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[f,l,[d,v]],[/(kf[A-z]+)\sbuild\/.+silk\//i],[l,[f,"Amazon"],[d,v]],[/(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i],[[l,k.str,B.device.amazon.model],[f,"Amazon"],[d,g]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[l,f,[d,g]],[/\((ip[honed|\s\w*]+);/i],[l,[f,"Apple"],[d,g]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[f,l,[d,g]],[/\(bb10;\s(\w+)/i],[l,[f,"BlackBerry"],[d,g]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i],[l,[f,"Asus"],[d,v]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[f,"Sony"],[l,"Xperia Tablet"],[d,v]],[/android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i],[l,[f,"Sony"],[d,g]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[f,l,[d,m]],[/android.+;\s(shield)\sbuild/i],[l,[f,"Nvidia"],[d,m]],[/(playstation\s[34portablevi]+)/i],[l,[f,"Sony"],[d,m]],[/(sprint\s(\w+))/i],[[f,k.str,B.device.sprint.vendor],[l,k.str,B.device.sprint.model],[d,g]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[f,l,[d,v]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[f,[l,/_/g," "],[d,g]],[/(nexus\s9)/i],[l,[f,"HTC"],[d,v]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p)/i],[l,[f,"Huawei"],[d,g]],[/(microsoft);\s(lumia[\s\w]+)/i],[f,l,[d,g]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[l,[f,"Microsoft"],[d,m]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[f,"Microsoft"],[d,g]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w*)/i,/(XT\d{3,4}) build\//i,/(nexus\s6)/i],[l,[f,"Motorola"],[d,g]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[l,[f,"Motorola"],[d,v]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[f,C.trim],[l,C.trim],[d,y]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[f,"Samsung"],[d,y]],[/\(dtv[\);].+(aquos)/i],[l,[f,"Sharp"],[d,y]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[f,"Samsung"],l,[d,v]],[/smart-tv.+(samsung)/i],[f,[d,y],l],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i,/sec-((sgh\w+))/i],[[f,"Samsung"],l,[d,g]],[/sie-(\w*)/i],[l,[f,"Siemens"],[d,g]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]*)/i],[[f,"Nokia"],l,[d,g]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[l,[f,"Acer"],[d,v]],[/android.+([vl]k\-?\d{3})\s+build/i],[l,[f,"LG"],[d,v]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[f,"LG"],l,[d,v]],[/(lg) netcast\.tv/i],[f,l,[d,y]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w*)/i,/android.+lg(\-?[\d\w]+)\s+build/i],[l,[f,"LG"],[d,g]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[l,[f,"Lenovo"],[d,v]],[/linux;.+((jolla));/i],[f,l,[d,g]],[/((pebble))app\/[\d\.]+\s/i],[f,l,[d,b]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[f,l,[d,g]],[/crkey/i],[[l,"Chromecast"],[f,"Google"]],[/android.+;\s(glass)\s\d/i],[l,[f,"Google"],[d,b]],[/android.+;\s(pixel c)\s/i],[l,[f,"Google"],[d,v]],[/android.+;\s(pixel xl|pixel)\s/i],[l,[f,"Google"],[d,g]],[/android.+;\s(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i,/android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i],[[l,/_/g," "],[f,"Xiaomi"],[d,g]],[/android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i],[[l,/_/g," "],[f,"Xiaomi"],[d,v]],[/android.+;\s(m[1-5]\snote)\sbuild/i],[l,[f,"Meizu"],[d,v]],[/android.+a000(1)\s+build/i,/android.+oneplus\s(a\d{4})\s+build/i],[l,[f,"OnePlus"],[d,g]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],[l,[f,"RCA"],[d,v]],[/android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i],[l,[f,"Dell"],[d,v]],[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],[l,[f,"Verizon"],[d,v]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[[f,"Barnes & Noble"],l,[d,v]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],[l,[f,"NuVision"],[d,v]],[/android.+;\s(k88)\sbuild/i],[l,[f,"ZTE"],[d,v]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],[l,[f,"Swiss"],[d,g]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],[l,[f,"Swiss"],[d,v]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],[l,[f,"Zeki"],[d,v]],[/(android).+[;\/]\s+([YR]\d{2})\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i],[[f,"Dragon Touch"],l,[d,v]],[/android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i],[l,[f,"Insignia"],[d,v]],[/android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i],[l,[f,"NextBook"],[d,v]],[/android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],[[f,"Voice"],l,[d,g]],[/android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i],[[f,"LvTel"],l,[d,g]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],[l,[f,"Envizen"],[d,v]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i],[f,l,[d,v]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],[l,[f,"MachSpeed"],[d,v]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],[f,l,[d,v]],[/android.+[;\/]\s*TU_(1491)\s+build/i],[l,[f,"Rotor"],[d,v]],[/android.+(KS(.+))\s+build/i],[l,[f,"Amazon"],[d,v]],[/android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i],[f,l,[d,v]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[d,C.lowerize],f,l],[/(android[\w\.\s\-]{0,9});.+build/i],[l,[f,"Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[u,p],[/rv\:([\w\.]{1,9}).+(gecko)/i],[p,u]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[u,p],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[u,[p,k.str,B.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[u,"Windows"],[p,k.str,B.os.windows.version]],[/\((bb)(10);/i],[[u,"BlackBerry"],p],[/(blackberry)\w*\/?([\w\.]*)/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]*)/i,/linux;.+(sailfish);/i],[u,p],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i],[[u,"Symbian"],p],[/\((series40);/i],[u],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[u,"Firefox OS"],p],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i],[u,p],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[u,"Chromium OS"],p],[/(sunos)\s?([\w\.\d]*)/i],[[u,"Solaris"],p],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i],[u,p],[/(haiku)\s(\w+)/i],[u,p],[/cfnetwork\/.+darwin/i,/ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)/i],[[u,"Mac OS"],[p,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]*)/i],[u,p]]},S=function e(t,r){if("object"==w(t)&&(r=t,t=a),!(this instanceof e))return new e(t,r).getResult();var n=t||(o&&o.navigator&&o.navigator.userAgent?o.navigator.userAgent:""),i=r?C.extend(E,r):E;return this.getBrowser=function(){var e={name:a,version:a};return k.rgx.call(e,n,i.browser),e.major=C.major(e.version),e},this.getCPU=function(){var e={architecture:a};return k.rgx.call(e,n,i.cpu),e},this.getDevice=function(){var e={vendor:a,model:a,type:a};return k.rgx.call(e,n,i.device),e},this.getEngine=function(){var e={name:a,version:a};return k.rgx.call(e,n,i.engine),e},this.getOS=function(){var e={name:a,version:a};return k.rgx.call(e,n,i.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=e,this},this};S.VERSION="0.7.18",S.BROWSER={NAME:u,MAJOR:"major",VERSION:p},S.CPU={ARCHITECTURE:h},S.DEVICE={MODEL:l,VENDOR:f,TYPE:d,CONSOLE:m,MOBILE:g,SMARTTV:y,TABLET:v,WEARABLE:b,EMBEDDED:"embedded"},S.ENGINE={NAME:u,VERSION:p},S.OS={NAME:u,VERSION:p},w(t)!==s?(w(e)!==s&&e.exports&&(t=e.exports=S),t.UAParser=S):r(3)?(n=function(){return S}.call(t,r,t,e))===a||(e.exports=n):o&&(o.UAParser=S);var A=o&&(o.jQuery||o.Zepto);if(w(A)!==s){var _=new S;A.ua=_.getResult(),A.ua.get=function(){return _.getUA()},A.ua.set=function(e){_.setUA(e);var t=_.getResult();for(var r in t)A.ua[r]=t[r]}}}("object"==("undefined"==typeof window?"undefined":w(window))?window:this)},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=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},o=r(0),a=o.DEVICE_TYPES,i=o.defaultData,s=t.getNavigatorInstance=function(){return!("undefined"==typeof window||!window.navigator&&!navigator)&&(window.navigator||navigator)},c=t.isIOS13Check=function(e){var t=s();return t&&t.platform&&(-1!==t.platform.indexOf(e)||"MacIntel"===t.platform&&t.maxTouchPoints>1&&!window.MSStream)};e.exports={checkType:function(e){switch(e){case a.MOBILE:return{isMobile:!0};case a.TABLET:return{isTablet:!0};case a.SMART_TV:return{isSmartTV:!0};case a.CONSOLE:return{isConsole:!0};case a.WEARABLE:return{isWearable:!0};case a.BROWSER:return{isBrowser:!0};default:return i}},broPayload:function(e,t,r,n,o){return{isBrowser:e,browserMajorVersion:t.major,browserFullVersion:t.version,browserName:t.name,engineName:r.name||!1,engineVersion:r.version,osName:n.name,osVersion:n.version,userAgent:o}},mobilePayload:function(e,t,r,o){return n({},e,{vendor:t.vendor,model:t.model,os:r.name,osVersion:r.version,ua:o})},stvPayload:function(e,t,r,n){return{isSmartTV:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},consolePayload:function(e,t,r,n){return{isConsole:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},wearPayload:function(e,t,r,n){return{isWearable:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},getNavigatorInstance:s,isIOS13Check:c}}])}));function on(){return{"X-TV-Device-Model":"".concat(nn.browserName," ").concat(nn.browserVersion),"X-TV-OS-Version":"".concat(nn.osName," ").concat(nn.osVersion),"X-TV-OS-Platform":nn.isMobile?"".concat(nn.osName.toLowerCase(),"_web"):"web"}}var an=Object.freeze({__proto__:null,getUAMetadata:on});function sn(e){return e<10?"0".concat(e):e}function cn(e){return"".concat(e.getFullYear(),"-").concat(sn(e.getMonth()+1),"-").concat(sn(e.getDate()),"T").concat(sn(e.getHours()),":").concat(sn(e.getMinutes()),":").concat(sn(e.getSeconds())).concat(function(e){if(0===e)return"Z";var t=e>0?"-":"+";return e=Math.abs(e),"".concat(t+sn(Math.floor(e/60)),":").concat(sn(e%60))}(e.getTimezoneOffset()))}var ln=Object.freeze({__proto__:null,rfc3339:cn});function un(e,t){window.localStorage&&window.JSON&&t&&localStorage.setItem(t,JSON.stringify(e))}function dn(e){if(window.localStorage&&window.JSON&&e){var t=localStorage.getItem(e);if(t)return JSON.parse(t)}}var fn=Object.freeze({__proto__:null,storeData:un,getData:dn,removeData:function(e){window.localStorage&&window.JSON&&e&&localStorage.removeItem(e)}}),pn=ie((function(e,t){var r;e.exports=r=r||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==ae&&ae.crypto&&(r=ae.crypto),!r)try{r=Wr}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},i=a.lib={},s=i.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=i.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<o;a++){var i=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=i<<24-(n+a)%4*8}else for(var s=0;s<o;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),l=a.enc={},u=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var a=t[o>>>2]>>>24-o%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var a=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},f=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=i.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,o=n.words,a=n.sigBytes,i=this.blockSize,s=a/(4*i),l=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,u=e.min(4*l,a);if(l){for(var d=0;d<l;d+=i)this._doProcessBlock(o,d);r=o.splice(0,l),n.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),h=(i.Hasher=p.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}}),a.algo={});return a}(Math)})),hn=(ie((function(e,t){var r,n,o,a,i,s;e.exports=(n=(r=s=pn).lib,o=n.Base,a=n.WordArray,(i=r.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),i.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var o=e[n];r.push(o.high),r.push(o.low)}return a.create(r,this.sigBytes)},clone:function(){for(var e=o.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}}),s)})),ie((function(e,t){var r;e.exports=(r=pn,function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,n=[],o=0;o<r;o++)n[o>>>2]|=e[o]<<24-o%4*8;t.call(this,n,r)}else t.apply(this,arguments)}).prototype=e}}(),r.lib.WordArray)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.WordArray,n=e.enc;function o(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var a=t[o>>>2]>>>16-o%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var r=e.length,n=[],o=0;o<r;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return t.create(n,2*r)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],a=0;a<r;a+=2){var i=o(t[a>>>2]>>>16-a%4*8&65535);n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var r=e.length,n=[],a=0;a<r;a++)n[a>>>1]|=o(e.charCodeAt(a)<<16-a%2*16);return t.create(n,2*r)}}}(),r.enc.Utf16)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var o=[],a=0,i=0;i<r;i++)if(i%4){var s=n[e.charCodeAt(i-1)]<<i%4*2|n[e.charCodeAt(i)]>>>6-i%4*2;o[a>>>2]|=s<<24-a%4*8,a++}return t.create(o,a)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],a=0;a<r;a+=3)for(var i=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)o.push(n.charAt(i>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a<r.length;a++)o[r.charCodeAt(a)]=a}var i=r.charAt(64);if(i){var s=e.indexOf(i);-1!==s&&(t=s)}return n(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var o=[],a=0,i=0;i<r;i++)if(i%4){var s=n[e.charCodeAt(i-1)]<<i%4*2|n[e.charCodeAt(i)]>>>6-i%4*2;o[a>>>2]|=s<<24-a%4*8,a++}return t.create(o,a)}e.enc.Base64url={stringify:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.words,n=e.sigBytes,o=t?this._safe_map:this._map;e.clamp();for(var a=[],i=0;i<n;i+=3)for(var s=(r[i>>>2]>>>24-i%4*8&255)<<16|(r[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|r[i+2>>>2]>>>24-(i+2)%4*8&255,c=0;c<4&&i+.75*c<n;c++)a.push(o.charAt(s>>>6*(3-c)&63));var l=o.charAt(64);if(l)for(;a.length%4;)a.push(l);return a.join("")},parse:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.length,o=t?this._safe_map:this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var i=0;i<o.length;i++)a[o.charCodeAt(i)]=i}var s=o.charAt(64);if(s){var c=e.indexOf(s);-1!==c&&(r=c)}return n(e,r,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),r.enc.Base64url)})),ie((function(e,t){var r;e.exports=(r=pn,function(e){var t=r,n=t.lib,o=n.WordArray,a=n.Hasher,i=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=i.MD5=a.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var a=this._hash.words,i=e[t+0],c=e[t+1],p=e[t+2],h=e[t+3],m=e[t+4],g=e[t+5],v=e[t+6],y=e[t+7],b=e[t+8],C=e[t+9],w=e[t+10],k=e[t+11],B=e[t+12],E=e[t+13],S=e[t+14],A=e[t+15],_=a[0],I=a[1],T=a[2],P=a[3];_=l(_,I,T,P,i,7,s[0]),P=l(P,_,I,T,c,12,s[1]),T=l(T,P,_,I,p,17,s[2]),I=l(I,T,P,_,h,22,s[3]),_=l(_,I,T,P,m,7,s[4]),P=l(P,_,I,T,g,12,s[5]),T=l(T,P,_,I,v,17,s[6]),I=l(I,T,P,_,y,22,s[7]),_=l(_,I,T,P,b,7,s[8]),P=l(P,_,I,T,C,12,s[9]),T=l(T,P,_,I,w,17,s[10]),I=l(I,T,P,_,k,22,s[11]),_=l(_,I,T,P,B,7,s[12]),P=l(P,_,I,T,E,12,s[13]),T=l(T,P,_,I,S,17,s[14]),_=u(_,I=l(I,T,P,_,A,22,s[15]),T,P,c,5,s[16]),P=u(P,_,I,T,v,9,s[17]),T=u(T,P,_,I,k,14,s[18]),I=u(I,T,P,_,i,20,s[19]),_=u(_,I,T,P,g,5,s[20]),P=u(P,_,I,T,w,9,s[21]),T=u(T,P,_,I,A,14,s[22]),I=u(I,T,P,_,m,20,s[23]),_=u(_,I,T,P,C,5,s[24]),P=u(P,_,I,T,S,9,s[25]),T=u(T,P,_,I,h,14,s[26]),I=u(I,T,P,_,b,20,s[27]),_=u(_,I,T,P,E,5,s[28]),P=u(P,_,I,T,p,9,s[29]),T=u(T,P,_,I,y,14,s[30]),_=d(_,I=u(I,T,P,_,B,20,s[31]),T,P,g,4,s[32]),P=d(P,_,I,T,b,11,s[33]),T=d(T,P,_,I,k,16,s[34]),I=d(I,T,P,_,S,23,s[35]),_=d(_,I,T,P,c,4,s[36]),P=d(P,_,I,T,m,11,s[37]),T=d(T,P,_,I,y,16,s[38]),I=d(I,T,P,_,w,23,s[39]),_=d(_,I,T,P,E,4,s[40]),P=d(P,_,I,T,i,11,s[41]),T=d(T,P,_,I,h,16,s[42]),I=d(I,T,P,_,v,23,s[43]),_=d(_,I,T,P,C,4,s[44]),P=d(P,_,I,T,B,11,s[45]),T=d(T,P,_,I,A,16,s[46]),_=f(_,I=d(I,T,P,_,p,23,s[47]),T,P,i,6,s[48]),P=f(P,_,I,T,y,10,s[49]),T=f(T,P,_,I,S,15,s[50]),I=f(I,T,P,_,g,21,s[51]),_=f(_,I,T,P,B,6,s[52]),P=f(P,_,I,T,h,10,s[53]),T=f(T,P,_,I,w,15,s[54]),I=f(I,T,P,_,c,21,s[55]),_=f(_,I,T,P,b,6,s[56]),P=f(P,_,I,T,A,10,s[57]),T=f(T,P,_,I,v,15,s[58]),I=f(I,T,P,_,E,21,s[59]),_=f(_,I,T,P,m,6,s[60]),P=f(P,_,I,T,k,10,s[61]),T=f(T,P,_,I,p,15,s[62]),I=f(I,T,P,_,C,21,s[63]),a[0]=a[0]+_|0,a[1]=a[1]+I|0,a[2]=a[2]+T|0,a[3]=a[3]+P|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;r[o>>>5]|=128<<24-o%32;var a=e.floor(n/4294967296),i=n;r[15+(o+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r[14+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,n,o,a,i){var s=e+(t&r|~t&n)+o+i;return(s<<a|s>>>32-a)+t}function u(e,t,r,n,o,a,i){var s=e+(t&n|r&~n)+o+i;return(s<<a|s>>>32-a)+t}function d(e,t,r,n,o,a,i){var s=e+(t^r^n)+o+i;return(s<<a|s>>>32-a)+t}function f(e,t,r,n,o,a,i){var s=e+(r^(t|~n))+o+i;return(s<<a|s>>>32-a)+t}t.MD5=a._createHelper(c),t.HmacMD5=a._createHmacHelper(c)}(Math),r.MD5)})),ie((function(e,t){var r,n,o,a,i,s,c,l;e.exports=(n=(r=l=pn).lib,o=n.WordArray,a=n.Hasher,i=r.algo,s=[],c=i.SHA1=a.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],a=r[2],i=r[3],c=r[4],l=0;l<80;l++){if(l<16)s[l]=0|e[t+l];else{var u=s[l-3]^s[l-8]^s[l-14]^s[l-16];s[l]=u<<1|u>>>31}var d=(n<<5|n>>>27)+c+s[l];d+=l<20?1518500249+(o&a|~o&i):l<40?1859775393+(o^a^i):l<60?(o&a|o&i|a&i)-1894007588:(o^a^i)-899497514,c=i,i=a,a=o<<30|o>>>2,o=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+a|0,r[3]=r[3]+i|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c),l.SHA1)})),ie((function(e,t){var r;e.exports=(r=pn,function(e){var t=r,n=t.lib,o=n.WordArray,a=n.Hasher,i=t.algo,s=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)t(n)&&(o<8&&(s[o]=r(e.pow(n,.5))),c[o]=r(e.pow(n,1/3)),o++),n++}();var l=[],u=i.SHA256=a.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],a=r[2],i=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=0;p<64;p++){if(p<16)l[p]=0|e[t+p];else{var h=l[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,g=l[p-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;l[p]=m+l[p-7]+v+l[p-16]}var y=n&o^n&a^o&a,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),C=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&u^~s&d)+c[p]+l[p];f=d,d=u,u=s,s=i+C|0,i=a,a=o,o=n,n=C+(b+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+a|0,r[3]=r[3]+i|0,r[4]=r[4]+s|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=e.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=a._createHelper(u),t.HmacSHA256=a._createHmacHelper(u)}(Math),r.SHA256)})),ie((function(e,t){var r,n,o,a,i,s;e.exports=(n=(r=s=pn).lib.WordArray,o=r.algo,a=o.SHA256,i=o.SHA224=a.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=a._createHelper(i),r.HmacSHA224=a._createHmacHelper(i),s.SHA224)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.Hasher,n=e.x64,o=n.Word,a=n.WordArray,i=e.algo;function s(){return o.create.apply(o,arguments)}var c=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=s()}();var u=i.SHA512=t.extend({_doReset:function(){this._hash=new a.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],a=r[2],i=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=n.high,h=n.low,m=o.high,g=o.low,v=a.high,y=a.low,b=i.high,C=i.low,w=s.high,k=s.low,B=u.high,E=u.low,S=d.high,A=d.low,_=f.high,I=f.low,T=p,P=h,x=m,R=g,N=v,L=y,O=b,D=C,M=w,U=k,j=B,F=E,V=S,z=A,K=_,H=I,q=0;q<80;q++){var Q,W,G=l[q];if(q<16)W=G.high=0|e[t+2*q],Q=G.low=0|e[t+2*q+1];else{var X=l[q-15],Y=X.high,$=X.low,Z=(Y>>>1|$<<31)^(Y>>>8|$<<24)^Y>>>7,J=($>>>1|Y<<31)^($>>>8|Y<<24)^($>>>7|Y<<25),ee=l[q-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,oe=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ae=l[q-7],ie=ae.high,se=ae.low,ce=l[q-16],le=ce.high,ue=ce.low;W=(W=(W=Z+ie+((Q=J+se)>>>0<J>>>0?1:0))+ne+((Q+=oe)>>>0<oe>>>0?1:0))+le+((Q+=ue)>>>0<ue>>>0?1:0),G.high=W,G.low=Q}var de,fe=M&j^~M&V,pe=U&F^~U&z,he=T&x^T&N^x&N,me=P&R^P&L^R&L,ge=(T>>>28|P<<4)^(T<<30|P>>>2)^(T<<25|P>>>7),ve=(P>>>28|T<<4)^(P<<30|T>>>2)^(P<<25|T>>>7),ye=(M>>>14|U<<18)^(M>>>18|U<<14)^(M<<23|U>>>9),be=(U>>>14|M<<18)^(U>>>18|M<<14)^(U<<23|M>>>9),Ce=c[q],we=Ce.high,ke=Ce.low,Be=K+ye+((de=H+be)>>>0<H>>>0?1:0),Ee=ve+me;K=V,H=z,V=j,z=F,j=M,F=U,M=O+(Be=(Be=(Be=Be+fe+((de+=pe)>>>0<pe>>>0?1:0))+we+((de+=ke)>>>0<ke>>>0?1:0))+W+((de+=Q)>>>0<Q>>>0?1:0))+((U=D+de|0)>>>0<D>>>0?1:0)|0,O=N,D=L,N=x,L=R,x=T,R=P,T=Be+(ge+he+(Ee>>>0<ve>>>0?1:0))+((P=de+Ee|0)>>>0<de>>>0?1:0)|0}h=n.low=h+P,n.high=p+T+(h>>>0<P>>>0?1:0),g=o.low=g+R,o.high=m+x+(g>>>0<R>>>0?1:0),y=a.low=y+L,a.high=v+N+(y>>>0<L>>>0?1:0),C=i.low=C+D,i.high=b+O+(C>>>0<D>>>0?1:0),k=s.low=k+U,s.high=w+M+(k>>>0<U>>>0?1:0),E=u.low=E+F,u.high=B+j+(E>>>0<F>>>0?1:0),A=d.low=A+z,d.high=S+V+(A>>>0<z>>>0?1:0),I=f.low=I+H,f.high=_+K+(I>>>0<H>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(u),e.HmacSHA512=t._createHmacHelper(u)}(),r.SHA512)})),ie((function(e,t){var r,n,o,a,i,s,c,l;e.exports=(n=(r=l=pn).x64,o=n.Word,a=n.WordArray,i=r.algo,s=i.SHA512,c=i.SHA384=s.extend({_doReset:function(){this._hash=new a.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=s._createHelper(c),r.HmacSHA384=s._createHmacHelper(c),l.SHA384)})),ie((function(e,t){var r;e.exports=(r=pn,function(e){var t=r,n=t.lib,o=n.WordArray,a=n.Hasher,i=t.x64.Word,s=t.algo,c=[],l=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,a=0;a<24;a++){for(var s=0,d=0,f=0;f<7;f++){if(1&o){var p=(1<<f)-1;p<32?d^=1<<p:s^=1<<p-32}128&o?o=o<<1^113:o<<=1}u[a]=i.create(s,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=i.create()}();var f=s.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new i.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,o=0;o<n;o++){var a=e[t+2*o],i=e[t+2*o+1];a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),(I=r[o]).high^=i,I.low^=a}for(var s=0;s<24;s++){for(var f=0;f<5;f++){for(var p=0,h=0,m=0;m<5;m++)p^=(I=r[f+5*m]).high,h^=I.low;var g=d[f];g.high=p,g.low=h}for(f=0;f<5;f++){var v=d[(f+4)%5],y=d[(f+1)%5],b=y.high,C=y.low;for(p=v.high^(b<<1|C>>>31),h=v.low^(C<<1|b>>>31),m=0;m<5;m++)(I=r[f+5*m]).high^=p,I.low^=h}for(var w=1;w<25;w++){var k=(I=r[w]).high,B=I.low,E=c[w];E<32?(p=k<<E|B>>>32-E,h=B<<E|k>>>32-E):(p=B<<E-32|k>>>64-E,h=k<<E-32|B>>>64-E);var S=d[l[w]];S.high=p,S.low=h}var A=d[0],_=r[0];for(A.high=_.high,A.low=_.low,f=0;f<5;f++)for(m=0;m<5;m++){var I=r[w=f+5*m],T=d[w],P=d[(f+1)%5+5*m],x=d[(f+2)%5+5*m];I.high=T.high^~P.high&x.high,I.low=T.low^~P.low&x.low}I=r[0];var R=u[s];I.high^=R.high,I.low^=R.low}},_doFinalize:function(){var t=this._data,r=t.words,n=(this._nDataBytes,8*t.sigBytes),a=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/a)*a>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var i=this._state,s=this.cfg.outputLength/8,c=s/8,l=[],u=0;u<c;u++){var d=i[u],f=d.high,p=d.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),l.push(p),l.push(f)}return new o.init(l,s)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=a._createHelper(f),t.HmacSHA3=a._createHmacHelper(f)}(Math),r.SHA3)})),ie((function(e,t){var r;e.exports=(r=pn,
|
|
24
|
+
*/!function(o,a){var i="function",s="undefined",c="object",l="model",u="name",d="type",f="vendor",p="version",h="architecture",m="console",g="mobile",v="tablet",y="smarttv",b="wearable",C={extend:function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"==typeof e?e.replace(/[^\d\.]/g,"").split(".")[0]:a},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},k={rgx:function(e,t){for(var r,n,o,s,l,u,d=0;d<t.length&&!l;){var f=t[d],p=t[d+1];for(r=n=0;r<f.length&&!l;)if(l=f[r++].exec(e))for(o=0;o<p.length;o++)u=l[++n],w(s=p[o])===c&&s.length>0?2==s.length?w(s[1])==i?this[s[0]]=s[1].call(this,u):this[s[0]]=s[1]:3==s.length?w(s[1])!==i||s[1].exec&&s[1].test?this[s[0]]=u?u.replace(s[1],s[2]):a:this[s[0]]=u?s[1].call(this,u,s[2]):a:4==s.length&&(this[s[0]]=u?s[3].call(this,u.replace(s[1],s[2])):a):this[s]=u||a;d+=2}},str:function(e,t){for(var r in t)if(w(t[r])===c&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(C.has(t[r][n],e))return"?"===r?a:r}else if(C.has(t[r],e))return"?"===r?a:r;return e}},B={browser:{oldsafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{amazon:{model:{"Fire Phone":["SD","KF"]}},sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"}}}},E={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[u,p],[/(opios)[\/\s]+([\w\.]+)/i],[[u,"Opera Mini"],p],[/\s(opr)\/([\w\.]+)/i],[[u,"Opera"],p],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]*)/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark)\/([\w\.-]+)/i],[u,p],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[u,"IE"],p],[/(edge|edgios|edgea)\/((\d+)?[\w\.]+)/i],[[u,"Edge"],p],[/(yabrowser)\/([\w\.]+)/i],[[u,"Yandex"],p],[/(puffin)\/([\w\.]+)/i],[[u,"Puffin"],p],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[[u,"UCBrowser"],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(micromessenger)\/([\w\.]+)/i],[[u,"WeChat"],p],[/(qqbrowserlite)\/([\w\.]+)/i],[u,p],[/(QQ)\/([\d\.]+)/i],[u,p],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],[u,p],[/(BIDUBrowser)[\/\s]?([\w\.]+)/i],[u,p],[/(2345Explorer)[\/\s]?([\w\.]+)/i],[u,p],[/(MetaSr)[\/\s]?([\w\.]+)/i],[u],[/(LBBROWSER)/i],[u],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],[p,[u,"Facebook"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[p,[u,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[u,/(.+)/,"$1 WebView"],p],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[[u,/(.+(?:g|us))(.+)/,"$1 $2"],p],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],[p,[u,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[u,p],[/(dolfin)\/([\w\.]+)/i],[[u,"Dolphin"],p],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[u,"Chrome"],p],[/(coast)\/([\w\.]+)/i],[[u,"Opera Coast"],p],[/fxios\/([\w\.-]+)/i],[p,[u,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[p,u],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[[u,"GSA"],p],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[u,[p,k.str,B.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[u,p],[/(navigator|netscape)\/([\w\.-]+)/i],[[u,"Netscape"],p],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[u,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,C.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/windows\s(ce|mobile);\sppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[h,/ower/,"",C.lowerize]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[[h,C.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[l,f,[d,v]],[/applecoremedia\/[\w\.]+ \((ipad)/],[l,[f,"Apple"],[d,v]],[/(apple\s{0,1}tv)/i],[[l,"Apple TV"],[f,"Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(hp).+(tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[f,l,[d,v]],[/(kf[A-z]+)\sbuild\/.+silk\//i],[l,[f,"Amazon"],[d,v]],[/(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i],[[l,k.str,B.device.amazon.model],[f,"Amazon"],[d,g]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[l,f,[d,g]],[/\((ip[honed|\s\w*]+);/i],[l,[f,"Apple"],[d,g]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[f,l,[d,g]],[/\(bb10;\s(\w+)/i],[l,[f,"BlackBerry"],[d,g]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i],[l,[f,"Asus"],[d,v]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[f,"Sony"],[l,"Xperia Tablet"],[d,v]],[/android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i],[l,[f,"Sony"],[d,g]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[f,l,[d,m]],[/android.+;\s(shield)\sbuild/i],[l,[f,"Nvidia"],[d,m]],[/(playstation\s[34portablevi]+)/i],[l,[f,"Sony"],[d,m]],[/(sprint\s(\w+))/i],[[f,k.str,B.device.sprint.vendor],[l,k.str,B.device.sprint.model],[d,g]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[f,l,[d,v]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[f,[l,/_/g," "],[d,g]],[/(nexus\s9)/i],[l,[f,"HTC"],[d,v]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p)/i],[l,[f,"Huawei"],[d,g]],[/(microsoft);\s(lumia[\s\w]+)/i],[f,l,[d,g]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[l,[f,"Microsoft"],[d,m]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[f,"Microsoft"],[d,g]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w*)/i,/(XT\d{3,4}) build\//i,/(nexus\s6)/i],[l,[f,"Motorola"],[d,g]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[l,[f,"Motorola"],[d,v]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[f,C.trim],[l,C.trim],[d,y]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[f,"Samsung"],[d,y]],[/\(dtv[\);].+(aquos)/i],[l,[f,"Sharp"],[d,y]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[f,"Samsung"],l,[d,v]],[/smart-tv.+(samsung)/i],[f,[d,y],l],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i,/sec-((sgh\w+))/i],[[f,"Samsung"],l,[d,g]],[/sie-(\w*)/i],[l,[f,"Siemens"],[d,g]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]*)/i],[[f,"Nokia"],l,[d,g]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[l,[f,"Acer"],[d,v]],[/android.+([vl]k\-?\d{3})\s+build/i],[l,[f,"LG"],[d,v]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[f,"LG"],l,[d,v]],[/(lg) netcast\.tv/i],[f,l,[d,y]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w*)/i,/android.+lg(\-?[\d\w]+)\s+build/i],[l,[f,"LG"],[d,g]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[l,[f,"Lenovo"],[d,v]],[/linux;.+((jolla));/i],[f,l,[d,g]],[/((pebble))app\/[\d\.]+\s/i],[f,l,[d,b]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[f,l,[d,g]],[/crkey/i],[[l,"Chromecast"],[f,"Google"]],[/android.+;\s(glass)\s\d/i],[l,[f,"Google"],[d,b]],[/android.+;\s(pixel c)\s/i],[l,[f,"Google"],[d,v]],[/android.+;\s(pixel xl|pixel)\s/i],[l,[f,"Google"],[d,g]],[/android.+;\s(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i,/android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i],[[l,/_/g," "],[f,"Xiaomi"],[d,g]],[/android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i],[[l,/_/g," "],[f,"Xiaomi"],[d,v]],[/android.+;\s(m[1-5]\snote)\sbuild/i],[l,[f,"Meizu"],[d,v]],[/android.+a000(1)\s+build/i,/android.+oneplus\s(a\d{4})\s+build/i],[l,[f,"OnePlus"],[d,g]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],[l,[f,"RCA"],[d,v]],[/android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i],[l,[f,"Dell"],[d,v]],[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],[l,[f,"Verizon"],[d,v]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[[f,"Barnes & Noble"],l,[d,v]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],[l,[f,"NuVision"],[d,v]],[/android.+;\s(k88)\sbuild/i],[l,[f,"ZTE"],[d,v]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],[l,[f,"Swiss"],[d,g]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],[l,[f,"Swiss"],[d,v]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],[l,[f,"Zeki"],[d,v]],[/(android).+[;\/]\s+([YR]\d{2})\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i],[[f,"Dragon Touch"],l,[d,v]],[/android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i],[l,[f,"Insignia"],[d,v]],[/android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i],[l,[f,"NextBook"],[d,v]],[/android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],[[f,"Voice"],l,[d,g]],[/android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i],[[f,"LvTel"],l,[d,g]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],[l,[f,"Envizen"],[d,v]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i],[f,l,[d,v]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],[l,[f,"MachSpeed"],[d,v]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],[f,l,[d,v]],[/android.+[;\/]\s*TU_(1491)\s+build/i],[l,[f,"Rotor"],[d,v]],[/android.+(KS(.+))\s+build/i],[l,[f,"Amazon"],[d,v]],[/android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i],[f,l,[d,v]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[d,C.lowerize],f,l],[/(android[\w\.\s\-]{0,9});.+build/i],[l,[f,"Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[u,p],[/rv\:([\w\.]{1,9}).+(gecko)/i],[p,u]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[u,p],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[u,[p,k.str,B.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[u,"Windows"],[p,k.str,B.os.windows.version]],[/\((bb)(10);/i],[[u,"BlackBerry"],p],[/(blackberry)\w*\/?([\w\.]*)/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]*)/i,/linux;.+(sailfish);/i],[u,p],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i],[[u,"Symbian"],p],[/\((series40);/i],[u],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[u,"Firefox OS"],p],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i],[u,p],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[u,"Chromium OS"],p],[/(sunos)\s?([\w\.\d]*)/i],[[u,"Solaris"],p],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i],[u,p],[/(haiku)\s(\w+)/i],[u,p],[/cfnetwork\/.+darwin/i,/ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)/i],[[u,"Mac OS"],[p,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]*)/i],[u,p]]},S=function e(t,r){if("object"==w(t)&&(r=t,t=a),!(this instanceof e))return new e(t,r).getResult();var n=t||(o&&o.navigator&&o.navigator.userAgent?o.navigator.userAgent:""),i=r?C.extend(E,r):E;return this.getBrowser=function(){var e={name:a,version:a};return k.rgx.call(e,n,i.browser),e.major=C.major(e.version),e},this.getCPU=function(){var e={architecture:a};return k.rgx.call(e,n,i.cpu),e},this.getDevice=function(){var e={vendor:a,model:a,type:a};return k.rgx.call(e,n,i.device),e},this.getEngine=function(){var e={name:a,version:a};return k.rgx.call(e,n,i.engine),e},this.getOS=function(){var e={name:a,version:a};return k.rgx.call(e,n,i.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=e,this},this};S.VERSION="0.7.18",S.BROWSER={NAME:u,MAJOR:"major",VERSION:p},S.CPU={ARCHITECTURE:h},S.DEVICE={MODEL:l,VENDOR:f,TYPE:d,CONSOLE:m,MOBILE:g,SMARTTV:y,TABLET:v,WEARABLE:b,EMBEDDED:"embedded"},S.ENGINE={NAME:u,VERSION:p},S.OS={NAME:u,VERSION:p},w(t)!==s?(w(e)!==s&&e.exports&&(t=e.exports=S),t.UAParser=S):r(3)?(n=function(){return S}.call(t,r,t,e))===a||(e.exports=n):o&&(o.UAParser=S);var A=o&&(o.jQuery||o.Zepto);if(w(A)!==s){var _=new S;A.ua=_.getResult(),A.ua.get=function(){return _.getUA()},A.ua.set=function(e){_.setUA(e);var t=_.getResult();for(var r in t)A.ua[r]=t[r]}}}("object"==("undefined"==typeof window?"undefined":w(window))?window:this)},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=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},o=r(0),a=o.DEVICE_TYPES,i=o.defaultData,s=t.getNavigatorInstance=function(){return!("undefined"==typeof window||!window.navigator&&!navigator)&&(window.navigator||navigator)},c=t.isIOS13Check=function(e){var t=s();return t&&t.platform&&(-1!==t.platform.indexOf(e)||"MacIntel"===t.platform&&t.maxTouchPoints>1&&!window.MSStream)};e.exports={checkType:function(e){switch(e){case a.MOBILE:return{isMobile:!0};case a.TABLET:return{isTablet:!0};case a.SMART_TV:return{isSmartTV:!0};case a.CONSOLE:return{isConsole:!0};case a.WEARABLE:return{isWearable:!0};case a.BROWSER:return{isBrowser:!0};default:return i}},broPayload:function(e,t,r,n,o){return{isBrowser:e,browserMajorVersion:t.major,browserFullVersion:t.version,browserName:t.name,engineName:r.name||!1,engineVersion:r.version,osName:n.name,osVersion:n.version,userAgent:o}},mobilePayload:function(e,t,r,o){return n({},e,{vendor:t.vendor,model:t.model,os:r.name,osVersion:r.version,ua:o})},stvPayload:function(e,t,r,n){return{isSmartTV:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},consolePayload:function(e,t,r,n){return{isConsole:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},wearPayload:function(e,t,r,n){return{isWearable:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},getNavigatorInstance:s,isIOS13Check:c}}])}));function on(){return{"X-TV-Device-Model":"".concat(nn.browserName," ").concat(nn.browserVersion),"X-TV-OS-Version":"".concat(nn.osName," ").concat(nn.osVersion),"X-TV-OS-Platform":nn.isMobile?"".concat(nn.osName.toLowerCase(),"_web"):"web"}}var an=Object.freeze({__proto__:null,getUAMetadata:on});function sn(e){return e<10?"0".concat(e):e}function cn(e){return"".concat(e.getFullYear(),"-").concat(sn(e.getMonth()+1),"-").concat(sn(e.getDate()),"T").concat(sn(e.getHours()),":").concat(sn(e.getMinutes()),":").concat(sn(e.getSeconds())).concat(function(e){if(0===e)return"Z";var t=e>0?"-":"+";return e=Math.abs(e),"".concat(t+sn(Math.floor(e/60)),":").concat(sn(e%60))}(e.getTimezoneOffset()))}var ln=Object.freeze({__proto__:null,rfc3339:cn});function un(e,t){window.localStorage&&window.JSON&&t&&localStorage.setItem(t,JSON.stringify(e))}function dn(e){if(window.localStorage&&window.JSON&&e){var t=localStorage.getItem(e);if(t)return JSON.parse(t)}}var fn=Object.freeze({__proto__:null,storeData:un,getData:dn,removeData:function(e){window.localStorage&&window.JSON&&e&&localStorage.removeItem(e)}}),pn=ie((function(e,t){var r;e.exports=r=r||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==ae&&ae.crypto&&(r=ae.crypto),!r)try{r=Wr}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},i=a.lib={},s=i.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=i.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<o;a++){var i=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=i<<24-(n+a)%4*8}else for(var s=0;s<o;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),l=a.enc={},u=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var a=t[o>>>2]>>>24-o%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var a=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},f=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=i.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,o=n.words,a=n.sigBytes,i=this.blockSize,s=a/(4*i),l=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,u=e.min(4*l,a);if(l){for(var d=0;d<l;d+=i)this._doProcessBlock(o,d);r=o.splice(0,l),n.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),h=(i.Hasher=p.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new h.HMAC.init(e,r).finalize(t)}}}),a.algo={});return a}(Math)})),hn=(ie((function(e,t){var r,n,o,a,i,s;e.exports=(n=(r=s=pn).lib,o=n.Base,a=n.WordArray,(i=r.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),i.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var o=e[n];r.push(o.high),r.push(o.low)}return a.create(r,this.sigBytes)},clone:function(){for(var e=o.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}}),s)})),ie((function(e,t){var r;e.exports=(r=pn,function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var r=e.byteLength,n=[],o=0;o<r;o++)n[o>>>2]|=e[o]<<24-o%4*8;t.call(this,n,r)}else t.apply(this,arguments)}).prototype=e}}(),r.lib.WordArray)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.WordArray,n=e.enc;function o(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var a=t[o>>>2]>>>16-o%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var r=e.length,n=[],o=0;o<r;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return t.create(n,2*r)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],a=0;a<r;a+=2){var i=o(t[a>>>2]>>>16-a%4*8&65535);n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var r=e.length,n=[],a=0;a<r;a++)n[a>>>1]|=o(e.charCodeAt(a)<<16-a%2*16);return t.create(n,2*r)}}}(),r.enc.Utf16)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var o=[],a=0,i=0;i<r;i++)if(i%4){var s=n[e.charCodeAt(i-1)]<<i%4*2|n[e.charCodeAt(i)]>>>6-i%4*2;o[a>>>2]|=s<<24-a%4*8,a++}return t.create(o,a)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],a=0;a<r;a+=3)for(var i=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)o.push(n.charAt(i>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a<r.length;a++)o[r.charCodeAt(a)]=a}var i=r.charAt(64);if(i){var s=e.indexOf(i);-1!==s&&(t=s)}return n(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var o=[],a=0,i=0;i<r;i++)if(i%4){var s=n[e.charCodeAt(i-1)]<<i%4*2|n[e.charCodeAt(i)]>>>6-i%4*2;o[a>>>2]|=s<<24-a%4*8,a++}return t.create(o,a)}e.enc.Base64url={stringify:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.words,n=e.sigBytes,o=t?this._safe_map:this._map;e.clamp();for(var a=[],i=0;i<n;i+=3)for(var s=(r[i>>>2]>>>24-i%4*8&255)<<16|(r[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|r[i+2>>>2]>>>24-(i+2)%4*8&255,c=0;c<4&&i+.75*c<n;c++)a.push(o.charAt(s>>>6*(3-c)&63));var l=o.charAt(64);if(l)for(;a.length%4;)a.push(l);return a.join("")},parse:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=e.length,o=t?this._safe_map:this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var i=0;i<o.length;i++)a[o.charCodeAt(i)]=i}var s=o.charAt(64);if(s){var c=e.indexOf(s);-1!==c&&(r=c)}return n(e,r,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),r.enc.Base64url)})),ie((function(e,t){var r;e.exports=(r=pn,function(e){var t=r,n=t.lib,o=n.WordArray,a=n.Hasher,i=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=i.MD5=a.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var a=this._hash.words,i=e[t+0],c=e[t+1],p=e[t+2],h=e[t+3],m=e[t+4],g=e[t+5],v=e[t+6],y=e[t+7],b=e[t+8],C=e[t+9],w=e[t+10],k=e[t+11],B=e[t+12],E=e[t+13],S=e[t+14],A=e[t+15],_=a[0],I=a[1],T=a[2],P=a[3];_=l(_,I,T,P,i,7,s[0]),P=l(P,_,I,T,c,12,s[1]),T=l(T,P,_,I,p,17,s[2]),I=l(I,T,P,_,h,22,s[3]),_=l(_,I,T,P,m,7,s[4]),P=l(P,_,I,T,g,12,s[5]),T=l(T,P,_,I,v,17,s[6]),I=l(I,T,P,_,y,22,s[7]),_=l(_,I,T,P,b,7,s[8]),P=l(P,_,I,T,C,12,s[9]),T=l(T,P,_,I,w,17,s[10]),I=l(I,T,P,_,k,22,s[11]),_=l(_,I,T,P,B,7,s[12]),P=l(P,_,I,T,E,12,s[13]),T=l(T,P,_,I,S,17,s[14]),_=u(_,I=l(I,T,P,_,A,22,s[15]),T,P,c,5,s[16]),P=u(P,_,I,T,v,9,s[17]),T=u(T,P,_,I,k,14,s[18]),I=u(I,T,P,_,i,20,s[19]),_=u(_,I,T,P,g,5,s[20]),P=u(P,_,I,T,w,9,s[21]),T=u(T,P,_,I,A,14,s[22]),I=u(I,T,P,_,m,20,s[23]),_=u(_,I,T,P,C,5,s[24]),P=u(P,_,I,T,S,9,s[25]),T=u(T,P,_,I,h,14,s[26]),I=u(I,T,P,_,b,20,s[27]),_=u(_,I,T,P,E,5,s[28]),P=u(P,_,I,T,p,9,s[29]),T=u(T,P,_,I,y,14,s[30]),_=d(_,I=u(I,T,P,_,B,20,s[31]),T,P,g,4,s[32]),P=d(P,_,I,T,b,11,s[33]),T=d(T,P,_,I,k,16,s[34]),I=d(I,T,P,_,S,23,s[35]),_=d(_,I,T,P,c,4,s[36]),P=d(P,_,I,T,m,11,s[37]),T=d(T,P,_,I,y,16,s[38]),I=d(I,T,P,_,w,23,s[39]),_=d(_,I,T,P,E,4,s[40]),P=d(P,_,I,T,i,11,s[41]),T=d(T,P,_,I,h,16,s[42]),I=d(I,T,P,_,v,23,s[43]),_=d(_,I,T,P,C,4,s[44]),P=d(P,_,I,T,B,11,s[45]),T=d(T,P,_,I,A,16,s[46]),_=f(_,I=d(I,T,P,_,p,23,s[47]),T,P,i,6,s[48]),P=f(P,_,I,T,y,10,s[49]),T=f(T,P,_,I,S,15,s[50]),I=f(I,T,P,_,g,21,s[51]),_=f(_,I,T,P,B,6,s[52]),P=f(P,_,I,T,h,10,s[53]),T=f(T,P,_,I,w,15,s[54]),I=f(I,T,P,_,c,21,s[55]),_=f(_,I,T,P,b,6,s[56]),P=f(P,_,I,T,A,10,s[57]),T=f(T,P,_,I,v,15,s[58]),I=f(I,T,P,_,E,21,s[59]),_=f(_,I,T,P,m,6,s[60]),P=f(P,_,I,T,k,10,s[61]),T=f(T,P,_,I,p,15,s[62]),I=f(I,T,P,_,C,21,s[63]),a[0]=a[0]+_|0,a[1]=a[1]+I|0,a[2]=a[2]+T|0,a[3]=a[3]+P|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;r[o>>>5]|=128<<24-o%32;var a=e.floor(n/4294967296),i=n;r[15+(o+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r[14+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return s},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,n,o,a,i){var s=e+(t&r|~t&n)+o+i;return(s<<a|s>>>32-a)+t}function u(e,t,r,n,o,a,i){var s=e+(t&n|r&~n)+o+i;return(s<<a|s>>>32-a)+t}function d(e,t,r,n,o,a,i){var s=e+(t^r^n)+o+i;return(s<<a|s>>>32-a)+t}function f(e,t,r,n,o,a,i){var s=e+(r^(t|~n))+o+i;return(s<<a|s>>>32-a)+t}t.MD5=a._createHelper(c),t.HmacMD5=a._createHmacHelper(c)}(Math),r.MD5)})),ie((function(e,t){var r,n,o,a,i,s,c,l;e.exports=(n=(r=l=pn).lib,o=n.WordArray,a=n.Hasher,i=r.algo,s=[],c=i.SHA1=a.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],a=r[2],i=r[3],c=r[4],l=0;l<80;l++){if(l<16)s[l]=0|e[t+l];else{var u=s[l-3]^s[l-8]^s[l-14]^s[l-16];s[l]=u<<1|u>>>31}var d=(n<<5|n>>>27)+c+s[l];d+=l<20?1518500249+(o&a|~o&i):l<40?1859775393+(o^a^i):l<60?(o&a|o&i|a&i)-1894007588:(o^a^i)-899497514,c=i,i=a,a=o<<30|o>>>2,o=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+a|0,r[3]=r[3]+i|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c),l.SHA1)})),ie((function(e,t){var r;e.exports=(r=pn,function(e){var t=r,n=t.lib,o=n.WordArray,a=n.Hasher,i=t.algo,s=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)t(n)&&(o<8&&(s[o]=r(e.pow(n,.5))),c[o]=r(e.pow(n,1/3)),o++),n++}();var l=[],u=i.SHA256=a.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],a=r[2],i=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=0;p<64;p++){if(p<16)l[p]=0|e[t+p];else{var h=l[p-15],m=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,g=l[p-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;l[p]=m+l[p-7]+v+l[p-16]}var y=n&o^n&a^o&a,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),C=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&u^~s&d)+c[p]+l[p];f=d,d=u,u=s,s=i+C|0,i=a,a=o,o=n,n=C+(b+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+a|0,r[3]=r[3]+i|0,r[4]=r[4]+s|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=e.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=a._createHelper(u),t.HmacSHA256=a._createHmacHelper(u)}(Math),r.SHA256)})),ie((function(e,t){var r,n,o,a,i,s;e.exports=(n=(r=s=pn).lib.WordArray,o=r.algo,a=o.SHA256,i=o.SHA224=a.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=a._createHelper(i),r.HmacSHA224=a._createHmacHelper(i),s.SHA224)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.Hasher,n=e.x64,o=n.Word,a=n.WordArray,i=e.algo;function s(){return o.create.apply(o,arguments)}var c=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=s()}();var u=i.SHA512=t.extend({_doReset:function(){this._hash=new a.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],a=r[2],i=r[3],s=r[4],u=r[5],d=r[6],f=r[7],p=n.high,h=n.low,m=o.high,g=o.low,v=a.high,y=a.low,b=i.high,C=i.low,w=s.high,k=s.low,B=u.high,E=u.low,S=d.high,A=d.low,_=f.high,I=f.low,T=p,P=h,x=m,R=g,N=v,L=y,O=b,D=C,M=w,U=k,F=B,j=E,V=S,z=A,K=_,H=I,q=0;q<80;q++){var Q,W,G=l[q];if(q<16)W=G.high=0|e[t+2*q],Q=G.low=0|e[t+2*q+1];else{var X=l[q-15],Y=X.high,$=X.low,Z=(Y>>>1|$<<31)^(Y>>>8|$<<24)^Y>>>7,J=($>>>1|Y<<31)^($>>>8|Y<<24)^($>>>7|Y<<25),ee=l[q-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,oe=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ae=l[q-7],ie=ae.high,se=ae.low,ce=l[q-16],le=ce.high,ue=ce.low;W=(W=(W=Z+ie+((Q=J+se)>>>0<J>>>0?1:0))+ne+((Q+=oe)>>>0<oe>>>0?1:0))+le+((Q+=ue)>>>0<ue>>>0?1:0),G.high=W,G.low=Q}var de,fe=M&F^~M&V,pe=U&j^~U&z,he=T&x^T&N^x&N,me=P&R^P&L^R&L,ge=(T>>>28|P<<4)^(T<<30|P>>>2)^(T<<25|P>>>7),ve=(P>>>28|T<<4)^(P<<30|T>>>2)^(P<<25|T>>>7),ye=(M>>>14|U<<18)^(M>>>18|U<<14)^(M<<23|U>>>9),be=(U>>>14|M<<18)^(U>>>18|M<<14)^(U<<23|M>>>9),Ce=c[q],we=Ce.high,ke=Ce.low,Be=K+ye+((de=H+be)>>>0<H>>>0?1:0),Ee=ve+me;K=V,H=z,V=F,z=j,F=M,j=U,M=O+(Be=(Be=(Be=Be+fe+((de+=pe)>>>0<pe>>>0?1:0))+we+((de+=ke)>>>0<ke>>>0?1:0))+W+((de+=Q)>>>0<Q>>>0?1:0))+((U=D+de|0)>>>0<D>>>0?1:0)|0,O=N,D=L,N=x,L=R,x=T,R=P,T=Be+(ge+he+(Ee>>>0<ve>>>0?1:0))+((P=de+Ee|0)>>>0<de>>>0?1:0)|0}h=n.low=h+P,n.high=p+T+(h>>>0<P>>>0?1:0),g=o.low=g+R,o.high=m+x+(g>>>0<R>>>0?1:0),y=a.low=y+L,a.high=v+N+(y>>>0<L>>>0?1:0),C=i.low=C+D,i.high=b+O+(C>>>0<D>>>0?1:0),k=s.low=k+U,s.high=w+M+(k>>>0<U>>>0?1:0),E=u.low=E+j,u.high=B+F+(E>>>0<j>>>0?1:0),A=d.low=A+z,d.high=S+V+(A>>>0<z>>>0?1:0),I=f.low=I+H,f.high=_+K+(I>>>0<H>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(u),e.HmacSHA512=t._createHmacHelper(u)}(),r.SHA512)})),ie((function(e,t){var r,n,o,a,i,s,c,l;e.exports=(n=(r=l=pn).x64,o=n.Word,a=n.WordArray,i=r.algo,s=i.SHA512,c=i.SHA384=s.extend({_doReset:function(){this._hash=new a.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=s._createHelper(c),r.HmacSHA384=s._createHmacHelper(c),l.SHA384)})),ie((function(e,t){var r;e.exports=(r=pn,function(e){var t=r,n=t.lib,o=n.WordArray,a=n.Hasher,i=t.x64.Word,s=t.algo,c=[],l=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,a=0;a<24;a++){for(var s=0,d=0,f=0;f<7;f++){if(1&o){var p=(1<<f)-1;p<32?d^=1<<p:s^=1<<p-32}128&o?o=o<<1^113:o<<=1}u[a]=i.create(s,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=i.create()}();var f=s.SHA3=a.extend({cfg:a.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new i.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,o=0;o<n;o++){var a=e[t+2*o],i=e[t+2*o+1];a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),(I=r[o]).high^=i,I.low^=a}for(var s=0;s<24;s++){for(var f=0;f<5;f++){for(var p=0,h=0,m=0;m<5;m++)p^=(I=r[f+5*m]).high,h^=I.low;var g=d[f];g.high=p,g.low=h}for(f=0;f<5;f++){var v=d[(f+4)%5],y=d[(f+1)%5],b=y.high,C=y.low;for(p=v.high^(b<<1|C>>>31),h=v.low^(C<<1|b>>>31),m=0;m<5;m++)(I=r[f+5*m]).high^=p,I.low^=h}for(var w=1;w<25;w++){var k=(I=r[w]).high,B=I.low,E=c[w];E<32?(p=k<<E|B>>>32-E,h=B<<E|k>>>32-E):(p=B<<E-32|k>>>64-E,h=k<<E-32|B>>>64-E);var S=d[l[w]];S.high=p,S.low=h}var A=d[0],_=r[0];for(A.high=_.high,A.low=_.low,f=0;f<5;f++)for(m=0;m<5;m++){var I=r[w=f+5*m],T=d[w],P=d[(f+1)%5+5*m],x=d[(f+2)%5+5*m];I.high=T.high^~P.high&x.high,I.low=T.low^~P.low&x.low}I=r[0];var R=u[s];I.high^=R.high,I.low^=R.low}},_doFinalize:function(){var t=this._data,r=t.words,n=(this._nDataBytes,8*t.sigBytes),a=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/a)*a>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var i=this._state,s=this.cfg.outputLength/8,c=s/8,l=[],u=0;u<c;u++){var d=i[u],f=d.high,p=d.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),l.push(p),l.push(f)}return new o.init(l,s)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=a._createHelper(f),t.HmacSHA3=a._createHmacHelper(f)}(Math),r.SHA3)})),ie((function(e,t){var r;e.exports=(r=pn,
|
|
25
25
|
/** @preserve
|
|
26
26
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
27
27
|
|
|
@@ -38,7 +38,7 @@ function(e){var t=r,n=t.lib,o=n.WordArray,a=n.Hasher,i=t.algo,s=o.create([0,1,2,
|
|
|
38
38
|
* derived from CryptoJS.mode.CTR
|
|
39
39
|
* Jan Hruby jhruby.web@gmail.com
|
|
40
40
|
*/
|
|
41
|
-
(r=pn).mode.CTRGladman=function(){var e=r.lib.BlockCipherMode.extend();function t(e){if(255==(e>>24&255)){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}else e+=1<<24;return e}function n(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var o=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,a=this._iv,i=this._counter;a&&(i=this._counter=a.slice(0),this._iv=void 0),n(i);var s=i.slice(0);r.encryptBlock(s,0);for(var c=0;c<o;c++)e[t+c]^=s[c]}});return e.Decryptor=o,e}(),r.mode.CTRGladman)})),ie((function(e,t){var r,n,o;e.exports=((o=pn).mode.OFB=(n=(r=o.lib.BlockCipherMode.extend()).Encryptor=r.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,a=this._keystream;o&&(a=this._keystream=o.slice(0),this._iv=void 0),r.encryptBlock(a,0);for(var i=0;i<n;i++)e[t+i]^=a[i]}}),r.Decryptor=n,r),o.mode.OFB)})),ie((function(e,t){var r,n;e.exports=((n=pn).mode.ECB=((r=n.lib.BlockCipherMode.extend()).Encryptor=r.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),r.Decryptor=r.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),r),n.mode.ECB)})),ie((function(e,t){var r;e.exports=((r=pn).pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,o=n-r%n,a=r+o-1;e.clamp(),e.words[a>>>2]|=o<<24-a%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),ie((function(e,t){var r;e.exports=((r=pn).pad.Iso10126={pad:function(e,t){var n=4*t,o=n-e.sigBytes%n;e.concat(r.lib.WordArray.random(o-1)).concat(r.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),ie((function(e,t){var r;e.exports=((r=pn).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),ie((function(e,t){var r;e.exports=((r=pn).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),ie((function(e,t){var r;e.exports=((r=pn).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),ie((function(e,t){var r,n,o,a;e.exports=(n=(r=a=pn).lib.CipherParams,o=r.enc.Hex,r.format.Hex={stringify:function(e){return e.ciphertext.toString(o)},parse:function(e){var t=o.parse(e);return n.create({ciphertext:t})}},a.format.Hex)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.BlockCipher,n=e.algo,o=[],a=[],i=[],s=[],c=[],l=[],u=[],d=[],f=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var h=n^n<<1^n<<2^n<<3^n<<4;h=h>>>8^255&h^99,o[r]=h,a[h]=r;var m=e[r],g=e[m],v=e[g],y=257*e[h]^16843008*h;i[r]=y<<24|y>>>8,s[r]=y<<16|y>>>16,c[r]=y<<8|y>>>24,l[r]=y,y=16843009*v^65537*g^257*m^16843008*r,u[h]=y<<24|y>>>8,d[h]=y<<16|y>>>16,f[h]=y<<8|y>>>24,p[h]=y,r?(r=m^e[e[e[v^m]]],n^=e[e[n]]):r=n=1}}();var h=[0,1,2,4,8,16,32,64,128,27,54],m=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),a=this._keySchedule=[],i=0;i<n;i++)i<r?a[i]=t[i]:(l=a[i-1],i%r?r>6&&i%r==4&&(l=o[l>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l]):(l=o[(l=l<<8|l>>>24)>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l],l^=h[i/r|0]<<24),a[i]=a[i-r]^l);for(var s=this._invKeySchedule=[],c=0;c<n;c++){if(i=n-c,c%4)var l=a[i];else l=a[i-4];s[c]=c<4||i<=4?l:u[o[l>>>24]]^d[o[l>>>16&255]]^f[o[l>>>8&255]]^p[o[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,i,s,c,l,o)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,d,f,p,a),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,o,a,i,s){for(var c=this._nRounds,l=e[t]^r[0],u=e[t+1]^r[1],d=e[t+2]^r[2],f=e[t+3]^r[3],p=4,h=1;h<c;h++){var m=n[l>>>24]^o[u>>>16&255]^a[d>>>8&255]^i[255&f]^r[p++],g=n[u>>>24]^o[d>>>16&255]^a[f>>>8&255]^i[255&l]^r[p++],v=n[d>>>24]^o[f>>>16&255]^a[l>>>8&255]^i[255&u]^r[p++],y=n[f>>>24]^o[l>>>16&255]^a[u>>>8&255]^i[255&d]^r[p++];l=m,u=g,d=v,f=y}m=(s[l>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&f])^r[p++],g=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[f>>>8&255]<<8|s[255&l])^r[p++],v=(s[d>>>24]<<24|s[f>>>16&255]<<16|s[l>>>8&255]<<8|s[255&u])^r[p++],y=(s[f>>>24]<<24|s[l>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^r[p++],e[t]=m,e[t+1]=g,e[t+2]=v,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib,n=t.WordArray,o=t.BlockCipher,a=e.algo,i=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=a.DES=o.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=i[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var o=this._subKeys=[],a=0;a<16;a++){var l=o[a]=[],u=c[a];for(r=0;r<24;r++)l[r/6|0]|=t[(s[r]-1+u)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(s[r+24]-1+u)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var d=this._invSubKeys=[];for(r=0;r<16;r++)d[r]=o[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],f.call(this,4,252645135),f.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),f.call(this,1,1431655765);for(var n=0;n<16;n++){for(var o=r[n],a=this._lBlock,i=this._rBlock,s=0,c=0;c<8;c++)s|=l[c][((i^o[c])&u[c])>>>0];this._lBlock=i,this._rBlock=a^s}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function f(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function p(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}e.DES=o._createHelper(d);var h=a.TripleDES=o.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),o=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(t)),this._des2=d.createEncryptor(n.create(r)),this._des3=d.createEncryptor(n.create(o))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=o._createHelper(h)}(),r.TripleDES)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=n.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],o=0;o<256;o++)n[o]=o;o=0;for(var a=0;o<256;o++){var i=o%r,s=t[i>>>2]>>>24-i%4*8&255;a=(a+n[o]+s)%256;var c=n[o];n[o]=n[a],n[a]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=a.call(this)},keySize:8,ivSize:0});function a(){for(var e=this._S,t=this._i,r=this._j,n=0,o=0;o<4;o++){r=(r+e[t=(t+1)%256])%256;var a=e[t];e[t]=e[r],e[r]=a,n|=e[(e[t]+e[r])%256]<<24-8*o}return this._i=t,this._j=r,n}e.RC4=t._createHelper(o);var i=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)a.call(this)}});e.RC4Drop=t._createHelper(i)}(),r.RC4)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=[],a=[],i=[],s=n.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)o[r]^=n[r+4&7];if(t){var a=t.words,i=a[0],s=a[1],l=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=l>>>16|4294901760&u,f=u<<16|65535&l;for(o[0]^=l,o[1]^=d,o[2]^=u,o[3]^=f,o[4]^=l,o[5]^=d,o[6]^=u,o[7]^=f,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)a[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);i[r]=c^l}e[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,e[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,e[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,e[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,e[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,e[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,e[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,e[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}e.Rabbit=t._createHelper(s)}(),r.Rabbit)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=[],a=[],i=[],s=n.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)n[o]^=r[o+4&7];if(t){var a=t.words,i=a[0],s=a[1],l=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=l>>>16|4294901760&u,f=u<<16|65535&l;for(n[0]^=l,n[1]^=d,n[2]^=u,n[3]^=f,n[4]^=l,n[5]^=d,n[6]^=u,n[7]^=f,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)a[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);i[r]=c^l}e[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,e[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,e[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,e[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,e[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,e[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,e[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,e[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}e.RabbitLegacy=t._createHelper(s)}(),r.RabbitLegacy)})),ie((function(e,t){e.exports=pn}))),mn=function(e){var t=e.blob;return new Promise((function(e){var r=new FileReader;r.onload=function(t){var r=t.target.result,n=hn.MD5(hn.lib.WordArray.create(r)).toString();e(n)},r.readAsArrayBuffer(t)}))},gn=Object.freeze({__proto__:null,MD5:mn}),vn=["tracking"],yn=on(),bn=t.createContext(),Cn={enable:!1,accessKey:"",secretKey:"",apiUrl:"",userId:""},wn=function(){var e=K(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f,p,h,m;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.tag,n=t.event,o=t.log,a=cn(new Date),i=o,e.t0=n,e.next="sdk_mode.read_id_card_one_side"===e.t0?6:"sdk_mode.liveness"===e.t0?19:36;break;case 6:return i=rn(o),s=o.result_object,e.next=10,mn({blob:s.image.blob});case 10:if(e.t1=e.sent,i.result_object.image={blob:e.t1},delete i.result_object.recordedVideos,!s.qrScannedResult){e.next=18;break}return e.next=16,mn({blob:s.qrScannedResult.image.blob});case 16:i.result_object.qrScannedResult.image.blob=e.sent,delete i.result_object.qrScannedResult.recordedVideos;case 18:return e.abrupt("break",36);case 19:return i=rn(o),c=o.result_object,l=c.steps,u=c.frontalFaces,d=c.frontalScaledImage,f=l.map((function(e){return mn({blob:e.image.blob})})),e.next=24,Promise.all(f);case 24:return p=e.sent,l.forEach((function(e,t){i.result_object.steps[t].image.blob=p[t]})),h=u.map((function(e){return mn({blob:e})})),e.next=29,Promise.all(h);case 29:if(m=e.sent,u.forEach((function(e,t){i.result_object.frontalFaces[t]=m[t]})),!d){e.next=35;break}return e.next=34,mn({blob:d});case 34:i.result_object.frontalScaledImage=e.sent;case 35:return e.abrupt("break",36);case 36:return e.abrupt("return",{tag:r,event:n,log:W({device_time:a},i)});case 37:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function kn(e){var t,r=e.userId;if(r)t=r;else{var n=dn("user-id");if(n)t=n;else{var o=tn();t=o,un(o,"user-id")}}return t}function Bn(e){var r=e.value,a=e.children,i=r.tracking,s=void 0===i?Cn:i,c=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(r,vn),l=s.enable,u=s.accessKey,d=s.secretKey,f=s.apiUrl,p=s.userId,h=n((function(){return l?f&&u&&d?new Gr(u,d,f):(console.error("apiUrl, accessKey and secretKey are required when tracking is enabled"),null):null}),[l,u,d,f]),m=n((function(){var e=kn({userId:p});return W(W({},yn),{},{"x-request-id":e})}),[p]),g=o(K(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]?s[0]:{},r=t.tag,n=t.event,o=t.log,a=void 0===o?{}:o,!l){e.next=11;break}return e.prev=2,e.next=5,wn({tag:r,event:n,log:a});case 5:i=e.sent,h.httpClient.post("/v1/log_events",i,m),e.next=11;break;case 9:e.prev=9,e.t0=e.catch(2);case 11:case"end":return e.stop()}}),e,null,[[2,9]])}))),[h,m,l]);return t.createElement(bn.Provider,{value:W(W({},c),{},{sendEvent:g})},a)}function En(){var e=a(bn);return n((function(){return void 0===e?(console.warn("useSDKTracking must be used within a SDKTrackingProvider"),{sendEvent:function(){}}):e}),[e])}Bn.propTypes={value:p.shape({tracking:p.shape({enable:p.bool,accessKey:p.string,secretKey:p.string,apiUrl:p.string,userId:p.string})}).isRequired,children:p.node.isRequired};var Sn=Object.freeze({__proto__:null,defaultTrackingConfig:Cn,getXRequestId:kn,SDKTrackingProvider:Bn,useSDKTracking:En});function An(e,t){return e&&!e.endsWith("/")?[e,"/",t].join(""):[e,t].join("")}function _n(){var e=Hr();return null==e?void 0:e.assetRoot}var In=Object.freeze({__proto__:null,getAsset:An,useAssetRoot:_n,useAsset:function(e){return An(_n(),e)}});function Tn(e){return new Promise((function(t){return setTimeout(t,e)}))}var Pn=Object.freeze({__proto__:null,sleep:Tn}),xn=Symbol("Comlink.proxy"),Rn=Symbol("Comlink.endpoint"),Nn=Symbol("Comlink.releaseProxy"),Ln=Symbol("Comlink.thrown"),On=function(e){return"object"==w(e)&&null!==e||"function"==typeof e},Dn=new Map([["proxy",{canHandle:function(e){return On(e)&&e[xn]},serialize:function(e){var t=new MessageChannel,r=t.port1,n=t.port2;return Mn(e,r),[n,[n]]},deserialize:function(e){return e.start(),jn(e)}}],["throw",{canHandle:function(e){return On(e)&&Ln in e},serialize:function(e){var t=e.value;return[t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[]]},deserialize:function(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function Mn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:self;t.addEventListener("message",(function r(n){if(n&&n.data){var o,a=Object.assign({path:[]},n.data),i=a.id,s=a.type,c=a.path,l=(n.data.argumentList||[]).map(qn);try{var u=c.slice(0,-1).reduce((function(e,t){return e[t]}),e),d=c.reduce((function(e,t){return e[t]}),e);switch(s){case"GET":o=d;break;case"SET":u[c.slice(-1)[0]]=qn(n.data.value),o=!0;break;case"APPLY":o=d.apply(u,l);break;case"CONSTRUCT":o=function(e){return Object.assign(e,S({},xn,!0))}(x(d,O(l)));break;case"ENDPOINT":var f=new MessageChannel,p=f.port1,h=f.port2;Mn(e,h),o=function(e,t){return Kn.set(e,t),e}(p,[p]);break;case"RELEASE":o=void 0;break;default:return}}catch(e){o=S({value:e},Ln,0)}Promise.resolve(o).catch((function(e){return S({value:e},Ln,0)})).then((function(e){var n=L(Hn(e),2),o=n[0],a=n[1];t.postMessage(Object.assign(Object.assign({},o),{id:i}),a),"RELEASE"===s&&(t.removeEventListener("message",r),Un(t))}))}})),t.start&&t.start()}function Un(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function jn(e,t){return Vn(e,[],t)}function Fn(e){if(e)throw new Error("Proxy has been released and is not useable")}function Vn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=!1,o=new Proxy(r,{get:function(r,a){if(Fn(n),a===Nn)return function(){return Qn(e,{type:"RELEASE",path:t.map((function(e){return e.toString()}))}).then((function(){Un(e),n=!0}))};if("then"===a){if(0===t.length)return{then:function(){return o}};var i=Qn(e,{type:"GET",path:t.map((function(e){return e.toString()}))}).then(qn);return i.then.bind(i)}return Vn(e,[].concat(O(t),[a]))},set:function(r,o,a){Fn(n);var i=L(Hn(a),2),s=i[0],c=i[1];return Qn(e,{type:"SET",path:[].concat(O(t),[o]).map((function(e){return e.toString()})),value:s},c).then(qn)},apply:function(r,o,a){Fn(n);var i=t[t.length-1];if(i===Rn)return Qn(e,{type:"ENDPOINT"}).then(qn);if("bind"===i)return Vn(e,t.slice(0,-1));var s=L(zn(a),2),c=s[0],l=s[1];return Qn(e,{type:"APPLY",path:t.map((function(e){return e.toString()})),argumentList:c},l).then(qn)},construct:function(r,o){Fn(n);var a=L(zn(o),2),i=a[0],s=a[1];return Qn(e,{type:"CONSTRUCT",path:t.map((function(e){return e.toString()})),argumentList:i},s).then(qn)}});return o}function zn(e){var t,r=e.map(Hn);return[r.map((function(e){return e[0]})),(t=r.map((function(e){return e[1]})),Array.prototype.concat.apply([],t))]}var Kn=new WeakMap;function Hn(e){var t,r=U(Dn);try{for(r.s();!(t=r.n()).done;){var n=L(t.value,2),o=n[0],a=n[1];if(a.canHandle(e)){var i=L(a.serialize(e),2);return[{type:"HANDLER",name:o,value:i[0]},i[1]]}}}catch(e){r.e(e)}finally{r.f()}return[{type:"RAW",value:e},Kn.get(e)||[]]}function qn(e){switch(e.type){case"HANDLER":return Dn.get(e.name).deserialize(e.value);case"RAW":return e.value}}function Qn(e,t,r){return new Promise((function(n){var o=new Array(4).fill(0).map((function(){return Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)})).join("-");e.addEventListener("message",(function t(r){r.data&&r.data.id&&r.data.id===o&&(e.removeEventListener("message",t),n(r.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),r)}))}var Wn=function(){if(!window.Worker)return null;var e=new Blob(['const t=Symbol("Comlink.proxy"),e=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.thrown"),a=t=>"object"==typeof t&&null!==t||"function"==typeof t,o=new Map([["proxy",{canHandle:e=>a(e)&&e[t],serialize(t){const{port1:e,port2:r}=new MessageChannel;return i(t,e),[r,[r]]},deserialize(t){return t.start(),s(t,[],e);var e}}],["throw",{canHandle:t=>a(t)&&n in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function i(e,r=self){r.addEventListener("message",(function a(o){if(!o||!o.data)return;const{id:c,type:s,path:l}=Object.assign({path:[]},o.data),g=(o.data.argumentList||[]).map(m);let p;try{const r=l.slice(0,-1).reduce(((t,e)=>t[e]),e),n=l.reduce(((t,e)=>t[e]),e);switch(s){case"GET":p=n;break;case"SET":r[l.slice(-1)[0]]=m(o.data.value),p=!0;break;case"APPLY":p=n.apply(r,g);break;case"CONSTRUCT":p=function(e){return Object.assign(e,{[t]:!0})}(new n(...g));break;case"ENDPOINT":{const{port1:t,port2:r}=new MessageChannel;i(e,r),p=function(t,e){return f.set(t,e),t}(t,[t])}break;case"RELEASE":p=void 0;break;default:return}}catch(t){p={value:t,[n]:0}}Promise.resolve(p).catch((t=>({value:t,[n]:0}))).then((t=>{const[e,n]=h(t);r.postMessage(Object.assign(Object.assign({},e),{id:c}),n),"RELEASE"===s&&(r.removeEventListener("message",a),u(r))}))})),r.start&&r.start()}function u(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function c(t){if(t)throw new Error("Proxy has been released and is not useable")}function s(t,n=[],a=function(){}){let o=!1;const i=new Proxy(a,{get(e,a){if(c(o),a===r)return()=>g(t,{type:"RELEASE",path:n.map((t=>t.toString()))}).then((()=>{u(t),o=!0}));if("then"===a){if(0===n.length)return{then:()=>i};const e=g(t,{type:"GET",path:n.map((t=>t.toString()))}).then(m);return e.then.bind(e)}return s(t,[...n,a])},set(e,r,a){c(o);const[i,u]=h(a);return g(t,{type:"SET",path:[...n,r].map((t=>t.toString())),value:i},u).then(m)},apply(r,a,i){c(o);const u=n[n.length-1];if(u===e)return g(t,{type:"ENDPOINT"}).then(m);if("bind"===u)return s(t,n.slice(0,-1));const[f,h]=l(i);return g(t,{type:"APPLY",path:n.map((t=>t.toString())),argumentList:f},h).then(m)},construct(e,r){c(o);const[a,i]=l(r);return g(t,{type:"CONSTRUCT",path:n.map((t=>t.toString())),argumentList:a},i).then(m)}});return i}function l(t){const e=t.map(h);return[e.map((t=>t[0])),(r=e.map((t=>t[1])),Array.prototype.concat.apply([],r))];var r}const f=new WeakMap;function h(t){for(const[e,r]of o)if(r.canHandle(t)){const[n,a]=r.serialize(t);return[{type:"HANDLER",name:e,value:n},a]}return[{type:"RAW",value:t},f.get(t)||[]]}function m(t){switch(t.type){case"HANDLER":return o.get(t.name).deserialize(t.value);case"RAW":return t.value}}function g(t,e,r){return new Promise((n=>{const a=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.addEventListener("message",(function e(r){r.data&&r.data.id&&r.data.id===a&&(t.removeEventListener("message",e),n(r.data))})),t.start&&t.start(),t.postMessage(Object.assign({id:a},e),r)}))}var p=[[0,1,0],[1,-4,1],[0,1,0]];function d(t,e,r,n){return t[4*(r*e+n)]}function v(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){a=!0,o=t}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return b(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var E="frontal",S="left",w="right",M="up",k="down",_=0,A=1,R=2;function L(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=y(t,2),a=n[0],o=n[1],i=y(e,2),u=i[0],c=i[1],s=[a[0],o[0]],l=[a[1],o[1]];return s[0]+r<=u[0]&&c[0]<=s[1]-r&&l[0]+r<=u[1]&&c[1]<=l[1]-.8*r?R:s[0]<=u[0]||c[0]<=s[1]||l[0]<=u[1]||c[1]<=l[1]?A:_}var P={code:"no_face",msg:{en:"Face not found",vi:"Không tìm thấy khuôn mặt"}},O={code:"partial_face",msg:{en:"Face out of the box",vi:"Không tìm thấy toàn bộ khuôn mặt"}},j={code:"multiple_faces",msg:{en:"Too many faces",vi:"Quá nhiều khuôn mặt"}},T={code:"face_too_small",msg:{en:"Face too small",vi:"Khuôn mặt quá nhỏ"}},F={code:"face_too_large",msg:{en:"Face too large",vi:"Khuôn mặt quá to"}},x={code:"face_out_of_box",msg:{en:"Face is out of box",vi:"Khuôn mặt không nằm trọn vẹn trong khung ảnh"}};function C(t){return Math.pow(Math.pow(t[0],2)+Math.pow(t[1],2),.5)}function N(t,e){return[t[0]-e[0],t[1]-e[1]]}function z(t,e,r,n){var a=r*(4*e)+4*n;return{r:t[a],g:t[a+1],b:t[a+2]}}i({calculateBlurScoreFunc:function(t){for(var e=t.data,r=t.reducedWidth,n=t.reducedHeight,a=0;a<e.length;a+=4){var o=(e[a]+e[a+1]+e[a+2])/3;e[a]=o}for(var i=0,u=0,c=n-1,s=r-1,l=1;l<c;l++)for(var f=1;f<s;f++){var h=p[0][0]*d(e,r,f-1,l-1)+p[0][1]*d(e,r,f,l-1)+p[0][2]*d(e,r,f+1,l-1)+p[1][0]*d(e,r,f-1,l)+p[1][1]*d(e,r,f,l)+p[1][2]*d(e,r,f+1,l)+p[2][0]*d(e,r,f-1,l+1)+p[2][1]*d(e,r,f,l+1)+p[2][2]*d(e,r,f+1,l+1);(h=Math.abs(h))>25&&i++,h>15&&h<25&&u++}var m=0;return i+u!==0&&(m=i/(i+u)),m},calculateFaceDirectionFunc:function(t){var e=t.landmarks,r=t.getPerfectFrontal,n=function(t){var e,r,n,a,o,i,u,c=y(t,4),s=c[0],l=c[1],f=c[2],h=c[3],m=N(l,s),g=C(m),p=(a=l,e=[(n=s)[0]+a[0],n[1]+a[1]],r=2,[e[0]/r,e[1]/r]),d=N(f,p),v=C(N(h,f)),b=N(h,p),E=C(b),S=(d[0]*b[0]+d[1]*b[1])/E,w=v/E;if(g>.5*E)o=(d[0]*m[0]+d[1]*m[1])/g/g;else{var M=C(N(d,function(t,e){return[t[0]*e,t[1]*e]}(b,S/E)));u=b,o=((i=d)[0]*u[1]-u[0]*i[1]>=0?1:-1)*M/g}return{left_right_score:o,up_down_score:w}}(e),a=n.left_right_score,o=n.up_down_score,i=y(e,3),u=i[0],c=i[1],s=i[2],l=c[0]-s[0],f=u[0]-s[0],h=r?.1:.3,m=o>.7,g=o<.42,p=a>=.35&&a<=.6,d=a<=-.35&&a>=-.6;return o>=.42&&o<=.7&&a>-h&&a<h&&l*f<0?{gesture:E,leftRightScore:a}:m&&!d&&!p?{gesture:M,leftRightScore:a}:g&&!d&&!p?{gesture:k,leftRightScore:a}:p&&!m&&!g?{gesture:w,leftRightScore:a}:d&&!m&&!g?{gesture:S,leftRightScore:a}:null},validatePredictionsFunc:function(t){var e,r,n,a,o,i,u,c,s,l,f,h,m,g,p,d,b,E,S,w,M,k,C,N,z,H,I,D,K,G,W,U,q=t.predictions,Y=t.width,B=[[0,0],[Y,t.height]],Q=q.reduce((function(t,e){var r=e.topLeft,n=e.bottomRight,a=e.probability,o=e.landmarks;a<.9||o.length<6||function(t){var e=t.small,r=e.coords,n=e.area,a=t.big,o=a.coords,i=a.area,u=n;if(!u){var c=y(r,2),s=c[0],l=c[1];u=(l[0]-s[0])*(l[1]-s[1])}var f=i;if(!f){var h=y(o,2),m=h[0],g=h[1];f=(g[0]-m[0])*(g[1]-m[1])}return u/f}({small:{coords:[r,n]},big:{coords:B}})<=.025?t[_].push(e):t[L(B,[r,n])].push(e);return t}),(v(e={},A,[]),v(e,R,[]),v(e,_,[]),e)),X=Q[R].length,$=Q[A].length;if(0===X)r=$>0?O:P;else if(X+$>1)r=j;else{var J=n=Q[R][0],V=J.topLeft,Z=J.bottomRight,tt=(C=B,N=y([V,Z],2),z=N[0],H=N[1],I=y(C,2),D=I[0],K=I[1],G=H[0]-z[0],W=H[1]-z[1],U=K[0]-D[0],G/U<W/U?G/U:W/U);tt<.4&&(r=T),tt>.61&&(r=F),L(B,(a=n.landmarks,u=a[0],c=a[1],s=a[2],l=a[3],f=a[4],h=a[5],m=.5*(u[1]+c[1]),g=m+1.5*(m-l[1]),p=l[1]-1.2*(s[1]-l[1]),d=[u[0],c[0],s[0],l[0],f[0],h[0]],b=Math.min.apply(Math,d),E=Math.min(g,p),S=Math.max.apply(Math,d),w=Math.max(g,p),M=Math.abs(l[0]-f[0])/Math.abs(l[0]-h[0]),k=l[0]-f[0]<0&&h[0]-l[0]>.05*(S-b),l[0]-f[0]>0&&h[0]-l[0]<-.05*(S-b)?(o=.2,i=.1):k?(o=.1,i=.2):M>2||M<.5?(o=.15,i=.15):(o=.05,i=.05),[[b-o*(S-b),E],[S+i*(S-b),w]]),.05*Y)!==R&&(r=x)}return{error:r,fullFace:n}},detectGlare:function(t,e,r){return function(t,e,r){for(var n=0,a=r[1],o=r[3],i=r[0],u=r[2],c=a;c<o;c++)for(var s=i;s<u;s++){var l=z(t,e,c,s),f=l.r,h=l.g,m=l.b;f>=245&&m>=245&&h>245&&(n+=1)}return n}(t,e,function(t,e){var r=Math.floor(.025*t),n=t-r,a=Math.floor(.025*e);return[r,a,n,e-a]}(e,r))/(e*r)>=.001}});']),t=URL.createObjectURL(e);return jn(new Worker(t))}(),Gn=[[0,1,0],[1,-4,1],[0,1,0]];function Xn(e,t,r,n){return e[4*(r*t+n)]}function Yn(e){for(var t=e.data,r=e.reducedWidth,n=e.reducedHeight,o=0;o<t.length;o+=4){var a=(t[o]+t[o+1]+t[o+2])/3;t[o]=a}for(var i=0,s=0,c=n-1,l=r-1,u=1;u<c;u++)for(var d=1;d<l;d++){var f=Gn[0][0]*Xn(t,r,d-1,u-1)+Gn[0][1]*Xn(t,r,d,u-1)+Gn[0][2]*Xn(t,r,d+1,u-1)+Gn[1][0]*Xn(t,r,d-1,u)+Gn[1][1]*Xn(t,r,d,u)+Gn[1][2]*Xn(t,r,d+1,u)+Gn[2][0]*Xn(t,r,d-1,u+1)+Gn[2][1]*Xn(t,r,d,u+1)+Gn[2][2]*Xn(t,r,d+1,u+1);(f=Math.abs(f))>25&&i++,f>15&&f<25&&s++}var p=0;return i+s!==0&&(p=i/(i+s)),p}function $n(e){var t=e.width,r=e.height,n=e.getContext("2d"),o=Math.floor(t/2.8),a=Math.floor(r/2.8),i=t-o,s=r-a;return{data:n.getImageData(Math.floor(o/2),Math.floor(a/2),i,s).data,reducedWidth:i,reducedHeight:s}}function Zn(){return(Zn=K(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=$n(t),Wn){e.next=3;break}return e.abrupt("return",Yn(r));case 3:return e.abrupt("return",Wn.calculateBlurScoreFunc(r));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Jn(e,t,r,n){return e[4*(n*t+r)]}var eo=Object.freeze({__proto__:null,calculateBlurScore:function(e){return Zn.apply(this,arguments)},hasBetterBlurScore:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.01;return null===t||e-t>r},hasBetterCardBlurScore:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.01;return null===t||t-e>r},calculateIdCardBlurScore:function(e){var t=e.canvas,r=document.createElement("canvas"),n=r.getContext("2d");r.width=430,r.height=270,n.drawImage(t,0,0,r.width,r.height);var o=Math.floor(129),a=Math.floor(13.5),i=Math.floor(408.5),s=Math.floor(256.5),c=document.createElement("canvas"),l=c.getContext("2d"),u=i-o,d=s-a;c.width=u,c.height=d,l.drawImage(r,o,a,u,d,0,0,u,d);for(var f=l.getImageData(0,0,u,d).data,p=0;p<f.length;p+=4){var h=Math.round(.299*f[p]+.587*f[p+1]+.114*f[p+2]);f[p]=h}for(var m=d-1,g=u-1,v=0,y=[],b=1;b<m;b++)for(var C=1;C<g;C++){var w=4*-Jn(f,u,C,b)+Jn(f,u,C,b-1)+Jn(f,u,C,b+1)+Jn(f,u,C-1,b)+Jn(f,u,C+1,b);v+=w,y.push(w)}v/=(u-2)*(d-2);for(var k=0,B=0;B<y.length;B++){var E=y[B]-v;k+=Math.pow(E,2)}var S=Math.sqrt(k/y.length);return 1/(1+Math.pow(2,S/2-10))}});function to(e){var t,r,n,o,a,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=s.x,u=s.y,d=s.width,f=s.height,p=e.videoWidth,h=e.videoHeight,m=window.innerWidth,g=window.innerHeight,v=m/g,y=p/h;v<y?(a=l*(n=p/m),i=(u-(t=(g-m/y)/2))*(o=h/(g-2*t))):(a=(l-(r=(m-g*y)/2))*(n=p/(m-2*r)),i=u*(o=h/g));var b=d*n,C=f*o,w=b,k=C,B=Math.max(b,C)*c;return{lostX:r,lostY:t,cropWidth:b=Math.floor(Math.min(p,b+2*B)),cropHeight:C=Math.floor(Math.min(h,C+2*B)),cropX:a=Math.floor(Math.max(0,a-B)),cropY:i=Math.floor(Math.max(0,i-B)),cropWidthWithoutPadding:w,cropHeightWithoutPadding:k}}var ro=Object.freeze({__proto__:null,analyzeVideoAndWindowSizes:to,takePicture:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.canvas,n=t.video,o=t.cropArea,a=t.quality,i=void 0===a?1:a;if(r)e=r;else{var s=to(n,o),c=s.cropWidth,l=s.cropHeight,u=s.cropX,d=s.cropY,f=(e=document.createElement("canvas")).getContext("2d");e.width=c,e.height=l,f.drawImage(n,u,d,c,l,0,0,c,l)}return new Promise((function(t){e.toBlob(t,"image/jpeg",i)}))}}),no=function(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=[e[r],e[t]];e[t]=n[0],e[r]=n[1]}return e},oo=Object.freeze({__proto__:null,shuffleArray:no}),ao={NONE:0,PARTIAL:1,FULL:2};function io(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=G(e,2),o=n[0],a=n[1],i=G(t,2),s=i[0],c=i[1],l=[o[0],a[0]],u=[o[1],a[1]];return l[0]+r<=s[0]&&c[0]<=l[1]-r&&u[0]+r<=s[1]&&c[1]<=u[1]-.8*r?ao.FULL:l[0]<=s[0]||c[0]<=l[1]||u[0]<=s[1]||c[1]<=u[1]?ao.PARTIAL:ao.NONE}function so(e){var t=e.small,r=t.coords,n=t.area,o=e.big,a=o.coords,i=o.area,s=n;if(!s){var c=G(r,2),l=c[0],u=c[1];s=(u[0]-l[0])*(u[1]-l[1])}var d=i;if(!d){var f=G(a,2),p=f[0],h=f[1];d=(h[0]-p[0])*(h[1]-p[1])}return s/d}function co(e,t){var r=G(e,2),n=r[0],o=r[1],a=G(t,2),i=a[0],s=a[1],c=o[0]-n[0],l=o[1]-n[1],u=s[0]-i[0];return c/u<l/u?c/u:l/u}var lo=Object.freeze({__proto__:null,ContainMode:ao,rectContains:io,rectAreaRatio:so,rectEdgeRatio:co,isFaceCenter:function(e,t){var r=G(e,2),n=r[0],o=r[1],a=G(t,2),i=a[0],s=a[1],c=o[0]-n[0],l=o[1]-n[1],u=s[0]-i[0],d=Math.abs(n[0]-(u-c)/2)/u<.2,f=Math.abs(n[1]-(u-l)/2)/u<.2;return!(!d||!f)}});function uo(e){return Math.pow(Math.pow(e[0],2)+Math.pow(e[1],2),.5)}function fo(e,t){return[e[0]-t[0],e[1]-t[1]]}function po(e){var t=e.landmarks,r=e.getPerfectFrontal,n=function(e){var t,r,n,o,a,i,s=G(e,4),c=s[0],l=s[1],u=s[2],d=s[3],f=fo(l,c),p=uo(f),h=(n=l,2,[(t=[(r=c)[0]+n[0],r[1]+n[1]])[0]/2,t[1]/2]),m=fo(u,h),g=uo(fo(d,u)),v=fo(d,h),y=uo(v),b=(m[0]*v[0]+m[1]*v[1])/y,C=g/y;if(p>.5*y)o=(m[0]*f[0]+m[1]*f[1])/p/p;else{var w=uo(fo(m,function(e,t){return[e[0]*t,e[1]*t]}(v,b/y)));i=v,o=((a=m)[0]*i[1]-i[0]*a[1]>=0?1:-1)*w/p}return{left_right_score:o,up_down_score:C}}(t),o=n.left_right_score,a=n.up_down_score,i=G(t,3),s=i[0],c=i[1],l=i[2],u=c[0]-l[0],d=s[0]-l[0],f=r?.1:.3,p=a>.7,h=a<.42,m=o>=.35&&o<=.6,g=o<=-.35&&o>=-.6;return a>=.42&&a<=.7&&o>-f&&o<f&&u*d<0?{gesture:F.FRONTAL,leftRightScore:o}:!p||g||m?!h||g||m?!m||p||h?!g||p||h?null:{gesture:F.LEFT,leftRightScore:o}:{gesture:F.RIGHT,leftRightScore:o}:{gesture:F.DOWN,leftRightScore:o}:{gesture:F.UP,leftRightScore:o}}function ho(e){var t,r,n,o,a,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k,B=e.predictions,E=e.width,S=[[0,0],[E,e.height]],A=B.reduce((function(e,t){var r=t.topLeft,n=t.bottomRight,o=t.probability,a=t.landmarks;return o<.9||a.length<6||so({small:{coords:[r,n]},big:{coords:S}})<=.025?e[ao.NONE].push(t):e[io(S,[r,n])].push(t),e}),(H(t={},ao.PARTIAL,[]),H(t,ao.FULL,[]),H(t,ao.NONE,[]),t)),_=A[ao.FULL].length,I=A[ao.PARTIAL].length;if(0===_)r=I>0?j.partial_face:j.no_face;else if(_+I>1)r=j.multiple_faces;else{var T=n=A[ao.FULL][0],P=co([T.topLeft,T.bottomRight],S);P<.4&&(r=j.face_too_small),P>.61&&(r=j.face_too_large),io(S,(s=(o=n.landmarks)[0],c=o[1],l=o[2],u=o[3],d=o[4],f=o[5],h=(p=.5*(s[1]+c[1]))+1.5*(p-u[1]),m=u[1]-1.2*(l[1]-u[1]),g=[s[0],c[0],l[0],u[0],d[0],f[0]],v=Math.min.apply(Math,g),y=Math.min(h,m),b=Math.max.apply(Math,g),C=Math.max(h,m),w=Math.abs(u[0]-d[0])/Math.abs(u[0]-f[0]),k=u[0]-d[0]<0&&f[0]-u[0]>.05*(b-v),u[0]-d[0]>0&&f[0]-u[0]<-.05*(b-v)?(a=.2,i=.1):k?(a=.1,i=.2):w>2||w<.5?(a=.15,i=.15):(a=.05,i=.05),[[v-a*(b-v),y],[b+i*(b-v),C]]),.05*E)!==ao.FULL&&(r=j.face_out_of_box)}return{error:r,fullFace:n}}function mo(e,t){var r=t.customInstructions,n=t.customIcon,o=t.customDirectionIcon,a=t.customStepTimeConstraints,i={};return null!=r&&r[e]&&(i.instructions=r[e]),null!=n&&n[e]&&(i.icon=n[e]),null!=o&&o[e]&&(i.directionIcon=o[e]),null!=a&&a[e]&&(i.stepTimeConstraints=a[e]),i}function go(){return(go=K(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wn){e.next=2;break}return e.abrupt("return",ho(t));case 2:return e.abrupt("return",Wn.validatePredictionsFunc(t));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vo(){return(vo=K(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wn){e.next=2;break}return e.abrupt("return",po(t));case 2:return e.abrupt("return",Wn.calculateFaceDirectionFunc(t));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var yo=Object.freeze({__proto__:null,initFaceVerificationData:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.assetRoot,r=void 0===t?"/":t,n=e.customInstructions,o=e.customIcon,a=e.customDirectionIcon,i=e.customStepTimeConstraints;return{curStepIndex:0,steps:[].concat(X(no([W({name:F.LEFT,instructions:{en:"Turn your face to the left",vi:"Quay mặt chậm qua trái"},image:{blob:null,imageId:null,objUrl:null,blurScore:null,leftRightScore:null},frontalFaceImage:{blob:null,imageId:null,blurScore:null,leftRightScore:null},icon:An(r,"ic_face_left.svg"),directionIcon:An(r,"arrow_left.svg"),directionIconAnimation:"slide-horizontal",firstFrameSpottedAt:null,stepTimeConstraints:{delayTime:null}},mo(F.LEFT,{customInstructions:n,customIcon:o,customDirectionIcon:a,customStepTimeConstraints:i})),W({name:F.RIGHT,instructions:{en:"Turn your face to the right",vi:"Quay mặt chậm qua phải"},image:{blob:null,imageId:null,objUrl:null,blurScore:null,leftRightScore:null},frontalFaceImage:{blob:null,imageId:null,blurScore:null,leftRightScore:null},icon:An(r,"ic_face_right.svg"),directionIcon:An(r,"arrow_right.svg"),directionIconAnimation:"slide-horizontal",firstFrameSpottedAt:null,stepTimeConstraints:{delayTime:null}},mo(F.RIGHT,{customInstructions:n,customIcon:o,customDirectionIcon:a,customStepTimeConstraints:i})),W({name:F.UP,instructions:{en:"Turn your face up",vi:"Ngước mặt chậm lên trên"},image:{blob:null,imageId:null,objUrl:null,blurScore:null,leftRightScore:null},frontalFaceImage:{blob:null,imageId:null,blurScore:null,leftRightScore:null},icon:An(r,"ic_face_up.svg"),directionIcon:An(r,"arrow_up.svg"),directionIconAnimation:"slide-vertical",firstFrameSpottedAt:null,stepTimeConstraints:{delayTime:null}},mo(F.UP,{customInstructions:n,customIcon:o,customDirectionIcon:a,customStepTimeConstraints:i}))])),[W({name:F.FRONTAL,instructions:{en:"Look straight into the camera",vi:"Nhìn thẳng camera"},image:{blob:null,imageId:null,objUrl:null,blurScore:null,leftRightScore:null},frontalFaceImage:{blob:null,imageId:null,blurScore:null,leftRightScore:null},icon:An(r,"ic_face_frontal.svg"),directionIcon:An(r,"frontal.svg"),directionIconAnimation:"blink",firstFrameSpottedAt:null,stepTimeConstraints:{delayTime:null}},mo(F.FRONTAL,{customInstructions:n,customIcon:o,customDirectionIcon:a,customStepTimeConstraints:i}))])}},validatePredictions:function(e){return go.apply(this,arguments)},calculateFaceDirection:function(e){return vo.apply(this,arguments)},faceTracker:function(){var e=[],t=[],r=[],n=[],o=[],a=0,i=0;function s(){i=a,r=X(e),n=X(t)}return function(c,l){var u=c.topLeft,d=c.bottomRight,f=c.landmarks,p=[],h=G(u,2);p[0]=h[0],p[1]=h[1];var m=G(d,2);p[2]=m[0],p[3]=m[1];var g=[],v=[];f.forEach((function(e,t){var r=G(e,2);g[t]=r[0],v[t]=r[1]})),a=Date.now();var y=p[2]-p[0];if(e=[].concat(g),t=[].concat(v),!r.length&&!n.length||l)return s(),{score:0,time:a};for(var b=0;b<6;b++)o[b]=Math.sqrt((e[b]-r[b])*(e[b]-r[b])+(t[b]-n[b])*(t[b]-n[b]));for(var C=0;C<6;C++)o[C]/=(a-i)*y;for(var w=0,k=0;k<6;k++)w+=o[k];return w/=6,s(),{score:w,time:a}}}}),bo=document.createElement("canvas"),Co=bo.getContext("2d");bo.width=128,bo.height=128;var wo=function(){var e=K(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.model,n=t.sCanvas,Co.drawImage(n,0,0,bo.width,bo.height),e.abrupt("return",r.estimateFaces(bo,!1,!1,!0));case 3:case"end":return e.stop()}var n}),e)})));return function(t){return e.apply(this,arguments)}}(),ko=Object.freeze({__proto__:null,SIZE:128,getModelPredictions:wo}),Bo=Object.getOwnPropertySymbols,Eo=Object.prototype.hasOwnProperty,So=Object.prototype.propertyIsEnumerable;function Ao(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var _o,Io=function(){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}}()?Object.assign:function(e,t){for(var r,n,o=Ao(e),a=1;a<arguments.length;a++){for(var i in r=Object(arguments[a]))Eo.call(r,i)&&(o[i]=r[i]);if(Bo){n=Bo(r);for(var s=0;s<n.length;s++)So.call(r,n[s])&&(o[n[s]]=r[n[s]])}}return o},To=arguments[3],Po=arguments[4],xo=arguments[5],Ro=JSON.stringify,No=function(e,t){for(var r,n=Object.keys(xo),o=0,a=n.length;o<a;o++){var i=n[o],s=xo[i].exports;if(s===e||s&&s.default===e){r=i;break}}if(!r){r=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var c={};for(o=0,a=n.length;o<a;o++)c[i=n[o]]=i;Po[r]=["function(require,module,exports){"+e+"(self); }",c]}var l=Math.floor(Math.pow(16,8)*Math.random()).toString(16),u={};u[r]=r,Po[l]=["function(require,module,exports){var f = require("+Ro(r)+");(f.default ? f.default : f)(self);}",u];var d={};!function e(t){for(var r in d[t]=!0,Po[t][1]){var n=Po[t][1][r];d[n]||e(n)}}(l);var f="("+To+")({"+Object.keys(d).map((function(e){return Ro(e)+":["+Po[e][0]+","+Ro(Po[e][1])+"]"})).join(",")+"},{},["+Ro(l)+"])",p=window.URL||window.webkitURL||window.mozURL||window.msURL,h=new Blob([f],{type:"text/javascript"});if(t&&t.bare)return h;var m=p.createObjectURL(h),g=new Worker(m);return g.objectURL=m,g},Lo=ie((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),Oo={js:!0,wasm:!0};function Do(e){if(!(this instanceof Do))return new Do(e);var t=Io({},Oo,e||{});if(this.options=t,this.__cache={},this.__init_promise=null,this.__modules=t.modules||{},this.__memory=null,this.__wasm={},this.__isLE=1===new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0],!this.options.js&&!this.options.wasm)throw new Error('mathlib: at least "js" or "wasm" should be enabled')}Do.prototype.has_wasm=function(){if(void 0!==_o)return _o;if(_o=!1,"undefined"==typeof WebAssembly)return _o;try{var e=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),t=new WebAssembly.Module(e);return 0!==new WebAssembly.Instance(t,{}).exports.test(4)&&(_o=!0),_o}catch(e){}return _o},Do.prototype.use=function(e){return this.__modules[e.name]=e,this.options.wasm&&this.has_wasm()&&e.wasm_fn?this[e.name]=e.wasm_fn:this[e.name]=e.fn,this},Do.prototype.init=function(){if(this.__init_promise)return this.__init_promise;if(!this.options.js&&this.options.wasm&&!this.has_wasm())return Promise.reject(new Error('mathlib: only "wasm" was enabled, but it\'s not supported'));var e=this;return this.__init_promise=Promise.all(Object.keys(e.__modules).map((function(t){var r=e.__modules[t];return e.options.wasm&&e.has_wasm()&&r.wasm_fn?e.__wasm[t]?null:WebAssembly.compile(e.__base64decode(r.wasm_src)).then((function(r){e.__wasm[t]=r})):null}))).then((function(){return e})),this.__init_promise},Do.prototype.__base64decode=function(e){for(var t=e.replace(/[\r\n=]/g,""),r=t.length,n=new Uint8Array(3*r>>2),o=0,a=0,i=0;i<r;i++)i%4==0&&i&&(n[a++]=o>>16&255,n[a++]=o>>8&255,n[a++]=255&o),o=o<<6|"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(t.charAt(i));var s=r%4*6;return 0===s?(n[a++]=o>>16&255,n[a++]=o>>8&255,n[a++]=255&o):18===s?(n[a++]=o>>10&255,n[a++]=o>>2&255):12===s&&(n[a++]=o>>4&255),n},Do.prototype.__reallocate=function(e){if(!this.__memory)return this.__memory=new WebAssembly.Memory({initial:Math.ceil(e/65536)}),this.__memory;var t=this.__memory.buffer.byteLength;return t<e&&this.__memory.grow(Math.ceil((e-t)/65536)),this.__memory},Do.prototype.__instance=function(e,t,r){if(t&&this.__reallocate(t),!this.__wasm[e]){var n=this.__modules[e];this.__wasm[e]=new WebAssembly.Module(this.__base64decode(n.wasm_src))}if(!this.__cache[e]){var o={memoryBase:0,memory:this.__memory,tableBase:0,table:new WebAssembly.Table({initial:0,element:"anyfunc"})};this.__cache[e]=new WebAssembly.Instance(this.__wasm[e],{env:Io(o,r||{})})}return this.__cache[e]},Do.prototype.__align=function(e,t){var r=e%(t=t||8);return e+(r?t-r:0)};var Mo,Uo,jo,Fo,Vo,zo,Ko=Do;function Ho(e,t,r,n,o,a){var i,s,c,l,u,d,f,p,h,m,g,v,y,b;for(h=0;h<a;h++){for(f=h,p=0,l=u=(i=e[d=h*o])*n[6],g=n[0],v=n[1],y=n[4],b=n[5],m=0;m<o;m++)c=(s=e[d])*g+i*v+l*y+u*b,u=l,l=c,i=s,r[p]=l,p++,d++;for(p--,f+=a*(o-1),l=u=(i=e[--d])*n[7],s=i,g=n[2],v=n[3],m=o-1;m>=0;m--)c=s*g+i*v+l*y+u*b,u=l,l=c,i=s,s=e[d],t[f]=r[p]+l,d--,p--,f-=a}}var qo={name:"unsharp_mask",fn:function(e,t,r,n,o,a){var i,s,c,l,u,d,f,p,h,m,g,v,y;if(!(0===n||o<.5)){o>2&&(o=2);var b=function(e,t,r){for(var n,o,a,i,s,c=t*r,l=new Uint16Array(c),u=0;u<c;u++)n=e[4*u],o=e[4*u+1],a=e[4*u+2],s=n>=o&&n>=a?n:o>=a&&o>=n?o:a,i=n<=o&&n<=a?n:o<=a&&o<=n?o:a,l[u]=257*(s+i)>>1;return l}(e,t,r),C=new Uint16Array(b);!function(e,t,r,n){if(n){var o=new Uint16Array(e.length),a=new Float32Array(Math.max(t,r)),i=function(e){e<.5&&(e=.5);var t=Math.exp(.527076)/e,r=Math.exp(-t),n=Math.exp(-2*t),o=(1-r)*(1-r)/(1+2*t*r-n);return Mo=o,Uo=o*(t-1)*r,jo=o*(t+1)*r,Fo=-o*n,Vo=2*r,zo=-n,new Float32Array([Mo,Uo,jo,Fo,Vo,zo,(Mo+Uo)/(1-Vo-zo),(jo+Fo)/(1-Vo-zo)])}(n);Ho(e,o,a,i,t,r),Ho(o,e,a,i,r,t)}}(C,t,r,o);for(var w=n/100*4096+.5|0,k=257*a|0,B=t*r,E=0;E<B;E++)v=2*(b[E]-C[E]),Math.abs(v)>=k&&(i=e[y=4*E],s=e[y+1],c=e[y+2],d=257*((p=i>=s&&i>=c?i:s>=i&&s>=c?s:c)+(f=i<=s&&i<=c?i:s<=i&&s<=c?s:c))>>1,f===p?l=u=0:(u=d<=32767?4095*(p-f)/(p+f)|0:4095*(p-f)/(510-p-f)|0,l=i===p?65535*(s-c)/(6*(p-f))|0:s===p?21845+(65535*(c-i)/(6*(p-f))|0):43690+(65535*(i-s)/(6*(p-f))|0)),(d+=w*v+2048>>12)>65535?d=65535:d<0&&(d=0),0===u?i=s=c=d>>8:(h=2*d-(m=d<=32767?d*(4096+u)+2048>>12:d+((65535-d)*u+2048>>12))>>8,m>>=8,i=(g=l+21845&65535)>=43690?h:g>=32767?h+(6*(m-h)*(43690-g)+32768>>16):g>=10922?m:h+(6*(m-h)*g+32768>>16),s=(g=65535&l)>=43690?h:g>=32767?h+(6*(m-h)*(43690-g)+32768>>16):g>=10922?m:h+(6*(m-h)*g+32768>>16),c=(g=l-21845&65535)>=43690?h:g>=32767?h+(6*(m-h)*(43690-g)+32768>>16):g>=10922?m:h+(6*(m-h)*g+32768>>16)),e[y]=i,e[y+1]=s,e[y+2]=c)}},wasm_fn:function(e,t,r,n,o,a){if(!(0===n||o<.5)){o>2&&(o=2);var i=t*r,s=4*i,c=2*i,l=2*i,u=4*Math.max(t,r),d=s,f=d+c,p=f+l,h=p+l,m=h+u,g=this.__instance("unsharp_mask",s+c+2*l+u+32,{exp:Math.exp}),v=new Uint32Array(e.buffer);new Uint32Array(this.__memory.buffer).set(v);var y=g.exports.hsl_l16||g.exports._hsl_l16;y(0,d,t,r),(y=g.exports.blurMono16||g.exports._blurMono16)(d,f,p,h,m,t,r,o),(y=g.exports.unsharp||g.exports._unsharp)(0,0,d,f,t,r,n,a),v.set(new Uint32Array(this.__memory.buffer,0,i))}},wasm_src:"AGFzbQEAAAABMQZgAXwBfGACfX8AYAZ/f39/f38AYAh/f39/f39/fQBgBH9/f38AYAh/f39/f39/fwACGQIDZW52A2V4cAAAA2VudgZtZW1vcnkCAAEDBgUBAgMEBQQEAXAAAAdMBRZfX2J1aWxkX2dhdXNzaWFuX2NvZWZzAAEOX19nYXVzczE2X2xpbmUAAgpibHVyTW9ubzE2AAMHaHNsX2wxNgAEB3Vuc2hhcnAABQkBAAqJEAXZAQEGfAJAIAFE24a6Q4Ia+z8gALujIgOaEAAiBCAEoCIGtjgCECABIANEAAAAAAAAAMCiEAAiBbaMOAIUIAFEAAAAAAAA8D8gBKEiAiACoiAEIAMgA6CiRAAAAAAAAPA/oCAFoaMiArY4AgAgASAEIANEAAAAAAAA8L+gIAKioiIHtjgCBCABIAQgA0QAAAAAAADwP6AgAqKiIgO2OAIIIAEgBSACoiIEtow4AgwgASACIAegIAVEAAAAAAAA8D8gBqGgIgKjtjgCGCABIAMgBKEgAqO2OAIcCwu3AwMDfwR9CHwCQCADKgIUIQkgAyoCECEKIAMqAgwhCyADKgIIIQwCQCAEQX9qIgdBAEgiCA0AIAIgAC8BALgiDSADKgIYu6IiDiAJuyIQoiAOIAq7IhGiIA0gAyoCBLsiEqIgAyoCALsiEyANoqCgoCIPtjgCACACQQRqIQIgAEECaiEAIAdFDQAgBCEGA0AgAiAOIBCiIA8iDiARoiANIBKiIBMgAC8BALgiDaKgoKAiD7Y4AgAgAkEEaiECIABBAmohACAGQX9qIgZBAUoNAAsLAkAgCA0AIAEgByAFbEEBdGogAEF+ai8BACIIuCINIAu7IhGiIA0gDLsiEqKgIA0gAyoCHLuiIg4gCrsiE6KgIA4gCbsiFKKgIg8gAkF8aioCALugqzsBACAHRQ0AIAJBeGohAiAAQXxqIQBBACAFQQF0ayEHIAEgBSAEQQF0QXxqbGohBgNAIAghAyAALwEAIQggBiANIBGiIAO4Ig0gEqKgIA8iECAToqAgDiAUoqAiDyACKgIAu6CrOwEAIAYgB2ohBiAAQX5qIQAgAkF8aiECIBAhDiAEQX9qIgRBAUoNAAsLCwvfAgIDfwZ8AkAgB0MAAAAAWw0AIARE24a6Q4Ia+z8gB0MAAAA/l7ujIgyaEAAiDSANoCIPtjgCECAEIAxEAAAAAAAAAMCiEAAiDraMOAIUIAREAAAAAAAA8D8gDaEiCyALoiANIAwgDKCiRAAAAAAAAPA/oCAOoaMiC7Y4AgAgBCANIAxEAAAAAAAA8L+gIAuioiIQtjgCBCAEIA0gDEQAAAAAAADwP6AgC6KiIgy2OAIIIAQgDiALoiINtow4AgwgBCALIBCgIA5EAAAAAAAA8D8gD6GgIgujtjgCGCAEIAwgDaEgC6O2OAIcIAYEQCAFQQF0IQogBiEJIAIhCANAIAAgCCADIAQgBSAGEAIgACAKaiEAIAhBAmohCCAJQX9qIgkNAAsLIAVFDQAgBkEBdCEIIAUhAANAIAIgASADIAQgBiAFEAIgAiAIaiECIAFBAmohASAAQX9qIgANAAsLC7wBAQV/IAMgAmwiAwRAQQAgA2shBgNAIAAoAgAiBEEIdiIHQf8BcSECAn8gBEH/AXEiAyAEQRB2IgRB/wFxIgVPBEAgAyIIIAMgAk8NARoLIAQgBCAHIAIgA0kbIAIgBUkbQf8BcQshCAJAIAMgAk0EQCADIAVNDQELIAQgByAEIAMgAk8bIAIgBUsbQf8BcSEDCyAAQQRqIQAgASADIAhqQYECbEEBdjsBACABQQJqIQEgBkEBaiIGDQALCwvTBgEKfwJAIAazQwAAgEWUQwAAyEKVu0QAAAAAAADgP6CqIQ0gBSAEbCILBEAgB0GBAmwhDgNAQQAgAi8BACADLwEAayIGQQF0IgdrIAcgBkEASBsgDk8EQCAAQQJqLQAAIQUCfyAALQAAIgYgAEEBai0AACIESSIJRQRAIAYiCCAGIAVPDQEaCyAFIAUgBCAEIAVJGyAGIARLGwshCAJ/IAYgBE0EQCAGIgogBiAFTQ0BGgsgBSAFIAQgBCAFSxsgCRsLIgogCGoiD0GBAmwiEEEBdiERQQAhDAJ/QQAiCSAIIApGDQAaIAggCmsiCUH/H2wgD0H+AyAIayAKayAQQYCABEkbbSEMIAYgCEYEQCAEIAVrQf//A2wgCUEGbG0MAQsgBSAGayAGIARrIAQgCEYiBhtB//8DbCAJQQZsbUHVqgFBqtUCIAYbagshCSARIAcgDWxBgBBqQQx1aiIGQQAgBkEAShsiBkH//wMgBkH//wNIGyEGAkACfwJAIAxB//8DcSIFBEAgBkH//wFKDQEgBUGAIGogBmxBgBBqQQx2DAILIAZBCHYiBiEFIAYhBAwCCyAFIAZB//8Dc2xBgBBqQQx2IAZqCyIFQQh2IQcgBkEBdCAFa0EIdiIGIQQCQCAJQdWqAWpB//8DcSIFQanVAksNACAFQf//AU8EQEGq1QIgBWsgByAGa2xBBmxBgIACakEQdiAGaiEEDAELIAchBCAFQanVAEsNACAFIAcgBmtsQQZsQYCAAmpBEHYgBmohBAsCfyAGIgUgCUH//wNxIghBqdUCSw0AGkGq1QIgCGsgByAGa2xBBmxBgIACakEQdiAGaiAIQf//AU8NABogByIFIAhBqdUASw0AGiAIIAcgBmtsQQZsQYCAAmpBEHYgBmoLIQUgCUGr1QJqQf//A3EiCEGp1QJLDQAgCEH//wFPBEBBqtUCIAhrIAcgBmtsQQZsQYCAAmpBEHYgBmohBgwBCyAIQanVAEsEQCAHIQYMAQsgCCAHIAZrbEEGbEGAgAJqQRB2IAZqIQYLIAEgBDoAACABQQFqIAU6AAAgAUECaiAGOgAACyADQQJqIQMgAkECaiECIABBBGohACABQQRqIQEgC0F/aiILDQALCwsL"},Qo=[{win:.5,filter:function(e){return e>=-.5&&e<.5?1:0}},{win:1,filter:function(e){if(e<=-1||e>=1)return 0;if(e>-1.1920929e-7&&e<1.1920929e-7)return 1;var t=e*Math.PI;return Math.sin(t)/t*(.54+.46*Math.cos(t/1))}},{win:2,filter:function(e){if(e<=-2||e>=2)return 0;if(e>-1.1920929e-7&&e<1.1920929e-7)return 1;var t=e*Math.PI;return Math.sin(t)/t*Math.sin(t/2)/(t/2)}},{win:3,filter:function(e){if(e<=-3||e>=3)return 0;if(e>-1.1920929e-7&&e<1.1920929e-7)return 1;var t=e*Math.PI;return Math.sin(t)/t*Math.sin(t/3)/(t/3)}}];function Wo(e){return Math.round(16383*e)}var Go=function(e,t,r,n,o){var a,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k=Qo[e].filter,B=1/n,E=Math.min(1,n),S=Qo[e].win/E,A=Math.floor(2*(S+1)),_=new Int16Array((A+2)*r),I=0,T=!_.subarray||!_.set;for(a=0;a<r;a++){for(i=(a+.5)*B+o,s=Math.max(0,Math.floor(i-S)),l=(c=Math.min(t-1,Math.ceil(i+S)))-s+1,u=new Float32Array(l),d=new Int16Array(l),f=0,p=s,h=0;p<=c;p++,h++)f+=m=k((p+.5-i)*E),u[h]=m;for(g=0,h=0;h<u.length;h++)g+=v=u[h]/f,d[h]=Wo(v);for(d[r>>1]+=Wo(1-g),y=0;y<d.length&&0===d[y];)y++;if(y<d.length){for(b=d.length-1;b>0&&0===d[b];)b--;if(C=s+y,w=b-y+1,_[I++]=C,_[I++]=w,T)for(h=y;h<=b;h++)_[I++]=d[h];else _.set(d.subarray(y,b+1),I),I+=w}else _[I++]=0,_[I++]=0}return _};function Xo(e){return e<0?0:e>255?255:e}var Yo=!0;try{Yo=1===new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0]}catch(e){}function $o(e,t,r){if(Yo)t.set(function(e){return new Uint8Array(e.buffer,0,e.byteLength)}(e),r);else for(var n=r,o=0;o<e.length;o++){var a=e[o];t[n++]=255&a,t[n++]=a>>8&255}}var Zo={name:"resize",fn:function(e){var t=e.src,r=e.width,n=e.height,o=e.toWidth,a=e.toHeight,i=e.scaleX||e.toWidth/e.width,s=e.scaleY||e.toHeight/e.height,c=e.offsetX||0,l=e.offsetY||0,u=e.dest||new Uint8Array(o*a*4),d=void 0===e.quality?3:e.quality,f=e.alpha||!1,p=Go(d,r,o,i,c),h=Go(d,n,a,s,l),m=new Uint8Array(o*n*4);return function(e,t,r,n,o,a){var i,s,c,l,u,d,f,p,h,m,g,v=0,y=0;for(h=0;h<n;h++){for(u=0,m=0;m<o;m++){for(d=a[u++],f=a[u++],p=v+4*d|0,i=s=c=l=0;f>0;f--)l=l+(g=a[u++])*e[p+3]|0,c=c+g*e[p+2]|0,s=s+g*e[p+1]|0,i=i+g*e[p]|0,p=p+4|0;t[y+3]=Xo(l+8192>>14),t[y+2]=Xo(c+8192>>14),t[y+1]=Xo(s+8192>>14),t[y]=Xo(i+8192>>14),y=y+4*n|0}y=4*(h+1)|0,v=(h+1)*r*4|0}}(t,m,r,n,o,p),function(e,t,r,n,o,a){var i,s,c,l,u,d,f,p,h,m,g,v=0,y=0;for(h=0;h<n;h++){for(u=0,m=0;m<o;m++){for(d=a[u++],f=a[u++],p=v+4*d|0,i=s=c=l=0;f>0;f--)l=l+(g=a[u++])*e[p+3]|0,c=c+g*e[p+2]|0,s=s+g*e[p+1]|0,i=i+g*e[p]|0,p=p+4|0;t[y+3]=Xo(l+8192>>14),t[y+2]=Xo(c+8192>>14),t[y+1]=Xo(s+8192>>14),t[y]=Xo(i+8192>>14),y=y+4*n|0}y=4*(h+1)|0,v=(h+1)*r*4|0}}(m,u,n,o,a,h),f||function(e,t,r){for(var n=3,o=t*r*4|0;n<o;)e[n]=255,n=n+4|0}(u,o,a),u},wasm_fn:function(e){var t=e.src,r=e.width,n=e.height,o=e.toWidth,a=e.toHeight,i=e.scaleX||e.toWidth/e.width,s=e.scaleY||e.toHeight/e.height,c=e.offsetX||0,l=e.offsetY||0,u=e.dest||new Uint8Array(o*a*4),d=void 0===e.quality?3:e.quality,f=e.alpha||!1,p=Go(d,r,o,i,c),h=Go(d,n,a,s,l),m=this.__align(0+Math.max(t.byteLength,u.byteLength)),g=this.__align(m+n*o*4),v=this.__align(g+p.byteLength),y=v+h.byteLength,b=this.__instance("resize",y),C=new Uint8Array(this.__memory.buffer),w=new Uint32Array(this.__memory.buffer),k=new Uint32Array(t.buffer);return w.set(k),$o(p,C,g),$o(h,C,v),(b.exports.convolveHV||b.exports._convolveHV)(g,v,m,r,n,o,a),new Uint32Array(u.buffer).set(new Uint32Array(this.__memory.buffer,0,a*o)),f||function(e,t,r){for(var n=3,o=t*r*4|0;n<o;)e[n]=255,n=n+4|0}(u,o,a),u},wasm_src:"AGFzbQEAAAABFAJgBn9/f39/fwBgB39/f39/f38AAg8BA2VudgZtZW1vcnkCAAEDAwIAAQQEAXAAAAcZAghjb252b2x2ZQAACmNvbnZvbHZlSFYAAQkBAArmAwLBAwEQfwJAIANFDQAgBEUNACAFQQRqIRVBACEMQQAhDQNAIA0hDkEAIRFBACEHA0AgB0ECaiESAn8gBSAHQQF0IgdqIgZBAmouAQAiEwRAQQAhCEEAIBNrIRQgFSAHaiEPIAAgDCAGLgEAakECdGohEEEAIQlBACEKQQAhCwNAIBAoAgAiB0EYdiAPLgEAIgZsIAtqIQsgB0H/AXEgBmwgCGohCCAHQRB2Qf8BcSAGbCAKaiEKIAdBCHZB/wFxIAZsIAlqIQkgD0ECaiEPIBBBBGohECAUQQFqIhQNAAsgEiATagwBC0EAIQtBACEKQQAhCUEAIQggEgshByABIA5BAnRqIApBgMAAakEOdSIGQf8BIAZB/wFIG0EQdEGAgPwHcUEAIAZBAEobIAtBgMAAakEOdSIGQf8BIAZB/wFIG0EYdEEAIAZBAEobciAJQYDAAGpBDnUiBkH/ASAGQf8BSBtBCHRBgP4DcUEAIAZBAEobciAIQYDAAGpBDnUiBkH/ASAGQf8BSBtB/wFxQQAgBkEAShtyNgIAIA4gA2ohDiARQQFqIhEgBEcNAAsgDCACaiEMIA1BAWoiDSADRw0ACwsLIQACQEEAIAIgAyAEIAUgABAAIAJBACAEIAUgBiABEAALCw=="};function Jo(e){var t=e||[],r={js:t.indexOf("js")>=0,wasm:t.indexOf("wasm")>=0};Ko.call(this,r),this.features={js:r.js,wasm:r.wasm&&this.has_wasm()},this.use(qo),this.use(Zo)}Lo(Jo,Ko),Jo.prototype.resizeAndUnsharp=function(e,t){var r=this.resize(e,t);return e.unsharpAmount&&this.unsharp_mask(r,e.toWidth,e.toHeight,e.unsharpAmount,e.unsharpRadius,e.unsharpThreshold),r};var ea=Jo;function ta(e,t){this.create=e,this.available=[],this.acquired={},this.lastId=1,this.timeoutId=0,this.idle=t||2e3}ta.prototype.acquire=function(){var e,t=this;return 0!==this.available.length?e=this.available.pop():((e=this.create()).id=this.lastId++,e.release=function(){return t.release(e)}),this.acquired[e.id]=e,e},ta.prototype.release=function(e){var t=this;delete this.acquired[e.id],e.lastUsed=Date.now(),this.available.push(e),0===this.timeoutId&&(this.timeoutId=setTimeout((function(){return t.gc()}),100))},ta.prototype.gc=function(){var e=this,t=Date.now();this.available=this.available.filter((function(r){return!(t-r.lastUsed>e.idle&&(r.destroy(),1))})),0!==this.available.length?this.timeoutId=setTimeout((function(){return e.gc()}),100):this.timeoutId=0};var ra=ta;function na(e){return Object.prototype.toString.call(e)}var oa=function(e){var t=na(e);return"[object HTMLCanvasElement]"===t||"[object OffscreenCanvas]"===t||"[object Canvas]"===t},aa=function(e){switch(e){case 0:return"pixelated";case 1:return"low";case 2:return"medium"}return"high"},ia=function(){var e,t=ea;onmessage=function(r){var n=r.data.opts;e||(e=new t(r.data.features));var o=e.resizeAndUnsharp(n);postMessage({result:o},[o.buffer])}};function sa(e){var t=Math.round(e);return Math.abs(e-t)<1e-5?t:Math.floor(e)}function ca(e){var t=Math.round(e);return Math.abs(e-t)<1e-5?t:Math.ceil(e)}var la={},ua=!1;try{"undefined"!=typeof navigator&&navigator.userAgent&&(ua=navigator.userAgent.indexOf("Safari")>=0)}catch(e){}var da=1;"undefined"!=typeof navigator&&(da=Math.min(navigator.hardwareConcurrency||1,4));var fa,pa,ha={tile:1024,concurrency:da,features:["js","wasm","ww"],idle:2e3,createCanvas:function(e,t){var r=document.createElement("canvas");return r.width=e,r.height=t,r}},ma={quality:3,alpha:!1,unsharpAmount:0,unsharpRadius:0,unsharpThreshold:0};function ga(){return{value:No(ia),destroy:function(){if(this.value.terminate(),"undefined"!=typeof window){var e=window.URL||window.webkitURL||window.mozURL||window.msURL;e&&e.revokeObjectURL&&this.value.objectURL&&e.revokeObjectURL(this.value.objectURL)}}}}function va(e){if(!(this instanceof va))return new va(e);this.options=Io({},ha,e||{});var t="lk_".concat(this.options.concurrency);this.__limit=la[t]||function(e){var t=0,r=[];function n(){t<e&&r.length&&(t++,r.shift()())}return function(e){return new Promise((function(o,a){r.push((function(){e().then((function(e){o(e),t--,n()}),(function(e){a(e),t--,n()}))})),n()}))}}(this.options.concurrency),la[t]||(la[t]=this.__limit),this.features={js:!1,wasm:!1,cib:!1,ww:!1},this.__workersPool=null,this.__requested_features=[],this.__mathlib=null}va.prototype.init=function(){var e=this;if(this.__initPromise)return this.__initPromise;if(!1!==fa&&!0!==fa&&(fa=!1,"undefined"!=typeof ImageData&&"undefined"!=typeof Uint8ClampedArray))try{new ImageData(new Uint8ClampedArray(400),10,10),fa=!0}catch(t){}!1!==pa&&!0!==pa&&(pa=!1,"undefined"!=typeof ImageBitmap&&(ImageBitmap.prototype&&ImageBitmap.prototype.close?pa=!0:this.debug("ImageBitmap does not support .close(), disabled")));var t=this.options.features.slice();if(t.indexOf("all")>=0&&(t=["cib","wasm","js","ww"]),this.__requested_features=t,this.__mathlib=new ea(t),t.indexOf("ww")>=0&&"undefined"!=typeof window&&"Worker"in window)try{No((function(){})).terminate(),this.features.ww=!0;var r="wp_".concat(JSON.stringify(this.options));la[r]?this.__workersPool=la[r]:(this.__workersPool=new ra(ga,this.options.idle),la[r]=this.__workersPool)}catch(t){}var n,o=this.__mathlib.init().then((function(t){Io(e.features,t.features)}));return n=pa?function(e){return Promise.resolve().then((function(){if("undefined"==typeof createImageBitmap)return!1;var t=e(100,100);return createImageBitmap(t,0,0,100,100,{resizeWidth:10,resizeHeight:10,resizeQuality:"high"}).then((function(e){var r=10===e.width;return e.close(),t=null,r}))})).catch((function(){return!1}))}(this.options.createCanvas).then((function(r){e.features.cib&&t.indexOf("cib")<0?e.debug("createImageBitmap() resize supported, but disabled by config"):t.indexOf("cib")>=0&&(e.features.cib=r)})):Promise.resolve(!1),this.__initPromise=Promise.all([o,n]).then((function(){return e})),this.__initPromise},va.prototype.resize=function(e,t,r){var n=this;this.debug("Start resize...");var o=Io({},ma);if(isNaN(r)?r&&(o=Io(o,r)):o=Io(o,{quality:r}),o.toWidth=t.width,o.toHeight=t.height,o.width=e.naturalWidth||e.width,o.height=e.naturalHeight||e.height,0===t.width||0===t.height)return Promise.reject(new Error("Invalid output size: ".concat(t.width,"x").concat(t.height)));o.unsharpRadius>2&&(o.unsharpRadius=2);var a=!1,i=null;o.cancelToken&&(i=o.cancelToken.then((function(e){throw a=!0,e}),(function(e){throw a=!0,e})));var s=Math.ceil(Math.max(3,2.5*o.unsharpRadius|0));return this.init().then((function(){if(a)return i;if(n.features.cib){var r=t.getContext("2d",{alpha:Boolean(o.alpha)});return n.debug("Resize via createImageBitmap()"),createImageBitmap(e,{resizeWidth:o.toWidth,resizeHeight:o.toHeight,resizeQuality:aa(o.quality)}).then((function(e){if(a)return i;if(!o.unsharpAmount)return r.drawImage(e,0,0),e.close(),r=null,n.debug("Finished!"),t;n.debug("Unsharp result");var s=n.options.createCanvas(o.toWidth,o.toHeight),c=s.getContext("2d",{alpha:Boolean(o.alpha)});c.drawImage(e,0,0),e.close();var l=c.getImageData(0,0,o.toWidth,o.toHeight);return n.__mathlib.unsharp_mask(l.data,o.toWidth,o.toHeight,o.unsharpAmount,o.unsharpRadius,o.unsharpThreshold),r.putImageData(l,0,0),s.width=s.height=0,l=c=s=r=null,n.debug("Finished!"),t}))}var c={},l=function(e){return Promise.resolve().then((function(){return n.features.ww?new Promise((function(t,r){var o=n.__workersPool.acquire();i&&i.catch((function(e){return r(e)})),o.value.onmessage=function(e){o.release(),e.data.err?r(e.data.err):t(e.data.result)},o.value.postMessage({opts:e,features:n.__requested_features,preload:{wasm_nodule:n.__mathlib.__}},[e.src.buffer])})):n.__mathlib.resizeAndUnsharp(e,c)}))},u=function(e,t,r){var o,c,u,d=!1,f=function(t){return n.__limit((function(){if(a)return i;var s;if(oa(e))n.debug("Get tile pixel data"),s=o.getImageData(t.x,t.y,t.width,t.height);else{n.debug("Draw tile imageBitmap/image to temporary canvas");var d=n.options.createCanvas(t.width,t.height),f=d.getContext("2d",{alpha:Boolean(r.alpha)});f.globalCompositeOperation="copy",f.drawImage(c||e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),n.debug("Get tile pixel data"),s=f.getImageData(0,0,t.width,t.height),d.width=d.height=0,f=d=null}var p={src:s.data,width:t.width,height:t.height,toWidth:t.toWidth,toHeight:t.toHeight,scaleX:t.scaleX,scaleY:t.scaleY,offsetX:t.offsetX,offsetY:t.offsetY,quality:r.quality,alpha:r.alpha,unsharpAmount:r.unsharpAmount,unsharpRadius:r.unsharpRadius,unsharpThreshold:r.unsharpThreshold};return n.debug("Invoke resize math"),Promise.resolve().then((function(){return l(p)})).then((function(e){if(a)return i;var r;if(s=null,n.debug("Convert raw rgba tile result to ImageData"),fa)r=new ImageData(new Uint8ClampedArray(e),t.toWidth,t.toHeight);else if((r=u.createImageData(t.toWidth,t.toHeight)).data.set)r.data.set(e);else for(var o=r.data.length-1;o>=0;o--)r.data[o]=e[o];return n.debug("Draw tile"),ua?u.putImageData(r,t.toX,t.toY,t.toInnerX-t.toX,t.toInnerY-t.toY,t.toInnerWidth+1e-5,t.toInnerHeight+1e-5):u.putImageData(r,t.toX,t.toY,t.toInnerX-t.toX,t.toInnerY-t.toY,t.toInnerWidth,t.toInnerHeight),null}))}))};return Promise.resolve().then((function(){if(u=t.getContext("2d",{alpha:Boolean(r.alpha)}),oa(e))return o=e.getContext("2d",{alpha:Boolean(r.alpha)}),null;if(function(e){return"[object ImageBitmap]"===na(e)}(e))return c=e,d=!0,null;if(function(e){return"[object HTMLImageElement]"===na(e)}(e))return pa?(n.debug("Decode image via createImageBitmap"),createImageBitmap(e).then((function(e){c=e})).catch((function(e){return null}))):null;throw new Error('Pica: ".from" should be Image, Canvas or ImageBitmap')})).then((function(){if(a)return i;n.debug("Calculate tiles");var e=function(e){var t,r,n,o,a,i,s=e.toWidth/e.width,c=e.toHeight/e.height,l=sa(e.srcTileSize*s)-2*e.destTileBorder,u=sa(e.srcTileSize*c)-2*e.destTileBorder;if(l<1||u<1)throw new Error("Internal error in pica: target tile width/height is too small.");var d,f=[];for(o=0;o<e.toHeight;o+=u)for(n=0;n<e.toWidth;n+=l)(t=n-e.destTileBorder)<0&&(t=0),t+(a=n+l+e.destTileBorder-t)>=e.toWidth&&(a=e.toWidth-t),(r=o-e.destTileBorder)<0&&(r=0),r+(i=o+u+e.destTileBorder-r)>=e.toHeight&&(i=e.toHeight-r),d={toX:t,toY:r,toWidth:a,toHeight:i,toInnerX:n,toInnerY:o,toInnerWidth:l,toInnerHeight:u,offsetX:t/s-sa(t/s),offsetY:r/c-sa(r/c),scaleX:s,scaleY:c,x:sa(t/s),y:sa(r/c),width:ca(a/s),height:ca(i/c)},f.push(d);return f}({width:r.width,height:r.height,srcTileSize:n.options.tile,toWidth:r.toWidth,toHeight:r.toHeight,destTileBorder:s}).map((function(e){return f(e)}));function o(){c&&(d||c.close(),c=null)}return n.debug("Process tiles"),Promise.all(e).then((function(){return n.debug("Finished!"),o(),t}),(function(e){throw o(),e}))}))};return function e(t,r,o,s){if(a)return i;var c,l=L(t.shift(),2),d=l[0],f=l[1],p=0===t.length;return s=Io({},s,{toWidth:d,toHeight:f,quality:p?s.quality:Math.min(1,s.quality)}),p||(c=n.options.createCanvas(d,f)),u(r,p?o:c,s).then((function(){return p?o:(s.width=d,s.height=f,e(t,c,o,s))})).then((function(e){return c&&(c.width=c.height=0),e}))}(function(e,t,r,n,o,a){var i=r/e,s=n/t,c=(2*a+2+1)/o;if(c>.5)return[[r,n]];var l=Math.ceil(Math.log(Math.min(i,s))/Math.log(c));if(l<=1)return[[r,n]];for(var u=[],d=0;d<l;d++){var f=Math.round(Math.pow(Math.pow(e,l-d-1)*Math.pow(r,d+1),1/l)),p=Math.round(Math.pow(Math.pow(t,l-d-1)*Math.pow(n,d+1),1/l));u.push([f,p])}return u}(o.width,o.height,o.toWidth,o.toHeight,n.options.tile,s),e,t,o)}))},va.prototype.resizeBuffer=function(e){var t=this,r=Io({},ma,e);return this.init().then((function(){return t.__mathlib.resizeAndUnsharp(r)}))},va.prototype.toBlob=function(e,t,r){return t=t||"image/png",new Promise((function(n){if(e.toBlob)e.toBlob((function(e){return n(e)}),t,r);else if(e.convertToBlob)n(e.convertToBlob({type:t,quality:r}));else{for(var o=atob(e.toDataURL(t,r).split(",")[1]),a=o.length,i=new Uint8Array(a),s=0;s<a;s++)i[s]=o.charCodeAt(s);n(new Blob([i],{type:t}))}}))},va.prototype.debug=function(){};var ya=new va,ba=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.minSize,o=void 0===n?720:n,a=e/t;return e>t?{desW:Math.floor(o*a),desH:o}:{desW:o,desH:Math.floor(o/a)}},Ca=Object.freeze({__proto__:null,scaleImage:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minSize,n=void 0===r?720:r;return new Promise((function(t){var r=URL.createObjectURL(e),o=new Image;o.src=r;var a=document.createElement("canvas");o.onload=function(){if(o.width&&o.height&&(o.width<n||o.height<n)){var e=ba(o.width,o.height,{minSize:n}),r=e.desW,i=e.desH;a.width=r,a.height=i,ya.resize(o,a).then((function(e){return ya.toBlob(e,"image/jpeg",1)})).then((function(e){return t(e)}))}else t(null)}}))},createResizer:function(e){var t=e.width,r=e.height,n=document.createElement("canvas"),o=n.getContext("2d");return n.width=t,n.height=r,{resize:function(e){var t=e.srcCanvas;return o.drawImage(t,0,0,n.width,n.height),n}}},resizeBlobImg:function(e,t,r){var n=document.createElement("canvas"),o=n.getContext("2d");return n.width=t,n.height=r,new Promise((function(t){var r=URL.createObjectURL(e),a=new Image;a.onload=function(){URL.revokeObjectURL(r),o.drawImage(a,0,0,n.width,n.height),n.toBlob(t,"image/jpeg",1)},a.src=r}))},blobToCanvas:function(e){var t=e.blob;return new Promise((function(e){var r=document.createElement("canvas"),n=r.getContext("2d"),o=new Image;o.onload=function(t){var a=o.width,i=o.height;r.width=a,r.height=i,URL.revokeObjectURL(t.target.src),n.drawImage(t.target,0,0),e(r)},o.src=URL.createObjectURL(t)}))}});function wa(e,t,r,n){var o=r*(4*t)+4*n;return{r:e[o],g:e[o+1],b:e[o+2]}}function ka(e,t,r){return function(e,t,r){for(var n=0,o=r[1],a=r[3],i=r[0],s=r[2],c=o;c<a;c++)for(var l=i;l<s;l++){var u=wa(e,t,c,l),d=u.r,f=u.g,p=u.b;d>=245&&p>=245&&f>245&&(n+=1)}return n}(e,t,function(e,t){var r=Math.floor(.025*e),n=e-r,o=Math.floor(.025*t);return[r,o,n,t-o]}(t,r))/(t*r)>=.001}function Ba(){return(Ba=K(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.getContext("2d"),n=r.getImageData(0,0,t.width,t.height),o=n.data,Wn){e.next=5;break}return e.abrupt("return",ka(o,n.width,n.height));case 5:return e.abrupt("return",Wn.detectGlare(o,n.width,n.height));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ea=Object.freeze({__proto__:null,isCardGlare:function(e){return Ba.apply(this,arguments)}}),Sa="internal_server_error",Aa="network_error",_a=on();function Ia(e){return 500*Math.pow(1.5,e)}function Ta(e){return Array.isArray(null==e?void 0:e.errors)&&e.errors.find((function(e){return e.code===Sa}))}function Pa(e){return"Failed to fetch"===e.message||!e.response}function xa(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.maxNetworkErrorRetryTimes,n=void 0===r?5:r,o=t.maxInternalServerErrorRetryTimes,a=void 0===o?1:o,i=t.propertyKey,s=t.onDone;return function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];var c=this;function l(e,t){return u.apply(this,arguments)}function u(){return(u=K(regeneratorRuntime.mark((function t(o,u){var d,f,p,h,m,g,v,y,b=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return g=function(){return(g=K(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=h(t),n=p(t)-r,e.next=4,Tn(Ia(n));case 4:return e.abrupt("return",l(r,t,n));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)},m=function(e){return g.apply(this,arguments)},h=function(e){return e===u?Math.max(o-1,0):p(e)-1},p=function(e){return e===Aa?n:e===Sa?a:0},f=function(e){return o>0||(e===Aa?void 0===o&&n>0:e===Sa&&void 0===o&&a>0)},d=b.length>2&&void 0!==b[2]?b[2]:0,v=performance.now(),t.prev=7,t.next=10,e.apply(c,r);case 10:if(y=t.sent,s({response:y,retryCount:d,propertyKey:i,timeInMs:performance.now()-v,args:r}),!Ta(y)||!f(Sa)){t.next=16;break}return t.next=15,m(Sa);case 15:return t.abrupt("return",t.sent);case 16:return t.abrupt("return",y);case 19:if(t.prev=19,t.t0=t.catch(7),s({error:t.t0,retryCount:d,propertyKey:i,timeInMs:performance.now()-v,args:r}),!Pa(t.t0)||!f(Aa)){t.next=24;break}return t.abrupt("return",m(Aa));case 24:throw t.t0;case 25:case"end":return t.stop()}}),t,null,[[7,19]])})))).apply(this,arguments)}return l()}}function Ra(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.maxNetworkErrorRetryTimes,n=void 0===r?5:r,o=t.maxInternalServerErrorRetryTimes,a=void 0===o?1:o,i=t.onDone,s=void 0===i?function(){}:i,c={get:function(e,t){var r=e[t];return"function"==typeof r&&"constructor"!==t?xa(r,{maxNetworkErrorRetryTimes:n,maxInternalServerErrorRetryTimes:a,propertyKey:t,onDone:s}):r}};return new Proxy(e,c)}var Na=function(e){var t=e.response,r=(e.error,e.retryCount,e.propertyKey,e.timeInMs);return e.args,{event:"test-event",log:{request_status:t?"success":"fail",time_in_ms:r}}},La=Object.freeze({__proto__:null,createRetryAPIClient:Ra,useApiClient:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.apiCredentials,n=void 0===t?{}:t,a=e.tracking,i=void 0===a?{}:a,s=r(null),c=En(),l=c.sendEvent,u=o((function(e){try{var t=Na(e),r=t.event,n=t.log;l({tag:"sdk_api",event:r,log:n})}catch(e){}}),[l]);if(null===s.current){var d=n.accessKey,f=n.secretKey,p=n.apiUrl,h=i.userId,m=kn({userId:h});s.current=Ra(new Gr(d,f,p,{httpHeaders:W(W({},_a),{},{"x-request-id":m})}),{onDone:u})}return{apiClient:s.current}}}),Oa="BFnYsWrH",Da="KbKcY2nb",Ma=function(e){return e.split("").reverse().join("")},Ua=function(e){var t=e.url;return new Promise((function(e){var r=document.createElement("script");r.onload=e,r.src=t,document.head.appendChild(r)}))},ja=window.fetch.bind(window);function Fa(e){var t=e.split(","),r=t[0].match(/:(.*?);/)[1];return{u8arr:Uint8Array.from(atob(t[1]),(function(e){return e.charCodeAt(0)})),mime:r}}var Va=function(){var e=K(regeneratorRuntime.mark((function e(){var t,r,n,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t="".concat(Ma(Oa)).concat(Ma(Da)),e.next=3,ja.apply(void 0,a);case 3:return r=e.sent,e.next=6,r.text();case 6:return n=e.sent,o=hn.AES.decrypt(n,t).toString(hn.enc.Utf8),e.abrupt("return",Fa(o));case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),za=function(){var e=K(regeneratorRuntime.mark((function e(){var t,r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ja.apply(void 0,n);case 2:return t=e.sent,e.next=5,t.text();case 5:return r=e.sent,e.abrupt("return",r);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ka=Object.freeze({__proto__:null,reverseString:Ma,loadExternalScript:Ua,fetchWithDecryption:Va,fetchRawResource:za}),Ha=/\s/,qa=/^\s+/,Qa=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&Ha.test(e.charAt(t)););return t}(e)+1).replace(qa,""):e},Wa=/^[-+]0x[0-9a-f]+$/i,Ga=/^0b[01]+$/i,Xa=/^0o[0-7]+$/i,Ya=parseInt,$a=function(e){return e?1/0===(e=function(e){if("number"==typeof e)return e;if(sr(e))return NaN;if(be(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=be(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Qa(e);var r=Ga.test(e);return r||Xa.test(e)?Ya(e.slice(2),r?2:8):Wa.test(e)?NaN:+e}(e))||-1/0===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0},Za=function(e,t){var r;if("function"!=typeof t)throw new TypeError("Expected a function");return e=function(e){var t=$a(e),r=t%1;return t==t?r?t-r:t:0}(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}},Ja=function(e){return Za(2,e)}(function(){var e=K(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c,l,u,d,f,p,h=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>0&&void 0!==h[0]?h[0]:{},r=t.tfUrl,n=void 0===r?"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@3.11.0":r,o=t.tfBackendWasmUrl,a=void 0===o?"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.11.0/dist/tf-backend-wasm.js":o,i=t.tfBackendCpuUrl,s=void 0===i?"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu@3.11.0":i,c=t.tfBackendWebGlUrl,l=void 0===c?"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl@3.11.0":c,u=t.tfLiteUrl,d=void 0===u?"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-tflite@0.0.1-alpha.7/dist/tf-tflite.min.js":u,f=t.blazefaceScriptUrl,p=void 0===f?"https://cdn.jsdelivr.net/npm/@tensorflow-models/blazeface@0.0.7":f,e.next=3,Ua({url:n});case 3:return e.next=5,Promise.all([Ua({url:a}),Ua({url:s}),Ua({url:l}),Ua({url:p}),Ua({url:d})]);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}());function ei(){return(ei=K(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:{},r=t.preferredBackends,n=void 0===r?["webgl","wasm","cpu"]:r,o=window,a=o.tf,e.next=4,a.enableProdMode();case 4:i=Z(n),e.prev=5,i.s();case 7:if((s=i.n()).done){e.next=21;break}return c=s.value,e.prev=9,e.next=12,a.setBackend(c);case 12:return e.abrupt("break",21);case 15:if(e.prev=15,e.t0=e.catch(9),c!==n[n.length-1]){e.next=19;break}throw e.t0;case 19:e.next=7;break;case 21:e.next=26;break;case 23:e.prev=23,e.t1=e.catch(5),i.e(e.t1);case 26:return e.prev=26,i.f(),e.finish(26);case 29:return e.next=31,a.ready();case 31:case"end":return e.stop()}}),e,null,[[5,23,26,29],[9,15]])})))).apply(this,arguments)}function ti(){return(ti=K(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.modelUrl,n=window,o=n.blazeface,e.abrupt("return",r?o.load({modelUrl:r}):o.load());case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ri(){return(ri=K(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.modelUrl,e.next=3,za(r);case 3:return n=e.sent,o=n.rawData,e.abrupt("return",o);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ni(){return(ni=K(regeneratorRuntime.mark((function e(t){var r,n,o,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.modelUrl,n=window,o=n.tflite,e.next=4,Va(r);case 4:return a=e.sent,i=a.u8arr,e.abrupt("return",o.loadTFLiteModel(i,{numThreads:navigator.hardwareConcurrency/2}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var oi=Object.freeze({__proto__:null,loadTensorFlow:Ja,initTensorFlow:function(){return ei.apply(this,arguments)},loadBlazefaceModel:function(e){return ti.apply(this,arguments)},preloadResource:function(e){return ri.apply(this,arguments)},loadTFLiteModel:function(e){return ni.apply(this,arguments)}}),ai=Object.freeze({__proto__:null,enableAntiDebug:function(){var e,t,r=["action","gger","stateObject","apply","chain","test","input","Hello World!","constructor","counter","length","debu","call"];e=r,t=185,function(t){for(;--t;)e.push(e.shift())}(++t);var n,o,a=function(e,t){return r[e-=0]};function i(e){function t(e){if("string"==typeof e)return function(e){}[a("0x5")]("while (true) {}")[a("0x0")](a("0x6"));1!=="".concat(e/e)[a("0x7")]||e%20==0?function(){return!0}[a("0x5")]("".concat(a("0x8"),"gger"))[a("0x9")](a("0xa")):function(){return!1}.constructor("debu".concat(a("0xb")))[a("0x0")](a("0xc")),t(++e)}try{if(e)return t;t(0)}catch(e){}}setInterval((function(){i()}),4e3),n=!0,o=function(e,t){var r=n?function(){if(t){var r=t[a("0x0")](e,arguments);return t=null,r}}:function(){};return n=!1,r},function(){o(this,(function(){var e=new RegExp("function *\\( *\\)"),t=new RegExp("\\+\\+ *(?:_0x(?:[a-f0-9]){4,6}|(?:\\b|\\d)[a-z0-9]{1,4}(?:\\b|\\d))","i"),r=i("init");e.test(r+a("0x1"))&&t[a("0x2")](r+a("0x3"))?i():r("0")}))()}(),console.log(a("0x4"))}}),ii=Object.freeze({__proto__:null,useThemeContext:function(){return a(m)}});function si(){return(si=K(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.key,n=new TextEncoder,(o=n.encode(r)).reverse(),e.abrupt("return",crypto.subtle.digest("SHA-256",o));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ci=Object.freeze({__proto__:null,encrypt:function(e){var t=e.blob,r=e.key;return new Promise((function(e){var n=new FileReader;n.onload=function(t){var n=t.target.result;(function(e){return si.apply(this,arguments)})({key:r}).then((function(t){window.crypto.subtle.importKey("raw",t,"AES-GCM",!0,["encrypt","decrypt"]).then((function(t){window.crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(12),tagLength:128},t,n).then((function(t){var r;e({hex:(r=t,X(new Uint8Array(r)).map((function(e){return e.toString(16).padStart(2,"0")})).join(""))})}))}))}))},n.readAsArrayBuffer(t)}))}}),li=function(){return URL.createObjectURL(new Blob(['\'use strict\';(function(){function T(a,b){let c=[],d="";b=a.readBits([8,16,16][b]);for(let d=0;d<b;d++){let b=a.readBits(8);c.push(b)}try{d+=decodeURIComponent(c.map(a=>`%${("0"+a.toString(16)).substr(-2)}`).join(""))}catch(e){}return{bytes:c,text:d}}function U(a,b){a=new V(a);let c=9>=b?0:26>=b?1:2;for(b={text:"",bytes:[],chunks:[],version:b};4<=a.available();){var d=a.readBits(4);if(d===t.Terminator)return b;if(d===t.ECI)0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(7)}):\n0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(14)}):0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(21)}):b.chunks.push({type:r.ECI,assignmentNumber:-1});else if(d===t.Numeric){var e=a;d=[];for(var f="",g=e.readBits([10,12,14][c]);3<=g;){var h=e.readBits(10);if(1E3<=h)throw Error("Invalid numeric value above 999");var k=Math.floor(h/100),n=Math.floor(h/10)%10;h%=10;d.push(48+k,48+n,48+h);f+=k.toString()+n.toString()+h.toString();g-=3}if(2===g){g=e.readBits(7);\nif(100<=g)throw Error("Invalid numeric value above 99");e=Math.floor(g/10);g%=10;d.push(48+e,48+g);f+=e.toString()+g.toString()}else if(1===g){e=e.readBits(4);if(10<=e)throw Error("Invalid numeric value above 9");d.push(48+e);f+=e.toString()}d={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Numeric,text:d.text})}else if(d===t.Alphanumeric){e=a;d=[];f="";for(g=e.readBits([9,11,13][c]);2<=g;)n=e.readBits(11),k=Math.floor(n/45),n%=45,d.push(B[k].charCodeAt(0),B[n].charCodeAt(0)),\nf+=B[k]+B[n],g-=2;1===g&&(e=e.readBits(6),d.push(B[e].charCodeAt(0)),f+=B[e]);d={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Alphanumeric,text:d.text})}else if(d===t.Byte)d=T(a,c),b.text+=d.text,b.bytes.push(...d.bytes),b.chunks.push({type:r.Byte,bytes:d.bytes,text:d.text});else if(d===t.Kanji){f=a;d=[];e=f.readBits([8,10,12][c]);for(g=0;g<e;g++)k=f.readBits(13),k=Math.floor(k/192)<<8|k%192,k=7936>k?k+33088:k+49472,d.push(k>>8,k&255);f=(new TextDecoder("shift-jis")).decode(Uint8Array.from(d));\nd={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Kanji,bytes:d.bytes,text:d.text})}else d===t.StructuredAppend&&b.chunks.push({type:r.StructuredAppend,currentSequence:a.readBits(4),totalSequence:a.readBits(4),parity:a.readBits(8)})}if(0===a.available()||0===a.readBits(a.available()))return b}function J(a,b){return a^b}function W(a,b,c,d){b.degree()<c.degree()&&([b,c]=[c,b]);let e=a.zero;for(var f=a.one;c.degree()>=d/2;){var g=b;let d=e;b=c;e=f;if(b.isZero())return null;\nc=g;f=a.zero;g=b.getCoefficient(b.degree());for(g=a.inverse(g);c.degree()>=b.degree()&&!c.isZero();){let d=c.degree()-b.degree(),e=a.multiply(c.getCoefficient(c.degree()),g);f=f.addOrSubtract(a.buildMonomial(d,e));c=c.addOrSubtract(b.multiplyByMonomial(d,e))}f=f.multiplyPoly(e).addOrSubtract(d);if(c.degree()>=b.degree())return null}d=f.getCoefficient(0);if(0===d)return null;a=a.inverse(d);return[f.multiply(a),c.multiply(a)]}function X(a,b){let c=new Uint8ClampedArray(a.length);c.set(a);a=new Y(285,\n256,0);var d=new w(a,c),e=new Uint8ClampedArray(b),f=!1;for(var g=0;g<b;g++){var h=d.evaluateAt(a.exp(g+a.generatorBase));e[e.length-1-g]=h;0!==h&&(f=!0)}if(!f)return c;d=new w(a,e);d=W(a,a.buildMonomial(b,1),d,b);if(null===d)return null;b=d[0];g=b.degree();if(1===g)b=[b.getCoefficient(1)];else{e=Array(g);f=0;for(h=1;h<a.size&&f<g;h++)0===b.evaluateAt(h)&&(e[f]=a.inverse(h),f++);b=f!==g?null:e}if(null==b)return null;d=d[1];e=b.length;f=Array(e);for(g=0;g<e;g++){h=a.inverse(b[g]);let c=1;for(let d=\n0;d<e;d++)g!==d&&(c=a.multiply(c,J(1,a.multiply(b[d],h))));f[g]=a.multiply(d.evaluateAt(h),a.inverse(c));0!==a.generatorBase&&(f[g]=a.multiply(f[g],h))}d=f;for(e=0;e<b.length;e++){f=c.length-1-a.log(b[e]);if(0>f)return null;c[f]^=d[e]}return c}function E(a,b){a^=b;for(b=0;a;)b++,a&=a-1;return b}function C(a,b){return b<<1|a}function Z(a,b,c){c=aa[c.dataMask];let d=a.height;var e=17+4*b.versionNumber,f=A.createEmpty(e,e);f.setRegion(0,0,9,9,!0);f.setRegion(e-8,0,8,9,!0);f.setRegion(0,e-8,9,8,!0);for(var g of b.alignmentPatternCenters)for(var h of b.alignmentPatternCenters)6===\ng&&6===h||6===g&&h===e-7||g===e-7&&6===h||f.setRegion(g-2,h-2,5,5,!0);f.setRegion(6,9,1,e-17,!0);f.setRegion(9,6,e-17,1,!0);6<b.versionNumber&&(f.setRegion(e-11,0,3,6,!0),f.setRegion(0,e-11,6,3,!0));b=f;g=[];e=h=0;f=!0;for(let k=d-1;0<k;k-=2){6===k&&k--;for(let n=0;n<d;n++){let m=f?d-1-n:n;for(let d=0;2>d;d++){let f=k-d;if(!b.get(f,m)){e++;let b=a.get(f,m);c({y:m,x:f})&&(b=!b);h=h<<1|b;8===e&&(g.push(h),h=e=0)}}}f=!f}return g}function ba(a){var b=a.height,c=Math.floor((b-17)/4);if(6>=c)return K[c-\n1];c=0;for(var d=5;0<=d;d--)for(var e=b-9;e>=b-11;e--)c=C(a.get(e,d),c);d=0;for(e=5;0<=e;e--)for(let c=b-9;c>=b-11;c--)d=C(a.get(e,c),d);a=Infinity;let f;for(let e of K){if(e.infoBits===c||e.infoBits===d)return e;b=E(c,e.infoBits);b<a&&(f=e,a=b);b=E(d,e.infoBits);b<a&&(f=e,a=b)}if(3>=a)return f}function ca(a){let b=0;for(var c=0;8>=c;c++)6!==c&&(b=C(a.get(c,8),b));for(c=7;0<=c;c--)6!==c&&(b=C(a.get(8,c),b));var d=a.height;c=0;for(var e=d-1;e>=d-7;e--)c=C(a.get(8,e),c);for(e=d-8;e<d;e++)c=C(a.get(e,\n8),c);a=Infinity;d=null;for(let {bits:f,formatInfo:g}of da){if(f===b||f===c)return g;e=E(b,f);e<a&&(d=g,a=e);b!==c&&(e=E(c,f),e<a&&(d=g,a=e))}return 3>=a?d:null}function ea(a,b,c){let d=b.errorCorrectionLevels[c],e=[],f=0;d.ecBlocks.forEach(a=>{for(let b=0;b<a.numBlocks;b++)e.push({numDataCodewords:a.dataCodewordsPerBlock,codewords:[]}),f+=a.dataCodewordsPerBlock+d.ecCodewordsPerBlock});if(a.length<f)return null;a=a.slice(0,f);b=d.ecBlocks[0].dataCodewordsPerBlock;for(c=0;c<b;c++)for(var g of e)g.codewords.push(a.shift());\nif(1<d.ecBlocks.length)for(g=d.ecBlocks[0].numBlocks,b=d.ecBlocks[1].numBlocks,c=0;c<b;c++)e[g+c].codewords.push(a.shift());for(;0<a.length;)for(let b of e)b.codewords.push(a.shift());return e}function L(a){let b=ba(a);if(!b)return null;var c=ca(a);if(!c)return null;a=Z(a,b,c);var d=ea(a,b,c.errorCorrectionLevel);if(!d)return null;c=d.reduce((a,b)=>a+b.numDataCodewords,0);c=new Uint8ClampedArray(c);a=0;for(let b of d){d=X(b.codewords,b.codewords.length-b.numDataCodewords);if(!d)return null;for(let e=\n0;e<b.numDataCodewords;e++)c[a++]=d[e]}try{return U(c,b.versionNumber)}catch(e){return null}}function M(a,b,c,d){var e=a.x-b.x+c.x-d.x;let f=a.y-b.y+c.y-d.y;if(0===e&&0===f)return{a11:b.x-a.x,a12:b.y-a.y,a13:0,a21:c.x-b.x,a22:c.y-b.y,a23:0,a31:a.x,a32:a.y,a33:1};{let h=b.x-c.x;var g=d.x-c.x;let k=b.y-c.y,n=d.y-c.y;c=h*n-g*k;g=(e*n-g*f)/c;e=(h*f-e*k)/c;return{a11:b.x-a.x+g*b.x,a12:b.y-a.y+g*b.y,a13:g,a21:d.x-a.x+e*d.x,a22:d.y-a.y+e*d.y,a23:e,a31:a.x,a32:a.y,a33:1}}}function fa(a,b,c,d){a=M(a,b,c,d);\nreturn{a11:a.a22*a.a33-a.a23*a.a32,a12:a.a13*a.a32-a.a12*a.a33,a13:a.a12*a.a23-a.a13*a.a22,a21:a.a23*a.a31-a.a21*a.a33,a22:a.a11*a.a33-a.a13*a.a31,a23:a.a13*a.a21-a.a11*a.a23,a31:a.a21*a.a32-a.a22*a.a31,a32:a.a12*a.a31-a.a11*a.a32,a33:a.a11*a.a22-a.a12*a.a21}}function ha(a,b){var c=fa({x:3.5,y:3.5},{x:b.dimension-3.5,y:3.5},{x:b.dimension-6.5,y:b.dimension-6.5},{x:3.5,y:b.dimension-3.5}),d=M(b.topLeft,b.topRight,b.alignmentPattern,b.bottomLeft),e=d.a11*c.a11+d.a21*c.a12+d.a31*c.a13,f=d.a12*c.a11+\nd.a22*c.a12+d.a32*c.a13,g=d.a13*c.a11+d.a23*c.a12+d.a33*c.a13,h=d.a11*c.a21+d.a21*c.a22+d.a31*c.a23,k=d.a12*c.a21+d.a22*c.a22+d.a32*c.a23,n=d.a13*c.a21+d.a23*c.a22+d.a33*c.a23,m=d.a11*c.a31+d.a21*c.a32+d.a31*c.a33,l=d.a12*c.a31+d.a22*c.a32+d.a32*c.a33,p=d.a13*c.a31+d.a23*c.a32+d.a33*c.a33;c=A.createEmpty(b.dimension,b.dimension);d=(a,b)=>{const c=g*a+n*b+p;return{x:(e*a+h*b+m)/c,y:(f*a+k*b+l)/c}};for(let e=0;e<b.dimension;e++)for(let f=0;f<b.dimension;f++){let b=d(f+.5,e+.5);c.set(f,e,a.get(Math.floor(b.x),\nMath.floor(b.y)))}return{matrix:c,mappingFunction:d}}function x(a){return a.reduce((a,c)=>a+c)}function ia(a,b,c){let d=y(a,b),e=y(b,c),f=y(a,c),g,h,k;e>=d&&e>=f?[g,h,k]=[b,a,c]:f>=e&&f>=d?[g,h,k]=[a,b,c]:[g,h,k]=[a,c,b];0>(k.x-h.x)*(g.y-h.y)-(k.y-h.y)*(g.x-h.x)&&([g,k]=[k,g]);return{bottomLeft:g,topLeft:h,topRight:k}}function ja(a,b,c,d){d=(x(z(a,c,d,5))/7+x(z(a,b,d,5))/7+x(z(c,a,d,5))/7+x(z(b,a,d,5))/7)/4;if(1>d)throw Error("Invalid module size");b=Math.round(y(a,b)/d);a=Math.round(y(a,c)/d);a=\nMath.floor((b+a)/2)+7;switch(a%4){case 0:a++;break;case 2:a--}return{dimension:a,moduleSize:d}}function N(a,b,c,d){let e=[{x:Math.floor(a.x),y:Math.floor(a.y)}];var f=Math.abs(b.y-a.y)>Math.abs(b.x-a.x);if(f){var g=Math.floor(a.y);var h=Math.floor(a.x);a=Math.floor(b.y);b=Math.floor(b.x)}else g=Math.floor(a.x),h=Math.floor(a.y),a=Math.floor(b.x),b=Math.floor(b.y);let k=Math.abs(a-g),n=Math.abs(b-h),m=Math.floor(-k/2),l=g<a?1:-1,p=h<b?1:-1,q=!0;for(let v=g,u=h;v!==a+l;v+=l){g=f?u:v;h=f?v:u;if(c.get(g,\nh)!==q&&(q=!q,e.push({x:g,y:h}),e.length===d+1))break;m+=n;if(0<m){if(u===b)break;u+=p;m-=k}}c=[];for(f=0;f<d;f++)e[f]&&e[f+1]?c.push(y(e[f],e[f+1])):c.push(0);return c}function z(a,b,c,d){let e=b.y-a.y,f=b.x-a.x;b=N(a,b,c,Math.ceil(d/2));a=N(a,{x:a.x-f,y:a.y-e},c,Math.ceil(d/2));c=b.shift()+a.shift()-1;return a.concat(c).concat(...b)}function F(a,b){let c=x(a)/x(b),d=0;b.forEach((b,f)=>{d+=Math.pow(a[f]-b*c,2)});return{averageSize:c,error:d}}function O(a,b,c){try{let d=z(a,{x:-1,y:a.y},c,b.length),\ne=z(a,{x:a.x,y:-1},c,b.length),f=z(a,{x:Math.max(0,a.x-a.y)-1,y:Math.max(0,a.y-a.x)-1},c,b.length),g=z(a,{x:Math.min(c.width,a.x+a.y)+1,y:Math.min(c.height,a.y+a.x)+1},c,b.length),h=F(d,b),k=F(e,b),n=F(f,b),m=F(g,b),l=(h.averageSize+k.averageSize+n.averageSize+m.averageSize)/4;return Math.sqrt(h.error*h.error+k.error*k.error+n.error*n.error+m.error*m.error)+(Math.pow(h.averageSize-l,2)+Math.pow(k.averageSize-l,2)+Math.pow(n.averageSize-l,2)+Math.pow(m.averageSize-l,2))/l}catch(d){return Infinity}}\nfunction H(a,b){for(var c=Math.round(b.x);a.get(c,Math.round(b.y));)c--;for(var d=Math.round(b.x);a.get(d,Math.round(b.y));)d++;c=(c+d)/2;for(d=Math.round(b.y);a.get(Math.round(c),d);)d--;for(b=Math.round(b.y);a.get(Math.round(c),b);)b++;return{x:c,y:(d+b)/2}}function ka(a){var b=[],c=[];let d=[];var e=[];for(let m=0;m<=a.height;m++){var f=0,g=!1;let l=[0,0,0,0,0];for(let b=-1;b<=a.width;b++){var h=a.get(b,m);if(h===g)f++;else{l=[l[1],l[2],l[3],l[4],f];f=1;g=h;var k=x(l)/7;k=Math.abs(l[0]-k)<k&&Math.abs(l[1]-\nk)<k&&Math.abs(l[2]-3*k)<3*k&&Math.abs(l[3]-k)<k&&Math.abs(l[4]-k)<k&&!h;var n=x(l.slice(-3))/3;h=Math.abs(l[2]-n)<n&&Math.abs(l[3]-n)<n&&Math.abs(l[4]-n)<n&&h;if(k){let a=b-l[3]-l[4],d=a-l[2];k={startX:d,endX:a,y:m};n=c.filter(b=>d>=b.bottom.startX&&d<=b.bottom.endX||a>=b.bottom.startX&&d<=b.bottom.endX||d<=b.bottom.startX&&a>=b.bottom.endX&&1.5>l[2]/(b.bottom.endX-b.bottom.startX)&&.5<l[2]/(b.bottom.endX-b.bottom.startX));0<n.length?n[0].bottom=k:c.push({top:k,bottom:k})}if(h){let a=b-l[4],c=a-\nl[3];h={startX:c,y:m,endX:a};k=e.filter(b=>c>=b.bottom.startX&&c<=b.bottom.endX||a>=b.bottom.startX&&c<=b.bottom.endX||c<=b.bottom.startX&&a>=b.bottom.endX&&1.5>l[2]/(b.bottom.endX-b.bottom.startX)&&.5<l[2]/(b.bottom.endX-b.bottom.startX));0<k.length?k[0].bottom=h:e.push({top:h,bottom:h})}}}b.push(...c.filter(a=>a.bottom.y!==m&&2<=a.bottom.y-a.top.y));c=c.filter(a=>a.bottom.y===m);d.push(...e.filter(a=>a.bottom.y!==m));e=e.filter(a=>a.bottom.y===m)}b.push(...c.filter(a=>2<=a.bottom.y-a.top.y));d.push(...e);\nc=[];for(var m of b)2>m.bottom.y-m.top.y||(b=(m.top.startX+m.top.endX+m.bottom.startX+m.bottom.endX)/4,e=(m.top.y+m.bottom.y+1)/2,a.get(Math.round(b),Math.round(e))&&(f=[m.top.endX-m.top.startX,m.bottom.endX-m.bottom.startX,m.bottom.y-m.top.y+1],f=x(f)/f.length,g=O({x:Math.round(b),y:Math.round(e)},[1,1,3,1,1],a),c.push({score:g,x:b,y:e,size:f})));if(3>c.length)return null;c.sort((a,b)=>a.score-b.score);m=[];for(b=0;b<Math.min(c.length,5);++b){e=c[b];f=[];for(var l of c)l!==e&&f.push(Object.assign(Object.assign({},\nl),{score:l.score+Math.pow(l.size-e.size,2)/e.size}));f.sort((a,b)=>a.score-b.score);m.push({points:[e,f[0],f[1]],score:e.score+f[0].score+f[1].score})}m.sort((a,b)=>a.score-b.score);let {topRight:p,topLeft:q,bottomLeft:v}=ia(...m[0].points);m=P(a,d,p,q,v);l=[];m&&l.push({alignmentPattern:{x:m.alignmentPattern.x,y:m.alignmentPattern.y},bottomLeft:{x:v.x,y:v.y},dimension:m.dimension,topLeft:{x:q.x,y:q.y},topRight:{x:p.x,y:p.y}});m=H(a,p);b=H(a,q);c=H(a,v);(a=P(a,d,m,b,c))&&l.push({alignmentPattern:{x:a.alignmentPattern.x,\ny:a.alignmentPattern.y},bottomLeft:{x:c.x,y:c.y},topLeft:{x:b.x,y:b.y},topRight:{x:m.x,y:m.y},dimension:a.dimension});return 0===l.length?null:l}function P(a,b,c,d,e){let f,g;try{({dimension:f,moduleSize:g}=ja(d,c,e,a))}catch(m){return null}var h=c.x-d.x+e.x,k=c.y-d.y+e.y;c=(y(d,e)+y(d,c))/2/g;e=1-3/c;let n={x:d.x+e*(h-d.x),y:d.y+e*(k-d.y)};b=b.map(b=>{const c=(b.top.startX+b.top.endX+b.bottom.startX+b.bottom.endX)/4;b=(b.top.y+b.bottom.y+1)/2;if(a.get(Math.floor(c),Math.floor(b))){var d=O({x:Math.floor(c),\ny:Math.floor(b)},[1,1,1],a)+y({x:c,y:b},n);return{x:c,y:b,score:d}}}).filter(a=>!!a).sort((a,b)=>a.score-b.score);return{alignmentPattern:15<=c&&b.length?b[0]:n,dimension:f}}function Q(a){var b=ka(a);if(!b)return null;for(let e of b){b=ha(a,e);var c=b.matrix;if(null==c)c=null;else{var d=L(c);if(d)c=d;else{for(d=0;d<c.width;d++)for(let a=d+1;a<c.height;a++)c.get(d,a)!==c.get(a,d)&&(c.set(d,a,!c.get(d,a)),c.set(a,d,!c.get(a,d)));c=L(c)}}if(c)return{binaryData:c.bytes,data:c.text,chunks:c.chunks,version:c.version,\nlocation:{topRightCorner:b.mappingFunction(e.dimension,0),topLeftCorner:b.mappingFunction(0,0),bottomRightCorner:b.mappingFunction(e.dimension,e.dimension),bottomLeftCorner:b.mappingFunction(0,e.dimension),topRightFinderPattern:e.topRight,topLeftFinderPattern:e.topLeft,bottomLeftFinderPattern:e.bottomLeft,bottomRightAlignmentPattern:e.alignmentPattern},matrix:b.matrix}}return null}function R(a,b){Object.keys(b).forEach(c=>{a[c]=b[c]})}function I(a,b,c,d={}){let e=Object.create(null);R(e,la);R(e,d);\nd="onlyInvert"===e.inversionAttempts||"invertFirst"===e.inversionAttempts;var f="attemptBoth"===e.inversionAttempts||d;var g=e.greyScaleWeights,h=e.canOverwriteImage,k=b*c;if(a.length!==4*k)throw Error("Malformed data passed to binarizer.");var n=0;if(h){var m=new Uint8ClampedArray(a.buffer,n,k);n+=k}m=new S(b,c,m);if(g.useIntegerApproximation)for(var l=0;l<c;l++)for(var p=0;p<b;p++){var q=4*(l*b+p);m.set(p,l,g.red*a[q]+g.green*a[q+1]+g.blue*a[q+2]+128>>8)}else for(l=0;l<c;l++)for(p=0;p<b;p++)q=4*\n(l*b+p),m.set(p,l,g.red*a[q]+g.green*a[q+1]+g.blue*a[q+2]);g=Math.ceil(b/8);l=Math.ceil(c/8);p=g*l;if(h){var v=new Uint8ClampedArray(a.buffer,n,p);n+=p}v=new S(g,l,v);for(p=0;p<l;p++)for(q=0;q<g;q++){var u=Infinity,r=0;for(var t=0;8>t;t++)for(let a=0;8>a;a++){let b=m.get(8*q+a,8*p+t);u=Math.min(u,b);r=Math.max(r,b)}t=(u+r)/2;t=Math.min(255,1.11*t);24>=r-u&&(t=u/2,0<p&&0<q&&(r=(v.get(q,p-1)+2*v.get(q-1,p)+v.get(q-1,p-1))/4,u<r&&(t=r)));v.set(q,p,t)}h?(p=new Uint8ClampedArray(a.buffer,n,k),n+=k,p=new A(p,\nb)):p=A.createEmpty(b,c);q=null;f&&(h?(a=new Uint8ClampedArray(a.buffer,n,k),q=new A(a,b)):q=A.createEmpty(b,c));for(b=0;b<l;b++)for(a=0;a<g;a++){c=g-3;c=2>a?2:a>c?c:a;h=l-3;h=2>b?2:b>h?h:b;k=0;for(n=-2;2>=n;n++)for(u=-2;2>=u;u++)k+=v.get(c+n,h+u);c=k/25;for(h=0;8>h;h++)for(k=0;8>k;k++)n=8*a+h,u=8*b+k,r=m.get(n,u),p.set(n,u,r<=c),f&&q.set(n,u,!(r<=c))}f=f?{binarized:p,inverted:q}:{binarized:p};let {binarized:w,inverted:x}=f;(f=Q(d?x:w))||"attemptBoth"!==e.inversionAttempts&&"invertFirst"!==e.inversionAttempts||\n(f=Q(d?w:x));return f}class A{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new A(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let b=a;b<a+c;b++)this.set(b,f,!!e)}}class S{constructor(a,b,c){this.width=a;a*=b;if(c&&c.length!==a)throw Error("Wrong buffer size");this.data=c||new Uint8ClampedArray(a)}get(a,\nb){return this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c}}class V{constructor(a){this.bitOffset=this.byteOffset=0;this.bytes=a}readBits(a){if(1>a||32<a||a>this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0<this.bitOffset){b=8-this.bitOffset;var c=a<b?a:b;b-=c;b=(this.bytes[this.byteOffset]&255>>8-c<<b)>>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(0<a){for(;8<=a;)b=b<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,\na-=8;0<a&&(c=8-a,b=b<<a|(this.bytes[this.byteOffset]&255>>c<<c)>>c,this.bitOffset+=a)}return b}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var r;(function(a){a.Numeric="numeric";a.Alphanumeric="alphanumeric";a.Byte="byte";a.Kanji="kanji";a.ECI="eci";a.StructuredAppend="structuredappend"})(r||(r={}));var t;(function(a){a[a.Terminator=0]="Terminator";a[a.Numeric=1]="Numeric";a[a.Alphanumeric=2]="Alphanumeric";a[a.Byte=4]="Byte";a[a.Kanji=8]="Kanji";a[a.ECI=7]="ECI";a[a.StructuredAppend=\n3]="StructuredAppend"})(t||(t={}));let B="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");class w{constructor(a,b){if(0===b.length)throw Error("No coefficients.");this.field=a;let c=b.length;if(1<c&&0===b[0]){let d=1;for(;d<c&&0===b[d];)d++;if(d===c)this.coefficients=a.zero.coefficients;else for(this.coefficients=new Uint8ClampedArray(c-d),a=0;a<this.coefficients.length;a++)this.coefficients[a]=b[d+a]}else this.coefficients=b}degree(){return this.coefficients.length-1}isZero(){return 0===\nthis.coefficients[0]}getCoefficient(a){return this.coefficients[this.coefficients.length-1-a]}addOrSubtract(a){if(this.isZero())return a;if(a.isZero())return this;let b=this.coefficients;a=a.coefficients;b.length>a.length&&([b,a]=[a,b]);let c=new Uint8ClampedArray(a.length),d=a.length-b.length;for(var e=0;e<d;e++)c[e]=a[e];for(e=d;e<a.length;e++)c[e]=b[e-d]^a[e];return new w(this.field,c)}multiply(a){if(0===a)return this.field.zero;if(1===a)return this;let b=this.coefficients.length,c=new Uint8ClampedArray(b);\nfor(let d=0;d<b;d++)c[d]=this.field.multiply(this.coefficients[d],a);return new w(this.field,c)}multiplyPoly(a){if(this.isZero()||a.isZero())return this.field.zero;let b=this.coefficients,c=b.length;a=a.coefficients;let d=a.length,e=new Uint8ClampedArray(c+d-1);for(let h=0;h<c;h++){let c=b[h];for(let b=0;b<d;b++){var f=h+b,g=this.field.multiply(c,a[b]);e[f]=e[h+b]^g}}return new w(this.field,e)}multiplyByMonomial(a,b){if(0>a)throw Error("Invalid degree less than 0");if(0===b)return this.field.zero;\nlet c=this.coefficients.length;a=new Uint8ClampedArray(c+a);for(let d=0;d<c;d++)a[d]=this.field.multiply(this.coefficients[d],b);return new w(this.field,a)}evaluateAt(a){let b=0;if(0===a)return this.getCoefficient(0);let c=this.coefficients.length;if(1===a)return this.coefficients.forEach(a=>{b^=a}),b;b=this.coefficients[0];for(let d=1;d<c;d++)b=J(this.field.multiply(a,b),this.coefficients[d]);return b}}class Y{constructor(a,b,c){this.primitive=a;this.size=b;this.generatorBase=c;this.expTable=Array(this.size);\nthis.logTable=Array(this.size);a=1;for(b=0;b<this.size;b++)this.expTable[b]=a,a*=2,a>=this.size&&(a=(a^this.primitive)&this.size-1);for(a=0;a<this.size-1;a++)this.logTable[this.expTable[a]]=a;this.zero=new w(this,Uint8ClampedArray.from([0]));this.one=new w(this,Uint8ClampedArray.from([1]))}multiply(a,b){return 0===a||0===b?0:this.expTable[(this.logTable[a]+this.logTable[b])%(this.size-1)]}inverse(a){if(0===a)throw Error("Can\'t invert 0");return this.expTable[this.size-this.logTable[a]-1]}buildMonomial(a,\nb){if(0>a)throw Error("Invalid monomial degree less than 0");if(0===b)return this.zero;a=new Uint8ClampedArray(a+1);a[0]=b;return new w(this,a)}log(a){if(0===a)throw Error("Can\'t take log(0)");return this.logTable[a]}exp(a){return this.expTable[a]}}let K=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,\necBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},\n{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,\ndataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},\n{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},\n{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},\n{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,\ndataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,\ndataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},\n{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},\n{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},\n{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},\n{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,\necBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,\ndataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,\ndataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,\ndataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,\n32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},\n{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},\n{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,\ndataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},\n{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},\n{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,\n30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},\n{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,\ndataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},\n{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,\ndataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},\n{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,\ndataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}],da=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,\ndataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,\nformatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,\ndataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,\ndataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],aa=[a=>0===(a.y+a.x)%2,a=>0===a.y%2,a=>0===a.x%3,a=>0===(a.y+a.x)%3,a=>0===(Math.floor(a.y/2)+Math.floor(a.x/3))%2,a=>0===a.x*a.y%2+a.x*a.y%3,a=>0===(a.y*a.x%2+a.y*a.x%3)%2,a=>0===((a.y+a.x)%2+a.y*a.x%3)%2],y=(a,b)=>Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2)),la={inversionAttempts:"attemptBoth",greyScaleWeights:{red:.2126,green:.7152,blue:.0722,useIntegerApproximation:!1},\ncanOverwriteImage:!0};I.default=I;let G="dontInvert",D={red:77,green:150,blue:29,useIntegerApproximation:!0};self.onmessage=a=>{let b=a.data.data;switch(a.data.type){case "decode":a=I(b.data,b.width,b.height,{inversionAttempts:G,greyScaleWeights:D});self.postMessage({type:"qrResult",data:a?a.data:null});break;case "grayscaleWeights":D.red=b.red;D.green=b.green;D.blue=b.blue;D.useIntegerApproximation=b.useIntegerApproximation;break;case "inversionMode":switch(b){case "original":G="dontInvert";break;\ncase "invert":G="onlyInvert";break;case "both":G="attemptBoth";break;default:throw Error("Invalid inversion mode");}break;case "close":self.close()}}})()\n\n']))},ui=on(),di=function(){function e(r){var n=this,o=r.container,a=r.lang,i=void 0===a?"en":a,s=r.assetRoot,c=void 0===s?"https://unpkg.com/@tsocial/tvweb-sdk@latest/assets":s,l=r.resourceRoot,u=r.customUrls,d=void 0===u?{}:u,f=r.enableAntiDebug,p=void 0===f||f,h=r.warmupMessage,m=r.baseComponent,g=r.component,v=void 0===g?{}:g;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),H(this,"initNativeCamera",(function(e){var r=document.createElement("div");document.body.appendChild(r);var o=t.createRef(),a=n.component.NativeCamera;return C.render(t.createElement(a,q({},e,{ref:o})),r),{openCamera:function(){o.current.click()}}})),H(this,"runWarmUpReadIDCard",K(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.commonSettings.customUrls,e.abrupt("return",n.component.warmUpReadIdCard(t));case 2:case"end":return e.stop()}}),e)})))),H(this,"runPreloadEKYCResources",K(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=n.commonSettings.customUrls,n.component.preloadEKYCResources(t);case 2:case"end":return e.stop()}}),e)})))),H(this,"destroyView",(function(){C.unmountComponentAtNode(n.container)})),function(e,t,r,n,o,a,i,s){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,o,a,i,s],u=0;(c=new Error(t.replace(/%s/g,(function(){return l[u++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}}(o,"container is a required parameter"),this.container=o,this.container.style="touch-action: none; -ms-touch-action: none;";var y=Vr({resourceRoot:l,initCustomUrls:d});this.commonSettings={lang:i,assetRoot:c,customUrls:y,enableAntiDebug:p,debug:!1,warmupMessage:h},this.component=W(W({},m),v)}var r;return(r=[{key:"checkCamera",value:function(){return(0,this.component.checkCamera)()}},{key:"getListCamera",value:function(){return(0,this.component.getListCamera)()}},{key:"readIDCardWithApiCall",value:function(e){var r=this.component.ReadIDCardWithApiCall;C.render(t.createElement(Kr,{value:W({},this.commonSettings)},t.createElement(r,q({onClose:this.destroyView},e))),this.container)}},{key:"readIDCardUIOnly",value:function(e){var r=this.component.ReadIDCardUIOnly;C.render(t.createElement(Kr,{value:this.commonSettings},t.createElement(r,q({onClose:this.destroyView},e))),this.container)}},{key:"livenessDetection",value:function(e){var r=this.component.LivenessDetection;C.render(t.createElement(Kr,{value:W({},this.commonSettings)},t.createElement(r,q({onClose:this.destroyView},e))),this.container)}},{key:"compareFaces",value:function(e){var t=e.accessKey,r=e.secretKey,n=e.apiUrl,o=e.image1,a=e.image2,i=e.onSuccess,s=e.onError;Ra(new Gr(t,r,n,{httpHeaders:ui})).compareFaces({image1:{id:o},image2:{id:a}}).then((function(e){i(e)})).catch((function(e){s(e)}))}}])&&function(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)}}(e.prototype,r),e}(),fi="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function pi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function hi(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var mi=hi((function(e){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){var n={MOBILE:"mobile",TABLET:"tablet",SMART_TV:"smarttv",CONSOLE:"console",WEARABLE:"wearable",BROWSER:void 0};e.exports={BROWSER_TYPES:{CHROME:"Chrome",FIREFOX:"Firefox",OPERA:"Opera",YANDEX:"Yandex",SAFARI:"Safari",INTERNET_EXPLORER:"Internet Explorer",EDGE:"Edge",CHROMIUM:"Chromium",IE:"IE",MOBILE_SAFARI:"Mobile Safari",EDGE_CHROMIUM:"Edge Chromium"},DEVICE_TYPES:n,OS_TYPES:{IOS:"iOS",ANDROID:"Android",WINDOWS_PHONE:"Windows Phone",WINDOWS:"Windows",MAC_OS:"Mac OS"},defaultData:{isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1}}},function(e,t,r){var n,o=r(2),a=r(0),i=a.BROWSER_TYPES,s=a.OS_TYPES,c=a.DEVICE_TYPES,l=r(4),u=l.checkType,d=l.broPayload,f=l.mobilePayload,p=l.wearPayload,h=l.consolePayload,m=l.stvPayload,g=l.getNavigatorInstance,v=l.isIOS13Check,y=new o,b=y.getBrowser(),C=y.getDevice(),w=y.getEngine(),k=y.getOS(),B=y.getUA(),E=i.CHROME,S=i.CHROMIUM,A=i.IE,_=i.INTERNET_EXPLORER,I=i.OPERA,T=i.FIREFOX,P=i.SAFARI,x=i.EDGE,R=i.YANDEX,N=i.MOBILE_SAFARI,L=c.MOBILE,O=c.TABLET,D=c.SMART_TV,M=c.BROWSER,U=c.WEARABLE,j=c.CONSOLE,F=s.ANDROID,V=s.WINDOWS_PHONE,z=s.IOS,K=s.WINDOWS,H=s.MAC_OS,q=function(){return k.name===s.WINDOWS&&"10"===k.version&&("string"==typeof B&&-1!==B.indexOf("Edg/"))},Q=function(){return b.name===x},W=function(){return v("iPad")},G=C.type===D,X=C.type===j,Y=C.type===U,$=b.name===N||W(),Z=b.name===S,J=function(){switch(C.type){case L:case O:return!0;default:return!1}}()||W(),ee=C.type===L,te=C.type===O||W(),re=C.type===M,ne=k.name===F,oe=k.name===V,ae=k.name===z||W(),ie=b.name===E,se=b.name===T,ce=b.name===P||b.name===N,le=b.name===I,ue=b.name===_||b.name===A,de=k.version?k.version:"none",fe=k.name?k.name:"none",pe=b.major,he=b.version,me=b.name,ge=C.vendor?C.vendor:"none",ve=C.model?C.model:"none",ye=w.name,be=w.version,Ce=B,we=Q()||q(),ke=b.name===R,Be=C.type,Ee=(n=g())&&(/iPad|iPhone|iPod/.test(n.platform)||"MacIntel"===n.platform&&n.maxTouchPoints>1)&&!window.MSStream,Se=W(),Ae=v("iPhone"),_e=v("iPod"),Ie=function(){var e=g(),t=e&&e.userAgent.toLowerCase();return"string"==typeof t&&/electron/.test(t)}(),Te=q(),Pe=Q(),xe=k.name===K,Re=k.name===H,Ne=u(C.type);e.exports={deviceDetect:function(){var e=Ne.isBrowser,t=Ne.isMobile,r=Ne.isTablet,n=Ne.isSmartTV,o=Ne.isConsole,a=Ne.isWearable;return e?d(e,b,w,k,B):n?m(n,w,k,B):o?h(o,w,k,B):t||r?f(Ne,C,k,B):a?p(a,w,k,B):void 0},isSmartTV:G,isConsole:X,isWearable:Y,isMobileSafari:$,isChromium:Z,isMobile:J,isMobileOnly:ee,isTablet:te,isBrowser:re,isAndroid:ne,isWinPhone:oe,isIOS:ae,isChrome:ie,isFirefox:se,isSafari:ce,isOpera:le,isIE:ue,osVersion:de,osName:fe,fullBrowserVersion:pe,browserVersion:he,browserName:me,mobileVendor:ge,mobileModel:ve,engineName:ye,engineVersion:be,getUA:Ce,isEdge:we,isYandex:ke,deviceType:Be,isIOS13:Ee,isIPad13:Se,isIPhone13:Ae,isIPod13:_e,isElectron:Ie,isEdgeChromium:Te,isLegacyEdge:Pe,isWindows:xe,isMacOs:Re}},function(e,t,r){var n;
|
|
41
|
+
(r=pn).mode.CTRGladman=function(){var e=r.lib.BlockCipherMode.extend();function t(e){if(255==(e>>24&255)){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}else e+=1<<24;return e}function n(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var o=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,a=this._iv,i=this._counter;a&&(i=this._counter=a.slice(0),this._iv=void 0),n(i);var s=i.slice(0);r.encryptBlock(s,0);for(var c=0;c<o;c++)e[t+c]^=s[c]}});return e.Decryptor=o,e}(),r.mode.CTRGladman)})),ie((function(e,t){var r,n,o;e.exports=((o=pn).mode.OFB=(n=(r=o.lib.BlockCipherMode.extend()).Encryptor=r.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,a=this._keystream;o&&(a=this._keystream=o.slice(0),this._iv=void 0),r.encryptBlock(a,0);for(var i=0;i<n;i++)e[t+i]^=a[i]}}),r.Decryptor=n,r),o.mode.OFB)})),ie((function(e,t){var r,n;e.exports=((n=pn).mode.ECB=((r=n.lib.BlockCipherMode.extend()).Encryptor=r.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),r.Decryptor=r.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),r),n.mode.ECB)})),ie((function(e,t){var r;e.exports=((r=pn).pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,o=n-r%n,a=r+o-1;e.clamp(),e.words[a>>>2]|=o<<24-a%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),ie((function(e,t){var r;e.exports=((r=pn).pad.Iso10126={pad:function(e,t){var n=4*t,o=n-e.sigBytes%n;e.concat(r.lib.WordArray.random(o-1)).concat(r.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),ie((function(e,t){var r;e.exports=((r=pn).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),ie((function(e,t){var r;e.exports=((r=pn).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),ie((function(e,t){var r;e.exports=((r=pn).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),ie((function(e,t){var r,n,o,a;e.exports=(n=(r=a=pn).lib.CipherParams,o=r.enc.Hex,r.format.Hex={stringify:function(e){return e.ciphertext.toString(o)},parse:function(e){var t=o.parse(e);return n.create({ciphertext:t})}},a.format.Hex)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.BlockCipher,n=e.algo,o=[],a=[],i=[],s=[],c=[],l=[],u=[],d=[],f=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var h=n^n<<1^n<<2^n<<3^n<<4;h=h>>>8^255&h^99,o[r]=h,a[h]=r;var m=e[r],g=e[m],v=e[g],y=257*e[h]^16843008*h;i[r]=y<<24|y>>>8,s[r]=y<<16|y>>>16,c[r]=y<<8|y>>>24,l[r]=y,y=16843009*v^65537*g^257*m^16843008*r,u[h]=y<<24|y>>>8,d[h]=y<<16|y>>>16,f[h]=y<<8|y>>>24,p[h]=y,r?(r=m^e[e[e[v^m]]],n^=e[e[n]]):r=n=1}}();var h=[0,1,2,4,8,16,32,64,128,27,54],m=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),a=this._keySchedule=[],i=0;i<n;i++)i<r?a[i]=t[i]:(l=a[i-1],i%r?r>6&&i%r==4&&(l=o[l>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l]):(l=o[(l=l<<8|l>>>24)>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l],l^=h[i/r|0]<<24),a[i]=a[i-r]^l);for(var s=this._invKeySchedule=[],c=0;c<n;c++){if(i=n-c,c%4)var l=a[i];else l=a[i-4];s[c]=c<4||i<=4?l:u[o[l>>>24]]^d[o[l>>>16&255]]^f[o[l>>>8&255]]^p[o[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,i,s,c,l,o)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,d,f,p,a),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,o,a,i,s){for(var c=this._nRounds,l=e[t]^r[0],u=e[t+1]^r[1],d=e[t+2]^r[2],f=e[t+3]^r[3],p=4,h=1;h<c;h++){var m=n[l>>>24]^o[u>>>16&255]^a[d>>>8&255]^i[255&f]^r[p++],g=n[u>>>24]^o[d>>>16&255]^a[f>>>8&255]^i[255&l]^r[p++],v=n[d>>>24]^o[f>>>16&255]^a[l>>>8&255]^i[255&u]^r[p++],y=n[f>>>24]^o[l>>>16&255]^a[u>>>8&255]^i[255&d]^r[p++];l=m,u=g,d=v,f=y}m=(s[l>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&f])^r[p++],g=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[f>>>8&255]<<8|s[255&l])^r[p++],v=(s[d>>>24]<<24|s[f>>>16&255]<<16|s[l>>>8&255]<<8|s[255&u])^r[p++],y=(s[f>>>24]<<24|s[l>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^r[p++],e[t]=m,e[t+1]=g,e[t+2]=v,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib,n=t.WordArray,o=t.BlockCipher,a=e.algo,i=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=a.DES=o.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=i[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var o=this._subKeys=[],a=0;a<16;a++){var l=o[a]=[],u=c[a];for(r=0;r<24;r++)l[r/6|0]|=t[(s[r]-1+u)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(s[r+24]-1+u)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var d=this._invSubKeys=[];for(r=0;r<16;r++)d[r]=o[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],f.call(this,4,252645135),f.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),f.call(this,1,1431655765);for(var n=0;n<16;n++){for(var o=r[n],a=this._lBlock,i=this._rBlock,s=0,c=0;c<8;c++)s|=l[c][((i^o[c])&u[c])>>>0];this._lBlock=i,this._rBlock=a^s}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,f.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function f(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function p(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}e.DES=o._createHelper(d);var h=a.TripleDES=o.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),o=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(t)),this._des2=d.createEncryptor(n.create(r)),this._des3=d.createEncryptor(n.create(o))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=o._createHelper(h)}(),r.TripleDES)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=n.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],o=0;o<256;o++)n[o]=o;o=0;for(var a=0;o<256;o++){var i=o%r,s=t[i>>>2]>>>24-i%4*8&255;a=(a+n[o]+s)%256;var c=n[o];n[o]=n[a],n[a]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=a.call(this)},keySize:8,ivSize:0});function a(){for(var e=this._S,t=this._i,r=this._j,n=0,o=0;o<4;o++){r=(r+e[t=(t+1)%256])%256;var a=e[t];e[t]=e[r],e[r]=a,n|=e[(e[t]+e[r])%256]<<24-8*o}return this._i=t,this._j=r,n}e.RC4=t._createHelper(o);var i=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)a.call(this)}});e.RC4Drop=t._createHelper(i)}(),r.RC4)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=[],a=[],i=[],s=n.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)o[r]^=n[r+4&7];if(t){var a=t.words,i=a[0],s=a[1],l=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=l>>>16|4294901760&u,f=u<<16|65535&l;for(o[0]^=l,o[1]^=d,o[2]^=u,o[3]^=f,o[4]^=l,o[5]^=d,o[6]^=u,o[7]^=f,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)a[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);i[r]=c^l}e[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,e[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,e[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,e[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,e[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,e[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,e[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,e[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}e.Rabbit=t._createHelper(s)}(),r.Rabbit)})),ie((function(e,t){var r;e.exports=(r=pn,function(){var e=r,t=e.lib.StreamCipher,n=e.algo,o=[],a=[],i=[],s=n.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)n[o]^=r[o+4&7];if(t){var a=t.words,i=a[0],s=a[1],l=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),d=l>>>16|4294901760&u,f=u<<16|65535&l;for(n[0]^=l,n[1]^=d,n[2]^=u,n[3]^=f,n[4]^=l,n[5]^=d,n[6]^=u,n[7]^=f,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)a[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<a[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<a[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<a[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<a[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<a[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<a[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<a[6]>>>0?1:0)|0,this._b=t[7]>>>0<a[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);i[r]=c^l}e[0]=i[0]+(i[7]<<16|i[7]>>>16)+(i[6]<<16|i[6]>>>16)|0,e[1]=i[1]+(i[0]<<8|i[0]>>>24)+i[7]|0,e[2]=i[2]+(i[1]<<16|i[1]>>>16)+(i[0]<<16|i[0]>>>16)|0,e[3]=i[3]+(i[2]<<8|i[2]>>>24)+i[1]|0,e[4]=i[4]+(i[3]<<16|i[3]>>>16)+(i[2]<<16|i[2]>>>16)|0,e[5]=i[5]+(i[4]<<8|i[4]>>>24)+i[3]|0,e[6]=i[6]+(i[5]<<16|i[5]>>>16)+(i[4]<<16|i[4]>>>16)|0,e[7]=i[7]+(i[6]<<8|i[6]>>>24)+i[5]|0}e.RabbitLegacy=t._createHelper(s)}(),r.RabbitLegacy)})),ie((function(e,t){e.exports=pn}))),mn=function(e){var t=e.blob;return new Promise((function(e){var r=new FileReader;r.onload=function(t){var r=t.target.result,n=hn.MD5(hn.lib.WordArray.create(r)).toString();e(n)},r.readAsArrayBuffer(t)}))},gn=Object.freeze({__proto__:null,MD5:mn}),vn=["tracking"],yn=on(),bn=t.createContext(),Cn={enable:!1,accessKey:"",secretKey:"",apiUrl:"",userId:""},wn=function(){var e=K(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f,p,h,m;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.tag,n=t.event,o=t.log,a=cn(new Date),i=o,e.t0=n,e.next="sdk_mode.read_id_card_one_side"===e.t0?6:"sdk_mode.liveness"===e.t0?19:36;break;case 6:return i=rn(o),s=o.result_object,e.next=10,mn({blob:s.image.blob});case 10:if(e.t1=e.sent,i.result_object.image={blob:e.t1},delete i.result_object.recordedVideos,!s.qrScannedResult){e.next=18;break}return e.next=16,mn({blob:s.qrScannedResult.image.blob});case 16:i.result_object.qrScannedResult.image.blob=e.sent,delete i.result_object.qrScannedResult.recordedVideos;case 18:return e.abrupt("break",36);case 19:return i=rn(o),c=o.result_object,l=c.steps,u=c.frontalFaces,d=c.frontalScaledImage,f=l.map((function(e){return mn({blob:e.image.blob})})),e.next=24,Promise.all(f);case 24:return p=e.sent,l.forEach((function(e,t){i.result_object.steps[t].image.blob=p[t]})),h=u.map((function(e){return mn({blob:e})})),e.next=29,Promise.all(h);case 29:if(m=e.sent,u.forEach((function(e,t){i.result_object.frontalFaces[t]=m[t]})),!d){e.next=35;break}return e.next=34,mn({blob:d});case 34:i.result_object.frontalScaledImage=e.sent;case 35:return e.abrupt("break",36);case 36:return e.abrupt("return",{tag:r,event:n,log:W({device_time:a},i)});case 37:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function kn(e){var t,r=e.userId;if(r)t=r;else{var n=dn("user-id");if(n)t=n;else{var o=tn();t=o,un(o,"user-id")}}return t}function Bn(e){var r=e.value,a=e.children,i=r.tracking,s=void 0===i?Cn:i,c=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(r,vn),l=s.enable,u=s.accessKey,d=s.secretKey,f=s.apiUrl,p=s.userId,h=n((function(){return l?f&&u&&d?new Gr(u,d,f):(console.error("apiUrl, accessKey and secretKey are required when tracking is enabled"),null):null}),[l,u,d,f]),m=n((function(){var e=kn({userId:p});return W(W({},yn),{},{"x-request-id":e})}),[p]),g=o(K(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]?s[0]:{},r=t.tag,n=t.event,o=t.log,a=void 0===o?{}:o,!l){e.next=11;break}return e.prev=2,e.next=5,wn({tag:r,event:n,log:a});case 5:i=e.sent,h.httpClient.post("/v1/log_events",i,m),e.next=11;break;case 9:e.prev=9,e.t0=e.catch(2);case 11:case"end":return e.stop()}}),e,null,[[2,9]])}))),[h,m,l]);return t.createElement(bn.Provider,{value:W(W({},c),{},{sendEvent:g})},a)}function En(){var e=a(bn);return n((function(){return void 0===e?(console.warn("useSDKTracking must be used within a SDKTrackingProvider"),{sendEvent:function(){}}):e}),[e])}Bn.propTypes={value:p.shape({tracking:p.shape({enable:p.bool,accessKey:p.string,secretKey:p.string,apiUrl:p.string,userId:p.string})}).isRequired,children:p.node.isRequired};var Sn=Object.freeze({__proto__:null,defaultTrackingConfig:Cn,getXRequestId:kn,SDKTrackingProvider:Bn,useSDKTracking:En});function An(e,t){return e&&!e.endsWith("/")?[e,"/",t].join(""):[e,t].join("")}function _n(){var e=Hr();return null==e?void 0:e.assetRoot}var In=Object.freeze({__proto__:null,getAsset:An,useAssetRoot:_n,useAsset:function(e){return An(_n(),e)}});function Tn(e){return new Promise((function(t){return setTimeout(t,e)}))}var Pn=Object.freeze({__proto__:null,sleep:Tn}),xn=Symbol("Comlink.proxy"),Rn=Symbol("Comlink.endpoint"),Nn=Symbol("Comlink.releaseProxy"),Ln=Symbol("Comlink.thrown"),On=function(e){return"object"==w(e)&&null!==e||"function"==typeof e},Dn=new Map([["proxy",{canHandle:function(e){return On(e)&&e[xn]},serialize:function(e){var t=new MessageChannel,r=t.port1,n=t.port2;return Mn(e,r),[n,[n]]},deserialize:function(e){return e.start(),Fn(e)}}],["throw",{canHandle:function(e){return On(e)&&Ln in e},serialize:function(e){var t=e.value;return[t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[]]},deserialize:function(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function Mn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:self;t.addEventListener("message",(function r(n){if(n&&n.data){var o,a=Object.assign({path:[]},n.data),i=a.id,s=a.type,c=a.path,l=(n.data.argumentList||[]).map(qn);try{var u=c.slice(0,-1).reduce((function(e,t){return e[t]}),e),d=c.reduce((function(e,t){return e[t]}),e);switch(s){case"GET":o=d;break;case"SET":u[c.slice(-1)[0]]=qn(n.data.value),o=!0;break;case"APPLY":o=d.apply(u,l);break;case"CONSTRUCT":o=function(e){return Object.assign(e,S({},xn,!0))}(x(d,O(l)));break;case"ENDPOINT":var f=new MessageChannel,p=f.port1,h=f.port2;Mn(e,h),o=function(e,t){return Kn.set(e,t),e}(p,[p]);break;case"RELEASE":o=void 0;break;default:return}}catch(e){o=S({value:e},Ln,0)}Promise.resolve(o).catch((function(e){return S({value:e},Ln,0)})).then((function(e){var n=L(Hn(e),2),o=n[0],a=n[1];t.postMessage(Object.assign(Object.assign({},o),{id:i}),a),"RELEASE"===s&&(t.removeEventListener("message",r),Un(t))}))}})),t.start&&t.start()}function Un(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function Fn(e,t){return Vn(e,[],t)}function jn(e){if(e)throw new Error("Proxy has been released and is not useable")}function Vn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=!1,o=new Proxy(r,{get:function(r,a){if(jn(n),a===Nn)return function(){return Qn(e,{type:"RELEASE",path:t.map((function(e){return e.toString()}))}).then((function(){Un(e),n=!0}))};if("then"===a){if(0===t.length)return{then:function(){return o}};var i=Qn(e,{type:"GET",path:t.map((function(e){return e.toString()}))}).then(qn);return i.then.bind(i)}return Vn(e,[].concat(O(t),[a]))},set:function(r,o,a){jn(n);var i=L(Hn(a),2),s=i[0],c=i[1];return Qn(e,{type:"SET",path:[].concat(O(t),[o]).map((function(e){return e.toString()})),value:s},c).then(qn)},apply:function(r,o,a){jn(n);var i=t[t.length-1];if(i===Rn)return Qn(e,{type:"ENDPOINT"}).then(qn);if("bind"===i)return Vn(e,t.slice(0,-1));var s=L(zn(a),2),c=s[0],l=s[1];return Qn(e,{type:"APPLY",path:t.map((function(e){return e.toString()})),argumentList:c},l).then(qn)},construct:function(r,o){jn(n);var a=L(zn(o),2),i=a[0],s=a[1];return Qn(e,{type:"CONSTRUCT",path:t.map((function(e){return e.toString()})),argumentList:i},s).then(qn)}});return o}function zn(e){var t,r=e.map(Hn);return[r.map((function(e){return e[0]})),(t=r.map((function(e){return e[1]})),Array.prototype.concat.apply([],t))]}var Kn=new WeakMap;function Hn(e){var t,r=U(Dn);try{for(r.s();!(t=r.n()).done;){var n=L(t.value,2),o=n[0],a=n[1];if(a.canHandle(e)){var i=L(a.serialize(e),2);return[{type:"HANDLER",name:o,value:i[0]},i[1]]}}}catch(e){r.e(e)}finally{r.f()}return[{type:"RAW",value:e},Kn.get(e)||[]]}function qn(e){switch(e.type){case"HANDLER":return Dn.get(e.name).deserialize(e.value);case"RAW":return e.value}}function Qn(e,t,r){return new Promise((function(n){var o=new Array(4).fill(0).map((function(){return Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)})).join("-");e.addEventListener("message",(function t(r){r.data&&r.data.id&&r.data.id===o&&(e.removeEventListener("message",t),n(r.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),r)}))}var Wn=function(){if(!window.Worker)return null;var e=new Blob(['const t=Symbol("Comlink.proxy"),e=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.thrown"),a=t=>"object"==typeof t&&null!==t||"function"==typeof t,o=new Map([["proxy",{canHandle:e=>a(e)&&e[t],serialize(t){const{port1:e,port2:r}=new MessageChannel;return i(t,e),[r,[r]]},deserialize(t){return t.start(),s(t,[],e);var e}}],["throw",{canHandle:t=>a(t)&&n in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function i(e,r=self){r.addEventListener("message",(function a(o){if(!o||!o.data)return;const{id:c,type:s,path:l}=Object.assign({path:[]},o.data),g=(o.data.argumentList||[]).map(m);let p;try{const r=l.slice(0,-1).reduce(((t,e)=>t[e]),e),n=l.reduce(((t,e)=>t[e]),e);switch(s){case"GET":p=n;break;case"SET":r[l.slice(-1)[0]]=m(o.data.value),p=!0;break;case"APPLY":p=n.apply(r,g);break;case"CONSTRUCT":p=function(e){return Object.assign(e,{[t]:!0})}(new n(...g));break;case"ENDPOINT":{const{port1:t,port2:r}=new MessageChannel;i(e,r),p=function(t,e){return f.set(t,e),t}(t,[t])}break;case"RELEASE":p=void 0;break;default:return}}catch(t){p={value:t,[n]:0}}Promise.resolve(p).catch((t=>({value:t,[n]:0}))).then((t=>{const[e,n]=h(t);r.postMessage(Object.assign(Object.assign({},e),{id:c}),n),"RELEASE"===s&&(r.removeEventListener("message",a),u(r))}))})),r.start&&r.start()}function u(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function c(t){if(t)throw new Error("Proxy has been released and is not useable")}function s(t,n=[],a=function(){}){let o=!1;const i=new Proxy(a,{get(e,a){if(c(o),a===r)return()=>g(t,{type:"RELEASE",path:n.map((t=>t.toString()))}).then((()=>{u(t),o=!0}));if("then"===a){if(0===n.length)return{then:()=>i};const e=g(t,{type:"GET",path:n.map((t=>t.toString()))}).then(m);return e.then.bind(e)}return s(t,[...n,a])},set(e,r,a){c(o);const[i,u]=h(a);return g(t,{type:"SET",path:[...n,r].map((t=>t.toString())),value:i},u).then(m)},apply(r,a,i){c(o);const u=n[n.length-1];if(u===e)return g(t,{type:"ENDPOINT"}).then(m);if("bind"===u)return s(t,n.slice(0,-1));const[f,h]=l(i);return g(t,{type:"APPLY",path:n.map((t=>t.toString())),argumentList:f},h).then(m)},construct(e,r){c(o);const[a,i]=l(r);return g(t,{type:"CONSTRUCT",path:n.map((t=>t.toString())),argumentList:a},i).then(m)}});return i}function l(t){const e=t.map(h);return[e.map((t=>t[0])),(r=e.map((t=>t[1])),Array.prototype.concat.apply([],r))];var r}const f=new WeakMap;function h(t){for(const[e,r]of o)if(r.canHandle(t)){const[n,a]=r.serialize(t);return[{type:"HANDLER",name:e,value:n},a]}return[{type:"RAW",value:t},f.get(t)||[]]}function m(t){switch(t.type){case"HANDLER":return o.get(t.name).deserialize(t.value);case"RAW":return t.value}}function g(t,e,r){return new Promise((n=>{const a=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.addEventListener("message",(function e(r){r.data&&r.data.id&&r.data.id===a&&(t.removeEventListener("message",e),n(r.data))})),t.start&&t.start(),t.postMessage(Object.assign({id:a},e),r)}))}var p=[[0,1,0],[1,-4,1],[0,1,0]];function d(t,e,r,n){return t[4*(r*e+n)]}function v(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){a=!0,o=t}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return b(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var E="frontal",S="left",w="right",M="up",k="down",_=0,A=1,R=2;function L(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=y(t,2),a=n[0],o=n[1],i=y(e,2),u=i[0],c=i[1],s=[a[0],o[0]],l=[a[1],o[1]];return s[0]+r<=u[0]&&c[0]<=s[1]-r&&l[0]+r<=u[1]&&c[1]<=l[1]-.8*r?R:s[0]<=u[0]||c[0]<=s[1]||l[0]<=u[1]||c[1]<=l[1]?A:_}var P={code:"no_face",msg:{en:"Face not found",vi:"Không tìm thấy khuôn mặt"}},O={code:"partial_face",msg:{en:"Face out of the box",vi:"Không tìm thấy toàn bộ khuôn mặt"}},j={code:"multiple_faces",msg:{en:"Too many faces",vi:"Quá nhiều khuôn mặt"}},T={code:"face_too_small",msg:{en:"Face too small",vi:"Khuôn mặt quá nhỏ"}},F={code:"face_too_large",msg:{en:"Face too large",vi:"Khuôn mặt quá to"}},x={code:"face_out_of_box",msg:{en:"Face is out of box",vi:"Khuôn mặt không nằm trọn vẹn trong khung ảnh"}};function C(t){return Math.pow(Math.pow(t[0],2)+Math.pow(t[1],2),.5)}function N(t,e){return[t[0]-e[0],t[1]-e[1]]}function z(t,e,r,n){var a=r*(4*e)+4*n;return{r:t[a],g:t[a+1],b:t[a+2]}}i({calculateBlurScoreFunc:function(t){for(var e=t.data,r=t.reducedWidth,n=t.reducedHeight,a=0;a<e.length;a+=4){var o=(e[a]+e[a+1]+e[a+2])/3;e[a]=o}for(var i=0,u=0,c=n-1,s=r-1,l=1;l<c;l++)for(var f=1;f<s;f++){var h=p[0][0]*d(e,r,f-1,l-1)+p[0][1]*d(e,r,f,l-1)+p[0][2]*d(e,r,f+1,l-1)+p[1][0]*d(e,r,f-1,l)+p[1][1]*d(e,r,f,l)+p[1][2]*d(e,r,f+1,l)+p[2][0]*d(e,r,f-1,l+1)+p[2][1]*d(e,r,f,l+1)+p[2][2]*d(e,r,f+1,l+1);(h=Math.abs(h))>25&&i++,h>15&&h<25&&u++}var m=0;return i+u!==0&&(m=i/(i+u)),m},calculateFaceDirectionFunc:function(t){var e=t.landmarks,r=t.getPerfectFrontal,n=function(t){var e,r,n,a,o,i,u,c=y(t,4),s=c[0],l=c[1],f=c[2],h=c[3],m=N(l,s),g=C(m),p=(a=l,e=[(n=s)[0]+a[0],n[1]+a[1]],r=2,[e[0]/r,e[1]/r]),d=N(f,p),v=C(N(h,f)),b=N(h,p),E=C(b),S=(d[0]*b[0]+d[1]*b[1])/E,w=v/E;if(g>.5*E)o=(d[0]*m[0]+d[1]*m[1])/g/g;else{var M=C(N(d,function(t,e){return[t[0]*e,t[1]*e]}(b,S/E)));u=b,o=((i=d)[0]*u[1]-u[0]*i[1]>=0?1:-1)*M/g}return{left_right_score:o,up_down_score:w}}(e),a=n.left_right_score,o=n.up_down_score,i=y(e,3),u=i[0],c=i[1],s=i[2],l=c[0]-s[0],f=u[0]-s[0],h=r?.1:.3,m=o>.7,g=o<.42,p=a>=.35&&a<=.6,d=a<=-.35&&a>=-.6;return o>=.42&&o<=.7&&a>-h&&a<h&&l*f<0?{gesture:E,leftRightScore:a}:m&&!d&&!p?{gesture:M,leftRightScore:a}:g&&!d&&!p?{gesture:k,leftRightScore:a}:p&&!m&&!g?{gesture:w,leftRightScore:a}:d&&!m&&!g?{gesture:S,leftRightScore:a}:null},validatePredictionsFunc:function(t){var e,r,n,a,o,i,u,c,s,l,f,h,m,g,p,d,b,E,S,w,M,k,C,N,z,H,I,D,K,G,W,U,q=t.predictions,Y=t.width,B=[[0,0],[Y,t.height]],Q=q.reduce((function(t,e){var r=e.topLeft,n=e.bottomRight,a=e.probability,o=e.landmarks;a<.9||o.length<6||function(t){var e=t.small,r=e.coords,n=e.area,a=t.big,o=a.coords,i=a.area,u=n;if(!u){var c=y(r,2),s=c[0],l=c[1];u=(l[0]-s[0])*(l[1]-s[1])}var f=i;if(!f){var h=y(o,2),m=h[0],g=h[1];f=(g[0]-m[0])*(g[1]-m[1])}return u/f}({small:{coords:[r,n]},big:{coords:B}})<=.025?t[_].push(e):t[L(B,[r,n])].push(e);return t}),(v(e={},A,[]),v(e,R,[]),v(e,_,[]),e)),X=Q[R].length,$=Q[A].length;if(0===X)r=$>0?O:P;else if(X+$>1)r=j;else{var J=n=Q[R][0],V=J.topLeft,Z=J.bottomRight,tt=(C=B,N=y([V,Z],2),z=N[0],H=N[1],I=y(C,2),D=I[0],K=I[1],G=H[0]-z[0],W=H[1]-z[1],U=K[0]-D[0],G/U<W/U?G/U:W/U);tt<.4&&(r=T),tt>.61&&(r=F),L(B,(a=n.landmarks,u=a[0],c=a[1],s=a[2],l=a[3],f=a[4],h=a[5],m=.5*(u[1]+c[1]),g=m+1.5*(m-l[1]),p=l[1]-1.2*(s[1]-l[1]),d=[u[0],c[0],s[0],l[0],f[0],h[0]],b=Math.min.apply(Math,d),E=Math.min(g,p),S=Math.max.apply(Math,d),w=Math.max(g,p),M=Math.abs(l[0]-f[0])/Math.abs(l[0]-h[0]),k=l[0]-f[0]<0&&h[0]-l[0]>.05*(S-b),l[0]-f[0]>0&&h[0]-l[0]<-.05*(S-b)?(o=.2,i=.1):k?(o=.1,i=.2):M>2||M<.5?(o=.15,i=.15):(o=.05,i=.05),[[b-o*(S-b),E],[S+i*(S-b),w]]),.05*Y)!==R&&(r=x)}return{error:r,fullFace:n}},detectGlare:function(t,e,r){return function(t,e,r){for(var n=0,a=r[1],o=r[3],i=r[0],u=r[2],c=a;c<o;c++)for(var s=i;s<u;s++){var l=z(t,e,c,s),f=l.r,h=l.g,m=l.b;f>=245&&m>=245&&h>245&&(n+=1)}return n}(t,e,function(t,e){var r=Math.floor(.025*t),n=t-r,a=Math.floor(.025*e);return[r,a,n,e-a]}(e,r))/(e*r)>=.001}});']),t=URL.createObjectURL(e);return Fn(new Worker(t))}(),Gn=[[0,1,0],[1,-4,1],[0,1,0]];function Xn(e,t,r,n){return e[4*(r*t+n)]}function Yn(e){for(var t=e.data,r=e.reducedWidth,n=e.reducedHeight,o=0;o<t.length;o+=4){var a=(t[o]+t[o+1]+t[o+2])/3;t[o]=a}for(var i=0,s=0,c=n-1,l=r-1,u=1;u<c;u++)for(var d=1;d<l;d++){var f=Gn[0][0]*Xn(t,r,d-1,u-1)+Gn[0][1]*Xn(t,r,d,u-1)+Gn[0][2]*Xn(t,r,d+1,u-1)+Gn[1][0]*Xn(t,r,d-1,u)+Gn[1][1]*Xn(t,r,d,u)+Gn[1][2]*Xn(t,r,d+1,u)+Gn[2][0]*Xn(t,r,d-1,u+1)+Gn[2][1]*Xn(t,r,d,u+1)+Gn[2][2]*Xn(t,r,d+1,u+1);(f=Math.abs(f))>25&&i++,f>15&&f<25&&s++}var p=0;return i+s!==0&&(p=i/(i+s)),p}function $n(e){var t=e.width,r=e.height,n=e.getContext("2d"),o=Math.floor(t/2.8),a=Math.floor(r/2.8),i=t-o,s=r-a;return{data:n.getImageData(Math.floor(o/2),Math.floor(a/2),i,s).data,reducedWidth:i,reducedHeight:s}}function Zn(){return(Zn=K(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=$n(t),Wn){e.next=3;break}return e.abrupt("return",Yn(r));case 3:return e.abrupt("return",Wn.calculateBlurScoreFunc(r));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Jn(e,t,r,n){return e[4*(n*t+r)]}var eo=Object.freeze({__proto__:null,calculateBlurScore:function(e){return Zn.apply(this,arguments)},hasBetterBlurScore:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.01;return null===t||e-t>r},hasBetterCardBlurScore:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.01;return null===t||t-e>r},calculateIdCardBlurScore:function(e){var t=e.canvas,r=document.createElement("canvas"),n=r.getContext("2d");r.width=430,r.height=270,n.drawImage(t,0,0,r.width,r.height);var o=Math.floor(129),a=Math.floor(13.5),i=Math.floor(408.5),s=Math.floor(256.5),c=document.createElement("canvas"),l=c.getContext("2d"),u=i-o,d=s-a;c.width=u,c.height=d,l.drawImage(r,o,a,u,d,0,0,u,d);for(var f=l.getImageData(0,0,u,d).data,p=0;p<f.length;p+=4){var h=Math.round(.299*f[p]+.587*f[p+1]+.114*f[p+2]);f[p]=h}for(var m=d-1,g=u-1,v=0,y=[],b=1;b<m;b++)for(var C=1;C<g;C++){var w=4*-Jn(f,u,C,b)+Jn(f,u,C,b-1)+Jn(f,u,C,b+1)+Jn(f,u,C-1,b)+Jn(f,u,C+1,b);v+=w,y.push(w)}v/=(u-2)*(d-2);for(var k=0,B=0;B<y.length;B++){var E=y[B]-v;k+=Math.pow(E,2)}var S=Math.sqrt(k/y.length);return 1/(1+Math.pow(2,S/2-10))}});function to(e){var t,r,n,o,a,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=s.x,u=s.y,d=s.width,f=s.height,p=e.videoWidth,h=e.videoHeight,m=window.innerWidth,g=window.innerHeight,v=m/g,y=p/h;v<y?(a=l*(n=p/m),i=(u-(t=(g-m/y)/2))*(o=h/(g-2*t))):(a=(l-(r=(m-g*y)/2))*(n=p/(m-2*r)),i=u*(o=h/g));var b=d*n,C=f*o,w=b,k=C,B=Math.max(b,C)*c;return{lostX:r,lostY:t,cropWidth:b=Math.floor(Math.min(p,b+2*B)),cropHeight:C=Math.floor(Math.min(h,C+2*B)),cropX:a=Math.floor(Math.max(0,a-B)),cropY:i=Math.floor(Math.max(0,i-B)),cropWidthWithoutPadding:w,cropHeightWithoutPadding:k}}var ro=Object.freeze({__proto__:null,analyzeVideoAndWindowSizes:to,takePicture:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.canvas,n=t.video,o=t.cropArea,a=t.quality,i=void 0===a?1:a;if(r)e=r;else{var s=to(n,o),c=s.cropWidth,l=s.cropHeight,u=s.cropX,d=s.cropY,f=(e=document.createElement("canvas")).getContext("2d");e.width=c,e.height=l,f.drawImage(n,u,d,c,l,0,0,c,l)}return new Promise((function(t){e.toBlob(t,"image/jpeg",i)}))}}),no=function(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=[e[r],e[t]];e[t]=n[0],e[r]=n[1]}return e},oo=Object.freeze({__proto__:null,shuffleArray:no}),ao={NONE:0,PARTIAL:1,FULL:2};function io(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=G(e,2),o=n[0],a=n[1],i=G(t,2),s=i[0],c=i[1],l=[o[0],a[0]],u=[o[1],a[1]];return l[0]+r<=s[0]&&c[0]<=l[1]-r&&u[0]+r<=s[1]&&c[1]<=u[1]-.8*r?ao.FULL:l[0]<=s[0]||c[0]<=l[1]||u[0]<=s[1]||c[1]<=u[1]?ao.PARTIAL:ao.NONE}function so(e){var t=e.small,r=t.coords,n=t.area,o=e.big,a=o.coords,i=o.area,s=n;if(!s){var c=G(r,2),l=c[0],u=c[1];s=(u[0]-l[0])*(u[1]-l[1])}var d=i;if(!d){var f=G(a,2),p=f[0],h=f[1];d=(h[0]-p[0])*(h[1]-p[1])}return s/d}function co(e,t){var r=G(e,2),n=r[0],o=r[1],a=G(t,2),i=a[0],s=a[1],c=o[0]-n[0],l=o[1]-n[1],u=s[0]-i[0];return c/u<l/u?c/u:l/u}var lo=Object.freeze({__proto__:null,ContainMode:ao,rectContains:io,rectAreaRatio:so,rectEdgeRatio:co,isFaceCenter:function(e,t){var r=G(e,2),n=r[0],o=r[1],a=G(t,2),i=a[0],s=a[1],c=o[0]-n[0],l=o[1]-n[1],u=s[0]-i[0],d=Math.abs(n[0]-(u-c)/2)/u<.2,f=Math.abs(n[1]-(u-l)/2)/u<.2;return!(!d||!f)}});function uo(e){return Math.pow(Math.pow(e[0],2)+Math.pow(e[1],2),.5)}function fo(e,t){return[e[0]-t[0],e[1]-t[1]]}function po(e){var t=e.landmarks,r=e.getPerfectFrontal,n=function(e){var t,r,n,o,a,i,s=G(e,4),c=s[0],l=s[1],u=s[2],d=s[3],f=fo(l,c),p=uo(f),h=(n=l,2,[(t=[(r=c)[0]+n[0],r[1]+n[1]])[0]/2,t[1]/2]),m=fo(u,h),g=uo(fo(d,u)),v=fo(d,h),y=uo(v),b=(m[0]*v[0]+m[1]*v[1])/y,C=g/y;if(p>.5*y)o=(m[0]*f[0]+m[1]*f[1])/p/p;else{var w=uo(fo(m,function(e,t){return[e[0]*t,e[1]*t]}(v,b/y)));i=v,o=((a=m)[0]*i[1]-i[0]*a[1]>=0?1:-1)*w/p}return{left_right_score:o,up_down_score:C}}(t),o=n.left_right_score,a=n.up_down_score,i=G(t,3),s=i[0],c=i[1],l=i[2],u=c[0]-l[0],d=s[0]-l[0],f=r?.1:.3,p=a>.7,h=a<.42,m=o>=.35&&o<=.6,g=o<=-.35&&o>=-.6;return a>=.42&&a<=.7&&o>-f&&o<f&&u*d<0?{gesture:j.FRONTAL,leftRightScore:o}:!p||g||m?!h||g||m?!m||p||h?!g||p||h?null:{gesture:j.LEFT,leftRightScore:o}:{gesture:j.RIGHT,leftRightScore:o}:{gesture:j.DOWN,leftRightScore:o}:{gesture:j.UP,leftRightScore:o}}function ho(e){var t,r,n,o,a,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k,B=e.predictions,E=e.width,S=[[0,0],[E,e.height]],A=B.reduce((function(e,t){var r=t.topLeft,n=t.bottomRight,o=t.probability,a=t.landmarks;return o<.9||a.length<6||so({small:{coords:[r,n]},big:{coords:S}})<=.025?e[ao.NONE].push(t):e[io(S,[r,n])].push(t),e}),(H(t={},ao.PARTIAL,[]),H(t,ao.FULL,[]),H(t,ao.NONE,[]),t)),_=A[ao.FULL].length,I=A[ao.PARTIAL].length;if(0===_)r=I>0?F.partial_face:F.no_face;else if(_+I>1)r=F.multiple_faces;else{var T=n=A[ao.FULL][0],P=co([T.topLeft,T.bottomRight],S);P<.4&&(r=F.face_too_small),P>.61&&(r=F.face_too_large),io(S,(s=(o=n.landmarks)[0],c=o[1],l=o[2],u=o[3],d=o[4],f=o[5],h=(p=.5*(s[1]+c[1]))+1.5*(p-u[1]),m=u[1]-1.2*(l[1]-u[1]),g=[s[0],c[0],l[0],u[0],d[0],f[0]],v=Math.min.apply(Math,g),y=Math.min(h,m),b=Math.max.apply(Math,g),C=Math.max(h,m),w=Math.abs(u[0]-d[0])/Math.abs(u[0]-f[0]),k=u[0]-d[0]<0&&f[0]-u[0]>.05*(b-v),u[0]-d[0]>0&&f[0]-u[0]<-.05*(b-v)?(a=.2,i=.1):k?(a=.1,i=.2):w>2||w<.5?(a=.15,i=.15):(a=.05,i=.05),[[v-a*(b-v),y],[b+i*(b-v),C]]),.05*E)!==ao.FULL&&(r=F.face_out_of_box)}return{error:r,fullFace:n}}function mo(e,t){var r=t.customInstructions,n=t.customIcon,o=t.customDirectionIcon,a=t.customStepTimeConstraints,i={};return null!=r&&r[e]&&(i.instructions=r[e]),null!=n&&n[e]&&(i.icon=n[e]),null!=o&&o[e]&&(i.directionIcon=o[e]),null!=a&&a[e]&&(i.stepTimeConstraints=a[e]),i}function go(){return(go=K(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wn){e.next=2;break}return e.abrupt("return",ho(t));case 2:return e.abrupt("return",Wn.validatePredictionsFunc(t));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vo(){return(vo=K(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wn){e.next=2;break}return e.abrupt("return",po(t));case 2:return e.abrupt("return",Wn.calculateFaceDirectionFunc(t));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var yo=Object.freeze({__proto__:null,initFaceVerificationData:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.assetRoot,r=void 0===t?"/":t,n=e.customInstructions,o=e.customIcon,a=e.customDirectionIcon,i=e.customStepTimeConstraints;return{curStepIndex:0,steps:[].concat(X(no([W({name:j.LEFT,instructions:{en:"Turn your face to the left",vi:"Quay mặt chậm qua trái"},image:{blob:null,imageId:null,objUrl:null,blurScore:null,leftRightScore:null},frontalFaceImage:{blob:null,imageId:null,blurScore:null,leftRightScore:null},icon:An(r,"ic_face_left.svg"),directionIcon:An(r,"arrow_left.svg"),directionIconAnimation:"slide-horizontal",firstFrameSpottedAt:null,stepTimeConstraints:{delayTime:null}},mo(j.LEFT,{customInstructions:n,customIcon:o,customDirectionIcon:a,customStepTimeConstraints:i})),W({name:j.RIGHT,instructions:{en:"Turn your face to the right",vi:"Quay mặt chậm qua phải"},image:{blob:null,imageId:null,objUrl:null,blurScore:null,leftRightScore:null},frontalFaceImage:{blob:null,imageId:null,blurScore:null,leftRightScore:null},icon:An(r,"ic_face_right.svg"),directionIcon:An(r,"arrow_right.svg"),directionIconAnimation:"slide-horizontal",firstFrameSpottedAt:null,stepTimeConstraints:{delayTime:null}},mo(j.RIGHT,{customInstructions:n,customIcon:o,customDirectionIcon:a,customStepTimeConstraints:i})),W({name:j.UP,instructions:{en:"Turn your face up",vi:"Ngước mặt chậm lên trên"},image:{blob:null,imageId:null,objUrl:null,blurScore:null,leftRightScore:null},frontalFaceImage:{blob:null,imageId:null,blurScore:null,leftRightScore:null},icon:An(r,"ic_face_up.svg"),directionIcon:An(r,"arrow_up.svg"),directionIconAnimation:"slide-vertical",firstFrameSpottedAt:null,stepTimeConstraints:{delayTime:null}},mo(j.UP,{customInstructions:n,customIcon:o,customDirectionIcon:a,customStepTimeConstraints:i}))])),[W({name:j.FRONTAL,instructions:{en:"Look straight into the camera",vi:"Nhìn thẳng camera"},image:{blob:null,imageId:null,objUrl:null,blurScore:null,leftRightScore:null},frontalFaceImage:{blob:null,imageId:null,blurScore:null,leftRightScore:null},icon:An(r,"ic_face_frontal.svg"),directionIcon:An(r,"frontal.svg"),directionIconAnimation:"blink",firstFrameSpottedAt:null,stepTimeConstraints:{delayTime:null}},mo(j.FRONTAL,{customInstructions:n,customIcon:o,customDirectionIcon:a,customStepTimeConstraints:i}))])}},validatePredictions:function(e){return go.apply(this,arguments)},calculateFaceDirection:function(e){return vo.apply(this,arguments)},faceTracker:function(){var e=[],t=[],r=[],n=[],o=[],a=0,i=0;function s(){i=a,r=X(e),n=X(t)}return function(c,l){var u=c.topLeft,d=c.bottomRight,f=c.landmarks,p=[],h=G(u,2);p[0]=h[0],p[1]=h[1];var m=G(d,2);p[2]=m[0],p[3]=m[1];var g=[],v=[];f.forEach((function(e,t){var r=G(e,2);g[t]=r[0],v[t]=r[1]})),a=Date.now();var y=p[2]-p[0];if(e=[].concat(g),t=[].concat(v),!r.length&&!n.length||l)return s(),{score:0,time:a};for(var b=0;b<6;b++)o[b]=Math.sqrt((e[b]-r[b])*(e[b]-r[b])+(t[b]-n[b])*(t[b]-n[b]));for(var C=0;C<6;C++)o[C]/=(a-i)*y;for(var w=0,k=0;k<6;k++)w+=o[k];return w/=6,s(),{score:w,time:a}}}}),bo=document.createElement("canvas"),Co=bo.getContext("2d");bo.width=128,bo.height=128;var wo=function(){var e=K(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.model,n=t.sCanvas,Co.drawImage(n,0,0,bo.width,bo.height),e.abrupt("return",r.estimateFaces(bo,!1,!1,!0));case 3:case"end":return e.stop()}var n}),e)})));return function(t){return e.apply(this,arguments)}}(),ko=Object.freeze({__proto__:null,SIZE:128,getModelPredictions:wo}),Bo=Object.getOwnPropertySymbols,Eo=Object.prototype.hasOwnProperty,So=Object.prototype.propertyIsEnumerable;function Ao(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var _o,Io=function(){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}}()?Object.assign:function(e,t){for(var r,n,o=Ao(e),a=1;a<arguments.length;a++){for(var i in r=Object(arguments[a]))Eo.call(r,i)&&(o[i]=r[i]);if(Bo){n=Bo(r);for(var s=0;s<n.length;s++)So.call(r,n[s])&&(o[n[s]]=r[n[s]])}}return o},To=arguments[3],Po=arguments[4],xo=arguments[5],Ro=JSON.stringify,No=function(e,t){for(var r,n=Object.keys(xo),o=0,a=n.length;o<a;o++){var i=n[o],s=xo[i].exports;if(s===e||s&&s.default===e){r=i;break}}if(!r){r=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var c={};for(o=0,a=n.length;o<a;o++)c[i=n[o]]=i;Po[r]=["function(require,module,exports){"+e+"(self); }",c]}var l=Math.floor(Math.pow(16,8)*Math.random()).toString(16),u={};u[r]=r,Po[l]=["function(require,module,exports){var f = require("+Ro(r)+");(f.default ? f.default : f)(self);}",u];var d={};!function e(t){for(var r in d[t]=!0,Po[t][1]){var n=Po[t][1][r];d[n]||e(n)}}(l);var f="("+To+")({"+Object.keys(d).map((function(e){return Ro(e)+":["+Po[e][0]+","+Ro(Po[e][1])+"]"})).join(",")+"},{},["+Ro(l)+"])",p=window.URL||window.webkitURL||window.mozURL||window.msURL,h=new Blob([f],{type:"text/javascript"});if(t&&t.bare)return h;var m=p.createObjectURL(h),g=new Worker(m);return g.objectURL=m,g},Lo=ie((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),Oo={js:!0,wasm:!0};function Do(e){if(!(this instanceof Do))return new Do(e);var t=Io({},Oo,e||{});if(this.options=t,this.__cache={},this.__init_promise=null,this.__modules=t.modules||{},this.__memory=null,this.__wasm={},this.__isLE=1===new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0],!this.options.js&&!this.options.wasm)throw new Error('mathlib: at least "js" or "wasm" should be enabled')}Do.prototype.has_wasm=function(){if(void 0!==_o)return _o;if(_o=!1,"undefined"==typeof WebAssembly)return _o;try{var e=new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,3,2,1,0,5,3,1,0,1,7,8,1,4,116,101,115,116,0,0,10,16,1,14,0,32,0,65,1,54,2,0,32,0,40,2,0,11]),t=new WebAssembly.Module(e);return 0!==new WebAssembly.Instance(t,{}).exports.test(4)&&(_o=!0),_o}catch(e){}return _o},Do.prototype.use=function(e){return this.__modules[e.name]=e,this.options.wasm&&this.has_wasm()&&e.wasm_fn?this[e.name]=e.wasm_fn:this[e.name]=e.fn,this},Do.prototype.init=function(){if(this.__init_promise)return this.__init_promise;if(!this.options.js&&this.options.wasm&&!this.has_wasm())return Promise.reject(new Error('mathlib: only "wasm" was enabled, but it\'s not supported'));var e=this;return this.__init_promise=Promise.all(Object.keys(e.__modules).map((function(t){var r=e.__modules[t];return e.options.wasm&&e.has_wasm()&&r.wasm_fn?e.__wasm[t]?null:WebAssembly.compile(e.__base64decode(r.wasm_src)).then((function(r){e.__wasm[t]=r})):null}))).then((function(){return e})),this.__init_promise},Do.prototype.__base64decode=function(e){for(var t=e.replace(/[\r\n=]/g,""),r=t.length,n=new Uint8Array(3*r>>2),o=0,a=0,i=0;i<r;i++)i%4==0&&i&&(n[a++]=o>>16&255,n[a++]=o>>8&255,n[a++]=255&o),o=o<<6|"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(t.charAt(i));var s=r%4*6;return 0===s?(n[a++]=o>>16&255,n[a++]=o>>8&255,n[a++]=255&o):18===s?(n[a++]=o>>10&255,n[a++]=o>>2&255):12===s&&(n[a++]=o>>4&255),n},Do.prototype.__reallocate=function(e){if(!this.__memory)return this.__memory=new WebAssembly.Memory({initial:Math.ceil(e/65536)}),this.__memory;var t=this.__memory.buffer.byteLength;return t<e&&this.__memory.grow(Math.ceil((e-t)/65536)),this.__memory},Do.prototype.__instance=function(e,t,r){if(t&&this.__reallocate(t),!this.__wasm[e]){var n=this.__modules[e];this.__wasm[e]=new WebAssembly.Module(this.__base64decode(n.wasm_src))}if(!this.__cache[e]){var o={memoryBase:0,memory:this.__memory,tableBase:0,table:new WebAssembly.Table({initial:0,element:"anyfunc"})};this.__cache[e]=new WebAssembly.Instance(this.__wasm[e],{env:Io(o,r||{})})}return this.__cache[e]},Do.prototype.__align=function(e,t){var r=e%(t=t||8);return e+(r?t-r:0)};var Mo,Uo,Fo,jo,Vo,zo,Ko=Do;function Ho(e,t,r,n,o,a){var i,s,c,l,u,d,f,p,h,m,g,v,y,b;for(h=0;h<a;h++){for(f=h,p=0,l=u=(i=e[d=h*o])*n[6],g=n[0],v=n[1],y=n[4],b=n[5],m=0;m<o;m++)c=(s=e[d])*g+i*v+l*y+u*b,u=l,l=c,i=s,r[p]=l,p++,d++;for(p--,f+=a*(o-1),l=u=(i=e[--d])*n[7],s=i,g=n[2],v=n[3],m=o-1;m>=0;m--)c=s*g+i*v+l*y+u*b,u=l,l=c,i=s,s=e[d],t[f]=r[p]+l,d--,p--,f-=a}}var qo={name:"unsharp_mask",fn:function(e,t,r,n,o,a){var i,s,c,l,u,d,f,p,h,m,g,v,y;if(!(0===n||o<.5)){o>2&&(o=2);var b=function(e,t,r){for(var n,o,a,i,s,c=t*r,l=new Uint16Array(c),u=0;u<c;u++)n=e[4*u],o=e[4*u+1],a=e[4*u+2],s=n>=o&&n>=a?n:o>=a&&o>=n?o:a,i=n<=o&&n<=a?n:o<=a&&o<=n?o:a,l[u]=257*(s+i)>>1;return l}(e,t,r),C=new Uint16Array(b);!function(e,t,r,n){if(n){var o=new Uint16Array(e.length),a=new Float32Array(Math.max(t,r)),i=function(e){e<.5&&(e=.5);var t=Math.exp(.527076)/e,r=Math.exp(-t),n=Math.exp(-2*t),o=(1-r)*(1-r)/(1+2*t*r-n);return Mo=o,Uo=o*(t-1)*r,Fo=o*(t+1)*r,jo=-o*n,Vo=2*r,zo=-n,new Float32Array([Mo,Uo,Fo,jo,Vo,zo,(Mo+Uo)/(1-Vo-zo),(Fo+jo)/(1-Vo-zo)])}(n);Ho(e,o,a,i,t,r),Ho(o,e,a,i,r,t)}}(C,t,r,o);for(var w=n/100*4096+.5|0,k=257*a|0,B=t*r,E=0;E<B;E++)v=2*(b[E]-C[E]),Math.abs(v)>=k&&(i=e[y=4*E],s=e[y+1],c=e[y+2],d=257*((p=i>=s&&i>=c?i:s>=i&&s>=c?s:c)+(f=i<=s&&i<=c?i:s<=i&&s<=c?s:c))>>1,f===p?l=u=0:(u=d<=32767?4095*(p-f)/(p+f)|0:4095*(p-f)/(510-p-f)|0,l=i===p?65535*(s-c)/(6*(p-f))|0:s===p?21845+(65535*(c-i)/(6*(p-f))|0):43690+(65535*(i-s)/(6*(p-f))|0)),(d+=w*v+2048>>12)>65535?d=65535:d<0&&(d=0),0===u?i=s=c=d>>8:(h=2*d-(m=d<=32767?d*(4096+u)+2048>>12:d+((65535-d)*u+2048>>12))>>8,m>>=8,i=(g=l+21845&65535)>=43690?h:g>=32767?h+(6*(m-h)*(43690-g)+32768>>16):g>=10922?m:h+(6*(m-h)*g+32768>>16),s=(g=65535&l)>=43690?h:g>=32767?h+(6*(m-h)*(43690-g)+32768>>16):g>=10922?m:h+(6*(m-h)*g+32768>>16),c=(g=l-21845&65535)>=43690?h:g>=32767?h+(6*(m-h)*(43690-g)+32768>>16):g>=10922?m:h+(6*(m-h)*g+32768>>16)),e[y]=i,e[y+1]=s,e[y+2]=c)}},wasm_fn:function(e,t,r,n,o,a){if(!(0===n||o<.5)){o>2&&(o=2);var i=t*r,s=4*i,c=2*i,l=2*i,u=4*Math.max(t,r),d=s,f=d+c,p=f+l,h=p+l,m=h+u,g=this.__instance("unsharp_mask",s+c+2*l+u+32,{exp:Math.exp}),v=new Uint32Array(e.buffer);new Uint32Array(this.__memory.buffer).set(v);var y=g.exports.hsl_l16||g.exports._hsl_l16;y(0,d,t,r),(y=g.exports.blurMono16||g.exports._blurMono16)(d,f,p,h,m,t,r,o),(y=g.exports.unsharp||g.exports._unsharp)(0,0,d,f,t,r,n,a),v.set(new Uint32Array(this.__memory.buffer,0,i))}},wasm_src:"AGFzbQEAAAABMQZgAXwBfGACfX8AYAZ/f39/f38AYAh/f39/f39/fQBgBH9/f38AYAh/f39/f39/fwACGQIDZW52A2V4cAAAA2VudgZtZW1vcnkCAAEDBgUBAgMEBQQEAXAAAAdMBRZfX2J1aWxkX2dhdXNzaWFuX2NvZWZzAAEOX19nYXVzczE2X2xpbmUAAgpibHVyTW9ubzE2AAMHaHNsX2wxNgAEB3Vuc2hhcnAABQkBAAqJEAXZAQEGfAJAIAFE24a6Q4Ia+z8gALujIgOaEAAiBCAEoCIGtjgCECABIANEAAAAAAAAAMCiEAAiBbaMOAIUIAFEAAAAAAAA8D8gBKEiAiACoiAEIAMgA6CiRAAAAAAAAPA/oCAFoaMiArY4AgAgASAEIANEAAAAAAAA8L+gIAKioiIHtjgCBCABIAQgA0QAAAAAAADwP6AgAqKiIgO2OAIIIAEgBSACoiIEtow4AgwgASACIAegIAVEAAAAAAAA8D8gBqGgIgKjtjgCGCABIAMgBKEgAqO2OAIcCwu3AwMDfwR9CHwCQCADKgIUIQkgAyoCECEKIAMqAgwhCyADKgIIIQwCQCAEQX9qIgdBAEgiCA0AIAIgAC8BALgiDSADKgIYu6IiDiAJuyIQoiAOIAq7IhGiIA0gAyoCBLsiEqIgAyoCALsiEyANoqCgoCIPtjgCACACQQRqIQIgAEECaiEAIAdFDQAgBCEGA0AgAiAOIBCiIA8iDiARoiANIBKiIBMgAC8BALgiDaKgoKAiD7Y4AgAgAkEEaiECIABBAmohACAGQX9qIgZBAUoNAAsLAkAgCA0AIAEgByAFbEEBdGogAEF+ai8BACIIuCINIAu7IhGiIA0gDLsiEqKgIA0gAyoCHLuiIg4gCrsiE6KgIA4gCbsiFKKgIg8gAkF8aioCALugqzsBACAHRQ0AIAJBeGohAiAAQXxqIQBBACAFQQF0ayEHIAEgBSAEQQF0QXxqbGohBgNAIAghAyAALwEAIQggBiANIBGiIAO4Ig0gEqKgIA8iECAToqAgDiAUoqAiDyACKgIAu6CrOwEAIAYgB2ohBiAAQX5qIQAgAkF8aiECIBAhDiAEQX9qIgRBAUoNAAsLCwvfAgIDfwZ8AkAgB0MAAAAAWw0AIARE24a6Q4Ia+z8gB0MAAAA/l7ujIgyaEAAiDSANoCIPtjgCECAEIAxEAAAAAAAAAMCiEAAiDraMOAIUIAREAAAAAAAA8D8gDaEiCyALoiANIAwgDKCiRAAAAAAAAPA/oCAOoaMiC7Y4AgAgBCANIAxEAAAAAAAA8L+gIAuioiIQtjgCBCAEIA0gDEQAAAAAAADwP6AgC6KiIgy2OAIIIAQgDiALoiINtow4AgwgBCALIBCgIA5EAAAAAAAA8D8gD6GgIgujtjgCGCAEIAwgDaEgC6O2OAIcIAYEQCAFQQF0IQogBiEJIAIhCANAIAAgCCADIAQgBSAGEAIgACAKaiEAIAhBAmohCCAJQX9qIgkNAAsLIAVFDQAgBkEBdCEIIAUhAANAIAIgASADIAQgBiAFEAIgAiAIaiECIAFBAmohASAAQX9qIgANAAsLC7wBAQV/IAMgAmwiAwRAQQAgA2shBgNAIAAoAgAiBEEIdiIHQf8BcSECAn8gBEH/AXEiAyAEQRB2IgRB/wFxIgVPBEAgAyIIIAMgAk8NARoLIAQgBCAHIAIgA0kbIAIgBUkbQf8BcQshCAJAIAMgAk0EQCADIAVNDQELIAQgByAEIAMgAk8bIAIgBUsbQf8BcSEDCyAAQQRqIQAgASADIAhqQYECbEEBdjsBACABQQJqIQEgBkEBaiIGDQALCwvTBgEKfwJAIAazQwAAgEWUQwAAyEKVu0QAAAAAAADgP6CqIQ0gBSAEbCILBEAgB0GBAmwhDgNAQQAgAi8BACADLwEAayIGQQF0IgdrIAcgBkEASBsgDk8EQCAAQQJqLQAAIQUCfyAALQAAIgYgAEEBai0AACIESSIJRQRAIAYiCCAGIAVPDQEaCyAFIAUgBCAEIAVJGyAGIARLGwshCAJ/IAYgBE0EQCAGIgogBiAFTQ0BGgsgBSAFIAQgBCAFSxsgCRsLIgogCGoiD0GBAmwiEEEBdiERQQAhDAJ/QQAiCSAIIApGDQAaIAggCmsiCUH/H2wgD0H+AyAIayAKayAQQYCABEkbbSEMIAYgCEYEQCAEIAVrQf//A2wgCUEGbG0MAQsgBSAGayAGIARrIAQgCEYiBhtB//8DbCAJQQZsbUHVqgFBqtUCIAYbagshCSARIAcgDWxBgBBqQQx1aiIGQQAgBkEAShsiBkH//wMgBkH//wNIGyEGAkACfwJAIAxB//8DcSIFBEAgBkH//wFKDQEgBUGAIGogBmxBgBBqQQx2DAILIAZBCHYiBiEFIAYhBAwCCyAFIAZB//8Dc2xBgBBqQQx2IAZqCyIFQQh2IQcgBkEBdCAFa0EIdiIGIQQCQCAJQdWqAWpB//8DcSIFQanVAksNACAFQf//AU8EQEGq1QIgBWsgByAGa2xBBmxBgIACakEQdiAGaiEEDAELIAchBCAFQanVAEsNACAFIAcgBmtsQQZsQYCAAmpBEHYgBmohBAsCfyAGIgUgCUH//wNxIghBqdUCSw0AGkGq1QIgCGsgByAGa2xBBmxBgIACakEQdiAGaiAIQf//AU8NABogByIFIAhBqdUASw0AGiAIIAcgBmtsQQZsQYCAAmpBEHYgBmoLIQUgCUGr1QJqQf//A3EiCEGp1QJLDQAgCEH//wFPBEBBqtUCIAhrIAcgBmtsQQZsQYCAAmpBEHYgBmohBgwBCyAIQanVAEsEQCAHIQYMAQsgCCAHIAZrbEEGbEGAgAJqQRB2IAZqIQYLIAEgBDoAACABQQFqIAU6AAAgAUECaiAGOgAACyADQQJqIQMgAkECaiECIABBBGohACABQQRqIQEgC0F/aiILDQALCwsL"},Qo=[{win:.5,filter:function(e){return e>=-.5&&e<.5?1:0}},{win:1,filter:function(e){if(e<=-1||e>=1)return 0;if(e>-1.1920929e-7&&e<1.1920929e-7)return 1;var t=e*Math.PI;return Math.sin(t)/t*(.54+.46*Math.cos(t/1))}},{win:2,filter:function(e){if(e<=-2||e>=2)return 0;if(e>-1.1920929e-7&&e<1.1920929e-7)return 1;var t=e*Math.PI;return Math.sin(t)/t*Math.sin(t/2)/(t/2)}},{win:3,filter:function(e){if(e<=-3||e>=3)return 0;if(e>-1.1920929e-7&&e<1.1920929e-7)return 1;var t=e*Math.PI;return Math.sin(t)/t*Math.sin(t/3)/(t/3)}}];function Wo(e){return Math.round(16383*e)}var Go=function(e,t,r,n,o){var a,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k=Qo[e].filter,B=1/n,E=Math.min(1,n),S=Qo[e].win/E,A=Math.floor(2*(S+1)),_=new Int16Array((A+2)*r),I=0,T=!_.subarray||!_.set;for(a=0;a<r;a++){for(i=(a+.5)*B+o,s=Math.max(0,Math.floor(i-S)),l=(c=Math.min(t-1,Math.ceil(i+S)))-s+1,u=new Float32Array(l),d=new Int16Array(l),f=0,p=s,h=0;p<=c;p++,h++)f+=m=k((p+.5-i)*E),u[h]=m;for(g=0,h=0;h<u.length;h++)g+=v=u[h]/f,d[h]=Wo(v);for(d[r>>1]+=Wo(1-g),y=0;y<d.length&&0===d[y];)y++;if(y<d.length){for(b=d.length-1;b>0&&0===d[b];)b--;if(C=s+y,w=b-y+1,_[I++]=C,_[I++]=w,T)for(h=y;h<=b;h++)_[I++]=d[h];else _.set(d.subarray(y,b+1),I),I+=w}else _[I++]=0,_[I++]=0}return _};function Xo(e){return e<0?0:e>255?255:e}var Yo=!0;try{Yo=1===new Uint32Array(new Uint8Array([1,0,0,0]).buffer)[0]}catch(e){}function $o(e,t,r){if(Yo)t.set(function(e){return new Uint8Array(e.buffer,0,e.byteLength)}(e),r);else for(var n=r,o=0;o<e.length;o++){var a=e[o];t[n++]=255&a,t[n++]=a>>8&255}}var Zo={name:"resize",fn:function(e){var t=e.src,r=e.width,n=e.height,o=e.toWidth,a=e.toHeight,i=e.scaleX||e.toWidth/e.width,s=e.scaleY||e.toHeight/e.height,c=e.offsetX||0,l=e.offsetY||0,u=e.dest||new Uint8Array(o*a*4),d=void 0===e.quality?3:e.quality,f=e.alpha||!1,p=Go(d,r,o,i,c),h=Go(d,n,a,s,l),m=new Uint8Array(o*n*4);return function(e,t,r,n,o,a){var i,s,c,l,u,d,f,p,h,m,g,v=0,y=0;for(h=0;h<n;h++){for(u=0,m=0;m<o;m++){for(d=a[u++],f=a[u++],p=v+4*d|0,i=s=c=l=0;f>0;f--)l=l+(g=a[u++])*e[p+3]|0,c=c+g*e[p+2]|0,s=s+g*e[p+1]|0,i=i+g*e[p]|0,p=p+4|0;t[y+3]=Xo(l+8192>>14),t[y+2]=Xo(c+8192>>14),t[y+1]=Xo(s+8192>>14),t[y]=Xo(i+8192>>14),y=y+4*n|0}y=4*(h+1)|0,v=(h+1)*r*4|0}}(t,m,r,n,o,p),function(e,t,r,n,o,a){var i,s,c,l,u,d,f,p,h,m,g,v=0,y=0;for(h=0;h<n;h++){for(u=0,m=0;m<o;m++){for(d=a[u++],f=a[u++],p=v+4*d|0,i=s=c=l=0;f>0;f--)l=l+(g=a[u++])*e[p+3]|0,c=c+g*e[p+2]|0,s=s+g*e[p+1]|0,i=i+g*e[p]|0,p=p+4|0;t[y+3]=Xo(l+8192>>14),t[y+2]=Xo(c+8192>>14),t[y+1]=Xo(s+8192>>14),t[y]=Xo(i+8192>>14),y=y+4*n|0}y=4*(h+1)|0,v=(h+1)*r*4|0}}(m,u,n,o,a,h),f||function(e,t,r){for(var n=3,o=t*r*4|0;n<o;)e[n]=255,n=n+4|0}(u,o,a),u},wasm_fn:function(e){var t=e.src,r=e.width,n=e.height,o=e.toWidth,a=e.toHeight,i=e.scaleX||e.toWidth/e.width,s=e.scaleY||e.toHeight/e.height,c=e.offsetX||0,l=e.offsetY||0,u=e.dest||new Uint8Array(o*a*4),d=void 0===e.quality?3:e.quality,f=e.alpha||!1,p=Go(d,r,o,i,c),h=Go(d,n,a,s,l),m=this.__align(0+Math.max(t.byteLength,u.byteLength)),g=this.__align(m+n*o*4),v=this.__align(g+p.byteLength),y=v+h.byteLength,b=this.__instance("resize",y),C=new Uint8Array(this.__memory.buffer),w=new Uint32Array(this.__memory.buffer),k=new Uint32Array(t.buffer);return w.set(k),$o(p,C,g),$o(h,C,v),(b.exports.convolveHV||b.exports._convolveHV)(g,v,m,r,n,o,a),new Uint32Array(u.buffer).set(new Uint32Array(this.__memory.buffer,0,a*o)),f||function(e,t,r){for(var n=3,o=t*r*4|0;n<o;)e[n]=255,n=n+4|0}(u,o,a),u},wasm_src:"AGFzbQEAAAABFAJgBn9/f39/fwBgB39/f39/f38AAg8BA2VudgZtZW1vcnkCAAEDAwIAAQQEAXAAAAcZAghjb252b2x2ZQAACmNvbnZvbHZlSFYAAQkBAArmAwLBAwEQfwJAIANFDQAgBEUNACAFQQRqIRVBACEMQQAhDQNAIA0hDkEAIRFBACEHA0AgB0ECaiESAn8gBSAHQQF0IgdqIgZBAmouAQAiEwRAQQAhCEEAIBNrIRQgFSAHaiEPIAAgDCAGLgEAakECdGohEEEAIQlBACEKQQAhCwNAIBAoAgAiB0EYdiAPLgEAIgZsIAtqIQsgB0H/AXEgBmwgCGohCCAHQRB2Qf8BcSAGbCAKaiEKIAdBCHZB/wFxIAZsIAlqIQkgD0ECaiEPIBBBBGohECAUQQFqIhQNAAsgEiATagwBC0EAIQtBACEKQQAhCUEAIQggEgshByABIA5BAnRqIApBgMAAakEOdSIGQf8BIAZB/wFIG0EQdEGAgPwHcUEAIAZBAEobIAtBgMAAakEOdSIGQf8BIAZB/wFIG0EYdEEAIAZBAEobciAJQYDAAGpBDnUiBkH/ASAGQf8BSBtBCHRBgP4DcUEAIAZBAEobciAIQYDAAGpBDnUiBkH/ASAGQf8BSBtB/wFxQQAgBkEAShtyNgIAIA4gA2ohDiARQQFqIhEgBEcNAAsgDCACaiEMIA1BAWoiDSADRw0ACwsLIQACQEEAIAIgAyAEIAUgABAAIAJBACAEIAUgBiABEAALCw=="};function Jo(e){var t=e||[],r={js:t.indexOf("js")>=0,wasm:t.indexOf("wasm")>=0};Ko.call(this,r),this.features={js:r.js,wasm:r.wasm&&this.has_wasm()},this.use(qo),this.use(Zo)}Lo(Jo,Ko),Jo.prototype.resizeAndUnsharp=function(e,t){var r=this.resize(e,t);return e.unsharpAmount&&this.unsharp_mask(r,e.toWidth,e.toHeight,e.unsharpAmount,e.unsharpRadius,e.unsharpThreshold),r};var ea=Jo;function ta(e,t){this.create=e,this.available=[],this.acquired={},this.lastId=1,this.timeoutId=0,this.idle=t||2e3}ta.prototype.acquire=function(){var e,t=this;return 0!==this.available.length?e=this.available.pop():((e=this.create()).id=this.lastId++,e.release=function(){return t.release(e)}),this.acquired[e.id]=e,e},ta.prototype.release=function(e){var t=this;delete this.acquired[e.id],e.lastUsed=Date.now(),this.available.push(e),0===this.timeoutId&&(this.timeoutId=setTimeout((function(){return t.gc()}),100))},ta.prototype.gc=function(){var e=this,t=Date.now();this.available=this.available.filter((function(r){return!(t-r.lastUsed>e.idle&&(r.destroy(),1))})),0!==this.available.length?this.timeoutId=setTimeout((function(){return e.gc()}),100):this.timeoutId=0};var ra=ta;function na(e){return Object.prototype.toString.call(e)}var oa=function(e){var t=na(e);return"[object HTMLCanvasElement]"===t||"[object OffscreenCanvas]"===t||"[object Canvas]"===t},aa=function(e){switch(e){case 0:return"pixelated";case 1:return"low";case 2:return"medium"}return"high"},ia=function(){var e,t=ea;onmessage=function(r){var n=r.data.opts;e||(e=new t(r.data.features));var o=e.resizeAndUnsharp(n);postMessage({result:o},[o.buffer])}};function sa(e){var t=Math.round(e);return Math.abs(e-t)<1e-5?t:Math.floor(e)}function ca(e){var t=Math.round(e);return Math.abs(e-t)<1e-5?t:Math.ceil(e)}var la={},ua=!1;try{"undefined"!=typeof navigator&&navigator.userAgent&&(ua=navigator.userAgent.indexOf("Safari")>=0)}catch(e){}var da=1;"undefined"!=typeof navigator&&(da=Math.min(navigator.hardwareConcurrency||1,4));var fa,pa,ha={tile:1024,concurrency:da,features:["js","wasm","ww"],idle:2e3,createCanvas:function(e,t){var r=document.createElement("canvas");return r.width=e,r.height=t,r}},ma={quality:3,alpha:!1,unsharpAmount:0,unsharpRadius:0,unsharpThreshold:0};function ga(){return{value:No(ia),destroy:function(){if(this.value.terminate(),"undefined"!=typeof window){var e=window.URL||window.webkitURL||window.mozURL||window.msURL;e&&e.revokeObjectURL&&this.value.objectURL&&e.revokeObjectURL(this.value.objectURL)}}}}function va(e){if(!(this instanceof va))return new va(e);this.options=Io({},ha,e||{});var t="lk_".concat(this.options.concurrency);this.__limit=la[t]||function(e){var t=0,r=[];function n(){t<e&&r.length&&(t++,r.shift()())}return function(e){return new Promise((function(o,a){r.push((function(){e().then((function(e){o(e),t--,n()}),(function(e){a(e),t--,n()}))})),n()}))}}(this.options.concurrency),la[t]||(la[t]=this.__limit),this.features={js:!1,wasm:!1,cib:!1,ww:!1},this.__workersPool=null,this.__requested_features=[],this.__mathlib=null}va.prototype.init=function(){var e=this;if(this.__initPromise)return this.__initPromise;if(!1!==fa&&!0!==fa&&(fa=!1,"undefined"!=typeof ImageData&&"undefined"!=typeof Uint8ClampedArray))try{new ImageData(new Uint8ClampedArray(400),10,10),fa=!0}catch(t){}!1!==pa&&!0!==pa&&(pa=!1,"undefined"!=typeof ImageBitmap&&(ImageBitmap.prototype&&ImageBitmap.prototype.close?pa=!0:this.debug("ImageBitmap does not support .close(), disabled")));var t=this.options.features.slice();if(t.indexOf("all")>=0&&(t=["cib","wasm","js","ww"]),this.__requested_features=t,this.__mathlib=new ea(t),t.indexOf("ww")>=0&&"undefined"!=typeof window&&"Worker"in window)try{No((function(){})).terminate(),this.features.ww=!0;var r="wp_".concat(JSON.stringify(this.options));la[r]?this.__workersPool=la[r]:(this.__workersPool=new ra(ga,this.options.idle),la[r]=this.__workersPool)}catch(t){}var n,o=this.__mathlib.init().then((function(t){Io(e.features,t.features)}));return n=pa?function(e){return Promise.resolve().then((function(){if("undefined"==typeof createImageBitmap)return!1;var t=e(100,100);return createImageBitmap(t,0,0,100,100,{resizeWidth:10,resizeHeight:10,resizeQuality:"high"}).then((function(e){var r=10===e.width;return e.close(),t=null,r}))})).catch((function(){return!1}))}(this.options.createCanvas).then((function(r){e.features.cib&&t.indexOf("cib")<0?e.debug("createImageBitmap() resize supported, but disabled by config"):t.indexOf("cib")>=0&&(e.features.cib=r)})):Promise.resolve(!1),this.__initPromise=Promise.all([o,n]).then((function(){return e})),this.__initPromise},va.prototype.resize=function(e,t,r){var n=this;this.debug("Start resize...");var o=Io({},ma);if(isNaN(r)?r&&(o=Io(o,r)):o=Io(o,{quality:r}),o.toWidth=t.width,o.toHeight=t.height,o.width=e.naturalWidth||e.width,o.height=e.naturalHeight||e.height,0===t.width||0===t.height)return Promise.reject(new Error("Invalid output size: ".concat(t.width,"x").concat(t.height)));o.unsharpRadius>2&&(o.unsharpRadius=2);var a=!1,i=null;o.cancelToken&&(i=o.cancelToken.then((function(e){throw a=!0,e}),(function(e){throw a=!0,e})));var s=Math.ceil(Math.max(3,2.5*o.unsharpRadius|0));return this.init().then((function(){if(a)return i;if(n.features.cib){var r=t.getContext("2d",{alpha:Boolean(o.alpha)});return n.debug("Resize via createImageBitmap()"),createImageBitmap(e,{resizeWidth:o.toWidth,resizeHeight:o.toHeight,resizeQuality:aa(o.quality)}).then((function(e){if(a)return i;if(!o.unsharpAmount)return r.drawImage(e,0,0),e.close(),r=null,n.debug("Finished!"),t;n.debug("Unsharp result");var s=n.options.createCanvas(o.toWidth,o.toHeight),c=s.getContext("2d",{alpha:Boolean(o.alpha)});c.drawImage(e,0,0),e.close();var l=c.getImageData(0,0,o.toWidth,o.toHeight);return n.__mathlib.unsharp_mask(l.data,o.toWidth,o.toHeight,o.unsharpAmount,o.unsharpRadius,o.unsharpThreshold),r.putImageData(l,0,0),s.width=s.height=0,l=c=s=r=null,n.debug("Finished!"),t}))}var c={},l=function(e){return Promise.resolve().then((function(){return n.features.ww?new Promise((function(t,r){var o=n.__workersPool.acquire();i&&i.catch((function(e){return r(e)})),o.value.onmessage=function(e){o.release(),e.data.err?r(e.data.err):t(e.data.result)},o.value.postMessage({opts:e,features:n.__requested_features,preload:{wasm_nodule:n.__mathlib.__}},[e.src.buffer])})):n.__mathlib.resizeAndUnsharp(e,c)}))},u=function(e,t,r){var o,c,u,d=!1,f=function(t){return n.__limit((function(){if(a)return i;var s;if(oa(e))n.debug("Get tile pixel data"),s=o.getImageData(t.x,t.y,t.width,t.height);else{n.debug("Draw tile imageBitmap/image to temporary canvas");var d=n.options.createCanvas(t.width,t.height),f=d.getContext("2d",{alpha:Boolean(r.alpha)});f.globalCompositeOperation="copy",f.drawImage(c||e,t.x,t.y,t.width,t.height,0,0,t.width,t.height),n.debug("Get tile pixel data"),s=f.getImageData(0,0,t.width,t.height),d.width=d.height=0,f=d=null}var p={src:s.data,width:t.width,height:t.height,toWidth:t.toWidth,toHeight:t.toHeight,scaleX:t.scaleX,scaleY:t.scaleY,offsetX:t.offsetX,offsetY:t.offsetY,quality:r.quality,alpha:r.alpha,unsharpAmount:r.unsharpAmount,unsharpRadius:r.unsharpRadius,unsharpThreshold:r.unsharpThreshold};return n.debug("Invoke resize math"),Promise.resolve().then((function(){return l(p)})).then((function(e){if(a)return i;var r;if(s=null,n.debug("Convert raw rgba tile result to ImageData"),fa)r=new ImageData(new Uint8ClampedArray(e),t.toWidth,t.toHeight);else if((r=u.createImageData(t.toWidth,t.toHeight)).data.set)r.data.set(e);else for(var o=r.data.length-1;o>=0;o--)r.data[o]=e[o];return n.debug("Draw tile"),ua?u.putImageData(r,t.toX,t.toY,t.toInnerX-t.toX,t.toInnerY-t.toY,t.toInnerWidth+1e-5,t.toInnerHeight+1e-5):u.putImageData(r,t.toX,t.toY,t.toInnerX-t.toX,t.toInnerY-t.toY,t.toInnerWidth,t.toInnerHeight),null}))}))};return Promise.resolve().then((function(){if(u=t.getContext("2d",{alpha:Boolean(r.alpha)}),oa(e))return o=e.getContext("2d",{alpha:Boolean(r.alpha)}),null;if(function(e){return"[object ImageBitmap]"===na(e)}(e))return c=e,d=!0,null;if(function(e){return"[object HTMLImageElement]"===na(e)}(e))return pa?(n.debug("Decode image via createImageBitmap"),createImageBitmap(e).then((function(e){c=e})).catch((function(e){return null}))):null;throw new Error('Pica: ".from" should be Image, Canvas or ImageBitmap')})).then((function(){if(a)return i;n.debug("Calculate tiles");var e=function(e){var t,r,n,o,a,i,s=e.toWidth/e.width,c=e.toHeight/e.height,l=sa(e.srcTileSize*s)-2*e.destTileBorder,u=sa(e.srcTileSize*c)-2*e.destTileBorder;if(l<1||u<1)throw new Error("Internal error in pica: target tile width/height is too small.");var d,f=[];for(o=0;o<e.toHeight;o+=u)for(n=0;n<e.toWidth;n+=l)(t=n-e.destTileBorder)<0&&(t=0),t+(a=n+l+e.destTileBorder-t)>=e.toWidth&&(a=e.toWidth-t),(r=o-e.destTileBorder)<0&&(r=0),r+(i=o+u+e.destTileBorder-r)>=e.toHeight&&(i=e.toHeight-r),d={toX:t,toY:r,toWidth:a,toHeight:i,toInnerX:n,toInnerY:o,toInnerWidth:l,toInnerHeight:u,offsetX:t/s-sa(t/s),offsetY:r/c-sa(r/c),scaleX:s,scaleY:c,x:sa(t/s),y:sa(r/c),width:ca(a/s),height:ca(i/c)},f.push(d);return f}({width:r.width,height:r.height,srcTileSize:n.options.tile,toWidth:r.toWidth,toHeight:r.toHeight,destTileBorder:s}).map((function(e){return f(e)}));function o(){c&&(d||c.close(),c=null)}return n.debug("Process tiles"),Promise.all(e).then((function(){return n.debug("Finished!"),o(),t}),(function(e){throw o(),e}))}))};return function e(t,r,o,s){if(a)return i;var c,l=L(t.shift(),2),d=l[0],f=l[1],p=0===t.length;return s=Io({},s,{toWidth:d,toHeight:f,quality:p?s.quality:Math.min(1,s.quality)}),p||(c=n.options.createCanvas(d,f)),u(r,p?o:c,s).then((function(){return p?o:(s.width=d,s.height=f,e(t,c,o,s))})).then((function(e){return c&&(c.width=c.height=0),e}))}(function(e,t,r,n,o,a){var i=r/e,s=n/t,c=(2*a+2+1)/o;if(c>.5)return[[r,n]];var l=Math.ceil(Math.log(Math.min(i,s))/Math.log(c));if(l<=1)return[[r,n]];for(var u=[],d=0;d<l;d++){var f=Math.round(Math.pow(Math.pow(e,l-d-1)*Math.pow(r,d+1),1/l)),p=Math.round(Math.pow(Math.pow(t,l-d-1)*Math.pow(n,d+1),1/l));u.push([f,p])}return u}(o.width,o.height,o.toWidth,o.toHeight,n.options.tile,s),e,t,o)}))},va.prototype.resizeBuffer=function(e){var t=this,r=Io({},ma,e);return this.init().then((function(){return t.__mathlib.resizeAndUnsharp(r)}))},va.prototype.toBlob=function(e,t,r){return t=t||"image/png",new Promise((function(n){if(e.toBlob)e.toBlob((function(e){return n(e)}),t,r);else if(e.convertToBlob)n(e.convertToBlob({type:t,quality:r}));else{for(var o=atob(e.toDataURL(t,r).split(",")[1]),a=o.length,i=new Uint8Array(a),s=0;s<a;s++)i[s]=o.charCodeAt(s);n(new Blob([i],{type:t}))}}))},va.prototype.debug=function(){};var ya=new va,ba=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.minSize,o=void 0===n?720:n,a=e/t;return e>t?{desW:Math.floor(o*a),desH:o}:{desW:o,desH:Math.floor(o/a)}},Ca=Object.freeze({__proto__:null,scaleImage:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minSize,n=void 0===r?720:r;return new Promise((function(t){var r=URL.createObjectURL(e),o=new Image;o.src=r;var a=document.createElement("canvas");o.onload=function(){if(o.width&&o.height&&(o.width<n||o.height<n)){var e=ba(o.width,o.height,{minSize:n}),r=e.desW,i=e.desH;a.width=r,a.height=i,ya.resize(o,a).then((function(e){return ya.toBlob(e,"image/jpeg",1)})).then((function(e){return t(e)}))}else t(null)}}))},createResizer:function(e){var t=e.width,r=e.height,n=document.createElement("canvas"),o=n.getContext("2d");return n.width=t,n.height=r,{resize:function(e){var t=e.srcCanvas;return o.drawImage(t,0,0,n.width,n.height),n}}},resizeBlobImg:function(e,t,r){var n=document.createElement("canvas"),o=n.getContext("2d");return n.width=t,n.height=r,new Promise((function(t){var r=URL.createObjectURL(e),a=new Image;a.onload=function(){URL.revokeObjectURL(r),o.drawImage(a,0,0,n.width,n.height),n.toBlob(t,"image/jpeg",1)},a.src=r}))},blobToCanvas:function(e){var t=e.blob;return new Promise((function(e){var r=document.createElement("canvas"),n=r.getContext("2d"),o=new Image;o.onload=function(t){var a=o.width,i=o.height;r.width=a,r.height=i,URL.revokeObjectURL(t.target.src),n.drawImage(t.target,0,0),e(r)},o.src=URL.createObjectURL(t)}))}});function wa(e,t,r,n){var o=r*(4*t)+4*n;return{r:e[o],g:e[o+1],b:e[o+2]}}function ka(e,t,r){return function(e,t,r){for(var n=0,o=r[1],a=r[3],i=r[0],s=r[2],c=o;c<a;c++)for(var l=i;l<s;l++){var u=wa(e,t,c,l),d=u.r,f=u.g,p=u.b;d>=245&&p>=245&&f>245&&(n+=1)}return n}(e,t,function(e,t){var r=Math.floor(.025*e),n=e-r,o=Math.floor(.025*t);return[r,o,n,t-o]}(t,r))/(t*r)>=.001}function Ba(){return(Ba=K(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.getContext("2d"),n=r.getImageData(0,0,t.width,t.height),o=n.data,Wn){e.next=5;break}return e.abrupt("return",ka(o,n.width,n.height));case 5:return e.abrupt("return",Wn.detectGlare(o,n.width,n.height));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ea=Object.freeze({__proto__:null,isCardGlare:function(e){return Ba.apply(this,arguments)}}),Sa="internal_server_error",Aa="network_error",_a=on();function Ia(e){return 500*Math.pow(1.5,e)}function Ta(e){return Array.isArray(null==e?void 0:e.errors)&&e.errors.find((function(e){return e.code===Sa}))}function Pa(e){return"Failed to fetch"===e.message||!e.response}function xa(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.maxNetworkErrorRetryTimes,n=void 0===r?5:r,o=t.maxInternalServerErrorRetryTimes,a=void 0===o?1:o,i=t.propertyKey,s=t.onDone;return function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];var c=this;function l(e,t){return u.apply(this,arguments)}function u(){return(u=K(regeneratorRuntime.mark((function t(o,u){var d,f,p,h,m,g,v,y,b=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return g=function(){return(g=K(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=h(t),n=p(t)-r,e.next=4,Tn(Ia(n));case 4:return e.abrupt("return",l(r,t,n));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)},m=function(e){return g.apply(this,arguments)},h=function(e){return e===u?Math.max(o-1,0):p(e)-1},p=function(e){return e===Aa?n:e===Sa?a:0},f=function(e){return o>0||(e===Aa?void 0===o&&n>0:e===Sa&&void 0===o&&a>0)},d=b.length>2&&void 0!==b[2]?b[2]:0,v=performance.now(),t.prev=7,t.next=10,e.apply(c,r);case 10:if(y=t.sent,s({response:y,retryCount:d,propertyKey:i,timeInMs:performance.now()-v,args:r}),!Ta(y)||!f(Sa)){t.next=16;break}return t.next=15,m(Sa);case 15:return t.abrupt("return",t.sent);case 16:return t.abrupt("return",y);case 19:if(t.prev=19,t.t0=t.catch(7),s({error:t.t0,retryCount:d,propertyKey:i,timeInMs:performance.now()-v,args:r}),!Pa(t.t0)||!f(Aa)){t.next=24;break}return t.abrupt("return",m(Aa));case 24:throw t.t0;case 25:case"end":return t.stop()}}),t,null,[[7,19]])})))).apply(this,arguments)}return l()}}function Ra(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.maxNetworkErrorRetryTimes,n=void 0===r?5:r,o=t.maxInternalServerErrorRetryTimes,a=void 0===o?1:o,i=t.onDone,s=void 0===i?function(){}:i,c={get:function(e,t){var r=e[t];return"function"==typeof r&&"constructor"!==t?xa(r,{maxNetworkErrorRetryTimes:n,maxInternalServerErrorRetryTimes:a,propertyKey:t,onDone:s}):r}};return new Proxy(e,c)}var Na=function(e){var t=e.response,r=(e.error,e.retryCount,e.propertyKey,e.timeInMs);return e.args,{event:"test-event",log:{request_status:t?"success":"fail",time_in_ms:r}}},La=Object.freeze({__proto__:null,createRetryAPIClient:Ra,useApiClient:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.apiCredentials,n=void 0===t?{}:t,a=e.tracking,i=void 0===a?{}:a,s=r(null),c=En(),l=c.sendEvent,u=o((function(e){try{var t=Na(e),r=t.event,n=t.log;l({tag:"sdk_api",event:r,log:n})}catch(e){}}),[l]);if(null===s.current){var d=n.accessKey,f=n.secretKey,p=n.apiUrl,h=i.userId,m=kn({userId:h});s.current=Ra(new Gr(d,f,p,{httpHeaders:W(W({},_a),{},{"x-request-id":m})}),{onDone:u})}return{apiClient:s.current}}}),Oa="BFnYsWrH",Da="KbKcY2nb",Ma=function(e){return e.split("").reverse().join("")},Ua=function(e){var t=e.url;return new Promise((function(e){var r=document.createElement("script");r.onload=e,r.src=t,document.head.appendChild(r)}))},Fa=window.fetch.bind(window);function ja(e){var t=e.split(","),r=t[0].match(/:(.*?);/)[1];return{u8arr:Uint8Array.from(atob(t[1]),(function(e){return e.charCodeAt(0)})),mime:r}}var Va=function(){var e=K(regeneratorRuntime.mark((function e(){var t,r,n,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t="".concat(Ma(Oa)).concat(Ma(Da)),e.next=3,Fa.apply(void 0,a);case 3:return r=e.sent,e.next=6,r.text();case 6:return n=e.sent,o=hn.AES.decrypt(n,t).toString(hn.enc.Utf8),e.abrupt("return",ja(o));case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),za=function(){var e=K(regeneratorRuntime.mark((function e(){var t,r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Fa.apply(void 0,n);case 2:return t=e.sent,e.next=5,t.text();case 5:return r=e.sent,e.abrupt("return",r);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ka=Object.freeze({__proto__:null,reverseString:Ma,loadExternalScript:Ua,fetchWithDecryption:Va,fetchRawResource:za}),Ha=/\s/,qa=/^\s+/,Qa=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&Ha.test(e.charAt(t)););return t}(e)+1).replace(qa,""):e},Wa=/^[-+]0x[0-9a-f]+$/i,Ga=/^0b[01]+$/i,Xa=/^0o[0-7]+$/i,Ya=parseInt,$a=function(e){return e?1/0===(e=function(e){if("number"==typeof e)return e;if(sr(e))return NaN;if(be(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=be(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Qa(e);var r=Ga.test(e);return r||Xa.test(e)?Ya(e.slice(2),r?2:8):Wa.test(e)?NaN:+e}(e))||-1/0===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0},Za=function(e,t){var r;if("function"!=typeof t)throw new TypeError("Expected a function");return e=function(e){var t=$a(e),r=t%1;return t==t?r?t-r:t:0}(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}},Ja=function(e){return Za(2,e)}(function(){var e=K(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c,l,u,d,f,p,h=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>0&&void 0!==h[0]?h[0]:{},r=t.tfUrl,n=void 0===r?"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@3.11.0":r,o=t.tfBackendWasmUrl,a=void 0===o?"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@3.11.0/dist/tf-backend-wasm.js":o,i=t.tfBackendCpuUrl,s=void 0===i?"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-cpu@3.11.0":i,c=t.tfBackendWebGlUrl,l=void 0===c?"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-webgl@3.11.0":c,u=t.tfLiteUrl,d=void 0===u?"https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-tflite@0.0.1-alpha.7/dist/tf-tflite.min.js":u,f=t.blazefaceScriptUrl,p=void 0===f?"https://cdn.jsdelivr.net/npm/@tensorflow-models/blazeface@0.0.7":f,e.next=3,Ua({url:n});case 3:return e.next=5,Promise.all([Ua({url:a}),Ua({url:s}),Ua({url:l}),Ua({url:p}),Ua({url:d})]);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}());function ei(){return(ei=K(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=l.length>0&&void 0!==l[0]?l[0]:{},r=t.preferredBackends,n=void 0===r?["webgl","wasm","cpu"]:r,!window.tv_model_backend_init||window.tv_model_backend_init[0]!==n[0]){e.next=3;break}return e.abrupt("return");case 3:return o=window,a=o.tf,e.next=6,a.enableProdMode();case 6:i=Z(n),e.prev=7,i.s();case 9:if((s=i.n()).done){e.next=23;break}return c=s.value,e.prev=11,e.next=14,a.setBackend(c);case 14:return e.abrupt("break",23);case 17:if(e.prev=17,e.t0=e.catch(11),c!==n[n.length-1]){e.next=21;break}throw e.t0;case 21:e.next=9;break;case 23:e.next=28;break;case 25:e.prev=25,e.t1=e.catch(7),i.e(e.t1);case 28:return e.prev=28,i.f(),e.finish(28);case 31:return e.next=33,a.ready();case 33:window.tv_model_backend_init=n;case 34:case"end":return e.stop()}}),e,null,[[7,25,28,31],[11,17]])})))).apply(this,arguments)}function ti(){return(ti=K(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.modelUrl,n=window,o=n.blazeface,e.abrupt("return",r?o.load({modelUrl:r}):o.load());case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ri(){return(ri=K(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.modelUrl,e.next=3,za(r);case 3:return n=e.sent,o=n.rawData,e.abrupt("return",o);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ni(){return(ni=K(regeneratorRuntime.mark((function e(t){var r,n,o,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.modelUrl,n=window,o=n.tflite,e.next=4,Va(r);case 4:return a=e.sent,i=a.u8arr,e.abrupt("return",o.loadTFLiteModel(i,{numThreads:navigator.hardwareConcurrency/2}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var oi=Object.freeze({__proto__:null,loadTensorFlow:Ja,initTensorFlow:function(){return ei.apply(this,arguments)},loadBlazefaceModel:function(e){return ti.apply(this,arguments)},preloadResource:function(e){return ri.apply(this,arguments)},loadTFLiteModel:function(e){return ni.apply(this,arguments)}}),ai=Object.freeze({__proto__:null,enableAntiDebug:function(){var e,t,r=["action","gger","stateObject","apply","chain","test","input","Hello World!","constructor","counter","length","debu","call"];e=r,t=185,function(t){for(;--t;)e.push(e.shift())}(++t);var n,o,a=function(e,t){return r[e-=0]};function i(e){function t(e){if("string"==typeof e)return function(e){}[a("0x5")]("while (true) {}")[a("0x0")](a("0x6"));1!=="".concat(e/e)[a("0x7")]||e%20==0?function(){return!0}[a("0x5")]("".concat(a("0x8"),"gger"))[a("0x9")](a("0xa")):function(){return!1}.constructor("debu".concat(a("0xb")))[a("0x0")](a("0xc")),t(++e)}try{if(e)return t;t(0)}catch(e){}}setInterval((function(){i()}),4e3),n=!0,o=function(e,t){var r=n?function(){if(t){var r=t[a("0x0")](e,arguments);return t=null,r}}:function(){};return n=!1,r},function(){o(this,(function(){var e=new RegExp("function *\\( *\\)"),t=new RegExp("\\+\\+ *(?:_0x(?:[a-f0-9]){4,6}|(?:\\b|\\d)[a-z0-9]{1,4}(?:\\b|\\d))","i"),r=i("init");e.test(r+a("0x1"))&&t[a("0x2")](r+a("0x3"))?i():r("0")}))()}(),console.log(a("0x4"))}}),ii=Object.freeze({__proto__:null,useThemeContext:function(){return a(m)}});function si(){return(si=K(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.key,n=new TextEncoder,(o=n.encode(r)).reverse(),e.abrupt("return",crypto.subtle.digest("SHA-256",o));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ci=Object.freeze({__proto__:null,encrypt:function(e){var t=e.blob,r=e.key;return new Promise((function(e){var n=new FileReader;n.onload=function(t){var n=t.target.result;(function(e){return si.apply(this,arguments)})({key:r}).then((function(t){window.crypto.subtle.importKey("raw",t,"AES-GCM",!0,["encrypt","decrypt"]).then((function(t){window.crypto.subtle.encrypt({name:"AES-GCM",iv:new Uint8Array(12),tagLength:128},t,n).then((function(t){var r;e({hex:(r=t,X(new Uint8Array(r)).map((function(e){return e.toString(16).padStart(2,"0")})).join(""))})}))}))}))},n.readAsArrayBuffer(t)}))}}),li=function(){return URL.createObjectURL(new Blob(['\'use strict\';(function(){function T(a,b){let c=[],d="";b=a.readBits([8,16,16][b]);for(let d=0;d<b;d++){let b=a.readBits(8);c.push(b)}try{d+=decodeURIComponent(c.map(a=>`%${("0"+a.toString(16)).substr(-2)}`).join(""))}catch(e){}return{bytes:c,text:d}}function U(a,b){a=new V(a);let c=9>=b?0:26>=b?1:2;for(b={text:"",bytes:[],chunks:[],version:b};4<=a.available();){var d=a.readBits(4);if(d===t.Terminator)return b;if(d===t.ECI)0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(7)}):\n0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(14)}):0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(21)}):b.chunks.push({type:r.ECI,assignmentNumber:-1});else if(d===t.Numeric){var e=a;d=[];for(var f="",g=e.readBits([10,12,14][c]);3<=g;){var h=e.readBits(10);if(1E3<=h)throw Error("Invalid numeric value above 999");var k=Math.floor(h/100),n=Math.floor(h/10)%10;h%=10;d.push(48+k,48+n,48+h);f+=k.toString()+n.toString()+h.toString();g-=3}if(2===g){g=e.readBits(7);\nif(100<=g)throw Error("Invalid numeric value above 99");e=Math.floor(g/10);g%=10;d.push(48+e,48+g);f+=e.toString()+g.toString()}else if(1===g){e=e.readBits(4);if(10<=e)throw Error("Invalid numeric value above 9");d.push(48+e);f+=e.toString()}d={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Numeric,text:d.text})}else if(d===t.Alphanumeric){e=a;d=[];f="";for(g=e.readBits([9,11,13][c]);2<=g;)n=e.readBits(11),k=Math.floor(n/45),n%=45,d.push(B[k].charCodeAt(0),B[n].charCodeAt(0)),\nf+=B[k]+B[n],g-=2;1===g&&(e=e.readBits(6),d.push(B[e].charCodeAt(0)),f+=B[e]);d={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Alphanumeric,text:d.text})}else if(d===t.Byte)d=T(a,c),b.text+=d.text,b.bytes.push(...d.bytes),b.chunks.push({type:r.Byte,bytes:d.bytes,text:d.text});else if(d===t.Kanji){f=a;d=[];e=f.readBits([8,10,12][c]);for(g=0;g<e;g++)k=f.readBits(13),k=Math.floor(k/192)<<8|k%192,k=7936>k?k+33088:k+49472,d.push(k>>8,k&255);f=(new TextDecoder("shift-jis")).decode(Uint8Array.from(d));\nd={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Kanji,bytes:d.bytes,text:d.text})}else d===t.StructuredAppend&&b.chunks.push({type:r.StructuredAppend,currentSequence:a.readBits(4),totalSequence:a.readBits(4),parity:a.readBits(8)})}if(0===a.available()||0===a.readBits(a.available()))return b}function J(a,b){return a^b}function W(a,b,c,d){b.degree()<c.degree()&&([b,c]=[c,b]);let e=a.zero;for(var f=a.one;c.degree()>=d/2;){var g=b;let d=e;b=c;e=f;if(b.isZero())return null;\nc=g;f=a.zero;g=b.getCoefficient(b.degree());for(g=a.inverse(g);c.degree()>=b.degree()&&!c.isZero();){let d=c.degree()-b.degree(),e=a.multiply(c.getCoefficient(c.degree()),g);f=f.addOrSubtract(a.buildMonomial(d,e));c=c.addOrSubtract(b.multiplyByMonomial(d,e))}f=f.multiplyPoly(e).addOrSubtract(d);if(c.degree()>=b.degree())return null}d=f.getCoefficient(0);if(0===d)return null;a=a.inverse(d);return[f.multiply(a),c.multiply(a)]}function X(a,b){let c=new Uint8ClampedArray(a.length);c.set(a);a=new Y(285,\n256,0);var d=new w(a,c),e=new Uint8ClampedArray(b),f=!1;for(var g=0;g<b;g++){var h=d.evaluateAt(a.exp(g+a.generatorBase));e[e.length-1-g]=h;0!==h&&(f=!0)}if(!f)return c;d=new w(a,e);d=W(a,a.buildMonomial(b,1),d,b);if(null===d)return null;b=d[0];g=b.degree();if(1===g)b=[b.getCoefficient(1)];else{e=Array(g);f=0;for(h=1;h<a.size&&f<g;h++)0===b.evaluateAt(h)&&(e[f]=a.inverse(h),f++);b=f!==g?null:e}if(null==b)return null;d=d[1];e=b.length;f=Array(e);for(g=0;g<e;g++){h=a.inverse(b[g]);let c=1;for(let d=\n0;d<e;d++)g!==d&&(c=a.multiply(c,J(1,a.multiply(b[d],h))));f[g]=a.multiply(d.evaluateAt(h),a.inverse(c));0!==a.generatorBase&&(f[g]=a.multiply(f[g],h))}d=f;for(e=0;e<b.length;e++){f=c.length-1-a.log(b[e]);if(0>f)return null;c[f]^=d[e]}return c}function E(a,b){a^=b;for(b=0;a;)b++,a&=a-1;return b}function C(a,b){return b<<1|a}function Z(a,b,c){c=aa[c.dataMask];let d=a.height;var e=17+4*b.versionNumber,f=A.createEmpty(e,e);f.setRegion(0,0,9,9,!0);f.setRegion(e-8,0,8,9,!0);f.setRegion(0,e-8,9,8,!0);for(var g of b.alignmentPatternCenters)for(var h of b.alignmentPatternCenters)6===\ng&&6===h||6===g&&h===e-7||g===e-7&&6===h||f.setRegion(g-2,h-2,5,5,!0);f.setRegion(6,9,1,e-17,!0);f.setRegion(9,6,e-17,1,!0);6<b.versionNumber&&(f.setRegion(e-11,0,3,6,!0),f.setRegion(0,e-11,6,3,!0));b=f;g=[];e=h=0;f=!0;for(let k=d-1;0<k;k-=2){6===k&&k--;for(let n=0;n<d;n++){let m=f?d-1-n:n;for(let d=0;2>d;d++){let f=k-d;if(!b.get(f,m)){e++;let b=a.get(f,m);c({y:m,x:f})&&(b=!b);h=h<<1|b;8===e&&(g.push(h),h=e=0)}}}f=!f}return g}function ba(a){var b=a.height,c=Math.floor((b-17)/4);if(6>=c)return K[c-\n1];c=0;for(var d=5;0<=d;d--)for(var e=b-9;e>=b-11;e--)c=C(a.get(e,d),c);d=0;for(e=5;0<=e;e--)for(let c=b-9;c>=b-11;c--)d=C(a.get(e,c),d);a=Infinity;let f;for(let e of K){if(e.infoBits===c||e.infoBits===d)return e;b=E(c,e.infoBits);b<a&&(f=e,a=b);b=E(d,e.infoBits);b<a&&(f=e,a=b)}if(3>=a)return f}function ca(a){let b=0;for(var c=0;8>=c;c++)6!==c&&(b=C(a.get(c,8),b));for(c=7;0<=c;c--)6!==c&&(b=C(a.get(8,c),b));var d=a.height;c=0;for(var e=d-1;e>=d-7;e--)c=C(a.get(8,e),c);for(e=d-8;e<d;e++)c=C(a.get(e,\n8),c);a=Infinity;d=null;for(let {bits:f,formatInfo:g}of da){if(f===b||f===c)return g;e=E(b,f);e<a&&(d=g,a=e);b!==c&&(e=E(c,f),e<a&&(d=g,a=e))}return 3>=a?d:null}function ea(a,b,c){let d=b.errorCorrectionLevels[c],e=[],f=0;d.ecBlocks.forEach(a=>{for(let b=0;b<a.numBlocks;b++)e.push({numDataCodewords:a.dataCodewordsPerBlock,codewords:[]}),f+=a.dataCodewordsPerBlock+d.ecCodewordsPerBlock});if(a.length<f)return null;a=a.slice(0,f);b=d.ecBlocks[0].dataCodewordsPerBlock;for(c=0;c<b;c++)for(var g of e)g.codewords.push(a.shift());\nif(1<d.ecBlocks.length)for(g=d.ecBlocks[0].numBlocks,b=d.ecBlocks[1].numBlocks,c=0;c<b;c++)e[g+c].codewords.push(a.shift());for(;0<a.length;)for(let b of e)b.codewords.push(a.shift());return e}function L(a){let b=ba(a);if(!b)return null;var c=ca(a);if(!c)return null;a=Z(a,b,c);var d=ea(a,b,c.errorCorrectionLevel);if(!d)return null;c=d.reduce((a,b)=>a+b.numDataCodewords,0);c=new Uint8ClampedArray(c);a=0;for(let b of d){d=X(b.codewords,b.codewords.length-b.numDataCodewords);if(!d)return null;for(let e=\n0;e<b.numDataCodewords;e++)c[a++]=d[e]}try{return U(c,b.versionNumber)}catch(e){return null}}function M(a,b,c,d){var e=a.x-b.x+c.x-d.x;let f=a.y-b.y+c.y-d.y;if(0===e&&0===f)return{a11:b.x-a.x,a12:b.y-a.y,a13:0,a21:c.x-b.x,a22:c.y-b.y,a23:0,a31:a.x,a32:a.y,a33:1};{let h=b.x-c.x;var g=d.x-c.x;let k=b.y-c.y,n=d.y-c.y;c=h*n-g*k;g=(e*n-g*f)/c;e=(h*f-e*k)/c;return{a11:b.x-a.x+g*b.x,a12:b.y-a.y+g*b.y,a13:g,a21:d.x-a.x+e*d.x,a22:d.y-a.y+e*d.y,a23:e,a31:a.x,a32:a.y,a33:1}}}function fa(a,b,c,d){a=M(a,b,c,d);\nreturn{a11:a.a22*a.a33-a.a23*a.a32,a12:a.a13*a.a32-a.a12*a.a33,a13:a.a12*a.a23-a.a13*a.a22,a21:a.a23*a.a31-a.a21*a.a33,a22:a.a11*a.a33-a.a13*a.a31,a23:a.a13*a.a21-a.a11*a.a23,a31:a.a21*a.a32-a.a22*a.a31,a32:a.a12*a.a31-a.a11*a.a32,a33:a.a11*a.a22-a.a12*a.a21}}function ha(a,b){var c=fa({x:3.5,y:3.5},{x:b.dimension-3.5,y:3.5},{x:b.dimension-6.5,y:b.dimension-6.5},{x:3.5,y:b.dimension-3.5}),d=M(b.topLeft,b.topRight,b.alignmentPattern,b.bottomLeft),e=d.a11*c.a11+d.a21*c.a12+d.a31*c.a13,f=d.a12*c.a11+\nd.a22*c.a12+d.a32*c.a13,g=d.a13*c.a11+d.a23*c.a12+d.a33*c.a13,h=d.a11*c.a21+d.a21*c.a22+d.a31*c.a23,k=d.a12*c.a21+d.a22*c.a22+d.a32*c.a23,n=d.a13*c.a21+d.a23*c.a22+d.a33*c.a23,m=d.a11*c.a31+d.a21*c.a32+d.a31*c.a33,l=d.a12*c.a31+d.a22*c.a32+d.a32*c.a33,p=d.a13*c.a31+d.a23*c.a32+d.a33*c.a33;c=A.createEmpty(b.dimension,b.dimension);d=(a,b)=>{const c=g*a+n*b+p;return{x:(e*a+h*b+m)/c,y:(f*a+k*b+l)/c}};for(let e=0;e<b.dimension;e++)for(let f=0;f<b.dimension;f++){let b=d(f+.5,e+.5);c.set(f,e,a.get(Math.floor(b.x),\nMath.floor(b.y)))}return{matrix:c,mappingFunction:d}}function x(a){return a.reduce((a,c)=>a+c)}function ia(a,b,c){let d=y(a,b),e=y(b,c),f=y(a,c),g,h,k;e>=d&&e>=f?[g,h,k]=[b,a,c]:f>=e&&f>=d?[g,h,k]=[a,b,c]:[g,h,k]=[a,c,b];0>(k.x-h.x)*(g.y-h.y)-(k.y-h.y)*(g.x-h.x)&&([g,k]=[k,g]);return{bottomLeft:g,topLeft:h,topRight:k}}function ja(a,b,c,d){d=(x(z(a,c,d,5))/7+x(z(a,b,d,5))/7+x(z(c,a,d,5))/7+x(z(b,a,d,5))/7)/4;if(1>d)throw Error("Invalid module size");b=Math.round(y(a,b)/d);a=Math.round(y(a,c)/d);a=\nMath.floor((b+a)/2)+7;switch(a%4){case 0:a++;break;case 2:a--}return{dimension:a,moduleSize:d}}function N(a,b,c,d){let e=[{x:Math.floor(a.x),y:Math.floor(a.y)}];var f=Math.abs(b.y-a.y)>Math.abs(b.x-a.x);if(f){var g=Math.floor(a.y);var h=Math.floor(a.x);a=Math.floor(b.y);b=Math.floor(b.x)}else g=Math.floor(a.x),h=Math.floor(a.y),a=Math.floor(b.x),b=Math.floor(b.y);let k=Math.abs(a-g),n=Math.abs(b-h),m=Math.floor(-k/2),l=g<a?1:-1,p=h<b?1:-1,q=!0;for(let v=g,u=h;v!==a+l;v+=l){g=f?u:v;h=f?v:u;if(c.get(g,\nh)!==q&&(q=!q,e.push({x:g,y:h}),e.length===d+1))break;m+=n;if(0<m){if(u===b)break;u+=p;m-=k}}c=[];for(f=0;f<d;f++)e[f]&&e[f+1]?c.push(y(e[f],e[f+1])):c.push(0);return c}function z(a,b,c,d){let e=b.y-a.y,f=b.x-a.x;b=N(a,b,c,Math.ceil(d/2));a=N(a,{x:a.x-f,y:a.y-e},c,Math.ceil(d/2));c=b.shift()+a.shift()-1;return a.concat(c).concat(...b)}function F(a,b){let c=x(a)/x(b),d=0;b.forEach((b,f)=>{d+=Math.pow(a[f]-b*c,2)});return{averageSize:c,error:d}}function O(a,b,c){try{let d=z(a,{x:-1,y:a.y},c,b.length),\ne=z(a,{x:a.x,y:-1},c,b.length),f=z(a,{x:Math.max(0,a.x-a.y)-1,y:Math.max(0,a.y-a.x)-1},c,b.length),g=z(a,{x:Math.min(c.width,a.x+a.y)+1,y:Math.min(c.height,a.y+a.x)+1},c,b.length),h=F(d,b),k=F(e,b),n=F(f,b),m=F(g,b),l=(h.averageSize+k.averageSize+n.averageSize+m.averageSize)/4;return Math.sqrt(h.error*h.error+k.error*k.error+n.error*n.error+m.error*m.error)+(Math.pow(h.averageSize-l,2)+Math.pow(k.averageSize-l,2)+Math.pow(n.averageSize-l,2)+Math.pow(m.averageSize-l,2))/l}catch(d){return Infinity}}\nfunction H(a,b){for(var c=Math.round(b.x);a.get(c,Math.round(b.y));)c--;for(var d=Math.round(b.x);a.get(d,Math.round(b.y));)d++;c=(c+d)/2;for(d=Math.round(b.y);a.get(Math.round(c),d);)d--;for(b=Math.round(b.y);a.get(Math.round(c),b);)b++;return{x:c,y:(d+b)/2}}function ka(a){var b=[],c=[];let d=[];var e=[];for(let m=0;m<=a.height;m++){var f=0,g=!1;let l=[0,0,0,0,0];for(let b=-1;b<=a.width;b++){var h=a.get(b,m);if(h===g)f++;else{l=[l[1],l[2],l[3],l[4],f];f=1;g=h;var k=x(l)/7;k=Math.abs(l[0]-k)<k&&Math.abs(l[1]-\nk)<k&&Math.abs(l[2]-3*k)<3*k&&Math.abs(l[3]-k)<k&&Math.abs(l[4]-k)<k&&!h;var n=x(l.slice(-3))/3;h=Math.abs(l[2]-n)<n&&Math.abs(l[3]-n)<n&&Math.abs(l[4]-n)<n&&h;if(k){let a=b-l[3]-l[4],d=a-l[2];k={startX:d,endX:a,y:m};n=c.filter(b=>d>=b.bottom.startX&&d<=b.bottom.endX||a>=b.bottom.startX&&d<=b.bottom.endX||d<=b.bottom.startX&&a>=b.bottom.endX&&1.5>l[2]/(b.bottom.endX-b.bottom.startX)&&.5<l[2]/(b.bottom.endX-b.bottom.startX));0<n.length?n[0].bottom=k:c.push({top:k,bottom:k})}if(h){let a=b-l[4],c=a-\nl[3];h={startX:c,y:m,endX:a};k=e.filter(b=>c>=b.bottom.startX&&c<=b.bottom.endX||a>=b.bottom.startX&&c<=b.bottom.endX||c<=b.bottom.startX&&a>=b.bottom.endX&&1.5>l[2]/(b.bottom.endX-b.bottom.startX)&&.5<l[2]/(b.bottom.endX-b.bottom.startX));0<k.length?k[0].bottom=h:e.push({top:h,bottom:h})}}}b.push(...c.filter(a=>a.bottom.y!==m&&2<=a.bottom.y-a.top.y));c=c.filter(a=>a.bottom.y===m);d.push(...e.filter(a=>a.bottom.y!==m));e=e.filter(a=>a.bottom.y===m)}b.push(...c.filter(a=>2<=a.bottom.y-a.top.y));d.push(...e);\nc=[];for(var m of b)2>m.bottom.y-m.top.y||(b=(m.top.startX+m.top.endX+m.bottom.startX+m.bottom.endX)/4,e=(m.top.y+m.bottom.y+1)/2,a.get(Math.round(b),Math.round(e))&&(f=[m.top.endX-m.top.startX,m.bottom.endX-m.bottom.startX,m.bottom.y-m.top.y+1],f=x(f)/f.length,g=O({x:Math.round(b),y:Math.round(e)},[1,1,3,1,1],a),c.push({score:g,x:b,y:e,size:f})));if(3>c.length)return null;c.sort((a,b)=>a.score-b.score);m=[];for(b=0;b<Math.min(c.length,5);++b){e=c[b];f=[];for(var l of c)l!==e&&f.push(Object.assign(Object.assign({},\nl),{score:l.score+Math.pow(l.size-e.size,2)/e.size}));f.sort((a,b)=>a.score-b.score);m.push({points:[e,f[0],f[1]],score:e.score+f[0].score+f[1].score})}m.sort((a,b)=>a.score-b.score);let {topRight:p,topLeft:q,bottomLeft:v}=ia(...m[0].points);m=P(a,d,p,q,v);l=[];m&&l.push({alignmentPattern:{x:m.alignmentPattern.x,y:m.alignmentPattern.y},bottomLeft:{x:v.x,y:v.y},dimension:m.dimension,topLeft:{x:q.x,y:q.y},topRight:{x:p.x,y:p.y}});m=H(a,p);b=H(a,q);c=H(a,v);(a=P(a,d,m,b,c))&&l.push({alignmentPattern:{x:a.alignmentPattern.x,\ny:a.alignmentPattern.y},bottomLeft:{x:c.x,y:c.y},topLeft:{x:b.x,y:b.y},topRight:{x:m.x,y:m.y},dimension:a.dimension});return 0===l.length?null:l}function P(a,b,c,d,e){let f,g;try{({dimension:f,moduleSize:g}=ja(d,c,e,a))}catch(m){return null}var h=c.x-d.x+e.x,k=c.y-d.y+e.y;c=(y(d,e)+y(d,c))/2/g;e=1-3/c;let n={x:d.x+e*(h-d.x),y:d.y+e*(k-d.y)};b=b.map(b=>{const c=(b.top.startX+b.top.endX+b.bottom.startX+b.bottom.endX)/4;b=(b.top.y+b.bottom.y+1)/2;if(a.get(Math.floor(c),Math.floor(b))){var d=O({x:Math.floor(c),\ny:Math.floor(b)},[1,1,1],a)+y({x:c,y:b},n);return{x:c,y:b,score:d}}}).filter(a=>!!a).sort((a,b)=>a.score-b.score);return{alignmentPattern:15<=c&&b.length?b[0]:n,dimension:f}}function Q(a){var b=ka(a);if(!b)return null;for(let e of b){b=ha(a,e);var c=b.matrix;if(null==c)c=null;else{var d=L(c);if(d)c=d;else{for(d=0;d<c.width;d++)for(let a=d+1;a<c.height;a++)c.get(d,a)!==c.get(a,d)&&(c.set(d,a,!c.get(d,a)),c.set(a,d,!c.get(a,d)));c=L(c)}}if(c)return{binaryData:c.bytes,data:c.text,chunks:c.chunks,version:c.version,\nlocation:{topRightCorner:b.mappingFunction(e.dimension,0),topLeftCorner:b.mappingFunction(0,0),bottomRightCorner:b.mappingFunction(e.dimension,e.dimension),bottomLeftCorner:b.mappingFunction(0,e.dimension),topRightFinderPattern:e.topRight,topLeftFinderPattern:e.topLeft,bottomLeftFinderPattern:e.bottomLeft,bottomRightAlignmentPattern:e.alignmentPattern},matrix:b.matrix}}return null}function R(a,b){Object.keys(b).forEach(c=>{a[c]=b[c]})}function I(a,b,c,d={}){let e=Object.create(null);R(e,la);R(e,d);\nd="onlyInvert"===e.inversionAttempts||"invertFirst"===e.inversionAttempts;var f="attemptBoth"===e.inversionAttempts||d;var g=e.greyScaleWeights,h=e.canOverwriteImage,k=b*c;if(a.length!==4*k)throw Error("Malformed data passed to binarizer.");var n=0;if(h){var m=new Uint8ClampedArray(a.buffer,n,k);n+=k}m=new S(b,c,m);if(g.useIntegerApproximation)for(var l=0;l<c;l++)for(var p=0;p<b;p++){var q=4*(l*b+p);m.set(p,l,g.red*a[q]+g.green*a[q+1]+g.blue*a[q+2]+128>>8)}else for(l=0;l<c;l++)for(p=0;p<b;p++)q=4*\n(l*b+p),m.set(p,l,g.red*a[q]+g.green*a[q+1]+g.blue*a[q+2]);g=Math.ceil(b/8);l=Math.ceil(c/8);p=g*l;if(h){var v=new Uint8ClampedArray(a.buffer,n,p);n+=p}v=new S(g,l,v);for(p=0;p<l;p++)for(q=0;q<g;q++){var u=Infinity,r=0;for(var t=0;8>t;t++)for(let a=0;8>a;a++){let b=m.get(8*q+a,8*p+t);u=Math.min(u,b);r=Math.max(r,b)}t=(u+r)/2;t=Math.min(255,1.11*t);24>=r-u&&(t=u/2,0<p&&0<q&&(r=(v.get(q,p-1)+2*v.get(q-1,p)+v.get(q-1,p-1))/4,u<r&&(t=r)));v.set(q,p,t)}h?(p=new Uint8ClampedArray(a.buffer,n,k),n+=k,p=new A(p,\nb)):p=A.createEmpty(b,c);q=null;f&&(h?(a=new Uint8ClampedArray(a.buffer,n,k),q=new A(a,b)):q=A.createEmpty(b,c));for(b=0;b<l;b++)for(a=0;a<g;a++){c=g-3;c=2>a?2:a>c?c:a;h=l-3;h=2>b?2:b>h?h:b;k=0;for(n=-2;2>=n;n++)for(u=-2;2>=u;u++)k+=v.get(c+n,h+u);c=k/25;for(h=0;8>h;h++)for(k=0;8>k;k++)n=8*a+h,u=8*b+k,r=m.get(n,u),p.set(n,u,r<=c),f&&q.set(n,u,!(r<=c))}f=f?{binarized:p,inverted:q}:{binarized:p};let {binarized:w,inverted:x}=f;(f=Q(d?x:w))||"attemptBoth"!==e.inversionAttempts&&"invertFirst"!==e.inversionAttempts||\n(f=Q(d?w:x));return f}class A{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new A(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let b=a;b<a+c;b++)this.set(b,f,!!e)}}class S{constructor(a,b,c){this.width=a;a*=b;if(c&&c.length!==a)throw Error("Wrong buffer size");this.data=c||new Uint8ClampedArray(a)}get(a,\nb){return this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c}}class V{constructor(a){this.bitOffset=this.byteOffset=0;this.bytes=a}readBits(a){if(1>a||32<a||a>this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0<this.bitOffset){b=8-this.bitOffset;var c=a<b?a:b;b-=c;b=(this.bytes[this.byteOffset]&255>>8-c<<b)>>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(0<a){for(;8<=a;)b=b<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,\na-=8;0<a&&(c=8-a,b=b<<a|(this.bytes[this.byteOffset]&255>>c<<c)>>c,this.bitOffset+=a)}return b}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var r;(function(a){a.Numeric="numeric";a.Alphanumeric="alphanumeric";a.Byte="byte";a.Kanji="kanji";a.ECI="eci";a.StructuredAppend="structuredappend"})(r||(r={}));var t;(function(a){a[a.Terminator=0]="Terminator";a[a.Numeric=1]="Numeric";a[a.Alphanumeric=2]="Alphanumeric";a[a.Byte=4]="Byte";a[a.Kanji=8]="Kanji";a[a.ECI=7]="ECI";a[a.StructuredAppend=\n3]="StructuredAppend"})(t||(t={}));let B="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");class w{constructor(a,b){if(0===b.length)throw Error("No coefficients.");this.field=a;let c=b.length;if(1<c&&0===b[0]){let d=1;for(;d<c&&0===b[d];)d++;if(d===c)this.coefficients=a.zero.coefficients;else for(this.coefficients=new Uint8ClampedArray(c-d),a=0;a<this.coefficients.length;a++)this.coefficients[a]=b[d+a]}else this.coefficients=b}degree(){return this.coefficients.length-1}isZero(){return 0===\nthis.coefficients[0]}getCoefficient(a){return this.coefficients[this.coefficients.length-1-a]}addOrSubtract(a){if(this.isZero())return a;if(a.isZero())return this;let b=this.coefficients;a=a.coefficients;b.length>a.length&&([b,a]=[a,b]);let c=new Uint8ClampedArray(a.length),d=a.length-b.length;for(var e=0;e<d;e++)c[e]=a[e];for(e=d;e<a.length;e++)c[e]=b[e-d]^a[e];return new w(this.field,c)}multiply(a){if(0===a)return this.field.zero;if(1===a)return this;let b=this.coefficients.length,c=new Uint8ClampedArray(b);\nfor(let d=0;d<b;d++)c[d]=this.field.multiply(this.coefficients[d],a);return new w(this.field,c)}multiplyPoly(a){if(this.isZero()||a.isZero())return this.field.zero;let b=this.coefficients,c=b.length;a=a.coefficients;let d=a.length,e=new Uint8ClampedArray(c+d-1);for(let h=0;h<c;h++){let c=b[h];for(let b=0;b<d;b++){var f=h+b,g=this.field.multiply(c,a[b]);e[f]=e[h+b]^g}}return new w(this.field,e)}multiplyByMonomial(a,b){if(0>a)throw Error("Invalid degree less than 0");if(0===b)return this.field.zero;\nlet c=this.coefficients.length;a=new Uint8ClampedArray(c+a);for(let d=0;d<c;d++)a[d]=this.field.multiply(this.coefficients[d],b);return new w(this.field,a)}evaluateAt(a){let b=0;if(0===a)return this.getCoefficient(0);let c=this.coefficients.length;if(1===a)return this.coefficients.forEach(a=>{b^=a}),b;b=this.coefficients[0];for(let d=1;d<c;d++)b=J(this.field.multiply(a,b),this.coefficients[d]);return b}}class Y{constructor(a,b,c){this.primitive=a;this.size=b;this.generatorBase=c;this.expTable=Array(this.size);\nthis.logTable=Array(this.size);a=1;for(b=0;b<this.size;b++)this.expTable[b]=a,a*=2,a>=this.size&&(a=(a^this.primitive)&this.size-1);for(a=0;a<this.size-1;a++)this.logTable[this.expTable[a]]=a;this.zero=new w(this,Uint8ClampedArray.from([0]));this.one=new w(this,Uint8ClampedArray.from([1]))}multiply(a,b){return 0===a||0===b?0:this.expTable[(this.logTable[a]+this.logTable[b])%(this.size-1)]}inverse(a){if(0===a)throw Error("Can\'t invert 0");return this.expTable[this.size-this.logTable[a]-1]}buildMonomial(a,\nb){if(0>a)throw Error("Invalid monomial degree less than 0");if(0===b)return this.zero;a=new Uint8ClampedArray(a+1);a[0]=b;return new w(this,a)}log(a){if(0===a)throw Error("Can\'t take log(0)");return this.logTable[a]}exp(a){return this.expTable[a]}}let K=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,\necBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},\n{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,\ndataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},\n{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},\n{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},\n{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,\ndataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,\ndataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},\n{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},\n{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},\n{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},\n{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,\necBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,\ndataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,\ndataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,\ndataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,\n32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},\n{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},\n{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,\ndataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},\n{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,\necBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},\n{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},\n{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,\necBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,\n30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},\n{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,\ndataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},\n{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,\ndataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},\n{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,\ndataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}],da=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,\ndataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,\nformatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,\ndataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,\ndataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],aa=[a=>0===(a.y+a.x)%2,a=>0===a.y%2,a=>0===a.x%3,a=>0===(a.y+a.x)%3,a=>0===(Math.floor(a.y/2)+Math.floor(a.x/3))%2,a=>0===a.x*a.y%2+a.x*a.y%3,a=>0===(a.y*a.x%2+a.y*a.x%3)%2,a=>0===((a.y+a.x)%2+a.y*a.x%3)%2],y=(a,b)=>Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2)),la={inversionAttempts:"attemptBoth",greyScaleWeights:{red:.2126,green:.7152,blue:.0722,useIntegerApproximation:!1},\ncanOverwriteImage:!0};I.default=I;let G="dontInvert",D={red:77,green:150,blue:29,useIntegerApproximation:!0};self.onmessage=a=>{let b=a.data.data;switch(a.data.type){case "decode":a=I(b.data,b.width,b.height,{inversionAttempts:G,greyScaleWeights:D});self.postMessage({type:"qrResult",data:a?a.data:null});break;case "grayscaleWeights":D.red=b.red;D.green=b.green;D.blue=b.blue;D.useIntegerApproximation=b.useIntegerApproximation;break;case "inversionMode":switch(b){case "original":G="dontInvert";break;\ncase "invert":G="onlyInvert";break;case "both":G="attemptBoth";break;default:throw Error("Invalid inversion mode");}break;case "close":self.close()}}})()\n\n']))},ui=on(),di=function(){function e(r){var n=this,o=r.container,a=r.lang,i=void 0===a?"en":a,s=r.assetRoot,c=void 0===s?"https://unpkg.com/@tsocial/tvweb-sdk@latest/assets":s,l=r.resourceRoot,u=r.customUrls,d=void 0===u?{}:u,f=r.enableAntiDebug,p=void 0===f||f,h=r.warmupMessage,m=r.baseComponent,g=r.component,v=void 0===g?{}:g;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),H(this,"initNativeCamera",(function(e){var r=document.createElement("div");document.body.appendChild(r);var o=t.createRef(),a=n.component.NativeCamera;return C.render(t.createElement(a,q({},e,{ref:o})),r),{openCamera:function(){o.current.click()}}})),H(this,"runWarmUpReadIDCard",K(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.commonSettings.customUrls,e.abrupt("return",n.component.warmUpReadIdCard(t));case 2:case"end":return e.stop()}}),e)})))),H(this,"runPreloadEKYCResources",K(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=n.commonSettings.customUrls,n.component.preloadEKYCResources(t);case 2:case"end":return e.stop()}}),e)})))),H(this,"destroyView",(function(){C.unmountComponentAtNode(n.container)})),function(e,t,r,n,o,a,i,s){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,o,a,i,s],u=0;(c=new Error(t.replace(/%s/g,(function(){return l[u++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}}(o,"container is a required parameter"),this.container=o,this.container.style="touch-action: none; -ms-touch-action: none;";var y=Vr({resourceRoot:l,initCustomUrls:d});this.commonSettings={lang:i,assetRoot:c,customUrls:y,enableAntiDebug:p,debug:!1,warmupMessage:h},this.component=W(W({},m),v)}var r;return(r=[{key:"checkCamera",value:function(){return(0,this.component.checkCamera)()}},{key:"getListCamera",value:function(){return(0,this.component.getListCamera)()}},{key:"readIDCardWithApiCall",value:function(e){var r=this.component.ReadIDCardWithApiCall;C.render(t.createElement(Kr,{value:W({},this.commonSettings)},t.createElement(r,q({onClose:this.destroyView},e))),this.container)}},{key:"readIDCardUIOnly",value:function(e){var r=this.component.ReadIDCardUIOnly;C.render(t.createElement(Kr,{value:this.commonSettings},t.createElement(r,q({onClose:this.destroyView},e))),this.container)}},{key:"livenessDetection",value:function(e){var r=this.component.LivenessDetection;C.render(t.createElement(Kr,{value:W({},this.commonSettings)},t.createElement(r,q({onClose:this.destroyView},e))),this.container)}},{key:"compareFaces",value:function(e){var t=e.accessKey,r=e.secretKey,n=e.apiUrl,o=e.image1,a=e.image2,i=e.onSuccess,s=e.onError;Ra(new Gr(t,r,n,{httpHeaders:ui})).compareFaces({image1:{id:o},image2:{id:a}}).then((function(e){i(e)})).catch((function(e){s(e)}))}}])&&function(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)}}(e.prototype,r),e}();function fi(){return"5.11.2"}var pi="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function hi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function mi(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var gi=mi((function(e){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){var n={MOBILE:"mobile",TABLET:"tablet",SMART_TV:"smarttv",CONSOLE:"console",WEARABLE:"wearable",BROWSER:void 0};e.exports={BROWSER_TYPES:{CHROME:"Chrome",FIREFOX:"Firefox",OPERA:"Opera",YANDEX:"Yandex",SAFARI:"Safari",INTERNET_EXPLORER:"Internet Explorer",EDGE:"Edge",CHROMIUM:"Chromium",IE:"IE",MOBILE_SAFARI:"Mobile Safari",EDGE_CHROMIUM:"Edge Chromium"},DEVICE_TYPES:n,OS_TYPES:{IOS:"iOS",ANDROID:"Android",WINDOWS_PHONE:"Windows Phone",WINDOWS:"Windows",MAC_OS:"Mac OS"},defaultData:{isMobile:!1,isTablet:!1,isBrowser:!1,isSmartTV:!1,isConsole:!1,isWearable:!1}}},function(e,t,r){var n,o=r(2),a=r(0),i=a.BROWSER_TYPES,s=a.OS_TYPES,c=a.DEVICE_TYPES,l=r(4),u=l.checkType,d=l.broPayload,f=l.mobilePayload,p=l.wearPayload,h=l.consolePayload,m=l.stvPayload,g=l.getNavigatorInstance,v=l.isIOS13Check,y=new o,b=y.getBrowser(),C=y.getDevice(),w=y.getEngine(),k=y.getOS(),B=y.getUA(),E=i.CHROME,S=i.CHROMIUM,A=i.IE,_=i.INTERNET_EXPLORER,I=i.OPERA,T=i.FIREFOX,P=i.SAFARI,x=i.EDGE,R=i.YANDEX,N=i.MOBILE_SAFARI,L=c.MOBILE,O=c.TABLET,D=c.SMART_TV,M=c.BROWSER,U=c.WEARABLE,F=c.CONSOLE,j=s.ANDROID,V=s.WINDOWS_PHONE,z=s.IOS,K=s.WINDOWS,H=s.MAC_OS,q=function(){return k.name===s.WINDOWS&&"10"===k.version&&("string"==typeof B&&-1!==B.indexOf("Edg/"))},Q=function(){return b.name===x},W=function(){return v("iPad")},G=C.type===D,X=C.type===F,Y=C.type===U,$=b.name===N||W(),Z=b.name===S,J=function(){switch(C.type){case L:case O:return!0;default:return!1}}()||W(),ee=C.type===L,te=C.type===O||W(),re=C.type===M,ne=k.name===j,oe=k.name===V,ae=k.name===z||W(),ie=b.name===E,se=b.name===T,ce=b.name===P||b.name===N,le=b.name===I,ue=b.name===_||b.name===A,de=k.version?k.version:"none",fe=k.name?k.name:"none",pe=b.major,he=b.version,me=b.name,ge=C.vendor?C.vendor:"none",ve=C.model?C.model:"none",ye=w.name,be=w.version,Ce=B,we=Q()||q(),ke=b.name===R,Be=C.type,Ee=(n=g())&&(/iPad|iPhone|iPod/.test(n.platform)||"MacIntel"===n.platform&&n.maxTouchPoints>1)&&!window.MSStream,Se=W(),Ae=v("iPhone"),_e=v("iPod"),Ie=function(){var e=g(),t=e&&e.userAgent.toLowerCase();return"string"==typeof t&&/electron/.test(t)}(),Te=q(),Pe=Q(),xe=k.name===K,Re=k.name===H,Ne=u(C.type);e.exports={deviceDetect:function(){var e=Ne.isBrowser,t=Ne.isMobile,r=Ne.isTablet,n=Ne.isSmartTV,o=Ne.isConsole,a=Ne.isWearable;return e?d(e,b,w,k,B):n?m(n,w,k,B):o?h(o,w,k,B):t||r?f(Ne,C,k,B):a?p(a,w,k,B):void 0},isSmartTV:G,isConsole:X,isWearable:Y,isMobileSafari:$,isChromium:Z,isMobile:J,isMobileOnly:ee,isTablet:te,isBrowser:re,isAndroid:ne,isWinPhone:oe,isIOS:ae,isChrome:ie,isFirefox:se,isSafari:ce,isOpera:le,isIE:ue,osVersion:de,osName:fe,fullBrowserVersion:pe,browserVersion:he,browserName:me,mobileVendor:ge,mobileModel:ve,engineName:ye,engineVersion:be,getUA:Ce,isEdge:we,isYandex:ke,deviceType:Be,isIOS13:Ee,isIPad13:Se,isIPhone13:Ae,isIPod13:_e,isElectron:Ie,isEdgeChromium:Te,isLegacyEdge:Pe,isWindows:xe,isMacOs:Re}},function(e,t,r){var n;
|
|
42
42
|
/*!
|
|
43
43
|
* UAParser.js v0.7.18
|
|
44
44
|
* Lightweight JavaScript-based User-Agent string parser
|
|
@@ -46,7 +46,7 @@ function(e){var t=r,n=t.lib,o=n.WordArray,a=n.Hasher,i=t.algo,s=o.create([0,1,2,
|
|
|
46
46
|
*
|
|
47
47
|
* Copyright © 2012-2016 Faisal Salman <fyzlman@gmail.com>
|
|
48
48
|
* Dual licensed under GPLv2 or MIT
|
|
49
|
-
*/!function(o,a){var i="function",s="undefined",c="object",l="model",u="name",d="type",f="vendor",p="version",h="architecture",m="console",g="mobile",v="tablet",y="smarttv",b="wearable",C={extend:function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"==typeof e?e.replace(/[^\d\.]/g,"").split(".")[0]:a},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},w={rgx:function(e,t){for(var r,n,o,s,l,u,d=0;d<t.length&&!l;){var f=t[d],p=t[d+1];for(r=n=0;r<f.length&&!l;)if(l=f[r++].exec(e))for(o=0;o<p.length;o++)u=l[++n],typeof(s=p[o])===c&&s.length>0?2==s.length?typeof s[1]==i?this[s[0]]=s[1].call(this,u):this[s[0]]=s[1]:3==s.length?typeof s[1]!==i||s[1].exec&&s[1].test?this[s[0]]=u?u.replace(s[1],s[2]):a:this[s[0]]=u?s[1].call(this,u,s[2]):a:4==s.length&&(this[s[0]]=u?s[3].call(this,u.replace(s[1],s[2])):a):this[s]=u||a;d+=2}},str:function(e,t){for(var r in t)if(typeof t[r]===c&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(C.has(t[r][n],e))return"?"===r?a:r}else if(C.has(t[r],e))return"?"===r?a:r;return e}},k={browser:{oldsafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{amazon:{model:{"Fire Phone":["SD","KF"]}},sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"}}}},B={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[u,p],[/(opios)[\/\s]+([\w\.]+)/i],[[u,"Opera Mini"],p],[/\s(opr)\/([\w\.]+)/i],[[u,"Opera"],p],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]*)/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark)\/([\w\.-]+)/i],[u,p],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[u,"IE"],p],[/(edge|edgios|edgea)\/((\d+)?[\w\.]+)/i],[[u,"Edge"],p],[/(yabrowser)\/([\w\.]+)/i],[[u,"Yandex"],p],[/(puffin)\/([\w\.]+)/i],[[u,"Puffin"],p],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[[u,"UCBrowser"],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(micromessenger)\/([\w\.]+)/i],[[u,"WeChat"],p],[/(qqbrowserlite)\/([\w\.]+)/i],[u,p],[/(QQ)\/([\d\.]+)/i],[u,p],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],[u,p],[/(BIDUBrowser)[\/\s]?([\w\.]+)/i],[u,p],[/(2345Explorer)[\/\s]?([\w\.]+)/i],[u,p],[/(MetaSr)[\/\s]?([\w\.]+)/i],[u],[/(LBBROWSER)/i],[u],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],[p,[u,"Facebook"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[p,[u,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[u,/(.+)/,"$1 WebView"],p],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[[u,/(.+(?:g|us))(.+)/,"$1 $2"],p],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],[p,[u,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[u,p],[/(dolfin)\/([\w\.]+)/i],[[u,"Dolphin"],p],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[u,"Chrome"],p],[/(coast)\/([\w\.]+)/i],[[u,"Opera Coast"],p],[/fxios\/([\w\.-]+)/i],[p,[u,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[p,u],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[[u,"GSA"],p],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[u,[p,w.str,k.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[u,p],[/(navigator|netscape)\/([\w\.-]+)/i],[[u,"Netscape"],p],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[u,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,C.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/windows\s(ce|mobile);\sppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[h,/ower/,"",C.lowerize]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[[h,C.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[l,f,[d,v]],[/applecoremedia\/[\w\.]+ \((ipad)/],[l,[f,"Apple"],[d,v]],[/(apple\s{0,1}tv)/i],[[l,"Apple TV"],[f,"Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(hp).+(tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[f,l,[d,v]],[/(kf[A-z]+)\sbuild\/.+silk\//i],[l,[f,"Amazon"],[d,v]],[/(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i],[[l,w.str,k.device.amazon.model],[f,"Amazon"],[d,g]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[l,f,[d,g]],[/\((ip[honed|\s\w*]+);/i],[l,[f,"Apple"],[d,g]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[f,l,[d,g]],[/\(bb10;\s(\w+)/i],[l,[f,"BlackBerry"],[d,g]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i],[l,[f,"Asus"],[d,v]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[f,"Sony"],[l,"Xperia Tablet"],[d,v]],[/android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i],[l,[f,"Sony"],[d,g]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[f,l,[d,m]],[/android.+;\s(shield)\sbuild/i],[l,[f,"Nvidia"],[d,m]],[/(playstation\s[34portablevi]+)/i],[l,[f,"Sony"],[d,m]],[/(sprint\s(\w+))/i],[[f,w.str,k.device.sprint.vendor],[l,w.str,k.device.sprint.model],[d,g]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[f,l,[d,v]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[f,[l,/_/g," "],[d,g]],[/(nexus\s9)/i],[l,[f,"HTC"],[d,v]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p)/i],[l,[f,"Huawei"],[d,g]],[/(microsoft);\s(lumia[\s\w]+)/i],[f,l,[d,g]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[l,[f,"Microsoft"],[d,m]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[f,"Microsoft"],[d,g]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w*)/i,/(XT\d{3,4}) build\//i,/(nexus\s6)/i],[l,[f,"Motorola"],[d,g]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[l,[f,"Motorola"],[d,v]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[f,C.trim],[l,C.trim],[d,y]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[f,"Samsung"],[d,y]],[/\(dtv[\);].+(aquos)/i],[l,[f,"Sharp"],[d,y]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[f,"Samsung"],l,[d,v]],[/smart-tv.+(samsung)/i],[f,[d,y],l],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i,/sec-((sgh\w+))/i],[[f,"Samsung"],l,[d,g]],[/sie-(\w*)/i],[l,[f,"Siemens"],[d,g]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]*)/i],[[f,"Nokia"],l,[d,g]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[l,[f,"Acer"],[d,v]],[/android.+([vl]k\-?\d{3})\s+build/i],[l,[f,"LG"],[d,v]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[f,"LG"],l,[d,v]],[/(lg) netcast\.tv/i],[f,l,[d,y]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w*)/i,/android.+lg(\-?[\d\w]+)\s+build/i],[l,[f,"LG"],[d,g]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[l,[f,"Lenovo"],[d,v]],[/linux;.+((jolla));/i],[f,l,[d,g]],[/((pebble))app\/[\d\.]+\s/i],[f,l,[d,b]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[f,l,[d,g]],[/crkey/i],[[l,"Chromecast"],[f,"Google"]],[/android.+;\s(glass)\s\d/i],[l,[f,"Google"],[d,b]],[/android.+;\s(pixel c)\s/i],[l,[f,"Google"],[d,v]],[/android.+;\s(pixel xl|pixel)\s/i],[l,[f,"Google"],[d,g]],[/android.+;\s(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i,/android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i],[[l,/_/g," "],[f,"Xiaomi"],[d,g]],[/android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i],[[l,/_/g," "],[f,"Xiaomi"],[d,v]],[/android.+;\s(m[1-5]\snote)\sbuild/i],[l,[f,"Meizu"],[d,v]],[/android.+a000(1)\s+build/i,/android.+oneplus\s(a\d{4})\s+build/i],[l,[f,"OnePlus"],[d,g]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],[l,[f,"RCA"],[d,v]],[/android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i],[l,[f,"Dell"],[d,v]],[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],[l,[f,"Verizon"],[d,v]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[[f,"Barnes & Noble"],l,[d,v]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],[l,[f,"NuVision"],[d,v]],[/android.+;\s(k88)\sbuild/i],[l,[f,"ZTE"],[d,v]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],[l,[f,"Swiss"],[d,g]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],[l,[f,"Swiss"],[d,v]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],[l,[f,"Zeki"],[d,v]],[/(android).+[;\/]\s+([YR]\d{2})\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i],[[f,"Dragon Touch"],l,[d,v]],[/android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i],[l,[f,"Insignia"],[d,v]],[/android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i],[l,[f,"NextBook"],[d,v]],[/android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],[[f,"Voice"],l,[d,g]],[/android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i],[[f,"LvTel"],l,[d,g]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],[l,[f,"Envizen"],[d,v]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i],[f,l,[d,v]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],[l,[f,"MachSpeed"],[d,v]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],[f,l,[d,v]],[/android.+[;\/]\s*TU_(1491)\s+build/i],[l,[f,"Rotor"],[d,v]],[/android.+(KS(.+))\s+build/i],[l,[f,"Amazon"],[d,v]],[/android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i],[f,l,[d,v]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[d,C.lowerize],f,l],[/(android[\w\.\s\-]{0,9});.+build/i],[l,[f,"Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[u,p],[/rv\:([\w\.]{1,9}).+(gecko)/i],[p,u]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[u,p],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[u,[p,w.str,k.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[u,"Windows"],[p,w.str,k.os.windows.version]],[/\((bb)(10);/i],[[u,"BlackBerry"],p],[/(blackberry)\w*\/?([\w\.]*)/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]*)/i,/linux;.+(sailfish);/i],[u,p],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i],[[u,"Symbian"],p],[/\((series40);/i],[u],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[u,"Firefox OS"],p],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i],[u,p],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[u,"Chromium OS"],p],[/(sunos)\s?([\w\.\d]*)/i],[[u,"Solaris"],p],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i],[u,p],[/(haiku)\s(\w+)/i],[u,p],[/cfnetwork\/.+darwin/i,/ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)/i],[[u,"Mac OS"],[p,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]*)/i],[u,p]]},E=function(e,t){if("object"==typeof e&&(t=e,e=a),!(this instanceof E))return new E(e,t).getResult();var r=e||(o&&o.navigator&&o.navigator.userAgent?o.navigator.userAgent:""),n=t?C.extend(B,t):B;return this.getBrowser=function(){var e={name:a,version:a};return w.rgx.call(e,r,n.browser),e.major=C.major(e.version),e},this.getCPU=function(){var e={architecture:a};return w.rgx.call(e,r,n.cpu),e},this.getDevice=function(){var e={vendor:a,model:a,type:a};return w.rgx.call(e,r,n.device),e},this.getEngine=function(){var e={name:a,version:a};return w.rgx.call(e,r,n.engine),e},this.getOS=function(){var e={name:a,version:a};return w.rgx.call(e,r,n.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=e,this},this};E.VERSION="0.7.18",E.BROWSER={NAME:u,MAJOR:"major",VERSION:p},E.CPU={ARCHITECTURE:h},E.DEVICE={MODEL:l,VENDOR:f,TYPE:d,CONSOLE:m,MOBILE:g,SMARTTV:y,TABLET:v,WEARABLE:b,EMBEDDED:"embedded"},E.ENGINE={NAME:u,VERSION:p},E.OS={NAME:u,VERSION:p},typeof t!==s?(typeof e!==s&&e.exports&&(t=e.exports=E),t.UAParser=E):r(3)?(n=function(){return E}.call(t,r,t,e))===a||(e.exports=n):o&&(o.UAParser=E);var S=o&&(o.jQuery||o.Zepto);if(typeof S!==s){var A=new E;S.ua=A.getResult(),S.ua.get=function(){return A.getUA()},S.ua.set=function(e){A.setUA(e);var t=A.getResult();for(var r in t)S.ua[r]=t[r]}}}("object"==typeof window?window:this)},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=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},o=r(0),a=o.DEVICE_TYPES,i=o.defaultData,s=t.getNavigatorInstance=function(){return!("undefined"==typeof window||!window.navigator&&!navigator)&&(window.navigator||navigator)},c=t.isIOS13Check=function(e){var t=s();return t&&t.platform&&(-1!==t.platform.indexOf(e)||"MacIntel"===t.platform&&t.maxTouchPoints>1&&!window.MSStream)};e.exports={checkType:function(e){switch(e){case a.MOBILE:return{isMobile:!0};case a.TABLET:return{isTablet:!0};case a.SMART_TV:return{isSmartTV:!0};case a.CONSOLE:return{isConsole:!0};case a.WEARABLE:return{isWearable:!0};case a.BROWSER:return{isBrowser:!0};default:return i}},broPayload:function(e,t,r,n,o){return{isBrowser:e,browserMajorVersion:t.major,browserFullVersion:t.version,browserName:t.name,engineName:r.name||!1,engineVersion:r.version,osName:n.name,osVersion:n.version,userAgent:o}},mobilePayload:function(e,t,r,o){return n({},e,{vendor:t.vendor,model:t.model,os:r.name,osVersion:r.version,ua:o})},stvPayload:function(e,t,r,n){return{isSmartTV:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},consolePayload:function(e,t,r,n){return{isConsole:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},wearPayload:function(e,t,r,n){return{isWearable:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},getNavigatorInstance:s,isIOS13Check:c}}])})),gi=pi(mi),vi=Object.freeze(Object.assign(Object.create(null),mi,{default:gi})),yi=/^\s+|\s+$/g,bi=/^[-+]0x[0-9a-f]+$/i,Ci=/^0b[01]+$/i,wi=/^0o[0-7]+$/i,ki=parseInt,Bi="object"==typeof fi&&fi&&fi.Object===Object&&fi,Ei="object"==typeof self&&self&&self.Object===Object&&self,Si=Bi||Ei||Function("return this")(),Ai=Object.prototype.toString,_i=Math.max,Ii=Math.min,Ti=function(){return Si.Date.now()};function Pi(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function xi(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==Ai.call(e)}(e))return NaN;if(Pi(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Pi(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(yi,"");var r=Ci.test(e);return r||wi.test(e)?ki(e.slice(2),r?2:8):bi.test(e)?NaN:+e}var Ri=function(e,t,r){var n,o,a,i,s,c,l=0,u=!1,d=!1,f=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var r=n,a=o;return n=o=void 0,l=t,i=e.apply(a,r)}function h(e){return l=e,s=setTimeout(g,t),u?p(e):i}function m(e){var r=e-c;return void 0===c||r>=t||r<0||d&&e-l>=a}function g(){var e=Ti();if(m(e))return v(e);s=setTimeout(g,function(e){var r=t-(e-c);return d?Ii(r,a-(e-l)):r}(e))}function v(e){return s=void 0,f&&n?p(e):(n=o=void 0,i)}function y(){var e=Ti(),r=m(e);if(n=arguments,o=this,c=e,r){if(void 0===s)return h(c);if(d)return s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),i}return t=xi(t)||0,Pi(r)&&(u=!!r.leading,a=(d="maxWait"in r)?_i(xi(r.maxWait)||0,t):a,f="trailing"in r?!!r.trailing:f),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,n=c=o=s=void 0},y.flush=function(){return void 0===s?i:v(Ti())},y},Ni="function"==typeof Symbol&&Symbol.for,Li=Ni?Symbol.for("react.element"):60103,Oi=Ni?Symbol.for("react.portal"):60106,Di=Ni?Symbol.for("react.fragment"):60107,Mi=Ni?Symbol.for("react.strict_mode"):60108,Ui=Ni?Symbol.for("react.profiler"):60114,ji=Ni?Symbol.for("react.provider"):60109,Fi=Ni?Symbol.for("react.context"):60110,Vi=Ni?Symbol.for("react.async_mode"):60111,zi=Ni?Symbol.for("react.concurrent_mode"):60111,Ki=Ni?Symbol.for("react.forward_ref"):60112,Hi=Ni?Symbol.for("react.suspense"):60113,qi=Ni?Symbol.for("react.suspense_list"):60120,Qi=Ni?Symbol.for("react.memo"):60115,Wi=Ni?Symbol.for("react.lazy"):60116,Gi=Ni?Symbol.for("react.block"):60121,Xi=Ni?Symbol.for("react.fundamental"):60117,Yi=Ni?Symbol.for("react.responder"):60118,$i=Ni?Symbol.for("react.scope"):60119;
|
|
49
|
+
*/!function(o,a){var i="function",s="undefined",c="object",l="model",u="name",d="type",f="vendor",p="version",h="architecture",m="console",g="mobile",v="tablet",y="smarttv",b="wearable",C={extend:function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"==typeof e?e.replace(/[^\d\.]/g,"").split(".")[0]:a},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},w={rgx:function(e,t){for(var r,n,o,s,l,u,d=0;d<t.length&&!l;){var f=t[d],p=t[d+1];for(r=n=0;r<f.length&&!l;)if(l=f[r++].exec(e))for(o=0;o<p.length;o++)u=l[++n],typeof(s=p[o])===c&&s.length>0?2==s.length?typeof s[1]==i?this[s[0]]=s[1].call(this,u):this[s[0]]=s[1]:3==s.length?typeof s[1]!==i||s[1].exec&&s[1].test?this[s[0]]=u?u.replace(s[1],s[2]):a:this[s[0]]=u?s[1].call(this,u,s[2]):a:4==s.length&&(this[s[0]]=u?s[3].call(this,u.replace(s[1],s[2])):a):this[s]=u||a;d+=2}},str:function(e,t){for(var r in t)if(typeof t[r]===c&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(C.has(t[r][n],e))return"?"===r?a:r}else if(C.has(t[r],e))return"?"===r?a:r;return e}},k={browser:{oldsafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{amazon:{model:{"Fire Phone":["SD","KF"]}},sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"}}}},B={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[u,p],[/(opios)[\/\s]+([\w\.]+)/i],[[u,"Opera Mini"],p],[/\s(opr)\/([\w\.]+)/i],[[u,"Opera"],p],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]*)/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark)\/([\w\.-]+)/i],[u,p],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[u,"IE"],p],[/(edge|edgios|edgea)\/((\d+)?[\w\.]+)/i],[[u,"Edge"],p],[/(yabrowser)\/([\w\.]+)/i],[[u,"Yandex"],p],[/(puffin)\/([\w\.]+)/i],[[u,"Puffin"],p],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[[u,"UCBrowser"],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(micromessenger)\/([\w\.]+)/i],[[u,"WeChat"],p],[/(qqbrowserlite)\/([\w\.]+)/i],[u,p],[/(QQ)\/([\d\.]+)/i],[u,p],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],[u,p],[/(BIDUBrowser)[\/\s]?([\w\.]+)/i],[u,p],[/(2345Explorer)[\/\s]?([\w\.]+)/i],[u,p],[/(MetaSr)[\/\s]?([\w\.]+)/i],[u],[/(LBBROWSER)/i],[u],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],[p,[u,"Facebook"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[p,[u,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[u,/(.+)/,"$1 WebView"],p],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[[u,/(.+(?:g|us))(.+)/,"$1 $2"],p],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],[p,[u,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[u,p],[/(dolfin)\/([\w\.]+)/i],[[u,"Dolphin"],p],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[u,"Chrome"],p],[/(coast)\/([\w\.]+)/i],[[u,"Opera Coast"],p],[/fxios\/([\w\.-]+)/i],[p,[u,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[p,u],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[[u,"GSA"],p],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[u,[p,w.str,k.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[u,p],[/(navigator|netscape)\/([\w\.-]+)/i],[[u,"Netscape"],p],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[u,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,C.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/windows\s(ce|mobile);\sppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[h,/ower/,"",C.lowerize]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[[h,C.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[l,f,[d,v]],[/applecoremedia\/[\w\.]+ \((ipad)/],[l,[f,"Apple"],[d,v]],[/(apple\s{0,1}tv)/i],[[l,"Apple TV"],[f,"Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(hp).+(tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[f,l,[d,v]],[/(kf[A-z]+)\sbuild\/.+silk\//i],[l,[f,"Amazon"],[d,v]],[/(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i],[[l,w.str,k.device.amazon.model],[f,"Amazon"],[d,g]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[l,f,[d,g]],[/\((ip[honed|\s\w*]+);/i],[l,[f,"Apple"],[d,g]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[f,l,[d,g]],[/\(bb10;\s(\w+)/i],[l,[f,"BlackBerry"],[d,g]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i],[l,[f,"Asus"],[d,v]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[f,"Sony"],[l,"Xperia Tablet"],[d,v]],[/android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i],[l,[f,"Sony"],[d,g]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[f,l,[d,m]],[/android.+;\s(shield)\sbuild/i],[l,[f,"Nvidia"],[d,m]],[/(playstation\s[34portablevi]+)/i],[l,[f,"Sony"],[d,m]],[/(sprint\s(\w+))/i],[[f,w.str,k.device.sprint.vendor],[l,w.str,k.device.sprint.model],[d,g]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[f,l,[d,v]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[f,[l,/_/g," "],[d,g]],[/(nexus\s9)/i],[l,[f,"HTC"],[d,v]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p)/i],[l,[f,"Huawei"],[d,g]],[/(microsoft);\s(lumia[\s\w]+)/i],[f,l,[d,g]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[l,[f,"Microsoft"],[d,m]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[f,"Microsoft"],[d,g]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w*)/i,/(XT\d{3,4}) build\//i,/(nexus\s6)/i],[l,[f,"Motorola"],[d,g]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[l,[f,"Motorola"],[d,v]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[f,C.trim],[l,C.trim],[d,y]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[f,"Samsung"],[d,y]],[/\(dtv[\);].+(aquos)/i],[l,[f,"Sharp"],[d,y]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[f,"Samsung"],l,[d,v]],[/smart-tv.+(samsung)/i],[f,[d,y],l],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i,/sec-((sgh\w+))/i],[[f,"Samsung"],l,[d,g]],[/sie-(\w*)/i],[l,[f,"Siemens"],[d,g]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]*)/i],[[f,"Nokia"],l,[d,g]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[l,[f,"Acer"],[d,v]],[/android.+([vl]k\-?\d{3})\s+build/i],[l,[f,"LG"],[d,v]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[f,"LG"],l,[d,v]],[/(lg) netcast\.tv/i],[f,l,[d,y]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w*)/i,/android.+lg(\-?[\d\w]+)\s+build/i],[l,[f,"LG"],[d,g]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[l,[f,"Lenovo"],[d,v]],[/linux;.+((jolla));/i],[f,l,[d,g]],[/((pebble))app\/[\d\.]+\s/i],[f,l,[d,b]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[f,l,[d,g]],[/crkey/i],[[l,"Chromecast"],[f,"Google"]],[/android.+;\s(glass)\s\d/i],[l,[f,"Google"],[d,b]],[/android.+;\s(pixel c)\s/i],[l,[f,"Google"],[d,v]],[/android.+;\s(pixel xl|pixel)\s/i],[l,[f,"Google"],[d,g]],[/android.+;\s(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i,/android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i],[[l,/_/g," "],[f,"Xiaomi"],[d,g]],[/android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i],[[l,/_/g," "],[f,"Xiaomi"],[d,v]],[/android.+;\s(m[1-5]\snote)\sbuild/i],[l,[f,"Meizu"],[d,v]],[/android.+a000(1)\s+build/i,/android.+oneplus\s(a\d{4})\s+build/i],[l,[f,"OnePlus"],[d,g]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],[l,[f,"RCA"],[d,v]],[/android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i],[l,[f,"Dell"],[d,v]],[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],[l,[f,"Verizon"],[d,v]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[[f,"Barnes & Noble"],l,[d,v]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],[l,[f,"NuVision"],[d,v]],[/android.+;\s(k88)\sbuild/i],[l,[f,"ZTE"],[d,v]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],[l,[f,"Swiss"],[d,g]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],[l,[f,"Swiss"],[d,v]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],[l,[f,"Zeki"],[d,v]],[/(android).+[;\/]\s+([YR]\d{2})\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i],[[f,"Dragon Touch"],l,[d,v]],[/android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i],[l,[f,"Insignia"],[d,v]],[/android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i],[l,[f,"NextBook"],[d,v]],[/android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],[[f,"Voice"],l,[d,g]],[/android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i],[[f,"LvTel"],l,[d,g]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],[l,[f,"Envizen"],[d,v]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i],[f,l,[d,v]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],[l,[f,"MachSpeed"],[d,v]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],[f,l,[d,v]],[/android.+[;\/]\s*TU_(1491)\s+build/i],[l,[f,"Rotor"],[d,v]],[/android.+(KS(.+))\s+build/i],[l,[f,"Amazon"],[d,v]],[/android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i],[f,l,[d,v]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[d,C.lowerize],f,l],[/(android[\w\.\s\-]{0,9});.+build/i],[l,[f,"Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[u,p],[/rv\:([\w\.]{1,9}).+(gecko)/i],[p,u]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[u,p],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[u,[p,w.str,k.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[u,"Windows"],[p,w.str,k.os.windows.version]],[/\((bb)(10);/i],[[u,"BlackBerry"],p],[/(blackberry)\w*\/?([\w\.]*)/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]*)/i,/linux;.+(sailfish);/i],[u,p],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i],[[u,"Symbian"],p],[/\((series40);/i],[u],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[u,"Firefox OS"],p],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i],[u,p],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[u,"Chromium OS"],p],[/(sunos)\s?([\w\.\d]*)/i],[[u,"Solaris"],p],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i],[u,p],[/(haiku)\s(\w+)/i],[u,p],[/cfnetwork\/.+darwin/i,/ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)/i],[[u,"Mac OS"],[p,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]*)/i],[u,p]]},E=function(e,t){if("object"==typeof e&&(t=e,e=a),!(this instanceof E))return new E(e,t).getResult();var r=e||(o&&o.navigator&&o.navigator.userAgent?o.navigator.userAgent:""),n=t?C.extend(B,t):B;return this.getBrowser=function(){var e={name:a,version:a};return w.rgx.call(e,r,n.browser),e.major=C.major(e.version),e},this.getCPU=function(){var e={architecture:a};return w.rgx.call(e,r,n.cpu),e},this.getDevice=function(){var e={vendor:a,model:a,type:a};return w.rgx.call(e,r,n.device),e},this.getEngine=function(){var e={name:a,version:a};return w.rgx.call(e,r,n.engine),e},this.getOS=function(){var e={name:a,version:a};return w.rgx.call(e,r,n.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=e,this},this};E.VERSION="0.7.18",E.BROWSER={NAME:u,MAJOR:"major",VERSION:p},E.CPU={ARCHITECTURE:h},E.DEVICE={MODEL:l,VENDOR:f,TYPE:d,CONSOLE:m,MOBILE:g,SMARTTV:y,TABLET:v,WEARABLE:b,EMBEDDED:"embedded"},E.ENGINE={NAME:u,VERSION:p},E.OS={NAME:u,VERSION:p},typeof t!==s?(typeof e!==s&&e.exports&&(t=e.exports=E),t.UAParser=E):r(3)?(n=function(){return E}.call(t,r,t,e))===a||(e.exports=n):o&&(o.UAParser=E);var S=o&&(o.jQuery||o.Zepto);if(typeof S!==s){var A=new E;S.ua=A.getResult(),S.ua.get=function(){return A.getUA()},S.ua.set=function(e){A.setUA(e);var t=A.getResult();for(var r in t)S.ua[r]=t[r]}}}("object"==typeof window?window:this)},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=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},o=r(0),a=o.DEVICE_TYPES,i=o.defaultData,s=t.getNavigatorInstance=function(){return!("undefined"==typeof window||!window.navigator&&!navigator)&&(window.navigator||navigator)},c=t.isIOS13Check=function(e){var t=s();return t&&t.platform&&(-1!==t.platform.indexOf(e)||"MacIntel"===t.platform&&t.maxTouchPoints>1&&!window.MSStream)};e.exports={checkType:function(e){switch(e){case a.MOBILE:return{isMobile:!0};case a.TABLET:return{isTablet:!0};case a.SMART_TV:return{isSmartTV:!0};case a.CONSOLE:return{isConsole:!0};case a.WEARABLE:return{isWearable:!0};case a.BROWSER:return{isBrowser:!0};default:return i}},broPayload:function(e,t,r,n,o){return{isBrowser:e,browserMajorVersion:t.major,browserFullVersion:t.version,browserName:t.name,engineName:r.name||!1,engineVersion:r.version,osName:n.name,osVersion:n.version,userAgent:o}},mobilePayload:function(e,t,r,o){return n({},e,{vendor:t.vendor,model:t.model,os:r.name,osVersion:r.version,ua:o})},stvPayload:function(e,t,r,n){return{isSmartTV:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},consolePayload:function(e,t,r,n){return{isConsole:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},wearPayload:function(e,t,r,n){return{isWearable:e,engineName:t.name,engineVersion:t.version,osName:r.name,osVersion:r.version,userAgent:n}},getNavigatorInstance:s,isIOS13Check:c}}])})),vi=hi(gi),yi=Object.freeze(Object.assign(Object.create(null),gi,{default:vi})),bi=/^\s+|\s+$/g,Ci=/^[-+]0x[0-9a-f]+$/i,wi=/^0b[01]+$/i,ki=/^0o[0-7]+$/i,Bi=parseInt,Ei="object"==typeof pi&&pi&&pi.Object===Object&&pi,Si="object"==typeof self&&self&&self.Object===Object&&self,Ai=Ei||Si||Function("return this")(),_i=Object.prototype.toString,Ii=Math.max,Ti=Math.min,Pi=function(){return Ai.Date.now()};function xi(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ri(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==_i.call(e)}(e))return NaN;if(xi(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=xi(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(bi,"");var r=wi.test(e);return r||ki.test(e)?Bi(e.slice(2),r?2:8):Ci.test(e)?NaN:+e}var Ni=function(e,t,r){var n,o,a,i,s,c,l=0,u=!1,d=!1,f=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var r=n,a=o;return n=o=void 0,l=t,i=e.apply(a,r)}function h(e){return l=e,s=setTimeout(g,t),u?p(e):i}function m(e){var r=e-c;return void 0===c||r>=t||r<0||d&&e-l>=a}function g(){var e=Pi();if(m(e))return v(e);s=setTimeout(g,function(e){var r=t-(e-c);return d?Ti(r,a-(e-l)):r}(e))}function v(e){return s=void 0,f&&n?p(e):(n=o=void 0,i)}function y(){var e=Pi(),r=m(e);if(n=arguments,o=this,c=e,r){if(void 0===s)return h(c);if(d)return s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),i}return t=Ri(t)||0,xi(r)&&(u=!!r.leading,a=(d="maxWait"in r)?Ii(Ri(r.maxWait)||0,t):a,f="trailing"in r?!!r.trailing:f),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,n=c=o=s=void 0},y.flush=function(){return void 0===s?i:v(Pi())},y},Li="function"==typeof Symbol&&Symbol.for,Oi=Li?Symbol.for("react.element"):60103,Di=Li?Symbol.for("react.portal"):60106,Mi=Li?Symbol.for("react.fragment"):60107,Ui=Li?Symbol.for("react.strict_mode"):60108,Fi=Li?Symbol.for("react.profiler"):60114,ji=Li?Symbol.for("react.provider"):60109,Vi=Li?Symbol.for("react.context"):60110,zi=Li?Symbol.for("react.async_mode"):60111,Ki=Li?Symbol.for("react.concurrent_mode"):60111,Hi=Li?Symbol.for("react.forward_ref"):60112,qi=Li?Symbol.for("react.suspense"):60113,Qi=Li?Symbol.for("react.suspense_list"):60120,Wi=Li?Symbol.for("react.memo"):60115,Gi=Li?Symbol.for("react.lazy"):60116,Xi=Li?Symbol.for("react.block"):60121,Yi=Li?Symbol.for("react.fundamental"):60117,$i=Li?Symbol.for("react.responder"):60118,Zi=Li?Symbol.for("react.scope"):60119;
|
|
50
50
|
/** @license React v16.13.1
|
|
51
51
|
* react-is.production.min.js
|
|
52
52
|
*
|
|
@@ -54,4 +54,4 @@ function(e){var t=r,n=t.lib,o=n.WordArray,a=n.Hasher,i=t.algo,s=o.create([0,1,2,
|
|
|
54
54
|
*
|
|
55
55
|
* This source code is licensed under the MIT license found in the
|
|
56
56
|
* LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/function Zi(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case Li:switch(e=e.type){case Vi:case zi:case Di:case Ui:case Mi:case Hi:return e;default:switch(e=e&&e.$$typeof){case Fi:case Ki:case Wi:case Qi:case ji:return e;default:return t}}case Oi:return t}}}function Ji(e){return Zi(e)===zi}var es={AsyncMode:Vi,ConcurrentMode:zi,ContextConsumer:Fi,ContextProvider:ji,Element:Li,ForwardRef:Ki,Fragment:Di,Lazy:Wi,Memo:Qi,Portal:Oi,Profiler:Ui,StrictMode:Mi,Suspense:Hi,isAsyncMode:function(e){return Ji(e)||Zi(e)===Vi},isConcurrentMode:Ji,isContextConsumer:function(e){return Zi(e)===Fi},isContextProvider:function(e){return Zi(e)===ji},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===Li},isForwardRef:function(e){return Zi(e)===Ki},isFragment:function(e){return Zi(e)===Di},isLazy:function(e){return Zi(e)===Wi},isMemo:function(e){return Zi(e)===Qi},isPortal:function(e){return Zi(e)===Oi},isProfiler:function(e){return Zi(e)===Ui},isStrictMode:function(e){return Zi(e)===Mi},isSuspense:function(e){return Zi(e)===Hi},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===Di||e===zi||e===Ui||e===Mi||e===Hi||e===qi||"object"==typeof e&&null!==e&&(e.$$typeof===Wi||e.$$typeof===Qi||e.$$typeof===ji||e.$$typeof===Fi||e.$$typeof===Ki||e.$$typeof===Xi||e.$$typeof===Yi||e.$$typeof===$i||e.$$typeof===Gi)},typeOf:Zi},ts=(hi((function(e,t){})),hi((function(e){e.exports=es}))),rs={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},ns={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},os={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},as={};function is(e){return ts.isMemo(e)?os:as[e.$$typeof]||rs}as[ts.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},as[ts.Memo]=os;var ss=Object.defineProperty,cs=Object.getOwnPropertyNames,ls=Object.getOwnPropertySymbols,us=Object.getOwnPropertyDescriptor,ds=Object.getPrototypeOf,fs=Object.prototype;var ps,hs,ms,gs,vs,ys=function e(t,r,n){if("string"!=typeof r){if(fs){var o=ds(r);o&&o!==fs&&e(t,o,n)}var a=cs(r);ls&&(a=a.concat(ls(r)));for(var i=is(t),s=is(r),c=0;c<a.length;++c){var l=a[c];if(!(ns[l]||n&&n[l]||s&&s[l]||i&&i[l])){var u=us(r,l);try{ss(t,l,u)}catch(e){}}}}return t};function bs(){return"function"==typeof navigator.enumerateDevices?navigator.enumerateDevices():"object"===w(navigator.mediaDevices)&&"function"==typeof navigator.mediaDevices.enumerateDevices?navigator.mediaDevices.enumerateDevices():new Promise((function(e,t){try{if(null==window.MediaStreamTrack||null==window.MediaStreamTrack.getSources)throw new Error;window.MediaStreamTrack.getSources((function(t){e(t.filter((function(e){return"video"===e.kind.toLowerCase()||"videoinput"===e.kind.toLowerCase()})).map((function(e){return{deviceId:null!=e.deviceId?e.deviceId:"",groupId:e.groupId,kind:"videoinput",label:e.label,toJSON:function(){return this}}})))}))}catch(e){return t(e)}}))}var Cs=V.Errors,ws=1e3,ks=h.div(ps||(ps=N(["\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: #000;\n display: flex;\n justify-content: center;\n z-index: ",";\n ","\n"])),1e3,(function(e){return e.checkCameraMode&&"opacity: 0;"})),Bs=h.video(hs||(hs=N(["\n width: 100%;\n ","\n"])),(function(e){return e.flipHorizontal&&"\n transform: scale(".concat(-1*e.scale,", ").concat(1*e.scale,");\n ")})),Es=h.div(ms||(ms=N(["\n cursor: pointer;\n text-align: center;\n width: 50px;\n\n img {\n width: 100%;\n }\n"]))),Ss=h(Es)(gs||(gs=N(["\n z-index: ",";\n position: absolute;\n top: 20px;\n right: 20px;\n width: 20px;\n"])),1100),As=h.div(vs||(vs=N(["\n z-index: ",";\n position: absolute;\n top: 40px;\n color: red;\n"])),1020),_s=t.createRef(),Is=function(){if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)return navigator.mediaDevices;var e=navigator.mozGetUserMedia||navigator.webkitGetUserMedia;return e?{getUserMedia:function(t){return new Promise((function(r,n){e.call(navigator,t,r,n)}))}}:null}();function Ts(e){var n=e.checkCameraMode,a=e.frontCamera,i=e.onClose,l=e.children,u=e.onVideoPlayed,d=e.flipHorizontal,f=e.videoSettings,p=e.refVideo,h=e.onError,m=e.closeButton,g=e.videoClassName,v=e.scale,y=e.defaultCameraId,b=e.onWarning,C=Qr.useSDKSettings().lang,w=Sn.useSDKTracking().sendEvent,k=In.useAsset("ic_close.png"),E=L(s(""),2),S=E[0],A=E[1],_=r(!1),T=r(!1),P=r(!1),x=o((function(){try{var e;(null==p||null===(e=p.current)||void 0===e?void 0:e.srcObject)instanceof MediaStream&&(p.current.srcObject.getTracks().forEach((function(e){return e.stop()})),p.current.srcObject=null)}catch(e){}}),[p]);c((function(){return function(){P.current=!0}}),[]);var R=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.length>1&&void 0!==i[1]&&i[1],n={},!1!==window.tv_last_req_camera_complete){e.next=5;break}return b("too_many_request_to_camera"),e.abrupt("return",new Promise((function(e){return e(null)})));case 5:return window.tv_last_req_camera_complete=!1,n=mi.isMobile?mi.isIOS?{width:{ideal:1460},aspectRatio:{ideal:window.innerHeight/window.innerWidth}}:{width:{ideal:1650},aspectRatio:{ideal:window.innerHeight/window.innerWidth}}:{height:{ideal:9999}},e.prev=7,e.next=10,Is.getUserMedia({audio:!1,video:I(I({},t?{deviceId:t}:{facingMode:a?"user":"environment"}),r?{}:f||n)});case 10:return(o=e.sent)||(A(Cs.not_supported.msg[C]),h(Cs.not_supported)),window.tv_last_req_camera_complete=!0,e.abrupt("return",o);case 16:e.prev=16,e.t0=e.catch(7),"NotAllowedError"===e.t0.name?(A(Cs.no_permission.msg[C]),h(Cs.no_permission),T.current=!0):T.current&&("NotReadableError"===e.t0.name?(h(Cs.not_readable),A(Cs.not_readable.msg[C])):(A(e.t0.message),h({code:e.t0.name||e.t0.code,message:e.t0.message})));case 19:return window.tv_last_req_camera_complete=!0,e.abrupt("return",null);case 21:case"end":return e.stop()}}),e,null,[[7,16]])})));return function(t){return e.apply(this,arguments)}}(),[a,f,C,h,b]),N=o(B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=s.length>0&&void 0!==s[0]?s[0]:y,o=s.length>1&&void 0!==s[1]&&s[1],!(null!=(a=p.current)&&null!==(t=a.srcObject)&&void 0!==t&&t.id&&null!=a&&null!==(r=a.srcObject)&&void 0!==r&&r.active&&_.current)){e.next=5;break}return e.abrupt("return");case 5:return a.oncanplaythrough=function(){a.play(),_.current=!0,A("");var e=window.innerWidth,t=window.innerHeight,r=ro.analyzeVideoAndWindowSizes(a),n=r.lostX,o=void 0===n?0:n,i=r.lostY,s=void 0===i?0:i,c=Math.min(e,Math.floor(e-2*o)),l=Math.min(t,Math.floor(t-2*s));u&&u({clientWidth:e,clientHeight:t,videoAreaWidth:c,videoAreaHeight:l,lostX:o,lostY:s})},e.next=8,R(n,o);case 8:(i=e.sent)||T.current||(T.current=!0,N(n,!0)),i&&P.current&&(p.current.srcObject=i,x()),i&&!P.current&&(a.srcObject=i);case 12:case"end":return e.stop()}}),e)}))),[p,R,u,y,x]);c((function(){function e(){return(e=B(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N();case 2:return e.next=4,bs();case 4:t=e.sent,(r=t.filter((function(e){return"videoinput"===e.kind&&e.label.includes("back")&&e.label.includes("0")}))).length>0&&(n=r[0].deviceId,x(),N(n));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var t=p.current;return!Is||mi.browserName&&["facebook"].includes(mi.browserName.toLowerCase())||mi.getUA.includes("Zalo iOS")?(A(Cs.not_supported.msg[C]),h(Cs.not_supported)):t&&(mi.isAndroid&&!1===a?function(){e.apply(this,arguments)}():N()),function(){P.current&&x()}}),[p,C,a,N,x,h]),c((function(){var e=setTimeout((function(){_.current||(A(Cs.camera_timeout.msg[C]),h(Cs.camera_timeout))}),15e3);return function(){clearTimeout(e)}}),[C,h]);var O=o((function(){x(),i&&i(),w({tag:"result",event:"user_activity.cancel",log:{}})}),[i,x,w]);return t.createElement(ks,{checkCameraMode:n},function(){if(!S)return null;var e=Cs.no_permission.msg[C];return S===e&&mi.isIOS?t.createElement(As,null,S," ",t.createElement("button",{onClick:function(){window.location.reload()}},{vi:"Cấp lại quyền truy cập camera",en:"Request camera permission"}[C])):t.createElement(As,null,S)}(),t.createElement(Bs,{ref:p,playsInline:!0,muted:!0,flipHorizontal:d,className:g,scale:v}),l,m?t.cloneElement(m,{onClick:O,"data-testid":"close-camera"}):t.createElement(Ss,{onClick:O,"data-testid":"close-camera"},t.createElement("img",{src:k,alt:""})))}Ts.propTypes={checkCameraMode:p.bool,frontCamera:p.bool,onClose:p.func,onError:p.func,onVideoPlayed:p.func,children:p.node,flipHorizontal:p.bool,videoSettings:p.object,refVideo:p.object,closeButton:p.node,videoClassName:p.string,scale:p.number,defaultCameraId:p.string,onWarning:p.func},Ts.defaultProps={checkCameraMode:!1,frontCamera:!0,onClose:null,onError:function(){},onVideoPlayed:null,children:null,flipHorizontal:!1,videoSettings:null,refVideo:null,closeButton:null,videoClassName:"",scale:1,defaultCameraId:void 0,onWarning:function(){}};var Ps,xs,Rs,Ns=function(e,r,n){class o extends i{constructor(){super(...arguments),this.updateDebounced=Ri(this.forceUpdate,r,n)}shouldComponentUpdate(){return this.updateDebounced(),!1}componentWillUnmount(){this.updateDebounced.cancel()}render(){return t.createElement(e,Object.assign({},this.props))}}return o.displayName=`debounceRender(${e.displayName||e.name||"Component"})`,ys(o,e)}(Ts,250),Ls=t.forwardRef((function(e,r){return t.createElement(Ns,A({},e,{refVideo:r||_s}))})),Os=h.table(Ps||(Ps=N(["\n width: 100%;\n height: 100%;\n td {\n text-align: center;\n vertical-align: middle;\n padding: 0;\n border: 0;\n }\n border-spacing: 0;\n table-layout: auto;\n border-collapse: collapse;\n"]))),Ds=h.div(xs||(xs=N(["\n position: relative;\n"]))),Ms=Array.from(Array(3).keys()),Us=Array.from(Array(3).keys());function js(e){var r=e.children,n=e.x,o=e.y,a=e.width,i=e.height,s=e.className,c=e.surroundStyle;return t.createElement(Os,{className:s},t.createElement("tbody",null,Ms.map((function(e,s){return t.createElement("tr",{key:e,style:{height:0===s?o:"auto"},"data-testid":"row"},Us.map((function(e,o){var l=1===s&&1===o,u="auto";return l?u=a:0===o&&(u=n),t.createElement("td",{"data-testid":l?"centeredCell":"cell",key:e,style:I({width:u,height:l?i:"auto"},l?{}:c)},l?t.createElement(Ds,{style:{width:u,height:i}},r):null)})))}))))}js.propTypes={children:p.node,x:p.string,y:p.string,width:p.string,height:p.string,className:p.string,surroundStyle:p.object},js.defaultProps={children:null,x:"auto",y:"auto",width:"auto",height:"auto",className:"",surroundStyle:{}};var Fs=h(js)(Rs||(Rs=N(["\n background: transparent;\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: ",";\n"])),1010);function Vs(e){var r=e.className;return t.createElement("svg",{className:r,width:"38px",height:"32px",viewBox:"0 0 24 21","data-testid":"camera-icon"},t.createElement("title",null,"FA45C15C-1E21-4D7B-9585-07FB9F999CB8"),t.createElement("desc",null,"Created with sketchtool."),t.createElement("g",{id:"Web-demo",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},t.createElement("g",{id:"step1",transform:"translate(-950.000000, -380.000000)",fill:"currentColor",fillRule:"nonzero"},t.createElement("g",{id:"Group",transform:"translate(950.000000, 380.000000)"},t.createElement("g",{id:"Group-2"},t.createElement("g",{id:"camera"},t.createElement("path",{d:"M21,3 L17,3 L15,0 L9,0 L7,3 L3,3 C1.34314575,3 0,4.34314575 0,6 L0,18 C0,19.6568542 1.34314575,21 3,21 L21,21 C22.6568542,21 24,19.6568542 24,18 L24,6 C24,4.34314575 22.6568542,3 21,3 Z M12,17 C9.23857625,17 7,14.7614237 7,12 C7,9.23857625 9.23857625,7 12,7 C14.7614237,7 17,9.23857625 17,12 C17,14.7614237 14.7614237,17 12,17 L12,17 Z",id:"Shape"})))))))}Vs.propTypes={className:p.string},Vs.defaultProps={className:""};var zs=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Ks="object"==typeof fi&&fi&&fi.Object===Object&&fi,Hs="object"==typeof self&&self&&self.Object===Object&&self,qs=Ks||Hs||Function("return this")(),Qs=function(){return qs.Date.now()},Ws=/\s/;var Gs=function(e){for(var t=e.length;t--&&Ws.test(e.charAt(t)););return t},Xs=/^\s+/;var Ys=function(e){return e?e.slice(0,Gs(e)+1).replace(Xs,""):e},$s=qs.Symbol,Zs=Object.prototype,Js=Zs.hasOwnProperty,ec=Zs.toString,tc=$s?$s.toStringTag:void 0;var rc=function(e){var t=Js.call(e,tc),r=e[tc];try{e[tc]=void 0;var n=!0}catch(e){}var o=ec.call(e);return n&&(t?e[tc]=r:delete e[tc]),o},nc=Object.prototype.toString;var oc=function(e){return nc.call(e)},ac=$s?$s.toStringTag:void 0;var ic=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ac&&ac in Object(e)?rc(e):oc(e)};var sc=function(e){return null!=e&&"object"==typeof e};var cc=function(e){return"symbol"==typeof e||sc(e)&&"[object Symbol]"==ic(e)},lc=/^[-+]0x[0-9a-f]+$/i,uc=/^0b[01]+$/i,dc=/^0o[0-7]+$/i,fc=parseInt;var pc=function(e){if("number"==typeof e)return e;if(cc(e))return NaN;if(zs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=zs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ys(e);var r=uc.test(e);return r||dc.test(e)?fc(e.slice(2),r?2:8):lc.test(e)?NaN:+e},hc=Math.max,mc=Math.min;var gc=function(e,t,r){var n,o,a,i,s,c,l=0,u=!1,d=!1,f=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var r=n,a=o;return n=o=void 0,l=t,i=e.apply(a,r)}function h(e){return l=e,s=setTimeout(g,t),u?p(e):i}function m(e){var r=e-c;return void 0===c||r>=t||r<0||d&&e-l>=a}function g(){var e=Qs();if(m(e))return v(e);s=setTimeout(g,function(e){var r=t-(e-c);return d?mc(r,a-(e-l)):r}(e))}function v(e){return s=void 0,f&&n?p(e):(n=o=void 0,i)}function y(){var e=Qs(),r=m(e);if(n=arguments,o=this,c=e,r){if(void 0===s)return h(c);if(d)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),i}return t=pc(t)||0,zs(r)&&(u=!!r.leading,a=(d="maxWait"in r)?hc(pc(r.maxWait)||0,t):a,f="trailing"in r?!!r.trailing:f),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,n=c=o=s=void 0},y.flush=function(){return void 0===s?i:v(Qs())},y};var vc=function(e,t,r){var n=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return zs(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),gc(e,t,{leading:n,maxWait:t,trailing:o})};var yc,bc=function(e){if(!zs(e))return!1;var t=ic(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Cc=qs["__core-js_shared__"],wc=(yc=/[^.]+$/.exec(Cc&&Cc.keys&&Cc.keys.IE_PROTO||""))?"Symbol(src)_1."+yc:"";var kc=function(e){return!!wc&&wc in e},Bc=Function.prototype.toString;var Ec=function(e){if(null!=e){try{return Bc.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Sc=/^\[object .+?Constructor\]$/,Ac=Function.prototype,_c=Object.prototype,Ic=Ac.toString,Tc=_c.hasOwnProperty,Pc=RegExp("^"+Ic.call(Tc).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var xc=function(e){return!(!zs(e)||kc(e))&&(bc(e)?Pc:Sc).test(Ec(e))};var Rc=function(e,t){return null==e?void 0:e[t]};var Nc=function(e,t){var r=Rc(e,t);return xc(r)?r:void 0},Lc=function(){try{var e=Nc(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Oc=function(e,t,r){"__proto__"==t&&Lc?Lc(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r};var Dc=function(e,t){return e===t||e!=e&&t!=t},Mc=Object.prototype.hasOwnProperty;var Uc=function(e,t,r){var n=e[t];Mc.call(e,t)&&Dc(n,r)&&(void 0!==r||t in e)||Oc(e,t,r)};var jc=function(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a<i;){var s=t[a],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),o?Oc(r,s,c):Uc(r,s,c)}return r};var Fc=function(e){return e};var Vc=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)},zc=Math.max;var Kc=function(e,t,r){return t=zc(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=zc(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=n[o];return s[t]=r(i),Vc(e,this,s)}};var Hc=function(e){return function(){return e}},qc=Lc?function(e,t){return Lc(e,"toString",{configurable:!0,enumerable:!1,value:Hc(t),writable:!0})}:Fc,Qc=Date.now;var Wc=function(e){var t=0,r=0;return function(){var n=Qc(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(qc);var Gc=function(e,t){return Wc(Kc(e,t,Fc),e+"")};var Xc=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var Yc=function(e){return null!=e&&Xc(e.length)&&!bc(e)},$c=/^(?:0|[1-9]\d*)$/;var Zc=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&$c.test(e))&&e>-1&&e%1==0&&e<t};var Jc=function(e,t,r){if(!zs(r))return!1;var n=typeof t;return!!("number"==n?Yc(r)&&Zc(t,r.length):"string"==n&&t in r)&&Dc(r[t],e)};var el=function(e){return Gc((function(t,r){var n=-1,o=r.length,a=o>1?r[o-1]:void 0,i=o>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(o--,a):void 0,i&&Jc(r[0],r[1],i)&&(a=o<3?void 0:a,o=1),t=Object(t);++n<o;){var s=r[n];s&&e(t,s,n,a)}return t}))};var tl=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var rl=function(e){return sc(e)&&"[object Arguments]"==ic(e)},nl=Object.prototype,ol=nl.hasOwnProperty,al=nl.propertyIsEnumerable,il=rl(function(){return arguments}())?rl:function(e){return sc(e)&&ol.call(e,"callee")&&!al.call(e,"callee")},sl=Array.isArray;var cl=function(){return!1},ll=hi((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?qs.Buffer:void 0,a=(o?o.isBuffer:void 0)||cl;e.exports=a})),ul={};ul["[object Float32Array]"]=ul["[object Float64Array]"]=ul["[object Int8Array]"]=ul["[object Int16Array]"]=ul["[object Int32Array]"]=ul["[object Uint8Array]"]=ul["[object Uint8ClampedArray]"]=ul["[object Uint16Array]"]=ul["[object Uint32Array]"]=!0,ul["[object Arguments]"]=ul["[object Array]"]=ul["[object ArrayBuffer]"]=ul["[object Boolean]"]=ul["[object DataView]"]=ul["[object Date]"]=ul["[object Error]"]=ul["[object Function]"]=ul["[object Map]"]=ul["[object Number]"]=ul["[object Object]"]=ul["[object RegExp]"]=ul["[object Set]"]=ul["[object String]"]=ul["[object WeakMap]"]=!1;var dl=function(e){return sc(e)&&Xc(e.length)&&!!ul[ic(e)]};var fl=function(e){return function(t){return e(t)}},pl=hi((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r&&Ks.process,a=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a})),hl=pl&&pl.isTypedArray,ml=hl?fl(hl):dl,gl=Object.prototype.hasOwnProperty;var vl=function(e,t){var r=sl(e),n=!r&&il(e),o=!r&&!n&&ll(e),a=!r&&!n&&!o&&ml(e),i=r||n||o||a,s=i?tl(e.length,String):[],c=s.length;for(var l in e)!t&&!gl.call(e,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Zc(l,c))||s.push(l);return s},yl=Object.prototype;var bl=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||yl)};var Cl=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},wl=Object.prototype.hasOwnProperty;var kl=function(e){if(!zs(e))return Cl(e);var t=bl(e),r=[];for(var n in e)("constructor"!=n||!t&&wl.call(e,n))&&r.push(n);return r};var Bl=function(e){return Yc(e)?vl(e,!0):kl(e)},El=el((function(e,t,r,n){jc(t,Bl(t),e,n)}));var Sl=function(e,t){return function(r){return e(t(r))}},Al=Sl(Object.getPrototypeOf,Object),_l=Function.prototype,Il=Object.prototype,Tl=_l.toString,Pl=Il.hasOwnProperty,xl=Tl.call(Object);var Rl=function(e){if(!sc(e)||"[object Object]"!=ic(e))return!1;var t=Al(e);if(null===t)return!0;var r=Pl.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Tl.call(r)==xl};var Nl=function(e){if(!sc(e))return!1;var t=ic(e);return"[object Error]"==t||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Rl(e)},Ll=Gc((function(e,t){try{return Vc(e,void 0,t)}catch(e){return Nl(e)?e:new Error(e)}}));var Ol=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o};var Dl=function(e,t){return Ol(t,(function(t){return e[t]}))},Ml=Object.prototype,Ul=Ml.hasOwnProperty;var jl=function(e,t,r,n){return void 0===e||Dc(e,Ml[r])&&!Ul.call(n,r)?t:e},Fl={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var Vl=function(e){return"\\"+Fl[e]},zl=Sl(Object.keys,Object),Kl=Object.prototype.hasOwnProperty;var Hl=function(e){if(!bl(e))return zl(e);var t=[];for(var r in Object(e))Kl.call(e,r)&&"constructor"!=r&&t.push(r);return t};var ql=function(e){return Yc(e)?vl(e):Hl(e)},Ql=/<%=([\s\S]+?)%>/g;var Wl=function(e){return function(t){return null==e?void 0:e[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'"}),Gl=$s?$s.prototype:void 0,Xl=Gl?Gl.toString:void 0;var Yl=function e(t){if("string"==typeof t)return t;if(sl(t))return Ol(t,e)+"";if(cc(t))return Xl?Xl.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r};var $l=function(e){return null==e?"":Yl(e)},Zl=/[&<>"']/g,Jl=RegExp(Zl.source);var eu={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:Ql,variable:"",imports:{_:{escape:function(e){return(e=$l(e))&&Jl.test(e)?e.replace(Zl,Wl):e}}}},tu=/\b__p \+= '';/g,ru=/\b(__p \+=) '' \+/g,nu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ou=/[()=,{}\[\]\/\s]/,au=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,iu=/($^)/,su=/['\n\r\u2028\u2029\\]/g,cu=Object.prototype.hasOwnProperty;var lu=function(e,t,r){var n=eu.imports._.templateSettings||eu;r&&Jc(e,t,r)&&(t=void 0),e=$l(e),t=El({},t,n,jl);var o,a,i=El({},t.imports,n.imports,jl),s=ql(i),c=Dl(i,s),l=0,u=t.interpolate||iu,d="__p += '",f=RegExp((t.escape||iu).source+"|"+u.source+"|"+(u===Ql?au:iu).source+"|"+(t.evaluate||iu).source+"|$","g"),p=cu.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/\s/g," ")+"\n":"";e.replace(f,(function(t,r,n,i,s,c){return n||(n=i),d+=e.slice(l,c).replace(su,Vl),r&&(o=!0,d+="' +\n__e("+r+") +\n'"),s&&(a=!0,d+="';\n"+s+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),d+="';\n";var h=cu.call(t,"variable")&&t.variable;if(h){if(ou.test(h))throw new Error("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(a?d.replace(tu,""):d).replace(ru,"$1").replace(nu,"$1;"),d="function("+(h||"obj")+") {\n"+(h?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var m=Ll((function(){return Function(s,p+"return "+d).apply(void 0,c)}));if(m.source=d,Nl(m))throw m;return m},uu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,du=/^\w*$/;var fu=function(e,t){if(sl(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!cc(e))||(du.test(e)||!uu.test(e)||null!=t&&e in Object(t))},pu=Nc(Object,"create");var hu=function(){this.__data__=pu?pu(null):{},this.size=0};var mu=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},gu=Object.prototype.hasOwnProperty;var vu=function(e){var t=this.__data__;if(pu){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return gu.call(t,e)?t[e]:void 0},yu=Object.prototype.hasOwnProperty;var bu=function(e){var t=this.__data__;return pu?void 0!==t[e]:yu.call(t,e)};var Cu=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=pu&&void 0===t?"__lodash_hash_undefined__":t,this};function wu(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}wu.prototype.clear=hu,wu.prototype.delete=mu,wu.prototype.get=vu,wu.prototype.has=bu,wu.prototype.set=Cu;var ku=wu;var Bu=function(){this.__data__=[],this.size=0};var Eu=function(e,t){for(var r=e.length;r--;)if(Dc(e[r][0],t))return r;return-1},Su=Array.prototype.splice;var Au=function(e){var t=this.__data__,r=Eu(t,e);return!(r<0)&&(r==t.length-1?t.pop():Su.call(t,r,1),--this.size,!0)};var _u=function(e){var t=this.__data__,r=Eu(t,e);return r<0?void 0:t[r][1]};var Iu=function(e){return Eu(this.__data__,e)>-1};var Tu=function(e,t){var r=this.__data__,n=Eu(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Pu(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Pu.prototype.clear=Bu,Pu.prototype.delete=Au,Pu.prototype.get=_u,Pu.prototype.has=Iu,Pu.prototype.set=Tu;var xu=Pu,Ru=Nc(qs,"Map");var Nu=function(){this.size=0,this.__data__={hash:new ku,map:new(Ru||xu),string:new ku}};var Lu=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ou=function(e,t){var r=e.__data__;return Lu(t)?r["string"==typeof t?"string":"hash"]:r.map};var Du=function(e){var t=Ou(this,e).delete(e);return this.size-=t?1:0,t};var Mu=function(e){return Ou(this,e).get(e)};var Uu=function(e){return Ou(this,e).has(e)};var ju=function(e,t){var r=Ou(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function Fu(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Fu.prototype.clear=Nu,Fu.prototype.delete=Du,Fu.prototype.get=Mu,Fu.prototype.has=Uu,Fu.prototype.set=ju;var Vu=Fu;function zu(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(zu.Cache||Vu),r}zu.Cache=Vu;var Ku=zu;var Hu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qu=/\\(\\)?/g,Qu=function(e){var t=Ku(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Hu,(function(e,r,n,o){t.push(n?o.replace(qu,"$1"):r||e)})),t}));var Wu=function(e,t){return sl(e)?e:fu(e,t)?[e]:Qu($l(e))};var Gu=function(e){if("string"==typeof e||cc(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var Xu=function(e,t){for(var r=0,n=(t=Wu(t,e)).length;null!=e&&r<n;)e=e[Gu(t[r++])];return r&&r==n?e:void 0};var Yu=function(e,t,r){var n=null==e?void 0:Xu(e,t);return void 0===n?r:n},$u=V.Errors;function Zu(e){var t=e.livenessSettings,r=e.apiClient,n=e.apiCheck,o=e.onError,a=L(s({face_tracking_setting:{enable:!1,web_terminate_threshold:.0030152991993743408,web_warning_threshold:.0017317430600108828,limit_for:"all_flow",max_warning_time:5},flow_interval_time_ms:3e3,limit_time_liveness_check:{enable:!1,limit_time_second:45},terminate_if_no_face:{enable:!1,max_invalid_frame:5,max_time_ms:1e3}}),2),i=a[0],l=a[1];return c((function(){t?l(I({},t)):n&&r.clientSettings().then((function(e){if(e&&e.data){var t,r=Yu(e,"data.settings.sdk_settings.server_log_settings.enable"),n=Yu(e,"data.settings.sdk_settings.active_liveness_settings"),a=Yu(n,"save_encoded_frames",{});a.enable&&(t={enable:!0,framesIntervalTime:a.frames_interval_ms,framesBatchLength:a.frames_batch_len}),l(I(I({},n),{},{enableTracking:r,captureFrameSettings:t}))}e&&e.errors&&o($u.server_error)})).catch((function(e){o(e)}))}),[t,r,o,n]),i}var Ju=function(e){var t=e.curStep,r=e.faceDirection,n=Yu(t,"stepTimeConstraints.delayTime");return!!n&&(null===t.firstFrameSpottedAt?(t.name===r&&(t.firstFrameSpottedAt=(new Date).getTime()),!0):(new Date).getTime()-t.firstFrameSpottedAt<n)};var ed=function(e){return e?Infinity===(e=pc(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var td=function(e){var t=ed(e),r=t%1;return t==t?r?t-r:t:0};var rd=function(e,t){var r;if("function"!=typeof t)throw new TypeError("Expected a function");return e=td(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}};var nd=function(e){return rd(2,e)};function od(){return(od=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{},r=t.blazefaceModelUrl,n=t.tfScriptUrls,e.next=3,oi.loadTensorFlow(n);case 3:return e.next=5,oi.initTensorFlow({preferredBackends:["wasm","webgl","cpu"]});case 5:return e.next=7,oi.loadBlazefaceModel({modelUrl:r});case 7:return o=e.sent,e.abrupt("return",{blazefaceModel:o});case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ad,id,sd,cd,ld,ud,dd,fd=nd((function(){return od.apply(this,arguments)})),pd=[],hd=function(){pd=[]},md=function(e,t,r){r&&hd(),pd.push({id:null});var n=pd.length-1;t.httpClient.post("/v1/files",{frames:e,metadata:JSON.stringify({type:"selfie"})}).then((function(e){e&&e.data&&e.data.file_id?pd[n].id=e.data.file_id:pd[n].id=-1}))},gd=function(){return new Promise((function(e){var t=setInterval((function(){pd.every((function(e){return e.id}))&&(e(),clearInterval(t))}),200)}))},vd=function(e){return e.enable?pd.some((function(e){return-1===e.id}))?null:pd:[]},yd=yo.faceTracker(),bd=V.Mode,Cd=V.FaceDirection,wd=V.Errors,kd=V.Messages,Bd=V.TrackLivenessEvents;function Ed(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=t.apiCheck,i=t.mode,u=t.bgCameraMask,d=t.bgCameraMaskRed,f=t.surroundStyle,p=t.cropAreaDimension,h=t.customInstructions,m=t.customIcon,g=t.customDirectionIcon,v=t.customStepTimeConstraints,y=void 0===v?(S(e={},V.FaceDirection.UP,{delayTime:0}),S(e,V.FaceDirection.LEFT,{delayTime:0}),S(e,V.FaceDirection.RIGHT,{delayTime:0}),S(e,V.FaceDirection.FRONTAL,{delayTime:2e3}),e):v,b=t.onLivenessDetectionDone,C=t.onError,k=t.frontalMinSize,E=t.waitingTimeToGetBetterFrames,A=void 0===E?500:E,_=t.captureFrameSettings,T=void 0===_?{enable:!1,framesIntervalTime:180,framesBatchLength:0}:_,P=t.livenessSettings,x=t.setRemainingTime,R=void 0===x?function(){}:x,N=t.onProcessing,D=void 0===N?function(){}:N,M=t.customErrors,U=t.customMessages,j=t.apiCredentials,F=void 0===j?{}:j,z=t.onFramesCaptured,K=void 0===z?function(){}:z,H=t.initFirstGestureTimeout,q=void 0===H?2e3:H,Q=t.outputEncryptionSettings,W=t.cameraScale,G=void 0===W?1:W,X=t.passiveModeAuto,Y=void 0!==X&&X,$=t.sendCustomEvent,Z=void 0===$?function(){}:$,J=s(!1),ee=L(J,2),te=ee[0],re=ee[1],ne=s(!1),oe=L(ne,2),ae=oe[0],ie=oe[1],se=s(!1),ce=L(se,2),le=ce[0],ue=ce[1],de=r(null),fe=Qr.useSDKSettings(),pe=fe.lang,he=fe.assetRoot,me=fe.customUrls,ge=La.useApiClient({apiCredentials:F}),ve=ge.apiClient,ye=i===bd.ACTIVE,be=l((function(e){return e+1}),0),Ce=L(be,2),we=(Ce[0],Ce[1]),ke=r(null),Be=r(!1),Ee=s(!1),Se=L(Ee,2),Ae=Se[0],_e=Se[1],Ie=r({}),Te=Sn.useSDKTracking(),Pe=Te.sendEvent,xe=r(null);null===xe.current&&(xe.current=yo.initFaceVerificationData({assetRoot:he,customInstructions:h,customIcon:m,customDirectionIcon:g,customStepTimeConstraints:y}));var Re=s(),Ne=L(Re,2),Le=Ne[0],Oe=Ne[1],De=n((function(){return vc(Oe,500)}),[Oe]),Me=r([]),Ue=r(),je=r(),Fe=Zu({livenessSettings:P,apiClient:ve,apiCheck:a,onError:C}),Ve=Fe.face_tracking_setting,ze=Fe.flow_interval_time_ms,Ke=Fe.limit_time_liveness_check,He=Fe.terminate_if_no_face,qe=Fe.captureFrameSettings,Qe=void 0===qe?T:qe,We=Fe.enableTracking,Ge=n((function(){return vc((function(e){a&&!We||null==e||!e.event||(Pe(e),Z(e))}),2e3)}),[a,We,Pe,Z]),Xe=r(0),Ye=r();c((function(){Ge({tag:"selfie",event:null==Bd?void 0:Bd.start_camera,log:{}})}),[Ge]),c((function(){var e=!1;function t(){return(t=B(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Ae){t.next=11;break}return je.current=performance.now(),t.next=4,fd(me);case 4:if(Ie.current=t.sent,!e){t.next=7;break}return t.abrupt("return");case 7:_e(!0),Ge({tag:"selfie",event:null==Bd?void 0:Bd.show_warmup,log:{}}),Ge({tag:"selfie",event:null==Bd?void 0:Bd.finish_load_model,log:{status:"success",time_in_ms:performance.now()-je.current}}),je.current=null;case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return function(){t.apply(this,arguments)}(),function(){e=!0}}),[Ae,me,Ge]);var $e=o((function(){R(""),xe.current.curStepIndex=xe.current.steps.length,ie(!1),setTimeout((function(){xe.current=yo.initFaceVerificationData({assetRoot:he,customInstructions:h,customIcon:m,customDirectionIcon:g}),Ue.current=Date.now(),Xe.current=0,Ye.current=null,Me.current=[],ue(!1),hd(),we()}),ze)}),[he,h,m,g,ze,R]),Ze=r(null),Je=n((function(){return I(I({},wd),M)}),[M]),et=n((function(){return I(I({},kd),U)}),[U]),tt=400;c((function(){if(te&&Ke.enable&&le){Ue.current=Date.now();var e=Ke.limit_time_second+1,t=Ke.remain_time_show||10,r=Ke.format||"s";Ze.current=setInterval((function(){var n=Math.round((1e3*e-(Date.now()-Ue.current))/1e3);if(xe.current.curStepIndex<xe.current.steps.length){if(n<=t&&n>=1){var o=lu(et.REMAIN_TIME[pe]),a=n;switch(r){case"mm:ss":a=n.toString().padStart(5,"00:00");break;case"ss":a=n.toString().padStart(2,"0")}R(o({x:a}))}if(Math.round((Date.now()-Ue.current)/1e3)===e){var i,s={};Object.keys(null===(i=Je.liveness_terminated_time_out)||void 0===i?void 0:i.msg).forEach((function(e){var t,r=lu(null===(t=Je.liveness_terminated_time_out)||void 0===t?void 0:t.msg[e]);s[e]=r({x:Ke.limit_time_second})})),Oe(I(I({},Je.liveness_terminated_time_out),{},{msg:s,duration:ze})),Ge({tag:"selfie",event:null==Bd?void 0:Bd.show_alert,log:{alert:"liveness_terminated_time_out,"}}),$e()}}}),1e3)}return function(){clearInterval(Ze.current)}}),[$e,R,te,pe,ze,Ke.enable,Ke.limit_time_second,le,Je.liveness_terminated_time_out,et.REMAIN_TIME,Ke.format,Ke.remain_time_show,Ge]);var rt=o((function(e){var t,r,n=e.clientWidth,o=e.clientHeight,a=e.videoAreaWidth,i=e.videoAreaHeight,s=e.lostX,c=e.lostY;mi.isMobile?r=t=a:t=r=i-200;var l=Math.floor((a-t)/2)+s,d=5+c,h=u;ke.current={x:l,y:d,width:t,height:r,image:h,surroundStyle:f},"object"===w(p)?ke.current=I(I({},ke.current),p):"function"==typeof p&&(ke.current=I(I({},ke.current),p({clientWidth:n,clientHeight:o,videoAreaWidth:a,videoAreaHeight:i,lostX:s,lostY:c,isMobile:mi.isMobile,width:t,height:r}))),we(),re(!0)}),[u,f,p]),nt=s(3),ot=L(nt,2),at=ot[0],it=ot[1],st=s(!1),ct=L(st,2),lt=ct[0],ut=ct[1],dt=r(!1),ft=o((function(e){ut(e),dt.current=e}),[]),pt=r(null),ht=r([]),mt=o((function(){it(3),clearInterval(pt.current),ft(!0);var e=function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t-1!=0){e.next=9;break}return clearInterval(pt.current),r=ht.current,D(),n=r.map((function(e){return Ca.resizeBlobImg(e.blob,tt,tt)})),e.next=7,Promise.all(n);case 7:o=e.sent,a?(i=O(Me.current),s=r.map((function(e,t){return ve.uploadImage({file:o[t],label:"portrait",metadata:JSON.stringify({gesture_score:e.leftRightScore,gesture:Cd.FRONTAL})})})),Promise.all(s).then((function(e){return ve.verifyFaceLiveness({images:e.map((function(e){return{id:e.data.image_id}})),videos:[{frames:i}]})})).then((function(e){b({apiCheckPassed:e.data.is_live,verifyFaceLivenessResult:e.data})})).catch((function(e){C({error:e})}))):b({frontalFaces:o,capturedFrames:Me.current});case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();pt.current=setInterval((function(){it((function(t){return e(t),t-1}))}),1e3)}),[ft,a,b,ve,C,D]);c((function(){Le&&(clearInterval(pt.current),ft(!1),ht.current=[])}),[Le,ft]),c((function(){var e,t=de.current,r=function(){var e=B(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=xe.current.steps,r=[],t.forEach((function(e){var t=e.name,n=e.image,o=e.frontalFaceImage;if(t!==Cd.FRONTAL){var a={label:"portrait",metadata:JSON.stringify({gesture_score:n.leftRightScore,gesture:t})};Q&&Q.key?r.push(ve.httpClient.post("/v1/images",I({base64:n.encrypted.hex},a),{"X-TV-Key":Q.key})):r.push(ve.uploadImage(I({file:n.blob},a)))}else r.push(Promise.resolve({data:{image_id:null}}));if(o.blob){var i={label:"portrait",metadata:JSON.stringify({gesture_score:o.leftRightScore,gesture:Cd.FRONTAL})};Q&&Q.key?r.push(ve.httpClient.post("/v1/images",I({base64:o.encrypted.hex},i),{"X-TV-Key":Q.key})):r.push(ve.uploadImage(I({file:o.blob},i)))}else r.push(Promise.resolve({data:{image_id:null}}))})),e.next=5,Promise.all(r);case 5:n=e.sent,t.forEach((function(e,t){e.image.imageId=n[2*t].data.image_id,e.frontalFaceImage.imageId=n[2*t+1].data.image_id}));case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),n=function(){var e=B(regeneratorRuntime.mark((function e(){var t,n,o,a,i,s,c,l,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r();case 3:if(t=xe.current.steps,0!==(n=t.filter((function(e){return e.frontalFaceImage.imageId}))).length){e.next=9;break}b({error:"wrong_face_movement"}),e.next=26;break;case 9:return e.next=11,gd();case 11:if(o=vd(Qe)){e.next=16;break}b({error:"network_error"}),e.next=26;break;case 16:return a=ve.verifyFaceLiveness({images:n.map((function(e){return{id:e.frontalFaceImage.imageId}})),gesture_images:t.filter((function(e){return e.image.imageId&&e.name!==Cd.FRONTAL})).map((function(e){return{gesture:e.name,images:[{id:e.image.imageId}]}})),videos:o}),i=ve.requestVerifyPortrait({image:{id:n[n.length-1].frontalFaceImage.imageId}}),e.next=20,Promise.all([a,i]);case 20:s=e.sent,c=L(s,2),l=c[0],u=c[1],d=!0===l.data.is_live,b({apiCheckPassed:d,verifyFaceLivenessResult:l.data,verifyFacePortraitResult:u.data,frontalFaces:n.map((function(e){return{id:e.frontalFaceImage.imageId,blob:e.frontalFaceImage.blob}})),steps:t.filter((function(e){return e.image.imageId&&e.name!==Cd.FRONTAL})).map((function(e){var t=e.name,r=e.image;return{name:t,blob:r.blob,id:r.imageId}}))});case 26:e.next=31;break;case 28:e.prev=28,e.t0=e.catch(0),C({error:e.t0});case 31:case"end":return e.stop()}}),e,null,[[0,28]])})));return function(){return e.apply(this,arguments)}}(),o=function(){var e=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=xe.current.steps,r=[],t.map((function(e){return r.push({name:e.name,blob:e.image.blob}),e.frontalFaceImage.blob&&r.push({name:e.name,blob:e.frontalFaceImage.blob}),0})),n=r.map((function(e){return Ca.resizeBlobImg(e.blob,tt,tt)})),e.next=6,Promise.all(n);case 6:return o=e.sent,a=r.map((function(e,t){return{name:e.name,blob:o[t]}})),e.next=10,Promise.all(t.map(function(){var e=B(regeneratorRuntime.mark((function e(r,n){var o,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=a.filter((function(e){return e.name===r.name})),t[n].image.blob=o[0].blob,r.frontalFaceImage.blob&&(t[n].frontalFaceImage.blob=o[1].blob),!Q||!Q.key){e.next=12;break}return i=Q.key,e.next=7,ci.encrypt({blob:o[0].blob,key:i});case 7:if(t[n].image.encrypted=e.sent,!r.frontalFaceImage.blob){e.next=12;break}return e.next=11,ci.encrypt({blob:o[1].blob,key:i});case 11:t[n].frontalFaceImage.encrypted=e.sent;case 12:return e.abrupt("return",0);case 13:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()));case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),i=function(){var e=B(regeneratorRuntime.mark((function e(){var t,r,i,s,c,l,u,d,f,p,h,m,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=xe.current.steps,i=r[xe.current.curStepIndex],S(t={},V.FaceDirection.UP,null==Bd?void 0:Bd.capture_up_face),S(t,V.FaceDirection.LEFT,null==Bd?void 0:Bd.capture_left_face),S(t,V.FaceDirection.RIGHT,null==Bd?void 0:Bd.capture_right_face),S(t,V.FaceDirection.FRONTAL,null==Bd?void 0:Bd.capture_frontal_face),Ge({tag:"selfie",event:t[i.name],log:{time_capture_in_seconds:((performance.now()-je.current)/1e3).toFixed(1)}}),xe.current.curStepIndex++,je.current=performance.now(),Ve.enable&&"each_gesture"===Ve.limit_for&&(Xe.current=0),xe.current.curStepIndex!==r.length){e.next=37;break}if(Ke.enable&&R(""),!b){e.next=37;break}return Qe.enable&&Qe.framesBatchLength>0&&Me.current.length%Qe.framesBatchLength>0&&(K(Me.current.slice(Me.current.length%Qe.framesBatchLength*-1).map((function(e){return{base64:e.base64,label:e.label,index:e.index}}))),a&&md(Me.current.slice(Me.current.length%Qe.framesBatchLength*-1),ve)),Ge({tag:"selfie",event:null==Bd?void 0:Bd.finish_capture,log:{time_capture_in_seconds:((Date.now()-Ue.current)/1e3).toFixed(1)}}),D(),e.next=15,o();case 15:if(a){e.next=35;break}if(d=r.filter((function(e){return e.name!==Cd.FRONTAL})).map((function(e){return{name:e.name,image:{blob:e.image.blob,encrypted:e.image.encrypted}}})),f=r.filter((function(e){return e.name!==Cd.FRONTAL})).map((function(e){return e.frontalFaceImage.blob})).filter((function(e){return null!==e})),p=r.filter((function(e){return e.name!==Cd.FRONTAL})).map((function(e){return e.frontalFaceImage.encrypted})).filter((function(e){return e&&e.hex})),h=null===(s=r.find((function(e){return e.name===Cd.FRONTAL})))||void 0===s||null===(c=s.image)||void 0===c?void 0:c.blob,m=null===(l=r.find((function(e){return e.name===Cd.FRONTAL})))||void 0===l||null===(u=l.image)||void 0===u?void 0:u.encrypted,!h||!k){e.next=27;break}return e.next=24,Ca.scaleImage(h,{minSize:k});case 24:e.t0=e.sent,e.next=28;break;case 27:e.t0=null;case 28:g=e.t0,h&&f.push(h),m&&p.push(m),Ge({tag:"result",event:null==Bd?void 0:Bd.liveness_detection_done,log:{result_object:{steps:d,frontalFaces:f,frontalScaledImage:g}}}),b({steps:d,frontalFaces:f,frontalFacesEncrypted:p,frontalScaledImage:g,capturedFrames:Me.current}),e.next=37;break;case 35:return e.next=37,n();case 37:we();case 38:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),s=gc((function(){var e=xe.current,t=e.curStepIndex,r=e.steps,n=r[t],o=null!==(null==n?void 0:n.image.blob),a=null!==(null==n?void 0:n.frontalFaceImage.blob),s=r.filter((function(e){return e.frontalFaceImage.blob})).length,c=!1;return o&&(a||![1].includes(t)||s>=1)?(Be.current=!1,i(),c=!0):Be.current=!(!o||a),ie(!1),c}),A);function c(e,t,r,n){return l.apply(this,arguments)}function l(){return(l=B(regeneratorRuntime.mark((function e(t,r,n,o){var a,c,l,u,d,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=xe.current,c=a.curStepIndex,l=a.steps,!(c<l.length)){e.next=24;break}if(u=l[c],!Ju({faceDirection:t,curStep:u})){e.next=5;break}return e.abrupt("return");case 5:if(t!==Cd.FRONTAL||null!==u.frontalFaceImage.blurScore&&!eo.hasBetterBlurScore(n,u.frontalFaceImage.blurScore)){e.next=13;break}return u.frontalFaceImage.blurScore=n,e.next=9,ro.takePicture({canvas:r});case 9:d=e.sent,u.frontalFaceImage.blob=d,u.frontalFaceImage.leftRightScore=o,Be.current&&(Be.current=!1,i());case 13:if(u.name!==t||null!==u.image.blurScore&&!eo.hasBetterBlurScore(n,u.image.blurScore)){e.next=24;break}return ie(!0),u.image.blurScore=n,e.next=18,ro.takePicture({canvas:r});case 18:f=e.sent,u.image.blob=f,u.image.leftRightScore=o,u.image.objUrl&&URL.revokeObjectURL(u.image.objUrl),u.image.objUrl=URL.createObjectURL(f),s();case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(e,t,r){return p.apply(this,arguments)}function p(){return(p=B(regeneratorRuntime.mark((function e(t,r,n){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!0===dt.current&&t===Cd.FRONTAL&&ht.current.length<3)){e.next=5;break}return e.next=3,ro.takePicture({canvas:r});case 3:o=e.sent,ht.current.push({blob:o,leftRightScore:n});case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(e,t,r,n){if(Me.current.length&&Date.now()-Me.current[Me.current.length-1].time<Qe.framesIntervalTime)return null;if(Qe.enable&&!n){var o=e.topLeft,i=e.bottomRight,s=[].concat(O(o),O(i)),c=[];[o,i].forEach((function(e){c=[].concat(O(c),[e[0]/ko.SIZE*t.width,e[1]/ko.SIZE*t.height])}));var l=yd(e,0===Me.current.length),u=l.score,d=l.time,f=t.toDataURL("image/jpeg",.8);return Me.current.push({label:"portrait",base64:f.split(",")[1],landmarks:r,original_landmarks:r.map((function(e){return[e[0]/ko.SIZE*t.width,e[1]/ko.SIZE*t.height]})),score:u,time:d,index:Me.current.length,bbox:s,original_bbox:c}),Qe.framesBatchLength>0&&Me.current.length%Qe.framesBatchLength==0&&K&&(K(Me.current.slice(-Qe.framesBatchLength).map((function(e){return{base64:e.base64,label:e.label,index:e.index}}))),a&&md(Me.current.slice(-Qe.framesBatchLength),ve,Me.current.length===Qe.framesBatchLength)),u}return null}function m(e){if(!Ve.enable||null===e||!le)return!0;var t=Ve.web_warning_threshold,r=Ve.web_terminate_threshold,n=Ve.max_warning_time;return e<t||(e<r&&Xe.current<n?(Xe.current++,Xe.current===n?(Oe(I(I({},Je.liveness_terminated_face_tracking),{},{duration:ze})),Ge({tag:"selfie",event:null==Bd?void 0:Bd.show_alert,log:{alert:"liveness_terminated_face_tracking"}})):Oe(I(I({},Je.liveness_too_fast),{},{duration:1500})),!0):(Oe(I(I({},Je.liveness_terminated),{},{duration:ze})),Ge({tag:"selfie",event:null==Bd?void 0:Bd.show_alert,log:{alert:"liveness_terminated"}}),$e(),!1))}function g(e){if(He.enable&&le){var t=He.max_time_ms;Ye.current&&e||(Ye.current={time:Date.now(),frame:0}),e&&Ye.current.frame++;var r=Ye.current.time;e&&Date.now()-r>=t&&(Oe(I(I({},Je.liveness_terminated_no_face),{},{duration:ze})),Ge({tag:"selfie",event:null==Bd?void 0:Bd.show_alert,log:{alert:"liveness_terminated_no_face"}}),$e())}}function v(e,t){return y.apply(this,arguments)}function y(){return(y=B(regeneratorRuntime.mark((function r(n,o){var a,i,s,l,p,y,b,C,w,k,B,E,S,A,_,I,T,P,x,R,N;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==(null==o?void 0:o.width)&&0!==(null==o?void 0:o.height)){r.next=2;break}return r.abrupt("return");case 2:return a=n.cropX,i=n.cropY,s=n.cropWidth,l=n.cropHeight,o.getContext("2d").drawImage(t,a,i,s,l,-(s*G-s)/2/G,-(l*G-l)/2/G,s,l),p=Ie.current.blazefaceModel,r.next=8,eo.calculateBlurScore(o);case 8:return y=r.sent,r.next=11,ko.getModelPredictions({model:p,sCanvas:o});case 11:return b=r.sent,r.next=14,yo.validatePredictions({predictions:b,width:ko.SIZE,height:ko.SIZE});case 14:if(C=r.sent,w=C.error,k=C.fullFace,ke.current.image=u,E=null,S=null,A=null,_=xe.current,I=_.curStepIndex,T=_.steps,!k){r.next=29;break}return P=T[I],A=k.landmarks,r.next=27,yo.calculateFaceDirection({landmarks:A,getPerfectFrontal:P&&P.name===Cd.FRONTAL});case 27:(x=r.sent)&&(E=x.gesture,S=x.leftRightScore);case 29:if(R="no_face"===(null==w?void 0:w.code)||"partial_face"===(null==w?void 0:w.code),N=I<T.length,g(R&&N),null!=w&&w.code&&Ge({tag:"selfie",event:null==Bd?void 0:Bd.show_alert,log:{alert:w.code}}),w&&("face_too_small"!==w.code||![Cd.DOWN,Cd.UP,Cd.LEFT,Cd.RIGHT].includes(E))){r.next=54;break}if(ye||h(b[0],o,A),!ye){r.next=43;break}if(le||(ue(!0),je.current=performance.now(),Ue.current=Date.now()),!m(h(b[0],o,A,I>=T.length))){r.next=41;break}return r.next=41,c(E,o,y,S);case 41:r.next=52;break;case 43:if(![Cd.LEFT,Cd.RIGHT].includes(E)){r.next=48;break}B=Je.not_frontal_face,ke.current.image=d,r.next=52;break;case 48:if(w){r.next=52;break}return Y&&!dt.current&&0===ht.current.length&&setTimeout((function(){mt()}),500),r.next=52,f(E,o,S);case 52:r.next=55;break;case 54:I<T.length&&(B=Je[w.code],ke.current.image=d);case 55:De(B),-1!==e&&(e=requestAnimationFrame((function(){return v(n,o)})));case 57:case"end":return r.stop()}}),r)})))).apply(this,arguments)}function w(){return(w=B(regeneratorRuntime.mark((function e(){var r,n,o,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=ro.analyzeVideoAndWindowSizes(t,ke.current),n=r.cropWidth,o=r.cropHeight,(a=document.createElement("canvas")).width=n,a.height=o,(i=a.getContext("2d")).translate(n,0),i.scale(-1*G,1*G),v(r,a);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return te&&Ae&&setTimeout((function(){!function(){w.apply(this,arguments)}()}),q),function(){cancelAnimationFrame(e),e=-1}}),[q,te,pe,ye,ve,a,u,d,b,C,k,A,Qe,D,Ve,Ke.enable,R,De,ze,$e,He,le,Je,Ae,Ge,K,Q,G,mt,Y]);var gt=xe.current,vt=gt.curStepIndex,yt=gt.steps,bt=n((function(){return yt.find((function(e){return e.name===V.FaceDirection.FRONTAL}))}),[yt]),Ct=Be.current?bt:yt[vt],wt=Ct&&le?Ct.instructions[pe]:null,kt=Ct&&le?Ct.directionIcon:"",Bt=Ct?Ct.directionIconAnimation:"";return{countdownToTakePicture:at,cropArea:ke,curStepIndex:vt,directionIcon:kt,directionIconAnimation:Bt,faceDetectionError:Le,handleTriggerPassiveMode:mt,handleVideoPlayed:rt,instructions:wt,isActiveMode:ye,refVideo:de,showCountdown:lt,steps:yt,videoPlayed:te,activeCapturing:ae,isFirstValidFrameFound:le,warmupDone:Ae}}var Sd=(S(ad={},V.FaceDirection.LEFT,90),S(ad,V.FaceDirection.RIGHT,270),S(ad,V.FaceDirection.UP,180),S(ad,V.FaceDirection.DOWN,0),ad),Ad=g(["0%{opacity:0.15;}50%{opacity:0.3;}100%{opacity:1;}"]),_d=h.div(id||(id=N(["\n width: 200px;\n height: 200px;\n position: relative;\n transform: scale(0.48);\n\n .top,\n .right,\n .bottom,\n .left {\n position: absolute;\n }\n\n .top {\n top: 0;\n left: 50%;\n transform: rotate(","deg) translateX(-50%);\n }\n\n .right {\n right: 0;\n top: 50%;\n transform: rotate(","deg) translateX(-50%);\n }\n\n .bottom {\n bottom: 0;\n left: 50%;\n transform: rotate(","deg) translateX(50%);\n }\n\n .left {\n left: 0;\n top: 50%;\n transform: rotate(","deg) translateX(50%);\n }\n"])),Sd[V.FaceDirection.DOWN],Sd[V.FaceDirection.LEFT],Sd[V.FaceDirection.UP],Sd[V.FaceDirection.RIGHT]),Id=h.div(sd||(sd=N(["\n width: 70px;\n transform: rotate(","deg);\n"])),(function(e){var t,r=e.direction;return null!==(t=Sd[r])&&void 0!==t?t:0})),Td=h.span(cd||(cd=N(["\n display: flex;\n margin: 4px 0;\n width: 100%;\n height: 15px;\n animation: "," 1s infinite;\n animation-direction: alternate;\n\n &::before,\n &::after {\n content: '';\n height: 100%;\n width: 50%;\n background: rgba(255, 255, 255, 0.8);\n }\n\n &::before {\n transform: skewY(32deg);\n }\n\n &::after {\n width: 50%;\n transform: skewY(-32deg);\n }\n"])),Ad),Pd=h(Td)(ld||(ld=N(["\n animation-delay: 0s;\n"]))),xd=h(Td)(ud||(ud=N(["\n animation-delay: 0.5s;\n"]))),Rd=h(Td)(dd||(dd=N(["\n animation-delay: 1s;\n"])));function Nd(e){var r=e.type;return r!==V.FaceDirection.FRONTAL?t.createElement(Id,{direction:r},t.createElement(Pd,null),t.createElement(xd,null),t.createElement(Rd,null)):t.createElement(_d,null,t.createElement(Id,{className:"top"},t.createElement(Pd,null),t.createElement(xd,null),t.createElement(Rd,null)),t.createElement(Id,{className:"right"},t.createElement(Pd,null),t.createElement(xd,null),t.createElement(Rd,null)),t.createElement(Id,{className:"bottom"},t.createElement(Pd,null),t.createElement(xd,null),t.createElement(Rd,null)),t.createElement(Id,{className:"left"},t.createElement(Pd,null),t.createElement(xd,null),t.createElement(Rd,null)))}Nd.propTypes={type:p.oneOf([V.FaceDirection.LEFT,V.FaceDirection.RIGHT,V.FaceDirection.UP,V.FaceDirection.FRONTAL])},Nd.defaultProps={type:V.FaceDirection.LEFT};var Ld,Od=V.ErrorDuration;function Dd(e){var r=e.children,n=e.errorMsg,o=e.className;return t.isValidElement(r)?n?t.createElement("div",{className:o},t.cloneElement(r,{errorMsg:n})):null:n?t.createElement("div",{className:o},n):null}function Md(e){var t=e.children,n=e.className,o=e.error,a=r(0),i=r(""),s=Qr.useSDKSettings().lang,c=r(Od.SHORT),l=o||{},u=l.msg,d=l.duration,f=void 0===d?Od.SHORT:d,p=null==u?void 0:u[s];return Date.now()-a.current>=c.current?(a.current=Date.now(),c.current=f,i.current=p,Dd({children:t,errorMsg:p,className:n})):Dd({children:t,errorMsg:i.current,className:n})}Md.propTypes={children:p.node,className:p.string},Md.defaultProps={className:""};var Ud=h.circle(Ld||(Ld=N(["\n transition: stroke-dashoffset 0.4s;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n"])));function jd(e){var r=e.className,n=e.style,o=e.radius,a=e.strokeWidth,i=e.progress,s=e.hasError,c=e.activeColor,l=e.innerPadding,u=e.outsideRingColor,d=e.outsideRingOpacity,f=e.insideRingColor,p=e.insideRingWidth,h=e.insideRingStrokeDash,m=e.errorRingWidth,g=e.errorRingColor,v=e.dashedRingColor,y=e.dashedRingOpacity,b=e.dashedRingWidth,C=e.dashedRingLineThick,w=e.dashedRingLineSpacing,k=e.dashedInsideRingColor,B=e.dashedInsideRingWidth,E=e.showOutsideRing,S=e.showInsideRing,A=e.showDashedRing,_=2*o,I=2*o,T=o-2*a,P=2*Math.PI*T,x=P-i/100*P,R=T-b/2-a/2-l,N=2*Math.PI*R,L=N-i/100*N,O=R-B/2-b/2,D=2*Math.PI*O,M=D-i/100*D,U=O-p/2-B/2,j=O-m/2-B/2;return t.createElement("svg",{className:r,style:n,width:_,height:I,viewBox:"0 0 ".concat(_," ").concat(I),fill:"none",xmlns:"http://www.w3.org/2000/svg"},E?t.createElement(t.Fragment,null,t.createElement("circle",{"data-testid":"outsideRing",opacity:d,cx:o,cy:o,r:T,stroke:u}),t.createElement(Ud,{"data-testid":"outsideAnimateRing",cx:o,cy:o,r:T,stroke:c,strokeWidth:a,strokeLinecap:"round",strokeDasharray:"".concat(P," ").concat(P),style:{strokeDashoffset:x}})):null,A?t.createElement(t.Fragment,null,t.createElement("circle",{"data-testid":"dashedRing",opacity:y,cx:o,cy:o,r:R,stroke:v,strokeWidth:b,strokeDasharray:"".concat(C," ").concat(w)}),t.createElement("mask",{id:"mask0","mask-type":"alpha",maskUnits:"userSpaceOnUse"},t.createElement("circle",{cx:o,cy:o,r:R,stroke:c,strokeWidth:b,strokeDasharray:"".concat(C," ").concat(w)})),t.createElement("g",{mask:"url(#mask0)"},t.createElement(Ud,{"data-testid":"dashedAnimateRing",cx:o,cy:o,r:R,stroke:c,strokeWidth:b,strokeDasharray:"".concat(N," ").concat(N),style:{strokeDashoffset:L}})),t.createElement("circle",{"data-testid":"dashedInsideRing",opacity:y,cx:o,cy:o,r:O,stroke:k,strokeWidth:B}),t.createElement(Ud,{"data-testid":"dashedInsideAnimateRing",cx:o,cy:o,r:O,stroke:c,strokeWidth:B,strokeLinecap:"round",strokeDasharray:"".concat(D," ").concat(D),style:{strokeDashoffset:M}})):null,S?t.createElement("circle",{"data-testid":"insideRing",strokeDasharray:h,cx:o,cy:o,r:U,stroke:f,strokeWidth:p}):null,s?t.createElement("circle",{"data-testid":"errorRing",strokeDasharray:h,cx:o,cy:o,r:j,stroke:g,strokeWidth:m}):null)}function Fd(e){var r=e.className;return t.createElement("svg",{className:r,width:"320",height:"320",viewBox:"0 0 320 320",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M320 0H0V320H320V0ZM160 296C235.111 296 296 235.111 296 160C296 84.8893 235.111 24 160 24C84.8893 24 24 84.8893 24 160C24 235.111 84.8893 296 160 296Z",fill:"currentColor"}))}function Vd(){return(Vd=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)}jd.propTypes={className:p.string,style:p.shape({}),radius:p.number,strokeWidth:p.number,progress:p.number,hasError:p.bool,activeColor:p.string,innerPadding:p.number,outsideRingColor:p.string,outsideRingOpacity:p.number,insideRingColor:p.string,insideRingWidth:p.number,insideRingStrokeDash:p.string,errorRingColor:p.string,errorRingWidth:p.number,dashedRingColor:p.string,dashedRingOpacity:p.number,dashedRingWidth:p.number,dashedRingLineThick:p.number,dashedRingLineSpacing:p.number,dashedInsideRingColor:p.string,dashedInsideRingWidth:p.number,showOutsideRing:p.bool,showDashedRing:p.bool,showInsideRing:p.bool},jd.defaultProps={className:"",style:null,radius:160,strokeWidth:3,progress:0,hasError:!1,activeColor:"#0092ff",innerPadding:5,outsideRingColor:"#f2f6f9",outsideRingOpacity:.1,insideRingColor:"#f2f6f9",insideRingWidth:3,insideRingStrokeDash:"0",errorRingColor:"#df0000",errorRingWidth:3,dashedRingColor:"#ffffff",dashedRingOpacity:.3,dashedRingWidth:10,dashedRingLineThick:1,dashedRingLineSpacing:6,dashedInsideRingColor:"#ffffff",dashedInsideRingWidth:0,showOutsideRing:!0,showDashedRing:!0,showInsideRing:!0},Fd.propTypes={className:p.string},Fd.defaultProps={className:""};var zd,Kd,Hd="undefined"!=typeof window?f:c,qd={popupContent:{tooltip:{position:"absolute",zIndex:999},modal:{position:"relative",margin:"auto"}},popupArrow:{height:"8px",width:"16px",position:"absolute",background:"transparent",color:"#FFF",zIndex:-1},overlay:{tooltip:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0",zIndex:999},modal:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0",display:"flex",zIndex:999}}},Qd=["top left","top center","top right","right top","right center","right bottom","bottom left","bottom center","bottom right","left top","left center","left bottom"],Wd=function(e,t,r,n,o){var a=o.offsetX,i=o.offsetY,s=n?8:0,c=r.split(" "),l=e.top+e.height/2,u=e.left+e.width/2,d=t.height,f=t.width,p=l-d/2,h=u-f/2,m="",g="0%",v="0%";switch(c[0]){case"top":p-=d/2+e.height/2+s,m="rotate(180deg) translateX(50%)",g="100%",v="50%";break;case"bottom":p+=d/2+e.height/2+s,m="rotate(0deg) translateY(-100%) translateX(-50%)",v="50%";break;case"left":h-=f/2+e.width/2+s,m=" rotate(90deg) translateY(50%) translateX(-25%)",v="100%",g="50%";break;case"right":h+=f/2+e.width/2+s,m="rotate(-90deg) translateY(-150%) translateX(25%)",g="50%"}switch(c[1]){case"top":p=e.top,g=e.height/2+"px";break;case"bottom":p=e.top-d+e.height,g=d-e.height/2+"px";break;case"left":h=e.left,v=e.width/2+"px";break;case"right":h=e.left-f+e.width,v=f-e.width/2+"px"}return{top:p="top"===c[0]?p-i:p+i,left:h="left"===c[0]?h-a:h+a,transform:m,arrowLeft:v,arrowTop:g}},Gd=function(e,t,r,n,o,a){var i=o.offsetX,s=o.offsetY,c={arrowLeft:"0%",arrowTop:"0%",left:0,top:0,transform:"rotate(135deg)"},l=0,u=function(e){var t={top:0,left:0,width:window.innerWidth,height:window.innerHeight};if("string"==typeof e){var r=document.querySelector(e);null!==r&&(t=r.getBoundingClientRect())}return t}(a),d=Array.isArray(r)?r:[r];for((a||Array.isArray(r))&&(d=[].concat(d,Qd));l<d.length;){var f={top:(c=Wd(e,t,d[l],n,{offsetX:i,offsetY:s})).top,left:c.left,width:t.width,height:t.height};if(!(f.top<=u.top||f.left<=u.left||f.top+f.height>=u.top+u.height||f.left+f.width>=u.left+u.width))break;l++}return c},Xd=0,Yd=u((function(e,n){var o=e.trigger,a=void 0===o?null:o,i=e.onOpen,l=void 0===i?function(){}:i,u=e.onClose,f=void 0===u?function(){}:u,p=e.defaultOpen,h=void 0!==p&&p,m=e.open,g=void 0===m?void 0:m,v=e.disabled,y=void 0!==v&&v,b=e.nested,w=void 0!==b&&b,k=e.closeOnDocumentClick,B=void 0===k||k,E=e.repositionOnResize,S=void 0===E||E,A=e.closeOnEscape,_=void 0===A||A,I=e.on,T=void 0===I?["click"]:I,P=e.contentStyle,x=void 0===P?{}:P,R=e.arrowStyle,N=void 0===R?{}:R,L=e.overlayStyle,O=void 0===L?{}:L,D=e.className,M=void 0===D?"":D,U=e.position,j=void 0===U?"bottom center":U,F=e.modal,V=void 0!==F&&F,z=e.lockScroll,K=void 0!==z&&z,H=e.arrow,q=void 0===H||H,Q=e.offsetX,W=void 0===Q?0:Q,G=e.offsetY,X=void 0===G?0:G,Y=e.mouseEnterDelay,$=void 0===Y?100:Y,Z=e.mouseLeaveDelay,J=void 0===Z?100:Z,ee=e.keepTooltipInside,te=void 0!==ee&&ee,re=e.children,ne=s(g||h),oe=ne[0],ae=ne[1],ie=r(null),se=r(null),ce=r(null),le=r(null),ue=r("popup-"+ ++Xd),de=!!V||!a,fe=r(0);Hd((function(){return oe?(le.current=document.activeElement,Ee(),we(),be()):Ce(),function(){clearTimeout(fe.current)}}),[oe]),c((function(){"boolean"==typeof g&&(g?pe():he())}),[g,y]);var pe=function(e){oe||y||(ae(!0),setTimeout((function(){return l(e)}),0))},he=function(e){var t;oe&&!y&&(ae(!1),de&&(null===(t=le.current)||void 0===t||t.focus()),setTimeout((function(){return f(e)}),0))},me=function(e){null==e||e.stopPropagation(),oe?he(e):pe(e)},ge=function(e){clearTimeout(fe.current),fe.current=setTimeout((function(){return pe(e)}),$)},ve=function(e){null==e||e.preventDefault(),me()},ye=function(e){clearTimeout(fe.current),fe.current=setTimeout((function(){return he(e)}),J)},be=function(){de&&K&&(document.getElementsByTagName("body")[0].style.overflow="hidden")},Ce=function(){de&&K&&(document.getElementsByTagName("body")[0].style.overflow="auto")},we=function(){var e,t=null==se||null===(e=se.current)||void 0===e?void 0:e.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),r=Array.prototype.slice.call(t)[0];null==r||r.focus()};d(n,(function(){return{open:function(){pe()},close:function(){he()},toggle:function(){me()}}}));var ke,Be,Ee=function(){if(!de&&oe&&(null==ie?void 0:ie.current)&&(null==ie?void 0:ie.current)&&(null==se?void 0:se.current)){var e,t,r=ie.current.getBoundingClientRect(),n=se.current.getBoundingClientRect(),o=Gd(r,n,j,q,{offsetX:W,offsetY:X},te);if(se.current.style.top=o.top+window.scrollY+"px",se.current.style.left=o.left+window.scrollX+"px",q&&ce.current)ce.current.style.transform=o.transform,ce.current.style.setProperty("-ms-transform",o.transform),ce.current.style.setProperty("-webkit-transform",o.transform),ce.current.style.top=(null===(e=N.top)||void 0===e?void 0:e.toString())||o.arrowTop,ce.current.style.left=(null===(t=N.left)||void 0===t?void 0:t.toString())||o.arrowLeft}};void 0===(Be=_)&&(Be=!0),c((function(){if(Be){var e=function(e){"Escape"===e.key&&ke(e)};return document.addEventListener("keyup",e),function(){Be&&document.removeEventListener("keyup",e)}}}),[ke=he,Be]),function(e,t){void 0===t&&(t=!0),c((function(){if(t){var r=function(t){if(9===t.keyCode){var r,n=null==e||null===(r=e.current)||void 0===r?void 0:r.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),o=Array.prototype.slice.call(n);if(1===o.length)return void t.preventDefault();var a=o[0],i=o[o.length-1];t.shiftKey&&document.activeElement===a?(t.preventDefault(),i.focus()):document.activeElement===i&&(t.preventDefault(),a.focus())}};return document.addEventListener("keydown",r),function(){t&&document.removeEventListener("keydown",r)}}}),[e,t])}(se,oe&&de),function(e,t){void 0===t&&(t=!0),c((function(){if(t){var r=function(){e()};return window.addEventListener("resize",r),function(){t&&window.removeEventListener("resize",r)}}}),[e,t])}(Ee,S),function(e,t,r){void 0===r&&(r=!0),c((function(){if(r){var n=function(r){var n=Array.isArray(e)?e:[e],o=!1;n.forEach((function(e){e.current&&!e.current.contains(r.target)||(o=!0)})),r.stopPropagation(),o||t(r)};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),function(){r&&(document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n))}}}),[e,t,r])}(a?[se,ie]:[se],he,B&&!w);var Se,Ae=function(){return t.createElement("div",Object.assign({},(e=de?qd.popupContent.modal:qd.popupContent.tooltip,r={className:"popup-content "+(""!==M?M.split(" ").map((function(e){return e+"-content"})).join(" "):""),style:Vd({},e,x,{pointerEvents:"auto"}),ref:se,onClick:function(e){e.stopPropagation()}},!V&&T.indexOf("hover")>=0&&(r.onMouseEnter=ge,r.onMouseLeave=ye),r),{key:"C",role:de?"dialog":"tooltip",id:ue.current}),q&&!de&&t.createElement("div",{ref:ce,style:qd.popupArrow},t.createElement("svg",{"data-testid":"arrow",className:"popup-arrow "+(""!==M?M.split(" ").map((function(e){return e+"-arrow"})).join(" "):""),viewBox:"0 0 32 16",style:Vd({position:"absolute"},N)},t.createElement("path",{d:"M16 0l16 16H0z",fill:"currentcolor"}))),re&&"function"==typeof re?re(he,oe):re);var e,r},_e=!(T.indexOf("hover")>=0),Ie=de?qd.overlay.modal:qd.overlay.tooltip,Te=[_e&&t.createElement("div",{key:"O","data-testid":"overlay","data-popup":de?"modal":"tooltip",className:"popup-overlay "+(""!==M?M.split(" ").map((function(e){return e+"-overlay"})).join(" "):""),style:Vd({},Ie,O,{pointerEvents:B&&w||de?"auto":"none"}),onClick:B&&w?he:void 0,tabIndex:-1},de&&Ae()),!de&&Ae()];return t.createElement(t.Fragment,null,function(){for(var e={key:"T",ref:ie,"aria-describedby":ue.current},r=Array.isArray(T)?T:[T],n=0,o=r.length;n<o;n++)switch(r[n]){case"click":e.onClick=me;break;case"right-click":e.onContextMenu=ve;break;case"hover":e.onMouseEnter=ge,e.onMouseLeave=ye;break;case"focus":e.onFocus=ge,e.onBlur=ye}if("function"==typeof a){var i=a(oe);return!!a&&t.cloneElement(i,e)}return!!a&&t.cloneElement(a,e)}(),oe&&C.createPortal(Te,(null===(Se=document.getElementById("popup-root"))&&((Se=document.createElement("div")).setAttribute("id","popup-root"),document.body.appendChild(Se)),Se)))})),$d=v(zd||(zd=N(["\n .popup-content {\n margin: auto;\n background: #fff;\n width: 100%;\n padding: 5px;\n border: 1px solid #d7d7d7;\n max-width: 568px;\n border-radius: 10px;\n }\n\n [role=tooltip].popup-content {\n width: 200px;\n box-shadow: 0 0 3px rgba(0, 0, 0, .16);\n border-radius: 5px\n }\n\n .popup-overlay {\n background: rgba(0, 0, 0, .5);\n padding: 10px;\n }\n\n [data-popup=tooltip].popup-overlay {\n background: transparent\n }\n\n .popup-arrow {\n -webkit-filter: drop-shadow(0 -3px 3px rgba(0, 0, 0, .16));\n filter: drop-shadow(0 -3px 3px rgba(0, 0, 0, .16));\n color: #fff;\n stroke-width: 2px;\n stroke: #d7d7d7;\n stroke-dasharray: 30px;\n stroke-dashoffset: -54px;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0\n }\n"]))),Zd=["open","children","overlayStyle"],Jd=function(e){var r=e.open,n=e.children,o=e.overlayStyle,a=R(e,Zd);return t.createElement(t.Fragment,null,t.createElement(Yd,A({overlayStyle:I(I({},o),{},{zIndex:2e3}),closeOnDocumentClick:!1,closeOnEscape:!1,modal:!0,open:r},a),n),t.createElement($d,null))};Jd.propTypes={open:p.bool,children:p.node,overlayStyle:p.shape({})},Jd.defaultProps={open:!1,children:null,overlayStyle:{}};var ef,tf,rf,nf,of,af,sf,cf,lf,uf,df,ff,pf,hf,mf,gf,vf={WARMUP_INTRO:{en:"Warming up... Please wait a moment",vi:"Đang khởi động, vui lòng chờ trong giây lát..."}},yf=h.div(Kd||(Kd=N(["\n font-size: 18px;\n text-align: center;\n padding: 10px;\n"]))),bf=function(e){var r=e.contentStyle,n=Qr.useSDKSettings(),o=n.lang,a=n.warmupMessage,i=a?a[o]:vf.WARMUP_INTRO[o];return t.createElement(Jd,{open:!0,contentStyle:r},t.createElement(yf,{className:"warmup-message"},i))};bf.propTypes={contentStyle:p.shape({})},bf.defaultProps={contentStyle:{}};var Cf=y(["z-index:",";color:#ffffff;"],1020),wf=h.div(ef||(ef=N(["\n ","\n"])),Cf),kf=h(Md)(tf||(tf=N(["\n ","\n ","\n ","\n ","\n font-size: 18px;\n background: #ea3223;\n color: #fff;\n padding: 5px 10px;\n border-radius: 3px;\n position: absolute;\n white-space: pre-wrap;\n text-align: center;\n max-width: 80%;\n"])),Cf,(function(e){var t=e.top;return t&&y(["top:","px;"],t)}),(function(e){var t=e.bottom;return t&&y(["bottom:","px;"],t)}),(function(e){return e.centerY&&y(["top:50%;transform:translateY(-50%);"])})),Bf=h(wf)(rf||(rf=N(["\n ","\n font-size: 18px;\n background: #ea3223;\n color: #fff;\n padding: 5px 10px;\n border-radius: 3px;\n position: absolute;\n left: 50%;\n transform: translate(-50%, 0);\n white-space: nowrap;\n"])),(function(e){var t=e.top;return t&&y(["top:","px;"],t)})),Ef=h(wf)(nf||(nf=N(["\n position: absolute;\n ","\n ","\n font-size: ",";\n text-shadow: 2px 2px 4px #000000;\n"])),(function(e){var t=e.top;return t&&y(["top:","px;"],t)}),(function(e){var t=e.bottom;return t&&y(["bottom:","px;"],t)}),(function(){return mi.isMobile?"20px":"22px"})),Sf=h.div(of||(of=N(["\n height: ",";\n position: absolute;\n ","\n ","\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: ",";\n"])),(function(){return mi.isMobile?"50px":"70px"}),(function(e){var t=e.top;return t&&y(["top:","px;"],t)}),(function(e){var t=e.bottom;return t&&y(["bottom:","px;"],t)}),1020),Af=h.div(af||(af=N(["\n width: ",";\n height: ",";\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n border: 2px solid #ffffff;\n font-size: 16px;\n color: #fff;\n font-weight: 700;\n\n & + & {\n margin-left: 10px;\n }\n\n ","\n img {\n width: 100%;\n margin: 0;\n border-radius: 50%;\n }\n"])),(function(){return mi.isMobile?"40px":"50px"}),(function(){return mi.isMobile?"40px":"50px"}),(function(e){return!e.active&&y(["opacity:0.6;"])})),_f=h.div(sf||(sf=N(["\n color: #ffffff;\n height: 70px;\n position: absolute;\n bottom: 0;\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: ",";\n"])),1020),If=h.div(cf||(cf=N(["\n cursor: pointer;\n text-align: center;\n width: 50px;\n\n img {\n width: 100%;\n }\n"]))),Tf=h.div(lf||(lf=N(["\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #ffffff;\n font-size: 140px;\n opacity: 0.6;\n"]))),Pf=h.div(uf||(uf=N(["\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"]))),xf=h(jd)(df||(df=N(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),Rf=h(Fd)(ff||(ff=N(["\n width: 100%;\n height: 100%;\n vertical-align: middle;\n margin: 0;\n color: ",";\n"])),(function(e){var t=e.color;return null!=t?t:"rgba(0, 0, 0, 0.6)"})),Nf=h.div(pf||(pf=N(["\n position: absolute;\n z-index: -1;\n background: rgba(223, 0, 0, 0.2);\n border-radius: 50%;\n width: 86%;\n height: 86%;\n top: 7%;\n left: 7%;\n"]))),Lf=g(["from{opacity:1;}to{opacity:0;}"]),Of=h.div(hf||(hf=N(["\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 0;\n z-index: -1;\n background: rgba(255, 255, 255, 0.3);\n animation: "," 1s infinite;\n border-radius: 50%;\n"])),Lf),Df=mi.isMobile?{width:{ideal:640}}:null,Mf={background:"#000000",opacity:.6};function Uf(e){var r=e.apiCheck,n=e.mode,a=e.onLivenessDetectionDone,i=e.onClose,c=e.onError,l=e.captureFrameSettings,u=e.onFramesCaptured,d=e.frontCamera,f=e.customDirectionIcon,p=e.customStepTimeConstraints,h=e.onProcessing,m=e.customErrors,g=e.livenessSettings,v=e.apiCredentials,y=e.outputEncryptionSettings,b=e.cameraScale,C=e.defaultCameraId,w=e.passiveModeAuto,k=e.offsetFaceY,B=In.useAsset("bg_camera_mask.png"),E=In.useAsset("bg_camera_mask_red.png"),S=L(s({}),2),A=S[0],_=S[1],I=A.yFaceDetectionError,T=A.yFaceVerificationStepsWrapper,P=L(s(""),2),x=P[0],R=P[1],N=o((function(e){var t=e.lostY,r=e.height,n=e.clientHeight,o=t+25,a=o+30;_({yFaceDetectionError:o,yFaceVerificationStepsWrapper:a+r+20});var i=Math.floor(t),s=Math.floor(n-t),l=Math.floor(a);return l+k<i||l+k+r>s?c({code:"offsetFaceY must be in [-".concat(l-i,", ").concat(s-r-l,"]")}):l+=k,{y:l}}),[k,c]),O=Ed({apiCheck:r,mode:n,bgCameraMask:B,bgCameraMaskRed:E,surroundStyle:Mf,onLivenessDetectionDone:a,onError:c,cropAreaDimension:N,customDirectionIcon:f,captureFrameSettings:l,onFramesCaptured:u,livenessSettings:g,setRemainingTime:R,customStepTimeConstraints:p,onProcessing:h,customErrors:m,apiCredentials:v,outputEncryptionSettings:y,cameraScale:b,passiveModeAuto:w}),D=O.countdownToTakePicture,M=O.cropArea,U=O.curStepIndex,j=O.directionIcon,F=O.faceDetectionError,V=O.handleTriggerPassiveMode,z=O.handleVideoPlayed,K=O.instructions,H=O.isActiveMode,q=O.refVideo,Q=O.showCountdown,W=O.steps,G=O.videoPlayed,X=O.activeCapturing,Y=O.isFirstValidFrameFound,$=O.warmupDone;return t.createElement(Ls,{frontCamera:d,onVideoPlayed:z,onClose:i,flipHorizontal:d,ref:q,videoSettings:Df,onError:c,scale:b,defaultCameraId:C},!$&&t.createElement(bf,null),G?t.createElement(t.Fragment,null,t.createElement(kf,{top:I-15,className:"face-detection-error",error:F}),M.current?t.createElement(Fs,{x:"".concat(M.current.x,"px"),y:"".concat(M.current.y,"px"),width:"".concat(M.current.width,"px"),height:"".concat(M.current.height,"px"),surroundStyle:M.current.surroundStyle},t.createElement(Rf,null),t.createElement(xf,{progress:U/W.length*100,hasError:!!F,showDashedRing:!1,showOutsideRing:!1,insideRingWidth:1,errorRingWidth:1,insideRingStrokeDash:"2"}),Q?t.createElement(Tf,null,D):null,H?t.createElement(t.Fragment,null,t.createElement(Pf,null,j),X&&t.createElement(Of,null)):null,F&&t.createElement(Nf,null)):null,H?t.createElement(t.Fragment,null,x&&t.createElement(Bf,{top:T-30},x),K?t.createElement(Ef,{top:T+5,className:"instructions"},K):null,Y&&t.createElement(Sf,{top:T+35},W.map((function(e,r){var n=e.name,o=e.image.objUrl;return t.createElement(Af,{key:n,active:U>=r,className:"step-item"},o?t.createElement("img",{src:o,alt:""}):t.createElement("span",null,r+1))})))):t.createElement(t.Fragment,null,F||w?null:t.createElement(_f,null,t.createElement(If,{onClick:V},t.createElement(Vs,null))))):null)}Uf.propTypes={apiCheck:p.bool,mode:p.string,onLivenessDetectionDone:p.func,onClose:p.func,onError:p.func,captureFrameSettings:p.shape({}),onFramesCaptured:p.func,frontCamera:p.bool,customDirectionIcon:p.shape({}),customStepTimeConstraints:p.shape({}),onProcessing:p.func,customErrors:p.shape({}),livenessSettings:p.shape({}),apiCredentials:p.shape({accessKey:p.string,secretKey:p.string,apiUrl:p.string}),outputEncryptionSettings:p.shape({}),cameraScale:p.number,defaultCameraId:p.string,passiveModeAuto:p.bool,offsetFaceY:p.number},Uf.defaultProps={apiCheck:!1,mode:null,onLivenessDetectionDone:null,onClose:null,onError:function(){},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:function(){},frontCamera:!0,customDirectionIcon:(mf={},S(mf,V.FaceDirection.LEFT,t.createElement(Nd,{type:V.FaceDirection.LEFT})),S(mf,V.FaceDirection.RIGHT,t.createElement(Nd,{type:V.FaceDirection.RIGHT})),S(mf,V.FaceDirection.UP,t.createElement(Nd,{type:V.FaceDirection.UP})),S(mf,V.FaceDirection.FRONTAL,t.createElement(Nd,{type:V.FaceDirection.FRONTAL})),mf),customStepTimeConstraints:(gf={},S(gf,V.FaceDirection.UP,{delayTime:0}),S(gf,V.FaceDirection.LEFT,{delayTime:0}),S(gf,V.FaceDirection.RIGHT,{delayTime:0}),S(gf,V.FaceDirection.FRONTAL,{delayTime:2e3}),gf),onProcessing:function(){},customErrors:null,livenessSettings:null,apiCredentials:{accessKey:"5767c20d-87aa-4cad-8dbb-f5429f76c34b",secretKey:"c1446919-e60a-4575-a05d-304318212a1b",apiUrl:"https://tv-testing.trustingsocial.com/api"},outputEncryptionSettings:null,cameraScale:1,defaultCameraId:void 0,passiveModeAuto:!1,offsetFaceY:0};var jf,Ff=Object.freeze({__proto__:null,Text:wf,FaceDetectionError:kf,CountdownTime:Bf,FaceVerificationInstructions:Ef,FaceVerificationStepsWrapper:Sf,StepItem:Af,BottomButtonsOverlay:_f,Button:If,CountDownOverlay:Tf,InstructionsOverlay:Pf,default:Uf,useLivenessDetection:Ed}),Vf=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.frontCamera,n=void 0===r||r,o=document.createElement("div");document.body.appendChild(o);var a=function(){C.unmountComponentAtNode(o)};return new Promise((function(e){C.render(t.createElement(Qr.SDKSettingsProvider,{value:{lang:"en"}},t.createElement(Ls,{checkCameraMode:!0,frontCamera:n,onVideoPlayed:function(){a(),e(null)},onClose:a,onError:function(t){a(),e(t)}})),o)}))},zf=h.input(jf||(jf=N(["\n display: none;\n"]))),Kf=u((function(e,r){var n=e.useFileBrowse,a=e.accept,i=e.frontCamera,s=e.onCaptureDone,c=e.outputEncryptionSettings,l=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.target.files,!s){e.next=8;break}if(n=r[0],!c||!c.key){e.next=7;break}return e.next=6,ci.encrypt({blob:n,key:c.key});case 6:o=e.sent;case 7:s({file:n,encrypted:o});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[s,c]);return t.createElement(zf,A({ref:r,type:"file",accept:a,onChange:l},n?{}:{capture:i?"user":"environment"}))}));Kf.propTypes={useFileBrowse:p.bool,accept:p.string,frontCamera:p.bool,onCaptureDone:p.func,outputEncryptionSettings:p.shape({key:p.string})},Kf.defaultProps={useFileBrowse:!1,accept:"image/*",frontCamera:!1,onCaptureDone:null,outputEncryptionSettings:{key:""}};var Hf,qf=Object.freeze({__proto__:null,Camera:Vs}),Qf="landscape",Wf="portrait",Gf="desktop",Xf=V.Errors,Yf=h.div(Hf||(Hf=N(["\n text-align: center;\n font-size: 20px;\n font-weight: 600;\n"])));function $f(e){var n=e.children,o=Qr.useSDKSettings().lang,a=Xf.wrong_orientation.msg[o],i=function(){var e=r(screen.width>screen.height?Qf:Wf),t=L(s(e.current),2),n=t[0],o=t[1];return c((function(){function e(){screen.width>screen.heightt?o(Qf):o(Wf)}return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),mi.isMobile?{curOrientation:n,initOrientation:e.current}:{curOrientation:Gf}}().curOrientation;return t.createElement(t.Fragment,null,i===Qf&&t.createElement(Jd,{open:!0},t.createElement(Yf,null,a)),(i===Wf||i===Gf)&&t.createElement(t.Fragment,null,n))}var Zf=["tracking","clientSettings","livenessSettings","livenessComponent"];function Jf(e){var r=e.tracking,n=void 0===r?{enable:!0}:r,o=e.clientSettings,a=e.livenessSettings,i=e.livenessComponent,s=void 0===i?Uf:i,c=R(e,Zf),l=Yu(o,"data.settings.sdk_settings.active_liveness_settings",a),u=Yu(o,"data.settings.sdk_settings.server_log_settings.enable",n.enable);return t.createElement($f,null,t.createElement(Sn.SDKTrackingProvider,{value:{tracking:I(I({},n),{},{enable:u})}},t.createElement(s,A({},c,{livenessSettings:l}))))}function ep(){return(ep=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 tp(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function rp(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function np(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var op=!1,ap=t.createContext(null),ip="entering",sp="entered",cp=function(e){function r(t,r){var n;n=e.call(this,t,r)||this;var o,a=r&&!r.isMounting?t.enter:t.appear;return n.appearStatus=null,t.in?a?(o="exited",n.appearStatus=ip):o=sp:o=t.unmountOnExit||t.mountOnEnter?"unmounted":"exited",n.state={status:o},n.nextCallback=null,n}rp(r,e),r.getDerivedStateFromProps=function(e,t){return e.in&&"unmounted"===t.status?{status:"exited"}:null};var n=r.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var r=this.state.status;this.props.in?r!==ip&&r!==sp&&(t=ip):r!==ip&&r!==sp||(t="exiting")}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,r,n=this.props.timeout;return e=t=r=n,null!=n&&"number"!=typeof n&&(e=n.exit,t=n.enter,r=void 0!==n.appear?n.appear:t),{exit:e,enter:t,appear:r}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===ip?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:"unmounted"})},n.performEnter=function(e){var t=this,r=this.props.enter,n=this.context?this.context.isMounting:e,o=this.props.nodeRef?[n]:[C.findDOMNode(this),n],a=o[0],i=o[1],s=this.getTimeouts(),c=n?s.appear:s.enter;!e&&!r||op?this.safeSetState({status:sp},(function(){t.props.onEntered(a)})):(this.props.onEnter(a,i),this.safeSetState({status:ip},(function(){t.props.onEntering(a,i),t.onTransitionEnd(c,(function(){t.safeSetState({status:sp},(function(){t.props.onEntered(a,i)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,r=this.getTimeouts(),n=this.props.nodeRef?void 0:C.findDOMNode(this);t&&!op?(this.props.onExit(n),this.safeSetState({status:"exiting"},(function(){e.props.onExiting(n),e.onTransitionEnd(r.exit,(function(){e.safeSetState({status:"exited"},(function(){e.props.onExited(n)}))}))}))):this.safeSetState({status:"exited"},(function(){e.props.onExited(n)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,r=!0;return this.nextCallback=function(n){r&&(r=!1,t.nextCallback=null,e(n))},this.nextCallback.cancel=function(){r=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var r=this.props.nodeRef?this.props.nodeRef.current:C.findDOMNode(this),n=null==e&&!this.props.addEndListener;if(r&&!n){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[r,this.nextCallback],a=o[0],i=o[1];this.props.addEndListener(a,i)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if("unmounted"===e)return null;var r=this.props,n=r.children,o=(r.in,r.mountOnEnter,r.unmountOnExit,r.appear,r.enter,r.exit,r.timeout,r.addEndListener,r.onEnter,r.onEntering,r.onEntered,r.onExit,r.onExiting,r.onExited,r.nodeRef,tp(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return t.createElement(ap.Provider,{value:null},"function"==typeof n?n(e,o):t.cloneElement(t.Children.only(n),o))},r}(t.Component);function lp(){}cp.contextType=ap,cp.propTypes={},cp.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:lp,onEntering:lp,onEntered:lp,onExit:lp,onExiting:lp,onExited:lp},cp.UNMOUNTED="unmounted",cp.EXITED="exited",cp.ENTERING=ip,cp.ENTERED=sp,cp.EXITING="exiting";var up,dp,fp=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return n=t,void((r=e).classList?r.classList.add(n):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(r,n)||("string"==typeof r.className?r.className=r.className+" "+n:r.setAttribute("class",(r.className&&r.className.baseVal||"")+" "+n)));var r,n}))},pp=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return n=t,void((r=e).classList?r.classList.remove(n):"string"==typeof r.className?r.className=np(r.className,n):r.setAttribute("class",np(r.className&&r.className.baseVal||"",n)));var r,n}))},hp=function(e){function r(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,r){var n=t.resolveArguments(e,r),o=n[0],a=n[1];t.removeClasses(o,"exit"),t.addClass(o,a?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,r)},t.onEntering=function(e,r){var n=t.resolveArguments(e,r),o=n[0],a=n[1]?"appear":"enter";t.addClass(o,a,"active"),t.props.onEntering&&t.props.onEntering(e,r)},t.onEntered=function(e,r){var n=t.resolveArguments(e,r),o=n[0],a=n[1]?"appear":"enter";t.removeClasses(o,a),t.addClass(o,a,"done"),t.props.onEntered&&t.props.onEntered(e,r)},t.onExit=function(e){var r=t.resolveArguments(e)[0];t.removeClasses(r,"appear"),t.removeClasses(r,"enter"),t.addClass(r,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var r=t.resolveArguments(e)[0];t.addClass(r,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var r=t.resolveArguments(e)[0];t.removeClasses(r,"exit"),t.addClass(r,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,r){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,r]},t.getClassNames=function(e){var r=t.props.classNames,n="string"==typeof r,o=n?""+(n&&r?r+"-":"")+e:r[e];return{baseClassName:o,activeClassName:n?o+"-active":r[e+"Active"],doneClassName:n?o+"-done":r[e+"Done"]}},t}rp(r,e);var n=r.prototype;return n.addClass=function(e,t,r){var n=this.getClassNames(t)[r+"ClassName"],o=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===r&&o&&(n+=" "+o),"active"===r&&e&&e.scrollTop,n&&(this.appliedClasses[t][r]=n,fp(e,n))},n.removeClasses=function(e,t){var r=this.appliedClasses[t],n=r.base,o=r.active,a=r.done;this.appliedClasses[t]={},n&&pp(e,n),o&&pp(e,o),a&&pp(e,a)},n.render=function(){var e=this.props,r=(e.classNames,tp(e,["classNames"]));return t.createElement(cp,ep({},r,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},r}(t.Component);hp.defaultProps={classNames:""},hp.propTypes={};var mp="out-in",gp="in-out",vp=function(e,t,r){return function(){var n;e.props[t]&&(n=e.props)[t].apply(n,arguments),r()}},yp=((up={})[mp]=function(e){var r=e.current,n=e.changeState;return t.cloneElement(r,{in:!1,onExited:vp(r,"onExited",(function(){n(ip,null)}))})},up[gp]=function(e){var r=e.current,n=e.changeState,o=e.children;return[r,t.cloneElement(o,{in:!0,onEntered:vp(o,"onEntered",(function(){n(ip)}))})]},up),bp=((dp={})[mp]=function(e){var r=e.children,n=e.changeState;return t.cloneElement(r,{in:!0,onEntered:vp(r,"onEntered",(function(){n(sp,t.cloneElement(r,{in:!0}))}))})},dp[gp]=function(e){var r=e.current,n=e.children,o=e.changeState;return[t.cloneElement(r,{in:!1,onExited:vp(r,"onExited",(function(){o(sp,t.cloneElement(n,{in:!0}))}))}),t.cloneElement(n,{in:!0})]},dp),Cp=function(e){function r(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).state={status:sp,current:null},t.appeared=!1,t.changeState=function(e,r){void 0===r&&(r=t.state.current),t.setState({status:e,current:r})},t}rp(r,e);var n=r.prototype;return n.componentDidMount=function(){this.appeared=!0},r.getDerivedStateFromProps=function(e,r){return null==e.children?{current:null}:r.status===ip&&e.mode===gp?{status:ip}:!r.current||(n=r.current,o=e.children,n===o||t.isValidElement(n)&&t.isValidElement(o)&&null!=n.key&&n.key===o.key)?{current:t.cloneElement(e.children,{in:!0})}:{status:"exiting"};var n,o},n.render=function(){var e,r=this.props,n=r.children,o=r.mode,a=this.state,i=a.status,s=a.current,c={children:n,current:s,changeState:this.changeState,status:i};switch(i){case ip:e=bp[o](c);break;case"exiting":e=yp[o](c);break;case sp:e=s}return t.createElement(ap.Provider,{value:{isMounting:!this.appeared}},e)},r}(t.Component);Cp.propTypes={},Cp.defaultProps={mode:mp};var wp={DEFAULT:"default",ERROR:"error"};function kp(e){var r=e.className,o=e.width,a=e.height,i=e.type,s=e.strokeStyles,c=e.strokeWidth,l=e.radius,u=e.paddingStyle,d=n((function(){var e;return I((S(e={},wp.DEFAULT,{fill:"none",strokeWidth:c,stroke:"#fff",strokeDasharray:"7, 4",opacity:.6}),S(e,wp.ERROR,{fill:"rgba(234,50,35, 0.1)",strokeWidth:c,stroke:"#ea3223"}),e),s)}),[c,s]),f=l+.8*c,p=d[i];return t.createElement("svg",{width:o,height:a,className:r},t.createElement("rect",{x:c/2,y:c/2,rx:l,ry:l,width:o-c,height:a-c,style:p}),t.createElement("path",{d:"M0,".concat(f," Q0,0 ").concat(f,",0 L0,0 Z"),style:u}),t.createElement("path",{d:"M0,".concat(a-f," Q0,").concat(a," ").concat(f,",").concat(a," L0,").concat(a," Z"),style:u}),t.createElement("path",{d:"M".concat(o-f,",").concat(a," Q").concat(o,",").concat(a," ").concat(o,",").concat(a-f," L").concat(o,",").concat(a," Z"),style:u}),t.createElement("path",{d:"M".concat(o-f,",0 Q").concat(o,",0 ").concat(o,",").concat(f," L").concat(o,",0 Z"),style:u}))}kp.propTypes={className:p.string,width:p.number,height:p.number,strokeWidth:p.number,strokeStyles:p.shape({}),type:p.oneOf([wp.DEFAULT,wp.ERROR]),radius:p.number,paddingStyle:p.shape({})},kp.defaultProps={className:"",width:600,height:400,strokeWidth:2,strokeStyles:{},type:wp.DEFAULT,radius:10,paddingStyle:{fill:"rgba(0, 0, 0, 0.6)"}};var Bp,Ep,Sp,Ap,_p,Ip,Tp,Pp,xp,Rp,Np,Lp,Op,Dp,Mp,Up,jp,Fp,Vp,zp=g(["from{transform:perspective(400px);}to{transform:perspective(400px) rotateY(90deg);}"]),Kp=g(["from{transform:perspective(400px) rotateY(-90deg);}to{transform:perspective(400px);}"]),Hp=y([".flipY-exit{animation-name:",";animation-duration:","ms;animation-timing-function:ease-in;}.flipY-enter{animation-name:",";animation-duration:","ms;animation-timing-function:ease-out;}"],zp,500,Kp,500),qp=Object.freeze({__proto__:null,animationDuration:500,default:Hp}),Qp=g(["from,to{transform:translate3d(-","px,0,0);}50%{transform:translate3d(","px,0,0);}"],20,20),Wp=g(["from,to{transform:translate3d(0,-","px,0);}50%{transform:translate3d(0,","px,0);}"],20,20),Gp=y([".slide-horizontal{animation-name:",";animation-iteration-count:infinite;animation-duration:2000ms;animation-timing-function:linear;}.slide-vertical{animation-name:",";animation-iteration-count:infinite;animation-duration:2000ms;animation-timing-function:linear;}"],Qp,Wp),Xp=Object.freeze({__proto__:null,default:Gp}),Yp=g(["from,to{opacity:1;}50%{opacity:0;}"]),$p=y([".blink{animation-name:",";animation-iteration-count:infinite;animation-duration:2000ms;animation-timing-function:linear;}"],Yp),Zp=Object.freeze({__proto__:null,default:$p}),Jp=h.div(Bp||(Bp=N(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: ","; // must be higher than BASE_Z_INDEX and lower than other layers\n"])),1001),eh=g(["from{background:#000;}to{}"]),th=y([".splash-enter{animation-name:",";animation-duration:","ms;animation-timing-function:ease-in;}"],eh,300),rh=h.div(Ep||(Ep=N(["\n ","\n"])),th),nh=function(e){var r=e.keyForTransition,n=void 0===r?0:r;return t.createElement(rh,null,t.createElement(Cp,null,t.createElement(hp,{key:n,timeout:{enter:300,exit:0},classNames:"splash",unmountOnExit:!1},t.createElement(Jp,null))))},oh=Object.freeze({__proto__:null,default:nh}),ah=g(["from{transform:rotate(0deg);}to{transform:rotate(360deg);}"]),ih=y([".spin{animation-name:",";animation-iteration-count:infinite;animation-duration:1000ms;animation-timing-function:linear;}"],ah),sh=Object.freeze({__proto__:null,default:ih}),ch=Object.freeze({__proto__:null,flipY:qp,slide:Xp,blink:Zp,splash:oh,spin:sh}),lh=nh,uh=h.div(Sp||(Sp=N(["\n ","\n ","\n"])),Hp,ih),dh=h.img(Ap||(Ap=N(["\n border-radius: 5px;\n opacity: 0.7;\n height: 38px;\n"]))),fh=h.div(_p||(_p=N(["\n cursor: pointer;\n text-align: center;\n width: ","px;\n\n img {\n width: 100%;\n }\n\n z-index: ",";\n position: fixed;\n\n ","\n"])),60,1020,mi.isMobile?y(["top:",";"],(function(e){return e.y})):y(["bottom:","px;"],10)),ph=h.div(Ip||(Ip=N(["\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n position: absolute;\n margin: auto;\n width: ","px;\n height: ","px;\n\n img {\n width: 100%;\n }\n\n z-index: ",";\n"])),100,100,1020),hh=h.div(Tp||(Tp=N(["\n color: #fff;\n text-align: center;\n"]))),mh=h.div(Pp||(Pp=N(["\n transform: translateZ(1000px); // to fix rotating bug on safari\n transform-style: preserve-3d;\n position: absolute;\n top: ",";\n z-index: ",";\n"])),(function(e){return e.y}),1020),gh=h.div(xp||(xp=N(["\n display: flex;\n align-items: center;\n"]))),vh=h(hh)(Rp||(Rp=N(["\n font-size: 20px;\n margin-left: 10px;\n color: #fff;\n"]))),yh=h(hh)(Np||(Np=N(["\n font-size: 20px;\n margin-left: 10px;\n color: green;\n position: absolute;\n left: 0;\n top: 10px;\n background: white;\n z-index: ",";\n"])),1030),bh=h(hh)(Lp||(Lp=N(["\n position: absolute;\n font-size: 16px;\n text-align: center;\n color: #fff;\n top: ",";\n z-index: ",";\n"])),(function(e){return e.y}),1020),Ch=h(bh)(Op||(Op=N(["\n background: #ea3223;\n padding: 5px 10px;\n border-radius: 3px;\n"]))),wh=h(hh)(Dp||(Dp=N(["\n position: absolute;\n font-size: 18px;\n text-align: center;\n border-radius: 3px;\n padding: 5px 10px;\n background: #ea3223;\n color: #fff;\n margin: 0 10px;\n top: ",";\n z-index: ",";\n"])),(function(e){return e.y}),1020),kh=(h.div(Mp||(Mp=N(["\n font-size: 18px;\n text-align: center;\n padding: 10px;\n"]))),h(kp)(Up||(Up=N(["\n position: absolute;\n top: 0;\n left: 0;\n"])))),Bh={BTN_OK:{en:"OK",vi:"Tôi đã hiểu"},FRONT:{en:"front",vi:"trước"},BACK:{en:"back",vi:"sau"},BTN_USE_THIS_PICTURE:{en:"Use this picture",vi:"Dùng ảnh này"},BTN_TRY_AGAIN:{en:"Try again",vi:"Thử lại"},CONFIRM_POPUP_VALID_QR:{en:"QR code scanned",vi:"Đã quét được mã QR"},CONFIRM_POPUP_INVALID_QR:{en:"Could not scan QR code",vi:"Không quét được mã QR"}},Eh=V.IDCardMessage,Sh=h.div(jp||(jp=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 10px;\n"]))),Ah=h.div(Fp||(Fp=N(["\n text-align: center;\n font-size: 1rem;\n"]))),_h=h.button(Vp||(Vp=N(["\n margin-top: 20px;\n width: 100%;\n max-width: 160px;\n height: 50px;\n background-color: ",";\n border: 0;\n outline: none;\n border-radius: 0.25rem;\n color: #fff;\n font-weight: 400;\n cursor: pointer;\n font-size: 1rem;\n"])),(function(e){return e.theme.tsBlue})),Ih=function(e){var r=e.onOk,n=e.maxSessionTime,o=Qr.useSDKSettings().lang;return t.createElement(Sh,null,t.createElement(Ah,{className:"popup-message"},lu(Eh.TIMEOUT_INSTRUCTION[o])({x:n})),t.createElement(_h,{className:"popup-button",onClick:r},Bh.BTN_OK[o]))};Ih.propTypes={onOk:p.func,maxSessionTime:p.number},Ih.defaultProps={onOk:function(){},maxSessionTime:30};var Th=function(){var e=L(s(!1),2),t=e[0],r=e[1],n=L(s(null),2),a=n[0],i=n[1],c=L(s({}),2),l=c[0],u=c[1];return{showPopup:o((function(e){var t=e.popupType,n=e.props;u(void 0===n?{}:n),i(t),r(null!==t)}),[]),popupShown:t,popupType:a,props:l}},Ph="SESSION_TIMEOUT",xh="CONFIRM",Rh="QR_INVALID",Nh="QR_INSTRUCTIONS",Lh=V.Errors;function Oh(e,t){return Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)}function Dh(e,t){return Math.sqrt(Oh(e,t))}function Mh(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.canvas,r=e.imgMargin,n=void 0===r?.15:r,o=window,a=o.cv,i=t.width,s=t.height,c=n;c<1&&(c=parseInt(.5*(s+i)*c,10));var l=a.imread(t),u=new a.Mat;return a.copyMakeBorder(l,u,c,c,c,c,a.BORDER_CONSTANT,new a.Scalar(0,0,0,255)),l.delete(),{mat:u,margin:c}}function Uh(e,t){var r=window.cv,n=L(t.map((function(e){return e.location})),4),o=n[0],a=n[1],i=n[2],s=n[3],c=Dh(i,s),l=Dh(a,o),u=Math.max(c,l),d=Dh(a,i),f=Dh(o,s),p=Math.max(d,f),h=[o.x,o.y,a.x,a.y,i.x,i.y,s.x,s.y],m=[0,0,u-1,0,u-1,p-1,0,p-1],g=r.imread(e),v=new r.Mat,y=new r.Size(u,p),b=r.matFromArray(4,1,r.CV_32FC2,h),C=r.matFromArray(4,1,r.CV_32FC2,m),w=r.getPerspectiveTransform(b,C);r.warpPerspective(g,v,w,y,r.INTER_LINEAR,r.BORDER_CONSTANT,new r.Scalar);var k=new ImageData(new Uint8ClampedArray(v.data),v.cols,v.rows);return g.delete(),v.delete(),b.delete(),C.delete(),k}function jh(e,t,r){var n={x:t.x-e.x,y:t.y-e.y},o={x:r.x-e.x,y:r.y-e.y},a=Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)),i=Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2));return 180*Math.acos((n.x*o.x+n.y*o.y)/(a*i))/Math.PI}function Fh(e){var t=e.corners,r=e.width,n=e.height,o=Number.MAX_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER,i=Number.MIN_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER;t.forEach((function(e){var t=e.location,r=t.x,n=t.y;o=Math.min(o,r),a=Math.min(a,n),i=Math.max(i,r),s=Math.max(s,n)}));var c=.02;return o/r>=c&&a/n>=c&&(n-s)/n>=c&&(r-i)/r>=c}function Vh(){return zh.apply(this,arguments)}function zh(){return(zh=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c,l,u,d,f,p=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:{},r=t.canvas,n=t.paddingPercent,o=void 0===n?.04:n,a=r.width,i=r.height,s=Math.floor(a*o),c=Math.floor(i*o),l=a-2*s,u=i-2*c,d=document.createElement("canvas"),f=d.getContext("2d"),d.width=l,d.height=u,f.drawImage(r,s,c,l,u,0,0,l,u),e.abrupt("return",Ea.isCardGlare(d));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Kh(e){for(var t=e.length,r=0;r<t;r++){var n=(r+t-1)%t,o=(r+1)%t,a=jh(e[r].location,e[n].location,e[o].location);if(a<70||a>110)return!1}return!0}function Hh(e){return qh.apply(this,arguments)}function qh(){return(qh=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.blazefaceModel,n=t.predictedIdCardCanvas,o=t.frontSide,a=n.width,i=n.height,s=Math.floor(a/3),c=Math.floor(4*i/5),l=document.createElement("canvas"),u=l.getContext("2d"),l.width=s,l.height=c,u.drawImage(n,0,Math.floor(i/5),s,c,0,0,s,c),e.next=12,ko.getModelPredictions({model:r,sCanvas:l});case 12:if(d=e.sent,f=d.filter((function(e){var t=e.topLeft,r=e.bottomRight,n=L(e.probability,1)[0],o=e.landmarks;return!(n<.9||o.length<4)&&!(lo.rectAreaRatio({small:{coords:[t,r]},big:{coords:[[0,0],[ko.SIZE,ko.SIZE]]}})<.025)})),p=f.length,!o){e.next=22;break}if(0!==p){e.next=18;break}return e.abrupt("return",Lh.id_detector_error_front_side_no_faces);case 18:if(!(p>1)){e.next=20;break}return e.abrupt("return",Lh.id_detector_error_front_side_multiple_faces);case 20:e.next=24;break;case 22:if(!(p>0)){e.next=24;break}return e.abrupt("return",Lh.id_detector_error_back_side_has_faces);case 24:return e.abrupt("return",null);case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Qh=function(e,t,r){return e==e&&(void 0!==r&&(e=e<=r?e:r),void 0!==t&&(e=e>=t?e:t)),e};var Wh=function(e,t,r){return void 0===r&&(r=t,t=void 0),void 0!==r&&(r=(r=pc(r))==r?r:0),void 0!==t&&(t=(t=pc(t))==t?t:0),Qh(pc(e),t,r)},Gh="https://unpkg.com/@tsocial/tv_web_sdk_resources@1.0.0/libs/opencv.js";function Xh(){return(Xh=B(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.url,n=void 0===r?Gh:r,!window.cv){e.next=3;break}return e.abrupt("return",Promise.resolve());case 3:return e.next=5,Ka.loadExternalScript({url:n});case 5:return e.abrupt("return",new Promise((function(e){window.cv.onRuntimeInitialized=e})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Yh=nd((function(e){return Xh.apply(this,arguments)})),$h="https://unpkg.com/@tsocial/tv_web_sdk_resources@1.0.0/models/id-card/tflite/qtf16_model_224x224.tflite",Zh={0:"top-left",1:"top-right",2:"bottom-right",3:"bottom-left",4:"cccd.front",5:"passport",6:"cmnd_old.front",7:"cmnd_old.back",8:"cmnd_new.front",9:"cmnd_new.back",10:"cccd_new.front",11:"cccd_new.back"};function Jh(e){var t,r,n,o,a,i=e.card,s=e.corners,c=i.box,l={x:(c[1]+c[3])/2,y:(c[0]+c[2])/2},u=c[2]-c[0],d=c[1]-c[3],f=U(s);try{for(f.s();!(a=f.n()).done;){var p=a.value;switch(p.label){case"top-left":t||(t=p.location);break;case"top-right":r||(r=p.location);break;case"bottom-right":n||(n=p.location);break;case"bottom-left":o||(o=p.location)}}}catch(e){f.e(e)}finally{f.f()}if(![t,r,n,o].every(Boolean))return console.debug("Not qualified, corners missing"),!1;var h={x:(t.x+n.x)/2,y:(t.y+n.y)/2},m={x:(r.x+o.x)/2,y:(r.y+o.y)/2},g=Oh(l,h),v=Oh(l,m);return Math.sqrt(g)>(u+d)/8||Math.sqrt(v)>(u+d)/8?(console.debug("Not qualified, not close enough"),!1):(console.debug("Qualified"),!0)}var em=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n,o,a,i,s,c,l;return t=e,(r=[{key:"load",value:(l=B(regeneratorRuntime.mark((function e(){var t,r,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},r=t.opencvUrl,n=t.modelUrl,e.next=3,Promise.all([Yh({url:r}),this.loadModel({modelUrl:n})]);case 3:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"loadModel",value:(c=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{},r=t.modelUrl,n=void 0===r?$h:r,e.next=3,oi.initTensorFlow({preferredBackends:["webgl","wasm","cpu"]});case 3:return e.next=5,oi.loadTFLiteModel({modelUrl:n});case 5:this.model=e.sent,o=this.model.inputs,this.inputSize=[o[0].shape[1],o[0].shape[2]];case 8:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"loadResource",value:(s=B(regeneratorRuntime.mark((function e(){var t,r,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},r=t.modelUrl,n=void 0===r?$h:r,e.next=3,oi.preloadResource({modelUrl:n});case 3:case"end":return e.stop()}}),e)}))),function(){return s.apply(this,arguments)})},{key:"dispose",value:(i=B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.model&&this.model.dispose();case 1:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"predict",value:(a=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k,B,E,S,A,_,I,T=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=T.length>1&&void 0!==T[1]?T[1]:{},n=r.imgMargin,o=void 0===n?.5:n,a=r.detectThreshold,i=void 0===a?.3:a,s=r.maxNumReturns,c=void 0===s?100:s,l=window,u=l.cv,d={},f=t.width,p=t.height,d.originalWidth=f,d.originalHeight=p,h=Mh({canvas:t,imgMargin:o}),m=h.margin,g=h.mat,v=L(this.inputSize,2),y=v[0],b=v[1],C=new u.Mat,u.resize(g,C,new u.Size(y,b),0,0,u.INTER_AREA),w=g.cols/y,k=g.rows/b,(B=document.createElement("canvas")).width=y,B.height=b,B.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(C.data),C.cols,C.rows),0,0),g.delete(),C.delete(),d.canvas=B,d.margin=m,e.next=24,this.detect(B,{detectThreshold:i,maxNumReturns:c});case 24:if(E=e.sent,S={inputImage:d,card:null},A=[],_=[],E.forEach((function(e){var t=L(e.box,4),r=t[0],n=t[1],o=t[2],a=t[3];e.clazz<=3?A.push({clazz:e.clazz,label:e.label,score:e.score,location:{x:Wh(Math.floor((a+n)/2*w-m),0,f),y:Wh(Math.floor((r+o)/2*k-m),0,p)},scaledLocation:{x:Wh(Math.floor((a+n)/2),0,B.width),y:Wh(Math.floor((r+o)/2),0,B.height)}}):_.push({label:e.label,score:e.score,box:[Wh(Math.floor(r*k-m),0,p),Wh(Math.floor(n*w-m),0,f),Wh(Math.floor(o*k-m),0,p),Wh(Math.floor(a*w-m),0,f)]})})),A.sort((function(e,t){return t.score-e.score})),_.sort((function(e,t){return t.score-e.score})),!(_.length>0)){e.next=40;break}if(Jh({card:I=_[0],corners:A})){e.next=36;break}return console.debug("Not qualified.",I,A),e.abrupt("return",S);case 36:return A.sort((function(e,t){return e.clazz-t.clazz})),I.corners=A,S.card=I,e.abrupt("return",S);case 40:return e.abrupt("return",S);case 41:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"detect",value:(o=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k,B,E,S=this,A=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=A.length>1&&void 0!==A[1]?A[1]:{},n=r.detectThreshold,o=r.maxNumReturns,a=window,i=a.tf,s=t.width,c=t.height,l=i.tidy((function(){var e=i.expandDims(i.cast(i.image.resizeNearestNeighbor(i.browser.fromPixels(t),S.inputSize),"float32"));return S.model.predict(e)})),e.next=7,Promise.all([l["StatefulPartitionedCall:1"].data(),l["StatefulPartitionedCall:2"].data(),l["StatefulPartitionedCall:3"].array()]);case 7:for(u=e.sent,d=L(u,3),f=d[0],p=d[1],h=L(d[2],1),m=h[0],g=[],v=Math.min(f.length,o),y=0;y<v;y++)(b=f[y])>n&&(w=p[y],k=null!==(C=Zh[Math.round(w)])&&void 0!==C?C:"NA",B=m[y],E=[B[0]*c,B[3]*s,B[2]*c,B[1]*s],g.push({score:b,clazz:w,box:E,label:k}));return e.abrupt("return",g);case 17:case"end":return e.stop()}}),e)}))),function(e){return o.apply(this,arguments)})}])&&E(t.prototype,r),n&&E(t,n),e}();function tm(e){return rm.apply(this,arguments)}function rm(){return(rm=B(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.idCardModel,e.abrupt("return",new Promise((function(e,t){var n=document.createElement("canvas");setTimeout(t,1e3),r.predict(n).then(e)})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function nm(e){return om.apply(this,arguments)}function om(){return(om=B(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.idCardModel,n=!0,e.prev=2,o=performance.now(),e.next=6,tm({idCardModel:r});case 6:performance.now()-o>1e3&&(n=!1),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(2),n=!1;case 13:return e.abrupt("return",{fastEnough:n});case 14:case"end":return e.stop()}}),e,null,[[2,10]])})))).apply(this,arguments)}function am(){return(am=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c,l,u,d,f,p,h=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=h.length>0&&void 0!==h[0]?h[0]:{},r=t.opencvUrl,n=t.idCardModelUrl,o=t.blazefaceModelUrl,a=t.tfScriptUrls,"iOS"!==mi.osName||!mi.osVersion.includes("12.")){e.next=5;break}return e.next=4,Yh({url:r});case 4:return e.abrupt("return",{ableToUseModel:!1});case 5:return e.next=7,oi.loadTensorFlow(a);case 7:return i=new em,e.next=10,Promise.all([oi.loadBlazefaceModel({modelUrl:o}),i.load({opencvUrl:r,modelUrl:n})]);case 10:return s=e.sent,c=L(s,1),l=c[0],u=!0,d=document.createElement("canvas"),e.prev=15,e.next=18,i.predict(d);case 18:return e.next=20,nm({idCardModel:i});case 20:f=e.sent,p=f.fastEnough,u=p,e.next=28;break;case 25:e.prev=25,e.t0=e.catch(15),u=!1;case 28:return e.abrupt("return",{ableToUseModel:u,idCardModel:i,blazefaceModel:l});case 29:case"end":return e.stop()}}),e,null,[[15,25]])})))).apply(this,arguments)}var im=nd((function(){return am.apply(this,arguments)})),sm=V.Errors;function cm(e){var t=e.refVideo,n=e.shouldStart,a=e.cropArea,i=e.settings,s=r(null);null===s.current&&(s.current=document.createElement("canvas"));var l=r(!1),u=r(Ca.createResizer({width:960,height:640})),d=r(null),f=r([{id:null,frames:[]}]),p=o((function(){!0===l.current&&(l.current=!1)}),[]),h=o((function(){f.current=[{id:null,frames:[]}]}),[]),m=o((function(){var e=f.current;e[e.length-1].frames.length>0&&e.push({id:null,frames:[]})}),[]),g=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.workingCanvas,n=u.current,o=f.current,a=n.resize({srcCanvas:r}),s=a.toDataURL("image/jpeg",i.saveFrameQuality/100).split(",")[1],o[o.length-1].frames.push({base64:s});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[i]),v=o(B(regeneratorRuntime.mark((function e(){var r,n,o,a,c,u,f,p,h,m,v;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i){e.next=2;break}return e.abrupt("return");case 2:if(r=i.frameCaptureIntervalMs,i.enableRecording){e.next=5;break}return e.abrupt("return");case 5:n=d.current,o=t.current,l.current=!0,a=n.cropX,c=n.cropY,u=n.cropWidth,f=n.cropHeight,(p=s.current).width=u,p.height=f,h=p.getContext("2d"),m=null;case 14:if(h.drawImage(o,a,c,u,f,0,0,u,f),!r){e.next=25;break}if(v=(new Date).getTime(),!(v-m>=r)){e.next=23;break}return e.next=22,g({workingCanvas:p});case 22:m=v;case 23:e.next=27;break;case 25:return e.next=27,g({workingCanvas:p});case 27:if(l.current){e.next=29;break}return e.abrupt("break",33);case 29:return e.next=31,Pn.sleep(15);case 31:e.next=14;break;case 33:case"end":return e.stop()}}),e)}))),[t,g,i]);return c((function(){var e=t.current;function r(){return(r=B(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.current=ro.analyzeVideoAndWindowSizes(e,a),t.next=3,v();case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return n&&a&&function(){r.apply(this,arguments)}(),function(){p()}}),[n,a,t,p,m,v]),{refWorkingCanvas:s,stopCheckFrame:p,splitVideos:m,resetRecordedVideos:h,checkFrame:v,refRecordedVideos:f}}var lm,um,dm,fm=function(e){var t=e.lang,n=e.onAboutToTimeout,a=e.onSessionTimeout,i=e.onVideoTimeLimitReached,l=e.settings,u=e.shouldStartTimers,d=e.sessionTime,f=r(),p=L(s(0),2),h=p[0],m=p[1],g=o((function(){clearInterval(f.current)}),[]),v=o((function(){m((function(e){return e+1}))}),[]);return c((function(){if(u){var e=l.maxRecordingTimePerVideo,t=0,r=d/3;f.current=setInterval((function(){var o=d-(t+=1);o<=r&&n&&n({curTimeLeft:o}),t>0&&t%e==0&&i&&i(),0===o&&(g(),a&&a())}),1e3)}return function(){g()}}),[u,t,n,g,a,i,h,l,d]),{stopTimers:g,startTimers:v}},pm=function(e){var t=e.shouldStart,n=e.refVideo,a=e.cropArea,i=e.settings,l=e.onModelErrorChange,u=e.frontSide,d=e.onDebugInfoChange,f=e.onAboutToTimeout,p=e.onSessionTimeout,h=e.onCaptureDone,m=e.outputEncryptionSettings,g=e.quality,v=r(!1),y=L(s(!1),2),b=y[0],C=y[1],w=r((function(){})),k=Sn.useSDKTracking().sendEvent,E=r(),S=r(),A=r(),_=Qr.useSDKSettings(),I=_.debug,T=_.lang,P=_.enableAntiDebug;c((function(){P&&ai.enableAntiDebug()}),[P]);var x=o(function(){var e=B(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return k({tag:u?"id_front":"id_back",event:"sdk_ui.auto_capture",log:{}}),e.next=3,w.current(t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[k,u]),R=o((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];l.apply(void 0,t);var n=Yu(t,"0.code");n&&n!==E.current&&k({tag:u?"id_front":"id_back",event:"sdk_ui.show_alert",log:{alert:n}}),E.current=n}),[l,u,k]),N=function(e){var t=e.refVideo,n=e.shouldStart,a=e.cropArea,i=e.settings,l=e.onError,u=e.frontSide,d=e.onAutoCaptureSuccess,f=e.quality,p=r(null);null===p.current&&(p.current=document.createElement("canvas"));var h=r(!1),m=r(null),g=L(s(!1),2),v=g[0],y=g[1],b=r({imageBlob:null,takenAt:null,blurScore:null,detectedCard:null}),C=r({imageBlob:null,blurScore:null,error:null,detectedCard:null}),w=r(!1),k=r(!1),E=r(null),S=r(!1),A=r({}),_=Qr.useSDKSettings().customUrls;c((function(){var e=!1;function t(){return(t=B(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!i||v){t.next=12;break}if(!i.enableIdDetection){t.next=8;break}return t.next=4,im(_);case 4:A.current=t.sent,E.current=i.enableBlurCheck&&A.current.ableToUseModel,t.next=9;break;case 8:E.current=!1;case 9:if(!e){t.next=11;break}return t.abrupt("return");case 11:y(!0);case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return function(){t.apply(this,arguments)}(),function(){e=!0}}),[v,i,_]);var I=o((function(){!0===h.current&&(h.current=!1)}),[]),T=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.blurScore,n=t.detectedCard,o=i.blurThreshold,a=b.current,s=C.current,!(r<o&&eo.hasBetterCardBlurScore(r,a.blurScore))){e.next=15;break}if(!S.current){e.next=9;break}a.imageBlob=s.imageBlob,e.next=12;break;case 9:return e.next=11,ro.takePicture({canvas:p.current,quality:f});case 11:a.imageBlob=e.sent;case 12:a.takenAt=(new Date).getTime(),a.blurScore=r,a.detectedCard=n;case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[i,f]),P=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.blurScore,n=t.detectedCard,k.current=!0,o=C.current,!eo.hasBetterCardBlurScore(r,o.blurScore)){e.next=10;break}return e.next=6,ro.takePicture({canvas:p.current,quality:f});case 6:o.imageBlob=e.sent,o.blurScore=r,o.detectedCard=n,S.current=!0;case 10:k.current=!1;case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[f]),x=o(B(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.waitForBestImageTimeMs,null===(r=b.current).imageBlob){e.next=8;break}if(!((new Date).getTime()-r.takenAt>t)){e.next=8;break}return e.next=7,d(r);case 7:I();case 8:case"end":return e.stop()}}),e)}))),[d,i,I]),R=o((function(){w.current=!0}),[]),N=o((function(){return new Promise((function(e){w.current=!1;var t=setInterval((function(){k.current||(clearInterval(t),e())}),150)}))}),[]),O=o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){var t=i.blurThreshold,r=C.current;E.current?(R(),setTimeout((function(){N().then((function(){eo.hasBetterCardBlurScore(r.blurScore,t)||(r.error=sm.id_detector_error_blur),null===r.imageBlob?ro.takePicture({canvas:p.current,quality:f}).then((function(t){r.imageBlob=t,e(r)})):e(r)}))}),2e3)):ro.takePicture({canvas:p.current,quality:f}).then((function(t){r.imageBlob=t,e(r)}))})));case 1:case"end":return e.stop()}}),e)}))),[i,R,N,f]),D=o(B(regeneratorRuntime.mark((function e(){var r,n,o,a,s,c,d,f,g,y,k,B,E,_,I,R,N,L,O,D,M,U,j,F,V;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i&&v&&!h.current){e.next=2;break}return e.abrupt("return");case 2:b.current={imageBlob:null,takenAt:null,blurScore:null,detectedCard:null},C.current={imageBlob:null,blurScore:null,error:null,detectedCard:null},r=i.enableAutoCapture,n=i.enableBlurCheck,o=i.enableIdDetection,a=A.current,s=a.idCardModel,c=a.blazefaceModel,d=a.ableToUseModel,f=m.current,g=t.current,h.current=!0,y=f.cropX,k=f.cropY,B=f.cropWidth,E=f.cropHeight,_=f.cropWidthWithoutPadding,I=f.cropHeightWithoutPadding,(R=p.current).width=B,R.height=E,N=R.getContext("2d"),L=document.createElement("canvas"),O=L.getContext("2d"),D=o&&d?15:700;case 17:if(N.drawImage(g,y,k,B,E,0,0,B,E),S.current=!1,!o||!d){e.next=74;break}return M=null,e.next=24,s.predict(R,{detectThreshold:.3});case 24:if(!(U=e.sent).card){e.next=70;break}if(!Fh({corners:U.card.corners,width:B,height:E})){e.next=67;break}if(!Kh(U.card.corners)){e.next=64;break}if(j=Uh(R,U.card.corners),!((F=lo.rectAreaRatio({small:{area:j.width*j.height},big:{area:_*I}}))<.5)){e.next=36;break}M=sm.id_detector_card_too_small,e.next=62;break;case 36:if(!(F>.95)){e.next=40;break}M=sm.id_detector_error_incomplete,e.next=62;break;case 40:return L.width=j.width,L.height=j.height,O.putImageData(j,0,0),e.next=45,Vh({canvas:L});case 45:if(!e.sent){e.next=50;break}M=sm.glare_detected,e.next=62;break;case 50:return e.next=52,Hh({blazefaceModel:c,predictedIdCardCanvas:L,frontSide:u});case 52:if(M=e.sent){e.next=62;break}if(!n){e.next=62;break}if(V=eo.calculateIdCardBlurScore({canvas:L}),!w.current){e.next=59;break}return e.next=59,P({blurScore:V,detectedCard:U.card});case 59:if(!r){e.next=62;break}return e.next=62,T({blurScore:V,detectedCard:U.card});case 62:e.next=65;break;case 64:M=sm.id_detector_validate_angle_error;case 65:e.next=68;break;case 67:M=sm.id_detector_error_incomplete;case 68:e.next=71;break;case 70:M=sm.id_detector_no_cards;case 71:return l(M),e.next=74,x();case 74:if(h.current){e.next=76;break}return e.abrupt("break",80);case 76:return e.next=78,Pn.sleep(D);case 78:e.next=17;break;case 80:case"end":return e.stop()}}),e)}))),[t,i,v,u,l,T,P,x]);c((function(){var e=t.current;function r(){return(r=B(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return m.current=ro.analyzeVideoAndWindowSizes(e,a,.05),t.next=3,D();case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}n&&a&&v&&function(){r.apply(this,arguments)}()}),[n,a,t,I,D,v]);var M=o((function(){I()}),[I]);return c((function(){return M}),[M]),{refWorkingCanvas:p,stopCheckFrame:I,checkFrame:D,warmupDone:v,takePictureManually:O,refAbleToRunBurstMode:E}}({refVideo:n,shouldStart:t,cropArea:a,settings:i,onError:R,frontSide:u,onAutoCaptureSuccess:x,quality:g}),O=N.refWorkingCanvas,D=N.stopCheckFrame,M=N.checkFrame,U=N.warmupDone,j=N.takePictureManually,F=N.refAbleToRunBurstMode,V=cm({refVideo:n,shouldStart:t&&U,cropArea:a,settings:i}),z=V.stopCheckFrame,K=V.splitVideos,H=V.resetRecordedVideos,q=V.checkFrame,Q=V.refRecordedVideos;!function(e){var t=e.debug,r=e.refRecordedVideos,n=e.refWorkingCanvas,o=e.refVideo,a=e.onChange;c((function(){var e;return t&&(e=setInterval((function(){var e=o.current,t=r.current,i=n.current,s=t[t.length-1],c={videoWidth:e.videoWidth,videoHeight:e.videoHeight,framesCount:s.frames.length,"window.innerWidth":window.innerWidth,"window.innerHeight":window.innerHeight,"canvas.width":null==i?void 0:i.width,"canvas.height":null==i?void 0:i.height};a&&a(JSON.stringify(c,null,2))}),1e3)),function(){return clearInterval(e)}}),[a,t,r,n,o])}({debug:I,refRecordedVideos:Q,refWorkingCanvas:O,refVideo:n,onChange:d});var W=o((function(){z(),D(),H(),p()}),[H,z,D,p]),G=o((function(){K()}),[K]),X=fm({lang:T,onAboutToTimeout:f,onSessionTimeout:W,onVideoTimeLimitReached:G,settings:i,shouldStartTimers:U&&t&&(null==i?void 0:i.enableTimers),sessionTime:null==i?void 0:i.idCardSessionTime}),Y=X.stopTimers,$=X.startTimers,Z=o((function(){v.current=!1}),[]),J=o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Z(),$(),e.next=4,Promise.all([q(),M()]);case 4:case"end":return e.stop()}}),e)}))),[q,M,$,Z]),ee=o(B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]?s[0]:{},r=t.imageBlob,n=t.error,o=t.detectedCard,!v.current){e.next=3;break}return e.abrupt("return");case 3:if(v.current=!0,C(!0),z(),D(),Y(),R(null),!m||!m.key){e.next=14;break}return i=m.key,e.next=13,ci.encrypt({blob:r,key:i});case 13:a=e.sent;case 14:h({image:{blob:r,encrypted:a,detectedCard:o},error:n,recordedVideos:Q.current}),C(!1),k({tag:u?"id_front":"id_back",event:"user_activity",log:{time_capture_in_seconds:(performance.now()-A.current)/1e3}});case 17:case"end":return e.stop()}}),e)}))),[z,D,Y,R,h,Q,u,k,m]);w.current=ee;var te=o(B(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return C(!0),Y(),z(),F.current||D(),e.next=6,j();case 6:return t=e.sent,e.next=9,ee(t);case 9:C(!1),k({tag:u?"id_front":"id_back",event:"user_activity.capture",log:{}});case 11:case"end":return e.stop()}}),e)}))),[j,ee,Y,F,z,D,k,u]);return c((function(){t&&(k({tag:u?"id_front":"id_back",event:"user_activity.start",log:{}}),S.current=performance.now())}),[k,u,t]),c((function(){U&&(k({tag:u?"id_front":"id_back",event:"user_activity.show",log:{}}),k({tag:u?"id_front":"id_back",event:"sdk.load_model",log:{status:"success",time_in_ms:performance.now()-S.current}}),A.current=performance.now())}),[k,u,U]),{warmupDone:U,isProcessing:b,takePictureManually:te,restartSession:J,resetIsProcessingImageBlobTaken:Z}},hm=V.IDCardMessage,mm=u((function(e,r){var n=e.description,a=e.usePortraitMask,i=e.windowAndVideoInfo,l=e.refVideo,u=e.frontSide,f=e.settings,p=e.onCaptureDone,h=e.onUISpacingChange,m=e.outputEncryptionSettings,g=L(s({}),2),v=g[0],y=g[1],b=v.yDescription,C=v.yMessage,w=v.yCaptureButton,k=In.useAsset("ic_camera.svg"),E=In.useAsset("ic_loading.png"),S=L(s(""),2),A=S[0],_=S[1],I=Qr.useSDKSettings(),T=I.debug,P=I.lang,x=L(s(null),2),R=x[0],N=x[1],O=L(s(""),2),D=O[0],M=O[1],U=L(s(null),2),j=U[0],F=U[1],V=Th(),z=V.showPopup,K=V.popupShown,H=V.popupType,q=o((function(e){M(null===e?"":lu(e.msg[P])({side:u?Bh.FRONT[P]:Bh.BACK[P]}))}),[P,u]),Q=o((function(){N(""),z({popupType:Ph})}),[z]),W=o((function(){N(""),p.apply(void 0,arguments)}),[p]),G=o((function(e){var t=e.curTimeLeft;N(lu(hm.REMAINING_TIME[P])({x:t}))}),[P]),X=pm({shouldStart:!0,refVideo:l,cropArea:j,settings:f,onModelErrorChange:q,frontSide:u,onDebugInfoChange:_,onSessionTimeout:Q,onCaptureDone:W,onAboutToTimeout:G,outputEncryptionSettings:m}),Y=X.warmupDone,$=X.isProcessing,Z=X.takePictureManually,J=X.restartSession,ee=X.resetIsProcessingImageBlobTaken,te=o((function(){z({popupType:null}),ee()}),[z,ee]),re=o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return te(),e.next=3,J();case 3:case"end":return e.stop()}}),e)}))),[J,te]);c((function(){if(i){var e,t,r,n,o,s,c,l=i.videoAreaWidth,u=i.videoAreaHeight,d=i.lostX,f=i.lostY,p=i.clientHeight;a?(o=.7*(s=u-165),r=(c=(e=f+10)+45)+20,n=(t=c+s+10)+60):(o=mi.isMobile?l-6:Math.floor(.7*l),r=(c=(e=f+10)+50)+20,n=(t=c+(s=Math.floor(Math.min(o/1.5,p-2*f-80-100)))+10)+60);var m=Math.floor((l-o)/2)+d;F({x:m,y:c,width:o,height:s,surroundStyle:{opacity:.6,background:"#000"}});var g={yTitle:e,yDescription:t,yMessage:r,yCaptureButton:n};y(g),h(g)}}),[i,a,h]);var ne=o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return N(""),e.next=3,Z();case 3:case"end":return e.stop()}}),e)}))),[Z]);return d(r,(function(){return{restartSession:re}}),[re]),t.createElement(t.Fragment,null,!Y&&t.createElement(bf,null),T&&t.createElement(yh,null,A),$&&t.createElement(ph,null,t.createElement("img",{src:E,alt:"",className:"spin"})),j&&t.createElement(Fs,{x:"".concat(j.x,"px"),y:"".concat(j.y,"px"),width:"".concat(j.width,"px"),height:"".concat(j.height,"px"),surroundStyle:j.surroundStyle},t.createElement(kh,{width:j.width,height:j.height,type:D?wp.ERROR:wp.DEFAULT})),!D&&t.createElement(bh,{y:"".concat(b,"px"),className:"description"},n),D&&t.createElement(Ch,{y:"".concat(b,"px")},D),!$&&(!(null!=f&&f.disableCaptureButtonIfAlert)||!D)&&t.createElement(fh,{onClick:ne,y:"".concat(w,"px")},t.createElement("img",{src:k,alt:""})),R&&t.createElement(wh,{key:R,className:"message",y:"".concat(C,"px")},R),t.createElement(Jd,{open:K},H===Ph&&t.createElement(Ih,{onOk:re,maxSessionTime:null==f?void 0:f.idCardSessionTime})))}));mm.propTypes={usePortraitMask:p.bool,description:p.string,windowAndVideoInfo:p.shape({}),refVideo:p.shape({}),frontSide:p.bool,settings:p.shape({}),onCaptureDone:p.func,onUISpacingChange:p.func,outputEncryptionSettings:p.shape({})},mm.defaultProps={usePortraitMask:!1,description:"",windowAndVideoInfo:{},refVideo:{},frontSide:!0,settings:{},onCaptureDone:function(){},onUISpacingChange:function(){},outputEncryptionSettings:null};var gm,vm,ym=h.div(lm||(lm=N(["\n background: ",";\n backdrop-filter: blur(12px);\n border-radius: 8px;\n top: ",";\n position: absolute;\n z-index: ",";\n color: #fff;\n padding: 10px;\n margin: 0 10px;\n max-width: 275px;\n text-align: center;\n"])),(function(e){return e.background}),(function(e){return e.y}),1020),bm=h.div(um||(um=N(["\n width: 0;\n height: 0;\n border-left: 20px solid transparent;\n border-right: 20px solid transparent;\n border-bottom: ",";\n position: absolute;\n left: 50%;\n top: ",";\n transform: translateX(-50%);\n"])),(function(e){return"".concat(e.arrowSize,"px solid ").concat(e.color)}),(function(e){return"".concat(e.top,"px")})),Cm=function(e){var r=e.children,n=e.y;return t.createElement(ym,{y:n,background:"#00ce78"},t.createElement(bm,{arrowSize:10,top:-10,color:"#00ce78"}),r)},wm=h.div(dm||(dm=N(["\n text-align: center;\n position: absolute;\n font-size: 18px;\n border-radius: 3px;\n padding: 5px 10px;\n background: #ea3223;\n color: #fff;\n margin: auto;\n top: ",";\n z-index: ",";\n"])),(function(e){return e.y}),1020),km={QR_INSTRUCTIONS_TEXT:{en:t.createElement("span",null,"Please follow the instructions below to scan QR code:",t.createElement("br",null),t.createElement("br",null)," Move camera to the position of QR code on ID card. Align QR code to fit into camera frame to scan it"),vi:t.createElement("span",null,"Vui lòng quét mã QR theo hướng dẫn sau:",t.createElement("br",null),t.createElement("br",null)," Đưa camera vào vị trí mã QR trên CCCD. Canh vừa mã QR vào 4 góc khung hình để quét mã")},QR_INSTRUCTIONS_START_BUTTON:{en:"Scan QR code",vi:"Tiến hành quét mã QR"},QR_INSTRUCTIONS_COUNTDOWN:{en:"Start in <%= x %> s",vi:"Bắt đầu trong <%= x %> giây"},QR_INVALID_POPUP_TITLE:{en:"Invalid QR code",vi:"QR không hợp lệ"},QR_INVALID_POPUP_DESCRIPTION:{en:"Please check and make sure scanning QR code on ID card",vi:"Vui lòng kiểm tra và đảm bảo việc thực hiện quét QR trên CCCD thật"},QR_INVALID_POPUP_RETRY_BUTTON:{en:"Scan QR (on ID card)",vi:"Quét lại QR (trên CCCD)"},QR_INVALID_POPUP_SKIP_BUTTON:{en:"Skip",vi:"Bỏ qua"},QR_TOOLTIP:{en:"Fit QR code to 4 corners of camera frame and try to move camera [in or out] to scan QR code",vi:"Canh vừa mã QR vào 4 góc khung hình và thử dịch chuyển camera [xa - gần] để quét được mã QR"},REMAINING_TIME:{en:"Remaining time: <%= x %> seconds",vi:"Thời gian còn lại: <%= x %> giây"},SESSION_TIMEOUT_POPUP_DESCRIPTION:{en:t.createElement("span",null,"Quá thời gian quét. Vui lòng thực hiện lại.",t.createElement("br",null),t.createElement("br",null)," Đưa camera vào vị trí mã QR trên thẻ. Canh vừa vào 4 góc và"," ",t.createElement("strong",{className:"text-primary"},"thử dịch chuyển camera [xa - gần]")," để camera điện thoại lấy nét chuẩn hơn."),vi:t.createElement("span",null,"Quá thời gian quét. Vui lòng thực hiện lại.",t.createElement("br",null),t.createElement("br",null)," Đưa camera vào vị trí mã QR trên thẻ. Canh vừa vào 4 góc và"," ",t.createElement("strong",{className:"text-primary"},"thử dịch chuyển camera [xa - gần]")," để camera điện thoại lấy nét chuẩn hơn.")},SESSION_TIMEOUT_POPUP_RETRY_BUTTON:{en:"Retry",vi:"Thực hiện lại"},SESSION_TIMEOUT_POPUP_SKIP_BUTTON:{en:"Skip",vi:"Bỏ qua"}},Bm=function(e){var r=e.children,n=e.mt,o=e.mb,a=e.ml,i=e.mr,s=e.mx,c=e.my,l=e.pt,u=e.pb,d=e.pl,f=e.pr,p=e.px,h=e.py,m=r.props.style||{},g={};return null!==s&&(g.marginLeft=s,g.marginRight=s),null!==c&&(g.marginTop=c,g.marginBottom=c),null!==n&&(g.marginTop=n),null!==o&&(g.marginBottom=o),null!==a&&(g.marginLeft=a),null!==i&&(g.marginRight=i),null!==p&&(g.paddingLeft=p,g.paddingRight=p),null!==h&&(g.paddingTop=h,g.paddingBottom=h),null!==l&&(g.paddingTop=l),null!==u&&(g.paddingBottom=u),null!==d&&(g.paddingLeft=d),null!==f&&(g.paddingRight=f),t.cloneElement(r,{style:I(I({},m),g)})};Bm.propTypes={mt:p.string,ml:p.string,mr:p.string,mb:p.string,mx:p.string,my:p.string,pt:p.string,pl:p.string,pr:p.string,pb:p.string,px:p.string,py:p.string},Bm.defaultProps={mt:null,ml:null,mr:null,mb:null,mx:null,my:null,pt:null,pl:null,pr:null,pb:null,px:null,py:null};var Em,Sm,Am,_m,Im,Tm,Pm=h.button(gm||(gm=N(["\n width: 100%;\n max-width: 294px;\n height: 66px;\n background-color: ",";\n border: 0;\n outline: none;\n border-radius: 3px;\n color: #fff;\n font-weight: normal;\n cursor: pointer;\n font-size: 1rem;\n"])),(function(e){return e.theme.tsBlue})),xm=h.a(vm||(vm=N(["\n color: ",";\n cursor: pointer;\n"])),(function(e){return e.theme.tsBlue})),Rm=h.div(Em||(Em=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 10px;\n"]))),Nm=h.div(Sm||(Sm=N(["\n color: ",";\n font-weight: bold;\n font-size: 16px;\n"])),(function(e){return e.theme.tsSecondary})),Lm=h.div(Am||(Am=N(["\n color: ",";\n font-weight: normal;\n font-size: 16px;\n text-align: center;\n"])),(function(e){return e.theme.tsSecondary})),Om=function(e){var r=e.onRetry,n=e.onSkip,o=Qr.useSDKSettings().lang;return t.createElement(Rm,null,t.createElement(Bm,{mt:"25px"},t.createElement(Nm,null,km.QR_INVALID_POPUP_TITLE[o])),t.createElement(Bm,{mt:"30px"},t.createElement(Lm,null,km.QR_INVALID_POPUP_DESCRIPTION[o])),t.createElement(Bm,{mt:"30px"},t.createElement(Pm,{onClick:r},km.QR_INVALID_POPUP_RETRY_BUTTON[o])),t.createElement(Bm,{my:"20px"},t.createElement(xm,{onClick:n},km.QR_INVALID_POPUP_SKIP_BUTTON[o])))};Om.propTypes={onRetry:p.func,onSkip:p.func},Om.defaultProps={onRetry:function(){},onSkip:function(){}};var Dm=h.div(_m||(_m=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 10px;\n"]))),Mm=h.div(Im||(Im=N(["\n background: #e7e6e6;\n width: 100%;\n display: flex;\n justify-content: center;\n"]))),Um=h.div(Tm||(Tm=N(["\n color: ",";\n font-weight: normal;\n font-size: 16px;\n text-align: center;\n line-height: 20px;\n"])),(function(e){return e.theme.tsSecondary})),jm=function(e){var r=e.onRetry,n=e.onSkip,o=Qr.useSDKSettings().lang,a=In.useAsset("qr_code_banner.svg");return t.createElement(Dm,null,t.createElement(Mm,null,t.createElement("img",{src:a,alt:""})),t.createElement(Bm,{mt:"30px"},t.createElement(Um,null,km.SESSION_TIMEOUT_POPUP_DESCRIPTION[o])),t.createElement(Bm,{mt:"30px"},t.createElement(Pm,{onClick:r},km.SESSION_TIMEOUT_POPUP_RETRY_BUTTON[o])),t.createElement(Bm,{my:"20px"},t.createElement(xm,{onClick:n},km.SESSION_TIMEOUT_POPUP_SKIP_BUTTON[o])))};jm.propTypes={onRetry:p.func,onSkip:p.func},jm.defaultProps={onRetry:function(){},onSkip:function(){}};var Fm,Vm,zm,Km,Hm,qm,Qm=["children","ratio","padding"],Wm=h.div(Fm||(Fm=N(["\n width: 100%;\n padding-bottom: ","%;\n position: relative;\n"])),(function(e){return 1/e.ratio*100})),Gm=h.div(Vm||(Vm=N(["\n position: absolute;\n top: ",";\n left: ",";\n right: ",";\n bottom: ",";\n"])),(function(e){return e.padding}),(function(e){return e.padding}),(function(e){return e.padding}),(function(e){return e.padding})),Xm=function(e){var r=e.children,n=e.ratio,o=e.padding,a=R(e,Qm);return t.createElement(Wm,A({ratio:n},a),t.createElement(Gm,{padding:o},r))};Xm.propTypes={children:p.node,ratio:p.number,padding:p.string},Xm.defaultProps={children:null,ratio:4/3,padding:"0"};var Ym=h.div(zm||(zm=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 10px;\n"]))),$m=h.div(Km||(Km=N(["\n background: #e7e6e6;\n width: 100%;\n"]))),Zm=h.img(Hm||(Hm=N(["\n width: 100%;\n height: 100%;\n object-fit: contain;\n border-radius: 5px;\n"]))),Jm=h.div(qm||(qm=N(["\n color: ",";\n font-weight: normal;\n font-size: 16px;\n text-align: center;\n line-height: 20px;\n"])),(function(e){return e.theme.tsSecondary})),eg=function(e){var n=e.onClickStart,o=e.onTimeout,a=e.timeout,i=Qr.useSDKSettings().lang,l=In.useAsset("qr_code_banner.png"),u=r(a),d=L(s((function(){return lu(km.QR_INSTRUCTIONS_COUNTDOWN[i])({x:a})})),2),f=d[0],p=d[1];return c((function(){var e=lu(km.QR_INSTRUCTIONS_COUNTDOWN[i]),t=setInterval((function(){u.current--,p(e({x:u.current})),u.current<=0&&(clearInterval(t),o&&o())}),1e3);return function(){clearInterval(t)}}),[i,o]),t.createElement(Ym,null,t.createElement($m,null,t.createElement(Xm,{ratio:1.6},t.createElement(Zm,{src:l}))),t.createElement(Bm,{mt:"30px"},t.createElement(Jm,null,km.QR_INSTRUCTIONS_TEXT[i])),t.createElement(Bm,{mt:"30px"},t.createElement(Pm,{onClick:n},km.QR_INSTRUCTIONS_START_BUTTON[i])),t.createElement(Bm,{my:"20px"},t.createElement(Jm,null,f)))};eg.propTypes={onClickStart:p.func,onTimeout:p.func,timeout:p.number},eg.defaultProps={onClickStart:null,onTimeout:null,timeout:10};var tg=/^\d{12}\|(\d{9})?\|.+\|\d{8}\|((Nam)|(Nữ))\|.+\|\d{8}$/g,rg=function(e){var t=e.match(tg);return{valid:Boolean(t)}};class ng{static hasCamera(){return ng.listCameras(!1).then((e=>!!e.length)).catch((()=>!1))}static listCameras(e=!1){if(!navigator.mediaDevices)return Promise.resolve([]);let t=null;return(e?navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((e=>t=e)).catch((()=>{})):Promise.resolve()).then((()=>navigator.mediaDevices.enumerateDevices())).then((e=>e.filter((e=>"videoinput"===e.kind)).map(((e,t)=>({id:e.deviceId,label:e.label||(0===t?"Default Camera":`Camera ${t+1}`)}))))).finally((()=>{if(t)for(const e of t.getTracks())e.stop(),t.removeTrack(e)}))}constructor(e,t,r=this._onDecodeError,n=this._calculateScanRegion,o="environment"){this.$video=e,this.$canvas=document.createElement("canvas"),this._onDecode=t,this._legacyCanvasSize=ng.DEFAULT_CANVAS_SIZE,this._preferredCamera=o,this._active=!1,this._paused=!1,this._flashOn=!1,"number"==typeof r?(this._legacyCanvasSize=r,console.warn("You're using a deprecated version of the QrScanner constructor which will be removed in the future")):this._onDecodeError=r,"number"==typeof n?(this._legacyCanvasSize=n,console.warn("You're using a deprecated version of the QrScanner constructor which will be removed in the future")):this._calculateScanRegion=n,this._scanRegion=this._calculateScanRegion(e),this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),e.disablePictureInPicture=!0,e.playsInline=!0,e.muted=!0;let a=!1;e.hidden&&(e.hidden=!1,a=!0),document.body.contains(e)||(document.body.appendChild(e),a=!0),requestAnimationFrame((()=>{const t=window.getComputedStyle(e);"none"===t.display&&(e.style.setProperty("display","block","important"),a=!0),"visible"!==t.visibility&&(e.style.setProperty("visibility","visible","important"),a=!0),a&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),e.style.opacity=0,e.style.width=0,e.style.height=0)})),e.addEventListener("play",this._onPlay),e.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),this._qrEnginePromise=ng.createQrEngine()}hasFlash(){let e=null;return(this.$video.srcObject?Promise.resolve(this.$video.srcObject.getVideoTracks()[0]):this._getCameraStream().then((({stream:t})=>(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),e=t,t.getVideoTracks()[0])))).then((e=>"torch"in e.getSettings())).catch((()=>!1)).finally((()=>{if(e)for(const t of e.getTracks())t.stop(),e.removeTrack(t)}))}isFlashOn(){return this._flashOn}toggleFlash(){return this._flashOn?this.turnFlashOff():this.turnFlashOn()}turnFlashOn(){return this._flashOn?Promise.resolve():(this._flashOn=!0,!this._active||this._paused?Promise.resolve():this.hasFlash().then((e=>e?this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]}):Promise.reject("No flash available"))).catch((()=>{throw this._flashOn=!1,e})))}turnFlashOff(){if(this._flashOn)return this._flashOn=!1,this._restartVideoStream()}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),this.stop(),ng._postWorkerMessage(this._qrEnginePromise,"close")}start(){return this._active&&!this._paused?Promise.resolve():("https:"!==window.location.protocol&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,document.hidden?Promise.resolve():(this._paused=!1,this.$video.srcObject?(this.$video.play(),Promise.resolve()):this._getCameraStream().then((({stream:e,facingMode:t})=>{this.$video.srcObject=e,this.$video.play(),this._setVideoMirror(t),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch((()=>{})))})).catch((e=>{throw this._active=!1,e}))))}stop(){this.pause(),this._active=!1}pause(e=!1){if(this._paused=!0,!this._active)return Promise.resolve(!0);this.$video.pause();const t=()=>{const e=this.$video.srcObject?this.$video.srcObject.getTracks():[];for(const t of e)t.stop(),this.$video.srcObject.removeTrack(t);this.$video.srcObject=null};return e?(t(),Promise.resolve(!0)):new Promise((e=>setTimeout(e,300))).then((()=>!!this._paused&&(t(),!0)))}setCamera(e){return e===this._preferredCamera?Promise.resolve():(this._preferredCamera=e,this._restartVideoStream())}static scanImage(e,t=null,r=null,n=null,o=!1,a=!1){const i=r instanceof Worker;let s=Promise.all([r||ng.createQrEngine(),ng._loadImage(e)]).then((([e,a])=>{let s;return r=e,[n,s]=this._drawToCanvas(a,t,n,o),r instanceof Worker?(i||r.postMessage({type:"inversionMode",data:"both"}),new Promise(((e,t)=>{let o,a,i;a=n=>{"qrResult"===n.data.type&&(r.removeEventListener("message",a),r.removeEventListener("error",i),clearTimeout(o),null!==n.data.data?e(n.data.data):t(ng.NO_QR_CODE_FOUND))},i=e=>{r.removeEventListener("message",a),r.removeEventListener("error",i),clearTimeout(o);const n=e?e.message||e:"Unknown Error";t("Scanner error: "+n)},r.addEventListener("message",a),r.addEventListener("error",i),o=setTimeout((()=>i("timeout")),1e4);const c=s.getImageData(0,0,n.width,n.height);r.postMessage({type:"decode",data:c},[c.data.buffer])}))):new Promise(((e,t)=>{const o=setTimeout((()=>t("Scanner error: timeout")),1e4);r.detect(n).then((r=>{r.length?e(r[0].rawValue):t(ng.NO_QR_CODE_FOUND)})).catch((e=>t("Scanner error: "+(e.message||e)))).finally((()=>clearTimeout(o)))}))}));return t&&a&&(s=s.catch((()=>ng.scanImage(e,null,r,n,o)))),s=s.finally((()=>{i||ng._postWorkerMessage(r,"close")})),s}setGrayscaleWeights(e,t,r,n=!0){ng._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:e,green:t,blue:r,useIntegerApproximation:n})}setInversionMode(e){ng._postWorkerMessage(this._qrEnginePromise,"inversionMode",e)}static createQrEngine(e=ng.WORKER_PATH){return("BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats?BarcodeDetector.getSupportedFormats():Promise.resolve([])).then((t=>-1!==t.indexOf("qr_code")?new BarcodeDetector({formats:["qr_code"]}):new Worker(e)))}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video)}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(e){const t=Math.min(e.videoWidth,e.videoHeight),r=Math.round(2/3*t);return{x:Math.round((e.videoWidth-r)/2),y:Math.round((e.videoHeight-r)/2),width:r,height:r,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_scanFrame(){if(!this._active||this.$video.paused||this.$video.ended)return!1;requestAnimationFrame((()=>{this.$video.readyState<=1?this._scanFrame():this._qrEnginePromise.then((e=>ng.scanImage(this.$video,this._scanRegion,e,this.$canvas))).then(this._onDecode,(e=>{if(!this._active)return;-1!==(e.message||e).indexOf("service unavailable")&&(this._qrEnginePromise=ng.createQrEngine()),this._onDecodeError(e)})).then((()=>this._scanFrame()))}))}_onDecodeError(e){e!==ng.NO_QR_CODE_FOUND&&console.log(e)}_getCameraStream(){if(!navigator.mediaDevices)return Promise.reject("Camera not found.");const e="environment"===this._preferredCamera||"user"===this._preferredCamera?"facingMode":"deviceId",t=[{width:{min:1024}},{width:{min:768}},{}];return[...t.map((t=>Object.assign({},t,{[e]:{exact:this._preferredCamera}}))),...t].reduceRight(((e,t)=>()=>navigator.mediaDevices.getUserMedia({video:t,audio:!1}).then((e=>({stream:e,facingMode:this._getFacingMode(e)||(t.facingMode?this._preferredCamera:"environment"===this._preferredCamera?"user":"environment")}))).catch(e)),(()=>Promise.reject("Camera not found.")))()}_restartVideoStream(){const e=this._paused;return this.pause(!0).then((t=>{if(t&&!e&&this._active)return this.start()}))}_setVideoMirror(e){const t="user"===e?-1:1;this.$video.style.transform="scaleX("+t+")"}_getFacingMode(e){const t=e.getVideoTracks()[0];return t?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(e,t=null,r=null,n=!1){r=r||document.createElement("canvas");const o=t&&t.x?t.x:0,a=t&&t.y?t.y:0,i=t&&t.width?t.width:e.width||e.videoWidth,s=t&&t.height?t.height:e.height||e.videoHeight;if(!n){const e=t&&t.downScaledWidth?t.downScaledWidth:i,n=t&&t.downScaledHeight?t.downScaledHeight:s;r.width!==e&&(r.width=e),r.height!==n&&(r.height=n)}const c=r.getContext("2d",{alpha:!1});return c.imageSmoothingEnabled=!1,c.drawImage(e,o,a,i,s,0,0,r.width,r.height),[r,c]}static _loadImage(e){if(e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||window.ImageBitmap&&e instanceof window.ImageBitmap||window.OffscreenCanvas&&e instanceof window.OffscreenCanvas)return Promise.resolve(e);if(e instanceof Image)return ng._awaitImageLoad(e).then((()=>e));if(e instanceof File||e instanceof Blob||e instanceof URL||"string"==typeof e){const t=new Image;return e instanceof File||e instanceof Blob?t.src=URL.createObjectURL(e):t.src=e,ng._awaitImageLoad(t).then((()=>((e instanceof File||e instanceof Blob)&&URL.revokeObjectURL(t.src),t)))}return Promise.reject("Unsupported image type.")}static _awaitImageLoad(e){return new Promise(((t,r)=>{if(e.complete&&0!==e.naturalWidth)t();else{let n,o;n=()=>{e.removeEventListener("load",n),e.removeEventListener("error",o),t()},o=()=>{e.removeEventListener("load",n),e.removeEventListener("error",o),r("Image load error")},e.addEventListener("load",n),e.addEventListener("error",o)}}))}static _postWorkerMessage(e,t,r){return Promise.resolve(e).then((e=>{e instanceof Worker&&e.postMessage({type:t,data:r})}))}}function og(){return ag.apply(this,arguments)}function ag(){return(ag=B(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ng.WORKER_PATH=li(),e.next=3,ng.createQrEngine(ng.WORKER_PATH);case 3:return t=e.sent,e.abrupt("return",{qrEngine:t});case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ig(){return(ig=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]?c[0]:{},r=t.opencvUrl,e.next=3,Promise.all([og(),Yh({url:r})]);case 3:return n=e.sent,o=L(n,1),a=o[0].qrEngine,i=window,s=i.cv,e.abrupt("return",{qrScannerResources:{engine:a,canvas:document.createElement("canvas")},blackAndWhiteConverterResources:{kernel:s.matFromArray(3,3,s.CV_32FC1,[-1,-1,-1,-1,11,-1,-1,-1,-1]),canvas:document.createElement("canvas"),dst:new s.Mat}});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}ng.DEFAULT_CANVAS_SIZE=400,ng.NO_QR_CODE_FOUND="No QR code found",ng.WORKER_PATH="qr-scanner-worker.min.js";var sg=nd((function(){return ig.apply(this,arguments)})),cg=pi(hi((function(e,t){var r;"undefined"!=typeof self&&self,r=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this.width=t,this.height=e.length/t,this.data=e}return e.createEmpty=function(t,r){return new e(new Uint8ClampedArray(t*r),t)},e.prototype.get=function(e,t){return!(e<0||e>=this.width||t<0||t>=this.height||!this.data[t*this.width+e])},e.prototype.set=function(e,t,r){this.data[t*this.width+e]=r?1:0},e.prototype.setRegion=function(e,t,r,n,o){for(var a=t;a<t+n;a++)for(var i=e;i<e+r;i++)this.set(i,a,!!o)},e}();t.BitMatrix=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);t.addOrSubtractGF=function(e,t){return e^t};var o=function(){function e(e,t,r){this.primitive=e,this.size=t,this.generatorBase=r,this.expTable=new Array(this.size),this.logTable=new Array(this.size);for(var o=1,a=0;a<this.size;a++)this.expTable[a]=o,(o*=2)>=this.size&&(o=(o^this.primitive)&this.size-1);for(a=0;a<this.size-1;a++)this.logTable[this.expTable[a]]=a;this.zero=new n.default(this,Uint8ClampedArray.from([0])),this.one=new n.default(this,Uint8ClampedArray.from([1]))}return e.prototype.multiply=function(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]},e.prototype.inverse=function(e){if(0===e)throw new Error("Can't invert 0");return this.expTable[this.size-this.logTable[e]-1]},e.prototype.buildMonomial=function(e,t){if(e<0)throw new Error("Invalid monomial degree less than 0");if(0===t)return this.zero;var r=new Uint8ClampedArray(e+1);return r[0]=t,new n.default(this,r)},e.prototype.log=function(e){if(0===e)throw new Error("Can't take log(0)");return this.logTable[e]},e.prototype.exp=function(e){return this.expTable[e]},e}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=function(){function e(e,t){if(0===t.length)throw new Error("No coefficients.");this.field=e;var r=t.length;if(r>1&&0===t[0]){for(var n=1;n<r&&0===t[n];)n++;if(n===r)this.coefficients=e.zero.coefficients;else{this.coefficients=new Uint8ClampedArray(r-n);for(var o=0;o<this.coefficients.length;o++)this.coefficients[o]=t[n+o]}}else this.coefficients=t}return e.prototype.degree=function(){return this.coefficients.length-1},e.prototype.isZero=function(){return 0===this.coefficients[0]},e.prototype.getCoefficient=function(e){return this.coefficients[this.coefficients.length-1-e]},e.prototype.addOrSubtract=function(t){var r;if(this.isZero())return t;if(t.isZero())return this;var o=this.coefficients,a=t.coefficients;o.length>a.length&&(o=(r=[a,o])[0],a=r[1]);for(var i=new Uint8ClampedArray(a.length),s=a.length-o.length,c=0;c<s;c++)i[c]=a[c];for(c=s;c<a.length;c++)i[c]=n.addOrSubtractGF(o[c-s],a[c]);return new e(this.field,i)},e.prototype.multiply=function(t){if(0===t)return this.field.zero;if(1===t)return this;for(var r=this.coefficients.length,n=new Uint8ClampedArray(r),o=0;o<r;o++)n[o]=this.field.multiply(this.coefficients[o],t);return new e(this.field,n)},e.prototype.multiplyPoly=function(t){if(this.isZero()||t.isZero())return this.field.zero;for(var r=this.coefficients,o=r.length,a=t.coefficients,i=a.length,s=new Uint8ClampedArray(o+i-1),c=0;c<o;c++)for(var l=r[c],u=0;u<i;u++)s[c+u]=n.addOrSubtractGF(s[c+u],this.field.multiply(l,a[u]));return new e(this.field,s)},e.prototype.multiplyByMonomial=function(t,r){if(t<0)throw new Error("Invalid degree less than 0");if(0===r)return this.field.zero;for(var n=this.coefficients.length,o=new Uint8ClampedArray(n+t),a=0;a<n;a++)o[a]=this.field.multiply(this.coefficients[a],r);return new e(this.field,o)},e.prototype.evaluateAt=function(e){var t=0;if(0===e)return this.getCoefficient(0);var r=this.coefficients.length;if(1===e)return this.coefficients.forEach((function(e){t=n.addOrSubtractGF(t,e)})),t;t=this.coefficients[0];for(var o=1;o<r;o++)t=n.addOrSubtractGF(this.field.multiply(e,t),this.coefficients[o]);return t},e}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(4),o=r(5),a=r(11),i=r(12);function s(e){var t=i.locate(e);if(!t)return null;for(var r=0,n=t;r<n.length;r++){var s=n[r],c=a.extract(e,s),l=o.decode(c.matrix);if(l)return{binaryData:l.bytes,data:l.text,chunks:l.chunks,version:l.version,location:{topRightCorner:c.mappingFunction(s.dimension,0),topLeftCorner:c.mappingFunction(0,0),bottomRightCorner:c.mappingFunction(s.dimension,s.dimension),bottomLeftCorner:c.mappingFunction(0,s.dimension),topRightFinderPattern:s.topRight,topLeftFinderPattern:s.topLeft,bottomLeftFinderPattern:s.bottomLeft,bottomRightAlignmentPattern:s.alignmentPattern}}}return null}var c={inversionAttempts:"attemptBoth"};function l(e,t,r,o){void 0===o&&(o={});var a=c;Object.keys(a||{}).forEach((function(e){a[e]=o[e]||a[e]}));var i="attemptBoth"===a.inversionAttempts||"invertFirst"===a.inversionAttempts,l="onlyInvert"===a.inversionAttempts||"invertFirst"===a.inversionAttempts,u=n.binarize(e,t,r,i),d=u.binarized,f=u.inverted,p=s(l?f:d);return p||"attemptBoth"!==a.inversionAttempts&&"invertFirst"!==a.inversionAttempts||(p=s(l?d:f)),p}l.default=l,t.default=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);function o(e,t,r){return e<t?t:e>r?r:e}var a=function(){function e(e,t){this.width=e,this.data=new Uint8ClampedArray(e*t)}return e.prototype.get=function(e,t){return this.data[t*this.width+e]},e.prototype.set=function(e,t,r){this.data[t*this.width+e]=r},e}();t.binarize=function(e,t,r,i){if(e.length!==t*r*4)throw new Error("Malformed data passed to binarizer.");for(var s=new a(t,r),c=0;c<t;c++)for(var l=0;l<r;l++){var u=e[4*(l*t+c)+0],d=e[4*(l*t+c)+1],f=e[4*(l*t+c)+2];s.set(c,l,.2126*u+.7152*d+.0722*f)}for(var p=Math.ceil(t/8),h=Math.ceil(r/8),m=new a(p,h),g=0;g<h;g++)for(var v=0;v<p;v++){var y=0,b=1/0,C=0;for(l=0;l<8;l++)for(c=0;c<8;c++){var w=s.get(8*v+c,8*g+l);y+=w,b=Math.min(b,w),C=Math.max(C,w)}var k=y/Math.pow(8,2);if(C-b<=24&&(k=b/2,g>0&&v>0)){var B=(m.get(v,g-1)+2*m.get(v-1,g)+m.get(v-1,g-1))/4;b<B&&(k=B)}m.set(v,g,k)}var E=n.BitMatrix.createEmpty(t,r),S=null;for(i&&(S=n.BitMatrix.createEmpty(t,r)),g=0;g<h;g++)for(v=0;v<p;v++){for(var A=o(v,2,p-3),_=o(g,2,h-3),I=(y=0,-2);I<=2;I++)for(var T=-2;T<=2;T++)y+=m.get(A+I,_+T);var P=y/25;for(I=0;I<8;I++)for(T=0;T<8;T++){c=8*v+I,l=8*g+T;var x=s.get(c,l);E.set(c,l,x<=P),i&&S.set(c,l,!(x<=P))}}return i?{binarized:E,inverted:S}:{binarized:E}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(6),a=r(9),i=r(10);function s(e,t){for(var r=e^t,n=0;r;)n++,r&=r-1;return n}function c(e,t){return t<<1|e}var l=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,dataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,formatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,dataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,dataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],u=[function(e){return(e.y+e.x)%2==0},function(e){return e.y%2==0},function(e){return e.x%3==0},function(e){return(e.y+e.x)%3==0},function(e){return(Math.floor(e.y/2)+Math.floor(e.x/3))%2==0},function(e){return e.x*e.y%2+e.x*e.y%3==0},function(e){return(e.y*e.x%2+e.y*e.x%3)%2==0},function(e){return((e.y+e.x)%2+e.y*e.x%3)%2==0}];function d(e,t,r){for(var o=u[r.dataMask],a=e.height,i=function(e){var t=17+4*e.versionNumber,r=n.BitMatrix.createEmpty(t,t);r.setRegion(0,0,9,9,!0),r.setRegion(t-8,0,8,9,!0),r.setRegion(0,t-8,9,8,!0);for(var o=0,a=e.alignmentPatternCenters;o<a.length;o++)for(var i=a[o],s=0,c=e.alignmentPatternCenters;s<c.length;s++){var l=c[s];6===i&&6===l||6===i&&l===t-7||i===t-7&&6===l||r.setRegion(i-2,l-2,5,5,!0)}return r.setRegion(6,9,1,t-17,!0),r.setRegion(9,6,t-17,1,!0),e.versionNumber>6&&(r.setRegion(t-11,0,3,6,!0),r.setRegion(0,t-11,6,3,!0)),r}(t),s=[],l=0,d=0,f=!0,p=a-1;p>0;p-=2){6===p&&p--;for(var h=0;h<a;h++)for(var m=f?a-1-h:h,g=0;g<2;g++){var v=p-g;if(!i.get(v,m)){d++;var y=e.get(v,m);o({y:m,x:v})&&(y=!y),l=c(y,l),8===d&&(s.push(l),d=0,l=0)}}f=!f}return s}function f(e){var t=function(e){var t=e.height,r=Math.floor((t-17)/4);if(r<=6)return i.VERSIONS[r-1];for(var n=0,o=5;o>=0;o--)for(var a=t-9;a>=t-11;a--)n=c(e.get(a,o),n);var l=0;for(a=5;a>=0;a--)for(o=t-9;o>=t-11;o--)l=c(e.get(a,o),l);for(var u,d=1/0,f=0,p=i.VERSIONS;f<p.length;f++){var h=p[f];if(h.infoBits===n||h.infoBits===l)return h;var m=s(n,h.infoBits);m<d&&(u=h,d=m),(m=s(l,h.infoBits))<d&&(u=h,d=m)}return d<=3?u:void 0}(e);if(!t)return null;var r=function(e){for(var t=0,r=0;r<=8;r++)6!==r&&(t=c(e.get(r,8),t));for(var n=7;n>=0;n--)6!==n&&(t=c(e.get(8,n),t));var o=e.height,a=0;for(n=o-1;n>=o-7;n--)a=c(e.get(8,n),a);for(r=o-8;r<o;r++)a=c(e.get(r,8),a);for(var i=1/0,u=null,d=0,f=l;d<f.length;d++){var p=f[d],h=p.bits,m=p.formatInfo;if(h===t||h===a)return m;var g=s(t,h);g<i&&(u=m,i=g),t!==a&&(g=s(a,h))<i&&(u=m,i=g)}return i<=3?u:null}(e);if(!r)return null;var n=function(e,t,r){var n=t.errorCorrectionLevels[r],o=[],a=0;if(n.ecBlocks.forEach((function(e){for(var t=0;t<e.numBlocks;t++)o.push({numDataCodewords:e.dataCodewordsPerBlock,codewords:[]}),a+=e.dataCodewordsPerBlock+n.ecCodewordsPerBlock})),e.length<a)return null;e=e.slice(0,a);for(var i=n.ecBlocks[0].dataCodewordsPerBlock,s=0;s<i;s++)for(var c=0,l=o;c<l.length;c++)l[c].codewords.push(e.shift());if(n.ecBlocks.length>1){var u=n.ecBlocks[0].numBlocks,d=n.ecBlocks[1].numBlocks;for(s=0;s<d;s++)o[u+s].codewords.push(e.shift())}for(;e.length>0;)for(var f=0,p=o;f<p.length;f++)p[f].codewords.push(e.shift());return o}(d(e,t,r),t,r.errorCorrectionLevel);if(!n)return null;for(var u=n.reduce((function(e,t){return e+t.numDataCodewords}),0),f=new Uint8ClampedArray(u),p=0,h=0,m=n;h<m.length;h++){var g=m[h],v=a.decode(g.codewords,g.codewords.length-g.numDataCodewords);if(!v)return null;for(var y=0;y<g.numDataCodewords;y++)f[p++]=v[y]}try{return o.decode(f,t.versionNumber)}catch(e){return null}}t.decode=function(e){if(null==e)return null;var t=f(e);if(t)return t;for(var r=0;r<e.width;r++)for(var n=r+1;n<e.height;n++)e.get(r,n)!==e.get(n,r)&&(e.set(r,n,!e.get(r,n)),e.set(n,r,!e.get(n,r)));return f(e)}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o,a=r(7),i=r(8);function s(e,t){for(var r=[],n="",o=[10,12,14][t],a=e.readBits(o);a>=3;){if((l=e.readBits(10))>=1e3)throw new Error("Invalid numeric value above 999");var i=Math.floor(l/100),s=Math.floor(l/10)%10,c=l%10;r.push(48+i,48+s,48+c),n+=i.toString()+s.toString()+c.toString(),a-=3}if(2===a){if((l=e.readBits(7))>=100)throw new Error("Invalid numeric value above 99");i=Math.floor(l/10),s=l%10,r.push(48+i,48+s),n+=i.toString()+s.toString()}else if(1===a){var l;if((l=e.readBits(4))>=10)throw new Error("Invalid numeric value above 9");r.push(48+l),n+=l.toString()}return{bytes:r,text:n}}!function(e){e.Numeric="numeric",e.Alphanumeric="alphanumeric",e.Byte="byte",e.Kanji="kanji",e.ECI="eci"}(n=t.Mode||(t.Mode={})),function(e){e[e.Terminator=0]="Terminator",e[e.Numeric=1]="Numeric",e[e.Alphanumeric=2]="Alphanumeric",e[e.Byte=4]="Byte",e[e.Kanji=8]="Kanji",e[e.ECI=7]="ECI"}(o||(o={}));var c=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function l(e,t){for(var r=[],n="",o=[9,11,13][t],a=e.readBits(o);a>=2;){var i=e.readBits(11),s=Math.floor(i/45),l=i%45;r.push(c[s].charCodeAt(0),c[l].charCodeAt(0)),n+=c[s]+c[l],a-=2}return 1===a&&(s=e.readBits(6),r.push(c[s].charCodeAt(0)),n+=c[s]),{bytes:r,text:n}}function u(e,t){for(var r=[],n="",o=[8,16,16][t],a=e.readBits(o),i=0;i<a;i++){var s=e.readBits(8);r.push(s)}try{n+=decodeURIComponent(r.map((function(e){return"%"+("0"+e.toString(16)).substr(-2)})).join(""))}catch(e){}return{bytes:r,text:n}}function d(e,t){for(var r=[],n="",o=[8,10,12][t],a=e.readBits(o),s=0;s<a;s++){var c=e.readBits(13),l=Math.floor(c/192)<<8|c%192;l+=l<7936?33088:49472,r.push(l>>8,255&l),n+=String.fromCharCode(i.shiftJISTable[l])}return{bytes:r,text:n}}t.decode=function(e,t){for(var r,i,c,f,p=new a.BitStream(e),h=t<=9?0:t<=26?1:2,m={text:"",bytes:[],chunks:[],version:t};p.available()>=4;){var g=p.readBits(4);if(g===o.Terminator)return m;if(g===o.ECI)0===p.readBits(1)?m.chunks.push({type:n.ECI,assignmentNumber:p.readBits(7)}):0===p.readBits(1)?m.chunks.push({type:n.ECI,assignmentNumber:p.readBits(14)}):0===p.readBits(1)?m.chunks.push({type:n.ECI,assignmentNumber:p.readBits(21)}):m.chunks.push({type:n.ECI,assignmentNumber:-1});else if(g===o.Numeric){var v=s(p,h);m.text+=v.text,(r=m.bytes).push.apply(r,v.bytes),m.chunks.push({type:n.Numeric,text:v.text})}else if(g===o.Alphanumeric){var y=l(p,h);m.text+=y.text,(i=m.bytes).push.apply(i,y.bytes),m.chunks.push({type:n.Alphanumeric,text:y.text})}else if(g===o.Byte){var b=u(p,h);m.text+=b.text,(c=m.bytes).push.apply(c,b.bytes),m.chunks.push({type:n.Byte,bytes:b.bytes,text:b.text})}else if(g===o.Kanji){var C=d(p,h);m.text+=C.text,(f=m.bytes).push.apply(f,C.bytes),m.chunks.push({type:n.Kanji,bytes:C.bytes,text:C.text})}}if(0===p.available()||0===p.readBits(p.available()))return m}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this.byteOffset=0,this.bitOffset=0,this.bytes=e}return e.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new Error("Cannot read "+e.toString()+" bits");var t=0;if(this.bitOffset>0){var r=8-this.bitOffset,n=e<r?e:r,o=255>>8-n<<(a=r-n);t=(this.bytes[this.byteOffset]&o)>>a,e-=n,this.bitOffset+=n,8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(e>0){for(;e>=8;)t=t<<8|255&this.bytes[this.byteOffset],this.byteOffset++,e-=8;var a;if(e>0)o=255>>(a=8-e)<<a,t=t<<e|(this.bytes[this.byteOffset]&o)>>a,this.bitOffset+=e}return t},e.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},e}();t.BitStream=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.shiftJISTable={32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:165,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:8254,33088:12288,33089:12289,33090:12290,33091:65292,33092:65294,33093:12539,33094:65306,33095:65307,33096:65311,33097:65281,33098:12443,33099:12444,33100:180,33101:65344,33102:168,33103:65342,33104:65507,33105:65343,33106:12541,33107:12542,33108:12445,33109:12446,33110:12291,33111:20189,33112:12293,33113:12294,33114:12295,33115:12540,33116:8213,33117:8208,33118:65295,33119:92,33120:12316,33121:8214,33122:65372,33123:8230,33124:8229,33125:8216,33126:8217,33127:8220,33128:8221,33129:65288,33130:65289,33131:12308,33132:12309,33133:65339,33134:65341,33135:65371,33136:65373,33137:12296,33138:12297,33139:12298,33140:12299,33141:12300,33142:12301,33143:12302,33144:12303,33145:12304,33146:12305,33147:65291,33148:8722,33149:177,33150:215,33152:247,33153:65309,33154:8800,33155:65308,33156:65310,33157:8806,33158:8807,33159:8734,33160:8756,33161:9794,33162:9792,33163:176,33164:8242,33165:8243,33166:8451,33167:65509,33168:65284,33169:162,33170:163,33171:65285,33172:65283,33173:65286,33174:65290,33175:65312,33176:167,33177:9734,33178:9733,33179:9675,33180:9679,33181:9678,33182:9671,33183:9670,33184:9633,33185:9632,33186:9651,33187:9650,33188:9661,33189:9660,33190:8251,33191:12306,33192:8594,33193:8592,33194:8593,33195:8595,33196:12307,33208:8712,33209:8715,33210:8838,33211:8839,33212:8834,33213:8835,33214:8746,33215:8745,33224:8743,33225:8744,33226:172,33227:8658,33228:8660,33229:8704,33230:8707,33242:8736,33243:8869,33244:8978,33245:8706,33246:8711,33247:8801,33248:8786,33249:8810,33250:8811,33251:8730,33252:8765,33253:8733,33254:8757,33255:8747,33256:8748,33264:8491,33265:8240,33266:9839,33267:9837,33268:9834,33269:8224,33270:8225,33271:182,33276:9711,33359:65296,33360:65297,33361:65298,33362:65299,33363:65300,33364:65301,33365:65302,33366:65303,33367:65304,33368:65305,33376:65313,33377:65314,33378:65315,33379:65316,33380:65317,33381:65318,33382:65319,33383:65320,33384:65321,33385:65322,33386:65323,33387:65324,33388:65325,33389:65326,33390:65327,33391:65328,33392:65329,33393:65330,33394:65331,33395:65332,33396:65333,33397:65334,33398:65335,33399:65336,33400:65337,33401:65338,33409:65345,33410:65346,33411:65347,33412:65348,33413:65349,33414:65350,33415:65351,33416:65352,33417:65353,33418:65354,33419:65355,33420:65356,33421:65357,33422:65358,33423:65359,33424:65360,33425:65361,33426:65362,33427:65363,33428:65364,33429:65365,33430:65366,33431:65367,33432:65368,33433:65369,33434:65370,33439:12353,33440:12354,33441:12355,33442:12356,33443:12357,33444:12358,33445:12359,33446:12360,33447:12361,33448:12362,33449:12363,33450:12364,33451:12365,33452:12366,33453:12367,33454:12368,33455:12369,33456:12370,33457:12371,33458:12372,33459:12373,33460:12374,33461:12375,33462:12376,33463:12377,33464:12378,33465:12379,33466:12380,33467:12381,33468:12382,33469:12383,33470:12384,33471:12385,33472:12386,33473:12387,33474:12388,33475:12389,33476:12390,33477:12391,33478:12392,33479:12393,33480:12394,33481:12395,33482:12396,33483:12397,33484:12398,33485:12399,33486:12400,33487:12401,33488:12402,33489:12403,33490:12404,33491:12405,33492:12406,33493:12407,33494:12408,33495:12409,33496:12410,33497:12411,33498:12412,33499:12413,33500:12414,33501:12415,33502:12416,33503:12417,33504:12418,33505:12419,33506:12420,33507:12421,33508:12422,33509:12423,33510:12424,33511:12425,33512:12426,33513:12427,33514:12428,33515:12429,33516:12430,33517:12431,33518:12432,33519:12433,33520:12434,33521:12435,33600:12449,33601:12450,33602:12451,33603:12452,33604:12453,33605:12454,33606:12455,33607:12456,33608:12457,33609:12458,33610:12459,33611:12460,33612:12461,33613:12462,33614:12463,33615:12464,33616:12465,33617:12466,33618:12467,33619:12468,33620:12469,33621:12470,33622:12471,33623:12472,33624:12473,33625:12474,33626:12475,33627:12476,33628:12477,33629:12478,33630:12479,33631:12480,33632:12481,33633:12482,33634:12483,33635:12484,33636:12485,33637:12486,33638:12487,33639:12488,33640:12489,33641:12490,33642:12491,33643:12492,33644:12493,33645:12494,33646:12495,33647:12496,33648:12497,33649:12498,33650:12499,33651:12500,33652:12501,33653:12502,33654:12503,33655:12504,33656:12505,33657:12506,33658:12507,33659:12508,33660:12509,33661:12510,33662:12511,33664:12512,33665:12513,33666:12514,33667:12515,33668:12516,33669:12517,33670:12518,33671:12519,33672:12520,33673:12521,33674:12522,33675:12523,33676:12524,33677:12525,33678:12526,33679:12527,33680:12528,33681:12529,33682:12530,33683:12531,33684:12532,33685:12533,33686:12534,33695:913,33696:914,33697:915,33698:916,33699:917,33700:918,33701:919,33702:920,33703:921,33704:922,33705:923,33706:924,33707:925,33708:926,33709:927,33710:928,33711:929,33712:931,33713:932,33714:933,33715:934,33716:935,33717:936,33718:937,33727:945,33728:946,33729:947,33730:948,33731:949,33732:950,33733:951,33734:952,33735:953,33736:954,33737:955,33738:956,33739:957,33740:958,33741:959,33742:960,33743:961,33744:963,33745:964,33746:965,33747:966,33748:967,33749:968,33750:969,33856:1040,33857:1041,33858:1042,33859:1043,33860:1044,33861:1045,33862:1025,33863:1046,33864:1047,33865:1048,33866:1049,33867:1050,33868:1051,33869:1052,33870:1053,33871:1054,33872:1055,33873:1056,33874:1057,33875:1058,33876:1059,33877:1060,33878:1061,33879:1062,33880:1063,33881:1064,33882:1065,33883:1066,33884:1067,33885:1068,33886:1069,33887:1070,33888:1071,33904:1072,33905:1073,33906:1074,33907:1075,33908:1076,33909:1077,33910:1105,33911:1078,33912:1079,33913:1080,33914:1081,33915:1082,33916:1083,33917:1084,33918:1085,33920:1086,33921:1087,33922:1088,33923:1089,33924:1090,33925:1091,33926:1092,33927:1093,33928:1094,33929:1095,33930:1096,33931:1097,33932:1098,33933:1099,33934:1100,33935:1101,33936:1102,33937:1103,33951:9472,33952:9474,33953:9484,33954:9488,33955:9496,33956:9492,33957:9500,33958:9516,33959:9508,33960:9524,33961:9532,33962:9473,33963:9475,33964:9487,33965:9491,33966:9499,33967:9495,33968:9507,33969:9523,33970:9515,33971:9531,33972:9547,33973:9504,33974:9519,33975:9512,33976:9527,33977:9535,33978:9501,33979:9520,33980:9509,33981:9528,33982:9538,34975:20124,34976:21782,34977:23043,34978:38463,34979:21696,34980:24859,34981:25384,34982:23030,34983:36898,34984:33909,34985:33564,34986:31312,34987:24746,34988:25569,34989:28197,34990:26093,34991:33894,34992:33446,34993:39925,34994:26771,34995:22311,34996:26017,34997:25201,34998:23451,34999:22992,35e3:34427,35001:39156,35002:32098,35003:32190,35004:39822,35005:25110,35006:31903,35007:34999,35008:23433,35009:24245,35010:25353,35011:26263,35012:26696,35013:38343,35014:38797,35015:26447,35016:20197,35017:20234,35018:20301,35019:20381,35020:20553,35021:22258,35022:22839,35023:22996,35024:23041,35025:23561,35026:24799,35027:24847,35028:24944,35029:26131,35030:26885,35031:28858,35032:30031,35033:30064,35034:31227,35035:32173,35036:32239,35037:32963,35038:33806,35039:34915,35040:35586,35041:36949,35042:36986,35043:21307,35044:20117,35045:20133,35046:22495,35047:32946,35048:37057,35049:30959,35050:19968,35051:22769,35052:28322,35053:36920,35054:31282,35055:33576,35056:33419,35057:39983,35058:20801,35059:21360,35060:21693,35061:21729,35062:22240,35063:23035,35064:24341,35065:39154,35066:28139,35067:32996,35068:34093,35136:38498,35137:38512,35138:38560,35139:38907,35140:21515,35141:21491,35142:23431,35143:28879,35144:32701,35145:36802,35146:38632,35147:21359,35148:40284,35149:31418,35150:19985,35151:30867,35152:33276,35153:28198,35154:22040,35155:21764,35156:27421,35157:34074,35158:39995,35159:23013,35160:21417,35161:28006,35162:29916,35163:38287,35164:22082,35165:20113,35166:36939,35167:38642,35168:33615,35169:39180,35170:21473,35171:21942,35172:23344,35173:24433,35174:26144,35175:26355,35176:26628,35177:27704,35178:27891,35179:27945,35180:29787,35181:30408,35182:31310,35183:38964,35184:33521,35185:34907,35186:35424,35187:37613,35188:28082,35189:30123,35190:30410,35191:39365,35192:24742,35193:35585,35194:36234,35195:38322,35196:27022,35197:21421,35198:20870,35200:22290,35201:22576,35202:22852,35203:23476,35204:24310,35205:24616,35206:25513,35207:25588,35208:27839,35209:28436,35210:28814,35211:28948,35212:29017,35213:29141,35214:29503,35215:32257,35216:33398,35217:33489,35218:34199,35219:36960,35220:37467,35221:40219,35222:22633,35223:26044,35224:27738,35225:29989,35226:20985,35227:22830,35228:22885,35229:24448,35230:24540,35231:25276,35232:26106,35233:27178,35234:27431,35235:27572,35236:29579,35237:32705,35238:35158,35239:40236,35240:40206,35241:40644,35242:23713,35243:27798,35244:33659,35245:20740,35246:23627,35247:25014,35248:33222,35249:26742,35250:29281,35251:20057,35252:20474,35253:21368,35254:24681,35255:28201,35256:31311,35257:38899,35258:19979,35259:21270,35260:20206,35261:20309,35262:20285,35263:20385,35264:20339,35265:21152,35266:21487,35267:22025,35268:22799,35269:23233,35270:23478,35271:23521,35272:31185,35273:26247,35274:26524,35275:26550,35276:27468,35277:27827,35278:28779,35279:29634,35280:31117,35281:31166,35282:31292,35283:31623,35284:33457,35285:33499,35286:33540,35287:33655,35288:33775,35289:33747,35290:34662,35291:35506,35292:22057,35293:36008,35294:36838,35295:36942,35296:38686,35297:34442,35298:20420,35299:23784,35300:25105,35301:29273,35302:30011,35303:33253,35304:33469,35305:34558,35306:36032,35307:38597,35308:39187,35309:39381,35310:20171,35311:20250,35312:35299,35313:22238,35314:22602,35315:22730,35316:24315,35317:24555,35318:24618,35319:24724,35320:24674,35321:25040,35322:25106,35323:25296,35324:25913,35392:39745,35393:26214,35394:26800,35395:28023,35396:28784,35397:30028,35398:30342,35399:32117,35400:33445,35401:34809,35402:38283,35403:38542,35404:35997,35405:20977,35406:21182,35407:22806,35408:21683,35409:23475,35410:23830,35411:24936,35412:27010,35413:28079,35414:30861,35415:33995,35416:34903,35417:35442,35418:37799,35419:39608,35420:28012,35421:39336,35422:34521,35423:22435,35424:26623,35425:34510,35426:37390,35427:21123,35428:22151,35429:21508,35430:24275,35431:25313,35432:25785,35433:26684,35434:26680,35435:27579,35436:29554,35437:30906,35438:31339,35439:35226,35440:35282,35441:36203,35442:36611,35443:37101,35444:38307,35445:38548,35446:38761,35447:23398,35448:23731,35449:27005,35450:38989,35451:38990,35452:25499,35453:31520,35454:27179,35456:27263,35457:26806,35458:39949,35459:28511,35460:21106,35461:21917,35462:24688,35463:25324,35464:27963,35465:28167,35466:28369,35467:33883,35468:35088,35469:36676,35470:19988,35471:39993,35472:21494,35473:26907,35474:27194,35475:38788,35476:26666,35477:20828,35478:31427,35479:33970,35480:37340,35481:37772,35482:22107,35483:40232,35484:26658,35485:33541,35486:33841,35487:31909,35488:21e3,35489:33477,35490:29926,35491:20094,35492:20355,35493:20896,35494:23506,35495:21002,35496:21208,35497:21223,35498:24059,35499:21914,35500:22570,35501:23014,35502:23436,35503:23448,35504:23515,35505:24178,35506:24185,35507:24739,35508:24863,35509:24931,35510:25022,35511:25563,35512:25954,35513:26577,35514:26707,35515:26874,35516:27454,35517:27475,35518:27735,35519:28450,35520:28567,35521:28485,35522:29872,35523:29976,35524:30435,35525:30475,35526:31487,35527:31649,35528:31777,35529:32233,35530:32566,35531:32752,35532:32925,35533:33382,35534:33694,35535:35251,35536:35532,35537:36011,35538:36996,35539:37969,35540:38291,35541:38289,35542:38306,35543:38501,35544:38867,35545:39208,35546:33304,35547:20024,35548:21547,35549:23736,35550:24012,35551:29609,35552:30284,35553:30524,35554:23721,35555:32747,35556:36107,35557:38593,35558:38929,35559:38996,35560:39e3,35561:20225,35562:20238,35563:21361,35564:21916,35565:22120,35566:22522,35567:22855,35568:23305,35569:23492,35570:23696,35571:24076,35572:24190,35573:24524,35574:25582,35575:26426,35576:26071,35577:26082,35578:26399,35579:26827,35580:26820,35648:27231,35649:24112,35650:27589,35651:27671,35652:27773,35653:30079,35654:31048,35655:23395,35656:31232,35657:32e3,35658:24509,35659:35215,35660:35352,35661:36020,35662:36215,35663:36556,35664:36637,35665:39138,35666:39438,35667:39740,35668:20096,35669:20605,35670:20736,35671:22931,35672:23452,35673:25135,35674:25216,35675:25836,35676:27450,35677:29344,35678:30097,35679:31047,35680:32681,35681:34811,35682:35516,35683:35696,35684:25516,35685:33738,35686:38816,35687:21513,35688:21507,35689:21931,35690:26708,35691:27224,35692:35440,35693:30759,35694:26485,35695:40653,35696:21364,35697:23458,35698:33050,35699:34384,35700:36870,35701:19992,35702:20037,35703:20167,35704:20241,35705:21450,35706:21560,35707:23470,35708:24339,35709:24613,35710:25937,35712:26429,35713:27714,35714:27762,35715:27875,35716:28792,35717:29699,35718:31350,35719:31406,35720:31496,35721:32026,35722:31998,35723:32102,35724:26087,35725:29275,35726:21435,35727:23621,35728:24040,35729:25298,35730:25312,35731:25369,35732:28192,35733:34394,35734:35377,35735:36317,35736:37624,35737:28417,35738:31142,35739:39770,35740:20136,35741:20139,35742:20140,35743:20379,35744:20384,35745:20689,35746:20807,35747:31478,35748:20849,35749:20982,35750:21332,35751:21281,35752:21375,35753:21483,35754:21932,35755:22659,35756:23777,35757:24375,35758:24394,35759:24623,35760:24656,35761:24685,35762:25375,35763:25945,35764:27211,35765:27841,35766:29378,35767:29421,35768:30703,35769:33016,35770:33029,35771:33288,35772:34126,35773:37111,35774:37857,35775:38911,35776:39255,35777:39514,35778:20208,35779:20957,35780:23597,35781:26241,35782:26989,35783:23616,35784:26354,35785:26997,35786:29577,35787:26704,35788:31873,35789:20677,35790:21220,35791:22343,35792:24062,35793:37670,35794:26020,35795:27427,35796:27453,35797:29748,35798:31105,35799:31165,35800:31563,35801:32202,35802:33465,35803:33740,35804:34943,35805:35167,35806:35641,35807:36817,35808:37329,35809:21535,35810:37504,35811:20061,35812:20534,35813:21477,35814:21306,35815:29399,35816:29590,35817:30697,35818:33510,35819:36527,35820:39366,35821:39368,35822:39378,35823:20855,35824:24858,35825:34398,35826:21936,35827:31354,35828:20598,35829:23507,35830:36935,35831:38533,35832:20018,35833:27355,35834:37351,35835:23633,35836:23624,35904:25496,35905:31391,35906:27795,35907:38772,35908:36705,35909:31402,35910:29066,35911:38536,35912:31874,35913:26647,35914:32368,35915:26705,35916:37740,35917:21234,35918:21531,35919:34219,35920:35347,35921:32676,35922:36557,35923:37089,35924:21350,35925:34952,35926:31041,35927:20418,35928:20670,35929:21009,35930:20804,35931:21843,35932:22317,35933:29674,35934:22411,35935:22865,35936:24418,35937:24452,35938:24693,35939:24950,35940:24935,35941:25001,35942:25522,35943:25658,35944:25964,35945:26223,35946:26690,35947:28179,35948:30054,35949:31293,35950:31995,35951:32076,35952:32153,35953:32331,35954:32619,35955:33550,35956:33610,35957:34509,35958:35336,35959:35427,35960:35686,35961:36605,35962:38938,35963:40335,35964:33464,35965:36814,35966:39912,35968:21127,35969:25119,35970:25731,35971:28608,35972:38553,35973:26689,35974:20625,35975:27424,35976:27770,35977:28500,35978:31348,35979:32080,35980:34880,35981:35363,35982:26376,35983:20214,35984:20537,35985:20518,35986:20581,35987:20860,35988:21048,35989:21091,35990:21927,35991:22287,35992:22533,35993:23244,35994:24314,35995:25010,35996:25080,35997:25331,35998:25458,35999:26908,36e3:27177,36001:29309,36002:29356,36003:29486,36004:30740,36005:30831,36006:32121,36007:30476,36008:32937,36009:35211,36010:35609,36011:36066,36012:36562,36013:36963,36014:37749,36015:38522,36016:38997,36017:39443,36018:40568,36019:20803,36020:21407,36021:21427,36022:24187,36023:24358,36024:28187,36025:28304,36026:29572,36027:29694,36028:32067,36029:33335,36030:35328,36031:35578,36032:38480,36033:20046,36034:20491,36035:21476,36036:21628,36037:22266,36038:22993,36039:23396,36040:24049,36041:24235,36042:24359,36043:25144,36044:25925,36045:26543,36046:28246,36047:29392,36048:31946,36049:34996,36050:32929,36051:32993,36052:33776,36053:34382,36054:35463,36055:36328,36056:37431,36057:38599,36058:39015,36059:40723,36060:20116,36061:20114,36062:20237,36063:21320,36064:21577,36065:21566,36066:23087,36067:24460,36068:24481,36069:24735,36070:26791,36071:27278,36072:29786,36073:30849,36074:35486,36075:35492,36076:35703,36077:37264,36078:20062,36079:39881,36080:20132,36081:20348,36082:20399,36083:20505,36084:20502,36085:20809,36086:20844,36087:21151,36088:21177,36089:21246,36090:21402,36091:21475,36092:21521,36160:21518,36161:21897,36162:22353,36163:22434,36164:22909,36165:23380,36166:23389,36167:23439,36168:24037,36169:24039,36170:24055,36171:24184,36172:24195,36173:24218,36174:24247,36175:24344,36176:24658,36177:24908,36178:25239,36179:25304,36180:25511,36181:25915,36182:26114,36183:26179,36184:26356,36185:26477,36186:26657,36187:26775,36188:27083,36189:27743,36190:27946,36191:28009,36192:28207,36193:28317,36194:30002,36195:30343,36196:30828,36197:31295,36198:31968,36199:32005,36200:32024,36201:32094,36202:32177,36203:32789,36204:32771,36205:32943,36206:32945,36207:33108,36208:33167,36209:33322,36210:33618,36211:34892,36212:34913,36213:35611,36214:36002,36215:36092,36216:37066,36217:37237,36218:37489,36219:30783,36220:37628,36221:38308,36222:38477,36224:38917,36225:39321,36226:39640,36227:40251,36228:21083,36229:21163,36230:21495,36231:21512,36232:22741,36233:25335,36234:28640,36235:35946,36236:36703,36237:40633,36238:20811,36239:21051,36240:21578,36241:22269,36242:31296,36243:37239,36244:40288,36245:40658,36246:29508,36247:28425,36248:33136,36249:29969,36250:24573,36251:24794,36252:39592,36253:29403,36254:36796,36255:27492,36256:38915,36257:20170,36258:22256,36259:22372,36260:22718,36261:23130,36262:24680,36263:25031,36264:26127,36265:26118,36266:26681,36267:26801,36268:28151,36269:30165,36270:32058,36271:33390,36272:39746,36273:20123,36274:20304,36275:21449,36276:21766,36277:23919,36278:24038,36279:24046,36280:26619,36281:27801,36282:29811,36283:30722,36284:35408,36285:37782,36286:35039,36287:22352,36288:24231,36289:25387,36290:20661,36291:20652,36292:20877,36293:26368,36294:21705,36295:22622,36296:22971,36297:23472,36298:24425,36299:25165,36300:25505,36301:26685,36302:27507,36303:28168,36304:28797,36305:37319,36306:29312,36307:30741,36308:30758,36309:31085,36310:25998,36311:32048,36312:33756,36313:35009,36314:36617,36315:38555,36316:21092,36317:22312,36318:26448,36319:32618,36320:36001,36321:20916,36322:22338,36323:38442,36324:22586,36325:27018,36326:32948,36327:21682,36328:23822,36329:22524,36330:30869,36331:40442,36332:20316,36333:21066,36334:21643,36335:25662,36336:26152,36337:26388,36338:26613,36339:31364,36340:31574,36341:32034,36342:37679,36343:26716,36344:39853,36345:31545,36346:21273,36347:20874,36348:21047,36416:23519,36417:25334,36418:25774,36419:25830,36420:26413,36421:27578,36422:34217,36423:38609,36424:30352,36425:39894,36426:25420,36427:37638,36428:39851,36429:30399,36430:26194,36431:19977,36432:20632,36433:21442,36434:23665,36435:24808,36436:25746,36437:25955,36438:26719,36439:29158,36440:29642,36441:29987,36442:31639,36443:32386,36444:34453,36445:35715,36446:36059,36447:37240,36448:39184,36449:26028,36450:26283,36451:27531,36452:20181,36453:20180,36454:20282,36455:20351,36456:21050,36457:21496,36458:21490,36459:21987,36460:22235,36461:22763,36462:22987,36463:22985,36464:23039,36465:23376,36466:23629,36467:24066,36468:24107,36469:24535,36470:24605,36471:25351,36472:25903,36473:23388,36474:26031,36475:26045,36476:26088,36477:26525,36478:27490,36480:27515,36481:27663,36482:29509,36483:31049,36484:31169,36485:31992,36486:32025,36487:32043,36488:32930,36489:33026,36490:33267,36491:35222,36492:35422,36493:35433,36494:35430,36495:35468,36496:35566,36497:36039,36498:36060,36499:38604,36500:39164,36501:27503,36502:20107,36503:20284,36504:20365,36505:20816,36506:23383,36507:23546,36508:24904,36509:25345,36510:26178,36511:27425,36512:28363,36513:27835,36514:29246,36515:29885,36516:30164,36517:30913,36518:31034,36519:32780,36520:32819,36521:33258,36522:33940,36523:36766,36524:27728,36525:40575,36526:24335,36527:35672,36528:40235,36529:31482,36530:36600,36531:23437,36532:38635,36533:19971,36534:21489,36535:22519,36536:22833,36537:23241,36538:23460,36539:24713,36540:28287,36541:28422,36542:30142,36543:36074,36544:23455,36545:34048,36546:31712,36547:20594,36548:26612,36549:33437,36550:23649,36551:34122,36552:32286,36553:33294,36554:20889,36555:23556,36556:25448,36557:36198,36558:26012,36559:29038,36560:31038,36561:32023,36562:32773,36563:35613,36564:36554,36565:36974,36566:34503,36567:37034,36568:20511,36569:21242,36570:23610,36571:26451,36572:28796,36573:29237,36574:37196,36575:37320,36576:37675,36577:33509,36578:23490,36579:24369,36580:24825,36581:20027,36582:21462,36583:23432,36584:25163,36585:26417,36586:27530,36587:29417,36588:29664,36589:31278,36590:33131,36591:36259,36592:37202,36593:39318,36594:20754,36595:21463,36596:21610,36597:23551,36598:25480,36599:27193,36600:32172,36601:38656,36602:22234,36603:21454,36604:21608,36672:23447,36673:23601,36674:24030,36675:20462,36676:24833,36677:25342,36678:27954,36679:31168,36680:31179,36681:32066,36682:32333,36683:32722,36684:33261,36685:33311,36686:33936,36687:34886,36688:35186,36689:35728,36690:36468,36691:36655,36692:36913,36693:37195,36694:37228,36695:38598,36696:37276,36697:20160,36698:20303,36699:20805,36700:21313,36701:24467,36702:25102,36703:26580,36704:27713,36705:28171,36706:29539,36707:32294,36708:37325,36709:37507,36710:21460,36711:22809,36712:23487,36713:28113,36714:31069,36715:32302,36716:31899,36717:22654,36718:29087,36719:20986,36720:34899,36721:36848,36722:20426,36723:23803,36724:26149,36725:30636,36726:31459,36727:33308,36728:39423,36729:20934,36730:24490,36731:26092,36732:26991,36733:27529,36734:28147,36736:28310,36737:28516,36738:30462,36739:32020,36740:24033,36741:36981,36742:37255,36743:38918,36744:20966,36745:21021,36746:25152,36747:26257,36748:26329,36749:28186,36750:24246,36751:32210,36752:32626,36753:26360,36754:34223,36755:34295,36756:35576,36757:21161,36758:21465,36759:22899,36760:24207,36761:24464,36762:24661,36763:37604,36764:38500,36765:20663,36766:20767,36767:21213,36768:21280,36769:21319,36770:21484,36771:21736,36772:21830,36773:21809,36774:22039,36775:22888,36776:22974,36777:23100,36778:23477,36779:23558,36780:23567,36781:23569,36782:23578,36783:24196,36784:24202,36785:24288,36786:24432,36787:25215,36788:25220,36789:25307,36790:25484,36791:25463,36792:26119,36793:26124,36794:26157,36795:26230,36796:26494,36797:26786,36798:27167,36799:27189,36800:27836,36801:28040,36802:28169,36803:28248,36804:28988,36805:28966,36806:29031,36807:30151,36808:30465,36809:30813,36810:30977,36811:31077,36812:31216,36813:31456,36814:31505,36815:31911,36816:32057,36817:32918,36818:33750,36819:33931,36820:34121,36821:34909,36822:35059,36823:35359,36824:35388,36825:35412,36826:35443,36827:35937,36828:36062,36829:37284,36830:37478,36831:37758,36832:37912,36833:38556,36834:38808,36835:19978,36836:19976,36837:19998,36838:20055,36839:20887,36840:21104,36841:22478,36842:22580,36843:22732,36844:23330,36845:24120,36846:24773,36847:25854,36848:26465,36849:26454,36850:27972,36851:29366,36852:30067,36853:31331,36854:33976,36855:35698,36856:37304,36857:37664,36858:22065,36859:22516,36860:39166,36928:25325,36929:26893,36930:27542,36931:29165,36932:32340,36933:32887,36934:33394,36935:35302,36936:39135,36937:34645,36938:36785,36939:23611,36940:20280,36941:20449,36942:20405,36943:21767,36944:23072,36945:23517,36946:23529,36947:24515,36948:24910,36949:25391,36950:26032,36951:26187,36952:26862,36953:27035,36954:28024,36955:28145,36956:30003,36957:30137,36958:30495,36959:31070,36960:31206,36961:32051,36962:33251,36963:33455,36964:34218,36965:35242,36966:35386,36967:36523,36968:36763,36969:36914,36970:37341,36971:38663,36972:20154,36973:20161,36974:20995,36975:22645,36976:22764,36977:23563,36978:29978,36979:23613,36980:33102,36981:35338,36982:36805,36983:38499,36984:38765,36985:31525,36986:35535,36987:38920,36988:37218,36989:22259,36990:21416,36992:36887,36993:21561,36994:22402,36995:24101,36996:25512,36997:27700,36998:28810,36999:30561,37e3:31883,37001:32736,37002:34928,37003:36930,37004:37204,37005:37648,37006:37656,37007:38543,37008:29790,37009:39620,37010:23815,37011:23913,37012:25968,37013:26530,37014:36264,37015:38619,37016:25454,37017:26441,37018:26905,37019:33733,37020:38935,37021:38592,37022:35070,37023:28548,37024:25722,37025:23544,37026:19990,37027:28716,37028:30045,37029:26159,37030:20932,37031:21046,37032:21218,37033:22995,37034:24449,37035:24615,37036:25104,37037:25919,37038:25972,37039:26143,37040:26228,37041:26866,37042:26646,37043:27491,37044:28165,37045:29298,37046:29983,37047:30427,37048:31934,37049:32854,37050:22768,37051:35069,37052:35199,37053:35488,37054:35475,37055:35531,37056:36893,37057:37266,37058:38738,37059:38745,37060:25993,37061:31246,37062:33030,37063:38587,37064:24109,37065:24796,37066:25114,37067:26021,37068:26132,37069:26512,37070:30707,37071:31309,37072:31821,37073:32318,37074:33034,37075:36012,37076:36196,37077:36321,37078:36447,37079:30889,37080:20999,37081:25305,37082:25509,37083:25666,37084:25240,37085:35373,37086:31363,37087:31680,37088:35500,37089:38634,37090:32118,37091:33292,37092:34633,37093:20185,37094:20808,37095:21315,37096:21344,37097:23459,37098:23554,37099:23574,37100:24029,37101:25126,37102:25159,37103:25776,37104:26643,37105:26676,37106:27849,37107:27973,37108:27927,37109:26579,37110:28508,37111:29006,37112:29053,37113:26059,37114:31359,37115:31661,37116:32218,37184:32330,37185:32680,37186:33146,37187:33307,37188:33337,37189:34214,37190:35438,37191:36046,37192:36341,37193:36984,37194:36983,37195:37549,37196:37521,37197:38275,37198:39854,37199:21069,37200:21892,37201:28472,37202:28982,37203:20840,37204:31109,37205:32341,37206:33203,37207:31950,37208:22092,37209:22609,37210:23720,37211:25514,37212:26366,37213:26365,37214:26970,37215:29401,37216:30095,37217:30094,37218:30990,37219:31062,37220:31199,37221:31895,37222:32032,37223:32068,37224:34311,37225:35380,37226:38459,37227:36961,37228:40736,37229:20711,37230:21109,37231:21452,37232:21474,37233:20489,37234:21930,37235:22766,37236:22863,37237:29245,37238:23435,37239:23652,37240:21277,37241:24803,37242:24819,37243:25436,37244:25475,37245:25407,37246:25531,37248:25805,37249:26089,37250:26361,37251:24035,37252:27085,37253:27133,37254:28437,37255:29157,37256:20105,37257:30185,37258:30456,37259:31379,37260:31967,37261:32207,37262:32156,37263:32865,37264:33609,37265:33624,37266:33900,37267:33980,37268:34299,37269:35013,37270:36208,37271:36865,37272:36973,37273:37783,37274:38684,37275:39442,37276:20687,37277:22679,37278:24974,37279:33235,37280:34101,37281:36104,37282:36896,37283:20419,37284:20596,37285:21063,37286:21363,37287:24687,37288:25417,37289:26463,37290:28204,37291:36275,37292:36895,37293:20439,37294:23646,37295:36042,37296:26063,37297:32154,37298:21330,37299:34966,37300:20854,37301:25539,37302:23384,37303:23403,37304:23562,37305:25613,37306:26449,37307:36956,37308:20182,37309:22810,37310:22826,37311:27760,37312:35409,37313:21822,37314:22549,37315:22949,37316:24816,37317:25171,37318:26561,37319:33333,37320:26965,37321:38464,37322:39364,37323:39464,37324:20307,37325:22534,37326:23550,37327:32784,37328:23729,37329:24111,37330:24453,37331:24608,37332:24907,37333:25140,37334:26367,37335:27888,37336:28382,37337:32974,37338:33151,37339:33492,37340:34955,37341:36024,37342:36864,37343:36910,37344:38538,37345:40667,37346:39899,37347:20195,37348:21488,37349:22823,37350:31532,37351:37261,37352:38988,37353:40441,37354:28381,37355:28711,37356:21331,37357:21828,37358:23429,37359:25176,37360:25246,37361:25299,37362:27810,37363:28655,37364:29730,37365:35351,37366:37944,37367:28609,37368:35582,37369:33592,37370:20967,37371:34552,37372:21482,37440:21481,37441:20294,37442:36948,37443:36784,37444:22890,37445:33073,37446:24061,37447:31466,37448:36799,37449:26842,37450:35895,37451:29432,37452:40008,37453:27197,37454:35504,37455:20025,37456:21336,37457:22022,37458:22374,37459:25285,37460:25506,37461:26086,37462:27470,37463:28129,37464:28251,37465:28845,37466:30701,37467:31471,37468:31658,37469:32187,37470:32829,37471:32966,37472:34507,37473:35477,37474:37723,37475:22243,37476:22727,37477:24382,37478:26029,37479:26262,37480:27264,37481:27573,37482:30007,37483:35527,37484:20516,37485:30693,37486:22320,37487:24347,37488:24677,37489:26234,37490:27744,37491:30196,37492:31258,37493:32622,37494:33268,37495:34584,37496:36933,37497:39347,37498:31689,37499:30044,37500:31481,37501:31569,37502:33988,37504:36880,37505:31209,37506:31378,37507:33590,37508:23265,37509:30528,37510:20013,37511:20210,37512:23449,37513:24544,37514:25277,37515:26172,37516:26609,37517:27880,37518:34411,37519:34935,37520:35387,37521:37198,37522:37619,37523:39376,37524:27159,37525:28710,37526:29482,37527:33511,37528:33879,37529:36015,37530:19969,37531:20806,37532:20939,37533:21899,37534:23541,37535:24086,37536:24115,37537:24193,37538:24340,37539:24373,37540:24427,37541:24500,37542:25074,37543:25361,37544:26274,37545:26397,37546:28526,37547:29266,37548:30010,37549:30522,37550:32884,37551:33081,37552:33144,37553:34678,37554:35519,37555:35548,37556:36229,37557:36339,37558:37530,37559:38263,37560:38914,37561:40165,37562:21189,37563:25431,37564:30452,37565:26389,37566:27784,37567:29645,37568:36035,37569:37806,37570:38515,37571:27941,37572:22684,37573:26894,37574:27084,37575:36861,37576:37786,37577:30171,37578:36890,37579:22618,37580:26626,37581:25524,37582:27131,37583:20291,37584:28460,37585:26584,37586:36795,37587:34086,37588:32180,37589:37716,37590:26943,37591:28528,37592:22378,37593:22775,37594:23340,37595:32044,37596:29226,37597:21514,37598:37347,37599:40372,37600:20141,37601:20302,37602:20572,37603:20597,37604:21059,37605:35998,37606:21576,37607:22564,37608:23450,37609:24093,37610:24213,37611:24237,37612:24311,37613:24351,37614:24716,37615:25269,37616:25402,37617:25552,37618:26799,37619:27712,37620:30855,37621:31118,37622:31243,37623:32224,37624:33351,37625:35330,37626:35558,37627:36420,37628:36883,37696:37048,37697:37165,37698:37336,37699:40718,37700:27877,37701:25688,37702:25826,37703:25973,37704:28404,37705:30340,37706:31515,37707:36969,37708:37841,37709:28346,37710:21746,37711:24505,37712:25764,37713:36685,37714:36845,37715:37444,37716:20856,37717:22635,37718:22825,37719:23637,37720:24215,37721:28155,37722:32399,37723:29980,37724:36028,37725:36578,37726:39003,37727:28857,37728:20253,37729:27583,37730:28593,37731:3e4,37732:38651,37733:20814,37734:21520,37735:22581,37736:22615,37737:22956,37738:23648,37739:24466,37740:26007,37741:26460,37742:28193,37743:30331,37744:33759,37745:36077,37746:36884,37747:37117,37748:37709,37749:30757,37750:30778,37751:21162,37752:24230,37753:22303,37754:22900,37755:24594,37756:20498,37757:20826,37758:20908,37760:20941,37761:20992,37762:21776,37763:22612,37764:22616,37765:22871,37766:23445,37767:23798,37768:23947,37769:24764,37770:25237,37771:25645,37772:26481,37773:26691,37774:26812,37775:26847,37776:30423,37777:28120,37778:28271,37779:28059,37780:28783,37781:29128,37782:24403,37783:30168,37784:31095,37785:31561,37786:31572,37787:31570,37788:31958,37789:32113,37790:21040,37791:33891,37792:34153,37793:34276,37794:35342,37795:35588,37796:35910,37797:36367,37798:36867,37799:36879,37800:37913,37801:38518,37802:38957,37803:39472,37804:38360,37805:20685,37806:21205,37807:21516,37808:22530,37809:23566,37810:24999,37811:25758,37812:27934,37813:30643,37814:31461,37815:33012,37816:33796,37817:36947,37818:37509,37819:23776,37820:40199,37821:21311,37822:24471,37823:24499,37824:28060,37825:29305,37826:30563,37827:31167,37828:31716,37829:27602,37830:29420,37831:35501,37832:26627,37833:27233,37834:20984,37835:31361,37836:26932,37837:23626,37838:40182,37839:33515,37840:23493,37841:37193,37842:28702,37843:22136,37844:23663,37845:24775,37846:25958,37847:27788,37848:35930,37849:36929,37850:38931,37851:21585,37852:26311,37853:37389,37854:22856,37855:37027,37856:20869,37857:20045,37858:20970,37859:34201,37860:35598,37861:28760,37862:25466,37863:37707,37864:26978,37865:39348,37866:32260,37867:30071,37868:21335,37869:26976,37870:36575,37871:38627,37872:27741,37873:20108,37874:23612,37875:24336,37876:36841,37877:21250,37878:36049,37879:32905,37880:34425,37881:24319,37882:26085,37883:20083,37884:20837,37952:22914,37953:23615,37954:38894,37955:20219,37956:22922,37957:24525,37958:35469,37959:28641,37960:31152,37961:31074,37962:23527,37963:33905,37964:29483,37965:29105,37966:24180,37967:24565,37968:25467,37969:25754,37970:29123,37971:31896,37972:20035,37973:24316,37974:20043,37975:22492,37976:22178,37977:24745,37978:28611,37979:32013,37980:33021,37981:33075,37982:33215,37983:36786,37984:35223,37985:34468,37986:24052,37987:25226,37988:25773,37989:35207,37990:26487,37991:27874,37992:27966,37993:29750,37994:30772,37995:23110,37996:32629,37997:33453,37998:39340,37999:20467,38e3:24259,38001:25309,38002:25490,38003:25943,38004:26479,38005:30403,38006:29260,38007:32972,38008:32954,38009:36649,38010:37197,38011:20493,38012:22521,38013:23186,38014:26757,38016:26995,38017:29028,38018:29437,38019:36023,38020:22770,38021:36064,38022:38506,38023:36889,38024:34687,38025:31204,38026:30695,38027:33833,38028:20271,38029:21093,38030:21338,38031:25293,38032:26575,38033:27850,38034:30333,38035:31636,38036:31893,38037:33334,38038:34180,38039:36843,38040:26333,38041:28448,38042:29190,38043:32283,38044:33707,38045:39361,38046:40614,38047:20989,38048:31665,38049:30834,38050:31672,38051:32903,38052:31560,38053:27368,38054:24161,38055:32908,38056:30033,38057:30048,38058:20843,38059:37474,38060:28300,38061:30330,38062:37271,38063:39658,38064:20240,38065:32624,38066:25244,38067:31567,38068:38309,38069:40169,38070:22138,38071:22617,38072:34532,38073:38588,38074:20276,38075:21028,38076:21322,38077:21453,38078:21467,38079:24070,38080:25644,38081:26001,38082:26495,38083:27710,38084:27726,38085:29256,38086:29359,38087:29677,38088:30036,38089:32321,38090:33324,38091:34281,38092:36009,38093:31684,38094:37318,38095:29033,38096:38930,38097:39151,38098:25405,38099:26217,38100:30058,38101:30436,38102:30928,38103:34115,38104:34542,38105:21290,38106:21329,38107:21542,38108:22915,38109:24199,38110:24444,38111:24754,38112:25161,38113:25209,38114:25259,38115:26e3,38116:27604,38117:27852,38118:30130,38119:30382,38120:30865,38121:31192,38122:32203,38123:32631,38124:32933,38125:34987,38126:35513,38127:36027,38128:36991,38129:38750,38130:39131,38131:27147,38132:31800,38133:20633,38134:23614,38135:24494,38136:26503,38137:27608,38138:29749,38139:30473,38140:32654,38208:40763,38209:26570,38210:31255,38211:21305,38212:30091,38213:39661,38214:24422,38215:33181,38216:33777,38217:32920,38218:24380,38219:24517,38220:30050,38221:31558,38222:36924,38223:26727,38224:23019,38225:23195,38226:32016,38227:30334,38228:35628,38229:20469,38230:24426,38231:27161,38232:27703,38233:28418,38234:29922,38235:31080,38236:34920,38237:35413,38238:35961,38239:24287,38240:25551,38241:30149,38242:31186,38243:33495,38244:37672,38245:37618,38246:33948,38247:34541,38248:39981,38249:21697,38250:24428,38251:25996,38252:27996,38253:28693,38254:36007,38255:36051,38256:38971,38257:25935,38258:29942,38259:19981,38260:20184,38261:22496,38262:22827,38263:23142,38264:23500,38265:20904,38266:24067,38267:24220,38268:24598,38269:25206,38270:25975,38272:26023,38273:26222,38274:28014,38275:29238,38276:31526,38277:33104,38278:33178,38279:33433,38280:35676,38281:36e3,38282:36070,38283:36212,38284:38428,38285:38468,38286:20398,38287:25771,38288:27494,38289:33310,38290:33889,38291:34154,38292:37096,38293:23553,38294:26963,38295:39080,38296:33914,38297:34135,38298:20239,38299:21103,38300:24489,38301:24133,38302:26381,38303:31119,38304:33145,38305:35079,38306:35206,38307:28149,38308:24343,38309:25173,38310:27832,38311:20175,38312:29289,38313:39826,38314:20998,38315:21563,38316:22132,38317:22707,38318:24996,38319:25198,38320:28954,38321:22894,38322:31881,38323:31966,38324:32027,38325:38640,38326:25991,38327:32862,38328:19993,38329:20341,38330:20853,38331:22592,38332:24163,38333:24179,38334:24330,38335:26564,38336:20006,38337:34109,38338:38281,38339:38491,38340:31859,38341:38913,38342:20731,38343:22721,38344:30294,38345:30887,38346:21029,38347:30629,38348:34065,38349:31622,38350:20559,38351:22793,38352:29255,38353:31687,38354:32232,38355:36794,38356:36820,38357:36941,38358:20415,38359:21193,38360:23081,38361:24321,38362:38829,38363:20445,38364:33303,38365:37610,38366:22275,38367:25429,38368:27497,38369:29995,38370:35036,38371:36628,38372:31298,38373:21215,38374:22675,38375:24917,38376:25098,38377:26286,38378:27597,38379:31807,38380:33769,38381:20515,38382:20472,38383:21253,38384:21574,38385:22577,38386:22857,38387:23453,38388:23792,38389:23791,38390:23849,38391:24214,38392:25265,38393:25447,38394:25918,38395:26041,38396:26379,38464:27861,38465:27873,38466:28921,38467:30770,38468:32299,38469:32990,38470:33459,38471:33804,38472:34028,38473:34562,38474:35090,38475:35370,38476:35914,38477:37030,38478:37586,38479:39165,38480:40179,38481:40300,38482:20047,38483:20129,38484:20621,38485:21078,38486:22346,38487:22952,38488:24125,38489:24536,38490:24537,38491:25151,38492:26292,38493:26395,38494:26576,38495:26834,38496:20882,38497:32033,38498:32938,38499:33192,38500:35584,38501:35980,38502:36031,38503:37502,38504:38450,38505:21536,38506:38956,38507:21271,38508:20693,38509:21340,38510:22696,38511:25778,38512:26420,38513:29287,38514:30566,38515:31302,38516:37350,38517:21187,38518:27809,38519:27526,38520:22528,38521:24140,38522:22868,38523:26412,38524:32763,38525:20961,38526:30406,38528:25705,38529:30952,38530:39764,38531:40635,38532:22475,38533:22969,38534:26151,38535:26522,38536:27598,38537:21737,38538:27097,38539:24149,38540:33180,38541:26517,38542:39850,38543:26622,38544:40018,38545:26717,38546:20134,38547:20451,38548:21448,38549:25273,38550:26411,38551:27819,38552:36804,38553:20397,38554:32365,38555:40639,38556:19975,38557:24930,38558:28288,38559:28459,38560:34067,38561:21619,38562:26410,38563:39749,38564:24051,38565:31637,38566:23724,38567:23494,38568:34588,38569:28234,38570:34001,38571:31252,38572:33032,38573:22937,38574:31885,38575:27665,38576:30496,38577:21209,38578:22818,38579:28961,38580:29279,38581:30683,38582:38695,38583:40289,38584:26891,38585:23167,38586:23064,38587:20901,38588:21517,38589:21629,38590:26126,38591:30431,38592:36855,38593:37528,38594:40180,38595:23018,38596:29277,38597:28357,38598:20813,38599:26825,38600:32191,38601:32236,38602:38754,38603:40634,38604:25720,38605:27169,38606:33538,38607:22916,38608:23391,38609:27611,38610:29467,38611:30450,38612:32178,38613:32791,38614:33945,38615:20786,38616:26408,38617:40665,38618:30446,38619:26466,38620:21247,38621:39173,38622:23588,38623:25147,38624:31870,38625:36016,38626:21839,38627:24758,38628:32011,38629:38272,38630:21249,38631:20063,38632:20918,38633:22812,38634:29242,38635:32822,38636:37326,38637:24357,38638:30690,38639:21380,38640:24441,38641:32004,38642:34220,38643:35379,38644:36493,38645:38742,38646:26611,38647:34222,38648:37971,38649:24841,38650:24840,38651:27833,38652:30290,38720:35565,38721:36664,38722:21807,38723:20305,38724:20778,38725:21191,38726:21451,38727:23461,38728:24189,38729:24736,38730:24962,38731:25558,38732:26377,38733:26586,38734:28263,38735:28044,38736:29494,38737:29495,38738:30001,38739:31056,38740:35029,38741:35480,38742:36938,38743:37009,38744:37109,38745:38596,38746:34701,38747:22805,38748:20104,38749:20313,38750:19982,38751:35465,38752:36671,38753:38928,38754:20653,38755:24188,38756:22934,38757:23481,38758:24248,38759:25562,38760:25594,38761:25793,38762:26332,38763:26954,38764:27096,38765:27915,38766:28342,38767:29076,38768:29992,38769:31407,38770:32650,38771:32768,38772:33865,38773:33993,38774:35201,38775:35617,38776:36362,38777:36965,38778:38525,38779:39178,38780:24958,38781:25233,38782:27442,38784:27779,38785:28020,38786:32716,38787:32764,38788:28096,38789:32645,38790:34746,38791:35064,38792:26469,38793:33713,38794:38972,38795:38647,38796:27931,38797:32097,38798:33853,38799:37226,38800:20081,38801:21365,38802:23888,38803:27396,38804:28651,38805:34253,38806:34349,38807:35239,38808:21033,38809:21519,38810:23653,38811:26446,38812:26792,38813:29702,38814:29827,38815:30178,38816:35023,38817:35041,38818:37324,38819:38626,38820:38520,38821:24459,38822:29575,38823:31435,38824:33870,38825:25504,38826:30053,38827:21129,38828:27969,38829:28316,38830:29705,38831:30041,38832:30827,38833:31890,38834:38534,38835:31452,38836:40845,38837:20406,38838:24942,38839:26053,38840:34396,38841:20102,38842:20142,38843:20698,38844:20001,38845:20940,38846:23534,38847:26009,38848:26753,38849:28092,38850:29471,38851:30274,38852:30637,38853:31260,38854:31975,38855:33391,38856:35538,38857:36988,38858:37327,38859:38517,38860:38936,38861:21147,38862:32209,38863:20523,38864:21400,38865:26519,38866:28107,38867:29136,38868:29747,38869:33256,38870:36650,38871:38563,38872:40023,38873:40607,38874:29792,38875:22593,38876:28057,38877:32047,38878:39006,38879:20196,38880:20278,38881:20363,38882:20919,38883:21169,38884:23994,38885:24604,38886:29618,38887:31036,38888:33491,38889:37428,38890:38583,38891:38646,38892:38666,38893:40599,38894:40802,38895:26278,38896:27508,38897:21015,38898:21155,38899:28872,38900:35010,38901:24265,38902:24651,38903:24976,38904:28451,38905:29001,38906:31806,38907:32244,38908:32879,38976:34030,38977:36899,38978:37676,38979:21570,38980:39791,38981:27347,38982:28809,38983:36034,38984:36335,38985:38706,38986:21172,38987:23105,38988:24266,38989:24324,38990:26391,38991:27004,38992:27028,38993:28010,38994:28431,38995:29282,38996:29436,38997:31725,38998:32769,38999:32894,39e3:34635,39001:37070,39002:20845,39003:40595,39004:31108,39005:32907,39006:37682,39007:35542,39008:20525,39009:21644,39010:35441,39011:27498,39012:36036,39013:33031,39014:24785,39015:26528,39016:40434,39017:20121,39018:20120,39019:39952,39020:35435,39021:34241,39022:34152,39023:26880,39024:28286,39025:30871,39026:33109,39071:24332,39072:19984,39073:19989,39074:20010,39075:20017,39076:20022,39077:20028,39078:20031,39079:20034,39080:20054,39081:20056,39082:20098,39083:20101,39084:35947,39085:20106,39086:33298,39087:24333,39088:20110,39089:20126,39090:20127,39091:20128,39092:20130,39093:20144,39094:20147,39095:20150,39096:20174,39097:20173,39098:20164,39099:20166,39100:20162,39101:20183,39102:20190,39103:20205,39104:20191,39105:20215,39106:20233,39107:20314,39108:20272,39109:20315,39110:20317,39111:20311,39112:20295,39113:20342,39114:20360,39115:20367,39116:20376,39117:20347,39118:20329,39119:20336,39120:20369,39121:20335,39122:20358,39123:20374,39124:20760,39125:20436,39126:20447,39127:20430,39128:20440,39129:20443,39130:20433,39131:20442,39132:20432,39133:20452,39134:20453,39135:20506,39136:20520,39137:20500,39138:20522,39139:20517,39140:20485,39141:20252,39142:20470,39143:20513,39144:20521,39145:20524,39146:20478,39147:20463,39148:20497,39149:20486,39150:20547,39151:20551,39152:26371,39153:20565,39154:20560,39155:20552,39156:20570,39157:20566,39158:20588,39159:20600,39160:20608,39161:20634,39162:20613,39163:20660,39164:20658,39232:20681,39233:20682,39234:20659,39235:20674,39236:20694,39237:20702,39238:20709,39239:20717,39240:20707,39241:20718,39242:20729,39243:20725,39244:20745,39245:20737,39246:20738,39247:20758,39248:20757,39249:20756,39250:20762,39251:20769,39252:20794,39253:20791,39254:20796,39255:20795,39256:20799,39257:20800,39258:20818,39259:20812,39260:20820,39261:20834,39262:31480,39263:20841,39264:20842,39265:20846,39266:20864,39267:20866,39268:22232,39269:20876,39270:20873,39271:20879,39272:20881,39273:20883,39274:20885,39275:20886,39276:20900,39277:20902,39278:20898,39279:20905,39280:20906,39281:20907,39282:20915,39283:20913,39284:20914,39285:20912,39286:20917,39287:20925,39288:20933,39289:20937,39290:20955,39291:20960,39292:34389,39293:20969,39294:20973,39296:20976,39297:20981,39298:20990,39299:20996,39300:21003,39301:21012,39302:21006,39303:21031,39304:21034,39305:21038,39306:21043,39307:21049,39308:21071,39309:21060,39310:21067,39311:21068,39312:21086,39313:21076,39314:21098,39315:21108,39316:21097,39317:21107,39318:21119,39319:21117,39320:21133,39321:21140,39322:21138,39323:21105,39324:21128,39325:21137,39326:36776,39327:36775,39328:21164,39329:21165,39330:21180,39331:21173,39332:21185,39333:21197,39334:21207,39335:21214,39336:21219,39337:21222,39338:39149,39339:21216,39340:21235,39341:21237,39342:21240,39343:21241,39344:21254,39345:21256,39346:30008,39347:21261,39348:21264,39349:21263,39350:21269,39351:21274,39352:21283,39353:21295,39354:21297,39355:21299,39356:21304,39357:21312,39358:21318,39359:21317,39360:19991,39361:21321,39362:21325,39363:20950,39364:21342,39365:21353,39366:21358,39367:22808,39368:21371,39369:21367,39370:21378,39371:21398,39372:21408,39373:21414,39374:21413,39375:21422,39376:21424,39377:21430,39378:21443,39379:31762,39380:38617,39381:21471,39382:26364,39383:29166,39384:21486,39385:21480,39386:21485,39387:21498,39388:21505,39389:21565,39390:21568,39391:21548,39392:21549,39393:21564,39394:21550,39395:21558,39396:21545,39397:21533,39398:21582,39399:21647,39400:21621,39401:21646,39402:21599,39403:21617,39404:21623,39405:21616,39406:21650,39407:21627,39408:21632,39409:21622,39410:21636,39411:21648,39412:21638,39413:21703,39414:21666,39415:21688,39416:21669,39417:21676,39418:21700,39419:21704,39420:21672,39488:21675,39489:21698,39490:21668,39491:21694,39492:21692,39493:21720,39494:21733,39495:21734,39496:21775,39497:21780,39498:21757,39499:21742,39500:21741,39501:21754,39502:21730,39503:21817,39504:21824,39505:21859,39506:21836,39507:21806,39508:21852,39509:21829,39510:21846,39511:21847,39512:21816,39513:21811,39514:21853,39515:21913,39516:21888,39517:21679,39518:21898,39519:21919,39520:21883,39521:21886,39522:21912,39523:21918,39524:21934,39525:21884,39526:21891,39527:21929,39528:21895,39529:21928,39530:21978,39531:21957,39532:21983,39533:21956,39534:21980,39535:21988,39536:21972,39537:22036,39538:22007,39539:22038,39540:22014,39541:22013,39542:22043,39543:22009,39544:22094,39545:22096,39546:29151,39547:22068,39548:22070,39549:22066,39550:22072,39552:22123,39553:22116,39554:22063,39555:22124,39556:22122,39557:22150,39558:22144,39559:22154,39560:22176,39561:22164,39562:22159,39563:22181,39564:22190,39565:22198,39566:22196,39567:22210,39568:22204,39569:22209,39570:22211,39571:22208,39572:22216,39573:22222,39574:22225,39575:22227,39576:22231,39577:22254,39578:22265,39579:22272,39580:22271,39581:22276,39582:22281,39583:22280,39584:22283,39585:22285,39586:22291,39587:22296,39588:22294,39589:21959,39590:22300,39591:22310,39592:22327,39593:22328,39594:22350,39595:22331,39596:22336,39597:22351,39598:22377,39599:22464,39600:22408,39601:22369,39602:22399,39603:22409,39604:22419,39605:22432,39606:22451,39607:22436,39608:22442,39609:22448,39610:22467,39611:22470,39612:22484,39613:22482,39614:22483,39615:22538,39616:22486,39617:22499,39618:22539,39619:22553,39620:22557,39621:22642,39622:22561,39623:22626,39624:22603,39625:22640,39626:27584,39627:22610,39628:22589,39629:22649,39630:22661,39631:22713,39632:22687,39633:22699,39634:22714,39635:22750,39636:22715,39637:22712,39638:22702,39639:22725,39640:22739,39641:22737,39642:22743,39643:22745,39644:22744,39645:22757,39646:22748,39647:22756,39648:22751,39649:22767,39650:22778,39651:22777,39652:22779,39653:22780,39654:22781,39655:22786,39656:22794,39657:22800,39658:22811,39659:26790,39660:22821,39661:22828,39662:22829,39663:22834,39664:22840,39665:22846,39666:31442,39667:22869,39668:22864,39669:22862,39670:22874,39671:22872,39672:22882,39673:22880,39674:22887,39675:22892,39676:22889,39744:22904,39745:22913,39746:22941,39747:20318,39748:20395,39749:22947,39750:22962,39751:22982,39752:23016,39753:23004,39754:22925,39755:23001,39756:23002,39757:23077,39758:23071,39759:23057,39760:23068,39761:23049,39762:23066,39763:23104,39764:23148,39765:23113,39766:23093,39767:23094,39768:23138,39769:23146,39770:23194,39771:23228,39772:23230,39773:23243,39774:23234,39775:23229,39776:23267,39777:23255,39778:23270,39779:23273,39780:23254,39781:23290,39782:23291,39783:23308,39784:23307,39785:23318,39786:23346,39787:23248,39788:23338,39789:23350,39790:23358,39791:23363,39792:23365,39793:23360,39794:23377,39795:23381,39796:23386,39797:23387,39798:23397,39799:23401,39800:23408,39801:23411,39802:23413,39803:23416,39804:25992,39805:23418,39806:23424,39808:23427,39809:23462,39810:23480,39811:23491,39812:23495,39813:23497,39814:23508,39815:23504,39816:23524,39817:23526,39818:23522,39819:23518,39820:23525,39821:23531,39822:23536,39823:23542,39824:23539,39825:23557,39826:23559,39827:23560,39828:23565,39829:23571,39830:23584,39831:23586,39832:23592,39833:23608,39834:23609,39835:23617,39836:23622,39837:23630,39838:23635,39839:23632,39840:23631,39841:23409,39842:23660,39843:23662,39844:20066,39845:23670,39846:23673,39847:23692,39848:23697,39849:23700,39850:22939,39851:23723,39852:23739,39853:23734,39854:23740,39855:23735,39856:23749,39857:23742,39858:23751,39859:23769,39860:23785,39861:23805,39862:23802,39863:23789,39864:23948,39865:23786,39866:23819,39867:23829,39868:23831,39869:23900,39870:23839,39871:23835,39872:23825,39873:23828,39874:23842,39875:23834,39876:23833,39877:23832,39878:23884,39879:23890,39880:23886,39881:23883,39882:23916,39883:23923,39884:23926,39885:23943,39886:23940,39887:23938,39888:23970,39889:23965,39890:23980,39891:23982,39892:23997,39893:23952,39894:23991,39895:23996,39896:24009,39897:24013,39898:24019,39899:24018,39900:24022,39901:24027,39902:24043,39903:24050,39904:24053,39905:24075,39906:24090,39907:24089,39908:24081,39909:24091,39910:24118,39911:24119,39912:24132,39913:24131,39914:24128,39915:24142,39916:24151,39917:24148,39918:24159,39919:24162,39920:24164,39921:24135,39922:24181,39923:24182,39924:24186,39925:40636,39926:24191,39927:24224,39928:24257,39929:24258,39930:24264,39931:24272,39932:24271,4e4:24278,40001:24291,40002:24285,40003:24282,40004:24283,40005:24290,40006:24289,40007:24296,40008:24297,40009:24300,40010:24305,40011:24307,40012:24304,40013:24308,40014:24312,40015:24318,40016:24323,40017:24329,40018:24413,40019:24412,40020:24331,40021:24337,40022:24342,40023:24361,40024:24365,40025:24376,40026:24385,40027:24392,40028:24396,40029:24398,40030:24367,40031:24401,40032:24406,40033:24407,40034:24409,40035:24417,40036:24429,40037:24435,40038:24439,40039:24451,40040:24450,40041:24447,40042:24458,40043:24456,40044:24465,40045:24455,40046:24478,40047:24473,40048:24472,40049:24480,40050:24488,40051:24493,40052:24508,40053:24534,40054:24571,40055:24548,40056:24568,40057:24561,40058:24541,40059:24755,40060:24575,40061:24609,40062:24672,40064:24601,40065:24592,40066:24617,40067:24590,40068:24625,40069:24603,40070:24597,40071:24619,40072:24614,40073:24591,40074:24634,40075:24666,40076:24641,40077:24682,40078:24695,40079:24671,40080:24650,40081:24646,40082:24653,40083:24675,40084:24643,40085:24676,40086:24642,40087:24684,40088:24683,40089:24665,40090:24705,40091:24717,40092:24807,40093:24707,40094:24730,40095:24708,40096:24731,40097:24726,40098:24727,40099:24722,40100:24743,40101:24715,40102:24801,40103:24760,40104:24800,40105:24787,40106:24756,40107:24560,40108:24765,40109:24774,40110:24757,40111:24792,40112:24909,40113:24853,40114:24838,40115:24822,40116:24823,40117:24832,40118:24820,40119:24826,40120:24835,40121:24865,40122:24827,40123:24817,40124:24845,40125:24846,40126:24903,40127:24894,40128:24872,40129:24871,40130:24906,40131:24895,40132:24892,40133:24876,40134:24884,40135:24893,40136:24898,40137:24900,40138:24947,40139:24951,40140:24920,40141:24921,40142:24922,40143:24939,40144:24948,40145:24943,40146:24933,40147:24945,40148:24927,40149:24925,40150:24915,40151:24949,40152:24985,40153:24982,40154:24967,40155:25004,40156:24980,40157:24986,40158:24970,40159:24977,40160:25003,40161:25006,40162:25036,40163:25034,40164:25033,40165:25079,40166:25032,40167:25027,40168:25030,40169:25018,40170:25035,40171:32633,40172:25037,40173:25062,40174:25059,40175:25078,40176:25082,40177:25076,40178:25087,40179:25085,40180:25084,40181:25086,40182:25088,40183:25096,40184:25097,40185:25101,40186:25100,40187:25108,40188:25115,40256:25118,40257:25121,40258:25130,40259:25134,40260:25136,40261:25138,40262:25139,40263:25153,40264:25166,40265:25182,40266:25187,40267:25179,40268:25184,40269:25192,40270:25212,40271:25218,40272:25225,40273:25214,40274:25234,40275:25235,40276:25238,40277:25300,40278:25219,40279:25236,40280:25303,40281:25297,40282:25275,40283:25295,40284:25343,40285:25286,40286:25812,40287:25288,40288:25308,40289:25292,40290:25290,40291:25282,40292:25287,40293:25243,40294:25289,40295:25356,40296:25326,40297:25329,40298:25383,40299:25346,40300:25352,40301:25327,40302:25333,40303:25424,40304:25406,40305:25421,40306:25628,40307:25423,40308:25494,40309:25486,40310:25472,40311:25515,40312:25462,40313:25507,40314:25487,40315:25481,40316:25503,40317:25525,40318:25451,40320:25449,40321:25534,40322:25577,40323:25536,40324:25542,40325:25571,40326:25545,40327:25554,40328:25590,40329:25540,40330:25622,40331:25652,40332:25606,40333:25619,40334:25638,40335:25654,40336:25885,40337:25623,40338:25640,40339:25615,40340:25703,40341:25711,40342:25718,40343:25678,40344:25898,40345:25749,40346:25747,40347:25765,40348:25769,40349:25736,40350:25788,40351:25818,40352:25810,40353:25797,40354:25799,40355:25787,40356:25816,40357:25794,40358:25841,40359:25831,40360:33289,40361:25824,40362:25825,40363:25260,40364:25827,40365:25839,40366:25900,40367:25846,40368:25844,40369:25842,40370:25850,40371:25856,40372:25853,40373:25880,40374:25884,40375:25861,40376:25892,40377:25891,40378:25899,40379:25908,40380:25909,40381:25911,40382:25910,40383:25912,40384:30027,40385:25928,40386:25942,40387:25941,40388:25933,40389:25944,40390:25950,40391:25949,40392:25970,40393:25976,40394:25986,40395:25987,40396:35722,40397:26011,40398:26015,40399:26027,40400:26039,40401:26051,40402:26054,40403:26049,40404:26052,40405:26060,40406:26066,40407:26075,40408:26073,40409:26080,40410:26081,40411:26097,40412:26482,40413:26122,40414:26115,40415:26107,40416:26483,40417:26165,40418:26166,40419:26164,40420:26140,40421:26191,40422:26180,40423:26185,40424:26177,40425:26206,40426:26205,40427:26212,40428:26215,40429:26216,40430:26207,40431:26210,40432:26224,40433:26243,40434:26248,40435:26254,40436:26249,40437:26244,40438:26264,40439:26269,40440:26305,40441:26297,40442:26313,40443:26302,40444:26300,40512:26308,40513:26296,40514:26326,40515:26330,40516:26336,40517:26175,40518:26342,40519:26345,40520:26352,40521:26357,40522:26359,40523:26383,40524:26390,40525:26398,40526:26406,40527:26407,40528:38712,40529:26414,40530:26431,40531:26422,40532:26433,40533:26424,40534:26423,40535:26438,40536:26462,40537:26464,40538:26457,40539:26467,40540:26468,40541:26505,40542:26480,40543:26537,40544:26492,40545:26474,40546:26508,40547:26507,40548:26534,40549:26529,40550:26501,40551:26551,40552:26607,40553:26548,40554:26604,40555:26547,40556:26601,40557:26552,40558:26596,40559:26590,40560:26589,40561:26594,40562:26606,40563:26553,40564:26574,40565:26566,40566:26599,40567:27292,40568:26654,40569:26694,40570:26665,40571:26688,40572:26701,40573:26674,40574:26702,40576:26803,40577:26667,40578:26713,40579:26723,40580:26743,40581:26751,40582:26783,40583:26767,40584:26797,40585:26772,40586:26781,40587:26779,40588:26755,40589:27310,40590:26809,40591:26740,40592:26805,40593:26784,40594:26810,40595:26895,40596:26765,40597:26750,40598:26881,40599:26826,40600:26888,40601:26840,40602:26914,40603:26918,40604:26849,40605:26892,40606:26829,40607:26836,40608:26855,40609:26837,40610:26934,40611:26898,40612:26884,40613:26839,40614:26851,40615:26917,40616:26873,40617:26848,40618:26863,40619:26920,40620:26922,40621:26906,40622:26915,40623:26913,40624:26822,40625:27001,40626:26999,40627:26972,40628:27e3,40629:26987,40630:26964,40631:27006,40632:26990,40633:26937,40634:26996,40635:26941,40636:26969,40637:26928,40638:26977,40639:26974,40640:26973,40641:27009,40642:26986,40643:27058,40644:27054,40645:27088,40646:27071,40647:27073,40648:27091,40649:27070,40650:27086,40651:23528,40652:27082,40653:27101,40654:27067,40655:27075,40656:27047,40657:27182,40658:27025,40659:27040,40660:27036,40661:27029,40662:27060,40663:27102,40664:27112,40665:27138,40666:27163,40667:27135,40668:27402,40669:27129,40670:27122,40671:27111,40672:27141,40673:27057,40674:27166,40675:27117,40676:27156,40677:27115,40678:27146,40679:27154,40680:27329,40681:27171,40682:27155,40683:27204,40684:27148,40685:27250,40686:27190,40687:27256,40688:27207,40689:27234,40690:27225,40691:27238,40692:27208,40693:27192,40694:27170,40695:27280,40696:27277,40697:27296,40698:27268,40699:27298,40700:27299,40768:27287,40769:34327,40770:27323,40771:27331,40772:27330,40773:27320,40774:27315,40775:27308,40776:27358,40777:27345,40778:27359,40779:27306,40780:27354,40781:27370,40782:27387,40783:27397,40784:34326,40785:27386,40786:27410,40787:27414,40788:39729,40789:27423,40790:27448,40791:27447,40792:30428,40793:27449,40794:39150,40795:27463,40796:27459,40797:27465,40798:27472,40799:27481,40800:27476,40801:27483,40802:27487,40803:27489,40804:27512,40805:27513,40806:27519,40807:27520,40808:27524,40809:27523,40810:27533,40811:27544,40812:27541,40813:27550,40814:27556,40815:27562,40816:27563,40817:27567,40818:27570,40819:27569,40820:27571,40821:27575,40822:27580,40823:27590,40824:27595,40825:27603,40826:27615,40827:27628,40828:27627,40829:27635,40830:27631,40832:40638,40833:27656,40834:27667,40835:27668,40836:27675,40837:27684,40838:27683,40839:27742,40840:27733,40841:27746,40842:27754,40843:27778,40844:27789,40845:27802,40846:27777,40847:27803,40848:27774,40849:27752,40850:27763,40851:27794,40852:27792,40853:27844,40854:27889,40855:27859,40856:27837,40857:27863,40858:27845,40859:27869,40860:27822,40861:27825,40862:27838,40863:27834,40864:27867,40865:27887,40866:27865,40867:27882,40868:27935,40869:34893,40870:27958,40871:27947,40872:27965,40873:27960,40874:27929,40875:27957,40876:27955,40877:27922,40878:27916,40879:28003,40880:28051,40881:28004,40882:27994,40883:28025,40884:27993,40885:28046,40886:28053,40887:28644,40888:28037,40889:28153,40890:28181,40891:28170,40892:28085,40893:28103,40894:28134,40895:28088,40896:28102,40897:28140,40898:28126,40899:28108,40900:28136,40901:28114,40902:28101,40903:28154,40904:28121,40905:28132,40906:28117,40907:28138,40908:28142,40909:28205,40910:28270,40911:28206,40912:28185,40913:28274,40914:28255,40915:28222,40916:28195,40917:28267,40918:28203,40919:28278,40920:28237,40921:28191,40922:28227,40923:28218,40924:28238,40925:28196,40926:28415,40927:28189,40928:28216,40929:28290,40930:28330,40931:28312,40932:28361,40933:28343,40934:28371,40935:28349,40936:28335,40937:28356,40938:28338,40939:28372,40940:28373,40941:28303,40942:28325,40943:28354,40944:28319,40945:28481,40946:28433,40947:28748,40948:28396,40949:28408,40950:28414,40951:28479,40952:28402,40953:28465,40954:28399,40955:28466,40956:28364,161:65377,162:65378,163:65379,164:65380,165:65381,166:65382,167:65383,168:65384,169:65385,170:65386,171:65387,172:65388,173:65389,174:65390,175:65391,176:65392,177:65393,178:65394,179:65395,180:65396,181:65397,182:65398,183:65399,184:65400,185:65401,186:65402,187:65403,188:65404,189:65405,190:65406,191:65407,192:65408,193:65409,194:65410,195:65411,196:65412,197:65413,198:65414,199:65415,200:65416,201:65417,202:65418,203:65419,204:65420,205:65421,206:65422,207:65423,208:65424,209:65425,210:65426,211:65427,212:65428,213:65429,214:65430,215:65431,216:65432,217:65433,218:65434,219:65435,220:65436,221:65437,222:65438,223:65439,57408:28478,57409:28435,57410:28407,57411:28550,57412:28538,57413:28536,57414:28545,57415:28544,57416:28527,57417:28507,57418:28659,57419:28525,57420:28546,57421:28540,57422:28504,57423:28558,57424:28561,57425:28610,57426:28518,57427:28595,57428:28579,57429:28577,57430:28580,57431:28601,57432:28614,57433:28586,57434:28639,57435:28629,57436:28652,57437:28628,57438:28632,57439:28657,57440:28654,57441:28635,57442:28681,57443:28683,57444:28666,57445:28689,57446:28673,57447:28687,57448:28670,57449:28699,57450:28698,57451:28532,57452:28701,57453:28696,57454:28703,57455:28720,57456:28734,57457:28722,57458:28753,57459:28771,57460:28825,57461:28818,57462:28847,57463:28913,57464:28844,57465:28856,57466:28851,57467:28846,57468:28895,57469:28875,57470:28893,57472:28889,57473:28937,57474:28925,57475:28956,57476:28953,57477:29029,57478:29013,57479:29064,57480:29030,57481:29026,57482:29004,57483:29014,57484:29036,57485:29071,57486:29179,57487:29060,57488:29077,57489:29096,57490:29100,57491:29143,57492:29113,57493:29118,57494:29138,57495:29129,57496:29140,57497:29134,57498:29152,57499:29164,57500:29159,57501:29173,57502:29180,57503:29177,57504:29183,57505:29197,57506:29200,57507:29211,57508:29224,57509:29229,57510:29228,57511:29232,57512:29234,57513:29243,57514:29244,57515:29247,57516:29248,57517:29254,57518:29259,57519:29272,57520:29300,57521:29310,57522:29314,57523:29313,57524:29319,57525:29330,57526:29334,57527:29346,57528:29351,57529:29369,57530:29362,57531:29379,57532:29382,57533:29380,57534:29390,57535:29394,57536:29410,57537:29408,57538:29409,57539:29433,57540:29431,57541:20495,57542:29463,57543:29450,57544:29468,57545:29462,57546:29469,57547:29492,57548:29487,57549:29481,57550:29477,57551:29502,57552:29518,57553:29519,57554:40664,57555:29527,57556:29546,57557:29544,57558:29552,57559:29560,57560:29557,57561:29563,57562:29562,57563:29640,57564:29619,57565:29646,57566:29627,57567:29632,57568:29669,57569:29678,57570:29662,57571:29858,57572:29701,57573:29807,57574:29733,57575:29688,57576:29746,57577:29754,57578:29781,57579:29759,57580:29791,57581:29785,57582:29761,57583:29788,57584:29801,57585:29808,57586:29795,57587:29802,57588:29814,57589:29822,57590:29835,57591:29854,57592:29863,57593:29898,57594:29903,57595:29908,57596:29681,57664:29920,57665:29923,57666:29927,57667:29929,57668:29934,57669:29938,57670:29936,57671:29937,57672:29944,57673:29943,57674:29956,57675:29955,57676:29957,57677:29964,57678:29966,57679:29965,57680:29973,57681:29971,57682:29982,57683:29990,57684:29996,57685:30012,57686:30020,57687:30029,57688:30026,57689:30025,57690:30043,57691:30022,57692:30042,57693:30057,57694:30052,57695:30055,57696:30059,57697:30061,57698:30072,57699:30070,57700:30086,57701:30087,57702:30068,57703:30090,57704:30089,57705:30082,57706:30100,57707:30106,57708:30109,57709:30117,57710:30115,57711:30146,57712:30131,57713:30147,57714:30133,57715:30141,57716:30136,57717:30140,57718:30129,57719:30157,57720:30154,57721:30162,57722:30169,57723:30179,57724:30174,57725:30206,57726:30207,57728:30204,57729:30209,57730:30192,57731:30202,57732:30194,57733:30195,57734:30219,57735:30221,57736:30217,57737:30239,57738:30247,57739:30240,57740:30241,57741:30242,57742:30244,57743:30260,57744:30256,57745:30267,57746:30279,57747:30280,57748:30278,57749:30300,57750:30296,57751:30305,57752:30306,57753:30312,57754:30313,57755:30314,57756:30311,57757:30316,57758:30320,57759:30322,57760:30326,57761:30328,57762:30332,57763:30336,57764:30339,57765:30344,57766:30347,57767:30350,57768:30358,57769:30355,57770:30361,57771:30362,57772:30384,57773:30388,57774:30392,57775:30393,57776:30394,57777:30402,57778:30413,57779:30422,57780:30418,57781:30430,57782:30433,57783:30437,57784:30439,57785:30442,57786:34351,57787:30459,57788:30472,57789:30471,57790:30468,57791:30505,57792:30500,57793:30494,57794:30501,57795:30502,57796:30491,57797:30519,57798:30520,57799:30535,57800:30554,57801:30568,57802:30571,57803:30555,57804:30565,57805:30591,57806:30590,57807:30585,57808:30606,57809:30603,57810:30609,57811:30624,57812:30622,57813:30640,57814:30646,57815:30649,57816:30655,57817:30652,57818:30653,57819:30651,57820:30663,57821:30669,57822:30679,57823:30682,57824:30684,57825:30691,57826:30702,57827:30716,57828:30732,57829:30738,57830:31014,57831:30752,57832:31018,57833:30789,57834:30862,57835:30836,57836:30854,57837:30844,57838:30874,57839:30860,57840:30883,57841:30901,57842:30890,57843:30895,57844:30929,57845:30918,57846:30923,57847:30932,57848:30910,57849:30908,57850:30917,57851:30922,57852:30956,57920:30951,57921:30938,57922:30973,57923:30964,57924:30983,57925:30994,57926:30993,57927:31001,57928:31020,57929:31019,57930:31040,57931:31072,57932:31063,57933:31071,57934:31066,57935:31061,57936:31059,57937:31098,57938:31103,57939:31114,57940:31133,57941:31143,57942:40779,57943:31146,57944:31150,57945:31155,57946:31161,57947:31162,57948:31177,57949:31189,57950:31207,57951:31212,57952:31201,57953:31203,57954:31240,57955:31245,57956:31256,57957:31257,57958:31264,57959:31263,57960:31104,57961:31281,57962:31291,57963:31294,57964:31287,57965:31299,57966:31319,57967:31305,57968:31329,57969:31330,57970:31337,57971:40861,57972:31344,57973:31353,57974:31357,57975:31368,57976:31383,57977:31381,57978:31384,57979:31382,57980:31401,57981:31432,57982:31408,57984:31414,57985:31429,57986:31428,57987:31423,57988:36995,57989:31431,57990:31434,57991:31437,57992:31439,57993:31445,57994:31443,57995:31449,57996:31450,57997:31453,57998:31457,57999:31458,58e3:31462,58001:31469,58002:31472,58003:31490,58004:31503,58005:31498,58006:31494,58007:31539,58008:31512,58009:31513,58010:31518,58011:31541,58012:31528,58013:31542,58014:31568,58015:31610,58016:31492,58017:31565,58018:31499,58019:31564,58020:31557,58021:31605,58022:31589,58023:31604,58024:31591,58025:31600,58026:31601,58027:31596,58028:31598,58029:31645,58030:31640,58031:31647,58032:31629,58033:31644,58034:31642,58035:31627,58036:31634,58037:31631,58038:31581,58039:31641,58040:31691,58041:31681,58042:31692,58043:31695,58044:31668,58045:31686,58046:31709,58047:31721,58048:31761,58049:31764,58050:31718,58051:31717,58052:31840,58053:31744,58054:31751,58055:31763,58056:31731,58057:31735,58058:31767,58059:31757,58060:31734,58061:31779,58062:31783,58063:31786,58064:31775,58065:31799,58066:31787,58067:31805,58068:31820,58069:31811,58070:31828,58071:31823,58072:31808,58073:31824,58074:31832,58075:31839,58076:31844,58077:31830,58078:31845,58079:31852,58080:31861,58081:31875,58082:31888,58083:31908,58084:31917,58085:31906,58086:31915,58087:31905,58088:31912,58089:31923,58090:31922,58091:31921,58092:31918,58093:31929,58094:31933,58095:31936,58096:31941,58097:31938,58098:31960,58099:31954,58100:31964,58101:31970,58102:39739,58103:31983,58104:31986,58105:31988,58106:31990,58107:31994,58108:32006,58176:32002,58177:32028,58178:32021,58179:32010,58180:32069,58181:32075,58182:32046,58183:32050,58184:32063,58185:32053,58186:32070,58187:32115,58188:32086,58189:32078,58190:32114,58191:32104,58192:32110,58193:32079,58194:32099,58195:32147,58196:32137,58197:32091,58198:32143,58199:32125,58200:32155,58201:32186,58202:32174,58203:32163,58204:32181,58205:32199,58206:32189,58207:32171,58208:32317,58209:32162,58210:32175,58211:32220,58212:32184,58213:32159,58214:32176,58215:32216,58216:32221,58217:32228,58218:32222,58219:32251,58220:32242,58221:32225,58222:32261,58223:32266,58224:32291,58225:32289,58226:32274,58227:32305,58228:32287,58229:32265,58230:32267,58231:32290,58232:32326,58233:32358,58234:32315,58235:32309,58236:32313,58237:32323,58238:32311,58240:32306,58241:32314,58242:32359,58243:32349,58244:32342,58245:32350,58246:32345,58247:32346,58248:32377,58249:32362,58250:32361,58251:32380,58252:32379,58253:32387,58254:32213,58255:32381,58256:36782,58257:32383,58258:32392,58259:32393,58260:32396,58261:32402,58262:32400,58263:32403,58264:32404,58265:32406,58266:32398,58267:32411,58268:32412,58269:32568,58270:32570,58271:32581,58272:32588,58273:32589,58274:32590,58275:32592,58276:32593,58277:32597,58278:32596,58279:32600,58280:32607,58281:32608,58282:32616,58283:32617,58284:32615,58285:32632,58286:32642,58287:32646,58288:32643,58289:32648,58290:32647,58291:32652,58292:32660,58293:32670,58294:32669,58295:32666,58296:32675,58297:32687,58298:32690,58299:32697,58300:32686,58301:32694,58302:32696,58303:35697,58304:32709,58305:32710,58306:32714,58307:32725,58308:32724,58309:32737,58310:32742,58311:32745,58312:32755,58313:32761,58314:39132,58315:32774,58316:32772,58317:32779,58318:32786,58319:32792,58320:32793,58321:32796,58322:32801,58323:32808,58324:32831,58325:32827,58326:32842,58327:32838,58328:32850,58329:32856,58330:32858,58331:32863,58332:32866,58333:32872,58334:32883,58335:32882,58336:32880,58337:32886,58338:32889,58339:32893,58340:32895,58341:32900,58342:32902,58343:32901,58344:32923,58345:32915,58346:32922,58347:32941,58348:20880,58349:32940,58350:32987,58351:32997,58352:32985,58353:32989,58354:32964,58355:32986,58356:32982,58357:33033,58358:33007,58359:33009,58360:33051,58361:33065,58362:33059,58363:33071,58364:33099,58432:38539,58433:33094,58434:33086,58435:33107,58436:33105,58437:33020,58438:33137,58439:33134,58440:33125,58441:33126,58442:33140,58443:33155,58444:33160,58445:33162,58446:33152,58447:33154,58448:33184,58449:33173,58450:33188,58451:33187,58452:33119,58453:33171,58454:33193,58455:33200,58456:33205,58457:33214,58458:33208,58459:33213,58460:33216,58461:33218,58462:33210,58463:33225,58464:33229,58465:33233,58466:33241,58467:33240,58468:33224,58469:33242,58470:33247,58471:33248,58472:33255,58473:33274,58474:33275,58475:33278,58476:33281,58477:33282,58478:33285,58479:33287,58480:33290,58481:33293,58482:33296,58483:33302,58484:33321,58485:33323,58486:33336,58487:33331,58488:33344,58489:33369,58490:33368,58491:33373,58492:33370,58493:33375,58494:33380,58496:33378,58497:33384,58498:33386,58499:33387,58500:33326,58501:33393,58502:33399,58503:33400,58504:33406,58505:33421,58506:33426,58507:33451,58508:33439,58509:33467,58510:33452,58511:33505,58512:33507,58513:33503,58514:33490,58515:33524,58516:33523,58517:33530,58518:33683,58519:33539,58520:33531,58521:33529,58522:33502,58523:33542,58524:33500,58525:33545,58526:33497,58527:33589,58528:33588,58529:33558,58530:33586,58531:33585,58532:33600,58533:33593,58534:33616,58535:33605,58536:33583,58537:33579,58538:33559,58539:33560,58540:33669,58541:33690,58542:33706,58543:33695,58544:33698,58545:33686,58546:33571,58547:33678,58548:33671,58549:33674,58550:33660,58551:33717,58552:33651,58553:33653,58554:33696,58555:33673,58556:33704,58557:33780,58558:33811,58559:33771,58560:33742,58561:33789,58562:33795,58563:33752,58564:33803,58565:33729,58566:33783,58567:33799,58568:33760,58569:33778,58570:33805,58571:33826,58572:33824,58573:33725,58574:33848,58575:34054,58576:33787,58577:33901,58578:33834,58579:33852,58580:34138,58581:33924,58582:33911,58583:33899,58584:33965,58585:33902,58586:33922,58587:33897,58588:33862,58589:33836,58590:33903,58591:33913,58592:33845,58593:33994,58594:33890,58595:33977,58596:33983,58597:33951,58598:34009,58599:33997,58600:33979,58601:34010,58602:34e3,58603:33985,58604:33990,58605:34006,58606:33953,58607:34081,58608:34047,58609:34036,58610:34071,58611:34072,58612:34092,58613:34079,58614:34069,58615:34068,58616:34044,58617:34112,58618:34147,58619:34136,58620:34120,58688:34113,58689:34306,58690:34123,58691:34133,58692:34176,58693:34212,58694:34184,58695:34193,58696:34186,58697:34216,58698:34157,58699:34196,58700:34203,58701:34282,58702:34183,58703:34204,58704:34167,58705:34174,58706:34192,58707:34249,58708:34234,58709:34255,58710:34233,58711:34256,58712:34261,58713:34269,58714:34277,58715:34268,58716:34297,58717:34314,58718:34323,58719:34315,58720:34302,58721:34298,58722:34310,58723:34338,58724:34330,58725:34352,58726:34367,58727:34381,58728:20053,58729:34388,58730:34399,58731:34407,58732:34417,58733:34451,58734:34467,58735:34473,58736:34474,58737:34443,58738:34444,58739:34486,58740:34479,58741:34500,58742:34502,58743:34480,58744:34505,58745:34851,58746:34475,58747:34516,58748:34526,58749:34537,58750:34540,58752:34527,58753:34523,58754:34543,58755:34578,58756:34566,58757:34568,58758:34560,58759:34563,58760:34555,58761:34577,58762:34569,58763:34573,58764:34553,58765:34570,58766:34612,58767:34623,58768:34615,58769:34619,58770:34597,58771:34601,58772:34586,58773:34656,58774:34655,58775:34680,58776:34636,58777:34638,58778:34676,58779:34647,58780:34664,58781:34670,58782:34649,58783:34643,58784:34659,58785:34666,58786:34821,58787:34722,58788:34719,58789:34690,58790:34735,58791:34763,58792:34749,58793:34752,58794:34768,58795:38614,58796:34731,58797:34756,58798:34739,58799:34759,58800:34758,58801:34747,58802:34799,58803:34802,58804:34784,58805:34831,58806:34829,58807:34814,58808:34806,58809:34807,58810:34830,58811:34770,58812:34833,58813:34838,58814:34837,58815:34850,58816:34849,58817:34865,58818:34870,58819:34873,58820:34855,58821:34875,58822:34884,58823:34882,58824:34898,58825:34905,58826:34910,58827:34914,58828:34923,58829:34945,58830:34942,58831:34974,58832:34933,58833:34941,58834:34997,58835:34930,58836:34946,58837:34967,58838:34962,58839:34990,58840:34969,58841:34978,58842:34957,58843:34980,58844:34992,58845:35007,58846:34993,58847:35011,58848:35012,58849:35028,58850:35032,58851:35033,58852:35037,58853:35065,58854:35074,58855:35068,58856:35060,58857:35048,58858:35058,58859:35076,58860:35084,58861:35082,58862:35091,58863:35139,58864:35102,58865:35109,58866:35114,58867:35115,58868:35137,58869:35140,58870:35131,58871:35126,58872:35128,58873:35148,58874:35101,58875:35168,58876:35166,58944:35174,58945:35172,58946:35181,58947:35178,58948:35183,58949:35188,58950:35191,58951:35198,58952:35203,58953:35208,58954:35210,58955:35219,58956:35224,58957:35233,58958:35241,58959:35238,58960:35244,58961:35247,58962:35250,58963:35258,58964:35261,58965:35263,58966:35264,58967:35290,58968:35292,58969:35293,58970:35303,58971:35316,58972:35320,58973:35331,58974:35350,58975:35344,58976:35340,58977:35355,58978:35357,58979:35365,58980:35382,58981:35393,58982:35419,58983:35410,58984:35398,58985:35400,58986:35452,58987:35437,58988:35436,58989:35426,58990:35461,58991:35458,58992:35460,58993:35496,58994:35489,58995:35473,58996:35493,58997:35494,58998:35482,58999:35491,59e3:35524,59001:35533,59002:35522,59003:35546,59004:35563,59005:35571,59006:35559,59008:35556,59009:35569,59010:35604,59011:35552,59012:35554,59013:35575,59014:35550,59015:35547,59016:35596,59017:35591,59018:35610,59019:35553,59020:35606,59021:35600,59022:35607,59023:35616,59024:35635,59025:38827,59026:35622,59027:35627,59028:35646,59029:35624,59030:35649,59031:35660,59032:35663,59033:35662,59034:35657,59035:35670,59036:35675,59037:35674,59038:35691,59039:35679,59040:35692,59041:35695,59042:35700,59043:35709,59044:35712,59045:35724,59046:35726,59047:35730,59048:35731,59049:35734,59050:35737,59051:35738,59052:35898,59053:35905,59054:35903,59055:35912,59056:35916,59057:35918,59058:35920,59059:35925,59060:35938,59061:35948,59062:35960,59063:35962,59064:35970,59065:35977,59066:35973,59067:35978,59068:35981,59069:35982,59070:35988,59071:35964,59072:35992,59073:25117,59074:36013,59075:36010,59076:36029,59077:36018,59078:36019,59079:36014,59080:36022,59081:36040,59082:36033,59083:36068,59084:36067,59085:36058,59086:36093,59087:36090,59088:36091,59089:36100,59090:36101,59091:36106,59092:36103,59093:36111,59094:36109,59095:36112,59096:40782,59097:36115,59098:36045,59099:36116,59100:36118,59101:36199,59102:36205,59103:36209,59104:36211,59105:36225,59106:36249,59107:36290,59108:36286,59109:36282,59110:36303,59111:36314,59112:36310,59113:36300,59114:36315,59115:36299,59116:36330,59117:36331,59118:36319,59119:36323,59120:36348,59121:36360,59122:36361,59123:36351,59124:36381,59125:36382,59126:36368,59127:36383,59128:36418,59129:36405,59130:36400,59131:36404,59132:36426,59200:36423,59201:36425,59202:36428,59203:36432,59204:36424,59205:36441,59206:36452,59207:36448,59208:36394,59209:36451,59210:36437,59211:36470,59212:36466,59213:36476,59214:36481,59215:36487,59216:36485,59217:36484,59218:36491,59219:36490,59220:36499,59221:36497,59222:36500,59223:36505,59224:36522,59225:36513,59226:36524,59227:36528,59228:36550,59229:36529,59230:36542,59231:36549,59232:36552,59233:36555,59234:36571,59235:36579,59236:36604,59237:36603,59238:36587,59239:36606,59240:36618,59241:36613,59242:36629,59243:36626,59244:36633,59245:36627,59246:36636,59247:36639,59248:36635,59249:36620,59250:36646,59251:36659,59252:36667,59253:36665,59254:36677,59255:36674,59256:36670,59257:36684,59258:36681,59259:36678,59260:36686,59261:36695,59262:36700,59264:36706,59265:36707,59266:36708,59267:36764,59268:36767,59269:36771,59270:36781,59271:36783,59272:36791,59273:36826,59274:36837,59275:36834,59276:36842,59277:36847,59278:36999,59279:36852,59280:36869,59281:36857,59282:36858,59283:36881,59284:36885,59285:36897,59286:36877,59287:36894,59288:36886,59289:36875,59290:36903,59291:36918,59292:36917,59293:36921,59294:36856,59295:36943,59296:36944,59297:36945,59298:36946,59299:36878,59300:36937,59301:36926,59302:36950,59303:36952,59304:36958,59305:36968,59306:36975,59307:36982,59308:38568,59309:36978,59310:36994,59311:36989,59312:36993,59313:36992,59314:37002,59315:37001,59316:37007,59317:37032,59318:37039,59319:37041,59320:37045,59321:37090,59322:37092,59323:25160,59324:37083,59325:37122,59326:37138,59327:37145,59328:37170,59329:37168,59330:37194,59331:37206,59332:37208,59333:37219,59334:37221,59335:37225,59336:37235,59337:37234,59338:37259,59339:37257,59340:37250,59341:37282,59342:37291,59343:37295,59344:37290,59345:37301,59346:37300,59347:37306,59348:37312,59349:37313,59350:37321,59351:37323,59352:37328,59353:37334,59354:37343,59355:37345,59356:37339,59357:37372,59358:37365,59359:37366,59360:37406,59361:37375,59362:37396,59363:37420,59364:37397,59365:37393,59366:37470,59367:37463,59368:37445,59369:37449,59370:37476,59371:37448,59372:37525,59373:37439,59374:37451,59375:37456,59376:37532,59377:37526,59378:37523,59379:37531,59380:37466,59381:37583,59382:37561,59383:37559,59384:37609,59385:37647,59386:37626,59387:37700,59388:37678,59456:37657,59457:37666,59458:37658,59459:37667,59460:37690,59461:37685,59462:37691,59463:37724,59464:37728,59465:37756,59466:37742,59467:37718,59468:37808,59469:37804,59470:37805,59471:37780,59472:37817,59473:37846,59474:37847,59475:37864,59476:37861,59477:37848,59478:37827,59479:37853,59480:37840,59481:37832,59482:37860,59483:37914,59484:37908,59485:37907,59486:37891,59487:37895,59488:37904,59489:37942,59490:37931,59491:37941,59492:37921,59493:37946,59494:37953,59495:37970,59496:37956,59497:37979,59498:37984,59499:37986,59500:37982,59501:37994,59502:37417,59503:38e3,59504:38005,59505:38007,59506:38013,59507:37978,59508:38012,59509:38014,59510:38017,59511:38015,59512:38274,59513:38279,59514:38282,59515:38292,59516:38294,59517:38296,59518:38297,59520:38304,59521:38312,59522:38311,59523:38317,59524:38332,59525:38331,59526:38329,59527:38334,59528:38346,59529:28662,59530:38339,59531:38349,59532:38348,59533:38357,59534:38356,59535:38358,59536:38364,59537:38369,59538:38373,59539:38370,59540:38433,59541:38440,59542:38446,59543:38447,59544:38466,59545:38476,59546:38479,59547:38475,59548:38519,59549:38492,59550:38494,59551:38493,59552:38495,59553:38502,59554:38514,59555:38508,59556:38541,59557:38552,59558:38549,59559:38551,59560:38570,59561:38567,59562:38577,59563:38578,59564:38576,59565:38580,59566:38582,59567:38584,59568:38585,59569:38606,59570:38603,59571:38601,59572:38605,59573:35149,59574:38620,59575:38669,59576:38613,59577:38649,59578:38660,59579:38662,59580:38664,59581:38675,59582:38670,59583:38673,59584:38671,59585:38678,59586:38681,59587:38692,59588:38698,59589:38704,59590:38713,59591:38717,59592:38718,59593:38724,59594:38726,59595:38728,59596:38722,59597:38729,59598:38748,59599:38752,59600:38756,59601:38758,59602:38760,59603:21202,59604:38763,59605:38769,59606:38777,59607:38789,59608:38780,59609:38785,59610:38778,59611:38790,59612:38795,59613:38799,59614:38800,59615:38812,59616:38824,59617:38822,59618:38819,59619:38835,59620:38836,59621:38851,59622:38854,59623:38856,59624:38859,59625:38876,59626:38893,59627:40783,59628:38898,59629:31455,59630:38902,59631:38901,59632:38927,59633:38924,59634:38968,59635:38948,59636:38945,59637:38967,59638:38973,59639:38982,59640:38991,59641:38987,59642:39019,59643:39023,59644:39024,59712:39025,59713:39028,59714:39027,59715:39082,59716:39087,59717:39089,59718:39094,59719:39108,59720:39107,59721:39110,59722:39145,59723:39147,59724:39171,59725:39177,59726:39186,59727:39188,59728:39192,59729:39201,59730:39197,59731:39198,59732:39204,59733:39200,59734:39212,59735:39214,59736:39229,59737:39230,59738:39234,59739:39241,59740:39237,59741:39248,59742:39243,59743:39249,59744:39250,59745:39244,59746:39253,59747:39319,59748:39320,59749:39333,59750:39341,59751:39342,59752:39356,59753:39391,59754:39387,59755:39389,59756:39384,59757:39377,59758:39405,59759:39406,59760:39409,59761:39410,59762:39419,59763:39416,59764:39425,59765:39439,59766:39429,59767:39394,59768:39449,59769:39467,59770:39479,59771:39493,59772:39490,59773:39488,59774:39491,59776:39486,59777:39509,59778:39501,59779:39515,59780:39511,59781:39519,59782:39522,59783:39525,59784:39524,59785:39529,59786:39531,59787:39530,59788:39597,59789:39600,59790:39612,59791:39616,59792:39631,59793:39633,59794:39635,59795:39636,59796:39646,59797:39647,59798:39650,59799:39651,59800:39654,59801:39663,59802:39659,59803:39662,59804:39668,59805:39665,59806:39671,59807:39675,59808:39686,59809:39704,59810:39706,59811:39711,59812:39714,59813:39715,59814:39717,59815:39719,59816:39720,59817:39721,59818:39722,59819:39726,59820:39727,59821:39730,59822:39748,59823:39747,59824:39759,59825:39757,59826:39758,59827:39761,59828:39768,59829:39796,59830:39827,59831:39811,59832:39825,59833:39830,59834:39831,59835:39839,59836:39840,59837:39848,59838:39860,59839:39872,59840:39882,59841:39865,59842:39878,59843:39887,59844:39889,59845:39890,59846:39907,59847:39906,59848:39908,59849:39892,59850:39905,59851:39994,59852:39922,59853:39921,59854:39920,59855:39957,59856:39956,59857:39945,59858:39955,59859:39948,59860:39942,59861:39944,59862:39954,59863:39946,59864:39940,59865:39982,59866:39963,59867:39973,59868:39972,59869:39969,59870:39984,59871:40007,59872:39986,59873:40006,59874:39998,59875:40026,59876:40032,59877:40039,59878:40054,59879:40056,59880:40167,59881:40172,59882:40176,59883:40201,59884:40200,59885:40171,59886:40195,59887:40198,59888:40234,59889:40230,59890:40367,59891:40227,59892:40223,59893:40260,59894:40213,59895:40210,59896:40257,59897:40255,59898:40254,59899:40262,59900:40264,59968:40285,59969:40286,59970:40292,59971:40273,59972:40272,59973:40281,59974:40306,59975:40329,59976:40327,59977:40363,59978:40303,59979:40314,59980:40346,59981:40356,59982:40361,59983:40370,59984:40388,59985:40385,59986:40379,59987:40376,59988:40378,59989:40390,59990:40399,59991:40386,59992:40409,59993:40403,59994:40440,59995:40422,59996:40429,59997:40431,59998:40445,59999:40474,6e4:40475,60001:40478,60002:40565,60003:40569,60004:40573,60005:40577,60006:40584,60007:40587,60008:40588,60009:40594,60010:40597,60011:40593,60012:40605,60013:40613,60014:40617,60015:40632,60016:40618,60017:40621,60018:38753,60019:40652,60020:40654,60021:40655,60022:40656,60023:40660,60024:40668,60025:40670,60026:40669,60027:40672,60028:40677,60029:40680,60030:40687,60032:40692,60033:40694,60034:40695,60035:40697,60036:40699,60037:40700,60038:40701,60039:40711,60040:40712,60041:30391,60042:40725,60043:40737,60044:40748,60045:40766,60046:40778,60047:40786,60048:40788,60049:40803,60050:40799,60051:40800,60052:40801,60053:40806,60054:40807,60055:40812,60056:40810,60057:40823,60058:40818,60059:40822,60060:40853,60061:40860,60062:40864,60063:22575,60064:27079,60065:36953,60066:29796,60067:20956,60068:29081}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(2);t.decode=function(e,t){var r=new Uint8ClampedArray(e.length);r.set(e);for(var a=new n.default(285,256,0),i=new o.default(a,r),s=new Uint8ClampedArray(t),c=!1,l=0;l<t;l++){var u=i.evaluateAt(a.exp(l+a.generatorBase));s[s.length-1-l]=u,0!==u&&(c=!0)}if(!c)return r;var d=new o.default(a,s),f=function(e,t,r,n){var o;t.degree()<r.degree()&&(t=(o=[r,t])[0],r=o[1]);for(var a=t,i=r,s=e.zero,c=e.one;i.degree()>=n/2;){var l=a,u=s;if(s=c,(a=i).isZero())return null;i=l;for(var d=e.zero,f=a.getCoefficient(a.degree()),p=e.inverse(f);i.degree()>=a.degree()&&!i.isZero();){var h=i.degree()-a.degree(),m=e.multiply(i.getCoefficient(i.degree()),p);d=d.addOrSubtract(e.buildMonomial(h,m)),i=i.addOrSubtract(a.multiplyByMonomial(h,m))}if(c=d.multiplyPoly(s).addOrSubtract(u),i.degree()>=a.degree())return null}var g=c.getCoefficient(0);if(0===g)return null;var v=e.inverse(g);return[c.multiply(v),i.multiply(v)]}(a,a.buildMonomial(t,1),d,t);if(null===f)return null;var p=function(e,t){var r=t.degree();if(1===r)return[t.getCoefficient(1)];for(var n=new Array(r),o=0,a=1;a<e.size&&o<r;a++)0===t.evaluateAt(a)&&(n[o]=e.inverse(a),o++);return o!==r?null:n}(a,f[0]);if(null==p)return null;for(var h=function(e,t,r){for(var o=r.length,a=new Array(o),i=0;i<o;i++){for(var s=e.inverse(r[i]),c=1,l=0;l<o;l++)i!==l&&(c=e.multiply(c,n.addOrSubtractGF(1,e.multiply(r[l],s))));a[i]=e.multiply(t.evaluateAt(s),e.inverse(c)),0!==e.generatorBase&&(a[i]=e.multiply(a[i],s))}return a}(a,f[1],p),m=0;m<p.length;m++){var g=r.length-1-a.log(p[m]);if(g<0)return null;r[g]=n.addOrSubtractGF(r[g],h[m])}return r}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.VERSIONS=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,dataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,dataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}]},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);function o(e,t,r,n){var o=e.x-t.x+r.x-n.x,a=e.y-t.y+r.y-n.y;if(0===o&&0===a)return{a11:t.x-e.x,a12:t.y-e.y,a13:0,a21:r.x-t.x,a22:r.y-t.y,a23:0,a31:e.x,a32:e.y,a33:1};var i=t.x-r.x,s=n.x-r.x,c=t.y-r.y,l=n.y-r.y,u=i*l-s*c,d=(o*l-s*a)/u,f=(i*a-o*c)/u;return{a11:t.x-e.x+d*t.x,a12:t.y-e.y+d*t.y,a13:d,a21:n.x-e.x+f*n.x,a22:n.y-e.y+f*n.y,a23:f,a31:e.x,a32:e.y,a33:1}}t.extract=function(e,t){for(var r=function(e,t,r,n){var a=o(e,t,r,n);return{a11:a.a22*a.a33-a.a23*a.a32,a12:a.a13*a.a32-a.a12*a.a33,a13:a.a12*a.a23-a.a13*a.a22,a21:a.a23*a.a31-a.a21*a.a33,a22:a.a11*a.a33-a.a13*a.a31,a23:a.a13*a.a21-a.a11*a.a23,a31:a.a21*a.a32-a.a22*a.a31,a32:a.a12*a.a31-a.a11*a.a32,a33:a.a11*a.a22-a.a12*a.a21}}({x:3.5,y:3.5},{x:t.dimension-3.5,y:3.5},{x:t.dimension-6.5,y:t.dimension-6.5},{x:3.5,y:t.dimension-3.5}),a=function(e,t){return{a11:e.a11*t.a11+e.a21*t.a12+e.a31*t.a13,a12:e.a12*t.a11+e.a22*t.a12+e.a32*t.a13,a13:e.a13*t.a11+e.a23*t.a12+e.a33*t.a13,a21:e.a11*t.a21+e.a21*t.a22+e.a31*t.a23,a22:e.a12*t.a21+e.a22*t.a22+e.a32*t.a23,a23:e.a13*t.a21+e.a23*t.a22+e.a33*t.a23,a31:e.a11*t.a31+e.a21*t.a32+e.a31*t.a33,a32:e.a12*t.a31+e.a22*t.a32+e.a32*t.a33,a33:e.a13*t.a31+e.a23*t.a32+e.a33*t.a33}}(o(t.topLeft,t.topRight,t.alignmentPattern,t.bottomLeft),r),i=n.BitMatrix.createEmpty(t.dimension,t.dimension),s=function(e,t){var r=a.a13*e+a.a23*t+a.a33;return{x:(a.a11*e+a.a21*t+a.a31)/r,y:(a.a12*e+a.a22*t+a.a32)/r}},c=0;c<t.dimension;c++)for(var l=0;l<t.dimension;l++){var u=s(l+.5,c+.5);i.set(l,c,e.get(Math.floor(u.x),Math.floor(u.y)))}return{matrix:i,mappingFunction:s}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))};function o(e){return e.reduce((function(e,t){return e+t}))}function a(e,t,r,o){var a,i,s,c,l=[{x:Math.floor(e.x),y:Math.floor(e.y)}],u=Math.abs(t.y-e.y)>Math.abs(t.x-e.x);u?(a=Math.floor(e.y),i=Math.floor(e.x),s=Math.floor(t.y),c=Math.floor(t.x)):(a=Math.floor(e.x),i=Math.floor(e.y),s=Math.floor(t.x),c=Math.floor(t.y));for(var d=Math.abs(s-a),f=Math.abs(c-i),p=Math.floor(-d/2),h=a<s?1:-1,m=i<c?1:-1,g=!0,v=a,y=i;v!==s+h;v+=h){var b=u?y:v,C=u?v:y;if(r.get(b,C)!==g&&(g=!g,l.push({x:b,y:C}),l.length===o+1))break;if((p+=f)>0){if(y===c)break;y+=m,p-=d}}for(var w=[],k=0;k<o;k++)l[k]&&l[k+1]?w.push(n(l[k],l[k+1])):w.push(0);return w}function i(e,t,r,n){var o,i=t.y-e.y,s=t.x-e.x,c=a(e,t,r,Math.ceil(n/2)),l=a(e,{x:e.x-s,y:e.y-i},r,Math.ceil(n/2)),u=c.shift()+l.shift()-1;return(o=l.concat(u)).concat.apply(o,c)}function s(e,t){var r=o(e)/o(t),n=0;return t.forEach((function(t,o){n+=Math.pow(e[o]-t*r,2)})),{averageSize:r,error:n}}function c(e,t,r){try{var n=i(e,{x:-1,y:e.y},r,t.length),o=i(e,{x:e.x,y:-1},r,t.length),a=i(e,{x:Math.max(0,e.x-e.y)-1,y:Math.max(0,e.y-e.x)-1},r,t.length),c=i(e,{x:Math.min(r.width,e.x+e.y)+1,y:Math.min(r.height,e.y+e.x)+1},r,t.length),l=s(n,t),u=s(o,t),d=s(a,t),f=s(c,t),p=Math.sqrt(l.error*l.error+u.error*u.error+d.error*d.error+f.error*f.error),h=(l.averageSize+u.averageSize+d.averageSize+f.averageSize)/4;return p+(Math.pow(l.averageSize-h,2)+Math.pow(u.averageSize-h,2)+Math.pow(d.averageSize-h,2)+Math.pow(f.averageSize-h,2))/h}catch(e){return 1/0}}function l(e,t){for(var r=Math.round(t.x);e.get(r,Math.round(t.y));)r--;for(var n=Math.round(t.x);e.get(n,Math.round(t.y));)n++;for(var o=(r+n)/2,a=Math.round(t.y);e.get(Math.round(o),a);)a--;for(var i=Math.round(t.y);e.get(Math.round(o),i);)i++;return{x:o,y:(a+i)/2}}function u(e,t,r,a,s){var l,u,d;try{l=function(e,t,r,a){var s=(o(i(e,r,a,5))/7+o(i(e,t,a,5))/7+o(i(r,e,a,5))/7+o(i(t,e,a,5))/7)/4;if(s<1)throw new Error("Invalid module size");var c=Math.round(n(e,t)/s),l=Math.round(n(e,r)/s),u=Math.floor((c+l)/2)+7;switch(u%4){case 0:u++;break;case 2:u--}return{dimension:u,moduleSize:s}}(a,r,s,e),u=l.dimension,d=l.moduleSize}catch(e){return null}var f=r.x-a.x+s.x,p=r.y-a.y+s.y,h=(n(a,s)+n(a,r))/2/d,m=1-3/h,g={x:a.x+m*(f-a.x),y:a.y+m*(p-a.y)},v=t.map((function(t){var r=(t.top.startX+t.top.endX+t.bottom.startX+t.bottom.endX)/4,a=(t.top.y+t.bottom.y+1)/2;if(e.get(Math.floor(r),Math.floor(a))){var i=[t.top.endX-t.top.startX,t.bottom.endX-t.bottom.startX,t.bottom.y-t.top.y+1];return o(i),{x:r,y:a,score:c({x:Math.floor(r),y:Math.floor(a)},[1,1,1],e)+n({x:r,y:a},g)}}})).filter((function(e){return!!e})).sort((function(e,t){return e.score-t.score}));return{alignmentPattern:h>=15&&v.length?v[0]:g,dimension:u}}t.locate=function(e){for(var t=[],r=[],a=[],i=[],s=function(n){for(var s=0,c=!1,l=[0,0,0,0,0],u=function(t){var a=e.get(t,n);if(a===c)s++;else{l=[l[1],l[2],l[3],l[4],s],s=1,c=a;var u=o(l)/7,d=Math.abs(l[0]-u)<u&&Math.abs(l[1]-u)<u&&Math.abs(l[2]-3*u)<3*u&&Math.abs(l[3]-u)<u&&Math.abs(l[4]-u)<u&&!a,f=o(l.slice(-3))/3,p=Math.abs(l[2]-f)<f&&Math.abs(l[3]-f)<f&&Math.abs(l[4]-f)<f&&a;if(d){var h=t-l[3]-l[4],m=h-l[2],g={startX:m,endX:h,y:n};(v=r.filter((function(e){return m>=e.bottom.startX&&m<=e.bottom.endX||h>=e.bottom.startX&&m<=e.bottom.endX||m<=e.bottom.startX&&h>=e.bottom.endX&&l[2]/(e.bottom.endX-e.bottom.startX)<1.5&&l[2]/(e.bottom.endX-e.bottom.startX)>.5}))).length>0?v[0].bottom=g:r.push({top:g,bottom:g})}if(p){var v,y=t-l[4],b=y-l[3];g={startX:b,y:n,endX:y},(v=i.filter((function(e){return b>=e.bottom.startX&&b<=e.bottom.endX||y>=e.bottom.startX&&b<=e.bottom.endX||b<=e.bottom.startX&&y>=e.bottom.endX&&l[2]/(e.bottom.endX-e.bottom.startX)<1.5&&l[2]/(e.bottom.endX-e.bottom.startX)>.5}))).length>0?v[0].bottom=g:i.push({top:g,bottom:g})}}},d=-1;d<=e.width;d++)u(d);t.push.apply(t,r.filter((function(e){return e.bottom.y!==n&&e.bottom.y-e.top.y>=2}))),r=r.filter((function(e){return e.bottom.y===n})),a.push.apply(a,i.filter((function(e){return e.bottom.y!==n}))),i=i.filter((function(e){return e.bottom.y===n}))},d=0;d<=e.height;d++)s(d);t.push.apply(t,r.filter((function(e){return e.bottom.y-e.top.y>=2}))),a.push.apply(a,i);var f=t.filter((function(e){return e.bottom.y-e.top.y>=2})).map((function(t){var r=(t.top.startX+t.top.endX+t.bottom.startX+t.bottom.endX)/4,n=(t.top.y+t.bottom.y+1)/2;if(e.get(Math.round(r),Math.round(n))){var a=[t.top.endX-t.top.startX,t.bottom.endX-t.bottom.startX,t.bottom.y-t.top.y+1],i=o(a)/a.length;return{score:c({x:Math.round(r),y:Math.round(n)},[1,1,3,1,1],e),x:r,y:n,size:i}}})).filter((function(e){return!!e})).sort((function(e,t){return e.score-t.score})).map((function(e,t,r){if(t>4)return null;var n=r.filter((function(e,r){return t!==r})).map((function(t){return{x:t.x,y:t.y,score:t.score+Math.pow(t.size-e.size,2)/e.size,size:t.size}})).sort((function(e,t){return e.score-t.score}));if(n.length<2)return null;var o=e.score+n[0].score+n[1].score;return{points:[e].concat(n.slice(0,2)),score:o}})).filter((function(e){return!!e})).sort((function(e,t){return e.score-t.score}));if(0===f.length)return null;var p=function(e,t,r){var o,a,i,s,c,l,u,d=n(e,t),f=n(t,r),p=n(e,r);return f>=d&&f>=p?(c=(o=[t,e,r])[0],l=o[1],u=o[2]):p>=f&&p>=d?(c=(a=[e,t,r])[0],l=a[1],u=a[2]):(c=(i=[e,r,t])[0],l=i[1],u=i[2]),(u.x-l.x)*(c.y-l.y)-(u.y-l.y)*(c.x-l.x)<0&&(c=(s=[u,c])[0],u=s[1]),{bottomLeft:c,topLeft:l,topRight:u}}(f[0].points[0],f[0].points[1],f[0].points[2]),h=p.topRight,m=p.topLeft,g=p.bottomLeft,v=u(e,a,h,m,g),y=[];v&&y.push({alignmentPattern:{x:v.alignmentPattern.x,y:v.alignmentPattern.y},bottomLeft:{x:g.x,y:g.y},dimension:v.dimension,topLeft:{x:m.x,y:m.y},topRight:{x:h.x,y:h.y}});var b=l(e,h),C=l(e,m),w=l(e,g),k=u(e,a,b,C,w);return k&&y.push({alignmentPattern:{x:k.alignmentPattern.x,y:k.alignmentPattern.y},bottomLeft:{x:w.x,y:w.y},topLeft:{x:C.x,y:C.y},topRight:{x:b.x,y:b.y},dimension:k.dimension}),0===y.length?null:y}}]).default},e.exports=r()})));function lg(e){return ug.apply(this,arguments)}function ug(){return(ug=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.imageData,n=t.canvas,(o=r)||(a=n.getContext("2d"),o=a.getImageData(0,0,n.width,n.height)),!(i=cg(o.data,o.width,o.height,{inversionAttempts:"dontInvert"}))){e.next=6;break}return e.abrupt("return",i.data);case 6:return e.abrupt("return","");case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function dg(e){return fg.apply(this,arguments)}function fg(){return(fg=B(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.canvas,n=t.qrScannerResources,e.abrupt("return",new Promise((function(e){setTimeout((function(){return e("")}),1e3),ng.scanImage(r,void 0,void 0,n.canvas).then(e).catch((function(){return e("")}))})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var pg=function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.canvas,n=t.blackAndWhiteConverterResources,o=t.qrScannerResources,a=n.kernel,i=n.canvas,s=n.dst,c=window,l=c.cv,u="",d=l.imread(r),l.cvtColor(d,s,l.COLOR_RGBA2GRAY),l.filter2D(s,s,-1,a),l.imshow(i,s),e.next=10,lg({canvas:i});case 10:if(u=e.sent){e.next=15;break}return e.next=14,dg({canvas:i,qrScannerResources:o});case 14:u=e.sent;case 15:return d.delete(),e.abrupt("return",u);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),hg=function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.canvas,n=t.blob,o=t.qrScannerResources,a=t.blackAndWhiteConverterResources,i=r,!n){e.next=6;break}return e.next=5,Ca.blobToCanvas({blob:n});case 5:i=e.sent;case 6:return s=i.getContext("2d"),e.next=9,lg({imageData:s.getImageData(0,0,i.width,i.height)});case 9:if(c=e.sent){e.next=18;break}return e.next=13,dg({canvas:i,qrScannerResources:o});case 13:if(c=e.sent){e.next=18;break}return e.next=17,pg({canvas:i,blackAndWhiteConverterResources:a,qrScannerResources:o});case 17:c=e.sent;case 18:return e.abrupt("return",c);case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),mg=function(){var e=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c,l,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>0&&void 0!==u[0]?u[0]:{},r=t.blob,n=t.resultWarmup,o=t.enableValidation,a=void 0===o||o,i=n.qrScannerResources,s=n.blackAndWhiteConverterResources,c={},e.next=5,hg({blob:r,qrScannerResources:i,blackAndWhiteConverterResources:s});case 5:return l=e.sent,a&&l&&(c=rg(l)),e.abrupt("return",{result:l,validateResult:c});case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();var gg,vg,yg,bg,Cg,wg,kg=function(e){var t=e.shouldStart,n=e.refVideo,a=e.cropArea,i=e.settings,l=e.onSessionTimeout,u=e.onCaptureDone,d=e.onAboutToTimeout,f=e.outputEncryptionSettings,p=L(s(!1),2),h=p[0],m=p[1],g=r((function(){})),v=r((function(){})),y=Qr.useSDKSettings().lang,b=function(e){var t=e.refVideo,n=e.shouldStart,a=e.cropArea,i=e.settings,l=e.onResult,u=e.outputEncryptionSettings,d=r(null);null===d.current&&(d.current=document.createElement("canvas"));var f=r(!1),p=r(null),h=L(s(!1),2),m=h[0],g=h[1],v=r({}),y=Qr.useSDKSettings().customUrls;c((function(){function e(){return(e=B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(m){e.next=5;break}return e.next=3,sg(y);case 3:v.current=e.sent,g(!0);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[m,y]);var b=o((function(){!0===f.current&&(f.current=!1)}),[]),C=o(B(regeneratorRuntime.mark((function e(){var r,n,o,a,s,c,h,g,y,C,w,k,B,E,S,A;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(m&&i&&!f.current){e.next=2;break}return e.abrupt("return");case 2:r=v.current,n=r.qrScannerResources,o=r.blackAndWhiteConverterResources,a=p.current,s=t.current,f.current=!0,c=a.cropX,h=a.cropY,g=a.cropWidth,y=a.cropHeight,(C=d.current).width=g,C.height=y,w=C.getContext("2d");case 11:return w.drawImage(s,c,h,g,y,0,0,g,y),e.next=15,hg({canvas:C,qrScannerResources:n,blackAndWhiteConverterResources:o});case 15:if(!(k=e.sent)){e.next=29;break}return b(),B=rg(k),e.next=21,ro.takePicture({canvas:d.current});case 21:if(E=e.sent,S=void 0,!u||!u.key){e.next=28;break}return A=u.key,e.next=27,ci.encrypt({blob:E,key:A});case 27:S=e.sent;case 28:l({result:k,validateResult:B,image:{blob:E,encrypted:S}});case 29:if(f.current){e.next=31;break}return e.abrupt("break",33);case 31:e.next=11;break;case 33:case"end":return e.stop()}}),e)}))),[t,i,m,l,b,u]),w=o((function(){b()}),[b]);return c((function(){var e=t.current;function r(){return(r=B(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return p.current=ro.analyzeVideoAndWindowSizes(e,a,0),t.next=3,C();case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}n||w(),m&&n&&a&&function(){r.apply(this,arguments)}()}),[n,a,t,b,C,m,w]),c((function(){return w}),[w]),{refWorkingCanvas:d,stopCheckFrame:b,checkFrame:C,warmupDone:m}}({refVideo:n,shouldStart:t,cropArea:a,settings:i,onResult:o((function(){g.current.apply(g,arguments)}),[]),outputEncryptionSettings:f}),C=b.stopCheckFrame,w=b.checkFrame,k=b.warmupDone,E=cm({refVideo:n,shouldStart:t&&k,cropArea:a,settings:i}),S=E.stopCheckFrame,A=E.refRecordedVideos,_=E.splitVideos,T=E.resetRecordedVideos,P=E.checkFrame;g.current=o((function(e){m(!0),S(),C(),v.current(),u(I(I({},e),{},{recordedVideos:A.current})),m(!1)}),[S,u,A,C]);var x=o((function(){S(),C(),T(),l()}),[T,S,C,l]),R=o((function(){_()}),[_]),N=fm({lang:y,onAboutToTimeout:d,onSessionTimeout:x,onVideoTimeLimitReached:R,settings:i,shouldStartTimers:t&&k,sessionTime:null==i?void 0:i.scanQrLimitTimeSecond}),O=N.stopTimers,D=N.startTimers;return v.current=O,{isProcessing:h,restartSession:o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return D(),e.next=3,Promise.all([P(),w()]);case 3:case"end":return e.stop()}}),e)}))),[P,w,D]),refRecordedVideos:A,warmupDone:k}};function Bg(e){var r=e.windowAndVideoInfo,n=e.onUISpacingChange,a=e.refVideo,i=e.settings,l=e.onCaptureDone,u=e.outputEncryptionSettings,d=L(s(null),2),f=d[0],p=d[1],h=In.useAsset("qr_capture_cursor.png"),m=L(s({}),2),g=m[0],v=m[1],y=g.yTooltip,b=g.yMessage,C=Qr.useSDKSettings().lang,w=Th(),k=w.showPopup,E=w.popupShown,S=w.popupType,A=L(s(!1),2),_=A[0],I=A[1],T=L(s(null),2),P=T[0],x=T[1],R=In.useAsset("ic_loading.png");c((function(){k({popupType:Nh})}),[k]),c((function(){if(r){var e=r.videoAreaWidth,t=r.lostX,o=r.lostY,a=mi.isMobile?Math.min(e-6,145):145,i=a,s=o+10,c=s+90,l=c+40,u=l+i+20,d=Math.floor((e-a)/2)+t;p({x:d,y:l,width:a,height:i,surroundStyle:{opacity:.6,background:"#000"}});var f={yTitle:s,yTooltip:u,yMessage:c};v(f),n(f)}}),[r,n]);var N=o((function(){x(""),l()}),[l]),O=o((function(e){var t=e.validateResult.valid;x(""),t?l(e):k({popupType:Rh})}),[k,l]),D=o((function(e){var t=e.curTimeLeft;x(lu(km.REMAINING_TIME[C])({x:t}))}),[C]),M=kg({shouldStart:_,refVideo:a,cropArea:f,settings:i,onSessionTimeout:N,onCaptureDone:O,onAboutToTimeout:D,outputEncryptionSettings:u}),U=M.isProcessing,j=M.restartSession,F=M.warmupDone,V=o((function(){k({popupType:null})}),[k]),z=o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V(),e.next=3,j();case 3:case"end":return e.stop()}}),e)}))),[j,V]),K=o((function(){V(),l()}),[V,l]),H=o((function(){V(),setTimeout((function(){I(!0)}),200)}),[V]);return t.createElement(t.Fragment,null,!F&&t.createElement(bf,{contentStyle:{maxWidth:"300px"}}),f&&t.createElement(Fs,{x:"".concat(f.x,"px"),y:"".concat(f.y,"px"),width:"".concat(f.width,"px"),height:"".concat(f.height,"px"),surroundStyle:f.surroundStyle},t.createElement("div",null,t.createElement("img",{src:h,width:f.width,height:f.height,alt:""}))),t.createElement(Cm,{y:"".concat(y,"px")},km.QR_TOOLTIP[C]),P&&t.createElement(wm,{key:P,className:"message",y:"".concat(b,"px")},P),U&&t.createElement(ph,null,t.createElement("img",{src:R,alt:"",className:"spin"})),t.createElement(Jd,{contentStyle:{maxWidth:"332px"},open:E},S===Rh&&t.createElement(Om,{onRetry:z,onSkip:K}),S===Ph&&t.createElement(jm,{onRetry:z,onSkip:K}),S===Nh&&t.createElement(eg,{onClickStart:H,onTimeout:H})))}Bg.propTypes={windowAndVideoInfo:p.shape({}),onUISpacingChange:p.func,refVideo:p.shape({}),settings:p.shape({}),onCaptureDone:p.func,outputEncryptionSettings:p.shape({})},Bg.defaultProps={windowAndVideoInfo:{},onUISpacingChange:function(){},refVideo:{},settings:{},onCaptureDone:function(){},outputEncryptionSettings:null};var Eg,Sg,Ag,_g,Ig,Tg={SUCCESS:"SUCCESS",WARNING:"WARNING"},Pg=(S(gg={},Tg.SUCCESS,"52,206,95"),S(gg,Tg.WARNING,"255,148,50"),gg),xg=(S(vg={},Tg.SUCCESS,"✓"),S(vg,Tg.WARNING,"!"),vg),Rg=h.div(yg||(yg=N(["\n font-weight: normal;\n"]))),Ng=h.div(bg||(bg=N(["\n height: 2px;\n width: 100%;\n background: ",";\n"])),(function(e){return y(["linear-gradient(to right,rgba(",",0),rgba(",",1),rgba(",",0));"],Pg[e.type],Pg[e.type],Pg[e.type])})),Lg=h.div(Cg||(Cg=N(["\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: ",";\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n margin-right: 8px;\n font-weight: bold;\n"])),(function(e){return y(["rgb(",")"],Pg[e.type])})),Og=h.div(wg||(wg=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 10px 0;\n"]))),Dg=function(e){var r=e.children,n=e.type,o=e.className;return t.createElement(Rg,{className:o},t.createElement(Ng,{type:n}),t.createElement(Og,null,t.createElement(Lg,{type:n},xg[n]),r),t.createElement(Ng,{type:n}))};Dg.propTypes={children:p.node,type:p.string,className:p.string},Dg.defaultProps={children:null,type:Tg.SUCCESS,className:""};var Mg=h.div(Eg||(Eg=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 10px;\n"]))),Ug=h.div(Sg||(Sg=N(["\n text-align: center;\n font-size: 1rem;\n color: #ea3223;\n margin-top: 10px;\n"]))),jg=h.button(Ag||(Ag=N(["\n margin-top: 20px;\n width: 100%;\n max-width: 160px;\n height: 50px;\n background-color: ",";\n border: 0;\n outline: none;\n border-radius: 0.25rem;\n color: #fff;\n font-weight: 400;\n cursor: pointer;\n font-size: 1rem;\n"])),(function(e){return e.theme.tsBlue})),Fg=h.img(_g||(_g=N(["\n width: 100%;\n height: 100%;\n object-fit: contain;\n border-radius: 5px;\n"]))),Vg=h.div(Ig||(Ig=N(["\n margin: 20px 0;\n width: 100%;\n display: flex;\n justify-content: space-evenly;\n gap: 10px;\n"]))),zg=function(e){var r=e.imageTaken,n=e.onConfirm,o=e.onTryAgain,a=e.error,i=e.hasValidQR,l=L(s(null),2),u=l[0],d=l[1],f=Qr.useSDKSettings().lang;return c((function(){var e;return r&&(e=URL.createObjectURL(r.blob),d(e)),function(){URL.revokeObjectURL(e)}}),[r]),t.createElement(Mg,null,null!==i&&t.createElement(Bm,{mb:"20px"},t.createElement("div",null,t.createElement(Dg,{type:i?Tg.SUCCESS:Tg.WARNING},i?Bh.CONFIRM_POPUP_VALID_QR[f]:Bh.CONFIRM_POPUP_INVALID_QR[f]))),t.createElement(Xm,{ratio:1.5},t.createElement(Fg,{src:u})),a&&t.createElement(Ug,{className:"confirm-popup-error-message"},a.msg[f]),t.createElement(Vg,null,t.createElement(jg,{onClick:o},Bh.BTN_TRY_AGAIN[f]),t.createElement(jg,{onClick:n},Bh.BTN_USE_THIS_PICTURE[f])))};zg.propTypes={imageTaken:p.shape({}),error:p.shape({msg:p.shape({})}),onConfirm:p.func,onTryAgain:p.func,hasValidQR:p.bool},zg.defaultProps={imageTaken:null,error:null,onConfirm:function(){},onTryAgain:function(){},hasValidQR:null};var Kg={tsBlue:"#0276f1",tsSecondary:"rgba(0, 47, 117, 0.6)"};var Hg=function(){this.__data__=new xu,this.size=0};var qg=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Qg=function(e){return this.__data__.get(e)};var Wg=function(e){return this.__data__.has(e)};var Gg=function(e,t){var r=this.__data__;if(r instanceof xu){var n=r.__data__;if(!Ru||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Vu(n)}return r.set(e,t),this.size=r.size,this};function Xg(e){var t=this.__data__=new xu(e);this.size=t.size}Xg.prototype.clear=Hg,Xg.prototype.delete=qg,Xg.prototype.get=Qg,Xg.prototype.has=Wg,Xg.prototype.set=Gg;var Yg=Xg;var $g=function(e,t,r){(void 0!==r&&!Dc(e[t],r)||void 0===r&&!(t in e))&&Oc(e,t,r)};var Zg=function(e){return function(t,r,n){for(var o=-1,a=Object(t),i=n(t),s=i.length;s--;){var c=i[e?s:++o];if(!1===r(a[c],c,a))break}return t}}(),Jg=hi((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?qs.Buffer:void 0,a=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=a?a(r):new e.constructor(r);return e.copy(n),n}})),ev=qs.Uint8Array;var tv=function(e){var t=new e.constructor(e.byteLength);return new ev(t).set(new ev(e)),t};var rv=function(e,t){var r=t?tv(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)};var nv=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t},ov=Object.create,av=function(){function e(){}return function(t){if(!zs(t))return{};if(ov)return ov(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();var iv=function(e){return"function"!=typeof e.constructor||bl(e)?{}:av(Al(e))};var sv=function(e){return sc(e)&&Yc(e)};var cv=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var lv=function(e){return jc(e,Bl(e))};var uv=function(e,t,r,n,o,a,i){var s=cv(e,r),c=cv(t,r),l=i.get(c);if(l)$g(e,r,l);else{var u=a?a(s,c,r+"",e,t,i):void 0,d=void 0===u;if(d){var f=sl(c),p=!f&&ll(c),h=!f&&!p&&ml(c);u=c,f||p||h?sl(s)?u=s:sv(s)?u=nv(s):p?(d=!1,u=Jg(c,!0)):h?(d=!1,u=rv(c,!0)):u=[]:Rl(c)||il(c)?(u=s,il(s)?u=lv(s):zs(s)&&!bc(s)||(u=iv(c))):d=!1}d&&(i.set(c,u),o(u,c,n,a,i),i.delete(c)),$g(e,r,u)}};var dv,fv=function e(t,r,n,o,a){t!==r&&Zg(r,(function(i,s){if(a||(a=new Yg),zs(i))uv(t,r,s,n,e,o,a);else{var c=o?o(cv(t,s),i,s+"",t,r,a):void 0;void 0===c&&(c=i),$g(t,s,c)}}),Bl)},pv=el((function(e,t,r){fv(e,t,r)})),hv={data:{settings:{sdk_settings:{id_detection_settings:{auto_capture:{enable:!0,show_capture_button:!0,wait_for_best_image_time_ms_web:1e3},blur_check:{enable:!0,threshold_web:.82},disable_capture_button_if_alert:!1,id_detection:{enable:!0},limit_time_settings:{enable:!0,limit_time_second:30,video_partial_length_seconds:15},save_frame_settings:{enable:!1,frames_interval_ms:190,quality_web:80},scan_qr_settings:{enable:!0,limit_time_second:20}}}}}};function mv(e){var t=e.clientSettings,r=L(s(null),2),n=r[0],o=r[1];return c((function(){var e=pv(hv,t),r=Yu(e,"data.settings.sdk_settings.id_detection_settings.save_frame_settings.enable"),n=Yu(e,"data.settings.sdk_settings.id_detection_settings.save_frame_settings.frames_interval_ms"),a=Yu(e,"data.settings.sdk_settings.id_detection_settings.save_frame_settings.quality_web"),i=Yu(e,"data.settings.sdk_settings.id_detection_settings.limit_time_settings.enable"),s=Yu(e,"data.settings.sdk_settings.id_detection_settings.limit_time_settings.limit_time_second"),c=Yu(e,"data.settings.sdk_settings.id_detection_settings.limit_time_settings.video_partial_length_seconds"),l=Yu(e,"data.settings.sdk_settings.id_detection_settings.auto_capture.enable"),u=Yu(e,"data.settings.sdk_settings.id_detection_settings.auto_capture.wait_for_best_image_time_ms_web"),d=Yu(e,"data.settings.sdk_settings.id_detection_settings.blur_check.enable"),f=Yu(e,"data.settings.sdk_settings.id_detection_settings.blur_check.threshold_web"),p=Yu(e,"data.settings.sdk_settings.id_detection_settings.disable_capture_button_if_alert"),h=Yu(e,"data.settings.sdk_settings.id_detection_settings.id_detection.enable"),m=Yu(e,"data.settings.sdk_settings.id_detection_settings.scan_qr_settings.enable"),g=Yu(e,"data.settings.sdk_settings.id_detection_settings.scan_qr_settings.limit_time_second");o({enableRecording:r,frameCaptureIntervalMs:n,idCardSessionTime:s,maxRecordingTimePerVideo:c,saveFrameQuality:a,enableTimers:i,enableAutoCapture:l,waitForBestImageTimeMs:u,enableBlurCheck:d,blurThreshold:f,disableCaptureButtonIfAlert:p,enableIdDetection:h,enableScanQr:m,scanQrLimitTimeSecond:g})}),[t]),{settings:n}}var gv=v(dv||(dv=N(["\n .text-primary {\n color: ",";\n }\n"])),(function(e){return e.theme.tsBlue})),vv=V.IDCardSide,yv=V.IDCardType,bv=V.Errors,Cv={ID_CARD:"id_card",QR_CODE:"qr_code"},wv=[{scannerType:Cv.ID_CARD,title:"Mặt trước CMND/CCCD",description:"Vui lòng đặt CMND mặt trước vào trong khung",titleIcon:"id_card_front.svg",cardSide:V.IDCardSide.FRONT,cardType:yv.VN,frontCamera:!1,enableConfirmPopup:!0},{scannerType:Cv.ID_CARD,title:"Mặt sau CMND/CCCD",description:"Vui lòng đặt CMND mặt sau vào trong khung",titleIcon:"id_card_back.svg",cardSide:V.IDCardSide.BACK,cardType:yv.VN,frontCamera:!1,enableConfirmPopup:!0}],kv={scannerType:Cv.QR_CODE,title:"Quét mã QR trên CCCD",frontCamera:!1};function Bv(e){var n=e.onClose,a=e.onError,i=e.clientSettings,l=e.detectIdCard,u=e.onStepDone,d=e.steps,f=e.outputEncryptionSettings,p=e.defaultCameraId,h=L(s(0),2),m=h[0],g=h[1],v=L(s(d[m]),2),y=v[0],C=v[1],w=r(null),k=L(s(null),2),E=k[0],S=k[1],_=L(s(!1),2),T=_[0],P=_[1],x=L(s(0),2),R=x[0],N=x[1],D=r(),M=y.scannerType,U=y.frontCamera,j=y.title,F=y.titleIcon,z=y.cardSide,K=y.description,H=y.usePortraitMask,q=y.cardType,Q=y.enableConfirmPopup,W=z===vv.FRONT,G=In.useAsset(F),X=Th(),Y=X.showPopup,$=X.popupShown,Z=X.popupType,J=X.props,ee=L(s(!1),2),te=ee[0],re=ee[1],ne=In.useAsset("ic_loading.png"),oe=r({}),ae=r(null),ie=r([]),se=mv({clientSettings:i}).settings,ce=L(s({}),2),le=ce[0],ue=ce[1],de=le.yTitle,fe=o((function(e){S(e),P(!0)}),[]);c((function(){P(!1)}),[U]);var pe=o((function(){Y({popupType:null})}),[Y]),he=o((function(e){e>=d.length||setTimeout((function(){g(e),C(d[e])}),200)}),[d]),me=o((function(){he(m+1)}),[he,m]),ge=o((function(){setTimeout((function(){C((function(e){return I(I({},kv),{},{enableConfirmPopup:e.enableConfirmPopup})}))}),200)}),[]),ve=o(B(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={stepNumber:m,image:oe.current,recordedVideos:null!=se&&se.enableRecording?ie.current:[]},M===Cv.QR_CODE&&(t.qrScannedResult=ae.current),re(!0),e.next=5,u(t);case 5:re(!1),me();case 7:case"end":return e.stop()}}),e)}))),[se,m,u,me,M]),ye=o((function(){pe(),M===Cv.QR_CODE?he(m):M===Cv.ID_CARD&&D.current.restartSession()}),[he,m,pe,M]),be=o((function(){pe(),ve()}),[ve,pe]),Ce=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,i,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.image,n=t.error,o=t.recordedVideos,oe.current=r,ie.current=o,N((function(e){return e+1})),z!==V.IDCardSide.FRONT){e.next=23;break}if(!se.enableScanQr||!mi.isMobile){e.next=23;break}if(s=null==r||null===(i=r.detectedCard)||void 0===i?void 0:i.label){e.next=20;break}return re(!0),e.prev=9,e.next=12,l({image:r,cardType:q,cardSide:z});case 12:c=e.sent,s=c.card_label,e.next=19;break;case 16:e.prev=16,e.t0=e.catch(9),a(bv.detect_id_card_error);case 19:re(!1);case 20:if(!s||!"vn.cccd_new.front".includes(s)){e.next=23;break}return ge(),e.abrupt("return");case 23:Q?Y({popupType:xh,props:{imageTaken:oe.current,error:n}}):ve();case 24:case"end":return e.stop()}}),e,null,[[9,16]])})));return function(t){return e.apply(this,arguments)}}(),[Q,Y,z,se,q,l,ve,ge,a]),we=o((function(e){var t;if(ae.current=e,e){var r,n=e.recordedVideos;(r=ie.current).push.apply(r,O(n))}N((function(e){return e+1}));var o=Boolean(null==e||null===(t=e.validateResult)||void 0===t?void 0:t.valid);Q?Y({popupType:xh,props:{hasValidQR:o,imageTaken:oe.current}}):ve()}),[Y,Q,ve]);return t.createElement(b,{theme:Kg},t.createElement(uh,null,t.createElement(Ls,{key:U,frontCamera:U,onVideoPlayed:fe,onClose:n,flipHorizontal:U,ref:w,onError:a,defaultCameraId:p},T&&t.createElement(t.Fragment,null,M===Cv.ID_CARD&&t.createElement(mm,{key:m,ref:D,windowAndVideoInfo:E,refVideo:w,settings:se,onCaptureDone:Ce,onUISpacingChange:ue,frontSide:W,description:K,usePortraitMask:H,outputEncryptionSettings:f}),M===Cv.QR_CODE&&t.createElement(Bg,{key:m,refVideo:w,windowAndVideoInfo:E,settings:se,onCaptureDone:we,onUISpacingChange:ue,outputEncryptionSettings:f})),t.createElement(lh,{keyForTransition:R}),t.createElement(mh,{y:"".concat(de,"px")},t.createElement(Cp,null,t.createElement(hp,{key:j,timeout:{enter:500,exit:500},classNames:"flipY",unmountOnExit:!0},t.createElement(gh,null,F&&t.createElement(dh,{src:G,alt:""}),t.createElement(vh,{className:"title"},j))))),te&&t.createElement(ph,null,t.createElement("img",{src:ne,alt:"",className:"spin"}))),t.createElement(Jd,{open:$},Z===xh&&t.createElement(zg,A({},J,{onConfirm:be,onTryAgain:ye})))),t.createElement(gv,null))}Bv.propTypes={onClose:p.func,onError:p.func,clientSettings:p.shape({}),detectIdCard:p.func,onStepDone:p.func,steps:p.arrayOf(p.shape({})),outputEncryptionSettings:p.shape({}),defaultCameraId:p.string},Bv.defaultProps={onClose:function(){},onError:function(){},clientSettings:{},detectIdCard:function(){return Promise.resolve({card_label:""})},onStepDone:function(){},steps:wv,outputEncryptionSettings:null,defaultCameraId:void 0};var Ev=["tracking","clientSettings"];function Sv(e){var r=e.tracking,o=e.clientSettings,a=R(e,Ev),i=n((function(){return Yu(o,"data.settings.sdk_settings.server_log_settings.enable",null==r?void 0:r.enable)}),[o,r]);return t.createElement(Sn.SDKTrackingProvider,{value:{tracking:I(I({},r),{},{enable:i})}},t.createElement(Bv,A({},a,{clientSettings:o})))}Sv.propTypes={tracking:p.shape({}),clientSettings:p.shape({})},Sv.defaultProps={tracking:void 0,clientSettings:void 0};var Av=V.IDCardSide,_v=V.Errors;function Iv(e){return Tv.apply(this,arguments)}function Tv(){return(Tv=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.image,n=t.cardType,o=t.cardSide,a=t.apiClient,i=t.outputEncryptionSettings,s={label:"id_card.".concat(n,".").concat(o)},!i||!i.key){e.next=4;break}return e.abrupt("return",a.httpClient.post("/v1/images",I({base64:r.encrypted.hex},s),{"X-TV-Key":i.key}));case 4:return e.abrupt("return",a.uploadImage(I({file:r.blob},s)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pv(e){return xv.apply(this,arguments)}function xv(){return(xv=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.image,n=t.apiClient,o=t.rawString,a=t.outputEncryptionSettings,i={label:"qr_code",metadata:JSON.stringify({raw:o})},!a||!a.key){e.next=4;break}return e.abrupt("return",n.httpClient.post("/v1/images",I({base64:r.encrypted.hex},i),{"X-TV-Key":a.key}));case 4:return e.abrupt("return",n.uploadImage(I({file:r.blob},i)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Rv(e){return Nv.apply(this,arguments)}function Nv(){return(Nv=B(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.imageId,n=t.cardType,o=t.apiClient,e.abrupt("return",o.requestVerifyIDCard({card_type:n,image1:{id:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lv(e){return Ov.apply(this,arguments)}function Ov(){return(Ov=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.apiClient,n=t.cardType,o=t.frontCardId,a=t.isCapturingFrontSide,i=t.backCardId,s=t.recordedVideos,c=t.qrImageId,l=s.filter((function(e){return null!==e.id})),u=s.filter((function(e){return null===e.id&&e.frames.length>0})),e.next=5,Promise.all(u.map((function(e){return r.fileService.request({frames:e.frames})})));case 5:return d=e.sent,f={card_type:n,image:{id:o},image2:a?void 0:{id:i},videos:[].concat(O(l.map((function(e){return{id:e.id}}))),O(d.map((function(e){return{id:e.data.file_id}}))))},c&&(f.qr1_images=[{id:c}]),e.abrupt("return",r.detectIDTampering(f));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Dv(e){return Mv.apply(this,arguments)}function Mv(){return(Mv=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.cardType,n=t.apiClient,o=t.frontCardId,a=t.backCardId,i=t.isCapturingFrontSide,s=t.qrImageId,c={card_type:r,image1:i?{id:o}:{id:a}},s&&(c.qr1_images=[{id:s}]),e.abrupt("return",n.readIDCard(c));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Uv(e){return jv.apply(this,arguments)}function jv(){return(jv=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k,B,E,S;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.image,o=t.frontCardId,a=t.qrImageId,i=t.onError,s=t.recordedVideos,c=t.apiClient,l=t.cardType,u=t.cardSide,d=t.qrScannedResult,f=t.outputEncryptionSettings,u!==Av.BACK||o){e.next=4;break}return i(_v.missing_front_id_card),e.abrupt("return");case 4:return p=[Iv({image:n,cardType:l,cardSide:u,apiClient:c,outputEncryptionSettings:f})],d&&p.push(Pv({image:d.image,apiClient:c,rawString:d.result,outputEncryptionSettings:f})),e.next=8,Promise.all(p);case 8:if(h=e.sent,m=L(h,2),g=m[0],v=m[1],!g.errors){e.next=15;break}return i(I(I({},_v.upload_error),{},{details:g.errors})),e.abrupt("return");case 15:return y=g.data.image_id,b=(null==v||null===(r=v.data)||void 0===r?void 0:r.image_id)||a,(k=u===Av.FRONT)?C=y:(C=o,w=y),e.next=21,Rv({imageId:y,cardType:l,apiClient:c});case 21:if(!(B=e.sent).errors){e.next=25;break}return i(I(I({},_v.sanity_check_error),{},{details:B.errors})),e.abrupt("return");case 25:return e.next=27,Dv({cardType:l,apiClient:c,frontCardId:C,backCardId:w,isCapturingFrontSide:k,qrImageId:b});case 27:if(!(E=e.sent).errors){e.next=31;break}return i(I(I({},_v.read_id_card_error),{},{details:E.errors})),e.abrupt("return");case 31:return e.next=33,Lv({apiClient:c,cardType:l,frontCardId:C,isCapturingFrontSide:k,backCardId:w,recordedVideos:s,qrImageId:b});case 33:if(!(S=e.sent).errors){e.next=37;break}return i(I(I({},_v.detect_id_tampering_error),{},{details:S.errors})),e.abrupt("return");case 37:return e.abrupt("return",{sanityResult:B.data,tamperingInfo:S.data,cardInfo:E.data,qrImageId:b});case 38:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Fv=["onClose","onError","detectIdCard","steps","onStepDone","apiCredentials","tracking","outputEncryptionSettings"],Vv=V.Errors,zv=function(e){var n=e.onClose,a=e.onError,i=e.detectIdCard,l=e.steps,u=e.onStepDone,d=e.apiCredentials,f=e.tracking,p=e.outputEncryptionSettings,h=R(e,Fv),m=L(s(null),2),g=m[0],v=m[1],y=La.useApiClient({apiCredentials:d,tracking:f}).apiClient,b=r(""),C=r("");c((function(){function e(){return(e=B(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.clientSettings();case 2:t=e.sent,v(t);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[y]);var w=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,i,s,c,d,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.stepNumber,n=t.recordedVideos,o=t.qrScannedResult,i=t.image,s=l[r],c=s.cardType,d=s.cardSide,f=null,e.prev=3,e.next=6,Uv({image:i,cardSide:d,frontCardId:b.current,qrImageId:C.current,onError:a,apiClient:y,cardType:c,recordedVideos:n,qrScannedResult:o,outputEncryptionSettings:p});case 6:f=e.sent,d===V.IDCardSide.FRONT&&(b.current=f.cardInfo.image1.id),C.current=f.qrImageId,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),a(I(I({},Vv.api_call_error),{},{details:e.t0}));case 14:f&&u(I(I({},t),{},{apiResult:f}));case 15:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(t){return e.apply(this,arguments)}}(),[y,a,l,u,p]);return g&&t.createElement(Sv,A({tracking:f,onClose:n,onError:a,detectIdCard:i,onStepDone:w,steps:l,outputEncryptionSettings:p},h,{clientSettings:g}))};function Kv(){return(Kv=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]?s[0]:{},r=t.opencvUrl,n=t.idCardModelUrl,o=t.blazefaceModelUrl,a=t.tfScriptUrls,"iOS"!==mi.osName||!mi.osVersion.includes("12.")){e.next=5;break}return e.next=4,Yh({url:r});case 4:return e.abrupt("return");case 5:return e.next=7,oi.loadTensorFlow(a);case 7:return e.next=9,oi.initTensorFlow({preferredBackends:["wasm","webgl","cpu"]});case 9:return i=new em,e.next=12,Promise.all([i.loadResource({modelUrl:n}),oi.loadBlazefaceModel({modelUrl:o}),Yh({url:r})]);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}zv.propTypes={onClose:p.func,onError:p.func,detectIdCard:p.func,onStepDone:p.func,steps:p.arrayOf(p.shape({})),apiCredentials:p.shape({accessKey:p.string,secretKey:p.string,apiUrl:p.string}),tracking:p.shape({}),outputEncryptionSettings:p.shape({})},zv.defaultProps={onClose:function(){},onError:function(){},detectIdCard:function(){return Promise.resolve({card_label:""})},onStepDone:function(){},steps:wv,apiCredentials:{accessKey:"5767c20d-87aa-4cad-8dbb-f5429f76c34b",secretKey:"c1446919-e60a-4575-a05d-304318212a1b",apiUrl:"https://tv-testing.trustingsocial.com/api"},outputEncryptionSettings:{key:""},tracking:void 0};var Hv,qv,Qv,Wv,Gv,Xv,Yv,$v=nd((function(){return Kv.apply(this,arguments)})),Zv=function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.blob,n=t.resultWarmup,o=n.idCardModel,a=n.ableToUseModel){e.next=4;break}return e.abrupt("return",{ableToUseModel:a});case 4:return e.next=6,Ca.blobToCanvas({blob:r});case 6:return i=e.sent,e.abrupt("return",o.predict(i,{detectThreshold:.3}));case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Jv=function(){return{checkCamera:Vf,LivenessDetection:Jf,NativeCamera:Kf,ReadIDCardUIOnly:Sv,ReadIDCardWithApiCall:zv,warmUpReadIdCard:im,preloadEKYCResources:$v,getListCamera:bs}},ey=Ed,ty=R(Ff,["useLivenessDetection"]);function ry(e){var r=e.className;return t.createElement("svg",{className:r,width:"320",height:"320",viewBox:"0 0 320 320",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M320 0H0V320H320V0ZM160 296C235.111 296 296 235.111 296 160C296 84.8893 235.111 24 160 24C84.8893 24 24 84.8893 24 160C24 235.111 84.8893 296 160 296Z",fill:"currentColor"}))}ry.propTypes={className:p.string},ry.defaultProps={className:""};var ny,oy,ay,iy,sy,cy,ly,uy,dy,fy,py,hy,my=(S(Hv={},V.FaceDirection.LEFT,90),S(Hv,V.FaceDirection.RIGHT,270),S(Hv,V.FaceDirection.UP,180),S(Hv,V.FaceDirection.DOWN,0),Hv),gy=g(["0%{opacity:0.15;}50%{opacity:0.3;}100%{opacity:1;}"]),vy=h.div(qv||(qv=N(["\n width: 200px;\n height: 200px;\n position: relative;\n transform: scale(0.48);\n\n .top,\n .right,\n .bottom,\n .left {\n position: absolute;\n }\n\n .top {\n top: 0;\n left: 50%;\n transform: rotate(","deg) translateX(-50%);\n }\n\n .right {\n right: 0;\n top: 50%;\n transform: rotate(","deg) translateX(-50%);\n }\n\n .bottom {\n bottom: 0;\n left: 50%;\n transform: rotate(","deg) translateX(50%);\n }\n\n .left {\n left: 0;\n top: 50%;\n transform: rotate(","deg) translateX(50%);\n }\n"])),my[V.FaceDirection.DOWN],my[V.FaceDirection.LEFT],my[V.FaceDirection.UP],my[V.FaceDirection.RIGHT]),yy=h.div(Qv||(Qv=N(["\n width: 70px;\n transform: rotate(","deg);\n"])),(function(e){var t,r=e.direction;return null!==(t=my[r])&&void 0!==t?t:0})),by=h.span(Wv||(Wv=N(["\n display: flex;\n margin: 4px 0;\n width: 100%;\n height: 15px;\n animation: "," 1s infinite;\n animation-direction: alternate;\n\n &::before,\n &::after {\n content: '';\n height: 100%;\n width: 50%;\n background: rgba(255, 255, 255, 0.8);\n }\n\n &::before {\n transform: skewY(32deg);\n }\n\n &::after {\n width: 50%;\n transform: skewY(-32deg);\n }\n"])),gy),Cy=h(by)(Gv||(Gv=N(["\n animation-delay: 0s;\n"]))),wy=h(by)(Xv||(Xv=N(["\n animation-delay: 0.5s;\n"]))),ky=h(by)(Yv||(Yv=N(["\n animation-delay: 1s;\n"])));function By(e){var r=e.type;return r!==V.FaceDirection.FRONTAL?t.createElement(yy,{direction:r},t.createElement(Cy,null),t.createElement(wy,null),t.createElement(ky,null)):t.createElement(vy,null,t.createElement(yy,{className:"top"},t.createElement(Cy,null),t.createElement(wy,null),t.createElement(ky,null)),t.createElement(yy,{className:"right"},t.createElement(Cy,null),t.createElement(wy,null),t.createElement(ky,null)),t.createElement(yy,{className:"bottom"},t.createElement(Cy,null),t.createElement(wy,null),t.createElement(ky,null)),t.createElement(yy,{className:"left"},t.createElement(Cy,null),t.createElement(wy,null),t.createElement(ky,null)))}By.propTypes={type:p.oneOf([V.FaceDirection.LEFT,V.FaceDirection.RIGHT,V.FaceDirection.UP,V.FaceDirection.FRONTAL])},By.defaultProps={type:V.FaceDirection.LEFT};var Ey=650,Sy=750,Ay=Vs,_y=ty.Text,Iy=ty.FaceDetectionError,Ty=ty.FaceVerificationInstructions,Py=ty.FaceVerificationStepsWrapper,xy=ty.StepItem,Ry=ty.BottomButtonsOverlay,Ny=ty.Button,Ly=ty.CountDownOverlay,Oy=ty.InstructionsOverlay,Dy=h(Py)(ny||(ny=N(["\n height: 50px;\n"]))),My=h(_y)(oy||(oy=N(["\n position: absolute;\n font-style: normal;\n font-weight: bold;\n font-size: 1.5rem;\n text-align: center;\n padding: 0 1.75rem;\n color: ",";\n\n ","\n\n ",";\n"])),(function(e){return e.color}),(function(e){var t=e.top;return t&&y(["top:","px;"],t)}),(function(e){return e.isMobile&&y(["font-size:1.125rem;"])})),Uy=h(Iy)(ay||(ay=N(["\n position: absolute;\n font-size: 1.125rem;\n text-align: center;\n\n ",";\n"])),(function(e){return e.isMobile&&y(["font-size:0.875rem;"])})),jy=h(Ty)(iy||(iy=N(["\n position: absolute;\n font-size: 1.125rem;\n text-align: center;\n padding: 0 1.75rem;\n color: ",";\n text-shadow: none;\n\n ",";\n"])),(function(e){return e.color}),(function(e){return e.isMobile&&y(["font-size:0.875rem;"])})),Fy=h(ry)(sy||(sy=N(["\n width: 100%;\n height: 100%;\n vertical-align: middle;\n margin: 0;\n color: ",";\n"])),(function(e){var t=e.color;return null!=t?t:"#06243c"})),Vy=h.img(cy||(cy=N(["\n && {\n width: 20px;\n border-radius: 50%;\n margin: 0;\n\n ","\n }\n"])),(function(e){return"preview"===e.mode&&y(["width:42px;"])})),zy=h(xy)(ly||(ly=N(["\n width: 50px;\n height: 50px;\n border: 1px solid #005993;\n border-radius: 50%;\n\n & + & {\n margin-left: 10px;\n }\n\n ","\n"])),(function(e){return!e.active&&y(["border-color:#f2f6f9;opacity:0.3;"])})),Ky=h(jd)(uy||(uy=N(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),Hy=h.div(dy||(dy=N(["\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 0;\n z-index: -1;\n"]))),qy=h(Hy)(fy||(fy=N(["\n background: rgba(223, 0, 0, 0.2);\n"]))),Qy=g(["from{opacity:1;}to{opacity:0;}"]),Wy=h(Hy)(py||(py=N(["\n background: rgba(255, 255, 255, 0.3);\n animation: "," 1s infinite;\n"])),Qy),Gy=mi.isMobile?{width:640}:null;function Xy(e){var r=e.className,a=e.apiCheck,i=e.enableInstructionsOverlay,s=e.enableErrorOverlay,c=e.enableCapturingOverlay,l=e.frontalMinSize,u=e.mode,d=e.minPadding,f=e.backgroundColor,p=e.textColor,h=e.progressProps,m=e.title,g=e.description,v=e.customInstructions,y=e.customIcon,b=e.customDirectionIcon,C=e.onLivenessDetectionDone,w=e.onClose,k=e.onError,B=e.captureFrameSettings,E=e.onFramesCaptured,S=e.livenessSettings,_=e.initFirstGestureTimeout,I=o((function(e){var t=e.clientWidth,r=e.clientHeight,n=e.videoAreaWidth,o=e.videoAreaHeight,a=e.lostX,i=e.lostY,s=Math.max(80,i),c=Math.max(140,i);r>Ey&&(s=Math.max(110,i),c=Math.max(170,i)),r>Sy&&(s=Math.max(140,i),c=Math.max(200,i));var l=Math.max(d,a),u=Math.max(d,a),f=Math.min(n,o),p=Math.max(Math.floor(Math.min(t-(l+u),r-(s+c),f)),160);return{x:Math.min(Math.floor(l+(t-u-l)/2-p/2),t-p),y:Math.min(Math.floor(s+(r-c-s)/2-p/2),r-p),width:p,height:p}}),[d]),T=n((function(){return{background:f,opacity:1}}),[f]),P=ey({apiCheck:a,frontalMinSize:l,mode:u,bgCameraMask:null,bgCameraMaskRed:null,surroundStyle:T,cropAreaDimension:I,customInstructions:v,customIcon:y,customDirectionIcon:b,onLivenessDetectionDone:C,captureFrameSettings:B,onFramesCaptured:E,livenessSettings:S,initFirstGestureTimeout:_}),x=P.countdownToTakePicture,R=P.cropArea,N=P.curStepIndex,L=P.directionIcon,O=P.faceDetectionError,D=P.handleTriggerPassiveMode,M=P.handleVideoPlayed,U=P.instructions,j=P.isActiveMode,F=P.refVideo,V=P.showCountdown,z=P.steps,K=P.videoPlayed,H=P.activeCapturing,q=P.warmupDone,Q=10,W=45,G=2,X=50,Y=12,$=14;window.innerHeight>Ey&&(Q=25,W=65,G=3,X=50,Y=24,$=34),window.innerHeight>Sy&&(Q=30,W=80,G=5,X=50,Y=32,$=54);var Z=R.current?R.current.y+R.current.height+G:0,J=$+X+Y,ee=s&&O;return t.createElement(Ls,{ref:F,className:r,frontCamera:!0,flipHorizontal:!0,videoSettings:Gy,onVideoPlayed:M,onClose:w,onError:k},!q&&t.createElement(bf,null),K?t.createElement(t.Fragment,null,t.createElement(My,{top:Q,isMobile:mi.isMobile,color:p},m),R.current?t.createElement(Fs,{x:"".concat(R.current.x,"px"),y:"".concat(R.current.y,"px"),width:"".concat(R.current.width,"px"),height:"".concat(R.current.height,"px"),surroundStyle:R.current.surroundStyle},t.createElement(Fy,{color:f}),t.createElement(Ky,A({progress:N/z.length*100,hasError:ee},h)),V?t.createElement(Ly,null,x):null,j&&i&&L?t.createElement(Oy,null,L):null,j&&c&&H?t.createElement(Wy,null):null,ee?t.createElement(qy,null):null):null,O?t.createElement(Uy,{top:Z,isMobile:mi.isMobile,error:O}):null,j?t.createElement(t.Fragment,null,t.createElement(jy,{top:W,isMobile:mi.isMobile,color:p},g),U?t.createElement(jy,{bottom:J,isMobile:mi.isMobile,color:p},U):null,t.createElement(Dy,{bottom:$},z.map((function(e,r){var n=e.name,o=e.icon,a=e.image.objUrl,i=N>=r;return t.createElement(zy,{key:n,active:i},a?t.createElement(Vy,{src:a,alt:"",mode:"preview"}):function(e,r){return"string"==typeof e?t.createElement(Vy,{src:e,alt:""}):t.cloneElement(e,r)}(o,{active:i}))})))):t.createElement(t.Fragment,null,O?null:t.createElement(Ry,null,t.createElement(Ny,{onClick:D},t.createElement(Ay,null))))):null)}Xy.propTypes={className:p.string,apiCheck:p.bool,enableInstructionsOverlay:p.bool,enableErrorOverlay:p.bool,enableCapturingOverlay:p.bool,frontalMinSize:p.number,mode:p.string,minPadding:p.number,backgroundColor:p.string,textColor:p.string,progressProps:p.shape({className:p.string,style:p.shape({}),radius:p.number,strokeWidth:p.number,progress:p.number,activeColor:p.string,innerPadding:p.number,outsideRingColor:p.string,insideRingColor:p.string,insideRingWidth:p.number,dashedRingColor:p.string,dashedRingWidth:p.number,dashedRingLineThick:p.number,dashedRingLineSpacing:p.number,showOutsideRing:p.bool,showDashedRing:p.bool,showInsideRing:p.bool}),title:p.string,description:p.string,customInstructions:p.shape({}),customIcon:p.shape({}),customDirectionIcon:p.shape({}),onLivenessDetectionDone:p.func,onClose:p.func,onError:p.func,captureFrameSettings:p.shape({}),onFramesCaptured:p.func,livenessSettings:p.shape({}),initFirstGestureTimeout:p.number},Xy.defaultProps={className:"",apiCheck:!1,enableInstructionsOverlay:!1,enableErrorOverlay:!1,enableCapturingOverlay:!1,frontalMinSize:720,mode:null,minPadding:30,backgroundColor:"#06243c",textColor:"#ffffff",progressProps:null,title:"Chụp ảnh chân dung",description:"Xin đưa khuôn mặt vào khung hình. Hình ảnh sẽ tự động được ghi lại.",customInstructions:null,customIcon:null,customDirectionIcon:(hy={},S(hy,V.FaceDirection.LEFT,t.createElement(By,{type:V.FaceDirection.LEFT})),S(hy,V.FaceDirection.RIGHT,t.createElement(By,{type:V.FaceDirection.RIGHT})),S(hy,V.FaceDirection.UP,t.createElement(By,{type:V.FaceDirection.UP})),S(hy,V.FaceDirection.FRONTAL,t.createElement(By,{type:V.FaceDirection.FRONTAL})),hy),onLivenessDetectionDone:null,onClose:null,onError:function(){},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:function(){},livenessSettings:null,initFirstGestureTimeout:2e3};export{La as APIUtils,ch as Animations,ai as AntiDebugUtils,In as AssetUtils,Pn as AsyncUtils,ws as BASE_Z_INDEX,di as BaseTVWebSDK,eo as BlurUtils,Pm as Button,xm as ButtonLink,Ls as Camera,ro as CameraUtils,oo as CommonUtils,V as Constants,lo as CoordinateUtils,Fs as CropAreaOverlayWrapper,ci as CryptoUtils,yo as FaceUtils,Ea as GlareUtils,gn as HashUtils,Dg as HighlightResult,Tg as HighlightResultType,qf as Icons,Ca as ImageUtils,Xy as LivenessDetection,ty as LivenessDetectionComponents,Ka as LoadResourceUtils,fn as LocalStorageUtils,vi as MobileDetect,oi as ModelUtils,Kf as NativeCamera,js as PlacementArea,Jd as Popup,ko as PredictionUtils,jd as ProgressCircle,Xm as RatioWrapper,Sv as ReadIDCardUIOnly,zv as ReadIDCardWithApiCall,kp as RectangleMask,wp as RectangleMaskType,Cv as ScannerType,Qr as SettingsContext,Bm as Spacing,ii as ThemeUtils,ln as TimeUtils,Sn as TrackingContext,an as UserAgentUtils,bf as WarmupPopup,Vf as checkCamera,hv as defaultClientSettings,wv as defaultReadIDCardSteps,Jv as getBaseSDKComponent,Vr as getCustomUrlsBySettings,li as getQrScannerWorkerPath,Uv as handleApiCheckReadIdCard,$v as preloadEKYCResources,Zv as readIdCardFromImage,mg as readQRCodeFromImage,ey as useLivenessDetection,kg as useMainProcessQRCodeScanner,pm as useMainProcessReadIdCard,mv as useSettingsReadIdCard,Th as useShowPopup,sg as warmUpQRCodeScanner,im as warmUpReadIdCard,fd as warmupSelfieActive};
|
|
57
|
+
*/function Ji(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case Oi:switch(e=e.type){case zi:case Ki:case Mi:case Fi:case Ui:case qi:return e;default:switch(e=e&&e.$$typeof){case Vi:case Hi:case Gi:case Wi:case ji:return e;default:return t}}case Di:return t}}}function es(e){return Ji(e)===Ki}var ts={AsyncMode:zi,ConcurrentMode:Ki,ContextConsumer:Vi,ContextProvider:ji,Element:Oi,ForwardRef:Hi,Fragment:Mi,Lazy:Gi,Memo:Wi,Portal:Di,Profiler:Fi,StrictMode:Ui,Suspense:qi,isAsyncMode:function(e){return es(e)||Ji(e)===zi},isConcurrentMode:es,isContextConsumer:function(e){return Ji(e)===Vi},isContextProvider:function(e){return Ji(e)===ji},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===Oi},isForwardRef:function(e){return Ji(e)===Hi},isFragment:function(e){return Ji(e)===Mi},isLazy:function(e){return Ji(e)===Gi},isMemo:function(e){return Ji(e)===Wi},isPortal:function(e){return Ji(e)===Di},isProfiler:function(e){return Ji(e)===Fi},isStrictMode:function(e){return Ji(e)===Ui},isSuspense:function(e){return Ji(e)===qi},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===Mi||e===Ki||e===Fi||e===Ui||e===qi||e===Qi||"object"==typeof e&&null!==e&&(e.$$typeof===Gi||e.$$typeof===Wi||e.$$typeof===ji||e.$$typeof===Vi||e.$$typeof===Hi||e.$$typeof===Yi||e.$$typeof===$i||e.$$typeof===Zi||e.$$typeof===Xi)},typeOf:Ji},rs=(mi((function(e,t){})),mi((function(e){e.exports=ts}))),ns={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},os={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},as={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},is={};function ss(e){return rs.isMemo(e)?as:is[e.$$typeof]||ns}is[rs.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},is[rs.Memo]=as;var cs=Object.defineProperty,ls=Object.getOwnPropertyNames,us=Object.getOwnPropertySymbols,ds=Object.getOwnPropertyDescriptor,fs=Object.getPrototypeOf,ps=Object.prototype;var hs,ms,gs,vs,ys,bs=function e(t,r,n){if("string"!=typeof r){if(ps){var o=fs(r);o&&o!==ps&&e(t,o,n)}var a=ls(r);us&&(a=a.concat(us(r)));for(var i=ss(t),s=ss(r),c=0;c<a.length;++c){var l=a[c];if(!(os[l]||n&&n[l]||s&&s[l]||i&&i[l])){var u=ds(r,l);try{cs(t,l,u)}catch(e){}}}}return t};function Cs(){return"function"==typeof navigator.enumerateDevices?navigator.enumerateDevices():"object"===w(navigator.mediaDevices)&&"function"==typeof navigator.mediaDevices.enumerateDevices?navigator.mediaDevices.enumerateDevices():new Promise((function(e,t){try{if(null==window.MediaStreamTrack||null==window.MediaStreamTrack.getSources)throw new Error;window.MediaStreamTrack.getSources((function(t){e(t.filter((function(e){return"video"===e.kind.toLowerCase()||"videoinput"===e.kind.toLowerCase()})).map((function(e){return{deviceId:null!=e.deviceId?e.deviceId:"",groupId:e.groupId,kind:"videoinput",label:e.label,toJSON:function(){return this}}})))}))}catch(e){return t(e)}}))}var ws=V.Errors,ks=1e3,Bs=h.div(hs||(hs=N(["\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: #000;\n display: flex;\n justify-content: center;\n z-index: ",";\n ","\n"])),1e3,(function(e){return e.checkCameraMode&&"opacity: 0;"})),Es=h.video(ms||(ms=N(["\n width: 100%;\n ","\n"])),(function(e){return e.flipHorizontal&&"\n transform: scale(".concat(-1*e.scale,", ").concat(1*e.scale,");\n ")})),Ss=h.div(gs||(gs=N(["\n cursor: pointer;\n text-align: center;\n width: 50px;\n\n img {\n width: 100%;\n }\n"]))),As=h(Ss)(vs||(vs=N(["\n z-index: ",";\n position: absolute;\n top: 20px;\n right: 20px;\n width: 20px;\n"])),1100),_s=h.div(ys||(ys=N(["\n z-index: ",";\n position: absolute;\n top: 40px;\n color: red;\n"])),1020),Is=t.createRef(),Ts=function(){if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)return navigator.mediaDevices;var e=navigator.mozGetUserMedia||navigator.webkitGetUserMedia;return e?{getUserMedia:function(t){return new Promise((function(r,n){e.call(navigator,t,r,n)}))}}:null}();function Ps(e){var n=e.checkCameraMode,a=e.frontCamera,i=e.onClose,l=e.children,u=e.onVideoPlayed,d=e.flipHorizontal,f=e.videoSettings,p=e.refVideo,h=e.onError,m=e.closeButton,g=e.videoClassName,v=e.scale,y=e.defaultCameraId,b=e.onWarning,C=r(),w=Qr.useSDKSettings().lang,k=Sn.useSDKTracking().sendEvent,E=In.useAsset("ic_close.png"),S=L(s(""),2),A=S[0],_=S[1],T=r(!1),P=r(!1),x=r(!1),R=o((function(){try{var e;clearInterval(C.current),(null==p||null===(e=p.current)||void 0===e?void 0:e.srcObject)instanceof MediaStream&&(p.current.srcObject.getTracks().forEach((function(e){return e.stop()})),p.current.srcObject=null)}catch(e){}}),[p]);C.current||(C.current=setInterval((function(){document.getElementById("tv-camera-".concat(C.current))||R()}),1e3)),c((function(){return function(){x.current=!0}}),[]);var N=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.length>1&&void 0!==i[1]&&i[1],n={},!1!==window.tv_last_req_camera_complete){e.next=5;break}return b("too_many_request_to_camera"),e.abrupt("return",new Promise((function(e){return e(null)})));case 5:return window.tv_last_req_camera_complete=!1,n=gi.isMobile?gi.isIOS?{width:{ideal:1460},aspectRatio:{ideal:window.innerHeight/window.innerWidth}}:{width:{ideal:1650},aspectRatio:{ideal:window.innerHeight/window.innerWidth}}:{height:{ideal:9999}},e.prev=7,e.next=10,Ts.getUserMedia({audio:!1,video:I(I({},t?{deviceId:t}:{facingMode:a?"user":"environment"}),r?{}:f||n)});case 10:return(o=e.sent)||(_(ws.not_supported.msg[w]),h(ws.not_supported)),window.tv_last_req_camera_complete=!0,e.abrupt("return",o);case 16:e.prev=16,e.t0=e.catch(7),"NotAllowedError"===e.t0.name?(_(ws.no_permission.msg[w]),h(ws.no_permission),P.current=!0):P.current&&("NotReadableError"===e.t0.name?(h(ws.not_readable),_(ws.not_readable.msg[w])):(_(e.t0.message),h({code:e.t0.name||e.t0.code,message:e.t0.message})));case 19:return window.tv_last_req_camera_complete=!0,e.abrupt("return",null);case 21:case"end":return e.stop()}}),e,null,[[7,16]])})));return function(t){return e.apply(this,arguments)}}(),[a,f,w,h,b]),O=o(B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=s.length>0&&void 0!==s[0]?s[0]:y,o=s.length>1&&void 0!==s[1]&&s[1],!(null!=(a=p.current)&&null!==(t=a.srcObject)&&void 0!==t&&t.id&&null!=a&&null!==(r=a.srcObject)&&void 0!==r&&r.active&&T.current)){e.next=5;break}return e.abrupt("return");case 5:return a.oncanplaythrough=function(){a.play(),T.current=!0,_("");var e=window.innerWidth,t=window.innerHeight,r=ro.analyzeVideoAndWindowSizes(a),n=r.lostX,o=void 0===n?0:n,i=r.lostY,s=void 0===i?0:i,c=Math.min(e,Math.floor(e-2*o)),l=Math.min(t,Math.floor(t-2*s));u&&u({clientWidth:e,clientHeight:t,videoAreaWidth:c,videoAreaHeight:l,lostX:o,lostY:s})},e.next=8,N(n,o);case 8:(i=e.sent)||P.current||(P.current=!0,O(n,!0)),i&&x.current&&(p.current.srcObject=i,R()),i&&!x.current&&(a.srcObject=i);case 12:case"end":return e.stop()}}),e)}))),[p,N,u,y,R]);c((function(){function e(){return(e=B(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O();case 2:return e.next=4,Cs();case 4:t=e.sent,(r=t.filter((function(e){return"videoinput"===e.kind&&e.label.includes("back")&&e.label.includes("0")}))).length>0&&(n=r[0].deviceId,R(),O(n));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var t=p.current;return!Ts||gi.browserName&&["facebook"].includes(gi.browserName.toLowerCase())||gi.getUA.includes("Zalo iOS")?(_(ws.not_supported.msg[w]),h(ws.not_supported)):t&&(gi.isAndroid&&!1===a?function(){e.apply(this,arguments)}():O()),function(){x.current&&R()}}),[p,w,a,O,R,h]),c((function(){var e=setTimeout((function(){T.current||(_(ws.camera_timeout.msg[w]),h(ws.camera_timeout))}),15e3);return function(){clearTimeout(e)}}),[w,h]);var D=o((function(){R(),i&&i(),k({tag:"result",event:"user_activity.cancel",log:{}})}),[i,R,k]);return t.createElement(Bs,{id:"tv-camera-".concat(C.current),checkCameraMode:n},function(){if(!A)return null;var e=ws.no_permission.msg[w];return A===e&&gi.isIOS?t.createElement(_s,null,A," ",t.createElement("button",{onClick:function(){window.location.reload()}},{vi:"Cấp lại quyền truy cập camera",en:"Request camera permission"}[w])):t.createElement(_s,null,A)}(),t.createElement(Es,{ref:p,playsInline:!0,muted:!0,flipHorizontal:d,className:g,scale:v}),l,m?t.cloneElement(m,{onClick:D,"data-testid":"close-camera"}):t.createElement(As,{onClick:D,"data-testid":"close-camera"},t.createElement("img",{src:E,alt:""})))}Ps.propTypes={checkCameraMode:p.bool,frontCamera:p.bool,onClose:p.func,onError:p.func,onVideoPlayed:p.func,children:p.node,flipHorizontal:p.bool,videoSettings:p.object,refVideo:p.object,closeButton:p.node,videoClassName:p.string,scale:p.number,defaultCameraId:p.string,onWarning:p.func},Ps.defaultProps={checkCameraMode:!1,frontCamera:!0,onClose:null,onError:function(){},onVideoPlayed:null,children:null,flipHorizontal:!1,videoSettings:null,refVideo:null,closeButton:null,videoClassName:"",scale:1,defaultCameraId:void 0,onWarning:function(){}};var xs,Rs,Ns,Ls=function(e,r,n){class o extends i{constructor(){super(...arguments),this.updateDebounced=Ni(this.forceUpdate,r,n)}shouldComponentUpdate(){return this.updateDebounced(),!1}componentWillUnmount(){this.updateDebounced.cancel()}render(){return t.createElement(e,Object.assign({},this.props))}}return o.displayName=`debounceRender(${e.displayName||e.name||"Component"})`,bs(o,e)}(Ps,250),Os=t.forwardRef((function(e,r){return t.createElement(Ls,A({},e,{refVideo:r||Is}))})),Ds=h.table(xs||(xs=N(["\n width: 100%;\n height: 100%;\n td {\n text-align: center;\n vertical-align: middle;\n padding: 0;\n border: 0;\n }\n border-spacing: 0;\n table-layout: auto;\n border-collapse: collapse;\n"]))),Ms=h.div(Rs||(Rs=N(["\n position: relative;\n"]))),Us=Array.from(Array(3).keys()),Fs=Array.from(Array(3).keys());function js(e){var r=e.children,n=e.x,o=e.y,a=e.width,i=e.height,s=e.className,c=e.surroundStyle;return t.createElement(Ds,{className:s},t.createElement("tbody",null,Us.map((function(e,s){return t.createElement("tr",{key:e,style:{height:0===s?o:"auto"},"data-testid":"row"},Fs.map((function(e,o){var l=1===s&&1===o,u="auto";return l?u=a:0===o&&(u=n),t.createElement("td",{"data-testid":l?"centeredCell":"cell",key:e,style:I({width:u,height:l?i:"auto"},l?{}:c)},l?t.createElement(Ms,{style:{width:u,height:i}},r):null)})))}))))}js.propTypes={children:p.node,x:p.string,y:p.string,width:p.string,height:p.string,className:p.string,surroundStyle:p.object},js.defaultProps={children:null,x:"auto",y:"auto",width:"auto",height:"auto",className:"",surroundStyle:{}};var Vs=h(js)(Ns||(Ns=N(["\n background: transparent;\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: ",";\n"])),1010);function zs(e){var r=e.className;return t.createElement("svg",{className:r,width:"38px",height:"32px",viewBox:"0 0 24 21","data-testid":"camera-icon"},t.createElement("title",null,"FA45C15C-1E21-4D7B-9585-07FB9F999CB8"),t.createElement("desc",null,"Created with sketchtool."),t.createElement("g",{id:"Web-demo",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},t.createElement("g",{id:"step1",transform:"translate(-950.000000, -380.000000)",fill:"currentColor",fillRule:"nonzero"},t.createElement("g",{id:"Group",transform:"translate(950.000000, 380.000000)"},t.createElement("g",{id:"Group-2"},t.createElement("g",{id:"camera"},t.createElement("path",{d:"M21,3 L17,3 L15,0 L9,0 L7,3 L3,3 C1.34314575,3 0,4.34314575 0,6 L0,18 C0,19.6568542 1.34314575,21 3,21 L21,21 C22.6568542,21 24,19.6568542 24,18 L24,6 C24,4.34314575 22.6568542,3 21,3 Z M12,17 C9.23857625,17 7,14.7614237 7,12 C7,9.23857625 9.23857625,7 12,7 C14.7614237,7 17,9.23857625 17,12 C17,14.7614237 14.7614237,17 12,17 L12,17 Z",id:"Shape"})))))))}zs.propTypes={className:p.string},zs.defaultProps={className:""};var Ks=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Hs="object"==typeof pi&&pi&&pi.Object===Object&&pi,qs="object"==typeof self&&self&&self.Object===Object&&self,Qs=Hs||qs||Function("return this")(),Ws=function(){return Qs.Date.now()},Gs=/\s/;var Xs=function(e){for(var t=e.length;t--&&Gs.test(e.charAt(t)););return t},Ys=/^\s+/;var $s=function(e){return e?e.slice(0,Xs(e)+1).replace(Ys,""):e},Zs=Qs.Symbol,Js=Object.prototype,ec=Js.hasOwnProperty,tc=Js.toString,rc=Zs?Zs.toStringTag:void 0;var nc=function(e){var t=ec.call(e,rc),r=e[rc];try{e[rc]=void 0;var n=!0}catch(e){}var o=tc.call(e);return n&&(t?e[rc]=r:delete e[rc]),o},oc=Object.prototype.toString;var ac=function(e){return oc.call(e)},ic=Zs?Zs.toStringTag:void 0;var sc=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ic&&ic in Object(e)?nc(e):ac(e)};var cc=function(e){return null!=e&&"object"==typeof e};var lc=function(e){return"symbol"==typeof e||cc(e)&&"[object Symbol]"==sc(e)},uc=/^[-+]0x[0-9a-f]+$/i,dc=/^0b[01]+$/i,fc=/^0o[0-7]+$/i,pc=parseInt;var hc=function(e){if("number"==typeof e)return e;if(lc(e))return NaN;if(Ks(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ks(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=$s(e);var r=dc.test(e);return r||fc.test(e)?pc(e.slice(2),r?2:8):uc.test(e)?NaN:+e},mc=Math.max,gc=Math.min;var vc=function(e,t,r){var n,o,a,i,s,c,l=0,u=!1,d=!1,f=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var r=n,a=o;return n=o=void 0,l=t,i=e.apply(a,r)}function h(e){return l=e,s=setTimeout(g,t),u?p(e):i}function m(e){var r=e-c;return void 0===c||r>=t||r<0||d&&e-l>=a}function g(){var e=Ws();if(m(e))return v(e);s=setTimeout(g,function(e){var r=t-(e-c);return d?gc(r,a-(e-l)):r}(e))}function v(e){return s=void 0,f&&n?p(e):(n=o=void 0,i)}function y(){var e=Ws(),r=m(e);if(n=arguments,o=this,c=e,r){if(void 0===s)return h(c);if(d)return clearTimeout(s),s=setTimeout(g,t),p(c)}return void 0===s&&(s=setTimeout(g,t)),i}return t=hc(t)||0,Ks(r)&&(u=!!r.leading,a=(d="maxWait"in r)?mc(hc(r.maxWait)||0,t):a,f="trailing"in r?!!r.trailing:f),y.cancel=function(){void 0!==s&&clearTimeout(s),l=0,n=c=o=s=void 0},y.flush=function(){return void 0===s?i:v(Ws())},y};var yc=function(e,t,r){var n=!0,o=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return Ks(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),vc(e,t,{leading:n,maxWait:t,trailing:o})};var bc,Cc=function(e){if(!Ks(e))return!1;var t=sc(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},wc=Qs["__core-js_shared__"],kc=(bc=/[^.]+$/.exec(wc&&wc.keys&&wc.keys.IE_PROTO||""))?"Symbol(src)_1."+bc:"";var Bc=function(e){return!!kc&&kc in e},Ec=Function.prototype.toString;var Sc=function(e){if(null!=e){try{return Ec.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Ac=/^\[object .+?Constructor\]$/,_c=Function.prototype,Ic=Object.prototype,Tc=_c.toString,Pc=Ic.hasOwnProperty,xc=RegExp("^"+Tc.call(Pc).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Rc=function(e){return!(!Ks(e)||Bc(e))&&(Cc(e)?xc:Ac).test(Sc(e))};var Nc=function(e,t){return null==e?void 0:e[t]};var Lc=function(e,t){var r=Nc(e,t);return Rc(r)?r:void 0},Oc=function(){try{var e=Lc(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Dc=function(e,t,r){"__proto__"==t&&Oc?Oc(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r};var Mc=function(e,t){return e===t||e!=e&&t!=t},Uc=Object.prototype.hasOwnProperty;var Fc=function(e,t,r){var n=e[t];Uc.call(e,t)&&Mc(n,r)&&(void 0!==r||t in e)||Dc(e,t,r)};var jc=function(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a<i;){var s=t[a],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),o?Dc(r,s,c):Fc(r,s,c)}return r};var Vc=function(e){return e};var zc=function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)},Kc=Math.max;var Hc=function(e,t,r){return t=Kc(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=Kc(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=n[o];return s[t]=r(i),zc(e,this,s)}};var qc=function(e){return function(){return e}},Qc=Oc?function(e,t){return Oc(e,"toString",{configurable:!0,enumerable:!1,value:qc(t),writable:!0})}:Vc,Wc=Date.now;var Gc=function(e){var t=0,r=0;return function(){var n=Wc(),o=16-(n-r);if(r=n,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(Qc);var Xc=function(e,t){return Gc(Hc(e,t,Vc),e+"")};var Yc=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var $c=function(e){return null!=e&&Yc(e.length)&&!Cc(e)},Zc=/^(?:0|[1-9]\d*)$/;var Jc=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&Zc.test(e))&&e>-1&&e%1==0&&e<t};var el=function(e,t,r){if(!Ks(r))return!1;var n=typeof t;return!!("number"==n?$c(r)&&Jc(t,r.length):"string"==n&&t in r)&&Mc(r[t],e)};var tl=function(e){return Xc((function(t,r){var n=-1,o=r.length,a=o>1?r[o-1]:void 0,i=o>2?r[2]:void 0;for(a=e.length>3&&"function"==typeof a?(o--,a):void 0,i&&el(r[0],r[1],i)&&(a=o<3?void 0:a,o=1),t=Object(t);++n<o;){var s=r[n];s&&e(t,s,n,a)}return t}))};var rl=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n};var nl=function(e){return cc(e)&&"[object Arguments]"==sc(e)},ol=Object.prototype,al=ol.hasOwnProperty,il=ol.propertyIsEnumerable,sl=nl(function(){return arguments}())?nl:function(e){return cc(e)&&al.call(e,"callee")&&!il.call(e,"callee")},cl=Array.isArray;var ll=function(){return!1},ul=mi((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?Qs.Buffer:void 0,a=(o?o.isBuffer:void 0)||ll;e.exports=a})),dl={};dl["[object Float32Array]"]=dl["[object Float64Array]"]=dl["[object Int8Array]"]=dl["[object Int16Array]"]=dl["[object Int32Array]"]=dl["[object Uint8Array]"]=dl["[object Uint8ClampedArray]"]=dl["[object Uint16Array]"]=dl["[object Uint32Array]"]=!0,dl["[object Arguments]"]=dl["[object Array]"]=dl["[object ArrayBuffer]"]=dl["[object Boolean]"]=dl["[object DataView]"]=dl["[object Date]"]=dl["[object Error]"]=dl["[object Function]"]=dl["[object Map]"]=dl["[object Number]"]=dl["[object Object]"]=dl["[object RegExp]"]=dl["[object Set]"]=dl["[object String]"]=dl["[object WeakMap]"]=!1;var fl=function(e){return cc(e)&&Yc(e.length)&&!!dl[sc(e)]};var pl=function(e){return function(t){return e(t)}},hl=mi((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r&&Hs.process,a=function(){try{var e=n&&n.require&&n.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a})),ml=hl&&hl.isTypedArray,gl=ml?pl(ml):fl,vl=Object.prototype.hasOwnProperty;var yl=function(e,t){var r=cl(e),n=!r&&sl(e),o=!r&&!n&&ul(e),a=!r&&!n&&!o&&gl(e),i=r||n||o||a,s=i?rl(e.length,String):[],c=s.length;for(var l in e)!t&&!vl.call(e,l)||i&&("length"==l||o&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Jc(l,c))||s.push(l);return s},bl=Object.prototype;var Cl=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||bl)};var wl=function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t},kl=Object.prototype.hasOwnProperty;var Bl=function(e){if(!Ks(e))return wl(e);var t=Cl(e),r=[];for(var n in e)("constructor"!=n||!t&&kl.call(e,n))&&r.push(n);return r};var El=function(e){return $c(e)?yl(e,!0):Bl(e)},Sl=tl((function(e,t,r,n){jc(t,El(t),e,n)}));var Al=function(e,t){return function(r){return e(t(r))}},_l=Al(Object.getPrototypeOf,Object),Il=Function.prototype,Tl=Object.prototype,Pl=Il.toString,xl=Tl.hasOwnProperty,Rl=Pl.call(Object);var Nl=function(e){if(!cc(e)||"[object Object]"!=sc(e))return!1;var t=_l(e);if(null===t)return!0;var r=xl.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Pl.call(r)==Rl};var Ll=function(e){if(!cc(e))return!1;var t=sc(e);return"[object Error]"==t||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Nl(e)},Ol=Xc((function(e,t){try{return zc(e,void 0,t)}catch(e){return Ll(e)?e:new Error(e)}}));var Dl=function(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o};var Ml=function(e,t){return Dl(t,(function(t){return e[t]}))},Ul=Object.prototype,Fl=Ul.hasOwnProperty;var jl=function(e,t,r,n){return void 0===e||Mc(e,Ul[r])&&!Fl.call(n,r)?t:e},Vl={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var zl=function(e){return"\\"+Vl[e]},Kl=Al(Object.keys,Object),Hl=Object.prototype.hasOwnProperty;var ql=function(e){if(!Cl(e))return Kl(e);var t=[];for(var r in Object(e))Hl.call(e,r)&&"constructor"!=r&&t.push(r);return t};var Ql=function(e){return $c(e)?yl(e):ql(e)},Wl=/<%=([\s\S]+?)%>/g;var Gl=function(e){return function(t){return null==e?void 0:e[t]}}({"&":"&","<":"<",">":">",'"':""","'":"'"}),Xl=Zs?Zs.prototype:void 0,Yl=Xl?Xl.toString:void 0;var $l=function e(t){if("string"==typeof t)return t;if(cl(t))return Dl(t,e)+"";if(lc(t))return Yl?Yl.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r};var Zl=function(e){return null==e?"":$l(e)},Jl=/[&<>"']/g,eu=RegExp(Jl.source);var tu={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:Wl,variable:"",imports:{_:{escape:function(e){return(e=Zl(e))&&eu.test(e)?e.replace(Jl,Gl):e}}}},ru=/\b__p \+= '';/g,nu=/\b(__p \+=) '' \+/g,ou=/(__e\(.*?\)|\b__t\)) \+\n'';/g,au=/[()=,{}\[\]\/\s]/,iu=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,su=/($^)/,cu=/['\n\r\u2028\u2029\\]/g,lu=Object.prototype.hasOwnProperty;var uu=function(e,t,r){var n=tu.imports._.templateSettings||tu;r&&el(e,t,r)&&(t=void 0),e=Zl(e),t=Sl({},t,n,jl);var o,a,i=Sl({},t.imports,n.imports,jl),s=Ql(i),c=Ml(i,s),l=0,u=t.interpolate||su,d="__p += '",f=RegExp((t.escape||su).source+"|"+u.source+"|"+(u===Wl?iu:su).source+"|"+(t.evaluate||su).source+"|$","g"),p=lu.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/\s/g," ")+"\n":"";e.replace(f,(function(t,r,n,i,s,c){return n||(n=i),d+=e.slice(l,c).replace(cu,zl),r&&(o=!0,d+="' +\n__e("+r+") +\n'"),s&&(a=!0,d+="';\n"+s+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),l=c+t.length,t})),d+="';\n";var h=lu.call(t,"variable")&&t.variable;if(h){if(au.test(h))throw new Error("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(a?d.replace(ru,""):d).replace(nu,"$1").replace(ou,"$1;"),d="function("+(h||"obj")+") {\n"+(h?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var m=Ol((function(){return Function(s,p+"return "+d).apply(void 0,c)}));if(m.source=d,Ll(m))throw m;return m},du=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,fu=/^\w*$/;var pu=function(e,t){if(cl(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!lc(e))||(fu.test(e)||!du.test(e)||null!=t&&e in Object(t))},hu=Lc(Object,"create");var mu=function(){this.__data__=hu?hu(null):{},this.size=0};var gu=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},vu=Object.prototype.hasOwnProperty;var yu=function(e){var t=this.__data__;if(hu){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return vu.call(t,e)?t[e]:void 0},bu=Object.prototype.hasOwnProperty;var Cu=function(e){var t=this.__data__;return hu?void 0!==t[e]:bu.call(t,e)};var wu=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=hu&&void 0===t?"__lodash_hash_undefined__":t,this};function ku(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ku.prototype.clear=mu,ku.prototype.delete=gu,ku.prototype.get=yu,ku.prototype.has=Cu,ku.prototype.set=wu;var Bu=ku;var Eu=function(){this.__data__=[],this.size=0};var Su=function(e,t){for(var r=e.length;r--;)if(Mc(e[r][0],t))return r;return-1},Au=Array.prototype.splice;var _u=function(e){var t=this.__data__,r=Su(t,e);return!(r<0)&&(r==t.length-1?t.pop():Au.call(t,r,1),--this.size,!0)};var Iu=function(e){var t=this.__data__,r=Su(t,e);return r<0?void 0:t[r][1]};var Tu=function(e){return Su(this.__data__,e)>-1};var Pu=function(e,t){var r=this.__data__,n=Su(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function xu(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}xu.prototype.clear=Eu,xu.prototype.delete=_u,xu.prototype.get=Iu,xu.prototype.has=Tu,xu.prototype.set=Pu;var Ru=xu,Nu=Lc(Qs,"Map");var Lu=function(){this.size=0,this.__data__={hash:new Bu,map:new(Nu||Ru),string:new Bu}};var Ou=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Du=function(e,t){var r=e.__data__;return Ou(t)?r["string"==typeof t?"string":"hash"]:r.map};var Mu=function(e){var t=Du(this,e).delete(e);return this.size-=t?1:0,t};var Uu=function(e){return Du(this,e).get(e)};var Fu=function(e){return Du(this,e).has(e)};var ju=function(e,t){var r=Du(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function Vu(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Vu.prototype.clear=Lu,Vu.prototype.delete=Mu,Vu.prototype.get=Uu,Vu.prototype.has=Fu,Vu.prototype.set=ju;var zu=Vu;function Ku(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(Ku.Cache||zu),r}Ku.Cache=zu;var Hu=Ku;var qu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qu=/\\(\\)?/g,Wu=function(e){var t=Hu(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(qu,(function(e,r,n,o){t.push(n?o.replace(Qu,"$1"):r||e)})),t}));var Gu=function(e,t){return cl(e)?e:pu(e,t)?[e]:Wu(Zl(e))};var Xu=function(e){if("string"==typeof e||lc(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var Yu=function(e,t){for(var r=0,n=(t=Gu(t,e)).length;null!=e&&r<n;)e=e[Xu(t[r++])];return r&&r==n?e:void 0};var $u=function(e,t,r){var n=null==e?void 0:Yu(e,t);return void 0===n?r:n},Zu=V.Errors;function Ju(e){var t=e.livenessSettings,r=e.apiClient,n=e.apiCheck,o=e.onError,a=L(s({face_tracking_setting:{enable:!1,web_terminate_threshold:.0030152991993743408,web_warning_threshold:.0017317430600108828,limit_for:"all_flow",max_warning_time:5},flow_interval_time_ms:3e3,limit_time_liveness_check:{enable:!1,limit_time_second:45},terminate_if_no_face:{enable:!1,max_invalid_frame:5,max_time_ms:1e3}}),2),i=a[0],l=a[1];return c((function(){t?l(I({},t)):n&&r.clientSettings().then((function(e){if(e&&e.data){var t,r=$u(e,"data.settings.sdk_settings.server_log_settings.enable"),n=$u(e,"data.settings.sdk_settings.active_liveness_settings"),a=$u(n,"save_encoded_frames",{});a.enable&&(t={enable:!0,framesIntervalTime:a.frames_interval_ms,framesBatchLength:a.frames_batch_len}),l(I(I({},n),{},{enableTracking:r,captureFrameSettings:t}))}e&&e.errors&&o(Zu.server_error)})).catch((function(e){o(e)}))}),[t,r,o,n]),i}var ed=function(e){var t=e.curStep,r=e.faceDirection,n=$u(t,"stepTimeConstraints.delayTime");return!!n&&(null===t.firstFrameSpottedAt?(t.name===r&&(t.firstFrameSpottedAt=(new Date).getTime()),!0):(new Date).getTime()-t.firstFrameSpottedAt<n)};var td=function(e){return e?Infinity===(e=hc(e))||-Infinity===e?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var rd=function(e){var t=td(e),r=t%1;return t==t?r?t-r:t:0};var nd=function(e,t){var r;if("function"!=typeof t)throw new TypeError("Expected a function");return e=rd(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}};var od=function(e){return nd(2,e)};function ad(){return(ad=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{},r=t.blazefaceModelUrl,n=t.tfScriptUrls,e.next=3,oi.loadTensorFlow(n);case 3:return e.next=5,oi.initTensorFlow({preferredBackends:["wasm","webgl","cpu"]});case 5:return e.next=7,oi.loadBlazefaceModel({modelUrl:r});case 7:return o=e.sent,e.abrupt("return",{blazefaceModel:o});case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var id,sd,cd,ld,ud,dd,fd,pd=od((function(){return ad.apply(this,arguments)})),hd=[],md=function(){hd=[]},gd=function(e,t,r){r&&md(),hd.push({id:null});var n=hd.length-1;t.httpClient.post("/v1/files",{frames:e,metadata:JSON.stringify({type:"selfie"})}).then((function(e){e&&e.data&&e.data.file_id?hd[n].id=e.data.file_id:hd[n].id=-1}))},vd=function(){return new Promise((function(e){var t=setInterval((function(){hd.every((function(e){return e.id}))&&(e(),clearInterval(t))}),200)}))},yd=function(e){return e.enable?hd.some((function(e){return-1===e.id}))?null:hd:[]},bd=yo.faceTracker(),Cd=V.Mode,wd=V.FaceDirection,kd=V.Errors,Bd=V.Messages,Ed=V.TrackLivenessEvents;function Sd(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=t.apiCheck,i=t.mode,u=t.bgCameraMask,d=t.bgCameraMaskRed,f=t.surroundStyle,p=t.cropAreaDimension,h=t.customInstructions,m=t.customIcon,g=t.customDirectionIcon,v=t.customStepTimeConstraints,y=void 0===v?(S(e={},V.FaceDirection.UP,{delayTime:0}),S(e,V.FaceDirection.LEFT,{delayTime:0}),S(e,V.FaceDirection.RIGHT,{delayTime:0}),S(e,V.FaceDirection.FRONTAL,{delayTime:2e3}),e):v,b=t.onLivenessDetectionDone,C=t.onError,k=t.frontalMinSize,E=t.waitingTimeToGetBetterFrames,A=void 0===E?500:E,_=t.captureFrameSettings,T=void 0===_?{enable:!1,framesIntervalTime:180,framesBatchLength:0}:_,P=t.livenessSettings,x=t.setRemainingTime,R=void 0===x?function(){}:x,N=t.onProcessing,D=void 0===N?function(){}:N,M=t.customErrors,U=t.customMessages,F=t.apiCredentials,j=void 0===F?{}:F,z=t.onFramesCaptured,K=void 0===z?function(){}:z,H=t.initFirstGestureTimeout,q=void 0===H?2e3:H,Q=t.outputEncryptionSettings,W=t.cameraScale,G=void 0===W?1:W,X=t.passiveModeAuto,Y=void 0!==X&&X,$=t.sendCustomEvent,Z=s(!1),J=L(Z,2),ee=J[0],te=J[1],re=s(!1),ne=L(re,2),oe=ne[0],ae=ne[1],ie=s(!1),se=L(ie,2),ce=se[0],le=se[1],ue=r(null),de=Qr.useSDKSettings(),fe=de.lang,pe=de.assetRoot,he=de.customUrls,me=La.useApiClient({apiCredentials:j}),ge=me.apiClient,ve=i===Cd.ACTIVE,ye=l((function(e){return e+1}),0),be=L(ye,2),Ce=(be[0],be[1]),we=r(null),ke=r(!1),Be=s(!1),Ee=L(Be,2),Se=Ee[0],Ae=Ee[1],_e=r({}),Ie=Sn.useSDKTracking(),Te=Ie.sendEvent,Pe=r(null);null===Pe.current&&(Pe.current=yo.initFaceVerificationData({assetRoot:pe,customInstructions:h,customIcon:m,customDirectionIcon:g,customStepTimeConstraints:y}));var xe=s(),Re=L(xe,2),Ne=Re[0],Le=Re[1],Oe=n((function(){return yc(Le,500)}),[Le]),De=r([]),Me=r(),Ue=r(),Fe=Ju({livenessSettings:P,apiClient:ge,apiCheck:a,onError:C}),je=Fe.face_tracking_setting,Ve=Fe.flow_interval_time_ms,ze=Fe.limit_time_liveness_check,Ke=Fe.terminate_if_no_face,He=Fe.captureFrameSettings,qe=void 0===He?T:He,Qe=Fe.enableTracking,We=n((function(){return yc((function(e){a&&!Qe||null==e||!e.event||(Te(e),$&&$(e))}),2e3)}),[a,Qe,Te,$]),Ge=r(0),Xe=r();c((function(){We({tag:"selfie",event:null==Ed?void 0:Ed.start_camera,log:{}})}),[We]),c((function(){var e=!1;function t(){return(t=B(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Se){t.next=13;break}return Ue.current=performance.now(),t.next=4,pd(he);case 4:return _e.current=t.sent,t.next=7,oi.initTensorFlow({preferredBackends:["wasm","webgl","cpu"]});case 7:if(!e){t.next=9;break}return t.abrupt("return");case 9:Ae(!0),We({tag:"selfie",event:null==Ed?void 0:Ed.show_warmup,log:{}}),We({tag:"selfie",event:null==Ed?void 0:Ed.finish_load_model,log:{status:"success",time_in_ms:performance.now()-Ue.current}}),Ue.current=null;case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return function(){t.apply(this,arguments)}(),function(){e=!0}}),[Se,he,We]);var Ye=o((function(){R(""),Pe.current.curStepIndex=Pe.current.steps.length,ae(!1),setTimeout((function(){Pe.current=yo.initFaceVerificationData({assetRoot:pe,customInstructions:h,customIcon:m,customDirectionIcon:g}),Me.current=Date.now(),Ge.current=0,Xe.current=null,De.current=[],le(!1),md(),Ce()}),Ve)}),[pe,h,m,g,Ve,R]),$e=r(null),Ze=n((function(){return I(I({},kd),M)}),[M]),Je=n((function(){return I(I({},Bd),U)}),[U]),et=400;c((function(){if(ee&&ze.enable&&ce){Me.current=Date.now();var e=ze.limit_time_second+1,t=ze.remain_time_show||10,r=ze.format||"s";$e.current=setInterval((function(){var n=Math.round((1e3*e-(Date.now()-Me.current))/1e3);if(Pe.current.curStepIndex<Pe.current.steps.length){if(n<=t&&n>=1){var o=uu(Je.REMAIN_TIME[fe]),a=n;switch(r){case"mm:ss":a=n.toString().padStart(5,"00:00");break;case"ss":a=n.toString().padStart(2,"0")}R(o({x:a}))}if(Math.round((Date.now()-Me.current)/1e3)===e){var i,s={};Object.keys(null===(i=Ze.liveness_terminated_time_out)||void 0===i?void 0:i.msg).forEach((function(e){var t,r=uu(null===(t=Ze.liveness_terminated_time_out)||void 0===t?void 0:t.msg[e]);s[e]=r({x:ze.limit_time_second})})),Le(I(I({},Ze.liveness_terminated_time_out),{},{msg:s,duration:Ve})),We({tag:"selfie",event:null==Ed?void 0:Ed.show_alert,log:{alert:"liveness_terminated_time_out,"}}),Ye()}}}),1e3)}return function(){clearInterval($e.current)}}),[Ye,R,ee,fe,Ve,ze.enable,ze.limit_time_second,ce,Ze.liveness_terminated_time_out,Je.REMAIN_TIME,ze.format,ze.remain_time_show,We]);var tt=o((function(e){var t,r,n=e.clientWidth,o=e.clientHeight,a=e.videoAreaWidth,i=e.videoAreaHeight,s=e.lostX,c=e.lostY;gi.isMobile?r=t=a:t=r=i-200;var l=Math.floor((a-t)/2)+s,d=5+c,h=u;we.current={x:l,y:d,width:t,height:r,image:h,surroundStyle:f},"object"===w(p)?we.current=I(I({},we.current),p):"function"==typeof p&&(we.current=I(I({},we.current),p({clientWidth:n,clientHeight:o,videoAreaWidth:a,videoAreaHeight:i,lostX:s,lostY:c,isMobile:gi.isMobile,width:t,height:r}))),Ce(),te(!0)}),[u,f,p]),rt=s(3),nt=L(rt,2),ot=nt[0],at=nt[1],it=s(!1),st=L(it,2),ct=st[0],lt=st[1],ut=r(!1),dt=o((function(e){lt(e),ut.current=e}),[]),ft=r(null),pt=r([]),ht=o((function(){at(3),clearInterval(ft.current),dt(!0);var e=function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,i,s,c,l,u,d,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t-1!=0){e.next=17;break}return clearInterval(ft.current),r=pt.current,D(),n=r.map((function(e){return Ca.resizeBlobImg(e.blob,et,et)})),e.next=7,Promise.all(n);case 7:if(o=e.sent,i={},!Q||!Q.key){e.next=16;break}return s=Q.key,c=o.map((function(e){return ci.encrypt({blob:e,key:s})})),e.next=14,Promise.all(c);case 14:l=e.sent,i={frontalFacesEncrypted:l};case 16:a?(u=O(De.current),d=function(e){return{label:"portrait",metadata:JSON.stringify({gesture_score:e,gesture:wd.FRONTAL})}},f=r.map((function(e,t){return ge.uploadImage(I({file:o[t]},d(e.leftRightScore)))})),Q&&Q.key&&(f=r.map((function(e,t){return ge.httpClient.post("/v1/images",I({base64:i.frontalFacesEncrypted[t].hex},d(e.leftRightScore)),{"X-TV-Key":Q.key})}))),Promise.all(f).then((function(e){return ge.verifyFaceLiveness({images:e.map((function(e){return{id:e.data.image_id}})),videos:[{frames:u}]})})).then((function(e){b({apiCheckPassed:e.data.is_live,verifyFaceLivenessResult:e.data})})).catch((function(e){C({error:e})}))):b(I(I({frontalFaces:o},i),{},{capturedFrames:De.current}));case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();ft.current=setInterval((function(){at((function(t){return e(t),t-1}))}),1e3)}),[dt,a,b,ge,C,D,Q]);c((function(){Ne&&(clearInterval(ft.current),dt(!1),pt.current=[])}),[Ne,dt]),c((function(){var e,t=ue.current,r=function(){var e=B(regeneratorRuntime.mark((function e(){var t,r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Pe.current.steps,r=[],t.forEach((function(e){var t=e.name,n=e.image,o=e.frontalFaceImage;if(t!==wd.FRONTAL){var a={label:"portrait",metadata:JSON.stringify({gesture_score:n.leftRightScore,gesture:t})};Q&&Q.key?r.push(ge.httpClient.post("/v1/images",I({base64:n.encrypted.hex},a),{"X-TV-Key":Q.key})):r.push(ge.uploadImage(I({file:n.blob},a)))}else r.push(Promise.resolve({data:{image_id:null}}));if(o.blob){var i={label:"portrait",metadata:JSON.stringify({gesture_score:o.leftRightScore,gesture:wd.FRONTAL})};Q&&Q.key?r.push(ge.httpClient.post("/v1/images",I({base64:o.encrypted.hex},i),{"X-TV-Key":Q.key})):r.push(ge.uploadImage(I({file:o.blob},i)))}else r.push(Promise.resolve({data:{image_id:null}}))})),e.next=5,Promise.all(r);case 5:n=e.sent,t.forEach((function(e,t){e.image.imageId=n[2*t].data.image_id,e.frontalFaceImage.imageId=n[2*t+1].data.image_id}));case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),n=function(){var e=B(regeneratorRuntime.mark((function e(){var t,n,o,a,i,s,c,l,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r();case 3:if(t=Pe.current.steps,0!==(n=t.filter((function(e){return e.frontalFaceImage.imageId}))).length){e.next=9;break}b({error:"wrong_face_movement"}),e.next=26;break;case 9:return e.next=11,vd();case 11:if(o=yd(qe)){e.next=16;break}b({error:"network_error"}),e.next=26;break;case 16:return a=ge.verifyFaceLiveness({images:n.map((function(e){return{id:e.frontalFaceImage.imageId}})),gesture_images:t.filter((function(e){return e.image.imageId&&e.name!==wd.FRONTAL})).map((function(e){return{gesture:e.name,images:[{id:e.image.imageId}]}})),videos:o}),i=ge.requestVerifyPortrait({image:{id:n[n.length-1].frontalFaceImage.imageId}}),e.next=20,Promise.all([a,i]);case 20:s=e.sent,c=L(s,2),l=c[0],u=c[1],d=!0===l.data.is_live,b({apiCheckPassed:d,verifyFaceLivenessResult:l.data,verifyFacePortraitResult:u.data,frontalFaces:n.map((function(e){return{id:e.frontalFaceImage.imageId,blob:e.frontalFaceImage.blob}})),steps:t.filter((function(e){return e.image.imageId&&e.name!==wd.FRONTAL})).map((function(e){var t=e.name,r=e.image;return{name:t,blob:r.blob,id:r.imageId}}))});case 26:e.next=31;break;case 28:e.prev=28,e.t0=e.catch(0),C({error:e.t0});case 31:case"end":return e.stop()}}),e,null,[[0,28]])})));return function(){return e.apply(this,arguments)}}(),o=function(){var e=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=Pe.current.steps,r=[],t.map((function(e){return r.push({name:e.name,blob:e.image.blob}),e.frontalFaceImage.blob&&r.push({name:e.name,blob:e.frontalFaceImage.blob}),0})),n=r.map((function(e){return Ca.resizeBlobImg(e.blob,et,et)})),e.next=6,Promise.all(n);case 6:return o=e.sent,a=r.map((function(e,t){return{name:e.name,blob:o[t]}})),e.next=10,Promise.all(t.map(function(){var e=B(regeneratorRuntime.mark((function e(r,n){var o,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=a.filter((function(e){return e.name===r.name})),t[n].image.blob=o[0].blob,r.frontalFaceImage.blob&&(t[n].frontalFaceImage.blob=o[1].blob),!Q||!Q.key){e.next=12;break}return i=Q.key,e.next=7,ci.encrypt({blob:o[0].blob,key:i});case 7:if(t[n].image.encrypted=e.sent,!r.frontalFaceImage.blob){e.next=12;break}return e.next=11,ci.encrypt({blob:o[1].blob,key:i});case 11:t[n].frontalFaceImage.encrypted=e.sent;case 12:return e.abrupt("return",0);case 13:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()));case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),i=function(){var e=B(regeneratorRuntime.mark((function e(){var t,r,i,s,c,l,u,d,f,p,h,m,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Pe.current.steps,i=r[Pe.current.curStepIndex],S(t={},V.FaceDirection.UP,null==Ed?void 0:Ed.capture_up_face),S(t,V.FaceDirection.LEFT,null==Ed?void 0:Ed.capture_left_face),S(t,V.FaceDirection.RIGHT,null==Ed?void 0:Ed.capture_right_face),S(t,V.FaceDirection.FRONTAL,null==Ed?void 0:Ed.capture_frontal_face),We({tag:"selfie",event:t[i.name],log:{time_capture_in_seconds:((performance.now()-Ue.current)/1e3).toFixed(1)}}),Pe.current.curStepIndex++,Ue.current=performance.now(),je.enable&&"each_gesture"===je.limit_for&&(Ge.current=0),Pe.current.curStepIndex!==r.length){e.next=37;break}if(ze.enable&&R(""),!b){e.next=37;break}return qe.enable&&qe.framesBatchLength>0&&De.current.length%qe.framesBatchLength>0&&(K(De.current.slice(De.current.length%qe.framesBatchLength*-1).map((function(e){return{base64:e.base64,label:e.label,index:e.index}}))),a&&gd(De.current.slice(De.current.length%qe.framesBatchLength*-1),ge)),We({tag:"selfie",event:null==Ed?void 0:Ed.finish_capture,log:{time_capture_in_seconds:((Date.now()-Me.current)/1e3).toFixed(1)}}),D(),e.next=15,o();case 15:if(a){e.next=35;break}if(d=r.filter((function(e){return e.name!==wd.FRONTAL})).map((function(e){return{name:e.name,image:{blob:e.image.blob,encrypted:e.image.encrypted}}})),f=r.filter((function(e){return e.name!==wd.FRONTAL})).map((function(e){return e.frontalFaceImage.blob})).filter((function(e){return null!==e})),p=r.filter((function(e){return e.name!==wd.FRONTAL})).map((function(e){return e.frontalFaceImage.encrypted})).filter((function(e){return e&&e.hex})),h=null===(s=r.find((function(e){return e.name===wd.FRONTAL})))||void 0===s||null===(c=s.image)||void 0===c?void 0:c.blob,m=null===(l=r.find((function(e){return e.name===wd.FRONTAL})))||void 0===l||null===(u=l.image)||void 0===u?void 0:u.encrypted,!h||!k){e.next=27;break}return e.next=24,Ca.scaleImage(h,{minSize:k});case 24:e.t0=e.sent,e.next=28;break;case 27:e.t0=null;case 28:g=e.t0,h&&f.push(h),m&&p.push(m),We({tag:"result",event:null==Ed?void 0:Ed.liveness_detection_done,log:{result_object:{steps:d,frontalFaces:f,frontalScaledImage:g}}}),b({steps:d,frontalFaces:f,frontalFacesEncrypted:p,frontalScaledImage:g,capturedFrames:De.current}),e.next=37;break;case 35:return e.next=37,n();case 37:Ce();case 38:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),s=vc((function(){var e=Pe.current,t=e.curStepIndex,r=e.steps,n=r[t],o=null!==(null==n?void 0:n.image.blob),a=null!==(null==n?void 0:n.frontalFaceImage.blob),s=r.filter((function(e){return e.frontalFaceImage.blob})).length,c=!1;return o&&(a||![1].includes(t)||s>=1)?(ke.current=!1,i(),c=!0):ke.current=!(!o||a),ae(!1),c}),A);function c(e,t,r,n){return l.apply(this,arguments)}function l(){return(l=B(regeneratorRuntime.mark((function e(t,r,n,o){var a,c,l,u,d,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=Pe.current,c=a.curStepIndex,l=a.steps,!(c<l.length)){e.next=24;break}if(u=l[c],!ed({faceDirection:t,curStep:u})){e.next=5;break}return e.abrupt("return");case 5:if(t!==wd.FRONTAL||null!==u.frontalFaceImage.blurScore&&!eo.hasBetterBlurScore(n,u.frontalFaceImage.blurScore)){e.next=13;break}return u.frontalFaceImage.blurScore=n,e.next=9,ro.takePicture({canvas:r});case 9:d=e.sent,u.frontalFaceImage.blob=d,u.frontalFaceImage.leftRightScore=o,ke.current&&(ke.current=!1,i());case 13:if(u.name!==t||null!==u.image.blurScore&&!eo.hasBetterBlurScore(n,u.image.blurScore)){e.next=24;break}return ae(!0),u.image.blurScore=n,e.next=18,ro.takePicture({canvas:r});case 18:f=e.sent,u.image.blob=f,u.image.leftRightScore=o,u.image.objUrl&&URL.revokeObjectURL(u.image.objUrl),u.image.objUrl=URL.createObjectURL(f),s();case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(e,t,r){return p.apply(this,arguments)}function p(){return(p=B(regeneratorRuntime.mark((function e(t,r,n){var o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!0===ut.current&&t===wd.FRONTAL&&pt.current.length<3)){e.next=5;break}return e.next=3,ro.takePicture({canvas:r});case 3:o=e.sent,pt.current.push({blob:o,leftRightScore:n});case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(e,t,r,n){if(De.current.length&&Date.now()-De.current[De.current.length-1].time<qe.framesIntervalTime)return null;if(qe.enable&&!n){var o=e.topLeft,i=e.bottomRight,s=[].concat(O(o),O(i)),c=[];[o,i].forEach((function(e){c=[].concat(O(c),[e[0]/ko.SIZE*t.width,e[1]/ko.SIZE*t.height])}));var l=bd(e,0===De.current.length),u=l.score,d=l.time,f=t.toDataURL("image/jpeg",.8);return De.current.push({label:"portrait",base64:f.split(",")[1],landmarks:r,original_landmarks:r.map((function(e){return[e[0]/ko.SIZE*t.width,e[1]/ko.SIZE*t.height]})),score:u,time:d,index:De.current.length,bbox:s,original_bbox:c}),qe.framesBatchLength>0&&De.current.length%qe.framesBatchLength==0&&K&&(K(De.current.slice(-qe.framesBatchLength).map((function(e){return{base64:e.base64,label:e.label,index:e.index}}))),a&&gd(De.current.slice(-qe.framesBatchLength),ge,De.current.length===qe.framesBatchLength)),u}return null}function m(e){if(!je.enable||null===e||!ce)return!0;var t=je.web_warning_threshold,r=je.web_terminate_threshold,n=je.max_warning_time;return e<t||(e<r&&Ge.current<n?(Ge.current++,Ge.current===n?(Le(I(I({},Ze.liveness_terminated_face_tracking),{},{duration:Ve})),We({tag:"selfie",event:null==Ed?void 0:Ed.show_alert,log:{alert:"liveness_terminated_face_tracking"}})):Le(I(I({},Ze.liveness_too_fast),{},{duration:1500})),!0):(Le(I(I({},Ze.liveness_terminated),{},{duration:Ve})),We({tag:"selfie",event:null==Ed?void 0:Ed.show_alert,log:{alert:"liveness_terminated"}}),Ye(),!1))}function g(e){if(Ke.enable&&ce){var t=Ke.max_time_ms;Xe.current&&e||(Xe.current={time:Date.now(),frame:0}),e&&Xe.current.frame++;var r=Xe.current.time;e&&Date.now()-r>=t&&(Le(I(I({},Ze.liveness_terminated_no_face),{},{duration:Ve})),We({tag:"selfie",event:null==Ed?void 0:Ed.show_alert,log:{alert:"liveness_terminated_no_face"}}),Ye())}}function v(e,t){return y.apply(this,arguments)}function y(){return(y=B(regeneratorRuntime.mark((function r(n,o){var a,i,s,l,p,y,b,C,w,k,B,E,S,A,_,I,T,P,x,R,N;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(0!==(null==o?void 0:o.width)&&0!==(null==o?void 0:o.height)){r.next=2;break}return r.abrupt("return");case 2:return a=n.cropX,i=n.cropY,s=n.cropWidth,l=n.cropHeight,o.getContext("2d").drawImage(t,a,i,s,l,-(s*G-s)/2/G,-(l*G-l)/2/G,s,l),p=_e.current.blazefaceModel,r.next=8,eo.calculateBlurScore(o);case 8:return y=r.sent,r.next=11,ko.getModelPredictions({model:p,sCanvas:o});case 11:return b=r.sent,r.next=14,yo.validatePredictions({predictions:b,width:ko.SIZE,height:ko.SIZE});case 14:if(C=r.sent,w=C.error,k=C.fullFace,we.current.image=u,E=null,S=null,A=null,_=Pe.current,I=_.curStepIndex,T=_.steps,!k){r.next=29;break}return P=T[I],A=k.landmarks,r.next=27,yo.calculateFaceDirection({landmarks:A,getPerfectFrontal:P&&P.name===wd.FRONTAL});case 27:(x=r.sent)&&(E=x.gesture,S=x.leftRightScore);case 29:if(R="no_face"===(null==w?void 0:w.code)||"partial_face"===(null==w?void 0:w.code),N=I<T.length,g(R&&N),null!=w&&w.code&&We({tag:"selfie",event:null==Ed?void 0:Ed.show_alert,log:{alert:w.code}}),w&&("face_too_small"!==w.code||![wd.DOWN,wd.UP,wd.LEFT,wd.RIGHT].includes(E))){r.next=55;break}if(ve||h(b[0],o,A),!ve){r.next=43;break}if(ce||(le(!0),Ue.current=performance.now(),Me.current=Date.now()),!m(h(b[0],o,A,I>=T.length))){r.next=41;break}return r.next=41,c(E,o,y,S);case 41:r.next=53;break;case 43:if(![wd.LEFT,wd.RIGHT].includes(E)){r.next=48;break}B=Ze.not_frontal_face,we.current.image=d,r.next=53;break;case 48:if(w){r.next=53;break}return ce||le(!0),Y&&!ut.current&&0===pt.current.length&&setTimeout((function(){ht()}),500),r.next=53,f(E,o,S);case 53:r.next=56;break;case 55:I<T.length&&(B=Ze[w.code],we.current.image=d);case 56:Oe(B),-1!==e&&(e=requestAnimationFrame((function(){return v(n,o)})));case 58:case"end":return r.stop()}}),r)})))).apply(this,arguments)}function w(){return(w=B(regeneratorRuntime.mark((function e(){var r,n,o,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=ro.analyzeVideoAndWindowSizes(t,we.current),n=r.cropWidth,o=r.cropHeight,(a=document.createElement("canvas")).width=n,a.height=o,(i=a.getContext("2d")).translate(n,0),i.scale(-1*G,1*G),v(r,a);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return ee&&Se&&setTimeout((function(){!function(){w.apply(this,arguments)}()}),q),function(){cancelAnimationFrame(e),e=-1}}),[q,ee,fe,ve,ge,a,u,d,b,C,k,A,qe,D,je,ze.enable,R,Oe,Ve,Ye,Ke,ce,Ze,Se,We,K,Q,G,ht,Y]);var mt=Pe.current,gt=mt.curStepIndex,vt=mt.steps,yt=n((function(){return vt.find((function(e){return e.name===V.FaceDirection.FRONTAL}))}),[vt]),bt=ke.current?yt:vt[gt],Ct=bt&&ce?bt.instructions[fe]:null,wt=bt&&ce?bt.directionIcon:"",kt=bt?bt.directionIconAnimation:"";return{countdownToTakePicture:ot,cropArea:we,curStepIndex:gt,directionIcon:wt,directionIconAnimation:kt,faceDetectionError:Ne,handleTriggerPassiveMode:ht,handleVideoPlayed:tt,instructions:Ct,isActiveMode:ve,refVideo:ue,showCountdown:ct,steps:vt,videoPlayed:ee,activeCapturing:oe,isFirstValidFrameFound:ce,warmupDone:Se}}var Ad=(S(id={},V.FaceDirection.LEFT,90),S(id,V.FaceDirection.RIGHT,270),S(id,V.FaceDirection.UP,180),S(id,V.FaceDirection.DOWN,0),id),_d=g(["0%{opacity:0.15;}50%{opacity:0.3;}100%{opacity:1;}"]),Id=h.div(sd||(sd=N(["\n width: 200px;\n height: 200px;\n position: relative;\n transform: scale(0.48);\n\n .top,\n .right,\n .bottom,\n .left {\n position: absolute;\n }\n\n .top {\n top: 0;\n left: 50%;\n transform: rotate(","deg) translateX(-50%);\n }\n\n .right {\n right: 0;\n top: 50%;\n transform: rotate(","deg) translateX(-50%);\n }\n\n .bottom {\n bottom: 0;\n left: 50%;\n transform: rotate(","deg) translateX(50%);\n }\n\n .left {\n left: 0;\n top: 50%;\n transform: rotate(","deg) translateX(50%);\n }\n"])),Ad[V.FaceDirection.DOWN],Ad[V.FaceDirection.LEFT],Ad[V.FaceDirection.UP],Ad[V.FaceDirection.RIGHT]),Td=h.div(cd||(cd=N(["\n width: 70px;\n transform: rotate(","deg);\n"])),(function(e){var t,r=e.direction;return null!==(t=Ad[r])&&void 0!==t?t:0})),Pd=h.span(ld||(ld=N(["\n display: flex;\n margin: 4px 0;\n width: 100%;\n height: 15px;\n animation: "," 1s infinite;\n animation-direction: alternate;\n\n &::before,\n &::after {\n content: '';\n height: 100%;\n width: 50%;\n background: rgba(255, 255, 255, 0.8);\n }\n\n &::before {\n transform: skewY(32deg);\n }\n\n &::after {\n width: 50%;\n transform: skewY(-32deg);\n }\n"])),_d),xd=h(Pd)(ud||(ud=N(["\n animation-delay: 0s;\n"]))),Rd=h(Pd)(dd||(dd=N(["\n animation-delay: 0.5s;\n"]))),Nd=h(Pd)(fd||(fd=N(["\n animation-delay: 1s;\n"])));function Ld(e){var r=e.type;return r!==V.FaceDirection.FRONTAL?t.createElement(Td,{direction:r},t.createElement(xd,null),t.createElement(Rd,null),t.createElement(Nd,null)):t.createElement(Id,null,t.createElement(Td,{className:"top"},t.createElement(xd,null),t.createElement(Rd,null),t.createElement(Nd,null)),t.createElement(Td,{className:"right"},t.createElement(xd,null),t.createElement(Rd,null),t.createElement(Nd,null)),t.createElement(Td,{className:"bottom"},t.createElement(xd,null),t.createElement(Rd,null),t.createElement(Nd,null)),t.createElement(Td,{className:"left"},t.createElement(xd,null),t.createElement(Rd,null),t.createElement(Nd,null)))}Ld.propTypes={type:p.oneOf([V.FaceDirection.LEFT,V.FaceDirection.RIGHT,V.FaceDirection.UP,V.FaceDirection.FRONTAL])},Ld.defaultProps={type:V.FaceDirection.LEFT};var Od,Dd=V.ErrorDuration;function Md(e){var r=e.children,n=e.errorMsg,o=e.className;return t.isValidElement(r)?n?t.createElement("div",{className:o},t.cloneElement(r,{errorMsg:n})):null:n?t.createElement("div",{className:o},n):null}function Ud(e){var t=e.children,n=e.className,o=e.error,a=r(0),i=r(""),s=Qr.useSDKSettings().lang,c=r(Dd.SHORT),l=o||{},u=l.msg,d=l.duration,f=void 0===d?Dd.SHORT:d,p=null==u?void 0:u[s];return Date.now()-a.current>=c.current?(a.current=Date.now(),c.current=f,i.current=p,Md({children:t,errorMsg:p,className:n})):Md({children:t,errorMsg:i.current,className:n})}Ud.propTypes={children:p.node,className:p.string},Ud.defaultProps={className:""};var Fd=h.circle(Od||(Od=N(["\n transition: stroke-dashoffset 0.4s;\n transform: rotate(-90deg);\n transform-origin: 50% 50%;\n"])));function jd(e){var r=e.className,n=e.style,o=e.radius,a=e.strokeWidth,i=e.progress,s=e.hasError,c=e.activeColor,l=e.innerPadding,u=e.outsideRingColor,d=e.outsideRingOpacity,f=e.insideRingColor,p=e.insideRingWidth,h=e.insideRingStrokeDash,m=e.errorRingWidth,g=e.errorRingColor,v=e.dashedRingColor,y=e.dashedRingOpacity,b=e.dashedRingWidth,C=e.dashedRingLineThick,w=e.dashedRingLineSpacing,k=e.dashedInsideRingColor,B=e.dashedInsideRingWidth,E=e.showOutsideRing,S=e.showInsideRing,A=e.showDashedRing,_=2*o,I=2*o,T=o-2*a,P=2*Math.PI*T,x=P-i/100*P,R=T-b/2-a/2-l,N=2*Math.PI*R,L=N-i/100*N,O=R-B/2-b/2,D=2*Math.PI*O,M=D-i/100*D,U=O-p/2-B/2,F=O-m/2-B/2;return t.createElement("svg",{className:r,style:n,width:_,height:I,viewBox:"0 0 ".concat(_," ").concat(I),fill:"none",xmlns:"http://www.w3.org/2000/svg"},E?t.createElement(t.Fragment,null,t.createElement("circle",{"data-testid":"outsideRing",opacity:d,cx:o,cy:o,r:T,stroke:u}),t.createElement(Fd,{"data-testid":"outsideAnimateRing",cx:o,cy:o,r:T,stroke:c,strokeWidth:a,strokeLinecap:"round",strokeDasharray:"".concat(P," ").concat(P),style:{strokeDashoffset:x}})):null,A?t.createElement(t.Fragment,null,t.createElement("circle",{"data-testid":"dashedRing",opacity:y,cx:o,cy:o,r:R,stroke:v,strokeWidth:b,strokeDasharray:"".concat(C," ").concat(w)}),t.createElement("mask",{id:"mask0","mask-type":"alpha",maskUnits:"userSpaceOnUse"},t.createElement("circle",{cx:o,cy:o,r:R,stroke:c,strokeWidth:b,strokeDasharray:"".concat(C," ").concat(w)})),t.createElement("g",{mask:"url(#mask0)"},t.createElement(Fd,{"data-testid":"dashedAnimateRing",cx:o,cy:o,r:R,stroke:c,strokeWidth:b,strokeDasharray:"".concat(N," ").concat(N),style:{strokeDashoffset:L}})),t.createElement("circle",{"data-testid":"dashedInsideRing",opacity:y,cx:o,cy:o,r:O,stroke:k,strokeWidth:B}),t.createElement(Fd,{"data-testid":"dashedInsideAnimateRing",cx:o,cy:o,r:O,stroke:c,strokeWidth:B,strokeLinecap:"round",strokeDasharray:"".concat(D," ").concat(D),style:{strokeDashoffset:M}})):null,S?t.createElement("circle",{"data-testid":"insideRing",strokeDasharray:h,cx:o,cy:o,r:U,stroke:f,strokeWidth:p}):null,s?t.createElement("circle",{"data-testid":"errorRing",strokeDasharray:h,cx:o,cy:o,r:F,stroke:g,strokeWidth:m}):null)}function Vd(e){var r=e.className;return t.createElement("svg",{className:r,width:"320",height:"320",viewBox:"0 0 320 320",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M320 0H0V320H320V0ZM160 296C235.111 296 296 235.111 296 160C296 84.8893 235.111 24 160 24C84.8893 24 24 84.8893 24 160C24 235.111 84.8893 296 160 296Z",fill:"currentColor"}))}function zd(){return(zd=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)}jd.propTypes={className:p.string,style:p.shape({}),radius:p.number,strokeWidth:p.number,progress:p.number,hasError:p.bool,activeColor:p.string,innerPadding:p.number,outsideRingColor:p.string,outsideRingOpacity:p.number,insideRingColor:p.string,insideRingWidth:p.number,insideRingStrokeDash:p.string,errorRingColor:p.string,errorRingWidth:p.number,dashedRingColor:p.string,dashedRingOpacity:p.number,dashedRingWidth:p.number,dashedRingLineThick:p.number,dashedRingLineSpacing:p.number,dashedInsideRingColor:p.string,dashedInsideRingWidth:p.number,showOutsideRing:p.bool,showDashedRing:p.bool,showInsideRing:p.bool},jd.defaultProps={className:"",style:null,radius:160,strokeWidth:3,progress:0,hasError:!1,activeColor:"#0092ff",innerPadding:5,outsideRingColor:"#f2f6f9",outsideRingOpacity:.1,insideRingColor:"#f2f6f9",insideRingWidth:3,insideRingStrokeDash:"0",errorRingColor:"#df0000",errorRingWidth:3,dashedRingColor:"#ffffff",dashedRingOpacity:.3,dashedRingWidth:10,dashedRingLineThick:1,dashedRingLineSpacing:6,dashedInsideRingColor:"#ffffff",dashedInsideRingWidth:0,showOutsideRing:!0,showDashedRing:!0,showInsideRing:!0},Vd.propTypes={className:p.string},Vd.defaultProps={className:""};var Kd,Hd,qd="undefined"!=typeof window?f:c,Qd={popupContent:{tooltip:{position:"absolute",zIndex:999},modal:{position:"relative",margin:"auto"}},popupArrow:{height:"8px",width:"16px",position:"absolute",background:"transparent",color:"#FFF",zIndex:-1},overlay:{tooltip:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0",zIndex:999},modal:{position:"fixed",top:"0",bottom:"0",left:"0",right:"0",display:"flex",zIndex:999}}},Wd=["top left","top center","top right","right top","right center","right bottom","bottom left","bottom center","bottom right","left top","left center","left bottom"],Gd=function(e,t,r,n,o){var a=o.offsetX,i=o.offsetY,s=n?8:0,c=r.split(" "),l=e.top+e.height/2,u=e.left+e.width/2,d=t.height,f=t.width,p=l-d/2,h=u-f/2,m="",g="0%",v="0%";switch(c[0]){case"top":p-=d/2+e.height/2+s,m="rotate(180deg) translateX(50%)",g="100%",v="50%";break;case"bottom":p+=d/2+e.height/2+s,m="rotate(0deg) translateY(-100%) translateX(-50%)",v="50%";break;case"left":h-=f/2+e.width/2+s,m=" rotate(90deg) translateY(50%) translateX(-25%)",v="100%",g="50%";break;case"right":h+=f/2+e.width/2+s,m="rotate(-90deg) translateY(-150%) translateX(25%)",g="50%"}switch(c[1]){case"top":p=e.top,g=e.height/2+"px";break;case"bottom":p=e.top-d+e.height,g=d-e.height/2+"px";break;case"left":h=e.left,v=e.width/2+"px";break;case"right":h=e.left-f+e.width,v=f-e.width/2+"px"}return{top:p="top"===c[0]?p-i:p+i,left:h="left"===c[0]?h-a:h+a,transform:m,arrowLeft:v,arrowTop:g}},Xd=function(e,t,r,n,o,a){var i=o.offsetX,s=o.offsetY,c={arrowLeft:"0%",arrowTop:"0%",left:0,top:0,transform:"rotate(135deg)"},l=0,u=function(e){var t={top:0,left:0,width:window.innerWidth,height:window.innerHeight};if("string"==typeof e){var r=document.querySelector(e);null!==r&&(t=r.getBoundingClientRect())}return t}(a),d=Array.isArray(r)?r:[r];for((a||Array.isArray(r))&&(d=[].concat(d,Wd));l<d.length;){var f={top:(c=Gd(e,t,d[l],n,{offsetX:i,offsetY:s})).top,left:c.left,width:t.width,height:t.height};if(!(f.top<=u.top||f.left<=u.left||f.top+f.height>=u.top+u.height||f.left+f.width>=u.left+u.width))break;l++}return c},Yd=0,$d=u((function(e,n){var o=e.trigger,a=void 0===o?null:o,i=e.onOpen,l=void 0===i?function(){}:i,u=e.onClose,f=void 0===u?function(){}:u,p=e.defaultOpen,h=void 0!==p&&p,m=e.open,g=void 0===m?void 0:m,v=e.disabled,y=void 0!==v&&v,b=e.nested,w=void 0!==b&&b,k=e.closeOnDocumentClick,B=void 0===k||k,E=e.repositionOnResize,S=void 0===E||E,A=e.closeOnEscape,_=void 0===A||A,I=e.on,T=void 0===I?["click"]:I,P=e.contentStyle,x=void 0===P?{}:P,R=e.arrowStyle,N=void 0===R?{}:R,L=e.overlayStyle,O=void 0===L?{}:L,D=e.className,M=void 0===D?"":D,U=e.position,F=void 0===U?"bottom center":U,j=e.modal,V=void 0!==j&&j,z=e.lockScroll,K=void 0!==z&&z,H=e.arrow,q=void 0===H||H,Q=e.offsetX,W=void 0===Q?0:Q,G=e.offsetY,X=void 0===G?0:G,Y=e.mouseEnterDelay,$=void 0===Y?100:Y,Z=e.mouseLeaveDelay,J=void 0===Z?100:Z,ee=e.keepTooltipInside,te=void 0!==ee&&ee,re=e.children,ne=s(g||h),oe=ne[0],ae=ne[1],ie=r(null),se=r(null),ce=r(null),le=r(null),ue=r("popup-"+ ++Yd),de=!!V||!a,fe=r(0);qd((function(){return oe?(le.current=document.activeElement,Ee(),we(),be()):Ce(),function(){clearTimeout(fe.current)}}),[oe]),c((function(){"boolean"==typeof g&&(g?pe():he())}),[g,y]);var pe=function(e){oe||y||(ae(!0),setTimeout((function(){return l(e)}),0))},he=function(e){var t;oe&&!y&&(ae(!1),de&&(null===(t=le.current)||void 0===t||t.focus()),setTimeout((function(){return f(e)}),0))},me=function(e){null==e||e.stopPropagation(),oe?he(e):pe(e)},ge=function(e){clearTimeout(fe.current),fe.current=setTimeout((function(){return pe(e)}),$)},ve=function(e){null==e||e.preventDefault(),me()},ye=function(e){clearTimeout(fe.current),fe.current=setTimeout((function(){return he(e)}),J)},be=function(){de&&K&&(document.getElementsByTagName("body")[0].style.overflow="hidden")},Ce=function(){de&&K&&(document.getElementsByTagName("body")[0].style.overflow="auto")},we=function(){var e,t=null==se||null===(e=se.current)||void 0===e?void 0:e.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),r=Array.prototype.slice.call(t)[0];null==r||r.focus()};d(n,(function(){return{open:function(){pe()},close:function(){he()},toggle:function(){me()}}}));var ke,Be,Ee=function(){if(!de&&oe&&(null==ie?void 0:ie.current)&&(null==ie?void 0:ie.current)&&(null==se?void 0:se.current)){var e,t,r=ie.current.getBoundingClientRect(),n=se.current.getBoundingClientRect(),o=Xd(r,n,F,q,{offsetX:W,offsetY:X},te);if(se.current.style.top=o.top+window.scrollY+"px",se.current.style.left=o.left+window.scrollX+"px",q&&ce.current)ce.current.style.transform=o.transform,ce.current.style.setProperty("-ms-transform",o.transform),ce.current.style.setProperty("-webkit-transform",o.transform),ce.current.style.top=(null===(e=N.top)||void 0===e?void 0:e.toString())||o.arrowTop,ce.current.style.left=(null===(t=N.left)||void 0===t?void 0:t.toString())||o.arrowLeft}};void 0===(Be=_)&&(Be=!0),c((function(){if(Be){var e=function(e){"Escape"===e.key&&ke(e)};return document.addEventListener("keyup",e),function(){Be&&document.removeEventListener("keyup",e)}}}),[ke=he,Be]),function(e,t){void 0===t&&(t=!0),c((function(){if(t){var r=function(t){if(9===t.keyCode){var r,n=null==e||null===(r=e.current)||void 0===r?void 0:r.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]'),o=Array.prototype.slice.call(n);if(1===o.length)return void t.preventDefault();var a=o[0],i=o[o.length-1];t.shiftKey&&document.activeElement===a?(t.preventDefault(),i.focus()):document.activeElement===i&&(t.preventDefault(),a.focus())}};return document.addEventListener("keydown",r),function(){t&&document.removeEventListener("keydown",r)}}}),[e,t])}(se,oe&&de),function(e,t){void 0===t&&(t=!0),c((function(){if(t){var r=function(){e()};return window.addEventListener("resize",r),function(){t&&window.removeEventListener("resize",r)}}}),[e,t])}(Ee,S),function(e,t,r){void 0===r&&(r=!0),c((function(){if(r){var n=function(r){var n=Array.isArray(e)?e:[e],o=!1;n.forEach((function(e){e.current&&!e.current.contains(r.target)||(o=!0)})),r.stopPropagation(),o||t(r)};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n),function(){r&&(document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n))}}}),[e,t,r])}(a?[se,ie]:[se],he,B&&!w);var Se,Ae=function(){return t.createElement("div",Object.assign({},(e=de?Qd.popupContent.modal:Qd.popupContent.tooltip,r={className:"popup-content "+(""!==M?M.split(" ").map((function(e){return e+"-content"})).join(" "):""),style:zd({},e,x,{pointerEvents:"auto"}),ref:se,onClick:function(e){e.stopPropagation()}},!V&&T.indexOf("hover")>=0&&(r.onMouseEnter=ge,r.onMouseLeave=ye),r),{key:"C",role:de?"dialog":"tooltip",id:ue.current}),q&&!de&&t.createElement("div",{ref:ce,style:Qd.popupArrow},t.createElement("svg",{"data-testid":"arrow",className:"popup-arrow "+(""!==M?M.split(" ").map((function(e){return e+"-arrow"})).join(" "):""),viewBox:"0 0 32 16",style:zd({position:"absolute"},N)},t.createElement("path",{d:"M16 0l16 16H0z",fill:"currentcolor"}))),re&&"function"==typeof re?re(he,oe):re);var e,r},_e=!(T.indexOf("hover")>=0),Ie=de?Qd.overlay.modal:Qd.overlay.tooltip,Te=[_e&&t.createElement("div",{key:"O","data-testid":"overlay","data-popup":de?"modal":"tooltip",className:"popup-overlay "+(""!==M?M.split(" ").map((function(e){return e+"-overlay"})).join(" "):""),style:zd({},Ie,O,{pointerEvents:B&&w||de?"auto":"none"}),onClick:B&&w?he:void 0,tabIndex:-1},de&&Ae()),!de&&Ae()];return t.createElement(t.Fragment,null,function(){for(var e={key:"T",ref:ie,"aria-describedby":ue.current},r=Array.isArray(T)?T:[T],n=0,o=r.length;n<o;n++)switch(r[n]){case"click":e.onClick=me;break;case"right-click":e.onContextMenu=ve;break;case"hover":e.onMouseEnter=ge,e.onMouseLeave=ye;break;case"focus":e.onFocus=ge,e.onBlur=ye}if("function"==typeof a){var i=a(oe);return!!a&&t.cloneElement(i,e)}return!!a&&t.cloneElement(a,e)}(),oe&&C.createPortal(Te,(null===(Se=document.getElementById("popup-root"))&&((Se=document.createElement("div")).setAttribute("id","popup-root"),document.body.appendChild(Se)),Se)))})),Zd=v(Kd||(Kd=N(["\n .popup-content {\n margin: auto;\n background: #fff;\n width: 100%;\n padding: 5px;\n border: 1px solid #d7d7d7;\n max-width: 568px;\n border-radius: 10px;\n }\n\n [role=tooltip].popup-content {\n width: 200px;\n box-shadow: 0 0 3px rgba(0, 0, 0, .16);\n border-radius: 5px\n }\n\n .popup-overlay {\n background: rgba(0, 0, 0, .5);\n padding: 10px;\n }\n\n [data-popup=tooltip].popup-overlay {\n background: transparent\n }\n\n .popup-arrow {\n -webkit-filter: drop-shadow(0 -3px 3px rgba(0, 0, 0, .16));\n filter: drop-shadow(0 -3px 3px rgba(0, 0, 0, .16));\n color: #fff;\n stroke-width: 2px;\n stroke: #d7d7d7;\n stroke-dasharray: 30px;\n stroke-dashoffset: -54px;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0\n }\n"]))),Jd=["open","children","overlayStyle"],ef=function(e){var r=e.open,n=e.children,o=e.overlayStyle,a=R(e,Jd);return t.createElement(t.Fragment,null,t.createElement($d,A({overlayStyle:I(I({},o),{},{zIndex:2e3}),closeOnDocumentClick:!1,closeOnEscape:!1,modal:!0,open:r},a),n),t.createElement(Zd,null))};ef.propTypes={open:p.bool,children:p.node,overlayStyle:p.shape({})},ef.defaultProps={open:!1,children:null,overlayStyle:{}};var tf,rf,nf,of,af,sf,cf,lf,uf,df,ff,pf,hf,mf,gf,vf,yf={WARMUP_INTRO:{en:"Warming up... Please wait a moment",vi:"Đang khởi động, vui lòng chờ trong giây lát..."}},bf=h.div(Hd||(Hd=N(["\n font-size: 18px;\n text-align: center;\n padding: 10px;\n"]))),Cf=function(e){var r=e.contentStyle,n=Qr.useSDKSettings(),o=n.lang,a=n.warmupMessage,i=a?a[o]:yf.WARMUP_INTRO[o];return t.createElement(ef,{open:!0,contentStyle:r},t.createElement(bf,{className:"warmup-message"},i))};Cf.propTypes={contentStyle:p.shape({})},Cf.defaultProps={contentStyle:{}};var wf=y(["z-index:",";color:#ffffff;"],1020),kf=h.div(tf||(tf=N(["\n ","\n"])),wf),Bf=h(Ud)(rf||(rf=N(["\n ","\n ","\n ","\n ","\n font-size: 18px;\n background: #ea3223;\n color: #fff;\n padding: 5px 10px;\n border-radius: 3px;\n position: absolute;\n white-space: pre-wrap;\n text-align: center;\n max-width: 80%;\n"])),wf,(function(e){var t=e.top;return t&&y(["top:","px;"],t)}),(function(e){var t=e.bottom;return t&&y(["bottom:","px;"],t)}),(function(e){return e.centerY&&y(["top:50%;transform:translateY(-50%);"])})),Ef=h(kf)(nf||(nf=N(["\n ","\n font-size: 18px;\n background: #ea3223;\n color: #fff;\n padding: 5px 10px;\n border-radius: 3px;\n position: absolute;\n left: 50%;\n transform: translate(-50%, 0);\n white-space: nowrap;\n"])),(function(e){var t=e.top;return t&&y(["top:","px;"],t)})),Sf=h(kf)(of||(of=N(["\n position: absolute;\n ","\n ","\n font-size: ",";\n text-shadow: 2px 2px 4px #000000;\n"])),(function(e){var t=e.top;return t&&y(["top:","px;"],t)}),(function(e){var t=e.bottom;return t&&y(["bottom:","px;"],t)}),(function(){return gi.isMobile?"20px":"22px"})),Af=h.div(af||(af=N(["\n height: ",";\n position: absolute;\n ","\n ","\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: ",";\n"])),(function(){return gi.isMobile?"50px":"70px"}),(function(e){var t=e.top;return t&&y(["top:","px;"],t)}),(function(e){var t=e.bottom;return t&&y(["bottom:","px;"],t)}),1020),_f=h.div(sf||(sf=N(["\n width: ",";\n height: ",";\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n border: 2px solid #ffffff;\n font-size: 16px;\n color: #fff;\n font-weight: 700;\n\n & + & {\n margin-left: 10px;\n }\n\n ","\n img {\n width: 100%;\n margin: 0;\n border-radius: 50%;\n }\n"])),(function(){return gi.isMobile?"40px":"50px"}),(function(){return gi.isMobile?"40px":"50px"}),(function(e){return!e.active&&y(["opacity:0.6;"])})),If=h.div(cf||(cf=N(["\n color: #ffffff;\n height: 70px;\n position: absolute;\n bottom: 0;\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: ",";\n"])),1020),Tf=h.div(lf||(lf=N(["\n cursor: pointer;\n text-align: center;\n width: 50px;\n\n img {\n width: 100%;\n }\n"]))),Pf=h.div(uf||(uf=N(["\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #ffffff;\n font-size: 140px;\n opacity: 0.6;\n"]))),xf=h.div(df||(df=N(["\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"]))),Rf=h(jd)(ff||(ff=N(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),Nf=h(Vd)(pf||(pf=N(["\n width: 100%;\n height: 100%;\n vertical-align: middle;\n margin: 0;\n color: ",";\n"])),(function(e){var t=e.color;return null!=t?t:"rgba(0, 0, 0, 0.6)"})),Lf=h.div(hf||(hf=N(["\n position: absolute;\n z-index: -1;\n background: rgba(223, 0, 0, 0.2);\n border-radius: 50%;\n width: 86%;\n height: 86%;\n top: 7%;\n left: 7%;\n"]))),Of=g(["from{opacity:1;}to{opacity:0;}"]),Df=h.div(mf||(mf=N(["\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 0;\n z-index: -1;\n background: rgba(255, 255, 255, 0.3);\n animation: "," 1s infinite;\n border-radius: 50%;\n"])),Of),Mf=gi.isMobile?{width:{ideal:640}}:null,Uf={background:"#000000",opacity:.6};function Ff(e){var r=e.apiCheck,n=e.mode,a=e.onLivenessDetectionDone,i=e.onClose,c=e.onError,l=e.captureFrameSettings,u=e.onFramesCaptured,d=e.frontCamera,f=e.customDirectionIcon,p=e.customStepTimeConstraints,h=e.onProcessing,m=e.customErrors,g=e.livenessSettings,v=e.apiCredentials,y=e.outputEncryptionSettings,b=e.cameraScale,C=e.defaultCameraId,w=e.passiveModeAuto,k=e.offsetFaceY,B=In.useAsset("bg_camera_mask.png"),E=In.useAsset("bg_camera_mask_red.png"),S=L(s({}),2),A=S[0],_=S[1],I=A.yFaceDetectionError,T=A.yFaceVerificationStepsWrapper,P=L(s(""),2),x=P[0],R=P[1],N=o((function(e){var t=e.lostY,r=e.height,n=e.clientHeight,o=t+25,a=o+30;_({yFaceDetectionError:o,yFaceVerificationStepsWrapper:a+r+20});var i=Math.floor(t),s=Math.floor(n-t),l=Math.floor(a);return l+k<i||l+k+r>s?c({code:"offsetFaceY must be in [-".concat(l-i,", ").concat(s-r-l,"]")}):l+=k,{y:l}}),[k,c]),O=Sd({apiCheck:r,mode:n,bgCameraMask:B,bgCameraMaskRed:E,surroundStyle:Uf,onLivenessDetectionDone:a,onError:c,cropAreaDimension:N,customDirectionIcon:f,captureFrameSettings:l,onFramesCaptured:u,livenessSettings:g,setRemainingTime:R,customStepTimeConstraints:p,onProcessing:h,customErrors:m,apiCredentials:v,outputEncryptionSettings:y,cameraScale:b,passiveModeAuto:w}),D=O.countdownToTakePicture,M=O.cropArea,U=O.curStepIndex,F=O.directionIcon,j=O.faceDetectionError,V=O.handleTriggerPassiveMode,z=O.handleVideoPlayed,K=O.instructions,H=O.isActiveMode,q=O.refVideo,Q=O.showCountdown,W=O.steps,G=O.videoPlayed,X=O.activeCapturing,Y=O.isFirstValidFrameFound,$=O.warmupDone;return t.createElement(Os,{frontCamera:d,onVideoPlayed:z,onClose:i,flipHorizontal:d,ref:q,videoSettings:Mf,onError:c,scale:b,defaultCameraId:C},!$&&t.createElement(Cf,null),G?t.createElement(t.Fragment,null,t.createElement(Bf,{top:I-15,className:"face-detection-error",error:j}),M.current?t.createElement(Vs,{x:"".concat(M.current.x,"px"),y:"".concat(M.current.y,"px"),width:"".concat(M.current.width,"px"),height:"".concat(M.current.height,"px"),surroundStyle:M.current.surroundStyle},t.createElement(Nf,null),t.createElement(Rf,{progress:U/W.length*100,hasError:!!j,showDashedRing:!1,showOutsideRing:!1,insideRingWidth:1,errorRingWidth:1,insideRingStrokeDash:"2"}),Q?t.createElement(Pf,null,D):null,H?t.createElement(t.Fragment,null,t.createElement(xf,null,F),X&&t.createElement(Df,null)):null,j&&t.createElement(Lf,null)):null,H?t.createElement(t.Fragment,null,x&&t.createElement(Ef,{top:T-30},x),K?t.createElement(Sf,{top:T+5,className:"instructions"},K):null,Y&&t.createElement(Af,{top:T+35},W.map((function(e,r){var n=e.name,o=e.image.objUrl;return t.createElement(_f,{key:n,active:U>=r,className:"step-item"},o?t.createElement("img",{src:o,alt:""}):t.createElement("span",null,r+1))})))):t.createElement(t.Fragment,null,!Y||j||w?null:t.createElement(If,null,t.createElement(Tf,{onClick:V},t.createElement(zs,null))))):null)}Ff.propTypes={apiCheck:p.bool,mode:p.string,onLivenessDetectionDone:p.func,onClose:p.func,onError:p.func,captureFrameSettings:p.shape({}),onFramesCaptured:p.func,frontCamera:p.bool,customDirectionIcon:p.shape({}),customStepTimeConstraints:p.shape({}),onProcessing:p.func,customErrors:p.shape({}),livenessSettings:p.shape({}),apiCredentials:p.shape({accessKey:p.string,secretKey:p.string,apiUrl:p.string}),outputEncryptionSettings:p.shape({}),cameraScale:p.number,defaultCameraId:p.string,passiveModeAuto:p.bool,offsetFaceY:p.number},Ff.defaultProps={apiCheck:!1,mode:null,onLivenessDetectionDone:null,onClose:null,onError:function(){},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:function(){},frontCamera:!0,customDirectionIcon:(gf={},S(gf,V.FaceDirection.LEFT,t.createElement(Ld,{type:V.FaceDirection.LEFT})),S(gf,V.FaceDirection.RIGHT,t.createElement(Ld,{type:V.FaceDirection.RIGHT})),S(gf,V.FaceDirection.UP,t.createElement(Ld,{type:V.FaceDirection.UP})),S(gf,V.FaceDirection.FRONTAL,t.createElement(Ld,{type:V.FaceDirection.FRONTAL})),gf),customStepTimeConstraints:(vf={},S(vf,V.FaceDirection.UP,{delayTime:0}),S(vf,V.FaceDirection.LEFT,{delayTime:0}),S(vf,V.FaceDirection.RIGHT,{delayTime:0}),S(vf,V.FaceDirection.FRONTAL,{delayTime:2e3}),vf),onProcessing:function(){},customErrors:null,livenessSettings:null,apiCredentials:{accessKey:"5767c20d-87aa-4cad-8dbb-f5429f76c34b",secretKey:"c1446919-e60a-4575-a05d-304318212a1b",apiUrl:"https://tv-testing.trustingsocial.com/api"},outputEncryptionSettings:null,cameraScale:1,defaultCameraId:void 0,passiveModeAuto:!1,offsetFaceY:0};var jf,Vf=Object.freeze({__proto__:null,Text:kf,FaceDetectionError:Bf,CountdownTime:Ef,FaceVerificationInstructions:Sf,FaceVerificationStepsWrapper:Af,StepItem:_f,BottomButtonsOverlay:If,Button:Tf,CountDownOverlay:Pf,InstructionsOverlay:xf,default:Ff,useLivenessDetection:Sd}),zf=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.frontCamera,n=void 0===r||r,o=document.createElement("div");document.body.appendChild(o);var a=function(){C.unmountComponentAtNode(o)};return new Promise((function(e){C.render(t.createElement(Qr.SDKSettingsProvider,{value:{lang:"en"}},t.createElement(Os,{checkCameraMode:!0,frontCamera:n,onVideoPlayed:function(){a(),e(null)},onClose:a,onError:function(t){a(),e(t)}})),o)}))},Kf=h.input(jf||(jf=N(["\n display: none;\n"]))),Hf=u((function(e,r){var n=e.useFileBrowse,a=e.accept,i=e.frontCamera,s=e.onCaptureDone,c=e.outputEncryptionSettings,l=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.target.files,!s){e.next=8;break}if(n=r[0],!c||!c.key){e.next=7;break}return e.next=6,ci.encrypt({blob:n,key:c.key});case 6:o=e.sent;case 7:s({file:n,encrypted:o});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[s,c]);return t.createElement(Kf,A({ref:r,type:"file",accept:a,onChange:l},n?{}:{capture:i?"user":"environment"}))}));Hf.propTypes={useFileBrowse:p.bool,accept:p.string,frontCamera:p.bool,onCaptureDone:p.func,outputEncryptionSettings:p.shape({key:p.string})},Hf.defaultProps={useFileBrowse:!1,accept:"image/*",frontCamera:!1,onCaptureDone:null,outputEncryptionSettings:{key:""}};var qf,Qf=Object.freeze({__proto__:null,Camera:zs}),Wf="landscape",Gf="portrait",Xf="desktop",Yf=V.Errors,$f=h.div(qf||(qf=N(["\n text-align: center;\n font-size: 20px;\n font-weight: 600;\n"])));function Zf(e){var n=e.children,o=Qr.useSDKSettings().lang,a=Yf.wrong_orientation.msg[o],i=function(){var e=r(screen.width>screen.height?Wf:Gf),t=L(s(e.current),2),n=t[0],o=t[1];return c((function(){function e(){screen.width>screen.heightt?o(Wf):o(Gf)}return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),gi.isMobile?{curOrientation:n,initOrientation:e.current}:{curOrientation:Xf}}().curOrientation;return t.createElement(t.Fragment,null,i===Wf&&t.createElement(ef,{open:!0},t.createElement($f,null,a)),(i===Gf||i===Xf)&&t.createElement(t.Fragment,null,n))}var Jf=["tracking","clientSettings","livenessSettings","livenessComponent"];function ep(e){var r=e.tracking,n=void 0===r?{enable:!0}:r,o=e.clientSettings,a=e.livenessSettings,i=e.livenessComponent,s=void 0===i?Ff:i,c=R(e,Jf),l=$u(o,"data.settings.sdk_settings.active_liveness_settings",a),u=$u(o,"data.settings.sdk_settings.server_log_settings.enable",n.enable);return t.createElement(Zf,null,t.createElement(Sn.SDKTrackingProvider,{value:{tracking:I(I({},n),{},{enable:u})}},t.createElement(s,A({},c,{livenessSettings:l}))))}function tp(){return(tp=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 rp(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function np(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function op(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var ap=!1,ip=t.createContext(null),sp="entering",cp="entered",lp=function(e){function r(t,r){var n;n=e.call(this,t,r)||this;var o,a=r&&!r.isMounting?t.enter:t.appear;return n.appearStatus=null,t.in?a?(o="exited",n.appearStatus=sp):o=cp:o=t.unmountOnExit||t.mountOnEnter?"unmounted":"exited",n.state={status:o},n.nextCallback=null,n}np(r,e),r.getDerivedStateFromProps=function(e,t){return e.in&&"unmounted"===t.status?{status:"exited"}:null};var n=r.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var r=this.state.status;this.props.in?r!==sp&&r!==cp&&(t=sp):r!==sp&&r!==cp||(t="exiting")}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,r,n=this.props.timeout;return e=t=r=n,null!=n&&"number"!=typeof n&&(e=n.exit,t=n.enter,r=void 0!==n.appear?n.appear:t),{exit:e,enter:t,appear:r}},n.updateStatus=function(e,t){void 0===e&&(e=!1),null!==t?(this.cancelNextCallback(),t===sp?this.performEnter(e):this.performExit()):this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:"unmounted"})},n.performEnter=function(e){var t=this,r=this.props.enter,n=this.context?this.context.isMounting:e,o=this.props.nodeRef?[n]:[C.findDOMNode(this),n],a=o[0],i=o[1],s=this.getTimeouts(),c=n?s.appear:s.enter;!e&&!r||ap?this.safeSetState({status:cp},(function(){t.props.onEntered(a)})):(this.props.onEnter(a,i),this.safeSetState({status:sp},(function(){t.props.onEntering(a,i),t.onTransitionEnd(c,(function(){t.safeSetState({status:cp},(function(){t.props.onEntered(a,i)}))}))})))},n.performExit=function(){var e=this,t=this.props.exit,r=this.getTimeouts(),n=this.props.nodeRef?void 0:C.findDOMNode(this);t&&!ap?(this.props.onExit(n),this.safeSetState({status:"exiting"},(function(){e.props.onExiting(n),e.onTransitionEnd(r.exit,(function(){e.safeSetState({status:"exited"},(function(){e.props.onExited(n)}))}))}))):this.safeSetState({status:"exited"},(function(){e.props.onExited(n)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,r=!0;return this.nextCallback=function(n){r&&(r=!1,t.nextCallback=null,e(n))},this.nextCallback.cancel=function(){r=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var r=this.props.nodeRef?this.props.nodeRef.current:C.findDOMNode(this),n=null==e&&!this.props.addEndListener;if(r&&!n){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[r,this.nextCallback],a=o[0],i=o[1];this.props.addEndListener(a,i)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if("unmounted"===e)return null;var r=this.props,n=r.children,o=(r.in,r.mountOnEnter,r.unmountOnExit,r.appear,r.enter,r.exit,r.timeout,r.addEndListener,r.onEnter,r.onEntering,r.onEntered,r.onExit,r.onExiting,r.onExited,r.nodeRef,rp(r,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return t.createElement(ip.Provider,{value:null},"function"==typeof n?n(e,o):t.cloneElement(t.Children.only(n),o))},r}(t.Component);function up(){}lp.contextType=ip,lp.propTypes={},lp.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:up,onEntering:up,onEntered:up,onExit:up,onExiting:up,onExited:up},lp.UNMOUNTED="unmounted",lp.EXITED="exited",lp.ENTERING=sp,lp.ENTERED=cp,lp.EXITING="exiting";var dp,fp,pp=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return n=t,void((r=e).classList?r.classList.add(n):function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")}(r,n)||("string"==typeof r.className?r.className=r.className+" "+n:r.setAttribute("class",(r.className&&r.className.baseVal||"")+" "+n)));var r,n}))},hp=function(e,t){return e&&t&&t.split(" ").forEach((function(t){return n=t,void((r=e).classList?r.classList.remove(n):"string"==typeof r.className?r.className=op(r.className,n):r.setAttribute("class",op(r.className&&r.className.baseVal||"",n)));var r,n}))},mp=function(e){function r(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).appliedClasses={appear:{},enter:{},exit:{}},t.onEnter=function(e,r){var n=t.resolveArguments(e,r),o=n[0],a=n[1];t.removeClasses(o,"exit"),t.addClass(o,a?"appear":"enter","base"),t.props.onEnter&&t.props.onEnter(e,r)},t.onEntering=function(e,r){var n=t.resolveArguments(e,r),o=n[0],a=n[1]?"appear":"enter";t.addClass(o,a,"active"),t.props.onEntering&&t.props.onEntering(e,r)},t.onEntered=function(e,r){var n=t.resolveArguments(e,r),o=n[0],a=n[1]?"appear":"enter";t.removeClasses(o,a),t.addClass(o,a,"done"),t.props.onEntered&&t.props.onEntered(e,r)},t.onExit=function(e){var r=t.resolveArguments(e)[0];t.removeClasses(r,"appear"),t.removeClasses(r,"enter"),t.addClass(r,"exit","base"),t.props.onExit&&t.props.onExit(e)},t.onExiting=function(e){var r=t.resolveArguments(e)[0];t.addClass(r,"exit","active"),t.props.onExiting&&t.props.onExiting(e)},t.onExited=function(e){var r=t.resolveArguments(e)[0];t.removeClasses(r,"exit"),t.addClass(r,"exit","done"),t.props.onExited&&t.props.onExited(e)},t.resolveArguments=function(e,r){return t.props.nodeRef?[t.props.nodeRef.current,e]:[e,r]},t.getClassNames=function(e){var r=t.props.classNames,n="string"==typeof r,o=n?""+(n&&r?r+"-":"")+e:r[e];return{baseClassName:o,activeClassName:n?o+"-active":r[e+"Active"],doneClassName:n?o+"-done":r[e+"Done"]}},t}np(r,e);var n=r.prototype;return n.addClass=function(e,t,r){var n=this.getClassNames(t)[r+"ClassName"],o=this.getClassNames("enter").doneClassName;"appear"===t&&"done"===r&&o&&(n+=" "+o),"active"===r&&e&&e.scrollTop,n&&(this.appliedClasses[t][r]=n,pp(e,n))},n.removeClasses=function(e,t){var r=this.appliedClasses[t],n=r.base,o=r.active,a=r.done;this.appliedClasses[t]={},n&&hp(e,n),o&&hp(e,o),a&&hp(e,a)},n.render=function(){var e=this.props,r=(e.classNames,rp(e,["classNames"]));return t.createElement(lp,tp({},r,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},r}(t.Component);mp.defaultProps={classNames:""},mp.propTypes={};var gp="out-in",vp="in-out",yp=function(e,t,r){return function(){var n;e.props[t]&&(n=e.props)[t].apply(n,arguments),r()}},bp=((dp={})[gp]=function(e){var r=e.current,n=e.changeState;return t.cloneElement(r,{in:!1,onExited:yp(r,"onExited",(function(){n(sp,null)}))})},dp[vp]=function(e){var r=e.current,n=e.changeState,o=e.children;return[r,t.cloneElement(o,{in:!0,onEntered:yp(o,"onEntered",(function(){n(sp)}))})]},dp),Cp=((fp={})[gp]=function(e){var r=e.children,n=e.changeState;return t.cloneElement(r,{in:!0,onEntered:yp(r,"onEntered",(function(){n(cp,t.cloneElement(r,{in:!0}))}))})},fp[vp]=function(e){var r=e.current,n=e.children,o=e.changeState;return[t.cloneElement(r,{in:!1,onExited:yp(r,"onExited",(function(){o(cp,t.cloneElement(n,{in:!0}))}))}),t.cloneElement(n,{in:!0})]},fp),wp=function(e){function r(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).state={status:cp,current:null},t.appeared=!1,t.changeState=function(e,r){void 0===r&&(r=t.state.current),t.setState({status:e,current:r})},t}np(r,e);var n=r.prototype;return n.componentDidMount=function(){this.appeared=!0},r.getDerivedStateFromProps=function(e,r){return null==e.children?{current:null}:r.status===sp&&e.mode===vp?{status:sp}:!r.current||(n=r.current,o=e.children,n===o||t.isValidElement(n)&&t.isValidElement(o)&&null!=n.key&&n.key===o.key)?{current:t.cloneElement(e.children,{in:!0})}:{status:"exiting"};var n,o},n.render=function(){var e,r=this.props,n=r.children,o=r.mode,a=this.state,i=a.status,s=a.current,c={children:n,current:s,changeState:this.changeState,status:i};switch(i){case sp:e=Cp[o](c);break;case"exiting":e=bp[o](c);break;case cp:e=s}return t.createElement(ip.Provider,{value:{isMounting:!this.appeared}},e)},r}(t.Component);wp.propTypes={},wp.defaultProps={mode:gp};var kp={DEFAULT:"default",ERROR:"error"};function Bp(e){var r=e.className,o=e.width,a=e.height,i=e.type,s=e.strokeStyles,c=e.strokeWidth,l=e.radius,u=e.paddingStyle,d=n((function(){var e;return I((S(e={},kp.DEFAULT,{fill:"none",strokeWidth:c,stroke:"#fff",strokeDasharray:"7, 4",opacity:.6}),S(e,kp.ERROR,{fill:"rgba(234,50,35, 0.1)",strokeWidth:c,stroke:"#ea3223"}),e),s)}),[c,s]),f=l+.8*c,p=d[i];return t.createElement("svg",{width:o,height:a,className:r},t.createElement("rect",{x:c/2,y:c/2,rx:l,ry:l,width:o-c,height:a-c,style:p}),t.createElement("path",{d:"M0,".concat(f," Q0,0 ").concat(f,",0 L0,0 Z"),style:u}),t.createElement("path",{d:"M0,".concat(a-f," Q0,").concat(a," ").concat(f,",").concat(a," L0,").concat(a," Z"),style:u}),t.createElement("path",{d:"M".concat(o-f,",").concat(a," Q").concat(o,",").concat(a," ").concat(o,",").concat(a-f," L").concat(o,",").concat(a," Z"),style:u}),t.createElement("path",{d:"M".concat(o-f,",0 Q").concat(o,",0 ").concat(o,",").concat(f," L").concat(o,",0 Z"),style:u}))}Bp.propTypes={className:p.string,width:p.number,height:p.number,strokeWidth:p.number,strokeStyles:p.shape({}),type:p.oneOf([kp.DEFAULT,kp.ERROR]),radius:p.number,paddingStyle:p.shape({})},Bp.defaultProps={className:"",width:600,height:400,strokeWidth:2,strokeStyles:{},type:kp.DEFAULT,radius:10,paddingStyle:{fill:"rgba(0, 0, 0, 0.6)"}};var Ep,Sp,Ap,_p,Ip,Tp,Pp,xp,Rp,Np,Lp,Op,Dp,Mp,Up,Fp,jp,Vp,zp,Kp=g(["from{transform:perspective(400px);}to{transform:perspective(400px) rotateY(90deg);}"]),Hp=g(["from{transform:perspective(400px) rotateY(-90deg);}to{transform:perspective(400px);}"]),qp=y([".flipY-exit{animation-name:",";animation-duration:","ms;animation-timing-function:ease-in;}.flipY-enter{animation-name:",";animation-duration:","ms;animation-timing-function:ease-out;}"],Kp,500,Hp,500),Qp=Object.freeze({__proto__:null,animationDuration:500,default:qp}),Wp=g(["from,to{transform:translate3d(-","px,0,0);}50%{transform:translate3d(","px,0,0);}"],20,20),Gp=g(["from,to{transform:translate3d(0,-","px,0);}50%{transform:translate3d(0,","px,0);}"],20,20),Xp=y([".slide-horizontal{animation-name:",";animation-iteration-count:infinite;animation-duration:2000ms;animation-timing-function:linear;}.slide-vertical{animation-name:",";animation-iteration-count:infinite;animation-duration:2000ms;animation-timing-function:linear;}"],Wp,Gp),Yp=Object.freeze({__proto__:null,default:Xp}),$p=g(["from,to{opacity:1;}50%{opacity:0;}"]),Zp=y([".blink{animation-name:",";animation-iteration-count:infinite;animation-duration:2000ms;animation-timing-function:linear;}"],$p),Jp=Object.freeze({__proto__:null,default:Zp}),eh=h.div(Ep||(Ep=N(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: ","; // must be higher than BASE_Z_INDEX and lower than other layers\n"])),1001),th=g(["from{background:#000;}to{}"]),rh=y([".splash-enter{animation-name:",";animation-duration:","ms;animation-timing-function:ease-in;}"],th,300),nh=h.div(Sp||(Sp=N(["\n ","\n"])),rh),oh=function(e){var r=e.keyForTransition,n=void 0===r?0:r;return t.createElement(nh,null,t.createElement(wp,null,t.createElement(mp,{key:n,timeout:{enter:300,exit:0},classNames:"splash",unmountOnExit:!1},t.createElement(eh,null))))},ah=Object.freeze({__proto__:null,default:oh}),ih=g(["from{transform:rotate(0deg);}to{transform:rotate(360deg);}"]),sh=y([".spin{animation-name:",";animation-iteration-count:infinite;animation-duration:1000ms;animation-timing-function:linear;}"],ih),ch=Object.freeze({__proto__:null,default:sh}),lh=Object.freeze({__proto__:null,flipY:Qp,slide:Yp,blink:Jp,splash:ah,spin:ch}),uh=oh,dh=h.div(Ap||(Ap=N(["\n ","\n ","\n"])),qp,sh),fh=h.img(_p||(_p=N(["\n border-radius: 5px;\n opacity: 0.7;\n height: 38px;\n"]))),ph=h.div(Ip||(Ip=N(["\n cursor: pointer;\n text-align: center;\n width: ","px;\n\n img {\n width: 100%;\n }\n\n z-index: ",";\n position: fixed;\n\n ","\n"])),60,1020,gi.isMobile?y(["top:",";"],(function(e){return e.y})):y(["bottom:","px;"],10)),hh=h.div(Tp||(Tp=N(["\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n position: absolute;\n margin: auto;\n width: ","px;\n height: ","px;\n\n img {\n width: 100%;\n }\n\n z-index: ",";\n"])),100,100,1020),mh=h.div(Pp||(Pp=N(["\n color: #fff;\n text-align: center;\n"]))),gh=h.div(xp||(xp=N(["\n transform: translateZ(1000px); // to fix rotating bug on safari\n transform-style: preserve-3d;\n position: absolute;\n top: ",";\n z-index: ",";\n"])),(function(e){return e.y}),1020),vh=h.div(Rp||(Rp=N(["\n display: flex;\n align-items: center;\n"]))),yh=h(mh)(Np||(Np=N(["\n font-size: 20px;\n margin-left: 10px;\n color: #fff;\n"]))),bh=h(mh)(Lp||(Lp=N(["\n font-size: 20px;\n margin-left: 10px;\n color: green;\n position: absolute;\n left: 0;\n top: 10px;\n background: white;\n z-index: ",";\n"])),1030),Ch=h(mh)(Op||(Op=N(["\n position: absolute;\n font-size: 16px;\n text-align: center;\n color: #fff;\n top: ",";\n z-index: ",";\n"])),(function(e){return e.y}),1020),wh=h(Ch)(Dp||(Dp=N(["\n background: #ea3223;\n padding: 5px 10px;\n border-radius: 3px;\n"]))),kh=h(mh)(Mp||(Mp=N(["\n position: absolute;\n font-size: 18px;\n text-align: center;\n border-radius: 3px;\n padding: 5px 10px;\n background: #ea3223;\n color: #fff;\n margin: 0 10px;\n top: ",";\n z-index: ",";\n"])),(function(e){return e.y}),1020),Bh=(h.div(Up||(Up=N(["\n font-size: 18px;\n text-align: center;\n padding: 10px;\n"]))),h(Bp)(Fp||(Fp=N(["\n position: absolute;\n top: 0;\n left: 0;\n"])))),Eh={BTN_OK:{en:"OK",vi:"Tôi đã hiểu"},FRONT:{en:"front",vi:"trước"},BACK:{en:"back",vi:"sau"},BTN_USE_THIS_PICTURE:{en:"Use this picture",vi:"Dùng ảnh này"},BTN_TRY_AGAIN:{en:"Try again",vi:"Thử lại"},CONFIRM_POPUP_VALID_QR:{en:"QR code scanned",vi:"Đã quét được mã QR"},CONFIRM_POPUP_INVALID_QR:{en:"Could not scan QR code",vi:"Không quét được mã QR"}},Sh=V.IDCardMessage,Ah=h.div(jp||(jp=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 10px;\n"]))),_h=h.div(Vp||(Vp=N(["\n text-align: center;\n font-size: 1rem;\n"]))),Ih=h.button(zp||(zp=N(["\n margin-top: 20px;\n width: 100%;\n max-width: 160px;\n height: 50px;\n background-color: ",";\n border: 0;\n outline: none;\n border-radius: 0.25rem;\n color: #fff;\n font-weight: 400;\n cursor: pointer;\n font-size: 1rem;\n"])),(function(e){return e.theme.tsBlue})),Th=function(e){var r=e.onOk,n=e.maxSessionTime,o=Qr.useSDKSettings().lang;return t.createElement(Ah,null,t.createElement(_h,{className:"popup-message"},uu(Sh.TIMEOUT_INSTRUCTION[o])({x:n})),t.createElement(Ih,{className:"popup-button",onClick:r},Eh.BTN_OK[o]))};Th.propTypes={onOk:p.func,maxSessionTime:p.number},Th.defaultProps={onOk:function(){},maxSessionTime:30};var Ph=function(){var e=L(s(!1),2),t=e[0],r=e[1],n=L(s(null),2),a=n[0],i=n[1],c=L(s({}),2),l=c[0],u=c[1];return{showPopup:o((function(e){var t=e.popupType,n=e.props;u(void 0===n?{}:n),i(t),r(null!==t)}),[]),popupShown:t,popupType:a,props:l}},xh="SESSION_TIMEOUT",Rh="CONFIRM",Nh="QR_INVALID",Lh="QR_INSTRUCTIONS",Oh=V.Errors;function Dh(e,t){return Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)}function Mh(e,t){return Math.sqrt(Dh(e,t))}function Uh(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.canvas,r=e.imgMargin,n=void 0===r?.15:r,o=window,a=o.cv,i=t.width,s=t.height,c=n;c<1&&(c=parseInt(.5*(s+i)*c,10));var l=a.imread(t),u=new a.Mat;return a.copyMakeBorder(l,u,c,c,c,c,a.BORDER_CONSTANT,new a.Scalar(0,0,0,255)),l.delete(),{mat:u,margin:c}}function Fh(e,t){var r=window.cv,n=L(t.map((function(e){return e.location})),4),o=n[0],a=n[1],i=n[2],s=n[3],c=Mh(i,s),l=Mh(a,o),u=Math.max(c,l),d=Mh(a,i),f=Mh(o,s),p=Math.max(d,f),h=[o.x,o.y,a.x,a.y,i.x,i.y,s.x,s.y],m=[0,0,u-1,0,u-1,p-1,0,p-1],g=r.imread(e),v=new r.Mat,y=new r.Size(u,p),b=r.matFromArray(4,1,r.CV_32FC2,h),C=r.matFromArray(4,1,r.CV_32FC2,m),w=r.getPerspectiveTransform(b,C);r.warpPerspective(g,v,w,y,r.INTER_LINEAR,r.BORDER_CONSTANT,new r.Scalar);var k=new ImageData(new Uint8ClampedArray(v.data),v.cols,v.rows);return g.delete(),v.delete(),b.delete(),C.delete(),k}function jh(e,t,r){var n={x:t.x-e.x,y:t.y-e.y},o={x:r.x-e.x,y:r.y-e.y},a=Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2)),i=Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2));return 180*Math.acos((n.x*o.x+n.y*o.y)/(a*i))/Math.PI}function Vh(e){var t=e.corners,r=e.width,n=e.height,o=Number.MAX_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER,i=Number.MIN_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER;t.forEach((function(e){var t=e.location,r=t.x,n=t.y;o=Math.min(o,r),a=Math.min(a,n),i=Math.max(i,r),s=Math.max(s,n)}));var c=.02;return o/r>=c&&a/n>=c&&(n-s)/n>=c&&(r-i)/r>=c}function zh(){return Kh.apply(this,arguments)}function Kh(){return(Kh=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c,l,u,d,f,p=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:{},r=t.canvas,n=t.paddingPercent,o=void 0===n?.04:n,a=r.width,i=r.height,s=Math.floor(a*o),c=Math.floor(i*o),l=a-2*s,u=i-2*c,d=document.createElement("canvas"),f=d.getContext("2d"),d.width=l,d.height=u,f.drawImage(r,s,c,l,u,0,0,l,u),e.abrupt("return",Ea.isCardGlare(d));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Hh(e){for(var t=e.length,r=0;r<t;r++){var n=(r+t-1)%t,o=(r+1)%t,a=jh(e[r].location,e[n].location,e[o].location);if(a<70||a>110)return!1}return!0}function qh(e){return Qh.apply(this,arguments)}function Qh(){return(Qh=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f,p;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.blazefaceModel,n=t.predictedIdCardCanvas,o=t.frontSide,a=n.width,i=n.height,s=Math.floor(a/3),c=Math.floor(4*i/5),l=document.createElement("canvas"),u=l.getContext("2d"),l.width=s,l.height=c,u.drawImage(n,0,Math.floor(i/5),s,c,0,0,s,c),e.next=12,ko.getModelPredictions({model:r,sCanvas:l});case 12:if(d=e.sent,f=d.filter((function(e){var t=e.topLeft,r=e.bottomRight,n=L(e.probability,1)[0],o=e.landmarks;return!(n<.9||o.length<4)&&!(lo.rectAreaRatio({small:{coords:[t,r]},big:{coords:[[0,0],[ko.SIZE,ko.SIZE]]}})<.025)})),p=f.length,!o){e.next=22;break}if(0!==p){e.next=18;break}return e.abrupt("return",Oh.id_detector_error_front_side_no_faces);case 18:if(!(p>1)){e.next=20;break}return e.abrupt("return",Oh.id_detector_error_front_side_multiple_faces);case 20:e.next=24;break;case 22:if(!(p>0)){e.next=24;break}return e.abrupt("return",Oh.id_detector_error_back_side_has_faces);case 24:return e.abrupt("return",null);case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Wh=function(e,t,r){return e==e&&(void 0!==r&&(e=e<=r?e:r),void 0!==t&&(e=e>=t?e:t)),e};var Gh=function(e,t,r){return void 0===r&&(r=t,t=void 0),void 0!==r&&(r=(r=hc(r))==r?r:0),void 0!==t&&(t=(t=hc(t))==t?t:0),Wh(hc(e),t,r)},Xh="https://unpkg.com/@tsocial/tv_web_sdk_resources@1.0.0/libs/opencv.js";function Yh(){return(Yh=B(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.url,n=void 0===r?Xh:r,!window.cv){e.next=3;break}return e.abrupt("return",Promise.resolve());case 3:return e.next=5,Ka.loadExternalScript({url:n});case 5:return e.abrupt("return",new Promise((function(e){window.cv.onRuntimeInitialized=e})));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var $h=od((function(e){return Yh.apply(this,arguments)})),Zh="https://unpkg.com/@tsocial/tv_web_sdk_resources@1.0.0/models/id-card/tflite/qtf16_model_224x224.tflite",Jh={0:"top-left",1:"top-right",2:"bottom-right",3:"bottom-left",4:"cccd.front",5:"passport",6:"cmnd_old.front",7:"cmnd_old.back",8:"cmnd_new.front",9:"cmnd_new.back",10:"cccd_new.front",11:"cccd_new.back"};function em(e){var t,r,n,o,a,i=e.card,s=e.corners,c=i.box,l={x:(c[1]+c[3])/2,y:(c[0]+c[2])/2},u=c[2]-c[0],d=c[1]-c[3],f=U(s);try{for(f.s();!(a=f.n()).done;){var p=a.value;switch(p.label){case"top-left":t||(t=p.location);break;case"top-right":r||(r=p.location);break;case"bottom-right":n||(n=p.location);break;case"bottom-left":o||(o=p.location)}}}catch(e){f.e(e)}finally{f.f()}if(![t,r,n,o].every(Boolean))return console.debug("Not qualified, corners missing"),!1;var h={x:(t.x+n.x)/2,y:(t.y+n.y)/2},m={x:(r.x+o.x)/2,y:(r.y+o.y)/2},g=Dh(l,h),v=Dh(l,m);return Math.sqrt(g)>(u+d)/8||Math.sqrt(v)>(u+d)/8?(console.debug("Not qualified, not close enough"),!1):(console.debug("Qualified"),!0)}var tm=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n,o,a,i,s,c,l;return t=e,(r=[{key:"load",value:(l=B(regeneratorRuntime.mark((function e(){var t,r,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},r=t.opencvUrl,n=t.modelUrl,e.next=3,Promise.all([$h({url:r}),this.loadModel({modelUrl:n})]);case 3:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"loadModel",value:(c=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{},r=t.modelUrl,n=void 0===r?Zh:r,e.next=3,oi.initTensorFlow({preferredBackends:["webgl","wasm","cpu"]});case 3:return e.next=5,oi.loadTFLiteModel({modelUrl:n});case 5:this.model=e.sent,o=this.model.inputs,this.inputSize=[o[0].shape[1],o[0].shape[2]];case 8:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"loadResource",value:(s=B(regeneratorRuntime.mark((function e(){var t,r,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},r=t.modelUrl,n=void 0===r?Zh:r,e.next=3,oi.preloadResource({modelUrl:n});case 3:case"end":return e.stop()}}),e)}))),function(){return s.apply(this,arguments)})},{key:"dispose",value:(i=B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.model&&this.model.dispose();case 1:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"predict",value:(a=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k,B,E,S,A,_,I,T=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=T.length>1&&void 0!==T[1]?T[1]:{},n=r.imgMargin,o=void 0===n?.5:n,a=r.detectThreshold,i=void 0===a?.3:a,s=r.maxNumReturns,c=void 0===s?100:s,l=window,u=l.cv,d={},f=t.width,p=t.height,d.originalWidth=f,d.originalHeight=p,h=Uh({canvas:t,imgMargin:o}),m=h.margin,g=h.mat,v=L(this.inputSize,2),y=v[0],b=v[1],C=new u.Mat,u.resize(g,C,new u.Size(y,b),0,0,u.INTER_AREA),w=g.cols/y,k=g.rows/b,(B=document.createElement("canvas")).width=y,B.height=b,B.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(C.data),C.cols,C.rows),0,0),g.delete(),C.delete(),d.canvas=B,d.margin=m,e.next=24,this.detect(B,{detectThreshold:i,maxNumReturns:c});case 24:if(E=e.sent,S={inputImage:d,card:null},A=[],_=[],E.forEach((function(e){var t=L(e.box,4),r=t[0],n=t[1],o=t[2],a=t[3];e.clazz<=3?A.push({clazz:e.clazz,label:e.label,score:e.score,location:{x:Gh(Math.floor((a+n)/2*w-m),0,f),y:Gh(Math.floor((r+o)/2*k-m),0,p)},scaledLocation:{x:Gh(Math.floor((a+n)/2),0,B.width),y:Gh(Math.floor((r+o)/2),0,B.height)}}):_.push({label:e.label,score:e.score,box:[Gh(Math.floor(r*k-m),0,p),Gh(Math.floor(n*w-m),0,f),Gh(Math.floor(o*k-m),0,p),Gh(Math.floor(a*w-m),0,f)]})})),A.sort((function(e,t){return t.score-e.score})),_.sort((function(e,t){return t.score-e.score})),!(_.length>0)){e.next=40;break}if(em({card:I=_[0],corners:A})){e.next=36;break}return console.debug("Not qualified.",I,A),e.abrupt("return",S);case 36:return A.sort((function(e,t){return e.clazz-t.clazz})),I.corners=A,S.card=I,e.abrupt("return",S);case 40:return e.abrupt("return",S);case 41:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"detect",value:(o=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k,B,E,S=this,A=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=A.length>1&&void 0!==A[1]?A[1]:{},n=r.detectThreshold,o=r.maxNumReturns,a=window,i=a.tf,s=t.width,c=t.height,l=i.tidy((function(){var e=i.expandDims(i.cast(i.image.resizeNearestNeighbor(i.browser.fromPixels(t),S.inputSize),"float32"));return S.model.predict(e)})),e.next=7,Promise.all([l["StatefulPartitionedCall:1"].data(),l["StatefulPartitionedCall:2"].data(),l["StatefulPartitionedCall:3"].array()]);case 7:for(u=e.sent,d=L(u,3),f=d[0],p=d[1],h=L(d[2],1),m=h[0],g=[],v=Math.min(f.length,o),y=0;y<v;y++)(b=f[y])>n&&(w=p[y],k=null!==(C=Jh[Math.round(w)])&&void 0!==C?C:"NA",B=m[y],E=[B[0]*c,B[3]*s,B[2]*c,B[1]*s],g.push({score:b,clazz:w,box:E,label:k}));return e.abrupt("return",g);case 17:case"end":return e.stop()}}),e)}))),function(e){return o.apply(this,arguments)})}])&&E(t.prototype,r),n&&E(t,n),e}();function rm(e){return nm.apply(this,arguments)}function nm(){return(nm=B(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.idCardModel,e.abrupt("return",new Promise((function(e,t){var n=document.createElement("canvas");setTimeout(t,1e3),r.predict(n).then(e)})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function om(e){return am.apply(this,arguments)}function am(){return(am=B(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.idCardModel,n=!0,e.prev=2,o=performance.now(),e.next=6,rm({idCardModel:r});case 6:performance.now()-o>1e3&&(n=!1),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(2),n=!1;case 13:return e.abrupt("return",{fastEnough:n});case 14:case"end":return e.stop()}}),e,null,[[2,10]])})))).apply(this,arguments)}function im(){return(im=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c,l,u,d,f,p,h=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=h.length>0&&void 0!==h[0]?h[0]:{},r=t.opencvUrl,n=t.idCardModelUrl,o=t.blazefaceModelUrl,a=t.tfScriptUrls,"iOS"!==gi.osName||!gi.osVersion.includes("12.")){e.next=5;break}return e.next=4,$h({url:r});case 4:return e.abrupt("return",{ableToUseModel:!1});case 5:return e.next=7,oi.loadTensorFlow(a);case 7:return i=new tm,e.next=10,Promise.all([oi.loadBlazefaceModel({modelUrl:o}),i.load({opencvUrl:r,modelUrl:n})]);case 10:return s=e.sent,c=L(s,1),l=c[0],u=!0,d=document.createElement("canvas"),e.prev=15,e.next=18,i.predict(d);case 18:return e.next=20,om({idCardModel:i});case 20:f=e.sent,p=f.fastEnough,u=p,e.next=28;break;case 25:e.prev=25,e.t0=e.catch(15),u=!1;case 28:return e.abrupt("return",{ableToUseModel:u,idCardModel:i,blazefaceModel:l});case 29:case"end":return e.stop()}}),e,null,[[15,25]])})))).apply(this,arguments)}var sm=od((function(){return im.apply(this,arguments)})),cm=V.Errors;function lm(e){var t=e.refVideo,n=e.shouldStart,a=e.cropArea,i=e.settings,s=r(null);null===s.current&&(s.current=document.createElement("canvas"));var l=r(!1),u=r(Ca.createResizer({width:960,height:640})),d=r(null),f=r([{id:null,frames:[]}]),p=o((function(){!0===l.current&&(l.current=!1)}),[]),h=o((function(){f.current=[{id:null,frames:[]}]}),[]),m=o((function(){var e=f.current;e[e.length-1].frames.length>0&&e.push({id:null,frames:[]})}),[]),g=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.workingCanvas,n=u.current,o=f.current,a=n.resize({srcCanvas:r}),s=a.toDataURL("image/jpeg",i.saveFrameQuality/100).split(",")[1],o[o.length-1].frames.push({base64:s});case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[i]),v=o(B(regeneratorRuntime.mark((function e(){var r,n,o,a,c,u,f,p,h,m,v;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i){e.next=2;break}return e.abrupt("return");case 2:if(r=i.frameCaptureIntervalMs,i.enableRecording){e.next=5;break}return e.abrupt("return");case 5:n=d.current,o=t.current,l.current=!0,a=n.cropX,c=n.cropY,u=n.cropWidth,f=n.cropHeight,(p=s.current).width=u,p.height=f,h=p.getContext("2d"),m=null;case 14:if(h.drawImage(o,a,c,u,f,0,0,u,f),!r){e.next=25;break}if(v=(new Date).getTime(),!(v-m>=r)){e.next=23;break}return e.next=22,g({workingCanvas:p});case 22:m=v;case 23:e.next=27;break;case 25:return e.next=27,g({workingCanvas:p});case 27:if(l.current){e.next=29;break}return e.abrupt("break",33);case 29:return e.next=31,Pn.sleep(15);case 31:e.next=14;break;case 33:case"end":return e.stop()}}),e)}))),[t,g,i]);return c((function(){var e=t.current;function r(){return(r=B(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.current=ro.analyzeVideoAndWindowSizes(e,a),t.next=3,v();case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return n&&a&&function(){r.apply(this,arguments)}(),function(){p()}}),[n,a,t,p,m,v]),{refWorkingCanvas:s,stopCheckFrame:p,splitVideos:m,resetRecordedVideos:h,checkFrame:v,refRecordedVideos:f}}var um,dm,fm,pm=function(e){var t=e.lang,n=e.onAboutToTimeout,a=e.onSessionTimeout,i=e.onVideoTimeLimitReached,l=e.settings,u=e.shouldStartTimers,d=e.sessionTime,f=r(),p=L(s(0),2),h=p[0],m=p[1],g=o((function(){clearInterval(f.current)}),[]),v=o((function(){m((function(e){return e+1}))}),[]);return c((function(){if(u){var e=l.maxRecordingTimePerVideo,t=0,r=d/3;f.current=setInterval((function(){var o=d-(t+=1);o<=r&&n&&n({curTimeLeft:o}),t>0&&t%e==0&&i&&i(),0===o&&(g(),a&&a())}),1e3)}return function(){g()}}),[u,t,n,g,a,i,h,l,d]),{stopTimers:g,startTimers:v}},hm=function(e){var t=e.shouldStart,n=e.refVideo,a=e.cropArea,i=e.settings,l=e.onModelErrorChange,u=e.frontSide,d=e.onDebugInfoChange,f=e.onAboutToTimeout,p=e.onSessionTimeout,h=e.onCaptureDone,m=e.outputEncryptionSettings,g=e.quality,v=r(!1),y=L(s(!1),2),b=y[0],C=y[1],w=r((function(){})),k=Sn.useSDKTracking().sendEvent,E=r(),S=r(),A=r(),_=Qr.useSDKSettings(),I=_.debug,T=_.lang,P=_.enableAntiDebug;c((function(){P&&ai.enableAntiDebug()}),[P]);var x=o(function(){var e=B(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return k({tag:u?"id_front":"id_back",event:"sdk_ui.auto_capture",log:{}}),e.next=3,w.current(t);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[k,u]),R=o((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];l.apply(void 0,t);var n=$u(t,"0.code");n&&n!==E.current&&k({tag:u?"id_front":"id_back",event:"sdk_ui.show_alert",log:{alert:n}}),E.current=n}),[l,u,k]),N=function(e){var t=e.refVideo,n=e.shouldStart,a=e.cropArea,i=e.settings,l=e.onError,u=e.frontSide,d=e.onAutoCaptureSuccess,f=e.quality,p=r(null);null===p.current&&(p.current=document.createElement("canvas"));var h=r(!1),m=r(null),g=L(s(!1),2),v=g[0],y=g[1],b=r({imageBlob:null,takenAt:null,blurScore:null,detectedCard:null}),C=r({imageBlob:null,blurScore:null,error:null,detectedCard:null}),w=r(!1),k=r(!1),E=r(null),S=r(!1),A=r({}),_=Qr.useSDKSettings().customUrls;c((function(){var e=!1;function t(){return(t=B(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!i||v){t.next=14;break}if(!i.enableIdDetection){t.next=10;break}return t.next=4,sm(_);case 4:return A.current=t.sent,t.next=7,oi.initTensorFlow();case 7:E.current=i.enableBlurCheck&&A.current.ableToUseModel,t.next=11;break;case 10:E.current=!1;case 11:if(!e){t.next=13;break}return t.abrupt("return");case 13:y(!0);case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return function(){t.apply(this,arguments)}(),function(){e=!0}}),[v,i,_]);var I=o((function(){!0===h.current&&(h.current=!1)}),[]),T=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.blurScore,n=t.detectedCard,o=i.blurThreshold,a=b.current,s=C.current,!(r<o&&eo.hasBetterCardBlurScore(r,a.blurScore))){e.next=15;break}if(!S.current){e.next=9;break}a.imageBlob=s.imageBlob,e.next=12;break;case 9:return e.next=11,ro.takePicture({canvas:p.current,quality:f});case 11:a.imageBlob=e.sent;case 12:a.takenAt=(new Date).getTime(),a.blurScore=r,a.detectedCard=n;case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[i,f]),P=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.blurScore,n=t.detectedCard,k.current=!0,o=C.current,!eo.hasBetterCardBlurScore(r,o.blurScore)){e.next=10;break}return e.next=6,ro.takePicture({canvas:p.current,quality:f});case 6:o.imageBlob=e.sent,o.blurScore=r,o.detectedCard=n,S.current=!0;case 10:k.current=!1;case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[f]),x=o(B(regeneratorRuntime.mark((function e(){var t,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.waitForBestImageTimeMs,null===(r=b.current).imageBlob){e.next=8;break}if(!((new Date).getTime()-r.takenAt>t)){e.next=8;break}return e.next=7,d(r);case 7:I();case 8:case"end":return e.stop()}}),e)}))),[d,i,I]),R=o((function(){w.current=!0}),[]),N=o((function(){return new Promise((function(e){w.current=!1;var t=setInterval((function(){k.current||(clearInterval(t),e())}),150)}))}),[]),O=o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){var t=i.blurThreshold,r=C.current;E.current?(R(),setTimeout((function(){N().then((function(){eo.hasBetterCardBlurScore(r.blurScore,t)||(r.error=cm.id_detector_error_blur),null===r.imageBlob?ro.takePicture({canvas:p.current,quality:f}).then((function(t){r.imageBlob=t,e(r)})):e(r)}))}),2e3)):ro.takePicture({canvas:p.current,quality:f}).then((function(t){r.imageBlob=t,e(r)}))})));case 1:case"end":return e.stop()}}),e)}))),[i,R,N,f]),D=o(B(regeneratorRuntime.mark((function e(){var r,n,o,a,s,c,d,f,g,y,k,B,E,_,I,R,N,L,O,D,M,U,F,j,V;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i&&v&&!h.current){e.next=2;break}return e.abrupt("return");case 2:b.current={imageBlob:null,takenAt:null,blurScore:null,detectedCard:null},C.current={imageBlob:null,blurScore:null,error:null,detectedCard:null},r=i.enableAutoCapture,n=i.enableBlurCheck,o=i.enableIdDetection,a=A.current,s=a.idCardModel,c=a.blazefaceModel,d=a.ableToUseModel,f=m.current,g=t.current,h.current=!0,y=f.cropX,k=f.cropY,B=f.cropWidth,E=f.cropHeight,_=f.cropWidthWithoutPadding,I=f.cropHeightWithoutPadding,(R=p.current).width=B,R.height=E,N=R.getContext("2d"),L=document.createElement("canvas"),O=L.getContext("2d"),D=o&&d?15:700;case 17:if(N.drawImage(g,y,k,B,E,0,0,B,E),S.current=!1,!o||!d){e.next=74;break}return M=null,e.next=24,s.predict(R,{detectThreshold:.3});case 24:if(!(U=e.sent).card){e.next=70;break}if(!Vh({corners:U.card.corners,width:B,height:E})){e.next=67;break}if(!Hh(U.card.corners)){e.next=64;break}if(F=Fh(R,U.card.corners),!((j=lo.rectAreaRatio({small:{area:F.width*F.height},big:{area:_*I}}))<.5)){e.next=36;break}M=cm.id_detector_card_too_small,e.next=62;break;case 36:if(!(j>.95)){e.next=40;break}M=cm.id_detector_error_incomplete,e.next=62;break;case 40:return L.width=F.width,L.height=F.height,O.putImageData(F,0,0),e.next=45,zh({canvas:L});case 45:if(!e.sent){e.next=50;break}M=cm.glare_detected,e.next=62;break;case 50:return e.next=52,qh({blazefaceModel:c,predictedIdCardCanvas:L,frontSide:u});case 52:if(M=e.sent){e.next=62;break}if(!n){e.next=62;break}if(V=eo.calculateIdCardBlurScore({canvas:L}),!w.current){e.next=59;break}return e.next=59,P({blurScore:V,detectedCard:U.card});case 59:if(!r){e.next=62;break}return e.next=62,T({blurScore:V,detectedCard:U.card});case 62:e.next=65;break;case 64:M=cm.id_detector_validate_angle_error;case 65:e.next=68;break;case 67:M=cm.id_detector_error_incomplete;case 68:e.next=71;break;case 70:M=cm.id_detector_no_cards;case 71:return l(M),e.next=74,x();case 74:if(h.current){e.next=76;break}return e.abrupt("break",80);case 76:return e.next=78,Pn.sleep(D);case 78:e.next=17;break;case 80:case"end":return e.stop()}}),e)}))),[t,i,v,u,l,T,P,x]);c((function(){var e=t.current;function r(){return(r=B(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return m.current=ro.analyzeVideoAndWindowSizes(e,a,.05),t.next=3,D();case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}n&&a&&v&&function(){r.apply(this,arguments)}()}),[n,a,t,I,D,v]);var M=o((function(){I()}),[I]);return c((function(){return M}),[M]),{refWorkingCanvas:p,stopCheckFrame:I,checkFrame:D,warmupDone:v,takePictureManually:O,refAbleToRunBurstMode:E}}({refVideo:n,shouldStart:t,cropArea:a,settings:i,onError:R,frontSide:u,onAutoCaptureSuccess:x,quality:g}),O=N.refWorkingCanvas,D=N.stopCheckFrame,M=N.checkFrame,U=N.warmupDone,F=N.takePictureManually,j=N.refAbleToRunBurstMode,V=lm({refVideo:n,shouldStart:!1,cropArea:a,settings:i}),z=V.stopCheckFrame,K=V.splitVideos,H=V.resetRecordedVideos,q=V.checkFrame;!function(e){var t=e.debug,r=e.refRecordedVideos,n=e.refWorkingCanvas,o=e.refVideo,a=e.onChange;c((function(){var e;return t&&(e=setInterval((function(){var e=o.current,t=r.current,i=n.current,s=t[t.length-1],c={videoWidth:e.videoWidth,videoHeight:e.videoHeight,framesCount:s.frames.length,"window.innerWidth":window.innerWidth,"window.innerHeight":window.innerHeight,"canvas.width":null==i?void 0:i.width,"canvas.height":null==i?void 0:i.height};a&&a(JSON.stringify(c,null,2))}),1e3)),function(){return clearInterval(e)}}),[a,t,r,n,o])}({debug:I,refRecordedVideos:V.refRecordedVideos,refWorkingCanvas:O,refVideo:n,onChange:d});var Q=o((function(){z(),D(),H(),p()}),[H,z,D,p]),W=o((function(){K()}),[K]),G=pm({lang:T,onAboutToTimeout:f,onSessionTimeout:Q,onVideoTimeLimitReached:W,settings:i,shouldStartTimers:U&&t&&(null==i?void 0:i.enableTimers),sessionTime:null==i?void 0:i.idCardSessionTime}),X=G.stopTimers,Y=G.startTimers,$=o((function(){v.current=!1}),[]),Z=o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $(),Y(),e.next=4,Promise.all([q(),M()]);case 4:case"end":return e.stop()}}),e)}))),[q,M,Y,$]),J=o(B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]?s[0]:{},r=t.imageBlob,n=t.error,o=t.detectedCard,!v.current){e.next=3;break}return e.abrupt("return");case 3:if(v.current=!0,C(!0),z(),D(),X(),R(null),!m||!m.key){e.next=14;break}return i=m.key,e.next=13,ci.encrypt({blob:r,key:i});case 13:a=e.sent;case 14:h({image:{blob:r,encrypted:a,detectedCard:o},error:n,recordedVideos:[]}),C(!1),k({tag:u?"id_front":"id_back",event:"user_activity",log:{time_capture_in_seconds:(performance.now()-A.current)/1e3}});case 17:case"end":return e.stop()}}),e)}))),[z,D,X,R,h,u,k,m]);w.current=J;var ee=o(B(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return C(!0),X(),z(),j.current||D(),e.next=6,F();case 6:return t=e.sent,e.next=9,J(t);case 9:C(!1),k({tag:u?"id_front":"id_back",event:"user_activity.capture",log:{}});case 11:case"end":return e.stop()}}),e)}))),[F,J,X,j,z,D,k,u]);return c((function(){t&&(k({tag:u?"id_front":"id_back",event:"user_activity.start",log:{}}),S.current=performance.now())}),[k,u,t]),c((function(){U&&(k({tag:u?"id_front":"id_back",event:"user_activity.show",log:{}}),k({tag:u?"id_front":"id_back",event:"sdk.load_model",log:{status:"success",time_in_ms:performance.now()-S.current}}),A.current=performance.now())}),[k,u,U]),{warmupDone:U,isProcessing:b,takePictureManually:ee,restartSession:Z,resetIsProcessingImageBlobTaken:$}},mm=V.IDCardMessage,gm=u((function(e,r){var n=e.description,a=e.usePortraitMask,i=e.windowAndVideoInfo,l=e.refVideo,u=e.frontSide,f=e.settings,p=e.onCaptureDone,h=e.onUISpacingChange,m=e.outputEncryptionSettings,g=L(s({}),2),v=g[0],y=g[1],b=v.yDescription,C=v.yMessage,w=v.yCaptureButton,k=In.useAsset("ic_camera.svg"),E=In.useAsset("ic_loading.png"),S=L(s(""),2),A=S[0],_=S[1],I=Qr.useSDKSettings(),T=I.debug,P=I.lang,x=L(s(null),2),R=x[0],N=x[1],O=L(s(""),2),D=O[0],M=O[1],U=L(s(null),2),F=U[0],j=U[1],V=Ph(),z=V.showPopup,K=V.popupShown,H=V.popupType,q=o((function(e){M(null===e?"":uu(e.msg[P])({side:u?Eh.FRONT[P]:Eh.BACK[P]}))}),[P,u]),Q=o((function(){N(""),z({popupType:xh})}),[z]),W=o((function(){N(""),p.apply(void 0,arguments)}),[p]),G=o((function(e){var t=e.curTimeLeft;N(uu(mm.REMAINING_TIME[P])({x:t}))}),[P]),X=hm({shouldStart:!0,refVideo:l,cropArea:F,settings:f,onModelErrorChange:q,frontSide:u,onDebugInfoChange:_,onSessionTimeout:Q,onCaptureDone:W,onAboutToTimeout:G,outputEncryptionSettings:m}),Y=X.warmupDone,$=X.isProcessing,Z=X.takePictureManually,J=X.restartSession,ee=X.resetIsProcessingImageBlobTaken,te=o((function(){z({popupType:null}),ee()}),[z,ee]),re=o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return te(),e.next=3,J();case 3:case"end":return e.stop()}}),e)}))),[J,te]);c((function(){if(i){var e,t,r,n,o,s,c,l=i.videoAreaWidth,u=i.videoAreaHeight,d=i.lostX,f=i.lostY,p=i.clientHeight;a?(o=.7*(s=u-165),r=(c=(e=f+10)+45)+20,n=(t=c+s+10)+60):(o=gi.isMobile?l-6:Math.floor(.7*l),r=(c=(e=f+10)+50)+20,n=(t=c+(s=Math.floor(Math.min(o/1.5,p-2*f-80-100)))+10)+60);var m=Math.floor((l-o)/2)+d;j({x:m,y:c,width:o,height:s,surroundStyle:{opacity:.6,background:"#000"}});var g={yTitle:e,yDescription:t,yMessage:r,yCaptureButton:n};y(g),h(g)}}),[i,a,h]);var ne=o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return N(""),e.next=3,Z();case 3:case"end":return e.stop()}}),e)}))),[Z]);return d(r,(function(){return{restartSession:re}}),[re]),t.createElement(t.Fragment,null,!Y&&t.createElement(Cf,null),T&&t.createElement(bh,null,A),$&&t.createElement(hh,null,t.createElement("img",{src:E,alt:"",className:"spin"})),F&&t.createElement(Vs,{x:"".concat(F.x,"px"),y:"".concat(F.y,"px"),width:"".concat(F.width,"px"),height:"".concat(F.height,"px"),surroundStyle:F.surroundStyle},t.createElement(Bh,{width:F.width,height:F.height,type:D?kp.ERROR:kp.DEFAULT})),!D&&t.createElement(Ch,{y:"".concat(b,"px"),className:"description"},n),D&&t.createElement(wh,{y:"".concat(b,"px")},D),!$&&(!(null!=f&&f.disableCaptureButtonIfAlert)||!D)&&t.createElement(ph,{onClick:ne,y:"".concat(w,"px")},t.createElement("img",{src:k,alt:""})),R&&t.createElement(kh,{key:R,className:"message",y:"".concat(C,"px")},R),t.createElement(ef,{open:K},H===xh&&t.createElement(Th,{onOk:re,maxSessionTime:null==f?void 0:f.idCardSessionTime})))}));gm.propTypes={usePortraitMask:p.bool,description:p.string,windowAndVideoInfo:p.shape({}),refVideo:p.shape({}),frontSide:p.bool,settings:p.shape({}),onCaptureDone:p.func,onUISpacingChange:p.func,outputEncryptionSettings:p.shape({})},gm.defaultProps={usePortraitMask:!1,description:"",windowAndVideoInfo:{},refVideo:{},frontSide:!0,settings:{},onCaptureDone:function(){},onUISpacingChange:function(){},outputEncryptionSettings:null};var vm,ym,bm=h.div(um||(um=N(["\n background: ",";\n backdrop-filter: blur(12px);\n border-radius: 8px;\n top: ",";\n position: absolute;\n z-index: ",";\n color: #fff;\n padding: 10px;\n margin: 0 10px;\n max-width: 275px;\n text-align: center;\n"])),(function(e){return e.background}),(function(e){return e.y}),1020),Cm=h.div(dm||(dm=N(["\n width: 0;\n height: 0;\n border-left: 20px solid transparent;\n border-right: 20px solid transparent;\n border-bottom: ",";\n position: absolute;\n left: 50%;\n top: ",";\n transform: translateX(-50%);\n"])),(function(e){return"".concat(e.arrowSize,"px solid ").concat(e.color)}),(function(e){return"".concat(e.top,"px")})),wm=function(e){var r=e.children,n=e.y;return t.createElement(bm,{y:n,background:"#00ce78"},t.createElement(Cm,{arrowSize:10,top:-10,color:"#00ce78"}),r)},km=h.div(fm||(fm=N(["\n text-align: center;\n position: absolute;\n font-size: 18px;\n border-radius: 3px;\n padding: 5px 10px;\n background: #ea3223;\n color: #fff;\n margin: auto;\n top: ",";\n z-index: ",";\n"])),(function(e){return e.y}),1020),Bm={QR_INSTRUCTIONS_TEXT:{en:t.createElement("span",null,"Please follow the instructions below to scan QR code:",t.createElement("br",null),t.createElement("br",null)," Move camera to the position of QR code on ID card. Align QR code to fit into camera frame to scan it"),vi:t.createElement("span",null,"Vui lòng quét mã QR theo hướng dẫn sau:",t.createElement("br",null),t.createElement("br",null)," Đưa camera vào vị trí mã QR trên CCCD. Canh vừa mã QR vào 4 góc khung hình để quét mã")},QR_INSTRUCTIONS_START_BUTTON:{en:"Scan QR code",vi:"Tiến hành quét mã QR"},QR_INSTRUCTIONS_COUNTDOWN:{en:"Start in <%= x %> s",vi:"Bắt đầu trong <%= x %> giây"},QR_INVALID_POPUP_TITLE:{en:"Invalid QR code",vi:"QR không hợp lệ"},QR_INVALID_POPUP_DESCRIPTION:{en:"Please check and make sure scanning QR code on ID card",vi:"Vui lòng kiểm tra và đảm bảo việc thực hiện quét QR trên CCCD thật"},QR_INVALID_POPUP_RETRY_BUTTON:{en:"Scan QR (on ID card)",vi:"Quét lại QR (trên CCCD)"},QR_INVALID_POPUP_SKIP_BUTTON:{en:"Skip",vi:"Bỏ qua"},QR_TOOLTIP:{en:"Fit QR code to 4 corners of camera frame and try to move camera [in or out] to scan QR code",vi:"Canh vừa mã QR vào 4 góc khung hình và thử dịch chuyển camera [xa - gần] để quét được mã QR"},REMAINING_TIME:{en:"Remaining time: <%= x %> seconds",vi:"Thời gian còn lại: <%= x %> giây"},SESSION_TIMEOUT_POPUP_DESCRIPTION:{en:t.createElement("span",null,"Quá thời gian quét. Vui lòng thực hiện lại.",t.createElement("br",null),t.createElement("br",null)," Đưa camera vào vị trí mã QR trên thẻ. Canh vừa vào 4 góc và"," ",t.createElement("strong",{className:"text-primary"},"thử dịch chuyển camera [xa - gần]")," để camera điện thoại lấy nét chuẩn hơn."),vi:t.createElement("span",null,"Quá thời gian quét. Vui lòng thực hiện lại.",t.createElement("br",null),t.createElement("br",null)," Đưa camera vào vị trí mã QR trên thẻ. Canh vừa vào 4 góc và"," ",t.createElement("strong",{className:"text-primary"},"thử dịch chuyển camera [xa - gần]")," để camera điện thoại lấy nét chuẩn hơn.")},SESSION_TIMEOUT_POPUP_RETRY_BUTTON:{en:"Retry",vi:"Thực hiện lại"},SESSION_TIMEOUT_POPUP_SKIP_BUTTON:{en:"Skip",vi:"Bỏ qua"}},Em=function(e){var r=e.children,n=e.mt,o=e.mb,a=e.ml,i=e.mr,s=e.mx,c=e.my,l=e.pt,u=e.pb,d=e.pl,f=e.pr,p=e.px,h=e.py,m=r.props.style||{},g={};return null!==s&&(g.marginLeft=s,g.marginRight=s),null!==c&&(g.marginTop=c,g.marginBottom=c),null!==n&&(g.marginTop=n),null!==o&&(g.marginBottom=o),null!==a&&(g.marginLeft=a),null!==i&&(g.marginRight=i),null!==p&&(g.paddingLeft=p,g.paddingRight=p),null!==h&&(g.paddingTop=h,g.paddingBottom=h),null!==l&&(g.paddingTop=l),null!==u&&(g.paddingBottom=u),null!==d&&(g.paddingLeft=d),null!==f&&(g.paddingRight=f),t.cloneElement(r,{style:I(I({},m),g)})};Em.propTypes={mt:p.string,ml:p.string,mr:p.string,mb:p.string,mx:p.string,my:p.string,pt:p.string,pl:p.string,pr:p.string,pb:p.string,px:p.string,py:p.string},Em.defaultProps={mt:null,ml:null,mr:null,mb:null,mx:null,my:null,pt:null,pl:null,pr:null,pb:null,px:null,py:null};var Sm,Am,_m,Im,Tm,Pm,xm=h.button(vm||(vm=N(["\n width: 100%;\n max-width: 294px;\n height: 66px;\n background-color: ",";\n border: 0;\n outline: none;\n border-radius: 3px;\n color: #fff;\n font-weight: normal;\n cursor: pointer;\n font-size: 1rem;\n"])),(function(e){return e.theme.tsBlue})),Rm=h.a(ym||(ym=N(["\n color: ",";\n cursor: pointer;\n"])),(function(e){return e.theme.tsBlue})),Nm=h.div(Sm||(Sm=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 10px;\n"]))),Lm=h.div(Am||(Am=N(["\n color: ",";\n font-weight: bold;\n font-size: 16px;\n"])),(function(e){return e.theme.tsSecondary})),Om=h.div(_m||(_m=N(["\n color: ",";\n font-weight: normal;\n font-size: 16px;\n text-align: center;\n"])),(function(e){return e.theme.tsSecondary})),Dm=function(e){var r=e.onRetry,n=e.onSkip,o=Qr.useSDKSettings().lang;return t.createElement(Nm,null,t.createElement(Em,{mt:"25px"},t.createElement(Lm,null,Bm.QR_INVALID_POPUP_TITLE[o])),t.createElement(Em,{mt:"30px"},t.createElement(Om,null,Bm.QR_INVALID_POPUP_DESCRIPTION[o])),t.createElement(Em,{mt:"30px"},t.createElement(xm,{onClick:r},Bm.QR_INVALID_POPUP_RETRY_BUTTON[o])),t.createElement(Em,{my:"20px"},t.createElement(Rm,{onClick:n},Bm.QR_INVALID_POPUP_SKIP_BUTTON[o])))};Dm.propTypes={onRetry:p.func,onSkip:p.func},Dm.defaultProps={onRetry:function(){},onSkip:function(){}};var Mm=h.div(Im||(Im=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 10px;\n"]))),Um=h.div(Tm||(Tm=N(["\n background: #e7e6e6;\n width: 100%;\n display: flex;\n justify-content: center;\n"]))),Fm=h.div(Pm||(Pm=N(["\n color: ",";\n font-weight: normal;\n font-size: 16px;\n text-align: center;\n line-height: 20px;\n"])),(function(e){return e.theme.tsSecondary})),jm=function(e){var r=e.onRetry,n=e.onSkip,o=Qr.useSDKSettings().lang,a=In.useAsset("qr_code_banner.svg");return t.createElement(Mm,null,t.createElement(Um,null,t.createElement("img",{src:a,alt:""})),t.createElement(Em,{mt:"30px"},t.createElement(Fm,null,Bm.SESSION_TIMEOUT_POPUP_DESCRIPTION[o])),t.createElement(Em,{mt:"30px"},t.createElement(xm,{onClick:r},Bm.SESSION_TIMEOUT_POPUP_RETRY_BUTTON[o])),t.createElement(Em,{my:"20px"},t.createElement(Rm,{onClick:n},Bm.SESSION_TIMEOUT_POPUP_SKIP_BUTTON[o])))};jm.propTypes={onRetry:p.func,onSkip:p.func},jm.defaultProps={onRetry:function(){},onSkip:function(){}};var Vm,zm,Km,Hm,qm,Qm,Wm=["children","ratio","padding"],Gm=h.div(Vm||(Vm=N(["\n width: 100%;\n padding-bottom: ","%;\n position: relative;\n"])),(function(e){return 1/e.ratio*100})),Xm=h.div(zm||(zm=N(["\n position: absolute;\n top: ",";\n left: ",";\n right: ",";\n bottom: ",";\n"])),(function(e){return e.padding}),(function(e){return e.padding}),(function(e){return e.padding}),(function(e){return e.padding})),Ym=function(e){var r=e.children,n=e.ratio,o=e.padding,a=R(e,Wm);return t.createElement(Gm,A({ratio:n},a),t.createElement(Xm,{padding:o},r))};Ym.propTypes={children:p.node,ratio:p.number,padding:p.string},Ym.defaultProps={children:null,ratio:4/3,padding:"0"};var $m=h.div(Km||(Km=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 10px;\n"]))),Zm=h.div(Hm||(Hm=N(["\n background: #e7e6e6;\n width: 100%;\n"]))),Jm=h.img(qm||(qm=N(["\n width: 100%;\n height: 100%;\n object-fit: contain;\n border-radius: 5px;\n"]))),eg=h.div(Qm||(Qm=N(["\n color: ",";\n font-weight: normal;\n font-size: 16px;\n text-align: center;\n line-height: 20px;\n"])),(function(e){return e.theme.tsSecondary})),tg=function(e){var n=e.onClickStart,o=e.onTimeout,a=e.timeout,i=Qr.useSDKSettings().lang,l=In.useAsset("qr_code_banner.png"),u=r(a),d=L(s((function(){return uu(Bm.QR_INSTRUCTIONS_COUNTDOWN[i])({x:a})})),2),f=d[0],p=d[1];return c((function(){var e=uu(Bm.QR_INSTRUCTIONS_COUNTDOWN[i]),t=setInterval((function(){u.current--,p(e({x:u.current})),u.current<=0&&(clearInterval(t),o&&o())}),1e3);return function(){clearInterval(t)}}),[i,o]),t.createElement($m,null,t.createElement(Zm,null,t.createElement(Ym,{ratio:1.6},t.createElement(Jm,{src:l}))),t.createElement(Em,{mt:"30px"},t.createElement(eg,null,Bm.QR_INSTRUCTIONS_TEXT[i])),t.createElement(Em,{mt:"30px"},t.createElement(xm,{onClick:n},Bm.QR_INSTRUCTIONS_START_BUTTON[i])),t.createElement(Em,{my:"20px"},t.createElement(eg,null,f)))};tg.propTypes={onClickStart:p.func,onTimeout:p.func,timeout:p.number},tg.defaultProps={onClickStart:null,onTimeout:null,timeout:10};var rg=/^\d{12}\|(\d{9})?\|.+\|\d{8}\|((Nam)|(Nữ))\|.+\|\d{8}$/g,ng=function(e){var t=e.match(rg);return{valid:Boolean(t)}};class og{static hasCamera(){return og.listCameras(!1).then((e=>!!e.length)).catch((()=>!1))}static listCameras(e=!1){if(!navigator.mediaDevices)return Promise.resolve([]);let t=null;return(e?navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((e=>t=e)).catch((()=>{})):Promise.resolve()).then((()=>navigator.mediaDevices.enumerateDevices())).then((e=>e.filter((e=>"videoinput"===e.kind)).map(((e,t)=>({id:e.deviceId,label:e.label||(0===t?"Default Camera":`Camera ${t+1}`)}))))).finally((()=>{if(t)for(const e of t.getTracks())e.stop(),t.removeTrack(e)}))}constructor(e,t,r=this._onDecodeError,n=this._calculateScanRegion,o="environment"){this.$video=e,this.$canvas=document.createElement("canvas"),this._onDecode=t,this._legacyCanvasSize=og.DEFAULT_CANVAS_SIZE,this._preferredCamera=o,this._active=!1,this._paused=!1,this._flashOn=!1,"number"==typeof r?(this._legacyCanvasSize=r,console.warn("You're using a deprecated version of the QrScanner constructor which will be removed in the future")):this._onDecodeError=r,"number"==typeof n?(this._legacyCanvasSize=n,console.warn("You're using a deprecated version of the QrScanner constructor which will be removed in the future")):this._calculateScanRegion=n,this._scanRegion=this._calculateScanRegion(e),this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),e.disablePictureInPicture=!0,e.playsInline=!0,e.muted=!0;let a=!1;e.hidden&&(e.hidden=!1,a=!0),document.body.contains(e)||(document.body.appendChild(e),a=!0),requestAnimationFrame((()=>{const t=window.getComputedStyle(e);"none"===t.display&&(e.style.setProperty("display","block","important"),a=!0),"visible"!==t.visibility&&(e.style.setProperty("visibility","visible","important"),a=!0),a&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),e.style.opacity=0,e.style.width=0,e.style.height=0)})),e.addEventListener("play",this._onPlay),e.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),this._qrEnginePromise=og.createQrEngine()}hasFlash(){let e=null;return(this.$video.srcObject?Promise.resolve(this.$video.srcObject.getVideoTracks()[0]):this._getCameraStream().then((({stream:t})=>(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),e=t,t.getVideoTracks()[0])))).then((e=>"torch"in e.getSettings())).catch((()=>!1)).finally((()=>{if(e)for(const t of e.getTracks())t.stop(),e.removeTrack(t)}))}isFlashOn(){return this._flashOn}toggleFlash(){return this._flashOn?this.turnFlashOff():this.turnFlashOn()}turnFlashOn(){return this._flashOn?Promise.resolve():(this._flashOn=!0,!this._active||this._paused?Promise.resolve():this.hasFlash().then((e=>e?this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]}):Promise.reject("No flash available"))).catch((()=>{throw this._flashOn=!1,e})))}turnFlashOff(){if(this._flashOn)return this._flashOn=!1,this._restartVideoStream()}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),this.stop(),og._postWorkerMessage(this._qrEnginePromise,"close")}start(){return this._active&&!this._paused?Promise.resolve():("https:"!==window.location.protocol&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,document.hidden?Promise.resolve():(this._paused=!1,this.$video.srcObject?(this.$video.play(),Promise.resolve()):this._getCameraStream().then((({stream:e,facingMode:t})=>{this.$video.srcObject=e,this.$video.play(),this._setVideoMirror(t),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch((()=>{})))})).catch((e=>{throw this._active=!1,e}))))}stop(){this.pause(),this._active=!1}pause(e=!1){if(this._paused=!0,!this._active)return Promise.resolve(!0);this.$video.pause();const t=()=>{const e=this.$video.srcObject?this.$video.srcObject.getTracks():[];for(const t of e)t.stop(),this.$video.srcObject.removeTrack(t);this.$video.srcObject=null};return e?(t(),Promise.resolve(!0)):new Promise((e=>setTimeout(e,300))).then((()=>!!this._paused&&(t(),!0)))}setCamera(e){return e===this._preferredCamera?Promise.resolve():(this._preferredCamera=e,this._restartVideoStream())}static scanImage(e,t=null,r=null,n=null,o=!1,a=!1){const i=r instanceof Worker;let s=Promise.all([r||og.createQrEngine(),og._loadImage(e)]).then((([e,a])=>{let s;return r=e,[n,s]=this._drawToCanvas(a,t,n,o),r instanceof Worker?(i||r.postMessage({type:"inversionMode",data:"both"}),new Promise(((e,t)=>{let o,a,i;a=n=>{"qrResult"===n.data.type&&(r.removeEventListener("message",a),r.removeEventListener("error",i),clearTimeout(o),null!==n.data.data?e(n.data.data):t(og.NO_QR_CODE_FOUND))},i=e=>{r.removeEventListener("message",a),r.removeEventListener("error",i),clearTimeout(o);const n=e?e.message||e:"Unknown Error";t("Scanner error: "+n)},r.addEventListener("message",a),r.addEventListener("error",i),o=setTimeout((()=>i("timeout")),1e4);const c=s.getImageData(0,0,n.width,n.height);r.postMessage({type:"decode",data:c},[c.data.buffer])}))):new Promise(((e,t)=>{const o=setTimeout((()=>t("Scanner error: timeout")),1e4);r.detect(n).then((r=>{r.length?e(r[0].rawValue):t(og.NO_QR_CODE_FOUND)})).catch((e=>t("Scanner error: "+(e.message||e)))).finally((()=>clearTimeout(o)))}))}));return t&&a&&(s=s.catch((()=>og.scanImage(e,null,r,n,o)))),s=s.finally((()=>{i||og._postWorkerMessage(r,"close")})),s}setGrayscaleWeights(e,t,r,n=!0){og._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:e,green:t,blue:r,useIntegerApproximation:n})}setInversionMode(e){og._postWorkerMessage(this._qrEnginePromise,"inversionMode",e)}static createQrEngine(e=og.WORKER_PATH){return("BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats?BarcodeDetector.getSupportedFormats():Promise.resolve([])).then((t=>-1!==t.indexOf("qr_code")?new BarcodeDetector({formats:["qr_code"]}):new Worker(e)))}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video)}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(e){const t=Math.min(e.videoWidth,e.videoHeight),r=Math.round(2/3*t);return{x:Math.round((e.videoWidth-r)/2),y:Math.round((e.videoHeight-r)/2),width:r,height:r,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_scanFrame(){if(!this._active||this.$video.paused||this.$video.ended)return!1;requestAnimationFrame((()=>{this.$video.readyState<=1?this._scanFrame():this._qrEnginePromise.then((e=>og.scanImage(this.$video,this._scanRegion,e,this.$canvas))).then(this._onDecode,(e=>{if(!this._active)return;-1!==(e.message||e).indexOf("service unavailable")&&(this._qrEnginePromise=og.createQrEngine()),this._onDecodeError(e)})).then((()=>this._scanFrame()))}))}_onDecodeError(e){e!==og.NO_QR_CODE_FOUND&&console.log(e)}_getCameraStream(){if(!navigator.mediaDevices)return Promise.reject("Camera not found.");const e="environment"===this._preferredCamera||"user"===this._preferredCamera?"facingMode":"deviceId",t=[{width:{min:1024}},{width:{min:768}},{}];return[...t.map((t=>Object.assign({},t,{[e]:{exact:this._preferredCamera}}))),...t].reduceRight(((e,t)=>()=>navigator.mediaDevices.getUserMedia({video:t,audio:!1}).then((e=>({stream:e,facingMode:this._getFacingMode(e)||(t.facingMode?this._preferredCamera:"environment"===this._preferredCamera?"user":"environment")}))).catch(e)),(()=>Promise.reject("Camera not found.")))()}_restartVideoStream(){const e=this._paused;return this.pause(!0).then((t=>{if(t&&!e&&this._active)return this.start()}))}_setVideoMirror(e){const t="user"===e?-1:1;this.$video.style.transform="scaleX("+t+")"}_getFacingMode(e){const t=e.getVideoTracks()[0];return t?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(e,t=null,r=null,n=!1){r=r||document.createElement("canvas");const o=t&&t.x?t.x:0,a=t&&t.y?t.y:0,i=t&&t.width?t.width:e.width||e.videoWidth,s=t&&t.height?t.height:e.height||e.videoHeight;if(!n){const e=t&&t.downScaledWidth?t.downScaledWidth:i,n=t&&t.downScaledHeight?t.downScaledHeight:s;r.width!==e&&(r.width=e),r.height!==n&&(r.height=n)}const c=r.getContext("2d",{alpha:!1});return c.imageSmoothingEnabled=!1,c.drawImage(e,o,a,i,s,0,0,r.width,r.height),[r,c]}static _loadImage(e){if(e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||window.ImageBitmap&&e instanceof window.ImageBitmap||window.OffscreenCanvas&&e instanceof window.OffscreenCanvas)return Promise.resolve(e);if(e instanceof Image)return og._awaitImageLoad(e).then((()=>e));if(e instanceof File||e instanceof Blob||e instanceof URL||"string"==typeof e){const t=new Image;return e instanceof File||e instanceof Blob?t.src=URL.createObjectURL(e):t.src=e,og._awaitImageLoad(t).then((()=>((e instanceof File||e instanceof Blob)&&URL.revokeObjectURL(t.src),t)))}return Promise.reject("Unsupported image type.")}static _awaitImageLoad(e){return new Promise(((t,r)=>{if(e.complete&&0!==e.naturalWidth)t();else{let n,o;n=()=>{e.removeEventListener("load",n),e.removeEventListener("error",o),t()},o=()=>{e.removeEventListener("load",n),e.removeEventListener("error",o),r("Image load error")},e.addEventListener("load",n),e.addEventListener("error",o)}}))}static _postWorkerMessage(e,t,r){return Promise.resolve(e).then((e=>{e instanceof Worker&&e.postMessage({type:t,data:r})}))}}function ag(){return ig.apply(this,arguments)}function ig(){return(ig=B(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return og.WORKER_PATH=li(),e.next=3,og.createQrEngine(og.WORKER_PATH);case 3:return t=e.sent,e.abrupt("return",{qrEngine:t});case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function sg(){return(sg=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]?c[0]:{},r=t.opencvUrl,e.next=3,Promise.all([ag(),$h({url:r})]);case 3:return n=e.sent,o=L(n,1),a=o[0].qrEngine,i=window,s=i.cv,e.abrupt("return",{qrScannerResources:{engine:a,canvas:document.createElement("canvas")},blackAndWhiteConverterResources:{kernel:s.matFromArray(3,3,s.CV_32FC1,[-1,-1,-1,-1,11,-1,-1,-1,-1]),canvas:document.createElement("canvas"),dst:new s.Mat}});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}og.DEFAULT_CANVAS_SIZE=400,og.NO_QR_CODE_FOUND="No QR code found",og.WORKER_PATH="qr-scanner-worker.min.js";var cg=od((function(){return sg.apply(this,arguments)})),lg=hi(mi((function(e,t){var r;"undefined"!=typeof self&&self,r=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this.width=t,this.height=e.length/t,this.data=e}return e.createEmpty=function(t,r){return new e(new Uint8ClampedArray(t*r),t)},e.prototype.get=function(e,t){return!(e<0||e>=this.width||t<0||t>=this.height||!this.data[t*this.width+e])},e.prototype.set=function(e,t,r){this.data[t*this.width+e]=r?1:0},e.prototype.setRegion=function(e,t,r,n,o){for(var a=t;a<t+n;a++)for(var i=e;i<e+r;i++)this.set(i,a,!!o)},e}();t.BitMatrix=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);t.addOrSubtractGF=function(e,t){return e^t};var o=function(){function e(e,t,r){this.primitive=e,this.size=t,this.generatorBase=r,this.expTable=new Array(this.size),this.logTable=new Array(this.size);for(var o=1,a=0;a<this.size;a++)this.expTable[a]=o,(o*=2)>=this.size&&(o=(o^this.primitive)&this.size-1);for(a=0;a<this.size-1;a++)this.logTable[this.expTable[a]]=a;this.zero=new n.default(this,Uint8ClampedArray.from([0])),this.one=new n.default(this,Uint8ClampedArray.from([1]))}return e.prototype.multiply=function(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]},e.prototype.inverse=function(e){if(0===e)throw new Error("Can't invert 0");return this.expTable[this.size-this.logTable[e]-1]},e.prototype.buildMonomial=function(e,t){if(e<0)throw new Error("Invalid monomial degree less than 0");if(0===t)return this.zero;var r=new Uint8ClampedArray(e+1);return r[0]=t,new n.default(this,r)},e.prototype.log=function(e){if(0===e)throw new Error("Can't take log(0)");return this.logTable[e]},e.prototype.exp=function(e){return this.expTable[e]},e}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=function(){function e(e,t){if(0===t.length)throw new Error("No coefficients.");this.field=e;var r=t.length;if(r>1&&0===t[0]){for(var n=1;n<r&&0===t[n];)n++;if(n===r)this.coefficients=e.zero.coefficients;else{this.coefficients=new Uint8ClampedArray(r-n);for(var o=0;o<this.coefficients.length;o++)this.coefficients[o]=t[n+o]}}else this.coefficients=t}return e.prototype.degree=function(){return this.coefficients.length-1},e.prototype.isZero=function(){return 0===this.coefficients[0]},e.prototype.getCoefficient=function(e){return this.coefficients[this.coefficients.length-1-e]},e.prototype.addOrSubtract=function(t){var r;if(this.isZero())return t;if(t.isZero())return this;var o=this.coefficients,a=t.coefficients;o.length>a.length&&(o=(r=[a,o])[0],a=r[1]);for(var i=new Uint8ClampedArray(a.length),s=a.length-o.length,c=0;c<s;c++)i[c]=a[c];for(c=s;c<a.length;c++)i[c]=n.addOrSubtractGF(o[c-s],a[c]);return new e(this.field,i)},e.prototype.multiply=function(t){if(0===t)return this.field.zero;if(1===t)return this;for(var r=this.coefficients.length,n=new Uint8ClampedArray(r),o=0;o<r;o++)n[o]=this.field.multiply(this.coefficients[o],t);return new e(this.field,n)},e.prototype.multiplyPoly=function(t){if(this.isZero()||t.isZero())return this.field.zero;for(var r=this.coefficients,o=r.length,a=t.coefficients,i=a.length,s=new Uint8ClampedArray(o+i-1),c=0;c<o;c++)for(var l=r[c],u=0;u<i;u++)s[c+u]=n.addOrSubtractGF(s[c+u],this.field.multiply(l,a[u]));return new e(this.field,s)},e.prototype.multiplyByMonomial=function(t,r){if(t<0)throw new Error("Invalid degree less than 0");if(0===r)return this.field.zero;for(var n=this.coefficients.length,o=new Uint8ClampedArray(n+t),a=0;a<n;a++)o[a]=this.field.multiply(this.coefficients[a],r);return new e(this.field,o)},e.prototype.evaluateAt=function(e){var t=0;if(0===e)return this.getCoefficient(0);var r=this.coefficients.length;if(1===e)return this.coefficients.forEach((function(e){t=n.addOrSubtractGF(t,e)})),t;t=this.coefficients[0];for(var o=1;o<r;o++)t=n.addOrSubtractGF(this.field.multiply(e,t),this.coefficients[o]);return t},e}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(4),o=r(5),a=r(11),i=r(12);function s(e){var t=i.locate(e);if(!t)return null;for(var r=0,n=t;r<n.length;r++){var s=n[r],c=a.extract(e,s),l=o.decode(c.matrix);if(l)return{binaryData:l.bytes,data:l.text,chunks:l.chunks,version:l.version,location:{topRightCorner:c.mappingFunction(s.dimension,0),topLeftCorner:c.mappingFunction(0,0),bottomRightCorner:c.mappingFunction(s.dimension,s.dimension),bottomLeftCorner:c.mappingFunction(0,s.dimension),topRightFinderPattern:s.topRight,topLeftFinderPattern:s.topLeft,bottomLeftFinderPattern:s.bottomLeft,bottomRightAlignmentPattern:s.alignmentPattern}}}return null}var c={inversionAttempts:"attemptBoth"};function l(e,t,r,o){void 0===o&&(o={});var a=c;Object.keys(a||{}).forEach((function(e){a[e]=o[e]||a[e]}));var i="attemptBoth"===a.inversionAttempts||"invertFirst"===a.inversionAttempts,l="onlyInvert"===a.inversionAttempts||"invertFirst"===a.inversionAttempts,u=n.binarize(e,t,r,i),d=u.binarized,f=u.inverted,p=s(l?f:d);return p||"attemptBoth"!==a.inversionAttempts&&"invertFirst"!==a.inversionAttempts||(p=s(l?d:f)),p}l.default=l,t.default=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);function o(e,t,r){return e<t?t:e>r?r:e}var a=function(){function e(e,t){this.width=e,this.data=new Uint8ClampedArray(e*t)}return e.prototype.get=function(e,t){return this.data[t*this.width+e]},e.prototype.set=function(e,t,r){this.data[t*this.width+e]=r},e}();t.binarize=function(e,t,r,i){if(e.length!==t*r*4)throw new Error("Malformed data passed to binarizer.");for(var s=new a(t,r),c=0;c<t;c++)for(var l=0;l<r;l++){var u=e[4*(l*t+c)+0],d=e[4*(l*t+c)+1],f=e[4*(l*t+c)+2];s.set(c,l,.2126*u+.7152*d+.0722*f)}for(var p=Math.ceil(t/8),h=Math.ceil(r/8),m=new a(p,h),g=0;g<h;g++)for(var v=0;v<p;v++){var y=0,b=1/0,C=0;for(l=0;l<8;l++)for(c=0;c<8;c++){var w=s.get(8*v+c,8*g+l);y+=w,b=Math.min(b,w),C=Math.max(C,w)}var k=y/Math.pow(8,2);if(C-b<=24&&(k=b/2,g>0&&v>0)){var B=(m.get(v,g-1)+2*m.get(v-1,g)+m.get(v-1,g-1))/4;b<B&&(k=B)}m.set(v,g,k)}var E=n.BitMatrix.createEmpty(t,r),S=null;for(i&&(S=n.BitMatrix.createEmpty(t,r)),g=0;g<h;g++)for(v=0;v<p;v++){for(var A=o(v,2,p-3),_=o(g,2,h-3),I=(y=0,-2);I<=2;I++)for(var T=-2;T<=2;T++)y+=m.get(A+I,_+T);var P=y/25;for(I=0;I<8;I++)for(T=0;T<8;T++){c=8*v+I,l=8*g+T;var x=s.get(c,l);E.set(c,l,x<=P),i&&S.set(c,l,!(x<=P))}}return i?{binarized:E,inverted:S}:{binarized:E}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(6),a=r(9),i=r(10);function s(e,t){for(var r=e^t,n=0;r;)n++,r&=r-1;return n}function c(e,t){return t<<1|e}var l=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1,dataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159,formatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3,dataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2,dataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],u=[function(e){return(e.y+e.x)%2==0},function(e){return e.y%2==0},function(e){return e.x%3==0},function(e){return(e.y+e.x)%3==0},function(e){return(Math.floor(e.y/2)+Math.floor(e.x/3))%2==0},function(e){return e.x*e.y%2+e.x*e.y%3==0},function(e){return(e.y*e.x%2+e.y*e.x%3)%2==0},function(e){return((e.y+e.x)%2+e.y*e.x%3)%2==0}];function d(e,t,r){for(var o=u[r.dataMask],a=e.height,i=function(e){var t=17+4*e.versionNumber,r=n.BitMatrix.createEmpty(t,t);r.setRegion(0,0,9,9,!0),r.setRegion(t-8,0,8,9,!0),r.setRegion(0,t-8,9,8,!0);for(var o=0,a=e.alignmentPatternCenters;o<a.length;o++)for(var i=a[o],s=0,c=e.alignmentPatternCenters;s<c.length;s++){var l=c[s];6===i&&6===l||6===i&&l===t-7||i===t-7&&6===l||r.setRegion(i-2,l-2,5,5,!0)}return r.setRegion(6,9,1,t-17,!0),r.setRegion(9,6,t-17,1,!0),e.versionNumber>6&&(r.setRegion(t-11,0,3,6,!0),r.setRegion(0,t-11,6,3,!0)),r}(t),s=[],l=0,d=0,f=!0,p=a-1;p>0;p-=2){6===p&&p--;for(var h=0;h<a;h++)for(var m=f?a-1-h:h,g=0;g<2;g++){var v=p-g;if(!i.get(v,m)){d++;var y=e.get(v,m);o({y:m,x:v})&&(y=!y),l=c(y,l),8===d&&(s.push(l),d=0,l=0)}}f=!f}return s}function f(e){var t=function(e){var t=e.height,r=Math.floor((t-17)/4);if(r<=6)return i.VERSIONS[r-1];for(var n=0,o=5;o>=0;o--)for(var a=t-9;a>=t-11;a--)n=c(e.get(a,o),n);var l=0;for(a=5;a>=0;a--)for(o=t-9;o>=t-11;o--)l=c(e.get(a,o),l);for(var u,d=1/0,f=0,p=i.VERSIONS;f<p.length;f++){var h=p[f];if(h.infoBits===n||h.infoBits===l)return h;var m=s(n,h.infoBits);m<d&&(u=h,d=m),(m=s(l,h.infoBits))<d&&(u=h,d=m)}return d<=3?u:void 0}(e);if(!t)return null;var r=function(e){for(var t=0,r=0;r<=8;r++)6!==r&&(t=c(e.get(r,8),t));for(var n=7;n>=0;n--)6!==n&&(t=c(e.get(8,n),t));var o=e.height,a=0;for(n=o-1;n>=o-7;n--)a=c(e.get(8,n),a);for(r=o-8;r<o;r++)a=c(e.get(r,8),a);for(var i=1/0,u=null,d=0,f=l;d<f.length;d++){var p=f[d],h=p.bits,m=p.formatInfo;if(h===t||h===a)return m;var g=s(t,h);g<i&&(u=m,i=g),t!==a&&(g=s(a,h))<i&&(u=m,i=g)}return i<=3?u:null}(e);if(!r)return null;var n=function(e,t,r){var n=t.errorCorrectionLevels[r],o=[],a=0;if(n.ecBlocks.forEach((function(e){for(var t=0;t<e.numBlocks;t++)o.push({numDataCodewords:e.dataCodewordsPerBlock,codewords:[]}),a+=e.dataCodewordsPerBlock+n.ecCodewordsPerBlock})),e.length<a)return null;e=e.slice(0,a);for(var i=n.ecBlocks[0].dataCodewordsPerBlock,s=0;s<i;s++)for(var c=0,l=o;c<l.length;c++)l[c].codewords.push(e.shift());if(n.ecBlocks.length>1){var u=n.ecBlocks[0].numBlocks,d=n.ecBlocks[1].numBlocks;for(s=0;s<d;s++)o[u+s].codewords.push(e.shift())}for(;e.length>0;)for(var f=0,p=o;f<p.length;f++)p[f].codewords.push(e.shift());return o}(d(e,t,r),t,r.errorCorrectionLevel);if(!n)return null;for(var u=n.reduce((function(e,t){return e+t.numDataCodewords}),0),f=new Uint8ClampedArray(u),p=0,h=0,m=n;h<m.length;h++){var g=m[h],v=a.decode(g.codewords,g.codewords.length-g.numDataCodewords);if(!v)return null;for(var y=0;y<g.numDataCodewords;y++)f[p++]=v[y]}try{return o.decode(f,t.versionNumber)}catch(e){return null}}t.decode=function(e){if(null==e)return null;var t=f(e);if(t)return t;for(var r=0;r<e.width;r++)for(var n=r+1;n<e.height;n++)e.get(r,n)!==e.get(n,r)&&(e.set(r,n,!e.get(r,n)),e.set(n,r,!e.get(n,r)));return f(e)}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o,a=r(7),i=r(8);function s(e,t){for(var r=[],n="",o=[10,12,14][t],a=e.readBits(o);a>=3;){if((l=e.readBits(10))>=1e3)throw new Error("Invalid numeric value above 999");var i=Math.floor(l/100),s=Math.floor(l/10)%10,c=l%10;r.push(48+i,48+s,48+c),n+=i.toString()+s.toString()+c.toString(),a-=3}if(2===a){if((l=e.readBits(7))>=100)throw new Error("Invalid numeric value above 99");i=Math.floor(l/10),s=l%10,r.push(48+i,48+s),n+=i.toString()+s.toString()}else if(1===a){var l;if((l=e.readBits(4))>=10)throw new Error("Invalid numeric value above 9");r.push(48+l),n+=l.toString()}return{bytes:r,text:n}}!function(e){e.Numeric="numeric",e.Alphanumeric="alphanumeric",e.Byte="byte",e.Kanji="kanji",e.ECI="eci"}(n=t.Mode||(t.Mode={})),function(e){e[e.Terminator=0]="Terminator",e[e.Numeric=1]="Numeric",e[e.Alphanumeric=2]="Alphanumeric",e[e.Byte=4]="Byte",e[e.Kanji=8]="Kanji",e[e.ECI=7]="ECI"}(o||(o={}));var c=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function l(e,t){for(var r=[],n="",o=[9,11,13][t],a=e.readBits(o);a>=2;){var i=e.readBits(11),s=Math.floor(i/45),l=i%45;r.push(c[s].charCodeAt(0),c[l].charCodeAt(0)),n+=c[s]+c[l],a-=2}return 1===a&&(s=e.readBits(6),r.push(c[s].charCodeAt(0)),n+=c[s]),{bytes:r,text:n}}function u(e,t){for(var r=[],n="",o=[8,16,16][t],a=e.readBits(o),i=0;i<a;i++){var s=e.readBits(8);r.push(s)}try{n+=decodeURIComponent(r.map((function(e){return"%"+("0"+e.toString(16)).substr(-2)})).join(""))}catch(e){}return{bytes:r,text:n}}function d(e,t){for(var r=[],n="",o=[8,10,12][t],a=e.readBits(o),s=0;s<a;s++){var c=e.readBits(13),l=Math.floor(c/192)<<8|c%192;l+=l<7936?33088:49472,r.push(l>>8,255&l),n+=String.fromCharCode(i.shiftJISTable[l])}return{bytes:r,text:n}}t.decode=function(e,t){for(var r,i,c,f,p=new a.BitStream(e),h=t<=9?0:t<=26?1:2,m={text:"",bytes:[],chunks:[],version:t};p.available()>=4;){var g=p.readBits(4);if(g===o.Terminator)return m;if(g===o.ECI)0===p.readBits(1)?m.chunks.push({type:n.ECI,assignmentNumber:p.readBits(7)}):0===p.readBits(1)?m.chunks.push({type:n.ECI,assignmentNumber:p.readBits(14)}):0===p.readBits(1)?m.chunks.push({type:n.ECI,assignmentNumber:p.readBits(21)}):m.chunks.push({type:n.ECI,assignmentNumber:-1});else if(g===o.Numeric){var v=s(p,h);m.text+=v.text,(r=m.bytes).push.apply(r,v.bytes),m.chunks.push({type:n.Numeric,text:v.text})}else if(g===o.Alphanumeric){var y=l(p,h);m.text+=y.text,(i=m.bytes).push.apply(i,y.bytes),m.chunks.push({type:n.Alphanumeric,text:y.text})}else if(g===o.Byte){var b=u(p,h);m.text+=b.text,(c=m.bytes).push.apply(c,b.bytes),m.chunks.push({type:n.Byte,bytes:b.bytes,text:b.text})}else if(g===o.Kanji){var C=d(p,h);m.text+=C.text,(f=m.bytes).push.apply(f,C.bytes),m.chunks.push({type:n.Kanji,bytes:C.bytes,text:C.text})}}if(0===p.available()||0===p.readBits(p.available()))return m}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this.byteOffset=0,this.bitOffset=0,this.bytes=e}return e.prototype.readBits=function(e){if(e<1||e>32||e>this.available())throw new Error("Cannot read "+e.toString()+" bits");var t=0;if(this.bitOffset>0){var r=8-this.bitOffset,n=e<r?e:r,o=255>>8-n<<(a=r-n);t=(this.bytes[this.byteOffset]&o)>>a,e-=n,this.bitOffset+=n,8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(e>0){for(;e>=8;)t=t<<8|255&this.bytes[this.byteOffset],this.byteOffset++,e-=8;var a;if(e>0)o=255>>(a=8-e)<<a,t=t<<e|(this.bytes[this.byteOffset]&o)>>a,this.bitOffset+=e}return t},e.prototype.available=function(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset},e}();t.BitStream=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.shiftJISTable={32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:165,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:8254,33088:12288,33089:12289,33090:12290,33091:65292,33092:65294,33093:12539,33094:65306,33095:65307,33096:65311,33097:65281,33098:12443,33099:12444,33100:180,33101:65344,33102:168,33103:65342,33104:65507,33105:65343,33106:12541,33107:12542,33108:12445,33109:12446,33110:12291,33111:20189,33112:12293,33113:12294,33114:12295,33115:12540,33116:8213,33117:8208,33118:65295,33119:92,33120:12316,33121:8214,33122:65372,33123:8230,33124:8229,33125:8216,33126:8217,33127:8220,33128:8221,33129:65288,33130:65289,33131:12308,33132:12309,33133:65339,33134:65341,33135:65371,33136:65373,33137:12296,33138:12297,33139:12298,33140:12299,33141:12300,33142:12301,33143:12302,33144:12303,33145:12304,33146:12305,33147:65291,33148:8722,33149:177,33150:215,33152:247,33153:65309,33154:8800,33155:65308,33156:65310,33157:8806,33158:8807,33159:8734,33160:8756,33161:9794,33162:9792,33163:176,33164:8242,33165:8243,33166:8451,33167:65509,33168:65284,33169:162,33170:163,33171:65285,33172:65283,33173:65286,33174:65290,33175:65312,33176:167,33177:9734,33178:9733,33179:9675,33180:9679,33181:9678,33182:9671,33183:9670,33184:9633,33185:9632,33186:9651,33187:9650,33188:9661,33189:9660,33190:8251,33191:12306,33192:8594,33193:8592,33194:8593,33195:8595,33196:12307,33208:8712,33209:8715,33210:8838,33211:8839,33212:8834,33213:8835,33214:8746,33215:8745,33224:8743,33225:8744,33226:172,33227:8658,33228:8660,33229:8704,33230:8707,33242:8736,33243:8869,33244:8978,33245:8706,33246:8711,33247:8801,33248:8786,33249:8810,33250:8811,33251:8730,33252:8765,33253:8733,33254:8757,33255:8747,33256:8748,33264:8491,33265:8240,33266:9839,33267:9837,33268:9834,33269:8224,33270:8225,33271:182,33276:9711,33359:65296,33360:65297,33361:65298,33362:65299,33363:65300,33364:65301,33365:65302,33366:65303,33367:65304,33368:65305,33376:65313,33377:65314,33378:65315,33379:65316,33380:65317,33381:65318,33382:65319,33383:65320,33384:65321,33385:65322,33386:65323,33387:65324,33388:65325,33389:65326,33390:65327,33391:65328,33392:65329,33393:65330,33394:65331,33395:65332,33396:65333,33397:65334,33398:65335,33399:65336,33400:65337,33401:65338,33409:65345,33410:65346,33411:65347,33412:65348,33413:65349,33414:65350,33415:65351,33416:65352,33417:65353,33418:65354,33419:65355,33420:65356,33421:65357,33422:65358,33423:65359,33424:65360,33425:65361,33426:65362,33427:65363,33428:65364,33429:65365,33430:65366,33431:65367,33432:65368,33433:65369,33434:65370,33439:12353,33440:12354,33441:12355,33442:12356,33443:12357,33444:12358,33445:12359,33446:12360,33447:12361,33448:12362,33449:12363,33450:12364,33451:12365,33452:12366,33453:12367,33454:12368,33455:12369,33456:12370,33457:12371,33458:12372,33459:12373,33460:12374,33461:12375,33462:12376,33463:12377,33464:12378,33465:12379,33466:12380,33467:12381,33468:12382,33469:12383,33470:12384,33471:12385,33472:12386,33473:12387,33474:12388,33475:12389,33476:12390,33477:12391,33478:12392,33479:12393,33480:12394,33481:12395,33482:12396,33483:12397,33484:12398,33485:12399,33486:12400,33487:12401,33488:12402,33489:12403,33490:12404,33491:12405,33492:12406,33493:12407,33494:12408,33495:12409,33496:12410,33497:12411,33498:12412,33499:12413,33500:12414,33501:12415,33502:12416,33503:12417,33504:12418,33505:12419,33506:12420,33507:12421,33508:12422,33509:12423,33510:12424,33511:12425,33512:12426,33513:12427,33514:12428,33515:12429,33516:12430,33517:12431,33518:12432,33519:12433,33520:12434,33521:12435,33600:12449,33601:12450,33602:12451,33603:12452,33604:12453,33605:12454,33606:12455,33607:12456,33608:12457,33609:12458,33610:12459,33611:12460,33612:12461,33613:12462,33614:12463,33615:12464,33616:12465,33617:12466,33618:12467,33619:12468,33620:12469,33621:12470,33622:12471,33623:12472,33624:12473,33625:12474,33626:12475,33627:12476,33628:12477,33629:12478,33630:12479,33631:12480,33632:12481,33633:12482,33634:12483,33635:12484,33636:12485,33637:12486,33638:12487,33639:12488,33640:12489,33641:12490,33642:12491,33643:12492,33644:12493,33645:12494,33646:12495,33647:12496,33648:12497,33649:12498,33650:12499,33651:12500,33652:12501,33653:12502,33654:12503,33655:12504,33656:12505,33657:12506,33658:12507,33659:12508,33660:12509,33661:12510,33662:12511,33664:12512,33665:12513,33666:12514,33667:12515,33668:12516,33669:12517,33670:12518,33671:12519,33672:12520,33673:12521,33674:12522,33675:12523,33676:12524,33677:12525,33678:12526,33679:12527,33680:12528,33681:12529,33682:12530,33683:12531,33684:12532,33685:12533,33686:12534,33695:913,33696:914,33697:915,33698:916,33699:917,33700:918,33701:919,33702:920,33703:921,33704:922,33705:923,33706:924,33707:925,33708:926,33709:927,33710:928,33711:929,33712:931,33713:932,33714:933,33715:934,33716:935,33717:936,33718:937,33727:945,33728:946,33729:947,33730:948,33731:949,33732:950,33733:951,33734:952,33735:953,33736:954,33737:955,33738:956,33739:957,33740:958,33741:959,33742:960,33743:961,33744:963,33745:964,33746:965,33747:966,33748:967,33749:968,33750:969,33856:1040,33857:1041,33858:1042,33859:1043,33860:1044,33861:1045,33862:1025,33863:1046,33864:1047,33865:1048,33866:1049,33867:1050,33868:1051,33869:1052,33870:1053,33871:1054,33872:1055,33873:1056,33874:1057,33875:1058,33876:1059,33877:1060,33878:1061,33879:1062,33880:1063,33881:1064,33882:1065,33883:1066,33884:1067,33885:1068,33886:1069,33887:1070,33888:1071,33904:1072,33905:1073,33906:1074,33907:1075,33908:1076,33909:1077,33910:1105,33911:1078,33912:1079,33913:1080,33914:1081,33915:1082,33916:1083,33917:1084,33918:1085,33920:1086,33921:1087,33922:1088,33923:1089,33924:1090,33925:1091,33926:1092,33927:1093,33928:1094,33929:1095,33930:1096,33931:1097,33932:1098,33933:1099,33934:1100,33935:1101,33936:1102,33937:1103,33951:9472,33952:9474,33953:9484,33954:9488,33955:9496,33956:9492,33957:9500,33958:9516,33959:9508,33960:9524,33961:9532,33962:9473,33963:9475,33964:9487,33965:9491,33966:9499,33967:9495,33968:9507,33969:9523,33970:9515,33971:9531,33972:9547,33973:9504,33974:9519,33975:9512,33976:9527,33977:9535,33978:9501,33979:9520,33980:9509,33981:9528,33982:9538,34975:20124,34976:21782,34977:23043,34978:38463,34979:21696,34980:24859,34981:25384,34982:23030,34983:36898,34984:33909,34985:33564,34986:31312,34987:24746,34988:25569,34989:28197,34990:26093,34991:33894,34992:33446,34993:39925,34994:26771,34995:22311,34996:26017,34997:25201,34998:23451,34999:22992,35e3:34427,35001:39156,35002:32098,35003:32190,35004:39822,35005:25110,35006:31903,35007:34999,35008:23433,35009:24245,35010:25353,35011:26263,35012:26696,35013:38343,35014:38797,35015:26447,35016:20197,35017:20234,35018:20301,35019:20381,35020:20553,35021:22258,35022:22839,35023:22996,35024:23041,35025:23561,35026:24799,35027:24847,35028:24944,35029:26131,35030:26885,35031:28858,35032:30031,35033:30064,35034:31227,35035:32173,35036:32239,35037:32963,35038:33806,35039:34915,35040:35586,35041:36949,35042:36986,35043:21307,35044:20117,35045:20133,35046:22495,35047:32946,35048:37057,35049:30959,35050:19968,35051:22769,35052:28322,35053:36920,35054:31282,35055:33576,35056:33419,35057:39983,35058:20801,35059:21360,35060:21693,35061:21729,35062:22240,35063:23035,35064:24341,35065:39154,35066:28139,35067:32996,35068:34093,35136:38498,35137:38512,35138:38560,35139:38907,35140:21515,35141:21491,35142:23431,35143:28879,35144:32701,35145:36802,35146:38632,35147:21359,35148:40284,35149:31418,35150:19985,35151:30867,35152:33276,35153:28198,35154:22040,35155:21764,35156:27421,35157:34074,35158:39995,35159:23013,35160:21417,35161:28006,35162:29916,35163:38287,35164:22082,35165:20113,35166:36939,35167:38642,35168:33615,35169:39180,35170:21473,35171:21942,35172:23344,35173:24433,35174:26144,35175:26355,35176:26628,35177:27704,35178:27891,35179:27945,35180:29787,35181:30408,35182:31310,35183:38964,35184:33521,35185:34907,35186:35424,35187:37613,35188:28082,35189:30123,35190:30410,35191:39365,35192:24742,35193:35585,35194:36234,35195:38322,35196:27022,35197:21421,35198:20870,35200:22290,35201:22576,35202:22852,35203:23476,35204:24310,35205:24616,35206:25513,35207:25588,35208:27839,35209:28436,35210:28814,35211:28948,35212:29017,35213:29141,35214:29503,35215:32257,35216:33398,35217:33489,35218:34199,35219:36960,35220:37467,35221:40219,35222:22633,35223:26044,35224:27738,35225:29989,35226:20985,35227:22830,35228:22885,35229:24448,35230:24540,35231:25276,35232:26106,35233:27178,35234:27431,35235:27572,35236:29579,35237:32705,35238:35158,35239:40236,35240:40206,35241:40644,35242:23713,35243:27798,35244:33659,35245:20740,35246:23627,35247:25014,35248:33222,35249:26742,35250:29281,35251:20057,35252:20474,35253:21368,35254:24681,35255:28201,35256:31311,35257:38899,35258:19979,35259:21270,35260:20206,35261:20309,35262:20285,35263:20385,35264:20339,35265:21152,35266:21487,35267:22025,35268:22799,35269:23233,35270:23478,35271:23521,35272:31185,35273:26247,35274:26524,35275:26550,35276:27468,35277:27827,35278:28779,35279:29634,35280:31117,35281:31166,35282:31292,35283:31623,35284:33457,35285:33499,35286:33540,35287:33655,35288:33775,35289:33747,35290:34662,35291:35506,35292:22057,35293:36008,35294:36838,35295:36942,35296:38686,35297:34442,35298:20420,35299:23784,35300:25105,35301:29273,35302:30011,35303:33253,35304:33469,35305:34558,35306:36032,35307:38597,35308:39187,35309:39381,35310:20171,35311:20250,35312:35299,35313:22238,35314:22602,35315:22730,35316:24315,35317:24555,35318:24618,35319:24724,35320:24674,35321:25040,35322:25106,35323:25296,35324:25913,35392:39745,35393:26214,35394:26800,35395:28023,35396:28784,35397:30028,35398:30342,35399:32117,35400:33445,35401:34809,35402:38283,35403:38542,35404:35997,35405:20977,35406:21182,35407:22806,35408:21683,35409:23475,35410:23830,35411:24936,35412:27010,35413:28079,35414:30861,35415:33995,35416:34903,35417:35442,35418:37799,35419:39608,35420:28012,35421:39336,35422:34521,35423:22435,35424:26623,35425:34510,35426:37390,35427:21123,35428:22151,35429:21508,35430:24275,35431:25313,35432:25785,35433:26684,35434:26680,35435:27579,35436:29554,35437:30906,35438:31339,35439:35226,35440:35282,35441:36203,35442:36611,35443:37101,35444:38307,35445:38548,35446:38761,35447:23398,35448:23731,35449:27005,35450:38989,35451:38990,35452:25499,35453:31520,35454:27179,35456:27263,35457:26806,35458:39949,35459:28511,35460:21106,35461:21917,35462:24688,35463:25324,35464:27963,35465:28167,35466:28369,35467:33883,35468:35088,35469:36676,35470:19988,35471:39993,35472:21494,35473:26907,35474:27194,35475:38788,35476:26666,35477:20828,35478:31427,35479:33970,35480:37340,35481:37772,35482:22107,35483:40232,35484:26658,35485:33541,35486:33841,35487:31909,35488:21e3,35489:33477,35490:29926,35491:20094,35492:20355,35493:20896,35494:23506,35495:21002,35496:21208,35497:21223,35498:24059,35499:21914,35500:22570,35501:23014,35502:23436,35503:23448,35504:23515,35505:24178,35506:24185,35507:24739,35508:24863,35509:24931,35510:25022,35511:25563,35512:25954,35513:26577,35514:26707,35515:26874,35516:27454,35517:27475,35518:27735,35519:28450,35520:28567,35521:28485,35522:29872,35523:29976,35524:30435,35525:30475,35526:31487,35527:31649,35528:31777,35529:32233,35530:32566,35531:32752,35532:32925,35533:33382,35534:33694,35535:35251,35536:35532,35537:36011,35538:36996,35539:37969,35540:38291,35541:38289,35542:38306,35543:38501,35544:38867,35545:39208,35546:33304,35547:20024,35548:21547,35549:23736,35550:24012,35551:29609,35552:30284,35553:30524,35554:23721,35555:32747,35556:36107,35557:38593,35558:38929,35559:38996,35560:39e3,35561:20225,35562:20238,35563:21361,35564:21916,35565:22120,35566:22522,35567:22855,35568:23305,35569:23492,35570:23696,35571:24076,35572:24190,35573:24524,35574:25582,35575:26426,35576:26071,35577:26082,35578:26399,35579:26827,35580:26820,35648:27231,35649:24112,35650:27589,35651:27671,35652:27773,35653:30079,35654:31048,35655:23395,35656:31232,35657:32e3,35658:24509,35659:35215,35660:35352,35661:36020,35662:36215,35663:36556,35664:36637,35665:39138,35666:39438,35667:39740,35668:20096,35669:20605,35670:20736,35671:22931,35672:23452,35673:25135,35674:25216,35675:25836,35676:27450,35677:29344,35678:30097,35679:31047,35680:32681,35681:34811,35682:35516,35683:35696,35684:25516,35685:33738,35686:38816,35687:21513,35688:21507,35689:21931,35690:26708,35691:27224,35692:35440,35693:30759,35694:26485,35695:40653,35696:21364,35697:23458,35698:33050,35699:34384,35700:36870,35701:19992,35702:20037,35703:20167,35704:20241,35705:21450,35706:21560,35707:23470,35708:24339,35709:24613,35710:25937,35712:26429,35713:27714,35714:27762,35715:27875,35716:28792,35717:29699,35718:31350,35719:31406,35720:31496,35721:32026,35722:31998,35723:32102,35724:26087,35725:29275,35726:21435,35727:23621,35728:24040,35729:25298,35730:25312,35731:25369,35732:28192,35733:34394,35734:35377,35735:36317,35736:37624,35737:28417,35738:31142,35739:39770,35740:20136,35741:20139,35742:20140,35743:20379,35744:20384,35745:20689,35746:20807,35747:31478,35748:20849,35749:20982,35750:21332,35751:21281,35752:21375,35753:21483,35754:21932,35755:22659,35756:23777,35757:24375,35758:24394,35759:24623,35760:24656,35761:24685,35762:25375,35763:25945,35764:27211,35765:27841,35766:29378,35767:29421,35768:30703,35769:33016,35770:33029,35771:33288,35772:34126,35773:37111,35774:37857,35775:38911,35776:39255,35777:39514,35778:20208,35779:20957,35780:23597,35781:26241,35782:26989,35783:23616,35784:26354,35785:26997,35786:29577,35787:26704,35788:31873,35789:20677,35790:21220,35791:22343,35792:24062,35793:37670,35794:26020,35795:27427,35796:27453,35797:29748,35798:31105,35799:31165,35800:31563,35801:32202,35802:33465,35803:33740,35804:34943,35805:35167,35806:35641,35807:36817,35808:37329,35809:21535,35810:37504,35811:20061,35812:20534,35813:21477,35814:21306,35815:29399,35816:29590,35817:30697,35818:33510,35819:36527,35820:39366,35821:39368,35822:39378,35823:20855,35824:24858,35825:34398,35826:21936,35827:31354,35828:20598,35829:23507,35830:36935,35831:38533,35832:20018,35833:27355,35834:37351,35835:23633,35836:23624,35904:25496,35905:31391,35906:27795,35907:38772,35908:36705,35909:31402,35910:29066,35911:38536,35912:31874,35913:26647,35914:32368,35915:26705,35916:37740,35917:21234,35918:21531,35919:34219,35920:35347,35921:32676,35922:36557,35923:37089,35924:21350,35925:34952,35926:31041,35927:20418,35928:20670,35929:21009,35930:20804,35931:21843,35932:22317,35933:29674,35934:22411,35935:22865,35936:24418,35937:24452,35938:24693,35939:24950,35940:24935,35941:25001,35942:25522,35943:25658,35944:25964,35945:26223,35946:26690,35947:28179,35948:30054,35949:31293,35950:31995,35951:32076,35952:32153,35953:32331,35954:32619,35955:33550,35956:33610,35957:34509,35958:35336,35959:35427,35960:35686,35961:36605,35962:38938,35963:40335,35964:33464,35965:36814,35966:39912,35968:21127,35969:25119,35970:25731,35971:28608,35972:38553,35973:26689,35974:20625,35975:27424,35976:27770,35977:28500,35978:31348,35979:32080,35980:34880,35981:35363,35982:26376,35983:20214,35984:20537,35985:20518,35986:20581,35987:20860,35988:21048,35989:21091,35990:21927,35991:22287,35992:22533,35993:23244,35994:24314,35995:25010,35996:25080,35997:25331,35998:25458,35999:26908,36e3:27177,36001:29309,36002:29356,36003:29486,36004:30740,36005:30831,36006:32121,36007:30476,36008:32937,36009:35211,36010:35609,36011:36066,36012:36562,36013:36963,36014:37749,36015:38522,36016:38997,36017:39443,36018:40568,36019:20803,36020:21407,36021:21427,36022:24187,36023:24358,36024:28187,36025:28304,36026:29572,36027:29694,36028:32067,36029:33335,36030:35328,36031:35578,36032:38480,36033:20046,36034:20491,36035:21476,36036:21628,36037:22266,36038:22993,36039:23396,36040:24049,36041:24235,36042:24359,36043:25144,36044:25925,36045:26543,36046:28246,36047:29392,36048:31946,36049:34996,36050:32929,36051:32993,36052:33776,36053:34382,36054:35463,36055:36328,36056:37431,36057:38599,36058:39015,36059:40723,36060:20116,36061:20114,36062:20237,36063:21320,36064:21577,36065:21566,36066:23087,36067:24460,36068:24481,36069:24735,36070:26791,36071:27278,36072:29786,36073:30849,36074:35486,36075:35492,36076:35703,36077:37264,36078:20062,36079:39881,36080:20132,36081:20348,36082:20399,36083:20505,36084:20502,36085:20809,36086:20844,36087:21151,36088:21177,36089:21246,36090:21402,36091:21475,36092:21521,36160:21518,36161:21897,36162:22353,36163:22434,36164:22909,36165:23380,36166:23389,36167:23439,36168:24037,36169:24039,36170:24055,36171:24184,36172:24195,36173:24218,36174:24247,36175:24344,36176:24658,36177:24908,36178:25239,36179:25304,36180:25511,36181:25915,36182:26114,36183:26179,36184:26356,36185:26477,36186:26657,36187:26775,36188:27083,36189:27743,36190:27946,36191:28009,36192:28207,36193:28317,36194:30002,36195:30343,36196:30828,36197:31295,36198:31968,36199:32005,36200:32024,36201:32094,36202:32177,36203:32789,36204:32771,36205:32943,36206:32945,36207:33108,36208:33167,36209:33322,36210:33618,36211:34892,36212:34913,36213:35611,36214:36002,36215:36092,36216:37066,36217:37237,36218:37489,36219:30783,36220:37628,36221:38308,36222:38477,36224:38917,36225:39321,36226:39640,36227:40251,36228:21083,36229:21163,36230:21495,36231:21512,36232:22741,36233:25335,36234:28640,36235:35946,36236:36703,36237:40633,36238:20811,36239:21051,36240:21578,36241:22269,36242:31296,36243:37239,36244:40288,36245:40658,36246:29508,36247:28425,36248:33136,36249:29969,36250:24573,36251:24794,36252:39592,36253:29403,36254:36796,36255:27492,36256:38915,36257:20170,36258:22256,36259:22372,36260:22718,36261:23130,36262:24680,36263:25031,36264:26127,36265:26118,36266:26681,36267:26801,36268:28151,36269:30165,36270:32058,36271:33390,36272:39746,36273:20123,36274:20304,36275:21449,36276:21766,36277:23919,36278:24038,36279:24046,36280:26619,36281:27801,36282:29811,36283:30722,36284:35408,36285:37782,36286:35039,36287:22352,36288:24231,36289:25387,36290:20661,36291:20652,36292:20877,36293:26368,36294:21705,36295:22622,36296:22971,36297:23472,36298:24425,36299:25165,36300:25505,36301:26685,36302:27507,36303:28168,36304:28797,36305:37319,36306:29312,36307:30741,36308:30758,36309:31085,36310:25998,36311:32048,36312:33756,36313:35009,36314:36617,36315:38555,36316:21092,36317:22312,36318:26448,36319:32618,36320:36001,36321:20916,36322:22338,36323:38442,36324:22586,36325:27018,36326:32948,36327:21682,36328:23822,36329:22524,36330:30869,36331:40442,36332:20316,36333:21066,36334:21643,36335:25662,36336:26152,36337:26388,36338:26613,36339:31364,36340:31574,36341:32034,36342:37679,36343:26716,36344:39853,36345:31545,36346:21273,36347:20874,36348:21047,36416:23519,36417:25334,36418:25774,36419:25830,36420:26413,36421:27578,36422:34217,36423:38609,36424:30352,36425:39894,36426:25420,36427:37638,36428:39851,36429:30399,36430:26194,36431:19977,36432:20632,36433:21442,36434:23665,36435:24808,36436:25746,36437:25955,36438:26719,36439:29158,36440:29642,36441:29987,36442:31639,36443:32386,36444:34453,36445:35715,36446:36059,36447:37240,36448:39184,36449:26028,36450:26283,36451:27531,36452:20181,36453:20180,36454:20282,36455:20351,36456:21050,36457:21496,36458:21490,36459:21987,36460:22235,36461:22763,36462:22987,36463:22985,36464:23039,36465:23376,36466:23629,36467:24066,36468:24107,36469:24535,36470:24605,36471:25351,36472:25903,36473:23388,36474:26031,36475:26045,36476:26088,36477:26525,36478:27490,36480:27515,36481:27663,36482:29509,36483:31049,36484:31169,36485:31992,36486:32025,36487:32043,36488:32930,36489:33026,36490:33267,36491:35222,36492:35422,36493:35433,36494:35430,36495:35468,36496:35566,36497:36039,36498:36060,36499:38604,36500:39164,36501:27503,36502:20107,36503:20284,36504:20365,36505:20816,36506:23383,36507:23546,36508:24904,36509:25345,36510:26178,36511:27425,36512:28363,36513:27835,36514:29246,36515:29885,36516:30164,36517:30913,36518:31034,36519:32780,36520:32819,36521:33258,36522:33940,36523:36766,36524:27728,36525:40575,36526:24335,36527:35672,36528:40235,36529:31482,36530:36600,36531:23437,36532:38635,36533:19971,36534:21489,36535:22519,36536:22833,36537:23241,36538:23460,36539:24713,36540:28287,36541:28422,36542:30142,36543:36074,36544:23455,36545:34048,36546:31712,36547:20594,36548:26612,36549:33437,36550:23649,36551:34122,36552:32286,36553:33294,36554:20889,36555:23556,36556:25448,36557:36198,36558:26012,36559:29038,36560:31038,36561:32023,36562:32773,36563:35613,36564:36554,36565:36974,36566:34503,36567:37034,36568:20511,36569:21242,36570:23610,36571:26451,36572:28796,36573:29237,36574:37196,36575:37320,36576:37675,36577:33509,36578:23490,36579:24369,36580:24825,36581:20027,36582:21462,36583:23432,36584:25163,36585:26417,36586:27530,36587:29417,36588:29664,36589:31278,36590:33131,36591:36259,36592:37202,36593:39318,36594:20754,36595:21463,36596:21610,36597:23551,36598:25480,36599:27193,36600:32172,36601:38656,36602:22234,36603:21454,36604:21608,36672:23447,36673:23601,36674:24030,36675:20462,36676:24833,36677:25342,36678:27954,36679:31168,36680:31179,36681:32066,36682:32333,36683:32722,36684:33261,36685:33311,36686:33936,36687:34886,36688:35186,36689:35728,36690:36468,36691:36655,36692:36913,36693:37195,36694:37228,36695:38598,36696:37276,36697:20160,36698:20303,36699:20805,36700:21313,36701:24467,36702:25102,36703:26580,36704:27713,36705:28171,36706:29539,36707:32294,36708:37325,36709:37507,36710:21460,36711:22809,36712:23487,36713:28113,36714:31069,36715:32302,36716:31899,36717:22654,36718:29087,36719:20986,36720:34899,36721:36848,36722:20426,36723:23803,36724:26149,36725:30636,36726:31459,36727:33308,36728:39423,36729:20934,36730:24490,36731:26092,36732:26991,36733:27529,36734:28147,36736:28310,36737:28516,36738:30462,36739:32020,36740:24033,36741:36981,36742:37255,36743:38918,36744:20966,36745:21021,36746:25152,36747:26257,36748:26329,36749:28186,36750:24246,36751:32210,36752:32626,36753:26360,36754:34223,36755:34295,36756:35576,36757:21161,36758:21465,36759:22899,36760:24207,36761:24464,36762:24661,36763:37604,36764:38500,36765:20663,36766:20767,36767:21213,36768:21280,36769:21319,36770:21484,36771:21736,36772:21830,36773:21809,36774:22039,36775:22888,36776:22974,36777:23100,36778:23477,36779:23558,36780:23567,36781:23569,36782:23578,36783:24196,36784:24202,36785:24288,36786:24432,36787:25215,36788:25220,36789:25307,36790:25484,36791:25463,36792:26119,36793:26124,36794:26157,36795:26230,36796:26494,36797:26786,36798:27167,36799:27189,36800:27836,36801:28040,36802:28169,36803:28248,36804:28988,36805:28966,36806:29031,36807:30151,36808:30465,36809:30813,36810:30977,36811:31077,36812:31216,36813:31456,36814:31505,36815:31911,36816:32057,36817:32918,36818:33750,36819:33931,36820:34121,36821:34909,36822:35059,36823:35359,36824:35388,36825:35412,36826:35443,36827:35937,36828:36062,36829:37284,36830:37478,36831:37758,36832:37912,36833:38556,36834:38808,36835:19978,36836:19976,36837:19998,36838:20055,36839:20887,36840:21104,36841:22478,36842:22580,36843:22732,36844:23330,36845:24120,36846:24773,36847:25854,36848:26465,36849:26454,36850:27972,36851:29366,36852:30067,36853:31331,36854:33976,36855:35698,36856:37304,36857:37664,36858:22065,36859:22516,36860:39166,36928:25325,36929:26893,36930:27542,36931:29165,36932:32340,36933:32887,36934:33394,36935:35302,36936:39135,36937:34645,36938:36785,36939:23611,36940:20280,36941:20449,36942:20405,36943:21767,36944:23072,36945:23517,36946:23529,36947:24515,36948:24910,36949:25391,36950:26032,36951:26187,36952:26862,36953:27035,36954:28024,36955:28145,36956:30003,36957:30137,36958:30495,36959:31070,36960:31206,36961:32051,36962:33251,36963:33455,36964:34218,36965:35242,36966:35386,36967:36523,36968:36763,36969:36914,36970:37341,36971:38663,36972:20154,36973:20161,36974:20995,36975:22645,36976:22764,36977:23563,36978:29978,36979:23613,36980:33102,36981:35338,36982:36805,36983:38499,36984:38765,36985:31525,36986:35535,36987:38920,36988:37218,36989:22259,36990:21416,36992:36887,36993:21561,36994:22402,36995:24101,36996:25512,36997:27700,36998:28810,36999:30561,37e3:31883,37001:32736,37002:34928,37003:36930,37004:37204,37005:37648,37006:37656,37007:38543,37008:29790,37009:39620,37010:23815,37011:23913,37012:25968,37013:26530,37014:36264,37015:38619,37016:25454,37017:26441,37018:26905,37019:33733,37020:38935,37021:38592,37022:35070,37023:28548,37024:25722,37025:23544,37026:19990,37027:28716,37028:30045,37029:26159,37030:20932,37031:21046,37032:21218,37033:22995,37034:24449,37035:24615,37036:25104,37037:25919,37038:25972,37039:26143,37040:26228,37041:26866,37042:26646,37043:27491,37044:28165,37045:29298,37046:29983,37047:30427,37048:31934,37049:32854,37050:22768,37051:35069,37052:35199,37053:35488,37054:35475,37055:35531,37056:36893,37057:37266,37058:38738,37059:38745,37060:25993,37061:31246,37062:33030,37063:38587,37064:24109,37065:24796,37066:25114,37067:26021,37068:26132,37069:26512,37070:30707,37071:31309,37072:31821,37073:32318,37074:33034,37075:36012,37076:36196,37077:36321,37078:36447,37079:30889,37080:20999,37081:25305,37082:25509,37083:25666,37084:25240,37085:35373,37086:31363,37087:31680,37088:35500,37089:38634,37090:32118,37091:33292,37092:34633,37093:20185,37094:20808,37095:21315,37096:21344,37097:23459,37098:23554,37099:23574,37100:24029,37101:25126,37102:25159,37103:25776,37104:26643,37105:26676,37106:27849,37107:27973,37108:27927,37109:26579,37110:28508,37111:29006,37112:29053,37113:26059,37114:31359,37115:31661,37116:32218,37184:32330,37185:32680,37186:33146,37187:33307,37188:33337,37189:34214,37190:35438,37191:36046,37192:36341,37193:36984,37194:36983,37195:37549,37196:37521,37197:38275,37198:39854,37199:21069,37200:21892,37201:28472,37202:28982,37203:20840,37204:31109,37205:32341,37206:33203,37207:31950,37208:22092,37209:22609,37210:23720,37211:25514,37212:26366,37213:26365,37214:26970,37215:29401,37216:30095,37217:30094,37218:30990,37219:31062,37220:31199,37221:31895,37222:32032,37223:32068,37224:34311,37225:35380,37226:38459,37227:36961,37228:40736,37229:20711,37230:21109,37231:21452,37232:21474,37233:20489,37234:21930,37235:22766,37236:22863,37237:29245,37238:23435,37239:23652,37240:21277,37241:24803,37242:24819,37243:25436,37244:25475,37245:25407,37246:25531,37248:25805,37249:26089,37250:26361,37251:24035,37252:27085,37253:27133,37254:28437,37255:29157,37256:20105,37257:30185,37258:30456,37259:31379,37260:31967,37261:32207,37262:32156,37263:32865,37264:33609,37265:33624,37266:33900,37267:33980,37268:34299,37269:35013,37270:36208,37271:36865,37272:36973,37273:37783,37274:38684,37275:39442,37276:20687,37277:22679,37278:24974,37279:33235,37280:34101,37281:36104,37282:36896,37283:20419,37284:20596,37285:21063,37286:21363,37287:24687,37288:25417,37289:26463,37290:28204,37291:36275,37292:36895,37293:20439,37294:23646,37295:36042,37296:26063,37297:32154,37298:21330,37299:34966,37300:20854,37301:25539,37302:23384,37303:23403,37304:23562,37305:25613,37306:26449,37307:36956,37308:20182,37309:22810,37310:22826,37311:27760,37312:35409,37313:21822,37314:22549,37315:22949,37316:24816,37317:25171,37318:26561,37319:33333,37320:26965,37321:38464,37322:39364,37323:39464,37324:20307,37325:22534,37326:23550,37327:32784,37328:23729,37329:24111,37330:24453,37331:24608,37332:24907,37333:25140,37334:26367,37335:27888,37336:28382,37337:32974,37338:33151,37339:33492,37340:34955,37341:36024,37342:36864,37343:36910,37344:38538,37345:40667,37346:39899,37347:20195,37348:21488,37349:22823,37350:31532,37351:37261,37352:38988,37353:40441,37354:28381,37355:28711,37356:21331,37357:21828,37358:23429,37359:25176,37360:25246,37361:25299,37362:27810,37363:28655,37364:29730,37365:35351,37366:37944,37367:28609,37368:35582,37369:33592,37370:20967,37371:34552,37372:21482,37440:21481,37441:20294,37442:36948,37443:36784,37444:22890,37445:33073,37446:24061,37447:31466,37448:36799,37449:26842,37450:35895,37451:29432,37452:40008,37453:27197,37454:35504,37455:20025,37456:21336,37457:22022,37458:22374,37459:25285,37460:25506,37461:26086,37462:27470,37463:28129,37464:28251,37465:28845,37466:30701,37467:31471,37468:31658,37469:32187,37470:32829,37471:32966,37472:34507,37473:35477,37474:37723,37475:22243,37476:22727,37477:24382,37478:26029,37479:26262,37480:27264,37481:27573,37482:30007,37483:35527,37484:20516,37485:30693,37486:22320,37487:24347,37488:24677,37489:26234,37490:27744,37491:30196,37492:31258,37493:32622,37494:33268,37495:34584,37496:36933,37497:39347,37498:31689,37499:30044,37500:31481,37501:31569,37502:33988,37504:36880,37505:31209,37506:31378,37507:33590,37508:23265,37509:30528,37510:20013,37511:20210,37512:23449,37513:24544,37514:25277,37515:26172,37516:26609,37517:27880,37518:34411,37519:34935,37520:35387,37521:37198,37522:37619,37523:39376,37524:27159,37525:28710,37526:29482,37527:33511,37528:33879,37529:36015,37530:19969,37531:20806,37532:20939,37533:21899,37534:23541,37535:24086,37536:24115,37537:24193,37538:24340,37539:24373,37540:24427,37541:24500,37542:25074,37543:25361,37544:26274,37545:26397,37546:28526,37547:29266,37548:30010,37549:30522,37550:32884,37551:33081,37552:33144,37553:34678,37554:35519,37555:35548,37556:36229,37557:36339,37558:37530,37559:38263,37560:38914,37561:40165,37562:21189,37563:25431,37564:30452,37565:26389,37566:27784,37567:29645,37568:36035,37569:37806,37570:38515,37571:27941,37572:22684,37573:26894,37574:27084,37575:36861,37576:37786,37577:30171,37578:36890,37579:22618,37580:26626,37581:25524,37582:27131,37583:20291,37584:28460,37585:26584,37586:36795,37587:34086,37588:32180,37589:37716,37590:26943,37591:28528,37592:22378,37593:22775,37594:23340,37595:32044,37596:29226,37597:21514,37598:37347,37599:40372,37600:20141,37601:20302,37602:20572,37603:20597,37604:21059,37605:35998,37606:21576,37607:22564,37608:23450,37609:24093,37610:24213,37611:24237,37612:24311,37613:24351,37614:24716,37615:25269,37616:25402,37617:25552,37618:26799,37619:27712,37620:30855,37621:31118,37622:31243,37623:32224,37624:33351,37625:35330,37626:35558,37627:36420,37628:36883,37696:37048,37697:37165,37698:37336,37699:40718,37700:27877,37701:25688,37702:25826,37703:25973,37704:28404,37705:30340,37706:31515,37707:36969,37708:37841,37709:28346,37710:21746,37711:24505,37712:25764,37713:36685,37714:36845,37715:37444,37716:20856,37717:22635,37718:22825,37719:23637,37720:24215,37721:28155,37722:32399,37723:29980,37724:36028,37725:36578,37726:39003,37727:28857,37728:20253,37729:27583,37730:28593,37731:3e4,37732:38651,37733:20814,37734:21520,37735:22581,37736:22615,37737:22956,37738:23648,37739:24466,37740:26007,37741:26460,37742:28193,37743:30331,37744:33759,37745:36077,37746:36884,37747:37117,37748:37709,37749:30757,37750:30778,37751:21162,37752:24230,37753:22303,37754:22900,37755:24594,37756:20498,37757:20826,37758:20908,37760:20941,37761:20992,37762:21776,37763:22612,37764:22616,37765:22871,37766:23445,37767:23798,37768:23947,37769:24764,37770:25237,37771:25645,37772:26481,37773:26691,37774:26812,37775:26847,37776:30423,37777:28120,37778:28271,37779:28059,37780:28783,37781:29128,37782:24403,37783:30168,37784:31095,37785:31561,37786:31572,37787:31570,37788:31958,37789:32113,37790:21040,37791:33891,37792:34153,37793:34276,37794:35342,37795:35588,37796:35910,37797:36367,37798:36867,37799:36879,37800:37913,37801:38518,37802:38957,37803:39472,37804:38360,37805:20685,37806:21205,37807:21516,37808:22530,37809:23566,37810:24999,37811:25758,37812:27934,37813:30643,37814:31461,37815:33012,37816:33796,37817:36947,37818:37509,37819:23776,37820:40199,37821:21311,37822:24471,37823:24499,37824:28060,37825:29305,37826:30563,37827:31167,37828:31716,37829:27602,37830:29420,37831:35501,37832:26627,37833:27233,37834:20984,37835:31361,37836:26932,37837:23626,37838:40182,37839:33515,37840:23493,37841:37193,37842:28702,37843:22136,37844:23663,37845:24775,37846:25958,37847:27788,37848:35930,37849:36929,37850:38931,37851:21585,37852:26311,37853:37389,37854:22856,37855:37027,37856:20869,37857:20045,37858:20970,37859:34201,37860:35598,37861:28760,37862:25466,37863:37707,37864:26978,37865:39348,37866:32260,37867:30071,37868:21335,37869:26976,37870:36575,37871:38627,37872:27741,37873:20108,37874:23612,37875:24336,37876:36841,37877:21250,37878:36049,37879:32905,37880:34425,37881:24319,37882:26085,37883:20083,37884:20837,37952:22914,37953:23615,37954:38894,37955:20219,37956:22922,37957:24525,37958:35469,37959:28641,37960:31152,37961:31074,37962:23527,37963:33905,37964:29483,37965:29105,37966:24180,37967:24565,37968:25467,37969:25754,37970:29123,37971:31896,37972:20035,37973:24316,37974:20043,37975:22492,37976:22178,37977:24745,37978:28611,37979:32013,37980:33021,37981:33075,37982:33215,37983:36786,37984:35223,37985:34468,37986:24052,37987:25226,37988:25773,37989:35207,37990:26487,37991:27874,37992:27966,37993:29750,37994:30772,37995:23110,37996:32629,37997:33453,37998:39340,37999:20467,38e3:24259,38001:25309,38002:25490,38003:25943,38004:26479,38005:30403,38006:29260,38007:32972,38008:32954,38009:36649,38010:37197,38011:20493,38012:22521,38013:23186,38014:26757,38016:26995,38017:29028,38018:29437,38019:36023,38020:22770,38021:36064,38022:38506,38023:36889,38024:34687,38025:31204,38026:30695,38027:33833,38028:20271,38029:21093,38030:21338,38031:25293,38032:26575,38033:27850,38034:30333,38035:31636,38036:31893,38037:33334,38038:34180,38039:36843,38040:26333,38041:28448,38042:29190,38043:32283,38044:33707,38045:39361,38046:40614,38047:20989,38048:31665,38049:30834,38050:31672,38051:32903,38052:31560,38053:27368,38054:24161,38055:32908,38056:30033,38057:30048,38058:20843,38059:37474,38060:28300,38061:30330,38062:37271,38063:39658,38064:20240,38065:32624,38066:25244,38067:31567,38068:38309,38069:40169,38070:22138,38071:22617,38072:34532,38073:38588,38074:20276,38075:21028,38076:21322,38077:21453,38078:21467,38079:24070,38080:25644,38081:26001,38082:26495,38083:27710,38084:27726,38085:29256,38086:29359,38087:29677,38088:30036,38089:32321,38090:33324,38091:34281,38092:36009,38093:31684,38094:37318,38095:29033,38096:38930,38097:39151,38098:25405,38099:26217,38100:30058,38101:30436,38102:30928,38103:34115,38104:34542,38105:21290,38106:21329,38107:21542,38108:22915,38109:24199,38110:24444,38111:24754,38112:25161,38113:25209,38114:25259,38115:26e3,38116:27604,38117:27852,38118:30130,38119:30382,38120:30865,38121:31192,38122:32203,38123:32631,38124:32933,38125:34987,38126:35513,38127:36027,38128:36991,38129:38750,38130:39131,38131:27147,38132:31800,38133:20633,38134:23614,38135:24494,38136:26503,38137:27608,38138:29749,38139:30473,38140:32654,38208:40763,38209:26570,38210:31255,38211:21305,38212:30091,38213:39661,38214:24422,38215:33181,38216:33777,38217:32920,38218:24380,38219:24517,38220:30050,38221:31558,38222:36924,38223:26727,38224:23019,38225:23195,38226:32016,38227:30334,38228:35628,38229:20469,38230:24426,38231:27161,38232:27703,38233:28418,38234:29922,38235:31080,38236:34920,38237:35413,38238:35961,38239:24287,38240:25551,38241:30149,38242:31186,38243:33495,38244:37672,38245:37618,38246:33948,38247:34541,38248:39981,38249:21697,38250:24428,38251:25996,38252:27996,38253:28693,38254:36007,38255:36051,38256:38971,38257:25935,38258:29942,38259:19981,38260:20184,38261:22496,38262:22827,38263:23142,38264:23500,38265:20904,38266:24067,38267:24220,38268:24598,38269:25206,38270:25975,38272:26023,38273:26222,38274:28014,38275:29238,38276:31526,38277:33104,38278:33178,38279:33433,38280:35676,38281:36e3,38282:36070,38283:36212,38284:38428,38285:38468,38286:20398,38287:25771,38288:27494,38289:33310,38290:33889,38291:34154,38292:37096,38293:23553,38294:26963,38295:39080,38296:33914,38297:34135,38298:20239,38299:21103,38300:24489,38301:24133,38302:26381,38303:31119,38304:33145,38305:35079,38306:35206,38307:28149,38308:24343,38309:25173,38310:27832,38311:20175,38312:29289,38313:39826,38314:20998,38315:21563,38316:22132,38317:22707,38318:24996,38319:25198,38320:28954,38321:22894,38322:31881,38323:31966,38324:32027,38325:38640,38326:25991,38327:32862,38328:19993,38329:20341,38330:20853,38331:22592,38332:24163,38333:24179,38334:24330,38335:26564,38336:20006,38337:34109,38338:38281,38339:38491,38340:31859,38341:38913,38342:20731,38343:22721,38344:30294,38345:30887,38346:21029,38347:30629,38348:34065,38349:31622,38350:20559,38351:22793,38352:29255,38353:31687,38354:32232,38355:36794,38356:36820,38357:36941,38358:20415,38359:21193,38360:23081,38361:24321,38362:38829,38363:20445,38364:33303,38365:37610,38366:22275,38367:25429,38368:27497,38369:29995,38370:35036,38371:36628,38372:31298,38373:21215,38374:22675,38375:24917,38376:25098,38377:26286,38378:27597,38379:31807,38380:33769,38381:20515,38382:20472,38383:21253,38384:21574,38385:22577,38386:22857,38387:23453,38388:23792,38389:23791,38390:23849,38391:24214,38392:25265,38393:25447,38394:25918,38395:26041,38396:26379,38464:27861,38465:27873,38466:28921,38467:30770,38468:32299,38469:32990,38470:33459,38471:33804,38472:34028,38473:34562,38474:35090,38475:35370,38476:35914,38477:37030,38478:37586,38479:39165,38480:40179,38481:40300,38482:20047,38483:20129,38484:20621,38485:21078,38486:22346,38487:22952,38488:24125,38489:24536,38490:24537,38491:25151,38492:26292,38493:26395,38494:26576,38495:26834,38496:20882,38497:32033,38498:32938,38499:33192,38500:35584,38501:35980,38502:36031,38503:37502,38504:38450,38505:21536,38506:38956,38507:21271,38508:20693,38509:21340,38510:22696,38511:25778,38512:26420,38513:29287,38514:30566,38515:31302,38516:37350,38517:21187,38518:27809,38519:27526,38520:22528,38521:24140,38522:22868,38523:26412,38524:32763,38525:20961,38526:30406,38528:25705,38529:30952,38530:39764,38531:40635,38532:22475,38533:22969,38534:26151,38535:26522,38536:27598,38537:21737,38538:27097,38539:24149,38540:33180,38541:26517,38542:39850,38543:26622,38544:40018,38545:26717,38546:20134,38547:20451,38548:21448,38549:25273,38550:26411,38551:27819,38552:36804,38553:20397,38554:32365,38555:40639,38556:19975,38557:24930,38558:28288,38559:28459,38560:34067,38561:21619,38562:26410,38563:39749,38564:24051,38565:31637,38566:23724,38567:23494,38568:34588,38569:28234,38570:34001,38571:31252,38572:33032,38573:22937,38574:31885,38575:27665,38576:30496,38577:21209,38578:22818,38579:28961,38580:29279,38581:30683,38582:38695,38583:40289,38584:26891,38585:23167,38586:23064,38587:20901,38588:21517,38589:21629,38590:26126,38591:30431,38592:36855,38593:37528,38594:40180,38595:23018,38596:29277,38597:28357,38598:20813,38599:26825,38600:32191,38601:32236,38602:38754,38603:40634,38604:25720,38605:27169,38606:33538,38607:22916,38608:23391,38609:27611,38610:29467,38611:30450,38612:32178,38613:32791,38614:33945,38615:20786,38616:26408,38617:40665,38618:30446,38619:26466,38620:21247,38621:39173,38622:23588,38623:25147,38624:31870,38625:36016,38626:21839,38627:24758,38628:32011,38629:38272,38630:21249,38631:20063,38632:20918,38633:22812,38634:29242,38635:32822,38636:37326,38637:24357,38638:30690,38639:21380,38640:24441,38641:32004,38642:34220,38643:35379,38644:36493,38645:38742,38646:26611,38647:34222,38648:37971,38649:24841,38650:24840,38651:27833,38652:30290,38720:35565,38721:36664,38722:21807,38723:20305,38724:20778,38725:21191,38726:21451,38727:23461,38728:24189,38729:24736,38730:24962,38731:25558,38732:26377,38733:26586,38734:28263,38735:28044,38736:29494,38737:29495,38738:30001,38739:31056,38740:35029,38741:35480,38742:36938,38743:37009,38744:37109,38745:38596,38746:34701,38747:22805,38748:20104,38749:20313,38750:19982,38751:35465,38752:36671,38753:38928,38754:20653,38755:24188,38756:22934,38757:23481,38758:24248,38759:25562,38760:25594,38761:25793,38762:26332,38763:26954,38764:27096,38765:27915,38766:28342,38767:29076,38768:29992,38769:31407,38770:32650,38771:32768,38772:33865,38773:33993,38774:35201,38775:35617,38776:36362,38777:36965,38778:38525,38779:39178,38780:24958,38781:25233,38782:27442,38784:27779,38785:28020,38786:32716,38787:32764,38788:28096,38789:32645,38790:34746,38791:35064,38792:26469,38793:33713,38794:38972,38795:38647,38796:27931,38797:32097,38798:33853,38799:37226,38800:20081,38801:21365,38802:23888,38803:27396,38804:28651,38805:34253,38806:34349,38807:35239,38808:21033,38809:21519,38810:23653,38811:26446,38812:26792,38813:29702,38814:29827,38815:30178,38816:35023,38817:35041,38818:37324,38819:38626,38820:38520,38821:24459,38822:29575,38823:31435,38824:33870,38825:25504,38826:30053,38827:21129,38828:27969,38829:28316,38830:29705,38831:30041,38832:30827,38833:31890,38834:38534,38835:31452,38836:40845,38837:20406,38838:24942,38839:26053,38840:34396,38841:20102,38842:20142,38843:20698,38844:20001,38845:20940,38846:23534,38847:26009,38848:26753,38849:28092,38850:29471,38851:30274,38852:30637,38853:31260,38854:31975,38855:33391,38856:35538,38857:36988,38858:37327,38859:38517,38860:38936,38861:21147,38862:32209,38863:20523,38864:21400,38865:26519,38866:28107,38867:29136,38868:29747,38869:33256,38870:36650,38871:38563,38872:40023,38873:40607,38874:29792,38875:22593,38876:28057,38877:32047,38878:39006,38879:20196,38880:20278,38881:20363,38882:20919,38883:21169,38884:23994,38885:24604,38886:29618,38887:31036,38888:33491,38889:37428,38890:38583,38891:38646,38892:38666,38893:40599,38894:40802,38895:26278,38896:27508,38897:21015,38898:21155,38899:28872,38900:35010,38901:24265,38902:24651,38903:24976,38904:28451,38905:29001,38906:31806,38907:32244,38908:32879,38976:34030,38977:36899,38978:37676,38979:21570,38980:39791,38981:27347,38982:28809,38983:36034,38984:36335,38985:38706,38986:21172,38987:23105,38988:24266,38989:24324,38990:26391,38991:27004,38992:27028,38993:28010,38994:28431,38995:29282,38996:29436,38997:31725,38998:32769,38999:32894,39e3:34635,39001:37070,39002:20845,39003:40595,39004:31108,39005:32907,39006:37682,39007:35542,39008:20525,39009:21644,39010:35441,39011:27498,39012:36036,39013:33031,39014:24785,39015:26528,39016:40434,39017:20121,39018:20120,39019:39952,39020:35435,39021:34241,39022:34152,39023:26880,39024:28286,39025:30871,39026:33109,39071:24332,39072:19984,39073:19989,39074:20010,39075:20017,39076:20022,39077:20028,39078:20031,39079:20034,39080:20054,39081:20056,39082:20098,39083:20101,39084:35947,39085:20106,39086:33298,39087:24333,39088:20110,39089:20126,39090:20127,39091:20128,39092:20130,39093:20144,39094:20147,39095:20150,39096:20174,39097:20173,39098:20164,39099:20166,39100:20162,39101:20183,39102:20190,39103:20205,39104:20191,39105:20215,39106:20233,39107:20314,39108:20272,39109:20315,39110:20317,39111:20311,39112:20295,39113:20342,39114:20360,39115:20367,39116:20376,39117:20347,39118:20329,39119:20336,39120:20369,39121:20335,39122:20358,39123:20374,39124:20760,39125:20436,39126:20447,39127:20430,39128:20440,39129:20443,39130:20433,39131:20442,39132:20432,39133:20452,39134:20453,39135:20506,39136:20520,39137:20500,39138:20522,39139:20517,39140:20485,39141:20252,39142:20470,39143:20513,39144:20521,39145:20524,39146:20478,39147:20463,39148:20497,39149:20486,39150:20547,39151:20551,39152:26371,39153:20565,39154:20560,39155:20552,39156:20570,39157:20566,39158:20588,39159:20600,39160:20608,39161:20634,39162:20613,39163:20660,39164:20658,39232:20681,39233:20682,39234:20659,39235:20674,39236:20694,39237:20702,39238:20709,39239:20717,39240:20707,39241:20718,39242:20729,39243:20725,39244:20745,39245:20737,39246:20738,39247:20758,39248:20757,39249:20756,39250:20762,39251:20769,39252:20794,39253:20791,39254:20796,39255:20795,39256:20799,39257:20800,39258:20818,39259:20812,39260:20820,39261:20834,39262:31480,39263:20841,39264:20842,39265:20846,39266:20864,39267:20866,39268:22232,39269:20876,39270:20873,39271:20879,39272:20881,39273:20883,39274:20885,39275:20886,39276:20900,39277:20902,39278:20898,39279:20905,39280:20906,39281:20907,39282:20915,39283:20913,39284:20914,39285:20912,39286:20917,39287:20925,39288:20933,39289:20937,39290:20955,39291:20960,39292:34389,39293:20969,39294:20973,39296:20976,39297:20981,39298:20990,39299:20996,39300:21003,39301:21012,39302:21006,39303:21031,39304:21034,39305:21038,39306:21043,39307:21049,39308:21071,39309:21060,39310:21067,39311:21068,39312:21086,39313:21076,39314:21098,39315:21108,39316:21097,39317:21107,39318:21119,39319:21117,39320:21133,39321:21140,39322:21138,39323:21105,39324:21128,39325:21137,39326:36776,39327:36775,39328:21164,39329:21165,39330:21180,39331:21173,39332:21185,39333:21197,39334:21207,39335:21214,39336:21219,39337:21222,39338:39149,39339:21216,39340:21235,39341:21237,39342:21240,39343:21241,39344:21254,39345:21256,39346:30008,39347:21261,39348:21264,39349:21263,39350:21269,39351:21274,39352:21283,39353:21295,39354:21297,39355:21299,39356:21304,39357:21312,39358:21318,39359:21317,39360:19991,39361:21321,39362:21325,39363:20950,39364:21342,39365:21353,39366:21358,39367:22808,39368:21371,39369:21367,39370:21378,39371:21398,39372:21408,39373:21414,39374:21413,39375:21422,39376:21424,39377:21430,39378:21443,39379:31762,39380:38617,39381:21471,39382:26364,39383:29166,39384:21486,39385:21480,39386:21485,39387:21498,39388:21505,39389:21565,39390:21568,39391:21548,39392:21549,39393:21564,39394:21550,39395:21558,39396:21545,39397:21533,39398:21582,39399:21647,39400:21621,39401:21646,39402:21599,39403:21617,39404:21623,39405:21616,39406:21650,39407:21627,39408:21632,39409:21622,39410:21636,39411:21648,39412:21638,39413:21703,39414:21666,39415:21688,39416:21669,39417:21676,39418:21700,39419:21704,39420:21672,39488:21675,39489:21698,39490:21668,39491:21694,39492:21692,39493:21720,39494:21733,39495:21734,39496:21775,39497:21780,39498:21757,39499:21742,39500:21741,39501:21754,39502:21730,39503:21817,39504:21824,39505:21859,39506:21836,39507:21806,39508:21852,39509:21829,39510:21846,39511:21847,39512:21816,39513:21811,39514:21853,39515:21913,39516:21888,39517:21679,39518:21898,39519:21919,39520:21883,39521:21886,39522:21912,39523:21918,39524:21934,39525:21884,39526:21891,39527:21929,39528:21895,39529:21928,39530:21978,39531:21957,39532:21983,39533:21956,39534:21980,39535:21988,39536:21972,39537:22036,39538:22007,39539:22038,39540:22014,39541:22013,39542:22043,39543:22009,39544:22094,39545:22096,39546:29151,39547:22068,39548:22070,39549:22066,39550:22072,39552:22123,39553:22116,39554:22063,39555:22124,39556:22122,39557:22150,39558:22144,39559:22154,39560:22176,39561:22164,39562:22159,39563:22181,39564:22190,39565:22198,39566:22196,39567:22210,39568:22204,39569:22209,39570:22211,39571:22208,39572:22216,39573:22222,39574:22225,39575:22227,39576:22231,39577:22254,39578:22265,39579:22272,39580:22271,39581:22276,39582:22281,39583:22280,39584:22283,39585:22285,39586:22291,39587:22296,39588:22294,39589:21959,39590:22300,39591:22310,39592:22327,39593:22328,39594:22350,39595:22331,39596:22336,39597:22351,39598:22377,39599:22464,39600:22408,39601:22369,39602:22399,39603:22409,39604:22419,39605:22432,39606:22451,39607:22436,39608:22442,39609:22448,39610:22467,39611:22470,39612:22484,39613:22482,39614:22483,39615:22538,39616:22486,39617:22499,39618:22539,39619:22553,39620:22557,39621:22642,39622:22561,39623:22626,39624:22603,39625:22640,39626:27584,39627:22610,39628:22589,39629:22649,39630:22661,39631:22713,39632:22687,39633:22699,39634:22714,39635:22750,39636:22715,39637:22712,39638:22702,39639:22725,39640:22739,39641:22737,39642:22743,39643:22745,39644:22744,39645:22757,39646:22748,39647:22756,39648:22751,39649:22767,39650:22778,39651:22777,39652:22779,39653:22780,39654:22781,39655:22786,39656:22794,39657:22800,39658:22811,39659:26790,39660:22821,39661:22828,39662:22829,39663:22834,39664:22840,39665:22846,39666:31442,39667:22869,39668:22864,39669:22862,39670:22874,39671:22872,39672:22882,39673:22880,39674:22887,39675:22892,39676:22889,39744:22904,39745:22913,39746:22941,39747:20318,39748:20395,39749:22947,39750:22962,39751:22982,39752:23016,39753:23004,39754:22925,39755:23001,39756:23002,39757:23077,39758:23071,39759:23057,39760:23068,39761:23049,39762:23066,39763:23104,39764:23148,39765:23113,39766:23093,39767:23094,39768:23138,39769:23146,39770:23194,39771:23228,39772:23230,39773:23243,39774:23234,39775:23229,39776:23267,39777:23255,39778:23270,39779:23273,39780:23254,39781:23290,39782:23291,39783:23308,39784:23307,39785:23318,39786:23346,39787:23248,39788:23338,39789:23350,39790:23358,39791:23363,39792:23365,39793:23360,39794:23377,39795:23381,39796:23386,39797:23387,39798:23397,39799:23401,39800:23408,39801:23411,39802:23413,39803:23416,39804:25992,39805:23418,39806:23424,39808:23427,39809:23462,39810:23480,39811:23491,39812:23495,39813:23497,39814:23508,39815:23504,39816:23524,39817:23526,39818:23522,39819:23518,39820:23525,39821:23531,39822:23536,39823:23542,39824:23539,39825:23557,39826:23559,39827:23560,39828:23565,39829:23571,39830:23584,39831:23586,39832:23592,39833:23608,39834:23609,39835:23617,39836:23622,39837:23630,39838:23635,39839:23632,39840:23631,39841:23409,39842:23660,39843:23662,39844:20066,39845:23670,39846:23673,39847:23692,39848:23697,39849:23700,39850:22939,39851:23723,39852:23739,39853:23734,39854:23740,39855:23735,39856:23749,39857:23742,39858:23751,39859:23769,39860:23785,39861:23805,39862:23802,39863:23789,39864:23948,39865:23786,39866:23819,39867:23829,39868:23831,39869:23900,39870:23839,39871:23835,39872:23825,39873:23828,39874:23842,39875:23834,39876:23833,39877:23832,39878:23884,39879:23890,39880:23886,39881:23883,39882:23916,39883:23923,39884:23926,39885:23943,39886:23940,39887:23938,39888:23970,39889:23965,39890:23980,39891:23982,39892:23997,39893:23952,39894:23991,39895:23996,39896:24009,39897:24013,39898:24019,39899:24018,39900:24022,39901:24027,39902:24043,39903:24050,39904:24053,39905:24075,39906:24090,39907:24089,39908:24081,39909:24091,39910:24118,39911:24119,39912:24132,39913:24131,39914:24128,39915:24142,39916:24151,39917:24148,39918:24159,39919:24162,39920:24164,39921:24135,39922:24181,39923:24182,39924:24186,39925:40636,39926:24191,39927:24224,39928:24257,39929:24258,39930:24264,39931:24272,39932:24271,4e4:24278,40001:24291,40002:24285,40003:24282,40004:24283,40005:24290,40006:24289,40007:24296,40008:24297,40009:24300,40010:24305,40011:24307,40012:24304,40013:24308,40014:24312,40015:24318,40016:24323,40017:24329,40018:24413,40019:24412,40020:24331,40021:24337,40022:24342,40023:24361,40024:24365,40025:24376,40026:24385,40027:24392,40028:24396,40029:24398,40030:24367,40031:24401,40032:24406,40033:24407,40034:24409,40035:24417,40036:24429,40037:24435,40038:24439,40039:24451,40040:24450,40041:24447,40042:24458,40043:24456,40044:24465,40045:24455,40046:24478,40047:24473,40048:24472,40049:24480,40050:24488,40051:24493,40052:24508,40053:24534,40054:24571,40055:24548,40056:24568,40057:24561,40058:24541,40059:24755,40060:24575,40061:24609,40062:24672,40064:24601,40065:24592,40066:24617,40067:24590,40068:24625,40069:24603,40070:24597,40071:24619,40072:24614,40073:24591,40074:24634,40075:24666,40076:24641,40077:24682,40078:24695,40079:24671,40080:24650,40081:24646,40082:24653,40083:24675,40084:24643,40085:24676,40086:24642,40087:24684,40088:24683,40089:24665,40090:24705,40091:24717,40092:24807,40093:24707,40094:24730,40095:24708,40096:24731,40097:24726,40098:24727,40099:24722,40100:24743,40101:24715,40102:24801,40103:24760,40104:24800,40105:24787,40106:24756,40107:24560,40108:24765,40109:24774,40110:24757,40111:24792,40112:24909,40113:24853,40114:24838,40115:24822,40116:24823,40117:24832,40118:24820,40119:24826,40120:24835,40121:24865,40122:24827,40123:24817,40124:24845,40125:24846,40126:24903,40127:24894,40128:24872,40129:24871,40130:24906,40131:24895,40132:24892,40133:24876,40134:24884,40135:24893,40136:24898,40137:24900,40138:24947,40139:24951,40140:24920,40141:24921,40142:24922,40143:24939,40144:24948,40145:24943,40146:24933,40147:24945,40148:24927,40149:24925,40150:24915,40151:24949,40152:24985,40153:24982,40154:24967,40155:25004,40156:24980,40157:24986,40158:24970,40159:24977,40160:25003,40161:25006,40162:25036,40163:25034,40164:25033,40165:25079,40166:25032,40167:25027,40168:25030,40169:25018,40170:25035,40171:32633,40172:25037,40173:25062,40174:25059,40175:25078,40176:25082,40177:25076,40178:25087,40179:25085,40180:25084,40181:25086,40182:25088,40183:25096,40184:25097,40185:25101,40186:25100,40187:25108,40188:25115,40256:25118,40257:25121,40258:25130,40259:25134,40260:25136,40261:25138,40262:25139,40263:25153,40264:25166,40265:25182,40266:25187,40267:25179,40268:25184,40269:25192,40270:25212,40271:25218,40272:25225,40273:25214,40274:25234,40275:25235,40276:25238,40277:25300,40278:25219,40279:25236,40280:25303,40281:25297,40282:25275,40283:25295,40284:25343,40285:25286,40286:25812,40287:25288,40288:25308,40289:25292,40290:25290,40291:25282,40292:25287,40293:25243,40294:25289,40295:25356,40296:25326,40297:25329,40298:25383,40299:25346,40300:25352,40301:25327,40302:25333,40303:25424,40304:25406,40305:25421,40306:25628,40307:25423,40308:25494,40309:25486,40310:25472,40311:25515,40312:25462,40313:25507,40314:25487,40315:25481,40316:25503,40317:25525,40318:25451,40320:25449,40321:25534,40322:25577,40323:25536,40324:25542,40325:25571,40326:25545,40327:25554,40328:25590,40329:25540,40330:25622,40331:25652,40332:25606,40333:25619,40334:25638,40335:25654,40336:25885,40337:25623,40338:25640,40339:25615,40340:25703,40341:25711,40342:25718,40343:25678,40344:25898,40345:25749,40346:25747,40347:25765,40348:25769,40349:25736,40350:25788,40351:25818,40352:25810,40353:25797,40354:25799,40355:25787,40356:25816,40357:25794,40358:25841,40359:25831,40360:33289,40361:25824,40362:25825,40363:25260,40364:25827,40365:25839,40366:25900,40367:25846,40368:25844,40369:25842,40370:25850,40371:25856,40372:25853,40373:25880,40374:25884,40375:25861,40376:25892,40377:25891,40378:25899,40379:25908,40380:25909,40381:25911,40382:25910,40383:25912,40384:30027,40385:25928,40386:25942,40387:25941,40388:25933,40389:25944,40390:25950,40391:25949,40392:25970,40393:25976,40394:25986,40395:25987,40396:35722,40397:26011,40398:26015,40399:26027,40400:26039,40401:26051,40402:26054,40403:26049,40404:26052,40405:26060,40406:26066,40407:26075,40408:26073,40409:26080,40410:26081,40411:26097,40412:26482,40413:26122,40414:26115,40415:26107,40416:26483,40417:26165,40418:26166,40419:26164,40420:26140,40421:26191,40422:26180,40423:26185,40424:26177,40425:26206,40426:26205,40427:26212,40428:26215,40429:26216,40430:26207,40431:26210,40432:26224,40433:26243,40434:26248,40435:26254,40436:26249,40437:26244,40438:26264,40439:26269,40440:26305,40441:26297,40442:26313,40443:26302,40444:26300,40512:26308,40513:26296,40514:26326,40515:26330,40516:26336,40517:26175,40518:26342,40519:26345,40520:26352,40521:26357,40522:26359,40523:26383,40524:26390,40525:26398,40526:26406,40527:26407,40528:38712,40529:26414,40530:26431,40531:26422,40532:26433,40533:26424,40534:26423,40535:26438,40536:26462,40537:26464,40538:26457,40539:26467,40540:26468,40541:26505,40542:26480,40543:26537,40544:26492,40545:26474,40546:26508,40547:26507,40548:26534,40549:26529,40550:26501,40551:26551,40552:26607,40553:26548,40554:26604,40555:26547,40556:26601,40557:26552,40558:26596,40559:26590,40560:26589,40561:26594,40562:26606,40563:26553,40564:26574,40565:26566,40566:26599,40567:27292,40568:26654,40569:26694,40570:26665,40571:26688,40572:26701,40573:26674,40574:26702,40576:26803,40577:26667,40578:26713,40579:26723,40580:26743,40581:26751,40582:26783,40583:26767,40584:26797,40585:26772,40586:26781,40587:26779,40588:26755,40589:27310,40590:26809,40591:26740,40592:26805,40593:26784,40594:26810,40595:26895,40596:26765,40597:26750,40598:26881,40599:26826,40600:26888,40601:26840,40602:26914,40603:26918,40604:26849,40605:26892,40606:26829,40607:26836,40608:26855,40609:26837,40610:26934,40611:26898,40612:26884,40613:26839,40614:26851,40615:26917,40616:26873,40617:26848,40618:26863,40619:26920,40620:26922,40621:26906,40622:26915,40623:26913,40624:26822,40625:27001,40626:26999,40627:26972,40628:27e3,40629:26987,40630:26964,40631:27006,40632:26990,40633:26937,40634:26996,40635:26941,40636:26969,40637:26928,40638:26977,40639:26974,40640:26973,40641:27009,40642:26986,40643:27058,40644:27054,40645:27088,40646:27071,40647:27073,40648:27091,40649:27070,40650:27086,40651:23528,40652:27082,40653:27101,40654:27067,40655:27075,40656:27047,40657:27182,40658:27025,40659:27040,40660:27036,40661:27029,40662:27060,40663:27102,40664:27112,40665:27138,40666:27163,40667:27135,40668:27402,40669:27129,40670:27122,40671:27111,40672:27141,40673:27057,40674:27166,40675:27117,40676:27156,40677:27115,40678:27146,40679:27154,40680:27329,40681:27171,40682:27155,40683:27204,40684:27148,40685:27250,40686:27190,40687:27256,40688:27207,40689:27234,40690:27225,40691:27238,40692:27208,40693:27192,40694:27170,40695:27280,40696:27277,40697:27296,40698:27268,40699:27298,40700:27299,40768:27287,40769:34327,40770:27323,40771:27331,40772:27330,40773:27320,40774:27315,40775:27308,40776:27358,40777:27345,40778:27359,40779:27306,40780:27354,40781:27370,40782:27387,40783:27397,40784:34326,40785:27386,40786:27410,40787:27414,40788:39729,40789:27423,40790:27448,40791:27447,40792:30428,40793:27449,40794:39150,40795:27463,40796:27459,40797:27465,40798:27472,40799:27481,40800:27476,40801:27483,40802:27487,40803:27489,40804:27512,40805:27513,40806:27519,40807:27520,40808:27524,40809:27523,40810:27533,40811:27544,40812:27541,40813:27550,40814:27556,40815:27562,40816:27563,40817:27567,40818:27570,40819:27569,40820:27571,40821:27575,40822:27580,40823:27590,40824:27595,40825:27603,40826:27615,40827:27628,40828:27627,40829:27635,40830:27631,40832:40638,40833:27656,40834:27667,40835:27668,40836:27675,40837:27684,40838:27683,40839:27742,40840:27733,40841:27746,40842:27754,40843:27778,40844:27789,40845:27802,40846:27777,40847:27803,40848:27774,40849:27752,40850:27763,40851:27794,40852:27792,40853:27844,40854:27889,40855:27859,40856:27837,40857:27863,40858:27845,40859:27869,40860:27822,40861:27825,40862:27838,40863:27834,40864:27867,40865:27887,40866:27865,40867:27882,40868:27935,40869:34893,40870:27958,40871:27947,40872:27965,40873:27960,40874:27929,40875:27957,40876:27955,40877:27922,40878:27916,40879:28003,40880:28051,40881:28004,40882:27994,40883:28025,40884:27993,40885:28046,40886:28053,40887:28644,40888:28037,40889:28153,40890:28181,40891:28170,40892:28085,40893:28103,40894:28134,40895:28088,40896:28102,40897:28140,40898:28126,40899:28108,40900:28136,40901:28114,40902:28101,40903:28154,40904:28121,40905:28132,40906:28117,40907:28138,40908:28142,40909:28205,40910:28270,40911:28206,40912:28185,40913:28274,40914:28255,40915:28222,40916:28195,40917:28267,40918:28203,40919:28278,40920:28237,40921:28191,40922:28227,40923:28218,40924:28238,40925:28196,40926:28415,40927:28189,40928:28216,40929:28290,40930:28330,40931:28312,40932:28361,40933:28343,40934:28371,40935:28349,40936:28335,40937:28356,40938:28338,40939:28372,40940:28373,40941:28303,40942:28325,40943:28354,40944:28319,40945:28481,40946:28433,40947:28748,40948:28396,40949:28408,40950:28414,40951:28479,40952:28402,40953:28465,40954:28399,40955:28466,40956:28364,161:65377,162:65378,163:65379,164:65380,165:65381,166:65382,167:65383,168:65384,169:65385,170:65386,171:65387,172:65388,173:65389,174:65390,175:65391,176:65392,177:65393,178:65394,179:65395,180:65396,181:65397,182:65398,183:65399,184:65400,185:65401,186:65402,187:65403,188:65404,189:65405,190:65406,191:65407,192:65408,193:65409,194:65410,195:65411,196:65412,197:65413,198:65414,199:65415,200:65416,201:65417,202:65418,203:65419,204:65420,205:65421,206:65422,207:65423,208:65424,209:65425,210:65426,211:65427,212:65428,213:65429,214:65430,215:65431,216:65432,217:65433,218:65434,219:65435,220:65436,221:65437,222:65438,223:65439,57408:28478,57409:28435,57410:28407,57411:28550,57412:28538,57413:28536,57414:28545,57415:28544,57416:28527,57417:28507,57418:28659,57419:28525,57420:28546,57421:28540,57422:28504,57423:28558,57424:28561,57425:28610,57426:28518,57427:28595,57428:28579,57429:28577,57430:28580,57431:28601,57432:28614,57433:28586,57434:28639,57435:28629,57436:28652,57437:28628,57438:28632,57439:28657,57440:28654,57441:28635,57442:28681,57443:28683,57444:28666,57445:28689,57446:28673,57447:28687,57448:28670,57449:28699,57450:28698,57451:28532,57452:28701,57453:28696,57454:28703,57455:28720,57456:28734,57457:28722,57458:28753,57459:28771,57460:28825,57461:28818,57462:28847,57463:28913,57464:28844,57465:28856,57466:28851,57467:28846,57468:28895,57469:28875,57470:28893,57472:28889,57473:28937,57474:28925,57475:28956,57476:28953,57477:29029,57478:29013,57479:29064,57480:29030,57481:29026,57482:29004,57483:29014,57484:29036,57485:29071,57486:29179,57487:29060,57488:29077,57489:29096,57490:29100,57491:29143,57492:29113,57493:29118,57494:29138,57495:29129,57496:29140,57497:29134,57498:29152,57499:29164,57500:29159,57501:29173,57502:29180,57503:29177,57504:29183,57505:29197,57506:29200,57507:29211,57508:29224,57509:29229,57510:29228,57511:29232,57512:29234,57513:29243,57514:29244,57515:29247,57516:29248,57517:29254,57518:29259,57519:29272,57520:29300,57521:29310,57522:29314,57523:29313,57524:29319,57525:29330,57526:29334,57527:29346,57528:29351,57529:29369,57530:29362,57531:29379,57532:29382,57533:29380,57534:29390,57535:29394,57536:29410,57537:29408,57538:29409,57539:29433,57540:29431,57541:20495,57542:29463,57543:29450,57544:29468,57545:29462,57546:29469,57547:29492,57548:29487,57549:29481,57550:29477,57551:29502,57552:29518,57553:29519,57554:40664,57555:29527,57556:29546,57557:29544,57558:29552,57559:29560,57560:29557,57561:29563,57562:29562,57563:29640,57564:29619,57565:29646,57566:29627,57567:29632,57568:29669,57569:29678,57570:29662,57571:29858,57572:29701,57573:29807,57574:29733,57575:29688,57576:29746,57577:29754,57578:29781,57579:29759,57580:29791,57581:29785,57582:29761,57583:29788,57584:29801,57585:29808,57586:29795,57587:29802,57588:29814,57589:29822,57590:29835,57591:29854,57592:29863,57593:29898,57594:29903,57595:29908,57596:29681,57664:29920,57665:29923,57666:29927,57667:29929,57668:29934,57669:29938,57670:29936,57671:29937,57672:29944,57673:29943,57674:29956,57675:29955,57676:29957,57677:29964,57678:29966,57679:29965,57680:29973,57681:29971,57682:29982,57683:29990,57684:29996,57685:30012,57686:30020,57687:30029,57688:30026,57689:30025,57690:30043,57691:30022,57692:30042,57693:30057,57694:30052,57695:30055,57696:30059,57697:30061,57698:30072,57699:30070,57700:30086,57701:30087,57702:30068,57703:30090,57704:30089,57705:30082,57706:30100,57707:30106,57708:30109,57709:30117,57710:30115,57711:30146,57712:30131,57713:30147,57714:30133,57715:30141,57716:30136,57717:30140,57718:30129,57719:30157,57720:30154,57721:30162,57722:30169,57723:30179,57724:30174,57725:30206,57726:30207,57728:30204,57729:30209,57730:30192,57731:30202,57732:30194,57733:30195,57734:30219,57735:30221,57736:30217,57737:30239,57738:30247,57739:30240,57740:30241,57741:30242,57742:30244,57743:30260,57744:30256,57745:30267,57746:30279,57747:30280,57748:30278,57749:30300,57750:30296,57751:30305,57752:30306,57753:30312,57754:30313,57755:30314,57756:30311,57757:30316,57758:30320,57759:30322,57760:30326,57761:30328,57762:30332,57763:30336,57764:30339,57765:30344,57766:30347,57767:30350,57768:30358,57769:30355,57770:30361,57771:30362,57772:30384,57773:30388,57774:30392,57775:30393,57776:30394,57777:30402,57778:30413,57779:30422,57780:30418,57781:30430,57782:30433,57783:30437,57784:30439,57785:30442,57786:34351,57787:30459,57788:30472,57789:30471,57790:30468,57791:30505,57792:30500,57793:30494,57794:30501,57795:30502,57796:30491,57797:30519,57798:30520,57799:30535,57800:30554,57801:30568,57802:30571,57803:30555,57804:30565,57805:30591,57806:30590,57807:30585,57808:30606,57809:30603,57810:30609,57811:30624,57812:30622,57813:30640,57814:30646,57815:30649,57816:30655,57817:30652,57818:30653,57819:30651,57820:30663,57821:30669,57822:30679,57823:30682,57824:30684,57825:30691,57826:30702,57827:30716,57828:30732,57829:30738,57830:31014,57831:30752,57832:31018,57833:30789,57834:30862,57835:30836,57836:30854,57837:30844,57838:30874,57839:30860,57840:30883,57841:30901,57842:30890,57843:30895,57844:30929,57845:30918,57846:30923,57847:30932,57848:30910,57849:30908,57850:30917,57851:30922,57852:30956,57920:30951,57921:30938,57922:30973,57923:30964,57924:30983,57925:30994,57926:30993,57927:31001,57928:31020,57929:31019,57930:31040,57931:31072,57932:31063,57933:31071,57934:31066,57935:31061,57936:31059,57937:31098,57938:31103,57939:31114,57940:31133,57941:31143,57942:40779,57943:31146,57944:31150,57945:31155,57946:31161,57947:31162,57948:31177,57949:31189,57950:31207,57951:31212,57952:31201,57953:31203,57954:31240,57955:31245,57956:31256,57957:31257,57958:31264,57959:31263,57960:31104,57961:31281,57962:31291,57963:31294,57964:31287,57965:31299,57966:31319,57967:31305,57968:31329,57969:31330,57970:31337,57971:40861,57972:31344,57973:31353,57974:31357,57975:31368,57976:31383,57977:31381,57978:31384,57979:31382,57980:31401,57981:31432,57982:31408,57984:31414,57985:31429,57986:31428,57987:31423,57988:36995,57989:31431,57990:31434,57991:31437,57992:31439,57993:31445,57994:31443,57995:31449,57996:31450,57997:31453,57998:31457,57999:31458,58e3:31462,58001:31469,58002:31472,58003:31490,58004:31503,58005:31498,58006:31494,58007:31539,58008:31512,58009:31513,58010:31518,58011:31541,58012:31528,58013:31542,58014:31568,58015:31610,58016:31492,58017:31565,58018:31499,58019:31564,58020:31557,58021:31605,58022:31589,58023:31604,58024:31591,58025:31600,58026:31601,58027:31596,58028:31598,58029:31645,58030:31640,58031:31647,58032:31629,58033:31644,58034:31642,58035:31627,58036:31634,58037:31631,58038:31581,58039:31641,58040:31691,58041:31681,58042:31692,58043:31695,58044:31668,58045:31686,58046:31709,58047:31721,58048:31761,58049:31764,58050:31718,58051:31717,58052:31840,58053:31744,58054:31751,58055:31763,58056:31731,58057:31735,58058:31767,58059:31757,58060:31734,58061:31779,58062:31783,58063:31786,58064:31775,58065:31799,58066:31787,58067:31805,58068:31820,58069:31811,58070:31828,58071:31823,58072:31808,58073:31824,58074:31832,58075:31839,58076:31844,58077:31830,58078:31845,58079:31852,58080:31861,58081:31875,58082:31888,58083:31908,58084:31917,58085:31906,58086:31915,58087:31905,58088:31912,58089:31923,58090:31922,58091:31921,58092:31918,58093:31929,58094:31933,58095:31936,58096:31941,58097:31938,58098:31960,58099:31954,58100:31964,58101:31970,58102:39739,58103:31983,58104:31986,58105:31988,58106:31990,58107:31994,58108:32006,58176:32002,58177:32028,58178:32021,58179:32010,58180:32069,58181:32075,58182:32046,58183:32050,58184:32063,58185:32053,58186:32070,58187:32115,58188:32086,58189:32078,58190:32114,58191:32104,58192:32110,58193:32079,58194:32099,58195:32147,58196:32137,58197:32091,58198:32143,58199:32125,58200:32155,58201:32186,58202:32174,58203:32163,58204:32181,58205:32199,58206:32189,58207:32171,58208:32317,58209:32162,58210:32175,58211:32220,58212:32184,58213:32159,58214:32176,58215:32216,58216:32221,58217:32228,58218:32222,58219:32251,58220:32242,58221:32225,58222:32261,58223:32266,58224:32291,58225:32289,58226:32274,58227:32305,58228:32287,58229:32265,58230:32267,58231:32290,58232:32326,58233:32358,58234:32315,58235:32309,58236:32313,58237:32323,58238:32311,58240:32306,58241:32314,58242:32359,58243:32349,58244:32342,58245:32350,58246:32345,58247:32346,58248:32377,58249:32362,58250:32361,58251:32380,58252:32379,58253:32387,58254:32213,58255:32381,58256:36782,58257:32383,58258:32392,58259:32393,58260:32396,58261:32402,58262:32400,58263:32403,58264:32404,58265:32406,58266:32398,58267:32411,58268:32412,58269:32568,58270:32570,58271:32581,58272:32588,58273:32589,58274:32590,58275:32592,58276:32593,58277:32597,58278:32596,58279:32600,58280:32607,58281:32608,58282:32616,58283:32617,58284:32615,58285:32632,58286:32642,58287:32646,58288:32643,58289:32648,58290:32647,58291:32652,58292:32660,58293:32670,58294:32669,58295:32666,58296:32675,58297:32687,58298:32690,58299:32697,58300:32686,58301:32694,58302:32696,58303:35697,58304:32709,58305:32710,58306:32714,58307:32725,58308:32724,58309:32737,58310:32742,58311:32745,58312:32755,58313:32761,58314:39132,58315:32774,58316:32772,58317:32779,58318:32786,58319:32792,58320:32793,58321:32796,58322:32801,58323:32808,58324:32831,58325:32827,58326:32842,58327:32838,58328:32850,58329:32856,58330:32858,58331:32863,58332:32866,58333:32872,58334:32883,58335:32882,58336:32880,58337:32886,58338:32889,58339:32893,58340:32895,58341:32900,58342:32902,58343:32901,58344:32923,58345:32915,58346:32922,58347:32941,58348:20880,58349:32940,58350:32987,58351:32997,58352:32985,58353:32989,58354:32964,58355:32986,58356:32982,58357:33033,58358:33007,58359:33009,58360:33051,58361:33065,58362:33059,58363:33071,58364:33099,58432:38539,58433:33094,58434:33086,58435:33107,58436:33105,58437:33020,58438:33137,58439:33134,58440:33125,58441:33126,58442:33140,58443:33155,58444:33160,58445:33162,58446:33152,58447:33154,58448:33184,58449:33173,58450:33188,58451:33187,58452:33119,58453:33171,58454:33193,58455:33200,58456:33205,58457:33214,58458:33208,58459:33213,58460:33216,58461:33218,58462:33210,58463:33225,58464:33229,58465:33233,58466:33241,58467:33240,58468:33224,58469:33242,58470:33247,58471:33248,58472:33255,58473:33274,58474:33275,58475:33278,58476:33281,58477:33282,58478:33285,58479:33287,58480:33290,58481:33293,58482:33296,58483:33302,58484:33321,58485:33323,58486:33336,58487:33331,58488:33344,58489:33369,58490:33368,58491:33373,58492:33370,58493:33375,58494:33380,58496:33378,58497:33384,58498:33386,58499:33387,58500:33326,58501:33393,58502:33399,58503:33400,58504:33406,58505:33421,58506:33426,58507:33451,58508:33439,58509:33467,58510:33452,58511:33505,58512:33507,58513:33503,58514:33490,58515:33524,58516:33523,58517:33530,58518:33683,58519:33539,58520:33531,58521:33529,58522:33502,58523:33542,58524:33500,58525:33545,58526:33497,58527:33589,58528:33588,58529:33558,58530:33586,58531:33585,58532:33600,58533:33593,58534:33616,58535:33605,58536:33583,58537:33579,58538:33559,58539:33560,58540:33669,58541:33690,58542:33706,58543:33695,58544:33698,58545:33686,58546:33571,58547:33678,58548:33671,58549:33674,58550:33660,58551:33717,58552:33651,58553:33653,58554:33696,58555:33673,58556:33704,58557:33780,58558:33811,58559:33771,58560:33742,58561:33789,58562:33795,58563:33752,58564:33803,58565:33729,58566:33783,58567:33799,58568:33760,58569:33778,58570:33805,58571:33826,58572:33824,58573:33725,58574:33848,58575:34054,58576:33787,58577:33901,58578:33834,58579:33852,58580:34138,58581:33924,58582:33911,58583:33899,58584:33965,58585:33902,58586:33922,58587:33897,58588:33862,58589:33836,58590:33903,58591:33913,58592:33845,58593:33994,58594:33890,58595:33977,58596:33983,58597:33951,58598:34009,58599:33997,58600:33979,58601:34010,58602:34e3,58603:33985,58604:33990,58605:34006,58606:33953,58607:34081,58608:34047,58609:34036,58610:34071,58611:34072,58612:34092,58613:34079,58614:34069,58615:34068,58616:34044,58617:34112,58618:34147,58619:34136,58620:34120,58688:34113,58689:34306,58690:34123,58691:34133,58692:34176,58693:34212,58694:34184,58695:34193,58696:34186,58697:34216,58698:34157,58699:34196,58700:34203,58701:34282,58702:34183,58703:34204,58704:34167,58705:34174,58706:34192,58707:34249,58708:34234,58709:34255,58710:34233,58711:34256,58712:34261,58713:34269,58714:34277,58715:34268,58716:34297,58717:34314,58718:34323,58719:34315,58720:34302,58721:34298,58722:34310,58723:34338,58724:34330,58725:34352,58726:34367,58727:34381,58728:20053,58729:34388,58730:34399,58731:34407,58732:34417,58733:34451,58734:34467,58735:34473,58736:34474,58737:34443,58738:34444,58739:34486,58740:34479,58741:34500,58742:34502,58743:34480,58744:34505,58745:34851,58746:34475,58747:34516,58748:34526,58749:34537,58750:34540,58752:34527,58753:34523,58754:34543,58755:34578,58756:34566,58757:34568,58758:34560,58759:34563,58760:34555,58761:34577,58762:34569,58763:34573,58764:34553,58765:34570,58766:34612,58767:34623,58768:34615,58769:34619,58770:34597,58771:34601,58772:34586,58773:34656,58774:34655,58775:34680,58776:34636,58777:34638,58778:34676,58779:34647,58780:34664,58781:34670,58782:34649,58783:34643,58784:34659,58785:34666,58786:34821,58787:34722,58788:34719,58789:34690,58790:34735,58791:34763,58792:34749,58793:34752,58794:34768,58795:38614,58796:34731,58797:34756,58798:34739,58799:34759,58800:34758,58801:34747,58802:34799,58803:34802,58804:34784,58805:34831,58806:34829,58807:34814,58808:34806,58809:34807,58810:34830,58811:34770,58812:34833,58813:34838,58814:34837,58815:34850,58816:34849,58817:34865,58818:34870,58819:34873,58820:34855,58821:34875,58822:34884,58823:34882,58824:34898,58825:34905,58826:34910,58827:34914,58828:34923,58829:34945,58830:34942,58831:34974,58832:34933,58833:34941,58834:34997,58835:34930,58836:34946,58837:34967,58838:34962,58839:34990,58840:34969,58841:34978,58842:34957,58843:34980,58844:34992,58845:35007,58846:34993,58847:35011,58848:35012,58849:35028,58850:35032,58851:35033,58852:35037,58853:35065,58854:35074,58855:35068,58856:35060,58857:35048,58858:35058,58859:35076,58860:35084,58861:35082,58862:35091,58863:35139,58864:35102,58865:35109,58866:35114,58867:35115,58868:35137,58869:35140,58870:35131,58871:35126,58872:35128,58873:35148,58874:35101,58875:35168,58876:35166,58944:35174,58945:35172,58946:35181,58947:35178,58948:35183,58949:35188,58950:35191,58951:35198,58952:35203,58953:35208,58954:35210,58955:35219,58956:35224,58957:35233,58958:35241,58959:35238,58960:35244,58961:35247,58962:35250,58963:35258,58964:35261,58965:35263,58966:35264,58967:35290,58968:35292,58969:35293,58970:35303,58971:35316,58972:35320,58973:35331,58974:35350,58975:35344,58976:35340,58977:35355,58978:35357,58979:35365,58980:35382,58981:35393,58982:35419,58983:35410,58984:35398,58985:35400,58986:35452,58987:35437,58988:35436,58989:35426,58990:35461,58991:35458,58992:35460,58993:35496,58994:35489,58995:35473,58996:35493,58997:35494,58998:35482,58999:35491,59e3:35524,59001:35533,59002:35522,59003:35546,59004:35563,59005:35571,59006:35559,59008:35556,59009:35569,59010:35604,59011:35552,59012:35554,59013:35575,59014:35550,59015:35547,59016:35596,59017:35591,59018:35610,59019:35553,59020:35606,59021:35600,59022:35607,59023:35616,59024:35635,59025:38827,59026:35622,59027:35627,59028:35646,59029:35624,59030:35649,59031:35660,59032:35663,59033:35662,59034:35657,59035:35670,59036:35675,59037:35674,59038:35691,59039:35679,59040:35692,59041:35695,59042:35700,59043:35709,59044:35712,59045:35724,59046:35726,59047:35730,59048:35731,59049:35734,59050:35737,59051:35738,59052:35898,59053:35905,59054:35903,59055:35912,59056:35916,59057:35918,59058:35920,59059:35925,59060:35938,59061:35948,59062:35960,59063:35962,59064:35970,59065:35977,59066:35973,59067:35978,59068:35981,59069:35982,59070:35988,59071:35964,59072:35992,59073:25117,59074:36013,59075:36010,59076:36029,59077:36018,59078:36019,59079:36014,59080:36022,59081:36040,59082:36033,59083:36068,59084:36067,59085:36058,59086:36093,59087:36090,59088:36091,59089:36100,59090:36101,59091:36106,59092:36103,59093:36111,59094:36109,59095:36112,59096:40782,59097:36115,59098:36045,59099:36116,59100:36118,59101:36199,59102:36205,59103:36209,59104:36211,59105:36225,59106:36249,59107:36290,59108:36286,59109:36282,59110:36303,59111:36314,59112:36310,59113:36300,59114:36315,59115:36299,59116:36330,59117:36331,59118:36319,59119:36323,59120:36348,59121:36360,59122:36361,59123:36351,59124:36381,59125:36382,59126:36368,59127:36383,59128:36418,59129:36405,59130:36400,59131:36404,59132:36426,59200:36423,59201:36425,59202:36428,59203:36432,59204:36424,59205:36441,59206:36452,59207:36448,59208:36394,59209:36451,59210:36437,59211:36470,59212:36466,59213:36476,59214:36481,59215:36487,59216:36485,59217:36484,59218:36491,59219:36490,59220:36499,59221:36497,59222:36500,59223:36505,59224:36522,59225:36513,59226:36524,59227:36528,59228:36550,59229:36529,59230:36542,59231:36549,59232:36552,59233:36555,59234:36571,59235:36579,59236:36604,59237:36603,59238:36587,59239:36606,59240:36618,59241:36613,59242:36629,59243:36626,59244:36633,59245:36627,59246:36636,59247:36639,59248:36635,59249:36620,59250:36646,59251:36659,59252:36667,59253:36665,59254:36677,59255:36674,59256:36670,59257:36684,59258:36681,59259:36678,59260:36686,59261:36695,59262:36700,59264:36706,59265:36707,59266:36708,59267:36764,59268:36767,59269:36771,59270:36781,59271:36783,59272:36791,59273:36826,59274:36837,59275:36834,59276:36842,59277:36847,59278:36999,59279:36852,59280:36869,59281:36857,59282:36858,59283:36881,59284:36885,59285:36897,59286:36877,59287:36894,59288:36886,59289:36875,59290:36903,59291:36918,59292:36917,59293:36921,59294:36856,59295:36943,59296:36944,59297:36945,59298:36946,59299:36878,59300:36937,59301:36926,59302:36950,59303:36952,59304:36958,59305:36968,59306:36975,59307:36982,59308:38568,59309:36978,59310:36994,59311:36989,59312:36993,59313:36992,59314:37002,59315:37001,59316:37007,59317:37032,59318:37039,59319:37041,59320:37045,59321:37090,59322:37092,59323:25160,59324:37083,59325:37122,59326:37138,59327:37145,59328:37170,59329:37168,59330:37194,59331:37206,59332:37208,59333:37219,59334:37221,59335:37225,59336:37235,59337:37234,59338:37259,59339:37257,59340:37250,59341:37282,59342:37291,59343:37295,59344:37290,59345:37301,59346:37300,59347:37306,59348:37312,59349:37313,59350:37321,59351:37323,59352:37328,59353:37334,59354:37343,59355:37345,59356:37339,59357:37372,59358:37365,59359:37366,59360:37406,59361:37375,59362:37396,59363:37420,59364:37397,59365:37393,59366:37470,59367:37463,59368:37445,59369:37449,59370:37476,59371:37448,59372:37525,59373:37439,59374:37451,59375:37456,59376:37532,59377:37526,59378:37523,59379:37531,59380:37466,59381:37583,59382:37561,59383:37559,59384:37609,59385:37647,59386:37626,59387:37700,59388:37678,59456:37657,59457:37666,59458:37658,59459:37667,59460:37690,59461:37685,59462:37691,59463:37724,59464:37728,59465:37756,59466:37742,59467:37718,59468:37808,59469:37804,59470:37805,59471:37780,59472:37817,59473:37846,59474:37847,59475:37864,59476:37861,59477:37848,59478:37827,59479:37853,59480:37840,59481:37832,59482:37860,59483:37914,59484:37908,59485:37907,59486:37891,59487:37895,59488:37904,59489:37942,59490:37931,59491:37941,59492:37921,59493:37946,59494:37953,59495:37970,59496:37956,59497:37979,59498:37984,59499:37986,59500:37982,59501:37994,59502:37417,59503:38e3,59504:38005,59505:38007,59506:38013,59507:37978,59508:38012,59509:38014,59510:38017,59511:38015,59512:38274,59513:38279,59514:38282,59515:38292,59516:38294,59517:38296,59518:38297,59520:38304,59521:38312,59522:38311,59523:38317,59524:38332,59525:38331,59526:38329,59527:38334,59528:38346,59529:28662,59530:38339,59531:38349,59532:38348,59533:38357,59534:38356,59535:38358,59536:38364,59537:38369,59538:38373,59539:38370,59540:38433,59541:38440,59542:38446,59543:38447,59544:38466,59545:38476,59546:38479,59547:38475,59548:38519,59549:38492,59550:38494,59551:38493,59552:38495,59553:38502,59554:38514,59555:38508,59556:38541,59557:38552,59558:38549,59559:38551,59560:38570,59561:38567,59562:38577,59563:38578,59564:38576,59565:38580,59566:38582,59567:38584,59568:38585,59569:38606,59570:38603,59571:38601,59572:38605,59573:35149,59574:38620,59575:38669,59576:38613,59577:38649,59578:38660,59579:38662,59580:38664,59581:38675,59582:38670,59583:38673,59584:38671,59585:38678,59586:38681,59587:38692,59588:38698,59589:38704,59590:38713,59591:38717,59592:38718,59593:38724,59594:38726,59595:38728,59596:38722,59597:38729,59598:38748,59599:38752,59600:38756,59601:38758,59602:38760,59603:21202,59604:38763,59605:38769,59606:38777,59607:38789,59608:38780,59609:38785,59610:38778,59611:38790,59612:38795,59613:38799,59614:38800,59615:38812,59616:38824,59617:38822,59618:38819,59619:38835,59620:38836,59621:38851,59622:38854,59623:38856,59624:38859,59625:38876,59626:38893,59627:40783,59628:38898,59629:31455,59630:38902,59631:38901,59632:38927,59633:38924,59634:38968,59635:38948,59636:38945,59637:38967,59638:38973,59639:38982,59640:38991,59641:38987,59642:39019,59643:39023,59644:39024,59712:39025,59713:39028,59714:39027,59715:39082,59716:39087,59717:39089,59718:39094,59719:39108,59720:39107,59721:39110,59722:39145,59723:39147,59724:39171,59725:39177,59726:39186,59727:39188,59728:39192,59729:39201,59730:39197,59731:39198,59732:39204,59733:39200,59734:39212,59735:39214,59736:39229,59737:39230,59738:39234,59739:39241,59740:39237,59741:39248,59742:39243,59743:39249,59744:39250,59745:39244,59746:39253,59747:39319,59748:39320,59749:39333,59750:39341,59751:39342,59752:39356,59753:39391,59754:39387,59755:39389,59756:39384,59757:39377,59758:39405,59759:39406,59760:39409,59761:39410,59762:39419,59763:39416,59764:39425,59765:39439,59766:39429,59767:39394,59768:39449,59769:39467,59770:39479,59771:39493,59772:39490,59773:39488,59774:39491,59776:39486,59777:39509,59778:39501,59779:39515,59780:39511,59781:39519,59782:39522,59783:39525,59784:39524,59785:39529,59786:39531,59787:39530,59788:39597,59789:39600,59790:39612,59791:39616,59792:39631,59793:39633,59794:39635,59795:39636,59796:39646,59797:39647,59798:39650,59799:39651,59800:39654,59801:39663,59802:39659,59803:39662,59804:39668,59805:39665,59806:39671,59807:39675,59808:39686,59809:39704,59810:39706,59811:39711,59812:39714,59813:39715,59814:39717,59815:39719,59816:39720,59817:39721,59818:39722,59819:39726,59820:39727,59821:39730,59822:39748,59823:39747,59824:39759,59825:39757,59826:39758,59827:39761,59828:39768,59829:39796,59830:39827,59831:39811,59832:39825,59833:39830,59834:39831,59835:39839,59836:39840,59837:39848,59838:39860,59839:39872,59840:39882,59841:39865,59842:39878,59843:39887,59844:39889,59845:39890,59846:39907,59847:39906,59848:39908,59849:39892,59850:39905,59851:39994,59852:39922,59853:39921,59854:39920,59855:39957,59856:39956,59857:39945,59858:39955,59859:39948,59860:39942,59861:39944,59862:39954,59863:39946,59864:39940,59865:39982,59866:39963,59867:39973,59868:39972,59869:39969,59870:39984,59871:40007,59872:39986,59873:40006,59874:39998,59875:40026,59876:40032,59877:40039,59878:40054,59879:40056,59880:40167,59881:40172,59882:40176,59883:40201,59884:40200,59885:40171,59886:40195,59887:40198,59888:40234,59889:40230,59890:40367,59891:40227,59892:40223,59893:40260,59894:40213,59895:40210,59896:40257,59897:40255,59898:40254,59899:40262,59900:40264,59968:40285,59969:40286,59970:40292,59971:40273,59972:40272,59973:40281,59974:40306,59975:40329,59976:40327,59977:40363,59978:40303,59979:40314,59980:40346,59981:40356,59982:40361,59983:40370,59984:40388,59985:40385,59986:40379,59987:40376,59988:40378,59989:40390,59990:40399,59991:40386,59992:40409,59993:40403,59994:40440,59995:40422,59996:40429,59997:40431,59998:40445,59999:40474,6e4:40475,60001:40478,60002:40565,60003:40569,60004:40573,60005:40577,60006:40584,60007:40587,60008:40588,60009:40594,60010:40597,60011:40593,60012:40605,60013:40613,60014:40617,60015:40632,60016:40618,60017:40621,60018:38753,60019:40652,60020:40654,60021:40655,60022:40656,60023:40660,60024:40668,60025:40670,60026:40669,60027:40672,60028:40677,60029:40680,60030:40687,60032:40692,60033:40694,60034:40695,60035:40697,60036:40699,60037:40700,60038:40701,60039:40711,60040:40712,60041:30391,60042:40725,60043:40737,60044:40748,60045:40766,60046:40778,60047:40786,60048:40788,60049:40803,60050:40799,60051:40800,60052:40801,60053:40806,60054:40807,60055:40812,60056:40810,60057:40823,60058:40818,60059:40822,60060:40853,60061:40860,60062:40864,60063:22575,60064:27079,60065:36953,60066:29796,60067:20956,60068:29081}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(2);t.decode=function(e,t){var r=new Uint8ClampedArray(e.length);r.set(e);for(var a=new n.default(285,256,0),i=new o.default(a,r),s=new Uint8ClampedArray(t),c=!1,l=0;l<t;l++){var u=i.evaluateAt(a.exp(l+a.generatorBase));s[s.length-1-l]=u,0!==u&&(c=!0)}if(!c)return r;var d=new o.default(a,s),f=function(e,t,r,n){var o;t.degree()<r.degree()&&(t=(o=[r,t])[0],r=o[1]);for(var a=t,i=r,s=e.zero,c=e.one;i.degree()>=n/2;){var l=a,u=s;if(s=c,(a=i).isZero())return null;i=l;for(var d=e.zero,f=a.getCoefficient(a.degree()),p=e.inverse(f);i.degree()>=a.degree()&&!i.isZero();){var h=i.degree()-a.degree(),m=e.multiply(i.getCoefficient(i.degree()),p);d=d.addOrSubtract(e.buildMonomial(h,m)),i=i.addOrSubtract(a.multiplyByMonomial(h,m))}if(c=d.multiplyPoly(s).addOrSubtract(u),i.degree()>=a.degree())return null}var g=c.getCoefficient(0);if(0===g)return null;var v=e.inverse(g);return[c.multiply(v),i.multiply(v)]}(a,a.buildMonomial(t,1),d,t);if(null===f)return null;var p=function(e,t){var r=t.degree();if(1===r)return[t.getCoefficient(1)];for(var n=new Array(r),o=0,a=1;a<e.size&&o<r;a++)0===t.evaluateAt(a)&&(n[o]=e.inverse(a),o++);return o!==r?null:n}(a,f[0]);if(null==p)return null;for(var h=function(e,t,r){for(var o=r.length,a=new Array(o),i=0;i<o;i++){for(var s=e.inverse(r[i]),c=1,l=0;l<o;l++)i!==l&&(c=e.multiply(c,n.addOrSubtractGF(1,e.multiply(r[l],s))));a[i]=e.multiply(t.evaluateAt(s),e.inverse(c)),0!==e.generatorBase&&(a[i]=e.multiply(a[i],s))}return a}(a,f[1],p),m=0;m<p.length;m++){var g=r.length-1-a.log(p[m]);if(g<0)return null;r[g]=n.addOrSubtractGF(r[g],h[m])}return r}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.VERSIONS=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]},{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13},{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14},{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12},{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16},{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4,dataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6,32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47},{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6,30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]},{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18,dataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}]},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);function o(e,t,r,n){var o=e.x-t.x+r.x-n.x,a=e.y-t.y+r.y-n.y;if(0===o&&0===a)return{a11:t.x-e.x,a12:t.y-e.y,a13:0,a21:r.x-t.x,a22:r.y-t.y,a23:0,a31:e.x,a32:e.y,a33:1};var i=t.x-r.x,s=n.x-r.x,c=t.y-r.y,l=n.y-r.y,u=i*l-s*c,d=(o*l-s*a)/u,f=(i*a-o*c)/u;return{a11:t.x-e.x+d*t.x,a12:t.y-e.y+d*t.y,a13:d,a21:n.x-e.x+f*n.x,a22:n.y-e.y+f*n.y,a23:f,a31:e.x,a32:e.y,a33:1}}t.extract=function(e,t){for(var r=function(e,t,r,n){var a=o(e,t,r,n);return{a11:a.a22*a.a33-a.a23*a.a32,a12:a.a13*a.a32-a.a12*a.a33,a13:a.a12*a.a23-a.a13*a.a22,a21:a.a23*a.a31-a.a21*a.a33,a22:a.a11*a.a33-a.a13*a.a31,a23:a.a13*a.a21-a.a11*a.a23,a31:a.a21*a.a32-a.a22*a.a31,a32:a.a12*a.a31-a.a11*a.a32,a33:a.a11*a.a22-a.a12*a.a21}}({x:3.5,y:3.5},{x:t.dimension-3.5,y:3.5},{x:t.dimension-6.5,y:t.dimension-6.5},{x:3.5,y:t.dimension-3.5}),a=function(e,t){return{a11:e.a11*t.a11+e.a21*t.a12+e.a31*t.a13,a12:e.a12*t.a11+e.a22*t.a12+e.a32*t.a13,a13:e.a13*t.a11+e.a23*t.a12+e.a33*t.a13,a21:e.a11*t.a21+e.a21*t.a22+e.a31*t.a23,a22:e.a12*t.a21+e.a22*t.a22+e.a32*t.a23,a23:e.a13*t.a21+e.a23*t.a22+e.a33*t.a23,a31:e.a11*t.a31+e.a21*t.a32+e.a31*t.a33,a32:e.a12*t.a31+e.a22*t.a32+e.a32*t.a33,a33:e.a13*t.a31+e.a23*t.a32+e.a33*t.a33}}(o(t.topLeft,t.topRight,t.alignmentPattern,t.bottomLeft),r),i=n.BitMatrix.createEmpty(t.dimension,t.dimension),s=function(e,t){var r=a.a13*e+a.a23*t+a.a33;return{x:(a.a11*e+a.a21*t+a.a31)/r,y:(a.a12*e+a.a22*t+a.a32)/r}},c=0;c<t.dimension;c++)for(var l=0;l<t.dimension;l++){var u=s(l+.5,c+.5);i.set(l,c,e.get(Math.floor(u.x),Math.floor(u.y)))}return{matrix:i,mappingFunction:s}}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))};function o(e){return e.reduce((function(e,t){return e+t}))}function a(e,t,r,o){var a,i,s,c,l=[{x:Math.floor(e.x),y:Math.floor(e.y)}],u=Math.abs(t.y-e.y)>Math.abs(t.x-e.x);u?(a=Math.floor(e.y),i=Math.floor(e.x),s=Math.floor(t.y),c=Math.floor(t.x)):(a=Math.floor(e.x),i=Math.floor(e.y),s=Math.floor(t.x),c=Math.floor(t.y));for(var d=Math.abs(s-a),f=Math.abs(c-i),p=Math.floor(-d/2),h=a<s?1:-1,m=i<c?1:-1,g=!0,v=a,y=i;v!==s+h;v+=h){var b=u?y:v,C=u?v:y;if(r.get(b,C)!==g&&(g=!g,l.push({x:b,y:C}),l.length===o+1))break;if((p+=f)>0){if(y===c)break;y+=m,p-=d}}for(var w=[],k=0;k<o;k++)l[k]&&l[k+1]?w.push(n(l[k],l[k+1])):w.push(0);return w}function i(e,t,r,n){var o,i=t.y-e.y,s=t.x-e.x,c=a(e,t,r,Math.ceil(n/2)),l=a(e,{x:e.x-s,y:e.y-i},r,Math.ceil(n/2)),u=c.shift()+l.shift()-1;return(o=l.concat(u)).concat.apply(o,c)}function s(e,t){var r=o(e)/o(t),n=0;return t.forEach((function(t,o){n+=Math.pow(e[o]-t*r,2)})),{averageSize:r,error:n}}function c(e,t,r){try{var n=i(e,{x:-1,y:e.y},r,t.length),o=i(e,{x:e.x,y:-1},r,t.length),a=i(e,{x:Math.max(0,e.x-e.y)-1,y:Math.max(0,e.y-e.x)-1},r,t.length),c=i(e,{x:Math.min(r.width,e.x+e.y)+1,y:Math.min(r.height,e.y+e.x)+1},r,t.length),l=s(n,t),u=s(o,t),d=s(a,t),f=s(c,t),p=Math.sqrt(l.error*l.error+u.error*u.error+d.error*d.error+f.error*f.error),h=(l.averageSize+u.averageSize+d.averageSize+f.averageSize)/4;return p+(Math.pow(l.averageSize-h,2)+Math.pow(u.averageSize-h,2)+Math.pow(d.averageSize-h,2)+Math.pow(f.averageSize-h,2))/h}catch(e){return 1/0}}function l(e,t){for(var r=Math.round(t.x);e.get(r,Math.round(t.y));)r--;for(var n=Math.round(t.x);e.get(n,Math.round(t.y));)n++;for(var o=(r+n)/2,a=Math.round(t.y);e.get(Math.round(o),a);)a--;for(var i=Math.round(t.y);e.get(Math.round(o),i);)i++;return{x:o,y:(a+i)/2}}function u(e,t,r,a,s){var l,u,d;try{l=function(e,t,r,a){var s=(o(i(e,r,a,5))/7+o(i(e,t,a,5))/7+o(i(r,e,a,5))/7+o(i(t,e,a,5))/7)/4;if(s<1)throw new Error("Invalid module size");var c=Math.round(n(e,t)/s),l=Math.round(n(e,r)/s),u=Math.floor((c+l)/2)+7;switch(u%4){case 0:u++;break;case 2:u--}return{dimension:u,moduleSize:s}}(a,r,s,e),u=l.dimension,d=l.moduleSize}catch(e){return null}var f=r.x-a.x+s.x,p=r.y-a.y+s.y,h=(n(a,s)+n(a,r))/2/d,m=1-3/h,g={x:a.x+m*(f-a.x),y:a.y+m*(p-a.y)},v=t.map((function(t){var r=(t.top.startX+t.top.endX+t.bottom.startX+t.bottom.endX)/4,a=(t.top.y+t.bottom.y+1)/2;if(e.get(Math.floor(r),Math.floor(a))){var i=[t.top.endX-t.top.startX,t.bottom.endX-t.bottom.startX,t.bottom.y-t.top.y+1];return o(i),{x:r,y:a,score:c({x:Math.floor(r),y:Math.floor(a)},[1,1,1],e)+n({x:r,y:a},g)}}})).filter((function(e){return!!e})).sort((function(e,t){return e.score-t.score}));return{alignmentPattern:h>=15&&v.length?v[0]:g,dimension:u}}t.locate=function(e){for(var t=[],r=[],a=[],i=[],s=function(n){for(var s=0,c=!1,l=[0,0,0,0,0],u=function(t){var a=e.get(t,n);if(a===c)s++;else{l=[l[1],l[2],l[3],l[4],s],s=1,c=a;var u=o(l)/7,d=Math.abs(l[0]-u)<u&&Math.abs(l[1]-u)<u&&Math.abs(l[2]-3*u)<3*u&&Math.abs(l[3]-u)<u&&Math.abs(l[4]-u)<u&&!a,f=o(l.slice(-3))/3,p=Math.abs(l[2]-f)<f&&Math.abs(l[3]-f)<f&&Math.abs(l[4]-f)<f&&a;if(d){var h=t-l[3]-l[4],m=h-l[2],g={startX:m,endX:h,y:n};(v=r.filter((function(e){return m>=e.bottom.startX&&m<=e.bottom.endX||h>=e.bottom.startX&&m<=e.bottom.endX||m<=e.bottom.startX&&h>=e.bottom.endX&&l[2]/(e.bottom.endX-e.bottom.startX)<1.5&&l[2]/(e.bottom.endX-e.bottom.startX)>.5}))).length>0?v[0].bottom=g:r.push({top:g,bottom:g})}if(p){var v,y=t-l[4],b=y-l[3];g={startX:b,y:n,endX:y},(v=i.filter((function(e){return b>=e.bottom.startX&&b<=e.bottom.endX||y>=e.bottom.startX&&b<=e.bottom.endX||b<=e.bottom.startX&&y>=e.bottom.endX&&l[2]/(e.bottom.endX-e.bottom.startX)<1.5&&l[2]/(e.bottom.endX-e.bottom.startX)>.5}))).length>0?v[0].bottom=g:i.push({top:g,bottom:g})}}},d=-1;d<=e.width;d++)u(d);t.push.apply(t,r.filter((function(e){return e.bottom.y!==n&&e.bottom.y-e.top.y>=2}))),r=r.filter((function(e){return e.bottom.y===n})),a.push.apply(a,i.filter((function(e){return e.bottom.y!==n}))),i=i.filter((function(e){return e.bottom.y===n}))},d=0;d<=e.height;d++)s(d);t.push.apply(t,r.filter((function(e){return e.bottom.y-e.top.y>=2}))),a.push.apply(a,i);var f=t.filter((function(e){return e.bottom.y-e.top.y>=2})).map((function(t){var r=(t.top.startX+t.top.endX+t.bottom.startX+t.bottom.endX)/4,n=(t.top.y+t.bottom.y+1)/2;if(e.get(Math.round(r),Math.round(n))){var a=[t.top.endX-t.top.startX,t.bottom.endX-t.bottom.startX,t.bottom.y-t.top.y+1],i=o(a)/a.length;return{score:c({x:Math.round(r),y:Math.round(n)},[1,1,3,1,1],e),x:r,y:n,size:i}}})).filter((function(e){return!!e})).sort((function(e,t){return e.score-t.score})).map((function(e,t,r){if(t>4)return null;var n=r.filter((function(e,r){return t!==r})).map((function(t){return{x:t.x,y:t.y,score:t.score+Math.pow(t.size-e.size,2)/e.size,size:t.size}})).sort((function(e,t){return e.score-t.score}));if(n.length<2)return null;var o=e.score+n[0].score+n[1].score;return{points:[e].concat(n.slice(0,2)),score:o}})).filter((function(e){return!!e})).sort((function(e,t){return e.score-t.score}));if(0===f.length)return null;var p=function(e,t,r){var o,a,i,s,c,l,u,d=n(e,t),f=n(t,r),p=n(e,r);return f>=d&&f>=p?(c=(o=[t,e,r])[0],l=o[1],u=o[2]):p>=f&&p>=d?(c=(a=[e,t,r])[0],l=a[1],u=a[2]):(c=(i=[e,r,t])[0],l=i[1],u=i[2]),(u.x-l.x)*(c.y-l.y)-(u.y-l.y)*(c.x-l.x)<0&&(c=(s=[u,c])[0],u=s[1]),{bottomLeft:c,topLeft:l,topRight:u}}(f[0].points[0],f[0].points[1],f[0].points[2]),h=p.topRight,m=p.topLeft,g=p.bottomLeft,v=u(e,a,h,m,g),y=[];v&&y.push({alignmentPattern:{x:v.alignmentPattern.x,y:v.alignmentPattern.y},bottomLeft:{x:g.x,y:g.y},dimension:v.dimension,topLeft:{x:m.x,y:m.y},topRight:{x:h.x,y:h.y}});var b=l(e,h),C=l(e,m),w=l(e,g),k=u(e,a,b,C,w);return k&&y.push({alignmentPattern:{x:k.alignmentPattern.x,y:k.alignmentPattern.y},bottomLeft:{x:w.x,y:w.y},topLeft:{x:C.x,y:C.y},topRight:{x:b.x,y:b.y},dimension:k.dimension}),0===y.length?null:y}}]).default},e.exports=r()})));function ug(e){return dg.apply(this,arguments)}function dg(){return(dg=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.imageData,n=t.canvas,(o=r)||(a=n.getContext("2d"),o=a.getImageData(0,0,n.width,n.height)),!(i=lg(o.data,o.width,o.height,{inversionAttempts:"dontInvert"}))){e.next=6;break}return e.abrupt("return",i.data);case 6:return e.abrupt("return","");case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fg(e){return pg.apply(this,arguments)}function pg(){return(pg=B(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.canvas,n=t.qrScannerResources,e.abrupt("return",new Promise((function(e){setTimeout((function(){return e("")}),1e3),og.scanImage(r,void 0,void 0,n.canvas).then(e).catch((function(){return e("")}))})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var hg=function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.canvas,n=t.blackAndWhiteConverterResources,o=t.qrScannerResources,a=n.kernel,i=n.canvas,s=n.dst,c=window,l=c.cv,u="",d=l.imread(r),l.cvtColor(d,s,l.COLOR_RGBA2GRAY),l.filter2D(s,s,-1,a),l.imshow(i,s),e.next=10,ug({canvas:i});case 10:if(u=e.sent){e.next=15;break}return e.next=14,fg({canvas:i,qrScannerResources:o});case 14:u=e.sent;case 15:return d.delete(),e.abrupt("return",u);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),mg=function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.canvas,n=t.blob,o=t.qrScannerResources,a=t.blackAndWhiteConverterResources,i=r,!n){e.next=6;break}return e.next=5,Ca.blobToCanvas({blob:n});case 5:i=e.sent;case 6:return s=i.getContext("2d"),e.next=9,ug({imageData:s.getImageData(0,0,i.width,i.height)});case 9:if(c=e.sent){e.next=18;break}return e.next=13,fg({canvas:i,qrScannerResources:o});case 13:if(c=e.sent){e.next=18;break}return e.next=17,hg({canvas:i,blackAndWhiteConverterResources:a,qrScannerResources:o});case 17:c=e.sent;case 18:return e.abrupt("return",c);case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),gg=function(){var e=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s,c,l,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>0&&void 0!==u[0]?u[0]:{},r=t.blob,n=t.resultWarmup,o=t.enableValidation,a=void 0===o||o,i=n.qrScannerResources,s=n.blackAndWhiteConverterResources,c={},e.next=5,mg({blob:r,qrScannerResources:i,blackAndWhiteConverterResources:s});case 5:return l=e.sent,a&&l&&(c=ng(l)),e.abrupt("return",{result:l,validateResult:c});case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();var vg,yg,bg,Cg,wg,kg,Bg=function(e){var t=e.shouldStart,n=e.refVideo,a=e.cropArea,i=e.settings,l=e.onSessionTimeout,u=e.onCaptureDone,d=e.onAboutToTimeout,f=e.outputEncryptionSettings,p=L(s(!1),2),h=p[0],m=p[1],g=r((function(){})),v=r((function(){})),y=Qr.useSDKSettings().lang,b=function(e){var t=e.refVideo,n=e.shouldStart,a=e.cropArea,i=e.settings,l=e.onResult,u=e.outputEncryptionSettings,d=r(null);null===d.current&&(d.current=document.createElement("canvas"));var f=r(!1),p=r(null),h=L(s(!1),2),m=h[0],g=h[1],v=r({}),y=Qr.useSDKSettings().customUrls;c((function(){function e(){return(e=B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(m){e.next=5;break}return e.next=3,cg(y);case 3:v.current=e.sent,g(!0);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[m,y]);var b=o((function(){!0===f.current&&(f.current=!1)}),[]),C=o(B(regeneratorRuntime.mark((function e(){var r,n,o,a,s,c,h,g,y,C,w,k,B,E,S,A;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(m&&i&&!f.current){e.next=2;break}return e.abrupt("return");case 2:r=v.current,n=r.qrScannerResources,o=r.blackAndWhiteConverterResources,a=p.current,s=t.current,f.current=!0,c=a.cropX,h=a.cropY,g=a.cropWidth,y=a.cropHeight,(C=d.current).width=g,C.height=y,w=C.getContext("2d");case 11:return w.drawImage(s,c,h,g,y,0,0,g,y),e.next=15,mg({canvas:C,qrScannerResources:n,blackAndWhiteConverterResources:o});case 15:if(!(k=e.sent)){e.next=29;break}return b(),B=ng(k),e.next=21,ro.takePicture({canvas:d.current});case 21:if(E=e.sent,S=void 0,!u||!u.key){e.next=28;break}return A=u.key,e.next=27,ci.encrypt({blob:E,key:A});case 27:S=e.sent;case 28:l({result:k,validateResult:B,image:{blob:E,encrypted:S}});case 29:if(f.current){e.next=31;break}return e.abrupt("break",33);case 31:e.next=11;break;case 33:case"end":return e.stop()}}),e)}))),[t,i,m,l,b,u]),w=o((function(){b()}),[b]);return c((function(){var e=t.current;function r(){return(r=B(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return p.current=ro.analyzeVideoAndWindowSizes(e,a,0),t.next=3,C();case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}n||w(),m&&n&&a&&function(){r.apply(this,arguments)}()}),[n,a,t,b,C,m,w]),c((function(){return w}),[w]),{refWorkingCanvas:d,stopCheckFrame:b,checkFrame:C,warmupDone:m}}({refVideo:n,shouldStart:t,cropArea:a,settings:i,onResult:o((function(){g.current.apply(g,arguments)}),[]),outputEncryptionSettings:f}),C=b.stopCheckFrame,w=b.checkFrame,k=b.warmupDone,E=lm({refVideo:n,shouldStart:t&&k,cropArea:a,settings:i}),S=E.stopCheckFrame,A=E.refRecordedVideos,_=E.splitVideos,T=E.resetRecordedVideos,P=E.checkFrame;g.current=o((function(e){m(!0),S(),C(),v.current(),u(I(I({},e),{},{recordedVideos:A.current})),m(!1)}),[S,u,A,C]);var x=o((function(){S(),C(),T(),l()}),[T,S,C,l]),R=o((function(){_()}),[_]),N=pm({lang:y,onAboutToTimeout:d,onSessionTimeout:x,onVideoTimeLimitReached:R,settings:i,shouldStartTimers:t&&k,sessionTime:null==i?void 0:i.scanQrLimitTimeSecond}),O=N.stopTimers,D=N.startTimers;return v.current=O,{isProcessing:h,restartSession:o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return D(),e.next=3,Promise.all([P(),w()]);case 3:case"end":return e.stop()}}),e)}))),[P,w,D]),refRecordedVideos:A,warmupDone:k}};function Eg(e){var r=e.windowAndVideoInfo,n=e.onUISpacingChange,a=e.refVideo,i=e.settings,l=e.onCaptureDone,u=e.outputEncryptionSettings,d=L(s(null),2),f=d[0],p=d[1],h=In.useAsset("qr_capture_cursor.png"),m=L(s({}),2),g=m[0],v=m[1],y=g.yTooltip,b=g.yMessage,C=Qr.useSDKSettings().lang,w=Ph(),k=w.showPopup,E=w.popupShown,S=w.popupType,A=L(s(!1),2),_=A[0],I=A[1],T=L(s(null),2),P=T[0],x=T[1],R=In.useAsset("ic_loading.png");c((function(){k({popupType:Lh})}),[k]),c((function(){if(r){var e=r.videoAreaWidth,t=r.lostX,o=r.lostY,a=gi.isMobile?Math.min(e-6,145):145,i=a,s=o+10,c=s+90,l=c+40,u=l+i+20,d=Math.floor((e-a)/2)+t;p({x:d,y:l,width:a,height:i,surroundStyle:{opacity:.6,background:"#000"}});var f={yTitle:s,yTooltip:u,yMessage:c};v(f),n(f)}}),[r,n]);var N=o((function(){x(""),l()}),[l]),O=o((function(e){var t=e.validateResult.valid;x(""),t?l(e):k({popupType:Nh})}),[k,l]),D=o((function(e){var t=e.curTimeLeft;x(uu(Bm.REMAINING_TIME[C])({x:t}))}),[C]),M=Bg({shouldStart:_,refVideo:a,cropArea:f,settings:i,onSessionTimeout:N,onCaptureDone:O,onAboutToTimeout:D,outputEncryptionSettings:u}),U=M.isProcessing,F=M.restartSession,j=M.warmupDone,V=o((function(){k({popupType:null})}),[k]),z=o(B(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V(),e.next=3,F();case 3:case"end":return e.stop()}}),e)}))),[F,V]),K=o((function(){V(),l()}),[V,l]),H=o((function(){V(),setTimeout((function(){I(!0)}),200)}),[V]);return t.createElement(t.Fragment,null,!j&&t.createElement(Cf,{contentStyle:{maxWidth:"300px"}}),f&&t.createElement(Vs,{x:"".concat(f.x,"px"),y:"".concat(f.y,"px"),width:"".concat(f.width,"px"),height:"".concat(f.height,"px"),surroundStyle:f.surroundStyle},t.createElement("div",null,t.createElement("img",{src:h,width:f.width,height:f.height,alt:""}))),t.createElement(wm,{y:"".concat(y,"px")},Bm.QR_TOOLTIP[C]),P&&t.createElement(km,{key:P,className:"message",y:"".concat(b,"px")},P),U&&t.createElement(hh,null,t.createElement("img",{src:R,alt:"",className:"spin"})),t.createElement(ef,{contentStyle:{maxWidth:"332px"},open:E},S===Nh&&t.createElement(Dm,{onRetry:z,onSkip:K}),S===xh&&t.createElement(jm,{onRetry:z,onSkip:K}),S===Lh&&t.createElement(tg,{onClickStart:H,onTimeout:H})))}Eg.propTypes={windowAndVideoInfo:p.shape({}),onUISpacingChange:p.func,refVideo:p.shape({}),settings:p.shape({}),onCaptureDone:p.func,outputEncryptionSettings:p.shape({})},Eg.defaultProps={windowAndVideoInfo:{},onUISpacingChange:function(){},refVideo:{},settings:{},onCaptureDone:function(){},outputEncryptionSettings:null};var Sg,Ag,_g,Ig,Tg,Pg={SUCCESS:"SUCCESS",WARNING:"WARNING"},xg=(S(vg={},Pg.SUCCESS,"52,206,95"),S(vg,Pg.WARNING,"255,148,50"),vg),Rg=(S(yg={},Pg.SUCCESS,"✓"),S(yg,Pg.WARNING,"!"),yg),Ng=h.div(bg||(bg=N(["\n font-weight: normal;\n"]))),Lg=h.div(Cg||(Cg=N(["\n height: 2px;\n width: 100%;\n background: ",";\n"])),(function(e){return y(["linear-gradient(to right,rgba(",",0),rgba(",",1),rgba(",",0));"],xg[e.type],xg[e.type],xg[e.type])})),Og=h.div(wg||(wg=N(["\n width: 22px;\n height: 22px;\n border-radius: 50%;\n background: ",";\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n margin-right: 8px;\n font-weight: bold;\n"])),(function(e){return y(["rgb(",")"],xg[e.type])})),Dg=h.div(kg||(kg=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 10px 0;\n"]))),Mg=function(e){var r=e.children,n=e.type,o=e.className;return t.createElement(Ng,{className:o},t.createElement(Lg,{type:n}),t.createElement(Dg,null,t.createElement(Og,{type:n},Rg[n]),r),t.createElement(Lg,{type:n}))};Mg.propTypes={children:p.node,type:p.string,className:p.string},Mg.defaultProps={children:null,type:Pg.SUCCESS,className:""};var Ug=h.div(Sg||(Sg=N(["\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n padding: 10px;\n"]))),Fg=h.div(Ag||(Ag=N(["\n text-align: center;\n font-size: 1rem;\n color: #ea3223;\n margin-top: 10px;\n"]))),jg=h.button(_g||(_g=N(["\n margin-top: 20px;\n width: 100%;\n max-width: 160px;\n height: 50px;\n background-color: ",";\n border: 0;\n outline: none;\n border-radius: 0.25rem;\n color: #fff;\n font-weight: 400;\n cursor: pointer;\n font-size: 1rem;\n"])),(function(e){return e.theme.tsBlue})),Vg=h.img(Ig||(Ig=N(["\n width: 100%;\n height: 100%;\n object-fit: contain;\n border-radius: 5px;\n"]))),zg=h.div(Tg||(Tg=N(["\n margin: 20px 0;\n width: 100%;\n display: flex;\n justify-content: space-evenly;\n gap: 10px;\n"]))),Kg=function(e){var r=e.imageTaken,n=e.onConfirm,o=e.onTryAgain,a=e.error,i=e.hasValidQR,l=L(s(null),2),u=l[0],d=l[1],f=Qr.useSDKSettings().lang;return c((function(){var e;return r&&(e=URL.createObjectURL(r.blob),d(e)),function(){URL.revokeObjectURL(e)}}),[r]),t.createElement(Ug,null,null!==i&&t.createElement(Em,{mb:"20px"},t.createElement("div",null,t.createElement(Mg,{type:i?Pg.SUCCESS:Pg.WARNING},i?Eh.CONFIRM_POPUP_VALID_QR[f]:Eh.CONFIRM_POPUP_INVALID_QR[f]))),t.createElement(Ym,{ratio:1.5},t.createElement(Vg,{src:u})),a&&t.createElement(Fg,{className:"confirm-popup-error-message"},a.msg[f]),t.createElement(zg,null,t.createElement(jg,{onClick:o},Eh.BTN_TRY_AGAIN[f]),t.createElement(jg,{onClick:n},Eh.BTN_USE_THIS_PICTURE[f])))};Kg.propTypes={imageTaken:p.shape({}),error:p.shape({msg:p.shape({})}),onConfirm:p.func,onTryAgain:p.func,hasValidQR:p.bool},Kg.defaultProps={imageTaken:null,error:null,onConfirm:function(){},onTryAgain:function(){},hasValidQR:null};var Hg={tsBlue:"#0276f1",tsSecondary:"rgba(0, 47, 117, 0.6)"};var qg=function(){this.__data__=new Ru,this.size=0};var Qg=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var Wg=function(e){return this.__data__.get(e)};var Gg=function(e){return this.__data__.has(e)};var Xg=function(e,t){var r=this.__data__;if(r instanceof Ru){var n=r.__data__;if(!Nu||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new zu(n)}return r.set(e,t),this.size=r.size,this};function Yg(e){var t=this.__data__=new Ru(e);this.size=t.size}Yg.prototype.clear=qg,Yg.prototype.delete=Qg,Yg.prototype.get=Wg,Yg.prototype.has=Gg,Yg.prototype.set=Xg;var $g=Yg;var Zg=function(e,t,r){(void 0!==r&&!Mc(e[t],r)||void 0===r&&!(t in e))&&Dc(e,t,r)};var Jg=function(e){return function(t,r,n){for(var o=-1,a=Object(t),i=n(t),s=i.length;s--;){var c=i[e?s:++o];if(!1===r(a[c],c,a))break}return t}}(),ev=mi((function(e,t){var r=t&&!t.nodeType&&t,n=r&&e&&!e.nodeType&&e,o=n&&n.exports===r?Qs.Buffer:void 0,a=o?o.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var r=e.length,n=a?a(r):new e.constructor(r);return e.copy(n),n}})),tv=Qs.Uint8Array;var rv=function(e){var t=new e.constructor(e.byteLength);return new tv(t).set(new tv(e)),t};var nv=function(e,t){var r=t?rv(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)};var ov=function(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t},av=Object.create,iv=function(){function e(){}return function(t){if(!Ks(t))return{};if(av)return av(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();var sv=function(e){return"function"!=typeof e.constructor||Cl(e)?{}:iv(_l(e))};var cv=function(e){return cc(e)&&$c(e)};var lv=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var uv=function(e){return jc(e,El(e))};var dv=function(e,t,r,n,o,a,i){var s=lv(e,r),c=lv(t,r),l=i.get(c);if(l)Zg(e,r,l);else{var u=a?a(s,c,r+"",e,t,i):void 0,d=void 0===u;if(d){var f=cl(c),p=!f&&ul(c),h=!f&&!p&&gl(c);u=c,f||p||h?cl(s)?u=s:cv(s)?u=ov(s):p?(d=!1,u=ev(c,!0)):h?(d=!1,u=nv(c,!0)):u=[]:Nl(c)||sl(c)?(u=s,sl(s)?u=uv(s):Ks(s)&&!Cc(s)||(u=sv(c))):d=!1}d&&(i.set(c,u),o(u,c,n,a,i),i.delete(c)),Zg(e,r,u)}};var fv,pv=function e(t,r,n,o,a){t!==r&&Jg(r,(function(i,s){if(a||(a=new $g),Ks(i))dv(t,r,s,n,e,o,a);else{var c=o?o(lv(t,s),i,s+"",t,r,a):void 0;void 0===c&&(c=i),Zg(t,s,c)}}),El)},hv=tl((function(e,t,r){pv(e,t,r)})),mv={data:{settings:{sdk_settings:{id_detection_settings:{auto_capture:{enable:!1,show_capture_button:!0,wait_for_best_image_time_ms_web:1e3},blur_check:{enable:!0,threshold_web:.82},disable_capture_button_if_alert:!1,id_detection:{enable:!0},limit_time_settings:{enable:!0,limit_time_second:30,video_partial_length_seconds:15},save_frame_settings:{enable:!1,frames_interval_ms:190,quality_web:80},scan_qr_settings:{enable:!0,limit_time_second:20}}}}}};function gv(e){var t=e.clientSettings,r=L(s(null),2),n=r[0],o=r[1];return c((function(){var e=hv(mv,t),r=$u(e,"data.settings.sdk_settings.id_detection_settings.save_frame_settings.enable"),n=$u(e,"data.settings.sdk_settings.id_detection_settings.save_frame_settings.frames_interval_ms"),a=$u(e,"data.settings.sdk_settings.id_detection_settings.save_frame_settings.quality_web"),i=$u(e,"data.settings.sdk_settings.id_detection_settings.limit_time_settings.enable"),s=$u(e,"data.settings.sdk_settings.id_detection_settings.limit_time_settings.limit_time_second"),c=$u(e,"data.settings.sdk_settings.id_detection_settings.limit_time_settings.video_partial_length_seconds"),l=$u(e,"data.settings.sdk_settings.id_detection_settings.auto_capture.enable"),u=$u(e,"data.settings.sdk_settings.id_detection_settings.auto_capture.wait_for_best_image_time_ms_web"),d=$u(e,"data.settings.sdk_settings.id_detection_settings.blur_check.enable"),f=$u(e,"data.settings.sdk_settings.id_detection_settings.blur_check.threshold_web"),p=$u(e,"data.settings.sdk_settings.id_detection_settings.disable_capture_button_if_alert"),h=$u(e,"data.settings.sdk_settings.id_detection_settings.id_detection.enable"),m=$u(e,"data.settings.sdk_settings.id_detection_settings.scan_qr_settings.enable"),g=$u(e,"data.settings.sdk_settings.id_detection_settings.scan_qr_settings.limit_time_second");o({enableRecording:r,frameCaptureIntervalMs:n,idCardSessionTime:s,maxRecordingTimePerVideo:c,saveFrameQuality:a,enableTimers:i,enableAutoCapture:l,waitForBestImageTimeMs:u,enableBlurCheck:d,blurThreshold:f,disableCaptureButtonIfAlert:p,enableIdDetection:h,enableScanQr:m,scanQrLimitTimeSecond:g})}),[t]),{settings:n}}var vv=v(fv||(fv=N(["\n .text-primary {\n color: ",";\n }\n"])),(function(e){return e.theme.tsBlue})),yv=V.IDCardSide,bv=V.IDCardType,Cv=V.Errors,wv={ID_CARD:"id_card",QR_CODE:"qr_code"},kv=[{scannerType:wv.ID_CARD,title:"Mặt trước CMND/CCCD",description:"Vui lòng đặt CMND mặt trước vào trong khung",titleIcon:"id_card_front.svg",cardSide:V.IDCardSide.FRONT,cardType:bv.VN,frontCamera:!1,enableConfirmPopup:!0},{scannerType:wv.ID_CARD,title:"Mặt sau CMND/CCCD",description:"Vui lòng đặt CMND mặt sau vào trong khung",titleIcon:"id_card_back.svg",cardSide:V.IDCardSide.BACK,cardType:bv.VN,frontCamera:!1,enableConfirmPopup:!0}],Bv={scannerType:wv.QR_CODE,title:"Quét mã QR trên CCCD",frontCamera:!1};function Ev(e){var n=e.onClose,a=e.onError,i=e.clientSettings,l=e.detectIdCard,u=e.onStepDone,d=e.steps,f=e.outputEncryptionSettings,p=e.defaultCameraId,h=L(s(0),2),m=h[0],g=h[1],v=L(s(d[m]),2),y=v[0],C=v[1],w=r(null),k=L(s(null),2),E=k[0],S=k[1],_=L(s(!1),2),T=_[0],P=_[1],x=L(s(0),2),R=x[0],N=x[1],D=r(),M=y.scannerType,U=y.frontCamera,F=y.title,j=y.titleIcon,z=y.cardSide,K=y.description,H=y.usePortraitMask,q=y.cardType,Q=y.enableConfirmPopup,W=z===yv.FRONT,G=In.useAsset(j),X=Ph(),Y=X.showPopup,$=X.popupShown,Z=X.popupType,J=X.props,ee=L(s(!1),2),te=ee[0],re=ee[1],ne=In.useAsset("ic_loading.png"),oe=r({}),ae=r(null),ie=r([]),se=gv({clientSettings:i}).settings,ce=L(s({}),2),le=ce[0],ue=ce[1],de=le.yTitle,fe=o((function(e){S(e),P(!0)}),[]);c((function(){P(!1)}),[U]);var pe=o((function(){Y({popupType:null})}),[Y]),he=o((function(e){e>=d.length||setTimeout((function(){g(e),C(d[e])}),200)}),[d]),me=o((function(){he(m+1)}),[he,m]),ge=o((function(){setTimeout((function(){C((function(e){return I(I({},Bv),{},{enableConfirmPopup:e.enableConfirmPopup})}))}),200)}),[]),ve=o(B(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={stepNumber:m,image:oe.current,recordedVideos:null!=se&&se.enableRecording?ie.current:[]},M===wv.QR_CODE&&(t.qrScannedResult=ae.current),re(!0),e.next=5,u(t);case 5:re(!1),me();case 7:case"end":return e.stop()}}),e)}))),[se,m,u,me,M]),ye=o((function(){pe(),M===wv.QR_CODE?he(m):M===wv.ID_CARD&&D.current.restartSession()}),[he,m,pe,M]),be=o((function(){pe(),ve()}),[ve,pe]),Ce=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,i,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.image,n=t.error,o=t.recordedVideos,oe.current=r,ie.current=o,N((function(e){return e+1})),z!==V.IDCardSide.FRONT){e.next=23;break}if(!se.enableScanQr||!gi.isMobile){e.next=23;break}if(s=null==r||null===(i=r.detectedCard)||void 0===i?void 0:i.label){e.next=20;break}return re(!0),e.prev=9,e.next=12,l({image:r,cardType:q,cardSide:z});case 12:c=e.sent,s=c.card_label,e.next=19;break;case 16:e.prev=16,e.t0=e.catch(9),a(Cv.detect_id_card_error);case 19:re(!1);case 20:if(!s||!"vn.cccd_new.front".includes(s)){e.next=23;break}return ge(),e.abrupt("return");case 23:Q?Y({popupType:Rh,props:{imageTaken:oe.current,error:n}}):ve();case 24:case"end":return e.stop()}}),e,null,[[9,16]])})));return function(t){return e.apply(this,arguments)}}(),[Q,Y,z,se,q,l,ve,ge,a]),we=o((function(e){var t;if(ae.current=e,e){var r,n=e.recordedVideos;(r=ie.current).push.apply(r,O(n))}N((function(e){return e+1}));var o=Boolean(null==e||null===(t=e.validateResult)||void 0===t?void 0:t.valid);Q?Y({popupType:Rh,props:{hasValidQR:o,imageTaken:oe.current}}):ve()}),[Y,Q,ve]);return t.createElement(b,{theme:Hg},t.createElement(dh,null,t.createElement(Os,{key:U,frontCamera:U,onVideoPlayed:fe,onClose:n,flipHorizontal:U,ref:w,onError:a,defaultCameraId:p},T&&t.createElement(t.Fragment,null,M===wv.ID_CARD&&t.createElement(gm,{key:m,ref:D,windowAndVideoInfo:E,refVideo:w,settings:se,onCaptureDone:Ce,onUISpacingChange:ue,frontSide:W,description:K,usePortraitMask:H,outputEncryptionSettings:f}),M===wv.QR_CODE&&t.createElement(Eg,{key:m,refVideo:w,windowAndVideoInfo:E,settings:se,onCaptureDone:we,onUISpacingChange:ue,outputEncryptionSettings:f})),t.createElement(uh,{keyForTransition:R}),t.createElement(gh,{y:"".concat(de,"px")},t.createElement(wp,null,t.createElement(mp,{key:F,timeout:{enter:500,exit:500},classNames:"flipY",unmountOnExit:!0},t.createElement(vh,null,j&&t.createElement(fh,{src:G,alt:""}),t.createElement(yh,{className:"title"},F))))),te&&t.createElement(hh,null,t.createElement("img",{src:ne,alt:"",className:"spin"}))),t.createElement(ef,{open:$},Z===Rh&&t.createElement(Kg,A({},J,{onConfirm:be,onTryAgain:ye})))),t.createElement(vv,null))}Ev.propTypes={onClose:p.func,onError:p.func,clientSettings:p.shape({}),detectIdCard:p.func,onStepDone:p.func,steps:p.arrayOf(p.shape({})),outputEncryptionSettings:p.shape({}),defaultCameraId:p.string},Ev.defaultProps={onClose:function(){},onError:function(){},clientSettings:{},detectIdCard:function(){return Promise.resolve({card_label:""})},onStepDone:function(){},steps:kv,outputEncryptionSettings:null,defaultCameraId:void 0};var Sv=["tracking","clientSettings"];function Av(e){var r=e.tracking,o=e.clientSettings,a=R(e,Sv),i=n((function(){return $u(o,"data.settings.sdk_settings.server_log_settings.enable",null==r?void 0:r.enable)}),[o,r]);return t.createElement(Sn.SDKTrackingProvider,{value:{tracking:I(I({},r),{},{enable:i})}},t.createElement(Ev,A({},a,{clientSettings:o})))}Av.propTypes={tracking:p.shape({}),clientSettings:p.shape({})},Av.defaultProps={tracking:void 0,clientSettings:void 0};var _v=V.IDCardSide,Iv=V.Errors;function Tv(e){return Pv.apply(this,arguments)}function Pv(){return(Pv=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.image,n=t.cardType,o=t.cardSide,a=t.apiClient,i=t.outputEncryptionSettings,s={label:"id_card.".concat(n,".").concat(o)},!i||!i.key){e.next=4;break}return e.abrupt("return",a.httpClient.post("/v1/images",I({base64:r.encrypted.hex},s),{"X-TV-Key":i.key}));case 4:return e.abrupt("return",a.uploadImage(I({file:r.blob},s)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xv(e){return Rv.apply(this,arguments)}function Rv(){return(Rv=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.image,n=t.apiClient,o=t.rawString,a=t.outputEncryptionSettings,i={label:"qr_code",metadata:JSON.stringify({raw:o})},!a||!a.key){e.next=4;break}return e.abrupt("return",n.httpClient.post("/v1/images",I({base64:r.encrypted.hex},i),{"X-TV-Key":a.key}));case 4:return e.abrupt("return",n.uploadImage(I({file:r.blob},i)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Nv(e){return Lv.apply(this,arguments)}function Lv(){return(Lv=B(regeneratorRuntime.mark((function e(t){var r,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.imageId,n=t.cardType,o=t.apiClient,e.abrupt("return",o.requestVerifyIDCard({card_type:n,image1:{id:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ov(e){return Dv.apply(this,arguments)}function Dv(){return(Dv=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.apiClient,n=t.cardType,o=t.frontCardId,a=t.isCapturingFrontSide,i=t.backCardId,s=t.recordedVideos,c=t.qrImageId,l=s.filter((function(e){return null!==e.id})),u=s.filter((function(e){return null===e.id&&e.frames.length>0})),e.next=5,Promise.all(u.map((function(e){return r.fileService.request({frames:e.frames})})));case 5:return d=e.sent,f={card_type:n,image:{id:o},image2:a?void 0:{id:i},videos:[].concat(O(l.map((function(e){return{id:e.id}}))),O(d.map((function(e){return{id:e.data.file_id}}))))},c&&(f.qr1_images=[{id:c}]),e.abrupt("return",r.detectIDTampering(f));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Mv(e){return Uv.apply(this,arguments)}function Uv(){return(Uv=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.cardType,n=t.apiClient,o=t.frontCardId,a=t.backCardId,i=t.isCapturingFrontSide,s=t.qrImageId,c={card_type:r,image1:i?{id:o}:{id:a}},s&&(c.qr1_images=[{id:s}]),e.abrupt("return",n.readIDCard(c));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fv(e){return jv.apply(this,arguments)}function jv(){return(jv=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i,s,c,l,u,d,f,p,h,m,g,v,y,b,C,w,k,B,E,S;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.image,o=t.frontCardId,a=t.qrImageId,i=t.onError,s=t.recordedVideos,c=t.apiClient,l=t.cardType,u=t.cardSide,d=t.qrScannedResult,f=t.outputEncryptionSettings,u!==_v.BACK||o){e.next=4;break}return i(Iv.missing_front_id_card),e.abrupt("return");case 4:return p=[Tv({image:n,cardType:l,cardSide:u,apiClient:c,outputEncryptionSettings:f})],d&&p.push(xv({image:d.image,apiClient:c,rawString:d.result,outputEncryptionSettings:f})),e.next=8,Promise.all(p);case 8:if(h=e.sent,m=L(h,2),g=m[0],v=m[1],!g.errors){e.next=15;break}return i(I(I({},Iv.upload_error),{},{details:g.errors})),e.abrupt("return");case 15:return y=g.data.image_id,b=(null==v||null===(r=v.data)||void 0===r?void 0:r.image_id)||a,(k=u===_v.FRONT)?C=y:(C=o,w=y),e.next=21,Nv({imageId:y,cardType:l,apiClient:c});case 21:if(!(B=e.sent).errors){e.next=25;break}return i(I(I({},Iv.sanity_check_error),{},{details:B.errors})),e.abrupt("return");case 25:return e.next=27,Mv({cardType:l,apiClient:c,frontCardId:C,backCardId:w,isCapturingFrontSide:k,qrImageId:b});case 27:if(!(E=e.sent).errors){e.next=31;break}return i(I(I({},Iv.read_id_card_error),{},{details:E.errors})),e.abrupt("return");case 31:return e.next=33,Ov({apiClient:c,cardType:l,frontCardId:C,isCapturingFrontSide:k,backCardId:w,recordedVideos:s,qrImageId:b});case 33:if(!(S=e.sent).errors){e.next=37;break}return i(I(I({},Iv.detect_id_tampering_error),{},{details:S.errors})),e.abrupt("return");case 37:return e.abrupt("return",{sanityResult:B.data,tamperingInfo:S.data,cardInfo:E.data,qrImageId:b});case 38:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Vv=["onClose","onError","detectIdCard","steps","onStepDone","apiCredentials","tracking","outputEncryptionSettings"],zv=V.Errors,Kv=function(e){var n=e.onClose,a=e.onError,i=e.detectIdCard,l=e.steps,u=e.onStepDone,d=e.apiCredentials,f=e.tracking,p=e.outputEncryptionSettings,h=R(e,Vv),m=L(s(null),2),g=m[0],v=m[1],y=La.useApiClient({apiCredentials:d,tracking:f}).apiClient,b=r(""),C=r("");c((function(){function e(){return(e=B(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.clientSettings();case 2:t=e.sent,v(t);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[y]);var w=o(function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,i,s,c,d,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.stepNumber,n=t.recordedVideos,o=t.qrScannedResult,i=t.image,s=l[r],c=s.cardType,d=s.cardSide,f=null,e.prev=3,e.next=6,Fv({image:i,cardSide:d,frontCardId:b.current,qrImageId:C.current,onError:a,apiClient:y,cardType:c,recordedVideos:n,qrScannedResult:o,outputEncryptionSettings:p});case 6:f=e.sent,d===V.IDCardSide.FRONT&&(b.current=f.cardInfo.image1.id),C.current=f.qrImageId,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),a(I(I({},zv.api_call_error),{},{details:e.t0}));case 14:f&&u(I(I({},t),{},{apiResult:f}));case 15:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(t){return e.apply(this,arguments)}}(),[y,a,l,u,p]);return g&&t.createElement(Av,A({tracking:f,onClose:n,onError:a,detectIdCard:i,onStepDone:w,steps:l,outputEncryptionSettings:p},h,{clientSettings:g}))};function Hv(){return(Hv=B(regeneratorRuntime.mark((function e(){var t,r,n,o,a,i,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]?s[0]:{},r=t.opencvUrl,n=t.idCardModelUrl,o=t.blazefaceModelUrl,a=t.tfScriptUrls,"iOS"!==gi.osName||!gi.osVersion.includes("12.")){e.next=5;break}return e.next=4,$h({url:r});case 4:return e.abrupt("return");case 5:return e.next=7,oi.loadTensorFlow(a);case 7:return e.next=9,oi.initTensorFlow({preferredBackends:["wasm","webgl","cpu"]});case 9:return i=new tm,e.next=12,Promise.all([i.loadResource({modelUrl:n}),oi.loadBlazefaceModel({modelUrl:o}),$h({url:r})]);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}Kv.propTypes={onClose:p.func,onError:p.func,detectIdCard:p.func,onStepDone:p.func,steps:p.arrayOf(p.shape({})),apiCredentials:p.shape({accessKey:p.string,secretKey:p.string,apiUrl:p.string}),tracking:p.shape({}),outputEncryptionSettings:p.shape({})},Kv.defaultProps={onClose:function(){},onError:function(){},detectIdCard:function(){return Promise.resolve({card_label:""})},onStepDone:function(){},steps:kv,apiCredentials:{accessKey:"5767c20d-87aa-4cad-8dbb-f5429f76c34b",secretKey:"c1446919-e60a-4575-a05d-304318212a1b",apiUrl:"https://tv-testing.trustingsocial.com/api"},outputEncryptionSettings:{key:""},tracking:void 0};var qv,Qv,Wv,Gv,Xv,Yv,$v,Zv=od((function(){return Hv.apply(this,arguments)})),Jv=function(){var e=B(regeneratorRuntime.mark((function e(t){var r,n,o,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.blob,n=t.resultWarmup,o=n.idCardModel,a=n.ableToUseModel){e.next=4;break}return e.abrupt("return",{ableToUseModel:a});case 4:return e.next=6,Ca.blobToCanvas({blob:r});case 6:return i=e.sent,e.abrupt("return",o.predict(i,{detectThreshold:.3}));case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ey=function(){return{checkCamera:zf,LivenessDetection:ep,NativeCamera:Hf,ReadIDCardUIOnly:Av,ReadIDCardWithApiCall:Kv,warmUpReadIdCard:sm,preloadEKYCResources:Zv,getListCamera:Cs}},ty=Sd,ry=R(Vf,["useLivenessDetection"]);function ny(e){var r=e.className;return t.createElement("svg",{className:r,width:"320",height:"320",viewBox:"0 0 320 320",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M320 0H0V320H320V0ZM160 296C235.111 296 296 235.111 296 160C296 84.8893 235.111 24 160 24C84.8893 24 24 84.8893 24 160C24 235.111 84.8893 296 160 296Z",fill:"currentColor"}))}ny.propTypes={className:p.string},ny.defaultProps={className:""};var oy,ay,iy,sy,cy,ly,uy,dy,fy,py,hy,my,gy=(S(qv={},V.FaceDirection.LEFT,90),S(qv,V.FaceDirection.RIGHT,270),S(qv,V.FaceDirection.UP,180),S(qv,V.FaceDirection.DOWN,0),qv),vy=g(["0%{opacity:0.15;}50%{opacity:0.3;}100%{opacity:1;}"]),yy=h.div(Qv||(Qv=N(["\n width: 200px;\n height: 200px;\n position: relative;\n transform: scale(0.48);\n\n .top,\n .right,\n .bottom,\n .left {\n position: absolute;\n }\n\n .top {\n top: 0;\n left: 50%;\n transform: rotate(","deg) translateX(-50%);\n }\n\n .right {\n right: 0;\n top: 50%;\n transform: rotate(","deg) translateX(-50%);\n }\n\n .bottom {\n bottom: 0;\n left: 50%;\n transform: rotate(","deg) translateX(50%);\n }\n\n .left {\n left: 0;\n top: 50%;\n transform: rotate(","deg) translateX(50%);\n }\n"])),gy[V.FaceDirection.DOWN],gy[V.FaceDirection.LEFT],gy[V.FaceDirection.UP],gy[V.FaceDirection.RIGHT]),by=h.div(Wv||(Wv=N(["\n width: 70px;\n transform: rotate(","deg);\n"])),(function(e){var t,r=e.direction;return null!==(t=gy[r])&&void 0!==t?t:0})),Cy=h.span(Gv||(Gv=N(["\n display: flex;\n margin: 4px 0;\n width: 100%;\n height: 15px;\n animation: "," 1s infinite;\n animation-direction: alternate;\n\n &::before,\n &::after {\n content: '';\n height: 100%;\n width: 50%;\n background: rgba(255, 255, 255, 0.8);\n }\n\n &::before {\n transform: skewY(32deg);\n }\n\n &::after {\n width: 50%;\n transform: skewY(-32deg);\n }\n"])),vy),wy=h(Cy)(Xv||(Xv=N(["\n animation-delay: 0s;\n"]))),ky=h(Cy)(Yv||(Yv=N(["\n animation-delay: 0.5s;\n"]))),By=h(Cy)($v||($v=N(["\n animation-delay: 1s;\n"])));function Ey(e){var r=e.type;return r!==V.FaceDirection.FRONTAL?t.createElement(by,{direction:r},t.createElement(wy,null),t.createElement(ky,null),t.createElement(By,null)):t.createElement(yy,null,t.createElement(by,{className:"top"},t.createElement(wy,null),t.createElement(ky,null),t.createElement(By,null)),t.createElement(by,{className:"right"},t.createElement(wy,null),t.createElement(ky,null),t.createElement(By,null)),t.createElement(by,{className:"bottom"},t.createElement(wy,null),t.createElement(ky,null),t.createElement(By,null)),t.createElement(by,{className:"left"},t.createElement(wy,null),t.createElement(ky,null),t.createElement(By,null)))}Ey.propTypes={type:p.oneOf([V.FaceDirection.LEFT,V.FaceDirection.RIGHT,V.FaceDirection.UP,V.FaceDirection.FRONTAL])},Ey.defaultProps={type:V.FaceDirection.LEFT};var Sy=650,Ay=750,_y=zs,Iy=ry.Text,Ty=ry.FaceDetectionError,Py=ry.FaceVerificationInstructions,xy=ry.FaceVerificationStepsWrapper,Ry=ry.StepItem,Ny=ry.BottomButtonsOverlay,Ly=ry.Button,Oy=ry.CountDownOverlay,Dy=ry.InstructionsOverlay,My=h(xy)(oy||(oy=N(["\n height: 50px;\n"]))),Uy=h(Iy)(ay||(ay=N(["\n position: absolute;\n font-style: normal;\n font-weight: bold;\n font-size: 1.5rem;\n text-align: center;\n padding: 0 1.75rem;\n color: ",";\n\n ","\n\n ",";\n"])),(function(e){return e.color}),(function(e){var t=e.top;return t&&y(["top:","px;"],t)}),(function(e){return e.isMobile&&y(["font-size:1.125rem;"])})),Fy=h(Ty)(iy||(iy=N(["\n position: absolute;\n font-size: 1.125rem;\n text-align: center;\n\n ",";\n"])),(function(e){return e.isMobile&&y(["font-size:0.875rem;"])})),jy=h(Py)(sy||(sy=N(["\n position: absolute;\n font-size: 1.125rem;\n text-align: center;\n padding: 0 1.75rem;\n color: ",";\n text-shadow: none;\n\n ",";\n"])),(function(e){return e.color}),(function(e){return e.isMobile&&y(["font-size:0.875rem;"])})),Vy=h(ny)(cy||(cy=N(["\n width: 100%;\n height: 100%;\n vertical-align: middle;\n margin: 0;\n color: ",";\n"])),(function(e){var t=e.color;return null!=t?t:"#06243c"})),zy=h.img(ly||(ly=N(["\n && {\n width: 20px;\n border-radius: 50%;\n margin: 0;\n\n ","\n }\n"])),(function(e){return"preview"===e.mode&&y(["width:42px;"])})),Ky=h(Ry)(uy||(uy=N(["\n width: 50px;\n height: 50px;\n border: 1px solid #005993;\n border-radius: 50%;\n\n & + & {\n margin-left: 10px;\n }\n\n ","\n"])),(function(e){return!e.active&&y(["border-color:#f2f6f9;opacity:0.3;"])})),Hy=h(jd)(dy||(dy=N(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),qy=h.div(fy||(fy=N(["\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 0;\n z-index: -1;\n"]))),Qy=h(qy)(py||(py=N(["\n background: rgba(223, 0, 0, 0.2);\n"]))),Wy=g(["from{opacity:1;}to{opacity:0;}"]),Gy=h(qy)(hy||(hy=N(["\n background: rgba(255, 255, 255, 0.3);\n animation: "," 1s infinite;\n"])),Wy),Xy=gi.isMobile?{width:640}:null;function Yy(e){var r=e.className,a=e.apiCheck,i=e.enableInstructionsOverlay,s=e.enableErrorOverlay,c=e.enableCapturingOverlay,l=e.frontalMinSize,u=e.mode,d=e.minPadding,f=e.backgroundColor,p=e.textColor,h=e.progressProps,m=e.title,g=e.description,v=e.customInstructions,y=e.customIcon,b=e.customDirectionIcon,C=e.onLivenessDetectionDone,w=e.onClose,k=e.onError,B=e.captureFrameSettings,E=e.onFramesCaptured,S=e.livenessSettings,_=e.initFirstGestureTimeout,I=o((function(e){var t=e.clientWidth,r=e.clientHeight,n=e.videoAreaWidth,o=e.videoAreaHeight,a=e.lostX,i=e.lostY,s=Math.max(80,i),c=Math.max(140,i);r>Sy&&(s=Math.max(110,i),c=Math.max(170,i)),r>Ay&&(s=Math.max(140,i),c=Math.max(200,i));var l=Math.max(d,a),u=Math.max(d,a),f=Math.min(n,o),p=Math.max(Math.floor(Math.min(t-(l+u),r-(s+c),f)),160);return{x:Math.min(Math.floor(l+(t-u-l)/2-p/2),t-p),y:Math.min(Math.floor(s+(r-c-s)/2-p/2),r-p),width:p,height:p}}),[d]),T=n((function(){return{background:f,opacity:1}}),[f]),P=ty({apiCheck:a,frontalMinSize:l,mode:u,bgCameraMask:null,bgCameraMaskRed:null,surroundStyle:T,cropAreaDimension:I,customInstructions:v,customIcon:y,customDirectionIcon:b,onLivenessDetectionDone:C,captureFrameSettings:B,onFramesCaptured:E,livenessSettings:S,initFirstGestureTimeout:_}),x=P.countdownToTakePicture,R=P.cropArea,N=P.curStepIndex,L=P.directionIcon,O=P.faceDetectionError,D=P.handleTriggerPassiveMode,M=P.handleVideoPlayed,U=P.instructions,F=P.isActiveMode,j=P.refVideo,V=P.showCountdown,z=P.steps,K=P.videoPlayed,H=P.activeCapturing,q=P.warmupDone,Q=10,W=45,G=2,X=50,Y=12,$=14;window.innerHeight>Sy&&(Q=25,W=65,G=3,X=50,Y=24,$=34),window.innerHeight>Ay&&(Q=30,W=80,G=5,X=50,Y=32,$=54);var Z=R.current?R.current.y+R.current.height+G:0,J=$+X+Y,ee=s&&O;return t.createElement(Os,{ref:j,className:r,frontCamera:!0,flipHorizontal:!0,videoSettings:Xy,onVideoPlayed:M,onClose:w,onError:k},!q&&t.createElement(Cf,null),K?t.createElement(t.Fragment,null,t.createElement(Uy,{top:Q,isMobile:gi.isMobile,color:p},m),R.current?t.createElement(Vs,{x:"".concat(R.current.x,"px"),y:"".concat(R.current.y,"px"),width:"".concat(R.current.width,"px"),height:"".concat(R.current.height,"px"),surroundStyle:R.current.surroundStyle},t.createElement(Vy,{color:f}),t.createElement(Hy,A({progress:N/z.length*100,hasError:ee},h)),V?t.createElement(Oy,null,x):null,F&&i&&L?t.createElement(Dy,null,L):null,F&&c&&H?t.createElement(Gy,null):null,ee?t.createElement(Qy,null):null):null,O?t.createElement(Fy,{top:Z,isMobile:gi.isMobile,error:O}):null,F?t.createElement(t.Fragment,null,t.createElement(jy,{top:W,isMobile:gi.isMobile,color:p},g),U?t.createElement(jy,{bottom:J,isMobile:gi.isMobile,color:p},U):null,t.createElement(My,{bottom:$},z.map((function(e,r){var n=e.name,o=e.icon,a=e.image.objUrl,i=N>=r;return t.createElement(Ky,{key:n,active:i},a?t.createElement(zy,{src:a,alt:"",mode:"preview"}):function(e,r){return"string"==typeof e?t.createElement(zy,{src:e,alt:""}):t.cloneElement(e,r)}(o,{active:i}))})))):t.createElement(t.Fragment,null,O?null:t.createElement(Ny,null,t.createElement(Ly,{onClick:D},t.createElement(_y,null))))):null)}Yy.propTypes={className:p.string,apiCheck:p.bool,enableInstructionsOverlay:p.bool,enableErrorOverlay:p.bool,enableCapturingOverlay:p.bool,frontalMinSize:p.number,mode:p.string,minPadding:p.number,backgroundColor:p.string,textColor:p.string,progressProps:p.shape({className:p.string,style:p.shape({}),radius:p.number,strokeWidth:p.number,progress:p.number,activeColor:p.string,innerPadding:p.number,outsideRingColor:p.string,insideRingColor:p.string,insideRingWidth:p.number,dashedRingColor:p.string,dashedRingWidth:p.number,dashedRingLineThick:p.number,dashedRingLineSpacing:p.number,showOutsideRing:p.bool,showDashedRing:p.bool,showInsideRing:p.bool}),title:p.string,description:p.string,customInstructions:p.shape({}),customIcon:p.shape({}),customDirectionIcon:p.shape({}),onLivenessDetectionDone:p.func,onClose:p.func,onError:p.func,captureFrameSettings:p.shape({}),onFramesCaptured:p.func,livenessSettings:p.shape({}),initFirstGestureTimeout:p.number},Yy.defaultProps={className:"",apiCheck:!1,enableInstructionsOverlay:!1,enableErrorOverlay:!1,enableCapturingOverlay:!1,frontalMinSize:720,mode:null,minPadding:30,backgroundColor:"#06243c",textColor:"#ffffff",progressProps:null,title:"Chụp ảnh chân dung",description:"Xin đưa khuôn mặt vào khung hình. Hình ảnh sẽ tự động được ghi lại.",customInstructions:null,customIcon:null,customDirectionIcon:(my={},S(my,V.FaceDirection.LEFT,t.createElement(Ey,{type:V.FaceDirection.LEFT})),S(my,V.FaceDirection.RIGHT,t.createElement(Ey,{type:V.FaceDirection.RIGHT})),S(my,V.FaceDirection.UP,t.createElement(Ey,{type:V.FaceDirection.UP})),S(my,V.FaceDirection.FRONTAL,t.createElement(Ey,{type:V.FaceDirection.FRONTAL})),my),onLivenessDetectionDone:null,onClose:null,onError:function(){},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:function(){},livenessSettings:null,initFirstGestureTimeout:2e3};export{La as APIUtils,lh as Animations,ai as AntiDebugUtils,In as AssetUtils,Pn as AsyncUtils,ks as BASE_Z_INDEX,di as BaseTVWebSDK,eo as BlurUtils,xm as Button,Rm as ButtonLink,Os as Camera,ro as CameraUtils,oo as CommonUtils,V as Constants,lo as CoordinateUtils,Vs as CropAreaOverlayWrapper,ci as CryptoUtils,yo as FaceUtils,Ea as GlareUtils,gn as HashUtils,Mg as HighlightResult,Pg as HighlightResultType,Qf as Icons,Ca as ImageUtils,Yy as LivenessDetection,ry as LivenessDetectionComponents,Ka as LoadResourceUtils,fn as LocalStorageUtils,yi as MobileDetect,oi as ModelUtils,Hf as NativeCamera,js as PlacementArea,ef as Popup,ko as PredictionUtils,jd as ProgressCircle,Ym as RatioWrapper,Av as ReadIDCardUIOnly,Kv as ReadIDCardWithApiCall,Bp as RectangleMask,kp as RectangleMaskType,wv as ScannerType,Qr as SettingsContext,Em as Spacing,ii as ThemeUtils,ln as TimeUtils,Sn as TrackingContext,an as UserAgentUtils,Cf as WarmupPopup,zf as checkCamera,mv as defaultClientSettings,kv as defaultReadIDCardSteps,ey as getBaseSDKComponent,Vr as getCustomUrlsBySettings,li as getQrScannerWorkerPath,fi as getSDKVersion,Fv as handleApiCheckReadIdCard,Zv as preloadEKYCResources,Jv as readIdCardFromImage,gg as readQRCodeFromImage,ty as useLivenessDetection,Bg as useMainProcessQRCodeScanner,hm as useMainProcessReadIdCard,gv as useSettingsReadIdCard,Ph as useShowPopup,cg as warmUpQRCodeScanner,sm as warmUpReadIdCard,pd as warmupSelfieActive};
|