Created
August 26, 2019 17:08
-
-
Save vladimyr/6defee896ac771b633964c05091ab4a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @license | |
Copyright (c) 2016-2018 by CyberSource flex-sdk-web v0.2.1 | (c) CyberSource 2017 */ | |
'use strict'; | |
!function(root, factory) { | |
if ("object" == typeof exports && "object" == typeof module) { | |
module.exports = factory(); | |
} else { | |
if ("function" == typeof define && define.amd) { | |
define([], factory); | |
} else { | |
var merge = factory(); | |
var i; | |
for (i in merge) { | |
("object" == typeof exports ? exports : root)[i] = merge[i]; | |
} | |
} | |
} | |
}("undefined" != typeof self ? self : this, function() { | |
return function(e) { | |
/** | |
* @param {number} i | |
* @return {?} | |
*/ | |
function t(i) { | |
if (n[i]) { | |
return n[i].exports; | |
} | |
var module = n[i] = { | |
i : i, | |
l : false, | |
exports : {} | |
}; | |
return e[i].call(module.exports, module, module.exports, t), module.l = true, module.exports; | |
} | |
var n = {}; | |
return t.m = e, t.c = n, t.d = function(d, name, n) { | |
if (!t.o(d, name)) { | |
Object.defineProperty(d, name, { | |
configurable : false, | |
enumerable : true, | |
get : n | |
}); | |
} | |
}, t.n = function(module) { | |
/** @type {function(): ?} */ | |
var n = module && module.__esModule ? function() { | |
return module.default; | |
} : function() { | |
return module; | |
}; | |
return t.d(n, "a", n), n; | |
}, t.o = function(t, object) { | |
return Object.prototype.hasOwnProperty.call(t, object); | |
}, t.p = "", t(t.s = 198); | |
}({ | |
0 : function(module, exports, __weex_require__) { | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function isObjectLike(value) { | |
return null != value && "object" === (void 0 === value ? "undefined" : _typeof(value)); | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function isObject(value) { | |
var argType = void 0 === value ? "undefined" : _typeof(value); | |
return null != value && ("object" === argType || "function" === argType); | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function isFunction(value) { | |
/** @type {string} */ | |
var t = isObject(value) ? Object.prototype.toString.call(value) : ""; | |
return "[object Function]" === t || "[object GeneratorFunction]" === t; | |
} | |
/** | |
* @param {string} value | |
* @return {?} | |
*/ | |
function isString(value) { | |
return "string" == typeof value || !Array.isArray(value) && isObjectLike(value) && "[object String]" === Object.prototype.toString.call(value); | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function isEmpty(value) { | |
return "object" === ("undefined" == typeof HTMLElement ? "undefined" : _typeof(HTMLElement)) ? value instanceof HTMLElement : isObjectLike(value) && 1 === value.nodeType && "string" == typeof value.nodeName; | |
} | |
/** | |
* @param {?} data | |
* @return {?} | |
*/ | |
function dataToAscii(data) { | |
return String.fromCharCode.apply(null, new Uint8Array(data)); | |
} | |
/** | |
* @param {string} text | |
* @return {?} | |
*/ | |
function parse(text) { | |
/** @type {!ArrayBuffer} */ | |
var data = new ArrayBuffer(text.length); | |
/** @type {!Uint8Array} */ | |
var ui8a = new Uint8Array(data); | |
/** @type {number} */ | |
var i = 0; | |
var l = text.length; | |
for (; i < l; i = i + 1) { | |
ui8a[i] = text.charCodeAt(i); | |
} | |
return data; | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function removeSelection() { | |
if (window.getSelection && window.getSelection().empty) { | |
window.getSelection().empty(); | |
} else { | |
if (window.getSelection && window.getSelection().removeAllRanges) { | |
window.getSelection().removeAllRanges(); | |
} else { | |
if (document.selection) { | |
document.selection.empty(); | |
} | |
} | |
} | |
} | |
/** | |
* @return {?} | |
*/ | |
function guid() { | |
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(l) { | |
/** @type {number} */ | |
var r = 16 * Math.random() | 0; | |
return ("x" === l ? r : 3 & r | 8).toString(16); | |
}); | |
} | |
/** | |
* @param {?} key | |
* @return {?} | |
*/ | |
function d(key) { | |
return JSON.parse(JSON.stringify(key)); | |
} | |
/** | |
* @param {string} el | |
* @return {?} | |
*/ | |
function GetFlashVars(el) { | |
return "string" == typeof el ? el.replace(/\D/g, "") : ""; | |
} | |
Object.defineProperty(exports, "__esModule", { | |
value : true | |
}); | |
/** @type {function((!Function|string)): ?} */ | |
var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(ctor) { | |
return typeof ctor; | |
} : function(obj) { | |
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | |
}; | |
/** @type {function(?): ?} */ | |
exports.isObjectLike = isObjectLike; | |
/** @type {function(?): ?} */ | |
exports.isObject = isObject; | |
/** @type {function(?): ?} */ | |
exports.isFunction = isFunction; | |
/** @type {function(string): ?} */ | |
exports.isString = isString; | |
/** @type {function(?): ?} */ | |
exports.isElement = isEmpty; | |
/** @type {function(?): ?} */ | |
exports.arrayBufferToString = dataToAscii; | |
/** @type {function(string): ?} */ | |
exports.stringToArrayBuffer = parse; | |
/** @type {function(): undefined} */ | |
exports.clearCurrentSelection = removeSelection; | |
/** @type {function(): ?} */ | |
exports.uuid = guid; | |
/** @type {function(?): ?} */ | |
exports.simpleClone = d; | |
/** @type {function(string): ?} */ | |
exports.stripNonDigits = GetFlashVars; | |
exports.Base64 = { | |
encode : function(value) { | |
var input = isString(value) ? parse(value) : value; | |
if ("ArrayBuffer" == typeof input || input instanceof ArrayBuffer) { | |
/** @type {!Uint8Array} */ | |
var uInt8Array = new Uint8Array(input); | |
return window.btoa(String.fromCharCode.apply(null, uInt8Array)); | |
} | |
throw new TypeError("Input should be of type String or ArrayBuffer"); | |
} | |
}; | |
}, | |
1 : function(_wid_attr, data, linkedEntities) { | |
Object.defineProperty(data, "__esModule", { | |
value : true | |
}); | |
var fields = (data.encryptionTypes = ["rsaoaep256", "rsaoaep", "none"], data.cssClasses = { | |
FOCUSED : "flex-microform-focused", | |
VALID : "flex-microform-valid", | |
INVALID : "flex-microform-invalid", | |
DISABLED : "flex-microform-disabled", | |
AUTOCOMPLETE : "flex-microform-autocomplete" | |
}, data.jsEvents = { | |
ENABLE : "enabled", | |
DISABLE : "disabled", | |
FOCUS : "focus", | |
BLUR : "blur", | |
EMPTY : "empty", | |
NOT_EMPTY : "notEmpty", | |
CARD_TYPE_CHANGE : "cardTypeChange", | |
VALIDATION_CHANGE : "validationChange", | |
INPUT_SUBMIT_REQUEST : "inputSubmitRequest", | |
TOKENIZE_LOAD_START : "tokenizeLoadStart", | |
AUTOCOMPLETE : "autocomplete", | |
AUTOCOMPLETE_CHANGE : "autocompleteChange" | |
}); | |
/** @type {!Array<?>} */ | |
data.jsEventsList = Object.keys(fields).map(function(utteranceIndex) { | |
return fields[utteranceIndex]; | |
}); | |
data.postMessagesFromParent = { | |
FOCUS : "focus", | |
TOKENIZE : "tokenize", | |
CLEAR : "clear", | |
ENABLE : "enable", | |
DISABLE : "disable", | |
SET_PLACEHOLDER : "setPlaceholder" | |
}; | |
data.postMessagesFromChild = { | |
FOCUS : "focus", | |
BLUR : "blur", | |
EMPTY : "empty", | |
NOT_EMPTY : "notEmpty", | |
CARD_CHANGE_TYPE : "cardTypeChange", | |
VALIDATION_CHANGE : "cardValidationChange", | |
ENABLE : "enable", | |
DISABLE : "disable", | |
INPUT_SUBMIT_REQUEST : "inputSubmitRequest", | |
TOKENIZE_LOAD_START : "tokenizeLoadStart", | |
HANDSHAKE_INIT : "handshakeInit", | |
HANDSHAKE_COMPLETE : "handshakeComplete", | |
AUTOCOMPLETE : "autocomplete", | |
AUTOCOMPLETE_CHANGE : "autocompleteChange" | |
}; | |
}, | |
198 : function(module, exports, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!NodeList} array | |
* @return {?} | |
*/ | |
function makeArray(array) { | |
if (Array.isArray(array)) { | |
/** @type {number} */ | |
var i = 0; | |
/** @type {!Array} */ | |
var ret = Array(array.length); | |
for (; i < array.length; i++) { | |
ret[i] = array[i]; | |
} | |
return ret; | |
} | |
return Array.from(array); | |
} | |
/** | |
* @param {!Event} e | |
* @return {?} | |
*/ | |
function isTextKey(e) { | |
var t = e.which ? e.which : e.keyCode; | |
return !(46 !== t && t > 31 && (t < 48 || t > 57)); | |
} | |
/** | |
* @param {!Element} elm | |
* @return {undefined} | |
*/ | |
function addPlaceHolders(elm) { | |
elm.addEventListener("keypress", function(e) { | |
return isTextKey(e); | |
}); | |
} | |
/** | |
* @param {string} r | |
* @param {number} c | |
* @return {?} | |
*/ | |
function getURL(r, c) { | |
var content = c || []; | |
var n = r.length; | |
if (n < 1) { | |
return ""; | |
} | |
/** @type {string} */ | |
var text = ""; | |
/** @type {number} */ | |
var selectedIndex = 0; | |
/** @type {number} */ | |
var i = 0; | |
for (; i <= n; i = i + 1) { | |
if (content.indexOf(selectedIndex) > -1 && " " !== text.charAt(text.length - 1)) { | |
/** @type {string} */ | |
text = text + " "; | |
} | |
var charStr = r.charAt(i); | |
if (" " !== charStr) { | |
/** @type {string} */ | |
text = text + charStr; | |
/** @type {number} */ | |
selectedIndex = selectedIndex + 1; | |
} | |
} | |
return text; | |
} | |
/** | |
* @param {!Event} self | |
* @return {undefined} | |
*/ | |
function render(self) { | |
var pos = self.target.selectionStart; | |
/** @type {number} */ | |
var maxlen = 22; | |
var src = (0, __WEBPACK_IMPORTED_MODULE_11_date_fns_end_of_month__.stripNonDigits)(self.target.value).slice(0, 19); | |
var item = result; | |
if (result = (0, _noframeworkWaypoints2.default)(src), result && result.cards.length > 0 && (maxlen = result.cards.reduce(function(positionIndexB, state) { | |
var positionIndexA = Math.max.apply(Math, makeArray(state.lengths)) + state.spaces.length; | |
return positionIndexA > positionIndexB ? positionIndexA : positionIndexB; | |
}, 0)), self.target.maxLength = maxlen, null != item && JSON.stringify(result.cards) === JSON.stringify(item.cards) || assert.publish(Runner.postMessagesFromChild.CARD_CHANGE_TYPE, { | |
card : result.cards | |
}), null != item && result.valid === item.valid && result.couldBeValid === item.couldBeValid || (assert.publish(Runner.postMessagesFromChild.VALIDATION_CHANGE, { | |
valid : result.valid, | |
couldBeValid : result.couldBeValid | |
}), input.setAttribute("aria-invalid", !result.couldBeValid)), result.valid ? (self.target.classList.remove("invalid"), self.target.classList.add("valid")) : result.couldBeValid ? (self.target.classList.remove("invalid"), self.target.classList.remove("valid")) : (self.target.classList.remove("valid"), self.target.classList.add("invalid")), ("tel" === self.target.type || "text" === self.target.type) && self.target.value.length > 0) { | |
if (result.valid || result.couldBeValid) { | |
var lat = (0, _custom2.default)(result.cards); | |
var url = getURL(src, lat); | |
if (!(" " !== url.charAt(pos) && " " !== url.charAt(pos - 1) || false !== le)) { | |
pos = pos + 1; | |
} | |
self.target.value = url; | |
} else { | |
self.target.value = src; | |
} | |
self.target.setSelectionRange(pos, pos); | |
} | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function onEmulatorDebug() { | |
input.focus(); | |
} | |
/** | |
* @param {!Object} options | |
* @param {?} callback | |
* @return {undefined} | |
*/ | |
function load(options, callback) { | |
if (!oe) { | |
/** @type {boolean} */ | |
oe = true; | |
assert.publish(Runner.postMessagesFromChild.TOKENIZE_LOAD_START); | |
var data = { | |
kid : keyId, | |
keystore : keystore, | |
encryptionType : awsSTSToken, | |
cardInfo : { | |
cardNumber : input.value | |
}, | |
production : (0, _readArchive2.default)(keyId) | |
}; | |
if (result && 1 === result.cards.length && result.cards[0].cybsCardType) { | |
data.cardInfo.cardType = result.cards[0].cybsCardType; | |
} | |
if (options.cardExpirationMonth) { | |
data.cardInfo.cardExpirationMonth = options.cardExpirationMonth; | |
} | |
if (options.cardExpirationYear) { | |
data.cardInfo.cardExpirationYear = options.cardExpirationYear; | |
} | |
if (options.cardType) { | |
data.cardInfo.cardType = options.cardType; | |
} | |
_normalizeDataUri2.default.createToken(data, function(response_2) { | |
/** @type {boolean} */ | |
oe = false; | |
callback(response_2); | |
}); | |
} | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function f() { | |
/** @type {string} */ | |
input.value = ""; | |
(0, _colorsList2.default)(input); | |
} | |
/** | |
* @param {boolean} disable | |
* @return {undefined} | |
*/ | |
function toggle(disable) { | |
var inputColl = el.querySelectorAll("input"); | |
/** @type {number} */ | |
var i = 0; | |
for (; i < inputColl.length; i = i + 1) { | |
/** @type {boolean} */ | |
inputColl[i].disabled = disable; | |
} | |
} | |
/** | |
* @param {?} session | |
* @param {?} jquery | |
* @return {undefined} | |
*/ | |
function update(session, jquery) { | |
(0, __WEBPACK_IMPORTED_MODULE_11_date_fns_end_of_month__.clearCurrentSelection)(); | |
toggle(false); | |
if (jquery) { | |
jquery(); | |
} | |
assert.publish(Runner.postMessagesFromChild.ENABLE); | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function y() { | |
(0, __WEBPACK_IMPORTED_MODULE_11_date_fns_end_of_month__.clearCurrentSelection)(); | |
toggle(true); | |
assert.publish(Runner.postMessagesFromChild.DISABLE); | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function callback() { | |
var val = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ""; | |
input.placeholder = val; | |
input.setAttribute("aria-placeholder", val); | |
} | |
/** | |
* @param {!Event} event | |
* @return {?} | |
*/ | |
function translate(event) { | |
var oInput = input; | |
var start = oInput.selectionStart; | |
var r = event.keyCode ? event.keyCode : event.which; | |
if (8 === r) { | |
if (" " === input.value.charAt(start - 2)) { | |
event.preventDefault(); | |
var text = input.value; | |
input.value = text.slice(0, start - 2) + text.slice(start); | |
/** @type {number} */ | |
start = start - 2; | |
(0, _colorsList2.default)(event.target); | |
} | |
} else { | |
if (46 === r && " " === input.value.charAt(start)) { | |
start = start + 1; | |
} | |
} | |
return start; | |
} | |
/** | |
* @param {string} name | |
* @return {?} | |
*/ | |
function create(name) { | |
/** @type {!Element} */ | |
var element = document.createElement("input"); | |
return element.className = "focus-helper " + name, element.tabIndex = 0, element.readOnly = true, element.setAttribute("autocomplete", "off"), element; | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function bindEvents() { | |
window.addEventListener("focus", function() { | |
return setTimeout(function() { | |
if (document.activeElement !== input) { | |
input.focus(); | |
} | |
}, 0); | |
}); | |
input.addEventListener("focus", function() { | |
assert.publish(Runner.postMessagesFromChild.FOCUS); | |
}); | |
input.addEventListener("blur", function(options) { | |
switch((options.relatedTarget || document.activeElement || { | |
className : "" | |
}).className) { | |
case "focus-helper start": | |
/** @type {string} */ | |
msg.TAB_DIRECTION.focusShift = "previous"; | |
break; | |
case "focus-helper end": | |
/** @type {string} */ | |
msg.TAB_DIRECTION.focusShift = "next"; | |
break; | |
default: | |
msg.TAB_DIRECTION = {}; | |
} | |
assert.publish(Runner.postMessagesFromChild.BLUR, msg.TAB_DIRECTION); | |
}); | |
input.addEventListener("keydown", function(key) { | |
if ((0, _validateUrl2.default)(key)) { | |
var t = key.which || key.keyCode || 0; | |
if (input.selectionStart !== input.selectionEnd || 8 !== t && 46 !== t) { | |
/** @type {boolean} */ | |
le = false; | |
} else { | |
input.selectionStart = translate(key); | |
input.selectionEnd = input.selectionStart; | |
/** @type {boolean} */ | |
le = true; | |
} | |
} | |
}); | |
input.addEventListener("paste", _prepareStyleProperties2.default); | |
if (globalFailure) { | |
input.addEventListener("input", render, true); | |
} | |
input.addEventListener("input", function(e) { | |
var originX = gridX; | |
if ((gridX = ("" + e.target.value).length > 0) !== originX) { | |
assert.publish(gridX ? Runner.postMessagesFromChild.NOT_EMPTY : Runner.postMessagesFromChild.EMPTY); | |
} | |
}); | |
input.addEventListener("keypress", function(event) { | |
if (13 === (event.which || event.keyCode || 0)) { | |
assert.publish(Runner.postMessagesFromChild.INPUT_SUBMIT_REQUEST); | |
} | |
}); | |
} | |
/** | |
* @param {!Object} options | |
* @return {undefined} | |
*/ | |
function init(options) { | |
keystore = options.keystore; | |
keyId = options.keyId; | |
awsSTSToken = options.encryptionType; | |
globalFailure = options.cardDetection; | |
/** @type {!Element} */ | |
input = document.createElement("input"); | |
/** @type {string} */ | |
input.type = "tel"; | |
/** @type {string} */ | |
input.name = "credit-card-number"; | |
callback(options.placeholder); | |
input.setAttribute("inputmode", "numeric"); | |
input.setAttribute("autocorrect", "off"); | |
input.setAttribute("autocapitalize", "none"); | |
/** @type {boolean} */ | |
input.spellcheck = false; | |
if (false !== options.autocomplete) { | |
input.setAttribute("autocomplete", "cc-number"); | |
input.setAttribute("autocompletetype", "cc-number"); | |
input.setAttribute("x-autocompletetype", "cc-number"); | |
} | |
input.setAttribute("maxlength", 22); | |
input.setAttribute("aria-invalid", false); | |
addPlaceHolders(input); | |
/** @type {!Element} */ | |
label = document.createElement("label"); | |
/** @type {string} */ | |
label.htmlFor = input.name; | |
/** @type {string} */ | |
label.innerText = "Credit Card Number"; | |
var t = create("start"); | |
var n = create("end"); | |
/** @type {!Element} */ | |
el = document.createElement("form"); | |
el.appendChild(t); | |
el.appendChild(label); | |
el.appendChild(input); | |
(0, _AboutPage2.default)(options.autocomplete, el, assert); | |
el.appendChild(n); | |
(0, _SearchUtility2.default)(options.styles); | |
bindEvents(); | |
document.body.appendChild(el); | |
} | |
/** | |
* @param {!Object} config | |
* @return {undefined} | |
*/ | |
function add(config) { | |
init(config); | |
assert.subscribe(Runner.postMessagesFromParent.FOCUS, onEmulatorDebug); | |
assert.subscribe(Runner.postMessagesFromParent.TOKENIZE, load); | |
assert.subscribe(Runner.postMessagesFromParent.CLEAR, f); | |
assert.subscribe(Runner.postMessagesFromParent.ENABLE, update); | |
assert.subscribe(Runner.postMessagesFromParent.DISABLE, y); | |
assert.subscribe(Runner.postMessagesFromParent.SET_PLACEHOLDER, function(actionConfig) { | |
return callback(actionConfig.text); | |
}); | |
assert.publish(Runner.postMessagesFromChild.HANDSHAKE_COMPLETE); | |
} | |
/** | |
* @param {!Object} options | |
* @return {undefined} | |
*/ | |
function emit(options) { | |
var t = { | |
targetOrigin : options.targetOrigin | |
}; | |
assert.publish(Runner.postMessagesFromChild.HANDSHAKE_INIT, t, function(embed) { | |
if ("none" === embed.encryptionType) { | |
add(embed); | |
} else { | |
(0, _browser2.default)(embed.keystore).then(function(s) { | |
if (s !== options.fingerprint) { | |
throw new Error("Invalid fingerprint"); | |
} | |
add(embed); | |
}); | |
} | |
}); | |
} | |
/** | |
* @param {string} name | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
function process(name, options) { | |
return name === options.keyId && Object.prototype.hasOwnProperty.call(options, "keyId") && Object.prototype.hasOwnProperty.call(options, "fingerprint") && Object.prototype.hasOwnProperty.call(options, "targetOrigin"); | |
} | |
var _normalizeDataUri = __webpack_require__(199); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
var _UiIcon = __webpack_require__(3); | |
var _UiIcon2 = _interopRequireDefault(_UiIcon); | |
var _classlist = __webpack_require__(6); | |
var _classlist2 = _interopRequireDefault(_classlist); | |
var _deepAssign = __webpack_require__(4); | |
var _deepAssign2 = _interopRequireDefault(_deepAssign); | |
var _readArchive = __webpack_require__(7); | |
var _readArchive2 = _interopRequireDefault(_readArchive); | |
var __WEBPACK_IMPORTED_MODULE_11_date_fns_end_of_month__ = __webpack_require__(0); | |
var Runner = __webpack_require__(1); | |
var _browser = __webpack_require__(203); | |
var _browser2 = _interopRequireDefault(_browser); | |
var _AboutPage = __webpack_require__(204); | |
var _AboutPage2 = _interopRequireDefault(_AboutPage); | |
var _validateUrl = __webpack_require__(205); | |
var _validateUrl2 = _interopRequireDefault(_validateUrl); | |
var _AppDownload = __webpack_require__(206); | |
var _AppDownload2 = _interopRequireDefault(_AppDownload); | |
var _prepareStyleProperties = __webpack_require__(207); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var _colorsList = __webpack_require__(9); | |
var _colorsList2 = _interopRequireDefault(_colorsList); | |
var _custom = __webpack_require__(208); | |
var _custom2 = _interopRequireDefault(_custom); | |
var _SearchUtility = __webpack_require__(209); | |
var _SearchUtility2 = _interopRequireDefault(_SearchUtility); | |
var _noframeworkWaypoints = __webpack_require__(211); | |
var _noframeworkWaypoints2 = _interopRequireDefault(_noframeworkWaypoints); | |
__webpack_require__(214); | |
var msg = { | |
TAB_DIRECTION : {} | |
}; | |
var keystore = void 0; | |
var keyId = void 0; | |
var awsSTSToken = void 0; | |
var globalFailure = void 0; | |
/** @type {boolean} */ | |
var oe = false; | |
var el = void 0; | |
var input = void 0; | |
var label = void 0; | |
/** @type {boolean} */ | |
var gridX = false; | |
/** @type {null} */ | |
var result = null; | |
/** @type {boolean} */ | |
var le = false; | |
var assert = void 0; | |
!function(context) { | |
var keys = (0, _AppDownload2.default)("keyId"); | |
if (keys) { | |
var options = { | |
keyId : keys, | |
clientVersion : _UiIcon2.default | |
}; | |
/** @type {!XMLHttpRequest} */ | |
var http = new XMLHttpRequest; | |
http.open("POST", "/cybersource/microform/v1/init", true); | |
http.setRequestHeader("Content-Type", "application/json"); | |
/** | |
* @return {undefined} | |
*/ | |
http.onreadystatechange = function() { | |
if (4 === http.readyState && 200 === http.status) { | |
/** @type {*} */ | |
var data = JSON.parse(http.responseText); | |
if (!process(options.keyId, data)) { | |
throw new _deepAssign2.default({ | |
message : "Could not initialize FLEX Microform", | |
details : data | |
}); | |
} | |
assert = (0, _classlist2.default)(context.parent, data.targetOrigin, data.targetOrigin); | |
emit(data); | |
} | |
}; | |
http.send(JSON.stringify(options)); | |
} | |
}(window); | |
}, | |
199 : function(module, exports, __webpack_require__) { | |
(function(canCreateDiscussions, obtainGETData) { | |
!function(addedRenderer, factory) { | |
module.exports = factory(); | |
}(0, function() { | |
/** | |
* @return {?} | |
*/ | |
function createXhr() { | |
return "undefined" != typeof XMLHttpRequest && "withCredentials" in new XMLHttpRequest; | |
} | |
/** | |
* @return {?} | |
*/ | |
function createElement() { | |
return "undefined" != typeof XDomainRequest; | |
} | |
/** | |
* @return {?} | |
*/ | |
function isBrowserSupported() { | |
return createXhr() || createElement(); | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function isFunction(value) { | |
var argType = void 0 === value ? "undefined" : baseIsEqual(value); | |
return null != value && ("object" === argType || "function" === argType); | |
} | |
/** | |
* @param {string} val | |
* @return {?} | |
*/ | |
function C(val) { | |
/** @type {string} */ | |
var t = isFunction(val) ? Object.prototype.toString.call(val) : ""; | |
return "[object Function]" === t || "[object GeneratorFunction]" === t; | |
} | |
/** | |
* @param {?} ast | |
* @return {?} | |
*/ | |
function match(ast) { | |
return JSON.parse(JSON.stringify(ast)); | |
} | |
/** | |
* @param {string} text | |
* @return {?} | |
*/ | |
function createBuffer(text) { | |
/** @type {!ArrayBuffer} */ | |
var buf = new ArrayBuffer(text.length); | |
/** @type {!Uint8Array} */ | |
var bView = new Uint8Array(buf); | |
/** @type {number} */ | |
var i = 0; | |
var l = text.length; | |
for (; i < l; i = i + 1) { | |
bView[i] = text.charCodeAt(i); | |
} | |
return buf; | |
} | |
/** | |
* @return {?} | |
*/ | |
function polycrypt() { | |
return window.crypto && window.crypto.subtle && "function" == typeof window.crypto.subtle.importKey && "function" == typeof window.crypto.subtle.encrypt; | |
} | |
/** | |
* @param {?} n | |
* @param {?} fn | |
* @return {?} | |
*/ | |
function parse(n, fn) { | |
var result = match(n); | |
return /Edge/.test(window.navigator.userAgent) && delete result.use, window.crypto.subtle.importKey("jwk", result, fn, false, ["encrypt"]); | |
} | |
/** | |
* @param {!Function} iv | |
* @param {?} ciphertext | |
* @param {!Function} key | |
* @return {?} | |
*/ | |
function decrypt(iv, ciphertext, key) { | |
return window.crypto.subtle.encrypt(iv, ciphertext, createBuffer(key)).then(encode); | |
} | |
/** | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function set(value) { | |
var config = void 0; | |
switch((value.encryptionType || "").toLowerCase()) { | |
case "none": | |
config = createStandardConfig(); | |
break; | |
case "rsaoaep": | |
config = copy(value); | |
break; | |
case "rsaoaep256": | |
config = encrypt(value); | |
break; | |
default: | |
throw new Error('Unsupported encryption type "' + value.encryptionType + '"'); | |
} | |
return { | |
encrypt : function(password) { | |
return config.encrypt(password); | |
} | |
}; | |
} | |
/** | |
* @param {string} t | |
* @return {?} | |
*/ | |
function error(t) { | |
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 200; | |
var m = void 0; | |
try { | |
/** @type {*} */ | |
m = JSON.parse(t); | |
} catch (c) { | |
/** @type {string} */ | |
m = t; | |
} | |
return t >= 200 && t < 400 && null != m.token ? m : { | |
error : m | |
}; | |
} | |
/** | |
* @param {string} listId | |
* @param {!Object} cardData | |
* @return {?} | |
*/ | |
function create(listId, cardData) { | |
var $scope = { | |
keyId : listId, | |
cardInfo : { | |
cardNumber : cardData.cardNumber, | |
cardType : cardData.cardType | |
} | |
}; | |
return cardData.cardExpirationMonth && ($scope.cardInfo.cardExpirationMonth = cardData.cardExpirationMonth), cardData.cardExpirationYear && ($scope.cardInfo.cardExpirationYear = cardData.cardExpirationYear), $scope; | |
} | |
/** | |
* @param {string} target | |
* @param {?} data | |
* @param {string} callback | |
* @return {undefined} | |
*/ | |
function send(target, data, callback) { | |
/** @type {!XMLHttpRequest} */ | |
var xhr = new XMLHttpRequest; | |
xhr.open("POST", target, true); | |
xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8"); | |
/** @type {number} */ | |
xhr.timeout = XHRTME; | |
/** | |
* @return {?} | |
*/ | |
xhr.ontimeout = function() { | |
return callback(error("Request has timed out")); | |
}; | |
/** | |
* @return {?} | |
*/ | |
xhr.onerror = function() { | |
return callback(error(xhr.responseText, xhr.status)); | |
}; | |
/** | |
* @return {?} | |
*/ | |
xhr.onload = function() { | |
return callback(error(xhr.responseText, xhr.status)); | |
}; | |
xhr.send(JSON.stringify(data)); | |
} | |
/** | |
* @param {string} url | |
* @param {?} params | |
* @param {string} cb | |
* @return {undefined} | |
*/ | |
function request(url, params, cb) { | |
/** @type {!XDomainRequest} */ | |
var xhr = new XDomainRequest; | |
/** @type {number} */ | |
xhr.timeout = XHRTME; | |
/** | |
* @return {undefined} | |
*/ | |
xhr.onprogress = function() { | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
xhr.ontimeout = function() { | |
cb(error("Request has timed out")); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
xhr.onerror = function() { | |
cb(error("Detailed error response unavailable in this browser")); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
xhr.onload = function() { | |
var e = void 0; | |
try { | |
/** @type {*} */ | |
e = JSON.parse(xhr.responseText); | |
} catch (t) { | |
e = { | |
error : xhr.responseText | |
}; | |
} | |
cb(error(e)); | |
}; | |
xhr.open("POST", url); | |
xhr.send(JSON.stringify(params)); | |
} | |
/** | |
* @param {string} obj | |
* @param {string} action | |
* @param {!Object} data | |
* @param {string} cb | |
* @return {undefined} | |
*/ | |
function get(obj, action, data, cb) { | |
var url = create(action, data); | |
if (createXhr()) { | |
send(obj, url, cb); | |
} else { | |
if (!createElement()) { | |
throw new Error("Browser does not support CORS requests."); | |
} | |
request(obj, url, cb); | |
} | |
} | |
/** | |
* @param {!Object} key | |
* @param {string} c | |
* @return {?} | |
*/ | |
function f(key, c) { | |
if (!C(c)) { | |
throw new Error("responseHandler is not a function"); | |
} | |
/** @type {string} */ | |
var opDef = true === key.production ? opts.prod : opts.test; | |
var data = key.cardInfo || {}; | |
if (data.cardNumber = data.cardNumber ? data.cardNumber.replace(/\D/g, "") : "", data.cardNumber.length < 1) { | |
return delete data.cardNumber, void get(opDef, key.kid, data, c); | |
} | |
set(key).encrypt(data.cardNumber).then(function(openReg) { | |
/** @type {!Object} */ | |
data.cardNumber = openReg; | |
get(opDef, key.kid, data, c); | |
}).catch(function(canCreateDiscussions) { | |
throw canCreateDiscussions; | |
}); | |
} | |
var opts = { | |
test : "https://testflex.cybersource.com/cybersource/flex/v1/tokens", | |
prod : "https://flex.cybersource.com/cybersource/flex/v1/tokens" | |
}; | |
var win = "undefined" != typeof window ? window : void 0 !== canCreateDiscussions ? canCreateDiscussions : "undefined" != typeof self ? self : {}; | |
/** @type {function(!Object): ?} */ | |
var baseIsEqual = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(lineStringProperty) { | |
return typeof lineStringProperty; | |
} : function(obj) { | |
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | |
}; | |
!function(canCreateDiscussions, module) { | |
module = { | |
exports : {} | |
}; | |
(function(module) { | |
!function(name, exports, canCreateDiscussions) { | |
exports[name] = exports[name] || function() { | |
/** | |
* @param {!Function} key | |
* @param {(!Function|RegExp|string)} cb | |
* @return {undefined} | |
*/ | |
function error(key, cb) { | |
q.add(key, cb); | |
if (!all) { | |
all = timer(q.drain); | |
} | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function isThenable(value) { | |
var then; | |
var e = void 0 === value ? "undefined" : baseIsEqual(value); | |
return null == value || "object" != e && "function" != e || (then = value.then), "function" == typeof then && then; | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function notify() { | |
/** @type {number} */ | |
var i = 0; | |
for (; i < this.chain.length; i++) { | |
notifyIsolated(this, 1 === this.state ? this.chain[i].success : this.chain[i].failure, this.chain[i]); | |
} | |
/** @type {number} */ | |
this.chain.length = 0; | |
} | |
/** | |
* @param {!Object} self | |
* @param {?} cb | |
* @param {!Object} chain | |
* @return {undefined} | |
*/ | |
function notifyIsolated(self, cb, chain) { | |
var ret; | |
var _then; | |
try { | |
if (false === cb) { | |
chain.reject(self.msg); | |
} else { | |
ret = true === cb ? self.msg : cb.call(void 0, self.msg); | |
if (ret === chain.promise) { | |
chain.reject(TypeError("Promise-chain cycle")); | |
} else { | |
if (_then = isThenable(ret)) { | |
_then.call(ret, chain.resolve, chain.reject); | |
} else { | |
chain.resolve(ret); | |
} | |
} | |
} | |
} catch (graphic) { | |
chain.reject(graphic); | |
} | |
} | |
/** | |
* @param {string} msg | |
* @return {undefined} | |
*/ | |
function resolve(msg) { | |
var _then; | |
var self = this; | |
if (!self.triggered) { | |
/** @type {boolean} */ | |
self.triggered = true; | |
if (self.def) { | |
self = self.def; | |
} | |
try { | |
if (_then = isThenable(msg)) { | |
error(function() { | |
var def_wrapper = new MakeDefWrapper(self); | |
try { | |
_then.call(msg, function() { | |
resolve.apply(def_wrapper, arguments); | |
}, function() { | |
r.apply(def_wrapper, arguments); | |
}); | |
} catch (data) { | |
r.call(def_wrapper, data); | |
} | |
}); | |
} else { | |
/** @type {string} */ | |
self.msg = msg; | |
/** @type {number} */ | |
self.state = 1; | |
if (self.chain.length > 0) { | |
error(notify, self); | |
} | |
} | |
} catch (data) { | |
r.call(new MakeDefWrapper(self), data); | |
} | |
} | |
} | |
/** | |
* @param {string} val | |
* @return {undefined} | |
*/ | |
function r(val) { | |
var obj = this; | |
if (!obj.triggered) { | |
/** @type {boolean} */ | |
obj.triggered = true; | |
if (obj.def) { | |
obj = obj.def; | |
} | |
/** @type {string} */ | |
obj.msg = val; | |
/** @type {number} */ | |
obj.state = 2; | |
if (obj.chain.length > 0) { | |
error(notify, obj); | |
} | |
} | |
} | |
/** | |
* @param {?} c | |
* @param {!NodeList} t | |
* @param {!Function} n | |
* @param {boolean} fn | |
* @return {undefined} | |
*/ | |
function f(c, t, n, fn) { | |
/** @type {number} */ | |
var k = 0; | |
for (; k < t.length; k++) { | |
!function(i) { | |
c.resolve(t[i]).then(function(status) { | |
n(i, status); | |
}, fn); | |
}(k); | |
} | |
} | |
/** | |
* @param {!Object} self | |
* @return {undefined} | |
*/ | |
function MakeDefWrapper(self) { | |
/** @type {!Object} */ | |
this.def = self; | |
/** @type {boolean} */ | |
this.triggered = false; | |
} | |
/** | |
* @param {!Function} self | |
* @return {undefined} | |
*/ | |
function MakeDef(self) { | |
/** @type {!Function} */ | |
this.promise = self; | |
/** @type {number} */ | |
this.state = 0; | |
/** @type {boolean} */ | |
this.triggered = false; | |
/** @type {!Array} */ | |
this.chain = []; | |
this.msg = void 0; | |
} | |
/** | |
* @param {!Function} fn | |
* @return {undefined} | |
*/ | |
function Promise(fn) { | |
if ("function" != typeof fn) { | |
throw TypeError("Not a function"); | |
} | |
if (0 !== this.__NPO__) { | |
throw TypeError("Not a promise"); | |
} | |
/** @type {number} */ | |
this.__NPO__ = 1; | |
var t = new MakeDef(this); | |
/** | |
* @param {string} method | |
* @param {boolean} callback | |
* @return {?} | |
*/ | |
this.then = function(method, callback) { | |
var o = { | |
success : "function" != typeof method || method, | |
failure : "function" == typeof callback && callback | |
}; | |
return o.promise = new this.constructor(function(t, b) { | |
if ("function" != typeof t || "function" != typeof b) { | |
throw TypeError("Not a function"); | |
} | |
/** @type {!Function} */ | |
o.resolve = t; | |
/** @type {!Function} */ | |
o.reject = b; | |
}), t.chain.push(o), 0 !== t.state && error(notify, t), o.promise; | |
}; | |
/** | |
* @param {!Array} handler | |
* @return {?} | |
*/ | |
this.catch = function(handler) { | |
return this.then(void 0, handler); | |
}; | |
try { | |
fn.call(void 0, function(name) { | |
resolve.call(t, name); | |
}, function(data) { | |
r.call(t, data); | |
}); | |
} catch (data) { | |
r.call(t, data); | |
} | |
} | |
var builtInProp; | |
var all; | |
var q; | |
/** @type {function(this:*): string} */ | |
var type = Object.prototype.toString; | |
/** @type {!Function} */ | |
var timer = void 0 !== obtainGETData ? function(val) { | |
return obtainGETData(val); | |
} : setTimeout; | |
try { | |
Object.defineProperty({}, "x", {}); | |
/** | |
* @param {!Function} obj | |
* @param {string} name | |
* @param {!Object} val | |
* @param {boolean} config | |
* @return {?} | |
*/ | |
builtInProp = function(obj, name, val, config) { | |
return Object.defineProperty(obj, name, { | |
value : val, | |
writable : true, | |
configurable : false !== config | |
}); | |
}; | |
} catch (e) { | |
/** | |
* @param {!Function} obj | |
* @param {string} name | |
* @param {!Function} val | |
* @return {?} | |
*/ | |
builtInProp = function(obj, name, val) { | |
return obj[name] = val, obj; | |
}; | |
} | |
q = function() { | |
/** | |
* @param {!Function} options | |
* @param {!Element} callback | |
* @return {undefined} | |
*/ | |
function Map(options, callback) { | |
/** @type {!Function} */ | |
this.fn = options; | |
/** @type {!Element} */ | |
this.self = callback; | |
this.next = void 0; | |
} | |
var container; | |
var div; | |
var node; | |
return { | |
add : function(value, options) { | |
node = new Map(value, options); | |
if (div) { | |
div.next = node; | |
} else { | |
container = node; | |
} | |
div = node; | |
node = void 0; | |
}, | |
drain : function() { | |
var node = container; | |
container = div = all = void 0; | |
for (; node;) { | |
node.fn.call(node.self); | |
node = node.next; | |
} | |
} | |
}; | |
}(); | |
var PromisePrototype = builtInProp({}, "constructor", Promise, false); | |
return Promise.prototype = PromisePrototype, builtInProp(PromisePrototype, "__NPO__", 0, false), builtInProp(Promise, "resolve", function(value) { | |
var t = this; | |
return value && "object" == (void 0 === value ? "undefined" : baseIsEqual(value)) && 1 === value.__NPO__ ? value : new t(function(listener, callback) { | |
if ("function" != typeof listener || "function" != typeof callback) { | |
throw TypeError("Not a function"); | |
} | |
listener(value); | |
}); | |
}), builtInProp(Promise, "reject", function(responce) { | |
return new this(function(callback, fn) { | |
if ("function" != typeof callback || "function" != typeof fn) { | |
throw TypeError("Not a function"); | |
} | |
fn(responce); | |
}); | |
}), builtInProp(Promise, "all", function(c) { | |
var n = this; | |
return "[object Array]" != type.call(c) ? n.reject(TypeError("Not an array")) : 0 === c.length ? n.resolve([]) : new n(function(listener, e) { | |
if ("function" != typeof listener || "function" != typeof e) { | |
throw TypeError("Not a function"); | |
} | |
var len = c.length; | |
/** @type {!Array} */ | |
var args = Array(len); | |
/** @type {number} */ | |
var i = 0; | |
f(n, c, function(callbackArgumentIndex, withoutSuffix) { | |
args[callbackArgumentIndex] = withoutSuffix; | |
if (++i === len) { | |
listener(args); | |
} | |
}, e); | |
}); | |
}), builtInProp(Promise, "race", function(proto) { | |
var n = this; | |
return "[object Array]" != type.call(proto) ? n.reject(TypeError("Not an array")) : new n(function(callback, e) { | |
if ("function" != typeof callback || "function" != typeof e) { | |
throw TypeError("Not a function"); | |
} | |
f(n, proto, function(canCreateDiscussions, identifierPositions) { | |
callback(identifierPositions); | |
}, e); | |
}); | |
}), Promise; | |
}(); | |
if (module.exports) { | |
module.exports = exports[name]; | |
} | |
}("Promise", win); | |
})(module, module.exports); | |
module.exports; | |
}(); | |
(function(window) { | |
/** | |
* @param {?} data | |
* @return {?} | |
*/ | |
function escape(data) { | |
return btoa(data).replace(/=+$/, "").replace(/\+/g, "-").replace(/\//g, "_"); | |
} | |
/** | |
* @param {string} s | |
* @return {?} | |
*/ | |
function callback(s) { | |
return s = s + "===", s = s.slice(0, -s.length % 4), atob(s.replace(/-/g, "+").replace(/_/g, "/")); | |
} | |
/** | |
* @param {string} str | |
* @return {?} | |
*/ | |
function $(str) { | |
/** @type {!Uint8Array} */ | |
var destination = new Uint8Array(str.length); | |
/** @type {number} */ | |
var i = 0; | |
for (; i < str.length; i++) { | |
destination[i] = str.charCodeAt(i); | |
} | |
return destination; | |
} | |
/** | |
* @param {!Object} bytes | |
* @return {?} | |
*/ | |
function decode(bytes) { | |
return bytes instanceof ArrayBuffer && (bytes = new Uint8Array(bytes)), String.fromCharCode.apply(String, bytes); | |
} | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function generate(obj) { | |
var self = { | |
name : (obj.name || obj || "").toUpperCase().replace("V", "v") | |
}; | |
switch(self.name) { | |
case "SHA-1": | |
case "SHA-256": | |
case "SHA-384": | |
case "SHA-512": | |
break; | |
case "AES-CBC": | |
case "AES-GCM": | |
case "AES-KW": | |
if (obj.length) { | |
self.length = obj.length; | |
} | |
break; | |
case "HMAC": | |
if (obj.hash) { | |
self.hash = generate(obj.hash); | |
} | |
if (obj.length) { | |
self.length = obj.length; | |
} | |
break; | |
case "RSAES-PKCS1-v1_5": | |
if (obj.publicExponent) { | |
/** @type {!Uint8Array} */ | |
self.publicExponent = new Uint8Array(obj.publicExponent); | |
} | |
if (obj.modulusLength) { | |
self.modulusLength = obj.modulusLength; | |
} | |
break; | |
case "RSASSA-PKCS1-v1_5": | |
case "RSA-OAEP": | |
if (obj.hash) { | |
self.hash = generate(obj.hash); | |
} | |
if (obj.publicExponent) { | |
/** @type {!Uint8Array} */ | |
self.publicExponent = new Uint8Array(obj.publicExponent); | |
} | |
if (obj.modulusLength) { | |
self.modulusLength = obj.modulusLength; | |
} | |
break; | |
default: | |
throw new SyntaxError("Bad algorithm name"); | |
} | |
return self; | |
} | |
/** | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
function getKeyUsageByAlg(options) { | |
return { | |
HMAC : { | |
"SHA-1" : "HS1", | |
"SHA-256" : "HS256", | |
"SHA-384" : "HS384", | |
"SHA-512" : "HS512" | |
}, | |
"RSASSA-PKCS1-v1_5" : { | |
"SHA-1" : "RS1", | |
"SHA-256" : "RS256", | |
"SHA-384" : "RS384", | |
"SHA-512" : "RS512" | |
}, | |
"RSAES-PKCS1-v1_5" : { | |
"" : "RSA1_5" | |
}, | |
"RSA-OAEP" : { | |
"SHA-1" : "RSA-OAEP", | |
"SHA-256" : "RSA-OAEP-256" | |
}, | |
"AES-KW" : { | |
128 : "A128KW", | |
192 : "A192KW", | |
256 : "A256KW" | |
}, | |
"AES-GCM" : { | |
128 : "A128GCM", | |
192 : "A192GCM", | |
256 : "A256GCM" | |
}, | |
"AES-CBC" : { | |
128 : "A128CBC", | |
192 : "A192CBC", | |
256 : "A256CBC" | |
} | |
}[options.name][(options.hash || {}).name || options.length || ""]; | |
} | |
/** | |
* @param {!Object} data | |
* @return {?} | |
*/ | |
function parse(data) { | |
if (data instanceof ArrayBuffer || data instanceof Uint8Array) { | |
/** @type {*} */ | |
data = JSON.parse(decodeURIComponent(escape(decode(data)))); | |
} | |
var r = { | |
kty : data.kty, | |
alg : data.alg, | |
ext : data.ext || data.extractable | |
}; | |
switch(r.kty) { | |
case "oct": | |
r.k = data.k; | |
case "RSA": | |
["n", "e", "d", "p", "q", "dp", "dq", "qi", "oth"].forEach(function(k) { | |
if (k in data) { | |
r[k] = data[k]; | |
} | |
}); | |
break; | |
default: | |
throw new TypeError("Unsupported key type"); | |
} | |
return r; | |
} | |
/** | |
* @param {!Object} type | |
* @return {?} | |
*/ | |
function parseValue(type) { | |
var data = parse(type); | |
return className && (data.extractable = data.ext, delete data.ext), $(unescape(encodeURIComponent(JSON.stringify(data)))).buffer; | |
} | |
/** | |
* @param {!Object} index | |
* @return {?} | |
*/ | |
function render(index) { | |
var obj = transform(index); | |
/** @type {boolean} */ | |
var r = false; | |
if (obj.length > 2) { | |
/** @type {boolean} */ | |
r = true; | |
obj.shift(); | |
} | |
var jwk = { | |
ext : true | |
}; | |
switch(obj[0][0]) { | |
case "1.2.840.113549.1.1.1": | |
/** @type {!Array} */ | |
var rsaComp = ["n", "e", "d", "p", "q", "dp", "dq", "qi"]; | |
var result = transform(obj[1]); | |
if (r) { | |
result.shift(); | |
} | |
/** @type {number} */ | |
var i = 0; | |
for (; i < result.length; i++) { | |
if (!result[i][0]) { | |
result[i] = result[i].subarray(1); | |
} | |
jwk[rsaComp[i]] = escape(decode(result[i])); | |
} | |
/** @type {string} */ | |
jwk.kty = "RSA"; | |
break; | |
default: | |
throw new TypeError("Unsupported key type"); | |
} | |
return jwk; | |
} | |
/** | |
* @param {?} k | |
* @return {?} | |
*/ | |
function check(k) { | |
var key; | |
/** @type {!Array} */ | |
var info = [["", null]]; | |
/** @type {boolean} */ | |
var i = false; | |
switch(k.kty) { | |
case "RSA": | |
/** @type {!Array} */ | |
var rsaComp = ["n", "e", "d", "p", "q", "dp", "dq", "qi"]; | |
/** @type {!Array} */ | |
var rsaKey = []; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < rsaComp.length && rsaComp[i] in k; i++) { | |
var blimbs = rsaKey[i] = $(callback(k[rsaComp[i]])); | |
if (128 & blimbs[0]) { | |
/** @type {!Uint8Array} */ | |
rsaKey[i] = new Uint8Array(blimbs.length + 1); | |
rsaKey[i].set(blimbs, 1); | |
} | |
} | |
if (rsaKey.length > 2) { | |
/** @type {boolean} */ | |
i = true; | |
rsaKey.unshift(new Uint8Array([0])); | |
} | |
/** @type {string} */ | |
info[0][0] = "1.2.840.113549.1.1.1"; | |
/** @type {!Array} */ | |
key = rsaKey; | |
break; | |
default: | |
throw new TypeError("Unsupported key type"); | |
} | |
return info.push((new Uint8Array(flatten(key))).buffer), i ? info.unshift(new Uint8Array([0])) : info[1] = { | |
tag : 3, | |
value : info[1] | |
}, (new Uint8Array(flatten(info))).buffer; | |
} | |
/** | |
* @param {!Object} buf | |
* @param {!Object} ctx | |
* @return {?} | |
*/ | |
function transform(buf, ctx) { | |
if (buf instanceof ArrayBuffer && (buf = new Uint8Array(buf)), ctx || (ctx = { | |
pos : 0, | |
end : buf.length | |
}), ctx.end - ctx.pos < 2 || ctx.end > buf.length) { | |
throw new RangeError("Malformed DER"); | |
} | |
var one = buf[ctx.pos++]; | |
var len = buf[ctx.pos++]; | |
if (len >= 128) { | |
if (len = len & 127, ctx.end - ctx.pos < len) { | |
throw new RangeError("Malformed DER"); | |
} | |
/** @type {number} */ | |
var xlen = 0; | |
for (; len--;) { | |
/** @type {number} */ | |
xlen = xlen << 8; | |
/** @type {number} */ | |
xlen = xlen | buf[ctx.pos++]; | |
} | |
/** @type {number} */ | |
len = xlen; | |
} | |
if (ctx.end - ctx.pos < len) { | |
throw new RangeError("Malformed DER"); | |
} | |
var res; | |
switch(one) { | |
case 2: | |
res = buf.subarray(ctx.pos, ctx.pos += len); | |
break; | |
case 3: | |
if (buf[ctx.pos++]) { | |
throw new Error("Unsupported bit string"); | |
} | |
len--; | |
case 4: | |
/** @type {!ArrayBuffer} */ | |
res = (new Uint8Array(buf.subarray(ctx.pos, ctx.pos += len))).buffer; | |
break; | |
case 5: | |
/** @type {null} */ | |
res = null; | |
break; | |
case 6: | |
/** @type {string} */ | |
var id = btoa(decode(buf.subarray(ctx.pos, ctx.pos += len))); | |
if (!(id in field)) { | |
throw new Error("Unsupported OBJECT ID " + id); | |
} | |
res = field[id]; | |
break; | |
case 48: | |
/** @type {!Array} */ | |
res = []; | |
var end = ctx.pos + len; | |
for (; ctx.pos < end;) { | |
res.push(transform(buf, ctx)); | |
} | |
break; | |
default: | |
throw new Error("Unsupported DER tag 0x" + one.toString(16)); | |
} | |
return res; | |
} | |
/** | |
* @param {!Object} value | |
* @param {!Array} result | |
* @return {?} | |
*/ | |
function flatten(value, result) { | |
if (!result) { | |
/** @type {!Array} */ | |
result = []; | |
} | |
/** @type {number} */ | |
var isNeg = 0; | |
/** @type {number} */ | |
var len = 0; | |
var i = result.length + 2; | |
if (result.push(0, 0), value instanceof Uint8Array) { | |
/** @type {number} */ | |
isNeg = 2; | |
len = value.length; | |
/** @type {number} */ | |
var index = 0; | |
for (; index < len; index++) { | |
result.push(value[index]); | |
} | |
} else { | |
if (value instanceof ArrayBuffer) { | |
/** @type {number} */ | |
isNeg = 4; | |
/** @type {number} */ | |
len = value.byteLength; | |
/** @type {!Uint8Array} */ | |
value = new Uint8Array(value); | |
/** @type {number} */ | |
index = 0; | |
for (; index < len; index++) { | |
result.push(value[index]); | |
} | |
} else { | |
if (null === value) { | |
/** @type {number} */ | |
isNeg = 5; | |
/** @type {number} */ | |
len = 0; | |
} else { | |
if ("string" == typeof value && value in data) { | |
var array = $(atob(data[value])); | |
/** @type {number} */ | |
isNeg = 6; | |
len = array.length; | |
/** @type {number} */ | |
index = 0; | |
for (; index < len; index++) { | |
result.push(array[index]); | |
} | |
} else { | |
if (value instanceof Array) { | |
/** @type {number} */ | |
index = 0; | |
for (; index < value.length; index++) { | |
flatten(value[index], result); | |
} | |
/** @type {number} */ | |
isNeg = 48; | |
/** @type {number} */ | |
len = result.length - i; | |
} else { | |
if (!("object" === (void 0 === value ? "undefined" : baseIsEqual(value)) && 3 === value.tag && value.value instanceof ArrayBuffer)) { | |
throw new Error("Unsupported DER value " + value); | |
} | |
/** @type {!Uint8Array} */ | |
value = new Uint8Array(value.value); | |
/** @type {number} */ | |
isNeg = 3; | |
/** @type {number} */ | |
len = value.byteLength; | |
result.push(0); | |
/** @type {number} */ | |
index = 0; | |
for (; index < len; index++) { | |
result.push(value[index]); | |
} | |
len++; | |
} | |
} | |
} | |
} | |
} | |
if (len >= 128) { | |
var xlen = len; | |
/** @type {number} */ | |
len = 4; | |
result.splice(i, 0, xlen >> 24 & 255, xlen >> 16 & 255, xlen >> 8 & 255, 255 & xlen); | |
for (; len > 1 && !(xlen >> 24);) { | |
/** @type {number} */ | |
xlen = xlen << 8; | |
len--; | |
} | |
if (len < 4) { | |
result.splice(i, 4 - len); | |
} | |
/** @type {number} */ | |
len = len | 128; | |
} | |
return result.splice(i - 2, 2, isNeg, len), result; | |
} | |
/** | |
* @param {!Object} args | |
* @param {number} string | |
* @param {number} data | |
* @param {string} value | |
* @return {undefined} | |
*/ | |
function Text(args, string, data, value) { | |
Object.defineProperties(this, { | |
_key : { | |
value : args | |
}, | |
type : { | |
value : args.type, | |
enumerable : true | |
}, | |
extractable : { | |
value : void 0 === data ? args.extractable : data, | |
enumerable : true | |
}, | |
algorithm : { | |
value : void 0 === string ? args.algorithm : string, | |
enumerable : true | |
}, | |
usages : { | |
value : void 0 === value ? args.usages : value, | |
enumerable : true | |
} | |
}); | |
} | |
/** | |
* @param {string} data | |
* @return {?} | |
*/ | |
function doImport(data) { | |
return "verify" === data || "encrypt" === data || "wrapKey" === data; | |
} | |
/** | |
* @param {string} c | |
* @return {?} | |
*/ | |
function config(c) { | |
return "sign" === c || "decrypt" === c || "unwrapKey" === c; | |
} | |
if ("function" != typeof Promise) { | |
throw "Promise support required"; | |
} | |
var options = window.crypto || window.msCrypto; | |
if (options) { | |
var that = options.subtle || options.webkitSubtle; | |
if (that) { | |
var Crypto = window.Crypto || options.constructor || Object; | |
var parent = window.SubtleCrypto || that.constructor || Object; | |
/** @type {boolean} */ | |
var w = (window.CryptoKey || window.Key || Object, window.navigator.userAgent.indexOf("Edge/") > -1); | |
/** @type {boolean} */ | |
var className = !!window.msCrypto && !w; | |
/** @type {boolean} */ | |
var mod = !options.subtle && !!options.webkitSubtle; | |
if (className || mod) { | |
var field = { | |
KoZIhvcNAQEB : "1.2.840.113549.1.1.1" | |
}; | |
var data = { | |
"1.2.840.113549.1.1.1" : "KoZIhvcNAQEB" | |
}; | |
if (["generateKey", "importKey", "unwrapKey"].forEach(function(name) { | |
var fn = that[name]; | |
/** | |
* @param {!Object} value | |
* @param {!Object} key | |
* @param {!Object} data | |
* @return {?} | |
*/ | |
that[name] = function(value, key, data) { | |
var result; | |
var callback; | |
var text; | |
/** @type {!Array<?>} */ | |
var params = [].slice.call(arguments); | |
switch(name) { | |
case "generateKey": | |
result = generate(value); | |
/** @type {!Object} */ | |
callback = key; | |
/** @type {!Object} */ | |
text = data; | |
break; | |
case "importKey": | |
result = generate(data); | |
callback = params[3]; | |
text = params[4]; | |
if ("jwk" === value) { | |
key = parse(key); | |
if (!key.alg) { | |
key.alg = getKeyUsageByAlg(result); | |
} | |
if (!key.key_ops) { | |
key.key_ops = "oct" !== key.kty ? "d" in key ? text.filter(config) : text.filter(doImport) : text.slice(); | |
} | |
params[1] = parseValue(key); | |
} | |
break; | |
case "unwrapKey": | |
result = params[4]; | |
callback = params[5]; | |
text = params[6]; | |
params[2] = data._key; | |
} | |
if ("generateKey" === name && "HMAC" === result.name && result.hash) { | |
return result.length = result.length || { | |
"SHA-1" : 512, | |
"SHA-256" : 512, | |
"SHA-384" : 1024, | |
"SHA-512" : 1024 | |
}[result.hash.name], that.importKey("raw", options.getRandomValues(new Uint8Array(result.length + 7 >> 3)), result, callback, text); | |
} | |
if (mod && "generateKey" === name && "RSASSA-PKCS1-v1_5" === result.name && (!result.modulusLength || result.modulusLength >= 2048)) { | |
return value = generate(value), value.name = "RSAES-PKCS1-v1_5", delete value.hash, that.generateKey(value, true, ["encrypt", "decrypt"]).then(function(key) { | |
return Promise.all([that.exportKey("jwk", key.publicKey), that.exportKey("jwk", key.privateKey)]); | |
}).then(function(dateMarkers) { | |
return dateMarkers[0].alg = dateMarkers[1].alg = getKeyUsageByAlg(result), dateMarkers[0].key_ops = text.filter(doImport), dateMarkers[1].key_ops = text.filter(config), Promise.all([that.importKey("jwk", dateMarkers[0], result, true, dateMarkers[0].key_ops), that.importKey("jwk", dateMarkers[1], result, callback, dateMarkers[1].key_ops)]); | |
}).then(function(exportedKeys) { | |
return { | |
publicKey : exportedKeys[0], | |
privateKey : exportedKeys[1] | |
}; | |
}); | |
} | |
if ((mod || className && "SHA-1" === (result.hash || {}).name) && "importKey" === name && "jwk" === value && "HMAC" === result.name && "oct" === key.kty) { | |
return that.importKey("raw", $(callback(key.k)), data, params[3], params[4]); | |
} | |
if (mod && "importKey" === name && ("spki" === value || "pkcs8" === value)) { | |
return that.importKey("jwk", render(key), data, params[3], params[4]); | |
} | |
if (className && "unwrapKey" === name) { | |
return that.decrypt(params[3], data, key).then(function(key) { | |
return that.importKey(value, key, params[4], params[5], params[6]); | |
}); | |
} | |
var req; | |
try { | |
req = fn.apply(that, params); | |
} catch (unknownError) { | |
return Promise.reject(unknownError); | |
} | |
return className && (req = new Promise(function(onSuccess, callback) { | |
/** @type {function(?): undefined} */ | |
req.onabort = req.onerror = function(theError) { | |
callback(theError); | |
}; | |
/** | |
* @param {!Event} event | |
* @return {undefined} | |
*/ | |
req.oncomplete = function(event) { | |
onSuccess(event.target.result); | |
}; | |
})), req = req.then(function(data) { | |
return "HMAC" === result.name && (result.length || (result.length = 8 * data.algorithm.length)), 0 == result.name.search("RSA") && (result.modulusLength || (result.modulusLength = (data.publicKey || data).algorithm.modulusLength), result.publicExponent || (result.publicExponent = (data.publicKey || data).algorithm.publicExponent)), data = data.publicKey && data.privateKey ? { | |
publicKey : new Text(data.publicKey, result, callback, text.filter(doImport)), | |
privateKey : new Text(data.privateKey, result, callback, text.filter(config)) | |
} : new Text(data, result, callback, text); | |
}); | |
}; | |
}), ["exportKey", "wrapKey"].forEach(function(name) { | |
var fn = that[name]; | |
/** | |
* @param {string} format | |
* @param {!Object} result | |
* @param {?} value | |
* @return {?} | |
*/ | |
that[name] = function(format, result, value) { | |
/** @type {!Array<?>} */ | |
var data = [].slice.call(arguments); | |
switch(name) { | |
case "exportKey": | |
data[1] = result._key; | |
break; | |
case "wrapKey": | |
data[1] = result._key; | |
data[2] = value._key; | |
} | |
if ((mod || className && "SHA-1" === (result.algorithm.hash || {}).name) && "exportKey" === name && "jwk" === format && "HMAC" === result.algorithm.name && (data[0] = "raw"), !mod || "exportKey" !== name || "spki" !== format && "pkcs8" !== format || (data[0] = "jwk"), className && "wrapKey" === name) { | |
return that.exportKey(format, result).then(function(payload) { | |
return "jwk" === format && (payload = $(unescape(encodeURIComponent(JSON.stringify(parse(payload)))))), that.encrypt(data[3], value, payload); | |
}); | |
} | |
var promise; | |
try { | |
promise = fn.apply(that, data); | |
} catch (unknownError) { | |
return Promise.reject(unknownError); | |
} | |
return className && (promise = new Promise(function(onSuccess, callback) { | |
/** @type {function(?): undefined} */ | |
promise.onabort = promise.onerror = function(theError) { | |
callback(theError); | |
}; | |
/** | |
* @param {!Event} event | |
* @return {undefined} | |
*/ | |
promise.oncomplete = function(event) { | |
onSuccess(event.target.result); | |
}; | |
})), "exportKey" === name && "jwk" === format && (promise = promise.then(function(key) { | |
return (mod || className && "SHA-1" === (result.algorithm.hash || {}).name) && "HMAC" === result.algorithm.name ? { | |
kty : "oct", | |
alg : getKeyUsageByAlg(result.algorithm), | |
key_ops : result.usages.slice(), | |
ext : true, | |
k : escape(decode(key)) | |
} : (key = parse(key), key.alg || (key.alg = getKeyUsageByAlg(result.algorithm)), key.key_ops || (key.key_ops = "public" === result.type ? result.usages.filter(doImport) : "private" === result.type ? result.usages.filter(config) : result.usages.slice()), key); | |
})), !mod || "exportKey" !== name || "spki" !== format && "pkcs8" !== format || (promise = promise.then(function(name) { | |
return name = check(parse(name)); | |
})), promise; | |
}; | |
}), ["encrypt", "decrypt", "sign", "verify"].forEach(function(name) { | |
var fn = that[name]; | |
/** | |
* @param {!Object} options | |
* @param {?} r | |
* @param {string} obj | |
* @param {!Object} announceRes | |
* @return {?} | |
*/ | |
that[name] = function(options, r, obj, announceRes) { | |
if (className && (!obj.byteLength || announceRes && !announceRes.byteLength)) { | |
throw new Error("Empy input is not allowed"); | |
} | |
/** @type {!Array<?>} */ | |
var id = [].slice.call(arguments); | |
var html = generate(options); | |
if (className && "decrypt" === name && "AES-GCM" === html.name) { | |
/** @type {number} */ | |
var i = options.tagLength >> 3; | |
id[2] = (obj.buffer || obj).slice(0, obj.byteLength - i); | |
options.tag = (obj.buffer || obj).slice(obj.byteLength - i); | |
} | |
id[1] = r._key; | |
var self; | |
try { | |
self = fn.apply(that, id); | |
} catch (unknownError) { | |
return Promise.reject(unknownError); | |
} | |
return className && (self = new Promise(function(success, callback) { | |
/** @type {function(?): undefined} */ | |
self.onabort = self.onerror = function(theError) { | |
callback(theError); | |
}; | |
/** | |
* @param {!Object} data | |
* @return {undefined} | |
*/ | |
self.oncomplete = function(data) { | |
data = data.target.result; | |
if ("encrypt" === name && data instanceof AesGcmEncryptResult) { | |
var buf = data.ciphertext; | |
var chunk = data.tag; | |
/** @type {!Uint8Array} */ | |
data = new Uint8Array(buf.byteLength + chunk.byteLength); | |
data.set(new Uint8Array(buf), 0); | |
data.set(new Uint8Array(chunk), buf.byteLength); | |
/** @type {!ArrayBuffer} */ | |
data = data.buffer; | |
} | |
success(data); | |
}; | |
})), self; | |
}; | |
}), className) { | |
var engine = that.digest; | |
/** | |
* @param {string} index | |
* @param {!ArrayBuffer} buffer | |
* @return {?} | |
*/ | |
that.digest = function(index, buffer) { | |
if (!buffer.byteLength) { | |
throw new Error("Empy input is not allowed"); | |
} | |
var result; | |
try { | |
result = engine.call(that, index, buffer); | |
} catch (unknownError) { | |
return Promise.reject(unknownError); | |
} | |
return result = new Promise(function(onSuccess, callback) { | |
/** @type {function(?): undefined} */ | |
result.onabort = result.onerror = function(theError) { | |
callback(theError); | |
}; | |
/** | |
* @param {!Event} event | |
* @return {undefined} | |
*/ | |
result.oncomplete = function(event) { | |
onSuccess(event.target.result); | |
}; | |
}); | |
}; | |
/** @type {!Object} */ | |
window.crypto = Object.create(options, { | |
getRandomValues : { | |
value : function(data) { | |
return options.getRandomValues(data); | |
} | |
}, | |
subtle : { | |
value : that | |
} | |
}); | |
/** @type {function(!Object, number, number, string): undefined} */ | |
window.CryptoKey = Text; | |
} | |
if (mod) { | |
options.subtle = that; | |
window.Crypto = Crypto; | |
window.SubtleCrypto = parent; | |
/** @type {function(!Object, number, number, string): undefined} */ | |
window.CryptoKey = Text; | |
} | |
} | |
} | |
} | |
})("undefined" == typeof window ? "undefined" == typeof self ? win : self : window); | |
/** | |
* @param {?} data | |
* @return {?} | |
*/ | |
var encode = function(data) { | |
return btoa(String.fromCharCode.apply(null, new Uint8Array(data))); | |
}; | |
/** | |
* @return {?} | |
*/ | |
var createStandardConfig = function() { | |
return { | |
encrypt : function(password) { | |
return Promise.resolve(password); | |
} | |
}; | |
}; | |
/** | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
var copy = function(options) { | |
var data = { | |
name : "RSA-OAEP", | |
hash : { | |
name : "SHA-1" | |
} | |
}; | |
var query = parse(options.keystore, data); | |
return { | |
encrypt : function(password) { | |
return query.then(function(ciphertext) { | |
return decrypt(data, ciphertext, password); | |
}); | |
} | |
}; | |
}; | |
/** | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
var encrypt = function(options) { | |
var data = { | |
name : "RSA-OAEP", | |
hash : { | |
name : "SHA-256" | |
} | |
}; | |
var query = parse(options.keystore, data); | |
return { | |
encrypt : function(password) { | |
return query.then(function(ciphertext) { | |
return decrypt(data, ciphertext, password); | |
}); | |
} | |
}; | |
}; | |
/** @type {number} */ | |
var XHRTME = 3E4; | |
return { | |
version : "0.2.1", | |
createToken : f, | |
utils : { | |
isBrowserSupported : isBrowserSupported, | |
nativeCryptoSupport : polycrypt | |
} | |
}; | |
}); | |
}).call(exports, __webpack_require__(8), __webpack_require__(200).setImmediate); | |
}, | |
200 : function(module, exports, __webpack_require__) { | |
(function(root) { | |
/** | |
* @param {string} id | |
* @param {!Function} clearFn | |
* @return {undefined} | |
*/ | |
function Timeout(id, clearFn) { | |
/** @type {string} */ | |
this._id = id; | |
/** @type {!Function} */ | |
this._clearFn = clearFn; | |
} | |
/** @type {function(this:!Function, ...*): *} */ | |
var apply = Function.prototype.apply; | |
/** | |
* @return {?} | |
*/ | |
exports.setTimeout = function() { | |
return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); | |
}; | |
/** | |
* @return {?} | |
*/ | |
exports.setInterval = function() { | |
return new Timeout(apply.call(setInterval, window, arguments), clearInterval); | |
}; | |
/** @type {function(!Object): undefined} */ | |
exports.clearTimeout = exports.clearInterval = function(n) { | |
if (n) { | |
n.close(); | |
} | |
}; | |
/** @type {function(): undefined} */ | |
Timeout.prototype.unref = Timeout.prototype.ref = function() { | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
Timeout.prototype.close = function() { | |
this._clearFn.call(window, this._id); | |
}; | |
/** | |
* @param {?} item | |
* @param {number} msecs | |
* @return {undefined} | |
*/ | |
exports.enroll = function(item, msecs) { | |
clearTimeout(item._idleTimeoutId); | |
/** @type {number} */ | |
item._idleTimeout = msecs; | |
}; | |
/** | |
* @param {?} item | |
* @return {undefined} | |
*/ | |
exports.unenroll = function(item) { | |
clearTimeout(item._idleTimeoutId); | |
/** @type {number} */ | |
item._idleTimeout = -1; | |
}; | |
/** @type {function(!Object): undefined} */ | |
exports._unrefActive = exports.active = function(item) { | |
clearTimeout(item._idleTimeoutId); | |
var msecs = item._idleTimeout; | |
if (msecs >= 0) { | |
/** @type {number} */ | |
item._idleTimeoutId = setTimeout(function() { | |
if (item._onTimeout) { | |
item._onTimeout(); | |
} | |
}, msecs); | |
} | |
}; | |
__webpack_require__(201); | |
exports.setImmediate = "undefined" != typeof self && self.setImmediate || void 0 !== root && root.setImmediate || this && this.setImmediate; | |
exports.clearImmediate = "undefined" != typeof self && self.clearImmediate || void 0 !== root && root.clearImmediate || this && this.clearImmediate; | |
}).call(exports, __webpack_require__(8)); | |
}, | |
201 : function(module, exports, __webpack_require__) { | |
(function(canCreateDiscussions, $process) { | |
!function(global, elem) { | |
/** | |
* @param {!Object} fn | |
* @return {?} | |
*/ | |
function setImmediate(fn) { | |
if ("function" != typeof fn) { | |
/** @type {!Function} */ | |
fn = new Function("" + fn); | |
} | |
/** @type {!Array} */ | |
var args = new Array(arguments.length - 1); | |
/** @type {number} */ | |
var i = 0; | |
for (; i < args.length; i++) { | |
args[i] = arguments[i + 1]; | |
} | |
var listener = { | |
callback : fn, | |
args : args | |
}; | |
return data[type] = listener, init(type), type++; | |
} | |
/** | |
* @param {?} pref | |
* @return {undefined} | |
*/ | |
function clear(pref) { | |
delete data[pref]; | |
} | |
/** | |
* @param {!Object} el | |
* @return {undefined} | |
*/ | |
function hydratePath(el) { | |
var callback = el.callback; | |
var args = el.args; | |
switch(args.length) { | |
case 0: | |
callback(); | |
break; | |
case 1: | |
callback(args[0]); | |
break; | |
case 2: | |
callback(args[0], args[1]); | |
break; | |
case 3: | |
callback(args[0], args[1], args[2]); | |
break; | |
default: | |
callback.apply(elem, args); | |
} | |
} | |
/** | |
* @param {?} id | |
* @return {undefined} | |
*/ | |
function next(id) { | |
if (l) { | |
setTimeout(next, 0, id); | |
} else { | |
var child = data[id]; | |
if (child) { | |
/** @type {boolean} */ | |
l = true; | |
try { | |
hydratePath(child); | |
} finally { | |
clear(id); | |
/** @type {boolean} */ | |
l = false; | |
} | |
} | |
} | |
} | |
if (!global.setImmediate) { | |
var init; | |
/** @type {number} */ | |
var type = 1; | |
var data = {}; | |
/** @type {boolean} */ | |
var l = false; | |
var document = global.document; | |
/** @type {(Object|null)} */ | |
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global); | |
attachTo = attachTo && attachTo.setTimeout ? attachTo : global; | |
if ("[object process]" === {}.toString.call(global.process)) { | |
(function() { | |
/** | |
* @param {number} value | |
* @return {undefined} | |
*/ | |
init = function(value) { | |
$process.nextTick(function() { | |
next(value); | |
}); | |
}; | |
})(); | |
} else { | |
if (function() { | |
if (global.postMessage && !global.importScripts) { | |
/** @type {boolean} */ | |
var t = true; | |
var oldOnMessage = global.onmessage; | |
return global.onmessage = function() { | |
/** @type {boolean} */ | |
t = false; | |
}, global.postMessage("", "*"), global.onmessage = oldOnMessage, t; | |
} | |
}()) { | |
(function() { | |
/** @type {string} */ | |
var messagePrefix = "setImmediate$" + Math.random() + "$"; | |
/** | |
* @param {!Object} event | |
* @return {undefined} | |
*/ | |
var onMessage = function(event) { | |
if (event.source === global && "string" == typeof event.data && 0 === event.data.indexOf(messagePrefix)) { | |
next(+event.data.slice(messagePrefix.length)); | |
} | |
}; | |
if (global.addEventListener) { | |
global.addEventListener("message", onMessage, false); | |
} else { | |
global.attachEvent("onmessage", onMessage); | |
} | |
/** | |
* @param {number} handle | |
* @return {undefined} | |
*/ | |
init = function(handle) { | |
global.postMessage(messagePrefix + handle, "*"); | |
}; | |
})(); | |
} else { | |
if (global.MessageChannel) { | |
(function() { | |
/** @type {!MessageChannel} */ | |
var channel = new MessageChannel; | |
/** | |
* @param {!Object} e | |
* @return {undefined} | |
*/ | |
channel.port1.onmessage = function(e) { | |
next(e.data); | |
}; | |
/** | |
* @param {number} data | |
* @return {undefined} | |
*/ | |
init = function(data) { | |
channel.port2.postMessage(data); | |
}; | |
})(); | |
} else { | |
if (document && "onreadystatechange" in document.createElement("script")) { | |
(function() { | |
var documentElement = document.documentElement; | |
/** | |
* @param {number} value | |
* @return {undefined} | |
*/ | |
init = function(value) { | |
var node = document.createElement("script"); | |
/** | |
* @return {undefined} | |
*/ | |
node.onreadystatechange = function() { | |
next(value); | |
/** @type {null} */ | |
node.onreadystatechange = null; | |
documentElement.removeChild(node); | |
/** @type {null} */ | |
node = null; | |
}; | |
documentElement.appendChild(node); | |
}; | |
})(); | |
} else { | |
(function() { | |
/** | |
* @param {number} data | |
* @return {undefined} | |
*/ | |
init = function(data) { | |
setTimeout(next, 0, data); | |
}; | |
})(); | |
} | |
} | |
} | |
} | |
/** @type {function(!Object): ?} */ | |
attachTo.setImmediate = setImmediate; | |
/** @type {function(?): undefined} */ | |
attachTo.clearImmediate = clear; | |
} | |
}("undefined" == typeof self ? void 0 === canCreateDiscussions ? this : canCreateDiscussions : self); | |
}).call(exports, __webpack_require__(8), __webpack_require__(202)); | |
}, | |
202 : function(mixin, doPost) { | |
/** | |
* @return {?} | |
*/ | |
function defaultSetTimout() { | |
throw new Error("setTimeout has not been defined"); | |
} | |
/** | |
* @return {?} | |
*/ | |
function defaultClearTimeout() { | |
throw new Error("clearTimeout has not been defined"); | |
} | |
/** | |
* @param {!Function} fun | |
* @return {?} | |
*/ | |
function runTimeout(fun) { | |
if (cachedSetTimeout === setTimeout) { | |
return setTimeout(fun, 0); | |
} | |
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | |
return cachedSetTimeout = setTimeout, setTimeout(fun, 0); | |
} | |
try { | |
return cachedSetTimeout(fun, 0); | |
} catch (t) { | |
try { | |
return cachedSetTimeout.call(null, fun, 0); | |
} catch (t) { | |
return cachedSetTimeout.call(this, fun, 0); | |
} | |
} | |
} | |
/** | |
* @param {?} marker | |
* @return {?} | |
*/ | |
function runClearTimeout(marker) { | |
if (cachedClearTimeout === clearTimeout) { | |
return clearTimeout(marker); | |
} | |
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | |
return cachedClearTimeout = clearTimeout, clearTimeout(marker); | |
} | |
try { | |
return cachedClearTimeout(marker); | |
} catch (t) { | |
try { | |
return cachedClearTimeout.call(null, marker); | |
} catch (t) { | |
return cachedClearTimeout.call(this, marker); | |
} | |
} | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function cleanUpNextTick() { | |
if (h && currentQueue) { | |
/** @type {boolean} */ | |
h = false; | |
if (currentQueue.length) { | |
queue = currentQueue.concat(queue); | |
} else { | |
/** @type {number} */ | |
queueIndex = -1; | |
} | |
if (queue.length) { | |
drainQueue(); | |
} | |
} | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function drainQueue() { | |
if (!h) { | |
var timeout = runTimeout(cleanUpNextTick); | |
/** @type {boolean} */ | |
h = true; | |
var len = queue.length; | |
for (; len;) { | |
currentQueue = queue; | |
/** @type {!Array} */ | |
queue = []; | |
for (; ++queueIndex < len;) { | |
if (currentQueue) { | |
currentQueue[queueIndex].run(); | |
} | |
} | |
/** @type {number} */ | |
queueIndex = -1; | |
/** @type {number} */ | |
len = queue.length; | |
} | |
/** @type {null} */ | |
currentQueue = null; | |
/** @type {boolean} */ | |
h = false; | |
runClearTimeout(timeout); | |
} | |
} | |
/** | |
* @param {(Object|string)} fun | |
* @param {!Array} array | |
* @return {undefined} | |
*/ | |
function Item(fun, array) { | |
/** @type {(Object|string)} */ | |
this.fun = fun; | |
/** @type {!Array} */ | |
this.array = array; | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function noop() { | |
} | |
var cachedSetTimeout; | |
var cachedClearTimeout; | |
var process = mixin.exports = {}; | |
!function() { | |
try { | |
/** @type {!Function} */ | |
cachedSetTimeout = "function" == typeof setTimeout ? setTimeout : defaultSetTimout; | |
} catch (e) { | |
/** @type {function(): ?} */ | |
cachedSetTimeout = defaultSetTimout; | |
} | |
try { | |
/** @type {!Function} */ | |
cachedClearTimeout = "function" == typeof clearTimeout ? clearTimeout : defaultClearTimeout; | |
} catch (e) { | |
/** @type {function(): ?} */ | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
}(); | |
var currentQueue; | |
/** @type {!Array} */ | |
var queue = []; | |
/** @type {boolean} */ | |
var h = false; | |
/** @type {number} */ | |
var queueIndex = -1; | |
/** | |
* @param {!Function} fun | |
* @return {undefined} | |
*/ | |
process.nextTick = function(fun) { | |
/** @type {!Array} */ | |
var args = new Array(arguments.length - 1); | |
if (arguments.length > 1) { | |
/** @type {number} */ | |
var i = 1; | |
for (; i < arguments.length; i++) { | |
args[i - 1] = arguments[i]; | |
} | |
} | |
queue.push(new Item(fun, args)); | |
if (!(1 !== queue.length || h)) { | |
runTimeout(drainQueue); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
Item.prototype.run = function() { | |
this.fun.apply(null, this.array); | |
}; | |
/** @type {string} */ | |
process.title = "browser"; | |
/** @type {boolean} */ | |
process.browser = true; | |
process.env = {}; | |
/** @type {!Array} */ | |
process.argv = []; | |
/** @type {string} */ | |
process.version = ""; | |
process.versions = {}; | |
/** @type {function(): undefined} */ | |
process.on = noop; | |
/** @type {function(): undefined} */ | |
process.addListener = noop; | |
/** @type {function(): undefined} */ | |
process.once = noop; | |
/** @type {function(): undefined} */ | |
process.off = noop; | |
/** @type {function(): undefined} */ | |
process.removeListener = noop; | |
/** @type {function(): undefined} */ | |
process.removeAllListeners = noop; | |
/** @type {function(): undefined} */ | |
process.emit = noop; | |
/** @type {function(): undefined} */ | |
process.prependListener = noop; | |
/** @type {function(): undefined} */ | |
process.prependOnceListener = noop; | |
/** | |
* @param {?} type | |
* @return {?} | |
*/ | |
process.listeners = function(type) { | |
return []; | |
}; | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
process.binding = function(name) { | |
throw new Error("process.binding is not supported"); | |
}; | |
/** | |
* @return {?} | |
*/ | |
process.cwd = function() { | |
return "/"; | |
}; | |
/** | |
* @param {?} dir | |
* @return {?} | |
*/ | |
process.chdir = function(dir) { | |
throw new Error("process.chdir is not supported"); | |
}; | |
/** | |
* @return {?} | |
*/ | |
process.umask = function() { | |
return 0; | |
}; | |
}, | |
203 : function(cond, body, end_q) { | |
/** | |
* @param {!Object} value | |
* @return {?} | |
*/ | |
function render(value) { | |
return (0, self.isObject)(value) && Object.prototype.hasOwnProperty.call(value, "kid") && Object.prototype.hasOwnProperty.call(value, "kty") && Object.prototype.hasOwnProperty.call(value, "use") && Object.prototype.hasOwnProperty.call(value, "e") && Object.prototype.hasOwnProperty.call(value, "n"); | |
} | |
Object.defineProperty(body, "__esModule", { | |
value : true | |
}); | |
var self = end_q(0); | |
/** | |
* @param {!Object} key | |
* @return {?} | |
*/ | |
body.default = function(key) { | |
if (!render(key)) { | |
return Promise.resolve(""); | |
} | |
/** @type {string} */ | |
var msginner = key.kid + "," + key.kty + "," + key.use + "," + key.e + "," + key.n; | |
var text = (0, self.stringToArrayBuffer)(msginner); | |
return window.crypto.subtle.digest("SHA-256", text).then(function(hrp) { | |
return self.Base64.encode(hrp); | |
}); | |
}; | |
}, | |
204 : function(module, exports, __weex_require__) { | |
/** | |
* @param {!Object} label | |
* @return {?} | |
*/ | |
function create(label) { | |
/** @type {!Element} */ | |
var container = document.createElement("input"); | |
return container.type = "text", container.name = label, container.id = label + "-autocomplete", container.className = "autocomplete", container.setAttribute("autocomplete", label), container.setAttribute("autocompletetype", label), container.setAttribute("x-autocompletetype", label), container.tabIndex = -1, container.setAttribute("aria-hidden", true), container; | |
} | |
/** | |
* @param {!Object} show | |
* @param {!Object} $elem | |
* @param {!Object} options | |
* @return {?} | |
*/ | |
function render(show, $elem, options) { | |
/** | |
* @return {undefined} | |
*/ | |
function o() { | |
/** @type {boolean} */ | |
l = true; | |
setTimeout(function() { | |
var e = { | |
name : input.value, | |
code : data.value, | |
cardExpirationMonth : a.value, | |
cardExpirationYear : nOpt.value | |
}; | |
Object.keys(e).forEach(function(childProp) { | |
if (!e[childProp]) { | |
delete e[childProp]; | |
} | |
}); | |
if (Object.keys(e).length > 0) { | |
options.publish(modal.postMessagesFromChild.AUTOCOMPLETE, e); | |
} | |
}, 5); | |
} | |
if (false === show) { | |
return void $elem.setAttribute("autocomplete", "off"); | |
} | |
var input = create("cc-name"); | |
var a = create("cc-exp-month"); | |
var nOpt = create("cc-exp-year"); | |
var data = create("cc-csc"); | |
/** @type {boolean} */ | |
var l = false; | |
a.addEventListener("change", o); | |
var zoomInputElem = $elem.querySelector("input[name=credit-card-number]"); | |
if (zoomInputElem) { | |
zoomInputElem.addEventListener("input", function() { | |
if (l) { | |
/** @type {boolean} */ | |
l = false; | |
options.publish(modal.postMessagesFromChild.AUTOCOMPLETE_CHANGE); | |
} | |
}); | |
} | |
/** @type {!DocumentFragment} */ | |
var select = document.createDocumentFragment(); | |
select.appendChild(input); | |
select.appendChild(a); | |
select.appendChild(nOpt); | |
select.appendChild(data); | |
$elem.appendChild(select); | |
} | |
Object.defineProperty(exports, "__esModule", { | |
value : true | |
}); | |
var modal = __weex_require__(1); | |
/** @type {function(!Object, !Object, !Object): ?} */ | |
exports.default = render; | |
}, | |
205 : function(cond, t, xgh2) { | |
/** | |
* @param {!Event} e | |
* @return {?} | |
*/ | |
function isTextKey(e) { | |
/** @type {!Array} */ | |
var unreleased = [8, 9, 13, 27, 35, 36, 37, 39, 46, 110]; | |
var key = e.which || e.keyCode || 0; | |
return -1 !== unreleased.indexOf(key) || key >= 112 && key <= 123 || 65 === key && (true === e.ctrlKey || true === e.metaKey) || 67 === key && (true === e.ctrlKey || true === e.metaKey) || 88 === key && (true === e.ctrlKey || true === e.metaKey) || 86 === key && (true === e.ctrlKey || true === e.metaKey) || 189 === key && (true === e.ctrlKey || true === e.metaKey) || 187 === key && (true === e.ctrlKey || true === e.metaKey) || key >= 35 && key <= 40; | |
} | |
/** | |
* @param {!Event} e | |
* @return {?} | |
*/ | |
function Command_Option_J(e) { | |
var t = e.which || e.keyCode || 0; | |
return t >= 48 && t <= 57 || t >= 96 && t <= 105; | |
} | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
/** | |
* @param {!Event} e | |
* @return {?} | |
*/ | |
t.default = function(e) { | |
var t = isTextKey(e) || Command_Option_J(e); | |
return t || e.preventDefault(), t; | |
}; | |
}, | |
206 : function(cond, t, xgh2) { | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
/** | |
* @param {string} p2 | |
* @return {?} | |
*/ | |
t.default = function(p2) { | |
var t = p2.replace(/[[]/, "\\[").replace(/[\]]/, "\\]"); | |
/** @type {!RegExp} */ | |
var replytocomRegExp = new RegExp("[\\?&]" + t + "=([^&#]*)"); | |
/** @type {(Array<string>|null)} */ | |
var b = replytocomRegExp.exec(window.location.search); | |
return null === b ? "" : decodeURIComponent(b[1].replace(/\+/g, " ")); | |
}; | |
}, | |
207 : function(letter, e, n) { | |
Object.defineProperty(e, "__esModule", { | |
value : true | |
}); | |
var next = n(0); | |
var a = n(9); | |
var i = function(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
}(a); | |
/** | |
* @param {!Event} e | |
* @return {undefined} | |
*/ | |
e.default = function(e) { | |
e.stopPropagation(); | |
e.preventDefault(); | |
var schema = (e.clipboardData || window.clipboardData).getData("Text"); | |
var result = (0, next.stripNonDigits)(schema); | |
var t = e.target; | |
var start = t.selectionStart; | |
var end = t.selectionEnd; | |
var s = e.target.value; | |
setTimeout(function() { | |
e.target.value = s.slice(0, start) + result + s.slice(end); | |
(0, i.default)(e.target); | |
/** @type {number} */ | |
var bigInsert = 0; | |
var lineStart = result.length; | |
/** @type {number} */ | |
var offset = 0; | |
for (; offset <= lineStart; offset = offset + 1) { | |
if (" " === e.target.value.charAt(start + offset)) { | |
/** @type {number} */ | |
bigInsert = bigInsert + 1; | |
lineStart = lineStart + 1; | |
} | |
} | |
var indentationLength = start + result.length + bigInsert; | |
e.target.setSelectionRange(indentationLength, indentationLength); | |
}, 0); | |
}; | |
}, | |
208 : function(cond, t, xgh2) { | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
/** | |
* @param {string} arr | |
* @return {?} | |
*/ | |
t.default = function(arr) { | |
if (0 === arr.length) { | |
return []; | |
} | |
var textTokens = arr[0].spaces; | |
if (1 === arr.length) { | |
return textTokens; | |
} | |
var n = textTokens.join(); | |
return arr.every(function(utils) { | |
return utils.spaces.join() === n; | |
}) ? textTokens : []; | |
}; | |
}, | |
209 : function(letter, e, view) { | |
/** | |
* @param {!Array} value | |
* @return {?} | |
*/ | |
function h(value) { | |
/** @type {!Array} */ | |
var tt = []; | |
return "object" === (void 0 === value ? "undefined" : isArray(value)) && Object.keys(value).forEach(function(cssProp) { | |
if ((0, vroot.isCssPropertySupported)(cssProp)) { | |
tt = tt + (cssProp + ":" + value[cssProp] + ";"); | |
} else { | |
console.warn("Unsupported css property: '" + cssProp + "'"); | |
} | |
}), tt; | |
} | |
/** | |
* @param {!CSSStyleSheet} parent | |
* @param {string} d | |
* @param {!Array} c | |
* @param {number} idx | |
* @return {undefined} | |
*/ | |
function callback(parent, d, c, idx) { | |
parent.insertRule(d + " {" + h(c) + "}", idx); | |
} | |
/** | |
* @param {!Object} args | |
* @return {undefined} | |
*/ | |
function onLoadGlyphSet(args) { | |
if (null != args && !((0, utils.isObjectLike)(args) && Object.keys(args).length < 1)) { | |
/** @type {!Element} */ | |
var el = document.createElement("style"); | |
el.appendChild(document.createTextNode("")); | |
document.head.appendChild(el); | |
/** @type {number} */ | |
var loaded = 0; | |
if (callback(el.sheet, "input", args.input, loaded), callback(el.sheet, "input:disabled", args[":disabled"], loaded = loaded + 1), callback(el.sheet, "input:focus", args[":focus"], loaded = loaded + 1), callback(el.sheet, "input.valid", args.valid, loaded = loaded + 1), callback(el.sheet, "input.invalid", args.invalid, loaded = loaded + 1), args[":hover"] && callback(el.sheet, "input:hover", args[":hover"], loaded = loaded + 1), args["::placeholder"]) { | |
loaded = loaded + 1; | |
var options = args["::placeholder"]; | |
[":-ms-input-placeholder", "::-ms-input-placeholder", ":-moz-placeholder", "::-moz-placeholder", "::-webkit-input-placeholder", "::placeholder"].forEach(function(source) { | |
try { | |
callback(el.sheet, "input" + source, options, loaded); | |
loaded = loaded + 1; | |
} catch (e) { | |
} | |
}); | |
} | |
} | |
} | |
Object.defineProperty(e, "__esModule", { | |
value : true | |
}); | |
/** @type {function(!Array): ?} */ | |
var isArray = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(p_or_v) { | |
return typeof p_or_v; | |
} : function(obj) { | |
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | |
}; | |
/** @type {function(!Object): undefined} */ | |
e.default = onLoadGlyphSet; | |
var utils = view(0); | |
var vroot = view(210); | |
}, | |
210 : function(cond, t, xgh2) { | |
/** | |
* @param {?} e | |
* @return {?} | |
*/ | |
function r(e) { | |
return linkEnv.indexOf(e) >= 0; | |
} | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
/** @type {function(?): ?} */ | |
t.isCssPropertySupported = r; | |
/** @type {!Array} */ | |
var linkEnv = t.supportedProperties = ["color", "cursor", "font", "font-family", "font-kerning", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant-alternates", "font-variant-caps", "font-variant-east-asian", "font-variant-ligatures", "font-variant-numeric", "font-variant", "font-weight", "line-height", "opacity", "text-rendering", "text-shadow", "transition", "-moz-osx-font-smoothing", "-moz-tap-highlight-color", "-moz-transition", "-o-transition", "-webkit-font-smoothing", | |
"-webkit-tap-highlight-color", "-webkit-transition"]; | |
}, | |
211 : function(module, exports, __webpack_require__) { | |
/** | |
* @param {!Object} obj | |
* @return {?} | |
*/ | |
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { | |
default : obj | |
}; | |
} | |
/** | |
* @param {!NodeList} text | |
* @return {?} | |
*/ | |
function range(text) { | |
if (Array.isArray(text)) { | |
/** @type {number} */ | |
var i = 0; | |
/** @type {!Array} */ | |
var ret = Array(text.length); | |
for (; i < text.length; i++) { | |
ret[i] = text[i]; | |
} | |
return ret; | |
} | |
return Array.from(text); | |
} | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
function copy(name) { | |
return JSON.parse(JSON.stringify(name)); | |
} | |
/** | |
* @param {string} data | |
* @param {boolean} result | |
* @param {boolean} wasThrown | |
* @return {?} | |
*/ | |
function callback(data, result, wasThrown) { | |
return { | |
cards : data, | |
valid : result, | |
couldBeValid : wasThrown | |
}; | |
} | |
/** | |
* @param {!NodeList} guid | |
* @param {?} data | |
* @return {?} | |
*/ | |
function create(guid, data) { | |
return data.couldBeValidRegex.test(guid) && Math.max.apply(Math, range(data.lengths)) >= guid.length; | |
} | |
/** | |
* @param {!NodeList} e | |
* @param {?} type | |
* @return {?} | |
*/ | |
function encode(e, type) { | |
return -1 !== type.lengths.indexOf(e.length) && type.validRegex.test(e) && (!type.luhn || (0, _prepareStyleProperties2.default)(e)); | |
} | |
/** | |
* @param {(Node|NodeList|string)} id | |
* @param {!Array} resolve | |
* @return {?} | |
*/ | |
function extend(id, resolve) { | |
/** @type {!Array} */ | |
var tasks = []; | |
/** @type {!Array} */ | |
var html = []; | |
/** @type {!Array} */ | |
var invalidatedIds = []; | |
return resolve.forEach(function(options) { | |
if (create(id, options)) { | |
invalidatedIds.push(true); | |
html.push(encode(id, options)); | |
tasks.push(copy(options)); | |
} | |
}), callback(tasks, html.length > 0 && -1 === html.indexOf(false), -1 !== invalidatedIds.indexOf(true)); | |
} | |
/** | |
* @param {string} message | |
* @param {!Array} e | |
* @return {?} | |
*/ | |
function notify(message, e) { | |
if (!("string" == typeof message || message instanceof String)) { | |
return callback([], false, false); | |
} | |
/** @type {string} */ | |
var name = message.replace(/\s+/g, ""); | |
return "" === name ? callback([], false, false) : extend(name, e); | |
} | |
/** | |
* @param {string} e | |
* @return {?} | |
*/ | |
function info(e) { | |
return notify(e, arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : _normalizeDataUri2.default); | |
} | |
Object.defineProperty(exports, "__esModule", { | |
value : true | |
}); | |
/** @type {function(string): ?} */ | |
exports.default = info; | |
var _prepareStyleProperties = __webpack_require__(212); | |
var _prepareStyleProperties2 = _interopRequireDefault(_prepareStyleProperties); | |
var _normalizeDataUri = __webpack_require__(213); | |
var _normalizeDataUri2 = _interopRequireDefault(_normalizeDataUri); | |
}, | |
212 : function(mixin, args, parseAsUTC) { | |
mixin.exports = function(array) { | |
return function(val) { | |
if ("string" != typeof val) { | |
throw new TypeError("Expected string input"); | |
} | |
if (!val) { | |
return false; | |
} | |
var value; | |
/** @type {number} */ | |
var index = val.length; | |
/** @type {number} */ | |
var bit = 1; | |
/** @type {number} */ | |
var sumTotal = 0; | |
for (; index;) { | |
/** @type {number} */ | |
value = parseInt(val.charAt(--index), 10); | |
sumTotal = sumTotal + ((bit = bit ^ 1) ? array[value] : value); | |
} | |
return !!sumTotal && sumTotal % 10 == 0; | |
}; | |
}([0, 2, 4, 6, 8, 1, 3, 5, 7, 9]); | |
}, | |
213 : function(cond, t, xgh2) { | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
/** @type {!Array} */ | |
var offsetFromCenter = [{ | |
name : "visa", | |
brandedName : "Visa", | |
cybsCardType : "001", | |
validRegex : /^4\d*$/, | |
couldBeValidRegex : /^4\d*$/, | |
spaces : [4, 8, 12], | |
lengths : [13, 14, 15, 16, 17, 18, 19], | |
code : { | |
name : "CVV", | |
length : 3 | |
}, | |
luhn : true | |
}, { | |
name : "mastercard", | |
brandedName : "MasterCard", | |
cybsCardType : "002", | |
validRegex : /^(5[1-5]|222[1-9]|2[3-6]|27[0-1]|2720)\d*$/, | |
couldBeValidRegex : /^((5|(5[1-5])\d*)|(2|2[2-7]|(22[2-9]|2[3-6][1-9]|27[0-2])\d*))$/, | |
spaces : [4, 8, 12], | |
lengths : [16], | |
code : { | |
name : "CVC", | |
length : 3 | |
}, | |
luhn : true | |
}, { | |
name : "amex", | |
brandedName : "American Express", | |
cybsCardType : "003", | |
validRegex : /^3([47]\d*)?$/, | |
couldBeValidRegex : /^(3|(34|37)\d*)$/, | |
spaces : [4, 10], | |
lengths : [15], | |
code : { | |
name : "CID", | |
length : 4 | |
}, | |
luhn : true | |
}, { | |
name : "maestro", | |
brandedName : "Maestro", | |
cybsCardType : "042", | |
validRegex : /^((5((0[0-9])|([6-9])))|6(?!((011(0|[2-4]|74|7[7-9]|8[6-9]|9))|4[4-9]|5)))\d*$/, | |
couldBeValidRegex : /^((5$|50$|(5((0[0-9])|([6-9]))))\d*|6$|6(?!((011(0|[2-4]|74|7[7-9]|8[6-9]|9))|4[4-9]|5)))\d*$/, | |
spaces : [4, 8, 12], | |
lengths : [12, 13, 14, 15, 16, 17, 18, 19], | |
code : { | |
name : "CVC", | |
length : 3 | |
}, | |
luhn : true | |
}, { | |
name : "discover", | |
brandedName : "Discover", | |
cybsCardType : "004", | |
validRegex : /^(6((011(0|[2-4]|74|7[7-9]|8[6-9]|9))|4[4-9]|5|(22(12[6-9]|1[3-9]|[2-8]|9[0-2]|92[0-5]))|2[4-6]|28[2-8]))\d*$/, | |
couldBeValidRegex : /^(6$|60$|601$|6011$|62$|622$|64$|65|(6(011(0|[2-4]|[7-9]$)|(0117(4|[7-9]))|(0118([6-9]))|0119|4[4-9]|22(1$|12$|12[6-9]|1[3-9]|[2-8]|9$|9[01]|92$|92[0-5]))))\d*$/, | |
spaces : [4, 8, 12], | |
lengths : [16, 19], | |
code : { | |
name : "CID", | |
length : 3 | |
}, | |
luhn : true | |
}, { | |
name : "diners-club", | |
brandedName : "Diners Club", | |
cybsCardType : "005", | |
validRegex : /^3(0[0-5]|095|[689])\d*$/, | |
couldBeValidRegex : /^(3$|30$|30[0-5]|309$|3095|3[689])\d*/, | |
spaces : [4, 10], | |
lengths : [14, 16], | |
code : { | |
name : "CVV", | |
length : 3 | |
}, | |
luhn : true | |
}, { | |
name : "jcb", | |
brandedName : "JCB", | |
cybsCardType : "007", | |
validRegex : /^(35(2[8-9]|[3-8]))\d*$/, | |
couldBeValidRegex : /^(3$|35$|352$|(35(2[8-9]|[3-8]))\d*)$/, | |
spaces : [4, 8, 12], | |
lengths : [16], | |
code : { | |
name : "CVV", | |
length : 3 | |
}, | |
luhn : true | |
}]; | |
/** @type {!Array} */ | |
t.default = offsetFromCenter; | |
}, | |
214 : function(formatters, customFormatters) { | |
}, | |
3 : function(cond, t, xgh2) { | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
/** @type {string} */ | |
t.default = "0.4.0"; | |
}, | |
4 : function(cond, t, xgh2) { | |
/** | |
* @return {undefined} | |
*/ | |
function UnsupportedError() { | |
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; | |
if (!e.message) { | |
throw new Error("Error message required"); | |
} | |
/** @type {string} */ | |
this.name = "MicroformError"; | |
this.message = e.message; | |
this.details = e.details; | |
} | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
/** @type {!Object} */ | |
UnsupportedError.prototype = Object.create(Error.prototype); | |
/** @type {function(): undefined} */ | |
UnsupportedError.prototype.constructor = UnsupportedError; | |
/** @type {function(): undefined} */ | |
t.default = UnsupportedError; | |
}, | |
6 : function(Database, Config, callback) { | |
/** | |
* @param {!Worker} fn | |
* @return {?} | |
*/ | |
function create(fn) { | |
/** | |
* @param {?} name | |
* @param {!Function} method | |
* @return {?} | |
*/ | |
function open(name, method) { | |
var type = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : e; | |
return !!(0, value.isString)(name) && (!!(0, value.isFunction)(method) && (table[type] || (table[type] = {}), table[type][name] || (table[type][name] = []), table[type][name].push(method), true)); | |
} | |
/** | |
* @param {?} method | |
* @param {!Function} entity | |
* @return {?} | |
*/ | |
function unsubscribe(method, entity) { | |
var type = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : e; | |
if (table[type] && table[type][method]) { | |
return false; | |
} | |
var bucket = table[type][method]; | |
if (!bucket) { | |
return false; | |
} | |
/** @type {number} */ | |
var i = 0; | |
for (; i < bucket.length; i = i + 1) { | |
if (bucket[i] === entity) { | |
return bucket.splice(i, 1), true; | |
} | |
} | |
return false; | |
} | |
/** | |
* @param {!Function} func | |
* @return {?} | |
*/ | |
function create(func) { | |
var name = (0, value.uuid)(); | |
return open(name, function channel(key) { | |
unsubscribe(name, channel); | |
func(key); | |
}), name; | |
} | |
/** | |
* @param {string} event | |
* @param {!Object} data | |
* @param {!Function} name | |
* @return {?} | |
*/ | |
function parse(event, data, name) { | |
var context = { | |
event : event, | |
contentType : contentType, | |
sender : socketWrapper1, | |
data : data || {} | |
}; | |
return "function" == typeof name && (context.reply = create(name)), context; | |
} | |
/** | |
* @param {!Object} e | |
* @return {?} | |
*/ | |
function c(e) { | |
return function(undefined, type) { | |
var value = parse(e.data.reply, undefined, type); | |
e.source.postMessage(value, e.origin); | |
}; | |
} | |
/** | |
* @param {string} y | |
* @param {?} x | |
* @param {!Array} n | |
* @param {!Object} e | |
* @return {undefined} | |
*/ | |
function cb(y, x, n, e) { | |
if (table[y] && table[y][x]) { | |
var patchLen = table[y][x].length; | |
/** @type {number} */ | |
var i = 0; | |
for (; i < patchLen; i = i + 1) { | |
table[y][x][i].apply(e, n); | |
} | |
} | |
} | |
/** | |
* @param {!Object} e | |
* @return {undefined} | |
*/ | |
function render(e) { | |
var charsetBitSize = e.origin || e.originalEvent.origin; | |
if ((0, value.isObject)(e.data) && e.data.contentType === contentType && "event" in e.data && !(!contentType.indexOf(e.data.event) < 0)) { | |
/** @type {!Array} */ | |
var line = [e.data.data || {}]; | |
if (e.data.reply) { | |
line.push(c(e)); | |
} | |
cb("*", e.data.event, line, e); | |
cb(charsetBitSize, e.data.event, line, e); | |
} | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function callback() { | |
window.removeEventListener("message", render, false); | |
} | |
/** | |
* @param {string} event | |
* @param {!Object} fn | |
* @param {!Function} type | |
* @return {undefined} | |
*/ | |
function trigger(event, fn, type) { | |
var host = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : notifyY; | |
var result = parse(event, fn, type); | |
try { | |
client.postMessage(result, host); | |
} catch (deprecationWarning) { | |
console.warn("Could not post payload\n\n" + result + "\n\nto origin: " + host); | |
console.warn(deprecationWarning); | |
} | |
} | |
/** | |
* @return {?} | |
*/ | |
function getData() { | |
return table = {}, true; | |
} | |
/** | |
* @return {undefined} | |
*/ | |
function teardown() { | |
callback(); | |
getData(); | |
} | |
var y = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "*"; | |
var args = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "*"; | |
var table = {}; | |
var socketWrapper1 = (0, value.uuid)(); | |
/** @type {!Worker} */ | |
var client = fn; | |
var notifyY = y; | |
var e = args; | |
return window.addEventListener("message", render, false), { | |
publish : trigger, | |
subscribe : open, | |
unsubscribe : unsubscribe, | |
unsubscribeAll : getData, | |
teardown : teardown | |
}; | |
} | |
Object.defineProperty(Config, "__esModule", { | |
value : true | |
}); | |
/** @type {function(!Worker): ?} */ | |
Config.default = create; | |
var value = callback(0); | |
/** @type {string} */ | |
var contentType = "application/x-telegram+json"; | |
}, | |
7 : function(cond, t, xgh2) { | |
/** | |
* @param {?} selector | |
* @return {?} | |
*/ | |
function clickWithWebdriver(selector) { | |
return /^(01|02|03|04).{30}$/.test(selector); | |
} | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
/** @type {function(?): ?} */ | |
t.default = clickWithWebdriver; | |
}, | |
8 : function(mixin, doPost) { | |
var g; | |
g = function() { | |
return this; | |
}(); | |
try { | |
g = g || Function("return this")() || (0, eval)("this"); | |
} catch (e) { | |
if ("object" == typeof window) { | |
/** @type {!Window} */ | |
g = window; | |
} | |
} | |
mixin.exports = g; | |
}, | |
9 : function(cond, t, xgh2) { | |
Object.defineProperty(t, "__esModule", { | |
value : true | |
}); | |
/** | |
* @param {!EventTarget} target | |
* @return {undefined} | |
*/ | |
t.default = function(target) { | |
var evt = void 0; | |
try { | |
/** @type {!Event} */ | |
evt = new Event("input"); | |
} catch (e) { | |
/** @type {(Event|null)} */ | |
evt = document.createEvent("HTMLEvents"); | |
evt.initEvent("input", false, false); | |
} | |
target.dispatchEvent(evt); | |
}; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment