# HG changeset patch # User Thierry Florac # Date 1461252000 -7200 # Node ID d294083fb28c8dd55622c95b7799cb0278087009 # Parent 601c667286f6584b4e0ad13d3193ab48f2437779 Added JQuery InputMask plug-in diff -r 601c667286f6 -r d294083fb28c src/pyams_skin/resources/js/ext/jquery-inputmask-bundle-3.2.8.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/jquery-inputmask-bundle-3.2.8.js Thu Apr 21 17:20:00 2016 +0200 @@ -0,0 +1,2605 @@ +/*! +* jquery.inputmask.bundle.js +* https://github.com/RobinHerbots/jquery.inputmask +* Copyright (c) 2010 - 2016 Robin Herbots +* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) +* Version: 3.2.8-15 +*/ +!function($) { + function Inputmask(alias, options) { + return this instanceof Inputmask ? ($.isPlainObject(alias) ? options = alias : (options = options || {}, + options.alias = alias), this.el = void 0, this.opts = $.extend(!0, {}, this.defaults, options), + this.noMasksCache = options && void 0 !== options.definitions, this.userOptions = options || {}, + this.events = {}, void resolveAlias(this.opts.alias, options, this.opts)) : new Inputmask(alias, options); + } + function isInputEventSupported(eventName) { + var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el; + return isSupported || (el.setAttribute(evName, "return;"), isSupported = "function" == typeof el[evName]), + el = null, isSupported; + } + function isElementTypeSupported(input, opts) { + var elementType = input.getAttribute("type"), isSupported = "INPUT" === input.tagName && -1 !== $.inArray(elementType, opts.supportsInputType) || input.isContentEditable || "TEXTAREA" === input.tagName; + if (!isSupported && "INPUT" === input.tagName) { + var el = document.createElement("input"); + el.setAttribute("type", elementType), isSupported = "text" === el.type, el = null; + } + return isSupported; + } + function resolveAlias(aliasStr, options, opts) { + var aliasDefinition = opts.aliases[aliasStr]; + return aliasDefinition ? (aliasDefinition.alias && resolveAlias(aliasDefinition.alias, void 0, opts), + $.extend(!0, opts, aliasDefinition), $.extend(!0, opts, options), !0) : (null === opts.mask && (opts.mask = aliasStr), + !1); + } + function importAttributeOptions(npt, opts, userOptions) { + function importOption(option, optionData) { + optionData = void 0 !== optionData ? optionData : npt.getAttribute("data-inputmask-" + option), + null !== optionData && ("string" == typeof optionData && (0 === option.indexOf("on") ? optionData = window[optionData] : "false" === optionData ? optionData = !1 : "true" === optionData && (optionData = !0)), + userOptions[option] = optionData); + } + var option, dataoptions, optionData, p, attrOptions = npt.getAttribute("data-inputmask"); + if (attrOptions && "" !== attrOptions && (attrOptions = attrOptions.replace(new RegExp("'", "g"), '"'), + dataoptions = JSON.parse("{" + attrOptions + "}")), dataoptions) { + optionData = void 0; + for (p in dataoptions) if ("alias" === p.toLowerCase()) { + optionData = dataoptions[p]; + break; + } + } + importOption("alias", optionData), userOptions.alias && resolveAlias(userOptions.alias, userOptions, opts); + for (option in opts) { + if (dataoptions) { + optionData = void 0; + for (p in dataoptions) if (p.toLowerCase() === option.toLowerCase()) { + optionData = dataoptions[p]; + break; + } + } + importOption(option, optionData); + } + return $.extend(!0, opts, userOptions), opts; + } + function generateMaskSet(opts, nocache) { + function analyseMask(mask) { + function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) { + this.matches = [], this.isGroup = isGroup || !1, this.isOptional = isOptional || !1, + this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1, + this.quantifier = { + min: 1, + max: 1 + }; + } + function insertTestDefinition(mtoken, element, position) { + var maskdef = opts.definitions[element]; + position = void 0 !== position ? position : mtoken.matches.length; + var prevMatch = mtoken.matches[position - 1]; + if (maskdef && !escaped) { + maskdef.placeholder = $.isFunction(maskdef.placeholder) ? maskdef.placeholder(opts) : maskdef.placeholder; + for (var prevalidators = maskdef.prevalidator, prevalidatorsL = prevalidators ? prevalidators.length : 0, i = 1; i < maskdef.cardinality; i++) { + var prevalidator = prevalidatorsL >= i ? prevalidators[i - 1] : [], validator = prevalidator.validator, cardinality = prevalidator.cardinality; + mtoken.matches.splice(position++, 0, { + fn: validator ? "string" == typeof validator ? new RegExp(validator) : new function() { + this.test = validator; + }() : new RegExp("."), + cardinality: cardinality ? cardinality : 1, + optionality: mtoken.isOptional, + newBlockMarker: void 0 === prevMatch || prevMatch.def !== (maskdef.definitionSymbol || element), + casing: maskdef.casing, + def: maskdef.definitionSymbol || element, + placeholder: maskdef.placeholder, + mask: element + }), prevMatch = mtoken.matches[position - 1]; + } + mtoken.matches.splice(position++, 0, { + fn: maskdef.validator ? "string" == typeof maskdef.validator ? new RegExp(maskdef.validator) : new function() { + this.test = maskdef.validator; + }() : new RegExp("."), + cardinality: maskdef.cardinality, + optionality: mtoken.isOptional, + newBlockMarker: void 0 === prevMatch || prevMatch.def !== (maskdef.definitionSymbol || element), + casing: maskdef.casing, + def: maskdef.definitionSymbol || element, + placeholder: maskdef.placeholder, + mask: element + }); + } else mtoken.matches.splice(position++, 0, { + fn: null, + cardinality: 0, + optionality: mtoken.isOptional, + newBlockMarker: void 0 === prevMatch || prevMatch.def !== element, + casing: null, + def: opts.staticDefinitionSymbol || element, + placeholder: void 0 !== opts.staticDefinitionSymbol ? element : void 0, + mask: element + }), escaped = !1; + } + function verifyGroupMarker(lastMatch, isOpenGroup) { + lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0), + isOpenGroup !== !0 && insertTestDefinition(lastMatch, opts.groupmarker.end)); + } + function maskCurrentToken(m, currentToken, lastMatch, extraCondition) { + currentToken.matches.length > 0 && (void 0 === extraCondition || extraCondition) && (lastMatch = currentToken.matches[currentToken.matches.length - 1], + verifyGroupMarker(lastMatch)), insertTestDefinition(currentToken, m); + } + function defaultCase() { + if (openenings.length > 0) { + if (currentOpeningToken = openenings[openenings.length - 1], maskCurrentToken(m, currentOpeningToken, lastMatch, !currentOpeningToken.isAlternator), + currentOpeningToken.isAlternator) { + alternator = openenings.pop(); + for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1; + openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1], + currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator); + } + } else maskCurrentToken(m, currentToken, lastMatch); + } + function reverseTokens(maskToken) { + function reverseStatic(st) { + return st === opts.optionalmarker.start ? st = opts.optionalmarker.end : st === opts.optionalmarker.end ? st = opts.optionalmarker.start : st === opts.groupmarker.start ? st = opts.groupmarker.end : st === opts.groupmarker.end && (st = opts.groupmarker.start), + st; + } + maskToken.matches = maskToken.matches.reverse(); + for (var match in maskToken.matches) { + var intMatch = parseInt(match); + if (maskToken.matches[match].isQuantifier && maskToken.matches[intMatch + 1] && maskToken.matches[intMatch + 1].isGroup) { + var qt = maskToken.matches[match]; + maskToken.matches.splice(match, 1), maskToken.matches.splice(intMatch + 1, 0, qt); + } + void 0 !== maskToken.matches[match].matches ? maskToken.matches[match] = reverseTokens(maskToken.matches[match]) : maskToken.matches[match] = reverseStatic(maskToken.matches[match]); + } + return maskToken; + } + for (var match, m, openingToken, currentOpeningToken, alternator, lastMatch, groupToken, tokenizer = /(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g, escaped = !1, currentToken = new MaskToken(), openenings = [], maskTokens = []; match = tokenizer.exec(mask); ) if (m = match[0], + escaped) defaultCase(); else switch (m.charAt(0)) { + case opts.escapeChar: + escaped = !0; + break; + + case opts.optionalmarker.end: + case opts.groupmarker.end: + if (openingToken = openenings.pop(), void 0 !== openingToken) if (openenings.length > 0) { + if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken), + currentOpeningToken.isAlternator) { + alternator = openenings.pop(); + for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1; + openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1], + currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator); + } + } else currentToken.matches.push(openingToken); else defaultCase(); + break; + + case opts.optionalmarker.start: + openenings.push(new MaskToken(!1, !0)); + break; + + case opts.groupmarker.start: + openenings.push(new MaskToken(!0)); + break; + + case opts.quantifiermarker.start: + var quantifier = new MaskToken(!1, !1, !0); + m = m.replace(/[{}]/g, ""); + var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]); + if (("*" === mq1 || "+" === mq1) && (mq0 = "*" === mq1 ? 0 : 1), quantifier.quantifier = { + min: mq0, + max: mq1 + }, openenings.length > 0) { + var matches = openenings[openenings.length - 1].matches; + match = matches.pop(), match.isGroup || (groupToken = new MaskToken(!0), groupToken.matches.push(match), + match = groupToken), matches.push(match), matches.push(quantifier); + } else match = currentToken.matches.pop(), match.isGroup || (groupToken = new MaskToken(!0), + groupToken.matches.push(match), match = groupToken), currentToken.matches.push(match), + currentToken.matches.push(quantifier); + break; + + case opts.alternatormarker: + openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1], + lastMatch = currentOpeningToken.matches.pop()) : lastMatch = currentToken.matches.pop(), + lastMatch.isAlternator ? openenings.push(lastMatch) : (alternator = new MaskToken(!1, !1, !1, !0), + alternator.matches.push(lastMatch), openenings.push(alternator)); + break; + + default: + defaultCase(); + } + for (;openenings.length > 0; ) openingToken = openenings.pop(), verifyGroupMarker(openingToken, !0), + currentToken.matches.push(openingToken); + return currentToken.matches.length > 0 && (lastMatch = currentToken.matches[currentToken.matches.length - 1], + verifyGroupMarker(lastMatch), maskTokens.push(currentToken)), opts.numericInput && reverseTokens(maskTokens[0]), + maskTokens; + } + function generateMask(mask, metadata) { + if (null === mask || "" === mask) return void 0; + if (1 === mask.length && opts.greedy === !1 && 0 !== opts.repeat && (opts.placeholder = ""), + opts.repeat > 0 || "*" === opts.repeat || "+" === opts.repeat) { + var repeatStart = "*" === opts.repeat ? 0 : "+" === opts.repeat ? 1 : opts.repeat; + mask = opts.groupmarker.start + mask + opts.groupmarker.end + opts.quantifiermarker.start + repeatStart + "," + opts.repeat + opts.quantifiermarker.end; + } + var masksetDefinition; + return void 0 === Inputmask.prototype.masksCache[mask] || nocache === !0 ? (masksetDefinition = { + mask: mask, + maskToken: analyseMask(mask), + validPositions: {}, + _buffer: void 0, + buffer: void 0, + tests: {}, + metadata: metadata + }, nocache !== !0 && (Inputmask.prototype.masksCache[opts.numericInput ? mask.split("").reverse().join("") : mask] = masksetDefinition, + masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[opts.numericInput ? mask.split("").reverse().join("") : mask]))) : masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[opts.numericInput ? mask.split("").reverse().join("") : mask]), + masksetDefinition; + } + function preProcessMask(mask) { + return mask = mask.toString(); + } + var ms; + if ($.isFunction(opts.mask) && (opts.mask = opts.mask(opts)), $.isArray(opts.mask)) { + if (opts.mask.length > 1) { + opts.keepStatic = null === opts.keepStatic ? !0 : opts.keepStatic; + var altMask = "("; + return $.each(opts.numericInput ? opts.mask.reverse() : opts.mask, function(ndx, msk) { + altMask.length > 1 && (altMask += ")|("), altMask += preProcessMask(void 0 === msk.mask || $.isFunction(msk.mask) ? msk : msk.mask); + }), altMask += ")", generateMask(altMask, opts.mask); + } + opts.mask = opts.mask.pop(); + } + return opts.mask && (ms = void 0 === opts.mask.mask || $.isFunction(opts.mask.mask) ? generateMask(preProcessMask(opts.mask), opts.mask) : generateMask(preProcessMask(opts.mask.mask), opts.mask)), + ms; + } + function maskScope(actionObj, maskset, opts) { + function getMaskTemplate(baseOnInput, minimalPos, includeInput) { + minimalPos = minimalPos || 0; + var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0, lvp = getLastValidPosition(); + do { + if (baseOnInput === !0 && getMaskSet().validPositions[pos]) { + var validPos = getMaskSet().validPositions[pos]; + test = validPos.match, ndxIntlzr = validPos.locator.slice(), maskTemplate.push(includeInput === !0 ? validPos.input : getPlaceholder(pos, test)); + } else testPos = getTestTemplate(pos, ndxIntlzr, pos - 1), test = testPos.match, + ndxIntlzr = testPos.locator.slice(), (opts.jitMasking === !1 || lvp > pos || isFinite(opts.jitMasking) && opts.jitMasking > pos) && maskTemplate.push(getPlaceholder(pos, test)); + pos++; + } while ((void 0 === maxLength || maxLength > pos - 1) && null !== test.fn || null === test.fn && "" !== test.def || minimalPos >= pos); + return "" === maskTemplate[maskTemplate.length - 1] && maskTemplate.pop(), maskTemplate; + } + function getMaskSet() { + return maskset; + } + function resetMaskSet(soft) { + var maskset = getMaskSet(); + maskset.buffer = void 0, soft !== !0 && (maskset.tests = {}, maskset._buffer = void 0, + maskset.validPositions = {}, maskset.p = 0); + } + function getLastValidPosition(closestTo, strict) { + var before = -1, after = -1, valids = getMaskSet().validPositions; + void 0 === closestTo && (closestTo = -1); + for (var posNdx in valids) { + var psNdx = parseInt(posNdx); + valids[psNdx] && (strict || null !== valids[psNdx].match.fn) && (closestTo >= psNdx && (before = psNdx), + psNdx >= closestTo && (after = psNdx)); + } + return -1 !== before && closestTo - before > 1 || closestTo > after ? before : after; + } + function setValidPosition(pos, validTest, fromSetValid, isSelection) { + if (isSelection || opts.insertMode && void 0 !== getMaskSet().validPositions[pos] && void 0 === fromSetValid) { + var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition(); + for (i = pos; lvp >= i; i++) delete getMaskSet().validPositions[i]; + getMaskSet().validPositions[pos] = validTest; + var j, valid = !0, vps = getMaskSet().validPositions; + for (i = j = pos; lvp >= i; i++) { + var t = positionsClone[i]; + if (void 0 !== t) for (var posMatch = j, prevPosMatch = -1; posMatch < getMaskLength() && (null == t.match.fn && vps[i] && (vps[i].match.optionalQuantifier === !0 || vps[i].match.optionality === !0) || null != t.match.fn); ) if (null === t.match.fn || !opts.keepStatic && vps[i] && (void 0 !== vps[i + 1] && getTests(i + 1, vps[i].locator.slice(), i).length > 1 || void 0 !== vps[i].alternation) ? posMatch++ : posMatch = seekNext(j), + positionCanMatchDefinition(posMatch, t.match.def)) { + var result = isValid(posMatch, t.input, !0, !0); + if (valid = result !== !1, j = result.caret || result.insert ? getLastValidPosition() : posMatch, + valid) break; + } else { + if (valid = null == t.match.fn, prevPosMatch === posMatch) break; + prevPosMatch = posMatch; + } + if (!valid) break; + } + if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone), + resetMaskSet(!0), !1; + } else getMaskSet().validPositions[pos] = validTest; + return resetMaskSet(!0), !0; + } + function stripValidPositions(start, end, nocheck, strict) { + function IsEnclosedStatic(pos) { + var posMatch = getMaskSet().validPositions[pos]; + if (void 0 !== posMatch && null === posMatch.match.fn) { + var prevMatch = getMaskSet().validPositions[pos - 1], nextMatch = getMaskSet().validPositions[pos + 1]; + return void 0 !== prevMatch && void 0 !== nextMatch; + } + return !1; + } + var i, startPos = start; + for (getMaskSet().p = start, i = end - 1; i >= startPos; i--) void 0 !== getMaskSet().validPositions[i] && (nocheck === !0 || !IsEnclosedStatic(i) && opts.canClearPosition(getMaskSet(), i, getLastValidPosition(), strict, opts) !== !1) && delete getMaskSet().validPositions[i]; + for (resetMaskSet(!0), i = startPos + 1; i <= getLastValidPosition(); ) { + for (;void 0 !== getMaskSet().validPositions[startPos]; ) startPos++; + var s = getMaskSet().validPositions[startPos]; + if (startPos > i && (i = startPos + 1), void 0 === getMaskSet().validPositions[i] && isMask(i) || void 0 !== s) i++; else { + var t = getTestTemplate(i); + positionCanMatchDefinition(startPos, t.match.def) ? isValid(startPos, t.input || getPlaceholder(i), !0) !== !1 && (delete getMaskSet().validPositions[i], + i++) : isMask(i) || (i++, startPos--), startPos++; + } + } + resetMaskSet(!0); + } + function getTestTemplate(pos, ndxIntlzr, tstPs) { + var testPos = getMaskSet().validPositions[pos]; + if (void 0 === testPos) for (var testPositions = getTests(pos, ndxIntlzr, tstPs), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation].toString().split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx], + !(testPos.match && (opts.greedy && testPos.match.optionalQuantifier !== !0 || (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0) && (void 0 === lvTest.alternation || lvTest.alternation !== testPos.alternation || void 0 !== testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr)))); ndx++) ; + return testPos; + } + function getTest(pos) { + return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos].match : getTests(pos)[0].match; + } + function positionCanMatchDefinition(pos, def) { + for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) { + valid = !0; + break; + } + return valid; + } + function selectBestMatch(pos, alternateNdx) { + var bestMatch, indexPos; + return (getMaskSet().tests[pos] || getMaskSet().validPositions[pos]) && $.each(getMaskSet().tests[pos] || [ getMaskSet().validPositions[pos] ], function(ndx, lmnt) { + var ndxPos = lmnt.alternation ? lmnt.locator[lmnt.alternation].toString().indexOf(alternateNdx) : -1; + (void 0 === indexPos || indexPos > ndxPos) && -1 !== ndxPos && (bestMatch = lmnt, + indexPos = ndxPos); + }), bestMatch; + } + function getTests(pos, ndxIntlzr, tstPs) { + function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) { + function handleMatch(match, loopNdx, quantifierRecurse) { + function isFirstMatch(latestMatch, tokenGroup) { + var firstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches); + return firstMatch || $.each(tokenGroup.matches, function(ndx, match) { + return match.isQuantifier === !0 && (firstMatch = isFirstMatch(latestMatch, tokenGroup.matches[ndx - 1])) ? !1 : void 0; + }), firstMatch; + } + function resolveNdxInitializer(pos, alternateNdx) { + var bestMatch = selectBestMatch(pos, alternateNdx); + return bestMatch ? bestMatch.locator.slice(bestMatch.alternation + 1) : []; + } + if (testPos > 1e4) throw "Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask; + if (testPos === pos && void 0 === match.matches) return matches.push({ + match: match, + locator: loopNdx.reverse(), + cd: cacheDependency + }), !0; + if (void 0 !== match.matches) { + if (match.isGroup && quantifierRecurse !== match) { + if (match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx)) return !0; + } else if (match.isOptional) { + var optionalToken = match; + if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) { + if (latestMatch = matches[matches.length - 1].match, !isFirstMatch(latestMatch, optionalToken)) return !0; + insertStop = !0, testPos = pos; + } + } else if (match.isAlternator) { + var maltMatches, alternateToken = match, malternateMatches = [], currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1; + if (-1 === altIndex || "string" == typeof altIndex) { + var amndx, currentPos = testPos, ndxInitializerClone = ndxInitializer.slice(), altIndexArr = []; + if ("string" == typeof altIndex) altIndexArr = altIndex.split(","); else for (amndx = 0; amndx < alternateToken.matches.length; amndx++) altIndexArr.push(amndx); + for (var ndx = 0; ndx < altIndexArr.length; ndx++) { + if (amndx = parseInt(altIndexArr[ndx]), matches = [], ndxInitializer = resolveNdxInitializer(testPos, amndx), + match = handleMatch(alternateToken.matches[amndx] || maskToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) || match, + match !== !0 && void 0 !== match && altIndexArr[altIndexArr.length - 1] < alternateToken.matches.length) { + var ntndx = $.inArray(match, maskToken.matches) + 1; + maskToken.matches.length > ntndx && (match = handleMatch(maskToken.matches[ntndx], [ ntndx ].concat(loopNdx.slice(1, loopNdx.length)), quantifierRecurse), + match && (altIndexArr.push(ntndx.toString()), $.each(matches, function(ndx, lmnt) { + lmnt.alternation = loopNdx.length - 1; + }))); + } + maltMatches = matches.slice(), testPos = currentPos, matches = []; + for (var i = 0; i < ndxInitializerClone.length; i++) ndxInitializer[i] = ndxInitializerClone[i]; + for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) { + var altMatch = maltMatches[ndx1]; + altMatch.alternation = altMatch.alternation || loopNdxCnt; + for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) { + var altMatch2 = malternateMatches[ndx2]; + if (altMatch.match.def === altMatch2.match.def && ("string" != typeof altIndex || -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr))) { + altMatch.match.mask === altMatch2.match.mask && (maltMatches.splice(ndx1, 1), ndx1--), + -1 === altMatch2.locator[altMatch.alternation].toString().indexOf(altMatch.locator[altMatch.alternation]) && (altMatch2.locator[altMatch.alternation] = altMatch2.locator[altMatch.alternation] + "," + altMatch.locator[altMatch.alternation], + altMatch2.alternation = altMatch.alternation); + break; + } + } + } + malternateMatches = malternateMatches.concat(maltMatches); + } + "string" == typeof altIndex && (malternateMatches = $.map(malternateMatches, function(lmnt, ndx) { + if (isFinite(ndx)) { + var mamatch, alternation = lmnt.alternation, altLocArr = lmnt.locator[alternation].toString().split(","); + lmnt.locator[alternation] = void 0, lmnt.alternation = void 0; + for (var alndx = 0; alndx < altLocArr.length; alndx++) mamatch = -1 !== $.inArray(altLocArr[alndx], altIndexArr), + mamatch && (void 0 !== lmnt.locator[alternation] ? (lmnt.locator[alternation] += ",", + lmnt.locator[alternation] += altLocArr[alndx]) : lmnt.locator[alternation] = parseInt(altLocArr[alndx]), + lmnt.alternation = alternation); + if (void 0 !== lmnt.locator[alternation]) return lmnt; + } + })), matches = currentMatches.concat(malternateMatches), testPos = pos, insertStop = matches.length > 0; + } else match = handleMatch(alternateToken.matches[altIndex] || maskToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse); + if (match) return !0; + } else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[$.inArray(match, maskToken.matches) - 1]) for (var qt = match, qndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && pos >= testPos; qndx++) { + var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1]; + if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup)) { + if (latestMatch = matches[matches.length - 1].match, latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1, + isFirstMatch(latestMatch, tokenGroup)) { + if (qndx > qt.quantifier.min - 1) { + insertStop = !0, testPos = pos; + break; + } + return !0; + } + return !0; + } + } else if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) return !0; + } else testPos++; + } + for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (maskToken.matches[tndx].isQuantifier !== !0) { + var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse); + if (match && testPos === pos) return match; + if (testPos > pos) break; + } + } + function mergeLocators(tests) { + var test = tests[0] || tests; + return test.locator.slice(); + } + var latestMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : ""; + if (pos > -1) { + if (void 0 === ndxIntlzr) { + for (var test, previousPos = pos - 1; void 0 === (test = getMaskSet().validPositions[previousPos] || getMaskSet().tests[previousPos]) && previousPos > -1; ) previousPos--; + void 0 !== test && previousPos > -1 && (ndxInitializer = mergeLocators(test), cacheDependency = ndxInitializer.join(""), + test = test[0] || test, testPos = previousPos); + } + if (getMaskSet().tests[pos] && getMaskSet().tests[pos][0].cd === cacheDependency) return getMaskSet().tests[pos]; + for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) { + var match = resolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]); + if (match && testPos === pos || testPos > pos) break; + } + } + return (0 === matches.length || insertStop) && matches.push({ + match: { + fn: null, + cardinality: 0, + optionality: !0, + casing: null, + def: "" + }, + locator: [] + }), getMaskSet().tests[pos] = $.extend(!0, [], matches), getMaskSet().tests[pos]; + } + function getBufferTemplate() { + return void 0 === getMaskSet()._buffer && (getMaskSet()._buffer = getMaskTemplate(!1, 1)), + getMaskSet()._buffer; + } + function getBuffer(noCache) { + if (void 0 === getMaskSet().buffer || noCache === !0) { + if (noCache === !0) for (var testNdx in getMaskSet().tests) void 0 === getMaskSet().validPositions[testNdx] && delete getMaskSet().tests[testNdx]; + getMaskSet().buffer = getMaskTemplate(!0, getLastValidPosition(), !0); + } + return getMaskSet().buffer; + } + function refreshFromBuffer(start, end, buffer) { + var i; + if (buffer = buffer, start === !0) resetMaskSet(), start = 0, end = buffer.length; else for (i = start; end > i; i++) delete getMaskSet().validPositions[i], + delete getMaskSet().tests[i]; + for (i = start; end > i; i++) resetMaskSet(!0), buffer[i] !== opts.skipOptionalPartCharacter && isValid(i, buffer[i], !0, !0); + } + function casing(elem, test) { + switch (test.casing) { + case "upper": + elem = elem.toUpperCase(); + break; + + case "lower": + elem = elem.toLowerCase(); + } + return elem; + } + function checkAlternationMatch(altArr1, altArr2) { + for (var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, alndx = 0; alndx < altArr1.length; alndx++) if (-1 !== $.inArray(altArr1[alndx], altArrC)) { + isMatch = !0; + break; + } + return isMatch; + } + function isValid(pos, c, strict, fromSetValid) { + function isSelection(posObj) { + return isRTL ? posObj.begin - posObj.end > 1 || posObj.begin - posObj.end === 1 && opts.insertMode : posObj.end - posObj.begin > 1 || posObj.end - posObj.begin === 1 && opts.insertMode; + } + function _isValid(position, c, strict, fromSetValid) { + var rslt = !1; + return $.each(getTests(position), function(ndx, tst) { + for (var test = tst.match, loopend = c ? 1 : 0, chrs = "", i = test.cardinality; i > loopend; i--) chrs += getBufferElement(position - (i - 1)); + if (c && (chrs += c), getBuffer(!0), rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts) : c !== test.def && c !== opts.skipOptionalPartCharacter || "" === test.def ? !1 : { + c: test.placeholder || test.def, + pos: position + }, rslt !== !1) { + var elem = void 0 !== rslt.c ? rslt.c : c; + elem = elem === opts.skipOptionalPartCharacter && null === test.fn ? test.placeholder || test.def : elem; + var validatedPos = position, possibleModifiedBuffer = getBuffer(); + if (void 0 !== rslt.remove && ($.isArray(rslt.remove) || (rslt.remove = [ rslt.remove ]), + $.each(rslt.remove.sort(function(a, b) { + return b - a; + }), function(ndx, lmnt) { + stripValidPositions(lmnt, lmnt + 1, !0); + })), void 0 !== rslt.insert && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]), + $.each(rslt.insert.sort(function(a, b) { + return a - b; + }), function(ndx, lmnt) { + isValid(lmnt.pos, lmnt.c, !1, fromSetValid); + })), rslt.refreshFromBuffer) { + var refresh = rslt.refreshFromBuffer; + if (strict = !0, refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end, possibleModifiedBuffer), + void 0 === rslt.pos && void 0 === rslt.c) return rslt.pos = getLastValidPosition(), + !1; + if (validatedPos = void 0 !== rslt.pos ? rslt.pos : position, validatedPos !== position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0, fromSetValid)), + !1; + } else if (rslt !== !0 && void 0 !== rslt.pos && rslt.pos !== position && (validatedPos = rslt.pos, + refreshFromBuffer(position, validatedPos, getBuffer().slice()), validatedPos !== position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)), + !1; + return rslt !== !0 && void 0 === rslt.pos && void 0 === rslt.c ? !1 : (ndx > 0 && resetMaskSet(!0), + setValidPosition(validatedPos, $.extend({}, tst, { + input: casing(elem, test) + }), fromSetValid, isSelection(pos)) || (rslt = !1), !1); + } + }), rslt; + } + function alternate(pos, c, strict, fromSetValid) { + for (var lastAlt, alternation, isValidRslt, altPos, i, validPos, validPsClone = $.extend(!0, {}, getMaskSet().validPositions), testsClone = $.extend(!0, {}, getMaskSet().tests), lAlt = getLastValidPosition(); lAlt >= 0 && (altPos = getMaskSet().validPositions[lAlt], + !altPos || void 0 === altPos.alternation || (lastAlt = lAlt, alternation = getMaskSet().validPositions[lastAlt].alternation, + getTestTemplate(lastAlt).locator[altPos.alternation] === altPos.locator[altPos.alternation])); lAlt--) ; + if (void 0 !== alternation) { + lastAlt = parseInt(lastAlt); + for (var decisionPos in getMaskSet().validPositions) if (decisionPos = parseInt(decisionPos), + altPos = getMaskSet().validPositions[decisionPos], decisionPos >= lastAlt && void 0 !== altPos.alternation) { + var altNdxs; + 0 === lastAlt ? (altNdxs = [], $.each(getMaskSet().tests[lastAlt], function(ndx, test) { + void 0 !== test.locator[alternation] && (altNdxs = altNdxs.concat(test.locator[alternation].toString().split(","))); + })) : altNdxs = getMaskSet().validPositions[lastAlt].locator[alternation].toString().split(","); + var decisionTaker = void 0 !== altPos.locator[alternation] ? altPos.locator[alternation] : altNdxs[0]; + decisionTaker.length > 0 && (decisionTaker = decisionTaker.split(",")[0]); + for (var mndx = 0; mndx < altNdxs.length; mndx++) { + var validInputs = [], staticInputsBeforePos = 0, staticInputsBeforePosAlternate = 0; + if (decisionTaker < altNdxs[mndx]) { + for (var possibilityPos, possibilities, dp = decisionPos; dp >= 0; dp--) if (possibilityPos = getMaskSet().validPositions[dp], + void 0 !== possibilityPos) { + var bestMatch = selectBestMatch(dp, altNdxs[mndx]); + getMaskSet().validPositions[dp].match.def !== bestMatch.match.def && (validInputs.push(getMaskSet().validPositions[dp].input), + getMaskSet().validPositions[dp] = bestMatch, getMaskSet().validPositions[dp].input = getPlaceholder(dp), + null === getMaskSet().validPositions[dp].match.fn && staticInputsBeforePosAlternate++, + possibilityPos = bestMatch), possibilities = possibilityPos.locator[alternation], + possibilityPos.locator[alternation] = parseInt(altNdxs[mndx]); + break; + } + if (decisionTaker !== possibilityPos.locator[alternation]) { + for (i = decisionPos + 1; i < getLastValidPosition(void 0, !0) + 1; i++) validPos = getMaskSet().validPositions[i], + validPos && null != validPos.match.fn ? validInputs.push(validPos.input) : pos > i && staticInputsBeforePos++, + delete getMaskSet().validPositions[i], delete getMaskSet().tests[i]; + for (resetMaskSet(!0), opts.keepStatic = !opts.keepStatic, isValidRslt = !0; validInputs.length > 0; ) { + var input = validInputs.shift(); + if (input !== opts.skipOptionalPartCharacter && !(isValidRslt = isValid(getLastValidPosition(void 0, !0) + 1, input, !1, fromSetValid))) break; + } + if (possibilityPos.alternation = alternation, possibilityPos.locator[alternation] = possibilities, + isValidRslt) { + var targetLvp = getLastValidPosition(pos) + 1; + for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) validPos = getMaskSet().validPositions[i], + (void 0 === validPos || null == validPos.match.fn) && pos > i && staticInputsBeforePosAlternate++; + pos += staticInputsBeforePosAlternate - staticInputsBeforePos, isValidRslt = isValid(pos > targetLvp ? targetLvp : pos, c, strict, fromSetValid); + } + if (opts.keepStatic = !opts.keepStatic, isValidRslt) return isValidRslt; + resetMaskSet(), getMaskSet().validPositions = $.extend(!0, {}, validPsClone), getMaskSet().tests = $.extend(!0, {}, testsClone); + } + } + } + break; + } + } + return !1; + } + function trackbackAlternations(originalPos, newPos) { + for (var vp = getMaskSet().validPositions[newPos], targetLocator = vp.locator, tll = targetLocator.length, ps = originalPos; newPos > ps; ps++) if (void 0 === getMaskSet().validPositions[ps] && !isMask(ps, !0)) { + var tests = getTests(ps), bestMatch = tests[0], equality = -1; + $.each(tests, function(ndx, tst) { + for (var i = 0; tll > i && (void 0 !== tst.locator[i] && checkAlternationMatch(tst.locator[i].toString().split(","), targetLocator[i].toString().split(","))); i++) i > equality && (equality = i, + bestMatch = tst); + }), setValidPosition(ps, $.extend({}, bestMatch, { + input: bestMatch.match.placeholder || bestMatch.match.def + }), !0); + } + } + strict = strict === !0; + var maskPos = pos; + void 0 !== pos.begin && (maskPos = isRTL && !isSelection(pos) ? pos.end : pos.begin); + for (var result = !1, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), pndx = maskPos - 1; pndx > -1 && !getMaskSet().validPositions[pndx]; pndx--) ; + pndx++; + for (var testTemplate; maskPos > pndx; pndx++) getBuffer(), void 0 === getMaskSet().validPositions[pndx] && ((testTemplate = getTestTemplate(pndx)).match.def === opts.radixPointDefinitionSymbol || !isMask(pndx, !0) || $.inArray(opts.radixPoint, getBuffer()) < pndx && testTemplate.match.fn && testTemplate.match.fn.test(getPlaceholder(pndx), getMaskSet(), pndx, !1, opts)) && _isValid(pndx, testTemplate.match.placeholder || (null == testTemplate.match.fn ? testTemplate.match.def : getPlaceholder(pndx)), !0, fromSetValid); + if (isSelection(pos) && (handleRemove(void 0, Inputmask.keyCode.DELETE, pos), maskPos = getMaskSet().p), + maskPos < getMaskLength() && (result = _isValid(maskPos, c, strict, fromSetValid), + (!strict || fromSetValid === !0) && result === !1)) { + var currentPosValid = getMaskSet().validPositions[maskPos]; + if (!currentPosValid || null !== currentPosValid.match.fn || currentPosValid.match.def !== c && c !== opts.skipOptionalPartCharacter) { + if ((opts.insertMode || void 0 === getMaskSet().validPositions[seekNext(maskPos)]) && !isMask(maskPos, !0)) { + var staticChar = getTestTemplate(maskPos).match; + staticChar = staticChar.placeholder || staticChar.def, _isValid(maskPos, staticChar, strict, fromSetValid); + for (var nPos = maskPos + 1, snPos = seekNext(maskPos); snPos >= nPos; nPos++) if (result = _isValid(nPos, c, strict, fromSetValid), + result !== !1) { + trackbackAlternations(maskPos, nPos), maskPos = nPos; + break; + } + } + } else result = { + caret: seekNext(maskPos) + }; + } + return result === !1 && opts.keepStatic && (result = alternate(maskPos, c, strict, fromSetValid)), + result === !0 && (result = { + pos: maskPos + }), $.isFunction(opts.postValidation) && result !== !1 && !strict && fromSetValid !== !0 && (result = opts.postValidation(getBuffer(!0), result, opts) ? result : !1), + void 0 === result.pos && (result.pos = maskPos), result === !1 && (resetMaskSet(!0), + getMaskSet().validPositions = $.extend(!0, {}, positionsClone)), result; + } + function isMask(pos, strict) { + var test; + if (strict ? (test = getTestTemplate(pos).match, "" === test.def && (test = getTest(pos))) : test = getTest(pos), + null != test.fn) return test.fn; + if (strict !== !0 && pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) { + var tests = getTests(pos); + return tests.length > 2; + } + return !1; + } + function getMaskLength() { + var maskLength; + maxLength = void 0 !== el ? el.maxLength : void 0, -1 === maxLength && (maxLength = void 0); + var pos, lvp = getLastValidPosition(), testPos = getMaskSet().validPositions[lvp], ndxIntlzr = void 0 !== testPos ? testPos.locator.slice() : void 0; + for (pos = lvp + 1; void 0 === testPos || null !== testPos.match.fn || null === testPos.match.fn && "" !== testPos.match.def; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1), + ndxIntlzr = testPos.locator.slice(); + var lastTest = getTest(pos - 1); + return maskLength = "" !== lastTest.def ? pos : pos - 1, void 0 === maxLength || maxLength > maskLength ? maskLength : maxLength; + } + function seekNext(pos, newBlock) { + var maskL = getMaskLength(); + if (pos >= maskL) return maskL; + for (var position = pos; ++position < maskL && (newBlock === !0 && (getTest(position).newBlockMarker !== !0 || !isMask(position)) || newBlock !== !0 && !isMask(position) && (opts.nojumps !== !0 || opts.nojumpsThreshold > position)); ) ; + return position; + } + function seekPrevious(pos, newBlock) { + var position = pos; + if (0 >= position) return 0; + for (;--position > 0 && (newBlock === !0 && getTest(position).newBlockMarker !== !0 || newBlock !== !0 && !isMask(position)); ) ; + return position; + } + function getBufferElement(position) { + return void 0 === getMaskSet().validPositions[position] ? getPlaceholder(position) : getMaskSet().validPositions[position].input; + } + function writeBuffer(input, buffer, caretPos, event, triggerInputEvent) { + if (event && $.isFunction(opts.onBeforeWrite)) { + var result = opts.onBeforeWrite(event, buffer, caretPos, opts); + if (result) { + if (result.refreshFromBuffer) { + var refresh = result.refreshFromBuffer; + refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end, result.buffer || buffer), + buffer = getBuffer(!0); + } + void 0 !== caretPos && (caretPos = void 0 !== result.caret ? result.caret : caretPos); + } + } + input.inputmask._valueSet(buffer.join("")), void 0 === caretPos || void 0 !== event && "blur" === event.type || caret(input, caretPos), + triggerInputEvent === !0 && (skipInputEvent = !0, $(input).trigger("input")); + } + function getPlaceholder(pos, test) { + if (test = test || getTest(pos), void 0 !== test.placeholder) return test.placeholder; + if (null === test.fn) { + if (pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) { + var prevTest, tests = getTests(pos), staticAlternations = 0; + if (tests.length > 2) for (var i = 0; i < tests.length; i++) if (tests[i].match.optionality !== !0 && tests[i].match.optionalQuantifier !== !0 && (null === tests[i].match.fn || void 0 === prevTest || tests[i].match.fn.test(prevTest.match.def, getMaskSet(), pos, !0, opts) !== !1) && (staticAlternations++, + null === tests[i].match.fn && (prevTest = tests[i]), staticAlternations > 1)) return opts.placeholder.charAt(pos % opts.placeholder.length); + } + return test.def; + } + return opts.placeholder.charAt(pos % opts.placeholder.length); + } + function checkVal(input, writeOut, strict, nptvl) { + function isTemplateMatch() { + var isMatch = !1, charCodeNdx = getBufferTemplate().slice(initialNdx, seekNext(initialNdx)).join("").indexOf(charCodes); + if (-1 !== charCodeNdx && !isMask(initialNdx)) { + isMatch = !0; + for (var bufferTemplateArr = getBufferTemplate().slice(initialNdx, initialNdx + charCodeNdx), i = 0; i < bufferTemplateArr.length; i++) if (" " !== bufferTemplateArr[i]) { + isMatch = !1; + break; + } + } + return isMatch; + } + var inputValue = nptvl.slice(), charCodes = "", initialNdx = 0; + if (resetMaskSet(), getMaskSet().p = seekNext(-1), !strict) if (opts.autoUnmask !== !0) { + var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""), matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g")); + matches && matches.length > 0 && (inputValue.splice(0, matches.length * staticInput.length), + initialNdx = seekNext(initialNdx)); + } else initialNdx = seekNext(initialNdx); + $.each(inputValue, function(ndx, charCode) { + if (void 0 !== charCode) { + var keypress = new $.Event("keypress"); + keypress.which = charCode.charCodeAt(0), charCodes += charCode; + var lvp = getLastValidPosition(void 0, !0), lvTest = getMaskSet().validPositions[lvp], nextTest = getTestTemplate(lvp + 1, lvTest ? lvTest.locator.slice() : void 0, lvp); + if (!isTemplateMatch() || strict || opts.autoUnmask) { + var pos = strict ? ndx : null == nextTest.match.fn && nextTest.match.optionality && lvp + 1 < getMaskSet().p ? lvp + 1 : getMaskSet().p; + keypressEvent.call(input, keypress, !0, !1, strict, pos), initialNdx = pos + 1, + charCodes = ""; + } else keypressEvent.call(input, keypress, !0, !1, !0, lvp + 1); + } + }), writeOut && writeBuffer(input, getBuffer(), document.activeElement === input ? seekNext(getLastValidPosition(0)) : void 0, new $.Event("checkval")); + } + function unmaskedvalue(input) { + if (input && void 0 === input.inputmask) return input.value; + var umValue = [], vps = getMaskSet().validPositions; + for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input); + var unmaskedValue = 0 === umValue.length ? null : (isRTL ? umValue.reverse() : umValue).join(""); + if (null !== unmaskedValue) { + var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join(""); + $.isFunction(opts.onUnMask) && (unmaskedValue = opts.onUnMask(bufferValue, unmaskedValue, opts) || unmaskedValue); + } + return unmaskedValue; + } + function caret(input, begin, end, notranslate) { + function translatePosition(pos) { + if (notranslate !== !0 && isRTL && "number" == typeof pos && (!opts.greedy || "" !== opts.placeholder)) { + var bffrLght = getBuffer().join("").length; + pos = bffrLght - pos; + } + return pos; + } + var range; + if ("number" != typeof begin) return input.setSelectionRange ? (begin = input.selectionStart, + end = input.selectionEnd) : window.getSelection ? (range = window.getSelection().getRangeAt(0), + (range.commonAncestorContainer.parentNode === input || range.commonAncestorContainer === input) && (begin = range.startOffset, + end = range.endOffset)) : document.selection && document.selection.createRange && (range = document.selection.createRange(), + begin = 0 - range.duplicate().moveStart("character", -input.inputmask._valueGet().length), + end = begin + range.text.length), { + begin: translatePosition(begin), + end: translatePosition(end) + }; + begin = translatePosition(begin), end = translatePosition(end), end = "number" == typeof end ? end : begin; + var scrollCalc = parseInt(((input.ownerDocument.defaultView || window).getComputedStyle ? (input.ownerDocument.defaultView || window).getComputedStyle(input, null) : input.currentStyle).fontSize) * end; + if (input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0, mobile || opts.insertMode !== !1 || begin !== end || end++, + input.setSelectionRange) input.selectionStart = begin, input.selectionEnd = end; else if (window.getSelection) { + if (range = document.createRange(), void 0 === input.firstChild || null === input.firstChild) { + var textNode = document.createTextNode(""); + input.appendChild(textNode); + } + range.setStart(input.firstChild, begin < input.inputmask._valueGet().length ? begin : input.inputmask._valueGet().length), + range.setEnd(input.firstChild, end < input.inputmask._valueGet().length ? end : input.inputmask._valueGet().length), + range.collapse(!0); + var sel = window.getSelection(); + sel.removeAllRanges(), sel.addRange(range); + } else input.createTextRange && (range = input.createTextRange(), range.collapse(!0), + range.moveEnd("character", end), range.moveStart("character", begin), range.select()); + } + function determineLastRequiredPosition(returnDefinition) { + var pos, testPos, buffer = getBuffer(), bl = buffer.length, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = void 0 !== lvTest ? lvTest.locator.slice() : void 0; + for (pos = lvp + 1; pos < buffer.length; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1), + ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos); + var lvTestAlt = lvTest && void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation] : void 0; + for (pos = bl - 1; pos > lvp && (testPos = positions[pos], (testPos.match.optionality || testPos.match.optionalQuantifier || lvTestAlt && (lvTestAlt !== positions[pos].locator[lvTest.alternation] && null != testPos.match.fn || null === testPos.match.fn && testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAlt.toString().split(",")) && "" !== getTests(pos)[0].def)) && buffer[pos] === getPlaceholder(pos, testPos.match)); pos--) bl--; + return returnDefinition ? { + l: bl, + def: positions[bl] ? positions[bl].match : void 0 + } : bl; + } + function clearOptionalTail(buffer) { + for (var rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ; + return buffer.splice(rl, lmib + 1 - rl), buffer; + } + function isComplete(buffer) { + if ($.isFunction(opts.isComplete)) return opts.isComplete(buffer, opts); + if ("*" === opts.repeat) return void 0; + var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l); + if (void 0 === lrp.def || lrp.def.newBlockMarker || lrp.def.optionality || lrp.def.optionalQuantifier) { + complete = !0; + for (var i = 0; aml >= i; i++) { + var test = getTestTemplate(i).match; + if (null !== test.fn && void 0 === getMaskSet().validPositions[i] && test.optionality !== !0 && test.optionalQuantifier !== !0 || null === test.fn && buffer[i] !== getPlaceholder(i, test)) { + complete = !1; + break; + } + } + } + return complete; + } + function patchValueProperty(npt) { + function patchValhook(type) { + if ($.valHooks && (void 0 === $.valHooks[type] || $.valHooks[type].inputmaskpatch !== !0)) { + var valhookGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) { + return elem.value; + }, valhookSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) { + return elem.value = value, elem; + }; + $.valHooks[type] = { + get: function(elem) { + if (elem.inputmask) { + if (elem.inputmask.opts.autoUnmask) return elem.inputmask.unmaskedvalue(); + var result = valhookGet(elem), maskset = elem.inputmask.maskset, bufferTemplate = maskset._buffer; + return bufferTemplate = bufferTemplate ? bufferTemplate.join("") : "", result !== bufferTemplate ? result : ""; + } + return valhookGet(elem); + }, + set: function(elem, value) { + var result, $elem = $(elem); + return result = valhookSet(elem, value), elem.inputmask && $elem.trigger("setvalue"), + result; + }, + inputmaskpatch: !0 + }; + } + } + function getter() { + return this.inputmask ? this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : valueGet.call(this) !== getBufferTemplate().join("") ? document.activeElement === this && opts.clearMaskOnLostFocus ? (isRTL ? clearOptionalTail(getBuffer().slice()).reverse() : clearOptionalTail(getBuffer().slice())).join("") : valueGet.call(this) : "" : valueGet.call(this); + } + function setter(value) { + valueSet.call(this, value), this.inputmask && $(this).trigger("setvalue"); + } + function installNativeValueSetFallback(npt) { + EventRuler.on(npt, "mouseenter", function(event) { + var $input = $(this), input = this, value = input.inputmask._valueGet(); + value !== getBuffer().join("") && $input.trigger("setvalue"); + }); + } + var valueGet, valueSet; + if (!npt.inputmask.__valueGet) { + if (Object.getOwnPropertyDescriptor) { + var valueProperty = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(npt), "value"); + valueProperty && valueProperty.get && valueProperty.set ? (valueGet = valueProperty.get, + valueSet = valueProperty.set, Object.defineProperty(npt, "value", { + get: getter, + set: setter, + configurable: !0 + })) : "INPUT" !== npt.tagName && (valueGet = function() { + return this.textContent; + }, valueSet = function(value) { + this.textContent = value; + }, Object.defineProperty(npt, "value", { + get: getter, + set: setter, + configurable: !0 + })); + } else document.__lookupGetter__ && npt.__lookupGetter__("value") && (valueGet = npt.__lookupGetter__("value"), + valueSet = npt.__lookupSetter__("value"), npt.__defineGetter__("value", getter), + npt.__defineSetter__("value", setter)); + void 0 === valueGet && (valueGet = function() { + return npt.value; + }, valueSet = function(value) { + npt.value = value; + }, patchValhook(npt.type), installNativeValueSetFallback(npt)), npt.inputmask.__valueGet = valueGet, + npt.inputmask._valueGet = function(overruleRTL) { + return isRTL && overruleRTL !== !0 ? valueGet.call(this.el).split("").reverse().join("") : valueGet.call(this.el); + }, npt.inputmask.__valueSet = valueSet, npt.inputmask._valueSet = function(value, overruleRTL) { + valueSet.call(this.el, null === value || void 0 === value ? "" : overruleRTL !== !0 && isRTL ? value.split("").reverse().join("") : value); + }; + } + } + function handleRemove(input, k, pos, strict) { + function generalize() { + if (opts.keepStatic) { + resetMaskSet(!0); + var lastAlt, validInputs = [], positionsClone = $.extend(!0, {}, getMaskSet().validPositions); + for (lastAlt = getLastValidPosition(); lastAlt >= 0; lastAlt--) { + var validPos = getMaskSet().validPositions[lastAlt]; + if (validPos && (null != validPos.match.fn && validInputs.push(validPos.input), + delete getMaskSet().validPositions[lastAlt], void 0 !== validPos.alternation && validPos.locator[validPos.alternation] === getTestTemplate(lastAlt).locator[validPos.alternation])) break; + } + if (lastAlt > -1) for (;validInputs.length > 0; ) { + getMaskSet().p = seekNext(getLastValidPosition()); + var keypress = new $.Event("keypress"); + keypress.which = validInputs.pop().charCodeAt(0), keypressEvent.call(input, keypress, !0, !1, !1, getMaskSet().p); + } else getMaskSet().validPositions = $.extend(!0, {}, positionsClone); + } + } + if ((opts.numericInput || isRTL) && (k === Inputmask.keyCode.BACKSPACE ? k = Inputmask.keyCode.DELETE : k === Inputmask.keyCode.DELETE && (k = Inputmask.keyCode.BACKSPACE), + isRTL)) { + var pend = pos.end; + pos.end = pos.begin, pos.begin = pend; + } + k === Inputmask.keyCode.BACKSPACE && (pos.end - pos.begin < 1 || opts.insertMode === !1) ? (pos.begin = seekPrevious(pos.begin), + void 0 === getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input !== opts.groupSeparator && getMaskSet().validPositions[pos.begin].input !== opts.radixPoint || pos.begin--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end) ? pos.end + 1 : seekNext(pos.end) + 1, + void 0 === getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input !== opts.groupSeparator && getMaskSet().validPositions[pos.begin].input !== opts.radixPoint || pos.end++), + stripValidPositions(pos.begin, pos.end, !1, strict), strict !== !0 && generalize(); + var lvp = getLastValidPosition(pos.begin); + lvp < pos.begin ? (-1 === lvp && resetMaskSet(), getMaskSet().p = seekNext(lvp)) : strict !== !0 && (getMaskSet().p = pos.begin); + } + function keydownEvent(e) { + var input = this, $input = $(input), k = e.keyCode, pos = caret(input); + if (k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || iphone && k === Inputmask.keyCode.BACKSPACE_SAFARI || e.ctrlKey && k === Inputmask.keyCode.X && !isInputEventSupported("cut")) e.preventDefault(), + handleRemove(input, k, pos), writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")), + input.inputmask._valueGet() === getBufferTemplate().join("") ? $input.trigger("cleared") : isComplete(getBuffer()) === !0 && $input.trigger("complete"), + opts.showTooltip && (input.title = opts.tooltip || getMaskSet().mask); else if (k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN) { + e.preventDefault(); + var caretPos = seekNext(getLastValidPosition()); + opts.insertMode || caretPos !== getMaskLength() || e.shiftKey || caretPos--, caret(input, e.shiftKey ? pos.begin : caretPos, caretPos, !0); + } else k === Inputmask.keyCode.HOME && !e.shiftKey || k === Inputmask.keyCode.PAGE_UP ? (e.preventDefault(), + caret(input, 0, e.shiftKey ? pos.begin : 0, !0)) : (opts.undoOnEscape && k === Inputmask.keyCode.ESCAPE || 90 === k && e.ctrlKey) && e.altKey !== !0 ? (checkVal(input, !0, !1, undoValue.split("")), + $input.trigger("click")) : k !== Inputmask.keyCode.INSERT || e.shiftKey || e.ctrlKey ? opts.tabThrough === !0 && k === Inputmask.keyCode.TAB ? (e.shiftKey === !0 ? (null === getTest(pos.begin).fn && (pos.begin = seekNext(pos.begin)), + pos.end = seekPrevious(pos.begin, !0), pos.begin = seekPrevious(pos.end, !0)) : (pos.begin = seekNext(pos.begin, !0), + pos.end = seekNext(pos.begin, !0), pos.end < getMaskLength() && pos.end--), pos.begin < getMaskLength() && (e.preventDefault(), + caret(input, pos.begin, pos.end))) : opts.insertMode !== !1 || e.shiftKey || (k === Inputmask.keyCode.RIGHT ? setTimeout(function() { + var caretPos = caret(input); + caret(input, caretPos.begin); + }, 0) : k === Inputmask.keyCode.LEFT && setTimeout(function() { + var caretPos = caret(input); + caret(input, isRTL ? caretPos.begin + 1 : caretPos.begin - 1); + }, 0)) : (opts.insertMode = !opts.insertMode, caret(input, opts.insertMode || pos.begin !== getMaskLength() ? pos.begin : pos.begin - 1)); + opts.onKeyDown.call(this, e, getBuffer(), caret(input).begin, opts), ignorable = -1 !== $.inArray(k, opts.ignorables); + } + function keypressEvent(e, checkval, writeOut, strict, ndx) { + var input = this, $input = $(input), k = e.which || e.charCode || e.keyCode; + if (!(checkval === !0 || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) return k === Inputmask.keyCode.ENTER && undoValue !== getBuffer().join("") && (undoValue = getBuffer().join(""), + setTimeout(function() { + $input.trigger("change"); + }, 0)), !0; + if (k) { + 46 === k && e.shiftKey === !1 && "," === opts.radixPoint && (k = 44); + var forwardPosition, pos = checkval ? { + begin: ndx, + end: ndx + } : caret(input), c = String.fromCharCode(k); + getMaskSet().writeOutBuffer = !0; + var valResult = isValid(pos, c, strict); + if (valResult !== !1) { + var p = valResult.pos; + if (resetMaskSet(!0), void 0 !== valResult.caret) forwardPosition = valResult.caret; else { + var vps = getMaskSet().validPositions; + forwardPosition = !opts.keepStatic && (void 0 !== vps[p + 1] && getTests(p + 1, vps[p].locator.slice(), p).length > 1 || void 0 !== vps[p].alternation) ? p + 1 : seekNext(p); + } + getMaskSet().p = forwardPosition; + } + if (writeOut !== !1) { + var self = this; + if (setTimeout(function() { + opts.onKeyValidation.call(self, k, valResult, opts); + }, 0), getMaskSet().writeOutBuffer && valResult !== !1) { + var buffer = getBuffer(); + writeBuffer(input, buffer, opts.numericInput && void 0 === valResult.caret ? seekPrevious(forwardPosition) : forwardPosition, e, checkval !== !0), + checkval !== !0 && setTimeout(function() { + isComplete(buffer) === !0 && $input.trigger("complete"); + }, 0); + } + } + if (opts.showTooltip && (input.title = opts.tooltip || getMaskSet().mask), checkval && $.isFunction(opts.onBeforeWrite)) { + var result = opts.onBeforeWrite(e, getBuffer(), forwardPosition, opts); + if (result && result.refreshFromBuffer) { + var refresh = result.refreshFromBuffer; + refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end, result.buffer), + resetMaskSet(!0), result.caret && (getMaskSet().p = result.caret); + } + } + if (e.preventDefault(), checkval) return valResult; + } + } + function pasteEvent(e) { + var tempValue, input = this, ev = e.originalEvent || e, $input = $(input), inputValue = input.inputmask._valueGet(!0), caretPos = caret(input); + isRTL && (tempValue = caretPos.end, caretPos.end = caretPos.begin, caretPos.begin = tempValue); + var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length); + valueBeforeCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""), + valueAfterCaret === (isRTL ? getBufferTemplate().reverse() : getBufferTemplate()).slice(caretPos.end).join("") && (valueAfterCaret = ""), + isRTL && (tempValue = valueBeforeCaret, valueBeforeCaret = valueAfterCaret, valueAfterCaret = tempValue), + window.clipboardData && window.clipboardData.getData ? inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret : ev.clipboardData && ev.clipboardData.getData && (inputValue = valueBeforeCaret + ev.clipboardData.getData("text/plain") + valueAfterCaret); + var pasteValue = inputValue; + if ($.isFunction(opts.onBeforePaste)) { + if (pasteValue = opts.onBeforePaste(inputValue, opts), pasteValue === !1) return e.preventDefault(); + pasteValue || (pasteValue = inputValue); + } + return checkVal(input, !1, !1, isRTL ? pasteValue.split("").reverse() : pasteValue.toString().split("")), + writeBuffer(input, getBuffer(), seekNext(getLastValidPosition()), e, !0), isComplete(getBuffer()) === !0 && $input.trigger("complete"), + e.preventDefault(); + } + function inputFallBackEvent(e) { + var input = this, inputValue = input.inputmask._valueGet(); + if (getBuffer().join("") !== inputValue) { + var caretPos = caret(input); + if (inputValue = inputValue.replace(new RegExp("(" + Inputmask.escapeRegex(getBufferTemplate().join("")) + ")*"), ""), + iemobile) { + var inputChar = inputValue.replace(getBuffer().join(""), ""); + if (1 === inputChar.length) { + var keypress = new $.Event("keypress"); + return keypress.which = inputChar.charCodeAt(0), keypressEvent.call(input, keypress, !0, !0, !1, getMaskSet().validPositions[caretPos.begin - 1] ? caretPos.begin : caretPos.begin - 1), + !1; + } + } + if (caretPos.begin > inputValue.length && (caret(input, inputValue.length), caretPos = caret(input)), + getBuffer().length - inputValue.length !== 1 || inputValue.charAt(caretPos.begin) === getBuffer()[caretPos.begin] || inputValue.charAt(caretPos.begin + 1) === getBuffer()[caretPos.begin] || isMask(caretPos.begin)) { + for (var lvp = getLastValidPosition() + 1, bufferTemplate = getBuffer().slice(lvp).join(""); null === inputValue.match(Inputmask.escapeRegex(bufferTemplate) + "$"); ) bufferTemplate = bufferTemplate.slice(1); + inputValue = inputValue.replace(bufferTemplate, ""), inputValue = inputValue.split(""), + checkVal(input, !0, !1, inputValue), isComplete(getBuffer()) === !0 && $(input).trigger("complete"); + } else e.keyCode = Inputmask.keyCode.BACKSPACE, keydownEvent.call(input, e); + e.preventDefault(); + } + } + function setValueEvent(e) { + var input = this, value = input.inputmask._valueGet(); + checkVal(input, !0, !1, ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(value, opts) || value : value).split("")), + undoValue = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("") && input.inputmask._valueSet(""); + } + function focusEvent(e) { + var input = this, nptValue = input.inputmask._valueGet(); + opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" === nptValue) ? input.inputmask._valueGet() !== getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) : mouseEnter === !1 && caret(input, seekNext(getLastValidPosition())), + opts.positionCaretOnTab === !0 && setTimeout(function() { + caret(input, seekNext(getLastValidPosition())); + }, 0), undoValue = getBuffer().join(""); + } + function mouseleaveEvent(e) { + var input = this; + if (mouseEnter = !1, opts.clearMaskOnLostFocus && document.activeElement !== input) { + var buffer = getBuffer().slice(), nptValue = input.inputmask._valueGet(); + nptValue !== input.getAttribute("placeholder") && "" !== nptValue && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer), + writeBuffer(input, buffer)); + } + } + function clickEvent(e) { + function doRadixFocus(clickPos) { + if (opts.radixFocus && "" !== opts.radixPoint) { + var vps = getMaskSet().validPositions; + if (void 0 === vps[clickPos] || vps[clickPos].input === getPlaceholder(clickPos)) { + if (clickPos < seekNext(-1)) return !0; + var radixPos = $.inArray(opts.radixPoint, getBuffer()); + if (-1 !== radixPos) { + for (var vp in vps) if (vp > radixPos && vps[vp].input !== getPlaceholder(vp)) return !1; + return !0; + } + } + } + return !1; + } + var input = this; + if (document.activeElement === input) { + var selectedCaret = caret(input); + if (selectedCaret.begin === selectedCaret.end) if (doRadixFocus(selectedCaret.begin)) caret(input, opts.numericInput ? seekNext($.inArray(opts.radixPoint, getBuffer())) : $.inArray(opts.radixPoint, getBuffer())); else { + var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition, !0), lastPosition = seekNext(lvclickPosition); + lastPosition > clickPosition ? caret(input, isMask(clickPosition) || isMask(clickPosition - 1) ? clickPosition : seekNext(clickPosition)) : ((getBuffer()[lastPosition] !== getPlaceholder(lastPosition) || !isMask(lastPosition, !0) && getTest(lastPosition).def === getPlaceholder(lastPosition)) && (lastPosition = seekNext(lastPosition)), + caret(input, lastPosition)); + } + } + } + function dblclickEvent(e) { + var input = this; + setTimeout(function() { + caret(input, 0, seekNext(getLastValidPosition())); + }, 0); + } + function cutEvent(e) { + var input = this, $input = $(input), pos = caret(input), ev = e.originalEvent || e, clipboardData = window.clipboardData || ev.clipboardData, clipData = isRTL ? getBuffer().slice(pos.end, pos.begin) : getBuffer().slice(pos.begin, pos.end); + clipboardData.setData("text", isRTL ? clipData.reverse().join("") : clipData.join("")), + document.execCommand && document.execCommand("copy"), handleRemove(input, Inputmask.keyCode.DELETE, pos), + writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")), + input.inputmask._valueGet() === getBufferTemplate().join("") && $input.trigger("cleared"), + opts.showTooltip && (input.title = opts.tooltip || getMaskSet().mask); + } + function blurEvent(e) { + var $input = $(this), input = this; + if (input.inputmask) { + var nptValue = input.inputmask._valueGet(), buffer = getBuffer().slice(); + undoValue !== buffer.join("") && setTimeout(function() { + $input.trigger("change"), undoValue = buffer.join(""); + }, 0), "" !== nptValue && (opts.clearMaskOnLostFocus && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)), + isComplete(buffer) === !1 && (setTimeout(function() { + $input.trigger("incomplete"); + }, 0), opts.clearIncomplete && (resetMaskSet(), buffer = opts.clearMaskOnLostFocus ? [] : getBufferTemplate().slice())), + writeBuffer(input, buffer, void 0, e)); + } + } + function mouseenterEvent(e) { + var input = this; + mouseEnter = !0, document.activeElement !== input && opts.showMaskOnHover && input.inputmask._valueGet() !== getBuffer().join("") && writeBuffer(input, getBuffer()); + } + function submitEvent(e) { + undoValue !== getBuffer().join("") && $el.trigger("change"), opts.clearMaskOnLostFocus && -1 === getLastValidPosition() && el.inputmask._valueGet && el.inputmask._valueGet() === getBufferTemplate().join("") && el.inputmask._valueSet(""), + opts.removeMaskOnSubmit && (el.inputmask._valueSet(el.inputmask.unmaskedvalue(), !0), + setTimeout(function() { + writeBuffer(el, getBuffer()); + }, 0)); + } + function resetEvent(e) { + setTimeout(function() { + $el.trigger("setvalue"); + }, 0); + } + function mask(elem) { + if (el = elem, $el = $(el), opts.showTooltip && (el.title = opts.tooltip || getMaskSet().mask), + ("rtl" === el.dir || opts.rightAlign) && (el.style.textAlign = "right"), ("rtl" === el.dir || opts.numericInput) && (el.dir = "ltr", + el.removeAttribute("dir"), el.inputmask.isRTL = !0, isRTL = !0), EventRuler.off(el), + patchValueProperty(el), isElementTypeSupported(el, opts) && (EventRuler.on(el, "submit", submitEvent), + EventRuler.on(el, "reset", resetEvent), EventRuler.on(el, "mouseenter", mouseenterEvent), + EventRuler.on(el, "blur", blurEvent), EventRuler.on(el, "focus", focusEvent), EventRuler.on(el, "mouseleave", mouseleaveEvent), + EventRuler.on(el, "click", clickEvent), EventRuler.on(el, "dblclick", dblclickEvent), + EventRuler.on(el, "paste", pasteEvent), EventRuler.on(el, "dragdrop", pasteEvent), + EventRuler.on(el, "drop", pasteEvent), EventRuler.on(el, "cut", cutEvent), EventRuler.on(el, "complete", opts.oncomplete), + EventRuler.on(el, "incomplete", opts.onincomplete), EventRuler.on(el, "cleared", opts.oncleared), + EventRuler.on(el, "keydown", keydownEvent), EventRuler.on(el, "keypress", keypressEvent), + EventRuler.on(el, "input", inputFallBackEvent)), EventRuler.on(el, "setvalue", setValueEvent), + "" !== el.inputmask._valueGet() || opts.clearMaskOnLostFocus === !1 || document.activeElement === el) { + var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(el.inputmask._valueGet(), opts) || el.inputmask._valueGet() : el.inputmask._valueGet(); + checkVal(el, !0, !1, initialValue.split("")); + var buffer = getBuffer().slice(); + undoValue = buffer.join(""), isComplete(buffer) === !1 && opts.clearIncomplete && resetMaskSet(), + opts.clearMaskOnLostFocus && document.activeElement !== el && (buffer.join("") === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)), + writeBuffer(el, buffer), document.activeElement === el && caret(el, seekNext(getLastValidPosition())); + } + } + var undoValue, el, $el, maxLength, valueBuffer, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !0, EventRuler = { + on: function(input, eventName, eventHandler) { + var ev = function(e) { + if (void 0 === this.inputmask && "FORM" !== this.nodeName) { + var imOpts = $.data(this, "_inputmask_opts"); + imOpts ? new Inputmask(imOpts).mask(this) : EventRuler.off(this); + } else { + if ("setvalue" === e.type || !(this.disabled || this.readOnly && !("keydown" === e.type && e.ctrlKey && 67 === e.keyCode || opts.tabThrough === !1 && e.keyCode === Inputmask.keyCode.TAB))) { + switch (e.type) { + case "input": + if (skipInputEvent === !0) return skipInputEvent = !1, e.preventDefault(); + break; + + case "keydown": + skipKeyPressEvent = !1, skipInputEvent = !1; + break; + + case "keypress": + if (skipKeyPressEvent === !0) return e.preventDefault(); + skipKeyPressEvent = !0; + break; + + case "click": + if (iemobile) { + var that = this; + return setTimeout(function() { + eventHandler.apply(that, arguments); + }, 0), !1; + } + } + var returnVal = eventHandler.apply(this, arguments); + return returnVal === !1 && (e.preventDefault(), e.stopPropagation()), returnVal; + } + e.preventDefault(); + } + }; + input.inputmask.events[eventName] = input.inputmask.events[eventName] || [], input.inputmask.events[eventName].push(ev), + -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null != input.form && $(input.form).on(eventName, ev) : $(input).on(eventName, ev); + }, + off: function(input, event) { + if (input.inputmask && input.inputmask.events) { + var events; + event ? (events = [], events[event] = input.inputmask.events[event]) : events = input.inputmask.events, + $.each(events, function(eventName, evArr) { + for (;evArr.length > 0; ) { + var ev = evArr.pop(); + -1 !== $.inArray(eventName, [ "submit", "reset" ]) ? null != input.form && $(input.form).off(eventName, ev) : $(input).off(eventName, ev); + } + delete input.inputmask.events[eventName]; + }); + } + } + }; + if (void 0 !== actionObj) switch (actionObj.action) { + case "isComplete": + return el = actionObj.el, isComplete(getBuffer()); + + case "unmaskedvalue": + return el = actionObj.el, void 0 !== el && void 0 !== el.inputmask ? (maskset = el.inputmask.maskset, + opts = el.inputmask.opts, isRTL = el.inputmask.isRTL) : (valueBuffer = actionObj.value, + opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(valueBuffer, opts) || valueBuffer : valueBuffer).split(""), + checkVal(void 0, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite(void 0, getBuffer(), 0, opts)), + unmaskedvalue(el); + + case "mask": + el = actionObj.el, maskset = el.inputmask.maskset, opts = el.inputmask.opts, isRTL = el.inputmask.isRTL, + undoValue = getBuffer().join(""), mask(el); + break; + + case "format": + return opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(actionObj.value, opts) || actionObj.value : actionObj.value).split(""), + checkVal(void 0, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite(void 0, getBuffer(), 0, opts), + actionObj.metadata ? { + value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""), + metadata: maskScope({ + action: "getmetadata" + }, maskset, opts) + } : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""); + + case "isValid": + opts.numericInput && (isRTL = !0), actionObj.value ? (valueBuffer = actionObj.value.split(""), + checkVal(void 0, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer)) : actionObj.value = getBuffer().join(""); + for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ; + return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value === getBuffer().join(""); + + case "getemptymask": + return getBufferTemplate().join(""); + + case "remove": + el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts, + el.inputmask._valueSet(unmaskedvalue(el)), EventRuler.off(el); + var valueProperty; + Object.getOwnPropertyDescriptor ? (valueProperty = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), "value"), + valueProperty && el.inputmask.__valueGet && Object.defineProperty(el, "value", { + get: el.inputmask.__valueGet, + set: el.inputmask.__valueSet, + configurable: !0 + })) : document.__lookupGetter__ && el.__lookupGetter__("value") && el.inputmask.__valueGet && (el.__defineGetter__("value", el.inputmask.__valueGet), + el.__defineSetter__("value", el.inputmask.__valueSet)), el.inputmask = void 0; + break; + + case "getmetadata": + if ($.isArray(maskset.metadata)) { + for (var alternation, lvp = getLastValidPosition(void 0, !0), firstAlt = lvp; firstAlt >= 0; firstAlt--) if (getMaskSet().validPositions[firstAlt] && void 0 !== getMaskSet().validPositions[firstAlt].alternation) { + alternation = getMaskSet().validPositions[firstAlt].alternation; + break; + } + return void 0 !== alternation ? maskset.metadata[getMaskSet().validPositions[firstAlt].locator[alternation]] : []; + } + return maskset.metadata; + } + } + Inputmask.prototype = { + defaults: { + placeholder: "_", + optionalmarker: { + start: "[", + end: "]" + }, + quantifiermarker: { + start: "{", + end: "}" + }, + groupmarker: { + start: "(", + end: ")" + }, + alternatormarker: "|", + escapeChar: "\\", + mask: null, + oncomplete: $.noop, + onincomplete: $.noop, + oncleared: $.noop, + repeat: 0, + greedy: !0, + autoUnmask: !1, + removeMaskOnSubmit: !1, + clearMaskOnLostFocus: !0, + insertMode: !0, + clearIncomplete: !1, + aliases: {}, + alias: null, + onKeyDown: $.noop, + onBeforeMask: null, + onBeforePaste: function(pastedValue, opts) { + return $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(pastedValue, opts) : pastedValue; + }, + onBeforeWrite: null, + onUnMask: null, + showMaskOnFocus: !0, + showMaskOnHover: !0, + onKeyValidation: $.noop, + skipOptionalPartCharacter: " ", + showTooltip: !1, + tooltip: void 0, + numericInput: !1, + rightAlign: !1, + undoOnEscape: !0, + radixPoint: "", + radixPointDefinitionSymbol: void 0, + groupSeparator: "", + radixFocus: !1, + nojumps: !1, + nojumpsThreshold: 0, + keepStatic: null, + positionCaretOnTab: !1, + tabThrough: !1, + supportsInputType: [ "text", "tel", "password" ], + definitions: { + "9": { + validator: "[0-9]", + cardinality: 1, + definitionSymbol: "*" + }, + a: { + validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", + cardinality: 1, + definitionSymbol: "*" + }, + "*": { + validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", + cardinality: 1 + } + }, + ignorables: [ 8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123 ], + isComplete: null, + canClearPosition: $.noop, + postValidation: null, + staticDefinitionSymbol: void 0, + jitMasking: !1 + }, + masksCache: {}, + mask: function(elems) { + var that = this; + return "string" == typeof elems && (elems = document.getElementById(elems) || document.querySelectorAll(elems)), + elems = elems.nodeName ? [ elems ] : elems, $.each(elems, function(ndx, el) { + var scopedOpts = $.extend(!0, {}, that.opts); + importAttributeOptions(el, scopedOpts, $.extend(!0, {}, that.userOptions)); + var maskset = generateMaskSet(scopedOpts, that.noMasksCache); + void 0 !== maskset && (void 0 !== el.inputmask && el.inputmask.remove(), el.inputmask = new Inputmask(), + el.inputmask.opts = scopedOpts, el.inputmask.noMasksCache = that.noMasksCache, el.inputmask.userOptions = $.extend(!0, {}, that.userOptions), + el.inputmask.el = el, el.inputmask.maskset = maskset, el.inputmask.isRTL = !1, $.data(el, "_inputmask_opts", scopedOpts), + maskScope({ + action: "mask", + el: el + })); + }), elems && elems[0] ? elems[0].inputmask || this : this; + }, + option: function(options) { + return "string" == typeof options ? this.opts[options] : "object" == typeof options ? ($.extend(this.opts, options), + $.extend(this.userOptions, options), this.el && (void 0 !== options.mask || void 0 !== options.alias ? this.mask(this.el) : ($.data(this.el, "_inputmask_opts", this.opts), + maskScope({ + action: "mask", + el: this.el + }))), this) : void 0; + }, + unmaskedvalue: function(value) { + return maskScope({ + action: "unmaskedvalue", + el: this.el, + value: value + }, this.el && this.el.inputmask ? this.el.inputmask.maskset : generateMaskSet(this.opts, this.noMasksCache), this.opts); + }, + remove: function() { + return this.el ? (maskScope({ + action: "remove", + el: this.el + }), this.el.inputmask = void 0, this.el) : void 0; + }, + getemptymask: function() { + return maskScope({ + action: "getemptymask" + }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts); + }, + hasMaskedValue: function() { + return !this.opts.autoUnmask; + }, + isComplete: function() { + return maskScope({ + action: "isComplete", + el: this.el + }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts); + }, + getmetadata: function() { + return maskScope({ + action: "getmetadata" + }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts); + }, + isValid: function(value) { + return maskScope({ + action: "isValid", + value: value + }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts); + }, + format: function(value, metadata) { + return maskScope({ + action: "format", + value: value, + metadata: metadata + }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts); + } + }, Inputmask.extendDefaults = function(options) { + $.extend(!0, Inputmask.prototype.defaults, options); + }, Inputmask.extendDefinitions = function(definition) { + $.extend(!0, Inputmask.prototype.defaults.definitions, definition); + }, Inputmask.extendAliases = function(alias) { + $.extend(!0, Inputmask.prototype.defaults.aliases, alias); + }, Inputmask.format = function(value, options, metadata) { + return Inputmask(options).format(value, metadata); + }, Inputmask.unmask = function(value, options) { + return Inputmask(options).unmaskedvalue(value); + }, Inputmask.isValid = function(value, options) { + return Inputmask(options).isValid(value); + }, Inputmask.remove = function(elems) { + $.each(elems, function(ndx, el) { + el.inputmask && el.inputmask.remove(); + }); + }, Inputmask.escapeRegex = function(str) { + var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ]; + return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1"); + }, Inputmask.keyCode = { + ALT: 18, + BACKSPACE: 8, + BACKSPACE_SAFARI: 127, + CAPS_LOCK: 20, + COMMA: 188, + COMMAND: 91, + COMMAND_LEFT: 91, + COMMAND_RIGHT: 93, + CONTROL: 17, + DELETE: 46, + DOWN: 40, + END: 35, + ENTER: 13, + ESCAPE: 27, + HOME: 36, + INSERT: 45, + LEFT: 37, + MENU: 93, + NUMPAD_ADD: 107, + NUMPAD_DECIMAL: 110, + NUMPAD_DIVIDE: 111, + NUMPAD_ENTER: 108, + NUMPAD_MULTIPLY: 106, + NUMPAD_SUBTRACT: 109, + PAGE_DOWN: 34, + PAGE_UP: 33, + PERIOD: 190, + RIGHT: 39, + SHIFT: 16, + SPACE: 32, + TAB: 9, + UP: 38, + WINDOWS: 91, + X: 88 + }; + var ua = navigator.userAgent, mobile = /mobile/i.test(ua), iemobile = /iemobile/i.test(ua), iphone = /iphone/i.test(ua) && !iemobile; + /android.*safari.*/i.test(ua) && !iemobile; + return window.Inputmask = Inputmask, Inputmask; +}(jQuery), function($, Inputmask) { + return void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) { + var nptmask, input = this[0]; + if (void 0 === options && (options = {}), "string" == typeof fn) switch (fn) { + case "unmaskedvalue": + return input && input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val(); + + case "remove": + return this.each(function() { + this.inputmask && this.inputmask.remove(); + }); + + case "getemptymask": + return input && input.inputmask ? input.inputmask.getemptymask() : ""; + + case "hasMaskedValue": + return input && input.inputmask ? input.inputmask.hasMaskedValue() : !1; + + case "isComplete": + return input && input.inputmask ? input.inputmask.isComplete() : !0; + + case "getmetadata": + return input && input.inputmask ? input.inputmask.getmetadata() : void 0; + + case "setvalue": + $(input).val(options), input && void 0 !== input.inputmask && $(input).triggerHandler("setvalue"); + break; + + case "option": + if ("string" != typeof options) return this.each(function() { + return void 0 !== this.inputmask ? this.inputmask.option(options) : void 0; + }); + if (input && void 0 !== input.inputmask) return input.inputmask.option(options); + break; + + default: + return options.alias = fn, nptmask = new Inputmask(options), this.each(function() { + nptmask.mask(this); + }); + } else { + if ("object" == typeof fn) return nptmask = new Inputmask(fn), void 0 === fn.mask && void 0 === fn.alias ? this.each(function() { + return void 0 !== this.inputmask ? this.inputmask.option(fn) : void nptmask.mask(this); + }) : this.each(function() { + nptmask.mask(this); + }); + if (void 0 === fn) return this.each(function() { + nptmask = new Inputmask(options), nptmask.mask(this); + }); + } + }), $.fn.inputmask; +}(jQuery, Inputmask), function($, Inputmask) { + return Inputmask.extendDefinitions({ + h: { + validator: "[01][0-9]|2[0-3]", + cardinality: 2, + prevalidator: [ { + validator: "[0-2]", + cardinality: 1 + } ] + }, + s: { + validator: "[0-5][0-9]", + cardinality: 2, + prevalidator: [ { + validator: "[0-5]", + cardinality: 1 + } ] + }, + d: { + validator: "0[1-9]|[12][0-9]|3[01]", + cardinality: 2, + prevalidator: [ { + validator: "[0-3]", + cardinality: 1 + } ] + }, + m: { + validator: "0[1-9]|1[012]", + cardinality: 2, + prevalidator: [ { + validator: "[01]", + cardinality: 1 + } ] + }, + y: { + validator: "(19|20)\\d{2}", + cardinality: 4, + prevalidator: [ { + validator: "[12]", + cardinality: 1 + }, { + validator: "(19|20)", + cardinality: 2 + }, { + validator: "(19|20)\\d", + cardinality: 3 + } ] + } + }), Inputmask.extendAliases({ + "dd/mm/yyyy": { + mask: "1/2/y", + placeholder: "dd/mm/yyyy", + regex: { + val1pre: new RegExp("[0-3]"), + val1: new RegExp("0[1-9]|[12][0-9]|3[01]"), + val2pre: function(separator) { + var escapedSeparator = Inputmask.escapeRegex.call(this, separator); + return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])"); + }, + val2: function(separator) { + var escapedSeparator = Inputmask.escapeRegex.call(this, separator); + return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))"); + } + }, + leapday: "29/02/", + separator: "/", + yearrange: { + minyear: 1900, + maxyear: 2099 + }, + isInYearRange: function(chrs, minyear, maxyear) { + if (isNaN(chrs)) return !1; + var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length))), enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length))); + return (isNaN(enteredyear) ? !1 : enteredyear >= minyear && maxyear >= enteredyear) || (isNaN(enteredyear2) ? !1 : enteredyear2 >= minyear && maxyear >= enteredyear2); + }, + determinebaseyear: function(minyear, maxyear, hint) { + var currentyear = new Date().getFullYear(); + if (minyear > currentyear) return minyear; + if (currentyear > maxyear) { + for (var maxYearPrefix = maxyear.toString().slice(0, 2), maxYearPostfix = maxyear.toString().slice(2, 4); maxYearPrefix + hint > maxyear; ) maxYearPrefix--; + var maxxYear = maxYearPrefix + maxYearPostfix; + return minyear > maxxYear ? minyear : maxxYear; + } + if (currentyear >= minyear && maxyear >= currentyear) { + for (var currentYearPrefix = currentyear.toString().slice(0, 2); currentYearPrefix + hint > maxyear; ) currentYearPrefix--; + var currentYearAndHint = currentYearPrefix + hint; + return minyear > currentYearAndHint ? minyear : currentYearAndHint; + } + return currentyear; + }, + onKeyDown: function(e, buffer, caretPos, opts) { + var $input = $(this); + if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) { + var today = new Date(); + $input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString()), + $input.trigger("setvalue"); + } + }, + getFrontValue: function(mask, buffer, opts) { + for (var start = 0, length = 0, i = 0; i < mask.length && "2" !== mask.charAt(i); i++) { + var definition = opts.definitions[mask.charAt(i)]; + definition ? (start += length, length = definition.cardinality) : length++; + } + return buffer.join("").substr(start, length); + }, + definitions: { + "1": { + validator: function(chrs, maskset, pos, strict, opts) { + var isValid = opts.regex.val1.test(chrs); + return strict || isValid || chrs.charAt(1) !== opts.separator && -1 === "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0", + { + refreshFromBuffer: { + start: pos - 1, + end: pos + }, + pos: pos, + c: chrs.charAt(0) + }); + }, + cardinality: 2, + prevalidator: [ { + validator: function(chrs, maskset, pos, strict, opts) { + var pchrs = chrs; + isNaN(maskset.buffer[pos + 1]) || (pchrs += maskset.buffer[pos + 1]); + var isValid = 1 === pchrs.length ? opts.regex.val1pre.test(pchrs) : opts.regex.val1.test(pchrs); + if (!strict && !isValid) { + if (isValid = opts.regex.val1.test(chrs + "0")) return maskset.buffer[pos] = chrs, + maskset.buffer[++pos] = "0", { + pos: pos, + c: "0" + }; + if (isValid = opts.regex.val1.test("0" + chrs)) return maskset.buffer[pos] = "0", + pos++, { + pos: pos + }; + } + return isValid; + }, + cardinality: 1 + } ] + }, + "2": { + validator: function(chrs, maskset, pos, strict, opts) { + var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts); + -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator); + var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs); + if (!strict && !isValid && (chrs.charAt(1) === opts.separator || -1 !== "-./".indexOf(chrs.charAt(1))) && (isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", + { + refreshFromBuffer: { + start: pos - 1, + end: pos + }, + pos: pos, + c: chrs.charAt(0) + }; + if (opts.mask.indexOf("2") === opts.mask.length - 1 && isValid) { + var dayMonthValue = maskset.buffer.join("").substr(4, 4) + chrs; + if (dayMonthValue !== opts.leapday) return !0; + var year = parseInt(maskset.buffer.join("").substr(0, 4), 10); + return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1; + } + return isValid; + }, + cardinality: 2, + prevalidator: [ { + validator: function(chrs, maskset, pos, strict, opts) { + isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]); + var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts); + -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator); + var isValid = 1 === chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs); + return strict || isValid || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs)) ? isValid : (maskset.buffer[pos] = "0", + pos++, { + pos: pos + }); + }, + cardinality: 1 + } ] + }, + y: { + validator: function(chrs, maskset, pos, strict, opts) { + if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) { + var dayMonthValue = maskset.buffer.join("").substr(0, 6); + if (dayMonthValue !== opts.leapday) return !0; + var year = parseInt(chrs, 10); + return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1; + } + return !1; + }, + cardinality: 4, + prevalidator: [ { + validator: function(chrs, maskset, pos, strict, opts) { + var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); + if (!strict && !isValid) { + var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1); + if (isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0), + { + pos: pos + }; + if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2), + isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0), + maskset.buffer[pos++] = yearPrefix.charAt(1), { + pos: pos + }; + } + return isValid; + }, + cardinality: 1 + }, { + validator: function(chrs, maskset, pos, strict, opts) { + var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); + if (!strict && !isValid) { + var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2); + if (isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(1), + { + pos: pos + }; + if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2), + opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) { + var dayMonthValue = maskset.buffer.join("").substr(0, 6); + if (dayMonthValue !== opts.leapday) isValid = !0; else { + var year = parseInt(chrs, 10); + isValid = year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1; + } + } else isValid = !1; + if (isValid) return maskset.buffer[pos - 1] = yearPrefix.charAt(0), maskset.buffer[pos++] = yearPrefix.charAt(1), + maskset.buffer[pos++] = chrs.charAt(0), { + refreshFromBuffer: { + start: pos - 3, + end: pos + }, + pos: pos + }; + } + return isValid; + }, + cardinality: 2 + }, { + validator: function(chrs, maskset, pos, strict, opts) { + return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear); + }, + cardinality: 3 + } ] + } + }, + insertMode: !1, + autoUnmask: !1 + }, + "mm/dd/yyyy": { + placeholder: "mm/dd/yyyy", + alias: "dd/mm/yyyy", + regex: { + val2pre: function(separator) { + var escapedSeparator = Inputmask.escapeRegex.call(this, separator); + return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])"); + }, + val2: function(separator) { + var escapedSeparator = Inputmask.escapeRegex.call(this, separator); + return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)"); + }, + val1pre: new RegExp("[01]"), + val1: new RegExp("0[1-9]|1[012]") + }, + leapday: "02/29/", + onKeyDown: function(e, buffer, caretPos, opts) { + var $input = $(this); + if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) { + var today = new Date(); + $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()), + $input.trigger("setvalue"); + } + } + }, + "yyyy/mm/dd": { + mask: "y/1/2", + placeholder: "yyyy/mm/dd", + alias: "mm/dd/yyyy", + leapday: "/02/29", + onKeyDown: function(e, buffer, caretPos, opts) { + var $input = $(this); + if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) { + var today = new Date(); + $input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString()), + $input.trigger("setvalue"); + } + } + }, + "dd.mm.yyyy": { + mask: "1.2.y", + placeholder: "dd.mm.yyyy", + leapday: "29.02.", + separator: ".", + alias: "dd/mm/yyyy" + }, + "dd-mm-yyyy": { + mask: "1-2-y", + placeholder: "dd-mm-yyyy", + leapday: "29-02-", + separator: "-", + alias: "dd/mm/yyyy" + }, + "mm.dd.yyyy": { + mask: "1.2.y", + placeholder: "mm.dd.yyyy", + leapday: "02.29.", + separator: ".", + alias: "mm/dd/yyyy" + }, + "mm-dd-yyyy": { + mask: "1-2-y", + placeholder: "mm-dd-yyyy", + leapday: "02-29-", + separator: "-", + alias: "mm/dd/yyyy" + }, + "yyyy.mm.dd": { + mask: "y.1.2", + placeholder: "yyyy.mm.dd", + leapday: ".02.29", + separator: ".", + alias: "yyyy/mm/dd" + }, + "yyyy-mm-dd": { + mask: "y-1-2", + placeholder: "yyyy-mm-dd", + leapday: "-02-29", + separator: "-", + alias: "yyyy/mm/dd" + }, + datetime: { + mask: "1/2/y h:s", + placeholder: "dd/mm/yyyy hh:mm", + alias: "dd/mm/yyyy", + regex: { + hrspre: new RegExp("[012]"), + hrs24: new RegExp("2[0-4]|1[3-9]"), + hrs: new RegExp("[01][0-9]|2[0-4]"), + ampm: new RegExp("^[a|p|A|P][m|M]"), + mspre: new RegExp("[0-5]"), + ms: new RegExp("[0-5][0-9]") + }, + timeseparator: ":", + hourFormat: "24", + definitions: { + h: { + validator: function(chrs, maskset, pos, strict, opts) { + if ("24" === opts.hourFormat && 24 === parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0", + maskset.buffer[pos] = "0", { + refreshFromBuffer: { + start: pos - 1, + end: pos + }, + c: "0" + }; + var isValid = opts.regex.hrs.test(chrs); + if (!strict && !isValid && (chrs.charAt(1) === opts.timeseparator || -1 !== "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0", + maskset.buffer[pos] = chrs.charAt(0), pos++, { + refreshFromBuffer: { + start: pos - 2, + end: pos + }, + pos: pos, + c: opts.timeseparator + }; + if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) { + var tmp = parseInt(chrs, 10); + return 24 === tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p", + maskset.buffer[pos + 6] = "m"), tmp -= 12, 10 > tmp ? (maskset.buffer[pos] = tmp.toString(), + maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1), + maskset.buffer[pos - 1] = tmp.toString().charAt(0)), { + refreshFromBuffer: { + start: pos - 1, + end: pos + 6 + }, + c: maskset.buffer[pos] + }; + } + return isValid; + }, + cardinality: 2, + prevalidator: [ { + validator: function(chrs, maskset, pos, strict, opts) { + var isValid = opts.regex.hrspre.test(chrs); + return strict || isValid || !(isValid = opts.regex.hrs.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0", + pos++, { + pos: pos + }); + }, + cardinality: 1 + } ] + }, + s: { + validator: "[0-5][0-9]", + cardinality: 2, + prevalidator: [ { + validator: function(chrs, maskset, pos, strict, opts) { + var isValid = opts.regex.mspre.test(chrs); + return strict || isValid || !(isValid = opts.regex.ms.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0", + pos++, { + pos: pos + }); + }, + cardinality: 1 + } ] + }, + t: { + validator: function(chrs, maskset, pos, strict, opts) { + return opts.regex.ampm.test(chrs + "m"); + }, + casing: "lower", + cardinality: 1 + } + }, + insertMode: !1, + autoUnmask: !1 + }, + datetime12: { + mask: "1/2/y h:s t\\m", + placeholder: "dd/mm/yyyy hh:mm xm", + alias: "datetime", + hourFormat: "12" + }, + "mm/dd/yyyy hh:mm xm": { + mask: "1/2/y h:s t\\m", + placeholder: "mm/dd/yyyy hh:mm xm", + alias: "datetime12", + regex: { + val2pre: function(separator) { + var escapedSeparator = Inputmask.escapeRegex.call(this, separator); + return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])"); + }, + val2: function(separator) { + var escapedSeparator = Inputmask.escapeRegex.call(this, separator); + return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)"); + }, + val1pre: new RegExp("[01]"), + val1: new RegExp("0[1-9]|1[012]") + }, + leapday: "02/29/", + onKeyDown: function(e, buffer, caretPos, opts) { + var $input = $(this); + if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) { + var today = new Date(); + $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()), + $input.trigger("setvalue"); + } + } + }, + "hh:mm t": { + mask: "h:s t\\m", + placeholder: "hh:mm xm", + alias: "datetime", + hourFormat: "12" + }, + "h:s t": { + mask: "h:s t\\m", + placeholder: "hh:mm xm", + alias: "datetime", + hourFormat: "12" + }, + "hh:mm:ss": { + mask: "h:s:s", + placeholder: "hh:mm:ss", + alias: "datetime", + autoUnmask: !1 + }, + "hh:mm": { + mask: "h:s", + placeholder: "hh:mm", + alias: "datetime", + autoUnmask: !1 + }, + date: { + alias: "dd/mm/yyyy" + }, + "mm/yyyy": { + mask: "1/y", + placeholder: "mm/yyyy", + leapday: "donotuse", + separator: "/", + alias: "mm/dd/yyyy" + }, + shamsi: { + regex: { + val2pre: function(separator) { + var escapedSeparator = Inputmask.escapeRegex.call(this, separator); + return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "[0-3])"); + }, + val2: function(separator) { + var escapedSeparator = Inputmask.escapeRegex.call(this, separator); + return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[1-9]|1[012])" + escapedSeparator + "30)|((0[1-6])" + escapedSeparator + "31)"); + }, + val1pre: new RegExp("[01]"), + val1: new RegExp("0[1-9]|1[012]") + }, + yearrange: { + minyear: 1300, + maxyear: 1499 + }, + mask: "y/1/2", + leapday: "/12/30", + placeholder: "yyyy/mm/dd", + alias: "mm/dd/yyyy", + clearIncomplete: !0 + } + }), Inputmask; +}(jQuery, Inputmask), function($, Inputmask) { + return Inputmask.extendDefinitions({ + A: { + validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", + cardinality: 1, + casing: "upper" + }, + "&": { + validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]", + cardinality: 1, + casing: "upper" + }, + "#": { + validator: "[0-9A-Fa-f]", + cardinality: 1, + casing: "upper" + } + }), Inputmask.extendAliases({ + url: { + definitions: { + i: { + validator: ".", + cardinality: 1 + } + }, + mask: "(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}", + insertMode: !1, + autoUnmask: !1 + }, + ip: { + mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]", + definitions: { + i: { + validator: function(chrs, maskset, pos, strict, opts) { + return pos - 1 > -1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs, + chrs = pos - 2 > -1 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs, + new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs); + }, + cardinality: 1 + } + }, + onUnMask: function(maskedValue, unmaskedValue, opts) { + return maskedValue; + } + }, + email: { + mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}[.-{1,63}][.-{1,63}][.-{1,63}]", + greedy: !1, + onBeforePaste: function(pastedValue, opts) { + return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", ""); + }, + definitions: { + "*": { + validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]", + cardinality: 1, + casing: "lower" + }, + "-": { + validator: "[0-9A-Za-z-]", + cardinality: 1, + casing: "lower" + } + }, + onUnMask: function(maskedValue, unmaskedValue, opts) { + return maskedValue; + } + }, + mac: { + mask: "##:##:##:##:##:##" + }, + vin: { + mask: "V{8}vV{4}9{4}", + definitions: { + V: { + validator: "[A-HJ-NPR-Za-hj-npr-z\\d]", + cardinality: 1, + casing: "upper" + }, + v: { + validator: "[Xx\\d]", + cardinality: 1, + casing: "upper" + } + }, + clearIncomplete: !0, + autoUnmask: !0 + } + }), Inputmask; +}(jQuery, Inputmask), function($, Inputmask) { + return Inputmask.extendAliases({ + numeric: { + mask: function(opts) { + function autoEscape(txt) { + for (var escapedTxt = "", i = 0; i < txt.length; i++) escapedTxt += opts.definitions[txt.charAt(i)] ? "\\" + txt.charAt(i) : txt.charAt(i); + return escapedTxt; + } + if (0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat), + opts.repeat = 0, opts.groupSeparator === opts.radixPoint && ("." === opts.radixPoint ? opts.groupSeparator = "," : "," === opts.radixPoint ? opts.groupSeparator = "." : opts.groupSeparator = ""), + " " === opts.groupSeparator && (opts.skipOptionalPartCharacter = void 0), opts.autoGroup = opts.autoGroup && "" !== opts.groupSeparator, + opts.autoGroup && ("string" == typeof opts.groupSize && isFinite(opts.groupSize) && (opts.groupSize = parseInt(opts.groupSize)), + isFinite(opts.integerDigits))) { + var seps = Math.floor(opts.integerDigits / opts.groupSize), mod = opts.integerDigits % opts.groupSize; + opts.integerDigits = parseInt(opts.integerDigits) + (0 === mod ? seps - 1 : seps), + opts.integerDigits < 1 && (opts.integerDigits = "*"); + } + opts.placeholder.length > 1 && (opts.placeholder = opts.placeholder.charAt(0)), + opts.radixFocus = opts.radixFocus && "" !== opts.placeholder && opts.integerOptional === !0, + opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~", + 1 == opts.numericInput && (opts.radixFocus = !1, opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2), + opts.decimalProtect = !1); + var mask = autoEscape(opts.prefix); + return mask += "[+]", mask += opts.integerOptional === !0 ? "~{1," + opts.integerDigits + "}" : "~{" + opts.integerDigits + "}", + void 0 !== opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (opts.decimalProtect && (opts.radixPointDefinitionSymbol = ":"), + mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{1," + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}"), + "" !== opts.negationSymbol.back && (mask += "[-]"), mask += autoEscape(opts.suffix), + opts.greedy = !1, mask; + }, + placeholder: "", + greedy: !1, + digits: "*", + digitsOptional: !0, + radixPoint: ".", + radixFocus: !0, + groupSize: 3, + groupSeparator: "", + autoGroup: !1, + allowPlus: !0, + allowMinus: !0, + negationSymbol: { + front: "-", + back: "" + }, + integerDigits: "+", + integerOptional: !0, + prefix: "", + suffix: "", + rightAlign: !0, + decimalProtect: !0, + min: null, + max: null, + step: 1, + insertMode: !0, + autoUnmask: !1, + unmaskAsNumber: !1, + postFormat: function(buffer, pos, opts) { + opts.numericInput === !0 && (buffer = buffer.reverse(), isFinite(pos) && (pos = buffer.join("").length - pos - 1)); + var i, l, suffixStripped = !1; + buffer.length >= opts.suffix.length && buffer.join("").indexOf(opts.suffix) === buffer.length - opts.suffix.length && (buffer.length = buffer.length - opts.suffix.length, + suffixStripped = !0), pos = pos >= buffer.length ? buffer.length - 1 : pos < opts.prefix.length ? opts.prefix.length : pos; + var needsRefresh = !1, charAtPos = buffer[pos], cbuf = buffer.slice(); + charAtPos === opts.groupSeparator && (cbuf.splice(pos--, 1), charAtPos = cbuf[pos]), + charAtPos !== opts.radixPoint && charAtPos !== opts.negationSymbol.front && charAtPos !== opts.negationSymbol.back && (cbuf[pos] = "?"); + var bufVal = cbuf.join(""), bufValOrigin = bufVal; + if (bufVal.length > 0 && opts.autoGroup || -1 !== bufVal.indexOf(opts.groupSeparator)) { + var escapedGroupSeparator = Inputmask.escapeRegex(opts.groupSeparator); + needsRefresh = 0 === bufVal.indexOf(opts.groupSeparator), bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), ""); + var radixSplit = bufVal.split(opts.radixPoint); + if (bufVal = "" === opts.radixPoint ? bufVal : radixSplit[0], bufVal !== opts.prefix + "?0" && bufVal.length >= opts.groupSize + opts.prefix.length) for (var reg = new RegExp("([-+]?[\\d?]+)([\\d?]{" + opts.groupSize + "})"); reg.test(bufVal) && "" !== opts.groupSeparator; ) bufVal = bufVal.replace(reg, "$1" + opts.groupSeparator + "$2"), + bufVal = bufVal.replace(opts.groupSeparator + opts.groupSeparator, opts.groupSeparator); + "" !== opts.radixPoint && radixSplit.length > 1 && (bufVal += opts.radixPoint + radixSplit[1]); + } + for (needsRefresh = bufValOrigin !== bufVal, buffer.length = bufVal.length, i = 0, + l = bufVal.length; l > i; i++) buffer[i] = bufVal.charAt(i); + var newPos = $.inArray("?", buffer); + if (-1 === newPos && (newPos = $.inArray(charAtPos, buffer)), buffer[newPos] = charAtPos, + !needsRefresh && suffixStripped) for (i = 0, l = opts.suffix.length; l > i; i++) buffer.push(opts.suffix.charAt(i)); + return newPos = opts.numericInput && isFinite(pos) ? buffer.join("").length - newPos - 1 : newPos, + opts.numericInput && (buffer = buffer.reverse(), $.inArray(opts.radixPoint, buffer) < newPos && buffer.join("").length - opts.suffix.length !== newPos && (newPos -= 1)), + { + pos: newPos, + refreshFromBuffer: needsRefresh, + buffer: buffer + }; + }, + onBeforeWrite: function(e, buffer, caretPos, opts) { + var rslt; + if (e && ("blur" === e.type || "checkval" === e.type || "keydown" === e.type)) { + var maskedValue = opts.numericInput ? buffer.slice().reverse().join("") : buffer.join(""), processValue = maskedValue.replace(opts.prefix, ""), minmaxed = !1; + processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), + "," === opts.radixPoint && (processValue = processValue.replace(opts.radixPoint, ".")); + var isNegative = processValue.match(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g")); + if (isNegative = null !== isNegative && 1 === isNegative.length, processValue = processValue.replace(new RegExp("[-" + Inputmask.escapeRegex(opts.negationSymbol.front) + "]", "g"), ""), + processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""), + processValue = processValue === opts.negationSymbol.front ? processValue + "0" : processValue, + isFinite(processValue)) { + var floatValue = parseFloat(processValue), signedFloatValue = isNegative ? -1 * floatValue : floatValue; + if (null !== opts.min && isFinite(opts.min) && signedFloatValue < parseFloat(opts.min) && (floatValue = Math.abs(opts.min), + isNegative = opts.min < 0, minmaxed = !0), !minmaxed && null !== opts.max && isFinite(opts.max) && signedFloatValue > parseFloat(opts.max) && (floatValue = Math.abs(opts.max), + isNegative = opts.max < 0, minmaxed = !0), processValue = floatValue.toString().replace(".", opts.radixPoint).split(""), + isFinite(opts.digits)) { + var radixPosition = $.inArray(opts.radixPoint, processValue), rpb = $.inArray(opts.radixPoint, maskedValue); + -1 === radixPosition && (processValue.push(opts.radixPoint), radixPosition = processValue.length - 1); + for (var i = 1; i <= opts.digits; i++) opts.digitsOptional || void 0 !== processValue[radixPosition + i] && processValue[radixPosition + i] !== opts.placeholder.charAt(0) ? -1 !== rpb && void 0 !== maskedValue[rpb + i] && (processValue[radixPosition + i] = processValue[radixPosition + i] || maskedValue[rpb + i]) : processValue[radixPosition + i] = "0"; + processValue[processValue.length - 1] === opts.radixPoint && delete processValue[processValue.length - 1]; + } + if (floatValue.toString() !== processValue && floatValue.toString() + "." !== processValue || isNegative) return !isNegative || 0 === floatValue && "blur" === e.type || (processValue.unshift(opts.negationSymbol.front), + processValue.push(opts.negationSymbol.back)), processValue = (opts.prefix + processValue.join("")).split(""), + opts.numericInput && (processValue = processValue.reverse()), rslt = opts.postFormat(processValue, opts.numericInput ? caretPos : caretPos - 1, opts), + rslt.buffer && (rslt.refreshFromBuffer = rslt.buffer.join("") !== buffer.join("")), + rslt; + } + } + return opts.autoGroup ? (rslt = opts.postFormat(buffer, opts.numericInput ? caretPos : caretPos - 1, opts), + rslt.caret = caretPos <= opts.prefix.length ? rslt.pos : rslt.pos + 1, rslt) : void 0; + }, + regex: { + integerPart: function(opts) { + return new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?\\d+"); + }, + integerNPart: function(opts) { + return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + Inputmask.escapeRegex(opts.placeholder.charAt(0)) + "]+"); + } + }, + signHandler: function(chrs, maskset, pos, strict, opts) { + if (!strict && opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs) { + var matchRslt = maskset.buffer.join("").match(opts.regex.integerPart(opts)); + if (matchRslt && matchRslt[0].length > 0) return maskset.buffer[matchRslt.index] === ("-" === chrs ? "+" : opts.negationSymbol.front) ? "-" === chrs ? "" !== opts.negationSymbol.back ? { + pos: matchRslt.index, + c: opts.negationSymbol.front, + remove: matchRslt.index, + caret: pos, + insert: { + pos: maskset.buffer.length - opts.suffix.length - 1, + c: opts.negationSymbol.back + } + } : { + pos: matchRslt.index, + c: opts.negationSymbol.front, + remove: matchRslt.index, + caret: pos + } : "" !== opts.negationSymbol.back ? { + pos: matchRslt.index, + c: "+", + remove: [ matchRslt.index, maskset.buffer.length - opts.suffix.length - 1 ], + caret: pos + } : { + pos: matchRslt.index, + c: "+", + remove: matchRslt.index, + caret: pos + } : maskset.buffer[matchRslt.index] === ("-" === chrs ? opts.negationSymbol.front : "+") ? "-" === chrs && "" !== opts.negationSymbol.back ? { + remove: [ matchRslt.index, maskset.buffer.length - opts.suffix.length - 1 ], + caret: pos - 1 + } : { + remove: matchRslt.index, + caret: pos - 1 + } : "-" === chrs ? "" !== opts.negationSymbol.back ? { + pos: matchRslt.index, + c: opts.negationSymbol.front, + caret: pos + 1, + insert: { + pos: maskset.buffer.length - opts.suffix.length, + c: opts.negationSymbol.back + } + } : { + pos: matchRslt.index, + c: opts.negationSymbol.front, + caret: pos + 1 + } : { + pos: matchRslt.index, + c: chrs, + caret: pos + 1 + }; + } + return !1; + }, + radixHandler: function(chrs, maskset, pos, strict, opts) { + if (!strict && (-1 !== $.inArray(chrs, [ ",", "." ]) && (chrs = opts.radixPoint), + chrs === opts.radixPoint && void 0 !== opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0))) { + var radixPos = $.inArray(opts.radixPoint, maskset.buffer), integerValue = maskset.buffer.join("").match(opts.regex.integerPart(opts)); + if (-1 !== radixPos && maskset.validPositions[radixPos]) return maskset.validPositions[radixPos - 1] ? { + caret: radixPos + 1 + } : { + pos: integerValue.index, + c: integerValue[0], + caret: radixPos + 1 + }; + if (!integerValue || "0" === integerValue[0] && integerValue.index + 1 !== pos) return maskset.buffer[integerValue ? integerValue.index : pos] = "0", + { + pos: (integerValue ? integerValue.index : pos) + 1, + c: opts.radixPoint + }; + } + return !1; + }, + leadingZeroHandler: function(chrs, maskset, pos, strict, opts) { + if (opts.numericInput === !0) { + if ("0" === maskset.buffer[maskset.buffer.length - opts.prefix.length - 1]) return { + pos: pos, + remove: maskset.buffer.length - opts.prefix.length - 1 + }; + } else { + var radixPosition = $.inArray(opts.radixPoint, maskset.buffer), matchRslt = maskset.buffer.slice(0, -1 !== radixPosition ? radixPosition : void 0).join("").match(opts.regex.integerNPart(opts)); + if (matchRslt && !strict && (-1 === radixPosition || radixPosition >= pos)) { + if (0 === matchRslt[0].indexOf("" !== opts.placeholder ? opts.placeholder.charAt(0) : "0") && matchRslt.index + 1 === pos) return maskset.buffer.splice(matchRslt.index, 1), + pos = matchRslt.index, { + pos: pos, + remove: matchRslt.index + }; + if ("0" === chrs && pos <= matchRslt.index && matchRslt[0] !== opts.groupSeparator) return !1; + } + } + return !0; + }, + definitions: { + "~": { + validator: function(chrs, maskset, pos, strict, opts) { + var isValid = opts.signHandler(chrs, maskset, pos, strict, opts); + if (!isValid && (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts), + !isValid && (isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs), + isValid === !0 && (isValid = opts.leadingZeroHandler(chrs, maskset, pos, strict, opts), + isValid === !0)))) { + var radixPosition = $.inArray(opts.radixPoint, maskset.buffer); + isValid = -1 !== radixPosition && (opts.digitsOptional === !1 || maskset.validPositions[pos]) && opts.numericInput !== !0 && pos > radixPosition && !strict ? { + pos: pos, + remove: pos + } : { + pos: pos + }; + } + return isValid; + }, + cardinality: 1, + prevalidator: null + }, + "+": { + validator: function(chrs, maskset, pos, strict, opts) { + var isValid = opts.signHandler(chrs, maskset, pos, strict, opts); + return !isValid && (strict && opts.allowMinus && chrs === opts.negationSymbol.front || opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs) && (isValid = "-" === chrs ? "" !== opts.negationSymbol.back ? { + pos: pos, + c: "-" === chrs ? opts.negationSymbol.front : "+", + caret: pos + 1, + insert: { + pos: maskset.buffer.length, + c: opts.negationSymbol.back + } + } : { + pos: pos, + c: "-" === chrs ? opts.negationSymbol.front : "+", + caret: pos + 1 + } : !0), isValid; + }, + cardinality: 1, + prevalidator: null, + placeholder: "" + }, + "-": { + validator: function(chrs, maskset, pos, strict, opts) { + var isValid = opts.signHandler(chrs, maskset, pos, strict, opts); + return !isValid && strict && opts.allowMinus && chrs === opts.negationSymbol.back && (isValid = !0), + isValid; + }, + cardinality: 1, + prevalidator: null, + placeholder: "" + }, + ":": { + validator: function(chrs, maskset, pos, strict, opts) { + var isValid = opts.signHandler(chrs, maskset, pos, strict, opts); + if (!isValid) { + var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + ",\\.]"; + isValid = new RegExp(radix).test(chrs), isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint && (isValid = { + caret: pos + 1 + }); + } + return isValid ? { + c: opts.radixPoint + } : isValid; + }, + cardinality: 1, + prevalidator: null, + placeholder: function(opts) { + return opts.radixPoint; + } + } + }, + onUnMask: function(maskedValue, unmaskedValue, opts) { + var processValue = maskedValue.replace(opts.prefix, ""); + return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), + opts.unmaskAsNumber ? ("" !== opts.radixPoint && -1 !== processValue.indexOf(opts.radixPoint) && (processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".")), + Number(processValue)) : processValue; + }, + isComplete: function(buffer, opts) { + var maskedValue = buffer.join(""), bufClone = buffer.slice(); + if (opts.postFormat(bufClone, 0, opts), bufClone.join("") !== maskedValue) return !1; + var processValue = maskedValue.replace(opts.prefix, ""); + return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""), + "," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")), + isFinite(processValue); + }, + onBeforeMask: function(initialValue, opts) { + if ("" !== opts.radixPoint && isFinite(initialValue)) initialValue = initialValue.toString().replace(".", opts.radixPoint); else { + var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g); + dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""), + initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length ? (initialValue = initialValue.replace(/,/g, ""), + initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue = initialValue.replace(/,/g, "") : initialValue = initialValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""); + } + if (0 === opts.digits && (-1 !== initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 !== initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))), + "" !== opts.radixPoint && isFinite(opts.digits) && -1 !== initialValue.indexOf(opts.radixPoint)) { + var valueParts = initialValue.split(opts.radixPoint), decPart = valueParts[1].match(new RegExp("\\d*"))[0]; + if (parseInt(opts.digits) < decPart.toString().length) { + var digitsFactor = Math.pow(10, parseInt(opts.digits)); + initialValue = initialValue.replace(Inputmask.escapeRegex(opts.radixPoint), "."), + initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor, + initialValue = initialValue.toString().replace(".", opts.radixPoint); + } + } + return initialValue.toString(); + }, + canClearPosition: function(maskset, position, lvp, strict, opts) { + var positionInput = maskset.validPositions[position].input, canClear = positionInput !== opts.radixPoint || null !== maskset.validPositions[position].match.fn && opts.decimalProtect === !1 || isFinite(positionInput) || position === lvp || positionInput === opts.groupSeparator || positionInput === opts.negationSymbol.front || positionInput === opts.negationSymbol.back; + return canClear; + }, + onKeyDown: function(e, buffer, caretPos, opts) { + var $input = $(this); + if (e.ctrlKey) switch (e.keyCode) { + case Inputmask.keyCode.UP: + $input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step)), $input.trigger("setvalue"); + break; + + case Inputmask.keyCode.DOWN: + $input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step)), $input.trigger("setvalue"); + } + } + }, + currency: { + prefix: "$ ", + groupSeparator: ",", + alias: "numeric", + placeholder: "0", + autoGroup: !0, + digits: 2, + digitsOptional: !1, + clearMaskOnLostFocus: !1 + }, + decimal: { + alias: "numeric" + }, + integer: { + alias: "numeric", + digits: 0, + radixPoint: "" + }, + percentage: { + alias: "numeric", + digits: 2, + radixPoint: ".", + placeholder: "0", + autoGroup: !1, + min: 0, + max: 100, + suffix: " %", + allowPlus: !1, + allowMinus: !1 + } + }), Inputmask; +}(jQuery, Inputmask), function($, Inputmask) { + return Inputmask.extendAliases({ + phone: { + url: "phone-codes/phone-codes.js", + countrycode: "", + phoneCodeCache: {}, + mask: function(opts) { + if (void 0 === opts.phoneCodeCache[opts.url]) { + var maskList = []; + opts.definitions["#"] = opts.definitions[9], $.ajax({ + url: opts.url, + async: !1, + type: "get", + dataType: "json", + success: function(response) { + maskList = response; + }, + error: function(xhr, ajaxOptions, thrownError) { + alert(thrownError + " - " + opts.url); + } + }), opts.phoneCodeCache[opts.url] = maskList.sort(function(a, b) { + return (a.mask || a) < (b.mask || b) ? -1 : 1; + }); + } + return opts.phoneCodeCache[opts.url]; + }, + keepStatic: !1, + nojumps: !0, + nojumpsThreshold: 1, + onBeforeMask: function(value, opts) { + var processedValue = value.replace(/^0{1,2}/, "").replace(/[\s]/g, ""); + return (processedValue.indexOf(opts.countrycode) > 1 || -1 === processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue), + processedValue; + } + }, + phonebe: { + alias: "phone", + url: "phone-codes/phone-be.js", + countrycode: "32", + nojumpsThreshold: 4 + } + }), Inputmask; +}(jQuery, Inputmask), function($, Inputmask) { + return Inputmask.extendAliases({ + Regex: { + mask: "r", + greedy: !1, + repeat: "*", + regex: null, + regexTokens: null, + tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g, + quantifierFilter: /[0-9]+[^,]/, + isComplete: function(buffer, opts) { + return new RegExp(opts.regex).test(buffer.join("")); + }, + definitions: { + r: { + validator: function(chrs, maskset, pos, strict, opts) { + function RegexToken(isGroup, isQuantifier) { + this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1, + this.quantifier = { + min: 1, + max: 1 + }, this.repeaterPart = void 0; + } + function analyseRegex() { + var match, m, currentToken = new RegexToken(), opengroups = []; + for (opts.regexTokens = []; match = opts.tokenizer.exec(opts.regex); ) switch (m = match[0], + m.charAt(0)) { + case "(": + opengroups.push(new RegexToken(!0)); + break; + + case ")": + groupToken = opengroups.pop(), opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken); + break; + + case "{": + case "+": + case "*": + var quantifierToken = new RegexToken(!1, !0); + m = m.replace(/[{}]/g, ""); + var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]); + if (quantifierToken.quantifier = { + min: mq0, + max: mq1 + }, opengroups.length > 0) { + var matches = opengroups[opengroups.length - 1].matches; + match = matches.pop(), match.isGroup || (groupToken = new RegexToken(!0), groupToken.matches.push(match), + match = groupToken), matches.push(match), matches.push(quantifierToken); + } else match = currentToken.matches.pop(), match.isGroup || (groupToken = new RegexToken(!0), + groupToken.matches.push(match), match = groupToken), currentToken.matches.push(match), + currentToken.matches.push(quantifierToken); + break; + + default: + opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(m) : currentToken.matches.push(m); + } + currentToken.matches.length > 0 && opts.regexTokens.push(currentToken); + } + function validateRegexToken(token, fromGroup) { + var isvalid = !1; + fromGroup && (regexPart += "(", openGroupCount++); + for (var mndx = 0; mndx < token.matches.length; mndx++) { + var matchToken = token.matches[mndx]; + if (matchToken.isGroup === !0) isvalid = validateRegexToken(matchToken, !0); else if (matchToken.isQuantifier === !0) { + var crrntndx = $.inArray(matchToken, token.matches), matchGroup = token.matches[crrntndx - 1], regexPartBak = regexPart; + if (isNaN(matchToken.quantifier.max)) { + for (;matchToken.repeaterPart && matchToken.repeaterPart !== regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ; + isvalid = isvalid || validateRegexToken(matchGroup, !0), isvalid && (matchToken.repeaterPart = regexPart), + regexPart = regexPartBak + matchToken.quantifier.max; + } else { + for (var i = 0, qm = matchToken.quantifier.max - 1; qm > i && !(isvalid = validateRegexToken(matchGroup, !0)); i++) ; + regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}"; + } + } else if (void 0 !== matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else { + var testExp; + if ("[" == matchToken.charAt(0)) { + testExp = regexPart, testExp += matchToken; + for (var j = 0; openGroupCount > j; j++) testExp += ")"; + var exp = new RegExp("^(" + testExp + ")$"); + isvalid = exp.test(bufferStr); + } else for (var l = 0, tl = matchToken.length; tl > l; l++) if ("\\" !== matchToken.charAt(l)) { + testExp = regexPart, testExp += matchToken.substr(0, l + 1), testExp = testExp.replace(/\|$/, ""); + for (var j = 0; openGroupCount > j; j++) testExp += ")"; + var exp = new RegExp("^(" + testExp + ")$"); + if (isvalid = exp.test(bufferStr)) break; + } + regexPart += matchToken; + } + if (isvalid) break; + } + return fromGroup && (regexPart += ")", openGroupCount--), isvalid; + } + var bufferStr, groupToken, cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0; + null === opts.regexTokens && analyseRegex(), cbuffer.splice(pos, 0, chrs), bufferStr = cbuffer.join(""); + for (var i = 0; i < opts.regexTokens.length; i++) { + var regexToken = opts.regexTokens[i]; + if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break; + } + return isValid; + }, + cardinality: 1 + } + } + } + }), Inputmask; +}(jQuery, Inputmask); diff -r 601c667286f6 -r d294083fb28c src/pyams_skin/resources/js/ext/jquery-inputmask-bundle-3.2.8.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_skin/resources/js/ext/jquery-inputmask-bundle-3.2.8.min.js Thu Apr 21 17:20:00 2016 +0200 @@ -0,0 +1,8 @@ +/* +* jquery.inputmask.bundle.js +* https://github.com/RobinHerbots/jquery.inputmask +* Copyright (c) 2010 - 2016 Robin Herbots +* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) +* Version: 3.2.8-15 +*/ +!function(f){function e(n,m){return this instanceof e?(f.isPlainObject(n)?m=n:(m=m||{},m.alias=n),this.el=void 0,this.opts=f.extend(!0,{},this.defaults,m),this.noMasksCache=m&&void 0!==m.definitions,this.userOptions=m||{},this.events={},void h(this.opts.alias,m,this.opts)):new e(n,m)}function k(m){var p=document.createElement("input"),o="on"+m,n=o in p;return n||(p.setAttribute(o,"return;"),n="function"==typeof p[o]),p=null,n}function i(n,q){var m=n.getAttribute("type"),o="INPUT"===n.tagName&&-1!==f.inArray(m,q.supportsInputType)||n.isContentEditable||"TEXTAREA"===n.tagName;if(!o&&"INPUT"===n.tagName){var p=document.createElement("input");p.setAttribute("type",m),o="text"===p.type,p=null}return o}function h(n,o,p){var m=p.aliases[n];return m?(m.alias&&h(m.alias,void 0,p),f.extend(!0,p,m),f.extend(!0,p,o),!0):(null===p.mask&&(p.mask=n),!1)}function l(v,m,t){function q(p,w){w=void 0!==w?w:v.getAttribute("data-inputmask-"+p),null!==w&&("string"==typeof w&&(0===p.indexOf("on")?w=window[w]:"false"===w?w=!1:"true"===w&&(w=!0)),t[p]=w)}var s,o,r,n,u=v.getAttribute("data-inputmask");if(u&&""!==u&&(u=u.replace(new RegExp("'","g"),'"'),o=JSON.parse("{"+u+"}")),o){r=void 0;for(n in o){if("alias"===n.toLowerCase()){r=o[n];break}}}q("alias",r),t.alias&&h(t.alias,t,m);for(s in m){if(o){r=void 0;for(n in o){if(n.toLowerCase()===s.toLowerCase()){r=o[n];break}}}q(s,r)}return f.extend(!0,m,t),m}function d(s,p){function r(M){function A(V,T,U,S){this.matches=[],this.isGroup=V||!1,this.isOptional=T||!1,this.isQuantifier=U||!1,this.isAlternator=S||!1,this.quantifier={min:1,max:1}}function t(aa,V,X){var T=s.definitions[V];X=void 0!==X?X:aa.matches.length;var U=aa.matches[X-1];if(T&&!B){T.placeholder=f.isFunction(T.placeholder)?T.placeholder(s):T.placeholder;for(var Z=T.prevalidator,ac=Z?Z.length:0,W=1;W=W?Z[W-1]:[],S=ab.validator,Y=ab.cardinality;aa.matches.splice(X++,0,{fn:S?"string"==typeof S?new RegExp(S):new function(){this.test=S}():new RegExp("."),cardinality:Y?Y:1,optionality:aa.isOptional,newBlockMarker:void 0===U||U.def!==(T.definitionSymbol||V),casing:T.casing,def:T.definitionSymbol||V,placeholder:T.placeholder,mask:V}),U=aa.matches[X-1]}aa.matches.splice(X++,0,{fn:T.validator?"string"==typeof T.validator?new RegExp(T.validator):new function(){this.test=T.validator}():new RegExp("."),cardinality:T.cardinality,optionality:aa.isOptional,newBlockMarker:void 0===U||U.def!==(T.definitionSymbol||V),casing:T.casing,def:T.definitionSymbol||V,placeholder:T.placeholder,mask:V})}else{aa.matches.splice(X++,0,{fn:null,cardinality:0,optionality:aa.isOptional,newBlockMarker:void 0===U||U.def!==V,casing:null,def:s.staticDefinitionSymbol||V,placeholder:void 0!==s.staticDefinitionSymbol?V:void 0,mask:V}),B=!1}}function C(T,S){T.isGroup&&(T.isGroup=!1,t(T,s.groupmarker.start,0),S!==!0&&t(T,s.groupmarker.end))}function R(S,U,V,T){U.matches.length>0&&(void 0===T||T)&&(V=U.matches[U.matches.length-1],C(V)),t(U,S)}function E(){if(Q.length>0){if(N=Q[Q.length-1],R(I,N,O,!N.isAlternator),N.isAlternator){P=Q.pop();for(var S=0;S0?(N=Q[Q.length-1],N.matches.push(P)):v.matches.push(P)}}else{R(I,v,O)}}function y(U){function V(X){return X===s.optionalmarker.start?X=s.optionalmarker.end:X===s.optionalmarker.end?X=s.optionalmarker.start:X===s.groupmarker.start?X=s.groupmarker.end:X===s.groupmarker.end&&(X=s.groupmarker.start),X}U.matches=U.matches.reverse();for(var T in U.matches){var S=parseInt(T);if(U.matches[T].isQuantifier&&U.matches[S+1]&&U.matches[S+1].isGroup){var W=U.matches[T];U.matches.splice(T,1),U.matches.splice(S+1,0,W)}void 0!==U.matches[T].matches?U.matches[T]=y(U.matches[T]):U.matches[T]=V(U.matches[T])}return U}for(var D,I,z,N,P,O,w,G=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g,B=!1,v=new A(),Q=[],x=[];D=G.exec(M);){if(I=D[0],B){E()}else{switch(I.charAt(0)){case s.escapeChar:B=!0;break;case s.optionalmarker.end:case s.groupmarker.end:if(z=Q.pop(),void 0!==z){if(Q.length>0){if(N=Q[Q.length-1],N.matches.push(z),N.isAlternator){P=Q.pop();for(var F=0;F0?(N=Q[Q.length-1],N.matches.push(P)):v.matches.push(P)}}else{v.matches.push(z)}}else{E()}break;case s.optionalmarker.start:Q.push(new A(!1,!0));break;case s.groupmarker.start:Q.push(new A(!0));break;case s.quantifiermarker.start:var H=new A(!1,!1,!0);I=I.replace(/[{}]/g,"");var J=I.split(","),L=isNaN(J[0])?J[0]:parseInt(J[0]),K=1===J.length?L:isNaN(J[1])?J[1]:parseInt(J[1]);if(("*"===K||"+"===K)&&(L="*"===K?0:1),H.quantifier={min:L,max:K},Q.length>0){var u=Q[Q.length-1].matches;D=u.pop(),D.isGroup||(w=new A(!0),w.matches.push(D),D=w),u.push(D),u.push(H)}else{D=v.matches.pop(),D.isGroup||(w=new A(!0),w.matches.push(D),D=w),v.matches.push(D),v.matches.push(H)}break;case s.alternatormarker:Q.length>0?(N=Q[Q.length-1],O=N.matches.pop()):O=v.matches.pop(),O.isAlternator?Q.push(O):(P=new A(!1,!1,!1,!0),P.matches.push(O),Q.push(P));break;default:E()}}}for(;Q.length>0;){z=Q.pop(),C(z,!0),v.matches.push(z)}return v.matches.length>0&&(O=v.matches[v.matches.length-1],C(O),x.push(v)),s.numericInput&&y(x[0]),x}function q(t,u){if(null===t||""===t){return void 0}if(1===t.length&&s.greedy===!1&&0!==s.repeat&&(s.placeholder=""),s.repeat>0||"*"===s.repeat||"+"===s.repeat){var v="*"===s.repeat?0:"+"===s.repeat?1:s.repeat;t=s.groupmarker.start+t+s.groupmarker.end+s.quantifiermarker.start+v+","+s.repeat+s.quantifiermarker.end}var w;return void 0===e.prototype.masksCache[t]||p===!0?(w={mask:t,maskToken:r(t),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},metadata:u},p!==!0&&(e.prototype.masksCache[s.numericInput?t.split("").reverse().join(""):t]=w,w=f.extend(!0,{},e.prototype.masksCache[s.numericInput?t.split("").reverse().join(""):t]))):w=f.extend(!0,{},e.prototype.masksCache[s.numericInput?t.split("").reverse().join(""):t]),w}function n(t){return t=t.toString()}var m;if(f.isFunction(s.mask)&&(s.mask=s.mask(s)),f.isArray(s.mask)){if(s.mask.length>1){s.keepStatic=null===s.keepStatic?!0:s.keepStatic;var o="(";return f.each(s.numericInput?s.mask.reverse():s.mask,function(t,u){o.length>1&&(o+=")|("),o+=n(void 0===u.mask||f.isFunction(u.mask)?u:u.mask)}),o+=")",q(o,s.mask)}s.mask=s.mask.pop()}return s.mask&&(m=void 0===s.mask.mask||f.isFunction(s.mask.mask)?q(n(s.mask),s.mask):q(n(s.mask.mask),s.mask)),m}function g(w,F,T){function aw(aM,aL,aE){aL=aL||0;var aG,aJ,aH,aF=[],aK=0,aI=r();do{if(aM===!0&&K().validPositions[aK]){var aD=K().validPositions[aK];aJ=aD.match,aG=aD.locator.slice(),aF.push(aE===!0?aD.input:aA(aK,aJ))}else{aH=E(aK,aG,aK-1),aJ=aH.match,aG=aH.locator.slice(),(T.jitMasking===!1||aI>aK||isFinite(T.jitMasking)&&T.jitMasking>aK)&&aF.push(aA(aK,aJ))}aK++}while((void 0===y||y>aK-1)&&null!==aJ.fn||null===aJ.fn&&""!==aJ.def||aL>=aK);return""===aF[aF.length-1]&&aF.pop(),aF}function K(){return F}function N(aD){var aE=K();aE.buffer=void 0,aD!==!0&&(aE.tests={},aE._buffer=void 0,aE.validPositions={},aE.p=0)}function r(aE,aF){var aI=-1,aJ=-1,aG=K().validPositions;void 0===aE&&(aE=-1);for(var aD in aG){var aH=parseInt(aD);aG[aH]&&(aF||null!==aG[aH].match.fn)&&(aE>=aH&&(aI=aH),aH>=aE&&(aJ=aH))}return -1!==aI&&aE-aI>1||aE>aJ?aI:aJ}function B(aM,aN,aH,aJ){if(aJ||T.insertMode&&void 0!==K().validPositions[aM]&&void 0===aH){var aG,aO=f.extend(!0,{},K().validPositions),aI=r();for(aG=aM;aI>=aG;aG++){delete K().validPositions[aG]}K().validPositions[aM]=aN;var aF,aD=!0,aL=K().validPositions;for(aG=aF=aM;aI>=aG;aG++){var aP=aO[aG];if(void 0!==aP){for(var aK=aF,aE=-1;aK1||void 0!==aL[aG].alternation)?aK++:aK=p(aF),ar(aK,aP.match.def)){var aQ=u(aK,aP.input,!0,!0);if(aD=aQ!==!1,aF=aQ.caret||aQ.insert?r():aK,aD){break}}else{if(aD=null==aP.match.fn,aE===aK){break}aE=aK}}}if(!aD){break}}if(!aD){return K().validPositions=f.extend(!0,{},aO),N(!0),!1}}else{K().validPositions[aM]=aN}return N(!0),!0}function aa(aD,aE,aH,aI){function aJ(aP){var aN=K().validPositions[aP];if(void 0!==aN&&null===aN.match.fn){var aO=K().validPositions[aP-1],aM=K().validPositions[aP+1];return void 0!==aO&&void 0!==aM}return !1}var aF,aG=aD;for(K().p=aD,aF=aE-1;aF>=aG;aF--){void 0!==K().validPositions[aF]&&(aH===!0||!aJ(aF)&&T.canClearPosition(K(),aF,r(),aI,T)!==!1)&&delete K().validPositions[aF]}for(N(!0),aF=aG+1;aF<=r();){for(;void 0!==K().validPositions[aG];){aG++}var aL=K().validPositions[aG];if(aG>aF&&(aF=aG+1),void 0===K().validPositions[aF]&&M(aF)||void 0!==aL){aF++}else{var aK=E(aF);ar(aG,aK.match.def)?u(aG,aK.input||aA(aF),!0)!==!1&&(delete K().validPositions[aF],aF++):M(aF)||(aF++,aG--),aG++}}N(!0)}function E(aJ,aG,aF){var aH=K().validPositions[aJ];if(void 0===aH){for(var aE=C(aJ,aG,aF),aI=r(),aK=K().validPositions[aI]||C(0)[0],aD=void 0!==aK.alternation?aK.locator[aK.alternation].toString().split(","):[],aL=0;aLaJ)&&-1!==aJ&&(aD=aI,aF=aJ)}),aD}function C(aO,aH,aG){function aD(aY,aV,aX,aT){function aZ(bc,bn,bm){function bj(br,bs){var bq=0===f.inArray(br,bs.matches);return bq||f.each(bs.matches,function(bt,bu){return bu.isQuantifier===!0&&(bq=bj(br,bs.matches[bt-1]))?!1:void 0}),bq}function a8(bs,br){var bq=U(bs,br);return bq?bq.locator.slice(bq.alternation+1):[]}if(aK>10000){throw"Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+K().mask}if(aK===aO&&void 0===bc.matches){return aJ.push({match:bc,locator:bn.reverse(),cd:aQ}),!0}if(void 0!==bc.matches){if(bc.isGroup&&bm!==bc){if(bc=aZ(aY.matches[f.inArray(bc,aY.matches)+1],bn)){return !0}}else{if(bc.isOptional){var bf=bc;if(bc=aD(bc,aV,bn,bm)){if(aR=aJ[aJ.length-1].match,!bj(aR,bf)){return !0}aP=!0,aK=aO}}else{if(bc.isAlternator){var a2,a3=bc,a0=[],a4=aJ.slice(),a6=bn.length,a7=aV.length>0?aV.shift():-1;if(-1===a7||"string"==typeof a7){var be,bo=aK,bd=aV.slice(),bl=[];if("string"==typeof a7){bl=a7.split(",")}else{for(be=0;bebh&&(bc=aZ(aY.matches[bh],[bh].concat(bn.slice(1,bn.length)),bm),bc&&(bl.push(bh.toString()),f.each(aJ,function(bq,br){br.alternation=bn.length-1})))}a2=aJ.slice(),aK=bo,aJ=[];for(var bk=0;bk0}else{bc=aZ(a3.matches[a7]||aY.matches[a7],[a7].concat(bn),bm)}if(bc){return !0}}else{if(bc.isQuantifier&&bm!==aY.matches[f.inArray(bc,aY.matches)-1]){for(var bp=bc,a5=aV.length>0?aV.shift():0;a5<(isNaN(bp.quantifier.max)?a5+1:bp.quantifier.max)&&aO>=aK;a5++){var ba=aY.matches[f.inArray(bp,aY.matches)-1];if(bc=aZ(ba,[a5].concat(bn),ba)){if(aR=aJ[aJ.length-1].match,aR.optionalQuantifier=a5>bp.quantifier.min-1,bj(aR,ba)){if(a5>bp.quantifier.min-1){aP=!0,aK=aO;break}return !0}return !0}}}else{if(bc=aD(bc,aV,bn,bm)){return !0}}}}}}else{aK++}}for(var aW=aV.length>0?aV.shift():0;aWaO){break}}}}function aL(aT){var aU=aT[0]||aT;return aU.locator.slice()}var aR,aE=K().maskToken,aK=aH?aG:0,aS=aH||[0],aJ=[],aP=!1,aQ=aH?aH.join(""):"";if(aO>-1){if(void 0===aH){for(var aN,aM=aO-1;void 0===(aN=K().validPositions[aM]||K().tests[aM])&&aM>-1;){aM--}void 0!==aN&&aM>-1&&(aS=aL(aN),aQ=aS.join(""),aN=aN[0]||aN,aK=aM)}if(K().tests[aO]&&K().tests[aO][0].cd===aQ){return K().tests[aO]}for(var aF=aS.shift();aFaO){break}}}return(0===aJ.length||aP)&&aJ.push({match:{fn:null,cardinality:0,optionality:!0,casing:null,def:""},locator:[]}),K().tests[aO]=f.extend(!0,[],aJ),K().tests[aO]}function aC(){return void 0===K()._buffer&&(K()._buffer=aw(!1,1)),K()._buffer}function n(aD){if(void 0===K().buffer||aD===!0){if(aD===!0){for(var aE in K().tests){void 0===K().validPositions[aE]&&delete K().tests[aE]}}K().buffer=aw(!0,r(),!0)}return K().buffer}function ab(aG,aE,aD){var aF;if(aD=aD,aG===!0){N(),aG=0,aE=aD.length}else{for(aF=aG;aE>aF;aF++){delete K().validPositions[aF],delete K().tests[aF]}}for(aF=aG;aE>aF;aF++){N(!0),aD[aF]!==T.skipOptionalPartCharacter&&u(aF,aD[aF],!0,!0)}}function Z(aD,aE){switch(aE.casing){case"upper":aD=aD.toUpperCase();break;case"lower":aD=aD.toLowerCase()}return aD}function o(aF,aE){for(var aH=T.greedy?aE:aE.slice(0,1),aD=!1,aG=0;aG1||aU.begin-aU.end===1&&T.insertMode:aU.end-aU.begin>1||aU.end-aU.begin===1&&T.insertMode}function aG(aV,aY,aX,aU){var aW=!1;return f.each(C(aV),function(a8,a1){for(var a6=a1.match,a2=aY?1:0,a0="",a4=a6.cardinality;a4>a2;a4--){a0+=S(aV-(a4-1))}if(aY&&(a0+=aY),n(!0),aW=null!=a6.fn?a6.fn.test(a0,K(),aV,aX,T):aY!==a6.def&&aY!==T.skipOptionalPartCharacter||""===a6.def?!1:{c:a6.placeholder||a6.def,pos:aV},aW!==!1){var a3=void 0!==aW.c?aW.c:aY;a3=a3===T.skipOptionalPartCharacter&&null===a6.fn?a6.placeholder||a6.def:a3;var aZ=aV,a7=n();if(void 0!==aW.remove&&(f.isArray(aW.remove)||(aW.remove=[aW.remove]),f.each(aW.remove.sort(function(ba,a9){return a9-ba}),function(a9,ba){aa(ba,ba+1,!0)})),void 0!==aW.insert&&(f.isArray(aW.insert)||(aW.insert=[aW.insert]),f.each(aW.insert.sort(function(ba,a9){return ba-a9}),function(a9,ba){u(ba.pos,ba.c,!1,aU)})),aW.refreshFromBuffer){var a5=aW.refreshFromBuffer;if(aX=!0,ab(a5===!0?a5:a5.start,a5.end,a7),void 0===aW.pos&&void 0===aW.c){return aW.pos=r(),!1}if(aZ=void 0!==aW.pos?aW.pos:aV,aZ!==aV){return aW=f.extend(aW,u(aZ,a3,!0,aU)),!1}}else{if(aW!==!0&&void 0!==aW.pos&&aW.pos!==aV&&(aZ=aW.pos,ab(aV,aZ,n().slice()),aZ!==aV)){return aW=f.extend(aW,u(aZ,a3,!0)),!1}}return aW!==!0&&void 0===aW.pos&&void 0===aW.c?!1:(a8>0&&N(!0),B(aZ,f.extend({},a1,{input:Z(a3,a6)}),aU,aK(aO))||(aW=!1),!1)}}),aW}function aI(a0,bf,bj,bd){for(var a3,bh,aZ,a1,be,aW,aV=f.extend(!0,{},K().validPositions),aX=f.extend(!0,{},K().tests),a2=r();a2>=0&&(a1=K().validPositions[a2],!a1||void 0===a1.alternation||(a3=a2,bh=K().validPositions[a3].alternation,E(a3).locator[a1.alternation]===a1.locator[a1.alternation]));a2--){}if(void 0!==bh){a3=parseInt(a3);for(var a7 in K().validPositions){if(a7=parseInt(a7),a1=K().validPositions[a7],a7>=a3&&void 0!==a1.alternation){var bg;0===a3?(bg=[],f.each(K().tests[a3],function(bk,bl){void 0!==bl.locator[bh]&&(bg=bg.concat(bl.locator[bh].toString().split(",")))})):bg=K().validPositions[a3].locator[bh].toString().split(",");var a9=void 0!==a1.locator[bh]?a1.locator[bh]:bg[0];a9.length>0&&(a9=a9.split(",")[0]);for(var a6=0;a6=0;a8--){if(aY=K().validPositions[a8],void 0!==aY){var aU=U(a8,bg[a6]);K().validPositions[a8].match.def!==aU.match.def&&(bc.push(K().validPositions[a8].input),K().validPositions[a8]=aU,K().validPositions[a8].input=aA(a8),null===K().validPositions[a8].match.fn&&ba++,aY=aU),bi=aY.locator[bh],aY.locator[bh]=parseInt(bg[a6]);break}}if(a9!==aY.locator[bh]){for(be=a7+1;bebe&&bb++,delete K().validPositions[be],delete K().tests[be]}for(N(!0),T.keepStatic=!T.keepStatic,aZ=!0;bc.length>0;){var a5=bc.shift();if(a5!==T.skipOptionalPartCharacter&&!(aZ=u(r(void 0,!0)+1,a5,!1,bd))){break}}if(aY.alternation=bh,aY.locator[bh]=bi,aZ){var a4=r(a0)+1;for(be=a7+1;bebe&&ba++}a0+=ba-bb,aZ=u(a0>a4?a4:a0,bf,bj,bd)}if(T.keepStatic=!T.keepStatic,aZ){return aZ}N(),K().validPositions=f.extend(!0,{},aV),K().tests=f.extend(!0,{},aX)}}}break}}}return !1}function aL(aY,a0){for(var aV=K().validPositions[a0],aZ=aV.locator,a2=aZ.length,aU=aY;a0>aU;aU++){if(void 0===K().validPositions[aU]&&!M(aU,!0)){var aW=C(aU),aX=aW[0],a1=-1;f.each(aW,function(a4,a3){for(var a5=0;a2>a5&&(void 0!==a3.locator[a5]&&o(a3.locator[a5].toString().split(","),aZ[a5].toString().split(",")));a5++){a5>a1&&(a1=a5,aX=a3)}}),B(aU,f.extend({},aX,{input:aX.match.placeholder||aX.match.def}),!0)}}}aR=aR===!0;var aQ=aO;void 0!==aO.begin&&(aQ=ao&&!aK(aO)?aO.end:aO.begin);for(var aT=!1,aP=f.extend(!0,{},K().validPositions),aM=aQ-1;aM>-1&&!K().validPositions[aM];aM--){}aM++;for(var aH;aQ>aM;aM++){n(),void 0===K().validPositions[aM]&&((aH=E(aM)).match.def===T.radixPointDefinitionSymbol||!M(aM,!0)||f.inArray(T.radixPoint,n())=aF;aF++){if(aT=aG(aF,aN,aR,aJ),aT!==!1){aL(aQ,aF),aQ=aF;break}}}}else{aT={caret:p(aQ)}}}return aT===!1&&T.keepStatic&&(aT=aI(aQ,aN,aR,aJ)),aT===!0&&(aT={pos:aQ}),f.isFunction(T.postValidation)&&aT!==!1&&!aR&&aJ!==!0&&(aT=T.postValidation(n(!0),aT,T)?aT:!1),void 0===aT.pos&&(aT.pos=aQ),aT===!1&&(N(!0),K().validPositions=f.extend(!0,{},aP)),aT}function M(aG,aD){var aF;if(aD?(aF=E(aG).match,""===aF.def&&(aF=ag(aG))):aF=ag(aG),null!=aF.fn){return aF.fn}if(aD!==!0&&aG>-1&&!T.keepStatic&&void 0===K().validPositions[aG]){var aE=C(aG);return aE.length>2}return !1}function ak(){var aI;y=void 0!==ax?ax.maxLength:void 0,-1===y&&(y=void 0);var aH,aG=r(),aD=K().validPositions[aG],aF=void 0!==aD?aD.locator.slice():void 0;for(aH=aG+1;void 0===aD||null!==aD.match.fn||null===aD.match.fn&&""!==aD.match.def;aH++){aD=E(aH,aF,aH-1),aF=aD.locator.slice()}var aE=ag(aH-1);return aI=""!==aE.def?aH:aH-1,void 0===y||y>aI?aI:y}function p(aG,aF){var aE=ak();if(aG>=aE){return aE}for(var aD=aG;++aDaD));){}return aD}function au(aF,aE){var aD=aF;if(0>=aD){return 0}for(;--aD>0&&(aE===!0&&ag(aD).newBlockMarker!==!0||aE!==!0&&!M(aD));){}return aD}function S(aD){return void 0===K().validPositions[aD]?aA(aD):K().validPositions[aD].input}function ac(aF,aE,aG,aJ,aI){if(aJ&&f.isFunction(T.onBeforeWrite)){var aD=T.onBeforeWrite(aJ,aE,aG,T);if(aD){if(aD.refreshFromBuffer){var aH=aD.refreshFromBuffer;ab(aH===!0?aH:aH.start,aH.end,aD.buffer||aE),aE=n(!0)}void 0!==aG&&(aG=void 0!==aD.caret?aD.caret:aG)}}aF.inputmask._valueSet(aE.join("")),void 0===aG||void 0!==aJ&&"blur"===aJ.type||I(aF,aG),aI===!0&&(s=!0,f(aF).trigger("input"))}function aA(aI,aH){if(aH=aH||ag(aI),void 0!==aH.placeholder){return aH.placeholder}if(null===aH.fn){if(aI>-1&&!T.keepStatic&&void 0===K().validPositions[aI]){var aF,aE=C(aI),aG=0;if(aE.length>2){for(var aD=0;aD1)){return T.placeholder.charAt(aI%T.placeholder.length)}}}}return aH.def}return T.placeholder.charAt(aI%T.placeholder.length)}function z(aK,aJ,aL,aI){function aM(){var aP=!1,aQ=aC().slice(aE,p(aE)).join("").indexOf(aG);if(-1!==aQ&&!M(aE)){aP=!0;for(var aO=aC().slice(aE,aE+aQ),aN=0;aN0&&(aD.splice(0,aF.length*aH.length),aE=p(aE))}else{aE=p(aE)}}f.each(aD,function(aP,aN){if(void 0!==aN){var aO=new f.Event("keypress");aO.which=aN.charCodeAt(0),aG+=aN;var aT=r(void 0,!0),aR=K().validPositions[aT],aQ=E(aT+1,aR?aR.locator.slice():void 0,aT);if(!aM()||aL||T.autoUnmask){var aS=aL?aP:null==aQ.match.fn&&aQ.match.optionality&&aT+1aL.scrollWidth?aJ:0,b||T.insertMode!==!1||aF!==aH||aH++,aL.setSelectionRange){aL.selectionStart=aF,aL.selectionEnd=aH}else{if(window.getSelection){if(aK=document.createRange(),void 0===aL.firstChild||null===aL.firstChild){var aG=document.createTextNode("");aL.appendChild(aG)}aK.setStart(aL.firstChild,aFaK&&(aJ=aI[aL],(aJ.match.optionality||aJ.match.optionalQuantifier||aD&&(aD!==aI[aL].locator[aM.alternation]&&null!=aJ.match.fn||null===aJ.match.fn&&aJ.locator[aM.alternation]&&o(aJ.locator[aM.alternation].toString().split(","),aD.toString().split(","))&&""!==C(aL)[0].def))&&aF[aL]===aA(aL,aJ.match));aL--){aE--}return aH?{l:aE,def:aI[aE]?aI[aE].match:void 0}:aE}function av(aE){for(var aF=D(),aD=aE.length-1;aD>aF&&!M(aD);aD--){}return aE.splice(aF,aD+1-aF),aE}function ad(aE){if(f.isFunction(T.isComplete)){return T.isComplete(aE,T)}if("*"===T.repeat){return void 0}var aD=!1,aF=D(!0),aH=au(aF.l);if(void 0===aF.def||aF.def.newBlockMarker||aF.def.optionality||aF.def.optionalQuantifier){aD=!0;for(var aG=0;aH>=aG;aG++){var aI=E(aG).match;if(null!==aI.fn&&void 0===K().validPositions[aG]&&aI.optionality!==!0&&aI.optionalQuantifier!==!0||null===aI.fn&&aE[aG]!==aA(aG,aI)){aD=!1;break}}}return aD}function an(aJ){function aF(aM){if(f.valHooks&&(void 0===f.valHooks[aM]||f.valHooks[aM].inputmaskpatch!==!0)){var aL=f.valHooks[aM]&&f.valHooks[aM].get?f.valHooks[aM].get:function(aO){return aO.value},aN=f.valHooks[aM]&&f.valHooks[aM].set?f.valHooks[aM].set:function(aO,aP){return aO.value=aP,aO};f.valHooks[aM]={get:function(aQ){if(aQ.inputmask){if(aQ.inputmask.opts.autoUnmask){return aQ.inputmask.unmaskedvalue()}var aO=aL(aQ),aR=aQ.inputmask.maskset,aP=aR._buffer;return aP=aP?aP.join(""):"",aO!==aP?aO:""}return aL(aQ)},set:function(aQ,aR){var aO,aP=f(aQ);return aO=aN(aQ,aR),aQ.inputmask&&aP.trigger("setvalue"),aO},inputmaskpatch:!0}}}function aD(){return this.inputmask?this.inputmask.opts.autoUnmask?this.inputmask.unmaskedvalue():aI.call(this)!==aC().join("")?document.activeElement===this&&T.clearMaskOnLostFocus?(ao?av(n().slice()).reverse():av(n().slice())).join(""):aI.call(this):"":aI.call(this)}function aK(aL){aE.call(this,aL),this.inputmask&&f(this).trigger("setvalue")}function aG(aL){W.on(aL,"mouseenter",function(aN){var aP=f(this),aM=this,aO=aM.inputmask._valueGet();aO!==n().join("")&&aP.trigger("setvalue")})}var aI,aE;if(!aJ.inputmask.__valueGet){if(Object.getOwnPropertyDescriptor){var aH=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(aJ),"value");aH&&aH.get&&aH.set?(aI=aH.get,aE=aH.set,Object.defineProperty(aJ,"value",{get:aD,set:aK,configurable:!0})):"INPUT"!==aJ.tagName&&(aI=function(){return this.textContent},aE=function(aL){this.textContent=aL},Object.defineProperty(aJ,"value",{get:aD,set:aK,configurable:!0}))}else{document.__lookupGetter__&&aJ.__lookupGetter__("value")&&(aI=aJ.__lookupGetter__("value"),aE=aJ.__lookupSetter__("value"),aJ.__defineGetter__("value",aD),aJ.__defineSetter__("value",aK))}void 0===aI&&(aI=function(){return aJ.value},aE=function(aL){aJ.value=aL},aF(aJ.type),aG(aJ)),aJ.inputmask.__valueGet=aI,aJ.inputmask._valueGet=function(aL){return ao&&aL!==!0?aI.call(this.el).split("").reverse().join(""):aI.call(this.el)},aJ.inputmask.__valueSet=aE,aJ.inputmask._valueSet=function(aL,aM){aE.call(this.el,null===aL||void 0===aL?"":aM!==!0&&ao?aL.split("").reverse().join(""):aL)}}}function V(aF,aE,aJ,aD){function aH(){if(T.keepStatic){N(!0);var aM,aL=[],aN=f.extend(!0,{},K().validPositions);for(aM=r();aM>=0;aM--){var aO=K().validPositions[aM];if(aO&&(null!=aO.match.fn&&aL.push(aO.input),delete K().validPositions[aM],void 0!==aO.alternation&&aO.locator[aO.alternation]===E(aM).locator[aO.alternation])){break}}if(aM>-1){for(;aL.length>0;){K().p=p(r());var aK=new f.Event("keypress");aK.which=aL.pop().charCodeAt(0),J.call(aF,aK,!0,!1,!1,K().p)}}else{K().validPositions=f.extend(!0,{},aN)}}}if((T.numericInput||ao)&&(aE===e.keyCode.BACKSPACE?aE=e.keyCode.DELETE:aE===e.keyCode.DELETE&&(aE=e.keyCode.BACKSPACE),ao)){var aG=aJ.end;aJ.end=aJ.begin,aJ.begin=aG}aE===e.keyCode.BACKSPACE&&(aJ.end-aJ.begin<1||T.insertMode===!1)?(aJ.begin=au(aJ.begin),void 0===K().validPositions[aJ.begin]||K().validPositions[aJ.begin].input!==T.groupSeparator&&K().validPositions[aJ.begin].input!==T.radixPoint||aJ.begin--):aE===e.keyCode.DELETE&&aJ.begin===aJ.end&&(aJ.end=M(aJ.end)?aJ.end+1:p(aJ.end)+1,void 0===K().validPositions[aJ.begin]||K().validPositions[aJ.begin].input!==T.groupSeparator&&K().validPositions[aJ.begin].input!==T.radixPoint||aJ.end++),aa(aJ.begin,aJ.end,!1,aD),aD!==!0&&aH();var aI=r(aJ.begin);aI1||void 0!==aT[aO].alternation)?aO+1:p(aO)}K().p=aI}if(aD!==!1){var aN=this;if(setTimeout(function(){T.onKeyValidation.call(aN,aQ,aF,T)},0),K().writeOutBuffer&&aF!==!1){var aP=n();ac(aM,aP,T.numericInput&&void 0===aF.caret?au(aI):aI,aR,aG!==!0),aG!==!0&&setTimeout(function(){ad(aP)===!0&&aE.trigger("complete")},0)}}if(T.showTooltip&&(aM.title=T.tooltip||K().mask),aG&&f.isFunction(T.onBeforeWrite)){var aL=T.onBeforeWrite(aR,n(),aI,T);if(aL&&aL.refreshFromBuffer){var aH=aL.refreshFromBuffer;ab(aH===!0?aH:aH.start,aH.end,aL.buffer),N(!0),aL.caret&&(K().p=aL.caret)}}if(aR.preventDefault(),aG){return aF}}}function am(aI){var aD,aM=this,aK=aI.originalEvent||aI,aJ=f(aM),aE=aM.inputmask._valueGet(!0),aH=I(aM);ao&&(aD=aH.end,aH.end=aH.begin,aH.begin=aD);var aG=aE.substr(0,aH.begin),aF=aE.substr(aH.end,aE.length);aG===(ao?aC().reverse():aC()).slice(0,aH.begin).join("")&&(aG=""),aF===(ao?aC().reverse():aC()).slice(aH.end).join("")&&(aF=""),ao&&(aD=aG,aG=aF,aF=aD),window.clipboardData&&window.clipboardData.getData?aE=aG+window.clipboardData.getData("Text")+aF:aK.clipboardData&&aK.clipboardData.getData&&(aE=aG+aK.clipboardData.getData("text/plain")+aF);var aL=aE;if(f.isFunction(T.onBeforePaste)){if(aL=T.onBeforePaste(aE,T),aL===!1){return aI.preventDefault()}aL||(aL=aE)}return z(aM,!1,!1,ao?aL.split("").reverse():aL.toString().split("")),ac(aM,n(),p(r()),aI,!0),ad(n())===!0&&aJ.trigger("complete"),aI.preventDefault()}function H(aJ){var aF=this,aD=aF.inputmask._valueGet();if(n().join("")!==aD){var aH=I(aF);if(aD=aD.replace(new RegExp("("+e.escapeRegex(aC().join(""))+")*"),""),a){var aI=aD.replace(n().join(""),"");if(1===aI.length){var aE=new f.Event("keypress");return aE.which=aI.charCodeAt(0),J.call(aF,aE,!0,!0,!1,K().validPositions[aH.begin-1]?aH.begin:aH.begin-1),!1}}if(aH.begin>aD.length&&(I(aF,aD.length),aH=I(aF)),n().length-aD.length!==1||aD.charAt(aH.begin)===n()[aH.begin]||aD.charAt(aH.begin+1)===n()[aH.begin]||M(aH.begin)){for(var aK=r()+1,aG=n().slice(aK).join("");null===aD.match(e.escapeRegex(aG)+"$");){aG=aG.slice(1)}aD=aD.replace(aG,""),aD=aD.split(""),z(aF,!0,!1,aD),ad(n())===!0&&f(aF).trigger("complete")}else{aJ.keyCode=e.keyCode.BACKSPACE,az.call(aF,aJ)}aJ.preventDefault()}}function Q(aF){var aD=this,aE=aD.inputmask._valueGet();z(aD,!0,!1,(f.isFunction(T.onBeforeMask)?T.onBeforeMask(aE,T)||aE:aE).split("")),R=n().join(""),(T.clearMaskOnLostFocus||T.clearIncomplete)&&aD.inputmask._valueGet()===aC().join("")&&aD.inputmask._valueSet("")}function Y(aE){var aD=this,aF=aD.inputmask._valueGet();T.showMaskOnFocus&&(!T.showMaskOnHover||T.showMaskOnHover&&""===aF)?aD.inputmask._valueGet()!==n().join("")&&ac(aD,n(),p(r())):x===!1&&I(aD,p(r())),T.positionCaretOnTab===!0&&setTimeout(function(){I(aD,p(r()))},0),R=n().join("")}function ay(aF){var aE=this;if(x=!1,T.clearMaskOnLostFocus&&document.activeElement!==aE){var aD=n().slice(),aG=aE.inputmask._valueGet();aG!==aE.getAttribute("placeholder")&&""!==aG&&(-1===r()&&aG===aC().join("")?aD=[]:av(aD),ac(aE,aD))}}function aB(aJ){function aI(aM){if(T.radixFocus&&""!==T.radixPoint){var aN=K().validPositions;if(void 0===aN[aM]||aN[aM].input===aA(aM)){if(aMaK&&aN[aL].input!==aA(aL)){return !1}}return !0}}}return !1}var aF=this;if(document.activeElement===aF){var aH=I(aF);if(aH.begin===aH.end){if(aI(aH.begin)){I(aF,T.numericInput?p(f.inArray(T.radixPoint,n())):f.inArray(T.radixPoint,n()))}else{var aG=aH.begin,aE=r(aG,!0),aD=p(aE);aD>aG?I(aF,M(aG)||M(aG-1)?aG:p(aG)):((n()[aD]!==aA(aD)||!M(aD,!0)&&ag(aD).def===aA(aD))&&(aD=p(aD)),I(aF,aD))}}}}function t(aE){var aD=this;setTimeout(function(){I(aD,0,p(r()))},0)}function af(aG){var aD=this,aJ=f(aD),aI=I(aD),aF=aG.originalEvent||aG,aH=window.clipboardData||aF.clipboardData,aE=ao?n().slice(aI.end,aI.begin):n().slice(aI.begin,aI.end);aH.setData("text",ao?aE.reverse().join(""):aE.join("")),document.execCommand&&document.execCommand("copy"),V(aD,e.keyCode.DELETE,aI),ac(aD,n(),K().p,aG,R!==n().join("")),aD.inputmask._valueGet()===aC().join("")&&aJ.trigger("cleared"),T.showTooltip&&(aD.title=T.tooltip||K().mask)}function v(aF){var aH=f(this),aE=this;if(aE.inputmask){var aG=aE.inputmask._valueGet(),aD=n().slice();R!==aD.join("")&&setTimeout(function(){aH.trigger("change"),R=aD.join("")},0),""!==aG&&(T.clearMaskOnLostFocus&&(-1===r()&&aG===aC().join("")?aD=[]:av(aD)),ad(aD)===!1&&(setTimeout(function(){aH.trigger("incomplete")},0),T.clearIncomplete&&(N(),aD=T.clearMaskOnLostFocus?[]:aC().slice())),ac(aE,aD,void 0,aF))}}function P(aE){var aD=this;x=!0,document.activeElement!==aD&&T.showMaskOnHover&&aD.inputmask._valueGet()!==n().join("")&&ac(aD,n())}function aj(aD){R!==n().join("")&&al.trigger("change"),T.clearMaskOnLostFocus&&-1===r()&&ax.inputmask._valueGet&&ax.inputmask._valueGet()===aC().join("")&&ax.inputmask._valueSet(""),T.removeMaskOnSubmit&&(ax.inputmask._valueSet(ax.inputmask.unmaskedvalue(),!0),setTimeout(function(){ac(ax,n())},0))}function X(aD){setTimeout(function(){al.trigger("setvalue")},0)}function at(aF){if(ax=aF,al=f(ax),T.showTooltip&&(ax.title=T.tooltip||K().mask),("rtl"===ax.dir||T.rightAlign)&&(ax.style.textAlign="right"),("rtl"===ax.dir||T.numericInput)&&(ax.dir="ltr",ax.removeAttribute("dir"),ax.inputmask.isRTL=!0,ao=!0),W.off(ax),an(ax),i(ax,T)&&(W.on(ax,"submit",aj),W.on(ax,"reset",X),W.on(ax,"mouseenter",P),W.on(ax,"blur",v),W.on(ax,"focus",Y),W.on(ax,"mouseleave",ay),W.on(ax,"click",aB),W.on(ax,"dblclick",t),W.on(ax,"paste",am),W.on(ax,"dragdrop",am),W.on(ax,"drop",am),W.on(ax,"cut",af),W.on(ax,"complete",T.oncomplete),W.on(ax,"incomplete",T.onincomplete),W.on(ax,"cleared",T.oncleared),W.on(ax,"keydown",az),W.on(ax,"keypress",J),W.on(ax,"input",H)),W.on(ax,"setvalue",Q),""!==ax.inputmask._valueGet()||T.clearMaskOnLostFocus===!1||document.activeElement===ax){var aD=f.isFunction(T.onBeforeMask)?T.onBeforeMask(ax.inputmask._valueGet(),T)||ax.inputmask._valueGet():ax.inputmask._valueGet();z(ax,!0,!1,aD.split(""));var aE=n().slice();R=aE.join(""),ad(aE)===!1&&T.clearIncomplete&&N(),T.clearMaskOnLostFocus&&document.activeElement!==ax&&(aE.join("")===aC().join("")?aE=[]:av(aE)),ac(ax,aE),document.activeElement===ax&&I(ax,p(r()))}}var R,ax,al,y,q,ao=!1,ah=!1,s=!1,G=!1,x=!0,W={on:function(aE,aD,aF){var aG=function(aK){if(void 0===this.inputmask&&"FORM"!==this.nodeName){var aH=f.data(this,"_inputmask_opts");aH?new e(aH).mask(this):W.off(this)}else{if("setvalue"===aK.type||!(this.disabled||this.readOnly&&!("keydown"===aK.type&&aK.ctrlKey&&67===aK.keyCode||T.tabThrough===!1&&aK.keyCode===e.keyCode.TAB))){switch(aK.type){case"input":if(s===!0){return s=!1,aK.preventDefault()}break;case"keydown":ah=!1,s=!1;break;case"keypress":if(ah===!0){return aK.preventDefault()}ah=!0;break;case"click":if(a){var aJ=this;return setTimeout(function(){aF.apply(aJ,arguments)},0),!1}}var aI=aF.apply(this,arguments);return aI===!1&&(aK.preventDefault(),aK.stopPropagation()),aI}aK.preventDefault()}};aE.inputmask.events[aD]=aE.inputmask.events[aD]||[],aE.inputmask.events[aD].push(aG),-1!==f.inArray(aD,["submit","reset"])?null!=aE.form&&f(aE.form).on(aD,aG):f(aE).on(aD,aG)},off:function(aD,aF){if(aD.inputmask&&aD.inputmask.events){var aE;aF?(aE=[],aE[aF]=aD.inputmask.events[aF]):aE=aD.inputmask.events,f.each(aE,function(aG,aI){for(;aI.length>0;){var aH=aI.pop();-1!==f.inArray(aG,["submit","reset"])?null!=aD.form&&f(aD.form).off(aG,aH):f(aD).off(aG,aH)}delete aD.inputmask.events[aG]})}}};if(void 0!==w){switch(w.action){case"isComplete":return ax=w.el,ad(n());case"unmaskedvalue":return ax=w.el,void 0!==ax&&void 0!==ax.inputmask?(F=ax.inputmask.maskset,T=ax.inputmask.opts,ao=ax.inputmask.isRTL):(q=w.value,T.numericInput&&(ao=!0),q=(f.isFunction(T.onBeforeMask)?T.onBeforeMask(q,T)||q:q).split(""),z(void 0,!1,!1,ao?q.reverse():q),f.isFunction(T.onBeforeWrite)&&T.onBeforeWrite(void 0,n(),0,T)),m(ax);case"mask":ax=w.el,F=ax.inputmask.maskset,T=ax.inputmask.opts,ao=ax.inputmask.isRTL,R=n().join(""),at(ax);break;case"format":return T.numericInput&&(ao=!0),q=(f.isFunction(T.onBeforeMask)?T.onBeforeMask(w.value,T)||w.value:w.value).split(""),z(void 0,!1,!1,ao?q.reverse():q),f.isFunction(T.onBeforeWrite)&&T.onBeforeWrite(void 0,n(),0,T),w.metadata?{value:ao?n().slice().reverse().join(""):n().join(""),metadata:g({action:"getmetadata"},F,T)}:ao?n().slice().reverse().join(""):n().join("");case"isValid":T.numericInput&&(ao=!0),w.value?(q=w.value.split(""),z(void 0,!1,!0,ao?q.reverse():q)):w.value=n().join("");for(var O=n(),ae=D(),L=O.length-1;L>ae&&!M(L);L--){}return O.splice(ae,L+1-ae),ad(O)&&w.value===n().join("");case"getemptymask":return aC().join("");case"remove":ax=w.el,al=f(ax),F=ax.inputmask.maskset,T=ax.inputmask.opts,ax.inputmask._valueSet(m(ax)),W.off(ax);var ap;Object.getOwnPropertyDescriptor?(ap=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(ax),"value"),ap&&ax.inputmask.__valueGet&&Object.defineProperty(ax,"value",{get:ax.inputmask.__valueGet,set:ax.inputmask.__valueSet,configurable:!0})):document.__lookupGetter__&&ax.__lookupGetter__("value")&&ax.inputmask.__valueGet&&(ax.__defineGetter__("value",ax.inputmask.__valueGet),ax.__defineSetter__("value",ax.inputmask.__valueSet)),ax.inputmask=void 0;break;case"getmetadata":if(f.isArray(F.metadata)){for(var ai,aq=r(void 0,!0),A=aq;A>=0;A--){if(K().validPositions[A]&&void 0!==K().validPositions[A].alternation){ai=K().validPositions[A].alternation;break}}return void 0!==ai?F.metadata[K().validPositions[A].locator[ai]]:[]}return F.metadata}}}e.prototype={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},alternatormarker:"|",escapeChar:"\\",mask:null,oncomplete:f.noop,onincomplete:f.noop,oncleared:f.noop,repeat:0,greedy:!0,autoUnmask:!1,removeMaskOnSubmit:!1,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,aliases:{},alias:null,onKeyDown:f.noop,onBeforeMask:null,onBeforePaste:function(m,n){return f.isFunction(n.onBeforeMask)?n.onBeforeMask(m,n):m},onBeforeWrite:null,onUnMask:null,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:f.noop,skipOptionalPartCharacter:" ",showTooltip:!1,tooltip:void 0,numericInput:!1,rightAlign:!1,undoOnEscape:!0,radixPoint:"",radixPointDefinitionSymbol:void 0,groupSeparator:"",radixFocus:!1,nojumps:!1,nojumpsThreshold:0,keepStatic:null,positionCaretOnTab:!1,tabThrough:!1,supportsInputType:["text","tel","password"],definitions:{"9":{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,definitionSymbol:"*"},"*":{validator:"[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1}},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],isComplete:null,canClearPosition:f.noop,postValidation:null,staticDefinitionSymbol:void 0,jitMasking:!1},masksCache:{},mask:function(m){var n=this;return"string"==typeof m&&(m=document.getElementById(m)||document.querySelectorAll(m)),m=m.nodeName?[m]:m,f.each(m,function(p,q){var o=f.extend(!0,{},n.opts);l(q,o,f.extend(!0,{},n.userOptions));var r=d(o,n.noMasksCache);void 0!==r&&(void 0!==q.inputmask&&q.inputmask.remove(),q.inputmask=new e(),q.inputmask.opts=o,q.inputmask.noMasksCache=n.noMasksCache,q.inputmask.userOptions=f.extend(!0,{},n.userOptions),q.inputmask.el=q,q.inputmask.maskset=r,q.inputmask.isRTL=!1,f.data(q,"_inputmask_opts",o),g({action:"mask",el:q}))}),m&&m[0]?m[0].inputmask||this:this},option:function(m){return"string"==typeof m?this.opts[m]:"object"==typeof m?(f.extend(this.opts,m),f.extend(this.userOptions,m),this.el&&(void 0!==m.mask||void 0!==m.alias?this.mask(this.el):(f.data(this.el,"_inputmask_opts",this.opts),g({action:"mask",el:this.el}))),this):void 0},unmaskedvalue:function(m){return g({action:"unmaskedvalue",el:this.el,value:m},this.el&&this.el.inputmask?this.el.inputmask.maskset:d(this.opts,this.noMasksCache),this.opts)},remove:function(){return this.el?(g({action:"remove",el:this.el}),this.el.inputmask=void 0,this.el):void 0},getemptymask:function(){return g({action:"getemptymask"},this.maskset||d(this.opts,this.noMasksCache),this.opts)},hasMaskedValue:function(){return !this.opts.autoUnmask},isComplete:function(){return g({action:"isComplete",el:this.el},this.maskset||d(this.opts,this.noMasksCache),this.opts)},getmetadata:function(){return g({action:"getmetadata"},this.maskset||d(this.opts,this.noMasksCache),this.opts)},isValid:function(m){return g({action:"isValid",value:m},this.maskset||d(this.opts,this.noMasksCache),this.opts)},format:function(n,m){return g({action:"format",value:n,metadata:m},this.maskset||d(this.opts,this.noMasksCache),this.opts)}},e.extendDefaults=function(m){f.extend(!0,e.prototype.defaults,m)},e.extendDefinitions=function(m){f.extend(!0,e.prototype.defaults.definitions,m)},e.extendAliases=function(m){f.extend(!0,e.prototype.defaults.aliases,m)},e.format=function(o,m,n){return e(m).format(o,n)},e.unmask=function(n,m){return e(m).unmaskedvalue(n)},e.isValid=function(n,m){return e(m).isValid(n)},e.remove=function(m){f.each(m,function(n,o){o.inputmask&&o.inputmask.remove()})},e.escapeRegex=function(n){var m=["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^"];return n.replace(new RegExp("(\\"+m.join("|\\")+")","gim"),"\\$1")},e.keyCode={ALT:18,BACKSPACE:8,BACKSPACE_SAFARI:127,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91,X:88};var c=navigator.userAgent,b=/mobile/i.test(c),a=/iemobile/i.test(c),j=/iphone/i.test(c)&&!a;/android.*safari.*/i.test(c)&&!a;return window.Inputmask=e,e}(jQuery),function(b,a){return void 0===b.fn.inputmask&&(b.fn.inputmask=function(e,d){var f,c=this[0];if(void 0===d&&(d={}),"string"==typeof e){switch(e){case"unmaskedvalue":return c&&c.inputmask?c.inputmask.unmaskedvalue():b(c).val();case"remove":return this.each(function(){this.inputmask&&this.inputmask.remove()});case"getemptymask":return c&&c.inputmask?c.inputmask.getemptymask():"";case"hasMaskedValue":return c&&c.inputmask?c.inputmask.hasMaskedValue():!1;case"isComplete":return c&&c.inputmask?c.inputmask.isComplete():!0;case"getmetadata":return c&&c.inputmask?c.inputmask.getmetadata():void 0;case"setvalue":b(c).val(d),c&&void 0!==c.inputmask&&b(c).triggerHandler("setvalue");break;case"option":if("string"!=typeof d){return this.each(function(){return void 0!==this.inputmask?this.inputmask.option(d):void 0})}if(c&&void 0!==c.inputmask){return c.inputmask.option(d)}break;default:return d.alias=e,f=new a(d),this.each(function(){f.mask(this)})}}else{if("object"==typeof e){return f=new a(e),void 0===e.mask&&void 0===e.alias?this.each(function(){return void 0!==this.inputmask?this.inputmask.option(e):void f.mask(this)}):this.each(function(){f.mask(this)})}if(void 0===e){return this.each(function(){f=new a(d),f.mask(this)})}}}),b.fn.inputmask}(jQuery,Inputmask),function(b,a){return a.extendDefinitions({h:{validator:"[01][0-9]|2[0-3]",cardinality:2,prevalidator:[{validator:"[0-2]",cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:"[0-5]",cardinality:1}]},d:{validator:"0[1-9]|[12][0-9]|3[01]",cardinality:2,prevalidator:[{validator:"[0-3]",cardinality:1}]},m:{validator:"0[1-9]|1[012]",cardinality:2,prevalidator:[{validator:"[01]",cardinality:1}]},y:{validator:"(19|20)\\d{2}",cardinality:4,prevalidator:[{validator:"[12]",cardinality:1},{validator:"(19|20)",cardinality:2},{validator:"(19|20)\\d",cardinality:3}]}}),a.extendAliases({"dd/mm/yyyy":{mask:"1/2/y",placeholder:"dd/mm/yyyy",regex:{val1pre:new RegExp("[0-3]"),val1:new RegExp("0[1-9]|[12][0-9]|3[01]"),val2pre:function(d){var c=a.escapeRegex.call(this,d);return new RegExp("((0[1-9]|[12][0-9]|3[01])"+c+"[01])")},val2:function(d){var c=a.escapeRegex.call(this,d);return new RegExp("((0[1-9]|[12][0-9])"+c+"(0[1-9]|1[012]))|(30"+c+"(0[13-9]|1[012]))|(31"+c+"(0[13578]|1[02]))")}},leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(f,c,d){if(isNaN(f)){return !1}var e=parseInt(f.concat(c.toString().slice(f.length))),g=parseInt(f.concat(d.toString().slice(f.length)));return(isNaN(e)?!1:e>=c&&d>=e)||(isNaN(g)?!1:g>=c&&d>=g)},determinebaseyear:function(i,e,h){var g=new Date().getFullYear();if(i>g){return i}if(g>e){for(var d=e.toString().slice(0,2),f=e.toString().slice(2,4);d+h>e;){d--}var j=d+f;return i>j?i:j}if(g>=i&&e>=g){for(var c=g.toString().slice(0,2);c+h>e;){c--}var k=c+h;return i>k?i:k}return g},onKeyDown:function(h,c,f,g){var i=b(this);if(h.ctrlKey&&h.keyCode===a.keyCode.RIGHT){var d=new Date();i.val(d.getDate().toString()+(d.getMonth()+1).toString()+d.getFullYear().toString()),i.trigger("setvalue")}},getFrontValue:function(d,c,h){for(var j=0,g=0,f=0;fd?(h.buffer[i]=d.toString(),h.buffer[i-1]="0"):(h.buffer[i]=d.toString().charAt(1),h.buffer[i-1]=d.toString().charAt(0)),{refreshFromBuffer:{start:i-1,end:i+6},c:h.buffer[i]}}return g},cardinality:2,prevalidator:[{validator:function(d,g,h,c,e){var f=e.regex.hrspre.test(d);return c||f||!(f=e.regex.hrs.test("0"+d))?f:(g.buffer[h]="0",h++,{pos:h})},cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:function(d,g,h,c,e){var f=e.regex.mspre.test(d);return c||f||!(f=e.regex.ms.test("0"+d))?f:(g.buffer[h]="0",h++,{pos:h})},cardinality:1}]},t:{validator:function(d,f,g,c,e){return e.regex.ampm.test(d+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"mm/dd/yyyy hh:mm xm":{mask:"1/2/y h:s t\\m",placeholder:"mm/dd/yyyy hh:mm xm",alias:"datetime12",regex:{val2pre:function(d){var c=a.escapeRegex.call(this,d);return new RegExp("((0[13-9]|1[012])"+c+"[0-3])|(02"+c+"[0-2])")},val2:function(d){var c=a.escapeRegex.call(this,d);return new RegExp("((0[1-9]|1[012])"+c+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+c+"30)|((0[13578]|1[02])"+c+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},leapday:"02/29/",onKeyDown:function(h,c,f,g){var i=b(this);if(h.ctrlKey&&h.keyCode===a.keyCode.RIGHT){var d=new Date();i.val((d.getMonth()+1).toString()+d.getDate().toString()+d.getFullYear().toString()),i.trigger("setvalue")}}},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",placeholder:"hh:mm:ss",alias:"datetime",autoUnmask:!1},"hh:mm":{mask:"h:s",placeholder:"hh:mm",alias:"datetime",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"},shamsi:{regex:{val2pre:function(d){var c=a.escapeRegex.call(this,d);return new RegExp("((0[1-9]|1[012])"+c+"[0-3])")},val2:function(d){var c=a.escapeRegex.call(this,d);return new RegExp("((0[1-9]|1[012])"+c+"(0[1-9]|[12][0-9]))|((0[1-9]|1[012])"+c+"30)|((0[1-6])"+c+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},yearrange:{minyear:1300,maxyear:1499},mask:"y/1/2",leapday:"/12/30",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",clearIncomplete:!0}}),a}(jQuery,Inputmask),function(b,a){return a.extendDefinitions({A:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,casing:"upper"},"&":{validator:"[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,casing:"upper"},"#":{validator:"[0-9A-Fa-f]",cardinality:1,casing:"upper"}}),a.extendAliases({url:{definitions:{i:{validator:".",cardinality:1}},mask:"(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",insertMode:!1,autoUnmask:!1},ip:{mask:"i[i[i]].i[i[i]].i[i[i]].i[i[i]]",definitions:{i:{validator:function(d,f,g,c,e){return g-1>-1&&"."!==f.buffer[g-1]?(d=f.buffer[g-1]+d,d=g-2>-1&&"."!==f.buffer[g-2]?f.buffer[g-2]+d:"0"+d):d="00"+d,new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(d)},cardinality:1}},onUnMask:function(e,c,d){return e}},email:{mask:"*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}[.-{1,63}][.-{1,63}][.-{1,63}]",greedy:!1,onBeforePaste:function(c,d){return c=c.toLowerCase(),c.replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",cardinality:1,casing:"lower"},"-":{validator:"[0-9A-Za-z-]",cardinality:1,casing:"lower"}},onUnMask:function(e,c,d){return e}},mac:{mask:"##:##:##:##:##:##"},vin:{mask:"V{8}vV{4}9{4}",definitions:{V:{validator:"[A-HJ-NPR-Za-hj-npr-z\\d]",cardinality:1,casing:"upper"},v:{validator:"[Xx\\d]",cardinality:1,casing:"upper"}},clearIncomplete:!0,autoUnmask:!0}}),a}(jQuery,Inputmask),function(b,a){return a.extendAliases({numeric:{mask:function(e){function g(h){for(var j="",k=0;k1&&(e.placeholder=e.placeholder.charAt(0)),e.radixFocus=e.radixFocus&&""!==e.placeholder&&e.integerOptional===!0,e.definitions[";"]=e.definitions["~"],e.definitions[";"].definitionSymbol="~",1==e.numericInput&&(e.radixFocus=!1,e.digitsOptional=!1,isNaN(e.digits)&&(e.digits=2),e.decimalProtect=!1);var c=g(e.prefix);return c+="[+]",c+=e.integerOptional===!0?"~{1,"+e.integerDigits+"}":"~{"+e.integerDigits+"}",void 0!==e.digits&&(isNaN(e.digits)||parseInt(e.digits)>0)&&(e.decimalProtect&&(e.radixPointDefinitionSymbol=":"),c+=e.digitsOptional?"["+(e.decimalProtect?":":e.radixPoint)+";{1,"+e.digits+"}]":(e.decimalProtect?":":e.radixPoint)+";{"+e.digits+"}"),""!==e.negationSymbol.back&&(c+="[-]"),c+=g(e.suffix),e.greedy=!1,c},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,radixPoint:".",radixFocus:!0,groupSize:3,groupSeparator:"",autoGroup:!1,allowPlus:!0,allowMinus:!0,negationSymbol:{front:"-",back:""},integerDigits:"+",integerOptional:!0,prefix:"",suffix:"",rightAlign:!0,decimalProtect:!0,min:null,max:null,step:1,insertMode:!0,autoUnmask:!1,unmaskAsNumber:!1,postFormat:function(m,r,c){c.numericInput===!0&&(m=m.reverse(),isFinite(r)&&(r=m.join("").length-r-1));var n,f,s=!1;m.length>=c.suffix.length&&m.join("").indexOf(c.suffix)===m.length-c.suffix.length&&(m.length=m.length-c.suffix.length,s=!0),r=r>=m.length?m.length-1:r0&&c.autoGroup||-1!==o.indexOf(c.groupSeparator)){var j=a.escapeRegex(c.groupSeparator);k=0===o.indexOf(c.groupSeparator),o=o.replace(new RegExp(j,"g"),"");var e=o.split(c.radixPoint);if(o=""===c.radixPoint?o:e[0],o!==c.prefix+"?0"&&o.length>=c.groupSize+c.prefix.length){for(var d=new RegExp("([-+]?[\\d?]+)([\\d?]{"+c.groupSize+"})");d.test(o)&&""!==c.groupSeparator;){o=o.replace(d,"$1"+c.groupSeparator+"$2"),o=o.replace(c.groupSeparator+c.groupSeparator,c.groupSeparator)}}""!==c.radixPoint&&e.length>1&&(o+=c.radixPoint+e[1])}for(k=g!==o,m.length=o.length,n=0,f=o.length;f>n;n++){m[n]=o.charAt(n)}var q=b.inArray("?",m);if(-1===q&&(q=b.inArray(p,m)),m[q]=p,!k&&s){for(n=0,f=c.suffix.length;f>n;n++){m.push(c.suffix.charAt(n))}}return q=c.numericInput&&isFinite(r)?m.join("").length-q-1:q,c.numericInput&&(m=m.reverse(),b.inArray(c.radixPoint,m)parseFloat(d.max)&&(l=Math.abs(d.max),f=d.max<0,r=!0),p=l.toString().replace(".",d.radixPoint).split(""),isFinite(d.digits)){var j=b.inArray(d.radixPoint,p),m=b.inArray(d.radixPoint,c);-1===j&&(p.push(d.radixPoint),j=p.length-1);for(var h=1;h<=d.digits;h++){d.digitsOptional||void 0!==p[j+h]&&p[j+h]!==d.placeholder.charAt(0)?-1!==m&&void 0!==c[m+h]&&(p[j+h]=p[j+h]||c[m+h]):p[j+h]="0"}p[p.length-1]===d.radixPoint&&delete p[p.length-1]}if(l.toString()!==p&&l.toString()+"."!==p||f){return !f||0===l&&"blur"===n.type||(p.unshift(d.negationSymbol.front),p.push(d.negationSymbol.back)),p=(d.prefix+p.join("")).split(""),d.numericInput&&(p=p.reverse()),o=d.postFormat(p,d.numericInput?k:k-1,d),o.buffer&&(o.refreshFromBuffer=o.buffer.join("")!==g.join("")),o}}}return d.autoGroup?(o=d.postFormat(g,d.numericInput?k:k-1,d),o.caret=k<=d.prefix.length?o.pos:o.pos+1,o):void 0},regex:{integerPart:function(c){return new RegExp("["+a.escapeRegex(c.negationSymbol.front)+"+]?\\d+")},integerNPart:function(c){return new RegExp("[\\d"+a.escapeRegex(c.groupSeparator)+a.escapeRegex(c.placeholder.charAt(0))+"]+")}},signHandler:function(d,g,h,c,f){if(!c&&f.allowMinus&&"-"===d||f.allowPlus&&"+"===d){var e=g.buffer.join("").match(f.regex.integerPart(f));if(e&&e[0].length>0){return g.buffer[e.index]===("-"===d?"+":f.negationSymbol.front)?"-"===d?""!==f.negationSymbol.back?{pos:e.index,c:f.negationSymbol.front,remove:e.index,caret:h,insert:{pos:g.buffer.length-f.suffix.length-1,c:f.negationSymbol.back}}:{pos:e.index,c:f.negationSymbol.front,remove:e.index,caret:h}:""!==f.negationSymbol.back?{pos:e.index,c:"+",remove:[e.index,g.buffer.length-f.suffix.length-1],caret:h}:{pos:e.index,c:"+",remove:e.index,caret:h}:g.buffer[e.index]===("-"===d?f.negationSymbol.front:"+")?"-"===d&&""!==f.negationSymbol.back?{remove:[e.index,g.buffer.length-f.suffix.length-1],caret:h-1}:{remove:e.index,caret:h-1}:"-"===d?""!==f.negationSymbol.back?{pos:e.index,c:f.negationSymbol.front,caret:h+1,insert:{pos:g.buffer.length-f.suffix.length,c:f.negationSymbol.back}}:{pos:e.index,c:f.negationSymbol.front,caret:h+1}:{pos:e.index,c:d,caret:h+1}}}return !1},radixHandler:function(f,h,i,d,g){if(!d&&(-1!==b.inArray(f,[",","."])&&(f=g.radixPoint),f===g.radixPoint&&void 0!==g.digits&&(isNaN(g.digits)||parseInt(g.digits)>0))){var c=b.inArray(g.radixPoint,h.buffer),e=h.buffer.join("").match(g.regex.integerPart(g));if(-1!==c&&h.validPositions[c]){return h.validPositions[c-1]?{caret:c+1}:{pos:e.index,c:e[0],caret:c+1}}if(!e||"0"===e[0]&&e.index+1!==i){return h.buffer[e?e.index:i]="0",{pos:(e?e.index:i)+1,c:g.radixPoint}}}return !1},leadingZeroHandler:function(d,h,i,c,f){if(f.numericInput===!0){if("0"===h.buffer[h.buffer.length-f.prefix.length-1]){return{pos:i,remove:h.buffer.length-f.prefix.length-1}}}else{var g=b.inArray(f.radixPoint,h.buffer),e=h.buffer.slice(0,-1!==g?g:void 0).join("").match(f.regex.integerNPart(f));if(e&&!c&&(-1===g||g>=i)){if(0===e[0].indexOf(""!==f.placeholder?f.placeholder.charAt(0):"0")&&e.index+1===i){return h.buffer.splice(e.index,1),i=e.index,{pos:i,remove:e.index}}if("0"===d&&i<=e.index&&e[0]!==f.groupSeparator){return !1}}}return !0},definitions:{"~":{validator:function(d,h,i,c,e){var g=e.signHandler(d,h,i,c,e);if(!g&&(g=e.radixHandler(d,h,i,c,e),!g&&(g=c?new RegExp("[0-9"+a.escapeRegex(e.groupSeparator)+"]").test(d):new RegExp("[0-9]").test(d),g===!0&&(g=e.leadingZeroHandler(d,h,i,c,e),g===!0)))){var f=b.inArray(e.radixPoint,h.buffer);g=-1!==f&&(e.digitsOptional===!1||h.validPositions[i])&&e.numericInput!==!0&&i>f&&!c?{pos:i,remove:i}:{pos:i}}return g},cardinality:1,prevalidator:null},"+":{validator:function(d,g,h,c,e){var f=e.signHandler(d,g,h,c,e);return !f&&(c&&e.allowMinus&&d===e.negationSymbol.front||e.allowMinus&&"-"===d||e.allowPlus&&"+"===d)&&(f="-"===d?""!==e.negationSymbol.back?{pos:h,c:"-"===d?e.negationSymbol.front:"+",caret:h+1,insert:{pos:g.buffer.length,c:e.negationSymbol.back}}:{pos:h,c:"-"===d?e.negationSymbol.front:"+",caret:h+1}:!0),f},cardinality:1,prevalidator:null,placeholder:""},"-":{validator:function(d,g,h,c,e){var f=e.signHandler(d,g,h,c,e);return !f&&c&&e.allowMinus&&d===e.negationSymbol.back&&(f=!0),f},cardinality:1,prevalidator:null,placeholder:""},":":{validator:function(d,h,i,c,f){var g=f.signHandler(d,h,i,c,f);if(!g){var e="["+a.escapeRegex(f.radixPoint)+",\\.]";g=new RegExp(e).test(d),g&&h.validPositions[i]&&h.validPositions[i].match.placeholder===f.radixPoint&&(g={caret:i+1})}return g?{c:f.radixPoint}:g},cardinality:1,prevalidator:null,placeholder:function(c){return c.radixPoint}}},onUnMask:function(f,c,e){var d=f.replace(e.prefix,"");return d=d.replace(e.suffix,""),d=d.replace(new RegExp(a.escapeRegex(e.groupSeparator),"g"),""),e.unmaskAsNumber?(""!==e.radixPoint&&-1!==d.indexOf(e.radixPoint)&&(d=d.replace(a.escapeRegex.call(this,e.radixPoint),".")),Number(d)):d},isComplete:function(d,f){var g=d.join(""),c=d.slice();if(f.postFormat(c,0,f),c.join("")!==g){return !1}var e=g.replace(f.prefix,"");return e=e.replace(f.suffix,""),e=e.replace(new RegExp(a.escapeRegex(f.groupSeparator),"g"),""),","===f.radixPoint&&(e=e.replace(a.escapeRegex(f.radixPoint),".")),isFinite(e)},onBeforeMask:function(e,g){if(""!==g.radixPoint&&isFinite(e)){e=e.toString().replace(".",g.radixPoint)}else{var d=e.match(/,/g),i=e.match(/\./g);i&&d?i.length>d.length?(e=e.replace(/\./g,""),e=e.replace(",",g.radixPoint)):d.length>i.length?(e=e.replace(/,/g,""),e=e.replace(".",g.radixPoint)):e=e.indexOf(".")1||-1===c.indexOf(d.countrycode))&&(c="+"+d.countrycode+c),c}},phonebe:{alias:"phone",url:"phone-codes/phone-be.js",countrycode:"32",nojumpsThreshold:4}}),a}(jQuery,Inputmask),function(b,a){return a.extendAliases({Regex:{mask:"r",greedy:!1,repeat:"*",regex:null,regexTokens:null,tokenizer:/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,quantifierFilter:/[0-9]+[^,]/,isComplete:function(c,d){return new RegExp(d.regex).test(c.join(""))},definitions:{r:{validator:function(f,o,m,n,c){function k(t,i){this.matches=[],this.isGroup=t||!1,this.isQuantifier=i||!1,this.quantifier={min:1,max:1},this.repeaterPart=void 0}function r(){var z,v,x=new k(),A=[];for(c.regexTokens=[];z=c.tokenizer.exec(c.regex);){switch(v=z[0],v.charAt(0)){case"(":A.push(new k(!0));break;case")":j=A.pop(),A.length>0?A[A.length-1].matches.push(j):x.matches.push(j);break;case"{":case"+":case"*":var i=new k(!1,!0);v=v.replace(/[{}]/g,"");var t=v.split(","),w=isNaN(t[0])?t[0]:parseInt(t[0]),u=1===t.length?w:isNaN(t[1])?t[1]:parseInt(t[1]);if(i.quantifier={min:w,max:u},A.length>0){var y=A[A.length-1].matches;z=y.pop(),z.isGroup||(j=new k(!0),j.matches.push(z),z=j),y.push(z),y.push(i)}else{z=x.matches.pop(),z.isGroup||(j=new k(!0),j.matches.push(z),z=j),x.matches.push(z),x.matches.push(i)}break;default:A.length>0?A[A.length-1].matches.push(v):x.matches.push(v)}}x.matches.length>0&&c.regexTokens.push(x)}function p(z,u){var w=!1;u&&(s+="(",d++);for(var E=0;Es.length&&!(w=p(v,!0));){}w=w||p(v,!0),w&&(F.repeaterPart=s),s=G+F.quantifier.max}else{for(var D=0,I=F.quantifier.max-1;I>D&&!(w=p(v,!0));D++){}s=G+"{"+F.quantifier.min+","+F.quantifier.max+"}"}}else{if(void 0!==F.matches){for(var B=0;BC;C++){t+=")"}var A=new RegExp("^("+t+")$");w=A.test(g)}else{for(var y=0,H=F.length;H>y;y++){if("\\"!==F.charAt(y)){t=s,t+=F.substr(0,y+1),t=t.replace(/\|$/,"");for(var C=0;d>C;C++){t+=")"}var A=new RegExp("^("+t+")$");if(w=A.test(g)){break}}}}s+=F}}}if(w){break}}return u&&(s+=")",d--),w}var g,j,e=o.buffer.slice(),s="",q=!1,d=0;null===c.regexTokens&&r(),e.splice(m,0,f),g=e.join("");for(var h=0;h + * ©2014-2016 Thierry Florac */ (function($, globals) { @@ -2312,7 +2312,7 @@ callbacks: new_plugin.callback ? [new_plugin.callback] : [], register: new_plugin.register, async: new_plugin.async - } + }; } } @@ -3034,6 +3034,40 @@ }, /** + * JQuery input-mask plug-in + * + * Mask value can be set in a "data-input-mask" attribute defined: + * - as a simple string containing mask + * - as a JSON object defining all mask attributes, for example: + * data-input-mask='{"alias": "integer", "allowPlus": false, "allowMinus": false}' + */ + inputmask: function(element) { + var masks = $('[data-input-mask]', element); + if (masks.length > 0) { + ams.ajax.check($.fn.inputmask, + ams.baseURL + 'ext/jquery-inputmask-bundle-3.2.8' + ams.devext + '.js', + function() { + masks.each(function() { + var input = $(this); + var data = input.data(); + var data_options; + if (typeof(data.inputMask) === 'object') { + data_options = data.inputMask; + } else { + data_options = { + mask: data.inputMask.toString() + }; + } + var settings = $.extend({}, data_options, data.amsInputmaskOptions); + settings = ams.executeFunctionByName(data.amsInputmaskInitCallback, input, settings) || settings; + var plugin = input.inputmask(settings); + ams.executeFunctionByName(data.amsInputmaskAfterInitCallback, input, plugin, settings); + }); + }); + } + }, + + /** * JQuery date picker */ datepicker: function(element) { @@ -3235,6 +3269,12 @@ : ams.getFunctionByName(data.amsFormInvalidHandler) : undefined }; + $('[data-ams-validate-rules]', form).each(function() { + if (index === 0) { + data_options.rules = {}; + } + data_options.rules[$(this).attr('name')] = $(this).data('ams-validate-rules'); + }); var settings = $.extend({}, data_options, data.amsValidateOptions); settings = ams.executeFunctionByName(data.amsValidateInitCallback, form, settings) || settings; var plugin = form.validate(settings); @@ -3301,7 +3341,7 @@ // Set options var data_options = { bJQueryUI: false, - bFilter: data.amsDatatableGlobalFilter !== false, + bFilter: data.amsDatatableGlobalFilter !== false || extensions.indexOf('columnfilter') >= 0, bPaginate: data.amsDatatablePagination !== false, bInfo: data.amsDatatableInfo !== false, bSort: data.amsDatatableSort !== false, diff -r 601c667286f6 -r d294083fb28c src/pyams_skin/resources/js/myams.min.js --- a/src/pyams_skin/resources/js/myams.min.js Thu Apr 21 17:18:11 2016 +0200 +++ b/src/pyams_skin/resources/js/myams.min.js Thu Apr 21 17:20:00 2016 +0200 @@ -1,1 +1,1 @@ -(function(c,b){String.prototype.startsWith=function(g){var e=this.length,f=g.length;if(e0};if(c.scrollbarWidth===undefined){c.scrollbarWidth=function(){var f=c('
').appendTo("body");var g=f.children();var e=g.innerWidth()-g.height(99).innerWidth();f.remove();return e}}c.fn.extend({exists:function(){return c(this).length>0},objectOrParentWithClass:function(e){if(this.hasClass(e)){return this}else{return this.parents("."+e)}},listattr:function(f){var e=[];this.each(function(){e.push(c(this).attr(f))});return e},style:function(f,i,e){var h=this.get(0);if(typeof(h)==="undefined"){return}var g=this.get(0).style;if(typeof(f)!=="undefined"){if(typeof(i)!=="undefined"){e=typeof(e)!=="undefined"?e:"";g.setProperty(f,i,e);return this}else{return g.getPropertyValue(f)}}else{return g}},removeClassPrefix:function(e){this.each(function(g,h){var f=h.className.split(" ").map(function(i){return i.startsWith(e)?"":i});h.className=c.trim(f.join(" "))});return this},contextMenu:function(f){function e(i,k,h){var j=c(window)[k](),l=c(f.menuSelector)[k](),g=i;if(i+l>j&&l',openedSign:''};var f=c.extend({},g,e);var h=c(this);h.find("LI").each(function(){var i=c(this);if(i.find("UL").size()>0){i.find("A:first").append(""+f.closedSign+"");var j=i.find("A:first");if(j.attr("href")==="#"){j.click(function(){return false})}}});h.find("LI.active").each(function(){var i=c(this).parents("UL");var j=i.parent("LI");i.slideDown(f.speed);j.find("b:first").html(f.openedSign);j.addClass("open")});h.find("LI A").on("click",function(){var m=c(this);if(m.hasClass("active")){return}var k=m.attr("href").replace(/^#/,"");var i=m.parent().find("UL");if(f.accordion){var l=m.parent().parents("UL");var n=h.find("UL:visible");n.each(function(o){var q=true;l.each(function(r){if(l[r]===n[o]){q=false;return false}});if(q){if(i!==n[o]){var p=c(n[o]);if(k||!p.hasClass("active")){p.slideUp(f.speed,function(){c(this).parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}}}})}var j=m.parent().find("UL:first");if(!k&&j.is(":visible")&&!j.hasClass("active")){j.slideUp(f.speed,function(){m.parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}else{j.slideDown(f.speed,function(){m.parent("LI").addClass("open").find("B:first").delay(f.speed).html(f.openedSign)})}})}});c.UTF8={encode:function(f){f=f.replace(/\r\n/g,"\n");var e="";for(var h=0;h127)&&(g<2048)){e+=String.fromCharCode((g>>6)|192);e+=String.fromCharCode((g&63)|128)}else{e+=String.fromCharCode((g>>12)|224);e+=String.fromCharCode(((g>>6)&63)|128);e+=String.fromCharCode((g&63)|128)}}}return e},decode:function(e){var g="";var j=0,k=0,h=0,f=0;while(j191)&&(k<224)){h=e.charCodeAt(j+1);g+=String.fromCharCode(((k&31)<<6)|(h&63));j+=2}else{h=e.charCodeAt(j+1);f=e.charCodeAt(j+2);g+=String.fromCharCode(((k&15)<<12)|((h&63)<<6)|(f&63));j+=3}}}return g}};if(b.MyAMS===undefined){b.MyAMS={devmode:true,devext:"",lang:"en",throttle_delay:350,menu_speed:235,navbar_height:49,ajax_nav:true,enable_widgets:true,enable_mobile:false,enable_fastclick:false,warn_on_form_change:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var d=b.MyAMS;var a=d;d.baseURL=(function(){var e=c('script[src*="/myams.js"], script[src*="/myams.min.js"]');var f=e.attr("src");a.devmode=f.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return f.substring(0,f.lastIndexOf("/")+1)})();d.getQueryVar=function(g,h){if(g.indexOf("?")<0){return false}if(!g.endsWith("&")){g+="&"}var e=new RegExp(".*?[&\\?]"+h+"=(.*?)&.*");var f=g.replace(e,"$1");return f===g?false:f};d.rgb2hex=function(e){return"#"+c.map(e.match(/\b(\d+)\b/g),function(f){return("0"+parseInt(f).toString(16)).slice(-2)}).join("")};d.generateId=function(){function e(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return e()+e()+e()+e()};d.getFunctionByName=function(k,g){if(k===undefined){return undefined}else{if(typeof(k)==="function"){return k}}var j=k.split(".");var h=j.pop();g=(g===undefined||g===null)?window:g;for(var f=0;f").attr({rel:"stylesheet",type:"text/css",href:h,"data-ams-id":i}).appendTo(g)}};d.event={stop:function(e){if(!e){e=window.event}if(e){if(e.stopPropagation){e.stopPropagation();e.preventDefault()}else{e.cancelBubble=true;e.returnValue=false}}}};d.browser={getInternetExplorerVersion:function(){var g=-1;if(navigator.appName==="Microsoft Internet Explorer"){var e=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(e)!==null){g=parseFloat(RegExp.$1)}}return g},checkVersion:function(){var f="You're not using Windows Internet Explorer.";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=8){f="You're using a recent copy of Windows Internet Explorer."}else{f="You should upgrade your copy of Windows Internet Explorer."}}if(b.alert){b.alert(f)}},isIE8orlower:function(){var f="0";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=9){f=0}else{f=1}}return f},copyToClipboard:function(){return function(){var e=c(this);e.parents(".btn-group").removeClass("open");if(b.prompt){b.prompt(d.i18n.CLIPBOARD_COPY,e.text())}}}};d.error={ajax:function(j,e,i,f){if(e.statusText==="OK"){return}var h=a.ajax.getResponse(e);if(h.content_type==="json"){a.ajax.handleJSON(h.data)}else{var k=j.statusText||j.type;var g=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

"+k+"

"+g+"

",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(j);b.console.debug(e)}},show:function(h,e,g){if(!g){return}var f=a.ajax.getResponse(h);if(f.content_type==="json"){a.ajax.handleJSON(f.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"

"+e+"

"+g+"

",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(g);b.console.debug(h)}}};d.ajax={check:function(f,h,j,e){if(typeof(j)==="object"){e=j;j=undefined}var i={async:typeof(j)==="function"};var g=c.extend({},i,e);if(f===undefined){a.getScript(h,function(){if(typeof(j)==="function"){j(true,e)}},g)}else{if(typeof(j)==="function"){j(false,e)}}},getAddr:function(f){var e=f||c("HTML HEAD BASE").attr("href")||window.location.href;return e.substr(0,e.lastIndexOf("/")+1)},start:function(){c("#ajax-gear").show()},stop:function(){c("#ajax-gear").hide()},progress:function(e){if(!e.lengthComputable){return}if(e.loaded>=e.total){return}if(b.console){b.console.log(parseInt((e.loaded/e.total*100),10)+"%")}},post:function(g,i,f,l){var k;if(g.startsWith(window.location.protocol)){k=g}else{k=this.getAddr()+g}if(typeof(f)==="function"){l=f;f={}}else{if(!f){f={}}}if(typeof(l)==="undefined"){l=f.callback}if(typeof(l)==="string"){l=a.getFunctionByName(l)}delete f.callback;var e;var j={url:k,type:"post",cache:false,async:typeof(l)==="function",data:c.param(i),dataType:"json",success:l||function(m){e=m.result}};var h=c.extend({},j,f);c.ajax(h);return e},getResponse:function(h){var g=h.getResponseHeader("content-type"),j,f;if(g){if(g.startsWith("application/javascript")){j="script";f=h.responseText}else{if(g.startsWith("text/html")){j="html";f=h.responseText}else{if(g.startsWith("text/xml")){j="xml";f=h.responseText}else{f=h.responseJSON;if(f){j="json"}else{try{f=JSON.parse(h.responseText);j="json"}catch(i){f=h.responseText;j="text"}}}}}}else{j="json";f={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:j,data:f}},handleJSON:function(p,g,l){var j=p.status;var e;switch(j){case"alert":if(b.alert){b.alert(p.alert.title+"\n\n"+p.alert.content)}break;case"error":a.form.showErrors(g,p);break;case"info":case"success":if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":if(p.close_form!==false){a.dialog.close(g)}e=p.location||window.location.hash;if(e.startsWith("#")){e=e.substr(1)}a.skin.loadURL(e,p.target||l||"#content");break;case"redirect":if(p.close_form===true){a.dialog.close(g)}e=p.location||window.location.href;if(p.window){window.open(e,p.window,p.options)}else{if(window.location.href===e){window.location.reload(true)}else{window.location.href=e}}break;default:if(b.console){b.console.log("Unhandled status: "+j)}}var k;var m;var f;if(p.content){m=p.content;f=c(m.target||l||g||"#content");if(m.raw===true){f.text(m.text)}else{f.html(m.html);a.initContent(f)}if(!m.keep_hidden){f.removeClass("hidden")}}if(p.contents){var i=p.contents;for(k=0;k  '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(h){if(h===a.i18n.BTN_OK){g.call(f)}})}else{g.call(f)}},submit:function(g,f,h){g=c(g);if(!g.exists()){return false}if(typeof(f)==="object"){h=f;f=undefined}if(g.data("submitted")){if(!g.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:g.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(g)){return false}c(".alert-danger, SPAN.state-error",g).not(".persistent").remove();c(".state-error",g).removeClassPrefix("state-");var e=c(g.data("ams-submit-button"));if(e&&!e.data("ams-form-hide-loading")){e.button("loading")}a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function k(m,o){var l;var E=m.data();var v=E.amsFormOptions;var n;var q;if(h){q=h.formDataInitCallback}if(q){delete h.formDataInitCallback}else{q=E.amsFormDataInitCallback}if(q){var w={};if(typeof(q)==="function"){n=q.call(m,w)}else{n=a.executeFunctionByName(q,m,w)}if(w.veto){l=m.data("ams-submit-button");if(l){l.button("reset")}a.form.finalizeSubmitFooter.call(m);return false}}else{n=E.amsFormData||{}}l=c(m.data("ams-submit-button"));var x,A;if(l){x=l.data("ams-form-handler");A=l.data("ams-form-submit-target")}var p;var t=f||x||E.amsFormHandler||"";if(t.startsWith(window.location.protocol)){p=t}else{var z=m.attr("action").replace(/#/,"");if(z.startsWith(window.location.protocol)){p=z}else{p=a.ajax.getAddr()+z}p+=t}var D=null;if(h&&h.initSubmitTarget){a.executeFunctionByName(h.initSubmitTarget)}else{if(E.amsFormInitSubmitTarget){D=c(A||E.amsFormSubmitTarget||"#content");a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmit",m,D)}else{if(!E.amsFormHideSubmitFooter){a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",m)}}}var r=typeof(o.uuid)!=="undefined";if(r){if(p.indexOf("X-Progress-ID")<0){p+="?X-Progress-ID="+o.uuid}delete o.uuid}if(h){n=c.extend({},n,h.form_data)}var u={url:p,type:"post",cache:false,data:n,dataType:E.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(G,F){F.data("submitted",true)},error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},iframe:r};var y=(h&&h.downloadTarget)||E.amsFormDownloadTarget;if(y){var s=c('iframe[name="'+y+'"]');if(!s.exists()){s=c("").hide().attr("name",y).appendTo(m)}u=c.extend({},u,{iframe:true,iframeTarget:s,success:function(F,G,K,J){var I=c(J).parents(".modal-dialog");if(I.exists()){a.dialog.close(J)}else{var L;var H=J.data("ams-submit-button");if(H){L=H.data("ams-form-submit-callback")}if(!L){L=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}L.call(J,F,G,K,J);if(J.is(":visible")&&H){H.button("reset")}J.data("submitted",false);J.removeData("ams-submit-button");J.removeAttr("data-ams-form-changed")}}})}else{u=c.extend({},u,{error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},success:function(F,G,J,I){var K;var H=I.data("ams-submit-button");if(H){K=H.data("ams-form-submit-callback")}if(!K){K=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}K.call(I,F,G,J,I);if(I.is(":visible")&&H){H.button("reset")}I.data("submitted",false);I.removeData("ams-submit-button");I.removeAttr("data-ams-form-changed")},iframe:r})}var C=c.extend({},u,o,v,h);c(m).ajaxSubmit(C);if(y){var B=c(m).parents(".modal-dialog");if(B.exists()){a.dialog.close(m)}else{a.form.finalizeSubmitFooter.call(m);if(l){l.button("reset")}m.data("submitted",false);m.removeData("ams-submit-button");m.removeAttr("data-ams-form-changed")}}}var j=c('INPUT[type="file"]',g).length>0;if(j){a.ajax.check(c.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var i=c.extend({},{uuid:c.progressBar.submit(g)});k(g,i)}else{k(g,{})}});return false},initSubmit:function(g,f){var e=c(this);var h='';if(!f){f=e.data("ams-form-submit-message")}if(f){h+=""+f+""}c(g).html('
'+h+"
");c(g).parents(".hidden").removeClass("hidden")},finalizeSubmitOnError:function(e){c("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(f){var e=c(this);var h='';if(!f){f=c(this).data("ams-form-submit-message")}if(f){h+=''+f+""}var g=c("footer",e);c("button",g).hide();g.append('
'+h+"
")},finalizeSubmitFooter:function(){var e=c(this);var f=c("footer",e);if(f){c(".row",f).remove();c("button",f).show()}},_submitCallback:function(o,g,f,e){var i;if(e.is(":visible")){a.form.finalizeSubmitFooter.call(e);i=e.data("ams-submit-button");if(i){i.button("reset")}}var h=e.data();var l;if(h.amsFormDatatype){l=h.amsFormDatatype}else{var j=a.ajax.getResponse(f);l=j.content_type;o=j.data}var k;if(i){k=c(i.data("ams-form-submit-target")||h.amsFormSubmitTarget||"#content")}else{k=c(h.amsFormSubmitTarget||"#content")}switch(l){case"json":a.ajax.handleJSON(o,e,k);break;case"script":break;case"xml":break;case"html":case"text":default:if(i&&(i.data("ams-keep-modal")!==true)){a.dialog.close(e)}if(!k.exists()){k=c("body")}k.parents(".hidden").removeClass("hidden");c(".alert",k.parents(".alerts-container")).remove();k.css({opacity:"0.0"}).html(o).delay(50).animate({opacity:"1.0"},300);a.initContent(k);a.form.setFocus(k)}var m=f.getResponseHeader("X-AMS-Callback");if(m){var n=f.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(m,e,n===undefined?{}:JSON.parse(n),f)}},_getSubmitValidators:function(f){var e=[];var g=f.data("ams-form-validator");if(g){e.push([f,g])}c("[data-ams-form-validator]",f).each(function(){var h=c(this);e.push([h,h.data("ams-form-validator")])});return e},_checkSubmitValidators:function(g){var i=a.form._getSubmitValidators(g);if(!i.length){return true}var h=[];var n=true;for(var k=0;k0)){h=h.concat(n)}}}}if(h.length>0){var j=h.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(g,"danger",j,h);return false}else{return n}},showErrors:function(e,m){var i;if(typeof(m)==="string"){a.skin.alert(e,"error",a.i18n.ERROR_OCCURED,m)}else{if(m instanceof Array){i=m.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"error",i,m)}else{c(".state-error",e).removeClass("state-error");i=m.error_header||(m.widgets&&(m.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var n=[];var l;if(m.messages){for(l=0;l"+f.header+"
"+f.message)}else{n.push(f.message||f)}}}if(m.widgets){for(l=0;l'+g.message+"");if(g.label){n.push(g.label+" : "+g.message)}var k=j.parents(".tab-pane").index()+1;if(k>0){var h=c(".nav-tabs",c(j).parents(".tabforms"));c("li:nth-child("+k+")",h).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",e).click()}}}a.skin.alert(c("fieldset:first",e),m.error_level||"error",i,n,m.error_message)}}}};d.dialog={_shown_callbacks:[],registerShownCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("shown-callbacks");if(g===undefined){g=[];e.data("shown-callbacks",g)}}else{g=a.dialog._shown_callbacks}if(g.indexOf(h)<0){g.push(h)}},_hide_callbacks:[],registerHideCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("hide-callbacks");if(g===undefined){g=[];e.data("hide-callbacks",g)}}else{g=a.dialog._hide_callbacks}if(g.indexOf(h)<0){g.push(h)}},open:function(f,e){a.ajax.check(c.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(c.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(j){if(j){c(document).off("click.modal");c.fn.modal.defaults.spinner=c.fn.modalmanager.defaults.spinner='
'}var i;var h;if(typeof(f)==="string"){i={};h=f}else{i=f.data();h=f.attr("href")||i.amsUrl;var g=a.getFunctionByName(h);if(typeof(g)==="function"){h=g.call(f)}}if(!h){return}c("body").modalmanager("loading");if(h.indexOf("#")===0){c(h).modal("show")}else{c.ajax({url:h,type:"get",cache:i.amsAllowCache===undefined?false:i.amsAllowCache,data:e,success:function(n,m,l){c("body").modalmanager("removeLoading");var o=a.ajax.getResponse(l);var t=o.content_type;var u=o.data;switch(t){case"json":a.ajax.handleJSON(u,c(c(f).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var p=c(u);var r=c(".modal-dialog",p.wrap("
").parent());var q=r.data();var s={backdrop:"static",overflow:q.amsModalOverflow||".modal-viewport",maxHeight:q.amsModalMaxHeight===undefined?function(){return c(window).height()-c(".modal-header",p).outerHeight(true)-c("footer",p).outerHeight(true)-85}:a.getFunctionByName(q.amsModalMaxHeight)};var k=c.extend({},s,q.amsModalOptions);k=a.executeFunctionByName(q.amsModalInitCallback,r,k)||k;c("
").addClass("modal fade").append(p).modal(k).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(p)}}})}})})},shown:function(m){function l(o){var p=c(".scrollmarker.top",f);var n=f.scrollTop();if(n>0){p.show()}else{p.hide()}var e=c(".scrollmarker.bottom",f);if(j+n>=f.get(0).scrollHeight){e.hide()}else{e.show()}}var k=m.target;var f=c(".modal-viewport",k);if(f.exists()){var j=parseInt(f.css("max-height"));var h=c.scrollbarWidth();if(f.height()===j){c("
").addClass("scrollmarker").addClass("top").css("top",0).css("width",f.width()-h).hide().appendTo(f);c("
").addClass("scrollmarker").addClass("bottom").css("top",j-20).css("width",f.width()-h).appendTo(f);f.scroll(l);f.off("resize").on("resize",l)}else{c(".scrollmarker",f).remove()}}var g;var i=c(".modal-dialog",k).data("shown-callbacks");if(i){for(g=0;g=0)){g.hide()}}},hidden:function(i){var h=i.target;a.skin.cleanContainer(h);var f;var g=c(".modal-dialog",h).data("hide-callbacks");if(g){for(f=0;f"+g.error_message+"",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(g.location);break;default:return{results:g.results||g,more:g.has_more||false,context:g.context}}},select2QueryMethodSuccessCallback:function(i,g,h){var f=i.result;if(typeof(f)==="string"){try{f=JSON.parse(f)}catch(j){}}switch(f.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

"+f.error_message+"

",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(f.location);break;default:h.callback({results:f.results||f,more:f.has_more||false,context:f.context})}},contextMenuHandler:function(h,i){var e=i.data();if(e.toggle==="modal"){a.dialog.open(i)}else{var f=i.attr("href")||e.amsUrl;if(!f||f.startsWith("javascript")||i.attr("target")){return}a.event.stop();var g=a.getFunctionByName(f);if(typeof(g)==="function"){f=g.call(i,h)}if(typeof(f)==="function"){f.call(i,h)}else{f=f.replace(/\%23/,"#");h=i.data("ams-target");if(h){a.form.confirmChangedForm(h,function(){a.skin.loadURL(f,h,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}}},datetimepickerDialogHiddenCallback:function(){c(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};d.plugins={init:function(i){a.plugins.initData(i);var h=[];c("[data-ams-plugins-disabled]",i).each(function(){var n=c(this).data("ams-plugins-disabled").split(/\s+/);for(var o=0;o=0){continue}var l=a.plugins.enabled[k];switch(typeof(l)){case"function":l(i);break;default:for(var f=0;f=0){if(b.console){b.console.warn("Plugin "+e+" is already registered!")}return}if(typeof(f)==="object"){var g=f.src;if(g){a.ajax.check(f.callback,g,function(i){if(i){a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}})}else{a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}}else{if(typeof(f)==="function"){a.plugins.enabled[e]=f;if(h){a.executeFunctionByName(h)}}}},enabled:{hint:function(e){var f=c(".hint:not(:parents(.nohints))",e);if(f.length>0){a.ajax.check(c.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");f.each(function(){var k=c(this);var j=k.data();var h={html:j.amsHintHtml,title:a.getFunctionByName(j.amsHintTitleGetter)||function(){var l=c(this);return l.attr("original-title")||l.attr(j.amsHintTitleAttr||"title")||(j.amsHintHtml?l.html():l.text())},opacity:j.amsHintOpacity||0.95,gravity:j.amsHintGravity||"sw",offset:j.amsHintOffset||0};var g=c.extend({},h,j.amsHintOptions);g=a.executeFunctionByName(j.amsHintInitCallback,k,g)||g;var i=k.tipsy(g);a.executeFunctionByName(j.amsHintAfterInitCallback,k,i,g)})})}},contextMenu:function(e){var f=c(".context-menu",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={menuSelector:j.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var g=c.extend({},h,j.amsContextmenuOptions);g=a.executeFunctionByName(j.amsContextmenuInitCallback,k,g)||g;var i=k.contextMenu(g);a.executeFunctionByName(j.amsContextmenuAfterInitCallback,k,i,g)})}},switcher:function(e){c("LEGEND.switcher",e).each(function(){var g=c(this);var f=g.parent("fieldset");var h=g.data();if(!h.amsSwitcher){c('').prependTo(c(this)).addClass(h.amsSwitcherState==="open"?(h.amsSwitcherMinusClass||"fa-minus"):(h.amsSwitcherPlusClass||"fa-plus"));g.on("click",function(j){j.preventDefault();var i={};g.trigger("ams.switcher.before-switch",[g,i]);if(i.veto){return}if(f.hasClass("switched")){f.removeClass("switched");c(".fa",g).removeClass(h.amsSwitcherPlusClass||"fa-plus").addClass(h.amsSwitcherMinusClass||"fa-minus");g.trigger("ams.switcher.opened",[g]);var k=g.attr("id");if(k){c('legend.switcher[data-ams-switcher-sync="'+k+'"]',f).each(function(){var l=c(this);if(l.parents("fieldset").hasClass("switched")){l.click()}})}}else{f.addClass("switched");c(".fa",g).removeClass(h.amsSwitcherMinusClass||"fa-minus").addClass(h.amsSwitcherPlusClass||"fa-plus");g.trigger("ams.switcher.closed",[g])}});if(h.amsSwitcherState!=="open"){f.addClass("switched")}g.data("ams-switcher","on")}})},checker:function(e){c("LEGEND.checker",e).each(function(){var q=c(this);var r=q.parent("fieldset");var h=q.data();if(!h.amsChecker){var f=c('');var k=h.amsCheckerFieldname||("checker_"+a.generateId());var o=k.replace(/\./,"_");var i=h.amsCheckerHiddenPrefix;var j=null;var n=h.amsCheckerHiddenValueOn||"true";var l=h.amsCheckerHiddenValueOff||"false";var g=h.amsCheckerMarker||false;if(i){j=c('').attr("name",i+k).val(h.amsCheckerState==="on"?n:l).prependTo(q)}else{if(g){c('').attr("name",g).attr("value",1).prependTo(q)}}var p=c('').attr("name",k).attr("id",o).data("ams-checker-hidden-input",j).data("ams-checker-init",true).val(h.amsCheckerValue||true).attr("checked",h.amsCheckerState==="on"?"checked":null);if(h.amsCheckerReadonly){p.attr("disabled","disabled")}else{p.on("change",function(u){u.preventDefault();var s={};var v=c(this).is(":checked");q.trigger("ams.checker.before-switch",[q,s]);if(s.veto){c(this).prop("checked",!v);return}a.executeFunctionByName(h.amsCheckerChangeHandler,q,v);if(!h.amsCheckerCancelDefault){var t=p.data("ams-checker-hidden-input");if(v){if(h.amsCheckerMode==="disable"){r.removeAttr("disabled")}else{r.removeClass("switched")}if(t){t.val(n)}c("[data-required]",r).attr("required","required");q.trigger("ams.checker.opened",[q])}else{if(h.amsCheckerMode==="disable"){r.prop("disabled","disabled")}else{r.addClass("switched")}if(t){t.val(l)}c("[data-required]",r).removeAttr("required");q.trigger("ams.checker.closed",[q])}}})}p.appendTo(f);c(">label",q).attr("for",p.attr("id"));f.append("").prependTo(q);var m=c("[required]",r);m.attr("data-required",true);if(h.amsCheckerState==="on"){p.attr("checked",true)}else{if(h.amsCheckerMode==="disable"){r.attr("disabled","disabled")}else{r.addClass("switched")}m.removeAttr("required")}q.data("ams-checker","on")}})},slider:function(e){var f=c(".slider",e);if(f.length>0){a.ajax.check(c.fn.slider,a.baseURL+"ext/bootstrap-slider-2.0.0"+a.devext+".js",function(){f.each(function(){var j=c(this);var k=j.data();var h={};var g=c.extend({},h,j.data.amsSliderOptions);g=a.executeFunctionByName(k.amsSliderInitCallback,j,g)||g;var i=j.slider(g);a.executeFunctionByName(k.amsSliderAfterInitCallback,j,i,g)})})}},draggable:function(f){var e=c(".draggable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={containment:k.amsDraggableContainment,helper:a.getFunctionByName(k.amsDraggableHelper)||k.amsDraggableHelper,start:a.getFunctionByName(k.amsDraggableStart),stop:a.getFunctionByName(k.amsDraggableStop)};var h=c.extend({},i,k.amsDraggableOptions);h=a.executeFunctionByName(k.amsDraggableInitCallback,g,h)||h;var j=g.draggable(h);g.disableSelection();a.executeFunctionByName(k.amsDraggableAfterInitCallback,g,j,h)})}},sortable:function(e){var f=c(".sortable",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={items:j.amsSortableItems,handle:j.amsSortableHandle,connectWith:j.amsSortableConnectwith,start:a.getFunctionByName(j.amsSortableStart),over:a.getFunctionByName(j.amsSortableOver),containment:j.amsSortableContainment,placeholder:j.amsSortablePlaceholder,stop:a.getFunctionByName(j.amsSortableStop)};var g=c.extend({},h,j.amsSortableOptions);g=a.executeFunctionByName(j.amsSortableInitCallback,k,g)||g;var i=k.sortable(g);k.disableSelection();a.executeFunctionByName(j.amsSortableAfterInitCallback,k,i,g)})}},resizable:function(f){var e=c(".resizable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={autoHide:k.amsResizableAutohide===false?true:k.amsResizableAutohide,containment:k.amsResizableContainment,grid:k.amsResizableGrid,handles:k.amsResizableHandles,start:a.getFunctionByName(k.amsResizableStart),stop:a.getFunctionByName(k.amsResizableStop)};var h=c.extend({},i,k.amsResizableOptions);h=a.executeFunctionByName(k.amsResizableInitCallback,g,h)||h;var j=g.resizable(h);g.disableSelection();a.executeFunctionByName(k.amsResizableAfterInitCallback,g,j,h)})}},typeahead:function(f){var e=c(".typeahead",f);if(e.length>0){a.ajax.check(c.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i={};var h=c.extend({},i,k.amsTypeaheadOptions);h=a.executeFunctionByName(k.amsTypeaheadInitCallback,g,h)||h;var j=g.typeahead(h);a.executeFunctionByName(k.amsTypeaheadAfterInitCallback,g,j,h)})})}},select2:function(f){var e=c(".select2",f);if(e.length>0){a.ajax.check(c.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){e.each(function(){var g=c(this);var l=g.data();var j={placeholder:l.amsSelect2Placeholder,multiple:l.amsSelect2Multiple,minimumInputLength:l.amsSelect2MinimumInputLength||0,maximumSelectionSize:l.amsSelect2MaximumSelectionSize,openOnEnter:l.amsSelect2EnterOpen===undefined?true:l.amsSelect2EnterOpen,allowClear:l.amsSelect2AllowClear===undefined?true:l.amsSelect2AllowClear,width:l.amsSelect2Width||"100%",initSelection:a.getFunctionByName(l.amsSelect2InitSelection),formatSelection:l.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(l.amsSelect2FormatSelection),formatResult:a.getFunctionByName(l.amsSelect2FormatResult),formatMatches:l.amsSelect2FormatMatches===undefined?function(m){if(m===1){return a.i18n.SELECT2_MATCH}else{return m+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(l.amsSelect2FormatMatches),formatNoMatches:l.amsSelect2FormatResult===undefined?function(m){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(l.amsSelect2FormatResult),formatInputTooShort:l.amsSelect2FormatInputTooShort===undefined?function(m,o){var p=o-m.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooShort),formatInputTooLong:l.amsSelect2FormatInputTooLong===undefined?function(o,m){var p=o.length-m;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooLong),formatSelectionTooBig:l.amsSelect2FormatSelectionTooBig===undefined?function(m){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,m).replace(/\{1\}/,m===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatSelectionTooBig),formatLoadMore:l.amsSelect2FormatLoadMore===undefined?function(m){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(l.amsSelect2FormatLoadMore),formatSearching:l.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(l.amsSelect2FormatSearching),separator:l.amsSelect2Separator||",",tokenSeparators:l.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(l.amsSelect2Tokenizer)};switch(g.context.type){case"text":case"hidden":if(!j.initSelection){var h=g.data("ams-select2-values");if(h){j.initSelection=function(m,o){var n=[];c(m.val().split(j.separator)).each(function(){n.push({id:this,text:h[this]||this})});o(n)}}}break;default:break}if(g.attr("readonly")){if(g.attr("type")==="hidden"){j.query=function(){return[]}}}else{if(l.amsSelect2Query){j.query=a.getFunctionByName(l.amsSelect2Query);j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryUrl){j.ajax={url:l.amsSelect2QueryUrl,quietMillis:l.amsSelect2QuietMillis||200,type:l.amsSelect2QueryType||"POST",dataType:l.amsSelect2QueryDatatype||"json",data:function(o,p,n){var m={};m[l.amsSelect2QueryParamName||"query"]=o;m[l.amsSelect2PageParamName||"page"]=p;m[l.amsSelect2ContextParamName||"context"]=n;return c.extend({},m,l.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryMethod){j.query=function(m){var n={id:new Date().getTime(),params:l.amsSelect2QueryParams||{},success:function(o){return a.helpers.select2QueryMethodSuccessCallback.call(g,o,"success",m)},error:a.error.show};n.params[l.amsSelect2QueryParamName||"query"]=m.term;n.params[l.amsSelect2PageParamName||"page"]=m.page;n.params[l.amsSelect2ContextParamName||"context"]=m.context;n=c.extend({},n,l.amsSelect2QueryOptions);n=a.executeFunctionByName(l.amsSelect2QueryInitCallback,g,n)||n;a.ajax.check(c.jsonRPC,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){c.jsonRPC.withOptions({endPoint:l.amsSelect2MethodTarget||a.jsonrpc.getAddr(),namespace:l.amsSelect2MethodNamespace,cache:false},function(){c.jsonRPC.request(l.amsSelect2QueryMethod,n)})})};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2Tags){j.tags=l.amsSelect2Tags}else{if(l.amsSelect2Data){j.data=l.amsSelect2Data}}}}}}if(l.amsSelect2EnableFreeTags){j.createSearchChoice=function(m){return{id:m,text:(l.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+m}}}var i=c.extend({},j,l.amsSelect2Options);i=a.executeFunctionByName(l.amsSelect2InitCallback,g,i)||i;var k=g.select2(i);a.executeFunctionByName(l.amsSelect2AfterInitCallback,g,k,i);if(g.hasClass("ordered")){a.ajax.check(c.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){g.select2Sortable({bindOrder:"sortableStop"})})}g.on("change",function(){var m=c(g.get(0).form).data("validator");if(m!==undefined){c(g).valid()}})})})}},maskedit:function(f){var e=c("[data-mask]",f);if(e.length>0){a.ajax.check(c.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.4.1"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i={placeholder:k.amsMaskeditPlaceholder===undefined?"X":k.amsMaskeditPlaceholder,complete:a.getFunctionByName(k.amsMaskeditComplete)};var h=c.extend({},i,k.amsMaskeditOptions);h=a.executeFunctionByName(k.amsMaskeditInitCallback,g,h)||h;var j=g.mask(g.attr("data-mask"),h);a.executeFunctionByName(k.amsMaskeditAfterInitCallback,g,j,h)})})}},datepicker:function(e){var f=c(".datepicker",e);if(f.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}f.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},datetimepicker:function(f){var e=c(".datetimepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},timepicker:function(f){var e=c(".timepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},colorpicker:function(e){var f=c(".colorpicker",e);if(f.length>0){a.ajax.check(c.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}f.each(function(){var h=c(this);var l=h.data();var j={position:l.amsColorpickerPosition||h.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var i=c.extend({},j,l.amsColorpickerOptions);i=a.executeFunctionByName(l.amsColorpickerInitCallback,h,i)||i;var k=h.minicolors(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},validate:function(f){var e=c("FORM:not([novalidate])",f);if(e.length>0){a.ajax.check(c.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(i){if(i){c.validator.setDefaults({highlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(k,l){var j=l.parents("label:first");if(j.length){k.insertAfter(j)}else{k.insertAfter(l)}}});if(a.plugins.i18n){for(var g in a.plugins.i18n.validate){if(!a.plugins.i18n.validate.hasOwnProperty(g)){continue}var h=a.plugins.i18n.validate[g];if((typeof(h)==="string")&&(h.indexOf("{0}")>-1)){a.plugins.i18n.validate[g]=c.validator.format(h)}}c.extend(c.validator.messages,a.plugins.i18n.validate)}}e.each(function(){var m=c(this);var n=m.data();var k={ignore:null,submitHandler:m.attr("data-async")!==undefined?n.amsFormSubmitHandler===undefined?function(){c(".state-error",m).removeClass("state-error");a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(m)}:a.getFunctionByName(n.amsFormSubmitHandler):undefined,invalidHandler:m.attr("data-async")!==undefined?n.amsFormInvalidHandler===undefined?function(s,r){c(".state-error",m).removeClass("state-error");for(var p=0;p0){var t=c(".nav-tabs",c(o.element).parents(".tabforms"));c("li:nth-child("+q+")",t).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",t).click()}}}:a.getFunctionByName(n.amsFormInvalidHandler):undefined};var j=c.extend({},k,n.amsValidateOptions);j=a.executeFunctionByName(n.amsValidateInitCallback,m,j)||j;var l=m.validate(j);a.executeFunctionByName(n.amsValidateAfterInitCallback,m,l,j)})})}},datatable:function(f){var e=c(".datatable",f);if(e.length>0){a.ajax.check(c.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(g){c(e).each(function(){a.ajax.check(c.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var D=c(this);var H=D.data();var F=(H.amsDatatableExtensions||"").split(/\s+/);var m=H.amsDatatableSdom||"W"+((F.indexOf("colreorder")>=0||F.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(F.indexOf("colvis")>=0?"C":"")+((H.amsDatatablePagination===false||H.amsDatatablePaginationSize===false)?"":"L")+(H.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(F.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(H.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var p;var i=H.amsDatatableSorting;if(typeof(i)==="string"){var G=i.split(";");i=[];for(p=0;p0?h:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:H.amsDatatableDisplayLength||25,sPaginationType:H.amsDatatablePaginationType||"bootstrap_full",sDom:m,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(K,J){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var E=c.extend({},z,H.amsDatatableOptions);if(F.length>0){for(p=0;p0){for(p=0;p0){for(p=0;p0){a.ajax.check(c.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(g){e.each(function(){var k=c(this);var l=k.data();if(l.amsTabledndDragHandle){c("tr",k).addClass("no-drag-handle")}else{c(k).on("mouseover","tr",function(){c(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){c(this.cells[0]).removeClass("drag-handle")})}var i={onDragClass:l.amsTabledndDragClass||"dragging-row",onDragStart:a.getFunctionByName(l.amsTabledndDragStart),dragHandle:l.amsTabledndDragHandle,scrollAmount:l.amsTabledndScrollAmount,onAllowDrop:l.amsTabledndAllowDrop,onDrop:a.getFunctionByName(l.amsTabledndDrop)||function(o,q){var n=l.amsTabledndDropTarget;if(n){c(q).data("ams-disabled-handlers","click");var m=[];c(o.rows).each(function(){var r=c(this).data("ams-element-name");if(r){m.push(r)}});var p=a.getFunctionByName(n);if(typeof(p)==="function"){p.call(k,o,m)}else{a.ajax.post(n,{names:JSON.stringify(m)})}setTimeout(function(){c(q).removeData("ams-disabled-handlers")},50)}return false}};var h=c.extend({},i,l.amsTabledndOptions);h=a.executeFunctionByName(l.amsTabledndInitCallback,k,h)||h;var j=k.tableDnD(h);a.executeFunctionByName(l.amsTabledndAfterInitCallback,k,j,h)})})}},tinymce:function(e){function h(){c(".tinymce",c(this)).each(function(){var i=tinymce.get(c(this).attr("id"));if(i){i.remove()}})}var f=c(".tinymce",e);if(f.length>0){var g=a.baseURL+"ext/tinymce"+(a.devmode?"/dev":"");a.ajax.check(window.tinymce,g+"/tinymce"+a.devext+".js",function(i){if(i){a.getScript(g+"/jquery.tinymce"+a.devext+".js");tinymce.baseURL=g;tinymce.suffix=a.devext;a.skin.registerCleanCallback(h)}f.each(function(){var m=c(this);var p=m.data();var l={theme:"modern",language:a.lang,plugins:["advlist autosave autolink lists link image charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code","insertdatetime media nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern"],toolbar1:"newdocument undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",toolbar2:"print preview media | forecolor backcolor emoticons | code",content_css:p.amsTinymceContentCss,formats:p.amsTinymceFormats,style_formats:p.amsTinymceStyleFormats,block_formats:p.amsTinymceBlockFormats,valid_classes:p.amsTinymceValidClasses,image_advtab:true,image_list:a.getFunctionByName(p.amsTinymceImageList)||p.amsTinymceImageList,image_class_list:p.amsTinymceImageClassList,link_list:a.getFunctionByName(p.amsTinymceLinkList)||p.amsTinymceLinkList,link_class_list:p.amsTinymceLinkClassList,resize:true};if(p.amsTinymceExternalPlugins){var q=p.amsTinymceExternalPlugins.split(/\s+/);for(var j in q){var o=m.data("ams-tinymce-plugin-"+q[j]);tinymce.PluginManager.load(q[j],a.getSource(o))}}var k=c.extend({},l,p.amsTinymceOptions);k=a.executeFunctionByName(p.amsTinymceInitCallback,m,k)||k;var n=m.tinymce(k);a.executeFunctionByName(p.amsTinymceAfterInitCallback,m,n,k)})})}},imgareaselect:function(f){var e=c(".imgareaselect",f);if(e.length>0){a.ajax.check(c.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}e.each(function(){var m=c(this);var l=m.data();var j=l.amsImgareaselectParent?m.parents(l.amsImgareaselectParent):"body";var i={instance:true,handles:true,parent:j,x1:l.amsImgareaselectX1||0,y1:l.amsImgareaselectY1||0,x2:l.amsImgareaselectX2||l.amsImgareaselectImageWidth,y2:l.amsImgareaselectY2||l.amsImgareaselectImageHeight,imageWidth:l.amsImgareaselectImageWidth,imageHeight:l.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:l.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(l.amsImgareaselectSelectEnd)||function(n,o){var p=l.amsImgareaselectTargetField||"image_";c('input[name="'+p+'x1"]',j).val(o.x1);c('input[name="'+p+'y1"]',j).val(o.y1);c('input[name="'+p+'x2"]',j).val(o.x2);c('input[name="'+p+'y2"]',j).val(o.y2)}};var h=c.extend({},i,l.amsImgareaselectOptions);h=a.executeFunctionByName(l.amsImgareaselectInitCallback,m,h)||h;var k=m.imgAreaSelect(h);a.executeFunctionByName(l.amsImgareaselectAfterInitCallback,m,k,h);setTimeout(function(){k.update()},250)})})}},fancybox:function(e){var f=c(".fancybox",e);if(f.length>0){a.ajax.check(c.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}f.each(function(){var h=c(this);var o=h.data();var n=(o.amsFancyboxHelpers||"").split(/\s+/);if(n.length>0){for(var i=0;i0){a.ajax.check(c.fn.plot,a.baseURL+"flot/jquery.flot"+a.devext+".js",function(){f.each(function(){function k(r){for(var q in c.plot.plugins){var s=c.plot.plugins[q];if(s.name==r){return s}}return null}var m=c(this);var i=m.data();var p={};var h=(i.amsChartPlugins||"").split(/\s+/);if(h.length>0){for(var l in h){var n=h[l];if(!k(n)){a.getScript(a.baseURL+"flot/jquery.flot."+n+a.devext+".js")}}}var g=c.extend({},p,i.amsChartOptions);g=a.executeFunctionByName(i.amsChartInitCallback,m,g)||g;var o=i.amsChartData;o=a.executeFunctionByName(i.amsChartInitData,m,o)||o;var j=m.plot(o,g);a.executeFunctionByName(i.amsChartAfterInitCallback,m,j,g)})})}},graphs:function(f){var e=c(".sparkline",f);if(e.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(e)})}},scrollbars:function(e){var f=c(".scrollbar",e);if(f.length>0){a.ajax.check(c.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(c.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}f.each(function(){var l=c(this);var k=l.data();var i={theme:k.amsScrollbarTheme||"light"};var h=c.extend({},i,k.amsScrollbarOptions);h=a.executeFunctionByName(k.amsScrollbarInitCallback,l,h)||h;var j=l.mCustomScrollbar(h);a.executeFunctionByName(k.amsScrollbarAfterInitCallback,l,j,h)})})})}}}};d.callbacks={init:function(e){c("[data-ams-callback]",e).each(function(){var f=this;var g=c(f).data();var h=a.getFunctionByName(g.amsCallback);if(h===undefined){if(g.amsCallbackSource){a.getScript(g.amsCallbackSource,function(){a.executeFunctionByName(g.amsCallback,f,g.amsCallbackOptions)})}else{if(b.console){b.console.warn("Undefined callback: "+g.amsCallback)}}}else{h.call(f,g.amsCallbackOptions)}})},alert:function(m){var h=c(this).data();var e=c.extend({},m,h.amsAlertOptions);var k=c(h.amsAlertParent||e.parent||this);var g=h.amsAlertStatus||e.status||"info";var i=h.amsAlertHeader||e.header;var l=h.amsAlertMessage||e.message;var j=h.amsAlertSubtitle||e.subtitle;var f=h.amsAlertMargin===undefined?(e.margin===undefined?false:e.margin):h.amsAlertMargin;a.skin.alert(k,g,i,l,j,f)},messageBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsMessageboxOptions);var g=c.extend({},h,{title:i.amsMessageboxTitle||h.title||"",content:i.amsMessageboxContent||h.content||"",icon:i.amsMessageboxIcon||h.icon,number:i.amsMessageboxNumber||h.number,timeout:i.amsMessageboxTimeout||h.timeout});var e=i.amsMessageboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsMessageboxCallback||h.callback);a.skin.messageBox(e,g,j)},smallBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsSmallboxOptions);var g=c.extend({},h,{title:i.amsSmallboxTitle||h.title||"",content:i.amsSmallboxContent||h.content||"",icon:i.amsSmallboxIcon||h.icon,iconSmall:i.amsSmallboxIconSmall||h.iconSmall,timeout:i.amsSmallboxTimeout||h.timeout});var e=i.amsSmallboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsSmallboxCallback||h.callback);a.skin.smallBox(e,g,j)}};d.events={init:function(e){c("[data-ams-events-handlers]",e).each(function(){var g=c(this);var f=g.data("ams-events-handlers");if(f){for(var h in f){if(f.hasOwnProperty(h)){g.on(h,a.getFunctionByName(f[h]))}}}})}};d.container={changeOrder:function(f,g){var e=c('input[name="'+c(this).data("ams-input-name")+'"]',c(this));e.val(g.join(";"))},deleteElement:function(e){return function(){var f=c(this);d.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){var k=f.parents("table");var h=k.data("ams-location")||"";var l=f.parents("tr");var j=l.data("ams-delete-target")||k.data("ams-delete-target")||"delete-element.json";var g=l.data("ams-element-name");d.ajax.post(h+"/"+j,{object_name:g},function(m,n){if(m.status==="success"){if(k.hasClass("datatable")){k.dataTable().fnDeleteRow(l[0])}else{l.remove()}}})}})}}};d.skin={_setPageHeight:function(){var g=c("#main").height();var e=a.left_panel.height();var f=c(window).height()-a.navbar_height;if(g>f){a.left_panel.css("min-height",g);a.root.css("min-height",g+a.navbar_height)}else{a.left_panel.css("min-height",f);a.root.css("min-height",f)}},_checkMobileWidth:function(){if(c(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){var e=c("#activity > .badge");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_initDesktopWidgets:function(e){if(a.enable_widgets){var f=c(".ams-widget",e);if(f.length>0){a.ajax.check(c.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){f.each(function(){var j=c(this);var i=j.data();var h={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var g=c.extend({},h,i.amsWidgetOptions);g=a.executeFunctionByName(i.amsWidgetInitcallback,j,g)||g;j.MyAMSWidget(g)});b.MyAMSWidget.initWidgetsGrid(c(".ams-widget-grid",e))})}}},_initMobileWidgets:function(e){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(e)}},alert:function(l,f,g,m,k,e){if(f==="error"){f="danger"}c(".alert-"+f,l).remove();var i='

'+g+"

"+(k?("

"+k+"

"):"");if(typeof(m)==="string"){i+="
  • "+m+"
"}else{if(m){i+="
    ";for(var h in m){if(!c.isNumeric(h)){continue}i+="
  • "+m[h]+"
  • "}i+="
"}}i+="
";var j=c(i).prependTo(l);if(l.exists){a.ajax.check(c.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){c.scrollTo(l,{offset:{top:-50}})})}},bigBox:function(e,f){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(e,f)})},messageBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.bigBox(f,g)})},smallBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.smallBox(f,g)})},_drawBreadCrumb:function(){var e=c("#ribbon OL.breadcrumb");c("li",e).not(".parent").remove();if(!c("li",e).exists()){e.append(c("
  • ").append(c("").text(a.i18n.HOME).addClass("padding-right-5").attr("href",c('nav a[href!="#"]:first').attr("href"))))}c("nav LI.active >A").each(function(){var h=c(this);var f=c.trim(h.clone().children(".badge").remove().end().text());var g=c("
  • ").append(h.attr("href").replace(/^#/,"")?c("").html(f).attr("href",h.attr("href")):f);e.append(g)})},checkURL:function(){function e(l){c(".active",i).removeClass("active");l.addClass("open").addClass("active");l.parents("li").addClass("open active").children("ul").addClass("active").show();l.parents("li:first").removeClass("open");l.parents("ul").addClass(l.attr("href").replace(/^#/,"")?"active":"").show()}var j;var i=c("nav");var h=location.hash;var g=h.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}j=c('A[href="'+h+'"]',i);if(j.exists()){e(j)}a.skin.loadURL(g,f);document.title=c("[data-ams-page-title]:first",f).data("ams-page-title")||j.attr("title")||document.title}else{var k=c("[data-ams-active-menu]").data("ams-active-menu");if(k){j=c('A[href="'+k+'"]',i)}else{j=c('>UL >LI >A[href!="#"]',i).first()}if(j.exists()){e(j);if(k){a.skin._drawBreadCrumb()}else{window.location.hash=j.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f Loading... ');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();document.title=c(".breadcrumb LI:last-child").text();c("html, body").animate({scrollTop:0},"fast")}else{e.animate({scrollTop:0},"fast")}},success:function(o,l,n){if(j){a.executeFunctionByName(j,this,o,l,n,f)}else{var m=a.ajax.getResponse(n);var p=m.content_type;var k=m.data;c(".loading",e).remove();switch(p){case"json":a.ajax.handleJSON(k,e);break;case"script":break;case"xml":break;case"html":case"text":default:e.parents(".hidden").removeClass("hidden");c(".alert",e.parents(".alerts-container")).remove();e.css({opacity:"0.0"}).html(o).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(e);a.form.setFocus(e)}if(f&&f.afterLoadCallback){a.executeFunctionByName(f.afterLoadCallback,this)}}},error:function(m,l,k){e.html('

    '+a.i18n.ERROR+k+"

    "+m.responseText)},async:false};var h=c.extend({},i,f);c.ajax(h)},setLanguage:function(f){var h=f.lang;var g=f.handler_type||"json";switch(g){case"json":var i=f.method||"setUserLanguage";a.jsonrpc.post(i,{lang:h},function(){window.location.reload(true)});break;case"ajax":var e=f.href||"setUserLanguage";a.ajax.post(e,{lang:h},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};d.stats={logEvent:function(f,g,e){if(typeof(b._gaq)==="undefined"){return}if(typeof(f)==="object"){g=f.action;e=f.label;f=f.category}b._gaq.push(["_trackEvent",f,g,e])}};d.initPage=function(){var e=c("body");a.root=e;a.left_panel=c("#left-panel");a.shortcuts=c("#shortcuts");a.plugins.initData(e);var f=c.ajaxSettings.xhr;c.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var i=f();if(i&&(typeof(i.addEventListener)==="function")){var h=this;i.addEventListener("progress",function(j){h.progress(j)},false)}return i}});c(document).ajaxStart(a.ajax.start);c(document).ajaxStop(a.ajax.stop);c(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enable_fastclick){a.ajax.check(c.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){c("NAV UL A").noClickDelay();c("A","#hide-menu").noClickDelay()})}}c("#hide-menu >:first-child > A").click(function(h){e.toggleClass("hidden-menu");h.preventDefault()});c("#show-shortcuts").click(function(h){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}h.preventDefault()});a.shortcuts.click(function(h){a.skin._hideShortcutButtons()});c(document).mouseup(function(h){if(!a.shortcuts.is(h.target)&&a.shortcuts.has(h.target).length===0){a.skin._hideShortcutButtons()}});c("#search-mobile").click(function(){a.root.addClass("search-mobile")});c("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});c("#activity").click(function(i){var h=c(this);var j=h.next(".ajax-dropdown");if(!j.is(":visible")){j.css("left",h.position().left-j.innerWidth()/2+h.innerWidth()/2).fadeIn(150);h.addClass("active")}else{j.fadeOut(150);h.removeClass("active")}i.preventDefault()});a.skin.checkNotification();c(document).mouseup(function(h){var i=c(".ajax-dropdown");if(!i.is(h.target)&&i.has(h.target).length===0){i.fadeOut(150).prev().removeClass("active")}});c('input[name="activity"]').change(function(){var i=c(this).data("ams-url");var h=c(".ajax-notifications");a.skin.loadURL(i,h)});c("a","#user-menu LI.logout").click(function(h){h.preventDefault();h.stopPropagation();a.loginURL=c(this).attr("href");a.skin.bigBox({title:" "+a.i18n.LOGOUT+" "+c("#show-shortcut").text()+" ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(i){if(i===a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});var g=c("nav");c("UL",g).myams_menu({accordion:g.data("ams-menu-accordion")!==false,speed:a.menu_speed});c(".minifyme").click(function(h){c("BODY").toggleClass("minified");c(this).effect("highlight",{},500);h.preventDefault()});c("#refresh").click(function(h){a.skin.bigBox({title:" "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(i){if(i===a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});h.preventDefault()});e.on("click",function(i){var h=c(this);if(!h.is(i.target)&&h.has(i.target).length===0&&c(".popover").has(i.target).length===0){h.popover("hide")}});a.ajax.check(c.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){c("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});g.resize(function(){a.skin._setPageHeight()})});if(a.ajax_nav){c(document).on("click",'a[href="#"]',function(h){h.preventDefault()});c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(m){var k=c(m.currentTarget);var i=k.data("ams-disabled-handlers");if((i===true)||(i==="click")||(i==="all")){return}var h=k.attr("href")||k.data("ams-url");if(!h||h.startsWith("javascript")||k.attr("target")||(k.data("ams-context-menu")===true)){return}m.preventDefault();m.stopPropagation();var j=a.getFunctionByName(h);if(typeof(j)==="function"){h=j.call(k)}if(typeof(h)==="function"){h.call(k)}else{h=h.replace(/\%23/,"#");var l=k.data("ams-target");if(l){a.form.confirmChangedForm(l,function(){a.skin.loadURL(h,l,k.data("ams-link-options"),k.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(h.startsWith("#")){if(h!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=h},50)}else{window.location.hash=h}}}else{window.location=h}})}}});c(document).on("click",'a[target="_blank"]',function(h){h.preventDefault();window.open(c(h.currentTarget).attr("href"))});c(document).on("click",'a[target="_top"]',function(h){h.preventDefault();a.form.confirmChangedForm(function(){window.location=c(h.currentTarget).attr("href")})});c(window).on("hashchange",a.skin.checkURL)}c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(j){var i=c(this);var h=i.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}if(i.data("ams-context-menu")===true){return}if(i.data("ams-stop-propagation")===true){j.stopPropagation()}j.preventDefault();a.dialog.open(i);if(i.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});c(document).on("click",'button[type="submit"], button.submit',function(){var h=c(this);c(h.get(0).form).data("ams-submit-button",h)});c(document).on("click","[data-ams-click-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}var i=j.data();if(i.amsClickHandler){if((i.amsStopPropagation===true)||(i.amsClickStopPropagation===true)){k.stopPropagation()}if(i.amsClickKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsClickHandler);if(l!==undefined){l.call(j,i.amsClickHandlerOptions)}}});c(document).on("change","[data-ams-change-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="change")||(h==="all")){return}var i=j.data();if(i.amsChangeHandler){if(i.amsChangeKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsChangeHandler);if(l!==undefined){l.call(j,i.amsChangeHandlerOptions)}}});c(document).on("reset","form",function(i){var h=c(this);setTimeout(function(){h.find(".select2").trigger("change")},10);a.form.setFocus(h)});c(document).on("reset","[data-ams-reset-handler]",function(j){var h=c(this);var i=h.data();if(i.amsResetHandler){if(i.amsResetKeepDefault!==true){j.preventDefault()}var k=a.getFunctionByName(i.amsResetHandler);if(k!==undefined){k.call(h,i.amsResetHandlerOptions)}}});c(document).on("change",'input[type="file"]',function(j){j.preventDefault();var h=c(this);var i=h.parent(".button");if(i.exists()&&i.parent().hasClass("input-file")){i.next('input[type="text"]').val(h.val())}});c(document).on("focusin",function(h){if(c(h.target).closest(".mce-window").length){h.stopImmediatePropagation()}});c("a[data-toggle=tab]",".nav-tabs").on("click",function(h){if(c(this).parent("li").hasClass("disabled")){h.preventDefault();return false}});c(document).on("show.bs.tab",function(j){var h=c(j.target);var i=h.data();if(i.amsUrl){if(i.amsTabLoaded){return}try{h.append('');a.skin.loadURL(i.amsUrl,h.attr("href"));if(i.amsTabLoadOnce){h.data("ams-tab-loaded",true)}}finally{c("i",h).remove()}}});a.initContent(document);if(a.ajax_nav&&g.exists()){a.skin.checkURL()}a.form.setFocus(document);c(window).on("beforeunload",a.form.checkBeforeUnload)};d.initContent=function(e){c(".tipsy").remove();c("[rel=tooltip]",e).tooltip();c("[rel=popover]",e).popover();c("[rel=popover-hover]",e).popover({trigger:"hover"});a.plugins.init(e);a.callbacks.init(e);a.events.init(e);a.form.init(e);if(a.device==="desktop"){a.skin._initDesktopWidgets(e)}else{a.skin._initMobileWidgets(e)}a.skin._setPageHeight()};d.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};c(document).ready(function(){c=jQuery.noConflict();var e=c("HTML");var f=e.attr("lang")||e.attr("xml:lang");if(f&&!f.startsWith("en")){d.lang=f;d.getScript(d.baseURL+"i18n/myams_"+f.substr(0,2)+".js",function(){d.initPage()})}else{d.initPage()}})})(jQuery,this); \ No newline at end of file +(function(c,b){String.prototype.startsWith=function(g){var e=this.length,f=g.length;if(e0};if(c.scrollbarWidth===undefined){c.scrollbarWidth=function(){var f=c('
    ').appendTo("body");var g=f.children();var e=g.innerWidth()-g.height(99).innerWidth();f.remove();return e}}c.fn.extend({exists:function(){return c(this).length>0},objectOrParentWithClass:function(e){if(this.hasClass(e)){return this}else{return this.parents("."+e)}},listattr:function(f){var e=[];this.each(function(){e.push(c(this).attr(f))});return e},style:function(f,i,e){var h=this.get(0);if(typeof(h)==="undefined"){return}var g=this.get(0).style;if(typeof(f)!=="undefined"){if(typeof(i)!=="undefined"){e=typeof(e)!=="undefined"?e:"";g.setProperty(f,i,e);return this}else{return g.getPropertyValue(f)}}else{return g}},removeClassPrefix:function(e){this.each(function(g,h){var f=h.className.split(" ").map(function(i){return i.startsWith(e)?"":i});h.className=c.trim(f.join(" "))});return this},contextMenu:function(f){function e(i,k,h){var j=c(window)[k](),l=c(f.menuSelector)[k](),g=i;if(i+l>j&&l',openedSign:''};var f=c.extend({},g,e);var h=c(this);h.find("LI").each(function(){var i=c(this);if(i.find("UL").size()>0){i.find("A:first").append(""+f.closedSign+"");var j=i.find("A:first");if(j.attr("href")==="#"){j.click(function(){return false})}}});h.find("LI.active").each(function(){var i=c(this).parents("UL");var j=i.parent("LI");i.slideDown(f.speed);j.find("b:first").html(f.openedSign);j.addClass("open")});h.find("LI A").on("click",function(){var m=c(this);if(m.hasClass("active")){return}var k=m.attr("href").replace(/^#/,"");var i=m.parent().find("UL");if(f.accordion){var l=m.parent().parents("UL");var n=h.find("UL:visible");n.each(function(o){var q=true;l.each(function(r){if(l[r]===n[o]){q=false;return false}});if(q){if(i!==n[o]){var p=c(n[o]);if(k||!p.hasClass("active")){p.slideUp(f.speed,function(){c(this).parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}}}})}var j=m.parent().find("UL:first");if(!k&&j.is(":visible")&&!j.hasClass("active")){j.slideUp(f.speed,function(){m.parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}else{j.slideDown(f.speed,function(){m.parent("LI").addClass("open").find("B:first").delay(f.speed).html(f.openedSign)})}})}});c.UTF8={encode:function(f){f=f.replace(/\r\n/g,"\n");var e="";for(var h=0;h127)&&(g<2048)){e+=String.fromCharCode((g>>6)|192);e+=String.fromCharCode((g&63)|128)}else{e+=String.fromCharCode((g>>12)|224);e+=String.fromCharCode(((g>>6)&63)|128);e+=String.fromCharCode((g&63)|128)}}}return e},decode:function(e){var g="";var j=0,k=0,h=0,f=0;while(j191)&&(k<224)){h=e.charCodeAt(j+1);g+=String.fromCharCode(((k&31)<<6)|(h&63));j+=2}else{h=e.charCodeAt(j+1);f=e.charCodeAt(j+2);g+=String.fromCharCode(((k&15)<<12)|((h&63)<<6)|(f&63));j+=3}}}return g}};if(b.MyAMS===undefined){b.MyAMS={devmode:true,devext:"",lang:"en",throttle_delay:350,menu_speed:235,navbar_height:49,ajax_nav:true,enable_widgets:true,enable_mobile:false,enable_fastclick:false,warn_on_form_change:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var d=b.MyAMS;var a=d;d.baseURL=(function(){var e=c('script[src*="/myams.js"], script[src*="/myams.min.js"]');var f=e.attr("src");a.devmode=f.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return f.substring(0,f.lastIndexOf("/")+1)})();d.getQueryVar=function(g,h){if(g.indexOf("?")<0){return false}if(!g.endsWith("&")){g+="&"}var e=new RegExp(".*?[&\\?]"+h+"=(.*?)&.*");var f=g.replace(e,"$1");return f===g?false:f};d.rgb2hex=function(e){return"#"+c.map(e.match(/\b(\d+)\b/g),function(f){return("0"+parseInt(f).toString(16)).slice(-2)}).join("")};d.generateId=function(){function e(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return e()+e()+e()+e()};d.getFunctionByName=function(k,g){if(k===undefined){return undefined}else{if(typeof(k)==="function"){return k}}var j=k.split(".");var h=j.pop();g=(g===undefined||g===null)?window:g;for(var f=0;f").attr({rel:"stylesheet",type:"text/css",href:h,"data-ams-id":i}).appendTo(g)}};d.event={stop:function(e){if(!e){e=window.event}if(e){if(e.stopPropagation){e.stopPropagation();e.preventDefault()}else{e.cancelBubble=true;e.returnValue=false}}}};d.browser={getInternetExplorerVersion:function(){var g=-1;if(navigator.appName==="Microsoft Internet Explorer"){var e=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(e)!==null){g=parseFloat(RegExp.$1)}}return g},checkVersion:function(){var f="You're not using Windows Internet Explorer.";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=8){f="You're using a recent copy of Windows Internet Explorer."}else{f="You should upgrade your copy of Windows Internet Explorer."}}if(b.alert){b.alert(f)}},isIE8orlower:function(){var f="0";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=9){f=0}else{f=1}}return f},copyToClipboard:function(){return function(){var e=c(this);e.parents(".btn-group").removeClass("open");if(b.prompt){b.prompt(d.i18n.CLIPBOARD_COPY,e.text())}}}};d.error={ajax:function(j,e,i,f){if(e.statusText==="OK"){return}var h=a.ajax.getResponse(e);if(h.content_type==="json"){a.ajax.handleJSON(h.data)}else{var k=j.statusText||j.type;var g=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+k+"

    "+g+"

    ",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(j);b.console.debug(e)}},show:function(h,e,g){if(!g){return}var f=a.ajax.getResponse(h);if(f.content_type==="json"){a.ajax.handleJSON(f.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"

    "+e+"

    "+g+"

    ",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(g);b.console.debug(h)}}};d.ajax={check:function(f,h,j,e){if(typeof(j)==="object"){e=j;j=undefined}var i={async:typeof(j)==="function"};var g=c.extend({},i,e);if(f===undefined){a.getScript(h,function(){if(typeof(j)==="function"){j(true,e)}},g)}else{if(typeof(j)==="function"){j(false,e)}}},getAddr:function(f){var e=f||c("HTML HEAD BASE").attr("href")||window.location.href;return e.substr(0,e.lastIndexOf("/")+1)},start:function(){c("#ajax-gear").show()},stop:function(){c("#ajax-gear").hide()},progress:function(e){if(!e.lengthComputable){return}if(e.loaded>=e.total){return}if(b.console){b.console.log(parseInt((e.loaded/e.total*100),10)+"%")}},post:function(g,i,f,l){var k;if(g.startsWith(window.location.protocol)){k=g}else{k=this.getAddr()+g}if(typeof(f)==="function"){l=f;f={}}else{if(!f){f={}}}if(typeof(l)==="undefined"){l=f.callback}if(typeof(l)==="string"){l=a.getFunctionByName(l)}delete f.callback;var e;var j={url:k,type:"post",cache:false,async:typeof(l)==="function",data:c.param(i),dataType:"json",success:l||function(m){e=m.result}};var h=c.extend({},j,f);c.ajax(h);return e},getResponse:function(h){var g=h.getResponseHeader("content-type"),j,f;if(g){if(g.startsWith("application/javascript")){j="script";f=h.responseText}else{if(g.startsWith("text/html")){j="html";f=h.responseText}else{if(g.startsWith("text/xml")){j="xml";f=h.responseText}else{f=h.responseJSON;if(f){j="json"}else{try{f=JSON.parse(h.responseText);j="json"}catch(i){f=h.responseText;j="text"}}}}}}else{j="json";f={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:j,data:f}},handleJSON:function(p,g,l){var j=p.status;var e;switch(j){case"alert":if(b.alert){b.alert(p.alert.title+"\n\n"+p.alert.content)}break;case"error":a.form.showErrors(g,p);break;case"info":case"success":if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":if(p.close_form!==false){a.dialog.close(g)}e=p.location||window.location.hash;if(e.startsWith("#")){e=e.substr(1)}a.skin.loadURL(e,p.target||l||"#content");break;case"redirect":if(p.close_form===true){a.dialog.close(g)}e=p.location||window.location.href;if(p.window){window.open(e,p.window,p.options)}else{if(window.location.href===e){window.location.reload(true)}else{window.location.href=e}}break;default:if(b.console){b.console.log("Unhandled status: "+j)}}var k;var m;var f;if(p.content){m=p.content;f=c(m.target||l||g||"#content");if(m.raw===true){f.text(m.text)}else{f.html(m.html);a.initContent(f)}if(!m.keep_hidden){f.removeClass("hidden")}}if(p.contents){var i=p.contents;for(k=0;k  '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(h){if(h===a.i18n.BTN_OK){g.call(f)}})}else{g.call(f)}},submit:function(g,f,h){g=c(g);if(!g.exists()){return false}if(typeof(f)==="object"){h=f;f=undefined}if(g.data("submitted")){if(!g.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:g.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(g)){return false}c(".alert-danger, SPAN.state-error",g).not(".persistent").remove();c(".state-error",g).removeClassPrefix("state-");var e=c(g.data("ams-submit-button"));if(e&&!e.data("ams-form-hide-loading")){e.button("loading")}a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function k(m,o){var l;var E=m.data();var v=E.amsFormOptions;var n;var q;if(h){q=h.formDataInitCallback}if(q){delete h.formDataInitCallback}else{q=E.amsFormDataInitCallback}if(q){var w={};if(typeof(q)==="function"){n=q.call(m,w)}else{n=a.executeFunctionByName(q,m,w)}if(w.veto){l=m.data("ams-submit-button");if(l){l.button("reset")}a.form.finalizeSubmitFooter.call(m);return false}}else{n=E.amsFormData||{}}l=c(m.data("ams-submit-button"));var x,A;if(l){x=l.data("ams-form-handler");A=l.data("ams-form-submit-target")}var p;var t=f||x||E.amsFormHandler||"";if(t.startsWith(window.location.protocol)){p=t}else{var z=m.attr("action").replace(/#/,"");if(z.startsWith(window.location.protocol)){p=z}else{p=a.ajax.getAddr()+z}p+=t}var D=null;if(h&&h.initSubmitTarget){a.executeFunctionByName(h.initSubmitTarget)}else{if(E.amsFormInitSubmitTarget){D=c(A||E.amsFormSubmitTarget||"#content");a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmit",m,D)}else{if(!E.amsFormHideSubmitFooter){a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",m)}}}var r=typeof(o.uuid)!=="undefined";if(r){if(p.indexOf("X-Progress-ID")<0){p+="?X-Progress-ID="+o.uuid}delete o.uuid}if(h){n=c.extend({},n,h.form_data)}var u={url:p,type:"post",cache:false,data:n,dataType:E.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(G,F){F.data("submitted",true)},error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},iframe:r};var y=(h&&h.downloadTarget)||E.amsFormDownloadTarget;if(y){var s=c('iframe[name="'+y+'"]');if(!s.exists()){s=c("").hide().attr("name",y).appendTo(m)}u=c.extend({},u,{iframe:true,iframeTarget:s,success:function(F,G,K,J){var I=c(J).parents(".modal-dialog");if(I.exists()){a.dialog.close(J)}else{var L;var H=J.data("ams-submit-button");if(H){L=H.data("ams-form-submit-callback")}if(!L){L=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}L.call(J,F,G,K,J);if(J.is(":visible")&&H){H.button("reset")}J.data("submitted",false);J.removeData("ams-submit-button");J.removeAttr("data-ams-form-changed")}}})}else{u=c.extend({},u,{error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},success:function(F,G,J,I){var K;var H=I.data("ams-submit-button");if(H){K=H.data("ams-form-submit-callback")}if(!K){K=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}K.call(I,F,G,J,I);if(I.is(":visible")&&H){H.button("reset")}I.data("submitted",false);I.removeData("ams-submit-button");I.removeAttr("data-ams-form-changed")},iframe:r})}var C=c.extend({},u,o,v,h);c(m).ajaxSubmit(C);if(y){var B=c(m).parents(".modal-dialog");if(B.exists()){a.dialog.close(m)}else{a.form.finalizeSubmitFooter.call(m);if(l){l.button("reset")}m.data("submitted",false);m.removeData("ams-submit-button");m.removeAttr("data-ams-form-changed")}}}var j=c('INPUT[type="file"]',g).length>0;if(j){a.ajax.check(c.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var i=c.extend({},{uuid:c.progressBar.submit(g)});k(g,i)}else{k(g,{})}});return false},initSubmit:function(g,f){var e=c(this);var h='';if(!f){f=e.data("ams-form-submit-message")}if(f){h+=""+f+""}c(g).html('
    '+h+"
    ");c(g).parents(".hidden").removeClass("hidden")},finalizeSubmitOnError:function(e){c("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(f){var e=c(this);var h='';if(!f){f=c(this).data("ams-form-submit-message")}if(f){h+=''+f+""}var g=c("footer",e);c("button",g).hide();g.append('
    '+h+"
    ")},finalizeSubmitFooter:function(){var e=c(this);var f=c("footer",e);if(f){c(".row",f).remove();c("button",f).show()}},_submitCallback:function(o,g,f,e){var i;if(e.is(":visible")){a.form.finalizeSubmitFooter.call(e);i=e.data("ams-submit-button");if(i){i.button("reset")}}var h=e.data();var l;if(h.amsFormDatatype){l=h.amsFormDatatype}else{var j=a.ajax.getResponse(f);l=j.content_type;o=j.data}var k;if(i){k=c(i.data("ams-form-submit-target")||h.amsFormSubmitTarget||"#content")}else{k=c(h.amsFormSubmitTarget||"#content")}switch(l){case"json":a.ajax.handleJSON(o,e,k);break;case"script":break;case"xml":break;case"html":case"text":default:if(i&&(i.data("ams-keep-modal")!==true)){a.dialog.close(e)}if(!k.exists()){k=c("body")}k.parents(".hidden").removeClass("hidden");c(".alert",k.parents(".alerts-container")).remove();k.css({opacity:"0.0"}).html(o).delay(50).animate({opacity:"1.0"},300);a.initContent(k);a.form.setFocus(k)}var m=f.getResponseHeader("X-AMS-Callback");if(m){var n=f.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(m,e,n===undefined?{}:JSON.parse(n),f)}},_getSubmitValidators:function(f){var e=[];var g=f.data("ams-form-validator");if(g){e.push([f,g])}c("[data-ams-form-validator]",f).each(function(){var h=c(this);e.push([h,h.data("ams-form-validator")])});return e},_checkSubmitValidators:function(g){var i=a.form._getSubmitValidators(g);if(!i.length){return true}var h=[];var n=true;for(var k=0;k0)){h=h.concat(n)}}}}if(h.length>0){var j=h.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(g,"danger",j,h);return false}else{return n}},showErrors:function(e,m){var i;if(typeof(m)==="string"){a.skin.alert(e,"error",a.i18n.ERROR_OCCURED,m)}else{if(m instanceof Array){i=m.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"error",i,m)}else{c(".state-error",e).removeClass("state-error");i=m.error_header||(m.widgets&&(m.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var n=[];var l;if(m.messages){for(l=0;l"+f.header+"
    "+f.message)}else{n.push(f.message||f)}}}if(m.widgets){for(l=0;l'+g.message+"");if(g.label){n.push(g.label+" : "+g.message)}var k=j.parents(".tab-pane").index()+1;if(k>0){var h=c(".nav-tabs",c(j).parents(".tabforms"));c("li:nth-child("+k+")",h).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",e).click()}}}a.skin.alert(c("fieldset:first",e),m.error_level||"error",i,n,m.error_message)}}}};d.dialog={_shown_callbacks:[],registerShownCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("shown-callbacks");if(g===undefined){g=[];e.data("shown-callbacks",g)}}else{g=a.dialog._shown_callbacks}if(g.indexOf(h)<0){g.push(h)}},_hide_callbacks:[],registerHideCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("hide-callbacks");if(g===undefined){g=[];e.data("hide-callbacks",g)}}else{g=a.dialog._hide_callbacks}if(g.indexOf(h)<0){g.push(h)}},open:function(f,e){a.ajax.check(c.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(c.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(j){if(j){c(document).off("click.modal");c.fn.modal.defaults.spinner=c.fn.modalmanager.defaults.spinner='
    '}var i;var h;if(typeof(f)==="string"){i={};h=f}else{i=f.data();h=f.attr("href")||i.amsUrl;var g=a.getFunctionByName(h);if(typeof(g)==="function"){h=g.call(f)}}if(!h){return}c("body").modalmanager("loading");if(h.indexOf("#")===0){c(h).modal("show")}else{c.ajax({url:h,type:"get",cache:i.amsAllowCache===undefined?false:i.amsAllowCache,data:e,success:function(n,m,l){c("body").modalmanager("removeLoading");var o=a.ajax.getResponse(l);var t=o.content_type;var u=o.data;switch(t){case"json":a.ajax.handleJSON(u,c(c(f).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var p=c(u);var r=c(".modal-dialog",p.wrap("
    ").parent());var q=r.data();var s={backdrop:"static",overflow:q.amsModalOverflow||".modal-viewport",maxHeight:q.amsModalMaxHeight===undefined?function(){return c(window).height()-c(".modal-header",p).outerHeight(true)-c("footer",p).outerHeight(true)-85}:a.getFunctionByName(q.amsModalMaxHeight)};var k=c.extend({},s,q.amsModalOptions);k=a.executeFunctionByName(q.amsModalInitCallback,r,k)||k;c("
    ").addClass("modal fade").append(p).modal(k).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(p)}}})}})})},shown:function(m){function l(o){var p=c(".scrollmarker.top",f);var n=f.scrollTop();if(n>0){p.show()}else{p.hide()}var e=c(".scrollmarker.bottom",f);if(j+n>=f.get(0).scrollHeight){e.hide()}else{e.show()}}var k=m.target;var f=c(".modal-viewport",k);if(f.exists()){var j=parseInt(f.css("max-height"));var h=c.scrollbarWidth();if(f.height()===j){c("
    ").addClass("scrollmarker").addClass("top").css("top",0).css("width",f.width()-h).hide().appendTo(f);c("
    ").addClass("scrollmarker").addClass("bottom").css("top",j-20).css("width",f.width()-h).appendTo(f);f.scroll(l);f.off("resize").on("resize",l)}else{c(".scrollmarker",f).remove()}}var g;var i=c(".modal-dialog",k).data("shown-callbacks");if(i){for(g=0;g=0)){g.hide()}}},hidden:function(i){var h=i.target;a.skin.cleanContainer(h);var f;var g=c(".modal-dialog",h).data("hide-callbacks");if(g){for(f=0;f"+g.error_message+"",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(g.location);break;default:return{results:g.results||g,more:g.has_more||false,context:g.context}}},select2QueryMethodSuccessCallback:function(i,g,h){var f=i.result;if(typeof(f)==="string"){try{f=JSON.parse(f)}catch(j){}}switch(f.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+f.error_message+"

    ",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(f.location);break;default:h.callback({results:f.results||f,more:f.has_more||false,context:f.context})}},contextMenuHandler:function(h,i){var e=i.data();if(e.toggle==="modal"){a.dialog.open(i)}else{var f=i.attr("href")||e.amsUrl;if(!f||f.startsWith("javascript")||i.attr("target")){return}a.event.stop();var g=a.getFunctionByName(f);if(typeof(g)==="function"){f=g.call(i,h)}if(typeof(f)==="function"){f.call(i,h)}else{f=f.replace(/\%23/,"#");h=i.data("ams-target");if(h){a.form.confirmChangedForm(h,function(){a.skin.loadURL(f,h,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}}},datetimepickerDialogHiddenCallback:function(){c(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};d.plugins={init:function(i){a.plugins.initData(i);var h=[];c("[data-ams-plugins-disabled]",i).each(function(){var n=c(this).data("ams-plugins-disabled").split(/\s+/);for(var o=0;o=0){continue}var l=a.plugins.enabled[k];switch(typeof(l)){case"function":l(i);break;default:for(var f=0;f=0){if(b.console){b.console.warn("Plugin "+e+" is already registered!")}return}if(typeof(f)==="object"){var g=f.src;if(g){a.ajax.check(f.callback,g,function(i){if(i){a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}})}else{a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}}else{if(typeof(f)==="function"){a.plugins.enabled[e]=f;if(h){a.executeFunctionByName(h)}}}},enabled:{hint:function(e){var f=c(".hint:not(:parents(.nohints))",e);if(f.length>0){a.ajax.check(c.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");f.each(function(){var k=c(this);var j=k.data();var h={html:j.amsHintHtml,title:a.getFunctionByName(j.amsHintTitleGetter)||function(){var l=c(this);return l.attr("original-title")||l.attr(j.amsHintTitleAttr||"title")||(j.amsHintHtml?l.html():l.text())},opacity:j.amsHintOpacity||0.95,gravity:j.amsHintGravity||"sw",offset:j.amsHintOffset||0};var g=c.extend({},h,j.amsHintOptions);g=a.executeFunctionByName(j.amsHintInitCallback,k,g)||g;var i=k.tipsy(g);a.executeFunctionByName(j.amsHintAfterInitCallback,k,i,g)})})}},contextMenu:function(e){var f=c(".context-menu",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={menuSelector:j.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var g=c.extend({},h,j.amsContextmenuOptions);g=a.executeFunctionByName(j.amsContextmenuInitCallback,k,g)||g;var i=k.contextMenu(g);a.executeFunctionByName(j.amsContextmenuAfterInitCallback,k,i,g)})}},switcher:function(e){c("LEGEND.switcher",e).each(function(){var g=c(this);var f=g.parent("fieldset");var h=g.data();if(!h.amsSwitcher){c('').prependTo(c(this)).addClass(h.amsSwitcherState==="open"?(h.amsSwitcherMinusClass||"fa-minus"):(h.amsSwitcherPlusClass||"fa-plus"));g.on("click",function(j){j.preventDefault();var i={};g.trigger("ams.switcher.before-switch",[g,i]);if(i.veto){return}if(f.hasClass("switched")){f.removeClass("switched");c(".fa",g).removeClass(h.amsSwitcherPlusClass||"fa-plus").addClass(h.amsSwitcherMinusClass||"fa-minus");g.trigger("ams.switcher.opened",[g]);var k=g.attr("id");if(k){c('legend.switcher[data-ams-switcher-sync="'+k+'"]',f).each(function(){var l=c(this);if(l.parents("fieldset").hasClass("switched")){l.click()}})}}else{f.addClass("switched");c(".fa",g).removeClass(h.amsSwitcherMinusClass||"fa-minus").addClass(h.amsSwitcherPlusClass||"fa-plus");g.trigger("ams.switcher.closed",[g])}});if(h.amsSwitcherState!=="open"){f.addClass("switched")}g.data("ams-switcher","on")}})},checker:function(e){c("LEGEND.checker",e).each(function(){var q=c(this);var r=q.parent("fieldset");var h=q.data();if(!h.amsChecker){var f=c('');var k=h.amsCheckerFieldname||("checker_"+a.generateId());var o=k.replace(/\./,"_");var i=h.amsCheckerHiddenPrefix;var j=null;var n=h.amsCheckerHiddenValueOn||"true";var l=h.amsCheckerHiddenValueOff||"false";var g=h.amsCheckerMarker||false;if(i){j=c('').attr("name",i+k).val(h.amsCheckerState==="on"?n:l).prependTo(q)}else{if(g){c('').attr("name",g).attr("value",1).prependTo(q)}}var p=c('').attr("name",k).attr("id",o).data("ams-checker-hidden-input",j).data("ams-checker-init",true).val(h.amsCheckerValue||true).attr("checked",h.amsCheckerState==="on"?"checked":null);if(h.amsCheckerReadonly){p.attr("disabled","disabled")}else{p.on("change",function(u){u.preventDefault();var s={};var v=c(this).is(":checked");q.trigger("ams.checker.before-switch",[q,s]);if(s.veto){c(this).prop("checked",!v);return}a.executeFunctionByName(h.amsCheckerChangeHandler,q,v);if(!h.amsCheckerCancelDefault){var t=p.data("ams-checker-hidden-input");if(v){if(h.amsCheckerMode==="disable"){r.removeAttr("disabled")}else{r.removeClass("switched")}if(t){t.val(n)}c("[data-required]",r).attr("required","required");q.trigger("ams.checker.opened",[q])}else{if(h.amsCheckerMode==="disable"){r.prop("disabled","disabled")}else{r.addClass("switched")}if(t){t.val(l)}c("[data-required]",r).removeAttr("required");q.trigger("ams.checker.closed",[q])}}})}p.appendTo(f);c(">label",q).attr("for",p.attr("id"));f.append("").prependTo(q);var m=c("[required]",r);m.attr("data-required",true);if(h.amsCheckerState==="on"){p.attr("checked",true)}else{if(h.amsCheckerMode==="disable"){r.attr("disabled","disabled")}else{r.addClass("switched")}m.removeAttr("required")}q.data("ams-checker","on")}})},slider:function(e){var f=c(".slider",e);if(f.length>0){a.ajax.check(c.fn.slider,a.baseURL+"ext/bootstrap-slider-2.0.0"+a.devext+".js",function(){f.each(function(){var j=c(this);var k=j.data();var h={};var g=c.extend({},h,j.data.amsSliderOptions);g=a.executeFunctionByName(k.amsSliderInitCallback,j,g)||g;var i=j.slider(g);a.executeFunctionByName(k.amsSliderAfterInitCallback,j,i,g)})})}},draggable:function(f){var e=c(".draggable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={containment:k.amsDraggableContainment,helper:a.getFunctionByName(k.amsDraggableHelper)||k.amsDraggableHelper,start:a.getFunctionByName(k.amsDraggableStart),stop:a.getFunctionByName(k.amsDraggableStop)};var h=c.extend({},i,k.amsDraggableOptions);h=a.executeFunctionByName(k.amsDraggableInitCallback,g,h)||h;var j=g.draggable(h);g.disableSelection();a.executeFunctionByName(k.amsDraggableAfterInitCallback,g,j,h)})}},sortable:function(e){var f=c(".sortable",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={items:j.amsSortableItems,handle:j.amsSortableHandle,connectWith:j.amsSortableConnectwith,start:a.getFunctionByName(j.amsSortableStart),over:a.getFunctionByName(j.amsSortableOver),containment:j.amsSortableContainment,placeholder:j.amsSortablePlaceholder,stop:a.getFunctionByName(j.amsSortableStop)};var g=c.extend({},h,j.amsSortableOptions);g=a.executeFunctionByName(j.amsSortableInitCallback,k,g)||g;var i=k.sortable(g);k.disableSelection();a.executeFunctionByName(j.amsSortableAfterInitCallback,k,i,g)})}},resizable:function(f){var e=c(".resizable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={autoHide:k.amsResizableAutohide===false?true:k.amsResizableAutohide,containment:k.amsResizableContainment,grid:k.amsResizableGrid,handles:k.amsResizableHandles,start:a.getFunctionByName(k.amsResizableStart),stop:a.getFunctionByName(k.amsResizableStop)};var h=c.extend({},i,k.amsResizableOptions);h=a.executeFunctionByName(k.amsResizableInitCallback,g,h)||h;var j=g.resizable(h);g.disableSelection();a.executeFunctionByName(k.amsResizableAfterInitCallback,g,j,h)})}},typeahead:function(f){var e=c(".typeahead",f);if(e.length>0){a.ajax.check(c.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i={};var h=c.extend({},i,k.amsTypeaheadOptions);h=a.executeFunctionByName(k.amsTypeaheadInitCallback,g,h)||h;var j=g.typeahead(h);a.executeFunctionByName(k.amsTypeaheadAfterInitCallback,g,j,h)})})}},select2:function(f){var e=c(".select2",f);if(e.length>0){a.ajax.check(c.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){e.each(function(){var g=c(this);var l=g.data();var j={placeholder:l.amsSelect2Placeholder,multiple:l.amsSelect2Multiple,minimumInputLength:l.amsSelect2MinimumInputLength||0,maximumSelectionSize:l.amsSelect2MaximumSelectionSize,openOnEnter:l.amsSelect2EnterOpen===undefined?true:l.amsSelect2EnterOpen,allowClear:l.amsSelect2AllowClear===undefined?true:l.amsSelect2AllowClear,width:l.amsSelect2Width||"100%",initSelection:a.getFunctionByName(l.amsSelect2InitSelection),formatSelection:l.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(l.amsSelect2FormatSelection),formatResult:a.getFunctionByName(l.amsSelect2FormatResult),formatMatches:l.amsSelect2FormatMatches===undefined?function(m){if(m===1){return a.i18n.SELECT2_MATCH}else{return m+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(l.amsSelect2FormatMatches),formatNoMatches:l.amsSelect2FormatResult===undefined?function(m){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(l.amsSelect2FormatResult),formatInputTooShort:l.amsSelect2FormatInputTooShort===undefined?function(m,o){var p=o-m.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooShort),formatInputTooLong:l.amsSelect2FormatInputTooLong===undefined?function(o,m){var p=o.length-m;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooLong),formatSelectionTooBig:l.amsSelect2FormatSelectionTooBig===undefined?function(m){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,m).replace(/\{1\}/,m===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatSelectionTooBig),formatLoadMore:l.amsSelect2FormatLoadMore===undefined?function(m){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(l.amsSelect2FormatLoadMore),formatSearching:l.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(l.amsSelect2FormatSearching),separator:l.amsSelect2Separator||",",tokenSeparators:l.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(l.amsSelect2Tokenizer)};switch(g.context.type){case"text":case"hidden":if(!j.initSelection){var h=g.data("ams-select2-values");if(h){j.initSelection=function(m,o){var n=[];c(m.val().split(j.separator)).each(function(){n.push({id:this,text:h[this]||this})});o(n)}}}break;default:break}if(g.attr("readonly")){if(g.attr("type")==="hidden"){j.query=function(){return[]}}}else{if(l.amsSelect2Query){j.query=a.getFunctionByName(l.amsSelect2Query);j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryUrl){j.ajax={url:l.amsSelect2QueryUrl,quietMillis:l.amsSelect2QuietMillis||200,type:l.amsSelect2QueryType||"POST",dataType:l.amsSelect2QueryDatatype||"json",data:function(o,p,n){var m={};m[l.amsSelect2QueryParamName||"query"]=o;m[l.amsSelect2PageParamName||"page"]=p;m[l.amsSelect2ContextParamName||"context"]=n;return c.extend({},m,l.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryMethod){j.query=function(m){var n={id:new Date().getTime(),params:l.amsSelect2QueryParams||{},success:function(o){return a.helpers.select2QueryMethodSuccessCallback.call(g,o,"success",m)},error:a.error.show};n.params[l.amsSelect2QueryParamName||"query"]=m.term;n.params[l.amsSelect2PageParamName||"page"]=m.page;n.params[l.amsSelect2ContextParamName||"context"]=m.context;n=c.extend({},n,l.amsSelect2QueryOptions);n=a.executeFunctionByName(l.amsSelect2QueryInitCallback,g,n)||n;a.ajax.check(c.jsonRPC,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){c.jsonRPC.withOptions({endPoint:l.amsSelect2MethodTarget||a.jsonrpc.getAddr(),namespace:l.amsSelect2MethodNamespace,cache:false},function(){c.jsonRPC.request(l.amsSelect2QueryMethod,n)})})};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2Tags){j.tags=l.amsSelect2Tags}else{if(l.amsSelect2Data){j.data=l.amsSelect2Data}}}}}}if(l.amsSelect2EnableFreeTags){j.createSearchChoice=function(m){return{id:m,text:(l.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+m}}}var i=c.extend({},j,l.amsSelect2Options);i=a.executeFunctionByName(l.amsSelect2InitCallback,g,i)||i;var k=g.select2(i);a.executeFunctionByName(l.amsSelect2AfterInitCallback,g,k,i);if(g.hasClass("ordered")){a.ajax.check(c.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){g.select2Sortable({bindOrder:"sortableStop"})})}g.on("change",function(){var m=c(g.get(0).form).data("validator");if(m!==undefined){c(g).valid()}})})})}},maskedit:function(f){var e=c("[data-mask]",f);if(e.length>0){a.ajax.check(c.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.4.1"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i={placeholder:k.amsMaskeditPlaceholder===undefined?"X":k.amsMaskeditPlaceholder,complete:a.getFunctionByName(k.amsMaskeditComplete)};var h=c.extend({},i,k.amsMaskeditOptions);h=a.executeFunctionByName(k.amsMaskeditInitCallback,g,h)||h;var j=g.mask(g.attr("data-mask"),h);a.executeFunctionByName(k.amsMaskeditAfterInitCallback,g,j,h)})})}},inputmask:function(f){var e=c("[data-input-mask]",f);if(e.length>0){a.ajax.check(c.fn.inputmask,a.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i;if(typeof(k.inputMask)==="object"){i=k.inputMask}else{i={mask:k.inputMask.toString()}}var h=c.extend({},i,k.amsInputmaskOptions);h=a.executeFunctionByName(k.amsInputmaskInitCallback,g,h)||h;var j=g.inputmask(h);a.executeFunctionByName(k.amsInputmaskAfterInitCallback,g,j,h)})})}},datepicker:function(e){var f=c(".datepicker",e);if(f.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}f.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},datetimepicker:function(f){var e=c(".datetimepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},timepicker:function(f){var e=c(".timepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},colorpicker:function(e){var f=c(".colorpicker",e);if(f.length>0){a.ajax.check(c.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}f.each(function(){var h=c(this);var l=h.data();var j={position:l.amsColorpickerPosition||h.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var i=c.extend({},j,l.amsColorpickerOptions);i=a.executeFunctionByName(l.amsColorpickerInitCallback,h,i)||i;var k=h.minicolors(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},validate:function(f){var e=c("FORM:not([novalidate])",f);if(e.length>0){a.ajax.check(c.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(i){if(i){c.validator.setDefaults({highlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(k,l){var j=l.parents("label:first");if(j.length){k.insertAfter(j)}else{k.insertAfter(l)}}});if(a.plugins.i18n){for(var g in a.plugins.i18n.validate){if(!a.plugins.i18n.validate.hasOwnProperty(g)){continue}var h=a.plugins.i18n.validate[g];if((typeof(h)==="string")&&(h.indexOf("{0}")>-1)){a.plugins.i18n.validate[g]=c.validator.format(h)}}c.extend(c.validator.messages,a.plugins.i18n.validate)}}e.each(function(){var m=c(this);var n=m.data();var k={ignore:null,submitHandler:m.attr("data-async")!==undefined?n.amsFormSubmitHandler===undefined?function(){c(".state-error",m).removeClass("state-error");a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(m)}:a.getFunctionByName(n.amsFormSubmitHandler):undefined,invalidHandler:m.attr("data-async")!==undefined?n.amsFormInvalidHandler===undefined?function(s,r){c(".state-error",m).removeClass("state-error");for(var p=0;p0){var t=c(".nav-tabs",c(o.element).parents(".tabforms"));c("li:nth-child("+q+")",t).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",t).click()}}}:a.getFunctionByName(n.amsFormInvalidHandler):undefined};c("[data-ams-validate-rules]",m).each(function(){if(index===0){k.rules={}}k.rules[c(this).attr("name")]=c(this).data("ams-validate-rules")});var j=c.extend({},k,n.amsValidateOptions);j=a.executeFunctionByName(n.amsValidateInitCallback,m,j)||j;var l=m.validate(j);a.executeFunctionByName(n.amsValidateAfterInitCallback,m,l,j)})})}},datatable:function(f){var e=c(".datatable",f);if(e.length>0){a.ajax.check(c.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(g){c(e).each(function(){a.ajax.check(c.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var D=c(this);var H=D.data();var F=(H.amsDatatableExtensions||"").split(/\s+/);var m=H.amsDatatableSdom||"W"+((F.indexOf("colreorder")>=0||F.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(F.indexOf("colvis")>=0?"C":"")+((H.amsDatatablePagination===false||H.amsDatatablePaginationSize===false)?"":"L")+(H.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(F.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(H.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var p;var i=H.amsDatatableSorting;if(typeof(i)==="string"){var G=i.split(";");i=[];for(p=0;p=0,bPaginate:H.amsDatatablePagination!==false,bInfo:H.amsDatatableInfo!==false,bSort:H.amsDatatableSort!==false,aaSorting:i,aoColumns:h.length>0?h:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:H.amsDatatableDisplayLength||25,sPaginationType:H.amsDatatablePaginationType||"bootstrap_full",sDom:m,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(K,J){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var E=c.extend({},z,H.amsDatatableOptions);if(F.length>0){for(p=0;p0){for(p=0;p0){for(p=0;p0){a.ajax.check(c.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(g){e.each(function(){var k=c(this);var l=k.data();if(l.amsTabledndDragHandle){c("tr",k).addClass("no-drag-handle")}else{c(k).on("mouseover","tr",function(){c(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){c(this.cells[0]).removeClass("drag-handle")})}var i={onDragClass:l.amsTabledndDragClass||"dragging-row",onDragStart:a.getFunctionByName(l.amsTabledndDragStart),dragHandle:l.amsTabledndDragHandle,scrollAmount:l.amsTabledndScrollAmount,onAllowDrop:l.amsTabledndAllowDrop,onDrop:a.getFunctionByName(l.amsTabledndDrop)||function(o,q){var n=l.amsTabledndDropTarget;if(n){c(q).data("ams-disabled-handlers","click");var m=[];c(o.rows).each(function(){var r=c(this).data("ams-element-name");if(r){m.push(r)}});var p=a.getFunctionByName(n);if(typeof(p)==="function"){p.call(k,o,m)}else{a.ajax.post(n,{names:JSON.stringify(m)})}setTimeout(function(){c(q).removeData("ams-disabled-handlers")},50)}return false}};var h=c.extend({},i,l.amsTabledndOptions);h=a.executeFunctionByName(l.amsTabledndInitCallback,k,h)||h;var j=k.tableDnD(h);a.executeFunctionByName(l.amsTabledndAfterInitCallback,k,j,h)})})}},tinymce:function(e){function h(){c(".tinymce",c(this)).each(function(){var i=tinymce.get(c(this).attr("id"));if(i){i.remove()}})}var f=c(".tinymce",e);if(f.length>0){var g=a.baseURL+"ext/tinymce"+(a.devmode?"/dev":"");a.ajax.check(window.tinymce,g+"/tinymce"+a.devext+".js",function(i){if(i){a.getScript(g+"/jquery.tinymce"+a.devext+".js");tinymce.baseURL=g;tinymce.suffix=a.devext;a.skin.registerCleanCallback(h)}f.each(function(){var m=c(this);var p=m.data();var l={theme:"modern",language:a.lang,plugins:["advlist autosave autolink lists link image charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code","insertdatetime media nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern"],toolbar1:"newdocument undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",toolbar2:"print preview media | forecolor backcolor emoticons | code",content_css:p.amsTinymceContentCss,formats:p.amsTinymceFormats,style_formats:p.amsTinymceStyleFormats,block_formats:p.amsTinymceBlockFormats,valid_classes:p.amsTinymceValidClasses,image_advtab:true,image_list:a.getFunctionByName(p.amsTinymceImageList)||p.amsTinymceImageList,image_class_list:p.amsTinymceImageClassList,link_list:a.getFunctionByName(p.amsTinymceLinkList)||p.amsTinymceLinkList,link_class_list:p.amsTinymceLinkClassList,resize:true};if(p.amsTinymceExternalPlugins){var q=p.amsTinymceExternalPlugins.split(/\s+/);for(var j in q){var o=m.data("ams-tinymce-plugin-"+q[j]);tinymce.PluginManager.load(q[j],a.getSource(o))}}var k=c.extend({},l,p.amsTinymceOptions);k=a.executeFunctionByName(p.amsTinymceInitCallback,m,k)||k;var n=m.tinymce(k);a.executeFunctionByName(p.amsTinymceAfterInitCallback,m,n,k)})})}},imgareaselect:function(f){var e=c(".imgareaselect",f);if(e.length>0){a.ajax.check(c.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}e.each(function(){var m=c(this);var l=m.data();var j=l.amsImgareaselectParent?m.parents(l.amsImgareaselectParent):"body";var i={instance:true,handles:true,parent:j,x1:l.amsImgareaselectX1||0,y1:l.amsImgareaselectY1||0,x2:l.amsImgareaselectX2||l.amsImgareaselectImageWidth,y2:l.amsImgareaselectY2||l.amsImgareaselectImageHeight,imageWidth:l.amsImgareaselectImageWidth,imageHeight:l.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:l.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(l.amsImgareaselectSelectEnd)||function(n,o){var p=l.amsImgareaselectTargetField||"image_";c('input[name="'+p+'x1"]',j).val(o.x1);c('input[name="'+p+'y1"]',j).val(o.y1);c('input[name="'+p+'x2"]',j).val(o.x2);c('input[name="'+p+'y2"]',j).val(o.y2)}};var h=c.extend({},i,l.amsImgareaselectOptions);h=a.executeFunctionByName(l.amsImgareaselectInitCallback,m,h)||h;var k=m.imgAreaSelect(h);a.executeFunctionByName(l.amsImgareaselectAfterInitCallback,m,k,h);setTimeout(function(){k.update()},250)})})}},fancybox:function(e){var f=c(".fancybox",e);if(f.length>0){a.ajax.check(c.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}f.each(function(){var h=c(this);var o=h.data();var n=(o.amsFancyboxHelpers||"").split(/\s+/);if(n.length>0){for(var i=0;i0){a.ajax.check(c.fn.plot,a.baseURL+"flot/jquery.flot"+a.devext+".js",function(){f.each(function(){function k(r){for(var q in c.plot.plugins){var s=c.plot.plugins[q];if(s.name==r){return s}}return null}var m=c(this);var i=m.data();var p={};var h=(i.amsChartPlugins||"").split(/\s+/);if(h.length>0){for(var l in h){var n=h[l];if(!k(n)){a.getScript(a.baseURL+"flot/jquery.flot."+n+a.devext+".js")}}}var g=c.extend({},p,i.amsChartOptions);g=a.executeFunctionByName(i.amsChartInitCallback,m,g)||g;var o=i.amsChartData;o=a.executeFunctionByName(i.amsChartInitData,m,o)||o;var j=m.plot(o,g);a.executeFunctionByName(i.amsChartAfterInitCallback,m,j,g)})})}},graphs:function(f){var e=c(".sparkline",f);if(e.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(e)})}},scrollbars:function(e){var f=c(".scrollbar",e);if(f.length>0){a.ajax.check(c.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(c.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}f.each(function(){var l=c(this);var k=l.data();var i={theme:k.amsScrollbarTheme||"light"};var h=c.extend({},i,k.amsScrollbarOptions);h=a.executeFunctionByName(k.amsScrollbarInitCallback,l,h)||h;var j=l.mCustomScrollbar(h);a.executeFunctionByName(k.amsScrollbarAfterInitCallback,l,j,h)})})})}}}};d.callbacks={init:function(e){c("[data-ams-callback]",e).each(function(){var f=this;var g=c(f).data();var h=a.getFunctionByName(g.amsCallback);if(h===undefined){if(g.amsCallbackSource){a.getScript(g.amsCallbackSource,function(){a.executeFunctionByName(g.amsCallback,f,g.amsCallbackOptions)})}else{if(b.console){b.console.warn("Undefined callback: "+g.amsCallback)}}}else{h.call(f,g.amsCallbackOptions)}})},alert:function(m){var h=c(this).data();var e=c.extend({},m,h.amsAlertOptions);var k=c(h.amsAlertParent||e.parent||this);var g=h.amsAlertStatus||e.status||"info";var i=h.amsAlertHeader||e.header;var l=h.amsAlertMessage||e.message;var j=h.amsAlertSubtitle||e.subtitle;var f=h.amsAlertMargin===undefined?(e.margin===undefined?false:e.margin):h.amsAlertMargin;a.skin.alert(k,g,i,l,j,f)},messageBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsMessageboxOptions);var g=c.extend({},h,{title:i.amsMessageboxTitle||h.title||"",content:i.amsMessageboxContent||h.content||"",icon:i.amsMessageboxIcon||h.icon,number:i.amsMessageboxNumber||h.number,timeout:i.amsMessageboxTimeout||h.timeout});var e=i.amsMessageboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsMessageboxCallback||h.callback);a.skin.messageBox(e,g,j)},smallBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsSmallboxOptions);var g=c.extend({},h,{title:i.amsSmallboxTitle||h.title||"",content:i.amsSmallboxContent||h.content||"",icon:i.amsSmallboxIcon||h.icon,iconSmall:i.amsSmallboxIconSmall||h.iconSmall,timeout:i.amsSmallboxTimeout||h.timeout});var e=i.amsSmallboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsSmallboxCallback||h.callback);a.skin.smallBox(e,g,j)}};d.events={init:function(e){c("[data-ams-events-handlers]",e).each(function(){var g=c(this);var f=g.data("ams-events-handlers");if(f){for(var h in f){if(f.hasOwnProperty(h)){g.on(h,a.getFunctionByName(f[h]))}}}})}};d.container={changeOrder:function(f,g){var e=c('input[name="'+c(this).data("ams-input-name")+'"]',c(this));e.val(g.join(";"))},deleteElement:function(e){return function(){var f=c(this);d.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){var k=f.parents("table");var h=k.data("ams-location")||"";var l=f.parents("tr");var j=l.data("ams-delete-target")||k.data("ams-delete-target")||"delete-element.json";var g=l.data("ams-element-name");d.ajax.post(h+"/"+j,{object_name:g},function(m,n){if(m.status==="success"){if(k.hasClass("datatable")){k.dataTable().fnDeleteRow(l[0])}else{l.remove()}}})}})}}};d.skin={_setPageHeight:function(){var g=c("#main").height();var e=a.left_panel.height();var f=c(window).height()-a.navbar_height;if(g>f){a.left_panel.css("min-height",g);a.root.css("min-height",g+a.navbar_height)}else{a.left_panel.css("min-height",f);a.root.css("min-height",f)}},_checkMobileWidth:function(){if(c(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){var e=c("#activity > .badge");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_initDesktopWidgets:function(e){if(a.enable_widgets){var f=c(".ams-widget",e);if(f.length>0){a.ajax.check(c.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){f.each(function(){var j=c(this);var i=j.data();var h={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var g=c.extend({},h,i.amsWidgetOptions);g=a.executeFunctionByName(i.amsWidgetInitcallback,j,g)||g;j.MyAMSWidget(g)});b.MyAMSWidget.initWidgetsGrid(c(".ams-widget-grid",e))})}}},_initMobileWidgets:function(e){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(e)}},alert:function(l,f,g,m,k,e){if(f==="error"){f="danger"}c(".alert-"+f,l).remove();var i='

    '+g+"

    "+(k?("

    "+k+"

    "):"");if(typeof(m)==="string"){i+="
    • "+m+"
    "}else{if(m){i+="
      ";for(var h in m){if(!c.isNumeric(h)){continue}i+="
    • "+m[h]+"
    • "}i+="
    "}}i+="
    ";var j=c(i).prependTo(l);if(l.exists){a.ajax.check(c.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){c.scrollTo(l,{offset:{top:-50}})})}},bigBox:function(e,f){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(e,f)})},messageBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.bigBox(f,g)})},smallBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.smallBox(f,g)})},_drawBreadCrumb:function(){var e=c("#ribbon OL.breadcrumb");c("li",e).not(".parent").remove();if(!c("li",e).exists()){e.append(c("
  • ").append(c("").text(a.i18n.HOME).addClass("padding-right-5").attr("href",c('nav a[href!="#"]:first').attr("href"))))}c("nav LI.active >A").each(function(){var h=c(this);var f=c.trim(h.clone().children(".badge").remove().end().text());var g=c("
  • ").append(h.attr("href").replace(/^#/,"")?c("").html(f).attr("href",h.attr("href")):f);e.append(g)})},checkURL:function(){function e(l){c(".active",i).removeClass("active");l.addClass("open").addClass("active");l.parents("li").addClass("open active").children("ul").addClass("active").show();l.parents("li:first").removeClass("open");l.parents("ul").addClass(l.attr("href").replace(/^#/,"")?"active":"").show()}var j;var i=c("nav");var h=location.hash;var g=h.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}j=c('A[href="'+h+'"]',i);if(j.exists()){e(j)}a.skin.loadURL(g,f);document.title=c("[data-ams-page-title]:first",f).data("ams-page-title")||j.attr("title")||document.title}else{var k=c("[data-ams-active-menu]").data("ams-active-menu");if(k){j=c('A[href="'+k+'"]',i)}else{j=c('>UL >LI >A[href!="#"]',i).first()}if(j.exists()){e(j);if(k){a.skin._drawBreadCrumb()}else{window.location.hash=j.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f Loading... ');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();document.title=c(".breadcrumb LI:last-child").text();c("html, body").animate({scrollTop:0},"fast")}else{e.animate({scrollTop:0},"fast")}},success:function(o,l,n){if(j){a.executeFunctionByName(j,this,o,l,n,f)}else{var m=a.ajax.getResponse(n);var p=m.content_type;var k=m.data;c(".loading",e).remove();switch(p){case"json":a.ajax.handleJSON(k,e);break;case"script":break;case"xml":break;case"html":case"text":default:e.parents(".hidden").removeClass("hidden");c(".alert",e.parents(".alerts-container")).remove();e.css({opacity:"0.0"}).html(o).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(e);a.form.setFocus(e)}if(f&&f.afterLoadCallback){a.executeFunctionByName(f.afterLoadCallback,this)}}},error:function(m,l,k){e.html('

    '+a.i18n.ERROR+k+"

    "+m.responseText)},async:false};var h=c.extend({},i,f);c.ajax(h)},setLanguage:function(f){var h=f.lang;var g=f.handler_type||"json";switch(g){case"json":var i=f.method||"setUserLanguage";a.jsonrpc.post(i,{lang:h},function(){window.location.reload(true)});break;case"ajax":var e=f.href||"setUserLanguage";a.ajax.post(e,{lang:h},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};d.stats={logEvent:function(f,g,e){if(typeof(b._gaq)==="undefined"){return}if(typeof(f)==="object"){g=f.action;e=f.label;f=f.category}b._gaq.push(["_trackEvent",f,g,e])}};d.initPage=function(){var e=c("body");a.root=e;a.left_panel=c("#left-panel");a.shortcuts=c("#shortcuts");a.plugins.initData(e);var f=c.ajaxSettings.xhr;c.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var i=f();if(i&&(typeof(i.addEventListener)==="function")){var h=this;i.addEventListener("progress",function(j){h.progress(j)},false)}return i}});c(document).ajaxStart(a.ajax.start);c(document).ajaxStop(a.ajax.stop);c(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enable_fastclick){a.ajax.check(c.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){c("NAV UL A").noClickDelay();c("A","#hide-menu").noClickDelay()})}}c("#hide-menu >:first-child > A").click(function(h){e.toggleClass("hidden-menu");h.preventDefault()});c("#show-shortcuts").click(function(h){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}h.preventDefault()});a.shortcuts.click(function(h){a.skin._hideShortcutButtons()});c(document).mouseup(function(h){if(!a.shortcuts.is(h.target)&&a.shortcuts.has(h.target).length===0){a.skin._hideShortcutButtons()}});c("#search-mobile").click(function(){a.root.addClass("search-mobile")});c("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});c("#activity").click(function(i){var h=c(this);var j=h.next(".ajax-dropdown");if(!j.is(":visible")){j.css("left",h.position().left-j.innerWidth()/2+h.innerWidth()/2).fadeIn(150);h.addClass("active")}else{j.fadeOut(150);h.removeClass("active")}i.preventDefault()});a.skin.checkNotification();c(document).mouseup(function(h){var i=c(".ajax-dropdown");if(!i.is(h.target)&&i.has(h.target).length===0){i.fadeOut(150).prev().removeClass("active")}});c('input[name="activity"]').change(function(){var i=c(this).data("ams-url");var h=c(".ajax-notifications");a.skin.loadURL(i,h)});c("a","#user-menu LI.logout").click(function(h){h.preventDefault();h.stopPropagation();a.loginURL=c(this).attr("href");a.skin.bigBox({title:" "+a.i18n.LOGOUT+" "+c("#show-shortcut").text()+" ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(i){if(i===a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});var g=c("nav");c("UL",g).myams_menu({accordion:g.data("ams-menu-accordion")!==false,speed:a.menu_speed});c(".minifyme").click(function(h){c("BODY").toggleClass("minified");c(this).effect("highlight",{},500);h.preventDefault()});c("#refresh").click(function(h){a.skin.bigBox({title:" "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(i){if(i===a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});h.preventDefault()});e.on("click",function(i){var h=c(this);if(!h.is(i.target)&&h.has(i.target).length===0&&c(".popover").has(i.target).length===0){h.popover("hide")}});a.ajax.check(c.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){c("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});g.resize(function(){a.skin._setPageHeight()})});if(a.ajax_nav){c(document).on("click",'a[href="#"]',function(h){h.preventDefault()});c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(m){var k=c(m.currentTarget);var i=k.data("ams-disabled-handlers");if((i===true)||(i==="click")||(i==="all")){return}var h=k.attr("href")||k.data("ams-url");if(!h||h.startsWith("javascript")||k.attr("target")||(k.data("ams-context-menu")===true)){return}m.preventDefault();m.stopPropagation();var j=a.getFunctionByName(h);if(typeof(j)==="function"){h=j.call(k)}if(typeof(h)==="function"){h.call(k)}else{h=h.replace(/\%23/,"#");var l=k.data("ams-target");if(l){a.form.confirmChangedForm(l,function(){a.skin.loadURL(h,l,k.data("ams-link-options"),k.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(h.startsWith("#")){if(h!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=h},50)}else{window.location.hash=h}}}else{window.location=h}})}}});c(document).on("click",'a[target="_blank"]',function(h){h.preventDefault();window.open(c(h.currentTarget).attr("href"))});c(document).on("click",'a[target="_top"]',function(h){h.preventDefault();a.form.confirmChangedForm(function(){window.location=c(h.currentTarget).attr("href")})});c(window).on("hashchange",a.skin.checkURL)}c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(j){var i=c(this);var h=i.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}if(i.data("ams-context-menu")===true){return}if(i.data("ams-stop-propagation")===true){j.stopPropagation()}j.preventDefault();a.dialog.open(i);if(i.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});c(document).on("click",'button[type="submit"], button.submit',function(){var h=c(this);c(h.get(0).form).data("ams-submit-button",h)});c(document).on("click","[data-ams-click-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}var i=j.data();if(i.amsClickHandler){if((i.amsStopPropagation===true)||(i.amsClickStopPropagation===true)){k.stopPropagation()}if(i.amsClickKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsClickHandler);if(l!==undefined){l.call(j,i.amsClickHandlerOptions)}}});c(document).on("change","[data-ams-change-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="change")||(h==="all")){return}var i=j.data();if(i.amsChangeHandler){if(i.amsChangeKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsChangeHandler);if(l!==undefined){l.call(j,i.amsChangeHandlerOptions)}}});c(document).on("reset","form",function(i){var h=c(this);setTimeout(function(){h.find(".select2").trigger("change")},10);a.form.setFocus(h)});c(document).on("reset","[data-ams-reset-handler]",function(j){var h=c(this);var i=h.data();if(i.amsResetHandler){if(i.amsResetKeepDefault!==true){j.preventDefault()}var k=a.getFunctionByName(i.amsResetHandler);if(k!==undefined){k.call(h,i.amsResetHandlerOptions)}}});c(document).on("change",'input[type="file"]',function(j){j.preventDefault();var h=c(this);var i=h.parent(".button");if(i.exists()&&i.parent().hasClass("input-file")){i.next('input[type="text"]').val(h.val())}});c(document).on("focusin",function(h){if(c(h.target).closest(".mce-window").length){h.stopImmediatePropagation()}});c("a[data-toggle=tab]",".nav-tabs").on("click",function(h){if(c(this).parent("li").hasClass("disabled")){h.preventDefault();return false}});c(document).on("show.bs.tab",function(j){var h=c(j.target);var i=h.data();if(i.amsUrl){if(i.amsTabLoaded){return}try{h.append('');a.skin.loadURL(i.amsUrl,h.attr("href"));if(i.amsTabLoadOnce){h.data("ams-tab-loaded",true)}}finally{c("i",h).remove()}}});a.initContent(document);if(a.ajax_nav&&g.exists()){a.skin.checkURL()}a.form.setFocus(document);c(window).on("beforeunload",a.form.checkBeforeUnload)};d.initContent=function(e){c(".tipsy").remove();c("[rel=tooltip]",e).tooltip();c("[rel=popover]",e).popover();c("[rel=popover-hover]",e).popover({trigger:"hover"});a.plugins.init(e);a.callbacks.init(e);a.events.init(e);a.form.init(e);if(a.device==="desktop"){a.skin._initDesktopWidgets(e)}else{a.skin._initMobileWidgets(e)}a.skin._setPageHeight()};d.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};c(document).ready(function(){c=jQuery.noConflict();var e=c("HTML");var f=e.attr("lang")||e.attr("xml:lang");if(f&&!f.startsWith("en")){d.lang=f;d.getScript(d.baseURL+"i18n/myams_"+f.substr(0,2)+".js",function(){d.initPage()})}else{d.initPage()}})})(jQuery,this); \ No newline at end of file