Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pidCrypt() {
- function t(t) {
- t || (t = 8);
- for (var e = new Array(t), n = [], i = 0; i < 256; i++)
- n[i] = i;
- for (i = 0; i < e.length; i++)
- e[i] = n[Math.floor(Math.random() * n.length)];
- return e
- }
- this.setDefaults = function() {
- this.params.nBits = 256,
- this.params.salt = t(8),
- this.params.salt = pidCryptUtil.byteArray2String(this.params.salt),
- this.params.salt = pidCryptUtil.convertToHex(this.params.salt),
- this.params.blockSize = 16,
- this.params.UTF8 = !0,
- this.params.A0_PAD = !0
- }
- ,
- this.debug = !0,
- this.params = {},
- this.params.dataIn = "",
- this.params.dataOut = "",
- this.params.decryptIn = "",
- this.params.decryptOut = "",
- this.params.encryptIn = "",
- this.params.encryptOut = "",
- this.params.key = "",
- this.params.iv = "",
- this.params.clear = !0,
- this.setDefaults(),
- this.errors = "",
- this.warnings = "",
- this.infos = "",
- this.debugMsg = "",
- this.setParams = function(t) {
- t || (t = {});
- for (var e in t)
- this.params[e] = t[e]
- }
- ,
- this.getParams = function() {
- return this.params
- }
- ,
- this.getParam = function(t) {
- return this.params[t] || ""
- }
- ,
- this.clearParams = function() {
- this.params = {}
- }
- ,
- this.getNBits = function() {
- return this.params.nBits
- }
- ,
- this.getOutput = function() {
- return this.params.dataOut
- }
- ,
- this.setError = function(t) {
- this.error = t
- }
- ,
- this.appendError = function(t) {
- return this.errors += t,
- ""
- }
- ,
- this.getErrors = function() {
- return this.errors
- }
- ,
- this.isError = function() {
- return this.errors.length > 0
- }
- ,
- this.appendInfo = function(t) {
- return this.infos += t,
- ""
- }
- ,
- this.getInfos = function() {
- return this.infos
- }
- ,
- this.setDebug = function(t) {
- this.debug = t
- }
- ,
- this.appendDebug = function(t) {
- return this.debugMsg += t,
- ""
- }
- ,
- this.isDebug = function() {
- return this.debug
- }
- ,
- this.getAllMessages = function(t) {
- var e = {
- lf: "\n",
- clr_mes: !1,
- verbose: 15
- };
- t || (t = e);
- for (var n in e)
- void 0 === t[n] && (t[n] = e[n]);
- var i = ""
- , r = "";
- for (var o in this.params) {
- switch (o) {
- case "encryptOut":
- r = pidCryptUtil.toByteArray(this.params[o].toString()),
- r = pidCryptUtil.fragment(r.join(), 64, t.lf);
- break;
- case "key":
- case "iv":
- r = pidCryptUtil.formatHex(this.params[o], 48);
- break;
- default:
- r = pidCryptUtil.fragment(this.params[o].toString(), 64, t.lf)
- }
- i += "<p><b>" + o + "</b>:<pre>" + r + "</pre></p>"
- }
- return this.debug && (i += "debug: " + this.debug + t.lf),
- this.errors.length > 0 && 1 == (1 & t.verbose) && (i += "Errors:" + t.lf + this.errors + t.lf),
- this.warnings.length > 0 && 2 == (2 & t.verbose) && (i += "Warnings:" + t.lf + this.warnings + t.lf),
- this.infos.length > 0 && 4 == (4 & t.verbose) && (i += "Infos:" + t.lf + this.infos + t.lf),
- this.debug && 8 == (8 & t.verbose) && (i += "Debug messages:" + t.lf + this.debugMsg + t.lf),
- t.clr_mes && (this.errors = this.infos = this.warnings = this.debug = ""),
- i
- }
- ,
- this.getRandomBytes = function(e) {
- return t(e)
- }
- }
- function certParser(t) {
- var e = t.split("\n")
- , n = !1
- , i = !1
- , r = ""
- , o = {};
- o.info = "",
- o.salt = "",
- o.iv,
- o.b64 = "",
- o.aes = !1,
- o.mode = "",
- o.bits = 0;
- for (var s = 0; s < e.length; s++)
- switch (r = e[s].substr(0, 9),
- 1 == s && "Proc-Type" != r && 0 == r.indexOf("M") && (i = !0),
- r) {
- case "-----BEGI":
- n = !0;
- break;
- case "Proc-Type":
- n && (o.info = e[s]);
- break;
- case "DEK-Info:":
- if (n) {
- var a = e[s].split(",")
- , u = a[0].split(": ")[1].split("-");
- o.aes = "AES" == u[0],
- o.mode = u[2],
- o.bits = parseInt(u[1]),
- o.salt = a[1].substr(0, 16),
- o.iv = a[1]
- }
- break;
- case "":
- n && (i = !0);
- break;
- case "-----END ":
- n && (i = !1,
- n = !1);
- break;
- default:
- n && i && (o.b64 += pidCryptUtil.stripLineFeeds(e[s]))
- }
- return o
- }
- function BigInteger(t, e, n) {
- null != t && ("number" == typeof t ? this.fromNumber(t, e, n) : null == e && "string" != typeof t ? this.fromString(t, 256) : this.fromString(t, e))
- }
- function nbi() {
- return new BigInteger(null)
- }
- function am1(t, e, n, i, r, o) {
- for (; --o >= 0; ) {
- var s = e * this[t++] + n[i] + r;
- r = Math.floor(s / 67108864),
- n[i++] = 67108863 & s
- }
- return r
- }
- function am2(t, e, n, i, r, o) {
- for (var s = 32767 & e, a = e >> 15; --o >= 0; ) {
- var u = 32767 & this[t]
- , c = this[t++] >> 15
- , l = a * u + c * s;
- r = ((u = s * u + ((32767 & l) << 15) + n[i] + (1073741823 & r)) >>> 30) + (l >>> 15) + a * c + (r >>> 30),
- n[i++] = 1073741823 & u
- }
- return r
- }
- function am3(t, e, n, i, r, o) {
- for (var s = 16383 & e, a = e >> 14; --o >= 0; ) {
- var u = 16383 & this[t]
- , c = this[t++] >> 14
- , l = a * u + c * s;
- r = ((u = s * u + ((16383 & l) << 14) + n[i] + r) >> 28) + (l >> 14) + a * c,
- n[i++] = 268435455 & u
- }
- return r
- }
- function int2char(t) {
- return BI_RM.charAt(t)
- }
- function intAt(t, e) {
- var n = BI_RC[t.charCodeAt(e)];
- return null == n ? -1 : n
- }
- function bnpCopyTo(t) {
- for (var e = this.t - 1; e >= 0; --e)
- t[e] = this[e];
- t.t = this.t,
- t.s = this.s
- }
- function bnpFromInt(t) {
- this.t = 1,
- this.s = t < 0 ? -1 : 0,
- t > 0 ? this[0] = t : t < -1 ? this[0] = t + DV : this.t = 0
- }
- function nbv(t) {
- var e = nbi();
- return e.fromInt(t),
- e
- }
- function bnpFromString(t, e) {
- var n;
- if (16 == e)
- n = 4;
- else if (8 == e)
- n = 3;
- else if (256 == e)
- n = 8;
- else if (2 == e)
- n = 1;
- else if (32 == e)
- n = 5;
- else {
- if (4 != e)
- return void this.fromRadix(t, e);
- n = 2
- }
- this.t = 0,
- this.s = 0;
- for (var i = t.length, r = !1, o = 0; --i >= 0; ) {
- var s = 8 == n ? 255 & t[i] : intAt(t, i);
- s < 0 ? "-" == t.charAt(i) && (r = !0) : (r = !1,
- 0 == o ? this[this.t++] = s : o + n > this.DB ? (this[this.t - 1] |= (s & (1 << this.DB - o) - 1) << o,
- this[this.t++] = s >> this.DB - o) : this[this.t - 1] |= s << o,
- (o += n) >= this.DB && (o -= this.DB))
- }
- 8 == n && 0 != (128 & t[0]) && (this.s = -1,
- o > 0 && (this[this.t - 1] |= (1 << this.DB - o) - 1 << o)),
- this.clamp(),
- r && BigInteger.ZERO.subTo(this, this)
- }
- function bnpClamp() {
- for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; )
- --this.t
- }
- function bnToString(t) {
- if (this.s < 0)
- return "-" + this.negate().toString(t);
- var e;
- if (16 == t)
- e = 4;
- else if (8 == t)
- e = 3;
- else if (2 == t)
- e = 1;
- else if (32 == t)
- e = 5;
- else {
- if (4 != t)
- return this.toRadix(t);
- e = 2
- }
- var n, i = (1 << e) - 1, r = !1, o = "", s = this.t, a = this.DB - s * this.DB % e;
- if (s-- > 0)
- for (a < this.DB && (n = this[s] >> a) > 0 && (r = !0,
- o = int2char(n)); s >= 0; )
- a < e ? (n = (this[s] & (1 << a) - 1) << e - a,
- n |= this[--s] >> (a += this.DB - e)) : (n = this[s] >> (a -= e) & i,
- a <= 0 && (a += this.DB,
- --s)),
- n > 0 && (r = !0),
- r && (o += int2char(n));
- return r ? o : "0"
- }
- function bnNegate() {
- var t = nbi();
- return BigInteger.ZERO.subTo(this, t),
- t
- }
- function bnAbs() {
- return this.s < 0 ? this.negate() : this
- }
- function bnCompareTo(t) {
- var e = this.s - t.s;
- if (0 != e)
- return e;
- var n = this.t;
- if (0 != (e = n - t.t))
- return e;
- for (; --n >= 0; )
- if (0 != (e = this[n] - t[n]))
- return e;
- return 0
- }
- function nbits(t) {
- var e, n = 1;
- return 0 != (e = t >>> 16) && (t = e,
- n += 16),
- 0 != (e = t >> 8) && (t = e,
- n += 8),
- 0 != (e = t >> 4) && (t = e,
- n += 4),
- 0 != (e = t >> 2) && (t = e,
- n += 2),
- 0 != (e = t >> 1) && (t = e,
- n += 1),
- n
- }
- function bnBitLength() {
- return this.t <= 0 ? 0 : this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM)
- }
- function bnpDLShiftTo(t, e) {
- var n;
- for (n = this.t - 1; n >= 0; --n)
- e[n + t] = this[n];
- for (n = t - 1; n >= 0; --n)
- e[n] = 0;
- e.t = this.t + t,
- e.s = this.s
- }
- function bnpDRShiftTo(t, e) {
- for (var n = t; n < this.t; ++n)
- e[n - t] = this[n];
- e.t = Math.max(this.t - t, 0),
- e.s = this.s
- }
- function bnpLShiftTo(t, e) {
- var n, i = t % this.DB, r = this.DB - i, o = (1 << r) - 1, s = Math.floor(t / this.DB), a = this.s << i & this.DM;
- for (n = this.t - 1; n >= 0; --n)
- e[n + s + 1] = this[n] >> r | a,
- a = (this[n] & o) << i;
- for (n = s - 1; n >= 0; --n)
- e[n] = 0;
- e[s] = a,
- e.t = this.t + s + 1,
- e.s = this.s,
- e.clamp()
- }
- function bnpRShiftTo(t, e) {
- e.s = this.s;
- var n = Math.floor(t / this.DB);
- if (n >= this.t)
- e.t = 0;
- else {
- var i = t % this.DB
- , r = this.DB - i
- , o = (1 << i) - 1;
- e[0] = this[n] >> i;
- for (var s = n + 1; s < this.t; ++s)
- e[s - n - 1] |= (this[s] & o) << r,
- e[s - n] = this[s] >> i;
- i > 0 && (e[this.t - n - 1] |= (this.s & o) << r),
- e.t = this.t - n,
- e.clamp()
- }
- }
- function bnpSubTo(t, e) {
- for (var n = 0, i = 0, r = Math.min(t.t, this.t); n < r; )
- i += this[n] - t[n],
- e[n++] = i & this.DM,
- i >>= this.DB;
- if (t.t < this.t) {
- for (i -= t.s; n < this.t; )
- i += this[n],
- e[n++] = i & this.DM,
- i >>= this.DB;
- i += this.s
- } else {
- for (i += this.s; n < t.t; )
- i -= t[n],
- e[n++] = i & this.DM,
- i >>= this.DB;
- i -= t.s
- }
- e.s = i < 0 ? -1 : 0,
- i < -1 ? e[n++] = this.DV + i : i > 0 && (e[n++] = i),
- e.t = n,
- e.clamp()
- }
- function bnpMultiplyTo(t, e) {
- var n = this.abs()
- , i = t.abs()
- , r = n.t;
- for (e.t = r + i.t; --r >= 0; )
- e[r] = 0;
- for (r = 0; r < i.t; ++r)
- e[r + n.t] = n.am(0, i[r], e, r, 0, n.t);
- e.s = 0,
- e.clamp(),
- this.s != t.s && BigInteger.ZERO.subTo(e, e)
- }
- function bnpSquareTo(t) {
- for (var e = this.abs(), n = t.t = 2 * e.t; --n >= 0; )
- t[n] = 0;
- for (n = 0; n < e.t - 1; ++n) {
- var i = e.am(n, e[n], t, 2 * n, 0, 1);
- (t[n + e.t] += e.am(n + 1, 2 * e[n], t, 2 * n + 1, i, e.t - n - 1)) >= e.DV && (t[n + e.t] -= e.DV,
- t[n + e.t + 1] = 1)
- }
- t.t > 0 && (t[t.t - 1] += e.am(n, e[n], t, 2 * n, 0, 1)),
- t.s = 0,
- t.clamp()
- }
- function bnpDivRemTo(t, e, n) {
- var i = t.abs();
- if (!(i.t <= 0)) {
- var r = this.abs();
- if (r.t < i.t)
- return null != e && e.fromInt(0),
- void (null != n && this.copyTo(n));
- null == n && (n = nbi());
- var o = nbi()
- , s = this.s
- , a = t.s
- , u = this.DB - nbits(i[i.t - 1]);
- u > 0 ? (i.lShiftTo(u, o),
- r.lShiftTo(u, n)) : (i.copyTo(o),
- r.copyTo(n));
- var c = o.t
- , l = o[c - 1];
- if (0 != l) {
- var p = l * (1 << this.F1) + (c > 1 ? o[c - 2] >> this.F2 : 0)
- , h = this.FV / p
- , d = (1 << this.F1) / p
- , f = 1 << this.F2
- , g = n.t
- , v = g - c
- , m = null == e ? nbi() : e;
- for (o.dlShiftTo(v, m),
- n.compareTo(m) >= 0 && (n[n.t++] = 1,
- n.subTo(m, n)),
- BigInteger.ONE.dlShiftTo(c, m),
- m.subTo(o, o); o.t < c; )
- o[o.t++] = 0;
- for (; --v >= 0; ) {
- var b = n[--g] == l ? this.DM : Math.floor(n[g] * h + (n[g - 1] + f) * d);
- if ((n[g] += o.am(0, b, n, v, 0, c)) < b)
- for (o.dlShiftTo(v, m),
- n.subTo(m, n); n[g] < --b; )
- n.subTo(m, n)
- }
- null != e && (n.drShiftTo(c, e),
- s != a && BigInteger.ZERO.subTo(e, e)),
- n.t = c,
- n.clamp(),
- u > 0 && n.rShiftTo(u, n),
- s < 0 && BigInteger.ZERO.subTo(n, n)
- }
- }
- }
- function bnMod(t) {
- var e = nbi();
- return this.abs().divRemTo(t, null, e),
- this.s < 0 && e.compareTo(BigInteger.ZERO) > 0 && t.subTo(e, e),
- e
- }
- function Classic(t) {
- this.m = t
- }
- function cConvert(t) {
- return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t
- }
- function cRevert(t) {
- return t
- }
- function cReduce(t) {
- t.divRemTo(this.m, null, t)
- }
- function cMulTo(t, e, n) {
- t.multiplyTo(e, n),
- this.reduce(n)
- }
- function cSqrTo(t, e) {
- t.squareTo(e),
- this.reduce(e)
- }
- function bnpInvDigit() {
- if (this.t < 1)
- return 0;
- var t = this[0];
- if (0 == (1 & t))
- return 0;
- var e = 3 & t;
- return e = e * (2 - (15 & t) * e) & 15,
- e = e * (2 - (255 & t) * e) & 255,
- e = e * (2 - ((65535 & t) * e & 65535)) & 65535,
- (e = e * (2 - t * e % this.DV) % this.DV) > 0 ? this.DV - e : -e
- }
- function Montgomery(t) {
- this.m = t,
- this.mp = t.invDigit(),
- this.mpl = 32767 & this.mp,
- this.mph = this.mp >> 15,
- this.um = (1 << t.DB - 15) - 1,
- this.mt2 = 2 * t.t
- }
- function montConvert(t) {
- var e = nbi();
- return t.abs().dlShiftTo(this.m.t, e),
- e.divRemTo(this.m, null, e),
- t.s < 0 && e.compareTo(BigInteger.ZERO) > 0 && this.m.subTo(e, e),
- e
- }
- function montRevert(t) {
- var e = nbi();
- return t.copyTo(e),
- this.reduce(e),
- e
- }
- function montReduce(t) {
- for (; t.t <= this.mt2; )
- t[t.t++] = 0;
- for (var e = 0; e < this.m.t; ++e) {
- var n = 32767 & t[e]
- , i = n * this.mpl + ((n * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM;
- for (t[n = e + this.m.t] += this.m.am(0, i, t, e, 0, this.m.t); t[n] >= t.DV; )
- t[n] -= t.DV,
- t[++n]++
- }
- t.clamp(),
- t.drShiftTo(this.m.t, t),
- t.compareTo(this.m) >= 0 && t.subTo(this.m, t)
- }
- function montSqrTo(t, e) {
- t.squareTo(e),
- this.reduce(e)
- }
- function montMulTo(t, e, n) {
- t.multiplyTo(e, n),
- this.reduce(n)
- }
- function bnpIsEven() {
- return 0 == (this.t > 0 ? 1 & this[0] : this.s)
- }
- function bnpExp(t, e) {
- if (t > 4294967295 || t < 1)
- return BigInteger.ONE;
- var n = nbi()
- , i = nbi()
- , r = e.convert(this)
- , o = nbits(t) - 1;
- for (r.copyTo(n); --o >= 0; )
- if (e.sqrTo(n, i),
- (t & 1 << o) > 0)
- e.mulTo(i, r, n);
- else {
- var s = n;
- n = i,
- i = s
- }
- return e.revert(n)
- }
- function bnModPowInt(t, e) {
- var n;
- return n = t < 256 || e.isEven() ? new Classic(e) : new Montgomery(e),
- this.exp(t, n)
- }
- function bnClone() {
- var t = nbi();
- return this.copyTo(t),
- t
- }
- function bnIntValue() {
- if (this.s < 0) {
- if (1 == this.t)
- return this[0] - this.DV;
- if (0 == this.t)
- return -1
- } else {
- if (1 == this.t)
- return this[0];
- if (0 == this.t)
- return 0
- }
- return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0]
- }
- function bnByteValue() {
- return 0 == this.t ? this.s : this[0] << 24 >> 24
- }
- function bnShortValue() {
- return 0 == this.t ? this.s : this[0] << 16 >> 16
- }
- function bnpChunkSize(t) {
- return Math.floor(Math.LN2 * this.DB / Math.log(t))
- }
- function bnSigNum() {
- return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1
- }
- function bnpToRadix(t) {
- if (null == t && (t = 10),
- 0 == this.signum() || t < 2 || t > 36)
- return "0";
- var e = this.chunkSize(t)
- , n = Math.pow(t, e)
- , i = nbv(n)
- , r = nbi()
- , o = nbi()
- , s = "";
- for (this.divRemTo(i, r, o); r.signum() > 0; )
- s = (n + o.intValue()).toString(t).substr(1) + s,
- r.divRemTo(i, r, o);
- return o.intValue().toString(t) + s
- }
- function bnpFromRadix(t, e) {
- this.fromInt(0),
- null == e && (e = 10);
- for (var n = this.chunkSize(e), i = Math.pow(e, n), r = !1, o = 0, s = 0, a = 0; a < t.length; ++a) {
- var u = intAt(t, a);
- u < 0 ? "-" == t.charAt(a) && 0 == this.signum() && (r = !0) : (s = e * s + u,
- ++o >= n && (this.dMultiply(i),
- this.dAddOffset(s, 0),
- o = 0,
- s = 0))
- }
- o > 0 && (this.dMultiply(Math.pow(e, o)),
- this.dAddOffset(s, 0)),
- r && BigInteger.ZERO.subTo(this, this)
- }
- function bnpFromNumber(t, e, n) {
- if ("number" == typeof e)
- if (t < 2)
- this.fromInt(1);
- else
- for (this.fromNumber(t, n),
- this.testBit(t - 1) || this.bitwiseTo(BigInteger.ONE.shiftLeft(t - 1), op_or, this),
- this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e); )
- this.dAddOffset(2, 0),
- this.bitLength() > t && this.subTo(BigInteger.ONE.shiftLeft(t - 1), this);
- else {
- var i = new Array
- , r = 7 & t;
- i.length = 1 + (t >> 3),
- e.nextBytes(i),
- r > 0 ? i[0] &= (1 << r) - 1 : i[0] = 0,
- this.fromString(i, 256)
- }
- }
- function bnToByteArray() {
- var t = this.t
- , e = new Array;
- e[0] = this.s;
- var n, i = this.DB - t * this.DB % 8, r = 0;
- if (t-- > 0)
- for (i < this.DB && (n = this[t] >> i) != (this.s & this.DM) >> i && (e[r++] = n | this.s << this.DB - i); t >= 0; )
- i < 8 ? (n = (this[t] & (1 << i) - 1) << 8 - i,
- n |= this[--t] >> (i += this.DB - 8)) : (n = this[t] >> (i -= 8) & 255,
- i <= 0 && (i += this.DB,
- --t)),
- 0 != (128 & n) && (n |= -256),
- 0 == r && (128 & this.s) != (128 & n) && ++r,
- (r > 0 || n != this.s) && (e[r++] = n);
- return e
- }
- function bnEquals(t) {
- return 0 == this.compareTo(t)
- }
- function bnMin(t) {
- return this.compareTo(t) < 0 ? this : t
- }
- function bnMax(t) {
- return this.compareTo(t) > 0 ? this : t
- }
- function bnpBitwiseTo(t, e, n) {
- var i, r, o = Math.min(t.t, this.t);
- for (i = 0; i < o; ++i)
- n[i] = e(this[i], t[i]);
- if (t.t < this.t) {
- for (r = t.s & this.DM,
- i = o; i < this.t; ++i)
- n[i] = e(this[i], r);
- n.t = this.t
- } else {
- for (r = this.s & this.DM,
- i = o; i < t.t; ++i)
- n[i] = e(r, t[i]);
- n.t = t.t
- }
- n.s = e(this.s, t.s),
- n.clamp()
- }
- function op_and(t, e) {
- return t & e
- }
- function bnAnd(t) {
- var e = nbi();
- return this.bitwiseTo(t, op_and, e),
- e
- }
- function op_or(t, e) {
- return t | e
- }
- function bnOr(t) {
- var e = nbi();
- return this.bitwiseTo(t, op_or, e),
- e
- }
- function op_xor(t, e) {
- return t ^ e
- }
- function bnXor(t) {
- var e = nbi();
- return this.bitwiseTo(t, op_xor, e),
- e
- }
- function op_andnot(t, e) {
- return t & ~e
- }
- function bnAndNot(t) {
- var e = nbi();
- return this.bitwiseTo(t, op_andnot, e),
- e
- }
- function bnNot() {
- for (var t = nbi(), e = 0; e < this.t; ++e)
- t[e] = this.DM & ~this[e];
- return t.t = this.t,
- t.s = ~this.s,
- t
- }
- function bnShiftLeft(t) {
- var e = nbi();
- return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e),
- e
- }
- function bnShiftRight(t) {
- var e = nbi();
- return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e),
- e
- }
- function lbit(t) {
- if (0 == t)
- return -1;
- var e = 0;
- return 0 == (65535 & t) && (t >>= 16,
- e += 16),
- 0 == (255 & t) && (t >>= 8,
- e += 8),
- 0 == (15 & t) && (t >>= 4,
- e += 4),
- 0 == (3 & t) && (t >>= 2,
- e += 2),
- 0 == (1 & t) && ++e,
- e
- }
- function bnGetLowestSetBit() {
- for (var t = 0; t < this.t; ++t)
- if (0 != this[t])
- return t * this.DB + lbit(this[t]);
- return this.s < 0 ? this.t * this.DB : -1
- }
- function cbit(t) {
- for (var e = 0; 0 != t; )
- t &= t - 1,
- ++e;
- return e
- }
- function bnBitCount() {
- for (var t = 0, e = this.s & this.DM, n = 0; n < this.t; ++n)
- t += cbit(this[n] ^ e);
- return t
- }
- function bnTestBit(t) {
- var e = Math.floor(t / this.DB);
- return e >= this.t ? 0 != this.s : 0 != (this[e] & 1 << t % this.DB)
- }
- function bnpChangeBit(t, e) {
- var n = BigInteger.ONE.shiftLeft(t);
- return this.bitwiseTo(n, e, n),
- n
- }
- function bnSetBit(t) {
- return this.changeBit(t, op_or)
- }
- function bnClearBit(t) {
- return this.changeBit(t, op_andnot)
- }
- function bnFlipBit(t) {
- return this.changeBit(t, op_xor)
- }
- function bnpAddTo(t, e) {
- for (var n = 0, i = 0, r = Math.min(t.t, this.t); n < r; )
- i += this[n] + t[n],
- e[n++] = i & this.DM,
- i >>= this.DB;
- if (t.t < this.t) {
- for (i += t.s; n < this.t; )
- i += this[n],
- e[n++] = i & this.DM,
- i >>= this.DB;
- i += this.s
- } else {
- for (i += this.s; n < t.t; )
- i += t[n],
- e[n++] = i & this.DM,
- i >>= this.DB;
- i += t.s
- }
- e.s = i < 0 ? -1 : 0,
- i > 0 ? e[n++] = i : i < -1 && (e[n++] = this.DV + i),
- e.t = n,
- e.clamp()
- }
- function bnAdd(t) {
- var e = nbi();
- return this.addTo(t, e),
- e
- }
- function bnSubtract(t) {
- var e = nbi();
- return this.subTo(t, e),
- e
- }
- function bnMultiply(t) {
- var e = nbi();
- return this.multiplyTo(t, e),
- e
- }
- function bnDivide(t) {
- var e = nbi();
- return this.divRemTo(t, e, null),
- e
- }
- function bnRemainder(t) {
- var e = nbi();
- return this.divRemTo(t, null, e),
- e
- }
- function bnDivideAndRemainder(t) {
- var e = nbi()
- , n = nbi();
- return this.divRemTo(t, e, n),
- new Array(e,n)
- }
- function bnpDMultiply(t) {
- this[this.t] = this.am(0, t - 1, this, 0, 0, this.t),
- ++this.t,
- this.clamp()
- }
- function bnpDAddOffset(t, e) {
- for (; this.t <= e; )
- this[this.t++] = 0;
- for (this[e] += t; this[e] >= this.DV; )
- this[e] -= this.DV,
- ++e >= this.t && (this[this.t++] = 0),
- ++this[e]
- }
- function NullExp() {}
- function nNop(t) {
- return t
- }
- function nMulTo(t, e, n) {
- t.multiplyTo(e, n)
- }
- function nSqrTo(t, e) {
- t.squareTo(e)
- }
- function bnPow(t) {
- return this.exp(t, new NullExp)
- }
- function bnpMultiplyLowerTo(t, e, n) {
- var i = Math.min(this.t + t.t, e);
- for (n.s = 0,
- n.t = i; i > 0; )
- n[--i] = 0;
- var r;
- for (r = n.t - this.t; i < r; ++i)
- n[i + this.t] = this.am(0, t[i], n, i, 0, this.t);
- for (r = Math.min(t.t, e); i < r; ++i)
- this.am(0, t[i], n, i, 0, e - i);
- n.clamp()
- }
- function bnpMultiplyUpperTo(t, e, n) {
- --e;
- var i = n.t = this.t + t.t - e;
- for (n.s = 0; --i >= 0; )
- n[i] = 0;
- for (i = Math.max(e - this.t, 0); i < t.t; ++i)
- n[this.t + i - e] = this.am(e - i, t[i], n, 0, 0, this.t + i - e);
- n.clamp(),
- n.drShiftTo(1, n)
- }
- function Barrett(t) {
- this.r2 = nbi(),
- this.q3 = nbi(),
- BigInteger.ONE.dlShiftTo(2 * t.t, this.r2),
- this.mu = this.r2.divide(t),
- this.m = t
- }
- function barrettConvert(t) {
- if (t.s < 0 || t.t > 2 * this.m.t)
- return t.mod(this.m);
- if (t.compareTo(this.m) < 0)
- return t;
- var e = nbi();
- return t.copyTo(e),
- this.reduce(e),
- e
- }
- function barrettRevert(t) {
- return t
- }
- function barrettReduce(t) {
- for (t.drShiftTo(this.m.t - 1, this.r2),
- t.t > this.m.t + 1 && (t.t = this.m.t + 1,
- t.clamp()),
- this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3),
- this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0; )
- t.dAddOffset(1, this.m.t + 1);
- for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0; )
- t.subTo(this.m, t)
- }
- function barrettSqrTo(t, e) {
- t.squareTo(e),
- this.reduce(e)
- }
- function barrettMulTo(t, e, n) {
- t.multiplyTo(e, n),
- this.reduce(n)
- }
- function bnModPow(t, e) {
- var n, i, r = t.bitLength(), o = nbv(1);
- if (r <= 0)
- return o;
- n = r < 18 ? 1 : r < 48 ? 3 : r < 144 ? 4 : r < 768 ? 5 : 6,
- i = r < 8 ? new Classic(e) : e.isEven() ? new Barrett(e) : new Montgomery(e);
- var s = new Array
- , a = 3
- , u = n - 1
- , c = (1 << n) - 1;
- if (s[1] = i.convert(this),
- n > 1) {
- var l = nbi();
- for (i.sqrTo(s[1], l); a <= c; )
- s[a] = nbi(),
- i.mulTo(l, s[a - 2], s[a]),
- a += 2
- }
- var p, h, d = t.t - 1, f = !0, g = nbi();
- for (r = nbits(t[d]) - 1; d >= 0; ) {
- for (r >= u ? p = t[d] >> r - u & c : (p = (t[d] & (1 << r + 1) - 1) << u - r,
- d > 0 && (p |= t[d - 1] >> this.DB + r - u)),
- a = n; 0 == (1 & p); )
- p >>= 1,
- --a;
- if ((r -= a) < 0 && (r += this.DB,
- --d),
- f)
- s[p].copyTo(o),
- f = !1;
- else {
- for (; a > 1; )
- i.sqrTo(o, g),
- i.sqrTo(g, o),
- a -= 2;
- a > 0 ? i.sqrTo(o, g) : (h = o,
- o = g,
- g = h),
- i.mulTo(g, s[p], o)
- }
- for (; d >= 0 && 0 == (t[d] & 1 << r); )
- i.sqrTo(o, g),
- h = o,
- o = g,
- g = h,
- --r < 0 && (r = this.DB - 1,
- --d)
- }
- return i.revert(o)
- }
- function bnGCD(t) {
- var e = this.s < 0 ? this.negate() : this.clone()
- , n = t.s < 0 ? t.negate() : t.clone();
- if (e.compareTo(n) < 0) {
- var i = e;
- e = n,
- n = i
- }
- var r = e.getLowestSetBit()
- , o = n.getLowestSetBit();
- if (o < 0)
- return e;
- for (r < o && (o = r),
- o > 0 && (e.rShiftTo(o, e),
- n.rShiftTo(o, n)); e.signum() > 0; )
- (r = e.getLowestSetBit()) > 0 && e.rShiftTo(r, e),
- (r = n.getLowestSetBit()) > 0 && n.rShiftTo(r, n),
- e.compareTo(n) >= 0 ? (e.subTo(n, e),
- e.rShiftTo(1, e)) : (n.subTo(e, n),
- n.rShiftTo(1, n));
- return o > 0 && n.lShiftTo(o, n),
- n
- }
- function bnpModInt(t) {
- if (t <= 0)
- return 0;
- var e = this.DV % t
- , n = this.s < 0 ? t - 1 : 0;
- if (this.t > 0)
- if (0 == e)
- n = this[0] % t;
- else
- for (var i = this.t - 1; i >= 0; --i)
- n = (e * n + this[i]) % t;
- return n
- }
- function bnModInverse(t) {
- var e = t.isEven();
- if (this.isEven() && e || 0 == t.signum())
- return BigInteger.ZERO;
- for (var n = t.clone(), i = this.clone(), r = nbv(1), o = nbv(0), s = nbv(0), a = nbv(1); 0 != n.signum(); ) {
- for (; n.isEven(); )
- n.rShiftTo(1, n),
- e ? (r.isEven() && o.isEven() || (r.addTo(this, r),
- o.subTo(t, o)),
- r.rShiftTo(1, r)) : o.isEven() || o.subTo(t, o),
- o.rShiftTo(1, o);
- for (; i.isEven(); )
- i.rShiftTo(1, i),
- e ? (s.isEven() && a.isEven() || (s.addTo(this, s),
- a.subTo(t, a)),
- s.rShiftTo(1, s)) : a.isEven() || a.subTo(t, a),
- a.rShiftTo(1, a);
- n.compareTo(i) >= 0 ? (n.subTo(i, n),
- e && r.subTo(s, r),
- o.subTo(a, o)) : (i.subTo(n, i),
- e && s.subTo(r, s),
- a.subTo(o, a))
- }
- return 0 != i.compareTo(BigInteger.ONE) ? BigInteger.ZERO : a.compareTo(t) >= 0 ? a.subtract(t) : a.signum() < 0 ? (a.addTo(t, a),
- a.signum() < 0 ? a.add(t) : a) : a
- }
- function bnIsProbablePrime(t) {
- var e, n = this.abs();
- if (1 == n.t && n[0] <= lowprimes[lowprimes.length - 1]) {
- for (e = 0; e < lowprimes.length; ++e)
- if (n[0] == lowprimes[e])
- return !0;
- return !1
- }
- if (n.isEven())
- return !1;
- for (e = 1; e < lowprimes.length; ) {
- for (var i = lowprimes[e], r = e + 1; r < lowprimes.length && i < lplim; )
- i *= lowprimes[r++];
- for (i = n.modInt(i); e < r; )
- if (i % lowprimes[e++] == 0)
- return !1
- }
- return n.millerRabin(t)
- }
- function bnpMillerRabin(t) {
- var e = this.subtract(BigInteger.ONE)
- , n = e.getLowestSetBit();
- if (n <= 0)
- return !1;
- var i = e.shiftRight(n);
- (t = t + 1 >> 1) > lowprimes.length && (t = lowprimes.length);
- for (var r = nbi(), o = 0; o < t; ++o) {
- r.fromInt(lowprimes[o]);
- var s = r.modPow(i, this);
- if (0 != s.compareTo(BigInteger.ONE) && 0 != s.compareTo(e)) {
- for (var a = 1; a++ < n && 0 != s.compareTo(e); )
- if (0 == (s = s.modPowInt(2, this)).compareTo(BigInteger.ONE))
- return !1;
- if (0 != s.compareTo(e))
- return !1
- }
- }
- return !0
- }
- function Stream(t, e) {
- t instanceof Stream ? (this.enc = t.enc,
- this.pos = t.pos) : (this.enc = t,
- this.pos = e)
- }
- function Arcfour() {
- this.i = 0,
- this.j = 0,
- this.S = new Array
- }
- function ARC4init(t) {
- var e, n, i;
- for (e = 0; e < 256; ++e)
- this.S[e] = e;
- for (n = 0,
- e = 0; e < 256; ++e)
- n = n + this.S[e] + t[e % t.length] & 255,
- i = this.S[e],
- this.S[e] = this.S[n],
- this.S[n] = i;
- this.i = 0,
- this.j = 0
- }
- function ARC4next() {
- var t;
- return this.i = this.i + 1 & 255,
- this.j = this.j + this.S[this.i] & 255,
- t = this.S[this.i],
- this.S[this.i] = this.S[this.j],
- this.S[this.j] = t,
- this.S[t + this.S[this.i] & 255]
- }
- function prng_newstate() {
- return new Arcfour
- }
- function SecureRandom() {
- if (this.rng_state,
- this.rng_pool,
- this.rng_pptr,
- this.rng_seed_int = function(t) {
- this.rng_pool[this.rng_pptr++] ^= 255 & t,
- this.rng_pool[this.rng_pptr++] ^= t >> 8 & 255,
- this.rng_pool[this.rng_pptr++] ^= t >> 16 & 255,
- this.rng_pool[this.rng_pptr++] ^= t >> 24 & 255,
- this.rng_pptr >= rng_psize && (this.rng_pptr -= rng_psize)
- }
- ,
- this.rng_seed_time = function() {
- this.rng_seed_int((new Date).getTime())
- }
- ,
- null == this.rng_pool) {
- this.rng_pool = new Array,
- this.rng_pptr = 0;
- var t;
- if ("Netscape" == navigator.appName && navigator.appVersion < "5" && window.crypto) {
- var e = window.crypto.random(32);
- for (t = 0; t < e.length; ++t)
- this.rng_pool[this.rng_pptr++] = 255 & e.charCodeAt(t)
- }
- for (; this.rng_pptr < rng_psize; )
- t = Math.floor(65536 * Math.random()),
- this.rng_pool[this.rng_pptr++] = t >>> 8,
- this.rng_pool[this.rng_pptr++] = 255 & t;
- this.rng_pptr = 0,
- this.rng_seed_time()
- }
- this.rng_get_byte = function() {
- if (null == this.rng_state) {
- for (this.rng_seed_time(),
- this.rng_state = prng_newstate(),
- this.rng_state.init(this.rng_pool),
- this.rng_pptr = 0; this.rng_pptr < this.rng_pool.length; ++this.rng_pptr)
- this.rng_pool[this.rng_pptr] = 0;
- this.rng_pptr = 0
- }
- return this.rng_state.next()
- }
- ,
- this.nextBytes = function(t) {
- var e;
- for (e = 0; e < t.length; ++e)
- t[e] = this.rng_get_byte()
- }
- }
- function parseBigInt(t, e) {
- return new BigInteger(t,e)
- }
- function linebrk(t, e) {
- for (var n = "", i = 0; i + e < t.length; )
- n += t.substring(i, i + e) + "\n",
- i += e;
- return n + t.substring(i, t.length)
- }
- function byte2Hex(t) {
- return t < 16 ? "0" + t.toString(16) : t.toString(16)
- }
- function pkcs1unpad2(t, e) {
- for (var n = t.toByteArray(), i = 0; i < n.length && 0 == n[i]; )
- ++i;
- if (n.length - i != e - 1 || 2 != n[i])
- return null;
- for (++i; 0 != n[i]; )
- if (++i >= n.length)
- return null;
- for (var r = ""; ++i < n.length; )
- r += String.fromCharCode(n[i]);
- return r
- }
- function pkcs1pad2(t, e) {
- if (e < t.length + 11)
- return alert("Message too long for RSA"),
- null;
- for (var n = new Array, i = t.length - 1; i >= 0 && e > 0; )
- n[--e] = t.charCodeAt(i--);
- n[--e] = 0;
- for (var r = new SecureRandom, o = new Array; e > 2; ) {
- for (o[0] = 0; 0 == o[0]; )
- r.nextBytes(o);
- n[--e] = o[0]
- }
- return n[--e] = 2,
- n[--e] = 0,
- new BigInteger(n)
- }
- pidCryptUtil = {},
- pidCryptUtil.encodeBase64 = function(t, e) {
- t || (t = "");
- var n, i, r, o, s, a, u, c, l = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", p = [], h = "";
- if (u = (e = void 0 !== e && e) ? pidCryptUtil.encodeUTF8(t) : t,
- (a = u.length % 3) > 0)
- for (; a++ < 3; )
- h += "=",
- u += "\0";
- for (a = 0; a < u.length; a += 3)
- i = (n = u.charCodeAt(a) << 16 | u.charCodeAt(a + 1) << 8 | u.charCodeAt(a + 2)) >> 18 & 63,
- r = n >> 12 & 63,
- o = n >> 6 & 63,
- s = 63 & n,
- p[a / 3] = l.charAt(i) + l.charAt(r) + l.charAt(o) + l.charAt(s);
- return c = p.join(""),
- c = c.slice(0, c.length - h.length) + h
- }
- ,
- pidCryptUtil.decodeBase64 = function(t, e) {
- t || (t = "");
- var n, i, r, o, s, a, u, c, l = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", p = [];
- c = (e = void 0 !== e && e) ? pidCryptUtil.decodeUTF8(t) : t;
- for (var h = 0; h < c.length; h += 4)
- n = (a = l.indexOf(c.charAt(h)) << 18 | l.indexOf(c.charAt(h + 1)) << 12 | (o = l.indexOf(c.charAt(h + 2))) << 6 | (s = l.indexOf(c.charAt(h + 3)))) >>> 16 & 255,
- i = a >>> 8 & 255,
- r = 255 & a,
- p[h / 4] = String.fromCharCode(n, i, r),
- 64 == s && (p[h / 4] = String.fromCharCode(n, i)),
- 64 == o && (p[h / 4] = String.fromCharCode(n));
- return u = p.join(""),
- u = e ? pidCryptUtil.decodeUTF8(u) : u
- }
- ,
- pidCryptUtil.encodeUTF8 = function(t) {
- return t || (t = ""),
- t = t.replace(/[\u0080-\u07ff]/g, function(t) {
- var e = t.charCodeAt(0);
- return String.fromCharCode(192 | e >> 6, 128 | 63 & e)
- }),
- t = t.replace(/[\u0800-\uffff]/g, function(t) {
- var e = t.charCodeAt(0);
- return String.fromCharCode(224 | e >> 12, 128 | e >> 6 & 63, 128 | 63 & e)
- })
- }
- ,
- pidCryptUtil.decodeUTF8 = function(t) {
- return t || (t = ""),
- t = t.replace(/[\u00c0-\u00df][\u0080-\u00bf]/g, function(t) {
- var e = (31 & t.charCodeAt(0)) << 6 | 63 & t.charCodeAt(1);
- return String.fromCharCode(e)
- }),
- t = t.replace(/[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, function(t) {
- var e = (15 & t.charCodeAt(0)) << 12 | (63 & t.charCodeAt(1)) << 6 | 63 & t.charCodeAt(2);
- return String.fromCharCode(e)
- })
- }
- ,
- pidCryptUtil.convertToHex = function(t) {
- t || (t = "");
- for (var e = "", n = "", i = 0; i < t.length; i++)
- e += 1 == (n = t.charCodeAt(i).toString(16)).length ? "0" + n : n;
- return e
- }
- ,
- pidCryptUtil.convertFromHex = function(t) {
- t || (t = "");
- for (var e = "", n = 0; n < t.length; n += 2)
- e += String.fromCharCode(parseInt(t.substring(n, n + 2), 16));
- return e
- }
- ,
- pidCryptUtil.stripLineFeeds = function(t) {
- t || (t = "");
- var e = "";
- return e = t.replace(/\n/g, ""),
- e = e.replace(/\r/g, "")
- }
- ,
- pidCryptUtil.toByteArray = function(t) {
- t || (t = "");
- for (var e = [], n = 0; n < t.length; n++)
- e[n] = t.charCodeAt(n);
- return e
- }
- ,
- pidCryptUtil.fragment = function(t, e, n) {
- if (t || (t = ""),
- !e || e >= t.length)
- return t;
- n || (n = "\n");
- for (var i = "", r = 0; r < t.length; r += e)
- i += t.substr(r, e) + n;
- return i
- }
- ,
- pidCryptUtil.formatHex = function(t, e) {
- t || (t = ""),
- e || (e = 45);
- for (var n = "", i = t.toLowerCase(), r = 0; r < i.length; r += 2)
- n += i.substr(r, 2) + ":";
- return i = this.fragment(n, e)
- }
- ,
- pidCryptUtil.byteArray2String = function(t) {
- for (var e = "", n = 0; n < t.length; n++)
- e += String.fromCharCode(t[n]);
- return e
- }
- ;
- var dbits, canary = 0xdeadbeefcafe, j_lm = 15715070 == (16777215 & canary);
- j_lm && "Microsoft Internet Explorer" == navigator.appName ? (BigInteger.prototype.am = am2,
- dbits = 30) : j_lm && "Netscape" != navigator.appName ? (BigInteger.prototype.am = am1,
- dbits = 26) : (BigInteger.prototype.am = am3,
- dbits = 28),
- BigInteger.prototype.DB = dbits,
- BigInteger.prototype.DM = (1 << dbits) - 1,
- BigInteger.prototype.DV = 1 << dbits;
- var BI_FP = 52;
- BigInteger.prototype.FV = Math.pow(2, BI_FP),
- BigInteger.prototype.F1 = BI_FP - dbits,
- BigInteger.prototype.F2 = 2 * dbits - BI_FP;
- var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz", BI_RC = new Array, rr, vv;
- for (rr = "0".charCodeAt(0),
- vv = 0; vv <= 9; ++vv)
- BI_RC[rr++] = vv;
- for (rr = "a".charCodeAt(0),
- vv = 10; vv < 36; ++vv)
- BI_RC[rr++] = vv;
- for (rr = "A".charCodeAt(0),
- vv = 10; vv < 36; ++vv)
- BI_RC[rr++] = vv;
- Classic.prototype.convert = cConvert,
- Classic.prototype.revert = cRevert,
- Classic.prototype.reduce = cReduce,
- Classic.prototype.mulTo = cMulTo,
- Classic.prototype.sqrTo = cSqrTo,
- Montgomery.prototype.convert = montConvert,
- Montgomery.prototype.revert = montRevert,
- Montgomery.prototype.reduce = montReduce,
- Montgomery.prototype.mulTo = montMulTo,
- Montgomery.prototype.sqrTo = montSqrTo,
- BigInteger.prototype.copyTo = bnpCopyTo,
- BigInteger.prototype.fromInt = bnpFromInt,
- BigInteger.prototype.fromString = bnpFromString,
- BigInteger.prototype.clamp = bnpClamp,
- BigInteger.prototype.dlShiftTo = bnpDLShiftTo,
- BigInteger.prototype.drShiftTo = bnpDRShiftTo,
- BigInteger.prototype.lShiftTo = bnpLShiftTo,
- BigInteger.prototype.rShiftTo = bnpRShiftTo,
- BigInteger.prototype.subTo = bnpSubTo,
- BigInteger.prototype.multiplyTo = bnpMultiplyTo,
- BigInteger.prototype.squareTo = bnpSquareTo,
- BigInteger.prototype.divRemTo = bnpDivRemTo,
- BigInteger.prototype.invDigit = bnpInvDigit,
- BigInteger.prototype.isEven = bnpIsEven,
- BigInteger.prototype.exp = bnpExp,
- BigInteger.prototype.toString = bnToString,
- BigInteger.prototype.negate = bnNegate,
- BigInteger.prototype.abs = bnAbs,
- BigInteger.prototype.compareTo = bnCompareTo,
- BigInteger.prototype.bitLength = bnBitLength,
- BigInteger.prototype.mod = bnMod,
- BigInteger.prototype.modPowInt = bnModPowInt,
- BigInteger.ZERO = nbv(0),
- BigInteger.ONE = nbv(1),
- NullExp.prototype.convert = nNop,
- NullExp.prototype.revert = nNop,
- NullExp.prototype.mulTo = nMulTo,
- NullExp.prototype.sqrTo = nSqrTo,
- Barrett.prototype.convert = barrettConvert,
- Barrett.prototype.revert = barrettRevert,
- Barrett.prototype.reduce = barrettReduce,
- Barrett.prototype.mulTo = barrettMulTo,
- Barrett.prototype.sqrTo = barrettSqrTo;
- var lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509]
- , lplim = (1 << 26) / lowprimes[lowprimes.length - 1];
- BigInteger.prototype.chunkSize = bnpChunkSize,
- BigInteger.prototype.toRadix = bnpToRadix,
- BigInteger.prototype.fromRadix = bnpFromRadix,
- BigInteger.prototype.fromNumber = bnpFromNumber,
- BigInteger.prototype.bitwiseTo = bnpBitwiseTo,
- BigInteger.prototype.changeBit = bnpChangeBit,
- BigInteger.prototype.addTo = bnpAddTo,
- BigInteger.prototype.dMultiply = bnpDMultiply,
- BigInteger.prototype.dAddOffset = bnpDAddOffset,
- BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo,
- BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo,
- BigInteger.prototype.modInt = bnpModInt,
- BigInteger.prototype.millerRabin = bnpMillerRabin,
- BigInteger.prototype.clone = bnClone,
- BigInteger.prototype.intValue = bnIntValue,
- BigInteger.prototype.byteValue = bnByteValue,
- BigInteger.prototype.shortValue = bnShortValue,
- BigInteger.prototype.signum = bnSigNum,
- BigInteger.prototype.toByteArray = bnToByteArray,
- BigInteger.prototype.equals = bnEquals,
- BigInteger.prototype.min = bnMin,
- BigInteger.prototype.max = bnMax,
- BigInteger.prototype.and = bnAnd,
- BigInteger.prototype.or = bnOr,
- BigInteger.prototype.xor = bnXor,
- BigInteger.prototype.andNot = bnAndNot,
- BigInteger.prototype.not = bnNot,
- BigInteger.prototype.shiftLeft = bnShiftLeft,
- BigInteger.prototype.shiftRight = bnShiftRight,
- BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit,
- BigInteger.prototype.bitCount = bnBitCount,
- BigInteger.prototype.testBit = bnTestBit,
- BigInteger.prototype.setBit = bnSetBit,
- BigInteger.prototype.clearBit = bnClearBit,
- BigInteger.prototype.flipBit = bnFlipBit,
- BigInteger.prototype.add = bnAdd,
- BigInteger.prototype.subtract = bnSubtract,
- BigInteger.prototype.multiply = bnMultiply,
- BigInteger.prototype.divide = bnDivide,
- BigInteger.prototype.remainder = bnRemainder,
- BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder,
- BigInteger.prototype.modPow = bnModPow,
- BigInteger.prototype.modInverse = bnModInverse,
- BigInteger.prototype.pow = bnPow,
- BigInteger.prototype.gcd = bnGCD,
- BigInteger.prototype.isProbablePrime = bnIsProbablePrime,
- Stream.prototype.parseStringHex = function(t, e) {
- void 0 === e && (e = this.enc.length);
- for (var n = "", i = t; i < e; ++i) {
- var r = this.get(i);
- n += this.hexDigits.charAt(r >> 4) + this.hexDigits.charAt(15 & r)
- }
- return n
- }
- ,
- Stream.prototype.get = function(t) {
- if (void 0 == t && (t = this.pos++),
- t >= this.enc.length)
- throw "Requesting byte offset " + t + " on a stream of length " + this.enc.length;
- return this.enc[t]
- }
- ,
- Stream.prototype.hexDigits = "0123456789ABCDEF",
- Stream.prototype.hexDump = function(t, e) {
- for (var n = "", i = t; i < e; ++i) {
- var r = this.get(i);
- n += this.hexDigits.charAt(r >> 4) + this.hexDigits.charAt(15 & r),
- 7 == (15 & i) && (n += " "),
- n += 15 == (15 & i) ? "\n" : " "
- }
- return n
- }
- ,
- Stream.prototype.parseStringISO = function(t, e) {
- for (var n = "", i = t; i < e; ++i)
- n += String.fromCharCode(this.get(i));
- return n
- }
- ,
- Stream.prototype.parseStringUTF = function(t, e) {
- for (var n = "", i = 0, r = t; r < e; )
- n += (i = this.get(r++)) < 128 ? String.fromCharCode(i) : i > 191 && i < 224 ? String.fromCharCode((31 & i) << 6 | 63 & this.get(r++)) : String.fromCharCode((15 & i) << 12 | (63 & this.get(r++)) << 6 | 63 & this.get(r++));
- return n
- }
- ,
- Stream.prototype.reTime = /^((?:1[89]|2\d)?\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,
- Stream.prototype.parseTime = function(t, e) {
- var n = this.parseStringISO(t, e)
- , i = this.reTime.exec(n);
- return i ? (n = i[1] + "-" + i[2] + "-" + i[3] + " " + i[4],
- i[5] && (n += ":" + i[5],
- i[6] && (n += ":" + i[6],
- i[7] && (n += "." + i[7]))),
- i[8] && (n += " UTC",
- "Z" != i[8] && (n += i[8],
- i[9] && (n += ":" + i[9]))),
- n) : "Unrecognized time: " + n
- }
- ,
- Stream.prototype.parseInteger = function(t, e) {
- if (!(e - t > 4)) {
- for (var n = 0, i = t; i < e; ++i)
- n = n << 8 | this.get(i);
- return n
- }
- }
- ,
- Stream.prototype.parseOID = function(t, e) {
- for (var n, i = 0, r = 0, o = t; o < e; ++o) {
- var s = this.get(o);
- i = i << 7 | 127 & s,
- r += 7,
- 128 & s || (void 0 == n ? n = parseInt(i / 40) + "." + i % 40 : n += "." + (r >= 31 ? "big" : i),
- i = r = 0),
- n += String.fromCharCode()
- }
- return n
- }
- ,
- void 0 !== pidCrypt && (pidCrypt.ASN1 = function(t, e, n, i, r) {
- this.stream = t,
- this.header = e,
- this.length = n,
- this.tag = i,
- this.sub = r
- }
- ,
- pidCrypt.ASN1.prototype.toHexTree = function() {
- var t = {};
- if (t.type = this.typeName(),
- "SEQUENCE" != t.type && (t.value = this.stream.parseStringHex(this.posContent(), this.posEnd())),
- null != this.sub) {
- t.sub = [];
- for (var e = 0, n = this.sub.length; e < n; ++e)
- t.sub[e] = this.sub[e].toHexTree()
- }
- return t
- }
- ,
- pidCrypt.ASN1.prototype.typeName = function() {
- if (void 0 == this.tag)
- return "unknown";
- var t = this.tag >> 6
- , e = (this.tag,
- 31 & this.tag);
- switch (t) {
- case 0:
- switch (e) {
- case 0:
- return "EOC";
- case 1:
- return "BOOLEAN";
- case 2:
- return "INTEGER";
- case 3:
- return "BIT_STRING";
- case 4:
- return "OCTET_STRING";
- case 5:
- return "NULL";
- case 6:
- return "OBJECT_IDENTIFIER";
- case 7:
- return "ObjectDescriptor";
- case 8:
- return "EXTERNAL";
- case 9:
- return "REAL";
- case 10:
- return "ENUMERATED";
- case 11:
- return "EMBEDDED_PDV";
- case 12:
- return "UTF8String";
- case 16:
- return "SEQUENCE";
- case 17:
- return "SET";
- case 18:
- return "NumericString";
- case 19:
- return "PrintableString";
- case 20:
- return "TeletexString";
- case 21:
- return "VideotexString";
- case 22:
- return "IA5String";
- case 23:
- return "UTCTime";
- case 24:
- return "GeneralizedTime";
- case 25:
- return "GraphicString";
- case 26:
- return "VisibleString";
- case 27:
- return "GeneralString";
- case 28:
- return "UniversalString";
- case 30:
- return "BMPString";
- default:
- return "Universal_" + e.toString(16)
- }
- case 1:
- return "Application_" + e.toString(16);
- case 2:
- return "[" + e + "]";
- case 3:
- return "Private_" + e.toString(16)
- }
- }
- ,
- pidCrypt.ASN1.prototype.content = function() {
- if (void 0 == this.tag)
- return null;
- if (0 != this.tag >> 6)
- return null;
- var t = 31 & this.tag
- , e = this.posContent()
- , n = Math.abs(this.length);
- switch (t) {
- case 1:
- return 0 == this.stream.get(e) ? "false" : "true";
- case 2:
- return this.stream.parseInteger(e, e + n);
- case 6:
- return this.stream.parseOID(e, e + n);
- case 12:
- return this.stream.parseStringUTF(e, e + n);
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 26:
- return this.stream.parseStringISO(e, e + n);
- case 23:
- case 24:
- return this.stream.parseTime(e, e + n)
- }
- return null
- }
- ,
- pidCrypt.ASN1.prototype.toString = function() {
- return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null == this.sub ? "null" : this.sub.length) + "]"
- }
- ,
- pidCrypt.ASN1.prototype.print = function(t) {
- if (void 0 == t && (t = ""),
- document.writeln(t + this),
- null != this.sub) {
- t += " ";
- for (var e = 0, n = this.sub.length; e < n; ++e)
- this.sub[e].print(t)
- }
- }
- ,
- pidCrypt.ASN1.prototype.toPrettyString = function(t) {
- void 0 == t && (t = "");
- var e = t + this.typeName() + " @" + this.stream.pos;
- if (this.length >= 0 && (e += "+"),
- e += this.length,
- 32 & this.tag ? e += " (constructed)" : 3 != this.tag && 4 != this.tag || null == this.sub || (e += " (encapsulates)"),
- e += "\n",
- null != this.sub) {
- t += " ";
- for (var n = 0, i = this.sub.length; n < i; ++n)
- e += this.sub[n].toPrettyString(t)
- }
- return e
- }
- ,
- pidCrypt.ASN1.prototype.toDOM = function() {
- var t = document.createElement("div");
- t.className = "node",
- t.asn1 = this;
- var e = document.createElement("div");
- e.className = "head";
- var n = this.typeName();
- e.innerHTML = n,
- t.appendChild(e),
- this.head = e;
- var i = document.createElement("div");
- i.className = "value",
- n = "Offset: " + this.stream.pos + "<br/>",
- n += "Length: " + this.header + "+",
- this.length >= 0 ? n += this.length : n += -this.length + " (undefined)",
- 32 & this.tag ? n += "<br/>(constructed)" : 3 != this.tag && 4 != this.tag || null == this.sub || (n += "<br/>(encapsulates)");
- var r = this.content();
- if (null != r && (n += "<br/>Value:<br/><b>" + r + "</b>",
- "object" == typeof oids && 6 == this.tag)) {
- var o = oids[r];
- o && (o.d && (n += "<br/>" + o.d),
- o.c && (n += "<br/>" + o.c),
- o.w && (n += "<br/>(warning!)"))
- }
- i.innerHTML = n,
- t.appendChild(i);
- var s = document.createElement("div");
- if (s.className = "sub",
- null != this.sub)
- for (var a = 0, u = this.sub.length; a < u; ++a)
- s.appendChild(this.sub[a].toDOM());
- return t.appendChild(s),
- e.switchNode = t,
- e.onclick = function() {
- var t = this.switchNode;
- t.className = "node collapsed" == t.className ? "node" : "node collapsed"
- }
- ,
- t
- }
- ,
- pidCrypt.ASN1.prototype.posStart = function() {
- return this.stream.pos
- }
- ,
- pidCrypt.ASN1.prototype.posContent = function() {
- return this.stream.pos + this.header
- }
- ,
- pidCrypt.ASN1.prototype.posEnd = function() {
- return this.stream.pos + this.header + Math.abs(this.length)
- }
- ,
- pidCrypt.ASN1.prototype.toHexDOM_sub = function(t, e, n, i, r) {
- if (!(i >= r)) {
- var o = document.createElement("span");
- o.className = e,
- o.appendChild(document.createTextNode(n.hexDump(i, r))),
- t.appendChild(o)
- }
- }
- ,
- pidCrypt.ASN1.prototype.toHexDOM = function() {
- var t = document.createElement("span");
- if (t.className = "hex",
- this.head.hexNode = t,
- this.head.onmouseover = function() {
- this.hexNode.className = "hexCurrent"
- }
- ,
- this.head.onmouseout = function() {
- this.hexNode.className = "hex"
- }
- ,
- this.toHexDOM_sub(t, "tag", this.stream, this.posStart(), this.posStart() + 1),
- this.toHexDOM_sub(t, this.length >= 0 ? "dlen" : "ulen", this.stream, this.posStart() + 1, this.posContent()),
- null == this.sub)
- t.appendChild(document.createTextNode(this.stream.hexDump(this.posContent(), this.posEnd())));
- else if (this.sub.length > 0) {
- var e = this.sub[0]
- , n = this.sub[this.sub.length - 1];
- this.toHexDOM_sub(t, "intro", this.stream, this.posContent(), e.posStart());
- for (var i = 0, r = this.sub.length; i < r; ++i)
- t.appendChild(this.sub[i].toHexDOM());
- this.toHexDOM_sub(t, "outro", this.stream, n.posEnd(), this.posEnd())
- }
- return t
- }
- ,
- pidCrypt.ASN1.decodeLength = function(t) {
- var e = t.get()
- , n = 127 & e;
- if (n == e)
- return n;
- if (n > 3)
- throw "Length over 24 bits not supported at position " + (t.pos - 1);
- if (0 == n)
- return -1;
- e = 0;
- for (var i = 0; i < n; ++i)
- e = e << 8 | t.get();
- return e
- }
- ,
- pidCrypt.ASN1.hasContent = function(t, e, n) {
- if (32 & t)
- return !0;
- if (t < 3 || t > 4)
- return !1;
- var i = new Stream(n);
- if (3 == t && i.get(),
- i.get() >> 6 & 1)
- return !1;
- try {
- var r = pidCrypt.ASN1.decodeLength(i);
- return i.pos - n.pos + r == e
- } catch (t) {
- return !1
- }
- }
- ,
- pidCrypt.ASN1.decode = function(t) {
- t instanceof Stream || (t = new Stream(t,0));
- var e = new Stream(t)
- , n = t.get()
- , i = pidCrypt.ASN1.decodeLength(t)
- , r = t.pos - e.pos
- , o = null;
- if (pidCrypt.ASN1.hasContent(n, i, t)) {
- var s = t.pos;
- if (3 == n && t.get(),
- o = [],
- i >= 0) {
- for (var a = s + i; t.pos < a; )
- o[o.length] = pidCrypt.ASN1.decode(t);
- if (t.pos != a)
- throw "Content size is not correct for container starting at offset " + s
- } else
- try {
- for (; ; ) {
- var u = pidCrypt.ASN1.decode(t);
- if (0 == u.tag)
- break;
- o[o.length] = u
- }
- i = s - t.pos
- } catch (t) {
- throw "Exception while decoding undefined length content: " + t
- }
- } else
- t.pos += i;
- return new pidCrypt.ASN1(e,r,i,n,o)
- }
- ,
- pidCrypt.ASN1.test = function() {
- for (var t = [{
- value: [39],
- expected: 39
- }, {
- value: [129, 201],
- expected: 201
- }, {
- value: [131, 254, 220, 186],
- expected: 16702650
- }], e = 0, n = t.length; e < n; ++e) {
- var i = new Stream(t[e].value,0)
- , r = pidCrypt.ASN1.decodeLength(i);
- r != t[e].expected && document.write("In test[" + e + "] expected " + t[e].expected + " got " + r + "\n")
- }
- }
- ),
- Arcfour.prototype.init = ARC4init,
- Arcfour.prototype.next = ARC4next;
- var rng_psize = 256;
- void 0 !== pidCrypt && void 0 !== BigInteger && void 0 !== SecureRandom && void 0 !== Arcfour && (pidCrypt.RSA = function() {
- this.n = null,
- this.e = 0,
- this.d = null,
- this.p = null,
- this.q = null,
- this.dmp1 = null,
- this.dmq1 = null,
- this.coeff = null
- }
- ,
- pidCrypt.RSA.prototype.doPrivate = function(t) {
- if (null == this.p || null == this.q)
- return t.modPow(this.d, this.n);
- for (var e = t.mod(this.p).modPow(this.dmp1, this.p), n = t.mod(this.q).modPow(this.dmq1, this.q); e.compareTo(n) < 0; )
- e = e.add(this.p);
- return e.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)
- }
- ,
- pidCrypt.RSA.prototype.setPublic = function(t, e, n) {
- void 0 === n && (n = 16),
- null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = parseBigInt(t, n),
- this.e = parseInt(e, n)) : alert("Invalid RSA public key")
- }
- ,
- pidCrypt.RSA.prototype.doPublic = function(t) {
- return t.modPowInt(this.e, this.n)
- }
- ,
- pidCrypt.RSA.prototype.encryptRaw = function(t) {
- var e = pkcs1pad2(t, this.n.bitLength() + 7 >> 3);
- if (null == e)
- return null;
- var n = this.doPublic(e);
- if (null == n)
- return null;
- var i = n.toString(16);
- return 0 == (1 & i.length) ? i : "0" + i
- }
- ,
- pidCrypt.RSA.prototype.encrypt = function(t) {
- return t = pidCryptUtil.encodeBase64(t),
- this.encryptRaw(t)
- }
- ,
- pidCrypt.RSA.prototype.decryptRaw = function(t) {
- var e = parseBigInt(t, 16)
- , n = this.doPrivate(e);
- return null == n ? null : pkcs1unpad2(n, this.n.bitLength() + 7 >> 3)
- }
- ,
- pidCrypt.RSA.prototype.decrypt = function(t) {
- var e = this.decryptRaw(t);
- return e = e ? pidCryptUtil.decodeBase64(e) : ""
- }
- ,
- pidCrypt.RSA.prototype.setPrivate = function(t, e, n, i) {
- void 0 === i && (i = 16),
- null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = parseBigInt(t, i),
- this.e = parseInt(e, i),
- this.d = parseBigInt(n, i)) : alert("Invalid RSA private key")
- }
- ,
- pidCrypt.RSA.prototype.setPrivateEx = function(t, e, n, i, r, o, s, a, u) {
- void 0 === u && (u = 16),
- null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = parseBigInt(t, u),
- this.e = parseInt(e, u),
- this.d = parseBigInt(n, u),
- this.p = parseBigInt(i, u),
- this.q = parseBigInt(r, u),
- this.dmp1 = parseBigInt(o, u),
- this.dmq1 = parseBigInt(s, u),
- this.coeff = parseBigInt(a, u)) : alert("Invalid RSA private key")
- }
- ,
- pidCrypt.RSA.prototype.generate = function(t, e) {
- var n = new SecureRandom
- , i = t >> 1;
- this.e = parseInt(e, 16);
- for (var r = new BigInteger(e,16); ; ) {
- for (; this.p = new BigInteger(t - i,1,n),
- 0 != this.p.subtract(BigInteger.ONE).gcd(r).compareTo(BigInteger.ONE) || !this.p.isProbablePrime(10); )
- ;
- for (; this.q = new BigInteger(i,1,n),
- 0 != this.q.subtract(BigInteger.ONE).gcd(r).compareTo(BigInteger.ONE) || !this.q.isProbablePrime(10); )
- ;
- if (this.p.compareTo(this.q) <= 0) {
- var o = this.p;
- this.p = this.q,
- this.q = o
- }
- var s = this.p.subtract(BigInteger.ONE)
- , a = this.q.subtract(BigInteger.ONE)
- , u = s.multiply(a);
- if (0 == u.gcd(r).compareTo(BigInteger.ONE)) {
- this.n = this.p.multiply(this.q),
- this.d = r.modInverse(u),
- this.dmp1 = this.d.mod(s),
- this.dmq1 = this.d.mod(a),
- this.coeff = this.q.modInverse(this.p);
- break
- }
- }
- }
- ,
- pidCrypt.RSA.prototype.getASNData = function(t) {
- var e = []
- , n = 0;
- if (t.value && "INTEGER" == t.type && (e[n++] = t.value),
- t.sub)
- for (var i = 0; i < t.sub.length; i++)
- e = e.concat(this.getASNData(t.sub[i]));
- return e
- }
- ,
- pidCrypt.RSA.prototype.setKeyFromASN = function(t, e) {
- var n = ["N", "E", "D", "P", "Q", "DP", "DQ", "C"]
- , i = {}
- , r = this.getASNData(e);
- switch (t) {
- case "Public":
- case "public":
- for (o = 0; o < r.length; o++)
- i[n[o]] = r[o].toLowerCase();
- this.setPublic(i.N, i.E, 16);
- break;
- case "Private":
- case "private":
- for (var o = 1; o < r.length; o++)
- i[n[o - 1]] = r[o].toLowerCase();
- this.setPrivateEx(i.N, i.E, i.D, i.P, i.Q, i.DP, i.DQ, i.C, 16)
- }
- }
- ,
- pidCrypt.RSA.prototype.setPublicKeyFromASN = function(t) {
- this.setKeyFromASN("public", t)
- }
- ,
- pidCrypt.RSA.prototype.setPrivateKeyFromASN = function(t) {
- this.setKeyFromASN("private", t)
- }
- ,
- pidCrypt.RSA.prototype.getParameters = function() {
- var t = {};
- return null != this.n && (t.n = this.n),
- t.e = this.e,
- null != this.d && (t.d = this.d),
- null != this.p && (t.p = this.p),
- null != this.q && (t.q = this.q),
- null != this.dmp1 && (t.dmp1 = this.dmp1),
- null != this.dmq1 && (t.dmq1 = this.dmq1),
- null != this.coeff && (t.c = this.coeff),
- t
- }
- ),
- define("jquery", [], function() {
- return window.jQuery
- }),
- define("can/util/can", [], function() {
- var t = "undefined" != typeof window ? window : "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope ? self : global
- , e = {};
- "undefined" != typeof GLOBALCAN && !1 === GLOBALCAN || (t.can = e),
- e.global = t,
- e.k = function() {}
- ,
- e.isDeferred = e.isPromise = function(t) {
- return t && "function" == typeof t.then && "function" == typeof t.pipe
- }
- ,
- e.isMapLike = function(t) {
- return e.Map && (t instanceof e.Map || t && t.___get)
- }
- ;
- var n = 0;
- e.cid = function(t, e) {
- return t._cid || (n++,
- t._cid = (e || "") + n),
- t._cid
- }
- ,
- e.VERSION = "2.3.7",
- e.simpleExtend = function(t, e) {
- for (var n in e)
- t[n] = e[n];
- return t
- }
- ,
- e.last = function(t) {
- return t && t[t.length - 1]
- }
- ,
- e.isDOM = function(t) {
- return (t.ownerDocument || t) === e.global.document
- }
- ,
- e.childNodes = function(t) {
- var e = t.childNodes;
- if ("length"in e)
- return e;
- for (var n = t.firstChild, i = []; n; )
- i.push(n),
- n = n.nextSibling;
- return i
- }
- ;
- var i = Function.prototype.bind;
- e.proxy = i ? function(t, e) {
- return i.call(t, e)
- }
- : function(t, e) {
- return function() {
- return t.apply(e, arguments)
- }
- }
- ,
- e.frag = function(t, n) {
- var i, r = n || e.document || e.global.document;
- return t && "string" != typeof t ? 11 === t.nodeType ? t : "number" == typeof t.nodeType ? ((i = r.createDocumentFragment()).appendChild(t),
- i) : "number" == typeof t.length ? (i = r.createDocumentFragment(),
- e.each(t, function(t) {
- i.appendChild(e.frag(t))
- }),
- i) : (i = e.buildFragment("" + t, r),
- e.childNodes(i).length || i.appendChild(r.createTextNode("")),
- i) : ((i = e.buildFragment(null == t ? "" : "" + t, r)).childNodes.length || i.appendChild(r.createTextNode("")),
- i)
- }
- ,
- e.scope = e.viewModel = function(t, n, i) {
- t = e.$(t);
- var r = e.data(t, "scope") || e.data(t, "viewModel");
- switch (r || (r = new e.Map,
- e.data(t, "scope", r),
- e.data(t, "viewModel", r)),
- arguments.length) {
- case 0:
- case 1:
- return r;
- case 2:
- return r.attr(n);
- default:
- return r.attr(n, i),
- t
- }
- }
- ;
- var r = function(t) {
- var e = String(t).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
- return e ? {
- href: e[0] || "",
- protocol: e[1] || "",
- authority: e[2] || "",
- host: e[3] || "",
- hostname: e[4] || "",
- port: e[5] || "",
- pathname: e[6] || "",
- search: e[7] || "",
- hash: e[8] || ""
- } : null
- };
- return e.joinURIs = function(t, e) {
- return e = r(e || ""),
- t = r(t || ""),
- e && t ? (e.protocol || t.protocol) + (e.protocol || e.authority ? e.authority : t.authority) + function(t) {
- var e = [];
- return t.replace(/^(\.\.?(\/|$))+/, "").replace(/\/(\.(\/|$))+/g, "/").replace(/\/\.\.$/, "/../").replace(/\/?[^\/]*/g, function(t) {
- "/.." === t ? e.pop() : e.push(t)
- }),
- e.join("").replace(/^\//, "/" === t.charAt(0) ? "/" : "")
- }(e.protocol || e.authority || "/" === e.pathname.charAt(0) ? e.pathname : e.pathname ? (t.authority && !t.pathname ? "/" : "") + t.pathname.slice(0, t.pathname.lastIndexOf("/") + 1) + e.pathname : t.pathname) + (e.protocol || e.authority || e.pathname ? e.search : e.search || t.search) + e.hash : null
- }
- ,
- e.import = function(t, n) {
- var i = new e.Deferred;
- return "object" == typeof window.System && e.isFunction(window.System.import) ? window.System.import(t, {
- name: n
- }).then(e.proxy(i.resolve, i), e.proxy(i.reject, i)) : window.define && window.define.amd ? window.require([t], function(t) {
- i.resolve(t)
- }) : window.steal ? steal.steal(t, function(t) {
- i.resolve(t)
- }) : window.require ? i.resolve(window.require(t)) : i.resolve(),
- i.promise()
- }
- ,
- e.__observe = function() {}
- ,
- e.isNode = "object" == typeof process && "[object process]" === {}.toString.call(process),
- e.isBrowserWindow = "undefined" != typeof window && "undefined" != typeof document && "undefined" == typeof SimpleDOM,
- e.isWebWorker = "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope,
- e
- }),
- define("can/util/attr", ["can/util/can"], function(t) {
- var e = t.global.setImmediate || function(t) {
- return setTimeout(t, 0)
- }
- , n = {
- input: !0,
- textarea: !0,
- select: !0
- }
- , i = function(e, i) {
- return i in e || t.document && n[e.nodeName.toLowerCase()]
- }
- , r = {
- MutationObserver: t.global.MutationObserver || t.global.WebKitMutationObserver || t.global.MozMutationObserver,
- map: {
- class: function(t, e) {
- return e = e || "",
- "http://www.w3.org/2000/svg" === t.namespaceURI ? t.setAttribute("class", e) : t.className = e,
- e
- },
- value: "value",
- innertext: "innerText",
- innerhtml: "innerHTML",
- textcontent: "textContent",
- for: "htmlFor",
- checked: !0,
- disabled: !0,
- readonly: function(t, e) {
- return t.readOnly = !0,
- e
- },
- required: !0,
- src: function(t, e) {
- return null == e || "" === e ? (t.removeAttribute("src"),
- null) : (t.setAttribute("src", e),
- e)
- },
- style: function() {
- var e = t.global.document && document.createElement("div");
- return e && e.style && "cssText"in e.style ? function(t, e) {
- return t.style.cssText = e || ""
- }
- : function(t, e) {
- return t.setAttribute("style", e)
- }
- }()
- },
- defaultValue: ["input", "textarea"],
- setAttrOrProp: function(t, e, n) {
- e = e.toLowerCase(),
- !0 !== r.map[e] || n ? this.set(t, e, n) : this.remove(t, e)
- },
- set: function(e, n, o) {
- var s = t.isDOM(e) && r.MutationObserver;
- n = n.toLowerCase();
- var a;
- s || (a = r.get(e, n));
- var u, c = r.map[n];
- "function" == typeof c ? u = c(e, o) : !0 === c && i(e, n) ? (u = e[n] = !0,
- "checked" === n && "radio" === e.type && t.inArray((e.nodeName + "").toLowerCase(), r.defaultValue) >= 0 && (e.defaultChecked = !0)) : "string" == typeof c && i(e, c) ? (u = o,
- e[c] === o && "OPTION" !== e.nodeName.toUpperCase() || (e[c] = o),
- "value" === c && t.inArray((e.nodeName + "").toLowerCase(), r.defaultValue) >= 0 && (e.defaultValue = o)) : r.setAttribute(e, n, o),
- s || u === a || r.trigger(e, n, a)
- },
- setAttribute: function() {
- var e = t.global.document;
- if (e && document.createAttribute)
- try {
- e.createAttribute("{}")
- } catch (t) {
- var n = {}
- , i = document.createElement("div");
- return function(t, e, r) {
- var o, s, a = e.charAt(0);
- "{" !== a && "(" !== a && "*" !== a || !t.setAttributeNode ? t.setAttribute(e, r) : ((o = n[e]) || (i.innerHTML = "<div " + e + '=""></div>',
- o = n[e] = i.childNodes[0].attributes[0]),
- s = o.cloneNode(),
- s.value = r,
- t.setAttributeNode(s))
- }
- }
- return function(t, e, n) {
- t.setAttribute(e, n)
- }
- }(),
- trigger: function(n, i, r) {
- if (t.data(t.$(n), "canHasAttributesBindings"))
- return i = i.toLowerCase(),
- e(function() {
- t.trigger(n, {
- type: "attributes",
- attributeName: i,
- target: n,
- oldValue: r,
- bubbles: !1
- }, [])
- })
- },
- get: function(t, e) {
- e = e.toLowerCase();
- var n = r.map[e];
- return "string" == typeof n && i(t, n) ? t[n] : !0 === n && i(t, e) ? t[e] : t.getAttribute(e)
- },
- remove: function(t, e) {
- e = e.toLowerCase();
- var n;
- r.MutationObserver || (n = r.get(t, e));
- var o = r.map[e];
- "function" == typeof o && o(t, void 0),
- !0 === o && i(t, e) ? t[e] = !1 : "string" == typeof o && i(t, o) ? t[o] = "" : t.removeAttribute(e),
- r.MutationObserver || null == n || r.trigger(t, e, n)
- },
- has: function() {
- var e = t.global.document && document.createElement("div");
- return e && e.hasAttribute ? function(t, e) {
- return t.hasAttribute(e)
- }
- : function(t, e) {
- return null !== t.getAttribute(e)
- }
- }()
- };
- return r
- }),
- define("can/event", ["can/util/can"], function(t) {
- return t.addEvent = function(t, e) {
- var n = this.__bindEvents || (this.__bindEvents = {});
- return (n[t] || (n[t] = [])).push({
- handler: e,
- name: t
- }),
- this
- }
- ,
- t.listenTo = function(e, n, i) {
- var r = this.__listenToEvents;
- r || (r = this.__listenToEvents = {});
- var o = t.cid(e)
- , s = r[o];
- s || (s = r[o] = {
- obj: e,
- events: {}
- });
- var a = s.events[n];
- a || (a = s.events[n] = []),
- a.push(i),
- t.bind.call(e, n, i)
- }
- ,
- t.stopListening = function(e, n, i) {
- var r = this.__listenToEvents
- , o = r
- , s = 0;
- if (!r)
- return this;
- if (e) {
- var a = t.cid(e);
- if ((o = {})[a] = r[a],
- !r[a])
- return this
- }
- for (var u in o) {
- var c, l = o[u];
- e = r[u].obj,
- n ? (c = {})[n] = l.events[n] : c = l.events;
- for (var p in c) {
- var h = c[p] || [];
- for (s = 0; s < h.length; )
- i && i === h[s] || !i ? (t.unbind.call(e, p, h[s]),
- h.splice(s, 1)) : s++;
- h.length || delete l.events[p]
- }
- t.isEmptyObject(l.events) && delete r[u]
- }
- return this
- }
- ,
- t.removeEvent = function(t, e, n) {
- if (!this.__bindEvents)
- return this;
- for (var i, r = this.__bindEvents[t] || [], o = 0, s = "function" == typeof e; o < r.length; )
- i = r[o],
- (n ? n(i, t, e) : s && i.handler === e || !s && (i.cid === e || !e)) ? r.splice(o, 1) : o++;
- return this
- }
- ,
- t.dispatch = function(t, e) {
- var n = this.__bindEvents;
- if (n) {
- var i;
- "string" == typeof t ? (i = t,
- t = {
- type: t
- }) : i = t.type;
- var r = n[i];
- if (r) {
- r = r.slice(0);
- var o = [t];
- e && o.push.apply(o, e);
- for (var s = 0, a = r.length; s < a; s++)
- r[s].handler.apply(this, o);
- return t
- }
- }
- }
- ,
- t.one = function(e, n) {
- var i = function() {
- return t.unbind.call(this, e, i),
- n.apply(this, arguments)
- };
- return t.bind.call(this, e, i),
- this
- }
- ,
- t.event = {
- on: function() {
- return 0 === arguments.length && t.Control && this instanceof t.Control ? t.Control.prototype.on.call(this) : t.addEvent.apply(this, arguments)
- },
- off: function() {
- return 0 === arguments.length && t.Control && this instanceof t.Control ? t.Control.prototype.off.call(this) : t.removeEvent.apply(this, arguments)
- },
- bind: t.addEvent,
- unbind: t.removeEvent,
- delegate: function(e, n, i) {
- return t.addEvent.call(this, n, i)
- },
- undelegate: function(e, n, i) {
- return t.removeEvent.call(this, n, i)
- },
- trigger: t.dispatch,
- one: t.one,
- addEvent: t.addEvent,
- removeEvent: t.removeEvent,
- listenTo: t.listenTo,
- stopListening: t.stopListening,
- dispatch: t.dispatch
- },
- t.event
- }),
- define("can/util/each", ["can/util/can"], function(t) {
- var e = function(t) {
- var e = t && "boolean" != typeof t && "number" != typeof t && "length"in t && t.length;
- return "function" != typeof arr && (0 === e || "number" == typeof e && e > 0 && e - 1 in t)
- };
- return t.each = function(n, i, r) {
- var o, s, a, u = 0;
- if (n)
- if (e(n))
- if (t.List && n instanceof t.List)
- for (s = n.attr("length"); u < s && (a = n.attr(u),
- !1 !== i.call(r || a, a, u, n)); u++)
- ;
- else
- for (s = n.length; u < s && (a = n[u],
- !1 !== i.call(r || a, a, u, n)); u++)
- ;
- else if ("object" == typeof n)
- if (t.Map && n instanceof t.Map || n === t.route) {
- var c = t.Map.keys(n);
- for (u = 0,
- s = c.length; u < s && (o = c[u],
- a = n.attr(o),
- !1 !== i.call(r || a, a, o, n)); u++)
- ;
- } else
- for (o in n)
- if (Object.prototype.hasOwnProperty.call(n, o) && !1 === i.call(r || n[o], n[o], o, n))
- break;
- return n
- }
- ,
- t
- }),
- define("can/util/inserted", ["can/util/can"], function(t) {
- t.inserted = function(e, n) {
- if (e.length) {
- e = t.makeArray(e);
- for (var i, r, o = n || e[0].ownerDocument || e[0], s = !1, a = t.$(o.contains ? o : o.body), u = 0; void 0 !== (r = e[u]); u++) {
- if (!s) {
- if (!r.getElementsByTagName)
- continue;
- if (!t.has(a, r).length)
- return;
- s = !0
- }
- if (s && r.getElementsByTagName) {
- i = t.makeArray(r.getElementsByTagName("*")),
- t.trigger(r, "inserted", [], !1);
- for (var c, l = 0; void 0 !== (c = i[l]); l++)
- t.trigger(c, "inserted", [], !1)
- }
- }
- }
- }
- ,
- t.appendChild = function(e, n, i) {
- var r;
- r = 11 === n.nodeType ? t.makeArray(t.childNodes(n)) : [n],
- e.appendChild(n),
- t.inserted(r, i)
- }
- ,
- t.insertBefore = function(e, n, i, r) {
- var o;
- o = 11 === n.nodeType ? t.makeArray(t.childNodes(n)) : [n],
- e.insertBefore(n, i),
- t.inserted(o, r)
- }
- }),
- define("can/util/jquery", ["jquery", "can/util/can", "can/util/attr", "can/event", "can/util/each", "can/util/inserted"], function(t, e, n, i) {
- var r = function(t) {
- return t.nodeName && (1 === t.nodeType || 9 === t.nodeType) || t == window || t.addEventListener
- };
- (t = t || window.jQuery).extend(e, t, {
- trigger: function(n, i, o, s) {
- r(n) ? t.event.trigger(i, o, n, !s) : n.trigger ? n.trigger(i, o) : ("string" == typeof i && (i = {
- type: i
- }),
- i.target = i.target || n,
- o && (o.length && "string" == typeof o ? o = [o] : o.length || (o = [o])),
- o || (o = []),
- e.dispatch.call(n, i, o))
- },
- event: e.event,
- addEvent: e.addEvent,
- removeEvent: e.removeEvent,
- buildFragment: function(e, n) {
- var i;
- return e = [e],
- n = n || document,
- n = !n.nodeType && n[0] || n,
- n = n.ownerDocument || n,
- (i = t.buildFragment(e, n)).cacheable ? t.clone(i.fragment) : i.fragment || i
- },
- $: t,
- each: e.each,
- bind: function(n, i) {
- return this.bind && this.bind !== e.bind ? this.bind(n, i) : r(this) ? t.event.add(this, n, i) : e.addEvent.call(this, n, i),
- this
- },
- unbind: function(n, i) {
- return this.unbind && this.unbind !== e.unbind ? this.unbind(n, i) : r(this) ? t.event.remove(this, n, i) : e.removeEvent.call(this, n, i),
- this
- },
- delegate: function(n, i, o) {
- return this.delegate ? this.delegate(n, i, o) : r(this) ? t(this).delegate(n, i, o) : e.bind.call(this, i, o),
- this
- },
- undelegate: function(n, i, o) {
- return this.undelegate ? this.undelegate(n, i, o) : r(this) ? t(this).undelegate(n, i, o) : e.unbind.call(this, i, o),
- this
- },
- proxy: e.proxy,
- attr: n
- }),
- e.on = e.bind,
- e.off = e.unbind,
- t.each(["append", "filter", "addClass", "remove", "data", "get", "has"], function(t, n) {
- e[n] = function(t) {
- return t[n].apply(t, e.makeArray(arguments).slice(1))
- }
- });
- var o = t.cleanData;
- t.cleanData = function(n) {
- t.each(n, function(t, n) {
- n && e.trigger(n, "removed", [], !1)
- }),
- o(n)
- }
- ;
- var s, a = t.fn.domManip;
- t.fn.domManip = function(t, e, n) {
- for (var i = 1; i < arguments.length; i++)
- if ("function" == typeof arguments[i]) {
- s = i;
- break
- }
- return a.apply(this, arguments)
- }
- ,
- t(document.createElement("div")).append(document.createElement("div")),
- t.fn.domManip = 2 === s ? function(t, n, i) {
- return a.call(this, t, n, function(t) {
- var n;
- 11 === t.nodeType && (n = e.makeArray(e.childNodes(t)));
- var r = i.apply(this, arguments);
- return e.inserted(n || [t]),
- r
- })
- }
- : function(t, n) {
- return a.call(this, t, function(t) {
- var i;
- 11 === t.nodeType && (i = e.makeArray(e.childNodes(t)));
- var r = n.apply(this, arguments);
- return e.inserted(i || [t]),
- r
- })
- }
- ;
- var u = t.attr;
- t.attr = function(t, n) {
- if (e.isDOM(t) && e.attr.MutationObserver)
- return u.apply(this, arguments);
- var i, r;
- arguments.length >= 3 && (i = u.call(this, t, n));
- var o = u.apply(this, arguments);
- return arguments.length >= 3 && (r = u.call(this, t, n)),
- r !== i && e.attr.trigger(t, n, i),
- o
- }
- ;
- var c = t.removeAttr;
- return t.removeAttr = function(t, n) {
- if (e.isDOM(t) && e.attr.MutationObserver)
- return c.apply(this, arguments);
- var i = u.call(this, t, n)
- , r = c.apply(this, arguments);
- return null != i && e.attr.trigger(t, n, i),
- r
- }
- ,
- t.event.special.attributes = {
- setup: function() {
- if (e.isDOM(this) && e.attr.MutationObserver) {
- var t = this
- , n = new e.attr.MutationObserver(function(n) {
- n.forEach(function(n) {
- var i = e.simpleExtend({}, n);
- e.trigger(t, i, [])
- })
- }
- );
- n.observe(this, {
- attributes: !0,
- attributeOldValue: !0
- }),
- e.data(e.$(this), "canAttributesObserver", n)
- } else
- e.data(e.$(this), "canHasAttributesBindings", !0)
- },
- teardown: function() {
- e.isDOM(this) && e.attr.MutationObserver ? (e.data(e.$(this), "canAttributesObserver").disconnect(),
- t.removeData(this, "canAttributesObserver")) : t.removeData(this, "canHasAttributesBindings")
- }
- },
- function() {
- var t = e.buildFragment("<-\n>", document);
- if (t.firstChild && "<-\n>" !== t.firstChild.nodeValue) {
- var n = e.buildFragment;
- e.buildFragment = function(t, e) {
- var i = n(t, e);
- return 1 === i.childNodes.length && 3 === i.childNodes.item(0).nodeType && (i.childNodes.item(0).nodeValue = t),
- i
- }
- }
- }(),
- t.event.special.inserted = {},
- t.event.special.removed = {},
- e
- }),
- define("can/util/library", ["can/util/jquery"], function(t) {
- return t
- }),
- define("can/util/bind", ["can/util/library"], function(t) {
- return t.bindAndSetup = function() {
- return t.addEvent.apply(this, arguments),
- this.__inSetup || (this._bindings ? this._bindings++ : (this._bindings = 1,
- this._bindsetup && this._bindsetup())),
- this
- }
- ,
- t.unbindAndTeardown = function(e, n) {
- if (!this.__bindEvents)
- return this;
- var i = this.__bindEvents[e] || []
- , r = i.length;
- return t.removeEvent.apply(this, arguments),
- null === this._bindings ? this._bindings = 0 : this._bindings = this._bindings - (r - i.length),
- !this._bindings && this._bindteardown && this._bindteardown(),
- this
- }
- ,
- t
- }),
- define("can/bubble", ["can/util/library"], function(t) {
- var e = t.bubble = {
- bind: function(t, n) {
- if (!t.__inSetup) {
- var i, r = e.events(t, n), o = r.length;
- t._bubbleBindings || (t._bubbleBindings = {});
- for (var s = 0; s < o; s++)
- i = r[s],
- t._bubbleBindings[i] ? t._bubbleBindings[i]++ : (t._bubbleBindings[i] = 1,
- e.childrenOf(t, i))
- }
- },
- unbind: function(n, i) {
- for (var r, o = e.events(n, i), s = o.length, a = 0; a < s; a++)
- r = o[a],
- n._bubbleBindings && n._bubbleBindings[r]--,
- n._bubbleBindings && !n._bubbleBindings[r] && (delete n._bubbleBindings[r],
- e.teardownChildrenFrom(n, r),
- t.isEmptyObject(n._bubbleBindings) && delete n._bubbleBindings)
- },
- add: function(n, i, r) {
- if (i instanceof t.Map && n._bubbleBindings)
- for (var o in n._bubbleBindings)
- n._bubbleBindings[o] && (e.teardownFromParent(n, i, o),
- e.toParent(i, n, r, o))
- },
- addMany: function(t, n) {
- for (var i = 0, r = n.length; i < r; i++)
- e.add(t, n[i], i)
- },
- remove: function(n, i) {
- if (i instanceof t.Map && n._bubbleBindings)
- for (var r in n._bubbleBindings)
- n._bubbleBindings[r] && e.teardownFromParent(n, i, r)
- },
- removeMany: function(t, n) {
- for (var i = 0, r = n.length; i < r; i++)
- e.remove(t, n[i])
- },
- set: function(n, i, r, o) {
- return t.isMapLike(r) && e.add(n, r, i),
- t.isMapLike(o) && e.remove(n, o),
- r
- },
- events: function(t, e) {
- return t.constructor._bubbleRule(e, t)
- },
- toParent: function(e, n, i, r) {
- t.listenTo.call(n, e, r, function() {
- var o = t.makeArray(arguments)
- , s = o.shift();
- o[0] = (t.List && n instanceof t.List ? n.indexOf(e) : i) + (o[0] ? "." + o[0] : ""),
- s.triggeredNS = s.triggeredNS || {},
- s.triggeredNS[n._cid] || (s.triggeredNS[n._cid] = !0,
- t.trigger(n, s, o),
- "change" === r && t.trigger(n, o[0], [o[2], o[3]]))
- })
- },
- childrenOf: function(t, n) {
- t._each(function(i, r) {
- i && i.bind && e.toParent(i, t, r, n)
- })
- },
- teardownFromParent: function(e, n, i) {
- n && n.unbind && t.stopListening.call(e, n, i)
- },
- teardownChildrenFrom: function(t, n) {
- t._each(function(i) {
- e.teardownFromParent(t, i, n)
- })
- },
- isBubbling: function(t, e) {
- return t._bubbleBindings && t._bubbleBindings[e]
- }
- };
- return e
- }),
- define("can/util/object/isplain", ["can/util/can"], function(t) {
- var e = Object.prototype.hasOwnProperty
- , n = function(t) {
- return null !== t && t == t.window
- };
- return t.isPlainObject = function(t) {
- if (!t || "object" != typeof t || t.nodeType || n(t))
- return !1;
- try {
- if (t.constructor && !e.call(t, "constructor") && !e.call(t.constructor.prototype, "isPrototypeOf"))
- return !1
- } catch (t) {
- return !1
- }
- var i;
- for (i in t)
- ;
- return void 0 === i || e.call(t, i)
- }
- ,
- t
- }),
- define("can/map_helpers", ["can/util/library", "can/util/object/isplain"], function(t) {
- var e = {
- attrParts: function(t, e) {
- return e ? [t] : "object" == typeof t ? t : ("" + t).split(".")
- },
- canMakeObserve: function(e) {
- return e && !t.isDeferred(e) && (t.isArray(e) || t.isPlainObject(e))
- },
- serialize: function() {
- var n = null;
- return function(i, r, o) {
- var s = t.cid(i)
- , a = !1;
- return n || (a = !0,
- n = {
- attr: {},
- serialize: {}
- }),
- n[r][s] = o,
- i.each(function(s, a) {
- var u;
- void 0 !== (u = t.isMapLike(s) && n[r][t.cid(s)] || (i["___" + r] ? i["___" + r](a, s) : e.getValue(i, a, s, r))) && (o[a] = u)
- }),
- a && (n = null),
- o
- }
- }(),
- getValue: function(e, n, i, r) {
- return t.isMapLike(i) ? i[r]() : i
- },
- define: null,
- addComputedAttr: function(t, e, n) {
- t._computedAttrs[e] = {
- compute: n,
- count: 0,
- handler: function(n, i, r) {
- t._triggerChange(e, "set", i, r, n.batchNum)
- }
- }
- },
- addToMap: function(e, r) {
- var o;
- n || (o = i,
- n = {});
- var s = e._cid
- , a = t.cid(e);
- return n[a] || (n[a] = {
- obj: e,
- instance: r,
- added: !s
- }),
- o
- },
- getMapFromObject: function(t) {
- return n && n[t._cid] && n[t._cid].instance
- }
- }
- , n = null
- , i = function() {
- for (var t in n)
- n[t].added && delete n[t].obj._cid;
- n = null
- };
- return e
- }),
- define("can/util/string", ["can/util/library"], function(t) {
- var e = /_|-/
- , n = /\=\=/
- , i = /([A-Z]+)([A-Z][a-z])/g
- , r = /([a-z\d])([A-Z])/g
- , o = /([a-z\d])([A-Z])/g
- , s = /\{([^\}]+)\}/g
- , a = /"/g
- , u = /'/g
- , c = /-+(.)?/g
- , l = /[a-z][A-Z]/g
- , p = function(t, e, n) {
- var i = t[e];
- return void 0 === i && !0 === n && (i = t[e] = {}),
- i
- }
- , h = function(t) {
- return /^f|^o/.test(typeof t)
- }
- , d = function(t) {
- return "" + (null === t || void 0 === t || isNaN(t) && "" + t == "NaN" ? "" : t)
- };
- return t.extend(t, {
- esc: function(t) {
- return d(t).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(a, """).replace(u, "'")
- },
- getObject: function(e, n, i) {
- var r, o, s, a, u = e ? e.split(".") : [], c = u.length, l = 0;
- if (n = t.isArray(n) ? n : [n || window],
- a = n.length,
- !c)
- return n[0];
- for (l; l < a; l++) {
- for (r = n[l],
- s = void 0,
- o = 0; o < c && h(r); o++)
- s = r,
- r = p(s, u[o]);
- if (void 0 !== s && void 0 !== r)
- break
- }
- if (!1 === i && void 0 !== r && delete s[u[o - 1]],
- !0 === i && void 0 === r)
- for (r = n[0],
- o = 0; o < c && h(r); o++)
- r = p(r, u[o], !0);
- return r
- },
- capitalize: function(t, e) {
- return t.charAt(0).toUpperCase() + t.slice(1)
- },
- camelize: function(t) {
- return d(t).replace(c, function(t, e) {
- return e ? e.toUpperCase() : ""
- })
- },
- hyphenate: function(t) {
- return d(t).replace(l, function(t, e) {
- return t.charAt(0) + "-" + t.charAt(1).toLowerCase()
- })
- },
- underscore: function(t) {
- return t.replace(n, "/").replace(i, "$1_$2").replace(r, "$1_$2").replace(o, "_").toLowerCase()
- },
- sub: function(e, n, i) {
- var r = [];
- return e = e || "",
- r.push(e.replace(s, function(e, o) {
- var s = t.getObject(o, n, !0 !== i && void 0);
- return void 0 === s || null === s ? (r = null,
- "") : h(s) && r ? (r.push(s),
- "") : "" + s
- })),
- null === r ? r : r.length <= 1 ? r[0] : r
- },
- replacer: s,
- undHash: e
- }),
- t
- }),
- define("can/construct", ["can/util/string"], function(t) {
- var e, n = 0;
- try {
- Object.getOwnPropertyDescriptor({}),
- e = !0
- } catch (t) {
- e = !1
- }
- var i = function(t, e) {
- var n = Object.getOwnPropertyDescriptor(t, e);
- return n && (n.get || n.set) ? n : null
- };
- return t.Construct = function() {
- if (arguments.length)
- return t.Construct.extend.apply(t.Construct, arguments)
- }
- ,
- t.extend(t.Construct, {
- constructorExtends: !0,
- newInstance: function() {
- var t, e = this.instance();
- return e.setup && (e.__inSetup = !0,
- t = e.setup.apply(e, arguments),
- delete e.__inSetup),
- e.init && e.init.apply(e, t || arguments),
- e
- },
- _inherit: e ? function(e, n, r) {
- r = r || e;
- var o;
- for (var s in e)
- (o = i(e, s)) ? this._defineProperty(r, n, s, o) : t.Construct._overwrite(r, n, s, e[s])
- }
- : function(e, n, i) {
- i = i || e;
- for (var r in e)
- t.Construct._overwrite(i, n, r, e[r])
- }
- ,
- _defineProperty: function(t, e, n, i) {
- Object.defineProperty(t, n, i)
- },
- _overwrite: function(t, e, n, i) {
- t[n] = i
- },
- setup: function(e, n) {
- this.defaults = t.extend(!0, {}, e.defaults, this.defaults)
- },
- instance: function() {
- n = 1;
- var t = new this;
- return n = 0,
- t
- },
- extend: function(e, i, r) {
- function o() {
- if (!n)
- return this.constructor !== c && arguments.length && c.constructorExtends ? c.extend.apply(c, arguments) : c.newInstance.apply(c, arguments)
- }
- var s = e
- , a = i
- , u = r;
- "string" != typeof s && (u = a,
- a = s,
- s = null),
- u || (u = a,
- a = null),
- u = u || {};
- var c, l, p, h, d, f, g, v, m, b = this, y = this.prototype;
- m = this.instance(),
- t.Construct._inherit(u, y, m),
- s ? (l = s.split("."),
- g = l.pop()) : a && a.shortName ? g = a.shortName : this.shortName && (g = this.shortName),
- "undefined" == typeof constructorName && (c = function() {
- return o.apply(this, arguments)
- }
- );
- for (f in b)
- b.hasOwnProperty(f) && (c[f] = b[f]);
- t.Construct._inherit(a, b, c),
- s && (p = t.getObject(l.join("."), window, !0),
- v = p,
- h = t.underscore(s.replace(/\./g, "_")),
- d = t.underscore(g),
- p[g] = c),
- t.extend(c, {
- constructor: c,
- prototype: m,
- namespace: v,
- _shortName: d,
- fullName: s,
- _fullName: h
- }),
- void 0 !== g && (c.shortName = g),
- c.prototype.constructor = c;
- var _ = [b].concat(t.makeArray(arguments))
- , w = c.setup.apply(c, _);
- return c.init && c.init.apply(c, w || _),
- c
- }
- }),
- t.Construct.prototype.setup = function() {}
- ,
- t.Construct.prototype.init = function() {}
- ,
- t.Construct
- }),
- define("can/util/batch", ["can/util/can"], function(t) {
- var e = 1
- , n = 0
- , i = null
- , r = null
- , o = [];
- t.batch = {
- start: function(t) {
- if (1 == ++n) {
- var i = {
- events: [],
- callbacks: [],
- number: e++
- };
- o.push(i),
- t && i.callbacks.push(t),
- r = i
- }
- },
- stop: function(e, s) {
- if (e ? n = 0 : n--,
- 0 === n) {
- r = null;
- var a;
- if (1 === o.length)
- for (; a = o.shift(); ) {
- var u = a.events
- , c = a.callbacks;
- i = a,
- t.batch.batchNum = a.number;
- var l, p;
- for (s && t.batch.start(),
- l = 0,
- p = u.length; l < p; l++)
- t.dispatch.apply(u[l][0], u[l][1]);
- for (t.batch._onDispatchedEvents(a.number),
- l = 0; l < c.length; l++)
- c[l]();
- i = null,
- t.batch.batchNum = void 0
- }
- }
- },
- _onDispatchedEvents: function() {},
- trigger: function(e, n, o) {
- e.__inSetup || (n = "string" == typeof n ? {
- type: n
- } : n,
- r ? (n.batchNum = r.number,
- r.events.push([e, [n, o]])) : (i && (n.batchNum = i.number),
- t.dispatch.call(e, n, o)))
- },
- afterPreviousEvents: function(t) {
- t({})
- },
- after: function(t) {
- var e = r || i;
- e ? e.callbacks.push(t) : t({})
- }
- }
- }),
- define("can/map", ["can/util/library", "can/util/bind", "can/bubble", "can/map_helpers", "can/construct", "can/util/batch"], function(t, e, n, i) {
- var r = t.Map = t.Construct.extend({
- setup: function() {
- if (t.Construct.setup.apply(this, arguments),
- this._computedPropertyNames = [],
- t.Map) {
- this.defaults || (this.defaults = {});
- for (var e in this.prototype)
- "define" !== e && "constructor" !== e && ("function" != typeof this.prototype[e] || this.prototype[e].prototype instanceof t.Construct) ? this.defaults[e] = this.prototype[e] : this.prototype[e].isComputed && this._computedPropertyNames.push(e);
- i.define && i.define(this)
- }
- !t.List || this.prototype instanceof t.List || (this.List = r.List.extend({
- Map: this
- }, {}))
- },
- shortName: "Map",
- _bubbleRule: function(t) {
- return "change" === t || t.indexOf(".") >= 0 ? ["change"] : []
- },
- bind: t.bindAndSetup,
- unbind: t.unbindAndTeardown,
- id: "id",
- keys: function(e) {
- var n = [];
- t.__observe(e, "__keys");
- for (var i in e._data)
- n.push(i);
- return n
- }
- }, {
- setup: function(e) {
- e instanceof t.Map && (e = e.serialize()),
- this._data = {},
- t.cid(this, ".map"),
- this._setupComputedProperties();
- var n = e && i.addToMap(e, this)
- , r = this._setupDefaults(e)
- , o = t.extend(t.extend(!0, {}, r), e);
- this.attr(o),
- n && n()
- },
- _setupComputedProperties: function() {
- this._computedAttrs = {};
- for (var t = this.constructor._computedPropertyNames, e = 0, n = t.length; e < n; e++) {
- var r = t[e];
- i.addComputedAttr(this, r, this[r].clone(this))
- }
- },
- _setupDefaults: function() {
- return this.constructor.defaults || {}
- },
- attr: function(t, e) {
- var n = typeof t;
- return void 0 === t ? this._getAttrs() : "string" !== n && "number" !== n ? this._setAttrs(t, e) : 1 === arguments.length ? this._get(t + "") : (this._set(t + "", e),
- this)
- },
- _get: function(e) {
- var n = e.indexOf(".");
- if (n >= 0) {
- var i = this.___get(e);
- if (void 0 !== i)
- return t.__observe(this, e),
- i;
- var r = e.substr(0, n)
- , o = e.substr(n + 1)
- , s = this.__get(r);
- return s && s._get ? s._get(o) : void 0
- }
- return this.__get(e)
- },
- __get: function(e) {
- return t.__observe(this, e),
- this.___get(e)
- },
- ___get: function(t) {
- if (t) {
- var e = this._computedAttrs[t];
- return e ? e.compute() : this._data[t]
- }
- return this._data
- },
- _set: function(e, n, i) {
- var r, o = e.indexOf(".");
- if (o >= 0 && !i) {
- var s = e.substr(0, o)
- , a = e.substr(o + 1);
- if (r = this.__inSetup ? void 0 : this.___get(s),
- !t.isMapLike(r))
- throw new Error("can.Map: Object does not exist");
- r._set(a, n)
- } else
- r = this.__inSetup ? void 0 : this.___get(e),
- this.__convert && (n = this.__convert(e, n)),
- this.__set(e, this.__type(n, e), r)
- },
- __type: function(e, n) {
- if ("object" == typeof e && !(e instanceof t.Map) && i.canMakeObserve(e)) {
- var r = i.getMapFromObject(e);
- return r || (t.isArray(e) ? new (0,
- t.List)(e) : new (this.constructor.Map || t.Map)(e))
- }
- return e
- },
- __set: function(t, e, i) {
- if (e !== i) {
- var r = this._computedAttrs[t]
- , o = r || void 0 !== i || this.___get().hasOwnProperty(t) ? "set" : "add";
- this.___set(t, "object" == typeof e ? n.set(this, t, e, i) : e),
- r && r.count || this._triggerChange(t, o, e, i),
- "object" == typeof i && n.teardownFromParent(this, i)
- }
- },
- ___set: function(t, e) {
- var n = this._computedAttrs[t];
- n ? n.compute(e) : this._data[t] = e,
- "function" == typeof this.constructor.prototype[t] || n || (this[t] = e)
- },
- removeAttr: function(t) {
- return this._remove(t)
- },
- _remove: function(t) {
- var e = i.attrParts(t)
- , n = e.shift()
- , r = this.___get(n);
- return e.length && r ? r.removeAttr(e) : ("string" == typeof t && ~t.indexOf(".") && (n = t),
- this.__remove(n, r),
- r)
- },
- __remove: function(t, e) {
- t in this._data && (this.___remove(t),
- this._triggerChange(t, "remove", void 0, e))
- },
- ___remove: function(t) {
- delete this._data[t],
- t in this.constructor.prototype || delete this[t]
- },
- ___serialize: function(t, e) {
- return i.getValue(this, t, e, "serialize")
- },
- _getAttrs: function() {
- return i.serialize(this, "attr", {})
- },
- _setAttrs: function(e, n) {
- e = t.simpleExtend({}, e);
- var r, o, s = this;
- t.batch.start(),
- this.each(function(r, a) {
- if ("_cid" !== a) {
- if (void 0 === (o = e[a]))
- return void (n && s.removeAttr(a));
- s.__convert && (o = s.__convert(a, o)),
- t.isMapLike(r) && i.canMakeObserve(o) ? r.attr(o, n) : r !== o && s.__set(a, s.__type(o, a), r),
- delete e[a]
- }
- });
- for (r in e)
- "_cid" !== r && (o = e[r],
- this._set(r, o, !0));
- return t.batch.stop(),
- this
- },
- serialize: function() {
- return i.serialize(this, "serialize", {})
- },
- _triggerChange: function(e, i, r, o, s) {
- n.isBubbling(this, "change") && t.batch.trigger(this, {
- type: "change",
- target: this,
- batchNum: s
- }, [e, i, r, o]),
- t.batch.trigger(this, {
- type: e,
- target: this,
- batchNum: s
- }, [r, o]),
- "remove" !== i && "add" !== i || t.batch.trigger(this, {
- type: "__keys",
- target: this,
- batchNum: s
- })
- },
- _bindsetup: function() {},
- _bindteardown: function() {},
- one: t.one,
- bind: function(e, i) {
- var r = this._computedAttrs && this._computedAttrs[e];
- return r && (r.count ? r.count++ : (r.count = 1,
- r.compute.bind("change", r.handler))),
- n.bind(this, e),
- t.bindAndSetup.apply(this, arguments)
- },
- unbind: function(e, i) {
- var r = this._computedAttrs && this._computedAttrs[e];
- return r && (1 === r.count ? (r.count = 0,
- r.compute.unbind("change", r.handler)) : r.count--),
- n.unbind(this, e),
- t.unbindAndTeardown.apply(this, arguments)
- },
- compute: function(e) {
- if (t.isFunction(this.constructor.prototype[e]))
- return t.compute(this[e], this);
- var n = t.compute.read.reads(e)
- , i = n.length - 1;
- return t.compute(function(e) {
- if (!arguments.length)
- return t.compute.read(this, n, {
- args: []
- }).value;
- t.compute.read(this, n.slice(0, i)).value.attr(n[i].key, e)
- }, this)
- },
- each: function() {
- return t.each.apply(void 0, [this].concat(t.makeArray(arguments)))
- },
- _each: function(t) {
- var e = this.___get();
- for (var n in e)
- e.hasOwnProperty(n) && t(e[n], n)
- },
- dispatch: t.dispatch
- });
- return r.prototype.on = r.prototype.bind,
- r.prototype.off = r.prototype.unbind,
- r.on = r.bind,
- r.off = r.unbind,
- r
- }),
- define("can/list", ["can/util/library", "can/map", "can/bubble", "can/map_helpers"], function(t, e, n, i) {
- var r = [].splice
- , o = function() {
- var t = {
- 0: "a",
- length: 1
- };
- return r.call(t, 0, 1),
- !t[0]
- }()
- , s = e.extend({
- Map: e
- }, {
- setup: function(e, n) {
- this.length = 0,
- t.cid(this, ".map"),
- this._setupComputedProperties(),
- e = e || [];
- var r;
- t.isDeferred(e) ? this.replace(e) : (r = e.length && i.addToMap(e, this),
- this.push.apply(this, t.makeArray(e || []))),
- r && r(),
- t.simpleExtend(this, n)
- },
- _triggerChange: function(n, i, r, o) {
- e.prototype._triggerChange.apply(this, arguments);
- var s = +n;
- ~("" + n).indexOf(".") || isNaN(s) || ("add" === i ? (t.batch.trigger(this, i, [r, s]),
- t.batch.trigger(this, "length", [this.length])) : "remove" === i ? (t.batch.trigger(this, i, [o, s]),
- t.batch.trigger(this, "length", [this.length])) : t.batch.trigger(this, i, [r, s]))
- },
- ___get: function(e) {
- return e ? this[e] && this[e].isComputed && t.isFunction(this.constructor.prototype[e]) ? this[e]() : this[e] : this
- },
- __set: function(e, n, i) {
- if ("number" == typeof (e = isNaN(+e) || e % 1 ? e : +e) && e > this.length - 1) {
- var r = new Array(e + 1 - this.length);
- return r[r.length - 1] = n,
- this.push.apply(this, r),
- r
- }
- return t.Map.prototype.__set.call(this, "" + e, n, i)
- },
- ___set: function(t, e) {
- this[t] = e,
- +t >= this.length && (this.length = +t + 1)
- },
- __remove: function(t, e) {
- isNaN(+t) ? (delete this[t],
- this._triggerChange(t, "remove", void 0, e)) : this.splice(t, 1)
- },
- _each: function(t) {
- for (var e = this.___get(), n = 0; n < e.length; n++)
- t(e[n], n)
- },
- serialize: function() {
- return i.serialize(this, "serialize", [])
- },
- splice: function(e, i) {
- var s, a, u, c = t.makeArray(arguments), l = [], p = c.length > 2;
- for (e = e || 0,
- s = 0,
- a = c.length - 2; s < a; s++)
- u = s + 2,
- c[u] = this.__type(c[u], u),
- l.push(c[u]),
- this[s + e] !== c[u] && (p = !1);
- if (p && this.length <= l.length)
- return l;
- void 0 === i && (i = c[1] = this.length - e);
- var h = r.apply(this, c);
- if (!o)
- for (s = this.length; s < h.length + this.length; s++)
- delete this[s];
- return t.batch.start(),
- i > 0 && (n.removeMany(this, h),
- this._triggerChange("" + e, "remove", void 0, h)),
- c.length > 2 && (n.addMany(this, l),
- this._triggerChange("" + e, "add", l, h)),
- t.batch.stop(),
- h
- },
- _getAttrs: function() {
- return i.serialize(this, "attr", [])
- },
- _setAttrs: function(e, n) {
- e = t.makeArray(e),
- t.batch.start(),
- this._updateAttrs(e, n),
- t.batch.stop()
- },
- _updateAttrs: function(e, n) {
- for (var r = Math.min(e.length, this.length), o = 0; o < r; o++) {
- var s = this[o]
- , a = e[o];
- t.isMapLike(s) && i.canMakeObserve(a) ? s.attr(a, n) : s !== a && this._set(o + "", a)
- }
- e.length > this.length ? this.push.apply(this, e.slice(this.length)) : e.length < this.length && n && this.splice(e.length)
- }
- })
- , a = function(e) {
- return e[0] && t.isArray(e[0]) ? e[0] : t.makeArray(e)
- };
- return t.each({
- push: "length",
- unshift: 0
- }, function(t, e) {
- var i = [][e];
- s.prototype[e] = function() {
- for (var e, r, o = [], s = t ? this.length : 0, a = arguments.length; a--; )
- r = arguments[a],
- o[a] = n.set(this, a, this.__type(r, a));
- return e = i.apply(this, o),
- this.comparator && !o.length || this._triggerChange("" + s, "add", o, void 0),
- e
- }
- }),
- t.each({
- pop: "length",
- shift: 0
- }, function(t, e) {
- s.prototype[e] = function() {
- if (this.length) {
- var i = a(arguments)
- , r = t && this.length ? this.length - 1 : 0
- , o = [][e].apply(this, i);
- return this._triggerChange("" + r, "remove", void 0, [o]),
- o && o.unbind && n.remove(this, o),
- o
- }
- }
- }),
- t.extend(s.prototype, {
- indexOf: function(e, n) {
- return t.__observe(this, "length"),
- t.inArray(e, this, n)
- },
- join: function() {
- return t.__observe(this, "length"),
- [].join.apply(this, arguments)
- },
- reverse: function() {
- var e = [].reverse.call(t.makeArray(this));
- return this.replace(e)
- },
- slice: function() {
- t.__observe(this, "length");
- var e = Array.prototype.slice.apply(this, arguments);
- return new this.constructor(e)
- },
- concat: function() {
- var e = [];
- return t.each(t.makeArray(arguments), function(n, i) {
- e[i] = n instanceof t.List ? n.serialize() : n
- }),
- new this.constructor(Array.prototype.concat.apply(this.serialize(), e))
- },
- forEach: function(e, n) {
- return t.each(this, e, n || this)
- },
- replace: function(e) {
- if (t.isDeferred(e)) {
- this._promise && (this._promise.__isCurrentPromise = !1);
- var n = this._promise = e;
- n.__isCurrentPromise = !0;
- var i = this;
- e.then(function(t) {
- n.__isCurrentPromise && i.replace(t)
- })
- } else
- this.splice.apply(this, [0, this.length].concat(t.makeArray(e || [])));
- return this
- },
- filter: function(t, e) {
- var n, i = new this.constructor, r = this;
- return this.each(function(o, s, a) {
- (n = t.call(e | r, o, s, r)) && i.push(o)
- }),
- i
- },
- map: function(e, n) {
- var i = new t.List
- , r = this;
- return this.each(function(t, o, s) {
- var a = e.call(n | r, t, o, r);
- i.push(a)
- }),
- i
- }
- }),
- t.List = e.List = s,
- t.List
- }),
- define("can/util/string/deparam", ["can/util/library", "can/util/string"], function(t) {
- var e = /^\d+$/
- , n = /([^\[\]]+)|(\[\])/g
- , i = /([^?#]*)(#.*)?$/
- , r = function(t) {
- return decodeURIComponent(t.replace(/\+/g, " "))
- };
- return t.extend(t, {
- deparam: function(o) {
- var s, a, u = {};
- return o && i.test(o) && (s = o.split("&"),
- t.each(s, function(t) {
- var i = t.split("=")
- , o = r(i.shift())
- , s = r(i.join("="))
- , c = u;
- if (o) {
- for (var l = 0, p = (i = o.match(n)).length - 1; l < p; l++)
- c[i[l]] || (c[i[l]] = e.test(i[l + 1]) || "[]" === i[l + 1] ? [] : {}),
- c = c[i[l]];
- "[]" === (a = i.pop()) ? c.push(s) : c[a] = s
- }
- })),
- u
- }
- }),
- t
- }),
- define("can/route", ["can/util/library", "can/map", "can/list", "can/util/string/deparam"], function(t) {
- var e, n, i, r, o = /\:([\w\.]+)/g, s = /^(?:&[^=]+=[^&]*)+/, a = function(e) {
- var n = [];
- return t.each(e, function(e, i) {
- n.push(("className" === i ? "class" : i) + '="' + ("href" === i ? e : t.esc(e)) + '"')
- }),
- n.join(" ")
- }, u = function(t, e) {
- var n = 0
- , i = 0
- , r = {};
- for (var o in t.defaults)
- t.defaults[o] === e[o] && (r[o] = 1,
- n++);
- for (; i < t.names.length; i++) {
- if (!e.hasOwnProperty(t.names[i]))
- return -1;
- r[t.names[i]] || n++
- }
- return n
- }, c = window.location, l = function(t) {
- return (t + "").replace(/([.?*+\^$\[\]\\(){}|\-])/g, "\\$1")
- }, p = t.each, h = t.extend, d = function(e) {
- return e && "object" == typeof e ? (e = e instanceof t.Map ? e.attr() : t.isFunction(e.slice) ? e.slice() : t.extend({}, e),
- t.each(e, function(t, n) {
- e[n] = d(t)
- })) : void 0 !== e && null !== e && t.isFunction(e.toString) && (e = e.toString()),
- e
- }, f = function(t) {
- return t.replace(/\\/g, "")
- }, g = [], v = function(n, o, s, a) {
- r = 1,
- g.push(o),
- clearTimeout(e),
- e = setTimeout(function() {
- r = 0;
- var e = t.route.data.serialize()
- , n = t.route.param(e, !0);
- t.route._call("setURL", n, g),
- t.batch.trigger(m, "__url", [n, i]),
- i = n,
- g = []
- }, 10)
- }, m = t.extend({}, t.event);
- t.route = function(e, n) {
- var i = t.route._call("root");
- i.lastIndexOf("/") === i.length - 1 && 0 === e.indexOf("/") && (e = e.substr(1)),
- n = n || {};
- for (var r, s, a = [], u = "", c = o.lastIndex = 0, p = t.route._call("querySeparator"), h = t.route._call("matchSlashes"); r = o.exec(e); )
- a.push(r[1]),
- u += f(e.substring(c, o.lastIndex - r[0].length)),
- s = "\\" + (f(e.substr(o.lastIndex, 1)) || p + (h ? "" : "|/")),
- u += "([^" + s + "]" + (n[r[1]] ? "*" : "+") + ")",
- c = o.lastIndex;
- return u += e.substr(c).replace("\\", ""),
- t.route.routes[e] = {
- test: new RegExp("^" + u + "($|" + l(p) + ")"),
- route: e,
- names: a,
- defaults: n,
- length: e.split("/").length
- },
- t.route
- }
- ,
- h(t.route, {
- param: function(e, n) {
- var i, r, s = 0, a = e.route, c = 0;
- if (delete e.route,
- p(e, function() {
- c++
- }),
- p(t.route.routes, function(t, n) {
- if ((r = u(t, e)) > s && (i = t,
- s = r),
- r >= c)
- return !1
- }),
- t.route.routes[a] && u(t.route.routes[a], e) === s && (i = t.route.routes[a]),
- i) {
- var l, d = h({}, e), f = i.route.replace(o, function(t, n) {
- return delete d[n],
- e[n] === i.defaults[n] ? "" : encodeURIComponent(e[n])
- }).replace("\\", "");
- return p(i.defaults, function(t, e) {
- d[e] === t && delete d[e]
- }),
- l = t.param(d),
- n && t.route.attr("route", i.route),
- f + (l ? t.route._call("querySeparator") + l : "")
- }
- return t.isEmptyObject(e) ? "" : t.route._call("querySeparator") + t.param(e)
- },
- deparam: function(e) {
- var n = t.route._call("root");
- n.lastIndexOf("/") === n.length - 1 && 0 === e.indexOf("/") && (e = e.substr(1));
- var i = {
- length: -1
- }
- , r = t.route._call("querySeparator")
- , o = t.route._call("paramsMatcher");
- if (p(t.route.routes, function(t, n) {
- t.test.test(e) && t.length > i.length && (i = t)
- }),
- i.length > -1) {
- var s = e.match(i.test)
- , a = s.shift()
- , u = e.substr(a.length - (s[s.length - 1] === r ? 1 : 0))
- , c = u && o.test(u) ? t.deparam(u.slice(1)) : {};
- return c = h(!0, {}, i.defaults, c),
- p(s, function(t, e) {
- t && t !== r && (c[i.names[e]] = decodeURIComponent(t))
- }),
- c.route = i.route,
- c
- }
- return e.charAt(0) !== r && (e = r + e),
- o.test(e) ? t.deparam(e.slice(1)) : {}
- },
- data: new t.Map({}),
- map: function(e) {
- var n;
- n = e.prototype instanceof t.Map ? new e : e,
- t.route.data = n
- },
- routes: {},
- ready: function(e) {
- return !0 !== e && (t.route._setup(),
- (t.isBrowserWindow || t.isWebWorker) && t.route.setState()),
- t.route
- },
- url: function(e, n) {
- return n && (t.__observe(m, "__url"),
- e = t.extend({}, t.route.deparam(t.route._call("matchingPartOfURL")), e)),
- t.route._call("root") + t.route.param(e)
- },
- link: function(e, n, i, r) {
- return "<a " + a(h({
- href: t.route.url(n, r)
- }, i)) + ">" + e + "</a>"
- },
- current: function(e) {
- return t.__observe(m, "__url"),
- this._call("matchingPartOfURL") === t.route.param(e)
- },
- bindings: {
- hashchange: {
- paramsMatcher: s,
- querySeparator: "&",
- matchSlashes: !1,
- bind: function() {
- t.bind.call(window, "hashchange", b)
- },
- unbind: function() {
- t.unbind.call(window, "hashchange", b)
- },
- matchingPartOfURL: function() {
- return (t.route.location || c).href.split(/#!?/)[1] || ""
- },
- setURL: function(t) {
- return c.hash !== "#" + t && (c.hash = "!" + t),
- t
- },
- root: "#!"
- }
- },
- defaultBinding: "hashchange",
- currentBinding: null,
- _setup: function() {
- t.route.currentBinding || (t.route._call("bind"),
- t.route.bind("change", v),
- t.route.currentBinding = t.route.defaultBinding)
- },
- _teardown: function() {
- t.route.currentBinding && (t.route._call("unbind"),
- t.route.unbind("change", v),
- t.route.currentBinding = null),
- clearTimeout(e),
- r = 0
- },
- _call: function() {
- var e = t.makeArray(arguments)
- , n = e.shift()
- , i = t.route.bindings[t.route.currentBinding || t.route.defaultBinding]
- , r = i[n];
- return r.apply ? r.apply(i, e) : r
- }
- }),
- p(["bind", "unbind", "on", "off", "delegate", "undelegate", "removeAttr", "compute", "_get", "___get", "each"], function(e) {
- t.route[e] = function() {
- if (t.route.data[e])
- return t.route.data[e].apply(t.route.data, arguments)
- }
- }),
- t.route.attr = function(e, n) {
- var i, r = typeof e;
- return i = void 0 === n ? arguments : "string" !== r && "number" !== r ? [d(e), n] : [e, d(n)],
- t.route.data.attr.apply(t.route.data, i)
- }
- ,
- t.route.batch = t.batch;
- var b = t.route.setState = function() {
- var e = t.route._call("matchingPartOfURL")
- , o = n;
- n = t.route.deparam(e),
- r && e === i || (t.route.batch.start(),
- y(o, n, t.route.data),
- t.route.attr(n),
- t.route.batch.trigger(m, "__url", [e, i]),
- t.route.batch.stop())
- }
- , y = function(t, e, n) {
- for (var i in t)
- void 0 === e[i] ? n.removeAttr(i) : "[object Object]" === Object.prototype.toString.call(t[i]) && y(t[i], e[i], n.attr(i))
- };
- return t.route
- }),
- define("can/control", ["can/util/library", "can/construct"], function(t) {
- var e, n = function(e, n, i) {
- return t.bind.call(e, n, i),
- function() {
- t.unbind.call(e, n, i)
- }
- }, i = t.isFunction, r = t.extend, o = t.each, s = [].slice, a = /\{([^\}]+)\}/g, u = t.getObject("$.event.special", [t]) || {}, c = function(e, n, i, r) {
- return t.delegate.call(e, n, i, r),
- function() {
- t.undelegate.call(e, n, i, r)
- }
- }, l = function(e, i, r, o) {
- return o ? c(e, t.trim(o), i, r) : n(e, i, r)
- }, p = t.Control = t.Construct({
- setup: function() {
- if (t.Construct.setup.apply(this, arguments),
- t.Control) {
- var e, n = this;
- n.actions = {};
- for (e in n.prototype)
- n._isAction(e) && (n.actions[e] = n._action(e))
- }
- },
- _shifter: function(e, n) {
- var r = "string" == typeof n ? e[n] : n;
- return i(r) || (r = e[r]),
- function() {
- return e.called = n,
- r.apply(e, [this.nodeName ? t.$(this) : this].concat(s.call(arguments, 0)))
- }
- },
- _isAction: function(t) {
- var e = this.prototype[t]
- , n = typeof e;
- return "constructor" !== t && ("function" === n || "string" === n && i(this.prototype[e])) && !!(u[t] || h[t] || /[^\w]/.test(t))
- },
- _action: function(n, i) {
- if (a.lastIndex = 0,
- i || !a.test(n)) {
- var r = i ? t.sub(n, this._lookup(i)) : n;
- if (!r)
- return null;
- var o = t.isArray(r)
- , s = o ? r[1] : r
- , u = s.split(/\s+/g)
- , c = u.pop();
- return {
- processor: h[c] || e,
- parts: [s, u.join(" "), c],
- delegate: o ? r[0] : void 0
- }
- }
- },
- _lookup: function(t) {
- return [t, window]
- },
- processors: {},
- defaults: {}
- }, {
- setup: function(e, n) {
- var i, o = this.constructor, s = o.pluginName || o._fullName;
- return this.element = t.$(e),
- s && "can_control" !== s && this.element.addClass(s),
- (i = t.data(this.element, "controls")) || (i = [],
- t.data(this.element, "controls", i)),
- i.push(this),
- this.options = r({}, o.defaults, n),
- this.on(),
- [this.element, this.options]
- },
- on: function(e, n, i, r) {
- if (!e) {
- this.off();
- var o, s, a = this.constructor, u = this._bindings, c = a.actions, p = this.element, h = t.Control._shifter(this, "destroy");
- for (o in c)
- c.hasOwnProperty(o) && (s = c[o] || a._action(o, this.options, this)) && (u.control[o] = s.processor(s.delegate || p, s.parts[2], s.parts[1], o, this));
- return t.bind.call(p, "removed", h),
- u.user.push(function(e) {
- t.unbind.call(e, "removed", h)
- }),
- u.user.length
- }
- return "string" == typeof e && (r = i,
- i = n,
- n = e,
- e = this.element),
- void 0 === r && (r = i,
- i = n,
- n = null),
- "string" == typeof r && (r = t.Control._shifter(this, r)),
- this._bindings.user.push(l(e, i, r, n)),
- this._bindings.user.length
- },
- off: function() {
- var t = this.element[0]
- , e = this._bindings;
- e && (o(e.user || [], function(e) {
- e(t)
- }),
- o(e.control || {}, function(e) {
- e(t)
- })),
- this._bindings = {
- user: [],
- control: {}
- }
- },
- destroy: function() {
- if (null !== this.element) {
- var e, n = this.constructor, i = n.pluginName || n._fullName;
- this.off(),
- i && "can_control" !== i && this.element.removeClass(i),
- (e = t.data(this.element, "controls")).splice(t.inArray(this, e), 1),
- t.trigger(this, "destroyed"),
- this.element = null
- }
- }
- }), h = t.Control.processors;
- return e = function(e, n, i, r, o) {
- return l(e, n, t.Control._shifter(o, r), i)
- }
- ,
- o(["change", "click", "contextmenu", "dblclick", "keydown", "keyup", "keypress", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "reset", "resize", "scroll", "select", "submit", "focusin", "focusout", "mouseenter", "mouseleave", "touchstart", "touchmove", "touchcancel", "touchend", "touchleave", "inserted", "removed", "dragstart", "dragenter", "dragover", "dragleave", "drag", "drop", "dragend"], function(t) {
- h[t] = e
- }),
- p
- }),
- define("can/control/route", ["can/util/library", "can/route", "can/control"], function(t) {
- return t.Control.processors.route = function(e, n, i, r, o) {
- i = i || "",
- t.route.routes[i] || ("/" === i[0] && (i = i.substring(1)),
- t.route(i));
- var s, a = function(e, n, a) {
- if (t.route.attr("route") === i && (void 0 === e.batchNum || e.batchNum !== s)) {
- s = e.batchNum;
- var u = t.route.attr();
- delete u.route,
- t.isFunction(o[r]) ? o[r](u) : o[o[r]](u)
- }
- };
- return t.route.bind("change", a),
- function() {
- t.route.unbind("change", a)
- }
- }
- ,
- t
- }),
- define("can/model", ["can/util/library", "can/map", "can/list"], function(t) {
- var e = function(e, n, i) {
- var r = new t.Deferred;
- return e.then(function() {
- var e = t.makeArray(arguments)
- , o = !0;
- try {
- e[0] = i.apply(n, e)
- } catch (t) {
- o = !1,
- r.rejectWith(r, [t].concat(e))
- }
- o && r.resolveWith(r, e)
- }, function() {
- r.rejectWith(this, arguments)
- }),
- "function" == typeof e.abort && (r.abort = function() {
- return e.abort()
- }
- ),
- r
- }
- , n = 0
- , i = function(e) {
- return t.__observe(e, e.constructor.id),
- e.___get(e.constructor.id)
- }
- , r = function(e, n, i, r, o, s) {
- var a = {};
- if ("string" == typeof e) {
- var u = e.split(/\s+/);
- a.url = u.pop(),
- u.length && (a.type = u.pop())
- } else
- t.extend(a, e);
- return a.data = "object" != typeof n || t.isArray(n) ? n : t.extend(a.data || {}, n),
- a.url = t.sub(a.url, a.data, !0),
- t.ajax(t.extend({
- type: i || "post",
- dataType: r || "json",
- success: o,
- error: s
- }, a))
- }
- , o = function(n, r, o, s, a) {
- var u;
- t.isArray(n) ? (u = n[1],
- n = n[0]) : u = n.serialize(),
- u = [u];
- var c, l, p = n.constructor;
- return "update" !== r && "destroy" !== r || u.unshift(i(n)),
- l = p[r].apply(p, u),
- c = e(l, n, function(t) {
- return n[a || r + "d"](t, l),
- n
- }),
- l.abort && (c.abort = function() {
- l.abort()
- }
- ),
- c.then(o, s),
- c
- }
- , s = {
- models: function(e, n, i) {
- if (t.Model._reqs++,
- e) {
- if (e instanceof this.List)
- return e;
- var r = this
- , o = []
- , s = r.List || f
- , a = n instanceof t.List ? n : new s
- , u = e instanceof f ? e.serialize() : e;
- if ((u = r.parseModels(u, i)).data && (e = u,
- u = u.data),
- void 0 === u || !t.isArray(u))
- throw new Error("Could not get any raw data while converting using .models");
- return a.length && a.splice(0),
- t.each(u, function(t) {
- o.push(r.model(t, i))
- }),
- a.push.apply(a, o),
- t.isArray(e) || t.each(e, function(t, e) {
- "data" !== e && a.attr(e, t)
- }),
- setTimeout(t.proxy(this._clean, this), 1),
- a
- }
- },
- model: function(e, n, i) {
- if (e) {
- var r = (e = "function" == typeof e.serialize ? e.serialize() : this.parseModel(e, i))[this.id];
- return (r || 0 === r) && this.store[r] && (n = this.store[r]),
- n && t.isFunction(n.attr) ? n.attr(e, this.removeAttr || !1) : new this(e)
- }
- }
- }
- , a = {
- parseModel: function(e) {
- return function(n) {
- return e ? t.getObject(e, n) : n
- }
- },
- parseModels: function(e) {
- return function(n) {
- if (t.isArray(n))
- return n;
- e = e || "data";
- var i = t.getObject(e, n);
- if (!t.isArray(i))
- throw new Error("Could not get any raw data while converting using .models");
- return i
- }
- }
- }
- , u = {
- create: {
- url: "_shortName",
- type: "post"
- },
- update: {
- data: function(e, n) {
- n = n || {};
- var i = this.id;
- return n[i] && n[i] !== e && (n["new" + t.capitalize(e)] = n[i],
- delete n[i]),
- n[i] = e,
- n
- },
- type: "put"
- },
- destroy: {
- type: "delete",
- data: function(t, e) {
- return e = e || {},
- e.id = e[this.id] = t,
- e
- }
- },
- findAll: {
- url: "_shortName"
- },
- findOne: {}
- }
- , c = function(t, e) {
- return function(n) {
- return n = t.data ? t.data.apply(this, arguments) : n,
- r(e || this[t.url || "_url"], n, t.type || "get")
- }
- }
- , l = function(t, e) {
- if (t.resource) {
- var n = t.resource.replace(/\/+$/, "");
- return "findAll" === e || "create" === e ? n : n + "/{" + t.id + "}"
- }
- };
- t.Model = t.Map.extend({
- fullName: "can.Model",
- _reqs: 0,
- setup: function(e, i, r, o) {
- if ("string" != typeof i && (o = r,
- r = i),
- o || (o = r),
- this.store = {},
- t.Map.setup.apply(this, arguments),
- t.Model) {
- r && r.List ? (this.List = r.List,
- this.List.Map = this) : this.List = e.List.extend({
- Map: this
- }, {});
- var p = this
- , h = t.proxy(this._clean, p);
- t.each(u, function(n, i) {
- if (r && r[i] && ("string" == typeof r[i] || "object" == typeof r[i]) ? p[i] = c(n, r[i]) : r && r.resource && !t.isFunction(r[i]) && (p[i] = c(n, l(p, i))),
- p["make" + t.capitalize(i)]) {
- var o = p["make" + t.capitalize(i)](p[i]);
- t.Construct._overwrite(p, e, i, function() {
- t.Model._reqs++;
- var e = o.apply(this, arguments)
- , n = e.then(h, h);
- return n.abort = e.abort,
- n
- })
- }
- });
- var d = {};
- t.each(s, function(n, i) {
- var o = "parse" + t.capitalize(i)
- , s = r && r[i] || p[i];
- "string" == typeof s ? (p[o] = s,
- t.Construct._overwrite(p, e, i, n)) : r && r[i] && (d[o] = !0)
- }),
- t.each(a, function(n, i) {
- var o = r && r[i] || p[i];
- if ("string" == typeof o)
- t.Construct._overwrite(p, e, i, n(o));
- else if (!(r && t.isFunction(r[i]) || p[i])) {
- var s = n();
- s.useModelConverter = d[i],
- t.Construct._overwrite(p, e, i, s)
- }
- }),
- "can.Model" !== p.fullName && p.fullName || (p.fullName = "Model" + ++n),
- t.Model._reqs = 0,
- this._url = this._shortName + "/{" + this.id + "}"
- }
- },
- _ajax: c,
- _makeRequest: o,
- _clean: function() {
- if (!--t.Model._reqs)
- for (var e in this.store)
- this.store[e]._bindings || delete this.store[e];
- return arguments[0]
- },
- models: s.models,
- model: s.model
- }, {
- setup: function(e) {
- var n = e && e[this.constructor.id];
- t.Model._reqs && null != n && (this.constructor.store[n] = this),
- t.Map.prototype.setup.apply(this, arguments)
- },
- isNew: function() {
- var t = i(this);
- return !(t || 0 === t)
- },
- save: function(t, e) {
- return o(this, this.isNew() ? "create" : "update", t, e)
- },
- destroy: function(e, n) {
- if (this.isNew()) {
- var i = this
- , r = t.Deferred();
- return r.then(e, n),
- r.done(function(t) {
- i.destroyed(t)
- }).resolve(i)
- }
- return o(this, "destroy", e, n, "destroyed")
- },
- _bindsetup: function() {
- var e = this.___get(this.constructor.id);
- return null != e && (this.constructor.store[e] = this),
- t.Map.prototype._bindsetup.apply(this, arguments)
- },
- _bindteardown: function() {
- return delete this.constructor.store[i(this)],
- t.Map.prototype._bindteardown.apply(this, arguments)
- },
- ___set: function(e, n) {
- t.Map.prototype.___set.call(this, e, n),
- e === this.constructor.id && this._bindings && (this.constructor.store[i(this)] = this)
- }
- });
- var p = function(t) {
- return function(e, n, i) {
- return this[t](e, null, i)
- }
- }
- , h = function(t) {
- return this.parseModel.useModelConverter ? this.model(t) : this.parseModel(t)
- }
- , d = {
- makeFindAll: p("models"),
- makeFindOne: p("model"),
- makeCreate: h,
- makeUpdate: h,
- makeDestroy: h
- };
- t.each(d, function(n, i) {
- t.Model[i] = function(i) {
- return function() {
- var r = t.makeArray(arguments)
- , o = t.isFunction(r[1]) ? r.splice(0, 1) : r.splice(0, 2)
- , s = e(i.apply(this, o), this, n);
- return s.then(r[0], r[1]),
- s
- }
- }
- }),
- t.each(["created", "updated", "destroyed"], function(e) {
- t.Model.prototype[e] = function(n) {
- var i = this.constructor;
- n && "object" == typeof n && this.attr(t.isFunction(n.attr) ? n.attr() : n),
- t.dispatch.call(this, {
- type: e,
- target: this
- }, []),
- t.dispatch.call(i, e, [this])
- }
- });
- var f = t.Model.List = t.List.extend({
- _bubbleRule: function(e, n) {
- var i = t.List._bubbleRule(e, n);
- return i.push("destroyed"),
- i
- }
- }, {
- setup: function(e) {
- t.isPlainObject(e) && !t.isArray(e) ? (t.List.prototype.setup.apply(this),
- this.replace(t.isDeferred(e) ? e : this.constructor.Map.findAll(e))) : t.List.prototype.setup.apply(this, arguments),
- this.bind("destroyed", t.proxy(this._destroyed, this))
- },
- _destroyed: function(t, e) {
- if (/\w+/.test(e))
- for (var n; (n = this.indexOf(t.target)) > -1; )
- this.splice(n, 1)
- }
- });
- return t.Model
- }),
- define("can/read", ["can/util/library"], function(t) {
- var e = function(t, n, r) {
- for (var o, s, a = {
- foundObservable: !1
- }, u = i(t, 0, n, r = r || {}, a), c = n.length, l = 0; l < c; ) {
- s = u;
- for (var p = 0, h = e.propertyReaders.length; p < h; p++) {
- var d = e.propertyReaders[p];
- if (d.test(u)) {
- u = d.read(u, n[l], l, r, a);
- break
- }
- }
- if (l += 1,
- u = i(u, l, n, r, a, s),
- o = typeof u,
- l < n.length && (null === u || "function" !== o && "object" !== o))
- return r.earlyExit && r.earlyExit(s, l - 1, u),
- {
- value: void 0,
- parent: s
- }
- }
- return void 0 === u && r.earlyExit && r.earlyExit(s, l - 1),
- {
- value: u,
- parent: s
- }
- }
- , n = function(t, e) {
- var n = e[t - 1];
- return n && n.at
- }
- , i = function(t, n, i, r, o, s) {
- var a;
- do {
- a = !1;
- for (var u = 0, c = e.valueReaders.length; u < c; u++)
- e.valueReaders[u].test(t, n, i, r) && (t = e.valueReaders[u].read(t, n, i, r, o, s))
- } while (a);return t
- };
- e.valueReaders = [{
- name: "compute",
- test: function(t, e, i, r) {
- return t && t.isComputed && !n(e, i)
- },
- read: function(e, n, i, r, o) {
- return r.isArgument && n === i.length ? e : (!o.foundObservable && r.foundObservable && (r.foundObservable(e, n),
- o.foundObservable = !0),
- e instanceof t.Compute ? e.get() : e())
- }
- }, {
- name: "function",
- test: function(e, n, i, r) {
- return !("function" != typeof e || e.isComputed || t.Construct && e.prototype instanceof t.Construct || t.route && e === t.route)
- },
- read: function(e, i, r, o, s, a) {
- return n(i, r) ? i === r.length ? t.proxy(e, a) : e : o.callMethodsOnObservables && t.isMapLike(a) ? e.apply(a, o.args || []) : o.isArgument && i === r.length ? !1 !== o.proxyMethods ? t.proxy(e, a) : e : e.apply(a, o.args || [])
- }
- }],
- e.propertyReaders = [{
- name: "map",
- test: t.isMapLike,
- read: function(t, e, n, i, r) {
- !r.foundObservable && i.foundObservable && (i.foundObservable(t, n),
- r.foundObservable = !0);
- var o = t[e.key];
- return "function" != typeof o || t.constructor.prototype[e.key] !== o || o.isComputed ? t.attr(e.key) : o
- }
- }, {
- name: "promise",
- test: function(e) {
- return t.isPromise(e)
- },
- read: function(e, n, i, r, o) {
- !o.foundObservable && r.foundObservable && (r.foundObservable(e, i),
- o.foundObservable = !0);
- var s = e.__observeData;
- return e.__observeData || (s = e.__observeData = {
- isPending: !0,
- state: "pending",
- isResolved: !1,
- isRejected: !1,
- value: void 0,
- reason: void 0
- },
- t.cid(s),
- t.simpleExtend(s, t.event),
- e.then(function(t) {
- s.isPending = !1,
- s.isResolved = !0,
- s.value = t,
- s.state = "resolved",
- s.dispatch("state", ["resolved", "pending"])
- }, function(t) {
- s.isPending = !1,
- s.isRejected = !0,
- s.reason = t,
- s.state = "rejected",
- s.dispatch("state", ["rejected", "pending"])
- })),
- t.__observe(s, "state"),
- n.key in s ? s[n.key] : e[n.key]
- }
- }, {
- name: "object",
- test: function() {
- return !0
- },
- read: function(t, e) {
- if (null != t)
- return e.key in t ? t[e.key] : e.at && r[e.key] && "@" + e.key in t ? (e.at = !1,
- t["@" + e.key]) : void 0
- }
- }];
- var r = {
- index: !0,
- key: !0,
- event: !0,
- element: !0,
- viewModel: !0
- };
- return e.write = function(e, n, i, r) {
- return r = r || {},
- t.isMapLike(e) ? !r.isArgument && e._data && e._data[n] && e._data[n].isComputed ? e._data[n](i) : e.attr(n, i) : e[n] && e[n].isComputed ? e[n](i) : void ("object" == typeof e && (e[n] = i))
- }
- ,
- e.reads = function(t) {
- var e = []
- , n = 0
- , i = !1;
- "@" === t.charAt(0) && (n = 1,
- i = !0);
- for (var r = "", o = n; o < t.length; o++) {
- var s = t.charAt(o);
- "." === s || "@" === s ? "\\" !== t.charAt(o - 1) ? (e.push({
- key: r,
- at: i
- }),
- i = "@" === s,
- r = "") : r = r.substr(0, r.length - 1) + "." : r += s
- }
- return e.push({
- key: r,
- at: i
- }),
- e
- }
- ,
- e
- }),
- define("can/get_value_and_bind", ["can/util/library"], function(t) {
- function e(e, n, i) {
- this.newObserved = {},
- this.oldObserved = null,
- this.func = e,
- this.context = n,
- this.compute = i,
- this.onDependencyChange = t.proxy(this.onDependencyChange, this),
- this.depth = null,
- this.childDepths = {},
- this.ignore = 0,
- this.inBatch = !1,
- i.observedInfo = this
- }
- t.simpleExtend(e.prototype, {
- getDepth: function() {
- return null !== this.depth ? this.depth : this.depth = this._getDepth()
- },
- _getDepth: function() {
- var t = 0
- , e = this.childDepths;
- for (var n in e)
- e[n] > t && (t = e[n]);
- return t + 1
- },
- addEdge: function(t) {
- t.obj.bind(t.event, this.onDependencyChange),
- t.obj.observedInfo && (this.childDepths[t.obj._cid] = t.obj.observedInfo.getDepth(),
- this.depth = null)
- },
- removeEdge: function(t) {
- t.obj.unbind(t.event, this.onDependencyChange),
- t.obj.observedInfo && (delete this.childDepths[t.obj._cid],
- this.depth = null)
- },
- onDependencyChange: function(t) {
- this.bound && (void 0 !== t.batchNum ? t.batchNum !== this.batchNum && (e.registerUpdate(this),
- this.batchNum = t.batchNum) : this.updateCompute(t.batchNum))
- },
- updateCompute: function(t) {
- var e = this.value;
- this.getValueAndBind(),
- this.compute.updater(this.value, e, t)
- },
- getValueAndBind: function() {
- this.bound = !0,
- this.oldObserved = this.newObserved || {},
- this.ignore = 0,
- this.newObserved = {},
- o.push(this),
- this.value = this.func.call(this.context),
- o.pop(),
- this.updateBindings()
- },
- updateBindings: function() {
- var t, e, n = this.newObserved, i = this.oldObserved;
- for (t in n)
- e = n[t],
- i[t] ? i[t] = null : this.addEdge(e);
- for (t in i)
- (e = i[t]) && this.removeEdge(e)
- },
- teardown: function() {
- this.bound = !1;
- for (var t in this.newObserved) {
- var e = this.newObserved[t];
- this.removeEdge(e)
- }
- this.newObserved = {}
- }
- });
- var n = []
- , i = 1 / 0
- , r = 0;
- e.registerUpdate = function(t, e) {
- var o = t.getDepth() - 1;
- i = Math.min(o, i),
- r = Math.max(r, o);
- var s = n[o];
- s || (s = n[o] = []),
- s.push(t)
- }
- ,
- e.batchEnd = function(t) {
- for (var e; i <= r; ) {
- var o = n[i];
- o && (e = o.pop()) ? e.updateCompute(t) : i++
- }
- n = [],
- i = 1 / 0,
- r = 0
- }
- ;
- var o = [];
- return t.__observe = function(t, e) {
- var n = o[o.length - 1];
- if (n) {
- var i = e + ""
- , r = t._cid + "|" + i;
- n.traps ? n.traps.push({
- obj: t,
- event: i,
- name: r
- }) : n.ignore || n.newObserved[r] || (n.newObserved[r] = {
- obj: t,
- event: i
- })
- }
- }
- ,
- t.__reading = t.__observe,
- t.__trapObserves = function() {
- if (o.length) {
- var t = o[o.length - 1]
- , e = t.traps = [];
- return function() {
- return t.traps = null,
- e
- }
- }
- return function() {
- return []
- }
- }
- ,
- t.__observes = function(t) {
- var e = o[o.length - 1];
- if (e)
- for (var n = 0, i = t.length; n < i; n++) {
- var r = t[n]
- , s = r.name;
- e.newObserved[s] || (e.newObserved[s] = r)
- }
- }
- ,
- t.__isRecordingObserves = function() {
- var t = o.length;
- return t && 0 === o[t - 1].ignore
- }
- ,
- t.__notObserve = function(t) {
- return function() {
- if (o.length) {
- var e = o[o.length - 1];
- e.ignore++;
- var n = t.apply(this, arguments);
- return e.ignore--,
- n
- }
- return t.apply(this, arguments)
- }
- }
- ,
- t.batch._onDispatchedEvents = e.batchEnd,
- e
- }),
- define("can/proto_compute", ["can/util/library", "can/util/bind", "can/read", "can/get_value_and_bind", "can/util/batch"], function(t, e, n, i) {
- t.Compute = function(e, n, i, r) {
- t.cid(this, "compute");
- for (var o = [], s = 0, a = arguments.length; s < a; s++)
- o[s] = arguments[s];
- var u = typeof o[1];
- "function" == typeof o[0] ? this._setupGetterSetterFn(o[0], o[1], o[2], o[3]) : o[1] ? "string" === u ? this._setupProperty(o[0], o[1], o[2]) : "function" === u ? this._setupSetter(o[0], o[1], o[2]) : o[1] && o[1].fn ? this._setupAsyncCompute(o[0], o[1]) : this._setupSettings(o[0], o[1]) : this._setupSimpleValue(o[0]),
- this._args = o,
- this.isComputed = !0
- }
- ,
- t.simpleExtend(t.Compute.prototype, {
- _setupGetterSetterFn: function(e, n, i) {
- this._set = n ? t.proxy(e, n) : e,
- this._get = n ? t.proxy(e, n) : e,
- this._canObserve = !1 !== i;
- var r = o(this, e, n || this);
- this._on = r.on,
- this._off = r.off
- },
- _setupProperty: function(e, n, i) {
- var r, o = this;
- t.isMapLike(e) ? (r = function(t, e, n) {
- o.updater(e, n, t.batchNum)
- }
- ,
- this.hasDependencies = !0,
- this._get = function() {
- return e.attr(n)
- }
- ,
- this._set = function(t) {
- e.attr(n, t)
- }
- ) : (r = function() {
- o.updater(o._get(), o.value)
- }
- ,
- this._get = function() {
- return t.getObject(n, [e])
- }
- ,
- this._set = function(i) {
- var r = n.split(".")
- , o = r.pop();
- t.getObject(r.join("."), [e])[o] = i
- }
- ),
- this._on = function(o) {
- t.bind.call(e, i || n, r),
- this.value = this._get()
- }
- ,
- this._off = function() {
- return t.unbind.call(e, i || n, r)
- }
- },
- _setupSetter: function(e, n, i) {
- this.value = e,
- this._set = n,
- t.simpleExtend(this, i)
- },
- _setupSettings: function(t, e) {
- if (this.value = t,
- this._set = e.set || this._set,
- this._get = e.get || this._get,
- !e.__selfUpdater) {
- var n = this
- , i = this.updater;
- this.updater = function() {
- i.call(n, n._get(), n.value)
- }
- }
- this._on = e.on ? e.on : this._on,
- this._off = e.off ? e.off : this._off
- },
- _setupAsyncCompute: function(e, n) {
- var i = this;
- this.value = e,
- this._setUpdates = !0,
- this.lastSetValue = new t.Compute(e),
- this._set = function(t) {
- return t === i.lastSetValue.get() ? this.value : i.lastSetValue.set(t)
- }
- ,
- this._get = function() {
- return s.call(n.context, i.lastSetValue.get())
- }
- ;
- var r, s = n.fn;
- if (0 === s.length)
- r = o(this, s, n.context);
- else if (1 === s.length)
- r = o(this, function() {
- return s.call(n.context, i.lastSetValue.get())
- }, n);
- else {
- var a = this.updater
- , u = function(t) {
- a.call(i, t, i.value)
- };
- this.updater = function(t) {
- a.call(i, t, i.value)
- }
- ,
- r = o(this, function() {
- var t = s.call(n.context, i.lastSetValue.get(), u);
- return void 0 !== t ? t : this.value
- }, this)
- }
- this._on = r.on,
- this._off = r.off
- },
- _setupSimpleValue: function(t) {
- this.value = t
- },
- _bindsetup: t.__notObserve(function() {
- this.bound = !0,
- this._on(this.updater)
- }),
- _bindteardown: function() {
- this._off(this.updater),
- this.bound = !1
- },
- bind: t.bindAndSetup,
- unbind: t.unbindAndTeardown,
- clone: function(e) {
- return e && "function" == typeof this._args[0] ? this._args[1] = e : e && (this._args[2] = e),
- new t.Compute(this._args[0],this._args[1],this._args[2],this._args[3])
- },
- _on: t.k,
- _off: t.k,
- get: function() {
- return t.__isRecordingObserves() && !1 !== this._canObserve && (t.__observe(this, "change"),
- this.bound || t.Compute.temporarilyBind(this)),
- this.bound ? this.value : this._get()
- },
- _get: function() {
- return this.value
- },
- set: function(t) {
- var e = this.value
- , n = this._set(t, e);
- return this._setUpdates ? this.value : this.hasDependencies ? this._get() : (this.value = void 0 === n ? this._get() : n,
- r(this, this.value, e),
- this.value)
- },
- _set: function(t) {
- return this.value = t
- },
- updater: function(t, e, n) {
- this.value = t,
- r(this, t, e, n)
- },
- toFunction: function() {
- return t.proxy(this._computeFn, this)
- },
- _computeFn: function(t) {
- return arguments.length ? this.set(t) : this.get()
- }
- });
- var r = function(e, n, i, r) {
- n !== i && !(n !== n && i !== i) && t.batch.trigger(e, {
- type: "change",
- batchNum: r
- }, [n, i])
- }
- , o = function(e, n, r) {
- var o = new i(n,r,e);
- return {
- on: function() {
- o.getValueAndBind(),
- e.value = o.value,
- e.hasDependencies = !t.isEmptyObject(o.newObserved)
- },
- off: function() {
- o.teardown()
- }
- }
- };
- t.Compute.temporarilyBind = function(e) {
- var n = e.computeInstance || e;
- n.bind("change", t.k),
- s || (s = [],
- setTimeout(a, 10)),
- s.push(n)
- }
- ;
- var s, a = function() {
- for (var e = 0, n = s.length; e < n; e++)
- s[e].unbind("change", t.k);
- s = null
- };
- return t.Compute.async = function(e, n, i) {
- return new t.Compute(e,{
- fn: n,
- context: i
- })
- }
- ,
- t.Compute.truthy = function(e) {
- return new t.Compute(function() {
- var t = e.get();
- return "function" == typeof t && (t = t.get()),
- !!t
- }
- )
- }
- ,
- t.Compute.read = n,
- t.Compute.set = n.write,
- t.Compute
- }),
- define("can/compute", ["can/util/library", "can/util/bind", "can/util/batch", "can/proto_compute"], function(t, e) {
- return t.compute = function(e, n, i, r) {
- var o = new t.Compute(e,n,i,r)
- , s = o.bind
- , a = o.unbind
- , u = function(t) {
- return arguments.length ? o.set(t) : o.get()
- }
- , c = "__handler" + t.cid(u, "compute");
- return u.bind = function(t, e) {
- var n = e && e[c];
- return e && !n && (n = e[c] = function() {
- e.apply(u, arguments)
- }
- ),
- s.call(o, t, n)
- }
- ,
- u.unbind = function(t, e) {
- var n = e && e[c];
- return n ? (delete e[c],
- o.unbind(t, n)) : a.apply(o, arguments)
- }
- ,
- u.isComputed = o.isComputed,
- u.clone = function(i) {
- return "function" == typeof e && (n = i),
- t.compute(e, n, i, r)
- }
- ,
- u.computeInstance = o,
- u
- }
- ,
- t.compute.truthy = function(e) {
- return t.compute(function() {
- var t = e();
- return "function" == typeof t && (t = t()),
- !!t
- })
- }
- ,
- t.compute.async = function(e, n, i) {
- return t.compute(e, {
- fn: n,
- context: i
- })
- }
- ,
- t.compute.read = t.Compute.read,
- t.compute.set = t.Compute.set,
- t.compute.temporarilyBind = t.Compute.temporarilyBind,
- t.compute
- }),
- define("can/map/define", ["can/util/library", "can/map_helpers", "can/map", "can/compute"], function(t, e) {
- if (!t.define) {
- var n = t.define = {}
- , i = function(t, e, n) {
- var i, r;
- if (n) {
- if (i = n[e],
- r = n["*"],
- i && void 0 !== i[t])
- return i[t];
- if (r && void 0 !== r[t])
- return r[t]
- }
- };
- e.define = function(e) {
- var i = e.prototype.define;
- e.defaultGenerators = {};
- for (var r in i) {
- var o = i[r].type;
- "string" == typeof o && "object" == typeof n.types[o] && (delete i[r].type,
- t.extend(i[r], n.types[o])),
- "value"in i[r] && ("function" == typeof i[r].value ? e.defaultGenerators[r] = i[r].value : e.defaults[r] = i[r].value),
- "function" == typeof i[r].Value && function(t) {
- e.defaultGenerators[r] = function() {
- return new t
- }
- }(i[r].Value)
- }
- }
- ;
- var r = t.Map.prototype._setupDefaults;
- t.Map.prototype._setupDefaults = function(t) {
- var e = r.call(this)
- , n = {}
- , i = this.constructor
- , o = this._get;
- this._get = function(t) {
- var i = -1 !== t.indexOf(".") ? t.substr(0, t.indexOf(".")) : t;
- return i in e && !(i in n) && (this.attr(i, e[i]),
- n[i] = !0),
- o.apply(this, arguments)
- }
- ;
- for (var s in i.defaultGenerators)
- t && s in t || (e[s] = i.defaultGenerators[s].call(this));
- return delete this._get,
- e
- }
- ;
- var o = t.Map.prototype
- , s = o.__set;
- o.__set = function(e, n, r, o, a) {
- var u = function(n) {
- return !1 !== (a && a.call(c, n)) && t.trigger(c, "error", [e, n], !0),
- !1
- }
- , c = this
- , l = i("set", e, this.define)
- , p = i("get", e, this.define);
- if (l) {
- t.batch.start();
- var h = !1
- , d = l.call(this, n, function(t) {
- p ? c[e](t) : s.call(c, e, t, r, o, u),
- h = !0
- }, u, p ? this._computedAttrs[e].compute.computeInstance.lastSetValue.get() : r);
- return p ? (void 0 !== d && !h && l.length >= 1 && this._computedAttrs[e].compute(d),
- void t.batch.stop()) : void 0 === d && !h && l.length >= 1 ? void t.batch.stop() : (h || s.call(c, e, 0 === l.length && void 0 === d ? n : d, r, o, u),
- t.batch.stop(),
- this)
- }
- return s.call(c, e, n, r, o, u),
- this
- }
- ,
- n.types = {
- date: function(t) {
- var e = typeof t;
- return "string" === e ? (t = Date.parse(t),
- isNaN(t) ? null : new Date(t)) : "number" === e ? new Date(t) : t
- },
- number: function(t) {
- return null == t ? t : +t
- },
- boolean: function(t) {
- return !("false" === t || "0" === t || !t)
- },
- htmlbool: function(t) {
- return "string" == typeof t || !!t
- },
- "*": function(t) {
- return t
- },
- string: function(t) {
- return null == t ? t : "" + t
- },
- compute: {
- set: function(t, e, n, i) {
- return t.isComputed ? t : i && i.isComputed ? (i(t),
- i) : t
- },
- get: function(t) {
- return t && t.isComputed ? t() : t
- }
- }
- };
- var a = o.__type;
- o.__type = function(e, r) {
- var o = i("type", r, this.define)
- , s = i("Type", r, this.define)
- , u = e;
- return "string" == typeof o && (o = n.types[o]),
- o || s ? (o && (u = o.call(this, u, r)),
- !s || u instanceof s || (u = new s(u)),
- u) : (t.isPlainObject(u) && u.define && (u = t.Map.extend(u),
- u = new u),
- a.call(this, u, r))
- }
- ;
- var u = o.__remove;
- o.__remove = function(e, n) {
- var r, o = i("remove", e, this.define);
- return o ? (t.batch.start(),
- !1 === (r = o.call(this, n)) ? void t.batch.stop() : (r = u.call(this, e, n),
- t.batch.stop(),
- r)) : u.call(this, e, n)
- }
- ;
- var c = o._setupComputedProperties;
- o._setupComputedProperties = function() {
- c.apply(this, arguments);
- for (var n in this.define) {
- var i = this.define[n].get;
- i && e.addComputedAttr(this, n, t.compute.async(void 0, i, this))
- }
- }
- ;
- var l = o.___serialize;
- o.___serialize = function(t, e) {
- return p(this, t, e)
- }
- ;
- var p = function(t, e, n) {
- var r = "*" !== e && i("serialize", e, t.define);
- return void 0 === r ? l.call(t, e, n) : !1 !== r ? "function" == typeof r ? r.call(t, n, e) : l.call(t, e, n) : void 0
- }
- , h = o.serialize;
- return o.serialize = function(t) {
- var e = h.apply(this, arguments);
- if (t)
- return e;
- var n;
- for (var i in this.define)
- i in e || this.define && this.define[i] && this.define[i].serialize && void 0 !== (n = p(this, i, this.attr(i))) && (e[i] = n);
- return e
- }
- ,
- t.define
- }
- }),
- define("can/view/compute_data", ["can/util/library", "can/compute", "can/get_value_and_bind"], function(t, e, n) {
- var i = function(e) {
- return e.reads && 1 === e.reads.length && e.root instanceof t.Map && !t.isFunction(e.root[e.reads[0].key])
- }
- , r = function(t, e, n) {
- var i = e.root
- , r = e.reads[0].key;
- i.bind(r, n),
- t.value = e.initialValue
- }
- , o = function(t, e) {
- t.root.unbind(t.reads[0].key, e)
- }
- , s = function(e, n, i, r, o) {
- if (!(arguments.length > 4)) {
- if (r.root)
- return t.compute.read(r.root, r.reads, i).value;
- var s = e.read(n, i);
- return r.scope = s.scope,
- r.initialValue = s.value,
- r.reads = s.reads,
- r.root = s.rootObserve,
- r.setRoot = s.setRoot,
- s.value
- }
- var a = r.root || r.setRoot;
- if (a)
- if (a.isComputed)
- a(o);
- else if (r.reads.length) {
- var u = r.reads.length - 1
- , c = r.reads.length ? t.compute.read(a, r.reads.slice(0, u)).value : a;
- t.compute.set(c, r.reads[u].key, o, i)
- }
- };
- return function(e, a, u) {
- u = u || {
- args: []
- };
- var c = {}
- , l = function(t) {
- return arguments.length ? s(e, a, u, c, t) : s(e, a, u, c)
- }
- , p = function(t, e, n) {
- "function" != typeof e ? d.computeInstance.updater(e, n, t.batchNum) : (o(c, p),
- f.getValueAndBind(),
- h = !1,
- d.computeInstance.updater(f.value, n, t.batchNum))
- }
- , h = !1
- , d = t.compute(void 0, {
- on: function() {
- f.getValueAndBind(),
- i(c) && (r(f, c, p),
- f.teardown(),
- f.newObserved = {},
- h = !0),
- d.computeInstance.value = f.value,
- d.computeInstance.hasDependencies = h || !t.isEmptyObject(f.newObserved)
- },
- off: function() {
- h ? o(c, p) : f.teardown()
- },
- set: l,
- get: l,
- __selfUpdater: !0
- })
- , f = new n(l,null,d.computeInstance);
- return c.compute = d,
- c
- }
- }),
- define("can/view", ["can/util/library"], function(t) {
- var e = t.isFunction
- , n = t.makeArray
- , i = 1
- , r = function(t) {
- var e = function() {
- return c.frag(t.apply(this, arguments))
- };
- return e.render = function() {
- return t.apply(t, arguments)
- }
- ,
- e
- }
- , o = function(t, e) {
- if (!t.length)
- throw new Error("can.view: No template or empty template:" + e)
- }
- , s = function(n, i) {
- if (e(n))
- return t.Deferred().resolve(n);
- var r, s, a, u = "string" == typeof n ? n : n.url, l = n.engine && "." + n.engine || u.match(/\.[\w\d]+$/);
- if (u.match(/^#/) && (u = u.substr(1)),
- (s = document.getElementById(u)) && (l = "." + s.type.match(/\/(x\-)?(.+)/)[2]),
- l || c.cached[u] || (u += l = c.ext),
- t.isArray(l) && (l = l[0]),
- a = c.toId(u),
- u.match(/^\/\//) && (u = u.substr(2),
- u = window.steal ? steal.config().root.mapJoin("" + steal.id(u)) : u),
- window.require && require.toUrl && (u = require.toUrl(u)),
- r = c.types[l],
- c.cached[a])
- return c.cached[a];
- if (s)
- return c.registerView(a, s.innerHTML, r);
- var p = new t.Deferred;
- return t.ajax({
- async: i,
- url: u,
- dataType: "text",
- error: function(t) {
- o("", u),
- p.reject(t)
- },
- success: function(t) {
- o(t, u),
- c.registerView(a, t, r, p)
- }
- }),
- p
- }
- , a = function(e) {
- var n = [];
- if (t.isDeferred(e))
- return [e];
- for (var i in e)
- t.isDeferred(e[i]) && n.push(e[i]);
- return n
- }
- , u = function(e) {
- return t.isArray(e) && "success" === e[1] ? e[0] : e
- }
- , c = t.view = t.template = function(t, n, i, r) {
- return e(i) && (r = i,
- i = void 0),
- c.renderAs("fragment", t, n, i, r)
- }
- ;
- return t.extend(c, {
- frag: function(t, e) {
- return c.hookup(c.fragment(t), e)
- },
- fragment: function(e) {
- if ("string" != typeof e && 11 === e.nodeType)
- return e;
- var n = t.buildFragment(e, document.body);
- return n.childNodes.length || n.appendChild(document.createTextNode("")),
- n
- },
- toId: function(e) {
- return t.map(e.toString().split(/\/|\./g), function(t) {
- if (t)
- return t
- }).join("_")
- },
- toStr: function(t) {
- return null == t ? "" : "" + t
- },
- hookup: function(e, n) {
- var i, r, o = [];
- return t.each(e.childNodes ? t.makeArray(e.childNodes) : e, function(e) {
- 1 === e.nodeType && (o.push(e),
- o.push.apply(o, t.makeArray(e.getElementsByTagName("*"))))
- }),
- t.each(o, function(t) {
- t.getAttribute && (i = t.getAttribute("data-view-id")) && (r = c.hookups[i]) && (r(t, n, i),
- delete c.hookups[i],
- t.removeAttribute("data-view-id"))
- }),
- e
- },
- hookups: {},
- hook: function(t) {
- return c.hookups[++i] = t,
- " data-view-id='" + i + "'"
- },
- cached: {},
- cachedRenderers: {},
- cache: !0,
- register: function(e) {
- this.types["." + e.suffix] = e,
- t[e.suffix] = c[e.suffix] = function(t, n) {
- var i, o;
- if (!n)
- return o = function() {
- return i || (i = e.fragRenderer ? e.fragRenderer(null, t) : r(e.renderer(null, t))),
- i.apply(this, arguments)
- }
- ,
- o.render = function() {
- var n = e.renderer(null, t);
- return n.apply(n, arguments)
- }
- ,
- o;
- var s = function() {
- return i || (i = e.fragRenderer ? e.fragRenderer(t, n) : e.renderer(t, n)),
- i.apply(this, arguments)
- };
- return e.fragRenderer ? c.preload(t, s) : c.preloadStringRenderer(t, s)
- }
- },
- types: {},
- ext: ".ejs",
- registerScript: function(t, e, n) {
- return "can.view.preloadStringRenderer('" + e + "'," + c.types["." + t].script(e, n) + ");"
- },
- preload: function(e, n) {
- return (c.cached[e] = (new t.Deferred).resolve(function(t, e) {
- return n.call(t, t, e)
- })).__view_id = e,
- c.cachedRenderers[e] = n,
- n
- },
- preloadStringRenderer: function(t, e) {
- return this.preload(t, r(e))
- },
- render: function(e, n, i, r) {
- return t.view.renderAs("string", e, n, i, r)
- },
- renderTo: function(t, e, n, i) {
- return ("string" === t && e.render ? e.render : e)(n, i)
- },
- renderAs: function(i, r, o, l, p) {
- e(l) && (p = l,
- l = void 0);
- var h, d, f, g, v = a(o);
- if (v.length)
- return h = new t.Deferred,
- d = t.extend({}, o),
- v.push(s(r, !0)),
- t.when.apply(t, v).then(function(e) {
- var r, s = n(arguments), a = s.pop();
- if (t.isDeferred(o))
- d = u(e);
- else
- for (var c in o)
- t.isDeferred(o[c]) && (d[c] = u(s.shift()));
- r = t.view.renderTo(i, a, d, l),
- h.resolve(r, d),
- p && p(r, d)
- }, function() {
- h.reject.apply(h, arguments)
- }),
- h;
- if (f = e(p),
- h = t.__notObserve(s)(r, f),
- f)
- g = h,
- h.then(function(e) {
- p(o ? t.view.renderTo(i, e, o, l) : e)
- });
- else {
- if ("resolved" === h.state() && h.__view_id) {
- var m = c.cachedRenderers[h.__view_id];
- return o ? t.view.renderTo(i, m, o, l) : m
- }
- h.then(function(e) {
- g = o ? t.view.renderTo(i, e, o, l) : e
- })
- }
- return g
- },
- registerView: function(e, n, i, o) {
- var s, a = "object" == typeof i ? i : c.types[i || c.ext];
- return s = a.fragRenderer ? a.fragRenderer(e, n) : r(a.renderer(e, n)),
- o = o || new t.Deferred,
- c.cache && (c.cached[e] = o,
- o.__view_id = e,
- c.cachedRenderers[e] = s),
- o.resolve(s)
- },
- simpleHelper: function(e) {
- return function() {
- var n = [];
- return t.each(arguments, function(t, e) {
- if (e <= arguments.length) {
- for (; t && t.isComputed; )
- t = t();
- n.push(t)
- }
- }),
- e.apply(this, n)
- }
- }
- }),
- t
- }),
- define("can/view/scope", ["can/util/library", "can/view/compute_data", "can/construct", "can/map", "can/list", "can/view", "can/compute"], function(t, e) {
- function n(t, e, n) {
- this._context = t,
- this._parent = e,
- this._meta = n || {},
- this.__cache = {}
- }
- function i(t, e, i) {
- t.helpers || t.partials || t.tags || (t = {
- helpers: t
- }),
- n.call(this, t, e, i)
- }
- return t.simpleExtend(n, {
- read: t.compute.read,
- Refs: t.Map.extend({
- shortName: "ReferenceMap"
- }, {}),
- refsScope: function() {
- return new t.view.Scope(new this.Refs)
- }
- }),
- t.simpleExtend(n.prototype, {
- add: function(t, e) {
- return t !== this._context ? new this.constructor(t,this,e) : this
- },
- read: function(e, n) {
- if ("%root" === e)
- return {
- value: this.getRoot()
- };
- var i = "./" === e.substr(0, 2)
- , r = "../" === e.substr(0, 3)
- , o = "." === e || "this" === e
- , s = ".." === e;
- if ((i || r || o || s) && this._meta.notContext)
- return this._parent.read(e, n);
- var a;
- if (i)
- a = !0,
- e = e.substr(2);
- else {
- if (r) {
- for (var u = this._parent; u._meta.notContext; )
- u = u._parent;
- return u.read(e.substr(3), n)
- }
- if (o)
- return {
- value: this._context
- };
- if (s)
- return {
- value: this._parent._context
- }
- }
- var c = t.compute.read.reads(e);
- return "*" === c[0].key.charAt(0) ? this.getRefs()._read(c, n, !0) : this._read(c, n, a)
- },
- _read: function(e, n, i) {
- for (var r, o, s, a, u, c = this, l = [], p = -1, h = t.simpleExtend({
- foundObservable: function(t, n) {
- o = t,
- s = e.slice(n)
- },
- earlyExit: function(t, e) {
- e > p && (u = o,
- a = s,
- p = e)
- }
- }, n); c; ) {
- if (null !== (r = c._context) && ("object" == typeof r || "function" == typeof r)) {
- var d = t.__trapObserves()
- , f = t.compute.read(r, e, h)
- , g = d();
- if (void 0 !== f.value)
- return t.__observes(g),
- {
- scope: c,
- rootObserve: o,
- value: f.value,
- reads: s
- };
- l.push.apply(l, g)
- }
- c = i ? null : c._parent
- }
- return t.__observes(l),
- {
- setRoot: u,
- reads: a,
- value: void 0
- }
- },
- get: t.__notObserve(function(e, n) {
- return n = t.simpleExtend({
- isArgument: !0
- }, n),
- this.read(e, n).value
- }),
- getScope: function(t) {
- for (var e = this; e; ) {
- if (t(e))
- return e;
- e = e._parent
- }
- },
- getContext: function(t) {
- var e = this.getScope(t);
- return e && e._context
- },
- getRefs: function() {
- return this.getScope(function(t) {
- return t._context instanceof n.Refs
- })
- },
- getRoot: function() {
- for (var t = this, e = this; t._parent; )
- e = t,
- t = t._parent;
- return t._context instanceof n.Refs && (t = e),
- t._context
- },
- set: function(e, n, i) {
- var r, o, s = e.lastIndexOf("."), a = e.lastIndexOf("/");
- if (a > s ? (r = e.substring(0, a),
- o = e.substring(a + 1, e.length)) : -1 !== s ? (r = e.substring(0, s),
- o = e.substring(s + 1, e.length)) : (r = ".",
- o = e),
- "*" === e.charAt(0))
- t.compute.set(this.getRefs()._context, e, n, i);
- else {
- var u = this.read(r, i).value;
- t.compute.set(u, o, n, i)
- }
- },
- attr: t.__notObserve(function(e, n, i) {
- return i = t.simpleExtend({
- isArgument: !0
- }, i),
- 2 === arguments.length ? this.set(e, n, i) : this.get(e, i)
- }),
- computeData: function(t, n) {
- return e(this, t, n)
- },
- compute: function(t, e) {
- return this.computeData(t, e).compute
- },
- cloneFromRef: function() {
- for (var e, i, r = [], o = this; o; ) {
- if ((e = o._context)instanceof n.Refs) {
- i = o._parent;
- break
- }
- r.unshift(e),
- o = o._parent
- }
- return i ? (t.each(r, function(t) {
- i = i.add(t)
- }),
- i) : this
- }
- }),
- t.view.Scope = n,
- i.prototype = new n,
- i.prototype.constructor = i,
- t.view.Options = i,
- n
- }),
- define("can/elements", ["can/util/library", "can/view"], function(t) {
- var e = "undefined" != typeof document ? document : null
- , n = e && 1 === t.$(document.createComment("~")).length
- , i = {
- tagToContentPropMap: {
- option: e && "textContent"in document.createElement("option") ? "textContent" : "innerText",
- textarea: "value"
- },
- attrMap: t.attr.map,
- attrReg: /([^\s=]+)[\s]*=[\s]*/,
- defaultValue: t.attr.defaultValue,
- tagMap: {
- "": "span",
- colgroup: "col",
- table: "tbody",
- tr: "td",
- ol: "li",
- ul: "li",
- tbody: "tr",
- thead: "tr",
- tfoot: "tr",
- select: "option",
- optgroup: "option"
- },
- reverseTagMap: {
- col: "colgroup",
- tr: "tbody",
- option: "select",
- td: "tr",
- th: "tr",
- li: "ul"
- },
- selfClosingTags: {
- col: !0
- },
- getParentNode: function(t, e) {
- return e && 11 === t.parentNode.nodeType ? e : t.parentNode
- },
- setAttr: t.attr.set,
- getAttr: t.attr.get,
- removeAttr: t.attr.remove,
- contentText: function(t) {
- return "string" == typeof t ? t : t || 0 === t ? "" + t : ""
- },
- after: function(e, n) {
- var i = e[e.length - 1];
- i.nextSibling ? t.insertBefore(i.parentNode, n, i.nextSibling, t.document) : t.appendChild(i.parentNode, n, t.document)
- },
- replace: function(e, r) {
- var o, s = e[0].parentNode;
- "SELECT" === s.nodeName.toUpperCase() && s.selectedIndex >= 0 && (o = s.value),
- i.after(e, r),
- t.remove(t.$(e)).length < e.length && !n && t.each(e, function(t) {
- 8 === t.nodeType && t.parentNode.removeChild(t)
- }),
- void 0 !== o && (s.value = o)
- }
- };
- return t.view.elements = i,
- i
- }),
- define("can/view/callbacks", ["can/util/library", "can/view"], function(t) {
- var e = t.view.attr = function(t, e) {
- if (!e) {
- var r = n[t];
- if (!r)
- for (var o = 0, s = i.length; o < s; o++) {
- var a = i[o];
- if (a.match.test(t)) {
- r = a.handler;
- break
- }
- }
- return r
- }
- "string" == typeof t ? n[t] = e : i.push({
- match: t,
- handler: e
- })
- }
- , n = {}
- , i = []
- , r = /[-\:]/
- , o = t.view.tag = function(e, n) {
- if (!n) {
- var i = s[e.toLowerCase()];
- return !i && r.test(e) && (i = function() {}
- ),
- i
- }
- t.global.html5 && (t.global.html5.elements += " " + e,
- t.global.html5.shivDocument()),
- s[e.toLowerCase()] = n
- }
- , s = {};
- return t.view.callbacks = {
- _tags: s,
- _attributes: n,
- _regExpAttributes: i,
- tag: o,
- attr: e,
- tagHandler: function(e, n, i) {
- var r, o = i.options.get("tags." + n, {
- proxyMethods: !1
- }) || s[n], a = i.scope;
- if ((r = o ? t.__notObserve(o)(e, i) : a) && i.subtemplate) {
- a !== r && (a = a.add(r));
- var u = i.subtemplate(a, i.options)
- , c = "string" == typeof u ? t.view.frag(u) : u;
- t.appendChild(e, c)
- }
- }
- },
- t.view.callbacks
- }),
- define("can/scanner", ["can/view", "can/elements", "can/view/callbacks"], function(can, elements, viewCallbacks) {
- var newLine = /(\r|\n)+/g, notEndTag = /\//, clean = function(t) {
- return t.split("\\").join("\\\\").split("\n").join("\\n").split('"').join('\\"').split("\t").join("\\t")
- }, getTag = function(t, e, n) {
- if (t)
- return t;
- for (; n < e.length; ) {
- if ("<" === e[n] && !notEndTag.test(e[n + 1]))
- return elements.reverseTagMap[e[n + 1]] || "span";
- n++
- }
- return ""
- }, bracketNum = function(t) {
- return --t.split("{").length - --t.split("}").length
- }, myEval = function(script) {
- eval(script)
- }, attrReg = /([^\s]+)[\s]*=[\s]*$/, startTxt = "var ___v1ew = [];", finishTxt = "return ___v1ew.join('')", put_cmd = "___v1ew.push(\n", insert_cmd = put_cmd, htmlTag = null, quote = null, beforeQuote = null, rescan = null, getAttrName = function() {
- var t = beforeQuote.match(attrReg);
- return t && t[1]
- }, status = function() {
- return quote ? "'" + getAttrName() + "'" : htmlTag ? 1 : 0
- }, top = function(t) {
- return t[t.length - 1]
- }, Scanner;
- return can.view.Scanner = Scanner = function(t) {
- can.extend(this, {
- text: {},
- tokens: []
- }, t),
- this.text.options = this.text.options || "",
- this.tokenReg = [],
- this.tokenSimple = {
- "<": "<",
- ">": ">",
- '"': '"',
- "'": "'"
- },
- this.tokenComplex = [],
- this.tokenMap = {};
- for (var e, n = 0; e = this.tokens[n]; n++)
- e[2] ? (this.tokenReg.push(e[2]),
- this.tokenComplex.push({
- abbr: e[1],
- re: new RegExp(e[2]),
- rescan: e[3]
- })) : (this.tokenReg.push(e[1]),
- this.tokenSimple[e[1]] = e[0]),
- this.tokenMap[e[0]] = e[1];
- this.tokenReg = new RegExp("(" + this.tokenReg.slice(0).concat(["<", ">", '"', "'"]).join("|") + ")","g")
- }
- ,
- Scanner.prototype = {
- helpers: [],
- scan: function(t, e) {
- var n = []
- , i = 0
- , r = this.tokenSimple
- , o = this.tokenComplex;
- t = t.replace(newLine, "\n"),
- this.transform && (t = this.transform(t)),
- t.replace(this.tokenReg, function(e, s) {
- var a = arguments[arguments.length - 2];
- if (a > i && n.push(t.substring(i, a)),
- r[e])
- n.push(e);
- else
- for (var u, c = 0; u = o[c]; c++)
- if (u.re.test(e)) {
- n.push(u.abbr),
- u.rescan && n.push(u.rescan(s));
- break
- }
- i = a + s.length
- }),
- i < t.length && n.push(t.substr(i));
- var s, a, u, c, l = "", p = [startTxt + (this.text.start || "")], h = function(t, e) {
- p.push(put_cmd, '"', clean(t), '"' + (e || "") + ");")
- }, d = [], f = null, g = !1, v = {
- attributeHookups: [],
- tagHookups: [],
- lastTagHookup: ""
- }, m = function() {
- v.lastTagHookup = v.tagHookups.pop() + v.tagHookups.length
- }, b = "", y = [], _ = !1, w = !1, x = 0, C = this.tokenMap;
- for (htmlTag = quote = beforeQuote = null; void 0 !== (u = n[x++]); ) {
- if (null === f)
- switch (u) {
- case C.left:
- case C.escapeLeft:
- case C.returnLeft:
- g = htmlTag && 1;
- case C.commentLeft:
- f = u,
- l.length && h(l),
- l = "";
- break;
- case C.escapeFull:
- g = htmlTag && 1,
- rescan = 1,
- f = C.escapeLeft,
- l.length && h(l),
- l = (rescan = n[x++]).content || rescan,
- rescan.before && h(rescan.before),
- n.splice(x, 0, C.right);
- break;
- case C.commentFull:
- break;
- case C.templateLeft:
- l += C.left;
- break;
- case "<":
- 0 !== n[x].indexOf("!--") && (htmlTag = 1,
- g = 0),
- l += u;
- break;
- case ">":
- htmlTag = 0;
- var k = "/" === l.substr(l.length - 1) || "--" === l.substr(l.length - 2)
- , S = "";
- if (v.attributeHookups.length && (S = "attrs: ['" + v.attributeHookups.join("','") + "'], ",
- v.attributeHookups = []),
- b + v.tagHookups.length !== v.lastTagHookup && b === top(v.tagHookups))
- k && (l = l.substr(0, l.length - 1)),
- p.push(put_cmd, '"', clean(l), '"', ",can.view.pending({tagName:'" + b + "'," + S + "scope: " + (this.text.scope || "this") + this.text.options),
- k ? (p.push("}));"),
- l = "/>",
- m()) : "<" === n[x] && n[x + 1] === "/" + b ? (p.push("}));"),
- l = u,
- m()) : (p.push(",subtemplate: function(" + this.text.argNames + "){\n" + startTxt + (this.text.start || "")),
- l = "");
- else if (g || !_ && elements.tagToContentPropMap[y[y.length - 1]] || S) {
- var T = ",can.view.pending({" + S + "scope: " + (this.text.scope || "this") + this.text.options + '}),"';
- k ? h(l.substr(0, l.length - 1), T + '/>"') : h(l, T + '>"'),
- l = "",
- g = 0
- } else
- l += u;
- (k || _) && (y.pop(),
- b = y[y.length - 1],
- _ = !1),
- v.attributeHookups = [];
- break;
- case "'":
- case '"':
- if (htmlTag)
- if (quote && quote === u) {
- quote = null;
- var A = getAttrName();
- if (viewCallbacks.attr(A) && v.attributeHookups.push(A),
- w) {
- h(l += u),
- p.push(finishTxt, "}));\n"),
- l = "",
- w = !1;
- break
- }
- } else if (null === quote && (quote = u,
- beforeQuote = s,
- c = getAttrName(),
- "img" === b && "src" === c || "style" === c)) {
- h(l.replace(attrReg, "")),
- l = "",
- w = !0,
- p.push(insert_cmd, "can.view.txt(2,'" + getTag(b, n, x) + "'," + status() + ",this,function(){", startTxt),
- h(c + "=" + u);
- break
- }
- default:
- if ("<" === s) {
- var B, N = !1;
- 0 === (b = "!--" === u.substr(0, 3) ? "!--" : u.split(/\s/)[0]).indexOf("/") && (N = !0,
- B = b.substr(1)),
- N ? (top(y) === B && (b = B,
- _ = !0),
- top(v.tagHookups) === B && (h(l.substr(0, l.length - 1)),
- p.push(finishTxt + "}}) );"),
- l = "><",
- m())) : (b.lastIndexOf("/") === b.length - 1 && (b = b.substr(0, b.length - 1)),
- "!--" !== b && viewCallbacks.tag(b) && ("content" === b && elements.tagMap[top(y)] && (u = u.replace("content", elements.tagMap[top(y)])),
- v.tagHookups.push(b)),
- y.push(b))
- }
- l += u
- }
- else
- switch (u) {
- case C.right:
- case C.returnRight:
- switch (f) {
- case C.left:
- 1 === (a = bracketNum(l)) ? (p.push(insert_cmd, "can.view.txt(0,'" + getTag(b, n, x) + "'," + status() + ",this,function(){", startTxt, l),
- d.push({
- before: "",
- after: finishTxt + "}));\n"
- })) : ((i = d.length && -1 === a ? d.pop() : {
- after: ";"
- }).before && p.push(i.before),
- p.push(l, ";", i.after));
- break;
- case C.escapeLeft:
- case C.returnLeft:
- (a = bracketNum(l)) && d.push({
- before: finishTxt,
- after: "}));\n"
- });
- for (var M = f === C.escapeLeft ? 1 : 0, I = {
- insert: insert_cmd,
- tagName: getTag(b, n, x),
- status: status(),
- specialAttribute: w
- }, O = 0; O < this.helpers.length; O++) {
- var D = this.helpers[O];
- if (D.name.test(l)) {
- l = D.fn(l, I),
- D.name.source === /^>[\s]*\w*/.source && (M = 0);
- break
- }
- }
- "object" == typeof l ? l.startTxt && l.end && w ? p.push(insert_cmd, "can.view.toStr( ", l.content, "() ) );") : (l.startTxt ? p.push(insert_cmd, "can.view.txt(\n" + ("string" == typeof status() || (null != l.escaped ? l.escaped : M)) + ",\n'" + b + "',\n" + status() + ",\nthis,\n") : l.startOnlyTxt && p.push(insert_cmd, "can.view.onlytxt(this,\n"),
- p.push(l.content),
- l.end && p.push("));")) : w ? p.push(insert_cmd, l, ");") : p.push(insert_cmd, "can.view.txt(\n" + ("string" == typeof status() || M) + ",\n'" + b + "',\n" + status() + ",\nthis,\nfunction(){ " + (this.text.escape || "") + "return ", l, a ? startTxt : "}));\n"),
- rescan && rescan.after && rescan.after.length && (h(rescan.after.length),
- rescan = null)
- }
- f = null,
- l = "";
- break;
- case C.templateLeft:
- l += C.left;
- break;
- default:
- l += u
- }
- s = u
- }
- l.length && h(l),
- p.push(";");
- var E = p.join("")
- , L = {
- out: (this.text.outStart || "") + E + " " + finishTxt + (this.text.outEnd || "")
- };
- return myEval.call(L, "this.fn = (function(" + this.text.argNames + "){" + L.out + "});\r\n//# sourceURL=" + e + ".js"),
- L
- }
- },
- can.view.pending = function(t) {
- var e = can.view.getHooks();
- return can.view.hook(function(n) {
- can.each(e, function(t) {
- t(n)
- }),
- t.templateType = "legacy",
- t.tagName && viewCallbacks.tagHandler(n, t.tagName, t),
- can.each(t && t.attrs || [], function(e) {
- t.attributeName = e;
- var i = viewCallbacks.attr(e);
- i && i(n, t)
- })
- })
- }
- ,
- can.view.tag("content", function(t, e) {
- return e.scope
- }),
- can.view.Scanner = Scanner,
- Scanner
- }),
- define("can/view/node_lists", ["can/util/library", "can/elements"], function(t) {
- var e = !0;
- try {
- document.createTextNode("")._ = 0
- } catch (t) {
- e = !1
- }
- var n = {}
- , i = {}
- , r = "ejs_" + Math.random()
- , o = 0
- , s = function(t, n) {
- var s = n || i;
- return a(t, s) || (e || 3 !== t.nodeType ? (++o,
- t[r] = (t.nodeName ? "element_" : "obj_") + o) : (++o,
- s["text_" + o] = t,
- "text_" + o))
- }
- , a = function(t, n) {
- if (e || 3 !== t.nodeType)
- return t[r];
- for (var i in n)
- if (n[i] === t)
- return i
- }
- , u = [].splice
- , c = [].push
- , l = function(t) {
- for (var e = 0, n = 0, i = t.length; n < i; n++) {
- var r = t[n];
- r.nodeType ? e++ : e += l(r)
- }
- return e
- }
- , p = function(t, e) {
- for (var n = {}, i = 0, r = t.length; i < r; i++) {
- var o = d.first(t[i]);
- n[s(o, e)] = t[i]
- }
- return n
- }
- , h = function(t, e, n) {
- for (var i in e)
- n[i] || t.newDeepChildren.push(e[i])
- }
- , d = {
- id: s,
- update: function(e, n) {
- var i = d.unregisterChildren(e);
- n = t.makeArray(n);
- var r = e.length;
- return u.apply(e, [0, r].concat(n)),
- e.replacements ? (d.nestReplacements(e),
- e.deepChildren = e.newDeepChildren,
- e.newDeepChildren = []) : d.nestList(e),
- i
- },
- nestReplacements: function(t) {
- for (var e = 0, n = {}, i = p(t.replacements, n), r = t.replacements.length, o = {}; e < t.length && r; ) {
- var s = t[e]
- , u = a(s, n)
- , c = i[u];
- c && (t.splice(e, l(c), c),
- o[u] = !0,
- r--),
- e++
- }
- r && h(t, i, o),
- t.replacements = []
- },
- nestList: function(t) {
- for (var e = 0; e < t.length; ) {
- var i = t[e]
- , r = n[s(i)];
- r ? r !== t && t.splice(e, l(r), r) : n[s(i)] = t,
- e++
- }
- },
- last: function(t) {
- var e = t[t.length - 1];
- return e.nodeType ? e : d.last(e)
- },
- first: function(t) {
- var e = t[0];
- return e.nodeType ? e : d.first(e)
- },
- flatten: function(t) {
- for (var e = [], n = 0; n < t.length; n++) {
- var i = t[n];
- i.nodeType ? e.push(i) : e.push.apply(e, d.flatten(i))
- }
- return e
- },
- register: function(e, n, i, r) {
- return t.cid(e),
- e.unregistered = n,
- e.parentList = i,
- i ? (e.deepChildren = [],
- e.newDeepChildren = [],
- e.replacements = [],
- !0 !== i && (r ? i.replacements.push(e) : i.newDeepChildren.push(e))) : d.nestList(e),
- e
- },
- unregisterChildren: function(e) {
- var i = [];
- return t.each(e, function(t) {
- t.nodeType ? (e.replacements || delete n[s(t)],
- i.push(t)) : c.apply(i, d.unregister(t, !0))
- }),
- t.each(e.deepChildren, function(t) {
- d.unregister(t, !0)
- }),
- i
- },
- unregister: function(t, e) {
- var n = d.unregisterChildren(t, !0);
- if (t.unregistered) {
- var i = t.unregistered;
- if (t.replacements = t.unregistered = null,
- !e) {
- var r = t.parentList && t.parentList.deepChildren;
- if (r) {
- var o = r.indexOf(t);
- -1 !== o && r.splice(o, 1)
- }
- }
- i()
- }
- return n
- },
- nodeMap: n
- };
- return t.view.nodeLists = d,
- d
- }),
- define("can/view/parser", [], function() {
- function t(t, e) {
- for (var n = 0; n < t.length; n++)
- e(t[n], n)
- }
- function e(e) {
- var n = {};
- return t(e.split(","), function(t) {
- n[t] = !0
- }),
- n
- }
- function n(t, e) {
- for (var n = 0, i = t.length; n < i; n++) {
- var r = t[n];
- e[r.tokenType].apply(e, r.args)
- }
- return t
- }
- var i = new RegExp("^<([-:A-Za-z0-9_]+)((?:\\s*(?:(?:(?:[^=>\\s\\/]+)?(?:\\s*=\\s*(?:(?:\\{\\{[^\\}]\\}\\}\\}?)|(?:\\{[^\\}\\{]\\})|(?:\"[^\"]*\")|(?:'[^']*')|[^>\\s]+))?)|(?:\\{\\{[^\\}]*\\}\\}\\}?)+))*)\\s*(\\/?)>")
- , r = new RegExp("^<\\/([-:A-Za-z0-9_]+)[^>]*>")
- , o = new RegExp("\\{\\{([^\\}]*)\\}\\}\\}?","g")
- , s = /<|\{\{/
- , a = /\s/
- , u = e("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed")
- , c = e("a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video")
- , l = e("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var")
- , p = e("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr")
- , h = e("script")
- , d = "start,end,close,attrStart,attrEnd,attrValue,chars,comment,special,done".split(",")
- , f = function() {}
- , g = function(e, a, v) {
- function m(t, e) {
- var n;
- if (e)
- for (n = C.length - 1; n >= 0 && C[n] !== e; n--)
- ;
- else
- n = 0;
- if (n >= 0) {
- for (var i = C.length - 1; i >= n; i--)
- a.close && a.close(C[i]);
- C.length = n
- }
- }
- if ("object" == typeof e)
- return n(e, a);
- var b = [];
- a = a || {},
- v && t(d, function(t) {
- var e = a[t] || f;
- a[t] = function() {
- !1 !== e.apply(this, arguments) && b.push({
- tokenType: t,
- args: [].slice.call(arguments, 0)
- })
- }
- });
- var y, _, w, x = function() {
- S && a.chars && a.chars(S),
- S = ""
- }, C = [], k = e, S = "";
- for (C.last = function() {
- return this[this.length - 1]
- }
- ; e; ) {
- if (_ = !0,
- C.last() && h[C.last()])
- e = e.replace(new RegExp("([\\s\\S]*?)</" + C.last() + "[^>]*>"), function(t, e) {
- return e = e.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, "$1$2"),
- a.chars && a.chars(e),
- ""
- }),
- m(0, C.last());
- else if (0 === e.indexOf("\x3c!--") ? (y = e.indexOf("--\x3e")) >= 0 && (x(),
- a.comment && a.comment(e.substring(4, y)),
- e = e.substring(y + 3),
- _ = !1) : 0 === e.indexOf("</") ? (w = e.match(r)) && (x(),
- e = e.substring(w[0].length),
- w[0].replace(r, m),
- _ = !1) : 0 === e.indexOf("<") ? (w = e.match(i)) && (x(),
- e = e.substring(w[0].length),
- w[0].replace(i, function(t, e, n, i) {
- if (e = e.toLowerCase(),
- c[e])
- for (; C.last() && l[C.last()]; )
- m(0, C.last());
- p[e] && C.last() === e && m(0, e),
- i = u[e] || !!i,
- a.start(e, i),
- i || C.push(e),
- g.parseAttrs(n, a),
- a.end(e, i)
- }),
- _ = !1) : 0 === e.indexOf("{{") && (w = e.match(o)) && (x(),
- e = e.substring(w[0].length),
- w[0].replace(o, function(t, e) {
- a.special && a.special(e)
- })),
- _) {
- 0 === (y = e.search(s)) && e === k && (S += e.charAt(0),
- e = e.substr(1),
- y = e.search(s));
- var T = y < 0 ? e : e.substring(0, y);
- e = y < 0 ? "" : e.substring(y),
- T && (S += T)
- }
- if (e === k)
- throw new Error("Parse Error: " + e);
- k = e
- }
- return x(),
- m(),
- a.done(),
- b
- }
- , v = function(t, e, n, i) {
- t.attrStart = i.substring("number" == typeof t.nameStart ? t.nameStart : e, e),
- n.attrStart(t.attrStart),
- t.inName = !1
- }
- , m = function(t, e, n, i) {
- void 0 !== t.valueStart && t.valueStart < e ? n.attrValue(i.substring(t.valueStart, e)) : t.inValue,
- n.attrEnd(t.attrStart),
- t.attrStart = void 0,
- t.valueStart = void 0,
- t.inValue = !1,
- t.inName = !1,
- t.lookingForEq = !1,
- t.inQuote = !1,
- t.lookingForName = !0
- };
- return g.parseAttrs = function(t, e) {
- if (t) {
- for (var n, i = 0, r = {
- inDoubleCurly: !1,
- inName: !1,
- nameStart: void 0,
- inValue: !1,
- valueStart: void 0,
- inQuote: !1,
- attrStart: void 0,
- lookingForName: !0,
- lookingForValue: !1,
- lookingForEq: !1
- }; i < t.length; ) {
- n = i;
- var o = t.charAt(i)
- , s = t.charAt(i + 1)
- , u = t.charAt(i + 2);
- if (i++,
- "{" === o && "{" === s)
- r.inValue && n > r.valueStart ? e.attrValue(t.substring(r.valueStart, n)) : r.inName && r.nameStart < n ? (v(r, n, e, t),
- m(r, n, e, t)) : r.lookingForValue ? r.inValue = !0 : r.lookingForEq && r.attrStart && m(r, n, e, t),
- r.inDoubleCurly = !0,
- r.doubleCurlyStart = n + 2,
- i++;
- else if (r.inDoubleCurly) {
- if ("}" === o && "}" === s) {
- var c = "}" === u ? 1 : 0;
- e.special(t.substring(r.doubleCurlyStart, n)),
- r.inDoubleCurly = !1,
- r.inValue && (r.valueStart = n + 2 + c),
- i += 1 + c
- }
- } else
- r.inValue ? r.inQuote ? o === r.inQuote && m(r, n, e, t) : a.test(o) && m(r, n, e, t) : "=" === o && (r.lookingForEq || r.lookingForName || r.inName) ? (r.attrStart || v(r, n, e, t),
- r.lookingForValue = !0,
- r.lookingForEq = !1,
- r.lookingForName = !1) : r.inName ? a.test(o) && (v(r, n, e, t),
- r.lookingForEq = !0) : r.lookingForName ? a.test(o) || (r.attrStart && m(r, n, e, t),
- r.nameStart = n,
- r.inName = !0) : r.lookingForValue && (a.test(o) || (r.lookingForValue = !1,
- r.inValue = !0,
- "'" === o || '"' === o ? (r.inQuote = o,
- r.valueStart = n + 1) : r.valueStart = n))
- }
- r.inName ? (v(r, n + 1, e, t),
- m(r, n + 1, e, t)) : r.lookingForEq ? m(r, n + 1, e, t) : r.inValue && m(r, n + 1, e, t)
- }
- }
- ,
- g
- }),
- define("can/util/diff", [], function() {
- var t = [].slice;
- return function(e, n) {
- for (var i = 0, r = 0, o = e.length, s = n.length, a = []; i < o && r < s; ) {
- var u = e[i]
- , c = n[r];
- if (u !== c)
- if (r + 1 < s && n[r + 1] === u)
- a.push({
- index: r,
- deleteCount: 0,
- insert: [n[r]]
- }),
- i++,
- r += 2;
- else {
- if (!(i + 1 < o && e[i + 1] === c))
- return a.push({
- index: r,
- deleteCount: o - i,
- insert: t.call(n, r)
- }),
- a;
- a.push({
- index: r,
- deleteCount: 1,
- insert: []
- }),
- i += 2,
- r++
- }
- else
- i++,
- r++
- }
- return r === s && i === o ? a : (a.push({
- index: r,
- deleteCount: o - i,
- insert: t.call(n, r)
- }),
- a)
- }
- }),
- define("can/view/live", ["can/util/library", "can/elements", "can/view", "can/view/node_lists", "can/view/parser", "can/util/diff"], function(t, e, n, i, r, o) {
- e = e || t.view.elements,
- i = i || t.view.NodeLists,
- r = r || t.view.parser;
- var s = function(e, n, i) {
- var r = !1
- , o = function() {
- return r || (r = !0,
- i(s),
- t.unbind.call(e, "removed", o)),
- !0
- }
- , s = {
- teardownCheck: function(t) {
- return !t && o()
- }
- };
- return t.bind.call(e, "removed", o),
- n(s),
- s
- }
- , a = function(t) {
- var e = t.childNodes;
- if ("length"in e)
- return e;
- for (var n = t.firstChild, i = []; n; )
- i.push(n),
- n = n.nextSibling;
- return i
- }
- , u = function(t, e, n) {
- return s(t, function() {
- e.computeInstance.bind("change", n)
- }, function(t) {
- e.computeInstance.unbind("change", n),
- t.nodeList && i.unregister(t.nodeList)
- })
- }
- , c = function(t) {
- var e, n = {};
- return r.parseAttrs(t, {
- attrStart: function(t) {
- n[t] = "",
- e = t
- },
- attrValue: function(t) {
- n[e] += t
- },
- attrEnd: function() {}
- }),
- n
- }
- , l = [].splice
- , p = function(t) {
- return t && t.nodeType
- }
- , h = function(t) {
- t.firstChild || t.appendChild(t.ownerDocument.createTextNode(""))
- }
- , d = function(e) {
- var n = "string" == typeof e
- , i = t.frag(e);
- return n ? t.view.hookup(i) : i
- }
- , f = function(e, n, r, o, s) {
- var u = [];
- n && (i.register(u, null, n, !0),
- u.parentList = n,
- u.expression = "#each SUBEXPRESSION");
- var c = r.apply(o, s.concat([u]))
- , l = d(c)
- , p = t.makeArray(a(l));
- return n ? (i.update(u, p),
- e.push(u)) : e.push(i.register(p)),
- l
- }
- , g = function(e, n, r) {
- var o = e.splice(n + 1, r)
- , s = [];
- return t.each(o, function(t) {
- var e = i.unregister(t);
- [].push.apply(s, e)
- }),
- s
- }
- , v = function(t, n, i, r) {
- if (n && 0 === t.length) {
- var o = []
- , s = f(o, r, n, t, [t]);
- e.after([i[0]], s),
- i.push(o[0])
- }
- }
- , m = {
- list: function(n, r, a, u, c, p, h) {
- var d, b = p || [n], y = [], _ = !1, w = !1, x = function(n, r, o) {
- if (_) {
- var s = T.ownerDocument.createDocumentFragment()
- , c = []
- , h = [];
- t.each(r, function(e, n) {
- var i = t.compute(n + o)
- , r = f(c, p, a, u, [e, i]);
- s.appendChild(r),
- h.push(i)
- });
- var d = o + 1;
- if (!y.length) {
- var v = g(b, 0, b.length - 1);
- t.remove(t.$(v))
- }
- if (b[d]) {
- var m = i.first(b[d]);
- t.insertBefore(m.parentNode, s, m)
- } else
- e.after(1 === d ? [T] : [i.last(b[d - 1])], s);
- l.apply(b, [d, 0].concat(c)),
- l.apply(y, [o, 0].concat(h));
- for (var w = o + h.length, x = y.length; w < x; w++)
- y[w](w)
- }
- }, C = function(t, e, n) {
- k({}, {
- length: 1
- }, n, !0),
- x(0, [e], n)
- }, k = function(e, n, r, o, s) {
- if (_ && (o || !N.teardownCheck(T.parentNode))) {
- r < 0 && (r = y.length + r);
- var a = g(b, r, n.length);
- y.splice(r, n.length);
- for (var u = r, c = y.length; u < c; u++)
- y[u](u);
- s ? i.unregister(b) : (v(d, h, b, p),
- t.remove(t.$(a)))
- }
- }, S = function(e, n, r, o) {
- if (_) {
- o += 1;
- var s, a = b[r += 1], u = t.frag(i.flatten(b[o]));
- s = o < r ? i.last(a).nextSibling : i.first(a),
- b[0].parentNode.insertBefore(u, s);
- var c = b[o];
- [].splice.apply(b, [o, 1]),
- [].splice.apply(b, [r, 0, c]),
- r -= 1;
- var l = y[o -= 1];
- [].splice.apply(y, [o, 1]),
- [].splice.apply(y, [r, 0, l]);
- var p = Math.min(o, r)
- , h = y.length;
- for (h; p < h; p++)
- y[p](p)
- }
- }, T = n.ownerDocument.createTextNode(""), A = function(t) {
- d && d.unbind && d.unbind("add", x).unbind("set", C).unbind("remove", k).unbind("move", S),
- k({}, {
- length: b.length - 1
- }, 0, !0, t)
- }, B = function(t, e, n) {
- if (!w) {
- if (_ = !0,
- e && n) {
- d = e || [];
- var i = o(n, e);
- n.unbind && n.unbind("add", x).unbind("set", C).unbind("remove", k).unbind("move", S);
- for (var r = 0, s = i.length; r < s; r++) {
- var a = i[r];
- a.deleteCount && k({}, {
- length: a.deleteCount
- }, a.index, !0),
- a.insert.length && x(0, a.insert, a.index)
- }
- } else
- n && A(),
- d = e || [],
- x(0, d, 0),
- v(d, h, b, p);
- _ = !1,
- d.bind && d.bind("add", x).bind("set", C).bind("remove", k).bind("move", S),
- _ = !0
- }
- };
- c = e.getParentNode(n, c);
- var N = s(c, function() {
- t.isFunction(r) && r.bind("change", B)
- }, function() {
- t.isFunction(r) && r.unbind("change", B),
- A(!0)
- });
- p ? (e.replace(b, T),
- i.update(b, [T]),
- p.unregistered = function() {
- N.teardownCheck(),
- w = !0
- }
- ) : m.replace(b, T, N.teardownCheck),
- B(0, t.isFunction(r) ? r() : r)
- },
- html: function(n, r, o, s) {
- var c;
- o = e.getParentNode(n, o),
- c = u(o, r, function(t, e, n) {
- i.first(l).parentNode && d(e),
- c.teardownCheck(i.first(l).parentNode)
- });
- var l = s || [n]
- , d = function(n) {
- var r = "function" == typeof n
- , s = p(n)
- , u = t.frag(r ? "" : n)
- , c = t.makeArray(l);
- h(u),
- s || r || (u = t.view.hookup(u, o)),
- c = i.update(l, a(u)),
- r && n(u.firstChild),
- e.replace(c, u)
- };
- c.nodeList = l,
- s ? s.unregistered = c.teardownCheck : i.register(l, c.teardownCheck),
- d(r())
- },
- replace: function(n, r, o) {
- var s = n.slice(0)
- , u = t.frag(r);
- return i.register(n, o),
- "string" == typeof r && (u = t.view.hookup(u, n[0].parentNode)),
- i.update(n, a(u)),
- e.replace(s, u),
- n
- },
- text: function(n, r, o, s) {
- var a = e.getParentNode(n, o)
- , c = u(a, r, function(e, n, i) {
- "unknown" != typeof l.nodeValue && (l.nodeValue = t.view.toStr(n)),
- c.teardownCheck(l.parentNode)
- })
- , l = n.ownerDocument.createTextNode(t.view.toStr(r()));
- s ? (s.unregistered = c.teardownCheck,
- c.nodeList = s,
- i.update(s, [l]),
- e.replace([n], l)) : c.nodeList = m.replace([n], l, c.teardownCheck)
- },
- setAttributes: function(e, n) {
- var i = c(n);
- for (var r in i)
- t.attr.set(e, r, i[r])
- },
- attributes: function(n, i, r) {
- var o = {}
- , s = function(i) {
- var r, s = c(i);
- for (r in s) {
- var a = s[r];
- a !== o[r] && t.attr.set(n, r, a),
- delete o[r]
- }
- for (r in o)
- e.removeAttr(n, r);
- o = s
- };
- u(n, i, function(t, e) {
- s(e)
- }),
- arguments.length >= 3 ? o = c(r) : s(i())
- },
- attributePlaceholder: "__!!__",
- attributeReplace: /__!!__/g,
- attribute: function(n, i, r) {
- u(n, r, function(t, r) {
- e.setAttr(n, i, a.render())
- });
- var o, s = t.$(n);
- (o = t.data(s, "hooks")) || t.data(s, "hooks", o = {});
- var a, c = String(e.getAttr(n, i)), l = c.split(m.attributePlaceholder), p = [];
- p.push(l.shift(), l.join(m.attributePlaceholder)),
- o[i] ? o[i].computes.push(r) : o[i] = {
- render: function() {
- var t = 0;
- return c ? c.replace(m.attributeReplace, function() {
- return e.contentText(a.computes[t++]())
- }) : e.contentText(a.computes[t++]())
- },
- computes: [r],
- batchNum: void 0
- },
- a = o[i],
- p.splice(1, 0, r()),
- e.setAttr(n, i, p.join(""))
- },
- specialAttribute: function(t, n, i) {
- u(t, i, function(i, r) {
- e.setAttr(t, n, y(r))
- }),
- e.setAttr(t, n, y(i()))
- },
- simpleAttribute: function(t, n, i) {
- u(t, i, function(i, r) {
- e.setAttr(t, n, r)
- }),
- e.setAttr(t, n, i())
- }
- };
- m.attr = m.simpleAttribute,
- m.attrs = m.attributes,
- m.getAttributeParts = c;
- var b = /(\r|\n)+/g
- , y = function(t) {
- var n = /^["'].*["']$/;
- return t = t.replace(e.attrReg, "").replace(b, ""),
- n.test(t) ? t.substr(1, t.length - 2) : t
- };
- return t.view.live = m,
- m
- }),
- define("can/render", ["can/view", "can/elements", "can/view/live", "can/util/string"], function(t, e, n) {
- var i, r = [], o = function(t) {
- var n = e.tagMap[t] || "span";
- return "span" === n ? "@@!!@@" : "<" + n + ">" + o(n) + "</" + n + ">"
- }, s = function(e, n) {
- if ("string" == typeof e)
- return e;
- if (!e && 0 !== e)
- return "";
- var i = e.hookup && function(t, n) {
- e.hookup.call(e, t, n)
- }
- || "function" == typeof e && e;
- return i ? n ? "<" + n + " " + t.view.hook(i) + "></" + n + ">" : (r.push(i),
- "") : "" + e
- }, a = function(e, n) {
- return "string" == typeof e || "number" == typeof e ? t.esc(e) : s(e, n)
- }, u = !1, c = function() {};
- return t.extend(t.view, {
- live: n,
- setupLists: function() {
- var e, n = t.view.lists;
- return t.view.lists = function(t, n) {
- return e = {
- list: t,
- renderer: n
- },
- Math.random()
- }
- ,
- function() {
- return t.view.lists = n,
- e
- }
- },
- getHooks: function() {
- var t = r.slice(0);
- return i = t,
- r = [],
- t
- },
- onlytxt: function(t, e) {
- return a(e.call(t))
- },
- txt: function(l, p, h, d, f) {
- var g, v, m, b, y = e.tagMap[p] || "span", _ = !1, w = c;
- if (u)
- g = f.call(d);
- else {
- "string" != typeof h && 1 !== h || (u = !0);
- var x = t.view.setupLists();
- w = function() {
- m.unbind("change", c)
- }
- ,
- (m = t.compute(f, d, !1)).bind("change", c),
- v = x(),
- g = m(),
- u = !1,
- _ = m.computeInstance.hasDependencies
- }
- if (v)
- return w(),
- "<" + y + t.view.hook(function(t, e) {
- n.list(t, v.list, v.renderer, d, e)
- }) + "></" + y + ">";
- if (!_ || "function" == typeof g)
- return w(),
- (u || 2 === l || !l ? s : a)(g, 0 === h && y);
- var C = e.tagToContentPropMap[p];
- if (0 !== h || C)
- return 1 === h ? (r.push(function(t) {
- n.attributes(t, m, m()),
- w()
- }),
- m()) : 2 === l ? (b = h,
- r.push(function(t) {
- n.specialAttribute(t, b, m),
- w()
- }),
- m()) : (b = 0 === h ? C : h,
- (0 === h ? i : r).push(function(t) {
- n.attribute(t, b, m),
- w()
- }),
- n.attributePlaceholder);
- var k = !!e.selfClosingTags[y];
- return "<" + y + t.view.hook(l && "object" != typeof g ? function(t, e) {
- n.text(t, m, e),
- w()
- }
- : function(t, e) {
- n.html(t, m, e),
- w()
- }
- ) + (k ? "/>" : ">" + o(y) + "</" + y + ">")
- }
- }),
- t
- }),
- define("can/view/utils", ["can/util/library", "can/view/scope"], function(can) {
- var Options = can.view.Options;
- return {
- isArrayLike: function(t) {
- return t && t.splice && "number" == typeof t.length
- },
- isObserveLike: function(t) {
- return t instanceof can.Map || t && !!t._get
- },
- emptyHandler: function() {},
- jsonParse: function(str) {
- return "'" === str[0] ? str.substr(1, str.length - 2) : "undefined" === str ? void 0 : can.global.JSON ? JSON.parse(str) : eval("(" + str + ")")
- },
- mixins: {
- last: function() {
- return this.stack[this.stack.length - 1]
- },
- add: function(t) {
- this.last().add(t)
- },
- subSectionDepth: function() {
- return this.stack.length - 1
- }
- },
- convertToScopes: function(t, e, n, i, r, o) {
- r && (t.fn = this.makeRendererConvertScopes(r, e, n, i)),
- o && (t.inverse = this.makeRendererConvertScopes(o, e, n, i))
- },
- makeRendererConvertScopes: function(t, e, n, i) {
- var r = function(n, i, r) {
- return t(n || e, i, r)
- };
- return can.__notObserve(function(t, o, s) {
- return void 0 === t || t instanceof can.view.Scope || (t = e.add(t)),
- void 0 === o || o instanceof Options || (o = n.add(o)),
- r(t, o || n, s || i)
- })
- },
- Options: Options
- }
- }),
- define("can/view/mustache_helpers", ["can/util/library", "can/view/utils", "can/view/live"], function(t, e, n) {
- n = n || t.view.live;
- var i = function(n) {
- return e.isObserveLike(n) && e.isArrayLike(n) && n.attr("length") ? n : t.isFunction(n) ? n() : n
- }
- , r = function(t) {
- var e = {};
- for (var n in t) {
- var i = t[n];
- i && i.isComputed ? e[n] = i() : e[n] = i
- }
- return e
- }
- , o = function(t) {
- return t && "function" == typeof t.fn && "function" == typeof t.inverse
- }
- , s = {
- each: function(r, o) {
- var s, a, u, c = i(r), l = [];
- if (c instanceof t.List)
- return function(e) {
- var i = [e];
- i.expression = "live.list",
- t.view.nodeLists.register(i, null, o.nodeList, !0),
- t.view.nodeLists.update(o.nodeList, [e]);
- n.list(e, r, function(t, e, n) {
- return o.fn(o.scope.add({
- "%index": e,
- "@index": e
- }, {
- notContext: !0
- }).add(t), o.options, n)
- }, o.context, e.parentNode, i, function(t, e) {
- return o.inverse(o.scope.add(t), o.options, e)
- })
- }
- ;
- var p = c;
- if (p && e.isArrayLike(p))
- for (u = 0; u < p.length; u++)
- l.push(o.fn(o.scope.add({
- "%index": u,
- "@index": u
- }, {
- notContext: !0
- }).add(p[u])));
- else if (e.isObserveLike(p))
- for (s = t.Map.keys(p),
- u = 0; u < s.length; u++)
- a = s[u],
- l.push(o.fn(o.scope.add({
- "%key": a,
- "@key": a
- }, {
- notContext: !0
- }).add(p[a])));
- else if (p instanceof Object)
- for (a in p)
- l.push(o.fn(o.scope.add({
- "%key": a,
- "@key": a
- }, {
- notContext: !0
- }).add(p[a])));
- return l
- },
- "@index": function(e, n) {
- n || (n = e,
- e = 0);
- var i = n.scope.attr("@index");
- return "" + ((t.isFunction(i) ? i() : i) + e)
- },
- if: function(e, n) {
- return (t.isFunction(e) ? t.compute.truthy(e)() : !!i(e)) ? n.fn(n.scope || this) : n.inverse(n.scope || this)
- },
- is: function() {
- var e, n, r = arguments[arguments.length - 1];
- if (arguments.length - 2 <= 0)
- return r.inverse();
- var o = arguments;
- return t.compute(function() {
- for (var r = 0; r < o.length - 1; r++) {
- if (n = i(o[r]),
- n = t.isFunction(n) ? n() : n,
- r > 0 && n !== e)
- return !1;
- e = n
- }
- return !0
- })() ? r.fn() : r.inverse()
- },
- eq: function() {
- return s.is.apply(this, arguments)
- },
- unless: function(e, n) {
- return s.if.apply(this, [e, t.extend({}, n, {
- fn: n.inverse,
- inverse: n.fn
- })])
- },
- with: function(t, e) {
- var n = t;
- if (t = i(t))
- return e.fn(n)
- },
- log: function(t, e) {
- "undefined" != typeof console && console.log && (e ? console.log(t, e.context) : console.log(t.context))
- },
- data: function(e) {
- var n = 2 === arguments.length ? this : arguments[1];
- return function(i) {
- t.data(t.$(i), e, n || this.context)
- }
- },
- switch: function(t, e) {
- i(t);
- var n = !1
- , r = e.helpers.add({
- case: function(e, r) {
- if (!n && i(t) === i(e))
- return n = !0,
- r.fn(r.scope || this)
- },
- default: function(t) {
- if (!n)
- return t.fn(t.scope || this)
- }
- });
- return e.fn(e.scope, r)
- },
- joinBase: function(e) {
- var n = [].slice.call(arguments)
- , r = n.pop()
- , o = t.map(n, function(e) {
- var n = i(e);
- return t.isFunction(n) ? n() : n
- }).join("")
- , s = r.helpers.attr("helpers.module")
- , a = s ? s.uri : void 0;
- if ("." === o[0] && a)
- return t.joinURIs(a, o);
- var u = t.baseURL || "undefined" != typeof System && (System.renderingLoader && System.renderingLoader.baseURL || System.baseURL) || location.pathname;
- return "/" !== o[0] && "/" !== u[u.length - 1] && (u += "/"),
- t.joinURIs(u, o)
- },
- routeUrl: function(e, n) {
- return e || (e = {}),
- "function" == typeof e.fn && "function" == typeof e.inverse && (e = r(e.hash)),
- t.route.url(e, "boolean" == typeof n ? n : void 0)
- },
- routeCurrent: function(e) {
- var n = t.last(arguments)
- , i = n && o(n);
- return !n || !i || n.exprData instanceof t.expression.Call ? t.route.current(o(e) ? {} : e || {}) : t.route.current(r(e.hash || {})) ? e.fn() : e.inverse()
- }
- };
- s.routeCurrent.callAsMethod = !0,
- s.eachOf = s.each;
- var a = function(t, e) {
- s[t] = e
- };
- return {
- registerHelper: a,
- registerSimpleHelper: function(e, n) {
- a(e, t.view.simpleHelper(n))
- },
- getHelper: function(t, e) {
- var n = e && e.get("helpers." + t, {
- proxyMethods: !1
- });
- if (n || (n = s[t]),
- n)
- return {
- fn: n
- }
- }
- }
- }),
- define("can/view/expression", ["can/util/library", "can/view/utils", "can/view/mustache_helpers", "can/view/scope"], function(t, e, n, i) {
- var r = function(e, n, i) {
- var r = n.computeData(e, i);
- return t.compute.temporarilyBind(r.compute),
- r
- }
- , o = function(t, e, n, i) {
- var o = r(t, e, i);
- return o.compute.computeInstance.hasDependencies ? {
- value: o.compute,
- computeData: o
- } : {
- value: o.initialValue,
- computeData: o
- }
- }
- , s = function(t, e, i, r) {
- var s = o(t, e, 0, r);
- if (void 0 === s.computeData.initialValue) {
- "@" === t.charAt(0) && "@index" !== t && (t = t.substr(1));
- var a = n.getHelper(t, i);
- s.helper = a && a.fn
- }
- return s
- }
- , a = function(t) {
- return t instanceof p || t instanceof u ? t : new p(t)
- }
- , u = function(t) {
- this._value = t
- };
- u.prototype.value = function() {
- return this._value
- }
- ;
- var c = function(t, e) {
- this.key = t,
- this.rootExpr = e
- };
- c.prototype.value = function(t, e) {
- var n = s(this.key, t, e);
- return this.isHelper = n.helper && !n.helper.callAsMethod,
- n.helper || n.value
- }
- ;
- var l = function(t, e) {
- c.apply(this, arguments)
- };
- l.prototype.value = function(t, e) {
- return o(this.key, t).value
- }
- ;
- var p = function(t, e) {
- this.expr = t,
- this.modifiers = e || {},
- this.isCompute = !1
- };
- p.prototype.value = function() {
- return this.expr.value.apply(this.expr, arguments)
- }
- ;
- var h = function(e, n, i) {
- this.methodExpr = e,
- this.argExprs = t.map(n, a);
- var r = this.hashExprs = {};
- t.each(i, function(t, e) {
- r[e] = a(t)
- })
- };
- h.prototype.args = function(t, e) {
- for (var n = [], i = 0, r = this.argExprs.length; i < r; i++) {
- var o = this.argExprs[i]
- , s = o.value.apply(o, arguments);
- n.push({
- call: s && s.isComputed && !o.modifiers.compute,
- value: s
- })
- }
- return function() {
- for (var t = [], e = 0, i = n.length; e < i; e++)
- t[e] = n[e].call ? n[e].value() : n[e].value;
- return t
- }
- }
- ,
- h.prototype.hash = function(t, e) {
- var n = {};
- for (var i in this.hashExprs) {
- var r = this.hashExprs[i]
- , o = r.value.apply(r, arguments);
- n[i] = {
- call: o && o.isComputed && !r.modifiers.compute,
- value: o
- }
- }
- return function() {
- var t = {};
- for (var e in n)
- t[e] = n[e].call ? n[e].value() : n[e].value;
- return t
- }
- }
- ,
- h.prototype.value = function(e, n, i) {
- var r = this.methodExpr.value(e, n);
- this.isHelper = this.methodExpr.isHelper;
- var o = !t.isEmptyObject(this.hashExprs)
- , s = this.args(e, n)
- , a = this.hash(e, n);
- return t.compute(function() {
- var t = r;
- if (t && t.isComputed && (t = t()),
- "function" == typeof t) {
- var e = s();
- return o && e.push(a()),
- i && e.push(i),
- t.apply(null, e)
- }
- })
- }
- ;
- var d = function() {
- c.apply(this, arguments)
- };
- d.prototype.value = function(t, e) {
- var n = s(this.key, t, e, {
- isArgument: !0,
- args: [t.attr("."), t]
- });
- return n.helper || n.value
- }
- ;
- var f = function() {
- c.apply(this, arguments)
- };
- f.prototype.value = function(t, e) {
- return o(this.key, t, 0, {
- callMethodsOnObservables: !0,
- isArgument: !0,
- args: [t.attr("."), t]
- }).value
- }
- ;
- var g = function(t, e, n) {
- this.methodExpr = t,
- this.argExprs = e,
- this.hashExprs = n,
- this.mode = null
- };
- g.prototype.args = function(t, e) {
- for (var n = [], i = 0, r = this.argExprs.length; i < r; i++) {
- var o = this.argExprs[i];
- n.push(o.value.apply(o, arguments))
- }
- return n
- }
- ,
- g.prototype.hash = function(t, e) {
- var n = {};
- for (var i in this.hashExprs) {
- var r = this.hashExprs[i];
- n[i] = r.value.apply(r, arguments)
- }
- return n
- }
- ,
- g.prototype.helperAndValue = function(e, i) {
- var o, s, a, c, l = this.argExprs.length || !t.isEmptyObject(this.hashExprs), p = this.methodExpr instanceof u ? "" + this.methodExpr._value : this.methodExpr.key;
- if (l) {
- o = n.getHelper(p, i);
- var h = e.attr(".");
- o || "function" != typeof h[p] || (o = {
- fn: h[p]
- })
- }
- if (!o) {
- c = this.args(e, i);
- var d = r(p, e, {
- isArgument: !1,
- args: c && c.length ? c : [e.attr("."), e]
- })
- , f = d.compute;
- a = d.initialValue,
- s = d.compute.computeInstance.hasDependencies ? f : a,
- l || void 0 !== a || (o = n.getHelper(p, i))
- }
- return {
- value: s,
- args: c,
- helper: o && o.fn
- }
- }
- ,
- g.prototype.evaluator = function(n, i, r, o, s, a, u, c) {
- var l = {
- fn: function() {},
- inverse: function() {}
- }
- , p = i.attr(".")
- , h = this.args(i, r, s, a, u, c)
- , d = this.hash(i, r, s, a, u, c);
- return e.convertToScopes(l, i, r, s, a, u),
- t.simpleExtend(l, {
- context: p,
- scope: i,
- contexts: i,
- hash: d,
- nodeList: s,
- exprData: this,
- helperOptions: r,
- helpers: r
- }),
- h.push(l),
- function() {
- return n.apply(p, h)
- }
- }
- ,
- g.prototype.value = function(e, n, i, r, o, s) {
- var a = this.helperAndValue(e, n)
- , u = a.helper;
- if (!u)
- return a.value;
- var c = this.evaluator(u, e, n, i, r, o, s)
- , l = t.compute(c);
- return t.compute.temporarilyBind(l),
- l.computeInstance.hasDependencies ? l : l()
- }
- ;
- var v = /[\w\.\\\-_@\/\&%]+/
- , m = /('.*?'|".*?"|=|[\w\.\\\-_@\/*%\$]+|[\(\)]|,|\~)/g
- , b = /^('.*?'|".*?"|[0-9]+\.?[0-9]*|true|false|null|undefined)$/
- , y = function(t) {
- return v.test(t)
- }
- , _ = /^[\.@]\w/
- , w = function(t) {
- return y(t) && _.test(t)
- }
- , x = function(t) {
- return t.children || (t.children = []),
- t
- }
- , C = function() {
- this.root = {
- children: [],
- type: "Root"
- },
- this.current = this.root,
- this.stack = [this.root]
- };
- t.simpleExtend(C.prototype, {
- top: function() {
- return t.last(this.stack)
- },
- isRootTop: function() {
- return this.top() === this.root
- },
- popTo: function(t) {
- this.popUntil(t),
- this.isRootTop() || this.stack.pop()
- },
- firstParent: function(e) {
- for (var n = this.stack.length - 2; n > 0 && -1 === t.inArray(this.stack[n].type, e); )
- n--;
- return this.stack[n]
- },
- popUntil: function(e) {
- for (; -1 === t.inArray(this.top().type, e) && !this.isRootTop(); )
- this.stack.pop();
- return this.top()
- },
- addTo: function(t, e) {
- var n = this.popUntil(t);
- x(n).children.push(e)
- },
- addToAndPush: function(t, e) {
- this.addTo(t, e),
- this.stack.push(e)
- },
- topLastChild: function() {
- return t.last(this.top().children)
- },
- replaceTopLastChild: function(t) {
- var e = x(this.top()).children;
- return e.pop(),
- e.push(t),
- t
- },
- replaceTopLastChildAndPush: function(t) {
- this.replaceTopLastChild(t),
- this.stack.push(t)
- },
- replaceTopAndPush: function(t) {
- var e;
- return this.top() === this.root ? e = x(this.top()).children : (this.stack.pop(),
- e = x(this.top()).children),
- e.pop(),
- e.push(t),
- this.stack.push(t),
- t
- }
- });
- var k = function(t) {
- var e = t.lastIndexOf("./")
- , n = t.lastIndexOf(".");
- if (n > e)
- return t.substr(0, n) + "@" + t.substr(n + 1);
- var i = -1 === e ? 0 : e + 2
- , r = t.charAt(i);
- return "." === r || "@" === r ? t.substr(0, i) + "@" + t.substr(i + 1) : t.substr(0, i) + "@" + t.substr(i)
- }
- , S = function(t) {
- return "Lookup" === t.type && (t.key = k(t.key)),
- t
- }
- , T = function(t) {
- var e = t.top();
- if (e && "Lookup" === e.type) {
- var n = t.stack[t.stack.length - 2];
- "Helper" !== n.type && n && t.replaceTopAndPush({
- type: "Helper",
- method: e
- })
- }
- }
- , A = {
- convertKeyToLookup: k,
- Literal: u,
- Lookup: c,
- ScopeLookup: l,
- Arg: p,
- Hash: function() {},
- Call: h,
- Helper: g,
- HelperLookup: d,
- HelperScopeLookup: f,
- tokenize: function(e) {
- var n = [];
- return (t.trim(e) + " ").replace(m, function(t, e) {
- n.push(e)
- }),
- n
- },
- lookupRules: {
- default: function(t, e, n) {
- var i = ("Helper" !== e || t.root ? "" : "Helper") + (n ? "Scope" : "") + "Lookup";
- return A[i]
- },
- method: function(t, e, n) {
- return l
- }
- },
- methodRules: {
- default: function(t) {
- return "Call" === t.type ? h : g
- },
- call: function(t) {
- return h
- }
- },
- parse: function(t, e) {
- e = e || {};
- var n = this.ast(t);
- return e.lookupRule || (e.lookupRule = "default"),
- "string" == typeof e.lookupRule && (e.lookupRule = A.lookupRules[e.lookupRule]),
- e.methodRule || (e.methodRule = "default"),
- "string" == typeof e.methodRule && (e.methodRule = A.methodRules[e.methodRule]),
- this.hydrateAst(n, e, e.baseMethodType || "Helper")
- },
- hydrateAst: function(t, e, n, i) {
- if ("Lookup" === t.type)
- return new (e.lookupRule(t, n, i))(t.key,t.root && this.hydrateAst(t.root, e, n));
- if ("Literal" === t.type)
- return new u(t.value);
- if ("Arg" === t.type)
- return new p(this.hydrateAst(t.children[0], e, n, i),{
- compute: !0
- });
- if ("Hash" === t.type)
- throw new Error("");
- if ("Call" === t.type || "Helper" === t.type) {
- var r = {}
- , o = []
- , s = t.children;
- if (s)
- for (var a = 0; a < s.length; a++) {
- var c = s[a];
- "Hash" === c.type ? r[c.prop] = this.hydrateAst(c.children[0], e, t.type, !0) : o.push(this.hydrateAst(c, e, t.type, !0))
- }
- return new (e.methodRule(t))(this.hydrateAst(t.method, e, t.type),o,r)
- }
- },
- ast: function(t) {
- var e = this.tokenize(t);
- return this.parseAst(e, {
- index: 0
- })
- },
- parseAst: function(n, i) {
- for (var r, o = new C; i.index < n.length; ) {
- var s = n[i.index]
- , a = n[i.index + 1];
- if (i.index++,
- b.test(s))
- T(o),
- o.addTo(["Helper", "Call", "Hash"], {
- type: "Literal",
- value: e.jsonParse(s)
- });
- else if ("=" === a) {
- if ((r = o.top()) && "Lookup" === r.type) {
- var u = o.firstParent(["Call", "Helper", "Hash"]);
- "Call" !== u.type && "Root" !== u.type || (o.popUntil(["Call"]),
- r = o.top(),
- o.replaceTopAndPush({
- type: "Helper",
- method: "Root" === r.type ? t.last(r.children) : r
- }))
- }
- o.addToAndPush(["Helper", "Call"], {
- type: "Hash",
- prop: s
- }),
- i.index++
- } else if (v.test(s)) {
- var c = o.topLastChild();
- c && "Call" === c.type && w(s) ? o.replaceTopLastChildAndPush({
- type: "Lookup",
- root: c,
- key: s
- }) : (T(o),
- o.addToAndPush(["Helper", "Call", "Hash", "Arg"], {
- type: "Lookup",
- key: s
- }))
- } else if ("~" === s)
- T(o),
- o.addToAndPush(["Helper", "Call", "Hash"], {
- type: "Arg",
- key: s
- });
- else if ("(" === s) {
- if ("Lookup" !== (r = o.top()).type)
- throw new Error("Unable to understand expression " + n.join(""));
- o.replaceTopAndPush({
- type: "Call",
- method: S(r)
- })
- } else
- ")" === s ? o.popTo(["Call"]) : "," === s && o.popUntil(["Call"])
- }
- return o.root.children[0]
- }
- };
- return t.expression = A,
- A
- }),
- define("can/view/href", ["can/util/library", "can/view/expression", "can/view/callbacks", "can/view/scope"], function(t, e) {
- var n = function(t) {
- return "{" === t[0] && "}" === t[t.length - 1] ? t.substr(1, t.length - 2) : t
- };
- t.view.attr("can-href", function(i, r) {
- var o = e.parse("tmp(" + n(i.getAttribute("can-href")) + ")", {
- baseMethodType: "Call"
- }).hash(r.scope, null)
- , s = t.compute(function() {
- return t.route.url(o())
- });
- i.setAttribute("href", s());
- var a = function(t, e) {
- i.setAttribute("href", e)
- };
- s.bind("change", a),
- t.bind.call(i, "removed", function() {
- s.unbind("change", a)
- })
- })
- }),
- define("can/view/bindings", ["can/util/library", "can/view/expression", "can/view/callbacks", "can/control", "can/view/scope", "can/view/href"], function(t, e, n) {
- var i = {
- viewModel: function(e, n, i, r) {
- r = r || {};
- var o, s = {}, a = [], u = {}, l = {}, p = t.extend({}, r);
- t.each(t.makeArray(e.attributes), function(t) {
- var i = c(t, e, {
- templateType: n.templateType,
- scope: n.scope,
- semaphore: s,
- getViewModel: function() {
- return o
- },
- attributeViewModelBindings: p,
- alreadyUpdatedChild: !0
- });
- i && (i.onCompleteBinding && (i.bindingInfo.parentToChild && void 0 !== i.value && (r[g(i.bindingInfo.childName)] = i.value),
- a.push(i.onCompleteBinding)),
- u[t.name] = i.onTeardown)
- }),
- o = i(r);
- for (var h = 0, d = a.length; h < d; h++)
- a[h]();
- return t.bind.call(e, "attributes", function(t) {
- var i = t.attributeName
- , r = e.getAttribute(i);
- u[i] && u[i]();
- var s = l[i] && "attribute" === l[i].parent;
- if (null !== r || s) {
- var a = c({
- name: i,
- value: r
- }, e, {
- templateType: n.templateType,
- scope: n.scope,
- semaphore: {},
- getViewModel: function() {
- return o
- },
- attributeViewModelBindings: p,
- initializeValues: !0
- });
- a && (a.onCompleteBinding && a.onCompleteBinding(),
- l[i] = a.bindingInfo,
- u[i] = a.onTeardown)
- }
- }),
- function() {
- for (var t in u)
- u[t]()
- }
- },
- data: function(e, n) {
- if (!t.data(t.$(e), "preventDataBindings")) {
- var i, r = t.viewModel(e), o = {}, s = c({
- name: n.attributeName,
- value: e.getAttribute(n.attributeName)
- }, e, {
- templateType: n.templateType,
- scope: n.scope,
- semaphore: o,
- getViewModel: function() {
- return r
- }
- });
- s.onCompleteBinding && s.onCompleteBinding(),
- i = s.onTeardown,
- t.one.call(e, "removed", function() {
- i()
- }),
- t.bind.call(e, "attributes", function(t) {
- var s = t.attributeName
- , a = e.getAttribute(s);
- if (s === n.attributeName && (i && i(),
- null !== a)) {
- var u = c({
- name: s,
- value: a
- }, e, {
- templateType: n.templateType,
- scope: n.scope,
- semaphore: o,
- getViewModel: function() {
- return r
- },
- initializeValues: !0
- });
- u && (u.onCompleteBinding && u.onCompleteBinding(),
- i = u.onTeardown)
- }
- })
- }
- },
- reference: function(e, n) {
- e.getAttribute(n.attributeName) && console.warn("*reference attributes can only export the view model.");
- var i = t.camelize(n.attributeName.substr(1).toLowerCase())
- , r = t.viewModel(e);
- n.scope.getRefs()._context.attr("*" + i, r)
- },
- event: function(n, i) {
- var r = i.attributeName
- , o = 0 === r.indexOf("can-")
- , s = 0 === r.indexOf("can-") ? r.substr("can-".length) : h(r, "(", ")")
- , a = o;
- "$" === s.charAt(0) && (s = s.substr(1),
- a = !0);
- var u = function(o) {
- var s = n.getAttribute(r);
- if (s) {
- var a = t.$(n)
- , u = t.viewModel(a[0])
- , c = e.parse(h(s), {
- lookupRule: "method",
- methodRule: "call"
- });
- if (!(c instanceof e.Call || c instanceof e.Helper)) {
- var l = t.map([i.scope._context, a].concat(t.makeArray(arguments)), function(t) {
- return new e.Literal(t)
- });
- c = new e.Call(c,l,{})
- }
- var p = i.scope.read(c.methodExpr.key, {
- isArgument: !0
- });
- if (!p.value)
- return p = i.scope.read(c.methodExpr.key, {
- isArgument: !0
- }),
- null;
- var d = i.scope.add({
- "@element": a,
- "@event": o,
- "@viewModel": u,
- "@scope": i.scope,
- "@context": i.scope._context,
- "%element": this,
- $element: a,
- "%event": o,
- "%viewModel": u,
- "%scope": i.scope,
- "%context": i.scope._context
- }, {
- notContext: !0
- })
- , f = c.args(d, null)()
- , g = c.hash(d, null)();
- return t.isEmptyObject(g) || f.push(g),
- p.value.apply(p.parent, f)
- }
- };
- if (v[s]) {
- var c = v[s](i, n, u);
- u = c.handler,
- s = c.event
- }
- t.bind.call(a ? n : t.viewModel(n), s, u);
- var l = function(e) {
- e.attributeName !== r || this.getAttribute(r) || (t.unbind.call(a ? n : t.viewModel(n), s, u),
- t.unbind.call(n, "attributes", l))
- };
- t.bind.call(n, "attributes", l)
- },
- value: function(e, n) {
- var i, o = "$value", s = t.trim(h(e.getAttribute("can-value")));
- if ("input" !== e.nodeName.toLowerCase() || "checkbox" !== e.type && "radio" !== e.type)
- p(e) && (o = "$innerHTML");
- else {
- var a = r.scope(e, n.scope, s, {}, !0);
- if ("checkbox" === e.type) {
- var u = !t.attr.has(e, "can-true-value") || e.getAttribute("can-true-value")
- , l = !!t.attr.has(e, "can-false-value") && e.getAttribute("can-false-value");
- i = t.compute(function(t) {
- if (!arguments.length)
- return a() == u;
- a(t ? u : l)
- })
- } else
- "radio" === e.type && (i = t.compute(function(t) {
- if (!arguments.length)
- return a() == e.value;
- t && a(e.value)
- }));
- o = "$checked",
- s = "getterSetter",
- n.scope = new t.view.Scope({
- getterSetter: i
- })
- }
- c({
- name: "{(" + o + "})",
- value: s
- }, e, {
- templateType: n.templateType,
- scope: n.scope,
- semaphore: {},
- initializeValues: !0,
- legacyBindings: !0,
- syncChildWithParent: !0
- })
- }
- };
- t.view.attr(/^\{[^\}]+\}$/, i.data),
- t.view.attr(/\*[\w\.\-_]+/, i.reference),
- t.view.attr(/^\([\$?\w\.]+\)$/, i.event),
- t.view.attr(/can-[\w\.]+/, i.event),
- t.view.attr("can-value", i.value);
- var r = {
- scope: function(n, i, r, o, s) {
- return r ? s ? e.parse(r, {
- baseMethodType: "Call"
- }).value(i, new t.view.Options({})) : function(t) {
- i.attr(g(r), t)
- }
- : t.compute()
- },
- viewModel: function(e, n, i, r, o) {
- var s = g(i);
- return o ? t.compute(function(e) {
- var n = r.getViewModel();
- if (!arguments.length)
- return "." === i ? n : t.compute.read(n, t.compute.read.reads(i), {}).value;
- n.attr(s, e)
- }) : function(t) {
- r.getViewModel().attr(s, t)
- }
- },
- attribute: function(e, n, i, r, o, s) {
- s || (s = "innerHTML" === i ? ["blur", "change"] : "change"),
- t.isArray(s) || (s = [s]);
- var a, u, c, l = "select" === e.nodeName.toLowerCase(), p = "value" === i && l && e.multiple, h = !1, d = function(n) {
- if (l && !h && (clearTimeout(c),
- c = setTimeout(function() {
- d(n)
- }, 1)),
- u = n,
- p) {
- n && "string" == typeof n ? (n = n.split(";"),
- a = !0) : n = n ? t.makeArray(n) : [];
- var o = {};
- t.each(n, function(t) {
- o[t] = !0
- }),
- t.each(e.childNodes, function(t) {
- t.value && (t.selected = !!o[t.value])
- })
- } else
- !r.legacyBindings && l && "selectedIndex"in e && (e.selectedIndex = -1),
- t.attr.setAttrOrProp(e, i, null == n ? "" : n);
- return n
- }, f = function() {
- if (p) {
- var n = []
- , r = e.childNodes;
- return t.each(r, function(t) {
- t.selected && t.value && n.push(t.value)
- }),
- a ? n.join(";") : n
- }
- return t.attr.get(e, i)
- };
- return l && setTimeout(function() {
- h = !0
- }, 1),
- t.compute(f(), {
- on: function(n) {
- t.each(s, function(i) {
- t.bind.call(e, i, n)
- })
- },
- off: function(n) {
- t.each(s, function(i) {
- t.unbind.call(e, i, n)
- })
- },
- get: f,
- set: d
- })
- }
- }
- , o = {
- childToParent: function(e, n, i, r, o, s) {
- var a = "function" == typeof n
- , u = function(e, u) {
- r[o] || (a ? (n(u),
- s && n() !== i() && (r[o] = (r[o] || 0) + 1,
- i(n()),
- t.batch.after(function() {
- --r[o]
- }))) : n instanceof t.Map && n.attr(u, !0))
- };
- return i && i.isComputed && i.bind("change", u),
- u
- },
- parentToChild: function(e, n, i, r, o) {
- var s = function(e, n) {
- r[o] = (r[o] || 0) + 1,
- i(n),
- t.batch.after(function() {
- --r[o]
- })
- };
- return n && n.isComputed && n.bind("change", s),
- s
- }
- }
- , s = function(e, i, r) {
- var o = e.name
- , s = e.value || ""
- , c = o.match(a);
- if (!c) {
- var l = u.test(o)
- , p = t.camelize(o);
- if (l || n.attr(o))
- return;
- var h = "{" === s[0] && "}" === t.last(s)
- , d = "legacy" === r ? i[p] : !h
- , f = h ? s.substr(1, s.length - 2) : s;
- return d ? {
- bindingAttributeName: o,
- parent: "attribute",
- parentName: o,
- child: "viewModel",
- childName: p,
- parentToChild: !0,
- childToParent: !0
- } : {
- bindingAttributeName: o,
- parent: "scope",
- parentName: f,
- child: "viewModel",
- childName: p,
- parentToChild: !0,
- childToParent: !0
- }
- }
- var g = !!c[1]
- , v = g || !!c[2]
- , m = g || !v
- , b = c[3];
- return "$" === b.charAt(0) ? {
- parent: "scope",
- child: "attribute",
- childToParent: v,
- parentToChild: m,
- bindingAttributeName: o,
- childName: b.substr(1),
- parentName: s,
- initializeValues: !0
- } : {
- parent: "scope",
- child: "viewModel",
- childToParent: v,
- parentToChild: m,
- bindingAttributeName: o,
- childName: t.camelize(b),
- parentName: s,
- initializeValues: !0
- }
- }
- , a = /\{(\()?(\^)?([^\}\)]+)\)?\}/
- , u = /^(data-view-id|class|id|\[[\w\.-]+\]|#[\w\.-])$/i
- , c = function(t, e, n) {
- var i = s(t, n.attributeViewModelBindings, n.templateType);
- if (i) {
- i.alreadyUpdatedChild = n.alreadyUpdatedChild,
- n.initializeValues && (i.initializeValues = !0);
- var a, u, c = r[i.parent](e, n.scope, i.parentName, n, i.parentToChild), p = r[i.child](e, n.scope, i.childName, n, i.childToParent);
- i.parentToChild && (u = o.parentToChild(e, c, p, n.semaphore, i.bindingAttributeName));
- var h = function() {
- i.childToParent && (a = o.childToParent(e, c, p, n.semaphore, i.bindingAttributeName, n.syncChildWithParent)),
- i.initializeValues && l(i, p, c, u, a)
- }
- , g = function() {
- f(c, u),
- f(p, a)
- };
- return "viewModel" === i.child ? {
- value: d(c),
- onCompleteBinding: h,
- bindingInfo: i,
- onTeardown: g
- } : (h(),
- {
- bindingInfo: i,
- onTeardown: g
- })
- }
- }
- , l = function(t, e, n, i, r) {
- var o = !1;
- t.parentToChild && !t.childToParent || (!t.parentToChild && t.childToParent ? o = !0 : void 0 === d(e) || void 0 === d(n) && (o = !0)),
- o ? r({}, d(e)) : t.alreadyUpdatedChild || i({}, d(n))
- }
- , p = function() {
- var t = {
- "": !0,
- true: !0,
- false: !1
- }
- , e = function(e) {
- if (e && e.getAttribute) {
- var n = e.getAttribute("contenteditable");
- return t[n]
- }
- };
- return function(t) {
- var n = e(t);
- return "boolean" == typeof n ? n : !!e(t.parentNode)
- }
- }()
- , h = function(t, e, n) {
- return e = e || "{",
- n = n || "}",
- t[0] === e && t[t.length - 1] === n ? t.substr(1, t.length - 2) : t
- }
- , d = function(t) {
- return t && t.isComputed ? t() : t
- }
- , f = function(t, e) {
- t && t.isComputed && "function" == typeof e && t.unbind("change", e)
- }
- , g = function(t) {
- return t.replace(/@/g, "")
- }
- , v = {
- enter: function(t, e, n) {
- return {
- event: "keyup",
- handler: function(t) {
- if (13 === t.keyCode)
- return n.call(this, t)
- }
- }
- }
- };
- return t.bindings = {
- behaviors: i,
- getBindingInfo: s,
- special: v
- },
- t.bindings
- }),
- define("can/view/mustache", ["can/util/library", "can/view/scope", "can/view", "can/scanner", "can/compute", "can/render", "can/view/bindings"], function(t) {
- t.view.ext = ".mustache";
- var e = "scope,options"
- , n = /((([^'"\s]+?=)?('.*?'|".*?"))|.*?)\s/g
- , i = /^(('.*?'|".*?"|[0-9]+\.?[0-9]*|true|false|null|undefined)|((.+?)=(('.*?'|".*?"|[0-9]+\.?[0-9]*|true|false)|(.+))))$/
- , r = function(t) {
- return '{get:"' + t.replace(/"/g, '\\"') + '"}'
- }
- , o = function(t) {
- return t && "string" == typeof t.get
- }
- , s = function(e) {
- return e instanceof t.Map || e && !!e._get
- }
- , a = function(t) {
- return t && t.splice && "number" == typeof t.length
- }
- , u = function(e, n, i) {
- var r = function(t, i) {
- return e(t || n, i)
- };
- return function(e, o) {
- return void 0 === e || e instanceof t.view.Scope || (e = n.add(e)),
- void 0 === o || o instanceof t.view.Options || (o = i.add(o)),
- r(e, o || i)
- }
- }
- , c = function(e, n) {
- if (this.constructor !== c) {
- var i = new c(e);
- return function(t, e) {
- return i.render(t, e)
- }
- }
- "function" != typeof e ? (t.extend(this, e),
- this.template = this.scanner.scan(this.text, this.name)) : this.template = {
- fn: e
- }
- };
- t.Mustache = t.global.Mustache = c,
- c.prototype.render = function(e, n) {
- return e instanceof t.view.Scope || (e = new t.view.Scope(e || {})),
- n instanceof t.view.Options || (n = new t.view.Options(n || {})),
- n = n || {},
- this.template.fn.call(e, e, n)
- }
- ,
- t.extend(c.prototype, {
- scanner: new t.view.Scanner({
- text: {
- start: "",
- scope: "scope",
- options: ",options: options",
- argNames: e
- },
- tokens: [["returnLeft", "{{{", "{{[{&]"], ["commentFull", "{{!}}", "^[\\s\\t]*{{!.+?}}\\n"], ["commentLeft", "{{!", "(\\n[\\s\\t]*{{!|{{!)"], ["escapeFull", "{{}}", "(^[\\s\\t]*{{[#/^][^}]+?}}\\n|\\n[\\s\\t]*{{[#/^][^}]+?}}\\n|\\n[\\s\\t]*{{[#/^][^}]+?}}$)", function(t) {
- return {
- before: /^\n.+?\n$/.test(t) ? "\n" : "",
- content: t.match(/\{\{(.+?)\}\}/)[1] || ""
- }
- }
- ], ["escapeLeft", "{{"], ["returnRight", "}}}"], ["right", "}}"]],
- helpers: [{
- name: /^>[\s]*\w*/,
- fn: function(n, i) {
- return "can.Mustache.renderPartial('" + t.trim(n.replace(/^>\s?/, "")).replace(/["|']/g, "") + "'," + e + ")"
- }
- }, {
- name: /^\s*data\s/,
- fn: function(t, e) {
- return "can.proxy(function(__){can.data(can.$(__),'" + t.match(/["|'](.*)["|']/)[1] + "', this.attr('.')); }, scope)"
- }
- }, {
- name: /\s*\(([\$\w]+)\)\s*->([^\n]*)/,
- fn: function(t) {
- var e = /\s*\(([\$\w]+)\)\s*->([^\n]*)/
- , n = t.match(e);
- return "can.proxy(function(__){var " + n[1] + "=can.$(__);with(scope.attr('.')){" + n[2] + "}}, this);"
- }
- }, {
- name: /^.*$/,
- fn: function(e, o) {
- var s = !1
- , a = {
- content: "",
- startTxt: !1,
- startOnlyTxt: !1,
- end: !1
- };
- if ((e = t.trim(e)).length && (s = e.match(/^([#^\/]|else$)/))) {
- switch (s = s[0]) {
- case "#":
- case "^":
- o.specialAttribute ? a.startOnlyTxt = !0 : (a.startTxt = !0,
- a.escaped = 0);
- break;
- case "/":
- return a.end = !0,
- a.content += 'return ___v1ew.join("");}}])',
- a
- }
- e = e.substring(1)
- }
- if ("else" !== s) {
- var u, c = [], l = [], p = 0;
- a.content += "can.Mustache.txt(\n" + (o.specialAttribute ? "{scope:scope,options:options, special: true}" : "{scope:scope,options:options}") + ",\n" + (s ? '"' + s + '"' : "null") + ",",
- (t.trim(e) + " ").replace(n, function(t, e) {
- p && (u = e.match(i)) ? u[2] ? c.push(u[0]) : l.push(u[4] + ":" + (u[6] ? u[6] : r(u[5]))) : c.push(r(e)),
- p++
- }),
- a.content += c.join(","),
- l.length && (a.content += ",{___h4sh:{" + l.join(",") + "}}")
- }
- switch (s && "else" !== s && (a.content += ",[\n\n"),
- s) {
- case "^":
- case "#":
- a.content += "{fn:function(scope,options){var ___v1ew = [];";
- break;
- case "else":
- a.content += 'return ___v1ew.join("");}},\n{inverse:function(scope,options){\nvar ___v1ew = [];';
- break;
- default:
- a.content += ")"
- }
- return s || (a.startTxt = !0,
- a.end = !0),
- a
- }
- }]
- })
- });
- for (var l = t.view.Scanner.prototype.helpers, p = 0; p < l.length; p++)
- c.prototype.scanner.helpers.unshift(l[p]);
- return c.txt = function(e, n, i) {
- for (var r, l, p = e.scope, h = e.options, d = [], f = {
- fn: function() {},
- inverse: function() {}
- }, g = p.attr("."), v = !0, m = 3; m < arguments.length; m++) {
- var b = arguments[m];
- if (n && t.isArray(b))
- f = t.extend.apply(t, [f].concat(b));
- else if (b && b.___h4sh) {
- r = b.___h4sh;
- for (var y in r)
- o(r[y]) && (r[y] = c.get(r[y].get, e, !1, !0))
- } else
- b && o(b) ? d.push(c.get(b.get, e, !1, !0, !0)) : d.push(b)
- }
- if (o(i) && (v = i.get === (i = c.get(i.get, e, d.length, !1))),
- f.fn = u(f.fn, p, h),
- f.inverse = u(f.inverse, p, h),
- "^" === n) {
- var _ = f.fn;
- f.fn = f.inverse,
- f.inverse = _
- }
- return (l = v && "string" == typeof i && c.getHelper(i, h) || t.isFunction(i) && !i.isComputed && {
- fn: i
- }) ? (t.extend(f, {
- context: g,
- scope: p,
- contexts: p,
- hash: r
- }),
- d.push(f),
- function() {
- var t = l.fn.apply(g, d);
- return null == t ? "" : t
- }
- ) : function() {
- var e;
- e = t.isFunction(i) && i.isComputed ? i() : i;
- var r, o, u, c = d.length ? d : [e], l = !0, p = [];
- if (n)
- for (r = 0; r < c.length; r++)
- u = c[r],
- o = void 0 !== u && s(u),
- a(u) ? "#" === n ? l = l && !!(o ? u.attr("length") : u.length) : "^" === n && (l = l && !(o ? u.attr("length") : u.length)) : l = "#" === n ? l && !!u : "^" === n ? l && !u : l;
- if (l) {
- if ("#" === n) {
- if (a(e)) {
- var h = s(e);
- for (r = 0; r < e.length; r++)
- p.push(f.fn(h ? e.attr("" + r) : e[r]));
- return p.join("")
- }
- return f.fn(e || {}) || ""
- }
- return "^" === n ? f.inverse(e || {}) || "" : "" + (null != e ? e : "")
- }
- return ""
- }
- }
- ,
- c.get = function(e, n, i, r, o) {
- var s = n.scope.attr(".")
- , a = n.options || {};
- if (i) {
- if (c.getHelper(e, a))
- return e;
- if (n.scope && t.isFunction(s[e]))
- return s[e]
- }
- var u = n.scope.computeData(e, {
- isArgument: r,
- args: [s, n.scope]
- })
- , l = u.compute;
- t.compute.temporarilyBind(l);
- var p = u.initialValue;
- return c.getHelper(e, a),
- o || void 0 !== p && u.scope === n.scope || !c.getHelper(e, a) ? l.computeInstance.hasDependencies ? l : p : e
- }
- ,
- c.resolve = function(e) {
- return s(e) && a(e) && e.attr("length") ? e : t.isFunction(e) ? e() : e
- }
- ,
- c._helpers = {},
- c.registerHelper = function(t, e) {
- this._helpers[t] = {
- name: t,
- fn: e
- }
- }
- ,
- c.registerSimpleHelper = function(e, n) {
- c.registerHelper(e, t.view.simpleHelper(n))
- }
- ,
- c.getHelper = function(t, e) {
- var n;
- return e && (n = e.get("helpers." + t, {
- proxyMethods: !1
- })),
- n ? {
- fn: n
- } : this._helpers[t]
- }
- ,
- c.render = function(e, n, i) {
- return t.view.cached[e] || t.__notObserve(function() {
- var t = n.attr(e);
- t && (e = t)
- })(),
- t.view.render(e, n, i)
- }
- ,
- c.safeString = function(t) {
- return {
- toString: function() {
- return t
- }
- }
- }
- ,
- c.renderPartial = function(e, n, i) {
- var r = i.get("partials." + e, {
- proxyMethods: !1
- });
- return r ? r.render ? r.render(n, i) : r(n, i) : t.Mustache.render(e, n, i)
- }
- ,
- t.each({
- if: function(e, n) {
- return (t.isFunction(e) ? t.compute.truthy(e)() : !!c.resolve(e)) ? n.fn(n.contexts || this) : n.inverse(n.contexts || this)
- },
- is: function() {
- var e, n, i = arguments[arguments.length - 1];
- if (arguments.length - 2 <= 0)
- return i.inverse();
- for (var r = 0; r < arguments.length - 1; r++) {
- if (n = c.resolve(arguments[r]),
- n = t.isFunction(n) ? n() : n,
- r > 0 && n !== e)
- return i.inverse();
- e = n
- }
- return i.fn()
- },
- eq: function() {
- return c._helpers.is.fn.apply(this, arguments)
- },
- unless: function(e, n) {
- return c._helpers.if.fn.apply(this, [e, t.extend({}, n, {
- fn: n.inverse,
- inverse: n.fn
- })])
- },
- each: function(e, n) {
- var i, r, o, u = c.resolve(e), l = [];
- if (t.view.lists && (u instanceof t.List || e && e.isComputed && void 0 === u))
- return t.view.lists(e, function(t, e) {
- return n.fn(n.scope.add({
- "@index": e
- }).add(t))
- });
- if ((e = u) && a(e)) {
- for (o = 0; o < e.length; o++)
- l.push(n.fn(n.scope.add({
- "@index": o
- }).add(e[o])));
- return l.join("")
- }
- if (s(e)) {
- for (i = t.Map.keys(e),
- o = 0; o < i.length; o++)
- r = i[o],
- l.push(n.fn(n.scope.add({
- "@key": r
- }).add(e[r])));
- return l.join("")
- }
- if (e instanceof Object) {
- for (r in e)
- l.push(n.fn(n.scope.add({
- "@key": r
- }).add(e[r])));
- return l.join("")
- }
- },
- with: function(t, e) {
- var n = t;
- if (t = c.resolve(t))
- return e.fn(n)
- },
- log: function(t, e) {
- "undefined" != typeof console && console.log && (e ? console.log(t, e.context) : console.log(t.context))
- },
- "@index": function(e, n) {
- n || (n = e,
- e = 0);
- var i = n.scope.attr("@index");
- return "" + ((t.isFunction(i) ? i() : i) + e)
- }
- }, function(t, e) {
- c.registerHelper(e, t)
- }),
- t.view.register({
- suffix: "mustache",
- contentType: "x-mustache-template",
- script: function(t, e) {
- return "can.Mustache(function(scope,options) { " + new c({
- text: e,
- name: t
- }).template.out + " })"
- },
- renderer: function(t, e) {
- return c({
- text: e,
- name: t
- })
- }
- }),
- t.mustache.registerHelper = t.proxy(t.Mustache.registerHelper, t.Mustache),
- t.mustache.safeString = t.Mustache.safeString,
- t
- }),
- define("can/observe", ["can/util/library", "can/map", "can/list", "can/compute"], function(t) {
- return t.Observe = t.Map,
- t.Observe.startBatch = t.batch.start,
- t.Observe.stopBatch = t.batch.stop,
- t.Observe.triggerBatch = t.batch.trigger,
- t
- }),
- define("can/util/view_model", ["can/util/library"], function(t) {
- var e = t.$;
- e.fn && (e.fn.scope = e.fn.viewModel = function() {
- return t.viewModel.apply(t, [this].concat(t.makeArray(arguments)))
- }
- )
- }),
- define("can/component", ["can/util/library", "can/view/callbacks", "can/elements", "can/view/bindings", "can/control", "can/observe", "can/view/mustache", "can/util/view_model"], function(t, e, n, i) {
- var r = /\{([^\}]+)\}/g
- , o = t.Component = t.Construct.extend({
- setup: function() {
- if (t.Construct.setup.apply(this, arguments),
- t.Component) {
- var e = this
- , n = this.prototype.scope || this.prototype.viewModel;
- if (this.Control = s.extend(this.prototype.events),
- n && ("object" != typeof n || n instanceof t.Map) ? n.prototype instanceof t.Map && (this.Map = n) : this.Map = t.Map.extend(n || {}),
- this.attributeScopeMappings = {},
- t.each(this.Map ? this.Map.defaults : {}, function(t, n) {
- "@" === t && (e.attributeScopeMappings[n] = n)
- }),
- this.prototype.template)
- if ("function" == typeof this.prototype.template) {
- var i = this.prototype.template;
- this.renderer = function() {
- return t.view.frag(i.apply(null, arguments))
- }
- } else
- this.renderer = t.view.mustache(this.prototype.template);
- t.view.tag(this.prototype.tag, function(t, n) {
- new e(t,n)
- })
- }
- }
- }, {
- setup: function(e, r) {
- var o, s, a = {
- "%root": r.scope.attr("%root")
- }, u = this, c = void 0 !== this.leakScope && !this.leakScope && !!this.template, l = [], p = t.$(e), h = !t.data(p, "preventDataBindings");
- t.each(this.constructor.attributeScopeMappings, function(n, i) {
- a[i] = e.getAttribute(t.hyphenate(n))
- }),
- h && l.push(i.behaviors.viewModel(e, r, function(n) {
- var i = u.scope || u.viewModel;
- if (u.constructor.Map)
- o = new u.constructor.Map(n);
- else if (i instanceof t.Map)
- o = i;
- else if (t.isFunction(i)) {
- var s = i.call(u, n, r.scope, e);
- o = s instanceof t.Map ? s : s.prototype instanceof t.Map ? new s(n) : new (t.Map.extend(s))(n)
- }
- var a = o.serialize;
- return o.serialize = function() {
- var t = a.apply(this, arguments);
- return delete t["%root"],
- t
- }
- ,
- o
- }, a)),
- this.scope = this.viewModel = o,
- t.data(p, "scope", this.viewModel),
- t.data(p, "viewModel", this.viewModel),
- t.data(p, "preventDataBindings", !0);
- var d;
- d = c ? t.view.Scope.refsScope().add(this.viewModel, {
- viewModel: !0
- }) : (this.constructor.renderer ? r.scope.add(new t.view.Scope.Refs) : r.scope).add(this.viewModel, {
- viewModel: !0
- });
- var f = {
- helpers: {}
- }
- , g = function(t, e) {
- f.helpers[t] = function() {
- return e.apply(o, arguments)
- }
- };
- t.each(this.helpers || {}, function(e, n) {
- t.isFunction(e) && g(n, e)
- }),
- t.each(this.simpleHelpers || {}, function(e, n) {
- g(n, t.view.simpleHelper(e))
- }),
- this._control = new this.constructor.Control(e,{
- scope: this.viewModel,
- viewModel: this.viewModel,
- destroy: function() {
- for (var t = 0, e = l.length; t < e; t++)
- l[t]()
- }
- });
- var v = t.view.nodeLists.register([], void 0, r.parentNodeList || !0, !1);
- v.expression = "<" + this.tag + ">",
- l.push(function() {
- t.view.nodeLists.unregister(v)
- }),
- this.constructor.renderer ? (f.tags || (f.tags = {}),
- f.tags.content = function e(i, o) {
- var s = r.subtemplate || o.subtemplate
- , a = s === r.subtemplate;
- if (s) {
- delete f.tags.content;
- var u;
- if (u = a ? c ? r : {
- scope: o.scope.cloneFromRef(),
- options: o.options
- } : o,
- o.parentNodeList) {
- var l = s(u.scope, u.options, o.parentNodeList);
- n.replace([i], l)
- } else
- t.view.live.replace([i], s(u.scope, u.options));
- f.tags.content = e
- }
- }
- ,
- s = this.constructor.renderer(d, r.options.add(f), v)) : s = "legacy" === r.templateType ? t.view.frag(r.subtemplate ? r.subtemplate(d, r.options.add(f)) : "") : r.subtemplate ? r.subtemplate(d, r.options.add(f), v) : document.createDocumentFragment(),
- t.appendChild(e, s, t.document),
- t.view.nodeLists.update(v, t.childNodes(e))
- }
- })
- , s = t.Control.extend({
- _lookup: function(t) {
- return [t.scope, t, window]
- },
- _action: function(e, n, i) {
- var o, s;
- if (r.lastIndex = 0,
- o = r.test(e),
- i || !o) {
- if (o) {
- s = t.compute(function() {
- var i, o = e.replace(r, function(e, r) {
- var o;
- return "scope" === r || "viewModel" === r ? (i = n.viewModel,
- "") : (r = r.replace(/^(scope|^viewModel)\./, ""),
- void 0 === (o = t.compute.read(n.viewModel, t.compute.read.reads(r), {
- isArgument: !0
- }).value) && (o = t.getObject(r)),
- "string" == typeof o ? o : (i = o,
- ""))
- }), s = o.split(/\s+/g), a = s.pop();
- return {
- processor: this.processors[a] || this.processors.click,
- parts: [o, s.join(" "), a],
- delegate: i || void 0
- }
- }, this);
- var a = function(t, n) {
- i._bindings.control[e](i.element),
- i._bindings.control[e] = n.processor(n.delegate || i.element, n.parts[2], n.parts[1], e, i)
- };
- return s.bind("change", a),
- i._bindings.readyComputes[e] = {
- compute: s,
- handler: a
- },
- s()
- }
- return t.Control._action.apply(this, arguments)
- }
- }
- }, {
- setup: function(e, n) {
- return this.scope = n.scope,
- this.viewModel = n.viewModel,
- t.Control.prototype.setup.call(this, e, n)
- },
- off: function() {
- this._bindings && t.each(this._bindings.readyComputes || {}, function(t) {
- t.compute.unbind("change", t.handler)
- }),
- t.Control.prototype.off.apply(this, arguments),
- this._bindings.readyComputes = {}
- },
- destroy: function() {
- t.Control.prototype.destroy.apply(this, arguments),
- "function" == typeof this.options.destroy && this.options.destroy.apply(this, arguments)
- }
- })
- , a = t.$;
- return a.fn && (a.fn.scope = a.fn.viewModel = function() {
- return t.viewModel.apply(t, [this].concat(t.makeArray(arguments)))
- }
- ),
- o
- }),
- define("can", ["can/util/library", "can/control/route", "can/model", "can/map/define", "can/view/mustache", "can/component"], function(t) {
- return t
- }),
- define("smsc", [], function() {
- return SMSC
- }),
- define("jqueryui", ["jquery"], function() {
- return jQuery
- }),
- require(["jquery", "smsc", "jqueryui"], function(t, e) {
- t.ajaxSetup({
- error: function(n) {
- function i(e, n) {
- var i = {}
- , r = t("#smscErrorHandlerDialog");
- 0 === r.length ? (t("body").append('<div id="smscErrorHandlerDialog">' + n + "</div>"),
- r = t("#smscErrorHandlerDialog")) : r.html(n),
- r.is(":data(dialog)") || r.dialog({
- autoOpen: !1,
- modal: !0,
- title: e,
- resizable: !1,
- beforeClose: function() {
- t(this).remove()
- }
- }),
- i.OK = function() {
- t(this).dialog("close")
- }
- ,
- r.dialog("option", "buttons", i),
- r.dialog("open")
- }
- var r;
- switch (n.status) {
- case 400:
- r = n.responseText,
- i(e.vars.lng_rpc_error_title, r);
- break;
- case 401:
- window.location = "/";
- break;
- case 0:
- break;
- default:
- !n.getAllResponseHeaders() || i(e.vars.lng_rpc_error_title, e.vars.lng_rpc_error_unknown_msg)
- }
- }
- })
- }),
- define("models/../../../../smsc/desktop/utils/errorHandler", function() {}),
- define("models/login", ["jquery", "can", "../../../../smsc/desktop/utils/errorHandler"], function(t, e) {
- return e.Model({
- getToken: function(e, n) {
- t.ajax({
- url: "/Authentication/Login/Token",
- type: "post",
- dataType: "json",
- data: e,
- success: n
- })
- },
- encryptPwd: function(t, e) {
- var n, i, r, o = "", s = certParser(e);
- return s.b64 && (n = pidCryptUtil.decodeBase64(s.b64),
- i = new pidCrypt.RSA,
- r = pidCrypt.ASN1.decode(pidCryptUtil.toByteArray(n)),
- i.setPublicKeyFromASN(r.toHexTree()),
- o = pidCryptUtil.encodeBase64(pidCryptUtil.convertFromHex(i.encrypt(pidCryptUtil.encodeBase64(t, !0))))),
- o
- },
- getAutoLoginData: function(e, n) {
- t.ajax({
- url: "/Authentication/Login/AutoLogin",
- type: "post",
- dataType: "json",
- data: e,
- success: n
- })
- },
- sendLoginData: function(e, n) {
- t.ajax({
- url: "/Authentication/Login/logindata",
- type: "post",
- dataType: "json",
- data: e,
- success: n
- })
- },
- gatherData: function(e) {
- t.ajax({
- url: "/Authentication/Login/gatherdata",
- type: "post",
- dataType: "json",
- data: e
- })
- },
- yubiAuto: function(e, n) {
- t.ajax({
- url: "/Authentication/Login/yubiauto",
- type: "post",
- dataType: "json",
- data: e,
- success: n
- })
- }
- }, {})
- }),
- define("text", ["module"], function(t) {
- "use strict";
- var e, n, i, r, o, s = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"], a = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, u = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im, c = "undefined" != typeof location && location.href, l = c && location.protocol && location.protocol.replace(/\:/, ""), p = c && location.hostname, h = c && (location.port || void 0), d = {}, f = t.config && t.config() || {};
- return e = {
- version: "2.0.14",
- strip: function(t) {
- if (t) {
- var e = (t = t.replace(a, "")).match(u);
- e && (t = e[1])
- } else
- t = "";
- return t
- },
- jsEscape: function(t) {
- return t.replace(/(['\\])/g, "\\$1").replace(/[\f]/g, "\\f").replace(/[\b]/g, "\\b").replace(/[\n]/g, "\\n").replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r").replace(/[\u2028]/g, "\\u2028").replace(/[\u2029]/g, "\\u2029")
- },
- createXhr: f.createXhr || function() {
- var t, e, n;
- if ("undefined" != typeof XMLHttpRequest)
- return new XMLHttpRequest;
- if ("undefined" != typeof ActiveXObject)
- for (e = 0; e < 3; e += 1) {
- n = s[e];
- try {
- t = new ActiveXObject(n)
- } catch (t) {}
- if (t) {
- s = [n];
- break
- }
- }
- return t
- }
- ,
- parseName: function(t) {
- var e, n, i, r = !1, o = t.lastIndexOf("."), s = 0 === t.indexOf("./") || 0 === t.indexOf("../");
- return -1 !== o && (!s || o > 1) ? (e = t.substring(0, o),
- n = t.substring(o + 1)) : e = t,
- i = n || e,
- -1 !== (o = i.indexOf("!")) && (r = "strip" === i.substring(o + 1),
- i = i.substring(0, o),
- n ? n = i : e = i),
- {
- moduleName: e,
- ext: n,
- strip: r
- }
- },
- xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
- useXhr: function(t, n, i, r) {
- var o, s, a, u = e.xdRegExp.exec(t);
- return !(u && (o = u[2],
- s = u[3],
- s = s.split(":"),
- a = s[1],
- s = s[0],
- o && o !== n || s && s.toLowerCase() !== i.toLowerCase() || (a || s) && a !== r))
- },
- finishLoad: function(t, n, i, r) {
- i = n ? e.strip(i) : i,
- f.isBuild && (d[t] = i),
- r(i)
- },
- load: function(t, n, i, r) {
- if (r && r.isBuild && !r.inlineText)
- i();
- else {
- f.isBuild = r && r.isBuild;
- var o = e.parseName(t)
- , s = o.moduleName + (o.ext ? "." + o.ext : "")
- , a = n.toUrl(s)
- , u = f.useXhr || e.useXhr;
- 0 !== a.indexOf("empty:") ? !c || u(a, l, p, h) ? e.get(a, function(n) {
- e.finishLoad(t, o.strip, n, i)
- }, function(t) {
- i.error && i.error(t)
- }) : n([s], function(t) {
- e.finishLoad(o.moduleName + "." + o.ext, o.strip, t, i)
- }) : i()
- }
- },
- write: function(t, n, i, r) {
- if (d.hasOwnProperty(n)) {
- var o = e.jsEscape(d[n]);
- i.asModule(t + "!" + n, "define(function () { return '" + o + "';});\n")
- }
- },
- writeFile: function(t, n, i, r, o) {
- var s = e.parseName(n)
- , a = s.ext ? "." + s.ext : ""
- , u = s.moduleName + a
- , c = i.toUrl(s.moduleName + a) + ".js";
- e.load(u, i, function(n) {
- var i = function(t) {
- return r(c, t)
- };
- i.asModule = function(t, e) {
- return r.asModule(t, c, e)
- }
- ,
- e.write(t, u, i, o)
- }, o)
- }
- },
- "node" === f.env || !f.env && "undefined" != typeof process && process.versions && process.versions.node && !process.versions["node-webkit"] && !process.versions["atom-shell"] ? (n = require.nodeRequire("fs"),
- e.get = function(t, e, i) {
- try {
- var r = n.readFileSync(t, "utf8");
- "\ufeff" === r[0] && (r = r.substring(1)),
- e(r)
- } catch (t) {
- i && i(t)
- }
- }
- ) : "xhr" === f.env || !f.env && e.createXhr() ? e.get = function(t, n, i, r) {
- var o, s = e.createXhr();
- if (s.open("GET", t, !0),
- r)
- for (o in r)
- r.hasOwnProperty(o) && s.setRequestHeader(o.toLowerCase(), r[o]);
- f.onXhr && f.onXhr(s, t),
- s.onreadystatechange = function(e) {
- var r, o;
- 4 === s.readyState && ((r = s.status || 0) > 399 && r < 600 ? (o = new Error(t + " HTTP status: " + r),
- o.xhr = s,
- i && i(o)) : n(s.responseText),
- f.onXhrComplete && f.onXhrComplete(s, t))
- }
- ,
- s.send(null)
- }
- : "rhino" === f.env || !f.env && "undefined" != typeof Packages && "undefined" != typeof java ? e.get = function(t, e) {
- var n, i, r = new java.io.File(t), o = java.lang.System.getProperty("line.separator"), s = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(r),"utf-8")), a = "";
- try {
- for (n = new java.lang.StringBuffer,
- (i = s.readLine()) && i.length() && 65279 === i.charAt(0) && (i = i.substring(1)),
- null !== i && n.append(i); null !== (i = s.readLine()); )
- n.append(o),
- n.append(i);
- a = String(n.toString())
- } finally {
- s.close()
- }
- e(a)
- }
- : ("xpconnect" === f.env || !f.env && "undefined" != typeof Components && Components.classes && Components.interfaces) && (i = Components.classes,
- r = Components.interfaces,
- Components.utils.import("resource://gre/modules/FileUtils.jsm"),
- o = "@mozilla.org/windows-registry-key;1"in i,
- e.get = function(t, e) {
- var n, s, a, u = {};
- o && (t = t.replace(/\//g, "\\")),
- a = new FileUtils.File(t);
- try {
- (n = i["@mozilla.org/network/file-input-stream;1"].createInstance(r.nsIFileInputStream)).init(a, 1, 0, !1),
- (s = i["@mozilla.org/intl/converter-input-stream;1"].createInstance(r.nsIConverterInputStream)).init(n, "utf-8", n.available(), r.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),
- s.readString(n.available(), u),
- s.close(),
- n.close(),
- e(u.value)
- } catch (t) {
- throw new Error((a && a.path || "") + ": " + t)
- }
- }
- ),
- e
- }),
- define("text!yubikey/views/yubikey.ejs", [], function() {
- return '<div class="yubikeyCenter">\n\t<div class="yubikeyTitle">\n\t\t<%=lng_title%>\n\t</div>\n\t<div class="yubikeyInput">\n\t\t<img src="/smsc/img/logo_yubico/logo_yubico_16x16.png"><input type="text" name="yubikey" placeholder="YubiKey" autocomplete="off" autofocus="autofocus">\n\t</div>\n</div>\n<div class="yubikeyDetail">\n\t<div class="maintxt">\n\t\t<%=lng_subtitle%>\n\t</div>\n\t<div class="subtxt">\n\t\t<%=lng_subtitle1%><br>\n\t\t<%=lng_subtitle2%>\n\t</div>\n</div>'
- }),
- define("can/view/ejs", ["can/util/library", "can/view", "can/util/string", "can/compute", "can/scanner", "can/render"], function(t) {
- var e = t.extend
- , n = function(t) {
- if (this.constructor !== n) {
- var i = new n(t);
- return function(t, e) {
- return i.render(t, e)
- }
- }
- "function" != typeof t ? (e(this, t),
- this.template = this.scanner.scan(this.text, this.name)) : this.template = {
- fn: t
- }
- };
- return t.EJS = n,
- n.prototype.render = function(t, e) {
- return t = t || {},
- this.template.fn.call(t, t, new n.Helpers(t,e || {}))
- }
- ,
- e(n.prototype, {
- scanner: new t.view.Scanner({
- text: {
- outStart: "with(_VIEW) { with (_CONTEXT) {",
- outEnd: "}}",
- argNames: "_CONTEXT,_VIEW",
- context: "this"
- },
- tokens: [["templateLeft", "<%%"], ["templateRight", "%>"], ["returnLeft", "<%=="], ["escapeLeft", "<%="], ["commentLeft", "<%#"], ["left", "<%"], ["right", "%>"], ["returnRight", "%>"]],
- helpers: [{
- name: /\s*\(([\$\w]+)\)\s*->([^\n]*)/,
- fn: function(t) {
- var e = /\s*\(([\$\w]+)\)\s*->([^\n]*)/
- , n = t.match(e);
- return "can.proxy(function(__){var " + n[1] + "=can.$(__);" + n[2] + "}, this);"
- }
- }],
- transform: function(t) {
- return t.replace(/<%([\s\S]+?)%>/gm, function(t, e) {
- var n, i, r = [];
- e.replace(/[{}]/gm, function(t, e) {
- r.push([t, e])
- });
- do {
- for (n = !1,
- i = r.length - 2; i >= 0; i--)
- if ("{" === r[i][0] && "}" === r[i + 1][0]) {
- r.splice(i, 2),
- n = !0;
- break
- }
- } while (n);if (r.length >= 2) {
- var o, s = ["<%"], a = 0;
- for (i = 0; o = r[i]; i++)
- s.push(e.substring(a, a = o[1])),
- "{" === o[0] && i < r.length - 1 || "}" === o[0] && i > 0 ? s.push("{" === o[0] ? "{ %><% " : " %><% }") : s.push(o[0]),
- ++a;
- return s.push(e.substring(a), "%>"),
- s.join("")
- }
- return "<%" + e + "%>"
- })
- }
- })
- }),
- n.Helpers = function(t, n) {
- this._data = t,
- this._extras = n,
- e(this, n)
- }
- ,
- n.Helpers.prototype = {
- list: function(e, n) {
- t.each(e, function(t, i) {
- n(t, i, e)
- })
- },
- each: function(e, n) {
- t.isArray(e) ? this.list(e, n) : t.view.lists(e, n)
- }
- },
- t.view.register({
- suffix: "ejs",
- script: function(t, e) {
- return "can.EJS(function(_CONTEXT,_VIEW) { " + new n({
- text: e,
- name: t
- }).template.out + " })"
- },
- renderer: function(t, e) {
- return n({
- text: e,
- name: t
- })
- }
- }),
- t.ejs.Helpers = n.Helpers,
- t
- }),
- define("yubikey/yubikey", ["jquery", "can", "smsc", "text!./views/yubikey.ejs", "can/view/ejs"], function(t, e, n, i) {
- return e.ejs("modules_authentication_app_yubikey_views_yubikey", i),
- e.Control.extend({
- init: function() {
- var n = this;
- this.element.dialog({
- title: "",
- modal: !0,
- resizable: !1,
- width: 640,
- height: 360,
- beforeClose: function(e) {
- e.preventDefault(),
- n.options.opener.closeYubiKey(),
- t(this).parents(".smscWindow").remove(),
- t(this).remove()
- }
- }).parents(".ui-dialog:eq(0)").wrap('<div class="smscWindow no-gradient"></div>'),
- this.element.html(e.view("modules_authentication_app_yubikey_views_yubikey", {
- lng_title: this.options.lng.lng_yubikey_title,
- lng_subtitle: !0 === this.options.fromForce ? this.options.lng.lng_yubikey_subtitle_info : this.options.lng.lng_yubikey_subtitle,
- lng_subtitle1: this.options.lng.lng_yubikey_subtitle1,
- lng_subtitle2: this.options.lng.lng_yubikey_subtitle2
- })),
- this.element.dialog("open"),
- this.focus()
- },
- focus: function() {
- this.element.find("input:first").focus()
- },
- "input[name=yubikey] keydown": function(t, e) {
- 13 == e.keyCode && (this.options.opener.handleYubiKey(t.val()),
- this.element.dialog("close"))
- }
- })
- }),
- define("models/totp", ["jquery", "can"], function(t, e) {
- return e.Model({
- getConfig: function(t) {
- return e.ajax({
- url: "/Authentication/Totp/getconfig",
- type: "POST",
- dataType: "json",
- data: t
- }).promise()
- },
- getTwofactorConfig: function(t) {
- return e.ajax({
- url: "/Authentication/Login/gettwofactorconfig",
- type: "POST",
- dataType: "json",
- data: t
- }).promise()
- },
- getValidationConfig: function(t) {
- return e.ajax({
- url: "/Authentication/Login/gettotpvalidationconfig",
- type: "POST",
- dataType: "json",
- data: t
- }).promise()
- },
- validateAndSafeCode: function(t) {
- return e.ajax({
- url: "/Authentication/Totp/validateandsavecode",
- type: "POST",
- dataType: "json",
- data: t
- }).promise()
- },
- validateTwoFactorAndSafeCode: function(t) {
- return e.ajax({
- url: "/Authentication/Login/validateandsavecode",
- type: "POST",
- dataType: "json",
- data: t
- }).promise()
- },
- validateCode: function(t) {
- return e.ajax({
- url: "/Authentication/Totp/validatecode",
- type: "POST",
- dataType: "json",
- data: t
- }).promise()
- },
- unsetTotp: function(t) {
- return e.ajax({
- url: "/Authentication/Totp/unsettotp",
- type: "POST",
- dataType: "json",
- data: t
- }).promise()
- }
- }, {})
- }),
- define("mainui/confirm/amd/confirm", ["jquery", "can", "jqueryui"], function(t, e) {
- return function(n) {
- var i, r, o = {
- title: "",
- msg: "",
- ok_title: "",
- cancel_title: "",
- ok_class: "",
- cancel_class: "",
- smscWindow: !1,
- width: 300,
- height: 150
- }, s = e.extend({}, o, n), a = {}, u = t("#smscConfirmDialog");
- return 0 === u.length ? (t("body").append('<div id="smscConfirmDialog">' + s.msg + "</div>"),
- u = t("#smscConfirmDialog")) : u.html(s.msg),
- u.is(":data(dialog)") || u.dialog({
- autoOpen: !1,
- modal: !0,
- title: s.title,
- resizable: !1,
- width: s.width,
- beforeClose: function(e, n) {
- t(this).remove()
- }
- }),
- "" !== s.cancel_title && (r = s.cancel_title,
- a[r] = {
- click: function() {
- var e = t(this);
- e.trigger("canceled"),
- e.dialog("close")
- },
- text: s.cancel_title,
- class: s.cancel_class
- }),
- "" !== s.ok_title && (i = s.ok_title,
- a[i] = {
- click: function() {
- var e = t(this);
- e.trigger("confirmed"),
- e.dialog("close")
- },
- text: s.ok_title,
- class: s.ok_class
- }),
- u.dialog("option", "buttons", a),
- u.dialog("open"),
- s.smscWindow && (u.parents(".ui-dialog:eq(0)").css("overflow", "visible").wrap('<div class="smscWindow no-gradient"></div>'),
- "" === s.ok_class && (s.ok_class = "smscButton blue"),
- "" === s.cancel_class && (s.cancel_class = "smscButton"),
- 1 === u.parents(".ui-dialog:eq(0)").find(".ui-dialog-buttonset button").length ? u.parents(".ui-dialog:eq(0)").find(".ui-dialog-buttonset button:eq(0)").attr("class", s.ok_class) : (u.parents(".ui-dialog:eq(0)").find(".ui-dialog-buttonset button:eq(0)").attr("class", s.cancel_class),
- u.parents(".ui-dialog:eq(0)").find(".ui-dialog-buttonset button:eq(1)").attr("class", s.ok_class))),
- u
- }
- }),
- define("text!totp/views/totp.stache", [], function() {
- return '<div class="totpDialog cf">\n\t<div class="lcol">\n\t\t<p>{{lang.totpdialog_no_app}}</p>\n\t\t<ul>\n\t\t\t<li><a target="_blank" href="https://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8">{{lang.totpdialog_app_ios}}</a></li>\n\t\t\t<li><a target="_blank" href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2">{{lang.totpdialog_app_android}}</a></li>\n\t\t\t<li><a target="_blank" href="https://www.microsoft.com/store/p/authenticator/9wzdncrfj3rj">{{lang.totpdialog_app_windowsphone}}</a></li>\n\t\t</ul>\n\t</div>\n\t<div class="rcol">\n\t\t<div class="content-holder"></div>\n\t\t<div class="form-holder">\n\t\t\t<input type="text" id="txt_totpCode" maxlength="6" placeholder="{{lang.totpdialog_6digitcode}}" />\n\t\t\t<button class="continueButton smscButton blue">{{lang.totpdialog_continue}}</button>\n\t\t</div>\n\t</div>\n</div>'
- }),
- define("text!totp/views/totp_qr.stache", [], function() {
- return '<div class="img-holder">\n\t<div class="corner tl"></div>\n <div class="corner tr"></div>\n\t<div class="corner bl"></div>\n\t<div class="corner br"></div>\n\t<img class="qr-code" src="{{qr}}" />\n</div>\n<div class="switchView">{{lang.totpdialog_no_camera}}</div>'
- }),
- define("text!totp/views/totp_manual.stache", [], function() {
- return '<div class="linetitle"><span>{{lang.totpdialog_details}}</span></div>\n<p class="step">\n\t<b>{{lang.totpdialog_account}}:</b><br/>\n\t{{highlightNumbers user}}@{{highlightNumbers domain}}\n</p>\n<p class="step">\n\t<b>{{lang.totpdialog_key}}:</b><br/>\n\t{{highlightNumbers key}}\n</p>\n<p class="step">\n\t<b>{{lang.totpdialog_type}}:</b><br/>\n\t{{lang.totpdialog_timebased}}\n</p>\n\n<div class="linetitle extramargin"><span>{{lang.totpdialog_manual_instructions}}</span></div>\n<ol>\n\t<li>{{lang.totpdialog_manual_instructions_step_1}}</li>\n\t<li>{{lang.totpdialog_manual_instructions_step_2}}</li>\n\t<li>{{lang.totpdialog_manual_instructions_step_3}}</li>\n</ol>\n\n<div class="switchView">{{lang.totpdialog_showqr}}</div>'
- }),
- define("can/view/target", ["can/util/library", "can/elements"], function(t, e, n) {
- function i(t, n, i, r) {
- var o, s, c, h, d, f = i, g = typeof t, v = function() {
- return o || (o = {
- path: i,
- callbacks: []
- },
- n.push(o),
- f = []),
- o
- };
- if ("object" === g) {
- if (t.tag) {
- if (s = l && t.namespace ? r.createElementNS(t.namespace, t.tag) : r.createElement(t.tag),
- t.attrs)
- for (var m in t.attrs) {
- var b = t.attrs[m];
- "function" == typeof b ? v().callbacks.push({
- callback: b
- }) : p(s, m, b)
- }
- if (t.attributes)
- for (h = 0,
- d = t.attributes.length; h < d; h++)
- v().callbacks.push({
- callback: t.attributes[h]
- });
- t.children && t.children.length && (c = o ? o.paths = [] : n,
- s.appendChild(a(t.children, c, f, r)))
- } else if (t.comment && (s = r.createComment(t.comment),
- t.callbacks))
- for (h = 0,
- d = t.attributes.length; h < d; h++)
- v().callbacks.push({
- callback: t.callbacks[h]
- })
- } else
- "string" === g ? s = r.createTextNode(t) : "function" === g && (u ? (s = r.createTextNode(""),
- v().callbacks.push({
- callback: t
- })) : (s = r.createComment("~"),
- v().callbacks.push({
- callback: function() {
- var n = r.createTextNode("");
- return e.replace([this], n),
- t.apply(n, arguments)
- }
- })));
- return s
- }
- function r(t, e, n) {
- for (var i = e.path, o = e.callbacks, s = e.paths, a = t, u = i ? i.length : 0, c = s ? s.length : 0, l = 0; l < u; l++)
- a = a.childNodes.item(i[l]);
- for (l = 0; l < c; l++)
- r(a, s[l], n);
- n.push({
- element: a,
- callbacks: o
- })
- }
- function o(t, e) {
- for (var n, i, r, o = t.length, s = 0; s < o; s++) {
- n = (r = t[s]).callbacks.length,
- i = r.element;
- for (var a = 0; a < n; a++)
- r.callbacks[a].callback.apply(i, e)
- }
- }
- function s(e, n) {
- var i = []
- , s = a(e, i, [], n || t.global.document);
- return {
- paths: i,
- clone: s,
- hydrate: function() {
- for (var e = h(this.clone), n = t.makeArray(arguments), s = [], a = 0; a < i.length; a++)
- r(e, i[a], s);
- return o(s, n),
- e
- }
- }
- }
- var a = function(t, e, n, r) {
- for (var o = r.createDocumentFragment(), s = 0, a = t.length; s < a; s++) {
- var u = t[s];
- o.appendChild(i(u, e, n.concat(s), r))
- }
- return o
- }
- , u = "undefined" != typeof document && function() {
- var e = document.createDocumentFragment()
- , n = document.createElement("div");
- n.appendChild(document.createTextNode("")),
- n.appendChild(document.createTextNode("")),
- e.appendChild(n);
- var i = e.cloneNode(!0);
- return 2 === t.childNodes(i.firstChild).length
- }()
- , c = "undefined" != typeof document && function() {
- var t = document.createElement("a");
- return t.innerHTML = "<xyz></xyz>",
- "<xyz></xyz>" === t.cloneNode(!0).innerHTML
- }()
- , l = "undefined" != typeof document && !!document.createElementNS
- , p = t.attr.setAttribute
- , h = c ? function(t) {
- return t.cloneNode(!0)
- }
- : function(e) {
- var n;
- if (1 === e.nodeType ? n = document.createElement(e.nodeName) : 3 === e.nodeType ? n = document.createTextNode(e.nodeValue) : 8 === e.nodeType ? n = document.createComment(e.nodeValue) : 11 === e.nodeType && (n = document.createDocumentFragment()),
- e.attributes) {
- var i = t.makeArray(e.attributes);
- t.each(i, function(t) {
- t && t.specified && p(n, t.nodeName, t.nodeValue)
- })
- }
- return e.childNodes && t.each(e.childNodes, function(t) {
- n.appendChild(h(t))
- }),
- n
- }
- ;
- return s.keepsTextNodes = u,
- t.view.target = s,
- s
- }),
- define("can/view/mustache_core", ["can/util/library", "can/view/utils", "can/view/mustache_helpers", "can/view/expression", "can/view/live", "can/elements", "can/view/scope", "can/view/node_lists"], function(t, e, n, i, r, o, s, a) {
- r = r || t.view.live,
- o = o || t.view.elements,
- s = s || t.view.Scope,
- a = a || t.view.nodeLists;
- var u = /(?:(?:^|(\r?)\n)(\s*)(\{\{([^\}]*)\}\}\}?)([^\S\n\r]*)($|\r?\n))|(\{\{([^\}]*)\}\}\}?)/g
- , c = function(e, n, i, r) {
- for (var o = (t.document || t.global.document).createDocumentFragment(), s = 0, a = e.length; s < a; s++)
- l(o, i.fn(n ? e.attr("" + s) : e[s], r));
- return o
- }
- , l = function(t, e) {
- e && t.appendChild("string" == typeof e ? t.ownerDocument.createTextNode(e) : e)
- }
- , p = function(t, e, n, i) {
- for (var r = "", o = 0, s = t.length; o < s; o++)
- r += n.fn(e ? t.attr("" + o) : t[o], i);
- return r
- }
- , h = {
- expression: i,
- makeEvaluator: function(n, r, o, s, a, u, l, h) {
- if ("^" === s) {
- var d = u;
- u = l,
- l = d
- }
- var f, g;
- if (a instanceof i.Call) {
- if (g = {
- fn: function() {},
- inverse: function() {},
- context: n.attr("."),
- scope: n,
- nodeList: o,
- exprData: a,
- helpersScope: r
- },
- e.convertToScopes(g, n, r, o, u, l),
- f = a.value(n, r, g),
- a.isHelper)
- return f
- } else {
- var v = {
- isArgument: !0,
- args: [n.attr("."), n],
- asCompute: !0
- }
- , m = a.helperAndValue(n, r, v, o, u, l, h)
- , b = m.helper;
- if (f = m.value,
- b)
- return a.evaluator(b, n, r, v, o, u, l, h)
- }
- return s ? "#" === s || "^" === s ? (g = {
- fn: function() {},
- inverse: function() {}
- },
- e.convertToScopes(g, n, r, o, u, l),
- function() {
- var i;
- if ("function" == typeof (i = t.isFunction(f) && f.isComputed ? f() : f))
- return i;
- if (e.isArrayLike(i)) {
- var o = e.isObserveLike(i);
- return (o ? i.attr("length") : i.length) ? (h ? p : c)(i, o, g, r) : g.inverse(n, r)
- }
- return i ? g.fn(i || n, r) : g.inverse(n, r)
- }
- ) : void 0 : f && f.isComputed ? f : function() {
- return "" + (null != f ? f : "")
- }
- },
- makeLiveBindingPartialRenderer: function(e, n) {
- return e = t.trim(e),
- function(i, o, s) {
- var u = [this];
- u.expression = ">" + e,
- a.register(u, null, s || !0, n.directlyNested);
- var c = t.compute(function() {
- var n, r = e, s = o.attr("partials." + r);
- if (s)
- n = s.render ? s.render(i, o) : s(i, o);
- else {
- var a = i.read(r, {
- isArgument: !0
- }).value;
- if (null === a || !a && "*" === r[0])
- return t.frag("");
- a && (r = a),
- n = t.isFunction(r) ? r(i, o) : t.view.render(r, i, o)
- }
- return t.frag(n)
- });
- r.html(this, c, this.parentNode, u)
- }
- },
- makeStringBranchRenderer: function(t, e) {
- var n = h.expression.parse(e)
- , r = t + e;
- return n instanceof i.Helper || n instanceof i.Call || (n = new i.Helper(n,[],{})),
- function(e, i, o, s) {
- var a = e.__cache[r];
- !t && a || (a = d(e, i, null, t, n, o, s, !0),
- t || (e.__cache[r] = a));
- var u = a();
- return null == u ? "" : "" + u
- }
- },
- makeLiveBindingBranchRenderer: function(e, n, s) {
- var u = h.expression.parse(n);
- return u instanceof i.Helper || u instanceof i.Call || (u = new i.Helper(u,[],{})),
- function(i, c, l, p, h) {
- var f = [this];
- f.expression = n,
- a.register(f, null, l || !0, s.directlyNested);
- var g, v = d(i, c, f, e, u, p, h, s.tag), m = v.isComputed;
- (g = m ? v : t.compute(v, null, !1)).computeInstance.bind("change", t.k);
- var b = g();
- "function" == typeof b ? t.__notObserve(b)(this) : m || g.computeInstance.hasDependencies ? s.attr ? r.simpleAttribute(this, s.attr, g) : s.tag ? r.attributes(this, g) : s.text && "object" != typeof b ? r.text(this, g, this.parentNode, f) : r.html(this, g, this.parentNode, f) : s.attr ? t.attr.set(this, s.attr, b) : s.tag ? r.setAttributes(this, b) : s.text && "string" == typeof b ? this.nodeValue = b : null != b && o.replace([this], t.frag(b, this.ownerDocument)),
- g.computeInstance.unbind("change", t.k)
- }
- },
- splitModeFromExpression: function(e, n) {
- var i = (e = t.trim(e)).charAt(0);
- return "#/{&^>!".indexOf(i) >= 0 ? e = t.trim(e.substr(1)) : i = null,
- "{" === i && n.node && (i = null),
- {
- mode: i,
- expression: e
- }
- },
- cleanLineEndings: function(t) {
- return t.replace(u, function(t, e, n, i, r, o, s, a, u, c) {
- o = o || "",
- e = e || "",
- n = n || "";
- var l = f(r || u, {});
- return a || ">{".indexOf(l.mode) >= 0 ? t : "^#!/".indexOf(l.mode) >= 0 ? i + (0 !== c && s.length ? e + "\n" : "") : n + i + o + (n.length || 0 !== c ? e + "\n" : "")
- })
- },
- Options: e.Options
- }
- , d = h.makeEvaluator
- , f = h.splitModeFromExpression;
- return t.view.mustacheCore = h,
- h
- }),
- define("can/view/html_section", ["can/util/library", "can/view/target", "can/view/utils", "can/view/mustache_core"], function(t, e, n, i) {
- var r = "undefined" != typeof document && function() {
- var t = document.createElement("div");
- return function(e) {
- return -1 === e.indexOf("&") ? e.replace(/\r\n/g, "\n") : (t.innerHTML = e,
- 0 === t.childNodes.length ? "" : t.childNodes.item(0).nodeValue)
- }
- }()
- , o = function() {
- this.stack = [new s]
- };
- t.extend(o.prototype, n.mixins),
- t.extend(o.prototype, {
- startSubSection: function(t) {
- var e = new s(t);
- return this.stack.push(e),
- e
- },
- endSubSectionAndReturnRenderer: function() {
- if (this.last().isEmpty())
- return this.stack.pop(),
- null;
- var e = this.endSection();
- return t.proxy(e.compiled.hydrate, e.compiled)
- },
- startSection: function(t) {
- var e = new s(t);
- this.last().add(e.targetCallback),
- this.stack.push(e)
- },
- endSection: function() {
- return this.last().compile(),
- this.stack.pop()
- },
- inverse: function() {
- this.last().inverse()
- },
- compile: function() {
- var e = this.stack.pop().compile();
- return function(n, r, o) {
- return n instanceof t.view.Scope || (n = t.view.Scope.refsScope().add(n || {})),
- r instanceof i.Options || (r = new i.Options(r || {})),
- e.hydrate(n, r, o)
- }
- },
- push: function(t) {
- this.last().push(t)
- },
- pop: function() {
- return this.last().pop()
- }
- });
- var s = function(e) {
- this.data = "targetData",
- this.targetData = [],
- this.targetStack = [];
- var n = this;
- this.targetCallback = function(i, r, o) {
- e.call(this, i, r, o, t.proxy(n.compiled.hydrate, n.compiled), n.inverseCompiled && t.proxy(n.inverseCompiled.hydrate, n.inverseCompiled))
- }
- };
- return t.extend(s.prototype, {
- inverse: function() {
- this.inverseData = [],
- this.data = "inverseData"
- },
- push: function(t) {
- this.add(t),
- this.targetStack.push(t)
- },
- pop: function() {
- return this.targetStack.pop()
- },
- add: function(e) {
- "string" == typeof e && (e = r(e)),
- this.targetStack.length ? t.last(this.targetStack).children.push(e) : this[this.data].push(e)
- },
- compile: function() {
- return this.compiled = e(this.targetData, t.document || t.global.document),
- this.inverseData && (this.inverseCompiled = e(this.inverseData, t.document || t.global.document),
- delete this.inverseData),
- this.targetStack = this.targetData = null,
- this.compiled
- },
- children: function() {
- return this.targetStack.length ? t.last(this.targetStack).children : this[this.data]
- },
- isEmpty: function() {
- return !this.targetData.length
- }
- }),
- o.HTMLSection = s,
- o
- }),
- define("can/view/live_attr", ["can/util/library", "can/view/live", "can/elements", "can/view/callbacks"], function(t, e, n, i) {
- return e = e || t.view.live,
- n = n || t.view.elements,
- i = i || t.view.callbacks,
- {
- attributes: function(r, o, s, a) {
- var u = {}
- , c = function(o) {
- var c, l = e.getAttributeParts(o);
- for (c in l) {
- var p = l[c];
- if (p !== u[c]) {
- t.attr.set(r, c, p);
- var h = i.attr(c);
- h && h(r, {
- attributeName: c,
- scope: s,
- options: a
- })
- }
- delete u[c]
- }
- for (c in u)
- n.removeAttr(r, c);
- u = l
- }
- , l = function(t, e) {
- c(e)
- };
- o.bind("change", l),
- t.bind.call(r, "removed", function() {
- o.unbind("change", l)
- }),
- c(o())
- }
- }
- }),
- define("can/view/text_section", ["can/util/library", "can/view/live", "can/view/utils", "can/view/live_attr"], function(t, e, n, i) {
- e = e || t.view.live;
- var r = function() {
- this.stack = [new s]
- };
- t.extend(r.prototype, n.mixins),
- t.extend(r.prototype, {
- startSection: function(t) {
- var e = new s;
- this.last().add({
- process: t,
- truthy: e
- }),
- this.stack.push(e)
- },
- endSection: function() {
- this.stack.pop()
- },
- inverse: function() {
- this.stack.pop();
- var t = new s;
- this.last().last().falsey = t,
- this.stack.push(t)
- },
- compile: function(n) {
- var r = this.stack[0].compile();
- return function(o, s) {
- var a = t.compute(function() {
- return r(o, s)
- }, null, !1);
- a.computeInstance.bind("change", t.k);
- var u = a();
- a.computeInstance.hasDependencies ? (n.textContentOnly ? e.text(this, a) : n.attr ? e.simpleAttribute(this, n.attr, a) : i.attributes(this, a, o, s),
- a.computeInstance.unbind("change", t.k)) : n.textContentOnly ? this.nodeValue = u : n.attr ? t.attr.set(this, n.attr, u) : e.setAttributes(this, u)
- }
- }
- });
- var o = function(t, e, n) {
- return function(i, r) {
- return t.call(this, i, r, e, n)
- }
- }
- , s = function() {
- this.values = []
- };
- return t.extend(s.prototype, {
- add: function(t) {
- this.values.push(t)
- },
- last: function() {
- return this.values[this.values.length - 1]
- },
- compile: function() {
- for (var t = this.values, e = t.length, n = 0; n < e; n++) {
- var i = this.values[n];
- "object" == typeof i && (t[n] = o(i.process, i.truthy && i.truthy.compile(), i.falsey && i.falsey.compile()))
- }
- return function(n, i) {
- for (var r, o = "", s = 0; s < e; s++)
- r = t[s],
- o += "string" == typeof r ? r : r.call(this, n, i);
- return o
- }
- }
- }),
- r
- }),
- define("can/view/import", ["can/util/library", "can/view/callbacks"], function(t) {
- t.view.tag("can-import", function(e, n) {
- var i, r = t.$(e), o = e.getAttribute("from"), s = n.options.attr("helpers.module"), a = s ? s.id : void 0;
- i = o ? t.import(o, a) : t.Deferred().reject("No moduleName provided").promise();
- var u = n.scope.attr("%root");
- u && t.isFunction(u.waitFor) && u.waitFor(i),
- t.data(r, "viewModel", i),
- t.data(r, "scope", i);
- var c = n.scope.add(i)
- , l = e.getAttribute("can-tag");
- if (l) {
- var p = t.view.tag(l);
- t.data(r, "preventDataBindings", !0),
- p(e, t.extend(n, {
- scope: c
- })),
- t.data(r, "preventDataBindings", !1),
- t.data(r, "viewModel", i),
- t.data(r, "scope", i)
- } else {
- var h = n.subtemplate ? n.subtemplate(c, n.options) : document.createDocumentFragment()
- , d = t.view.nodeLists.register([], void 0, !0);
- t.one.call(e, "removed", function() {
- t.view.nodeLists.unregister(d)
- }),
- t.appendChild(e, h, t.document),
- t.view.nodeLists.update(d, t.childNodes(e))
- }
- })
- }),
- define("can/view/intermediate_and_imports", ["can/view/mustache_core", "can/view/parser", "can/view/import"], function(t, e) {
- return function(n) {
- var i = t.cleanLineEndings(n)
- , r = []
- , o = []
- , s = {}
- , a = !1
- , u = !1
- , c = !1
- , l = !1
- , p = ""
- , h = "";
- return {
- intermediate: e(i, {
- start: function(t, e) {
- l = e,
- "can-import" === t ? a = !0 : a && (a = !1)
- },
- attrStart: function(t) {
- "from" === t ? u = !0 : "as" !== t && "export-as" !== t || (c = !0)
- },
- attrEnd: function(t) {
- "from" === t ? u = !1 : "as" !== t && "export-as" !== t || (c = !1)
- },
- attrValue: function(t) {
- u && a ? (r.push(t),
- l || o.push(t),
- h = t) : c && a && (p = t)
- },
- end: function(t) {
- "can-import" === t && p && (s[p] = h,
- p = "")
- },
- close: function(t) {
- "can-import" === t && r.pop()
- }
- }, !0),
- imports: r,
- dynamicImports: o,
- ases: s,
- exports: s
- }
- }
- }),
- define("can/view/stache", ["can/util/library", "can/view/parser", "can/view/target", "can/view/html_section", "can/view/text_section", "can/view/mustache_core", "can/view/mustache_helpers", "can/view/intermediate_and_imports", "can/view/callbacks", "can/view/bindings"], function(t, e, n, i, r, o, s, a, u) {
- function c(n) {
- "string" == typeof n && (n = o.cleanLineEndings(n));
- var s = new i
- , a = {
- node: null,
- attr: null,
- sectionElementStack: [],
- text: !1,
- namespaceStack: [],
- textContentOnly: null
- }
- , c = function(t, e, n) {
- if (">" === e)
- t.add(o.makeLiveBindingPartialRenderer(n, a));
- else if ("/" === e)
- t.endSection(),
- t instanceof i && a.sectionElementStack.pop();
- else if ("else" === e)
- t.inverse();
- else {
- var r = t instanceof i ? o.makeLiveBindingBranchRenderer : o.makeStringBranchRenderer;
- "{" === e || "&" === e ? t.add(r(null, n, h())) : "#" === e || "^" === e ? (t.startSection(r(e, n, h())),
- t instanceof i && a.sectionElementStack.push("section")) : t.add(r(null, n, h({
- text: !0
- })))
- }
- }
- , h = function(e) {
- var n = a.sectionElementStack[a.sectionElementStack.length - 1]
- , i = {
- tag: a.node && a.node.tag,
- attr: a.attr && a.attr.name,
- directlyNested: !a.sectionElementStack.length || "section" === n || "custom" === n,
- textContentOnly: !!a.textContentOnly
- };
- return e ? t.simpleExtend(i, e) : i
- }
- , d = function(t, e) {
- t.attributes || (t.attributes = []),
- t.attributes.unshift(e)
- };
- return e(n, {
- start: function(e, n) {
- var i = l[e];
- i && !n && a.namespaceStack.push(i),
- a.node = {
- tag: e,
- children: [],
- namespace: i || t.last(a.namespaceStack)
- }
- },
- end: function(t, e) {
- var n = u.tag(t);
- e ? (s.add(a.node),
- n && d(a.node, function(e, n, i) {
- u.tagHandler(this, t, {
- scope: e,
- options: n,
- subtemplate: null,
- templateType: "stache",
- parentNodeList: i
- })
- })) : (s.push(a.node),
- a.sectionElementStack.push(n ? "custom" : t),
- n ? s.startSubSection() : p[t] && (a.textContentOnly = new r)),
- a.node = null
- },
- close: function(t) {
- l[t] && a.namespaceStack.pop();
- var e, n = u.tag(t);
- n && (e = s.endSubSectionAndReturnRenderer()),
- p[t] && (s.last().add(a.textContentOnly.compile(h())),
- a.textContentOnly = null);
- var i = s.pop();
- n && d(i, function(n, i, r) {
- u.tagHandler(this, t, {
- scope: n,
- options: i,
- subtemplate: e,
- templateType: "stache",
- parentNodeList: r
- })
- }),
- a.sectionElementStack.pop()
- },
- attrStart: function(t) {
- a.node.section ? a.node.section.add(t + '="') : a.attr = {
- name: t,
- value: ""
- }
- },
- attrEnd: function(t) {
- if (a.node.section)
- a.node.section.add('" ');
- else {
- a.node.attrs || (a.node.attrs = {}),
- a.node.attrs[a.attr.name] = a.attr.section ? a.attr.section.compile(h()) : a.attr.value;
- var e = u.attr(t);
- e && (a.node.attributes || (a.node.attributes = []),
- a.node.attributes.push(function(n, i) {
- e(this, {
- attributeName: t,
- scope: n,
- options: i
- })
- })),
- a.attr = null
- }
- },
- attrValue: function(t) {
- var e = a.node.section || a.attr.section;
- e ? e.add(t) : a.attr.value += t
- },
- chars: function(t) {
- (a.textContentOnly || s).add(t)
- },
- special: function(t) {
- var e = o.splitModeFromExpression(t, a)
- , n = e.mode
- , i = e.expression;
- if ("else" !== i) {
- if ("!" !== n)
- if (a.node && a.node.section)
- c(a.node.section, n, i),
- 0 === a.node.section.subSectionDepth() && (a.node.attributes.push(a.node.section.compile(h())),
- delete a.node.section);
- else if (a.attr)
- a.attr.section || (a.attr.section = new r,
- a.attr.value && a.attr.section.add(a.attr.value)),
- c(a.attr.section, n, i);
- else if (a.node)
- if (a.node.attributes || (a.node.attributes = []),
- n) {
- if ("#" !== n && "^" !== n)
- throw new Error(n + " is currently not supported within a tag.");
- a.node.section || (a.node.section = new r),
- c(a.node.section, n, i)
- } else
- a.node.attributes.push(o.makeLiveBindingBranchRenderer(null, i, h()));
- else
- c(a.textContentOnly || s, n, i)
- } else
- (a.attr && a.attr.section ? a.attr.section : a.textContentOnly || s).inverse()
- },
- comment: function(t) {
- s.add({
- comment: t
- })
- },
- done: function() {}
- }),
- s.compile()
- }
- e = e || t.view.parser,
- t.view.parser = e,
- u = u || t.view.callbacks;
- var l = {
- svg: "http://www.w3.org/2000/svg",
- g: "http://www.w3.org/2000/svg"
- }
- , p = {
- style: !0,
- script: !0
- }
- , h = {
- "\n": "\\n",
- "\r": "\\r",
- "\u2028": "\\u2028",
- "\u2029": "\\u2029"
- }
- , d = function(t) {
- return ("" + t).replace(/["'\\\n\r\u2028\u2029]/g, function(t) {
- return "'\"\\".indexOf(t) >= 0 ? "\\" + t : h[t]
- })
- };
- return t.view.register({
- suffix: "stache",
- contentType: "x-stache-template",
- fragRenderer: function(t, e) {
- return c(e)
- },
- script: function(t, e) {
- return 'can.stache("' + d(e) + '")'
- }
- }),
- t.view.ext = ".stache",
- t.extend(t.stache, s),
- t.extend(c, s),
- t.stache.safeString = c.safeString = function(t) {
- return {
- toString: function() {
- return t
- }
- }
- }
- ,
- t.stache.async = function(e) {
- var n = a(e)
- , i = t.map(n.imports, function(e) {
- return t.import(e)
- });
- return t.when.apply(t, i).then(function() {
- return c(n.intermediate)
- })
- }
- ,
- c
- }),
- define("totp/totp", ["jquery", "can", "../models/totp", "mainui/confirm/amd/confirm", "text!./views/totp.stache", "text!./views/totp_qr.stache", "text!./views/totp_manual.stache", "jqueryui", "can/view/stache"], function(t, e, n, i, r, o, s) {
- return e.stache("totp_stache", r),
- e.stache("totp_qr_stache", o),
- e.stache("totp_manual_stache", s),
- e.Control.extend({
- create: function(e) {
- var n = t("#smscDialogTOTP");
- return 0 !== n.length && (n.is(":data(dialog)") && n.dialog("destroy"),
- n.remove()),
- n = t("<div>").attr("id", "smscDialogTOTP"),
- t("body").append(n),
- n.dialog({
- modal: !0,
- width: 720,
- height: 400,
- beforeClose: function(i) {
- i.preventDefault(),
- e.targetElement.trigger("totpDialogClosing", [t("#smscDialogTOTP").data("totpIsSet")]),
- n.dialog("destroy"),
- n.parents(".smscWindow").remove(),
- n.remove()
- }
- }).parents(".ui-dialog:eq(0)").wrap('<div class="smscWindow no-gradient"></div>'),
- new this(n,e)
- }
- }, {
- init: function() {
- var t = this;
- t.element.data("totpIsSet", !1),
- this.options.fromForce ? n.getTwofactorConfig({}).then(function(n) {
- t.config = n,
- t.element.dialog("option", "title", n.lang.totpdialog_title),
- t.element.html(e.view("totp_stache", {
- lang: t.config.lang
- })),
- t._renderQR(),
- t.element.find("#txt_totpCode").focus()
- }) : n.getConfig({}).then(function(n) {
- t.config = n,
- t.element.dialog("option", "title", n.lang.totpdialog_title),
- t.element.html(e.view("totp_stache", {
- lang: t.config.lang
- })),
- t._renderQR(),
- t.element.find("#txt_totpCode").focus()
- })
- },
- _renderQR: function() {
- this.element.find(".rcol .content-holder").html(e.view("totp_qr_stache", {
- lang: this.config.lang,
- qr: this.config.qr
- })),
- this.qrView = !0
- },
- _renderManual: function() {
- this.element.find(".rcol .content-holder").html(e.view("totp_manual_stache", {
- lang: this.config.lang,
- user: this.config.username,
- domain: this.config.domain,
- key: this.config.key
- }, {
- highlightNumbers: function(t) {
- for (var n = "", i = 0, r = t.length; i < r; ++i) {
- var o = t.charAt(i);
- isNaN(o) ? n += o : n += '<span class="hilite">' + o + "</span>"
- }
- return e.mustache.safeString(n)
- }
- })),
- this.qrView = !1
- },
- ".switchView click": function() {
- this.qrView ? this._renderManual() : this._renderQR()
- },
- ".continueButton:not(:disabled) click": function(t) {
- t.attr("disabled", !0);
- var e = this
- , i = this.element.find("#txt_totpCode");
- i.removeClass("error").addClass("loading"),
- "" === i.val() ? (i.addClass("error").removeClass("loading"),
- t.removeAttr("disabled")) : this.options.fromForce ? n.validateTwoFactorAndSafeCode({
- code: i.val()
- }).then(function(t) {
- e._handleValidation(t)
- }) : n.validateAndSafeCode({
- code: i.val()
- }).then(function(t) {
- e._handleValidation(t)
- })
- },
- _handleValidation: function(t) {
- var e = this;
- e.element.find("#txt_totpCode").removeClass("loading"),
- e.element.data("totpIsSet", t),
- i(t ? {
- title: this.config.lang.totpdialog_validate_true_title,
- msg: this.config.lang.totpdialog_validate_true_msg,
- ok_title: this.config.lang.totpdialog_ok
- } : {
- title: this.config.lang.totpdialog_validate_false_title,
- msg: this.config.lang.totpdialog_validate_false_msg,
- ok_title: this.config.lang.totpdialog_ok
- }).on("confirmed", function() {
- e.element.find(".continueButton").removeAttr("disabled"),
- e.element.find("#txt_totpCode").addClass("error").val("").focus(),
- t && e.element.dialog("close")
- })
- },
- "#txt_totpCode keypress": function(t, e) {
- 13 === e.keyCode && this.element.find(".continueButton").trigger("click")
- }
- })
- }),
- define("text!totpvalidation/views/totpvalidation.stache", [], function() {
- return '<div class="totpValidationDialog cf">\n\t<div class="form-holder">\n\t\t<input type="text" id="txt_totpCode" maxlength="6" placeholder="{{lang.totpvalidationdialog_6digitcode}}" />\n\t\t<button class="continueButton smscButton blue">{{lang.totpvalidationdialog_continue}}</button>\n\t</div>\n\t<a href="http://www.smartschool.be/help/dubbele-authenticatie-vergeten-verloren/" target="_blank" class="info">{{lang.totpvalidationdialog_info}}</a>\n</div>'
- }),
- define("totpvalidation/totpvalidation", ["jquery", "can", "../models/totp", "text!./views/totpvalidation.stache", "jqueryui", "can/view/stache"], function(t, e, n, i) {
- return e.stache("totpvalidation_stache", i),
- e.Control.extend({
- create: function(e) {
- var n = t("#smscDialogTOTPValidation");
- return 0 !== n.length && (n.is(":data(dialog)") && n.dialog("destroy"),
- n.remove()),
- n = t("<div>").attr("id", "smscDialogTOTPValidation"),
- t("body").append(n),
- n.dialog({
- modal: !0,
- width: 720,
- height: 360,
- beforeClose: function(i) {
- i.preventDefault(),
- e.targetElement.trigger("totpValidationDialogClosing", [t("#smscDialogTOTPValidation").data("totpValid"), t("#smscDialogTOTPValidation").data("totpCode")]),
- n.dialog("destroy"),
- n.parents(".smscWindow").remove(),
- n.remove()
- }
- }).parents(".ui-dialog:eq(0)").wrap('<div class="smscWindow no-gradient"></div>'),
- new this(n,e)
- }
- }, {
- init: function() {
- var t = this;
- t.element.data("totpValid", !1),
- t.element.data("totpCode", ""),
- n.getValidationConfig({}).then(function(n) {
- t.config = n,
- t.element.dialog("option", "title", n.lang.totpvalidationdialog_title),
- t.element.html(e.view("totpvalidation_stache", {
- lang: t.config.lang
- })),
- t.element.find("#txt_totpCode").focus()
- })
- },
- ".continueButton:not(:disabled) click": function(t) {
- t.attr("disabled", !0);
- var e = this
- , i = this.element.find("#txt_totpCode");
- i.removeClass("error").addClass("loading"),
- "" === i.val() ? (this.element.data("totpCode", ""),
- i.addClass("error").removeClass("loading"),
- t.removeAttr("disabled")) : (this.element.data("totpCode", i.val()),
- e.options.unsetTotp ? n.unsetTotp({
- code: i.val()
- }).then(function(t) {
- e._handleValidation(t)
- }) : this.element.dialog("close"))
- },
- _handleValidation: function(t) {
- this.element.data("totpValid", t),
- t ? this.element.dialog("close") : (this.element.find(".continueButton").removeAttr("disabled"),
- this.element.find("#txt_totpCode").removeClass("loading").addClass("error").val("").focus())
- },
- "#txt_totpCode keypress": function(t, e) {
- 13 === e.keyCode && this.element.find(".continueButton").trigger("click")
- }
- })
- }),
- define("text!twofactor/views/twofactor.ejs", [], function() {
- return '<div class="twofactorCenter">\n\t<div class="twofactorTitle">\n\t\t<%=lng_twofactor_title%>\n\t</div>\n\t<div class="twofactorsubTitle">\n\t\t<%=lng_twofactor_obligated1%><br>\n\t\t<%=lng_twofactor_obligated2%>\n\t</div>\n\t<div class="twofactorItems">\n\t\t<div class="twofactorItem totp">\n\t\t\t<button class="smscButton blue"><%=lng_twofactor_totp%></button>\n\t\t</div>\n\t\t<div class="twofactorItem yubikey">\n\t\t\t<button class="smscButton blue"><%=lng_twofactor_yubikey%></button>\n\t\t</div>\n\t</div>\n</div>\n<div class="twofactorInfo">\n\t<%=lng_twofactor_info%>\n</div>'
- }),
- define("twofactor/twofactor", ["jquery", "can", "smsc", "../yubikey/yubikey", "../totp/totp", "text!./views/twofactor.ejs", "can/view/ejs"], function(t, e, n, i, r, o) {
- return e.ejs("modules_authentication_app_twofactor_views_twofactor", o),
- e.Control.extend({
- init: function() {
- var n = this;
- this.element.dialog({
- title: "",
- modal: !0,
- resizable: !1,
- width: 640,
- height: 350,
- beforeClose: function(e) {
- e.preventDefault(),
- n.options.opener.closeTwofactor(),
- t(this).parents(".smscWindow").remove(),
- t(this).remove()
- }
- }).parents(".ui-dialog:eq(0)").wrap('<div class="smscWindow no-gradient"></div>'),
- this.element.html(e.view("modules_authentication_app_twofactor_views_twofactor", this.options.lng)),
- this.element.dialog("open")
- },
- focus: function() {
- this.element.find("input:first").focus()
- },
- "input[name=twofactor] keydown": function(t, e) {
- 13 == e.keyCode && (this.options.opener.handleTwofactor(t.val()),
- this.element.dialog("close"))
- },
- ".yubikey click": function(e, r) {
- var o = t("<div>").addClass("yubikey");
- t("body").append(o),
- new i(o,{
- opener: this,
- lng: n.vars.yubikey,
- fromForce: !0
- })
- },
- ".totp click": function(t, e) {
- r.create({
- targetElement: this.element,
- fromForce: !0
- })
- },
- handleYubiKey: function(t) {
- this.options.opener.handleTwoFactorYubikey(t),
- this.element.dialog("close")
- },
- closeYubiKey: function() {},
- " totpDialogClosing": function(t, e, n) {
- n && this.element.dialog("close")
- }
- })
- }),
- define("text!autoreason/views/autoreason.ejs", [], function() {
- return '<div class="autoreasonCenter">\n\t<div class="autoreasonTitle">\n\t\t<%=lng.lng_autoreason_title%>\n\t</div>\n\t<div class="autoreasonInput">\n\t\t<label for="desknr">Desk:</label><input type="text" name="desknr" id="desknr" autocomplete="off" autofocus="autofocus">\n\t</div>\n\t<div class="autoreasonInput">\n\t\t<label for="jiranr">JIRA:</label><input type="text" name="jiranr" id="jiranr" autocomplete="off" autofocus="autofocus">\n\t</div>\n\t<div class="autoreasonInput">\n\t\t<label for="opmerking">Overige/opmerking:</label><input type="text" name="opmerking" id="opmerking" autocomplete="off" autofocus="autofocus">\n\t</div>\n\t<div class="autoreasonInput">\n\t\t<button class="smscButton blue nextbutton">Verder</button>\n\t</div>\n</div>'
- }),
- define("autoreason/autoreason", ["jquery", "can", "smsc", "text!./views/autoreason.ejs", "can/view/ejs"], function(t, e, n, i) {
- return e.ejs("modules_authentication_app_autoreason_views_autoreason", i),
- e.Control.extend({
- init: function() {
- var n = this;
- this.element.dialog({
- title: "",
- modal: !0,
- resizable: !1,
- width: 640,
- height: 350,
- beforeClose: function() {
- n.options.opener.closeautoreason(),
- t(this).parents(".smscWindow").remove(),
- t(this).remove()
- }
- }).parents(".ui-dialog:eq(0)").wrap('<div class="smscWindow no-gradient"></div>'),
- this.element.html(e.view("modules_authentication_app_autoreason_views_autoreason", {
- lng: this.options.lng
- })),
- this.element.dialog("open"),
- this.focus(),
- "" !== this.getUrlParam("desknr") && (this.element.find("#desknr").val(this.getUrlParam("desknr")),
- this.roundupComments())
- },
- focus: function() {
- this.element.find("input:first").focus()
- },
- "input keydown": function(t, e) {
- 13 == e.keyCode && this.roundupComments()
- },
- "button.nextbutton click": function(t, e) {
- this.roundupComments()
- },
- getUrlParam: function(t) {
- var e, n, i;
- return t = t.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"),
- e = "[\\?&]" + t + "=([^&#]*)",
- n = new RegExp(e),
- null === (i = n.exec(window.location.href)) ? "" : i[1]
- },
- roundupComments: function() {
- var e = !1
- , n = {};
- this.element.find("input").each(function(i, r) {
- n[t(r).attr("name")] = t(r).val(),
- "" != t(r).val().trim() && (e = !0)
- }),
- e ? (this.options.opener.handleautoreason(n),
- this.element.dialog("close")) : alert("Geef een reden in!")
- }
- })
- }),
- define("text!login/views/login.ejs", [], function() {
- return '<div id="authLeftPaneLoginFadeDiv">\n\t<div id="schoolname"><%=SMSC.vars.login.schoolname%></div>\n\t<div id="schoolplace"><%=SMSC.vars.login.schoolplace%></div>\n\t<p>\n\t\t<label class="input-label" for="username"><%= lng_username %></label>\n\t\t<input type="text" name="username" id="username" readonly autocomplete="off" spellcheck="false" autofocus tabindex="1" />\n\t</p>\n\t<p>\n\t\t<label class="input-label" for="password"><%= lng_password %></label>\n\t\t<input type="text" name="password" id="password" readonly autocomplete="off" spellcheck="false" tabindex="2" />\n\t</p>\n\t<button id="authLeftPaneLoginButton" class="smscButton" tabindex="3">\n\t\t<%== loginbutton %>\n\t</button>\n\t<% if(allowGoogle === \'1\') { %>\n\t\t<button id="authLeftPaneLoginGoogleButton" class="smscButton blue" onclick="window.location=\'<%= googleControllerPath %>\'" title="<%= login_button_google_title %>">\n\t\t\t<span class="icon"></span><span class="text"><%=login_button_google_title%></span>\n\t\t</button>\n\t<% } %>\n\t<% if(allowOffice365 === \'1\') { %>\n\t\t<button id="authLeftPaneLoginOffice365Button" class="smscButton" onclick="window.location=\'<%= office365ControllerPath %>\'" title="<%= login_button_office365_title %>">\n\t\t\t<span class="icon"></span><span class="text"><%=login_button_office365_title%></span>\n\t\t</button>\n\t<% } %>\n</div>'
- }),
- define("mainui/alert/amd/alert", ["jquery", "can", "jqueryui"], function(t, e) {
- return function(n) {
- var i, r = {
- title: "",
- msg: "",
- ok_title: "",
- width: 300,
- height: "auto"
- }, o = e.extend({}, r, n), s = {}, a = t("#smscAlertDialog");
- return 0 === a.length ? (t("body").append('<div id="smscAlertDialog">' + o.msg + "</div>"),
- a = t("#smscAlertDialog")) : a.html(o.msg),
- a.is(":data(dialog)") || a.dialog({
- autoOpen: !1,
- modal: !0,
- title: o.title,
- resizable: !1,
- width: o.width,
- height: o.height
- }),
- i = o.ok_title,
- s[i] = function() {
- t(this).dialog("close"),
- o.onClose && "function" == typeof o.onClose && o.onClose()
- }
- ,
- a.dialog("option", "buttons", s),
- a.dialog("open"),
- a
- }
- }),
- function(t) {
- t.InFieldLabels = function(e, n, i) {
- var r = this;
- r.$label = t(e),
- r.label = e,
- r.$field = t(n),
- r.field = n,
- r.$label.data("InFieldLabels", r),
- r.showing = !0,
- r.init = function() {
- var e;
- r.options = t.extend({}, t.InFieldLabels.defaultOptions, i),
- r.options.className && r.$label.addClass(r.options.className),
- setTimeout(function() {
- "" !== r.$field.val() ? (r.$label.hide(),
- r.showing = !1) : (r.$label.show(),
- r.showing = !0)
- }, 200),
- r.$field.focus(function() {
- r.fadeOnFocus()
- }).blur(function() {
- r.checkForEmpty(!0)
- }).bind("keydown.infieldlabel", function(t) {
- r.hideOnChange(t)
- }).bind("paste", function() {
- r.setOpacity(0)
- }).change(function() {
- r.checkForEmpty()
- }).bind("onPropertyChange", function() {
- r.checkForEmpty()
- }).bind("keyup.infieldlabel", function() {
- r.checkForEmpty()
- }),
- r.options.pollDuration > 0 && (e = setInterval(function() {
- "" !== r.$field.val() && (r.$label.hide(),
- r.showing = !1,
- clearInterval(e))
- }, r.options.pollDuration))
- }
- ,
- r.fadeOnFocus = function() {
- r.showing && r.setOpacity(r.options.fadeOpacity)
- }
- ,
- r.setOpacity = function(t) {
- r.$label.stop().animate({
- opacity: t
- }, r.options.fadeDuration, function() {
- 0 === t && r.$label.hide()
- }),
- r.showing = t > 0
- }
- ,
- r.checkForEmpty = function(t) {
- "" === r.$field.val() ? (r.prepForShow(),
- r.setOpacity(t ? 1 : r.options.fadeOpacity)) : r.setOpacity(0)
- }
- ,
- r.prepForShow = function() {
- r.showing || (r.$label.css({
- opacity: 0
- }).show(),
- r.$field.bind("keydown.infieldlabel", function(t) {
- r.hideOnChange(t)
- }))
- }
- ,
- r.hideOnChange = function(t) {
- 16 !== t.keyCode && 9 !== t.keyCode && (r.showing && (r.$label.hide(),
- r.showing = !1),
- r.$field.unbind("keydown.infieldlabel"))
- }
- ,
- r.init()
- }
- ,
- t.InFieldLabels.defaultOptions = {
- fadeOpacity: .5,
- fadeDuration: 300,
- pollDuration: 0,
- enabledInputTypes: ["text", "search", "tel", "url", "email", "password", "number", "textarea"],
- className: !1
- },
- t.fn.inFieldLabels = function(e) {
- var n = e && e.enabledInputTypes || t.InFieldLabels.defaultOptions.enabledInputTypes;
- return this.each(function() {
- var i, r = t(this).attr("for");
- r && (i = document.getElementById(r)) && (-1 === t.inArray(i.type, n) && "TEXTAREA" !== i.nodeName || new t.InFieldLabels(this,i,e))
- })
- }
- }(jQuery),
- define("jqplugins/infieldlabel/jquery.infieldlabel", function() {}),
- define("login/login", ["jquery", "can", "models/login", "../yubikey/yubikey", "../totp/totp", "../totpvalidation/totpvalidation", "../twofactor/twofactor", "../autoreason/autoreason", "text!./views/login.ejs", "mainui/alert/amd/alert", "jqplugins/infieldlabel/jquery.infieldlabel", "can/view/ejs"], function(t, e, n, i, r, o, s, a, u, c) {
- return e.ejs("modules_authentication_app_login_views_login", u),
- e.Control.extend({
- defaults: {
- statusObject: "Status"
- }
- }, {
- token: "",
- autoLoginStarted: !1,
- isLoginInProgress: !1,
- yubikeyValue: "",
- autoreasonValue: [],
- twoFactorYubikeyValue: "",
- totpCode: "",
- init: function() {
- var n = this
- , i = this.getUrlParam("pk");
- this.element.html(e.view("modules_authentication_app_login_views_login", {
- lng_username: this.options.lng_username,
- lng_password: this.options.lng_password,
- loginbutton: this.options.loginbutton,
- allowGoogle: this.options.allowGoogle,
- googleControllerPath: this.options.googleControllerPath,
- allowOffice365: this.options.allowOffice365,
- office365ControllerPath: this.options.office365ControllerPath,
- login_button_google_title: this.options.login_button_google_title,
- login_button_office365_title: this.options.login_button_office365_title
- })),
- t("#authLeftPaneLoginFadeDiv").fadeIn(),
- t("#authRightPaneLogin label").inFieldLabels({
- fadeOpacity: .8,
- fadeDuration: 250
- }),
- n.element.find("input:first").removeAttr("readonly").focus(),
- i.length >= 32 && i.length <= 48 && this.initYubiAuto(i),
- (SMSC.vars.showUnlockAlert || SMSC.vars.showUnlockAndMailAlert) && new c({
- title: SMSC.vars.login.login_unlock_alert_title,
- msg: SMSC.vars.showUnlockAlert ? SMSC.vars.login.login_unlock_alert_txt : SMSC.vars.login.login_unlock_alert_txtandmail,
- ok_title: SMSC.vars.login.login_unlock_alert_ok
- }),
- this.checkForAutoLogin()
- },
- initYubiAuto: function(e) {
- n.yubiAuto({
- pk: e
- }, t.proxy(this.handleYubiAuto, this))
- },
- handleYubiAuto: function(e) {
- !0 === e.success && !1 !== e.userdata.u && (t("#username").val(e.userdata.u).trigger("keydown"),
- !1 !== e.userdata.p ? (t("#password").attr("type", "password").val(e.userdata.p).trigger("keydown"),
- this.startLogin()) : t("#password").removeAttr("readonly").focus())
- },
- getUrlParam: function(t) {
- var e, n, i;
- return t = t.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"),
- e = "[\\?&]" + t + "=([^&#]*)",
- n = new RegExp(e),
- null === (i = n.exec(window.location.href)) ? "" : i[1]
- },
- checkForAutoLogin: function() {
- var e, i, r;
- this.autoLoginStarted || (this.autoLoginStarted = !0,
- e = this.getUrlParam("mek"),
- i = this.getUrlParam("smk"),
- "" !== e && "" !== i ? (r = {
- mek: e,
- smk: i
- },
- n.getAutoLoginData(r, t.proxy(this.handleAutoLogin, this))) : this.autoLoginStarted = !1)
- },
- handleAutoLogin: function(e) {
- var n = e.username
- , i = e.password;
- t("#username").val(n).trigger("keydown"),
- t("#password").attr("type", "password").val(i).trigger("keydown"),
- this.startLogin()
- },
- "input keydown": function(e, n) {
- if (13 === n.keyCode)
- "username" === n.target.id ? t("#password").removeAttr("readonly").focus() : this.startLogin();
- else if ("username" === n.target.id && 9 === n.keyCode)
- return n.stopImmediatePropagation(),
- t("#password").removeAttr("readonly").focus(),
- !1
- },
- "input focus": "_setInputField",
- "input click": "_setInputField",
- _setInputField: function(t, e) {
- t.removeAttr("readonly"),
- "password" === t.attr("id") && t.attr("type", "password")
- },
- ".input-label click": function(e, n) {
- n.stopImmediatePropagation();
- var i = t("#" + e.attr("for"));
- this._setInputField(i),
- i.focus()
- },
- "#authLeftPaneLoginButton click": function(e) {
- t(e).hasClass("disabled") || this.startLogin()
- },
- verifyStartLogin: function() {
- return !(t("input").filter(function() {
- return "" === this.value
- }).length > 0)
- },
- startLogin: function() {
- if (this.verifyStartLogin() && !this.isLoginInProgress) {
- this.setIsLoginInProgress();
- var e = t("#username").val();
- n.getToken({
- username: e
- }, t.proxy(this.handleToken, this))
- }
- },
- handleToken: function(t) {
- this.token = t.token,
- this.loginStep1()
- },
- loginStep1: function() {
- var e = t("#password").val()
- , i = {
- username: t("#username").val(),
- password: n.encryptPwd(e, this.token),
- hn: this.getUrlParam("hn")
- };
- "" != this.yubikeyValue && (i.yubiKey = this.yubikeyValue),
- "" != this.totpCode && (i.totpCode = this.totpCode),
- "" != this.twoFactorYubikeyValue && (i.twoFactorYubikeyValue = this.twoFactorYubikeyValue),
- void 0 !== this.autoreasonValue.desknr && (i.autoreason = this.autoreasonValue),
- n.sendLoginData(i, t.proxy(this.handleLoginStep1, this))
- },
- handleLoginStep1: function(t) {
- var e = this.yubikeyValue;
- t.success ? this.element.trigger("loginStep1") : (this.yubikeyValue = "",
- this.totpCode = "",
- this.twoFactorYubikeyValue = "",
- t.yubikey_notpassed ? this.showYubiKeyDialog() : t.totp_notpassed ? this.showTotpValidationDialog() : t.twofactormsg ? new c({
- title: SMSC.vars.twofactor.lng_twofactor_alert_title,
- msg: t.msg,
- ok_title: SMSC.vars.twofactor.lng_twofactor_alert_ok
- }) : t.twofactorobligated_error && t.twofactorobligated_notpassed ? this.showTwoFactorDialog() : t.twofactorobligated_error && t.twofactorobligated_notpassed ? this.showTwoFactorDialog() : t.showautoreason ? (this.showAutoReason(),
- this.yubikeyValue = e) : t.counter ? this.element.trigger("status_not_ok_counter", t) : this.element.trigger("loginStep1_failed", [{
- msg: t.msg,
- icon: t.icon
- }]))
- },
- "{statusElement} loginStep1_finished": function() {
- this.loginStep2()
- },
- loginStep2: function() {
- this.handleLoginStep2(),
- n.gatherData({}, "")
- },
- handleLoginStep2: function() {
- var t = this;
- setTimeout(function() {
- t.element.trigger("loginStep2")
- }, 350)
- },
- "{statusElement} loginStep2_finished": function() {
- this.reloadToUri()
- },
- "{statusElement} startStatusNotOk_finished": function() {
- this.unsetIsLoginInProgress()
- },
- "{statusElement} startStatusNotOkCounter_finished": function() {
- this.unsetIsLoginInProgress()
- },
- reloadToUri: function() {
- this.unsetIsLoginInProgress(),
- window.location = this.options.requesturi
- },
- setIsLoginInProgress: function() {
- this.isLoginInProgress = !0,
- this.element.find("button").addClass("disabled")
- },
- unsetIsLoginInProgress: function() {
- this.isLoginInProgress = !1,
- this.element.find("button").removeClass("disabled")
- },
- showYubiKeyDialog: function() {
- var e = t("<div>").addClass("yubikey");
- t("body").append(e),
- new i(e,{
- opener: this,
- lng: SMSC.vars.yubikey
- })
- },
- showTwoFactorDialog: function() {
- var e = t("<div>").addClass("twofactor");
- t("body").append(e),
- new s(e,{
- opener: this,
- lng: SMSC.vars.twofactor
- })
- },
- showAutoReason: function() {
- var e = t("<div>").addClass("autoreason");
- t("body").append(e),
- new a(e,{
- opener: this,
- lng: SMSC.vars.autoreason
- })
- },
- handleautoreason: function(t) {
- this.autoreasonValue = t,
- this.loginStep1()
- },
- closeautoreason: function() {
- this.unsetIsLoginInProgress()
- },
- handleYubiKey: function(t) {
- this.yubikeyValue = t,
- this.loginStep1()
- },
- closeYubiKey: function() {
- this.unsetIsLoginInProgress()
- },
- handleTwoFactorYubikey: function(t) {
- this.twoFactorYubikeyValue = t,
- this.loginStep1()
- },
- closeTwofactor: function() {
- this.unsetIsLoginInProgress()
- },
- showTotpValidationDialog: function() {
- this.totpValidationDialog = o.create({
- targetElement: this.element
- })
- },
- " totpValidationDialogClosing": function(t, e, n, i) {
- "" === i ? this.unsetIsLoginInProgress() : (this.totpCode = i,
- this.loginStep1())
- }
- })
- }),
- define("text!status/views/status.ejs", [], function() {
- return '<div class="status <%= classnames %>"><div><%== lng_status_text %></div></div>'
- }),
- define("status/status", ["jquery", "can", "text!./views/status.ejs", "can/view/ejs"], function(t, e, n) {
- return e.ejs("modules_authentication_app_status_views_status", n),
- e.Control.extend({
- defaults: {
- scrollVal: 70,
- timeoutDuration: 1e3,
- timeoutDurationSlow: 3500,
- timeoutDurationSecond: 1e3,
- animateSpeed: 500
- }
- }, {
- init: function() {
- this.options.is_register_activation && this.setStatusRegister(this.options.is_register_activation_ok),
- this.setFirstStep(),
- 1 === this.options.not_connected_to_account && this.startStatusNotOk(this.options.lng_unkown_account_error)
- },
- setFirstStep: function() {
- this.element.append(e.view("modules_authentication_app_status_views_status", {
- classnames: "ok",
- lng_status_text: this.options.lng_status_start
- }))
- },
- setStatusRegister: function(n) {
- var i = this;
- this.element.prepend(e.view("modules_authentication_app_status_views_status", {
- classnames: "register" + (n ? "" : " failed"),
- lng_status_text: this.options.register_activation_txt
- })),
- i.timeout(function() {
- t.when(i.scrollDown()).then(function() {
- t("div.register").remove()
- })
- }, i.options.timeoutDurationSlow)
- },
- "{loginElement} loginStep1": function() {
- this.startLoginStep1()
- },
- startLoginStep1: function() {
- var e = this;
- t.when(this.startStep1()).then(function() {
- t.when(e.startStep2()).then(function() {
- t.when(e.startStep3()).then(function() {
- e.element.trigger("loginStep1_finished")
- })
- })
- })
- },
- "{loginElement} loginStep2": function() {
- this.startLoginStep2()
- },
- startLoginStep2: function() {
- var e = this;
- t.when(e.startStep4()).then(function() {
- e.element.trigger("loginStep2_finished")
- })
- },
- startStep1: function() {
- return this.element.append(e.view("modules_authentication_app_status_views_status", {
- classnames: "step1",
- lng_status_text: this.options.lng_status_step1
- })),
- this.scrollDown()
- },
- startStep2: function() {
- return this.element.append(e.view("modules_authentication_app_status_views_status", {
- classnames: "step2",
- lng_status_text: this.options.lng_status_step2
- })),
- this.scrollDown()
- },
- startStep3: function() {
- return this.element.append(e.view("modules_authentication_app_status_views_status", {
- classnames: "step3",
- lng_status_text: this.options.lng_status_step3
- })),
- this.scrollDown()
- },
- startStep4: function() {
- return this.element.append(e.view("modules_authentication_app_status_views_status", {
- classnames: "step4",
- lng_status_text: this.options.lng_status_step4
- })),
- this.scrollDown()
- },
- "{loginElement} loginStep1_failed": function(t, e, n) {
- this.startStatusNotOk(n.msg, n.icon)
- },
- startStatusNotOk: function(n, i) {
- i && void 0 !== i || (i = "");
- var r = this;
- this.element.prepend(e.view("modules_authentication_app_status_views_status", {
- classnames: "notok " + i,
- lng_status_text: n,
- icon: i
- })).scrollTop(this.options.scrollVal),
- t.when(this.scrollUp()).then(function() {
- r.timeout(function() {
- t.when(r.scrollDown()).then(function() {
- t("div.status.notok").remove(),
- r.element.trigger("startStatusNotOk_finished")
- })
- }, r.options.timeoutDuration)
- })
- },
- "{loginElement} status_not_ok_counter": function(t, e, n) {
- this.startStatusNotOkCounter(n.msg, n.counter, n.elementID, n.icon)
- },
- startStatusNotOkCounter: function(n, i, r, o) {
- o && void 0 !== o || (o = "");
- var s = this;
- this.element.prepend(e.view("modules_authentication_app_status_views_status", {
- classnames: "notok counter " + o,
- lng_status_text: n,
- icon: o
- })).scrollTop(this.options.scrollVal),
- t.when(this.scrollUp()).then(function() {
- t.when(s.startCountDown(r, i)).then(function() {
- t.when(s.scrollDown()).then(function() {
- t("div.status.notok.counter").remove(),
- s.element.trigger("startStatusNotOkCounter_finished")
- })
- })
- })
- },
- startCountDown: function(e, n) {
- var i = t.Deferred();
- return this.countDown(i, e, n),
- i.promise()
- },
- countDown: function(e, n, i) {
- var r = this;
- t("#" + n).html(i),
- setTimeout(function() {
- 0 === i ? e.resolve() : r.countDown(e, n, i - 1)
- }, r.options.timeoutDurationSecond)
- },
- scrollUp: function() {
- var e = t.Deferred()
- , n = parseInt(this.element.scrollTop(), 10) - this.options.scrollVal;
- return n < 0 && (n = 0),
- this.element.animate({
- scrollTop: n
- }, this.options.animateSpeed, function() {
- e.resolve()
- }),
- e.promise()
- },
- scrollDown: function() {
- var e = this;
- return t.Deferred(function(t) {
- var n = parseInt(e.element.scrollTop(), 10) + e.options.scrollVal;
- e.element.animate({
- scrollTop: n
- }, e.options.animateSpeed, function() {
- t.resolve()
- })
- }).promise()
- },
- timeout: function(t, e) {
- setTimeout(t, e)
- }
- })
- }),
- define("tip/tip", ["jquery", "can"], function(t, e) {
- return e.Control.extend({
- init: function() {
- var t = this.element.find("#smsctipimg")
- , e = this;
- tipID = t.attr("tipid"),
- void 0 !== tipID && t.css("cursor", "pointer").one("click", function() {
- e.getEmbed(tipID)
- })
- },
- getEmbed: function(e) {
- var n = this;
- t.ajax({
- url: "/Authentication/Index/gettipembed",
- type: "post",
- dataType: "json",
- data: {
- tipID: e
- },
- success: function(t) {
- n.animateEmbed(t)
- }
- })
- },
- animateEmbed: function(t) {
- var e = this;
- this.element.find("#smsctipimg").fadeOut("slow", function() {
- e.element.html(t.embed)
- })
- }
- })
- }),
- define("text!menu/views/menu.ejs", [], function() {
- return '<div id="<%= name %>"><%= text %></div>'
- }),
- define("text!recover/views/recover.ejs", [], function() {
- return '<p>\n<label for="username"><%= lng_username %></label>\n<input type="text" name="username" id="username" autofocus />\n</p>\n<button id="sendButton" class="smscButton">\n\t<%== sendbutton %>\n</button>'
- }),
- define("models/recover", ["jquery", "can"], function(t, e) {
- return e.Model({
- sendPwd: function(e, n) {
- t.ajax({
- url: "/Authentication/Recover/sendPwd",
- type: "post",
- dataType: "json",
- data: e,
- success: n
- })
- }
- }, {})
- }),
- define("recover/recover", ["jquery", "can", "smsc", "text!./views/recover.ejs", "mainui/alert/amd/alert", "models/recover", "can/view/ejs"], function(t, e, n, i, r, o) {
- return e.ejs("_modules_authentication_app_recover_views_recover", i),
- e.Control.extend({
- defaults: {}
- }, {
- init: function() {
- this.element.html(e.view("_modules_authentication_app_recover_views_recover", {
- lng_username: this.options.lng_username,
- sendbutton: this.options.sendbutton
- })),
- t("#authRightPaneLogin label").inFieldLabels({
- fadeOpacity: .8,
- fadeDuration: 250
- })
- },
- "#sendButton click": function() {
- var e = t("#username").val();
- t("#recover").click(),
- e.length > 0 && o.sendPwd({
- username: e
- }, t.proxy(this.handleSendPwd, this))
- },
- handleSendPwd: function(t) {
- t.success && new r({
- title: n.vars.error.lng_dberror_title,
- msg: t.msg,
- ok_title: "Ok"
- })
- }
- })
- }),
- define("models/register", ["jquery", "can"], function(t, e) {
- return e.Model({
- register: function(e, n) {
- t.ajax({
- url: "/Authentication/Register/register",
- type: "post",
- dataType: "json",
- data: e,
- success: n
- })
- }
- }, {})
- }),
- define("text!register/views/register.ejs", [], function() {
- return '<div class="registerContainer">\n\t\t<div class="registerBlock cf">\n\t\t\t<label for="register_username"><%= lng_username %>:</label>\n\t\t\t<input type="text" id="register_username" autofocus />\n\t\t</div>\n\t\t<div class="registerBlock cf">\n\t\t\t<label for="register_pwd"><%= lng_password %>:</label><input autocomplete="off" type="password" id="register_pwd" />\n\t\t</div>\n\t\t<div class="registerBlock cf">\n\t\t\t<label for="register_pwd_confirm"><%= lng_password_confirm %>:</label><input autocomplete="off" type="password" id="register_pwd_confirm" />\n\t\t</div>\n\t\t<div class="registerBlock cf">\n\t\t\t<label for="register_class_code"><%= lng_code %>:</label><input type="text" id="register_class_code" />\n\t\t</div>\n\t\t<div class="registerBlock cf">\n\t\t\t<label for="register_name"><%= lng_name %>:</label><input type="text" id="register_name" />\n\t\t</div>\n\t\t<div class="registerBlock cf">\n\t\t\t<label for="register_surname"><%= lng_surname %>:</label><input type="text" id="register_surname" />\n\t\t</div>\n\t\t<div class="registerBlock cf">\n\t\t\t<label for="register_email"><%= lng_email %>:</label><input type="text" id="register_email" />\n\t\t</div>\n</div>\n<button id="registerButton" class="smscButton"><%== registerbutton %></button>'
- }),
- define("register/register", ["jquery", "can", "smsc", "models/register", "text!./views/register.ejs", "mainui/alert/amd/alert", "can/view/ejs"], function(t, e, n, i, r, o) {
- return e.ejs("modules_authentication_app_register_views_register", r),
- e.Control.extend({
- init: function() {
- this.element.dialog({
- title: this.options.lng_register,
- modal: !0,
- resizable: !1,
- width: 410,
- beforeClose: function() {
- t(this).remove()
- }
- }).parents(".ui-dialog:eq(0)").addClass("smscWindow"),
- this.element.html(e.view("modules_authentication_app_register_views_register", {
- lng_username: this.options.lng_username,
- lng_password: this.options.lng_password,
- lng_password_confirm: this.options.lng_password_confirm,
- lng_code: this.options.lng_code,
- lng_name: this.options.lng_name,
- lng_surname: this.options.lng_surname,
- lng_email: this.options.lng_email,
- registerbutton: this.options.registerbutton
- })),
- this.element.dialog("open"),
- this.focus()
- },
- focus: function() {
- this.element.find("input:first").focus()
- },
- "#registerButton click": function() {
- var e = t("#register_username")
- , n = e.val()
- , r = t("#register_pwd")
- , o = r.val()
- , s = t("#register_pwd_confirm")
- , a = s.val()
- , u = t("#register_class_code")
- , c = u.val()
- , l = t("#register_name")
- , p = l.val()
- , h = t("#register_surname")
- , d = h.val()
- , f = t("#register_email")
- , g = f.val()
- , v = {}
- , m = !0;
- n.length < 2 ? (e.addClass("error"),
- m = !1) : e.removeClass("error"),
- o.length < 5 ? (r.addClass("error"),
- m = !1) : r.removeClass("error"),
- a.length < 5 ? (s.addClass("error"),
- m = !1) : s.removeClass("error"),
- 0 === c.length ? (u.addClass("error"),
- m = !1) : u.removeClass("error"),
- p.length < 1 ? (l.addClass("error"),
- m = !1) : l.removeClass("error"),
- d.length < 2 ? (h.addClass("error"),
- m = !1) : h.removeClass("error"),
- 0 === g.length ? (f.addClass("error"),
- m = !1) : f.removeClass("error"),
- m && (o !== a ? (r.addClass("error"),
- s.addClass("error"),
- m = !1) : (r.removeClass("error"),
- s.removeClass("error"))),
- m && (v = {
- username: n,
- pwd: o,
- pwd_confirm: a,
- class_code: c,
- name: p,
- surname: d,
- email: g
- },
- i.register(v, t.proxy(this.handleRegister, this)))
- },
- handleRegister: function(t) {
- this.element.dialog("close"),
- new o({
- title: n.vars.error.lng_dberror_title,
- msg: t.msg,
- ok_title: "Ok"
- })
- }
- })
- }),
- define("menu/menu", ["jquery", "can", "smsc", "text!./views/menu.ejs", "../recover/recover", "../login/login", "../register/register", "can/view/ejs"], function(t, e, n, i, r, o, s) {
- return e.ejs("modules_authentication_app_menu_views_menu", i),
- e.Control.extend({
- recover: !1,
- init: function() {
- this.element.empty();
- for (var t in this.options.items)
- this.element.append(e.view("modules_authentication_app_menu_views_menu", {
- name: this.options.items[t].name,
- text: this.options.items[t].text
- }));
- this.recover = !1
- },
- click: function(e, i) {
- var a, u = t(i.target), c = u.attr("id");
- switch (void 0 === this.options.items[c].clicked ? void 0 !== this.options.items[c].toggletext && (u.html(this.options.items[c].toggletext),
- this.options.items[c].clicked = !0) : void 0 !== this.options.items[c].toggletext && (u.html(this.options.items[c].text),
- delete this.options.items[c].clicked),
- c) {
- case "recover":
- this.options.loginElement.data("controls")[0].destroy(),
- !1 === this.recover ? (this.recover = !0,
- new r(this.options.loginElement,this.options.items[c].options)) : (this.recover = !1,
- new o(this.options.loginElement,this.options.loginOptions));
- break;
- case "register":
- a = t("<div>").addClass("register"),
- t("body").append(a),
- new s(a,n.vars.register)
- }
- }
- })
- }),
- define("modernizr", [], function() {
- return window.Modernizr
- }),
- define("bowser", [], function() {
- return window.bowser
- }),
- define("text!coreutils/browsercheck/views/browsercheck.stache", [], function() {
- return '<div class="browsercheck">\n\t\n\t<h1>{{title}}</h1>\n\t<p>{{{message}}}</p>\n\n\t<a target="_blank" href="https://www.google.com/chrome/browser/" class="browserButton chrome">{{browser_chrome}}</a>\n\t<a target="_blank" href="http://www.getfirefox.com" class="browserButton ff">{{browser_ff}}</a>\n <a target="_blank" href="https://www.microsoft.com/nl-be/windows/microsoft-edge" class="browserButton edge">{{browser_edge}}</a>\n\t<a target="_blank" href="https://www.apple.com/safari/" class="browserButton safari">{{browser_safari}}</a>\n\n\t\x3c!--<a target="_blank" href="{{extrainfolink}}" class="info">{{extrainfo}}</a>--\x3e\n\t{{#allowContinue}}\n\t<span class="continue">{{continueText}}</span>\n\t{{/allowContinue}}\n</div>'
- }),
- define("coreutils/browsercheck/browsercheck", ["jquery", "can", "modernizr", "bowser", "text!./views/browsercheck.stache", "can/view/stache"], function(t, e, n, i, r) {
- return e.stache("browsercheck_views_browsercheck", r),
- e.Control({
- _checkCookiesFailed: !1,
- _checkBorderradiusFailed: !1,
- _checkFlexboxFailed: !1,
- _isInternetExplorerFailed: !1,
- checkAll: function() {
- var t = !0;
- return (t = this.checkCookies()) && (t = this.checkBorderradius()),
- t && (t = this.checkFlexbox()),
- t && (t = !this.isInternetExplorer()),
- t
- },
- isInternetExplorer: function(t) {
- var e = !1;
- return i && !0 === i.msie && (e = !0,
- this._isInternetExplorerFailed = !0,
- this.renderWrongBrowser(t)),
- e
- },
- checkCookies: function() {
- var t = !0;
- return n.cookies || (t = !1,
- this._checkCookiesFailed = !0,
- this.renderWrongBrowser()),
- t
- },
- checkBorderradius: function() {
- var t = !0;
- return n.borderradius || (t = !1,
- this._checkBorderradiusFailed = !0,
- this.renderWrongBrowser()),
- t
- },
- checkFlexbox: function(t) {
- var e = !0;
- return n.flexbox || (e = !1,
- this._checkFlexboxFailed = !0,
- this.renderWrongBrowser(t)),
- e
- },
- renderWrongBrowser: function(i) {
- i || (i = !1),
- this.element.html(e.view("browsercheck_views_browsercheck", {
- type: "wrongbrowser",
- title: this.options.wrongbrowser_title,
- message: this.options.wrongbrowser_message,
- browser_chrome: this.options.browser_chrome,
- browser_ff: this.options.browser_ff,
- browser_ie: this.options.browser_ie,
- browser_edge: this.options.browser_edge,
- browser_safari: this.options.browser_safari,
- extrainfo: this.options.extrainfo,
- extrainfolink: this.options.extrainfolink,
- continueText: this.options.continueText,
- allowContinue: i
- })),
- this.element.find("a:first").focus();
- var r = {}
- , o = "";
- try {
- for (var s in navigator)
- r[s] = navigator[s];
- delete r.plugins,
- delete r.mimeTypes,
- o = JSON.stringify(r)
- } catch (t) {
- r = {
- error: "FAILED parsing navigator",
- userAgent: navigator.userAgent
- },
- o = JSON.stringify(r)
- }
- t.ajax({
- method: "POST",
- url: "/Authentication/Browsercheck/failed",
- data: {
- cookies: this._checkCookiesFailed ? 1 : 0,
- borderradius: this._checkBorderradiusFailed ? 1 : 0,
- flexbox: this._checkFlexboxFailed ? 1 : 0,
- msie: this._isInternetExplorerFailed ? 1 : 0,
- navigator: o,
- modernizrVersion: n._version
- }
- })
- },
- ".continue click": function() {
- this.element.remove(),
- this.destroy()
- }
- })
- }),
- function(t) {
- var e = function(e) {
- this.options = t.extend({}, t.smartbanner.defaults, e);
- var n = navigator.standalone;
- if (this.options.force)
- this.type = this.options.force;
- else if (null != navigator.userAgent.match(/Windows NT/i)) {
- var i = navigator.userAgent.split(/\s*[;)(]\s*/);
- parseFloat(i[1].split(" ").pop()) > 6.1 && (this.type = !1)
- } else
- null != navigator.userAgent.match(/Windows Phone/i) ? this.type = "windows-phone" : null != navigator.userAgent.match(/iPad|iPhone|iPod/i) && null != navigator.userAgent.match(/Safari/i) ? (window.Number(navigator.userAgent.substr(navigator.userAgent.indexOf("OS ") + 3, 3).replace("_", ".")) < 6 || null == navigator.userAgent.match(/Version/i)) && (this.type = "ios") : null != navigator.userAgent.match(/Android/i) && (this.type = "android");
- if (this.type && !n && !this.getCookie("sb-closed") && !this.getCookie("sb-installed")) {
- var r, o, s;
- switch (this.type) {
- case "windows":
- r = 'meta[name="msApplication-ID"]',
- o = 'meta[name="ms-store-rt-tracking"]',
- s = this.options.windowsNTConfig || null;
- break;
- case "windows-phone":
- r = 'meta[name="msApplication-WinPhonePackageUrl"]',
- o = 'meta[name="ms-store-phone-tracking"]',
- s = this.options.windowsPhoneConfig || null;
- break;
- case "android":
- r = 'meta[name="google-play-app"]',
- o = 'meta[name="google-play-app-tracking"]',
- s = this.options.androidConfig || null;
- break;
- case "ios":
- r = 'meta[name="apple-itunes-app"]',
- o = 'meta[name="apple-itunes-app-tracking"]',
- s = this.options.iphoneConfig || null
- }
- var a = t(r)
- , u = t(o);
- 0 != a.length && (0 == u.length && (u = t('<meta name="" content="" />')),
- "windows" == this.type ? (this.pfn = t('meta[name="msApplication-PackageFamilyName"]').attr("content"),
- this.appId = a.attr("content")[1]) : "windows-phone" == this.type ? this.appId = a.attr("content") : this.appId = /app-id=([^\s,]+)/.exec(a.attr("content"))[1],
- this.appTracking = u.attr("content"),
- s && t.extend(this.options, s),
- this.scale = "auto" == this.options.scale ? t(window).width() / window.screen.width : this.options.scale,
- this.scale < 1 && (this.scale = 1),
- this.title = this.options.title ? this.options.title : t("title").text().replace(/\s*[|\-·].*$/, ""),
- this.author = this.options.author ? this.options.author : t('meta[name="author"]').length ? t('meta[name="author"]').attr("content") : window.location.hostname,
- this.create(),
- this.show(),
- this.listen())
- }
- };
- e.prototype = {
- constructor: e,
- create: function() {
- var e, n, i = this.options.price ? '<span class="sb-price">' + this.options.price + "</span> " + ("android" == this.type ? this.options.inGooglePlay : "ios" == this.type ? this.options.inAppStore : this.options.inWindowsStore) : "", r = this.options.iconGloss;
- if ("" == this.appTracking)
- switch (this.type) {
- case "windows":
- n = "ms-windows-store:PDP?PFN=" + this.pfn;
- break;
- case "windows-phone":
- n = "http://windowsphone.com/s?appId=" + this.appId;
- break;
- case "android":
- n = "market://details?id=" + this.appId;
- break;
- case "ios":
- n = "https://itunes.apple.com/" + this.options.appStoreLanguage + "/app/id" + this.appId
- }
- else
- n = this.appTracking;
- var o = this.options.container;
- if (!(t(o).length < 1)) {
- t(o).append('<div id="smartbanner" class="' + this.type + '"><div class="sb-container"><a href="#" class="sb-close">×</a><span class="sb-icon"></span><div class="sb-info"><strong>' + this.title + "</strong><span>" + this.author + "</span><span>" + i + '</span></div><a href="' + n + '" target="_blank" class="sb-button"><span>' + this.options.button + "</span></a></div></div>");
- var s = t("#smartbanner");
- if (this.options.icon ? e = this.options.icon : t('link[rel="apple-touch-icon-precomposed"]').length > 0 ? e = t('link[rel="apple-touch-icon-precomposed"]').attr("href") : t('link[rel="apple-touch-icon"]').length > 0 ? e = t('link[rel="apple-touch-icon"]').attr("href") : t('meta[name="msApplication-TileImage"]').length > 0 ? e = t('meta[name="msApplication-TileImage"]').attr("content") : t('meta[name="msapplication-TileImage"]').length > 0 && (e = t('meta[name="msapplication-TileImage"]').attr("content")),
- e) {
- var a = t("#smartbanner .sb-icon");
- a.css("background-image", "url(" + e + ")"),
- r && a.addClass("gloss")
- } else
- s.addClass("no-icon");
- this.scale > 1 && (s.css("top", parseFloat(s.css("top")) * this.scale).css("height", parseFloat(s.css("height")) * this.scale),
- t("#smartbanner .sb-container").css("-webkit-transform", "scale(" + this.scale + ")").css("-msie-transform", "scale(" + this.scale + ")").css("-moz-transform", "scale(" + this.scale + ")").css("width", t(window).width() / this.scale))
- }
- },
- listen: function() {
- t("#smartbanner .sb-close").on("click", t.proxy(this.close, this)),
- t("#smartbanner .sb-button").on("click", t.proxy(this.install, this))
- },
- show: function(e) {
- var n = t("html");
- n.get(0).className = n.get(0).className + " smartBanner ",
- e && e()
- },
- hide: function(e) {
- t("#smartbanner").detach(),
- e && e()
- },
- close: function(t) {
- t.preventDefault(),
- this.hide(),
- this.setCookie("sb-closed", "true", this.options.daysHidden)
- },
- install: function(t) {
- this.hide(),
- this.setCookie("sb-installed", "true", this.options.daysReminder)
- },
- setCookie: function(t, e, n) {
- var i = new Date;
- i.setDate(i.getDate() + n),
- e = encodeURIComponent(e) + (null == n ? "" : "; expires=" + i.toUTCString()),
- document.cookie = t + "=" + e + "; path=/;"
- },
- getCookie: function(t) {
- var e, n, i, r = document.cookie.split(";");
- for (e = 0; e < r.length; e++)
- if (n = r[e].substr(0, r[e].indexOf("=")),
- i = r[e].substr(r[e].indexOf("=") + 1),
- (n = n.replace(/^\s+|\s+$/g, "")) == t)
- return decodeURIComponent(i);
- return null
- },
- switchType: function() {
- Array.prototype.indexOf || (Array.prototype.indexOf = function(t, e) {
- if (void 0 === this || null === this)
- throw new TypeError('"this" is null or not defined');
- var n = this.length >>> 0;
- for (e = +e || 0,
- Math.abs(e) === 1 / 0 && (e = 0),
- e < 0 && (e += n) < 0 && (e = 0); e < n; e++)
- if (this[e] === t)
- return e;
- return -1
- }
- );
- var e = this;
- e.hide(function() {
- var n = ["ios", "android", "windows", "windows-phone"]
- , i = n.indexOf(e.type) + 1;
- e.type = n[i] ? n[i] : n[0];
- var r = t("android" == e.type ? 'meta[name="google-play-app"]' : 'meta[name="apple-itunes-app"]').attr("content");
- e.appId = /app-id=([^\s,]+)/.exec(r)[1],
- t("#smartbanner").detach(),
- e.create(),
- e.show(),
- window.console && console.log && console.log(e.type)
- })
- }
- },
- t.smartbanner = function(n) {
- var i = t(window)
- , r = i.data("typeahead")
- , o = "object" == typeof n && n;
- r || i.data("typeahead", r = new e(o)),
- "string" == typeof n && r[n]()
- }
- ,
- t.smartbanner.defaults = {
- title: null,
- author: null,
- price: "FREE",
- priceText: "On the store",
- icon: null,
- button: "View in Store",
- appStoreLanguage: "us",
- inAppStore: "On the App Store",
- inGooglePlay: "In Google Play",
- inWindowsStore: "In the Windows Store",
- iconGloss: null,
- daysHidden: 15,
- daysReminder: 90,
- scale: "auto",
- container: "body",
- force: null,
- iphoneConfig: null,
- ipadConfig: null,
- androidConfig: null,
- androidTabsConfig: null,
- windowsPhoneConfig: null,
- windowsNTConfig: null
- },
- t.smartbanner.Constructor = e
- }(window.jQuery),
- define("resources/jqueryplugins/jquery.universal-smartbanner/jquery.ultimate-smartbanner", function() {}),
- require.config({
- baseUrl: "/modules/Authentication/application",
- paths: {
- jquery: "../../../smsc/resources/requirejs-jquery/requirejs-jquery",
- can: "../../../smsc/resources/canjs/2.3.7/amd/can",
- smsc: "../../../smsc/resources/requirejs-smsc/requirejs-smsc",
- jquerypp: "../../../smsc/resources/jquerypp/1.0.1/amd",
- jqueryui: "../../../smsc/resources/requirejs-jqueryui/requirejs-jqueryui",
- modernizr: "../../../smsc/resources/modernizr/requirejs-modernizr",
- bowser: "../../../smsc/resources/bowser/requirejs-bowser",
- text: "../../../smsc/resources/requirejstext/2.0.14/text",
- layout: "../../../smsc/desktop/ui/layout",
- mainui: "../../../smsc/desktop/ui",
- resources: "../../../smsc/resources",
- resources_desktop: "../../../smsc/desktop/resources",
- jqplugins: "../../../includes/jQuery/plugins",
- coreutils: "../../../smsc/utils/"
- },
- shim: {
- can: {
- deps: ["jquery"],
- exports: "can"
- },
- jquerypp: {
- deps: ["jquery"]
- },
- jqueryui: {
- deps: ["jquery"]
- }
- }
- }),
- require(["jquery", "can", "smsc", "login/login", "status/status", "tip/tip", "menu/menu", "coreutils/browsercheck/browsercheck", "resources/jqueryplugins/jquery.universal-smartbanner/jquery.ultimate-smartbanner"], function(t, e, n, i, r, o, s, a) {
- var u = (t("#smscMain"),
- t("#authRightPaneLogin"))
- , c = t("#statusContainer")
- , l = t("#smsctip")
- , p = t("#browserCheck")
- , h = {}
- , d = {}
- , f = {};
- sessionStorage.clear();
- var g = new a(p,n.vars.check);
- g.checkCookies() && g.checkBorderradius() && (!g.isInternetExplorer(!0) && g.checkFlexbox(!0) && p.remove(),
- d = t.extend({}, n.vars.login, {
- statusElement: c
- }),
- new i(u,d),
- h = t.extend({}, n.vars.status, {
- loginElement: u
- }),
- new r(c,h),
- new o(l),
- f = t.extend({}, n.vars.menu, {
- loginElement: u,
- loginOptions: d
- }),
- new s(t("#authRightPaneOptions"),f),
- t("#browserCheck").length && t("#browserCheck a:first").focus()),
- t.smartbanner({
- title: n.vars.banners.banner_title,
- author: n.vars.banners.banner_title,
- price: n.vars.banners.banner_price,
- priceText: n.vars.banners.banner_applestore,
- icon: null,
- button: n.vars.banners.banner_view,
- daysHidden: 5,
- daysReminder: 90,
- scale: "auto",
- container: "body",
- iphoneConfig: {
- icon: "/smsc/img/apple/apple_128x128.png",
- inAppStore: n.vars.banners.banner_applestore
- },
- ipadConfig: {
- icon: "/smsc/img/apple/apple_128x128.png",
- inAppStore: n.vars.banners.banner_applestore
- },
- androidConfig: {
- icon: "/smsc/img/android_app_logo/android_app_logo_128x128@2x.png",
- inGooglePlay: n.vars.banners.banner_playstore
- },
- androidTabsConfig: {
- icon: "/smsc/img/android_app_logo/android_app_logo_128x128@2x.png",
- inGooglePlay: n.vars.banners.banner_playstore
- },
- windowsPhoneConfig: {
- icon: "/smsc/img/windows_app_logo/windows_app_logo_128x128.png",
- inWindowsStore: n.vars.banners.banner_windowsstore
- },
- windowsNTConfig: {
- icon: "/smsc/img/windows_app_logo/windows_app_logo_128x128.png",
- inWindowsStore: n.vars.banners.banner_windowsstore
- }
- })
- }),
- define("main", function() {});
Add Comment
Please, Sign In to add comment