Guest User

Untitled

a guest
Nov 20th, 2017
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 397.60 KB | None | 0 0
  1. function pidCrypt() {
  2. function t(t) {
  3. t || (t = 8);
  4. for (var e = new Array(t), n = [], i = 0; i < 256; i++)
  5. n[i] = i;
  6. for (i = 0; i < e.length; i++)
  7. e[i] = n[Math.floor(Math.random() * n.length)];
  8. return e
  9. }
  10. this.setDefaults = function() {
  11. this.params.nBits = 256,
  12. this.params.salt = t(8),
  13. this.params.salt = pidCryptUtil.byteArray2String(this.params.salt),
  14. this.params.salt = pidCryptUtil.convertToHex(this.params.salt),
  15. this.params.blockSize = 16,
  16. this.params.UTF8 = !0,
  17. this.params.A0_PAD = !0
  18. }
  19. ,
  20. this.debug = !0,
  21. this.params = {},
  22. this.params.dataIn = "",
  23. this.params.dataOut = "",
  24. this.params.decryptIn = "",
  25. this.params.decryptOut = "",
  26. this.params.encryptIn = "",
  27. this.params.encryptOut = "",
  28. this.params.key = "",
  29. this.params.iv = "",
  30. this.params.clear = !0,
  31. this.setDefaults(),
  32. this.errors = "",
  33. this.warnings = "",
  34. this.infos = "",
  35. this.debugMsg = "",
  36. this.setParams = function(t) {
  37. t || (t = {});
  38. for (var e in t)
  39. this.params[e] = t[e]
  40. }
  41. ,
  42. this.getParams = function() {
  43. return this.params
  44. }
  45. ,
  46. this.getParam = function(t) {
  47. return this.params[t] || ""
  48. }
  49. ,
  50. this.clearParams = function() {
  51. this.params = {}
  52. }
  53. ,
  54. this.getNBits = function() {
  55. return this.params.nBits
  56. }
  57. ,
  58. this.getOutput = function() {
  59. return this.params.dataOut
  60. }
  61. ,
  62. this.setError = function(t) {
  63. this.error = t
  64. }
  65. ,
  66. this.appendError = function(t) {
  67. return this.errors += t,
  68. ""
  69. }
  70. ,
  71. this.getErrors = function() {
  72. return this.errors
  73. }
  74. ,
  75. this.isError = function() {
  76. return this.errors.length > 0
  77. }
  78. ,
  79. this.appendInfo = function(t) {
  80. return this.infos += t,
  81. ""
  82. }
  83. ,
  84. this.getInfos = function() {
  85. return this.infos
  86. }
  87. ,
  88. this.setDebug = function(t) {
  89. this.debug = t
  90. }
  91. ,
  92. this.appendDebug = function(t) {
  93. return this.debugMsg += t,
  94. ""
  95. }
  96. ,
  97. this.isDebug = function() {
  98. return this.debug
  99. }
  100. ,
  101. this.getAllMessages = function(t) {
  102. var e = {
  103. lf: "\n",
  104. clr_mes: !1,
  105. verbose: 15
  106. };
  107. t || (t = e);
  108. for (var n in e)
  109. void 0 === t[n] && (t[n] = e[n]);
  110. var i = ""
  111. , r = "";
  112. for (var o in this.params) {
  113. switch (o) {
  114. case "encryptOut":
  115. r = pidCryptUtil.toByteArray(this.params[o].toString()),
  116. r = pidCryptUtil.fragment(r.join(), 64, t.lf);
  117. break;
  118. case "key":
  119. case "iv":
  120. r = pidCryptUtil.formatHex(this.params[o], 48);
  121. break;
  122. default:
  123. r = pidCryptUtil.fragment(this.params[o].toString(), 64, t.lf)
  124. }
  125. i += "<p><b>" + o + "</b>:<pre>" + r + "</pre></p>"
  126. }
  127. return this.debug && (i += "debug: " + this.debug + t.lf),
  128. this.errors.length > 0 && 1 == (1 & t.verbose) && (i += "Errors:" + t.lf + this.errors + t.lf),
  129. this.warnings.length > 0 && 2 == (2 & t.verbose) && (i += "Warnings:" + t.lf + this.warnings + t.lf),
  130. this.infos.length > 0 && 4 == (4 & t.verbose) && (i += "Infos:" + t.lf + this.infos + t.lf),
  131. this.debug && 8 == (8 & t.verbose) && (i += "Debug messages:" + t.lf + this.debugMsg + t.lf),
  132. t.clr_mes && (this.errors = this.infos = this.warnings = this.debug = ""),
  133. i
  134. }
  135. ,
  136. this.getRandomBytes = function(e) {
  137. return t(e)
  138. }
  139. }
  140. function certParser(t) {
  141. var e = t.split("\n")
  142. , n = !1
  143. , i = !1
  144. , r = ""
  145. , o = {};
  146. o.info = "",
  147. o.salt = "",
  148. o.iv,
  149. o.b64 = "",
  150. o.aes = !1,
  151. o.mode = "",
  152. o.bits = 0;
  153. for (var s = 0; s < e.length; s++)
  154. switch (r = e[s].substr(0, 9),
  155. 1 == s && "Proc-Type" != r && 0 == r.indexOf("M") && (i = !0),
  156. r) {
  157. case "-----BEGI":
  158. n = !0;
  159. break;
  160. case "Proc-Type":
  161. n && (o.info = e[s]);
  162. break;
  163. case "DEK-Info:":
  164. if (n) {
  165. var a = e[s].split(",")
  166. , u = a[0].split(": ")[1].split("-");
  167. o.aes = "AES" == u[0],
  168. o.mode = u[2],
  169. o.bits = parseInt(u[1]),
  170. o.salt = a[1].substr(0, 16),
  171. o.iv = a[1]
  172. }
  173. break;
  174. case "":
  175. n && (i = !0);
  176. break;
  177. case "-----END ":
  178. n && (i = !1,
  179. n = !1);
  180. break;
  181. default:
  182. n && i && (o.b64 += pidCryptUtil.stripLineFeeds(e[s]))
  183. }
  184. return o
  185. }
  186. function BigInteger(t, e, n) {
  187. null != t && ("number" == typeof t ? this.fromNumber(t, e, n) : null == e && "string" != typeof t ? this.fromString(t, 256) : this.fromString(t, e))
  188. }
  189. function nbi() {
  190. return new BigInteger(null)
  191. }
  192. function am1(t, e, n, i, r, o) {
  193. for (; --o >= 0; ) {
  194. var s = e * this[t++] + n[i] + r;
  195. r = Math.floor(s / 67108864),
  196. n[i++] = 67108863 & s
  197. }
  198. return r
  199. }
  200. function am2(t, e, n, i, r, o) {
  201. for (var s = 32767 & e, a = e >> 15; --o >= 0; ) {
  202. var u = 32767 & this[t]
  203. , c = this[t++] >> 15
  204. , l = a * u + c * s;
  205. r = ((u = s * u + ((32767 & l) << 15) + n[i] + (1073741823 & r)) >>> 30) + (l >>> 15) + a * c + (r >>> 30),
  206. n[i++] = 1073741823 & u
  207. }
  208. return r
  209. }
  210. function am3(t, e, n, i, r, o) {
  211. for (var s = 16383 & e, a = e >> 14; --o >= 0; ) {
  212. var u = 16383 & this[t]
  213. , c = this[t++] >> 14
  214. , l = a * u + c * s;
  215. r = ((u = s * u + ((16383 & l) << 14) + n[i] + r) >> 28) + (l >> 14) + a * c,
  216. n[i++] = 268435455 & u
  217. }
  218. return r
  219. }
  220. function int2char(t) {
  221. return BI_RM.charAt(t)
  222. }
  223. function intAt(t, e) {
  224. var n = BI_RC[t.charCodeAt(e)];
  225. return null == n ? -1 : n
  226. }
  227. function bnpCopyTo(t) {
  228. for (var e = this.t - 1; e >= 0; --e)
  229. t[e] = this[e];
  230. t.t = this.t,
  231. t.s = this.s
  232. }
  233. function bnpFromInt(t) {
  234. this.t = 1,
  235. this.s = t < 0 ? -1 : 0,
  236. t > 0 ? this[0] = t : t < -1 ? this[0] = t + DV : this.t = 0
  237. }
  238. function nbv(t) {
  239. var e = nbi();
  240. return e.fromInt(t),
  241. e
  242. }
  243. function bnpFromString(t, e) {
  244. var n;
  245. if (16 == e)
  246. n = 4;
  247. else if (8 == e)
  248. n = 3;
  249. else if (256 == e)
  250. n = 8;
  251. else if (2 == e)
  252. n = 1;
  253. else if (32 == e)
  254. n = 5;
  255. else {
  256. if (4 != e)
  257. return void this.fromRadix(t, e);
  258. n = 2
  259. }
  260. this.t = 0,
  261. this.s = 0;
  262. for (var i = t.length, r = !1, o = 0; --i >= 0; ) {
  263. var s = 8 == n ? 255 & t[i] : intAt(t, i);
  264. s < 0 ? "-" == t.charAt(i) && (r = !0) : (r = !1,
  265. 0 == o ? this[this.t++] = s : o + n > this.DB ? (this[this.t - 1] |= (s & (1 << this.DB - o) - 1) << o,
  266. this[this.t++] = s >> this.DB - o) : this[this.t - 1] |= s << o,
  267. (o += n) >= this.DB && (o -= this.DB))
  268. }
  269. 8 == n && 0 != (128 & t[0]) && (this.s = -1,
  270. o > 0 && (this[this.t - 1] |= (1 << this.DB - o) - 1 << o)),
  271. this.clamp(),
  272. r && BigInteger.ZERO.subTo(this, this)
  273. }
  274. function bnpClamp() {
  275. for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; )
  276. --this.t
  277. }
  278. function bnToString(t) {
  279. if (this.s < 0)
  280. return "-" + this.negate().toString(t);
  281. var e;
  282. if (16 == t)
  283. e = 4;
  284. else if (8 == t)
  285. e = 3;
  286. else if (2 == t)
  287. e = 1;
  288. else if (32 == t)
  289. e = 5;
  290. else {
  291. if (4 != t)
  292. return this.toRadix(t);
  293. e = 2
  294. }
  295. var n, i = (1 << e) - 1, r = !1, o = "", s = this.t, a = this.DB - s * this.DB % e;
  296. if (s-- > 0)
  297. for (a < this.DB && (n = this[s] >> a) > 0 && (r = !0,
  298. o = int2char(n)); s >= 0; )
  299. a < e ? (n = (this[s] & (1 << a) - 1) << e - a,
  300. n |= this[--s] >> (a += this.DB - e)) : (n = this[s] >> (a -= e) & i,
  301. a <= 0 && (a += this.DB,
  302. --s)),
  303. n > 0 && (r = !0),
  304. r && (o += int2char(n));
  305. return r ? o : "0"
  306. }
  307. function bnNegate() {
  308. var t = nbi();
  309. return BigInteger.ZERO.subTo(this, t),
  310. t
  311. }
  312. function bnAbs() {
  313. return this.s < 0 ? this.negate() : this
  314. }
  315. function bnCompareTo(t) {
  316. var e = this.s - t.s;
  317. if (0 != e)
  318. return e;
  319. var n = this.t;
  320. if (0 != (e = n - t.t))
  321. return e;
  322. for (; --n >= 0; )
  323. if (0 != (e = this[n] - t[n]))
  324. return e;
  325. return 0
  326. }
  327. function nbits(t) {
  328. var e, n = 1;
  329. return 0 != (e = t >>> 16) && (t = e,
  330. n += 16),
  331. 0 != (e = t >> 8) && (t = e,
  332. n += 8),
  333. 0 != (e = t >> 4) && (t = e,
  334. n += 4),
  335. 0 != (e = t >> 2) && (t = e,
  336. n += 2),
  337. 0 != (e = t >> 1) && (t = e,
  338. n += 1),
  339. n
  340. }
  341. function bnBitLength() {
  342. return this.t <= 0 ? 0 : this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM)
  343. }
  344. function bnpDLShiftTo(t, e) {
  345. var n;
  346. for (n = this.t - 1; n >= 0; --n)
  347. e[n + t] = this[n];
  348. for (n = t - 1; n >= 0; --n)
  349. e[n] = 0;
  350. e.t = this.t + t,
  351. e.s = this.s
  352. }
  353. function bnpDRShiftTo(t, e) {
  354. for (var n = t; n < this.t; ++n)
  355. e[n - t] = this[n];
  356. e.t = Math.max(this.t - t, 0),
  357. e.s = this.s
  358. }
  359. function bnpLShiftTo(t, e) {
  360. 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;
  361. for (n = this.t - 1; n >= 0; --n)
  362. e[n + s + 1] = this[n] >> r | a,
  363. a = (this[n] & o) << i;
  364. for (n = s - 1; n >= 0; --n)
  365. e[n] = 0;
  366. e[s] = a,
  367. e.t = this.t + s + 1,
  368. e.s = this.s,
  369. e.clamp()
  370. }
  371. function bnpRShiftTo(t, e) {
  372. e.s = this.s;
  373. var n = Math.floor(t / this.DB);
  374. if (n >= this.t)
  375. e.t = 0;
  376. else {
  377. var i = t % this.DB
  378. , r = this.DB - i
  379. , o = (1 << i) - 1;
  380. e[0] = this[n] >> i;
  381. for (var s = n + 1; s < this.t; ++s)
  382. e[s - n - 1] |= (this[s] & o) << r,
  383. e[s - n] = this[s] >> i;
  384. i > 0 && (e[this.t - n - 1] |= (this.s & o) << r),
  385. e.t = this.t - n,
  386. e.clamp()
  387. }
  388. }
  389. function bnpSubTo(t, e) {
  390. for (var n = 0, i = 0, r = Math.min(t.t, this.t); n < r; )
  391. i += this[n] - t[n],
  392. e[n++] = i & this.DM,
  393. i >>= this.DB;
  394. if (t.t < this.t) {
  395. for (i -= t.s; n < this.t; )
  396. i += this[n],
  397. e[n++] = i & this.DM,
  398. i >>= this.DB;
  399. i += this.s
  400. } else {
  401. for (i += this.s; n < t.t; )
  402. i -= t[n],
  403. e[n++] = i & this.DM,
  404. i >>= this.DB;
  405. i -= t.s
  406. }
  407. e.s = i < 0 ? -1 : 0,
  408. i < -1 ? e[n++] = this.DV + i : i > 0 && (e[n++] = i),
  409. e.t = n,
  410. e.clamp()
  411. }
  412. function bnpMultiplyTo(t, e) {
  413. var n = this.abs()
  414. , i = t.abs()
  415. , r = n.t;
  416. for (e.t = r + i.t; --r >= 0; )
  417. e[r] = 0;
  418. for (r = 0; r < i.t; ++r)
  419. e[r + n.t] = n.am(0, i[r], e, r, 0, n.t);
  420. e.s = 0,
  421. e.clamp(),
  422. this.s != t.s && BigInteger.ZERO.subTo(e, e)
  423. }
  424. function bnpSquareTo(t) {
  425. for (var e = this.abs(), n = t.t = 2 * e.t; --n >= 0; )
  426. t[n] = 0;
  427. for (n = 0; n < e.t - 1; ++n) {
  428. var i = e.am(n, e[n], t, 2 * n, 0, 1);
  429. (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,
  430. t[n + e.t + 1] = 1)
  431. }
  432. t.t > 0 && (t[t.t - 1] += e.am(n, e[n], t, 2 * n, 0, 1)),
  433. t.s = 0,
  434. t.clamp()
  435. }
  436. function bnpDivRemTo(t, e, n) {
  437. var i = t.abs();
  438. if (!(i.t <= 0)) {
  439. var r = this.abs();
  440. if (r.t < i.t)
  441. return null != e && e.fromInt(0),
  442. void (null != n && this.copyTo(n));
  443. null == n && (n = nbi());
  444. var o = nbi()
  445. , s = this.s
  446. , a = t.s
  447. , u = this.DB - nbits(i[i.t - 1]);
  448. u > 0 ? (i.lShiftTo(u, o),
  449. r.lShiftTo(u, n)) : (i.copyTo(o),
  450. r.copyTo(n));
  451. var c = o.t
  452. , l = o[c - 1];
  453. if (0 != l) {
  454. var p = l * (1 << this.F1) + (c > 1 ? o[c - 2] >> this.F2 : 0)
  455. , h = this.FV / p
  456. , d = (1 << this.F1) / p
  457. , f = 1 << this.F2
  458. , g = n.t
  459. , v = g - c
  460. , m = null == e ? nbi() : e;
  461. for (o.dlShiftTo(v, m),
  462. n.compareTo(m) >= 0 && (n[n.t++] = 1,
  463. n.subTo(m, n)),
  464. BigInteger.ONE.dlShiftTo(c, m),
  465. m.subTo(o, o); o.t < c; )
  466. o[o.t++] = 0;
  467. for (; --v >= 0; ) {
  468. var b = n[--g] == l ? this.DM : Math.floor(n[g] * h + (n[g - 1] + f) * d);
  469. if ((n[g] += o.am(0, b, n, v, 0, c)) < b)
  470. for (o.dlShiftTo(v, m),
  471. n.subTo(m, n); n[g] < --b; )
  472. n.subTo(m, n)
  473. }
  474. null != e && (n.drShiftTo(c, e),
  475. s != a && BigInteger.ZERO.subTo(e, e)),
  476. n.t = c,
  477. n.clamp(),
  478. u > 0 && n.rShiftTo(u, n),
  479. s < 0 && BigInteger.ZERO.subTo(n, n)
  480. }
  481. }
  482. }
  483. function bnMod(t) {
  484. var e = nbi();
  485. return this.abs().divRemTo(t, null, e),
  486. this.s < 0 && e.compareTo(BigInteger.ZERO) > 0 && t.subTo(e, e),
  487. e
  488. }
  489. function Classic(t) {
  490. this.m = t
  491. }
  492. function cConvert(t) {
  493. return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t
  494. }
  495. function cRevert(t) {
  496. return t
  497. }
  498. function cReduce(t) {
  499. t.divRemTo(this.m, null, t)
  500. }
  501. function cMulTo(t, e, n) {
  502. t.multiplyTo(e, n),
  503. this.reduce(n)
  504. }
  505. function cSqrTo(t, e) {
  506. t.squareTo(e),
  507. this.reduce(e)
  508. }
  509. function bnpInvDigit() {
  510. if (this.t < 1)
  511. return 0;
  512. var t = this[0];
  513. if (0 == (1 & t))
  514. return 0;
  515. var e = 3 & t;
  516. return e = e * (2 - (15 & t) * e) & 15,
  517. e = e * (2 - (255 & t) * e) & 255,
  518. e = e * (2 - ((65535 & t) * e & 65535)) & 65535,
  519. (e = e * (2 - t * e % this.DV) % this.DV) > 0 ? this.DV - e : -e
  520. }
  521. function Montgomery(t) {
  522. this.m = t,
  523. this.mp = t.invDigit(),
  524. this.mpl = 32767 & this.mp,
  525. this.mph = this.mp >> 15,
  526. this.um = (1 << t.DB - 15) - 1,
  527. this.mt2 = 2 * t.t
  528. }
  529. function montConvert(t) {
  530. var e = nbi();
  531. return t.abs().dlShiftTo(this.m.t, e),
  532. e.divRemTo(this.m, null, e),
  533. t.s < 0 && e.compareTo(BigInteger.ZERO) > 0 && this.m.subTo(e, e),
  534. e
  535. }
  536. function montRevert(t) {
  537. var e = nbi();
  538. return t.copyTo(e),
  539. this.reduce(e),
  540. e
  541. }
  542. function montReduce(t) {
  543. for (; t.t <= this.mt2; )
  544. t[t.t++] = 0;
  545. for (var e = 0; e < this.m.t; ++e) {
  546. var n = 32767 & t[e]
  547. , i = n * this.mpl + ((n * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM;
  548. for (t[n = e + this.m.t] += this.m.am(0, i, t, e, 0, this.m.t); t[n] >= t.DV; )
  549. t[n] -= t.DV,
  550. t[++n]++
  551. }
  552. t.clamp(),
  553. t.drShiftTo(this.m.t, t),
  554. t.compareTo(this.m) >= 0 && t.subTo(this.m, t)
  555. }
  556. function montSqrTo(t, e) {
  557. t.squareTo(e),
  558. this.reduce(e)
  559. }
  560. function montMulTo(t, e, n) {
  561. t.multiplyTo(e, n),
  562. this.reduce(n)
  563. }
  564. function bnpIsEven() {
  565. return 0 == (this.t > 0 ? 1 & this[0] : this.s)
  566. }
  567. function bnpExp(t, e) {
  568. if (t > 4294967295 || t < 1)
  569. return BigInteger.ONE;
  570. var n = nbi()
  571. , i = nbi()
  572. , r = e.convert(this)
  573. , o = nbits(t) - 1;
  574. for (r.copyTo(n); --o >= 0; )
  575. if (e.sqrTo(n, i),
  576. (t & 1 << o) > 0)
  577. e.mulTo(i, r, n);
  578. else {
  579. var s = n;
  580. n = i,
  581. i = s
  582. }
  583. return e.revert(n)
  584. }
  585. function bnModPowInt(t, e) {
  586. var n;
  587. return n = t < 256 || e.isEven() ? new Classic(e) : new Montgomery(e),
  588. this.exp(t, n)
  589. }
  590. function bnClone() {
  591. var t = nbi();
  592. return this.copyTo(t),
  593. t
  594. }
  595. function bnIntValue() {
  596. if (this.s < 0) {
  597. if (1 == this.t)
  598. return this[0] - this.DV;
  599. if (0 == this.t)
  600. return -1
  601. } else {
  602. if (1 == this.t)
  603. return this[0];
  604. if (0 == this.t)
  605. return 0
  606. }
  607. return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0]
  608. }
  609. function bnByteValue() {
  610. return 0 == this.t ? this.s : this[0] << 24 >> 24
  611. }
  612. function bnShortValue() {
  613. return 0 == this.t ? this.s : this[0] << 16 >> 16
  614. }
  615. function bnpChunkSize(t) {
  616. return Math.floor(Math.LN2 * this.DB / Math.log(t))
  617. }
  618. function bnSigNum() {
  619. return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1
  620. }
  621. function bnpToRadix(t) {
  622. if (null == t && (t = 10),
  623. 0 == this.signum() || t < 2 || t > 36)
  624. return "0";
  625. var e = this.chunkSize(t)
  626. , n = Math.pow(t, e)
  627. , i = nbv(n)
  628. , r = nbi()
  629. , o = nbi()
  630. , s = "";
  631. for (this.divRemTo(i, r, o); r.signum() > 0; )
  632. s = (n + o.intValue()).toString(t).substr(1) + s,
  633. r.divRemTo(i, r, o);
  634. return o.intValue().toString(t) + s
  635. }
  636. function bnpFromRadix(t, e) {
  637. this.fromInt(0),
  638. null == e && (e = 10);
  639. for (var n = this.chunkSize(e), i = Math.pow(e, n), r = !1, o = 0, s = 0, a = 0; a < t.length; ++a) {
  640. var u = intAt(t, a);
  641. u < 0 ? "-" == t.charAt(a) && 0 == this.signum() && (r = !0) : (s = e * s + u,
  642. ++o >= n && (this.dMultiply(i),
  643. this.dAddOffset(s, 0),
  644. o = 0,
  645. s = 0))
  646. }
  647. o > 0 && (this.dMultiply(Math.pow(e, o)),
  648. this.dAddOffset(s, 0)),
  649. r && BigInteger.ZERO.subTo(this, this)
  650. }
  651. function bnpFromNumber(t, e, n) {
  652. if ("number" == typeof e)
  653. if (t < 2)
  654. this.fromInt(1);
  655. else
  656. for (this.fromNumber(t, n),
  657. this.testBit(t - 1) || this.bitwiseTo(BigInteger.ONE.shiftLeft(t - 1), op_or, this),
  658. this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e); )
  659. this.dAddOffset(2, 0),
  660. this.bitLength() > t && this.subTo(BigInteger.ONE.shiftLeft(t - 1), this);
  661. else {
  662. var i = new Array
  663. , r = 7 & t;
  664. i.length = 1 + (t >> 3),
  665. e.nextBytes(i),
  666. r > 0 ? i[0] &= (1 << r) - 1 : i[0] = 0,
  667. this.fromString(i, 256)
  668. }
  669. }
  670. function bnToByteArray() {
  671. var t = this.t
  672. , e = new Array;
  673. e[0] = this.s;
  674. var n, i = this.DB - t * this.DB % 8, r = 0;
  675. if (t-- > 0)
  676. for (i < this.DB && (n = this[t] >> i) != (this.s & this.DM) >> i && (e[r++] = n | this.s << this.DB - i); t >= 0; )
  677. i < 8 ? (n = (this[t] & (1 << i) - 1) << 8 - i,
  678. n |= this[--t] >> (i += this.DB - 8)) : (n = this[t] >> (i -= 8) & 255,
  679. i <= 0 && (i += this.DB,
  680. --t)),
  681. 0 != (128 & n) && (n |= -256),
  682. 0 == r && (128 & this.s) != (128 & n) && ++r,
  683. (r > 0 || n != this.s) && (e[r++] = n);
  684. return e
  685. }
  686. function bnEquals(t) {
  687. return 0 == this.compareTo(t)
  688. }
  689. function bnMin(t) {
  690. return this.compareTo(t) < 0 ? this : t
  691. }
  692. function bnMax(t) {
  693. return this.compareTo(t) > 0 ? this : t
  694. }
  695. function bnpBitwiseTo(t, e, n) {
  696. var i, r, o = Math.min(t.t, this.t);
  697. for (i = 0; i < o; ++i)
  698. n[i] = e(this[i], t[i]);
  699. if (t.t < this.t) {
  700. for (r = t.s & this.DM,
  701. i = o; i < this.t; ++i)
  702. n[i] = e(this[i], r);
  703. n.t = this.t
  704. } else {
  705. for (r = this.s & this.DM,
  706. i = o; i < t.t; ++i)
  707. n[i] = e(r, t[i]);
  708. n.t = t.t
  709. }
  710. n.s = e(this.s, t.s),
  711. n.clamp()
  712. }
  713. function op_and(t, e) {
  714. return t & e
  715. }
  716. function bnAnd(t) {
  717. var e = nbi();
  718. return this.bitwiseTo(t, op_and, e),
  719. e
  720. }
  721. function op_or(t, e) {
  722. return t | e
  723. }
  724. function bnOr(t) {
  725. var e = nbi();
  726. return this.bitwiseTo(t, op_or, e),
  727. e
  728. }
  729. function op_xor(t, e) {
  730. return t ^ e
  731. }
  732. function bnXor(t) {
  733. var e = nbi();
  734. return this.bitwiseTo(t, op_xor, e),
  735. e
  736. }
  737. function op_andnot(t, e) {
  738. return t & ~e
  739. }
  740. function bnAndNot(t) {
  741. var e = nbi();
  742. return this.bitwiseTo(t, op_andnot, e),
  743. e
  744. }
  745. function bnNot() {
  746. for (var t = nbi(), e = 0; e < this.t; ++e)
  747. t[e] = this.DM & ~this[e];
  748. return t.t = this.t,
  749. t.s = ~this.s,
  750. t
  751. }
  752. function bnShiftLeft(t) {
  753. var e = nbi();
  754. return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e),
  755. e
  756. }
  757. function bnShiftRight(t) {
  758. var e = nbi();
  759. return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e),
  760. e
  761. }
  762. function lbit(t) {
  763. if (0 == t)
  764. return -1;
  765. var e = 0;
  766. return 0 == (65535 & t) && (t >>= 16,
  767. e += 16),
  768. 0 == (255 & t) && (t >>= 8,
  769. e += 8),
  770. 0 == (15 & t) && (t >>= 4,
  771. e += 4),
  772. 0 == (3 & t) && (t >>= 2,
  773. e += 2),
  774. 0 == (1 & t) && ++e,
  775. e
  776. }
  777. function bnGetLowestSetBit() {
  778. for (var t = 0; t < this.t; ++t)
  779. if (0 != this[t])
  780. return t * this.DB + lbit(this[t]);
  781. return this.s < 0 ? this.t * this.DB : -1
  782. }
  783. function cbit(t) {
  784. for (var e = 0; 0 != t; )
  785. t &= t - 1,
  786. ++e;
  787. return e
  788. }
  789. function bnBitCount() {
  790. for (var t = 0, e = this.s & this.DM, n = 0; n < this.t; ++n)
  791. t += cbit(this[n] ^ e);
  792. return t
  793. }
  794. function bnTestBit(t) {
  795. var e = Math.floor(t / this.DB);
  796. return e >= this.t ? 0 != this.s : 0 != (this[e] & 1 << t % this.DB)
  797. }
  798. function bnpChangeBit(t, e) {
  799. var n = BigInteger.ONE.shiftLeft(t);
  800. return this.bitwiseTo(n, e, n),
  801. n
  802. }
  803. function bnSetBit(t) {
  804. return this.changeBit(t, op_or)
  805. }
  806. function bnClearBit(t) {
  807. return this.changeBit(t, op_andnot)
  808. }
  809. function bnFlipBit(t) {
  810. return this.changeBit(t, op_xor)
  811. }
  812. function bnpAddTo(t, e) {
  813. for (var n = 0, i = 0, r = Math.min(t.t, this.t); n < r; )
  814. i += this[n] + t[n],
  815. e[n++] = i & this.DM,
  816. i >>= this.DB;
  817. if (t.t < this.t) {
  818. for (i += t.s; n < this.t; )
  819. i += this[n],
  820. e[n++] = i & this.DM,
  821. i >>= this.DB;
  822. i += this.s
  823. } else {
  824. for (i += this.s; n < t.t; )
  825. i += t[n],
  826. e[n++] = i & this.DM,
  827. i >>= this.DB;
  828. i += t.s
  829. }
  830. e.s = i < 0 ? -1 : 0,
  831. i > 0 ? e[n++] = i : i < -1 && (e[n++] = this.DV + i),
  832. e.t = n,
  833. e.clamp()
  834. }
  835. function bnAdd(t) {
  836. var e = nbi();
  837. return this.addTo(t, e),
  838. e
  839. }
  840. function bnSubtract(t) {
  841. var e = nbi();
  842. return this.subTo(t, e),
  843. e
  844. }
  845. function bnMultiply(t) {
  846. var e = nbi();
  847. return this.multiplyTo(t, e),
  848. e
  849. }
  850. function bnDivide(t) {
  851. var e = nbi();
  852. return this.divRemTo(t, e, null),
  853. e
  854. }
  855. function bnRemainder(t) {
  856. var e = nbi();
  857. return this.divRemTo(t, null, e),
  858. e
  859. }
  860. function bnDivideAndRemainder(t) {
  861. var e = nbi()
  862. , n = nbi();
  863. return this.divRemTo(t, e, n),
  864. new Array(e,n)
  865. }
  866. function bnpDMultiply(t) {
  867. this[this.t] = this.am(0, t - 1, this, 0, 0, this.t),
  868. ++this.t,
  869. this.clamp()
  870. }
  871. function bnpDAddOffset(t, e) {
  872. for (; this.t <= e; )
  873. this[this.t++] = 0;
  874. for (this[e] += t; this[e] >= this.DV; )
  875. this[e] -= this.DV,
  876. ++e >= this.t && (this[this.t++] = 0),
  877. ++this[e]
  878. }
  879. function NullExp() {}
  880. function nNop(t) {
  881. return t
  882. }
  883. function nMulTo(t, e, n) {
  884. t.multiplyTo(e, n)
  885. }
  886. function nSqrTo(t, e) {
  887. t.squareTo(e)
  888. }
  889. function bnPow(t) {
  890. return this.exp(t, new NullExp)
  891. }
  892. function bnpMultiplyLowerTo(t, e, n) {
  893. var i = Math.min(this.t + t.t, e);
  894. for (n.s = 0,
  895. n.t = i; i > 0; )
  896. n[--i] = 0;
  897. var r;
  898. for (r = n.t - this.t; i < r; ++i)
  899. n[i + this.t] = this.am(0, t[i], n, i, 0, this.t);
  900. for (r = Math.min(t.t, e); i < r; ++i)
  901. this.am(0, t[i], n, i, 0, e - i);
  902. n.clamp()
  903. }
  904. function bnpMultiplyUpperTo(t, e, n) {
  905. --e;
  906. var i = n.t = this.t + t.t - e;
  907. for (n.s = 0; --i >= 0; )
  908. n[i] = 0;
  909. for (i = Math.max(e - this.t, 0); i < t.t; ++i)
  910. n[this.t + i - e] = this.am(e - i, t[i], n, 0, 0, this.t + i - e);
  911. n.clamp(),
  912. n.drShiftTo(1, n)
  913. }
  914. function Barrett(t) {
  915. this.r2 = nbi(),
  916. this.q3 = nbi(),
  917. BigInteger.ONE.dlShiftTo(2 * t.t, this.r2),
  918. this.mu = this.r2.divide(t),
  919. this.m = t
  920. }
  921. function barrettConvert(t) {
  922. if (t.s < 0 || t.t > 2 * this.m.t)
  923. return t.mod(this.m);
  924. if (t.compareTo(this.m) < 0)
  925. return t;
  926. var e = nbi();
  927. return t.copyTo(e),
  928. this.reduce(e),
  929. e
  930. }
  931. function barrettRevert(t) {
  932. return t
  933. }
  934. function barrettReduce(t) {
  935. for (t.drShiftTo(this.m.t - 1, this.r2),
  936. t.t > this.m.t + 1 && (t.t = this.m.t + 1,
  937. t.clamp()),
  938. this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3),
  939. this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0; )
  940. t.dAddOffset(1, this.m.t + 1);
  941. for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0; )
  942. t.subTo(this.m, t)
  943. }
  944. function barrettSqrTo(t, e) {
  945. t.squareTo(e),
  946. this.reduce(e)
  947. }
  948. function barrettMulTo(t, e, n) {
  949. t.multiplyTo(e, n),
  950. this.reduce(n)
  951. }
  952. function bnModPow(t, e) {
  953. var n, i, r = t.bitLength(), o = nbv(1);
  954. if (r <= 0)
  955. return o;
  956. n = r < 18 ? 1 : r < 48 ? 3 : r < 144 ? 4 : r < 768 ? 5 : 6,
  957. i = r < 8 ? new Classic(e) : e.isEven() ? new Barrett(e) : new Montgomery(e);
  958. var s = new Array
  959. , a = 3
  960. , u = n - 1
  961. , c = (1 << n) - 1;
  962. if (s[1] = i.convert(this),
  963. n > 1) {
  964. var l = nbi();
  965. for (i.sqrTo(s[1], l); a <= c; )
  966. s[a] = nbi(),
  967. i.mulTo(l, s[a - 2], s[a]),
  968. a += 2
  969. }
  970. var p, h, d = t.t - 1, f = !0, g = nbi();
  971. for (r = nbits(t[d]) - 1; d >= 0; ) {
  972. for (r >= u ? p = t[d] >> r - u & c : (p = (t[d] & (1 << r + 1) - 1) << u - r,
  973. d > 0 && (p |= t[d - 1] >> this.DB + r - u)),
  974. a = n; 0 == (1 & p); )
  975. p >>= 1,
  976. --a;
  977. if ((r -= a) < 0 && (r += this.DB,
  978. --d),
  979. f)
  980. s[p].copyTo(o),
  981. f = !1;
  982. else {
  983. for (; a > 1; )
  984. i.sqrTo(o, g),
  985. i.sqrTo(g, o),
  986. a -= 2;
  987. a > 0 ? i.sqrTo(o, g) : (h = o,
  988. o = g,
  989. g = h),
  990. i.mulTo(g, s[p], o)
  991. }
  992. for (; d >= 0 && 0 == (t[d] & 1 << r); )
  993. i.sqrTo(o, g),
  994. h = o,
  995. o = g,
  996. g = h,
  997. --r < 0 && (r = this.DB - 1,
  998. --d)
  999. }
  1000. return i.revert(o)
  1001. }
  1002. function bnGCD(t) {
  1003. var e = this.s < 0 ? this.negate() : this.clone()
  1004. , n = t.s < 0 ? t.negate() : t.clone();
  1005. if (e.compareTo(n) < 0) {
  1006. var i = e;
  1007. e = n,
  1008. n = i
  1009. }
  1010. var r = e.getLowestSetBit()
  1011. , o = n.getLowestSetBit();
  1012. if (o < 0)
  1013. return e;
  1014. for (r < o && (o = r),
  1015. o > 0 && (e.rShiftTo(o, e),
  1016. n.rShiftTo(o, n)); e.signum() > 0; )
  1017. (r = e.getLowestSetBit()) > 0 && e.rShiftTo(r, e),
  1018. (r = n.getLowestSetBit()) > 0 && n.rShiftTo(r, n),
  1019. e.compareTo(n) >= 0 ? (e.subTo(n, e),
  1020. e.rShiftTo(1, e)) : (n.subTo(e, n),
  1021. n.rShiftTo(1, n));
  1022. return o > 0 && n.lShiftTo(o, n),
  1023. n
  1024. }
  1025. function bnpModInt(t) {
  1026. if (t <= 0)
  1027. return 0;
  1028. var e = this.DV % t
  1029. , n = this.s < 0 ? t - 1 : 0;
  1030. if (this.t > 0)
  1031. if (0 == e)
  1032. n = this[0] % t;
  1033. else
  1034. for (var i = this.t - 1; i >= 0; --i)
  1035. n = (e * n + this[i]) % t;
  1036. return n
  1037. }
  1038. function bnModInverse(t) {
  1039. var e = t.isEven();
  1040. if (this.isEven() && e || 0 == t.signum())
  1041. return BigInteger.ZERO;
  1042. for (var n = t.clone(), i = this.clone(), r = nbv(1), o = nbv(0), s = nbv(0), a = nbv(1); 0 != n.signum(); ) {
  1043. for (; n.isEven(); )
  1044. n.rShiftTo(1, n),
  1045. e ? (r.isEven() && o.isEven() || (r.addTo(this, r),
  1046. o.subTo(t, o)),
  1047. r.rShiftTo(1, r)) : o.isEven() || o.subTo(t, o),
  1048. o.rShiftTo(1, o);
  1049. for (; i.isEven(); )
  1050. i.rShiftTo(1, i),
  1051. e ? (s.isEven() && a.isEven() || (s.addTo(this, s),
  1052. a.subTo(t, a)),
  1053. s.rShiftTo(1, s)) : a.isEven() || a.subTo(t, a),
  1054. a.rShiftTo(1, a);
  1055. n.compareTo(i) >= 0 ? (n.subTo(i, n),
  1056. e && r.subTo(s, r),
  1057. o.subTo(a, o)) : (i.subTo(n, i),
  1058. e && s.subTo(r, s),
  1059. a.subTo(o, a))
  1060. }
  1061. return 0 != i.compareTo(BigInteger.ONE) ? BigInteger.ZERO : a.compareTo(t) >= 0 ? a.subtract(t) : a.signum() < 0 ? (a.addTo(t, a),
  1062. a.signum() < 0 ? a.add(t) : a) : a
  1063. }
  1064. function bnIsProbablePrime(t) {
  1065. var e, n = this.abs();
  1066. if (1 == n.t && n[0] <= lowprimes[lowprimes.length - 1]) {
  1067. for (e = 0; e < lowprimes.length; ++e)
  1068. if (n[0] == lowprimes[e])
  1069. return !0;
  1070. return !1
  1071. }
  1072. if (n.isEven())
  1073. return !1;
  1074. for (e = 1; e < lowprimes.length; ) {
  1075. for (var i = lowprimes[e], r = e + 1; r < lowprimes.length && i < lplim; )
  1076. i *= lowprimes[r++];
  1077. for (i = n.modInt(i); e < r; )
  1078. if (i % lowprimes[e++] == 0)
  1079. return !1
  1080. }
  1081. return n.millerRabin(t)
  1082. }
  1083. function bnpMillerRabin(t) {
  1084. var e = this.subtract(BigInteger.ONE)
  1085. , n = e.getLowestSetBit();
  1086. if (n <= 0)
  1087. return !1;
  1088. var i = e.shiftRight(n);
  1089. (t = t + 1 >> 1) > lowprimes.length && (t = lowprimes.length);
  1090. for (var r = nbi(), o = 0; o < t; ++o) {
  1091. r.fromInt(lowprimes[o]);
  1092. var s = r.modPow(i, this);
  1093. if (0 != s.compareTo(BigInteger.ONE) && 0 != s.compareTo(e)) {
  1094. for (var a = 1; a++ < n && 0 != s.compareTo(e); )
  1095. if (0 == (s = s.modPowInt(2, this)).compareTo(BigInteger.ONE))
  1096. return !1;
  1097. if (0 != s.compareTo(e))
  1098. return !1
  1099. }
  1100. }
  1101. return !0
  1102. }
  1103. function Stream(t, e) {
  1104. t instanceof Stream ? (this.enc = t.enc,
  1105. this.pos = t.pos) : (this.enc = t,
  1106. this.pos = e)
  1107. }
  1108. function Arcfour() {
  1109. this.i = 0,
  1110. this.j = 0,
  1111. this.S = new Array
  1112. }
  1113. function ARC4init(t) {
  1114. var e, n, i;
  1115. for (e = 0; e < 256; ++e)
  1116. this.S[e] = e;
  1117. for (n = 0,
  1118. e = 0; e < 256; ++e)
  1119. n = n + this.S[e] + t[e % t.length] & 255,
  1120. i = this.S[e],
  1121. this.S[e] = this.S[n],
  1122. this.S[n] = i;
  1123. this.i = 0,
  1124. this.j = 0
  1125. }
  1126. function ARC4next() {
  1127. var t;
  1128. return this.i = this.i + 1 & 255,
  1129. this.j = this.j + this.S[this.i] & 255,
  1130. t = this.S[this.i],
  1131. this.S[this.i] = this.S[this.j],
  1132. this.S[this.j] = t,
  1133. this.S[t + this.S[this.i] & 255]
  1134. }
  1135. function prng_newstate() {
  1136. return new Arcfour
  1137. }
  1138. function SecureRandom() {
  1139. if (this.rng_state,
  1140. this.rng_pool,
  1141. this.rng_pptr,
  1142. this.rng_seed_int = function(t) {
  1143. this.rng_pool[this.rng_pptr++] ^= 255 & t,
  1144. this.rng_pool[this.rng_pptr++] ^= t >> 8 & 255,
  1145. this.rng_pool[this.rng_pptr++] ^= t >> 16 & 255,
  1146. this.rng_pool[this.rng_pptr++] ^= t >> 24 & 255,
  1147. this.rng_pptr >= rng_psize && (this.rng_pptr -= rng_psize)
  1148. }
  1149. ,
  1150. this.rng_seed_time = function() {
  1151. this.rng_seed_int((new Date).getTime())
  1152. }
  1153. ,
  1154. null == this.rng_pool) {
  1155. this.rng_pool = new Array,
  1156. this.rng_pptr = 0;
  1157. var t;
  1158. if ("Netscape" == navigator.appName && navigator.appVersion < "5" && window.crypto) {
  1159. var e = window.crypto.random(32);
  1160. for (t = 0; t < e.length; ++t)
  1161. this.rng_pool[this.rng_pptr++] = 255 & e.charCodeAt(t)
  1162. }
  1163. for (; this.rng_pptr < rng_psize; )
  1164. t = Math.floor(65536 * Math.random()),
  1165. this.rng_pool[this.rng_pptr++] = t >>> 8,
  1166. this.rng_pool[this.rng_pptr++] = 255 & t;
  1167. this.rng_pptr = 0,
  1168. this.rng_seed_time()
  1169. }
  1170. this.rng_get_byte = function() {
  1171. if (null == this.rng_state) {
  1172. for (this.rng_seed_time(),
  1173. this.rng_state = prng_newstate(),
  1174. this.rng_state.init(this.rng_pool),
  1175. this.rng_pptr = 0; this.rng_pptr < this.rng_pool.length; ++this.rng_pptr)
  1176. this.rng_pool[this.rng_pptr] = 0;
  1177. this.rng_pptr = 0
  1178. }
  1179. return this.rng_state.next()
  1180. }
  1181. ,
  1182. this.nextBytes = function(t) {
  1183. var e;
  1184. for (e = 0; e < t.length; ++e)
  1185. t[e] = this.rng_get_byte()
  1186. }
  1187. }
  1188. function parseBigInt(t, e) {
  1189. return new BigInteger(t,e)
  1190. }
  1191. function linebrk(t, e) {
  1192. for (var n = "", i = 0; i + e < t.length; )
  1193. n += t.substring(i, i + e) + "\n",
  1194. i += e;
  1195. return n + t.substring(i, t.length)
  1196. }
  1197. function byte2Hex(t) {
  1198. return t < 16 ? "0" + t.toString(16) : t.toString(16)
  1199. }
  1200. function pkcs1unpad2(t, e) {
  1201. for (var n = t.toByteArray(), i = 0; i < n.length && 0 == n[i]; )
  1202. ++i;
  1203. if (n.length - i != e - 1 || 2 != n[i])
  1204. return null;
  1205. for (++i; 0 != n[i]; )
  1206. if (++i >= n.length)
  1207. return null;
  1208. for (var r = ""; ++i < n.length; )
  1209. r += String.fromCharCode(n[i]);
  1210. return r
  1211. }
  1212. function pkcs1pad2(t, e) {
  1213. if (e < t.length + 11)
  1214. return alert("Message too long for RSA"),
  1215. null;
  1216. for (var n = new Array, i = t.length - 1; i >= 0 && e > 0; )
  1217. n[--e] = t.charCodeAt(i--);
  1218. n[--e] = 0;
  1219. for (var r = new SecureRandom, o = new Array; e > 2; ) {
  1220. for (o[0] = 0; 0 == o[0]; )
  1221. r.nextBytes(o);
  1222. n[--e] = o[0]
  1223. }
  1224. return n[--e] = 2,
  1225. n[--e] = 0,
  1226. new BigInteger(n)
  1227. }
  1228. pidCryptUtil = {},
  1229. pidCryptUtil.encodeBase64 = function(t, e) {
  1230. t || (t = "");
  1231. var n, i, r, o, s, a, u, c, l = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", p = [], h = "";
  1232. if (u = (e = void 0 !== e && e) ? pidCryptUtil.encodeUTF8(t) : t,
  1233. (a = u.length % 3) > 0)
  1234. for (; a++ < 3; )
  1235. h += "=",
  1236. u += "\0";
  1237. for (a = 0; a < u.length; a += 3)
  1238. i = (n = u.charCodeAt(a) << 16 | u.charCodeAt(a + 1) << 8 | u.charCodeAt(a + 2)) >> 18 & 63,
  1239. r = n >> 12 & 63,
  1240. o = n >> 6 & 63,
  1241. s = 63 & n,
  1242. p[a / 3] = l.charAt(i) + l.charAt(r) + l.charAt(o) + l.charAt(s);
  1243. return c = p.join(""),
  1244. c = c.slice(0, c.length - h.length) + h
  1245. }
  1246. ,
  1247. pidCryptUtil.decodeBase64 = function(t, e) {
  1248. t || (t = "");
  1249. var n, i, r, o, s, a, u, c, l = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", p = [];
  1250. c = (e = void 0 !== e && e) ? pidCryptUtil.decodeUTF8(t) : t;
  1251. for (var h = 0; h < c.length; h += 4)
  1252. 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,
  1253. i = a >>> 8 & 255,
  1254. r = 255 & a,
  1255. p[h / 4] = String.fromCharCode(n, i, r),
  1256. 64 == s && (p[h / 4] = String.fromCharCode(n, i)),
  1257. 64 == o && (p[h / 4] = String.fromCharCode(n));
  1258. return u = p.join(""),
  1259. u = e ? pidCryptUtil.decodeUTF8(u) : u
  1260. }
  1261. ,
  1262. pidCryptUtil.encodeUTF8 = function(t) {
  1263. return t || (t = ""),
  1264. t = t.replace(/[\u0080-\u07ff]/g, function(t) {
  1265. var e = t.charCodeAt(0);
  1266. return String.fromCharCode(192 | e >> 6, 128 | 63 & e)
  1267. }),
  1268. t = t.replace(/[\u0800-\uffff]/g, function(t) {
  1269. var e = t.charCodeAt(0);
  1270. return String.fromCharCode(224 | e >> 12, 128 | e >> 6 & 63, 128 | 63 & e)
  1271. })
  1272. }
  1273. ,
  1274. pidCryptUtil.decodeUTF8 = function(t) {
  1275. return t || (t = ""),
  1276. t = t.replace(/[\u00c0-\u00df][\u0080-\u00bf]/g, function(t) {
  1277. var e = (31 & t.charCodeAt(0)) << 6 | 63 & t.charCodeAt(1);
  1278. return String.fromCharCode(e)
  1279. }),
  1280. t = t.replace(/[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, function(t) {
  1281. var e = (15 & t.charCodeAt(0)) << 12 | (63 & t.charCodeAt(1)) << 6 | 63 & t.charCodeAt(2);
  1282. return String.fromCharCode(e)
  1283. })
  1284. }
  1285. ,
  1286. pidCryptUtil.convertToHex = function(t) {
  1287. t || (t = "");
  1288. for (var e = "", n = "", i = 0; i < t.length; i++)
  1289. e += 1 == (n = t.charCodeAt(i).toString(16)).length ? "0" + n : n;
  1290. return e
  1291. }
  1292. ,
  1293. pidCryptUtil.convertFromHex = function(t) {
  1294. t || (t = "");
  1295. for (var e = "", n = 0; n < t.length; n += 2)
  1296. e += String.fromCharCode(parseInt(t.substring(n, n + 2), 16));
  1297. return e
  1298. }
  1299. ,
  1300. pidCryptUtil.stripLineFeeds = function(t) {
  1301. t || (t = "");
  1302. var e = "";
  1303. return e = t.replace(/\n/g, ""),
  1304. e = e.replace(/\r/g, "")
  1305. }
  1306. ,
  1307. pidCryptUtil.toByteArray = function(t) {
  1308. t || (t = "");
  1309. for (var e = [], n = 0; n < t.length; n++)
  1310. e[n] = t.charCodeAt(n);
  1311. return e
  1312. }
  1313. ,
  1314. pidCryptUtil.fragment = function(t, e, n) {
  1315. if (t || (t = ""),
  1316. !e || e >= t.length)
  1317. return t;
  1318. n || (n = "\n");
  1319. for (var i = "", r = 0; r < t.length; r += e)
  1320. i += t.substr(r, e) + n;
  1321. return i
  1322. }
  1323. ,
  1324. pidCryptUtil.formatHex = function(t, e) {
  1325. t || (t = ""),
  1326. e || (e = 45);
  1327. for (var n = "", i = t.toLowerCase(), r = 0; r < i.length; r += 2)
  1328. n += i.substr(r, 2) + ":";
  1329. return i = this.fragment(n, e)
  1330. }
  1331. ,
  1332. pidCryptUtil.byteArray2String = function(t) {
  1333. for (var e = "", n = 0; n < t.length; n++)
  1334. e += String.fromCharCode(t[n]);
  1335. return e
  1336. }
  1337. ;
  1338. var dbits, canary = 0xdeadbeefcafe, j_lm = 15715070 == (16777215 & canary);
  1339. j_lm && "Microsoft Internet Explorer" == navigator.appName ? (BigInteger.prototype.am = am2,
  1340. dbits = 30) : j_lm && "Netscape" != navigator.appName ? (BigInteger.prototype.am = am1,
  1341. dbits = 26) : (BigInteger.prototype.am = am3,
  1342. dbits = 28),
  1343. BigInteger.prototype.DB = dbits,
  1344. BigInteger.prototype.DM = (1 << dbits) - 1,
  1345. BigInteger.prototype.DV = 1 << dbits;
  1346. var BI_FP = 52;
  1347. BigInteger.prototype.FV = Math.pow(2, BI_FP),
  1348. BigInteger.prototype.F1 = BI_FP - dbits,
  1349. BigInteger.prototype.F2 = 2 * dbits - BI_FP;
  1350. var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz", BI_RC = new Array, rr, vv;
  1351. for (rr = "0".charCodeAt(0),
  1352. vv = 0; vv <= 9; ++vv)
  1353. BI_RC[rr++] = vv;
  1354. for (rr = "a".charCodeAt(0),
  1355. vv = 10; vv < 36; ++vv)
  1356. BI_RC[rr++] = vv;
  1357. for (rr = "A".charCodeAt(0),
  1358. vv = 10; vv < 36; ++vv)
  1359. BI_RC[rr++] = vv;
  1360. Classic.prototype.convert = cConvert,
  1361. Classic.prototype.revert = cRevert,
  1362. Classic.prototype.reduce = cReduce,
  1363. Classic.prototype.mulTo = cMulTo,
  1364. Classic.prototype.sqrTo = cSqrTo,
  1365. Montgomery.prototype.convert = montConvert,
  1366. Montgomery.prototype.revert = montRevert,
  1367. Montgomery.prototype.reduce = montReduce,
  1368. Montgomery.prototype.mulTo = montMulTo,
  1369. Montgomery.prototype.sqrTo = montSqrTo,
  1370. BigInteger.prototype.copyTo = bnpCopyTo,
  1371. BigInteger.prototype.fromInt = bnpFromInt,
  1372. BigInteger.prototype.fromString = bnpFromString,
  1373. BigInteger.prototype.clamp = bnpClamp,
  1374. BigInteger.prototype.dlShiftTo = bnpDLShiftTo,
  1375. BigInteger.prototype.drShiftTo = bnpDRShiftTo,
  1376. BigInteger.prototype.lShiftTo = bnpLShiftTo,
  1377. BigInteger.prototype.rShiftTo = bnpRShiftTo,
  1378. BigInteger.prototype.subTo = bnpSubTo,
  1379. BigInteger.prototype.multiplyTo = bnpMultiplyTo,
  1380. BigInteger.prototype.squareTo = bnpSquareTo,
  1381. BigInteger.prototype.divRemTo = bnpDivRemTo,
  1382. BigInteger.prototype.invDigit = bnpInvDigit,
  1383. BigInteger.prototype.isEven = bnpIsEven,
  1384. BigInteger.prototype.exp = bnpExp,
  1385. BigInteger.prototype.toString = bnToString,
  1386. BigInteger.prototype.negate = bnNegate,
  1387. BigInteger.prototype.abs = bnAbs,
  1388. BigInteger.prototype.compareTo = bnCompareTo,
  1389. BigInteger.prototype.bitLength = bnBitLength,
  1390. BigInteger.prototype.mod = bnMod,
  1391. BigInteger.prototype.modPowInt = bnModPowInt,
  1392. BigInteger.ZERO = nbv(0),
  1393. BigInteger.ONE = nbv(1),
  1394. NullExp.prototype.convert = nNop,
  1395. NullExp.prototype.revert = nNop,
  1396. NullExp.prototype.mulTo = nMulTo,
  1397. NullExp.prototype.sqrTo = nSqrTo,
  1398. Barrett.prototype.convert = barrettConvert,
  1399. Barrett.prototype.revert = barrettRevert,
  1400. Barrett.prototype.reduce = barrettReduce,
  1401. Barrett.prototype.mulTo = barrettMulTo,
  1402. Barrett.prototype.sqrTo = barrettSqrTo;
  1403. 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]
  1404. , lplim = (1 << 26) / lowprimes[lowprimes.length - 1];
  1405. BigInteger.prototype.chunkSize = bnpChunkSize,
  1406. BigInteger.prototype.toRadix = bnpToRadix,
  1407. BigInteger.prototype.fromRadix = bnpFromRadix,
  1408. BigInteger.prototype.fromNumber = bnpFromNumber,
  1409. BigInteger.prototype.bitwiseTo = bnpBitwiseTo,
  1410. BigInteger.prototype.changeBit = bnpChangeBit,
  1411. BigInteger.prototype.addTo = bnpAddTo,
  1412. BigInteger.prototype.dMultiply = bnpDMultiply,
  1413. BigInteger.prototype.dAddOffset = bnpDAddOffset,
  1414. BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo,
  1415. BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo,
  1416. BigInteger.prototype.modInt = bnpModInt,
  1417. BigInteger.prototype.millerRabin = bnpMillerRabin,
  1418. BigInteger.prototype.clone = bnClone,
  1419. BigInteger.prototype.intValue = bnIntValue,
  1420. BigInteger.prototype.byteValue = bnByteValue,
  1421. BigInteger.prototype.shortValue = bnShortValue,
  1422. BigInteger.prototype.signum = bnSigNum,
  1423. BigInteger.prototype.toByteArray = bnToByteArray,
  1424. BigInteger.prototype.equals = bnEquals,
  1425. BigInteger.prototype.min = bnMin,
  1426. BigInteger.prototype.max = bnMax,
  1427. BigInteger.prototype.and = bnAnd,
  1428. BigInteger.prototype.or = bnOr,
  1429. BigInteger.prototype.xor = bnXor,
  1430. BigInteger.prototype.andNot = bnAndNot,
  1431. BigInteger.prototype.not = bnNot,
  1432. BigInteger.prototype.shiftLeft = bnShiftLeft,
  1433. BigInteger.prototype.shiftRight = bnShiftRight,
  1434. BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit,
  1435. BigInteger.prototype.bitCount = bnBitCount,
  1436. BigInteger.prototype.testBit = bnTestBit,
  1437. BigInteger.prototype.setBit = bnSetBit,
  1438. BigInteger.prototype.clearBit = bnClearBit,
  1439. BigInteger.prototype.flipBit = bnFlipBit,
  1440. BigInteger.prototype.add = bnAdd,
  1441. BigInteger.prototype.subtract = bnSubtract,
  1442. BigInteger.prototype.multiply = bnMultiply,
  1443. BigInteger.prototype.divide = bnDivide,
  1444. BigInteger.prototype.remainder = bnRemainder,
  1445. BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder,
  1446. BigInteger.prototype.modPow = bnModPow,
  1447. BigInteger.prototype.modInverse = bnModInverse,
  1448. BigInteger.prototype.pow = bnPow,
  1449. BigInteger.prototype.gcd = bnGCD,
  1450. BigInteger.prototype.isProbablePrime = bnIsProbablePrime,
  1451. Stream.prototype.parseStringHex = function(t, e) {
  1452. void 0 === e && (e = this.enc.length);
  1453. for (var n = "", i = t; i < e; ++i) {
  1454. var r = this.get(i);
  1455. n += this.hexDigits.charAt(r >> 4) + this.hexDigits.charAt(15 & r)
  1456. }
  1457. return n
  1458. }
  1459. ,
  1460. Stream.prototype.get = function(t) {
  1461. if (void 0 == t && (t = this.pos++),
  1462. t >= this.enc.length)
  1463. throw "Requesting byte offset " + t + " on a stream of length " + this.enc.length;
  1464. return this.enc[t]
  1465. }
  1466. ,
  1467. Stream.prototype.hexDigits = "0123456789ABCDEF",
  1468. Stream.prototype.hexDump = function(t, e) {
  1469. for (var n = "", i = t; i < e; ++i) {
  1470. var r = this.get(i);
  1471. n += this.hexDigits.charAt(r >> 4) + this.hexDigits.charAt(15 & r),
  1472. 7 == (15 & i) && (n += " "),
  1473. n += 15 == (15 & i) ? "\n" : " "
  1474. }
  1475. return n
  1476. }
  1477. ,
  1478. Stream.prototype.parseStringISO = function(t, e) {
  1479. for (var n = "", i = t; i < e; ++i)
  1480. n += String.fromCharCode(this.get(i));
  1481. return n
  1482. }
  1483. ,
  1484. Stream.prototype.parseStringUTF = function(t, e) {
  1485. for (var n = "", i = 0, r = t; r < e; )
  1486. 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++));
  1487. return n
  1488. }
  1489. ,
  1490. 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)?)?$/,
  1491. Stream.prototype.parseTime = function(t, e) {
  1492. var n = this.parseStringISO(t, e)
  1493. , i = this.reTime.exec(n);
  1494. return i ? (n = i[1] + "-" + i[2] + "-" + i[3] + " " + i[4],
  1495. i[5] && (n += ":" + i[5],
  1496. i[6] && (n += ":" + i[6],
  1497. i[7] && (n += "." + i[7]))),
  1498. i[8] && (n += " UTC",
  1499. "Z" != i[8] && (n += i[8],
  1500. i[9] && (n += ":" + i[9]))),
  1501. n) : "Unrecognized time: " + n
  1502. }
  1503. ,
  1504. Stream.prototype.parseInteger = function(t, e) {
  1505. if (!(e - t > 4)) {
  1506. for (var n = 0, i = t; i < e; ++i)
  1507. n = n << 8 | this.get(i);
  1508. return n
  1509. }
  1510. }
  1511. ,
  1512. Stream.prototype.parseOID = function(t, e) {
  1513. for (var n, i = 0, r = 0, o = t; o < e; ++o) {
  1514. var s = this.get(o);
  1515. i = i << 7 | 127 & s,
  1516. r += 7,
  1517. 128 & s || (void 0 == n ? n = parseInt(i / 40) + "." + i % 40 : n += "." + (r >= 31 ? "big" : i),
  1518. i = r = 0),
  1519. n += String.fromCharCode()
  1520. }
  1521. return n
  1522. }
  1523. ,
  1524. void 0 !== pidCrypt && (pidCrypt.ASN1 = function(t, e, n, i, r) {
  1525. this.stream = t,
  1526. this.header = e,
  1527. this.length = n,
  1528. this.tag = i,
  1529. this.sub = r
  1530. }
  1531. ,
  1532. pidCrypt.ASN1.prototype.toHexTree = function() {
  1533. var t = {};
  1534. if (t.type = this.typeName(),
  1535. "SEQUENCE" != t.type && (t.value = this.stream.parseStringHex(this.posContent(), this.posEnd())),
  1536. null != this.sub) {
  1537. t.sub = [];
  1538. for (var e = 0, n = this.sub.length; e < n; ++e)
  1539. t.sub[e] = this.sub[e].toHexTree()
  1540. }
  1541. return t
  1542. }
  1543. ,
  1544. pidCrypt.ASN1.prototype.typeName = function() {
  1545. if (void 0 == this.tag)
  1546. return "unknown";
  1547. var t = this.tag >> 6
  1548. , e = (this.tag,
  1549. 31 & this.tag);
  1550. switch (t) {
  1551. case 0:
  1552. switch (e) {
  1553. case 0:
  1554. return "EOC";
  1555. case 1:
  1556. return "BOOLEAN";
  1557. case 2:
  1558. return "INTEGER";
  1559. case 3:
  1560. return "BIT_STRING";
  1561. case 4:
  1562. return "OCTET_STRING";
  1563. case 5:
  1564. return "NULL";
  1565. case 6:
  1566. return "OBJECT_IDENTIFIER";
  1567. case 7:
  1568. return "ObjectDescriptor";
  1569. case 8:
  1570. return "EXTERNAL";
  1571. case 9:
  1572. return "REAL";
  1573. case 10:
  1574. return "ENUMERATED";
  1575. case 11:
  1576. return "EMBEDDED_PDV";
  1577. case 12:
  1578. return "UTF8String";
  1579. case 16:
  1580. return "SEQUENCE";
  1581. case 17:
  1582. return "SET";
  1583. case 18:
  1584. return "NumericString";
  1585. case 19:
  1586. return "PrintableString";
  1587. case 20:
  1588. return "TeletexString";
  1589. case 21:
  1590. return "VideotexString";
  1591. case 22:
  1592. return "IA5String";
  1593. case 23:
  1594. return "UTCTime";
  1595. case 24:
  1596. return "GeneralizedTime";
  1597. case 25:
  1598. return "GraphicString";
  1599. case 26:
  1600. return "VisibleString";
  1601. case 27:
  1602. return "GeneralString";
  1603. case 28:
  1604. return "UniversalString";
  1605. case 30:
  1606. return "BMPString";
  1607. default:
  1608. return "Universal_" + e.toString(16)
  1609. }
  1610. case 1:
  1611. return "Application_" + e.toString(16);
  1612. case 2:
  1613. return "[" + e + "]";
  1614. case 3:
  1615. return "Private_" + e.toString(16)
  1616. }
  1617. }
  1618. ,
  1619. pidCrypt.ASN1.prototype.content = function() {
  1620. if (void 0 == this.tag)
  1621. return null;
  1622. if (0 != this.tag >> 6)
  1623. return null;
  1624. var t = 31 & this.tag
  1625. , e = this.posContent()
  1626. , n = Math.abs(this.length);
  1627. switch (t) {
  1628. case 1:
  1629. return 0 == this.stream.get(e) ? "false" : "true";
  1630. case 2:
  1631. return this.stream.parseInteger(e, e + n);
  1632. case 6:
  1633. return this.stream.parseOID(e, e + n);
  1634. case 12:
  1635. return this.stream.parseStringUTF(e, e + n);
  1636. case 18:
  1637. case 19:
  1638. case 20:
  1639. case 21:
  1640. case 22:
  1641. case 26:
  1642. return this.stream.parseStringISO(e, e + n);
  1643. case 23:
  1644. case 24:
  1645. return this.stream.parseTime(e, e + n)
  1646. }
  1647. return null
  1648. }
  1649. ,
  1650. pidCrypt.ASN1.prototype.toString = function() {
  1651. return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null == this.sub ? "null" : this.sub.length) + "]"
  1652. }
  1653. ,
  1654. pidCrypt.ASN1.prototype.print = function(t) {
  1655. if (void 0 == t && (t = ""),
  1656. document.writeln(t + this),
  1657. null != this.sub) {
  1658. t += " ";
  1659. for (var e = 0, n = this.sub.length; e < n; ++e)
  1660. this.sub[e].print(t)
  1661. }
  1662. }
  1663. ,
  1664. pidCrypt.ASN1.prototype.toPrettyString = function(t) {
  1665. void 0 == t && (t = "");
  1666. var e = t + this.typeName() + " @" + this.stream.pos;
  1667. if (this.length >= 0 && (e += "+"),
  1668. e += this.length,
  1669. 32 & this.tag ? e += " (constructed)" : 3 != this.tag && 4 != this.tag || null == this.sub || (e += " (encapsulates)"),
  1670. e += "\n",
  1671. null != this.sub) {
  1672. t += " ";
  1673. for (var n = 0, i = this.sub.length; n < i; ++n)
  1674. e += this.sub[n].toPrettyString(t)
  1675. }
  1676. return e
  1677. }
  1678. ,
  1679. pidCrypt.ASN1.prototype.toDOM = function() {
  1680. var t = document.createElement("div");
  1681. t.className = "node",
  1682. t.asn1 = this;
  1683. var e = document.createElement("div");
  1684. e.className = "head";
  1685. var n = this.typeName();
  1686. e.innerHTML = n,
  1687. t.appendChild(e),
  1688. this.head = e;
  1689. var i = document.createElement("div");
  1690. i.className = "value",
  1691. n = "Offset: " + this.stream.pos + "<br/>",
  1692. n += "Length: " + this.header + "+",
  1693. this.length >= 0 ? n += this.length : n += -this.length + " (undefined)",
  1694. 32 & this.tag ? n += "<br/>(constructed)" : 3 != this.tag && 4 != this.tag || null == this.sub || (n += "<br/>(encapsulates)");
  1695. var r = this.content();
  1696. if (null != r && (n += "<br/>Value:<br/><b>" + r + "</b>",
  1697. "object" == typeof oids && 6 == this.tag)) {
  1698. var o = oids[r];
  1699. o && (o.d && (n += "<br/>" + o.d),
  1700. o.c && (n += "<br/>" + o.c),
  1701. o.w && (n += "<br/>(warning!)"))
  1702. }
  1703. i.innerHTML = n,
  1704. t.appendChild(i);
  1705. var s = document.createElement("div");
  1706. if (s.className = "sub",
  1707. null != this.sub)
  1708. for (var a = 0, u = this.sub.length; a < u; ++a)
  1709. s.appendChild(this.sub[a].toDOM());
  1710. return t.appendChild(s),
  1711. e.switchNode = t,
  1712. e.onclick = function() {
  1713. var t = this.switchNode;
  1714. t.className = "node collapsed" == t.className ? "node" : "node collapsed"
  1715. }
  1716. ,
  1717. t
  1718. }
  1719. ,
  1720. pidCrypt.ASN1.prototype.posStart = function() {
  1721. return this.stream.pos
  1722. }
  1723. ,
  1724. pidCrypt.ASN1.prototype.posContent = function() {
  1725. return this.stream.pos + this.header
  1726. }
  1727. ,
  1728. pidCrypt.ASN1.prototype.posEnd = function() {
  1729. return this.stream.pos + this.header + Math.abs(this.length)
  1730. }
  1731. ,
  1732. pidCrypt.ASN1.prototype.toHexDOM_sub = function(t, e, n, i, r) {
  1733. if (!(i >= r)) {
  1734. var o = document.createElement("span");
  1735. o.className = e,
  1736. o.appendChild(document.createTextNode(n.hexDump(i, r))),
  1737. t.appendChild(o)
  1738. }
  1739. }
  1740. ,
  1741. pidCrypt.ASN1.prototype.toHexDOM = function() {
  1742. var t = document.createElement("span");
  1743. if (t.className = "hex",
  1744. this.head.hexNode = t,
  1745. this.head.onmouseover = function() {
  1746. this.hexNode.className = "hexCurrent"
  1747. }
  1748. ,
  1749. this.head.onmouseout = function() {
  1750. this.hexNode.className = "hex"
  1751. }
  1752. ,
  1753. this.toHexDOM_sub(t, "tag", this.stream, this.posStart(), this.posStart() + 1),
  1754. this.toHexDOM_sub(t, this.length >= 0 ? "dlen" : "ulen", this.stream, this.posStart() + 1, this.posContent()),
  1755. null == this.sub)
  1756. t.appendChild(document.createTextNode(this.stream.hexDump(this.posContent(), this.posEnd())));
  1757. else if (this.sub.length > 0) {
  1758. var e = this.sub[0]
  1759. , n = this.sub[this.sub.length - 1];
  1760. this.toHexDOM_sub(t, "intro", this.stream, this.posContent(), e.posStart());
  1761. for (var i = 0, r = this.sub.length; i < r; ++i)
  1762. t.appendChild(this.sub[i].toHexDOM());
  1763. this.toHexDOM_sub(t, "outro", this.stream, n.posEnd(), this.posEnd())
  1764. }
  1765. return t
  1766. }
  1767. ,
  1768. pidCrypt.ASN1.decodeLength = function(t) {
  1769. var e = t.get()
  1770. , n = 127 & e;
  1771. if (n == e)
  1772. return n;
  1773. if (n > 3)
  1774. throw "Length over 24 bits not supported at position " + (t.pos - 1);
  1775. if (0 == n)
  1776. return -1;
  1777. e = 0;
  1778. for (var i = 0; i < n; ++i)
  1779. e = e << 8 | t.get();
  1780. return e
  1781. }
  1782. ,
  1783. pidCrypt.ASN1.hasContent = function(t, e, n) {
  1784. if (32 & t)
  1785. return !0;
  1786. if (t < 3 || t > 4)
  1787. return !1;
  1788. var i = new Stream(n);
  1789. if (3 == t && i.get(),
  1790. i.get() >> 6 & 1)
  1791. return !1;
  1792. try {
  1793. var r = pidCrypt.ASN1.decodeLength(i);
  1794. return i.pos - n.pos + r == e
  1795. } catch (t) {
  1796. return !1
  1797. }
  1798. }
  1799. ,
  1800. pidCrypt.ASN1.decode = function(t) {
  1801. t instanceof Stream || (t = new Stream(t,0));
  1802. var e = new Stream(t)
  1803. , n = t.get()
  1804. , i = pidCrypt.ASN1.decodeLength(t)
  1805. , r = t.pos - e.pos
  1806. , o = null;
  1807. if (pidCrypt.ASN1.hasContent(n, i, t)) {
  1808. var s = t.pos;
  1809. if (3 == n && t.get(),
  1810. o = [],
  1811. i >= 0) {
  1812. for (var a = s + i; t.pos < a; )
  1813. o[o.length] = pidCrypt.ASN1.decode(t);
  1814. if (t.pos != a)
  1815. throw "Content size is not correct for container starting at offset " + s
  1816. } else
  1817. try {
  1818. for (; ; ) {
  1819. var u = pidCrypt.ASN1.decode(t);
  1820. if (0 == u.tag)
  1821. break;
  1822. o[o.length] = u
  1823. }
  1824. i = s - t.pos
  1825. } catch (t) {
  1826. throw "Exception while decoding undefined length content: " + t
  1827. }
  1828. } else
  1829. t.pos += i;
  1830. return new pidCrypt.ASN1(e,r,i,n,o)
  1831. }
  1832. ,
  1833. pidCrypt.ASN1.test = function() {
  1834. for (var t = [{
  1835. value: [39],
  1836. expected: 39
  1837. }, {
  1838. value: [129, 201],
  1839. expected: 201
  1840. }, {
  1841. value: [131, 254, 220, 186],
  1842. expected: 16702650
  1843. }], e = 0, n = t.length; e < n; ++e) {
  1844. var i = new Stream(t[e].value,0)
  1845. , r = pidCrypt.ASN1.decodeLength(i);
  1846. r != t[e].expected && document.write("In test[" + e + "] expected " + t[e].expected + " got " + r + "\n")
  1847. }
  1848. }
  1849. ),
  1850. Arcfour.prototype.init = ARC4init,
  1851. Arcfour.prototype.next = ARC4next;
  1852. var rng_psize = 256;
  1853. void 0 !== pidCrypt && void 0 !== BigInteger && void 0 !== SecureRandom && void 0 !== Arcfour && (pidCrypt.RSA = function() {
  1854. this.n = null,
  1855. this.e = 0,
  1856. this.d = null,
  1857. this.p = null,
  1858. this.q = null,
  1859. this.dmp1 = null,
  1860. this.dmq1 = null,
  1861. this.coeff = null
  1862. }
  1863. ,
  1864. pidCrypt.RSA.prototype.doPrivate = function(t) {
  1865. if (null == this.p || null == this.q)
  1866. return t.modPow(this.d, this.n);
  1867. 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; )
  1868. e = e.add(this.p);
  1869. return e.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)
  1870. }
  1871. ,
  1872. pidCrypt.RSA.prototype.setPublic = function(t, e, n) {
  1873. void 0 === n && (n = 16),
  1874. null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = parseBigInt(t, n),
  1875. this.e = parseInt(e, n)) : alert("Invalid RSA public key")
  1876. }
  1877. ,
  1878. pidCrypt.RSA.prototype.doPublic = function(t) {
  1879. return t.modPowInt(this.e, this.n)
  1880. }
  1881. ,
  1882. pidCrypt.RSA.prototype.encryptRaw = function(t) {
  1883. var e = pkcs1pad2(t, this.n.bitLength() + 7 >> 3);
  1884. if (null == e)
  1885. return null;
  1886. var n = this.doPublic(e);
  1887. if (null == n)
  1888. return null;
  1889. var i = n.toString(16);
  1890. return 0 == (1 & i.length) ? i : "0" + i
  1891. }
  1892. ,
  1893. pidCrypt.RSA.prototype.encrypt = function(t) {
  1894. return t = pidCryptUtil.encodeBase64(t),
  1895. this.encryptRaw(t)
  1896. }
  1897. ,
  1898. pidCrypt.RSA.prototype.decryptRaw = function(t) {
  1899. var e = parseBigInt(t, 16)
  1900. , n = this.doPrivate(e);
  1901. return null == n ? null : pkcs1unpad2(n, this.n.bitLength() + 7 >> 3)
  1902. }
  1903. ,
  1904. pidCrypt.RSA.prototype.decrypt = function(t) {
  1905. var e = this.decryptRaw(t);
  1906. return e = e ? pidCryptUtil.decodeBase64(e) : ""
  1907. }
  1908. ,
  1909. pidCrypt.RSA.prototype.setPrivate = function(t, e, n, i) {
  1910. void 0 === i && (i = 16),
  1911. null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = parseBigInt(t, i),
  1912. this.e = parseInt(e, i),
  1913. this.d = parseBigInt(n, i)) : alert("Invalid RSA private key")
  1914. }
  1915. ,
  1916. pidCrypt.RSA.prototype.setPrivateEx = function(t, e, n, i, r, o, s, a, u) {
  1917. void 0 === u && (u = 16),
  1918. null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = parseBigInt(t, u),
  1919. this.e = parseInt(e, u),
  1920. this.d = parseBigInt(n, u),
  1921. this.p = parseBigInt(i, u),
  1922. this.q = parseBigInt(r, u),
  1923. this.dmp1 = parseBigInt(o, u),
  1924. this.dmq1 = parseBigInt(s, u),
  1925. this.coeff = parseBigInt(a, u)) : alert("Invalid RSA private key")
  1926. }
  1927. ,
  1928. pidCrypt.RSA.prototype.generate = function(t, e) {
  1929. var n = new SecureRandom
  1930. , i = t >> 1;
  1931. this.e = parseInt(e, 16);
  1932. for (var r = new BigInteger(e,16); ; ) {
  1933. for (; this.p = new BigInteger(t - i,1,n),
  1934. 0 != this.p.subtract(BigInteger.ONE).gcd(r).compareTo(BigInteger.ONE) || !this.p.isProbablePrime(10); )
  1935. ;
  1936. for (; this.q = new BigInteger(i,1,n),
  1937. 0 != this.q.subtract(BigInteger.ONE).gcd(r).compareTo(BigInteger.ONE) || !this.q.isProbablePrime(10); )
  1938. ;
  1939. if (this.p.compareTo(this.q) <= 0) {
  1940. var o = this.p;
  1941. this.p = this.q,
  1942. this.q = o
  1943. }
  1944. var s = this.p.subtract(BigInteger.ONE)
  1945. , a = this.q.subtract(BigInteger.ONE)
  1946. , u = s.multiply(a);
  1947. if (0 == u.gcd(r).compareTo(BigInteger.ONE)) {
  1948. this.n = this.p.multiply(this.q),
  1949. this.d = r.modInverse(u),
  1950. this.dmp1 = this.d.mod(s),
  1951. this.dmq1 = this.d.mod(a),
  1952. this.coeff = this.q.modInverse(this.p);
  1953. break
  1954. }
  1955. }
  1956. }
  1957. ,
  1958. pidCrypt.RSA.prototype.getASNData = function(t) {
  1959. var e = []
  1960. , n = 0;
  1961. if (t.value && "INTEGER" == t.type && (e[n++] = t.value),
  1962. t.sub)
  1963. for (var i = 0; i < t.sub.length; i++)
  1964. e = e.concat(this.getASNData(t.sub[i]));
  1965. return e
  1966. }
  1967. ,
  1968. pidCrypt.RSA.prototype.setKeyFromASN = function(t, e) {
  1969. var n = ["N", "E", "D", "P", "Q", "DP", "DQ", "C"]
  1970. , i = {}
  1971. , r = this.getASNData(e);
  1972. switch (t) {
  1973. case "Public":
  1974. case "public":
  1975. for (o = 0; o < r.length; o++)
  1976. i[n[o]] = r[o].toLowerCase();
  1977. this.setPublic(i.N, i.E, 16);
  1978. break;
  1979. case "Private":
  1980. case "private":
  1981. for (var o = 1; o < r.length; o++)
  1982. i[n[o - 1]] = r[o].toLowerCase();
  1983. this.setPrivateEx(i.N, i.E, i.D, i.P, i.Q, i.DP, i.DQ, i.C, 16)
  1984. }
  1985. }
  1986. ,
  1987. pidCrypt.RSA.prototype.setPublicKeyFromASN = function(t) {
  1988. this.setKeyFromASN("public", t)
  1989. }
  1990. ,
  1991. pidCrypt.RSA.prototype.setPrivateKeyFromASN = function(t) {
  1992. this.setKeyFromASN("private", t)
  1993. }
  1994. ,
  1995. pidCrypt.RSA.prototype.getParameters = function() {
  1996. var t = {};
  1997. return null != this.n && (t.n = this.n),
  1998. t.e = this.e,
  1999. null != this.d && (t.d = this.d),
  2000. null != this.p && (t.p = this.p),
  2001. null != this.q && (t.q = this.q),
  2002. null != this.dmp1 && (t.dmp1 = this.dmp1),
  2003. null != this.dmq1 && (t.dmq1 = this.dmq1),
  2004. null != this.coeff && (t.c = this.coeff),
  2005. t
  2006. }
  2007. ),
  2008. define("jquery", [], function() {
  2009. return window.jQuery
  2010. }),
  2011. define("can/util/can", [], function() {
  2012. var t = "undefined" != typeof window ? window : "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope ? self : global
  2013. , e = {};
  2014. "undefined" != typeof GLOBALCAN && !1 === GLOBALCAN || (t.can = e),
  2015. e.global = t,
  2016. e.k = function() {}
  2017. ,
  2018. e.isDeferred = e.isPromise = function(t) {
  2019. return t && "function" == typeof t.then && "function" == typeof t.pipe
  2020. }
  2021. ,
  2022. e.isMapLike = function(t) {
  2023. return e.Map && (t instanceof e.Map || t && t.___get)
  2024. }
  2025. ;
  2026. var n = 0;
  2027. e.cid = function(t, e) {
  2028. return t._cid || (n++,
  2029. t._cid = (e || "") + n),
  2030. t._cid
  2031. }
  2032. ,
  2033. e.VERSION = "2.3.7",
  2034. e.simpleExtend = function(t, e) {
  2035. for (var n in e)
  2036. t[n] = e[n];
  2037. return t
  2038. }
  2039. ,
  2040. e.last = function(t) {
  2041. return t && t[t.length - 1]
  2042. }
  2043. ,
  2044. e.isDOM = function(t) {
  2045. return (t.ownerDocument || t) === e.global.document
  2046. }
  2047. ,
  2048. e.childNodes = function(t) {
  2049. var e = t.childNodes;
  2050. if ("length"in e)
  2051. return e;
  2052. for (var n = t.firstChild, i = []; n; )
  2053. i.push(n),
  2054. n = n.nextSibling;
  2055. return i
  2056. }
  2057. ;
  2058. var i = Function.prototype.bind;
  2059. e.proxy = i ? function(t, e) {
  2060. return i.call(t, e)
  2061. }
  2062. : function(t, e) {
  2063. return function() {
  2064. return t.apply(e, arguments)
  2065. }
  2066. }
  2067. ,
  2068. e.frag = function(t, n) {
  2069. var i, r = n || e.document || e.global.document;
  2070. return t && "string" != typeof t ? 11 === t.nodeType ? t : "number" == typeof t.nodeType ? ((i = r.createDocumentFragment()).appendChild(t),
  2071. i) : "number" == typeof t.length ? (i = r.createDocumentFragment(),
  2072. e.each(t, function(t) {
  2073. i.appendChild(e.frag(t))
  2074. }),
  2075. i) : (i = e.buildFragment("" + t, r),
  2076. e.childNodes(i).length || i.appendChild(r.createTextNode("")),
  2077. i) : ((i = e.buildFragment(null == t ? "" : "" + t, r)).childNodes.length || i.appendChild(r.createTextNode("")),
  2078. i)
  2079. }
  2080. ,
  2081. e.scope = e.viewModel = function(t, n, i) {
  2082. t = e.$(t);
  2083. var r = e.data(t, "scope") || e.data(t, "viewModel");
  2084. switch (r || (r = new e.Map,
  2085. e.data(t, "scope", r),
  2086. e.data(t, "viewModel", r)),
  2087. arguments.length) {
  2088. case 0:
  2089. case 1:
  2090. return r;
  2091. case 2:
  2092. return r.attr(n);
  2093. default:
  2094. return r.attr(n, i),
  2095. t
  2096. }
  2097. }
  2098. ;
  2099. var r = function(t) {
  2100. var e = String(t).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
  2101. return e ? {
  2102. href: e[0] || "",
  2103. protocol: e[1] || "",
  2104. authority: e[2] || "",
  2105. host: e[3] || "",
  2106. hostname: e[4] || "",
  2107. port: e[5] || "",
  2108. pathname: e[6] || "",
  2109. search: e[7] || "",
  2110. hash: e[8] || ""
  2111. } : null
  2112. };
  2113. return e.joinURIs = function(t, e) {
  2114. return e = r(e || ""),
  2115. t = r(t || ""),
  2116. e && t ? (e.protocol || t.protocol) + (e.protocol || e.authority ? e.authority : t.authority) + function(t) {
  2117. var e = [];
  2118. return t.replace(/^(\.\.?(\/|$))+/, "").replace(/\/(\.(\/|$))+/g, "/").replace(/\/\.\.$/, "/../").replace(/\/?[^\/]*/g, function(t) {
  2119. "/.." === t ? e.pop() : e.push(t)
  2120. }),
  2121. e.join("").replace(/^\//, "/" === t.charAt(0) ? "/" : "")
  2122. }(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
  2123. }
  2124. ,
  2125. e.import = function(t, n) {
  2126. var i = new e.Deferred;
  2127. return "object" == typeof window.System && e.isFunction(window.System.import) ? window.System.import(t, {
  2128. name: n
  2129. }).then(e.proxy(i.resolve, i), e.proxy(i.reject, i)) : window.define && window.define.amd ? window.require([t], function(t) {
  2130. i.resolve(t)
  2131. }) : window.steal ? steal.steal(t, function(t) {
  2132. i.resolve(t)
  2133. }) : window.require ? i.resolve(window.require(t)) : i.resolve(),
  2134. i.promise()
  2135. }
  2136. ,
  2137. e.__observe = function() {}
  2138. ,
  2139. e.isNode = "object" == typeof process && "[object process]" === {}.toString.call(process),
  2140. e.isBrowserWindow = "undefined" != typeof window && "undefined" != typeof document && "undefined" == typeof SimpleDOM,
  2141. e.isWebWorker = "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope,
  2142. e
  2143. }),
  2144. define("can/util/attr", ["can/util/can"], function(t) {
  2145. var e = t.global.setImmediate || function(t) {
  2146. return setTimeout(t, 0)
  2147. }
  2148. , n = {
  2149. input: !0,
  2150. textarea: !0,
  2151. select: !0
  2152. }
  2153. , i = function(e, i) {
  2154. return i in e || t.document && n[e.nodeName.toLowerCase()]
  2155. }
  2156. , r = {
  2157. MutationObserver: t.global.MutationObserver || t.global.WebKitMutationObserver || t.global.MozMutationObserver,
  2158. map: {
  2159. class: function(t, e) {
  2160. return e = e || "",
  2161. "http://www.w3.org/2000/svg" === t.namespaceURI ? t.setAttribute("class", e) : t.className = e,
  2162. e
  2163. },
  2164. value: "value",
  2165. innertext: "innerText",
  2166. innerhtml: "innerHTML",
  2167. textcontent: "textContent",
  2168. for: "htmlFor",
  2169. checked: !0,
  2170. disabled: !0,
  2171. readonly: function(t, e) {
  2172. return t.readOnly = !0,
  2173. e
  2174. },
  2175. required: !0,
  2176. src: function(t, e) {
  2177. return null == e || "" === e ? (t.removeAttribute("src"),
  2178. null) : (t.setAttribute("src", e),
  2179. e)
  2180. },
  2181. style: function() {
  2182. var e = t.global.document && document.createElement("div");
  2183. return e && e.style && "cssText"in e.style ? function(t, e) {
  2184. return t.style.cssText = e || ""
  2185. }
  2186. : function(t, e) {
  2187. return t.setAttribute("style", e)
  2188. }
  2189. }()
  2190. },
  2191. defaultValue: ["input", "textarea"],
  2192. setAttrOrProp: function(t, e, n) {
  2193. e = e.toLowerCase(),
  2194. !0 !== r.map[e] || n ? this.set(t, e, n) : this.remove(t, e)
  2195. },
  2196. set: function(e, n, o) {
  2197. var s = t.isDOM(e) && r.MutationObserver;
  2198. n = n.toLowerCase();
  2199. var a;
  2200. s || (a = r.get(e, n));
  2201. var u, c = r.map[n];
  2202. "function" == typeof c ? u = c(e, o) : !0 === c && i(e, n) ? (u = e[n] = !0,
  2203. "checked" === n && "radio" === e.type && t.inArray((e.nodeName + "").toLowerCase(), r.defaultValue) >= 0 && (e.defaultChecked = !0)) : "string" == typeof c && i(e, c) ? (u = o,
  2204. e[c] === o && "OPTION" !== e.nodeName.toUpperCase() || (e[c] = o),
  2205. "value" === c && t.inArray((e.nodeName + "").toLowerCase(), r.defaultValue) >= 0 && (e.defaultValue = o)) : r.setAttribute(e, n, o),
  2206. s || u === a || r.trigger(e, n, a)
  2207. },
  2208. setAttribute: function() {
  2209. var e = t.global.document;
  2210. if (e && document.createAttribute)
  2211. try {
  2212. e.createAttribute("{}")
  2213. } catch (t) {
  2214. var n = {}
  2215. , i = document.createElement("div");
  2216. return function(t, e, r) {
  2217. var o, s, a = e.charAt(0);
  2218. "{" !== a && "(" !== a && "*" !== a || !t.setAttributeNode ? t.setAttribute(e, r) : ((o = n[e]) || (i.innerHTML = "<div " + e + '=""></div>',
  2219. o = n[e] = i.childNodes[0].attributes[0]),
  2220. s = o.cloneNode(),
  2221. s.value = r,
  2222. t.setAttributeNode(s))
  2223. }
  2224. }
  2225. return function(t, e, n) {
  2226. t.setAttribute(e, n)
  2227. }
  2228. }(),
  2229. trigger: function(n, i, r) {
  2230. if (t.data(t.$(n), "canHasAttributesBindings"))
  2231. return i = i.toLowerCase(),
  2232. e(function() {
  2233. t.trigger(n, {
  2234. type: "attributes",
  2235. attributeName: i,
  2236. target: n,
  2237. oldValue: r,
  2238. bubbles: !1
  2239. }, [])
  2240. })
  2241. },
  2242. get: function(t, e) {
  2243. e = e.toLowerCase();
  2244. var n = r.map[e];
  2245. return "string" == typeof n && i(t, n) ? t[n] : !0 === n && i(t, e) ? t[e] : t.getAttribute(e)
  2246. },
  2247. remove: function(t, e) {
  2248. e = e.toLowerCase();
  2249. var n;
  2250. r.MutationObserver || (n = r.get(t, e));
  2251. var o = r.map[e];
  2252. "function" == typeof o && o(t, void 0),
  2253. !0 === o && i(t, e) ? t[e] = !1 : "string" == typeof o && i(t, o) ? t[o] = "" : t.removeAttribute(e),
  2254. r.MutationObserver || null == n || r.trigger(t, e, n)
  2255. },
  2256. has: function() {
  2257. var e = t.global.document && document.createElement("div");
  2258. return e && e.hasAttribute ? function(t, e) {
  2259. return t.hasAttribute(e)
  2260. }
  2261. : function(t, e) {
  2262. return null !== t.getAttribute(e)
  2263. }
  2264. }()
  2265. };
  2266. return r
  2267. }),
  2268. define("can/event", ["can/util/can"], function(t) {
  2269. return t.addEvent = function(t, e) {
  2270. var n = this.__bindEvents || (this.__bindEvents = {});
  2271. return (n[t] || (n[t] = [])).push({
  2272. handler: e,
  2273. name: t
  2274. }),
  2275. this
  2276. }
  2277. ,
  2278. t.listenTo = function(e, n, i) {
  2279. var r = this.__listenToEvents;
  2280. r || (r = this.__listenToEvents = {});
  2281. var o = t.cid(e)
  2282. , s = r[o];
  2283. s || (s = r[o] = {
  2284. obj: e,
  2285. events: {}
  2286. });
  2287. var a = s.events[n];
  2288. a || (a = s.events[n] = []),
  2289. a.push(i),
  2290. t.bind.call(e, n, i)
  2291. }
  2292. ,
  2293. t.stopListening = function(e, n, i) {
  2294. var r = this.__listenToEvents
  2295. , o = r
  2296. , s = 0;
  2297. if (!r)
  2298. return this;
  2299. if (e) {
  2300. var a = t.cid(e);
  2301. if ((o = {})[a] = r[a],
  2302. !r[a])
  2303. return this
  2304. }
  2305. for (var u in o) {
  2306. var c, l = o[u];
  2307. e = r[u].obj,
  2308. n ? (c = {})[n] = l.events[n] : c = l.events;
  2309. for (var p in c) {
  2310. var h = c[p] || [];
  2311. for (s = 0; s < h.length; )
  2312. i && i === h[s] || !i ? (t.unbind.call(e, p, h[s]),
  2313. h.splice(s, 1)) : s++;
  2314. h.length || delete l.events[p]
  2315. }
  2316. t.isEmptyObject(l.events) && delete r[u]
  2317. }
  2318. return this
  2319. }
  2320. ,
  2321. t.removeEvent = function(t, e, n) {
  2322. if (!this.__bindEvents)
  2323. return this;
  2324. for (var i, r = this.__bindEvents[t] || [], o = 0, s = "function" == typeof e; o < r.length; )
  2325. i = r[o],
  2326. (n ? n(i, t, e) : s && i.handler === e || !s && (i.cid === e || !e)) ? r.splice(o, 1) : o++;
  2327. return this
  2328. }
  2329. ,
  2330. t.dispatch = function(t, e) {
  2331. var n = this.__bindEvents;
  2332. if (n) {
  2333. var i;
  2334. "string" == typeof t ? (i = t,
  2335. t = {
  2336. type: t
  2337. }) : i = t.type;
  2338. var r = n[i];
  2339. if (r) {
  2340. r = r.slice(0);
  2341. var o = [t];
  2342. e && o.push.apply(o, e);
  2343. for (var s = 0, a = r.length; s < a; s++)
  2344. r[s].handler.apply(this, o);
  2345. return t
  2346. }
  2347. }
  2348. }
  2349. ,
  2350. t.one = function(e, n) {
  2351. var i = function() {
  2352. return t.unbind.call(this, e, i),
  2353. n.apply(this, arguments)
  2354. };
  2355. return t.bind.call(this, e, i),
  2356. this
  2357. }
  2358. ,
  2359. t.event = {
  2360. on: function() {
  2361. return 0 === arguments.length && t.Control && this instanceof t.Control ? t.Control.prototype.on.call(this) : t.addEvent.apply(this, arguments)
  2362. },
  2363. off: function() {
  2364. return 0 === arguments.length && t.Control && this instanceof t.Control ? t.Control.prototype.off.call(this) : t.removeEvent.apply(this, arguments)
  2365. },
  2366. bind: t.addEvent,
  2367. unbind: t.removeEvent,
  2368. delegate: function(e, n, i) {
  2369. return t.addEvent.call(this, n, i)
  2370. },
  2371. undelegate: function(e, n, i) {
  2372. return t.removeEvent.call(this, n, i)
  2373. },
  2374. trigger: t.dispatch,
  2375. one: t.one,
  2376. addEvent: t.addEvent,
  2377. removeEvent: t.removeEvent,
  2378. listenTo: t.listenTo,
  2379. stopListening: t.stopListening,
  2380. dispatch: t.dispatch
  2381. },
  2382. t.event
  2383. }),
  2384. define("can/util/each", ["can/util/can"], function(t) {
  2385. var e = function(t) {
  2386. var e = t && "boolean" != typeof t && "number" != typeof t && "length"in t && t.length;
  2387. return "function" != typeof arr && (0 === e || "number" == typeof e && e > 0 && e - 1 in t)
  2388. };
  2389. return t.each = function(n, i, r) {
  2390. var o, s, a, u = 0;
  2391. if (n)
  2392. if (e(n))
  2393. if (t.List && n instanceof t.List)
  2394. for (s = n.attr("length"); u < s && (a = n.attr(u),
  2395. !1 !== i.call(r || a, a, u, n)); u++)
  2396. ;
  2397. else
  2398. for (s = n.length; u < s && (a = n[u],
  2399. !1 !== i.call(r || a, a, u, n)); u++)
  2400. ;
  2401. else if ("object" == typeof n)
  2402. if (t.Map && n instanceof t.Map || n === t.route) {
  2403. var c = t.Map.keys(n);
  2404. for (u = 0,
  2405. s = c.length; u < s && (o = c[u],
  2406. a = n.attr(o),
  2407. !1 !== i.call(r || a, a, o, n)); u++)
  2408. ;
  2409. } else
  2410. for (o in n)
  2411. if (Object.prototype.hasOwnProperty.call(n, o) && !1 === i.call(r || n[o], n[o], o, n))
  2412. break;
  2413. return n
  2414. }
  2415. ,
  2416. t
  2417. }),
  2418. define("can/util/inserted", ["can/util/can"], function(t) {
  2419. t.inserted = function(e, n) {
  2420. if (e.length) {
  2421. e = t.makeArray(e);
  2422. 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++) {
  2423. if (!s) {
  2424. if (!r.getElementsByTagName)
  2425. continue;
  2426. if (!t.has(a, r).length)
  2427. return;
  2428. s = !0
  2429. }
  2430. if (s && r.getElementsByTagName) {
  2431. i = t.makeArray(r.getElementsByTagName("*")),
  2432. t.trigger(r, "inserted", [], !1);
  2433. for (var c, l = 0; void 0 !== (c = i[l]); l++)
  2434. t.trigger(c, "inserted", [], !1)
  2435. }
  2436. }
  2437. }
  2438. }
  2439. ,
  2440. t.appendChild = function(e, n, i) {
  2441. var r;
  2442. r = 11 === n.nodeType ? t.makeArray(t.childNodes(n)) : [n],
  2443. e.appendChild(n),
  2444. t.inserted(r, i)
  2445. }
  2446. ,
  2447. t.insertBefore = function(e, n, i, r) {
  2448. var o;
  2449. o = 11 === n.nodeType ? t.makeArray(t.childNodes(n)) : [n],
  2450. e.insertBefore(n, i),
  2451. t.inserted(o, r)
  2452. }
  2453. }),
  2454. define("can/util/jquery", ["jquery", "can/util/can", "can/util/attr", "can/event", "can/util/each", "can/util/inserted"], function(t, e, n, i) {
  2455. var r = function(t) {
  2456. return t.nodeName && (1 === t.nodeType || 9 === t.nodeType) || t == window || t.addEventListener
  2457. };
  2458. (t = t || window.jQuery).extend(e, t, {
  2459. trigger: function(n, i, o, s) {
  2460. r(n) ? t.event.trigger(i, o, n, !s) : n.trigger ? n.trigger(i, o) : ("string" == typeof i && (i = {
  2461. type: i
  2462. }),
  2463. i.target = i.target || n,
  2464. o && (o.length && "string" == typeof o ? o = [o] : o.length || (o = [o])),
  2465. o || (o = []),
  2466. e.dispatch.call(n, i, o))
  2467. },
  2468. event: e.event,
  2469. addEvent: e.addEvent,
  2470. removeEvent: e.removeEvent,
  2471. buildFragment: function(e, n) {
  2472. var i;
  2473. return e = [e],
  2474. n = n || document,
  2475. n = !n.nodeType && n[0] || n,
  2476. n = n.ownerDocument || n,
  2477. (i = t.buildFragment(e, n)).cacheable ? t.clone(i.fragment) : i.fragment || i
  2478. },
  2479. $: t,
  2480. each: e.each,
  2481. bind: function(n, i) {
  2482. 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),
  2483. this
  2484. },
  2485. unbind: function(n, i) {
  2486. 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),
  2487. this
  2488. },
  2489. delegate: function(n, i, o) {
  2490. return this.delegate ? this.delegate(n, i, o) : r(this) ? t(this).delegate(n, i, o) : e.bind.call(this, i, o),
  2491. this
  2492. },
  2493. undelegate: function(n, i, o) {
  2494. return this.undelegate ? this.undelegate(n, i, o) : r(this) ? t(this).undelegate(n, i, o) : e.unbind.call(this, i, o),
  2495. this
  2496. },
  2497. proxy: e.proxy,
  2498. attr: n
  2499. }),
  2500. e.on = e.bind,
  2501. e.off = e.unbind,
  2502. t.each(["append", "filter", "addClass", "remove", "data", "get", "has"], function(t, n) {
  2503. e[n] = function(t) {
  2504. return t[n].apply(t, e.makeArray(arguments).slice(1))
  2505. }
  2506. });
  2507. var o = t.cleanData;
  2508. t.cleanData = function(n) {
  2509. t.each(n, function(t, n) {
  2510. n && e.trigger(n, "removed", [], !1)
  2511. }),
  2512. o(n)
  2513. }
  2514. ;
  2515. var s, a = t.fn.domManip;
  2516. t.fn.domManip = function(t, e, n) {
  2517. for (var i = 1; i < arguments.length; i++)
  2518. if ("function" == typeof arguments[i]) {
  2519. s = i;
  2520. break
  2521. }
  2522. return a.apply(this, arguments)
  2523. }
  2524. ,
  2525. t(document.createElement("div")).append(document.createElement("div")),
  2526. t.fn.domManip = 2 === s ? function(t, n, i) {
  2527. return a.call(this, t, n, function(t) {
  2528. var n;
  2529. 11 === t.nodeType && (n = e.makeArray(e.childNodes(t)));
  2530. var r = i.apply(this, arguments);
  2531. return e.inserted(n || [t]),
  2532. r
  2533. })
  2534. }
  2535. : function(t, n) {
  2536. return a.call(this, t, function(t) {
  2537. var i;
  2538. 11 === t.nodeType && (i = e.makeArray(e.childNodes(t)));
  2539. var r = n.apply(this, arguments);
  2540. return e.inserted(i || [t]),
  2541. r
  2542. })
  2543. }
  2544. ;
  2545. var u = t.attr;
  2546. t.attr = function(t, n) {
  2547. if (e.isDOM(t) && e.attr.MutationObserver)
  2548. return u.apply(this, arguments);
  2549. var i, r;
  2550. arguments.length >= 3 && (i = u.call(this, t, n));
  2551. var o = u.apply(this, arguments);
  2552. return arguments.length >= 3 && (r = u.call(this, t, n)),
  2553. r !== i && e.attr.trigger(t, n, i),
  2554. o
  2555. }
  2556. ;
  2557. var c = t.removeAttr;
  2558. return t.removeAttr = function(t, n) {
  2559. if (e.isDOM(t) && e.attr.MutationObserver)
  2560. return c.apply(this, arguments);
  2561. var i = u.call(this, t, n)
  2562. , r = c.apply(this, arguments);
  2563. return null != i && e.attr.trigger(t, n, i),
  2564. r
  2565. }
  2566. ,
  2567. t.event.special.attributes = {
  2568. setup: function() {
  2569. if (e.isDOM(this) && e.attr.MutationObserver) {
  2570. var t = this
  2571. , n = new e.attr.MutationObserver(function(n) {
  2572. n.forEach(function(n) {
  2573. var i = e.simpleExtend({}, n);
  2574. e.trigger(t, i, [])
  2575. })
  2576. }
  2577. );
  2578. n.observe(this, {
  2579. attributes: !0,
  2580. attributeOldValue: !0
  2581. }),
  2582. e.data(e.$(this), "canAttributesObserver", n)
  2583. } else
  2584. e.data(e.$(this), "canHasAttributesBindings", !0)
  2585. },
  2586. teardown: function() {
  2587. e.isDOM(this) && e.attr.MutationObserver ? (e.data(e.$(this), "canAttributesObserver").disconnect(),
  2588. t.removeData(this, "canAttributesObserver")) : t.removeData(this, "canHasAttributesBindings")
  2589. }
  2590. },
  2591. function() {
  2592. var t = e.buildFragment("<-\n>", document);
  2593. if (t.firstChild && "<-\n>" !== t.firstChild.nodeValue) {
  2594. var n = e.buildFragment;
  2595. e.buildFragment = function(t, e) {
  2596. var i = n(t, e);
  2597. return 1 === i.childNodes.length && 3 === i.childNodes.item(0).nodeType && (i.childNodes.item(0).nodeValue = t),
  2598. i
  2599. }
  2600. }
  2601. }(),
  2602. t.event.special.inserted = {},
  2603. t.event.special.removed = {},
  2604. e
  2605. }),
  2606. define("can/util/library", ["can/util/jquery"], function(t) {
  2607. return t
  2608. }),
  2609. define("can/util/bind", ["can/util/library"], function(t) {
  2610. return t.bindAndSetup = function() {
  2611. return t.addEvent.apply(this, arguments),
  2612. this.__inSetup || (this._bindings ? this._bindings++ : (this._bindings = 1,
  2613. this._bindsetup && this._bindsetup())),
  2614. this
  2615. }
  2616. ,
  2617. t.unbindAndTeardown = function(e, n) {
  2618. if (!this.__bindEvents)
  2619. return this;
  2620. var i = this.__bindEvents[e] || []
  2621. , r = i.length;
  2622. return t.removeEvent.apply(this, arguments),
  2623. null === this._bindings ? this._bindings = 0 : this._bindings = this._bindings - (r - i.length),
  2624. !this._bindings && this._bindteardown && this._bindteardown(),
  2625. this
  2626. }
  2627. ,
  2628. t
  2629. }),
  2630. define("can/bubble", ["can/util/library"], function(t) {
  2631. var e = t.bubble = {
  2632. bind: function(t, n) {
  2633. if (!t.__inSetup) {
  2634. var i, r = e.events(t, n), o = r.length;
  2635. t._bubbleBindings || (t._bubbleBindings = {});
  2636. for (var s = 0; s < o; s++)
  2637. i = r[s],
  2638. t._bubbleBindings[i] ? t._bubbleBindings[i]++ : (t._bubbleBindings[i] = 1,
  2639. e.childrenOf(t, i))
  2640. }
  2641. },
  2642. unbind: function(n, i) {
  2643. for (var r, o = e.events(n, i), s = o.length, a = 0; a < s; a++)
  2644. r = o[a],
  2645. n._bubbleBindings && n._bubbleBindings[r]--,
  2646. n._bubbleBindings && !n._bubbleBindings[r] && (delete n._bubbleBindings[r],
  2647. e.teardownChildrenFrom(n, r),
  2648. t.isEmptyObject(n._bubbleBindings) && delete n._bubbleBindings)
  2649. },
  2650. add: function(n, i, r) {
  2651. if (i instanceof t.Map && n._bubbleBindings)
  2652. for (var o in n._bubbleBindings)
  2653. n._bubbleBindings[o] && (e.teardownFromParent(n, i, o),
  2654. e.toParent(i, n, r, o))
  2655. },
  2656. addMany: function(t, n) {
  2657. for (var i = 0, r = n.length; i < r; i++)
  2658. e.add(t, n[i], i)
  2659. },
  2660. remove: function(n, i) {
  2661. if (i instanceof t.Map && n._bubbleBindings)
  2662. for (var r in n._bubbleBindings)
  2663. n._bubbleBindings[r] && e.teardownFromParent(n, i, r)
  2664. },
  2665. removeMany: function(t, n) {
  2666. for (var i = 0, r = n.length; i < r; i++)
  2667. e.remove(t, n[i])
  2668. },
  2669. set: function(n, i, r, o) {
  2670. return t.isMapLike(r) && e.add(n, r, i),
  2671. t.isMapLike(o) && e.remove(n, o),
  2672. r
  2673. },
  2674. events: function(t, e) {
  2675. return t.constructor._bubbleRule(e, t)
  2676. },
  2677. toParent: function(e, n, i, r) {
  2678. t.listenTo.call(n, e, r, function() {
  2679. var o = t.makeArray(arguments)
  2680. , s = o.shift();
  2681. o[0] = (t.List && n instanceof t.List ? n.indexOf(e) : i) + (o[0] ? "." + o[0] : ""),
  2682. s.triggeredNS = s.triggeredNS || {},
  2683. s.triggeredNS[n._cid] || (s.triggeredNS[n._cid] = !0,
  2684. t.trigger(n, s, o),
  2685. "change" === r && t.trigger(n, o[0], [o[2], o[3]]))
  2686. })
  2687. },
  2688. childrenOf: function(t, n) {
  2689. t._each(function(i, r) {
  2690. i && i.bind && e.toParent(i, t, r, n)
  2691. })
  2692. },
  2693. teardownFromParent: function(e, n, i) {
  2694. n && n.unbind && t.stopListening.call(e, n, i)
  2695. },
  2696. teardownChildrenFrom: function(t, n) {
  2697. t._each(function(i) {
  2698. e.teardownFromParent(t, i, n)
  2699. })
  2700. },
  2701. isBubbling: function(t, e) {
  2702. return t._bubbleBindings && t._bubbleBindings[e]
  2703. }
  2704. };
  2705. return e
  2706. }),
  2707. define("can/util/object/isplain", ["can/util/can"], function(t) {
  2708. var e = Object.prototype.hasOwnProperty
  2709. , n = function(t) {
  2710. return null !== t && t == t.window
  2711. };
  2712. return t.isPlainObject = function(t) {
  2713. if (!t || "object" != typeof t || t.nodeType || n(t))
  2714. return !1;
  2715. try {
  2716. if (t.constructor && !e.call(t, "constructor") && !e.call(t.constructor.prototype, "isPrototypeOf"))
  2717. return !1
  2718. } catch (t) {
  2719. return !1
  2720. }
  2721. var i;
  2722. for (i in t)
  2723. ;
  2724. return void 0 === i || e.call(t, i)
  2725. }
  2726. ,
  2727. t
  2728. }),
  2729. define("can/map_helpers", ["can/util/library", "can/util/object/isplain"], function(t) {
  2730. var e = {
  2731. attrParts: function(t, e) {
  2732. return e ? [t] : "object" == typeof t ? t : ("" + t).split(".")
  2733. },
  2734. canMakeObserve: function(e) {
  2735. return e && !t.isDeferred(e) && (t.isArray(e) || t.isPlainObject(e))
  2736. },
  2737. serialize: function() {
  2738. var n = null;
  2739. return function(i, r, o) {
  2740. var s = t.cid(i)
  2741. , a = !1;
  2742. return n || (a = !0,
  2743. n = {
  2744. attr: {},
  2745. serialize: {}
  2746. }),
  2747. n[r][s] = o,
  2748. i.each(function(s, a) {
  2749. var u;
  2750. 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)
  2751. }),
  2752. a && (n = null),
  2753. o
  2754. }
  2755. }(),
  2756. getValue: function(e, n, i, r) {
  2757. return t.isMapLike(i) ? i[r]() : i
  2758. },
  2759. define: null,
  2760. addComputedAttr: function(t, e, n) {
  2761. t._computedAttrs[e] = {
  2762. compute: n,
  2763. count: 0,
  2764. handler: function(n, i, r) {
  2765. t._triggerChange(e, "set", i, r, n.batchNum)
  2766. }
  2767. }
  2768. },
  2769. addToMap: function(e, r) {
  2770. var o;
  2771. n || (o = i,
  2772. n = {});
  2773. var s = e._cid
  2774. , a = t.cid(e);
  2775. return n[a] || (n[a] = {
  2776. obj: e,
  2777. instance: r,
  2778. added: !s
  2779. }),
  2780. o
  2781. },
  2782. getMapFromObject: function(t) {
  2783. return n && n[t._cid] && n[t._cid].instance
  2784. }
  2785. }
  2786. , n = null
  2787. , i = function() {
  2788. for (var t in n)
  2789. n[t].added && delete n[t].obj._cid;
  2790. n = null
  2791. };
  2792. return e
  2793. }),
  2794. define("can/util/string", ["can/util/library"], function(t) {
  2795. var e = /_|-/
  2796. , n = /\=\=/
  2797. , i = /([A-Z]+)([A-Z][a-z])/g
  2798. , r = /([a-z\d])([A-Z])/g
  2799. , o = /([a-z\d])([A-Z])/g
  2800. , s = /\{([^\}]+)\}/g
  2801. , a = /"/g
  2802. , u = /'/g
  2803. , c = /-+(.)?/g
  2804. , l = /[a-z][A-Z]/g
  2805. , p = function(t, e, n) {
  2806. var i = t[e];
  2807. return void 0 === i && !0 === n && (i = t[e] = {}),
  2808. i
  2809. }
  2810. , h = function(t) {
  2811. return /^f|^o/.test(typeof t)
  2812. }
  2813. , d = function(t) {
  2814. return "" + (null === t || void 0 === t || isNaN(t) && "" + t == "NaN" ? "" : t)
  2815. };
  2816. return t.extend(t, {
  2817. esc: function(t) {
  2818. return d(t).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(a, "&#34;").replace(u, "&#39;")
  2819. },
  2820. getObject: function(e, n, i) {
  2821. var r, o, s, a, u = e ? e.split(".") : [], c = u.length, l = 0;
  2822. if (n = t.isArray(n) ? n : [n || window],
  2823. a = n.length,
  2824. !c)
  2825. return n[0];
  2826. for (l; l < a; l++) {
  2827. for (r = n[l],
  2828. s = void 0,
  2829. o = 0; o < c && h(r); o++)
  2830. s = r,
  2831. r = p(s, u[o]);
  2832. if (void 0 !== s && void 0 !== r)
  2833. break
  2834. }
  2835. if (!1 === i && void 0 !== r && delete s[u[o - 1]],
  2836. !0 === i && void 0 === r)
  2837. for (r = n[0],
  2838. o = 0; o < c && h(r); o++)
  2839. r = p(r, u[o], !0);
  2840. return r
  2841. },
  2842. capitalize: function(t, e) {
  2843. return t.charAt(0).toUpperCase() + t.slice(1)
  2844. },
  2845. camelize: function(t) {
  2846. return d(t).replace(c, function(t, e) {
  2847. return e ? e.toUpperCase() : ""
  2848. })
  2849. },
  2850. hyphenate: function(t) {
  2851. return d(t).replace(l, function(t, e) {
  2852. return t.charAt(0) + "-" + t.charAt(1).toLowerCase()
  2853. })
  2854. },
  2855. underscore: function(t) {
  2856. return t.replace(n, "/").replace(i, "$1_$2").replace(r, "$1_$2").replace(o, "_").toLowerCase()
  2857. },
  2858. sub: function(e, n, i) {
  2859. var r = [];
  2860. return e = e || "",
  2861. r.push(e.replace(s, function(e, o) {
  2862. var s = t.getObject(o, n, !0 !== i && void 0);
  2863. return void 0 === s || null === s ? (r = null,
  2864. "") : h(s) && r ? (r.push(s),
  2865. "") : "" + s
  2866. })),
  2867. null === r ? r : r.length <= 1 ? r[0] : r
  2868. },
  2869. replacer: s,
  2870. undHash: e
  2871. }),
  2872. t
  2873. }),
  2874. define("can/construct", ["can/util/string"], function(t) {
  2875. var e, n = 0;
  2876. try {
  2877. Object.getOwnPropertyDescriptor({}),
  2878. e = !0
  2879. } catch (t) {
  2880. e = !1
  2881. }
  2882. var i = function(t, e) {
  2883. var n = Object.getOwnPropertyDescriptor(t, e);
  2884. return n && (n.get || n.set) ? n : null
  2885. };
  2886. return t.Construct = function() {
  2887. if (arguments.length)
  2888. return t.Construct.extend.apply(t.Construct, arguments)
  2889. }
  2890. ,
  2891. t.extend(t.Construct, {
  2892. constructorExtends: !0,
  2893. newInstance: function() {
  2894. var t, e = this.instance();
  2895. return e.setup && (e.__inSetup = !0,
  2896. t = e.setup.apply(e, arguments),
  2897. delete e.__inSetup),
  2898. e.init && e.init.apply(e, t || arguments),
  2899. e
  2900. },
  2901. _inherit: e ? function(e, n, r) {
  2902. r = r || e;
  2903. var o;
  2904. for (var s in e)
  2905. (o = i(e, s)) ? this._defineProperty(r, n, s, o) : t.Construct._overwrite(r, n, s, e[s])
  2906. }
  2907. : function(e, n, i) {
  2908. i = i || e;
  2909. for (var r in e)
  2910. t.Construct._overwrite(i, n, r, e[r])
  2911. }
  2912. ,
  2913. _defineProperty: function(t, e, n, i) {
  2914. Object.defineProperty(t, n, i)
  2915. },
  2916. _overwrite: function(t, e, n, i) {
  2917. t[n] = i
  2918. },
  2919. setup: function(e, n) {
  2920. this.defaults = t.extend(!0, {}, e.defaults, this.defaults)
  2921. },
  2922. instance: function() {
  2923. n = 1;
  2924. var t = new this;
  2925. return n = 0,
  2926. t
  2927. },
  2928. extend: function(e, i, r) {
  2929. function o() {
  2930. if (!n)
  2931. return this.constructor !== c && arguments.length && c.constructorExtends ? c.extend.apply(c, arguments) : c.newInstance.apply(c, arguments)
  2932. }
  2933. var s = e
  2934. , a = i
  2935. , u = r;
  2936. "string" != typeof s && (u = a,
  2937. a = s,
  2938. s = null),
  2939. u || (u = a,
  2940. a = null),
  2941. u = u || {};
  2942. var c, l, p, h, d, f, g, v, m, b = this, y = this.prototype;
  2943. m = this.instance(),
  2944. t.Construct._inherit(u, y, m),
  2945. s ? (l = s.split("."),
  2946. g = l.pop()) : a && a.shortName ? g = a.shortName : this.shortName && (g = this.shortName),
  2947. "undefined" == typeof constructorName && (c = function() {
  2948. return o.apply(this, arguments)
  2949. }
  2950. );
  2951. for (f in b)
  2952. b.hasOwnProperty(f) && (c[f] = b[f]);
  2953. t.Construct._inherit(a, b, c),
  2954. s && (p = t.getObject(l.join("."), window, !0),
  2955. v = p,
  2956. h = t.underscore(s.replace(/\./g, "_")),
  2957. d = t.underscore(g),
  2958. p[g] = c),
  2959. t.extend(c, {
  2960. constructor: c,
  2961. prototype: m,
  2962. namespace: v,
  2963. _shortName: d,
  2964. fullName: s,
  2965. _fullName: h
  2966. }),
  2967. void 0 !== g && (c.shortName = g),
  2968. c.prototype.constructor = c;
  2969. var _ = [b].concat(t.makeArray(arguments))
  2970. , w = c.setup.apply(c, _);
  2971. return c.init && c.init.apply(c, w || _),
  2972. c
  2973. }
  2974. }),
  2975. t.Construct.prototype.setup = function() {}
  2976. ,
  2977. t.Construct.prototype.init = function() {}
  2978. ,
  2979. t.Construct
  2980. }),
  2981. define("can/util/batch", ["can/util/can"], function(t) {
  2982. var e = 1
  2983. , n = 0
  2984. , i = null
  2985. , r = null
  2986. , o = [];
  2987. t.batch = {
  2988. start: function(t) {
  2989. if (1 == ++n) {
  2990. var i = {
  2991. events: [],
  2992. callbacks: [],
  2993. number: e++
  2994. };
  2995. o.push(i),
  2996. t && i.callbacks.push(t),
  2997. r = i
  2998. }
  2999. },
  3000. stop: function(e, s) {
  3001. if (e ? n = 0 : n--,
  3002. 0 === n) {
  3003. r = null;
  3004. var a;
  3005. if (1 === o.length)
  3006. for (; a = o.shift(); ) {
  3007. var u = a.events
  3008. , c = a.callbacks;
  3009. i = a,
  3010. t.batch.batchNum = a.number;
  3011. var l, p;
  3012. for (s && t.batch.start(),
  3013. l = 0,
  3014. p = u.length; l < p; l++)
  3015. t.dispatch.apply(u[l][0], u[l][1]);
  3016. for (t.batch._onDispatchedEvents(a.number),
  3017. l = 0; l < c.length; l++)
  3018. c[l]();
  3019. i = null,
  3020. t.batch.batchNum = void 0
  3021. }
  3022. }
  3023. },
  3024. _onDispatchedEvents: function() {},
  3025. trigger: function(e, n, o) {
  3026. e.__inSetup || (n = "string" == typeof n ? {
  3027. type: n
  3028. } : n,
  3029. r ? (n.batchNum = r.number,
  3030. r.events.push([e, [n, o]])) : (i && (n.batchNum = i.number),
  3031. t.dispatch.call(e, n, o)))
  3032. },
  3033. afterPreviousEvents: function(t) {
  3034. t({})
  3035. },
  3036. after: function(t) {
  3037. var e = r || i;
  3038. e ? e.callbacks.push(t) : t({})
  3039. }
  3040. }
  3041. }),
  3042. define("can/map", ["can/util/library", "can/util/bind", "can/bubble", "can/map_helpers", "can/construct", "can/util/batch"], function(t, e, n, i) {
  3043. var r = t.Map = t.Construct.extend({
  3044. setup: function() {
  3045. if (t.Construct.setup.apply(this, arguments),
  3046. this._computedPropertyNames = [],
  3047. t.Map) {
  3048. this.defaults || (this.defaults = {});
  3049. for (var e in this.prototype)
  3050. "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);
  3051. i.define && i.define(this)
  3052. }
  3053. !t.List || this.prototype instanceof t.List || (this.List = r.List.extend({
  3054. Map: this
  3055. }, {}))
  3056. },
  3057. shortName: "Map",
  3058. _bubbleRule: function(t) {
  3059. return "change" === t || t.indexOf(".") >= 0 ? ["change"] : []
  3060. },
  3061. bind: t.bindAndSetup,
  3062. unbind: t.unbindAndTeardown,
  3063. id: "id",
  3064. keys: function(e) {
  3065. var n = [];
  3066. t.__observe(e, "__keys");
  3067. for (var i in e._data)
  3068. n.push(i);
  3069. return n
  3070. }
  3071. }, {
  3072. setup: function(e) {
  3073. e instanceof t.Map && (e = e.serialize()),
  3074. this._data = {},
  3075. t.cid(this, ".map"),
  3076. this._setupComputedProperties();
  3077. var n = e && i.addToMap(e, this)
  3078. , r = this._setupDefaults(e)
  3079. , o = t.extend(t.extend(!0, {}, r), e);
  3080. this.attr(o),
  3081. n && n()
  3082. },
  3083. _setupComputedProperties: function() {
  3084. this._computedAttrs = {};
  3085. for (var t = this.constructor._computedPropertyNames, e = 0, n = t.length; e < n; e++) {
  3086. var r = t[e];
  3087. i.addComputedAttr(this, r, this[r].clone(this))
  3088. }
  3089. },
  3090. _setupDefaults: function() {
  3091. return this.constructor.defaults || {}
  3092. },
  3093. attr: function(t, e) {
  3094. var n = typeof t;
  3095. return void 0 === t ? this._getAttrs() : "string" !== n && "number" !== n ? this._setAttrs(t, e) : 1 === arguments.length ? this._get(t + "") : (this._set(t + "", e),
  3096. this)
  3097. },
  3098. _get: function(e) {
  3099. var n = e.indexOf(".");
  3100. if (n >= 0) {
  3101. var i = this.___get(e);
  3102. if (void 0 !== i)
  3103. return t.__observe(this, e),
  3104. i;
  3105. var r = e.substr(0, n)
  3106. , o = e.substr(n + 1)
  3107. , s = this.__get(r);
  3108. return s && s._get ? s._get(o) : void 0
  3109. }
  3110. return this.__get(e)
  3111. },
  3112. __get: function(e) {
  3113. return t.__observe(this, e),
  3114. this.___get(e)
  3115. },
  3116. ___get: function(t) {
  3117. if (t) {
  3118. var e = this._computedAttrs[t];
  3119. return e ? e.compute() : this._data[t]
  3120. }
  3121. return this._data
  3122. },
  3123. _set: function(e, n, i) {
  3124. var r, o = e.indexOf(".");
  3125. if (o >= 0 && !i) {
  3126. var s = e.substr(0, o)
  3127. , a = e.substr(o + 1);
  3128. if (r = this.__inSetup ? void 0 : this.___get(s),
  3129. !t.isMapLike(r))
  3130. throw new Error("can.Map: Object does not exist");
  3131. r._set(a, n)
  3132. } else
  3133. r = this.__inSetup ? void 0 : this.___get(e),
  3134. this.__convert && (n = this.__convert(e, n)),
  3135. this.__set(e, this.__type(n, e), r)
  3136. },
  3137. __type: function(e, n) {
  3138. if ("object" == typeof e && !(e instanceof t.Map) && i.canMakeObserve(e)) {
  3139. var r = i.getMapFromObject(e);
  3140. return r || (t.isArray(e) ? new (0,
  3141. t.List)(e) : new (this.constructor.Map || t.Map)(e))
  3142. }
  3143. return e
  3144. },
  3145. __set: function(t, e, i) {
  3146. if (e !== i) {
  3147. var r = this._computedAttrs[t]
  3148. , o = r || void 0 !== i || this.___get().hasOwnProperty(t) ? "set" : "add";
  3149. this.___set(t, "object" == typeof e ? n.set(this, t, e, i) : e),
  3150. r && r.count || this._triggerChange(t, o, e, i),
  3151. "object" == typeof i && n.teardownFromParent(this, i)
  3152. }
  3153. },
  3154. ___set: function(t, e) {
  3155. var n = this._computedAttrs[t];
  3156. n ? n.compute(e) : this._data[t] = e,
  3157. "function" == typeof this.constructor.prototype[t] || n || (this[t] = e)
  3158. },
  3159. removeAttr: function(t) {
  3160. return this._remove(t)
  3161. },
  3162. _remove: function(t) {
  3163. var e = i.attrParts(t)
  3164. , n = e.shift()
  3165. , r = this.___get(n);
  3166. return e.length && r ? r.removeAttr(e) : ("string" == typeof t && ~t.indexOf(".") && (n = t),
  3167. this.__remove(n, r),
  3168. r)
  3169. },
  3170. __remove: function(t, e) {
  3171. t in this._data && (this.___remove(t),
  3172. this._triggerChange(t, "remove", void 0, e))
  3173. },
  3174. ___remove: function(t) {
  3175. delete this._data[t],
  3176. t in this.constructor.prototype || delete this[t]
  3177. },
  3178. ___serialize: function(t, e) {
  3179. return i.getValue(this, t, e, "serialize")
  3180. },
  3181. _getAttrs: function() {
  3182. return i.serialize(this, "attr", {})
  3183. },
  3184. _setAttrs: function(e, n) {
  3185. e = t.simpleExtend({}, e);
  3186. var r, o, s = this;
  3187. t.batch.start(),
  3188. this.each(function(r, a) {
  3189. if ("_cid" !== a) {
  3190. if (void 0 === (o = e[a]))
  3191. return void (n && s.removeAttr(a));
  3192. s.__convert && (o = s.__convert(a, o)),
  3193. t.isMapLike(r) && i.canMakeObserve(o) ? r.attr(o, n) : r !== o && s.__set(a, s.__type(o, a), r),
  3194. delete e[a]
  3195. }
  3196. });
  3197. for (r in e)
  3198. "_cid" !== r && (o = e[r],
  3199. this._set(r, o, !0));
  3200. return t.batch.stop(),
  3201. this
  3202. },
  3203. serialize: function() {
  3204. return i.serialize(this, "serialize", {})
  3205. },
  3206. _triggerChange: function(e, i, r, o, s) {
  3207. n.isBubbling(this, "change") && t.batch.trigger(this, {
  3208. type: "change",
  3209. target: this,
  3210. batchNum: s
  3211. }, [e, i, r, o]),
  3212. t.batch.trigger(this, {
  3213. type: e,
  3214. target: this,
  3215. batchNum: s
  3216. }, [r, o]),
  3217. "remove" !== i && "add" !== i || t.batch.trigger(this, {
  3218. type: "__keys",
  3219. target: this,
  3220. batchNum: s
  3221. })
  3222. },
  3223. _bindsetup: function() {},
  3224. _bindteardown: function() {},
  3225. one: t.one,
  3226. bind: function(e, i) {
  3227. var r = this._computedAttrs && this._computedAttrs[e];
  3228. return r && (r.count ? r.count++ : (r.count = 1,
  3229. r.compute.bind("change", r.handler))),
  3230. n.bind(this, e),
  3231. t.bindAndSetup.apply(this, arguments)
  3232. },
  3233. unbind: function(e, i) {
  3234. var r = this._computedAttrs && this._computedAttrs[e];
  3235. return r && (1 === r.count ? (r.count = 0,
  3236. r.compute.unbind("change", r.handler)) : r.count--),
  3237. n.unbind(this, e),
  3238. t.unbindAndTeardown.apply(this, arguments)
  3239. },
  3240. compute: function(e) {
  3241. if (t.isFunction(this.constructor.prototype[e]))
  3242. return t.compute(this[e], this);
  3243. var n = t.compute.read.reads(e)
  3244. , i = n.length - 1;
  3245. return t.compute(function(e) {
  3246. if (!arguments.length)
  3247. return t.compute.read(this, n, {
  3248. args: []
  3249. }).value;
  3250. t.compute.read(this, n.slice(0, i)).value.attr(n[i].key, e)
  3251. }, this)
  3252. },
  3253. each: function() {
  3254. return t.each.apply(void 0, [this].concat(t.makeArray(arguments)))
  3255. },
  3256. _each: function(t) {
  3257. var e = this.___get();
  3258. for (var n in e)
  3259. e.hasOwnProperty(n) && t(e[n], n)
  3260. },
  3261. dispatch: t.dispatch
  3262. });
  3263. return r.prototype.on = r.prototype.bind,
  3264. r.prototype.off = r.prototype.unbind,
  3265. r.on = r.bind,
  3266. r.off = r.unbind,
  3267. r
  3268. }),
  3269. define("can/list", ["can/util/library", "can/map", "can/bubble", "can/map_helpers"], function(t, e, n, i) {
  3270. var r = [].splice
  3271. , o = function() {
  3272. var t = {
  3273. 0: "a",
  3274. length: 1
  3275. };
  3276. return r.call(t, 0, 1),
  3277. !t[0]
  3278. }()
  3279. , s = e.extend({
  3280. Map: e
  3281. }, {
  3282. setup: function(e, n) {
  3283. this.length = 0,
  3284. t.cid(this, ".map"),
  3285. this._setupComputedProperties(),
  3286. e = e || [];
  3287. var r;
  3288. t.isDeferred(e) ? this.replace(e) : (r = e.length && i.addToMap(e, this),
  3289. this.push.apply(this, t.makeArray(e || []))),
  3290. r && r(),
  3291. t.simpleExtend(this, n)
  3292. },
  3293. _triggerChange: function(n, i, r, o) {
  3294. e.prototype._triggerChange.apply(this, arguments);
  3295. var s = +n;
  3296. ~("" + n).indexOf(".") || isNaN(s) || ("add" === i ? (t.batch.trigger(this, i, [r, s]),
  3297. t.batch.trigger(this, "length", [this.length])) : "remove" === i ? (t.batch.trigger(this, i, [o, s]),
  3298. t.batch.trigger(this, "length", [this.length])) : t.batch.trigger(this, i, [r, s]))
  3299. },
  3300. ___get: function(e) {
  3301. return e ? this[e] && this[e].isComputed && t.isFunction(this.constructor.prototype[e]) ? this[e]() : this[e] : this
  3302. },
  3303. __set: function(e, n, i) {
  3304. if ("number" == typeof (e = isNaN(+e) || e % 1 ? e : +e) && e > this.length - 1) {
  3305. var r = new Array(e + 1 - this.length);
  3306. return r[r.length - 1] = n,
  3307. this.push.apply(this, r),
  3308. r
  3309. }
  3310. return t.Map.prototype.__set.call(this, "" + e, n, i)
  3311. },
  3312. ___set: function(t, e) {
  3313. this[t] = e,
  3314. +t >= this.length && (this.length = +t + 1)
  3315. },
  3316. __remove: function(t, e) {
  3317. isNaN(+t) ? (delete this[t],
  3318. this._triggerChange(t, "remove", void 0, e)) : this.splice(t, 1)
  3319. },
  3320. _each: function(t) {
  3321. for (var e = this.___get(), n = 0; n < e.length; n++)
  3322. t(e[n], n)
  3323. },
  3324. serialize: function() {
  3325. return i.serialize(this, "serialize", [])
  3326. },
  3327. splice: function(e, i) {
  3328. var s, a, u, c = t.makeArray(arguments), l = [], p = c.length > 2;
  3329. for (e = e || 0,
  3330. s = 0,
  3331. a = c.length - 2; s < a; s++)
  3332. u = s + 2,
  3333. c[u] = this.__type(c[u], u),
  3334. l.push(c[u]),
  3335. this[s + e] !== c[u] && (p = !1);
  3336. if (p && this.length <= l.length)
  3337. return l;
  3338. void 0 === i && (i = c[1] = this.length - e);
  3339. var h = r.apply(this, c);
  3340. if (!o)
  3341. for (s = this.length; s < h.length + this.length; s++)
  3342. delete this[s];
  3343. return t.batch.start(),
  3344. i > 0 && (n.removeMany(this, h),
  3345. this._triggerChange("" + e, "remove", void 0, h)),
  3346. c.length > 2 && (n.addMany(this, l),
  3347. this._triggerChange("" + e, "add", l, h)),
  3348. t.batch.stop(),
  3349. h
  3350. },
  3351. _getAttrs: function() {
  3352. return i.serialize(this, "attr", [])
  3353. },
  3354. _setAttrs: function(e, n) {
  3355. e = t.makeArray(e),
  3356. t.batch.start(),
  3357. this._updateAttrs(e, n),
  3358. t.batch.stop()
  3359. },
  3360. _updateAttrs: function(e, n) {
  3361. for (var r = Math.min(e.length, this.length), o = 0; o < r; o++) {
  3362. var s = this[o]
  3363. , a = e[o];
  3364. t.isMapLike(s) && i.canMakeObserve(a) ? s.attr(a, n) : s !== a && this._set(o + "", a)
  3365. }
  3366. e.length > this.length ? this.push.apply(this, e.slice(this.length)) : e.length < this.length && n && this.splice(e.length)
  3367. }
  3368. })
  3369. , a = function(e) {
  3370. return e[0] && t.isArray(e[0]) ? e[0] : t.makeArray(e)
  3371. };
  3372. return t.each({
  3373. push: "length",
  3374. unshift: 0
  3375. }, function(t, e) {
  3376. var i = [][e];
  3377. s.prototype[e] = function() {
  3378. for (var e, r, o = [], s = t ? this.length : 0, a = arguments.length; a--; )
  3379. r = arguments[a],
  3380. o[a] = n.set(this, a, this.__type(r, a));
  3381. return e = i.apply(this, o),
  3382. this.comparator && !o.length || this._triggerChange("" + s, "add", o, void 0),
  3383. e
  3384. }
  3385. }),
  3386. t.each({
  3387. pop: "length",
  3388. shift: 0
  3389. }, function(t, e) {
  3390. s.prototype[e] = function() {
  3391. if (this.length) {
  3392. var i = a(arguments)
  3393. , r = t && this.length ? this.length - 1 : 0
  3394. , o = [][e].apply(this, i);
  3395. return this._triggerChange("" + r, "remove", void 0, [o]),
  3396. o && o.unbind && n.remove(this, o),
  3397. o
  3398. }
  3399. }
  3400. }),
  3401. t.extend(s.prototype, {
  3402. indexOf: function(e, n) {
  3403. return t.__observe(this, "length"),
  3404. t.inArray(e, this, n)
  3405. },
  3406. join: function() {
  3407. return t.__observe(this, "length"),
  3408. [].join.apply(this, arguments)
  3409. },
  3410. reverse: function() {
  3411. var e = [].reverse.call(t.makeArray(this));
  3412. return this.replace(e)
  3413. },
  3414. slice: function() {
  3415. t.__observe(this, "length");
  3416. var e = Array.prototype.slice.apply(this, arguments);
  3417. return new this.constructor(e)
  3418. },
  3419. concat: function() {
  3420. var e = [];
  3421. return t.each(t.makeArray(arguments), function(n, i) {
  3422. e[i] = n instanceof t.List ? n.serialize() : n
  3423. }),
  3424. new this.constructor(Array.prototype.concat.apply(this.serialize(), e))
  3425. },
  3426. forEach: function(e, n) {
  3427. return t.each(this, e, n || this)
  3428. },
  3429. replace: function(e) {
  3430. if (t.isDeferred(e)) {
  3431. this._promise && (this._promise.__isCurrentPromise = !1);
  3432. var n = this._promise = e;
  3433. n.__isCurrentPromise = !0;
  3434. var i = this;
  3435. e.then(function(t) {
  3436. n.__isCurrentPromise && i.replace(t)
  3437. })
  3438. } else
  3439. this.splice.apply(this, [0, this.length].concat(t.makeArray(e || [])));
  3440. return this
  3441. },
  3442. filter: function(t, e) {
  3443. var n, i = new this.constructor, r = this;
  3444. return this.each(function(o, s, a) {
  3445. (n = t.call(e | r, o, s, r)) && i.push(o)
  3446. }),
  3447. i
  3448. },
  3449. map: function(e, n) {
  3450. var i = new t.List
  3451. , r = this;
  3452. return this.each(function(t, o, s) {
  3453. var a = e.call(n | r, t, o, r);
  3454. i.push(a)
  3455. }),
  3456. i
  3457. }
  3458. }),
  3459. t.List = e.List = s,
  3460. t.List
  3461. }),
  3462. define("can/util/string/deparam", ["can/util/library", "can/util/string"], function(t) {
  3463. var e = /^\d+$/
  3464. , n = /([^\[\]]+)|(\[\])/g
  3465. , i = /([^?#]*)(#.*)?$/
  3466. , r = function(t) {
  3467. return decodeURIComponent(t.replace(/\+/g, " "))
  3468. };
  3469. return t.extend(t, {
  3470. deparam: function(o) {
  3471. var s, a, u = {};
  3472. return o && i.test(o) && (s = o.split("&"),
  3473. t.each(s, function(t) {
  3474. var i = t.split("=")
  3475. , o = r(i.shift())
  3476. , s = r(i.join("="))
  3477. , c = u;
  3478. if (o) {
  3479. for (var l = 0, p = (i = o.match(n)).length - 1; l < p; l++)
  3480. c[i[l]] || (c[i[l]] = e.test(i[l + 1]) || "[]" === i[l + 1] ? [] : {}),
  3481. c = c[i[l]];
  3482. "[]" === (a = i.pop()) ? c.push(s) : c[a] = s
  3483. }
  3484. })),
  3485. u
  3486. }
  3487. }),
  3488. t
  3489. }),
  3490. define("can/route", ["can/util/library", "can/map", "can/list", "can/util/string/deparam"], function(t) {
  3491. var e, n, i, r, o = /\:([\w\.]+)/g, s = /^(?:&[^=]+=[^&]*)+/, a = function(e) {
  3492. var n = [];
  3493. return t.each(e, function(e, i) {
  3494. n.push(("className" === i ? "class" : i) + '="' + ("href" === i ? e : t.esc(e)) + '"')
  3495. }),
  3496. n.join(" ")
  3497. }, u = function(t, e) {
  3498. var n = 0
  3499. , i = 0
  3500. , r = {};
  3501. for (var o in t.defaults)
  3502. t.defaults[o] === e[o] && (r[o] = 1,
  3503. n++);
  3504. for (; i < t.names.length; i++) {
  3505. if (!e.hasOwnProperty(t.names[i]))
  3506. return -1;
  3507. r[t.names[i]] || n++
  3508. }
  3509. return n
  3510. }, c = window.location, l = function(t) {
  3511. return (t + "").replace(/([.?*+\^$\[\]\\(){}|\-])/g, "\\$1")
  3512. }, p = t.each, h = t.extend, d = function(e) {
  3513. return e && "object" == typeof e ? (e = e instanceof t.Map ? e.attr() : t.isFunction(e.slice) ? e.slice() : t.extend({}, e),
  3514. t.each(e, function(t, n) {
  3515. e[n] = d(t)
  3516. })) : void 0 !== e && null !== e && t.isFunction(e.toString) && (e = e.toString()),
  3517. e
  3518. }, f = function(t) {
  3519. return t.replace(/\\/g, "")
  3520. }, g = [], v = function(n, o, s, a) {
  3521. r = 1,
  3522. g.push(o),
  3523. clearTimeout(e),
  3524. e = setTimeout(function() {
  3525. r = 0;
  3526. var e = t.route.data.serialize()
  3527. , n = t.route.param(e, !0);
  3528. t.route._call("setURL", n, g),
  3529. t.batch.trigger(m, "__url", [n, i]),
  3530. i = n,
  3531. g = []
  3532. }, 10)
  3533. }, m = t.extend({}, t.event);
  3534. t.route = function(e, n) {
  3535. var i = t.route._call("root");
  3536. i.lastIndexOf("/") === i.length - 1 && 0 === e.indexOf("/") && (e = e.substr(1)),
  3537. n = n || {};
  3538. for (var r, s, a = [], u = "", c = o.lastIndex = 0, p = t.route._call("querySeparator"), h = t.route._call("matchSlashes"); r = o.exec(e); )
  3539. a.push(r[1]),
  3540. u += f(e.substring(c, o.lastIndex - r[0].length)),
  3541. s = "\\" + (f(e.substr(o.lastIndex, 1)) || p + (h ? "" : "|/")),
  3542. u += "([^" + s + "]" + (n[r[1]] ? "*" : "+") + ")",
  3543. c = o.lastIndex;
  3544. return u += e.substr(c).replace("\\", ""),
  3545. t.route.routes[e] = {
  3546. test: new RegExp("^" + u + "($|" + l(p) + ")"),
  3547. route: e,
  3548. names: a,
  3549. defaults: n,
  3550. length: e.split("/").length
  3551. },
  3552. t.route
  3553. }
  3554. ,
  3555. h(t.route, {
  3556. param: function(e, n) {
  3557. var i, r, s = 0, a = e.route, c = 0;
  3558. if (delete e.route,
  3559. p(e, function() {
  3560. c++
  3561. }),
  3562. p(t.route.routes, function(t, n) {
  3563. if ((r = u(t, e)) > s && (i = t,
  3564. s = r),
  3565. r >= c)
  3566. return !1
  3567. }),
  3568. t.route.routes[a] && u(t.route.routes[a], e) === s && (i = t.route.routes[a]),
  3569. i) {
  3570. var l, d = h({}, e), f = i.route.replace(o, function(t, n) {
  3571. return delete d[n],
  3572. e[n] === i.defaults[n] ? "" : encodeURIComponent(e[n])
  3573. }).replace("\\", "");
  3574. return p(i.defaults, function(t, e) {
  3575. d[e] === t && delete d[e]
  3576. }),
  3577. l = t.param(d),
  3578. n && t.route.attr("route", i.route),
  3579. f + (l ? t.route._call("querySeparator") + l : "")
  3580. }
  3581. return t.isEmptyObject(e) ? "" : t.route._call("querySeparator") + t.param(e)
  3582. },
  3583. deparam: function(e) {
  3584. var n = t.route._call("root");
  3585. n.lastIndexOf("/") === n.length - 1 && 0 === e.indexOf("/") && (e = e.substr(1));
  3586. var i = {
  3587. length: -1
  3588. }
  3589. , r = t.route._call("querySeparator")
  3590. , o = t.route._call("paramsMatcher");
  3591. if (p(t.route.routes, function(t, n) {
  3592. t.test.test(e) && t.length > i.length && (i = t)
  3593. }),
  3594. i.length > -1) {
  3595. var s = e.match(i.test)
  3596. , a = s.shift()
  3597. , u = e.substr(a.length - (s[s.length - 1] === r ? 1 : 0))
  3598. , c = u && o.test(u) ? t.deparam(u.slice(1)) : {};
  3599. return c = h(!0, {}, i.defaults, c),
  3600. p(s, function(t, e) {
  3601. t && t !== r && (c[i.names[e]] = decodeURIComponent(t))
  3602. }),
  3603. c.route = i.route,
  3604. c
  3605. }
  3606. return e.charAt(0) !== r && (e = r + e),
  3607. o.test(e) ? t.deparam(e.slice(1)) : {}
  3608. },
  3609. data: new t.Map({}),
  3610. map: function(e) {
  3611. var n;
  3612. n = e.prototype instanceof t.Map ? new e : e,
  3613. t.route.data = n
  3614. },
  3615. routes: {},
  3616. ready: function(e) {
  3617. return !0 !== e && (t.route._setup(),
  3618. (t.isBrowserWindow || t.isWebWorker) && t.route.setState()),
  3619. t.route
  3620. },
  3621. url: function(e, n) {
  3622. return n && (t.__observe(m, "__url"),
  3623. e = t.extend({}, t.route.deparam(t.route._call("matchingPartOfURL")), e)),
  3624. t.route._call("root") + t.route.param(e)
  3625. },
  3626. link: function(e, n, i, r) {
  3627. return "<a " + a(h({
  3628. href: t.route.url(n, r)
  3629. }, i)) + ">" + e + "</a>"
  3630. },
  3631. current: function(e) {
  3632. return t.__observe(m, "__url"),
  3633. this._call("matchingPartOfURL") === t.route.param(e)
  3634. },
  3635. bindings: {
  3636. hashchange: {
  3637. paramsMatcher: s,
  3638. querySeparator: "&",
  3639. matchSlashes: !1,
  3640. bind: function() {
  3641. t.bind.call(window, "hashchange", b)
  3642. },
  3643. unbind: function() {
  3644. t.unbind.call(window, "hashchange", b)
  3645. },
  3646. matchingPartOfURL: function() {
  3647. return (t.route.location || c).href.split(/#!?/)[1] || ""
  3648. },
  3649. setURL: function(t) {
  3650. return c.hash !== "#" + t && (c.hash = "!" + t),
  3651. t
  3652. },
  3653. root: "#!"
  3654. }
  3655. },
  3656. defaultBinding: "hashchange",
  3657. currentBinding: null,
  3658. _setup: function() {
  3659. t.route.currentBinding || (t.route._call("bind"),
  3660. t.route.bind("change", v),
  3661. t.route.currentBinding = t.route.defaultBinding)
  3662. },
  3663. _teardown: function() {
  3664. t.route.currentBinding && (t.route._call("unbind"),
  3665. t.route.unbind("change", v),
  3666. t.route.currentBinding = null),
  3667. clearTimeout(e),
  3668. r = 0
  3669. },
  3670. _call: function() {
  3671. var e = t.makeArray(arguments)
  3672. , n = e.shift()
  3673. , i = t.route.bindings[t.route.currentBinding || t.route.defaultBinding]
  3674. , r = i[n];
  3675. return r.apply ? r.apply(i, e) : r
  3676. }
  3677. }),
  3678. p(["bind", "unbind", "on", "off", "delegate", "undelegate", "removeAttr", "compute", "_get", "___get", "each"], function(e) {
  3679. t.route[e] = function() {
  3680. if (t.route.data[e])
  3681. return t.route.data[e].apply(t.route.data, arguments)
  3682. }
  3683. }),
  3684. t.route.attr = function(e, n) {
  3685. var i, r = typeof e;
  3686. return i = void 0 === n ? arguments : "string" !== r && "number" !== r ? [d(e), n] : [e, d(n)],
  3687. t.route.data.attr.apply(t.route.data, i)
  3688. }
  3689. ,
  3690. t.route.batch = t.batch;
  3691. var b = t.route.setState = function() {
  3692. var e = t.route._call("matchingPartOfURL")
  3693. , o = n;
  3694. n = t.route.deparam(e),
  3695. r && e === i || (t.route.batch.start(),
  3696. y(o, n, t.route.data),
  3697. t.route.attr(n),
  3698. t.route.batch.trigger(m, "__url", [e, i]),
  3699. t.route.batch.stop())
  3700. }
  3701. , y = function(t, e, n) {
  3702. for (var i in t)
  3703. void 0 === e[i] ? n.removeAttr(i) : "[object Object]" === Object.prototype.toString.call(t[i]) && y(t[i], e[i], n.attr(i))
  3704. };
  3705. return t.route
  3706. }),
  3707. define("can/control", ["can/util/library", "can/construct"], function(t) {
  3708. var e, n = function(e, n, i) {
  3709. return t.bind.call(e, n, i),
  3710. function() {
  3711. t.unbind.call(e, n, i)
  3712. }
  3713. }, 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) {
  3714. return t.delegate.call(e, n, i, r),
  3715. function() {
  3716. t.undelegate.call(e, n, i, r)
  3717. }
  3718. }, l = function(e, i, r, o) {
  3719. return o ? c(e, t.trim(o), i, r) : n(e, i, r)
  3720. }, p = t.Control = t.Construct({
  3721. setup: function() {
  3722. if (t.Construct.setup.apply(this, arguments),
  3723. t.Control) {
  3724. var e, n = this;
  3725. n.actions = {};
  3726. for (e in n.prototype)
  3727. n._isAction(e) && (n.actions[e] = n._action(e))
  3728. }
  3729. },
  3730. _shifter: function(e, n) {
  3731. var r = "string" == typeof n ? e[n] : n;
  3732. return i(r) || (r = e[r]),
  3733. function() {
  3734. return e.called = n,
  3735. r.apply(e, [this.nodeName ? t.$(this) : this].concat(s.call(arguments, 0)))
  3736. }
  3737. },
  3738. _isAction: function(t) {
  3739. var e = this.prototype[t]
  3740. , n = typeof e;
  3741. return "constructor" !== t && ("function" === n || "string" === n && i(this.prototype[e])) && !!(u[t] || h[t] || /[^\w]/.test(t))
  3742. },
  3743. _action: function(n, i) {
  3744. if (a.lastIndex = 0,
  3745. i || !a.test(n)) {
  3746. var r = i ? t.sub(n, this._lookup(i)) : n;
  3747. if (!r)
  3748. return null;
  3749. var o = t.isArray(r)
  3750. , s = o ? r[1] : r
  3751. , u = s.split(/\s+/g)
  3752. , c = u.pop();
  3753. return {
  3754. processor: h[c] || e,
  3755. parts: [s, u.join(" "), c],
  3756. delegate: o ? r[0] : void 0
  3757. }
  3758. }
  3759. },
  3760. _lookup: function(t) {
  3761. return [t, window]
  3762. },
  3763. processors: {},
  3764. defaults: {}
  3765. }, {
  3766. setup: function(e, n) {
  3767. var i, o = this.constructor, s = o.pluginName || o._fullName;
  3768. return this.element = t.$(e),
  3769. s && "can_control" !== s && this.element.addClass(s),
  3770. (i = t.data(this.element, "controls")) || (i = [],
  3771. t.data(this.element, "controls", i)),
  3772. i.push(this),
  3773. this.options = r({}, o.defaults, n),
  3774. this.on(),
  3775. [this.element, this.options]
  3776. },
  3777. on: function(e, n, i, r) {
  3778. if (!e) {
  3779. this.off();
  3780. var o, s, a = this.constructor, u = this._bindings, c = a.actions, p = this.element, h = t.Control._shifter(this, "destroy");
  3781. for (o in c)
  3782. 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));
  3783. return t.bind.call(p, "removed", h),
  3784. u.user.push(function(e) {
  3785. t.unbind.call(e, "removed", h)
  3786. }),
  3787. u.user.length
  3788. }
  3789. return "string" == typeof e && (r = i,
  3790. i = n,
  3791. n = e,
  3792. e = this.element),
  3793. void 0 === r && (r = i,
  3794. i = n,
  3795. n = null),
  3796. "string" == typeof r && (r = t.Control._shifter(this, r)),
  3797. this._bindings.user.push(l(e, i, r, n)),
  3798. this._bindings.user.length
  3799. },
  3800. off: function() {
  3801. var t = this.element[0]
  3802. , e = this._bindings;
  3803. e && (o(e.user || [], function(e) {
  3804. e(t)
  3805. }),
  3806. o(e.control || {}, function(e) {
  3807. e(t)
  3808. })),
  3809. this._bindings = {
  3810. user: [],
  3811. control: {}
  3812. }
  3813. },
  3814. destroy: function() {
  3815. if (null !== this.element) {
  3816. var e, n = this.constructor, i = n.pluginName || n._fullName;
  3817. this.off(),
  3818. i && "can_control" !== i && this.element.removeClass(i),
  3819. (e = t.data(this.element, "controls")).splice(t.inArray(this, e), 1),
  3820. t.trigger(this, "destroyed"),
  3821. this.element = null
  3822. }
  3823. }
  3824. }), h = t.Control.processors;
  3825. return e = function(e, n, i, r, o) {
  3826. return l(e, n, t.Control._shifter(o, r), i)
  3827. }
  3828. ,
  3829. 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) {
  3830. h[t] = e
  3831. }),
  3832. p
  3833. }),
  3834. define("can/control/route", ["can/util/library", "can/route", "can/control"], function(t) {
  3835. return t.Control.processors.route = function(e, n, i, r, o) {
  3836. i = i || "",
  3837. t.route.routes[i] || ("/" === i[0] && (i = i.substring(1)),
  3838. t.route(i));
  3839. var s, a = function(e, n, a) {
  3840. if (t.route.attr("route") === i && (void 0 === e.batchNum || e.batchNum !== s)) {
  3841. s = e.batchNum;
  3842. var u = t.route.attr();
  3843. delete u.route,
  3844. t.isFunction(o[r]) ? o[r](u) : o[o[r]](u)
  3845. }
  3846. };
  3847. return t.route.bind("change", a),
  3848. function() {
  3849. t.route.unbind("change", a)
  3850. }
  3851. }
  3852. ,
  3853. t
  3854. }),
  3855. define("can/model", ["can/util/library", "can/map", "can/list"], function(t) {
  3856. var e = function(e, n, i) {
  3857. var r = new t.Deferred;
  3858. return e.then(function() {
  3859. var e = t.makeArray(arguments)
  3860. , o = !0;
  3861. try {
  3862. e[0] = i.apply(n, e)
  3863. } catch (t) {
  3864. o = !1,
  3865. r.rejectWith(r, [t].concat(e))
  3866. }
  3867. o && r.resolveWith(r, e)
  3868. }, function() {
  3869. r.rejectWith(this, arguments)
  3870. }),
  3871. "function" == typeof e.abort && (r.abort = function() {
  3872. return e.abort()
  3873. }
  3874. ),
  3875. r
  3876. }
  3877. , n = 0
  3878. , i = function(e) {
  3879. return t.__observe(e, e.constructor.id),
  3880. e.___get(e.constructor.id)
  3881. }
  3882. , r = function(e, n, i, r, o, s) {
  3883. var a = {};
  3884. if ("string" == typeof e) {
  3885. var u = e.split(/\s+/);
  3886. a.url = u.pop(),
  3887. u.length && (a.type = u.pop())
  3888. } else
  3889. t.extend(a, e);
  3890. return a.data = "object" != typeof n || t.isArray(n) ? n : t.extend(a.data || {}, n),
  3891. a.url = t.sub(a.url, a.data, !0),
  3892. t.ajax(t.extend({
  3893. type: i || "post",
  3894. dataType: r || "json",
  3895. success: o,
  3896. error: s
  3897. }, a))
  3898. }
  3899. , o = function(n, r, o, s, a) {
  3900. var u;
  3901. t.isArray(n) ? (u = n[1],
  3902. n = n[0]) : u = n.serialize(),
  3903. u = [u];
  3904. var c, l, p = n.constructor;
  3905. return "update" !== r && "destroy" !== r || u.unshift(i(n)),
  3906. l = p[r].apply(p, u),
  3907. c = e(l, n, function(t) {
  3908. return n[a || r + "d"](t, l),
  3909. n
  3910. }),
  3911. l.abort && (c.abort = function() {
  3912. l.abort()
  3913. }
  3914. ),
  3915. c.then(o, s),
  3916. c
  3917. }
  3918. , s = {
  3919. models: function(e, n, i) {
  3920. if (t.Model._reqs++,
  3921. e) {
  3922. if (e instanceof this.List)
  3923. return e;
  3924. var r = this
  3925. , o = []
  3926. , s = r.List || f
  3927. , a = n instanceof t.List ? n : new s
  3928. , u = e instanceof f ? e.serialize() : e;
  3929. if ((u = r.parseModels(u, i)).data && (e = u,
  3930. u = u.data),
  3931. void 0 === u || !t.isArray(u))
  3932. throw new Error("Could not get any raw data while converting using .models");
  3933. return a.length && a.splice(0),
  3934. t.each(u, function(t) {
  3935. o.push(r.model(t, i))
  3936. }),
  3937. a.push.apply(a, o),
  3938. t.isArray(e) || t.each(e, function(t, e) {
  3939. "data" !== e && a.attr(e, t)
  3940. }),
  3941. setTimeout(t.proxy(this._clean, this), 1),
  3942. a
  3943. }
  3944. },
  3945. model: function(e, n, i) {
  3946. if (e) {
  3947. var r = (e = "function" == typeof e.serialize ? e.serialize() : this.parseModel(e, i))[this.id];
  3948. return (r || 0 === r) && this.store[r] && (n = this.store[r]),
  3949. n && t.isFunction(n.attr) ? n.attr(e, this.removeAttr || !1) : new this(e)
  3950. }
  3951. }
  3952. }
  3953. , a = {
  3954. parseModel: function(e) {
  3955. return function(n) {
  3956. return e ? t.getObject(e, n) : n
  3957. }
  3958. },
  3959. parseModels: function(e) {
  3960. return function(n) {
  3961. if (t.isArray(n))
  3962. return n;
  3963. e = e || "data";
  3964. var i = t.getObject(e, n);
  3965. if (!t.isArray(i))
  3966. throw new Error("Could not get any raw data while converting using .models");
  3967. return i
  3968. }
  3969. }
  3970. }
  3971. , u = {
  3972. create: {
  3973. url: "_shortName",
  3974. type: "post"
  3975. },
  3976. update: {
  3977. data: function(e, n) {
  3978. n = n || {};
  3979. var i = this.id;
  3980. return n[i] && n[i] !== e && (n["new" + t.capitalize(e)] = n[i],
  3981. delete n[i]),
  3982. n[i] = e,
  3983. n
  3984. },
  3985. type: "put"
  3986. },
  3987. destroy: {
  3988. type: "delete",
  3989. data: function(t, e) {
  3990. return e = e || {},
  3991. e.id = e[this.id] = t,
  3992. e
  3993. }
  3994. },
  3995. findAll: {
  3996. url: "_shortName"
  3997. },
  3998. findOne: {}
  3999. }
  4000. , c = function(t, e) {
  4001. return function(n) {
  4002. return n = t.data ? t.data.apply(this, arguments) : n,
  4003. r(e || this[t.url || "_url"], n, t.type || "get")
  4004. }
  4005. }
  4006. , l = function(t, e) {
  4007. if (t.resource) {
  4008. var n = t.resource.replace(/\/+$/, "");
  4009. return "findAll" === e || "create" === e ? n : n + "/{" + t.id + "}"
  4010. }
  4011. };
  4012. t.Model = t.Map.extend({
  4013. fullName: "can.Model",
  4014. _reqs: 0,
  4015. setup: function(e, i, r, o) {
  4016. if ("string" != typeof i && (o = r,
  4017. r = i),
  4018. o || (o = r),
  4019. this.store = {},
  4020. t.Map.setup.apply(this, arguments),
  4021. t.Model) {
  4022. r && r.List ? (this.List = r.List,
  4023. this.List.Map = this) : this.List = e.List.extend({
  4024. Map: this
  4025. }, {});
  4026. var p = this
  4027. , h = t.proxy(this._clean, p);
  4028. t.each(u, function(n, i) {
  4029. 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))),
  4030. p["make" + t.capitalize(i)]) {
  4031. var o = p["make" + t.capitalize(i)](p[i]);
  4032. t.Construct._overwrite(p, e, i, function() {
  4033. t.Model._reqs++;
  4034. var e = o.apply(this, arguments)
  4035. , n = e.then(h, h);
  4036. return n.abort = e.abort,
  4037. n
  4038. })
  4039. }
  4040. });
  4041. var d = {};
  4042. t.each(s, function(n, i) {
  4043. var o = "parse" + t.capitalize(i)
  4044. , s = r && r[i] || p[i];
  4045. "string" == typeof s ? (p[o] = s,
  4046. t.Construct._overwrite(p, e, i, n)) : r && r[i] && (d[o] = !0)
  4047. }),
  4048. t.each(a, function(n, i) {
  4049. var o = r && r[i] || p[i];
  4050. if ("string" == typeof o)
  4051. t.Construct._overwrite(p, e, i, n(o));
  4052. else if (!(r && t.isFunction(r[i]) || p[i])) {
  4053. var s = n();
  4054. s.useModelConverter = d[i],
  4055. t.Construct._overwrite(p, e, i, s)
  4056. }
  4057. }),
  4058. "can.Model" !== p.fullName && p.fullName || (p.fullName = "Model" + ++n),
  4059. t.Model._reqs = 0,
  4060. this._url = this._shortName + "/{" + this.id + "}"
  4061. }
  4062. },
  4063. _ajax: c,
  4064. _makeRequest: o,
  4065. _clean: function() {
  4066. if (!--t.Model._reqs)
  4067. for (var e in this.store)
  4068. this.store[e]._bindings || delete this.store[e];
  4069. return arguments[0]
  4070. },
  4071. models: s.models,
  4072. model: s.model
  4073. }, {
  4074. setup: function(e) {
  4075. var n = e && e[this.constructor.id];
  4076. t.Model._reqs && null != n && (this.constructor.store[n] = this),
  4077. t.Map.prototype.setup.apply(this, arguments)
  4078. },
  4079. isNew: function() {
  4080. var t = i(this);
  4081. return !(t || 0 === t)
  4082. },
  4083. save: function(t, e) {
  4084. return o(this, this.isNew() ? "create" : "update", t, e)
  4085. },
  4086. destroy: function(e, n) {
  4087. if (this.isNew()) {
  4088. var i = this
  4089. , r = t.Deferred();
  4090. return r.then(e, n),
  4091. r.done(function(t) {
  4092. i.destroyed(t)
  4093. }).resolve(i)
  4094. }
  4095. return o(this, "destroy", e, n, "destroyed")
  4096. },
  4097. _bindsetup: function() {
  4098. var e = this.___get(this.constructor.id);
  4099. return null != e && (this.constructor.store[e] = this),
  4100. t.Map.prototype._bindsetup.apply(this, arguments)
  4101. },
  4102. _bindteardown: function() {
  4103. return delete this.constructor.store[i(this)],
  4104. t.Map.prototype._bindteardown.apply(this, arguments)
  4105. },
  4106. ___set: function(e, n) {
  4107. t.Map.prototype.___set.call(this, e, n),
  4108. e === this.constructor.id && this._bindings && (this.constructor.store[i(this)] = this)
  4109. }
  4110. });
  4111. var p = function(t) {
  4112. return function(e, n, i) {
  4113. return this[t](e, null, i)
  4114. }
  4115. }
  4116. , h = function(t) {
  4117. return this.parseModel.useModelConverter ? this.model(t) : this.parseModel(t)
  4118. }
  4119. , d = {
  4120. makeFindAll: p("models"),
  4121. makeFindOne: p("model"),
  4122. makeCreate: h,
  4123. makeUpdate: h,
  4124. makeDestroy: h
  4125. };
  4126. t.each(d, function(n, i) {
  4127. t.Model[i] = function(i) {
  4128. return function() {
  4129. var r = t.makeArray(arguments)
  4130. , o = t.isFunction(r[1]) ? r.splice(0, 1) : r.splice(0, 2)
  4131. , s = e(i.apply(this, o), this, n);
  4132. return s.then(r[0], r[1]),
  4133. s
  4134. }
  4135. }
  4136. }),
  4137. t.each(["created", "updated", "destroyed"], function(e) {
  4138. t.Model.prototype[e] = function(n) {
  4139. var i = this.constructor;
  4140. n && "object" == typeof n && this.attr(t.isFunction(n.attr) ? n.attr() : n),
  4141. t.dispatch.call(this, {
  4142. type: e,
  4143. target: this
  4144. }, []),
  4145. t.dispatch.call(i, e, [this])
  4146. }
  4147. });
  4148. var f = t.Model.List = t.List.extend({
  4149. _bubbleRule: function(e, n) {
  4150. var i = t.List._bubbleRule(e, n);
  4151. return i.push("destroyed"),
  4152. i
  4153. }
  4154. }, {
  4155. setup: function(e) {
  4156. t.isPlainObject(e) && !t.isArray(e) ? (t.List.prototype.setup.apply(this),
  4157. this.replace(t.isDeferred(e) ? e : this.constructor.Map.findAll(e))) : t.List.prototype.setup.apply(this, arguments),
  4158. this.bind("destroyed", t.proxy(this._destroyed, this))
  4159. },
  4160. _destroyed: function(t, e) {
  4161. if (/\w+/.test(e))
  4162. for (var n; (n = this.indexOf(t.target)) > -1; )
  4163. this.splice(n, 1)
  4164. }
  4165. });
  4166. return t.Model
  4167. }),
  4168. define("can/read", ["can/util/library"], function(t) {
  4169. var e = function(t, n, r) {
  4170. for (var o, s, a = {
  4171. foundObservable: !1
  4172. }, u = i(t, 0, n, r = r || {}, a), c = n.length, l = 0; l < c; ) {
  4173. s = u;
  4174. for (var p = 0, h = e.propertyReaders.length; p < h; p++) {
  4175. var d = e.propertyReaders[p];
  4176. if (d.test(u)) {
  4177. u = d.read(u, n[l], l, r, a);
  4178. break
  4179. }
  4180. }
  4181. if (l += 1,
  4182. u = i(u, l, n, r, a, s),
  4183. o = typeof u,
  4184. l < n.length && (null === u || "function" !== o && "object" !== o))
  4185. return r.earlyExit && r.earlyExit(s, l - 1, u),
  4186. {
  4187. value: void 0,
  4188. parent: s
  4189. }
  4190. }
  4191. return void 0 === u && r.earlyExit && r.earlyExit(s, l - 1),
  4192. {
  4193. value: u,
  4194. parent: s
  4195. }
  4196. }
  4197. , n = function(t, e) {
  4198. var n = e[t - 1];
  4199. return n && n.at
  4200. }
  4201. , i = function(t, n, i, r, o, s) {
  4202. var a;
  4203. do {
  4204. a = !1;
  4205. for (var u = 0, c = e.valueReaders.length; u < c; u++)
  4206. e.valueReaders[u].test(t, n, i, r) && (t = e.valueReaders[u].read(t, n, i, r, o, s))
  4207. } while (a);return t
  4208. };
  4209. e.valueReaders = [{
  4210. name: "compute",
  4211. test: function(t, e, i, r) {
  4212. return t && t.isComputed && !n(e, i)
  4213. },
  4214. read: function(e, n, i, r, o) {
  4215. return r.isArgument && n === i.length ? e : (!o.foundObservable && r.foundObservable && (r.foundObservable(e, n),
  4216. o.foundObservable = !0),
  4217. e instanceof t.Compute ? e.get() : e())
  4218. }
  4219. }, {
  4220. name: "function",
  4221. test: function(e, n, i, r) {
  4222. return !("function" != typeof e || e.isComputed || t.Construct && e.prototype instanceof t.Construct || t.route && e === t.route)
  4223. },
  4224. read: function(e, i, r, o, s, a) {
  4225. 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 || [])
  4226. }
  4227. }],
  4228. e.propertyReaders = [{
  4229. name: "map",
  4230. test: t.isMapLike,
  4231. read: function(t, e, n, i, r) {
  4232. !r.foundObservable && i.foundObservable && (i.foundObservable(t, n),
  4233. r.foundObservable = !0);
  4234. var o = t[e.key];
  4235. return "function" != typeof o || t.constructor.prototype[e.key] !== o || o.isComputed ? t.attr(e.key) : o
  4236. }
  4237. }, {
  4238. name: "promise",
  4239. test: function(e) {
  4240. return t.isPromise(e)
  4241. },
  4242. read: function(e, n, i, r, o) {
  4243. !o.foundObservable && r.foundObservable && (r.foundObservable(e, i),
  4244. o.foundObservable = !0);
  4245. var s = e.__observeData;
  4246. return e.__observeData || (s = e.__observeData = {
  4247. isPending: !0,
  4248. state: "pending",
  4249. isResolved: !1,
  4250. isRejected: !1,
  4251. value: void 0,
  4252. reason: void 0
  4253. },
  4254. t.cid(s),
  4255. t.simpleExtend(s, t.event),
  4256. e.then(function(t) {
  4257. s.isPending = !1,
  4258. s.isResolved = !0,
  4259. s.value = t,
  4260. s.state = "resolved",
  4261. s.dispatch("state", ["resolved", "pending"])
  4262. }, function(t) {
  4263. s.isPending = !1,
  4264. s.isRejected = !0,
  4265. s.reason = t,
  4266. s.state = "rejected",
  4267. s.dispatch("state", ["rejected", "pending"])
  4268. })),
  4269. t.__observe(s, "state"),
  4270. n.key in s ? s[n.key] : e[n.key]
  4271. }
  4272. }, {
  4273. name: "object",
  4274. test: function() {
  4275. return !0
  4276. },
  4277. read: function(t, e) {
  4278. if (null != t)
  4279. return e.key in t ? t[e.key] : e.at && r[e.key] && "@" + e.key in t ? (e.at = !1,
  4280. t["@" + e.key]) : void 0
  4281. }
  4282. }];
  4283. var r = {
  4284. index: !0,
  4285. key: !0,
  4286. event: !0,
  4287. element: !0,
  4288. viewModel: !0
  4289. };
  4290. return e.write = function(e, n, i, r) {
  4291. return r = r || {},
  4292. 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))
  4293. }
  4294. ,
  4295. e.reads = function(t) {
  4296. var e = []
  4297. , n = 0
  4298. , i = !1;
  4299. "@" === t.charAt(0) && (n = 1,
  4300. i = !0);
  4301. for (var r = "", o = n; o < t.length; o++) {
  4302. var s = t.charAt(o);
  4303. "." === s || "@" === s ? "\\" !== t.charAt(o - 1) ? (e.push({
  4304. key: r,
  4305. at: i
  4306. }),
  4307. i = "@" === s,
  4308. r = "") : r = r.substr(0, r.length - 1) + "." : r += s
  4309. }
  4310. return e.push({
  4311. key: r,
  4312. at: i
  4313. }),
  4314. e
  4315. }
  4316. ,
  4317. e
  4318. }),
  4319. define("can/get_value_and_bind", ["can/util/library"], function(t) {
  4320. function e(e, n, i) {
  4321. this.newObserved = {},
  4322. this.oldObserved = null,
  4323. this.func = e,
  4324. this.context = n,
  4325. this.compute = i,
  4326. this.onDependencyChange = t.proxy(this.onDependencyChange, this),
  4327. this.depth = null,
  4328. this.childDepths = {},
  4329. this.ignore = 0,
  4330. this.inBatch = !1,
  4331. i.observedInfo = this
  4332. }
  4333. t.simpleExtend(e.prototype, {
  4334. getDepth: function() {
  4335. return null !== this.depth ? this.depth : this.depth = this._getDepth()
  4336. },
  4337. _getDepth: function() {
  4338. var t = 0
  4339. , e = this.childDepths;
  4340. for (var n in e)
  4341. e[n] > t && (t = e[n]);
  4342. return t + 1
  4343. },
  4344. addEdge: function(t) {
  4345. t.obj.bind(t.event, this.onDependencyChange),
  4346. t.obj.observedInfo && (this.childDepths[t.obj._cid] = t.obj.observedInfo.getDepth(),
  4347. this.depth = null)
  4348. },
  4349. removeEdge: function(t) {
  4350. t.obj.unbind(t.event, this.onDependencyChange),
  4351. t.obj.observedInfo && (delete this.childDepths[t.obj._cid],
  4352. this.depth = null)
  4353. },
  4354. onDependencyChange: function(t) {
  4355. this.bound && (void 0 !== t.batchNum ? t.batchNum !== this.batchNum && (e.registerUpdate(this),
  4356. this.batchNum = t.batchNum) : this.updateCompute(t.batchNum))
  4357. },
  4358. updateCompute: function(t) {
  4359. var e = this.value;
  4360. this.getValueAndBind(),
  4361. this.compute.updater(this.value, e, t)
  4362. },
  4363. getValueAndBind: function() {
  4364. this.bound = !0,
  4365. this.oldObserved = this.newObserved || {},
  4366. this.ignore = 0,
  4367. this.newObserved = {},
  4368. o.push(this),
  4369. this.value = this.func.call(this.context),
  4370. o.pop(),
  4371. this.updateBindings()
  4372. },
  4373. updateBindings: function() {
  4374. var t, e, n = this.newObserved, i = this.oldObserved;
  4375. for (t in n)
  4376. e = n[t],
  4377. i[t] ? i[t] = null : this.addEdge(e);
  4378. for (t in i)
  4379. (e = i[t]) && this.removeEdge(e)
  4380. },
  4381. teardown: function() {
  4382. this.bound = !1;
  4383. for (var t in this.newObserved) {
  4384. var e = this.newObserved[t];
  4385. this.removeEdge(e)
  4386. }
  4387. this.newObserved = {}
  4388. }
  4389. });
  4390. var n = []
  4391. , i = 1 / 0
  4392. , r = 0;
  4393. e.registerUpdate = function(t, e) {
  4394. var o = t.getDepth() - 1;
  4395. i = Math.min(o, i),
  4396. r = Math.max(r, o);
  4397. var s = n[o];
  4398. s || (s = n[o] = []),
  4399. s.push(t)
  4400. }
  4401. ,
  4402. e.batchEnd = function(t) {
  4403. for (var e; i <= r; ) {
  4404. var o = n[i];
  4405. o && (e = o.pop()) ? e.updateCompute(t) : i++
  4406. }
  4407. n = [],
  4408. i = 1 / 0,
  4409. r = 0
  4410. }
  4411. ;
  4412. var o = [];
  4413. return t.__observe = function(t, e) {
  4414. var n = o[o.length - 1];
  4415. if (n) {
  4416. var i = e + ""
  4417. , r = t._cid + "|" + i;
  4418. n.traps ? n.traps.push({
  4419. obj: t,
  4420. event: i,
  4421. name: r
  4422. }) : n.ignore || n.newObserved[r] || (n.newObserved[r] = {
  4423. obj: t,
  4424. event: i
  4425. })
  4426. }
  4427. }
  4428. ,
  4429. t.__reading = t.__observe,
  4430. t.__trapObserves = function() {
  4431. if (o.length) {
  4432. var t = o[o.length - 1]
  4433. , e = t.traps = [];
  4434. return function() {
  4435. return t.traps = null,
  4436. e
  4437. }
  4438. }
  4439. return function() {
  4440. return []
  4441. }
  4442. }
  4443. ,
  4444. t.__observes = function(t) {
  4445. var e = o[o.length - 1];
  4446. if (e)
  4447. for (var n = 0, i = t.length; n < i; n++) {
  4448. var r = t[n]
  4449. , s = r.name;
  4450. e.newObserved[s] || (e.newObserved[s] = r)
  4451. }
  4452. }
  4453. ,
  4454. t.__isRecordingObserves = function() {
  4455. var t = o.length;
  4456. return t && 0 === o[t - 1].ignore
  4457. }
  4458. ,
  4459. t.__notObserve = function(t) {
  4460. return function() {
  4461. if (o.length) {
  4462. var e = o[o.length - 1];
  4463. e.ignore++;
  4464. var n = t.apply(this, arguments);
  4465. return e.ignore--,
  4466. n
  4467. }
  4468. return t.apply(this, arguments)
  4469. }
  4470. }
  4471. ,
  4472. t.batch._onDispatchedEvents = e.batchEnd,
  4473. e
  4474. }),
  4475. 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) {
  4476. t.Compute = function(e, n, i, r) {
  4477. t.cid(this, "compute");
  4478. for (var o = [], s = 0, a = arguments.length; s < a; s++)
  4479. o[s] = arguments[s];
  4480. var u = typeof o[1];
  4481. "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]),
  4482. this._args = o,
  4483. this.isComputed = !0
  4484. }
  4485. ,
  4486. t.simpleExtend(t.Compute.prototype, {
  4487. _setupGetterSetterFn: function(e, n, i) {
  4488. this._set = n ? t.proxy(e, n) : e,
  4489. this._get = n ? t.proxy(e, n) : e,
  4490. this._canObserve = !1 !== i;
  4491. var r = o(this, e, n || this);
  4492. this._on = r.on,
  4493. this._off = r.off
  4494. },
  4495. _setupProperty: function(e, n, i) {
  4496. var r, o = this;
  4497. t.isMapLike(e) ? (r = function(t, e, n) {
  4498. o.updater(e, n, t.batchNum)
  4499. }
  4500. ,
  4501. this.hasDependencies = !0,
  4502. this._get = function() {
  4503. return e.attr(n)
  4504. }
  4505. ,
  4506. this._set = function(t) {
  4507. e.attr(n, t)
  4508. }
  4509. ) : (r = function() {
  4510. o.updater(o._get(), o.value)
  4511. }
  4512. ,
  4513. this._get = function() {
  4514. return t.getObject(n, [e])
  4515. }
  4516. ,
  4517. this._set = function(i) {
  4518. var r = n.split(".")
  4519. , o = r.pop();
  4520. t.getObject(r.join("."), [e])[o] = i
  4521. }
  4522. ),
  4523. this._on = function(o) {
  4524. t.bind.call(e, i || n, r),
  4525. this.value = this._get()
  4526. }
  4527. ,
  4528. this._off = function() {
  4529. return t.unbind.call(e, i || n, r)
  4530. }
  4531. },
  4532. _setupSetter: function(e, n, i) {
  4533. this.value = e,
  4534. this._set = n,
  4535. t.simpleExtend(this, i)
  4536. },
  4537. _setupSettings: function(t, e) {
  4538. if (this.value = t,
  4539. this._set = e.set || this._set,
  4540. this._get = e.get || this._get,
  4541. !e.__selfUpdater) {
  4542. var n = this
  4543. , i = this.updater;
  4544. this.updater = function() {
  4545. i.call(n, n._get(), n.value)
  4546. }
  4547. }
  4548. this._on = e.on ? e.on : this._on,
  4549. this._off = e.off ? e.off : this._off
  4550. },
  4551. _setupAsyncCompute: function(e, n) {
  4552. var i = this;
  4553. this.value = e,
  4554. this._setUpdates = !0,
  4555. this.lastSetValue = new t.Compute(e),
  4556. this._set = function(t) {
  4557. return t === i.lastSetValue.get() ? this.value : i.lastSetValue.set(t)
  4558. }
  4559. ,
  4560. this._get = function() {
  4561. return s.call(n.context, i.lastSetValue.get())
  4562. }
  4563. ;
  4564. var r, s = n.fn;
  4565. if (0 === s.length)
  4566. r = o(this, s, n.context);
  4567. else if (1 === s.length)
  4568. r = o(this, function() {
  4569. return s.call(n.context, i.lastSetValue.get())
  4570. }, n);
  4571. else {
  4572. var a = this.updater
  4573. , u = function(t) {
  4574. a.call(i, t, i.value)
  4575. };
  4576. this.updater = function(t) {
  4577. a.call(i, t, i.value)
  4578. }
  4579. ,
  4580. r = o(this, function() {
  4581. var t = s.call(n.context, i.lastSetValue.get(), u);
  4582. return void 0 !== t ? t : this.value
  4583. }, this)
  4584. }
  4585. this._on = r.on,
  4586. this._off = r.off
  4587. },
  4588. _setupSimpleValue: function(t) {
  4589. this.value = t
  4590. },
  4591. _bindsetup: t.__notObserve(function() {
  4592. this.bound = !0,
  4593. this._on(this.updater)
  4594. }),
  4595. _bindteardown: function() {
  4596. this._off(this.updater),
  4597. this.bound = !1
  4598. },
  4599. bind: t.bindAndSetup,
  4600. unbind: t.unbindAndTeardown,
  4601. clone: function(e) {
  4602. return e && "function" == typeof this._args[0] ? this._args[1] = e : e && (this._args[2] = e),
  4603. new t.Compute(this._args[0],this._args[1],this._args[2],this._args[3])
  4604. },
  4605. _on: t.k,
  4606. _off: t.k,
  4607. get: function() {
  4608. return t.__isRecordingObserves() && !1 !== this._canObserve && (t.__observe(this, "change"),
  4609. this.bound || t.Compute.temporarilyBind(this)),
  4610. this.bound ? this.value : this._get()
  4611. },
  4612. _get: function() {
  4613. return this.value
  4614. },
  4615. set: function(t) {
  4616. var e = this.value
  4617. , n = this._set(t, e);
  4618. return this._setUpdates ? this.value : this.hasDependencies ? this._get() : (this.value = void 0 === n ? this._get() : n,
  4619. r(this, this.value, e),
  4620. this.value)
  4621. },
  4622. _set: function(t) {
  4623. return this.value = t
  4624. },
  4625. updater: function(t, e, n) {
  4626. this.value = t,
  4627. r(this, t, e, n)
  4628. },
  4629. toFunction: function() {
  4630. return t.proxy(this._computeFn, this)
  4631. },
  4632. _computeFn: function(t) {
  4633. return arguments.length ? this.set(t) : this.get()
  4634. }
  4635. });
  4636. var r = function(e, n, i, r) {
  4637. n !== i && !(n !== n && i !== i) && t.batch.trigger(e, {
  4638. type: "change",
  4639. batchNum: r
  4640. }, [n, i])
  4641. }
  4642. , o = function(e, n, r) {
  4643. var o = new i(n,r,e);
  4644. return {
  4645. on: function() {
  4646. o.getValueAndBind(),
  4647. e.value = o.value,
  4648. e.hasDependencies = !t.isEmptyObject(o.newObserved)
  4649. },
  4650. off: function() {
  4651. o.teardown()
  4652. }
  4653. }
  4654. };
  4655. t.Compute.temporarilyBind = function(e) {
  4656. var n = e.computeInstance || e;
  4657. n.bind("change", t.k),
  4658. s || (s = [],
  4659. setTimeout(a, 10)),
  4660. s.push(n)
  4661. }
  4662. ;
  4663. var s, a = function() {
  4664. for (var e = 0, n = s.length; e < n; e++)
  4665. s[e].unbind("change", t.k);
  4666. s = null
  4667. };
  4668. return t.Compute.async = function(e, n, i) {
  4669. return new t.Compute(e,{
  4670. fn: n,
  4671. context: i
  4672. })
  4673. }
  4674. ,
  4675. t.Compute.truthy = function(e) {
  4676. return new t.Compute(function() {
  4677. var t = e.get();
  4678. return "function" == typeof t && (t = t.get()),
  4679. !!t
  4680. }
  4681. )
  4682. }
  4683. ,
  4684. t.Compute.read = n,
  4685. t.Compute.set = n.write,
  4686. t.Compute
  4687. }),
  4688. define("can/compute", ["can/util/library", "can/util/bind", "can/util/batch", "can/proto_compute"], function(t, e) {
  4689. return t.compute = function(e, n, i, r) {
  4690. var o = new t.Compute(e,n,i,r)
  4691. , s = o.bind
  4692. , a = o.unbind
  4693. , u = function(t) {
  4694. return arguments.length ? o.set(t) : o.get()
  4695. }
  4696. , c = "__handler" + t.cid(u, "compute");
  4697. return u.bind = function(t, e) {
  4698. var n = e && e[c];
  4699. return e && !n && (n = e[c] = function() {
  4700. e.apply(u, arguments)
  4701. }
  4702. ),
  4703. s.call(o, t, n)
  4704. }
  4705. ,
  4706. u.unbind = function(t, e) {
  4707. var n = e && e[c];
  4708. return n ? (delete e[c],
  4709. o.unbind(t, n)) : a.apply(o, arguments)
  4710. }
  4711. ,
  4712. u.isComputed = o.isComputed,
  4713. u.clone = function(i) {
  4714. return "function" == typeof e && (n = i),
  4715. t.compute(e, n, i, r)
  4716. }
  4717. ,
  4718. u.computeInstance = o,
  4719. u
  4720. }
  4721. ,
  4722. t.compute.truthy = function(e) {
  4723. return t.compute(function() {
  4724. var t = e();
  4725. return "function" == typeof t && (t = t()),
  4726. !!t
  4727. })
  4728. }
  4729. ,
  4730. t.compute.async = function(e, n, i) {
  4731. return t.compute(e, {
  4732. fn: n,
  4733. context: i
  4734. })
  4735. }
  4736. ,
  4737. t.compute.read = t.Compute.read,
  4738. t.compute.set = t.Compute.set,
  4739. t.compute.temporarilyBind = t.Compute.temporarilyBind,
  4740. t.compute
  4741. }),
  4742. define("can/map/define", ["can/util/library", "can/map_helpers", "can/map", "can/compute"], function(t, e) {
  4743. if (!t.define) {
  4744. var n = t.define = {}
  4745. , i = function(t, e, n) {
  4746. var i, r;
  4747. if (n) {
  4748. if (i = n[e],
  4749. r = n["*"],
  4750. i && void 0 !== i[t])
  4751. return i[t];
  4752. if (r && void 0 !== r[t])
  4753. return r[t]
  4754. }
  4755. };
  4756. e.define = function(e) {
  4757. var i = e.prototype.define;
  4758. e.defaultGenerators = {};
  4759. for (var r in i) {
  4760. var o = i[r].type;
  4761. "string" == typeof o && "object" == typeof n.types[o] && (delete i[r].type,
  4762. t.extend(i[r], n.types[o])),
  4763. "value"in i[r] && ("function" == typeof i[r].value ? e.defaultGenerators[r] = i[r].value : e.defaults[r] = i[r].value),
  4764. "function" == typeof i[r].Value && function(t) {
  4765. e.defaultGenerators[r] = function() {
  4766. return new t
  4767. }
  4768. }(i[r].Value)
  4769. }
  4770. }
  4771. ;
  4772. var r = t.Map.prototype._setupDefaults;
  4773. t.Map.prototype._setupDefaults = function(t) {
  4774. var e = r.call(this)
  4775. , n = {}
  4776. , i = this.constructor
  4777. , o = this._get;
  4778. this._get = function(t) {
  4779. var i = -1 !== t.indexOf(".") ? t.substr(0, t.indexOf(".")) : t;
  4780. return i in e && !(i in n) && (this.attr(i, e[i]),
  4781. n[i] = !0),
  4782. o.apply(this, arguments)
  4783. }
  4784. ;
  4785. for (var s in i.defaultGenerators)
  4786. t && s in t || (e[s] = i.defaultGenerators[s].call(this));
  4787. return delete this._get,
  4788. e
  4789. }
  4790. ;
  4791. var o = t.Map.prototype
  4792. , s = o.__set;
  4793. o.__set = function(e, n, r, o, a) {
  4794. var u = function(n) {
  4795. return !1 !== (a && a.call(c, n)) && t.trigger(c, "error", [e, n], !0),
  4796. !1
  4797. }
  4798. , c = this
  4799. , l = i("set", e, this.define)
  4800. , p = i("get", e, this.define);
  4801. if (l) {
  4802. t.batch.start();
  4803. var h = !1
  4804. , d = l.call(this, n, function(t) {
  4805. p ? c[e](t) : s.call(c, e, t, r, o, u),
  4806. h = !0
  4807. }, u, p ? this._computedAttrs[e].compute.computeInstance.lastSetValue.get() : r);
  4808. return p ? (void 0 !== d && !h && l.length >= 1 && this._computedAttrs[e].compute(d),
  4809. 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),
  4810. t.batch.stop(),
  4811. this)
  4812. }
  4813. return s.call(c, e, n, r, o, u),
  4814. this
  4815. }
  4816. ,
  4817. n.types = {
  4818. date: function(t) {
  4819. var e = typeof t;
  4820. return "string" === e ? (t = Date.parse(t),
  4821. isNaN(t) ? null : new Date(t)) : "number" === e ? new Date(t) : t
  4822. },
  4823. number: function(t) {
  4824. return null == t ? t : +t
  4825. },
  4826. boolean: function(t) {
  4827. return !("false" === t || "0" === t || !t)
  4828. },
  4829. htmlbool: function(t) {
  4830. return "string" == typeof t || !!t
  4831. },
  4832. "*": function(t) {
  4833. return t
  4834. },
  4835. string: function(t) {
  4836. return null == t ? t : "" + t
  4837. },
  4838. compute: {
  4839. set: function(t, e, n, i) {
  4840. return t.isComputed ? t : i && i.isComputed ? (i(t),
  4841. i) : t
  4842. },
  4843. get: function(t) {
  4844. return t && t.isComputed ? t() : t
  4845. }
  4846. }
  4847. };
  4848. var a = o.__type;
  4849. o.__type = function(e, r) {
  4850. var o = i("type", r, this.define)
  4851. , s = i("Type", r, this.define)
  4852. , u = e;
  4853. return "string" == typeof o && (o = n.types[o]),
  4854. o || s ? (o && (u = o.call(this, u, r)),
  4855. !s || u instanceof s || (u = new s(u)),
  4856. u) : (t.isPlainObject(u) && u.define && (u = t.Map.extend(u),
  4857. u = new u),
  4858. a.call(this, u, r))
  4859. }
  4860. ;
  4861. var u = o.__remove;
  4862. o.__remove = function(e, n) {
  4863. var r, o = i("remove", e, this.define);
  4864. return o ? (t.batch.start(),
  4865. !1 === (r = o.call(this, n)) ? void t.batch.stop() : (r = u.call(this, e, n),
  4866. t.batch.stop(),
  4867. r)) : u.call(this, e, n)
  4868. }
  4869. ;
  4870. var c = o._setupComputedProperties;
  4871. o._setupComputedProperties = function() {
  4872. c.apply(this, arguments);
  4873. for (var n in this.define) {
  4874. var i = this.define[n].get;
  4875. i && e.addComputedAttr(this, n, t.compute.async(void 0, i, this))
  4876. }
  4877. }
  4878. ;
  4879. var l = o.___serialize;
  4880. o.___serialize = function(t, e) {
  4881. return p(this, t, e)
  4882. }
  4883. ;
  4884. var p = function(t, e, n) {
  4885. var r = "*" !== e && i("serialize", e, t.define);
  4886. 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
  4887. }
  4888. , h = o.serialize;
  4889. return o.serialize = function(t) {
  4890. var e = h.apply(this, arguments);
  4891. if (t)
  4892. return e;
  4893. var n;
  4894. for (var i in this.define)
  4895. i in e || this.define && this.define[i] && this.define[i].serialize && void 0 !== (n = p(this, i, this.attr(i))) && (e[i] = n);
  4896. return e
  4897. }
  4898. ,
  4899. t.define
  4900. }
  4901. }),
  4902. define("can/view/compute_data", ["can/util/library", "can/compute", "can/get_value_and_bind"], function(t, e, n) {
  4903. var i = function(e) {
  4904. return e.reads && 1 === e.reads.length && e.root instanceof t.Map && !t.isFunction(e.root[e.reads[0].key])
  4905. }
  4906. , r = function(t, e, n) {
  4907. var i = e.root
  4908. , r = e.reads[0].key;
  4909. i.bind(r, n),
  4910. t.value = e.initialValue
  4911. }
  4912. , o = function(t, e) {
  4913. t.root.unbind(t.reads[0].key, e)
  4914. }
  4915. , s = function(e, n, i, r, o) {
  4916. if (!(arguments.length > 4)) {
  4917. if (r.root)
  4918. return t.compute.read(r.root, r.reads, i).value;
  4919. var s = e.read(n, i);
  4920. return r.scope = s.scope,
  4921. r.initialValue = s.value,
  4922. r.reads = s.reads,
  4923. r.root = s.rootObserve,
  4924. r.setRoot = s.setRoot,
  4925. s.value
  4926. }
  4927. var a = r.root || r.setRoot;
  4928. if (a)
  4929. if (a.isComputed)
  4930. a(o);
  4931. else if (r.reads.length) {
  4932. var u = r.reads.length - 1
  4933. , c = r.reads.length ? t.compute.read(a, r.reads.slice(0, u)).value : a;
  4934. t.compute.set(c, r.reads[u].key, o, i)
  4935. }
  4936. };
  4937. return function(e, a, u) {
  4938. u = u || {
  4939. args: []
  4940. };
  4941. var c = {}
  4942. , l = function(t) {
  4943. return arguments.length ? s(e, a, u, c, t) : s(e, a, u, c)
  4944. }
  4945. , p = function(t, e, n) {
  4946. "function" != typeof e ? d.computeInstance.updater(e, n, t.batchNum) : (o(c, p),
  4947. f.getValueAndBind(),
  4948. h = !1,
  4949. d.computeInstance.updater(f.value, n, t.batchNum))
  4950. }
  4951. , h = !1
  4952. , d = t.compute(void 0, {
  4953. on: function() {
  4954. f.getValueAndBind(),
  4955. i(c) && (r(f, c, p),
  4956. f.teardown(),
  4957. f.newObserved = {},
  4958. h = !0),
  4959. d.computeInstance.value = f.value,
  4960. d.computeInstance.hasDependencies = h || !t.isEmptyObject(f.newObserved)
  4961. },
  4962. off: function() {
  4963. h ? o(c, p) : f.teardown()
  4964. },
  4965. set: l,
  4966. get: l,
  4967. __selfUpdater: !0
  4968. })
  4969. , f = new n(l,null,d.computeInstance);
  4970. return c.compute = d,
  4971. c
  4972. }
  4973. }),
  4974. define("can/view", ["can/util/library"], function(t) {
  4975. var e = t.isFunction
  4976. , n = t.makeArray
  4977. , i = 1
  4978. , r = function(t) {
  4979. var e = function() {
  4980. return c.frag(t.apply(this, arguments))
  4981. };
  4982. return e.render = function() {
  4983. return t.apply(t, arguments)
  4984. }
  4985. ,
  4986. e
  4987. }
  4988. , o = function(t, e) {
  4989. if (!t.length)
  4990. throw new Error("can.view: No template or empty template:" + e)
  4991. }
  4992. , s = function(n, i) {
  4993. if (e(n))
  4994. return t.Deferred().resolve(n);
  4995. var r, s, a, u = "string" == typeof n ? n : n.url, l = n.engine && "." + n.engine || u.match(/\.[\w\d]+$/);
  4996. if (u.match(/^#/) && (u = u.substr(1)),
  4997. (s = document.getElementById(u)) && (l = "." + s.type.match(/\/(x\-)?(.+)/)[2]),
  4998. l || c.cached[u] || (u += l = c.ext),
  4999. t.isArray(l) && (l = l[0]),
  5000. a = c.toId(u),
  5001. u.match(/^\/\//) && (u = u.substr(2),
  5002. u = window.steal ? steal.config().root.mapJoin("" + steal.id(u)) : u),
  5003. window.require && require.toUrl && (u = require.toUrl(u)),
  5004. r = c.types[l],
  5005. c.cached[a])
  5006. return c.cached[a];
  5007. if (s)
  5008. return c.registerView(a, s.innerHTML, r);
  5009. var p = new t.Deferred;
  5010. return t.ajax({
  5011. async: i,
  5012. url: u,
  5013. dataType: "text",
  5014. error: function(t) {
  5015. o("", u),
  5016. p.reject(t)
  5017. },
  5018. success: function(t) {
  5019. o(t, u),
  5020. c.registerView(a, t, r, p)
  5021. }
  5022. }),
  5023. p
  5024. }
  5025. , a = function(e) {
  5026. var n = [];
  5027. if (t.isDeferred(e))
  5028. return [e];
  5029. for (var i in e)
  5030. t.isDeferred(e[i]) && n.push(e[i]);
  5031. return n
  5032. }
  5033. , u = function(e) {
  5034. return t.isArray(e) && "success" === e[1] ? e[0] : e
  5035. }
  5036. , c = t.view = t.template = function(t, n, i, r) {
  5037. return e(i) && (r = i,
  5038. i = void 0),
  5039. c.renderAs("fragment", t, n, i, r)
  5040. }
  5041. ;
  5042. return t.extend(c, {
  5043. frag: function(t, e) {
  5044. return c.hookup(c.fragment(t), e)
  5045. },
  5046. fragment: function(e) {
  5047. if ("string" != typeof e && 11 === e.nodeType)
  5048. return e;
  5049. var n = t.buildFragment(e, document.body);
  5050. return n.childNodes.length || n.appendChild(document.createTextNode("")),
  5051. n
  5052. },
  5053. toId: function(e) {
  5054. return t.map(e.toString().split(/\/|\./g), function(t) {
  5055. if (t)
  5056. return t
  5057. }).join("_")
  5058. },
  5059. toStr: function(t) {
  5060. return null == t ? "" : "" + t
  5061. },
  5062. hookup: function(e, n) {
  5063. var i, r, o = [];
  5064. return t.each(e.childNodes ? t.makeArray(e.childNodes) : e, function(e) {
  5065. 1 === e.nodeType && (o.push(e),
  5066. o.push.apply(o, t.makeArray(e.getElementsByTagName("*"))))
  5067. }),
  5068. t.each(o, function(t) {
  5069. t.getAttribute && (i = t.getAttribute("data-view-id")) && (r = c.hookups[i]) && (r(t, n, i),
  5070. delete c.hookups[i],
  5071. t.removeAttribute("data-view-id"))
  5072. }),
  5073. e
  5074. },
  5075. hookups: {},
  5076. hook: function(t) {
  5077. return c.hookups[++i] = t,
  5078. " data-view-id='" + i + "'"
  5079. },
  5080. cached: {},
  5081. cachedRenderers: {},
  5082. cache: !0,
  5083. register: function(e) {
  5084. this.types["." + e.suffix] = e,
  5085. t[e.suffix] = c[e.suffix] = function(t, n) {
  5086. var i, o;
  5087. if (!n)
  5088. return o = function() {
  5089. return i || (i = e.fragRenderer ? e.fragRenderer(null, t) : r(e.renderer(null, t))),
  5090. i.apply(this, arguments)
  5091. }
  5092. ,
  5093. o.render = function() {
  5094. var n = e.renderer(null, t);
  5095. return n.apply(n, arguments)
  5096. }
  5097. ,
  5098. o;
  5099. var s = function() {
  5100. return i || (i = e.fragRenderer ? e.fragRenderer(t, n) : e.renderer(t, n)),
  5101. i.apply(this, arguments)
  5102. };
  5103. return e.fragRenderer ? c.preload(t, s) : c.preloadStringRenderer(t, s)
  5104. }
  5105. },
  5106. types: {},
  5107. ext: ".ejs",
  5108. registerScript: function(t, e, n) {
  5109. return "can.view.preloadStringRenderer('" + e + "'," + c.types["." + t].script(e, n) + ");"
  5110. },
  5111. preload: function(e, n) {
  5112. return (c.cached[e] = (new t.Deferred).resolve(function(t, e) {
  5113. return n.call(t, t, e)
  5114. })).__view_id = e,
  5115. c.cachedRenderers[e] = n,
  5116. n
  5117. },
  5118. preloadStringRenderer: function(t, e) {
  5119. return this.preload(t, r(e))
  5120. },
  5121. render: function(e, n, i, r) {
  5122. return t.view.renderAs("string", e, n, i, r)
  5123. },
  5124. renderTo: function(t, e, n, i) {
  5125. return ("string" === t && e.render ? e.render : e)(n, i)
  5126. },
  5127. renderAs: function(i, r, o, l, p) {
  5128. e(l) && (p = l,
  5129. l = void 0);
  5130. var h, d, f, g, v = a(o);
  5131. if (v.length)
  5132. return h = new t.Deferred,
  5133. d = t.extend({}, o),
  5134. v.push(s(r, !0)),
  5135. t.when.apply(t, v).then(function(e) {
  5136. var r, s = n(arguments), a = s.pop();
  5137. if (t.isDeferred(o))
  5138. d = u(e);
  5139. else
  5140. for (var c in o)
  5141. t.isDeferred(o[c]) && (d[c] = u(s.shift()));
  5142. r = t.view.renderTo(i, a, d, l),
  5143. h.resolve(r, d),
  5144. p && p(r, d)
  5145. }, function() {
  5146. h.reject.apply(h, arguments)
  5147. }),
  5148. h;
  5149. if (f = e(p),
  5150. h = t.__notObserve(s)(r, f),
  5151. f)
  5152. g = h,
  5153. h.then(function(e) {
  5154. p(o ? t.view.renderTo(i, e, o, l) : e)
  5155. });
  5156. else {
  5157. if ("resolved" === h.state() && h.__view_id) {
  5158. var m = c.cachedRenderers[h.__view_id];
  5159. return o ? t.view.renderTo(i, m, o, l) : m
  5160. }
  5161. h.then(function(e) {
  5162. g = o ? t.view.renderTo(i, e, o, l) : e
  5163. })
  5164. }
  5165. return g
  5166. },
  5167. registerView: function(e, n, i, o) {
  5168. var s, a = "object" == typeof i ? i : c.types[i || c.ext];
  5169. return s = a.fragRenderer ? a.fragRenderer(e, n) : r(a.renderer(e, n)),
  5170. o = o || new t.Deferred,
  5171. c.cache && (c.cached[e] = o,
  5172. o.__view_id = e,
  5173. c.cachedRenderers[e] = s),
  5174. o.resolve(s)
  5175. },
  5176. simpleHelper: function(e) {
  5177. return function() {
  5178. var n = [];
  5179. return t.each(arguments, function(t, e) {
  5180. if (e <= arguments.length) {
  5181. for (; t && t.isComputed; )
  5182. t = t();
  5183. n.push(t)
  5184. }
  5185. }),
  5186. e.apply(this, n)
  5187. }
  5188. }
  5189. }),
  5190. t
  5191. }),
  5192. define("can/view/scope", ["can/util/library", "can/view/compute_data", "can/construct", "can/map", "can/list", "can/view", "can/compute"], function(t, e) {
  5193. function n(t, e, n) {
  5194. this._context = t,
  5195. this._parent = e,
  5196. this._meta = n || {},
  5197. this.__cache = {}
  5198. }
  5199. function i(t, e, i) {
  5200. t.helpers || t.partials || t.tags || (t = {
  5201. helpers: t
  5202. }),
  5203. n.call(this, t, e, i)
  5204. }
  5205. return t.simpleExtend(n, {
  5206. read: t.compute.read,
  5207. Refs: t.Map.extend({
  5208. shortName: "ReferenceMap"
  5209. }, {}),
  5210. refsScope: function() {
  5211. return new t.view.Scope(new this.Refs)
  5212. }
  5213. }),
  5214. t.simpleExtend(n.prototype, {
  5215. add: function(t, e) {
  5216. return t !== this._context ? new this.constructor(t,this,e) : this
  5217. },
  5218. read: function(e, n) {
  5219. if ("%root" === e)
  5220. return {
  5221. value: this.getRoot()
  5222. };
  5223. var i = "./" === e.substr(0, 2)
  5224. , r = "../" === e.substr(0, 3)
  5225. , o = "." === e || "this" === e
  5226. , s = ".." === e;
  5227. if ((i || r || o || s) && this._meta.notContext)
  5228. return this._parent.read(e, n);
  5229. var a;
  5230. if (i)
  5231. a = !0,
  5232. e = e.substr(2);
  5233. else {
  5234. if (r) {
  5235. for (var u = this._parent; u._meta.notContext; )
  5236. u = u._parent;
  5237. return u.read(e.substr(3), n)
  5238. }
  5239. if (o)
  5240. return {
  5241. value: this._context
  5242. };
  5243. if (s)
  5244. return {
  5245. value: this._parent._context
  5246. }
  5247. }
  5248. var c = t.compute.read.reads(e);
  5249. return "*" === c[0].key.charAt(0) ? this.getRefs()._read(c, n, !0) : this._read(c, n, a)
  5250. },
  5251. _read: function(e, n, i) {
  5252. for (var r, o, s, a, u, c = this, l = [], p = -1, h = t.simpleExtend({
  5253. foundObservable: function(t, n) {
  5254. o = t,
  5255. s = e.slice(n)
  5256. },
  5257. earlyExit: function(t, e) {
  5258. e > p && (u = o,
  5259. a = s,
  5260. p = e)
  5261. }
  5262. }, n); c; ) {
  5263. if (null !== (r = c._context) && ("object" == typeof r || "function" == typeof r)) {
  5264. var d = t.__trapObserves()
  5265. , f = t.compute.read(r, e, h)
  5266. , g = d();
  5267. if (void 0 !== f.value)
  5268. return t.__observes(g),
  5269. {
  5270. scope: c,
  5271. rootObserve: o,
  5272. value: f.value,
  5273. reads: s
  5274. };
  5275. l.push.apply(l, g)
  5276. }
  5277. c = i ? null : c._parent
  5278. }
  5279. return t.__observes(l),
  5280. {
  5281. setRoot: u,
  5282. reads: a,
  5283. value: void 0
  5284. }
  5285. },
  5286. get: t.__notObserve(function(e, n) {
  5287. return n = t.simpleExtend({
  5288. isArgument: !0
  5289. }, n),
  5290. this.read(e, n).value
  5291. }),
  5292. getScope: function(t) {
  5293. for (var e = this; e; ) {
  5294. if (t(e))
  5295. return e;
  5296. e = e._parent
  5297. }
  5298. },
  5299. getContext: function(t) {
  5300. var e = this.getScope(t);
  5301. return e && e._context
  5302. },
  5303. getRefs: function() {
  5304. return this.getScope(function(t) {
  5305. return t._context instanceof n.Refs
  5306. })
  5307. },
  5308. getRoot: function() {
  5309. for (var t = this, e = this; t._parent; )
  5310. e = t,
  5311. t = t._parent;
  5312. return t._context instanceof n.Refs && (t = e),
  5313. t._context
  5314. },
  5315. set: function(e, n, i) {
  5316. var r, o, s = e.lastIndexOf("."), a = e.lastIndexOf("/");
  5317. if (a > s ? (r = e.substring(0, a),
  5318. o = e.substring(a + 1, e.length)) : -1 !== s ? (r = e.substring(0, s),
  5319. o = e.substring(s + 1, e.length)) : (r = ".",
  5320. o = e),
  5321. "*" === e.charAt(0))
  5322. t.compute.set(this.getRefs()._context, e, n, i);
  5323. else {
  5324. var u = this.read(r, i).value;
  5325. t.compute.set(u, o, n, i)
  5326. }
  5327. },
  5328. attr: t.__notObserve(function(e, n, i) {
  5329. return i = t.simpleExtend({
  5330. isArgument: !0
  5331. }, i),
  5332. 2 === arguments.length ? this.set(e, n, i) : this.get(e, i)
  5333. }),
  5334. computeData: function(t, n) {
  5335. return e(this, t, n)
  5336. },
  5337. compute: function(t, e) {
  5338. return this.computeData(t, e).compute
  5339. },
  5340. cloneFromRef: function() {
  5341. for (var e, i, r = [], o = this; o; ) {
  5342. if ((e = o._context)instanceof n.Refs) {
  5343. i = o._parent;
  5344. break
  5345. }
  5346. r.unshift(e),
  5347. o = o._parent
  5348. }
  5349. return i ? (t.each(r, function(t) {
  5350. i = i.add(t)
  5351. }),
  5352. i) : this
  5353. }
  5354. }),
  5355. t.view.Scope = n,
  5356. i.prototype = new n,
  5357. i.prototype.constructor = i,
  5358. t.view.Options = i,
  5359. n
  5360. }),
  5361. define("can/elements", ["can/util/library", "can/view"], function(t) {
  5362. var e = "undefined" != typeof document ? document : null
  5363. , n = e && 1 === t.$(document.createComment("~")).length
  5364. , i = {
  5365. tagToContentPropMap: {
  5366. option: e && "textContent"in document.createElement("option") ? "textContent" : "innerText",
  5367. textarea: "value"
  5368. },
  5369. attrMap: t.attr.map,
  5370. attrReg: /([^\s=]+)[\s]*=[\s]*/,
  5371. defaultValue: t.attr.defaultValue,
  5372. tagMap: {
  5373. "": "span",
  5374. colgroup: "col",
  5375. table: "tbody",
  5376. tr: "td",
  5377. ol: "li",
  5378. ul: "li",
  5379. tbody: "tr",
  5380. thead: "tr",
  5381. tfoot: "tr",
  5382. select: "option",
  5383. optgroup: "option"
  5384. },
  5385. reverseTagMap: {
  5386. col: "colgroup",
  5387. tr: "tbody",
  5388. option: "select",
  5389. td: "tr",
  5390. th: "tr",
  5391. li: "ul"
  5392. },
  5393. selfClosingTags: {
  5394. col: !0
  5395. },
  5396. getParentNode: function(t, e) {
  5397. return e && 11 === t.parentNode.nodeType ? e : t.parentNode
  5398. },
  5399. setAttr: t.attr.set,
  5400. getAttr: t.attr.get,
  5401. removeAttr: t.attr.remove,
  5402. contentText: function(t) {
  5403. return "string" == typeof t ? t : t || 0 === t ? "" + t : ""
  5404. },
  5405. after: function(e, n) {
  5406. var i = e[e.length - 1];
  5407. i.nextSibling ? t.insertBefore(i.parentNode, n, i.nextSibling, t.document) : t.appendChild(i.parentNode, n, t.document)
  5408. },
  5409. replace: function(e, r) {
  5410. var o, s = e[0].parentNode;
  5411. "SELECT" === s.nodeName.toUpperCase() && s.selectedIndex >= 0 && (o = s.value),
  5412. i.after(e, r),
  5413. t.remove(t.$(e)).length < e.length && !n && t.each(e, function(t) {
  5414. 8 === t.nodeType && t.parentNode.removeChild(t)
  5415. }),
  5416. void 0 !== o && (s.value = o)
  5417. }
  5418. };
  5419. return t.view.elements = i,
  5420. i
  5421. }),
  5422. define("can/view/callbacks", ["can/util/library", "can/view"], function(t) {
  5423. var e = t.view.attr = function(t, e) {
  5424. if (!e) {
  5425. var r = n[t];
  5426. if (!r)
  5427. for (var o = 0, s = i.length; o < s; o++) {
  5428. var a = i[o];
  5429. if (a.match.test(t)) {
  5430. r = a.handler;
  5431. break
  5432. }
  5433. }
  5434. return r
  5435. }
  5436. "string" == typeof t ? n[t] = e : i.push({
  5437. match: t,
  5438. handler: e
  5439. })
  5440. }
  5441. , n = {}
  5442. , i = []
  5443. , r = /[-\:]/
  5444. , o = t.view.tag = function(e, n) {
  5445. if (!n) {
  5446. var i = s[e.toLowerCase()];
  5447. return !i && r.test(e) && (i = function() {}
  5448. ),
  5449. i
  5450. }
  5451. t.global.html5 && (t.global.html5.elements += " " + e,
  5452. t.global.html5.shivDocument()),
  5453. s[e.toLowerCase()] = n
  5454. }
  5455. , s = {};
  5456. return t.view.callbacks = {
  5457. _tags: s,
  5458. _attributes: n,
  5459. _regExpAttributes: i,
  5460. tag: o,
  5461. attr: e,
  5462. tagHandler: function(e, n, i) {
  5463. var r, o = i.options.get("tags." + n, {
  5464. proxyMethods: !1
  5465. }) || s[n], a = i.scope;
  5466. if ((r = o ? t.__notObserve(o)(e, i) : a) && i.subtemplate) {
  5467. a !== r && (a = a.add(r));
  5468. var u = i.subtemplate(a, i.options)
  5469. , c = "string" == typeof u ? t.view.frag(u) : u;
  5470. t.appendChild(e, c)
  5471. }
  5472. }
  5473. },
  5474. t.view.callbacks
  5475. }),
  5476. define("can/scanner", ["can/view", "can/elements", "can/view/callbacks"], function(can, elements, viewCallbacks) {
  5477. var newLine = /(\r|\n)+/g, notEndTag = /\//, clean = function(t) {
  5478. return t.split("\\").join("\\\\").split("\n").join("\\n").split('"').join('\\"').split("\t").join("\\t")
  5479. }, getTag = function(t, e, n) {
  5480. if (t)
  5481. return t;
  5482. for (; n < e.length; ) {
  5483. if ("<" === e[n] && !notEndTag.test(e[n + 1]))
  5484. return elements.reverseTagMap[e[n + 1]] || "span";
  5485. n++
  5486. }
  5487. return ""
  5488. }, bracketNum = function(t) {
  5489. return --t.split("{").length - --t.split("}").length
  5490. }, myEval = function(script) {
  5491. eval(script)
  5492. }, 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() {
  5493. var t = beforeQuote.match(attrReg);
  5494. return t && t[1]
  5495. }, status = function() {
  5496. return quote ? "'" + getAttrName() + "'" : htmlTag ? 1 : 0
  5497. }, top = function(t) {
  5498. return t[t.length - 1]
  5499. }, Scanner;
  5500. return can.view.Scanner = Scanner = function(t) {
  5501. can.extend(this, {
  5502. text: {},
  5503. tokens: []
  5504. }, t),
  5505. this.text.options = this.text.options || "",
  5506. this.tokenReg = [],
  5507. this.tokenSimple = {
  5508. "<": "<",
  5509. ">": ">",
  5510. '"': '"',
  5511. "'": "'"
  5512. },
  5513. this.tokenComplex = [],
  5514. this.tokenMap = {};
  5515. for (var e, n = 0; e = this.tokens[n]; n++)
  5516. e[2] ? (this.tokenReg.push(e[2]),
  5517. this.tokenComplex.push({
  5518. abbr: e[1],
  5519. re: new RegExp(e[2]),
  5520. rescan: e[3]
  5521. })) : (this.tokenReg.push(e[1]),
  5522. this.tokenSimple[e[1]] = e[0]),
  5523. this.tokenMap[e[0]] = e[1];
  5524. this.tokenReg = new RegExp("(" + this.tokenReg.slice(0).concat(["<", ">", '"', "'"]).join("|") + ")","g")
  5525. }
  5526. ,
  5527. Scanner.prototype = {
  5528. helpers: [],
  5529. scan: function(t, e) {
  5530. var n = []
  5531. , i = 0
  5532. , r = this.tokenSimple
  5533. , o = this.tokenComplex;
  5534. t = t.replace(newLine, "\n"),
  5535. this.transform && (t = this.transform(t)),
  5536. t.replace(this.tokenReg, function(e, s) {
  5537. var a = arguments[arguments.length - 2];
  5538. if (a > i && n.push(t.substring(i, a)),
  5539. r[e])
  5540. n.push(e);
  5541. else
  5542. for (var u, c = 0; u = o[c]; c++)
  5543. if (u.re.test(e)) {
  5544. n.push(u.abbr),
  5545. u.rescan && n.push(u.rescan(s));
  5546. break
  5547. }
  5548. i = a + s.length
  5549. }),
  5550. i < t.length && n.push(t.substr(i));
  5551. var s, a, u, c, l = "", p = [startTxt + (this.text.start || "")], h = function(t, e) {
  5552. p.push(put_cmd, '"', clean(t), '"' + (e || "") + ");")
  5553. }, d = [], f = null, g = !1, v = {
  5554. attributeHookups: [],
  5555. tagHookups: [],
  5556. lastTagHookup: ""
  5557. }, m = function() {
  5558. v.lastTagHookup = v.tagHookups.pop() + v.tagHookups.length
  5559. }, b = "", y = [], _ = !1, w = !1, x = 0, C = this.tokenMap;
  5560. for (htmlTag = quote = beforeQuote = null; void 0 !== (u = n[x++]); ) {
  5561. if (null === f)
  5562. switch (u) {
  5563. case C.left:
  5564. case C.escapeLeft:
  5565. case C.returnLeft:
  5566. g = htmlTag && 1;
  5567. case C.commentLeft:
  5568. f = u,
  5569. l.length && h(l),
  5570. l = "";
  5571. break;
  5572. case C.escapeFull:
  5573. g = htmlTag && 1,
  5574. rescan = 1,
  5575. f = C.escapeLeft,
  5576. l.length && h(l),
  5577. l = (rescan = n[x++]).content || rescan,
  5578. rescan.before && h(rescan.before),
  5579. n.splice(x, 0, C.right);
  5580. break;
  5581. case C.commentFull:
  5582. break;
  5583. case C.templateLeft:
  5584. l += C.left;
  5585. break;
  5586. case "<":
  5587. 0 !== n[x].indexOf("!--") && (htmlTag = 1,
  5588. g = 0),
  5589. l += u;
  5590. break;
  5591. case ">":
  5592. htmlTag = 0;
  5593. var k = "/" === l.substr(l.length - 1) || "--" === l.substr(l.length - 2)
  5594. , S = "";
  5595. if (v.attributeHookups.length && (S = "attrs: ['" + v.attributeHookups.join("','") + "'], ",
  5596. v.attributeHookups = []),
  5597. b + v.tagHookups.length !== v.lastTagHookup && b === top(v.tagHookups))
  5598. k && (l = l.substr(0, l.length - 1)),
  5599. p.push(put_cmd, '"', clean(l), '"', ",can.view.pending({tagName:'" + b + "'," + S + "scope: " + (this.text.scope || "this") + this.text.options),
  5600. k ? (p.push("}));"),
  5601. l = "/>",
  5602. m()) : "<" === n[x] && n[x + 1] === "/" + b ? (p.push("}));"),
  5603. l = u,
  5604. m()) : (p.push(",subtemplate: function(" + this.text.argNames + "){\n" + startTxt + (this.text.start || "")),
  5605. l = "");
  5606. else if (g || !_ && elements.tagToContentPropMap[y[y.length - 1]] || S) {
  5607. var T = ",can.view.pending({" + S + "scope: " + (this.text.scope || "this") + this.text.options + '}),"';
  5608. k ? h(l.substr(0, l.length - 1), T + '/>"') : h(l, T + '>"'),
  5609. l = "",
  5610. g = 0
  5611. } else
  5612. l += u;
  5613. (k || _) && (y.pop(),
  5614. b = y[y.length - 1],
  5615. _ = !1),
  5616. v.attributeHookups = [];
  5617. break;
  5618. case "'":
  5619. case '"':
  5620. if (htmlTag)
  5621. if (quote && quote === u) {
  5622. quote = null;
  5623. var A = getAttrName();
  5624. if (viewCallbacks.attr(A) && v.attributeHookups.push(A),
  5625. w) {
  5626. h(l += u),
  5627. p.push(finishTxt, "}));\n"),
  5628. l = "",
  5629. w = !1;
  5630. break
  5631. }
  5632. } else if (null === quote && (quote = u,
  5633. beforeQuote = s,
  5634. c = getAttrName(),
  5635. "img" === b && "src" === c || "style" === c)) {
  5636. h(l.replace(attrReg, "")),
  5637. l = "",
  5638. w = !0,
  5639. p.push(insert_cmd, "can.view.txt(2,'" + getTag(b, n, x) + "'," + status() + ",this,function(){", startTxt),
  5640. h(c + "=" + u);
  5641. break
  5642. }
  5643. default:
  5644. if ("<" === s) {
  5645. var B, N = !1;
  5646. 0 === (b = "!--" === u.substr(0, 3) ? "!--" : u.split(/\s/)[0]).indexOf("/") && (N = !0,
  5647. B = b.substr(1)),
  5648. N ? (top(y) === B && (b = B,
  5649. _ = !0),
  5650. top(v.tagHookups) === B && (h(l.substr(0, l.length - 1)),
  5651. p.push(finishTxt + "}}) );"),
  5652. l = "><",
  5653. m())) : (b.lastIndexOf("/") === b.length - 1 && (b = b.substr(0, b.length - 1)),
  5654. "!--" !== b && viewCallbacks.tag(b) && ("content" === b && elements.tagMap[top(y)] && (u = u.replace("content", elements.tagMap[top(y)])),
  5655. v.tagHookups.push(b)),
  5656. y.push(b))
  5657. }
  5658. l += u
  5659. }
  5660. else
  5661. switch (u) {
  5662. case C.right:
  5663. case C.returnRight:
  5664. switch (f) {
  5665. case C.left:
  5666. 1 === (a = bracketNum(l)) ? (p.push(insert_cmd, "can.view.txt(0,'" + getTag(b, n, x) + "'," + status() + ",this,function(){", startTxt, l),
  5667. d.push({
  5668. before: "",
  5669. after: finishTxt + "}));\n"
  5670. })) : ((i = d.length && -1 === a ? d.pop() : {
  5671. after: ";"
  5672. }).before && p.push(i.before),
  5673. p.push(l, ";", i.after));
  5674. break;
  5675. case C.escapeLeft:
  5676. case C.returnLeft:
  5677. (a = bracketNum(l)) && d.push({
  5678. before: finishTxt,
  5679. after: "}));\n"
  5680. });
  5681. for (var M = f === C.escapeLeft ? 1 : 0, I = {
  5682. insert: insert_cmd,
  5683. tagName: getTag(b, n, x),
  5684. status: status(),
  5685. specialAttribute: w
  5686. }, O = 0; O < this.helpers.length; O++) {
  5687. var D = this.helpers[O];
  5688. if (D.name.test(l)) {
  5689. l = D.fn(l, I),
  5690. D.name.source === /^>[\s]*\w*/.source && (M = 0);
  5691. break
  5692. }
  5693. }
  5694. "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"),
  5695. p.push(l.content),
  5696. 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"),
  5697. rescan && rescan.after && rescan.after.length && (h(rescan.after.length),
  5698. rescan = null)
  5699. }
  5700. f = null,
  5701. l = "";
  5702. break;
  5703. case C.templateLeft:
  5704. l += C.left;
  5705. break;
  5706. default:
  5707. l += u
  5708. }
  5709. s = u
  5710. }
  5711. l.length && h(l),
  5712. p.push(";");
  5713. var E = p.join("")
  5714. , L = {
  5715. out: (this.text.outStart || "") + E + " " + finishTxt + (this.text.outEnd || "")
  5716. };
  5717. return myEval.call(L, "this.fn = (function(" + this.text.argNames + "){" + L.out + "});\r\n//# sourceURL=" + e + ".js"),
  5718. L
  5719. }
  5720. },
  5721. can.view.pending = function(t) {
  5722. var e = can.view.getHooks();
  5723. return can.view.hook(function(n) {
  5724. can.each(e, function(t) {
  5725. t(n)
  5726. }),
  5727. t.templateType = "legacy",
  5728. t.tagName && viewCallbacks.tagHandler(n, t.tagName, t),
  5729. can.each(t && t.attrs || [], function(e) {
  5730. t.attributeName = e;
  5731. var i = viewCallbacks.attr(e);
  5732. i && i(n, t)
  5733. })
  5734. })
  5735. }
  5736. ,
  5737. can.view.tag("content", function(t, e) {
  5738. return e.scope
  5739. }),
  5740. can.view.Scanner = Scanner,
  5741. Scanner
  5742. }),
  5743. define("can/view/node_lists", ["can/util/library", "can/elements"], function(t) {
  5744. var e = !0;
  5745. try {
  5746. document.createTextNode("")._ = 0
  5747. } catch (t) {
  5748. e = !1
  5749. }
  5750. var n = {}
  5751. , i = {}
  5752. , r = "ejs_" + Math.random()
  5753. , o = 0
  5754. , s = function(t, n) {
  5755. var s = n || i;
  5756. return a(t, s) || (e || 3 !== t.nodeType ? (++o,
  5757. t[r] = (t.nodeName ? "element_" : "obj_") + o) : (++o,
  5758. s["text_" + o] = t,
  5759. "text_" + o))
  5760. }
  5761. , a = function(t, n) {
  5762. if (e || 3 !== t.nodeType)
  5763. return t[r];
  5764. for (var i in n)
  5765. if (n[i] === t)
  5766. return i
  5767. }
  5768. , u = [].splice
  5769. , c = [].push
  5770. , l = function(t) {
  5771. for (var e = 0, n = 0, i = t.length; n < i; n++) {
  5772. var r = t[n];
  5773. r.nodeType ? e++ : e += l(r)
  5774. }
  5775. return e
  5776. }
  5777. , p = function(t, e) {
  5778. for (var n = {}, i = 0, r = t.length; i < r; i++) {
  5779. var o = d.first(t[i]);
  5780. n[s(o, e)] = t[i]
  5781. }
  5782. return n
  5783. }
  5784. , h = function(t, e, n) {
  5785. for (var i in e)
  5786. n[i] || t.newDeepChildren.push(e[i])
  5787. }
  5788. , d = {
  5789. id: s,
  5790. update: function(e, n) {
  5791. var i = d.unregisterChildren(e);
  5792. n = t.makeArray(n);
  5793. var r = e.length;
  5794. return u.apply(e, [0, r].concat(n)),
  5795. e.replacements ? (d.nestReplacements(e),
  5796. e.deepChildren = e.newDeepChildren,
  5797. e.newDeepChildren = []) : d.nestList(e),
  5798. i
  5799. },
  5800. nestReplacements: function(t) {
  5801. for (var e = 0, n = {}, i = p(t.replacements, n), r = t.replacements.length, o = {}; e < t.length && r; ) {
  5802. var s = t[e]
  5803. , u = a(s, n)
  5804. , c = i[u];
  5805. c && (t.splice(e, l(c), c),
  5806. o[u] = !0,
  5807. r--),
  5808. e++
  5809. }
  5810. r && h(t, i, o),
  5811. t.replacements = []
  5812. },
  5813. nestList: function(t) {
  5814. for (var e = 0; e < t.length; ) {
  5815. var i = t[e]
  5816. , r = n[s(i)];
  5817. r ? r !== t && t.splice(e, l(r), r) : n[s(i)] = t,
  5818. e++
  5819. }
  5820. },
  5821. last: function(t) {
  5822. var e = t[t.length - 1];
  5823. return e.nodeType ? e : d.last(e)
  5824. },
  5825. first: function(t) {
  5826. var e = t[0];
  5827. return e.nodeType ? e : d.first(e)
  5828. },
  5829. flatten: function(t) {
  5830. for (var e = [], n = 0; n < t.length; n++) {
  5831. var i = t[n];
  5832. i.nodeType ? e.push(i) : e.push.apply(e, d.flatten(i))
  5833. }
  5834. return e
  5835. },
  5836. register: function(e, n, i, r) {
  5837. return t.cid(e),
  5838. e.unregistered = n,
  5839. e.parentList = i,
  5840. i ? (e.deepChildren = [],
  5841. e.newDeepChildren = [],
  5842. e.replacements = [],
  5843. !0 !== i && (r ? i.replacements.push(e) : i.newDeepChildren.push(e))) : d.nestList(e),
  5844. e
  5845. },
  5846. unregisterChildren: function(e) {
  5847. var i = [];
  5848. return t.each(e, function(t) {
  5849. t.nodeType ? (e.replacements || delete n[s(t)],
  5850. i.push(t)) : c.apply(i, d.unregister(t, !0))
  5851. }),
  5852. t.each(e.deepChildren, function(t) {
  5853. d.unregister(t, !0)
  5854. }),
  5855. i
  5856. },
  5857. unregister: function(t, e) {
  5858. var n = d.unregisterChildren(t, !0);
  5859. if (t.unregistered) {
  5860. var i = t.unregistered;
  5861. if (t.replacements = t.unregistered = null,
  5862. !e) {
  5863. var r = t.parentList && t.parentList.deepChildren;
  5864. if (r) {
  5865. var o = r.indexOf(t);
  5866. -1 !== o && r.splice(o, 1)
  5867. }
  5868. }
  5869. i()
  5870. }
  5871. return n
  5872. },
  5873. nodeMap: n
  5874. };
  5875. return t.view.nodeLists = d,
  5876. d
  5877. }),
  5878. define("can/view/parser", [], function() {
  5879. function t(t, e) {
  5880. for (var n = 0; n < t.length; n++)
  5881. e(t[n], n)
  5882. }
  5883. function e(e) {
  5884. var n = {};
  5885. return t(e.split(","), function(t) {
  5886. n[t] = !0
  5887. }),
  5888. n
  5889. }
  5890. function n(t, e) {
  5891. for (var n = 0, i = t.length; n < i; n++) {
  5892. var r = t[n];
  5893. e[r.tokenType].apply(e, r.args)
  5894. }
  5895. return t
  5896. }
  5897. var i = new RegExp("^<([-:A-Za-z0-9_]+)((?:\\s*(?:(?:(?:[^=>\\s\\/]+)?(?:\\s*=\\s*(?:(?:\\{\\{[^\\}]\\}\\}\\}?)|(?:\\{[^\\}\\{]\\})|(?:\"[^\"]*\")|(?:'[^']*')|[^>\\s]+))?)|(?:\\{\\{[^\\}]*\\}\\}\\}?)+))*)\\s*(\\/?)>")
  5898. , r = new RegExp("^<\\/([-:A-Za-z0-9_]+)[^>]*>")
  5899. , o = new RegExp("\\{\\{([^\\}]*)\\}\\}\\}?","g")
  5900. , s = /<|\{\{/
  5901. , a = /\s/
  5902. , u = e("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed")
  5903. , 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")
  5904. , 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")
  5905. , p = e("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr")
  5906. , h = e("script")
  5907. , d = "start,end,close,attrStart,attrEnd,attrValue,chars,comment,special,done".split(",")
  5908. , f = function() {}
  5909. , g = function(e, a, v) {
  5910. function m(t, e) {
  5911. var n;
  5912. if (e)
  5913. for (n = C.length - 1; n >= 0 && C[n] !== e; n--)
  5914. ;
  5915. else
  5916. n = 0;
  5917. if (n >= 0) {
  5918. for (var i = C.length - 1; i >= n; i--)
  5919. a.close && a.close(C[i]);
  5920. C.length = n
  5921. }
  5922. }
  5923. if ("object" == typeof e)
  5924. return n(e, a);
  5925. var b = [];
  5926. a = a || {},
  5927. v && t(d, function(t) {
  5928. var e = a[t] || f;
  5929. a[t] = function() {
  5930. !1 !== e.apply(this, arguments) && b.push({
  5931. tokenType: t,
  5932. args: [].slice.call(arguments, 0)
  5933. })
  5934. }
  5935. });
  5936. var y, _, w, x = function() {
  5937. S && a.chars && a.chars(S),
  5938. S = ""
  5939. }, C = [], k = e, S = "";
  5940. for (C.last = function() {
  5941. return this[this.length - 1]
  5942. }
  5943. ; e; ) {
  5944. if (_ = !0,
  5945. C.last() && h[C.last()])
  5946. e = e.replace(new RegExp("([\\s\\S]*?)</" + C.last() + "[^>]*>"), function(t, e) {
  5947. return e = e.replace(/<!--([\s\S]*?)-->|<!\[CDATA\[([\s\S]*?)]]>/g, "$1$2"),
  5948. a.chars && a.chars(e),
  5949. ""
  5950. }),
  5951. m(0, C.last());
  5952. else if (0 === e.indexOf("\x3c!--") ? (y = e.indexOf("--\x3e")) >= 0 && (x(),
  5953. a.comment && a.comment(e.substring(4, y)),
  5954. e = e.substring(y + 3),
  5955. _ = !1) : 0 === e.indexOf("</") ? (w = e.match(r)) && (x(),
  5956. e = e.substring(w[0].length),
  5957. w[0].replace(r, m),
  5958. _ = !1) : 0 === e.indexOf("<") ? (w = e.match(i)) && (x(),
  5959. e = e.substring(w[0].length),
  5960. w[0].replace(i, function(t, e, n, i) {
  5961. if (e = e.toLowerCase(),
  5962. c[e])
  5963. for (; C.last() && l[C.last()]; )
  5964. m(0, C.last());
  5965. p[e] && C.last() === e && m(0, e),
  5966. i = u[e] || !!i,
  5967. a.start(e, i),
  5968. i || C.push(e),
  5969. g.parseAttrs(n, a),
  5970. a.end(e, i)
  5971. }),
  5972. _ = !1) : 0 === e.indexOf("{{") && (w = e.match(o)) && (x(),
  5973. e = e.substring(w[0].length),
  5974. w[0].replace(o, function(t, e) {
  5975. a.special && a.special(e)
  5976. })),
  5977. _) {
  5978. 0 === (y = e.search(s)) && e === k && (S += e.charAt(0),
  5979. e = e.substr(1),
  5980. y = e.search(s));
  5981. var T = y < 0 ? e : e.substring(0, y);
  5982. e = y < 0 ? "" : e.substring(y),
  5983. T && (S += T)
  5984. }
  5985. if (e === k)
  5986. throw new Error("Parse Error: " + e);
  5987. k = e
  5988. }
  5989. return x(),
  5990. m(),
  5991. a.done(),
  5992. b
  5993. }
  5994. , v = function(t, e, n, i) {
  5995. t.attrStart = i.substring("number" == typeof t.nameStart ? t.nameStart : e, e),
  5996. n.attrStart(t.attrStart),
  5997. t.inName = !1
  5998. }
  5999. , m = function(t, e, n, i) {
  6000. void 0 !== t.valueStart && t.valueStart < e ? n.attrValue(i.substring(t.valueStart, e)) : t.inValue,
  6001. n.attrEnd(t.attrStart),
  6002. t.attrStart = void 0,
  6003. t.valueStart = void 0,
  6004. t.inValue = !1,
  6005. t.inName = !1,
  6006. t.lookingForEq = !1,
  6007. t.inQuote = !1,
  6008. t.lookingForName = !0
  6009. };
  6010. return g.parseAttrs = function(t, e) {
  6011. if (t) {
  6012. for (var n, i = 0, r = {
  6013. inDoubleCurly: !1,
  6014. inName: !1,
  6015. nameStart: void 0,
  6016. inValue: !1,
  6017. valueStart: void 0,
  6018. inQuote: !1,
  6019. attrStart: void 0,
  6020. lookingForName: !0,
  6021. lookingForValue: !1,
  6022. lookingForEq: !1
  6023. }; i < t.length; ) {
  6024. n = i;
  6025. var o = t.charAt(i)
  6026. , s = t.charAt(i + 1)
  6027. , u = t.charAt(i + 2);
  6028. if (i++,
  6029. "{" === o && "{" === s)
  6030. r.inValue && n > r.valueStart ? e.attrValue(t.substring(r.valueStart, n)) : r.inName && r.nameStart < n ? (v(r, n, e, t),
  6031. m(r, n, e, t)) : r.lookingForValue ? r.inValue = !0 : r.lookingForEq && r.attrStart && m(r, n, e, t),
  6032. r.inDoubleCurly = !0,
  6033. r.doubleCurlyStart = n + 2,
  6034. i++;
  6035. else if (r.inDoubleCurly) {
  6036. if ("}" === o && "}" === s) {
  6037. var c = "}" === u ? 1 : 0;
  6038. e.special(t.substring(r.doubleCurlyStart, n)),
  6039. r.inDoubleCurly = !1,
  6040. r.inValue && (r.valueStart = n + 2 + c),
  6041. i += 1 + c
  6042. }
  6043. } else
  6044. 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),
  6045. r.lookingForValue = !0,
  6046. r.lookingForEq = !1,
  6047. r.lookingForName = !1) : r.inName ? a.test(o) && (v(r, n, e, t),
  6048. r.lookingForEq = !0) : r.lookingForName ? a.test(o) || (r.attrStart && m(r, n, e, t),
  6049. r.nameStart = n,
  6050. r.inName = !0) : r.lookingForValue && (a.test(o) || (r.lookingForValue = !1,
  6051. r.inValue = !0,
  6052. "'" === o || '"' === o ? (r.inQuote = o,
  6053. r.valueStart = n + 1) : r.valueStart = n))
  6054. }
  6055. r.inName ? (v(r, n + 1, e, t),
  6056. m(r, n + 1, e, t)) : r.lookingForEq ? m(r, n + 1, e, t) : r.inValue && m(r, n + 1, e, t)
  6057. }
  6058. }
  6059. ,
  6060. g
  6061. }),
  6062. define("can/util/diff", [], function() {
  6063. var t = [].slice;
  6064. return function(e, n) {
  6065. for (var i = 0, r = 0, o = e.length, s = n.length, a = []; i < o && r < s; ) {
  6066. var u = e[i]
  6067. , c = n[r];
  6068. if (u !== c)
  6069. if (r + 1 < s && n[r + 1] === u)
  6070. a.push({
  6071. index: r,
  6072. deleteCount: 0,
  6073. insert: [n[r]]
  6074. }),
  6075. i++,
  6076. r += 2;
  6077. else {
  6078. if (!(i + 1 < o && e[i + 1] === c))
  6079. return a.push({
  6080. index: r,
  6081. deleteCount: o - i,
  6082. insert: t.call(n, r)
  6083. }),
  6084. a;
  6085. a.push({
  6086. index: r,
  6087. deleteCount: 1,
  6088. insert: []
  6089. }),
  6090. i += 2,
  6091. r++
  6092. }
  6093. else
  6094. i++,
  6095. r++
  6096. }
  6097. return r === s && i === o ? a : (a.push({
  6098. index: r,
  6099. deleteCount: o - i,
  6100. insert: t.call(n, r)
  6101. }),
  6102. a)
  6103. }
  6104. }),
  6105. 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) {
  6106. e = e || t.view.elements,
  6107. i = i || t.view.NodeLists,
  6108. r = r || t.view.parser;
  6109. var s = function(e, n, i) {
  6110. var r = !1
  6111. , o = function() {
  6112. return r || (r = !0,
  6113. i(s),
  6114. t.unbind.call(e, "removed", o)),
  6115. !0
  6116. }
  6117. , s = {
  6118. teardownCheck: function(t) {
  6119. return !t && o()
  6120. }
  6121. };
  6122. return t.bind.call(e, "removed", o),
  6123. n(s),
  6124. s
  6125. }
  6126. , a = function(t) {
  6127. var e = t.childNodes;
  6128. if ("length"in e)
  6129. return e;
  6130. for (var n = t.firstChild, i = []; n; )
  6131. i.push(n),
  6132. n = n.nextSibling;
  6133. return i
  6134. }
  6135. , u = function(t, e, n) {
  6136. return s(t, function() {
  6137. e.computeInstance.bind("change", n)
  6138. }, function(t) {
  6139. e.computeInstance.unbind("change", n),
  6140. t.nodeList && i.unregister(t.nodeList)
  6141. })
  6142. }
  6143. , c = function(t) {
  6144. var e, n = {};
  6145. return r.parseAttrs(t, {
  6146. attrStart: function(t) {
  6147. n[t] = "",
  6148. e = t
  6149. },
  6150. attrValue: function(t) {
  6151. n[e] += t
  6152. },
  6153. attrEnd: function() {}
  6154. }),
  6155. n
  6156. }
  6157. , l = [].splice
  6158. , p = function(t) {
  6159. return t && t.nodeType
  6160. }
  6161. , h = function(t) {
  6162. t.firstChild || t.appendChild(t.ownerDocument.createTextNode(""))
  6163. }
  6164. , d = function(e) {
  6165. var n = "string" == typeof e
  6166. , i = t.frag(e);
  6167. return n ? t.view.hookup(i) : i
  6168. }
  6169. , f = function(e, n, r, o, s) {
  6170. var u = [];
  6171. n && (i.register(u, null, n, !0),
  6172. u.parentList = n,
  6173. u.expression = "#each SUBEXPRESSION");
  6174. var c = r.apply(o, s.concat([u]))
  6175. , l = d(c)
  6176. , p = t.makeArray(a(l));
  6177. return n ? (i.update(u, p),
  6178. e.push(u)) : e.push(i.register(p)),
  6179. l
  6180. }
  6181. , g = function(e, n, r) {
  6182. var o = e.splice(n + 1, r)
  6183. , s = [];
  6184. return t.each(o, function(t) {
  6185. var e = i.unregister(t);
  6186. [].push.apply(s, e)
  6187. }),
  6188. s
  6189. }
  6190. , v = function(t, n, i, r) {
  6191. if (n && 0 === t.length) {
  6192. var o = []
  6193. , s = f(o, r, n, t, [t]);
  6194. e.after([i[0]], s),
  6195. i.push(o[0])
  6196. }
  6197. }
  6198. , m = {
  6199. list: function(n, r, a, u, c, p, h) {
  6200. var d, b = p || [n], y = [], _ = !1, w = !1, x = function(n, r, o) {
  6201. if (_) {
  6202. var s = T.ownerDocument.createDocumentFragment()
  6203. , c = []
  6204. , h = [];
  6205. t.each(r, function(e, n) {
  6206. var i = t.compute(n + o)
  6207. , r = f(c, p, a, u, [e, i]);
  6208. s.appendChild(r),
  6209. h.push(i)
  6210. });
  6211. var d = o + 1;
  6212. if (!y.length) {
  6213. var v = g(b, 0, b.length - 1);
  6214. t.remove(t.$(v))
  6215. }
  6216. if (b[d]) {
  6217. var m = i.first(b[d]);
  6218. t.insertBefore(m.parentNode, s, m)
  6219. } else
  6220. e.after(1 === d ? [T] : [i.last(b[d - 1])], s);
  6221. l.apply(b, [d, 0].concat(c)),
  6222. l.apply(y, [o, 0].concat(h));
  6223. for (var w = o + h.length, x = y.length; w < x; w++)
  6224. y[w](w)
  6225. }
  6226. }, C = function(t, e, n) {
  6227. k({}, {
  6228. length: 1
  6229. }, n, !0),
  6230. x(0, [e], n)
  6231. }, k = function(e, n, r, o, s) {
  6232. if (_ && (o || !N.teardownCheck(T.parentNode))) {
  6233. r < 0 && (r = y.length + r);
  6234. var a = g(b, r, n.length);
  6235. y.splice(r, n.length);
  6236. for (var u = r, c = y.length; u < c; u++)
  6237. y[u](u);
  6238. s ? i.unregister(b) : (v(d, h, b, p),
  6239. t.remove(t.$(a)))
  6240. }
  6241. }, S = function(e, n, r, o) {
  6242. if (_) {
  6243. o += 1;
  6244. var s, a = b[r += 1], u = t.frag(i.flatten(b[o]));
  6245. s = o < r ? i.last(a).nextSibling : i.first(a),
  6246. b[0].parentNode.insertBefore(u, s);
  6247. var c = b[o];
  6248. [].splice.apply(b, [o, 1]),
  6249. [].splice.apply(b, [r, 0, c]),
  6250. r -= 1;
  6251. var l = y[o -= 1];
  6252. [].splice.apply(y, [o, 1]),
  6253. [].splice.apply(y, [r, 0, l]);
  6254. var p = Math.min(o, r)
  6255. , h = y.length;
  6256. for (h; p < h; p++)
  6257. y[p](p)
  6258. }
  6259. }, T = n.ownerDocument.createTextNode(""), A = function(t) {
  6260. d && d.unbind && d.unbind("add", x).unbind("set", C).unbind("remove", k).unbind("move", S),
  6261. k({}, {
  6262. length: b.length - 1
  6263. }, 0, !0, t)
  6264. }, B = function(t, e, n) {
  6265. if (!w) {
  6266. if (_ = !0,
  6267. e && n) {
  6268. d = e || [];
  6269. var i = o(n, e);
  6270. n.unbind && n.unbind("add", x).unbind("set", C).unbind("remove", k).unbind("move", S);
  6271. for (var r = 0, s = i.length; r < s; r++) {
  6272. var a = i[r];
  6273. a.deleteCount && k({}, {
  6274. length: a.deleteCount
  6275. }, a.index, !0),
  6276. a.insert.length && x(0, a.insert, a.index)
  6277. }
  6278. } else
  6279. n && A(),
  6280. d = e || [],
  6281. x(0, d, 0),
  6282. v(d, h, b, p);
  6283. _ = !1,
  6284. d.bind && d.bind("add", x).bind("set", C).bind("remove", k).bind("move", S),
  6285. _ = !0
  6286. }
  6287. };
  6288. c = e.getParentNode(n, c);
  6289. var N = s(c, function() {
  6290. t.isFunction(r) && r.bind("change", B)
  6291. }, function() {
  6292. t.isFunction(r) && r.unbind("change", B),
  6293. A(!0)
  6294. });
  6295. p ? (e.replace(b, T),
  6296. i.update(b, [T]),
  6297. p.unregistered = function() {
  6298. N.teardownCheck(),
  6299. w = !0
  6300. }
  6301. ) : m.replace(b, T, N.teardownCheck),
  6302. B(0, t.isFunction(r) ? r() : r)
  6303. },
  6304. html: function(n, r, o, s) {
  6305. var c;
  6306. o = e.getParentNode(n, o),
  6307. c = u(o, r, function(t, e, n) {
  6308. i.first(l).parentNode && d(e),
  6309. c.teardownCheck(i.first(l).parentNode)
  6310. });
  6311. var l = s || [n]
  6312. , d = function(n) {
  6313. var r = "function" == typeof n
  6314. , s = p(n)
  6315. , u = t.frag(r ? "" : n)
  6316. , c = t.makeArray(l);
  6317. h(u),
  6318. s || r || (u = t.view.hookup(u, o)),
  6319. c = i.update(l, a(u)),
  6320. r && n(u.firstChild),
  6321. e.replace(c, u)
  6322. };
  6323. c.nodeList = l,
  6324. s ? s.unregistered = c.teardownCheck : i.register(l, c.teardownCheck),
  6325. d(r())
  6326. },
  6327. replace: function(n, r, o) {
  6328. var s = n.slice(0)
  6329. , u = t.frag(r);
  6330. return i.register(n, o),
  6331. "string" == typeof r && (u = t.view.hookup(u, n[0].parentNode)),
  6332. i.update(n, a(u)),
  6333. e.replace(s, u),
  6334. n
  6335. },
  6336. text: function(n, r, o, s) {
  6337. var a = e.getParentNode(n, o)
  6338. , c = u(a, r, function(e, n, i) {
  6339. "unknown" != typeof l.nodeValue && (l.nodeValue = t.view.toStr(n)),
  6340. c.teardownCheck(l.parentNode)
  6341. })
  6342. , l = n.ownerDocument.createTextNode(t.view.toStr(r()));
  6343. s ? (s.unregistered = c.teardownCheck,
  6344. c.nodeList = s,
  6345. i.update(s, [l]),
  6346. e.replace([n], l)) : c.nodeList = m.replace([n], l, c.teardownCheck)
  6347. },
  6348. setAttributes: function(e, n) {
  6349. var i = c(n);
  6350. for (var r in i)
  6351. t.attr.set(e, r, i[r])
  6352. },
  6353. attributes: function(n, i, r) {
  6354. var o = {}
  6355. , s = function(i) {
  6356. var r, s = c(i);
  6357. for (r in s) {
  6358. var a = s[r];
  6359. a !== o[r] && t.attr.set(n, r, a),
  6360. delete o[r]
  6361. }
  6362. for (r in o)
  6363. e.removeAttr(n, r);
  6364. o = s
  6365. };
  6366. u(n, i, function(t, e) {
  6367. s(e)
  6368. }),
  6369. arguments.length >= 3 ? o = c(r) : s(i())
  6370. },
  6371. attributePlaceholder: "__!!__",
  6372. attributeReplace: /__!!__/g,
  6373. attribute: function(n, i, r) {
  6374. u(n, r, function(t, r) {
  6375. e.setAttr(n, i, a.render())
  6376. });
  6377. var o, s = t.$(n);
  6378. (o = t.data(s, "hooks")) || t.data(s, "hooks", o = {});
  6379. var a, c = String(e.getAttr(n, i)), l = c.split(m.attributePlaceholder), p = [];
  6380. p.push(l.shift(), l.join(m.attributePlaceholder)),
  6381. o[i] ? o[i].computes.push(r) : o[i] = {
  6382. render: function() {
  6383. var t = 0;
  6384. return c ? c.replace(m.attributeReplace, function() {
  6385. return e.contentText(a.computes[t++]())
  6386. }) : e.contentText(a.computes[t++]())
  6387. },
  6388. computes: [r],
  6389. batchNum: void 0
  6390. },
  6391. a = o[i],
  6392. p.splice(1, 0, r()),
  6393. e.setAttr(n, i, p.join(""))
  6394. },
  6395. specialAttribute: function(t, n, i) {
  6396. u(t, i, function(i, r) {
  6397. e.setAttr(t, n, y(r))
  6398. }),
  6399. e.setAttr(t, n, y(i()))
  6400. },
  6401. simpleAttribute: function(t, n, i) {
  6402. u(t, i, function(i, r) {
  6403. e.setAttr(t, n, r)
  6404. }),
  6405. e.setAttr(t, n, i())
  6406. }
  6407. };
  6408. m.attr = m.simpleAttribute,
  6409. m.attrs = m.attributes,
  6410. m.getAttributeParts = c;
  6411. var b = /(\r|\n)+/g
  6412. , y = function(t) {
  6413. var n = /^["'].*["']$/;
  6414. return t = t.replace(e.attrReg, "").replace(b, ""),
  6415. n.test(t) ? t.substr(1, t.length - 2) : t
  6416. };
  6417. return t.view.live = m,
  6418. m
  6419. }),
  6420. define("can/render", ["can/view", "can/elements", "can/view/live", "can/util/string"], function(t, e, n) {
  6421. var i, r = [], o = function(t) {
  6422. var n = e.tagMap[t] || "span";
  6423. return "span" === n ? "@@!!@@" : "<" + n + ">" + o(n) + "</" + n + ">"
  6424. }, s = function(e, n) {
  6425. if ("string" == typeof e)
  6426. return e;
  6427. if (!e && 0 !== e)
  6428. return "";
  6429. var i = e.hookup && function(t, n) {
  6430. e.hookup.call(e, t, n)
  6431. }
  6432. || "function" == typeof e && e;
  6433. return i ? n ? "<" + n + " " + t.view.hook(i) + "></" + n + ">" : (r.push(i),
  6434. "") : "" + e
  6435. }, a = function(e, n) {
  6436. return "string" == typeof e || "number" == typeof e ? t.esc(e) : s(e, n)
  6437. }, u = !1, c = function() {};
  6438. return t.extend(t.view, {
  6439. live: n,
  6440. setupLists: function() {
  6441. var e, n = t.view.lists;
  6442. return t.view.lists = function(t, n) {
  6443. return e = {
  6444. list: t,
  6445. renderer: n
  6446. },
  6447. Math.random()
  6448. }
  6449. ,
  6450. function() {
  6451. return t.view.lists = n,
  6452. e
  6453. }
  6454. },
  6455. getHooks: function() {
  6456. var t = r.slice(0);
  6457. return i = t,
  6458. r = [],
  6459. t
  6460. },
  6461. onlytxt: function(t, e) {
  6462. return a(e.call(t))
  6463. },
  6464. txt: function(l, p, h, d, f) {
  6465. var g, v, m, b, y = e.tagMap[p] || "span", _ = !1, w = c;
  6466. if (u)
  6467. g = f.call(d);
  6468. else {
  6469. "string" != typeof h && 1 !== h || (u = !0);
  6470. var x = t.view.setupLists();
  6471. w = function() {
  6472. m.unbind("change", c)
  6473. }
  6474. ,
  6475. (m = t.compute(f, d, !1)).bind("change", c),
  6476. v = x(),
  6477. g = m(),
  6478. u = !1,
  6479. _ = m.computeInstance.hasDependencies
  6480. }
  6481. if (v)
  6482. return w(),
  6483. "<" + y + t.view.hook(function(t, e) {
  6484. n.list(t, v.list, v.renderer, d, e)
  6485. }) + "></" + y + ">";
  6486. if (!_ || "function" == typeof g)
  6487. return w(),
  6488. (u || 2 === l || !l ? s : a)(g, 0 === h && y);
  6489. var C = e.tagToContentPropMap[p];
  6490. if (0 !== h || C)
  6491. return 1 === h ? (r.push(function(t) {
  6492. n.attributes(t, m, m()),
  6493. w()
  6494. }),
  6495. m()) : 2 === l ? (b = h,
  6496. r.push(function(t) {
  6497. n.specialAttribute(t, b, m),
  6498. w()
  6499. }),
  6500. m()) : (b = 0 === h ? C : h,
  6501. (0 === h ? i : r).push(function(t) {
  6502. n.attribute(t, b, m),
  6503. w()
  6504. }),
  6505. n.attributePlaceholder);
  6506. var k = !!e.selfClosingTags[y];
  6507. return "<" + y + t.view.hook(l && "object" != typeof g ? function(t, e) {
  6508. n.text(t, m, e),
  6509. w()
  6510. }
  6511. : function(t, e) {
  6512. n.html(t, m, e),
  6513. w()
  6514. }
  6515. ) + (k ? "/>" : ">" + o(y) + "</" + y + ">")
  6516. }
  6517. }),
  6518. t
  6519. }),
  6520. define("can/view/utils", ["can/util/library", "can/view/scope"], function(can) {
  6521. var Options = can.view.Options;
  6522. return {
  6523. isArrayLike: function(t) {
  6524. return t && t.splice && "number" == typeof t.length
  6525. },
  6526. isObserveLike: function(t) {
  6527. return t instanceof can.Map || t && !!t._get
  6528. },
  6529. emptyHandler: function() {},
  6530. jsonParse: function(str) {
  6531. return "'" === str[0] ? str.substr(1, str.length - 2) : "undefined" === str ? void 0 : can.global.JSON ? JSON.parse(str) : eval("(" + str + ")")
  6532. },
  6533. mixins: {
  6534. last: function() {
  6535. return this.stack[this.stack.length - 1]
  6536. },
  6537. add: function(t) {
  6538. this.last().add(t)
  6539. },
  6540. subSectionDepth: function() {
  6541. return this.stack.length - 1
  6542. }
  6543. },
  6544. convertToScopes: function(t, e, n, i, r, o) {
  6545. r && (t.fn = this.makeRendererConvertScopes(r, e, n, i)),
  6546. o && (t.inverse = this.makeRendererConvertScopes(o, e, n, i))
  6547. },
  6548. makeRendererConvertScopes: function(t, e, n, i) {
  6549. var r = function(n, i, r) {
  6550. return t(n || e, i, r)
  6551. };
  6552. return can.__notObserve(function(t, o, s) {
  6553. return void 0 === t || t instanceof can.view.Scope || (t = e.add(t)),
  6554. void 0 === o || o instanceof Options || (o = n.add(o)),
  6555. r(t, o || n, s || i)
  6556. })
  6557. },
  6558. Options: Options
  6559. }
  6560. }),
  6561. define("can/view/mustache_helpers", ["can/util/library", "can/view/utils", "can/view/live"], function(t, e, n) {
  6562. n = n || t.view.live;
  6563. var i = function(n) {
  6564. return e.isObserveLike(n) && e.isArrayLike(n) && n.attr("length") ? n : t.isFunction(n) ? n() : n
  6565. }
  6566. , r = function(t) {
  6567. var e = {};
  6568. for (var n in t) {
  6569. var i = t[n];
  6570. i && i.isComputed ? e[n] = i() : e[n] = i
  6571. }
  6572. return e
  6573. }
  6574. , o = function(t) {
  6575. return t && "function" == typeof t.fn && "function" == typeof t.inverse
  6576. }
  6577. , s = {
  6578. each: function(r, o) {
  6579. var s, a, u, c = i(r), l = [];
  6580. if (c instanceof t.List)
  6581. return function(e) {
  6582. var i = [e];
  6583. i.expression = "live.list",
  6584. t.view.nodeLists.register(i, null, o.nodeList, !0),
  6585. t.view.nodeLists.update(o.nodeList, [e]);
  6586. n.list(e, r, function(t, e, n) {
  6587. return o.fn(o.scope.add({
  6588. "%index": e,
  6589. "@index": e
  6590. }, {
  6591. notContext: !0
  6592. }).add(t), o.options, n)
  6593. }, o.context, e.parentNode, i, function(t, e) {
  6594. return o.inverse(o.scope.add(t), o.options, e)
  6595. })
  6596. }
  6597. ;
  6598. var p = c;
  6599. if (p && e.isArrayLike(p))
  6600. for (u = 0; u < p.length; u++)
  6601. l.push(o.fn(o.scope.add({
  6602. "%index": u,
  6603. "@index": u
  6604. }, {
  6605. notContext: !0
  6606. }).add(p[u])));
  6607. else if (e.isObserveLike(p))
  6608. for (s = t.Map.keys(p),
  6609. u = 0; u < s.length; u++)
  6610. a = s[u],
  6611. l.push(o.fn(o.scope.add({
  6612. "%key": a,
  6613. "@key": a
  6614. }, {
  6615. notContext: !0
  6616. }).add(p[a])));
  6617. else if (p instanceof Object)
  6618. for (a in p)
  6619. l.push(o.fn(o.scope.add({
  6620. "%key": a,
  6621. "@key": a
  6622. }, {
  6623. notContext: !0
  6624. }).add(p[a])));
  6625. return l
  6626. },
  6627. "@index": function(e, n) {
  6628. n || (n = e,
  6629. e = 0);
  6630. var i = n.scope.attr("@index");
  6631. return "" + ((t.isFunction(i) ? i() : i) + e)
  6632. },
  6633. if: function(e, n) {
  6634. return (t.isFunction(e) ? t.compute.truthy(e)() : !!i(e)) ? n.fn(n.scope || this) : n.inverse(n.scope || this)
  6635. },
  6636. is: function() {
  6637. var e, n, r = arguments[arguments.length - 1];
  6638. if (arguments.length - 2 <= 0)
  6639. return r.inverse();
  6640. var o = arguments;
  6641. return t.compute(function() {
  6642. for (var r = 0; r < o.length - 1; r++) {
  6643. if (n = i(o[r]),
  6644. n = t.isFunction(n) ? n() : n,
  6645. r > 0 && n !== e)
  6646. return !1;
  6647. e = n
  6648. }
  6649. return !0
  6650. })() ? r.fn() : r.inverse()
  6651. },
  6652. eq: function() {
  6653. return s.is.apply(this, arguments)
  6654. },
  6655. unless: function(e, n) {
  6656. return s.if.apply(this, [e, t.extend({}, n, {
  6657. fn: n.inverse,
  6658. inverse: n.fn
  6659. })])
  6660. },
  6661. with: function(t, e) {
  6662. var n = t;
  6663. if (t = i(t))
  6664. return e.fn(n)
  6665. },
  6666. log: function(t, e) {
  6667. "undefined" != typeof console && console.log && (e ? console.log(t, e.context) : console.log(t.context))
  6668. },
  6669. data: function(e) {
  6670. var n = 2 === arguments.length ? this : arguments[1];
  6671. return function(i) {
  6672. t.data(t.$(i), e, n || this.context)
  6673. }
  6674. },
  6675. switch: function(t, e) {
  6676. i(t);
  6677. var n = !1
  6678. , r = e.helpers.add({
  6679. case: function(e, r) {
  6680. if (!n && i(t) === i(e))
  6681. return n = !0,
  6682. r.fn(r.scope || this)
  6683. },
  6684. default: function(t) {
  6685. if (!n)
  6686. return t.fn(t.scope || this)
  6687. }
  6688. });
  6689. return e.fn(e.scope, r)
  6690. },
  6691. joinBase: function(e) {
  6692. var n = [].slice.call(arguments)
  6693. , r = n.pop()
  6694. , o = t.map(n, function(e) {
  6695. var n = i(e);
  6696. return t.isFunction(n) ? n() : n
  6697. }).join("")
  6698. , s = r.helpers.attr("helpers.module")
  6699. , a = s ? s.uri : void 0;
  6700. if ("." === o[0] && a)
  6701. return t.joinURIs(a, o);
  6702. var u = t.baseURL || "undefined" != typeof System && (System.renderingLoader && System.renderingLoader.baseURL || System.baseURL) || location.pathname;
  6703. return "/" !== o[0] && "/" !== u[u.length - 1] && (u += "/"),
  6704. t.joinURIs(u, o)
  6705. },
  6706. routeUrl: function(e, n) {
  6707. return e || (e = {}),
  6708. "function" == typeof e.fn && "function" == typeof e.inverse && (e = r(e.hash)),
  6709. t.route.url(e, "boolean" == typeof n ? n : void 0)
  6710. },
  6711. routeCurrent: function(e) {
  6712. var n = t.last(arguments)
  6713. , i = n && o(n);
  6714. 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()
  6715. }
  6716. };
  6717. s.routeCurrent.callAsMethod = !0,
  6718. s.eachOf = s.each;
  6719. var a = function(t, e) {
  6720. s[t] = e
  6721. };
  6722. return {
  6723. registerHelper: a,
  6724. registerSimpleHelper: function(e, n) {
  6725. a(e, t.view.simpleHelper(n))
  6726. },
  6727. getHelper: function(t, e) {
  6728. var n = e && e.get("helpers." + t, {
  6729. proxyMethods: !1
  6730. });
  6731. if (n || (n = s[t]),
  6732. n)
  6733. return {
  6734. fn: n
  6735. }
  6736. }
  6737. }
  6738. }),
  6739. define("can/view/expression", ["can/util/library", "can/view/utils", "can/view/mustache_helpers", "can/view/scope"], function(t, e, n, i) {
  6740. var r = function(e, n, i) {
  6741. var r = n.computeData(e, i);
  6742. return t.compute.temporarilyBind(r.compute),
  6743. r
  6744. }
  6745. , o = function(t, e, n, i) {
  6746. var o = r(t, e, i);
  6747. return o.compute.computeInstance.hasDependencies ? {
  6748. value: o.compute,
  6749. computeData: o
  6750. } : {
  6751. value: o.initialValue,
  6752. computeData: o
  6753. }
  6754. }
  6755. , s = function(t, e, i, r) {
  6756. var s = o(t, e, 0, r);
  6757. if (void 0 === s.computeData.initialValue) {
  6758. "@" === t.charAt(0) && "@index" !== t && (t = t.substr(1));
  6759. var a = n.getHelper(t, i);
  6760. s.helper = a && a.fn
  6761. }
  6762. return s
  6763. }
  6764. , a = function(t) {
  6765. return t instanceof p || t instanceof u ? t : new p(t)
  6766. }
  6767. , u = function(t) {
  6768. this._value = t
  6769. };
  6770. u.prototype.value = function() {
  6771. return this._value
  6772. }
  6773. ;
  6774. var c = function(t, e) {
  6775. this.key = t,
  6776. this.rootExpr = e
  6777. };
  6778. c.prototype.value = function(t, e) {
  6779. var n = s(this.key, t, e);
  6780. return this.isHelper = n.helper && !n.helper.callAsMethod,
  6781. n.helper || n.value
  6782. }
  6783. ;
  6784. var l = function(t, e) {
  6785. c.apply(this, arguments)
  6786. };
  6787. l.prototype.value = function(t, e) {
  6788. return o(this.key, t).value
  6789. }
  6790. ;
  6791. var p = function(t, e) {
  6792. this.expr = t,
  6793. this.modifiers = e || {},
  6794. this.isCompute = !1
  6795. };
  6796. p.prototype.value = function() {
  6797. return this.expr.value.apply(this.expr, arguments)
  6798. }
  6799. ;
  6800. var h = function(e, n, i) {
  6801. this.methodExpr = e,
  6802. this.argExprs = t.map(n, a);
  6803. var r = this.hashExprs = {};
  6804. t.each(i, function(t, e) {
  6805. r[e] = a(t)
  6806. })
  6807. };
  6808. h.prototype.args = function(t, e) {
  6809. for (var n = [], i = 0, r = this.argExprs.length; i < r; i++) {
  6810. var o = this.argExprs[i]
  6811. , s = o.value.apply(o, arguments);
  6812. n.push({
  6813. call: s && s.isComputed && !o.modifiers.compute,
  6814. value: s
  6815. })
  6816. }
  6817. return function() {
  6818. for (var t = [], e = 0, i = n.length; e < i; e++)
  6819. t[e] = n[e].call ? n[e].value() : n[e].value;
  6820. return t
  6821. }
  6822. }
  6823. ,
  6824. h.prototype.hash = function(t, e) {
  6825. var n = {};
  6826. for (var i in this.hashExprs) {
  6827. var r = this.hashExprs[i]
  6828. , o = r.value.apply(r, arguments);
  6829. n[i] = {
  6830. call: o && o.isComputed && !r.modifiers.compute,
  6831. value: o
  6832. }
  6833. }
  6834. return function() {
  6835. var t = {};
  6836. for (var e in n)
  6837. t[e] = n[e].call ? n[e].value() : n[e].value;
  6838. return t
  6839. }
  6840. }
  6841. ,
  6842. h.prototype.value = function(e, n, i) {
  6843. var r = this.methodExpr.value(e, n);
  6844. this.isHelper = this.methodExpr.isHelper;
  6845. var o = !t.isEmptyObject(this.hashExprs)
  6846. , s = this.args(e, n)
  6847. , a = this.hash(e, n);
  6848. return t.compute(function() {
  6849. var t = r;
  6850. if (t && t.isComputed && (t = t()),
  6851. "function" == typeof t) {
  6852. var e = s();
  6853. return o && e.push(a()),
  6854. i && e.push(i),
  6855. t.apply(null, e)
  6856. }
  6857. })
  6858. }
  6859. ;
  6860. var d = function() {
  6861. c.apply(this, arguments)
  6862. };
  6863. d.prototype.value = function(t, e) {
  6864. var n = s(this.key, t, e, {
  6865. isArgument: !0,
  6866. args: [t.attr("."), t]
  6867. });
  6868. return n.helper || n.value
  6869. }
  6870. ;
  6871. var f = function() {
  6872. c.apply(this, arguments)
  6873. };
  6874. f.prototype.value = function(t, e) {
  6875. return o(this.key, t, 0, {
  6876. callMethodsOnObservables: !0,
  6877. isArgument: !0,
  6878. args: [t.attr("."), t]
  6879. }).value
  6880. }
  6881. ;
  6882. var g = function(t, e, n) {
  6883. this.methodExpr = t,
  6884. this.argExprs = e,
  6885. this.hashExprs = n,
  6886. this.mode = null
  6887. };
  6888. g.prototype.args = function(t, e) {
  6889. for (var n = [], i = 0, r = this.argExprs.length; i < r; i++) {
  6890. var o = this.argExprs[i];
  6891. n.push(o.value.apply(o, arguments))
  6892. }
  6893. return n
  6894. }
  6895. ,
  6896. g.prototype.hash = function(t, e) {
  6897. var n = {};
  6898. for (var i in this.hashExprs) {
  6899. var r = this.hashExprs[i];
  6900. n[i] = r.value.apply(r, arguments)
  6901. }
  6902. return n
  6903. }
  6904. ,
  6905. g.prototype.helperAndValue = function(e, i) {
  6906. var o, s, a, c, l = this.argExprs.length || !t.isEmptyObject(this.hashExprs), p = this.methodExpr instanceof u ? "" + this.methodExpr._value : this.methodExpr.key;
  6907. if (l) {
  6908. o = n.getHelper(p, i);
  6909. var h = e.attr(".");
  6910. o || "function" != typeof h[p] || (o = {
  6911. fn: h[p]
  6912. })
  6913. }
  6914. if (!o) {
  6915. c = this.args(e, i);
  6916. var d = r(p, e, {
  6917. isArgument: !1,
  6918. args: c && c.length ? c : [e.attr("."), e]
  6919. })
  6920. , f = d.compute;
  6921. a = d.initialValue,
  6922. s = d.compute.computeInstance.hasDependencies ? f : a,
  6923. l || void 0 !== a || (o = n.getHelper(p, i))
  6924. }
  6925. return {
  6926. value: s,
  6927. args: c,
  6928. helper: o && o.fn
  6929. }
  6930. }
  6931. ,
  6932. g.prototype.evaluator = function(n, i, r, o, s, a, u, c) {
  6933. var l = {
  6934. fn: function() {},
  6935. inverse: function() {}
  6936. }
  6937. , p = i.attr(".")
  6938. , h = this.args(i, r, s, a, u, c)
  6939. , d = this.hash(i, r, s, a, u, c);
  6940. return e.convertToScopes(l, i, r, s, a, u),
  6941. t.simpleExtend(l, {
  6942. context: p,
  6943. scope: i,
  6944. contexts: i,
  6945. hash: d,
  6946. nodeList: s,
  6947. exprData: this,
  6948. helperOptions: r,
  6949. helpers: r
  6950. }),
  6951. h.push(l),
  6952. function() {
  6953. return n.apply(p, h)
  6954. }
  6955. }
  6956. ,
  6957. g.prototype.value = function(e, n, i, r, o, s) {
  6958. var a = this.helperAndValue(e, n)
  6959. , u = a.helper;
  6960. if (!u)
  6961. return a.value;
  6962. var c = this.evaluator(u, e, n, i, r, o, s)
  6963. , l = t.compute(c);
  6964. return t.compute.temporarilyBind(l),
  6965. l.computeInstance.hasDependencies ? l : l()
  6966. }
  6967. ;
  6968. var v = /[\w\.\\\-_@\/\&%]+/
  6969. , m = /('.*?'|".*?"|=|[\w\.\\\-_@\/*%\$]+|[\(\)]|,|\~)/g
  6970. , b = /^('.*?'|".*?"|[0-9]+\.?[0-9]*|true|false|null|undefined)$/
  6971. , y = function(t) {
  6972. return v.test(t)
  6973. }
  6974. , _ = /^[\.@]\w/
  6975. , w = function(t) {
  6976. return y(t) && _.test(t)
  6977. }
  6978. , x = function(t) {
  6979. return t.children || (t.children = []),
  6980. t
  6981. }
  6982. , C = function() {
  6983. this.root = {
  6984. children: [],
  6985. type: "Root"
  6986. },
  6987. this.current = this.root,
  6988. this.stack = [this.root]
  6989. };
  6990. t.simpleExtend(C.prototype, {
  6991. top: function() {
  6992. return t.last(this.stack)
  6993. },
  6994. isRootTop: function() {
  6995. return this.top() === this.root
  6996. },
  6997. popTo: function(t) {
  6998. this.popUntil(t),
  6999. this.isRootTop() || this.stack.pop()
  7000. },
  7001. firstParent: function(e) {
  7002. for (var n = this.stack.length - 2; n > 0 && -1 === t.inArray(this.stack[n].type, e); )
  7003. n--;
  7004. return this.stack[n]
  7005. },
  7006. popUntil: function(e) {
  7007. for (; -1 === t.inArray(this.top().type, e) && !this.isRootTop(); )
  7008. this.stack.pop();
  7009. return this.top()
  7010. },
  7011. addTo: function(t, e) {
  7012. var n = this.popUntil(t);
  7013. x(n).children.push(e)
  7014. },
  7015. addToAndPush: function(t, e) {
  7016. this.addTo(t, e),
  7017. this.stack.push(e)
  7018. },
  7019. topLastChild: function() {
  7020. return t.last(this.top().children)
  7021. },
  7022. replaceTopLastChild: function(t) {
  7023. var e = x(this.top()).children;
  7024. return e.pop(),
  7025. e.push(t),
  7026. t
  7027. },
  7028. replaceTopLastChildAndPush: function(t) {
  7029. this.replaceTopLastChild(t),
  7030. this.stack.push(t)
  7031. },
  7032. replaceTopAndPush: function(t) {
  7033. var e;
  7034. return this.top() === this.root ? e = x(this.top()).children : (this.stack.pop(),
  7035. e = x(this.top()).children),
  7036. e.pop(),
  7037. e.push(t),
  7038. this.stack.push(t),
  7039. t
  7040. }
  7041. });
  7042. var k = function(t) {
  7043. var e = t.lastIndexOf("./")
  7044. , n = t.lastIndexOf(".");
  7045. if (n > e)
  7046. return t.substr(0, n) + "@" + t.substr(n + 1);
  7047. var i = -1 === e ? 0 : e + 2
  7048. , r = t.charAt(i);
  7049. return "." === r || "@" === r ? t.substr(0, i) + "@" + t.substr(i + 1) : t.substr(0, i) + "@" + t.substr(i)
  7050. }
  7051. , S = function(t) {
  7052. return "Lookup" === t.type && (t.key = k(t.key)),
  7053. t
  7054. }
  7055. , T = function(t) {
  7056. var e = t.top();
  7057. if (e && "Lookup" === e.type) {
  7058. var n = t.stack[t.stack.length - 2];
  7059. "Helper" !== n.type && n && t.replaceTopAndPush({
  7060. type: "Helper",
  7061. method: e
  7062. })
  7063. }
  7064. }
  7065. , A = {
  7066. convertKeyToLookup: k,
  7067. Literal: u,
  7068. Lookup: c,
  7069. ScopeLookup: l,
  7070. Arg: p,
  7071. Hash: function() {},
  7072. Call: h,
  7073. Helper: g,
  7074. HelperLookup: d,
  7075. HelperScopeLookup: f,
  7076. tokenize: function(e) {
  7077. var n = [];
  7078. return (t.trim(e) + " ").replace(m, function(t, e) {
  7079. n.push(e)
  7080. }),
  7081. n
  7082. },
  7083. lookupRules: {
  7084. default: function(t, e, n) {
  7085. var i = ("Helper" !== e || t.root ? "" : "Helper") + (n ? "Scope" : "") + "Lookup";
  7086. return A[i]
  7087. },
  7088. method: function(t, e, n) {
  7089. return l
  7090. }
  7091. },
  7092. methodRules: {
  7093. default: function(t) {
  7094. return "Call" === t.type ? h : g
  7095. },
  7096. call: function(t) {
  7097. return h
  7098. }
  7099. },
  7100. parse: function(t, e) {
  7101. e = e || {};
  7102. var n = this.ast(t);
  7103. return e.lookupRule || (e.lookupRule = "default"),
  7104. "string" == typeof e.lookupRule && (e.lookupRule = A.lookupRules[e.lookupRule]),
  7105. e.methodRule || (e.methodRule = "default"),
  7106. "string" == typeof e.methodRule && (e.methodRule = A.methodRules[e.methodRule]),
  7107. this.hydrateAst(n, e, e.baseMethodType || "Helper")
  7108. },
  7109. hydrateAst: function(t, e, n, i) {
  7110. if ("Lookup" === t.type)
  7111. return new (e.lookupRule(t, n, i))(t.key,t.root && this.hydrateAst(t.root, e, n));
  7112. if ("Literal" === t.type)
  7113. return new u(t.value);
  7114. if ("Arg" === t.type)
  7115. return new p(this.hydrateAst(t.children[0], e, n, i),{
  7116. compute: !0
  7117. });
  7118. if ("Hash" === t.type)
  7119. throw new Error("");
  7120. if ("Call" === t.type || "Helper" === t.type) {
  7121. var r = {}
  7122. , o = []
  7123. , s = t.children;
  7124. if (s)
  7125. for (var a = 0; a < s.length; a++) {
  7126. var c = s[a];
  7127. "Hash" === c.type ? r[c.prop] = this.hydrateAst(c.children[0], e, t.type, !0) : o.push(this.hydrateAst(c, e, t.type, !0))
  7128. }
  7129. return new (e.methodRule(t))(this.hydrateAst(t.method, e, t.type),o,r)
  7130. }
  7131. },
  7132. ast: function(t) {
  7133. var e = this.tokenize(t);
  7134. return this.parseAst(e, {
  7135. index: 0
  7136. })
  7137. },
  7138. parseAst: function(n, i) {
  7139. for (var r, o = new C; i.index < n.length; ) {
  7140. var s = n[i.index]
  7141. , a = n[i.index + 1];
  7142. if (i.index++,
  7143. b.test(s))
  7144. T(o),
  7145. o.addTo(["Helper", "Call", "Hash"], {
  7146. type: "Literal",
  7147. value: e.jsonParse(s)
  7148. });
  7149. else if ("=" === a) {
  7150. if ((r = o.top()) && "Lookup" === r.type) {
  7151. var u = o.firstParent(["Call", "Helper", "Hash"]);
  7152. "Call" !== u.type && "Root" !== u.type || (o.popUntil(["Call"]),
  7153. r = o.top(),
  7154. o.replaceTopAndPush({
  7155. type: "Helper",
  7156. method: "Root" === r.type ? t.last(r.children) : r
  7157. }))
  7158. }
  7159. o.addToAndPush(["Helper", "Call"], {
  7160. type: "Hash",
  7161. prop: s
  7162. }),
  7163. i.index++
  7164. } else if (v.test(s)) {
  7165. var c = o.topLastChild();
  7166. c && "Call" === c.type && w(s) ? o.replaceTopLastChildAndPush({
  7167. type: "Lookup",
  7168. root: c,
  7169. key: s
  7170. }) : (T(o),
  7171. o.addToAndPush(["Helper", "Call", "Hash", "Arg"], {
  7172. type: "Lookup",
  7173. key: s
  7174. }))
  7175. } else if ("~" === s)
  7176. T(o),
  7177. o.addToAndPush(["Helper", "Call", "Hash"], {
  7178. type: "Arg",
  7179. key: s
  7180. });
  7181. else if ("(" === s) {
  7182. if ("Lookup" !== (r = o.top()).type)
  7183. throw new Error("Unable to understand expression " + n.join(""));
  7184. o.replaceTopAndPush({
  7185. type: "Call",
  7186. method: S(r)
  7187. })
  7188. } else
  7189. ")" === s ? o.popTo(["Call"]) : "," === s && o.popUntil(["Call"])
  7190. }
  7191. return o.root.children[0]
  7192. }
  7193. };
  7194. return t.expression = A,
  7195. A
  7196. }),
  7197. define("can/view/href", ["can/util/library", "can/view/expression", "can/view/callbacks", "can/view/scope"], function(t, e) {
  7198. var n = function(t) {
  7199. return "{" === t[0] && "}" === t[t.length - 1] ? t.substr(1, t.length - 2) : t
  7200. };
  7201. t.view.attr("can-href", function(i, r) {
  7202. var o = e.parse("tmp(" + n(i.getAttribute("can-href")) + ")", {
  7203. baseMethodType: "Call"
  7204. }).hash(r.scope, null)
  7205. , s = t.compute(function() {
  7206. return t.route.url(o())
  7207. });
  7208. i.setAttribute("href", s());
  7209. var a = function(t, e) {
  7210. i.setAttribute("href", e)
  7211. };
  7212. s.bind("change", a),
  7213. t.bind.call(i, "removed", function() {
  7214. s.unbind("change", a)
  7215. })
  7216. })
  7217. }),
  7218. 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) {
  7219. var i = {
  7220. viewModel: function(e, n, i, r) {
  7221. r = r || {};
  7222. var o, s = {}, a = [], u = {}, l = {}, p = t.extend({}, r);
  7223. t.each(t.makeArray(e.attributes), function(t) {
  7224. var i = c(t, e, {
  7225. templateType: n.templateType,
  7226. scope: n.scope,
  7227. semaphore: s,
  7228. getViewModel: function() {
  7229. return o
  7230. },
  7231. attributeViewModelBindings: p,
  7232. alreadyUpdatedChild: !0
  7233. });
  7234. i && (i.onCompleteBinding && (i.bindingInfo.parentToChild && void 0 !== i.value && (r[g(i.bindingInfo.childName)] = i.value),
  7235. a.push(i.onCompleteBinding)),
  7236. u[t.name] = i.onTeardown)
  7237. }),
  7238. o = i(r);
  7239. for (var h = 0, d = a.length; h < d; h++)
  7240. a[h]();
  7241. return t.bind.call(e, "attributes", function(t) {
  7242. var i = t.attributeName
  7243. , r = e.getAttribute(i);
  7244. u[i] && u[i]();
  7245. var s = l[i] && "attribute" === l[i].parent;
  7246. if (null !== r || s) {
  7247. var a = c({
  7248. name: i,
  7249. value: r
  7250. }, e, {
  7251. templateType: n.templateType,
  7252. scope: n.scope,
  7253. semaphore: {},
  7254. getViewModel: function() {
  7255. return o
  7256. },
  7257. attributeViewModelBindings: p,
  7258. initializeValues: !0
  7259. });
  7260. a && (a.onCompleteBinding && a.onCompleteBinding(),
  7261. l[i] = a.bindingInfo,
  7262. u[i] = a.onTeardown)
  7263. }
  7264. }),
  7265. function() {
  7266. for (var t in u)
  7267. u[t]()
  7268. }
  7269. },
  7270. data: function(e, n) {
  7271. if (!t.data(t.$(e), "preventDataBindings")) {
  7272. var i, r = t.viewModel(e), o = {}, s = c({
  7273. name: n.attributeName,
  7274. value: e.getAttribute(n.attributeName)
  7275. }, e, {
  7276. templateType: n.templateType,
  7277. scope: n.scope,
  7278. semaphore: o,
  7279. getViewModel: function() {
  7280. return r
  7281. }
  7282. });
  7283. s.onCompleteBinding && s.onCompleteBinding(),
  7284. i = s.onTeardown,
  7285. t.one.call(e, "removed", function() {
  7286. i()
  7287. }),
  7288. t.bind.call(e, "attributes", function(t) {
  7289. var s = t.attributeName
  7290. , a = e.getAttribute(s);
  7291. if (s === n.attributeName && (i && i(),
  7292. null !== a)) {
  7293. var u = c({
  7294. name: s,
  7295. value: a
  7296. }, e, {
  7297. templateType: n.templateType,
  7298. scope: n.scope,
  7299. semaphore: o,
  7300. getViewModel: function() {
  7301. return r
  7302. },
  7303. initializeValues: !0
  7304. });
  7305. u && (u.onCompleteBinding && u.onCompleteBinding(),
  7306. i = u.onTeardown)
  7307. }
  7308. })
  7309. }
  7310. },
  7311. reference: function(e, n) {
  7312. e.getAttribute(n.attributeName) && console.warn("*reference attributes can only export the view model.");
  7313. var i = t.camelize(n.attributeName.substr(1).toLowerCase())
  7314. , r = t.viewModel(e);
  7315. n.scope.getRefs()._context.attr("*" + i, r)
  7316. },
  7317. event: function(n, i) {
  7318. var r = i.attributeName
  7319. , o = 0 === r.indexOf("can-")
  7320. , s = 0 === r.indexOf("can-") ? r.substr("can-".length) : h(r, "(", ")")
  7321. , a = o;
  7322. "$" === s.charAt(0) && (s = s.substr(1),
  7323. a = !0);
  7324. var u = function(o) {
  7325. var s = n.getAttribute(r);
  7326. if (s) {
  7327. var a = t.$(n)
  7328. , u = t.viewModel(a[0])
  7329. , c = e.parse(h(s), {
  7330. lookupRule: "method",
  7331. methodRule: "call"
  7332. });
  7333. if (!(c instanceof e.Call || c instanceof e.Helper)) {
  7334. var l = t.map([i.scope._context, a].concat(t.makeArray(arguments)), function(t) {
  7335. return new e.Literal(t)
  7336. });
  7337. c = new e.Call(c,l,{})
  7338. }
  7339. var p = i.scope.read(c.methodExpr.key, {
  7340. isArgument: !0
  7341. });
  7342. if (!p.value)
  7343. return p = i.scope.read(c.methodExpr.key, {
  7344. isArgument: !0
  7345. }),
  7346. null;
  7347. var d = i.scope.add({
  7348. "@element": a,
  7349. "@event": o,
  7350. "@viewModel": u,
  7351. "@scope": i.scope,
  7352. "@context": i.scope._context,
  7353. "%element": this,
  7354. $element: a,
  7355. "%event": o,
  7356. "%viewModel": u,
  7357. "%scope": i.scope,
  7358. "%context": i.scope._context
  7359. }, {
  7360. notContext: !0
  7361. })
  7362. , f = c.args(d, null)()
  7363. , g = c.hash(d, null)();
  7364. return t.isEmptyObject(g) || f.push(g),
  7365. p.value.apply(p.parent, f)
  7366. }
  7367. };
  7368. if (v[s]) {
  7369. var c = v[s](i, n, u);
  7370. u = c.handler,
  7371. s = c.event
  7372. }
  7373. t.bind.call(a ? n : t.viewModel(n), s, u);
  7374. var l = function(e) {
  7375. e.attributeName !== r || this.getAttribute(r) || (t.unbind.call(a ? n : t.viewModel(n), s, u),
  7376. t.unbind.call(n, "attributes", l))
  7377. };
  7378. t.bind.call(n, "attributes", l)
  7379. },
  7380. value: function(e, n) {
  7381. var i, o = "$value", s = t.trim(h(e.getAttribute("can-value")));
  7382. if ("input" !== e.nodeName.toLowerCase() || "checkbox" !== e.type && "radio" !== e.type)
  7383. p(e) && (o = "$innerHTML");
  7384. else {
  7385. var a = r.scope(e, n.scope, s, {}, !0);
  7386. if ("checkbox" === e.type) {
  7387. var u = !t.attr.has(e, "can-true-value") || e.getAttribute("can-true-value")
  7388. , l = !!t.attr.has(e, "can-false-value") && e.getAttribute("can-false-value");
  7389. i = t.compute(function(t) {
  7390. if (!arguments.length)
  7391. return a() == u;
  7392. a(t ? u : l)
  7393. })
  7394. } else
  7395. "radio" === e.type && (i = t.compute(function(t) {
  7396. if (!arguments.length)
  7397. return a() == e.value;
  7398. t && a(e.value)
  7399. }));
  7400. o = "$checked",
  7401. s = "getterSetter",
  7402. n.scope = new t.view.Scope({
  7403. getterSetter: i
  7404. })
  7405. }
  7406. c({
  7407. name: "{(" + o + "})",
  7408. value: s
  7409. }, e, {
  7410. templateType: n.templateType,
  7411. scope: n.scope,
  7412. semaphore: {},
  7413. initializeValues: !0,
  7414. legacyBindings: !0,
  7415. syncChildWithParent: !0
  7416. })
  7417. }
  7418. };
  7419. t.view.attr(/^\{[^\}]+\}$/, i.data),
  7420. t.view.attr(/\*[\w\.\-_]+/, i.reference),
  7421. t.view.attr(/^\([\$?\w\.]+\)$/, i.event),
  7422. t.view.attr(/can-[\w\.]+/, i.event),
  7423. t.view.attr("can-value", i.value);
  7424. var r = {
  7425. scope: function(n, i, r, o, s) {
  7426. return r ? s ? e.parse(r, {
  7427. baseMethodType: "Call"
  7428. }).value(i, new t.view.Options({})) : function(t) {
  7429. i.attr(g(r), t)
  7430. }
  7431. : t.compute()
  7432. },
  7433. viewModel: function(e, n, i, r, o) {
  7434. var s = g(i);
  7435. return o ? t.compute(function(e) {
  7436. var n = r.getViewModel();
  7437. if (!arguments.length)
  7438. return "." === i ? n : t.compute.read(n, t.compute.read.reads(i), {}).value;
  7439. n.attr(s, e)
  7440. }) : function(t) {
  7441. r.getViewModel().attr(s, t)
  7442. }
  7443. },
  7444. attribute: function(e, n, i, r, o, s) {
  7445. s || (s = "innerHTML" === i ? ["blur", "change"] : "change"),
  7446. t.isArray(s) || (s = [s]);
  7447. var a, u, c, l = "select" === e.nodeName.toLowerCase(), p = "value" === i && l && e.multiple, h = !1, d = function(n) {
  7448. if (l && !h && (clearTimeout(c),
  7449. c = setTimeout(function() {
  7450. d(n)
  7451. }, 1)),
  7452. u = n,
  7453. p) {
  7454. n && "string" == typeof n ? (n = n.split(";"),
  7455. a = !0) : n = n ? t.makeArray(n) : [];
  7456. var o = {};
  7457. t.each(n, function(t) {
  7458. o[t] = !0
  7459. }),
  7460. t.each(e.childNodes, function(t) {
  7461. t.value && (t.selected = !!o[t.value])
  7462. })
  7463. } else
  7464. !r.legacyBindings && l && "selectedIndex"in e && (e.selectedIndex = -1),
  7465. t.attr.setAttrOrProp(e, i, null == n ? "" : n);
  7466. return n
  7467. }, f = function() {
  7468. if (p) {
  7469. var n = []
  7470. , r = e.childNodes;
  7471. return t.each(r, function(t) {
  7472. t.selected && t.value && n.push(t.value)
  7473. }),
  7474. a ? n.join(";") : n
  7475. }
  7476. return t.attr.get(e, i)
  7477. };
  7478. return l && setTimeout(function() {
  7479. h = !0
  7480. }, 1),
  7481. t.compute(f(), {
  7482. on: function(n) {
  7483. t.each(s, function(i) {
  7484. t.bind.call(e, i, n)
  7485. })
  7486. },
  7487. off: function(n) {
  7488. t.each(s, function(i) {
  7489. t.unbind.call(e, i, n)
  7490. })
  7491. },
  7492. get: f,
  7493. set: d
  7494. })
  7495. }
  7496. }
  7497. , o = {
  7498. childToParent: function(e, n, i, r, o, s) {
  7499. var a = "function" == typeof n
  7500. , u = function(e, u) {
  7501. r[o] || (a ? (n(u),
  7502. s && n() !== i() && (r[o] = (r[o] || 0) + 1,
  7503. i(n()),
  7504. t.batch.after(function() {
  7505. --r[o]
  7506. }))) : n instanceof t.Map && n.attr(u, !0))
  7507. };
  7508. return i && i.isComputed && i.bind("change", u),
  7509. u
  7510. },
  7511. parentToChild: function(e, n, i, r, o) {
  7512. var s = function(e, n) {
  7513. r[o] = (r[o] || 0) + 1,
  7514. i(n),
  7515. t.batch.after(function() {
  7516. --r[o]
  7517. })
  7518. };
  7519. return n && n.isComputed && n.bind("change", s),
  7520. s
  7521. }
  7522. }
  7523. , s = function(e, i, r) {
  7524. var o = e.name
  7525. , s = e.value || ""
  7526. , c = o.match(a);
  7527. if (!c) {
  7528. var l = u.test(o)
  7529. , p = t.camelize(o);
  7530. if (l || n.attr(o))
  7531. return;
  7532. var h = "{" === s[0] && "}" === t.last(s)
  7533. , d = "legacy" === r ? i[p] : !h
  7534. , f = h ? s.substr(1, s.length - 2) : s;
  7535. return d ? {
  7536. bindingAttributeName: o,
  7537. parent: "attribute",
  7538. parentName: o,
  7539. child: "viewModel",
  7540. childName: p,
  7541. parentToChild: !0,
  7542. childToParent: !0
  7543. } : {
  7544. bindingAttributeName: o,
  7545. parent: "scope",
  7546. parentName: f,
  7547. child: "viewModel",
  7548. childName: p,
  7549. parentToChild: !0,
  7550. childToParent: !0
  7551. }
  7552. }
  7553. var g = !!c[1]
  7554. , v = g || !!c[2]
  7555. , m = g || !v
  7556. , b = c[3];
  7557. return "$" === b.charAt(0) ? {
  7558. parent: "scope",
  7559. child: "attribute",
  7560. childToParent: v,
  7561. parentToChild: m,
  7562. bindingAttributeName: o,
  7563. childName: b.substr(1),
  7564. parentName: s,
  7565. initializeValues: !0
  7566. } : {
  7567. parent: "scope",
  7568. child: "viewModel",
  7569. childToParent: v,
  7570. parentToChild: m,
  7571. bindingAttributeName: o,
  7572. childName: t.camelize(b),
  7573. parentName: s,
  7574. initializeValues: !0
  7575. }
  7576. }
  7577. , a = /\{(\()?(\^)?([^\}\)]+)\)?\}/
  7578. , u = /^(data-view-id|class|id|\[[\w\.-]+\]|#[\w\.-])$/i
  7579. , c = function(t, e, n) {
  7580. var i = s(t, n.attributeViewModelBindings, n.templateType);
  7581. if (i) {
  7582. i.alreadyUpdatedChild = n.alreadyUpdatedChild,
  7583. n.initializeValues && (i.initializeValues = !0);
  7584. 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);
  7585. i.parentToChild && (u = o.parentToChild(e, c, p, n.semaphore, i.bindingAttributeName));
  7586. var h = function() {
  7587. i.childToParent && (a = o.childToParent(e, c, p, n.semaphore, i.bindingAttributeName, n.syncChildWithParent)),
  7588. i.initializeValues && l(i, p, c, u, a)
  7589. }
  7590. , g = function() {
  7591. f(c, u),
  7592. f(p, a)
  7593. };
  7594. return "viewModel" === i.child ? {
  7595. value: d(c),
  7596. onCompleteBinding: h,
  7597. bindingInfo: i,
  7598. onTeardown: g
  7599. } : (h(),
  7600. {
  7601. bindingInfo: i,
  7602. onTeardown: g
  7603. })
  7604. }
  7605. }
  7606. , l = function(t, e, n, i, r) {
  7607. var o = !1;
  7608. t.parentToChild && !t.childToParent || (!t.parentToChild && t.childToParent ? o = !0 : void 0 === d(e) || void 0 === d(n) && (o = !0)),
  7609. o ? r({}, d(e)) : t.alreadyUpdatedChild || i({}, d(n))
  7610. }
  7611. , p = function() {
  7612. var t = {
  7613. "": !0,
  7614. true: !0,
  7615. false: !1
  7616. }
  7617. , e = function(e) {
  7618. if (e && e.getAttribute) {
  7619. var n = e.getAttribute("contenteditable");
  7620. return t[n]
  7621. }
  7622. };
  7623. return function(t) {
  7624. var n = e(t);
  7625. return "boolean" == typeof n ? n : !!e(t.parentNode)
  7626. }
  7627. }()
  7628. , h = function(t, e, n) {
  7629. return e = e || "{",
  7630. n = n || "}",
  7631. t[0] === e && t[t.length - 1] === n ? t.substr(1, t.length - 2) : t
  7632. }
  7633. , d = function(t) {
  7634. return t && t.isComputed ? t() : t
  7635. }
  7636. , f = function(t, e) {
  7637. t && t.isComputed && "function" == typeof e && t.unbind("change", e)
  7638. }
  7639. , g = function(t) {
  7640. return t.replace(/@/g, "")
  7641. }
  7642. , v = {
  7643. enter: function(t, e, n) {
  7644. return {
  7645. event: "keyup",
  7646. handler: function(t) {
  7647. if (13 === t.keyCode)
  7648. return n.call(this, t)
  7649. }
  7650. }
  7651. }
  7652. };
  7653. return t.bindings = {
  7654. behaviors: i,
  7655. getBindingInfo: s,
  7656. special: v
  7657. },
  7658. t.bindings
  7659. }),
  7660. define("can/view/mustache", ["can/util/library", "can/view/scope", "can/view", "can/scanner", "can/compute", "can/render", "can/view/bindings"], function(t) {
  7661. t.view.ext = ".mustache";
  7662. var e = "scope,options"
  7663. , n = /((([^'"\s]+?=)?('.*?'|".*?"))|.*?)\s/g
  7664. , i = /^(('.*?'|".*?"|[0-9]+\.?[0-9]*|true|false|null|undefined)|((.+?)=(('.*?'|".*?"|[0-9]+\.?[0-9]*|true|false)|(.+))))$/
  7665. , r = function(t) {
  7666. return '{get:"' + t.replace(/"/g, '\\"') + '"}'
  7667. }
  7668. , o = function(t) {
  7669. return t && "string" == typeof t.get
  7670. }
  7671. , s = function(e) {
  7672. return e instanceof t.Map || e && !!e._get
  7673. }
  7674. , a = function(t) {
  7675. return t && t.splice && "number" == typeof t.length
  7676. }
  7677. , u = function(e, n, i) {
  7678. var r = function(t, i) {
  7679. return e(t || n, i)
  7680. };
  7681. return function(e, o) {
  7682. return void 0 === e || e instanceof t.view.Scope || (e = n.add(e)),
  7683. void 0 === o || o instanceof t.view.Options || (o = i.add(o)),
  7684. r(e, o || i)
  7685. }
  7686. }
  7687. , c = function(e, n) {
  7688. if (this.constructor !== c) {
  7689. var i = new c(e);
  7690. return function(t, e) {
  7691. return i.render(t, e)
  7692. }
  7693. }
  7694. "function" != typeof e ? (t.extend(this, e),
  7695. this.template = this.scanner.scan(this.text, this.name)) : this.template = {
  7696. fn: e
  7697. }
  7698. };
  7699. t.Mustache = t.global.Mustache = c,
  7700. c.prototype.render = function(e, n) {
  7701. return e instanceof t.view.Scope || (e = new t.view.Scope(e || {})),
  7702. n instanceof t.view.Options || (n = new t.view.Options(n || {})),
  7703. n = n || {},
  7704. this.template.fn.call(e, e, n)
  7705. }
  7706. ,
  7707. t.extend(c.prototype, {
  7708. scanner: new t.view.Scanner({
  7709. text: {
  7710. start: "",
  7711. scope: "scope",
  7712. options: ",options: options",
  7713. argNames: e
  7714. },
  7715. tokens: [["returnLeft", "{{{", "{{[{&]"], ["commentFull", "{{!}}", "^[\\s\\t]*{{!.+?}}\\n"], ["commentLeft", "{{!", "(\\n[\\s\\t]*{{!|{{!)"], ["escapeFull", "{{}}", "(^[\\s\\t]*{{[#/^][^}]+?}}\\n|\\n[\\s\\t]*{{[#/^][^}]+?}}\\n|\\n[\\s\\t]*{{[#/^][^}]+?}}$)", function(t) {
  7716. return {
  7717. before: /^\n.+?\n$/.test(t) ? "\n" : "",
  7718. content: t.match(/\{\{(.+?)\}\}/)[1] || ""
  7719. }
  7720. }
  7721. ], ["escapeLeft", "{{"], ["returnRight", "}}}"], ["right", "}}"]],
  7722. helpers: [{
  7723. name: /^>[\s]*\w*/,
  7724. fn: function(n, i) {
  7725. return "can.Mustache.renderPartial('" + t.trim(n.replace(/^>\s?/, "")).replace(/["|']/g, "") + "'," + e + ")"
  7726. }
  7727. }, {
  7728. name: /^\s*data\s/,
  7729. fn: function(t, e) {
  7730. return "can.proxy(function(__){can.data(can.$(__),'" + t.match(/["|'](.*)["|']/)[1] + "', this.attr('.')); }, scope)"
  7731. }
  7732. }, {
  7733. name: /\s*\(([\$\w]+)\)\s*->([^\n]*)/,
  7734. fn: function(t) {
  7735. var e = /\s*\(([\$\w]+)\)\s*->([^\n]*)/
  7736. , n = t.match(e);
  7737. return "can.proxy(function(__){var " + n[1] + "=can.$(__);with(scope.attr('.')){" + n[2] + "}}, this);"
  7738. }
  7739. }, {
  7740. name: /^.*$/,
  7741. fn: function(e, o) {
  7742. var s = !1
  7743. , a = {
  7744. content: "",
  7745. startTxt: !1,
  7746. startOnlyTxt: !1,
  7747. end: !1
  7748. };
  7749. if ((e = t.trim(e)).length && (s = e.match(/^([#^\/]|else$)/))) {
  7750. switch (s = s[0]) {
  7751. case "#":
  7752. case "^":
  7753. o.specialAttribute ? a.startOnlyTxt = !0 : (a.startTxt = !0,
  7754. a.escaped = 0);
  7755. break;
  7756. case "/":
  7757. return a.end = !0,
  7758. a.content += 'return ___v1ew.join("");}}])',
  7759. a
  7760. }
  7761. e = e.substring(1)
  7762. }
  7763. if ("else" !== s) {
  7764. var u, c = [], l = [], p = 0;
  7765. a.content += "can.Mustache.txt(\n" + (o.specialAttribute ? "{scope:scope,options:options, special: true}" : "{scope:scope,options:options}") + ",\n" + (s ? '"' + s + '"' : "null") + ",",
  7766. (t.trim(e) + " ").replace(n, function(t, e) {
  7767. 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)),
  7768. p++
  7769. }),
  7770. a.content += c.join(","),
  7771. l.length && (a.content += ",{___h4sh:{" + l.join(",") + "}}")
  7772. }
  7773. switch (s && "else" !== s && (a.content += ",[\n\n"),
  7774. s) {
  7775. case "^":
  7776. case "#":
  7777. a.content += "{fn:function(scope,options){var ___v1ew = [];";
  7778. break;
  7779. case "else":
  7780. a.content += 'return ___v1ew.join("");}},\n{inverse:function(scope,options){\nvar ___v1ew = [];';
  7781. break;
  7782. default:
  7783. a.content += ")"
  7784. }
  7785. return s || (a.startTxt = !0,
  7786. a.end = !0),
  7787. a
  7788. }
  7789. }]
  7790. })
  7791. });
  7792. for (var l = t.view.Scanner.prototype.helpers, p = 0; p < l.length; p++)
  7793. c.prototype.scanner.helpers.unshift(l[p]);
  7794. return c.txt = function(e, n, i) {
  7795. for (var r, l, p = e.scope, h = e.options, d = [], f = {
  7796. fn: function() {},
  7797. inverse: function() {}
  7798. }, g = p.attr("."), v = !0, m = 3; m < arguments.length; m++) {
  7799. var b = arguments[m];
  7800. if (n && t.isArray(b))
  7801. f = t.extend.apply(t, [f].concat(b));
  7802. else if (b && b.___h4sh) {
  7803. r = b.___h4sh;
  7804. for (var y in r)
  7805. o(r[y]) && (r[y] = c.get(r[y].get, e, !1, !0))
  7806. } else
  7807. b && o(b) ? d.push(c.get(b.get, e, !1, !0, !0)) : d.push(b)
  7808. }
  7809. if (o(i) && (v = i.get === (i = c.get(i.get, e, d.length, !1))),
  7810. f.fn = u(f.fn, p, h),
  7811. f.inverse = u(f.inverse, p, h),
  7812. "^" === n) {
  7813. var _ = f.fn;
  7814. f.fn = f.inverse,
  7815. f.inverse = _
  7816. }
  7817. return (l = v && "string" == typeof i && c.getHelper(i, h) || t.isFunction(i) && !i.isComputed && {
  7818. fn: i
  7819. }) ? (t.extend(f, {
  7820. context: g,
  7821. scope: p,
  7822. contexts: p,
  7823. hash: r
  7824. }),
  7825. d.push(f),
  7826. function() {
  7827. var t = l.fn.apply(g, d);
  7828. return null == t ? "" : t
  7829. }
  7830. ) : function() {
  7831. var e;
  7832. e = t.isFunction(i) && i.isComputed ? i() : i;
  7833. var r, o, u, c = d.length ? d : [e], l = !0, p = [];
  7834. if (n)
  7835. for (r = 0; r < c.length; r++)
  7836. u = c[r],
  7837. o = void 0 !== u && s(u),
  7838. 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;
  7839. if (l) {
  7840. if ("#" === n) {
  7841. if (a(e)) {
  7842. var h = s(e);
  7843. for (r = 0; r < e.length; r++)
  7844. p.push(f.fn(h ? e.attr("" + r) : e[r]));
  7845. return p.join("")
  7846. }
  7847. return f.fn(e || {}) || ""
  7848. }
  7849. return "^" === n ? f.inverse(e || {}) || "" : "" + (null != e ? e : "")
  7850. }
  7851. return ""
  7852. }
  7853. }
  7854. ,
  7855. c.get = function(e, n, i, r, o) {
  7856. var s = n.scope.attr(".")
  7857. , a = n.options || {};
  7858. if (i) {
  7859. if (c.getHelper(e, a))
  7860. return e;
  7861. if (n.scope && t.isFunction(s[e]))
  7862. return s[e]
  7863. }
  7864. var u = n.scope.computeData(e, {
  7865. isArgument: r,
  7866. args: [s, n.scope]
  7867. })
  7868. , l = u.compute;
  7869. t.compute.temporarilyBind(l);
  7870. var p = u.initialValue;
  7871. return c.getHelper(e, a),
  7872. o || void 0 !== p && u.scope === n.scope || !c.getHelper(e, a) ? l.computeInstance.hasDependencies ? l : p : e
  7873. }
  7874. ,
  7875. c.resolve = function(e) {
  7876. return s(e) && a(e) && e.attr("length") ? e : t.isFunction(e) ? e() : e
  7877. }
  7878. ,
  7879. c._helpers = {},
  7880. c.registerHelper = function(t, e) {
  7881. this._helpers[t] = {
  7882. name: t,
  7883. fn: e
  7884. }
  7885. }
  7886. ,
  7887. c.registerSimpleHelper = function(e, n) {
  7888. c.registerHelper(e, t.view.simpleHelper(n))
  7889. }
  7890. ,
  7891. c.getHelper = function(t, e) {
  7892. var n;
  7893. return e && (n = e.get("helpers." + t, {
  7894. proxyMethods: !1
  7895. })),
  7896. n ? {
  7897. fn: n
  7898. } : this._helpers[t]
  7899. }
  7900. ,
  7901. c.render = function(e, n, i) {
  7902. return t.view.cached[e] || t.__notObserve(function() {
  7903. var t = n.attr(e);
  7904. t && (e = t)
  7905. })(),
  7906. t.view.render(e, n, i)
  7907. }
  7908. ,
  7909. c.safeString = function(t) {
  7910. return {
  7911. toString: function() {
  7912. return t
  7913. }
  7914. }
  7915. }
  7916. ,
  7917. c.renderPartial = function(e, n, i) {
  7918. var r = i.get("partials." + e, {
  7919. proxyMethods: !1
  7920. });
  7921. return r ? r.render ? r.render(n, i) : r(n, i) : t.Mustache.render(e, n, i)
  7922. }
  7923. ,
  7924. t.each({
  7925. if: function(e, n) {
  7926. return (t.isFunction(e) ? t.compute.truthy(e)() : !!c.resolve(e)) ? n.fn(n.contexts || this) : n.inverse(n.contexts || this)
  7927. },
  7928. is: function() {
  7929. var e, n, i = arguments[arguments.length - 1];
  7930. if (arguments.length - 2 <= 0)
  7931. return i.inverse();
  7932. for (var r = 0; r < arguments.length - 1; r++) {
  7933. if (n = c.resolve(arguments[r]),
  7934. n = t.isFunction(n) ? n() : n,
  7935. r > 0 && n !== e)
  7936. return i.inverse();
  7937. e = n
  7938. }
  7939. return i.fn()
  7940. },
  7941. eq: function() {
  7942. return c._helpers.is.fn.apply(this, arguments)
  7943. },
  7944. unless: function(e, n) {
  7945. return c._helpers.if.fn.apply(this, [e, t.extend({}, n, {
  7946. fn: n.inverse,
  7947. inverse: n.fn
  7948. })])
  7949. },
  7950. each: function(e, n) {
  7951. var i, r, o, u = c.resolve(e), l = [];
  7952. if (t.view.lists && (u instanceof t.List || e && e.isComputed && void 0 === u))
  7953. return t.view.lists(e, function(t, e) {
  7954. return n.fn(n.scope.add({
  7955. "@index": e
  7956. }).add(t))
  7957. });
  7958. if ((e = u) && a(e)) {
  7959. for (o = 0; o < e.length; o++)
  7960. l.push(n.fn(n.scope.add({
  7961. "@index": o
  7962. }).add(e[o])));
  7963. return l.join("")
  7964. }
  7965. if (s(e)) {
  7966. for (i = t.Map.keys(e),
  7967. o = 0; o < i.length; o++)
  7968. r = i[o],
  7969. l.push(n.fn(n.scope.add({
  7970. "@key": r
  7971. }).add(e[r])));
  7972. return l.join("")
  7973. }
  7974. if (e instanceof Object) {
  7975. for (r in e)
  7976. l.push(n.fn(n.scope.add({
  7977. "@key": r
  7978. }).add(e[r])));
  7979. return l.join("")
  7980. }
  7981. },
  7982. with: function(t, e) {
  7983. var n = t;
  7984. if (t = c.resolve(t))
  7985. return e.fn(n)
  7986. },
  7987. log: function(t, e) {
  7988. "undefined" != typeof console && console.log && (e ? console.log(t, e.context) : console.log(t.context))
  7989. },
  7990. "@index": function(e, n) {
  7991. n || (n = e,
  7992. e = 0);
  7993. var i = n.scope.attr("@index");
  7994. return "" + ((t.isFunction(i) ? i() : i) + e)
  7995. }
  7996. }, function(t, e) {
  7997. c.registerHelper(e, t)
  7998. }),
  7999. t.view.register({
  8000. suffix: "mustache",
  8001. contentType: "x-mustache-template",
  8002. script: function(t, e) {
  8003. return "can.Mustache(function(scope,options) { " + new c({
  8004. text: e,
  8005. name: t
  8006. }).template.out + " })"
  8007. },
  8008. renderer: function(t, e) {
  8009. return c({
  8010. text: e,
  8011. name: t
  8012. })
  8013. }
  8014. }),
  8015. t.mustache.registerHelper = t.proxy(t.Mustache.registerHelper, t.Mustache),
  8016. t.mustache.safeString = t.Mustache.safeString,
  8017. t
  8018. }),
  8019. define("can/observe", ["can/util/library", "can/map", "can/list", "can/compute"], function(t) {
  8020. return t.Observe = t.Map,
  8021. t.Observe.startBatch = t.batch.start,
  8022. t.Observe.stopBatch = t.batch.stop,
  8023. t.Observe.triggerBatch = t.batch.trigger,
  8024. t
  8025. }),
  8026. define("can/util/view_model", ["can/util/library"], function(t) {
  8027. var e = t.$;
  8028. e.fn && (e.fn.scope = e.fn.viewModel = function() {
  8029. return t.viewModel.apply(t, [this].concat(t.makeArray(arguments)))
  8030. }
  8031. )
  8032. }),
  8033. 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) {
  8034. var r = /\{([^\}]+)\}/g
  8035. , o = t.Component = t.Construct.extend({
  8036. setup: function() {
  8037. if (t.Construct.setup.apply(this, arguments),
  8038. t.Component) {
  8039. var e = this
  8040. , n = this.prototype.scope || this.prototype.viewModel;
  8041. if (this.Control = s.extend(this.prototype.events),
  8042. n && ("object" != typeof n || n instanceof t.Map) ? n.prototype instanceof t.Map && (this.Map = n) : this.Map = t.Map.extend(n || {}),
  8043. this.attributeScopeMappings = {},
  8044. t.each(this.Map ? this.Map.defaults : {}, function(t, n) {
  8045. "@" === t && (e.attributeScopeMappings[n] = n)
  8046. }),
  8047. this.prototype.template)
  8048. if ("function" == typeof this.prototype.template) {
  8049. var i = this.prototype.template;
  8050. this.renderer = function() {
  8051. return t.view.frag(i.apply(null, arguments))
  8052. }
  8053. } else
  8054. this.renderer = t.view.mustache(this.prototype.template);
  8055. t.view.tag(this.prototype.tag, function(t, n) {
  8056. new e(t,n)
  8057. })
  8058. }
  8059. }
  8060. }, {
  8061. setup: function(e, r) {
  8062. var o, s, a = {
  8063. "%root": r.scope.attr("%root")
  8064. }, u = this, c = void 0 !== this.leakScope && !this.leakScope && !!this.template, l = [], p = t.$(e), h = !t.data(p, "preventDataBindings");
  8065. t.each(this.constructor.attributeScopeMappings, function(n, i) {
  8066. a[i] = e.getAttribute(t.hyphenate(n))
  8067. }),
  8068. h && l.push(i.behaviors.viewModel(e, r, function(n) {
  8069. var i = u.scope || u.viewModel;
  8070. if (u.constructor.Map)
  8071. o = new u.constructor.Map(n);
  8072. else if (i instanceof t.Map)
  8073. o = i;
  8074. else if (t.isFunction(i)) {
  8075. var s = i.call(u, n, r.scope, e);
  8076. o = s instanceof t.Map ? s : s.prototype instanceof t.Map ? new s(n) : new (t.Map.extend(s))(n)
  8077. }
  8078. var a = o.serialize;
  8079. return o.serialize = function() {
  8080. var t = a.apply(this, arguments);
  8081. return delete t["%root"],
  8082. t
  8083. }
  8084. ,
  8085. o
  8086. }, a)),
  8087. this.scope = this.viewModel = o,
  8088. t.data(p, "scope", this.viewModel),
  8089. t.data(p, "viewModel", this.viewModel),
  8090. t.data(p, "preventDataBindings", !0);
  8091. var d;
  8092. d = c ? t.view.Scope.refsScope().add(this.viewModel, {
  8093. viewModel: !0
  8094. }) : (this.constructor.renderer ? r.scope.add(new t.view.Scope.Refs) : r.scope).add(this.viewModel, {
  8095. viewModel: !0
  8096. });
  8097. var f = {
  8098. helpers: {}
  8099. }
  8100. , g = function(t, e) {
  8101. f.helpers[t] = function() {
  8102. return e.apply(o, arguments)
  8103. }
  8104. };
  8105. t.each(this.helpers || {}, function(e, n) {
  8106. t.isFunction(e) && g(n, e)
  8107. }),
  8108. t.each(this.simpleHelpers || {}, function(e, n) {
  8109. g(n, t.view.simpleHelper(e))
  8110. }),
  8111. this._control = new this.constructor.Control(e,{
  8112. scope: this.viewModel,
  8113. viewModel: this.viewModel,
  8114. destroy: function() {
  8115. for (var t = 0, e = l.length; t < e; t++)
  8116. l[t]()
  8117. }
  8118. });
  8119. var v = t.view.nodeLists.register([], void 0, r.parentNodeList || !0, !1);
  8120. v.expression = "<" + this.tag + ">",
  8121. l.push(function() {
  8122. t.view.nodeLists.unregister(v)
  8123. }),
  8124. this.constructor.renderer ? (f.tags || (f.tags = {}),
  8125. f.tags.content = function e(i, o) {
  8126. var s = r.subtemplate || o.subtemplate
  8127. , a = s === r.subtemplate;
  8128. if (s) {
  8129. delete f.tags.content;
  8130. var u;
  8131. if (u = a ? c ? r : {
  8132. scope: o.scope.cloneFromRef(),
  8133. options: o.options
  8134. } : o,
  8135. o.parentNodeList) {
  8136. var l = s(u.scope, u.options, o.parentNodeList);
  8137. n.replace([i], l)
  8138. } else
  8139. t.view.live.replace([i], s(u.scope, u.options));
  8140. f.tags.content = e
  8141. }
  8142. }
  8143. ,
  8144. 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(),
  8145. t.appendChild(e, s, t.document),
  8146. t.view.nodeLists.update(v, t.childNodes(e))
  8147. }
  8148. })
  8149. , s = t.Control.extend({
  8150. _lookup: function(t) {
  8151. return [t.scope, t, window]
  8152. },
  8153. _action: function(e, n, i) {
  8154. var o, s;
  8155. if (r.lastIndex = 0,
  8156. o = r.test(e),
  8157. i || !o) {
  8158. if (o) {
  8159. s = t.compute(function() {
  8160. var i, o = e.replace(r, function(e, r) {
  8161. var o;
  8162. return "scope" === r || "viewModel" === r ? (i = n.viewModel,
  8163. "") : (r = r.replace(/^(scope|^viewModel)\./, ""),
  8164. void 0 === (o = t.compute.read(n.viewModel, t.compute.read.reads(r), {
  8165. isArgument: !0
  8166. }).value) && (o = t.getObject(r)),
  8167. "string" == typeof o ? o : (i = o,
  8168. ""))
  8169. }), s = o.split(/\s+/g), a = s.pop();
  8170. return {
  8171. processor: this.processors[a] || this.processors.click,
  8172. parts: [o, s.join(" "), a],
  8173. delegate: i || void 0
  8174. }
  8175. }, this);
  8176. var a = function(t, n) {
  8177. i._bindings.control[e](i.element),
  8178. i._bindings.control[e] = n.processor(n.delegate || i.element, n.parts[2], n.parts[1], e, i)
  8179. };
  8180. return s.bind("change", a),
  8181. i._bindings.readyComputes[e] = {
  8182. compute: s,
  8183. handler: a
  8184. },
  8185. s()
  8186. }
  8187. return t.Control._action.apply(this, arguments)
  8188. }
  8189. }
  8190. }, {
  8191. setup: function(e, n) {
  8192. return this.scope = n.scope,
  8193. this.viewModel = n.viewModel,
  8194. t.Control.prototype.setup.call(this, e, n)
  8195. },
  8196. off: function() {
  8197. this._bindings && t.each(this._bindings.readyComputes || {}, function(t) {
  8198. t.compute.unbind("change", t.handler)
  8199. }),
  8200. t.Control.prototype.off.apply(this, arguments),
  8201. this._bindings.readyComputes = {}
  8202. },
  8203. destroy: function() {
  8204. t.Control.prototype.destroy.apply(this, arguments),
  8205. "function" == typeof this.options.destroy && this.options.destroy.apply(this, arguments)
  8206. }
  8207. })
  8208. , a = t.$;
  8209. return a.fn && (a.fn.scope = a.fn.viewModel = function() {
  8210. return t.viewModel.apply(t, [this].concat(t.makeArray(arguments)))
  8211. }
  8212. ),
  8213. o
  8214. }),
  8215. define("can", ["can/util/library", "can/control/route", "can/model", "can/map/define", "can/view/mustache", "can/component"], function(t) {
  8216. return t
  8217. }),
  8218. define("smsc", [], function() {
  8219. return SMSC
  8220. }),
  8221. define("jqueryui", ["jquery"], function() {
  8222. return jQuery
  8223. }),
  8224. require(["jquery", "smsc", "jqueryui"], function(t, e) {
  8225. t.ajaxSetup({
  8226. error: function(n) {
  8227. function i(e, n) {
  8228. var i = {}
  8229. , r = t("#smscErrorHandlerDialog");
  8230. 0 === r.length ? (t("body").append('<div id="smscErrorHandlerDialog">' + n + "</div>"),
  8231. r = t("#smscErrorHandlerDialog")) : r.html(n),
  8232. r.is(":data(dialog)") || r.dialog({
  8233. autoOpen: !1,
  8234. modal: !0,
  8235. title: e,
  8236. resizable: !1,
  8237. beforeClose: function() {
  8238. t(this).remove()
  8239. }
  8240. }),
  8241. i.OK = function() {
  8242. t(this).dialog("close")
  8243. }
  8244. ,
  8245. r.dialog("option", "buttons", i),
  8246. r.dialog("open")
  8247. }
  8248. var r;
  8249. switch (n.status) {
  8250. case 400:
  8251. r = n.responseText,
  8252. i(e.vars.lng_rpc_error_title, r);
  8253. break;
  8254. case 401:
  8255. window.location = "/";
  8256. break;
  8257. case 0:
  8258. break;
  8259. default:
  8260. !n.getAllResponseHeaders() || i(e.vars.lng_rpc_error_title, e.vars.lng_rpc_error_unknown_msg)
  8261. }
  8262. }
  8263. })
  8264. }),
  8265. define("models/../../../../smsc/desktop/utils/errorHandler", function() {}),
  8266. define("models/login", ["jquery", "can", "../../../../smsc/desktop/utils/errorHandler"], function(t, e) {
  8267. return e.Model({
  8268. getToken: function(e, n) {
  8269. t.ajax({
  8270. url: "/Authentication/Login/Token",
  8271. type: "post",
  8272. dataType: "json",
  8273. data: e,
  8274. success: n
  8275. })
  8276. },
  8277. encryptPwd: function(t, e) {
  8278. var n, i, r, o = "", s = certParser(e);
  8279. return s.b64 && (n = pidCryptUtil.decodeBase64(s.b64),
  8280. i = new pidCrypt.RSA,
  8281. r = pidCrypt.ASN1.decode(pidCryptUtil.toByteArray(n)),
  8282. i.setPublicKeyFromASN(r.toHexTree()),
  8283. o = pidCryptUtil.encodeBase64(pidCryptUtil.convertFromHex(i.encrypt(pidCryptUtil.encodeBase64(t, !0))))),
  8284. o
  8285. },
  8286. getAutoLoginData: function(e, n) {
  8287. t.ajax({
  8288. url: "/Authentication/Login/AutoLogin",
  8289. type: "post",
  8290. dataType: "json",
  8291. data: e,
  8292. success: n
  8293. })
  8294. },
  8295. sendLoginData: function(e, n) {
  8296. t.ajax({
  8297. url: "/Authentication/Login/logindata",
  8298. type: "post",
  8299. dataType: "json",
  8300. data: e,
  8301. success: n
  8302. })
  8303. },
  8304. gatherData: function(e) {
  8305. t.ajax({
  8306. url: "/Authentication/Login/gatherdata",
  8307. type: "post",
  8308. dataType: "json",
  8309. data: e
  8310. })
  8311. },
  8312. yubiAuto: function(e, n) {
  8313. t.ajax({
  8314. url: "/Authentication/Login/yubiauto",
  8315. type: "post",
  8316. dataType: "json",
  8317. data: e,
  8318. success: n
  8319. })
  8320. }
  8321. }, {})
  8322. }),
  8323. define("text", ["module"], function(t) {
  8324. "use strict";
  8325. 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() || {};
  8326. return e = {
  8327. version: "2.0.14",
  8328. strip: function(t) {
  8329. if (t) {
  8330. var e = (t = t.replace(a, "")).match(u);
  8331. e && (t = e[1])
  8332. } else
  8333. t = "";
  8334. return t
  8335. },
  8336. jsEscape: function(t) {
  8337. 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")
  8338. },
  8339. createXhr: f.createXhr || function() {
  8340. var t, e, n;
  8341. if ("undefined" != typeof XMLHttpRequest)
  8342. return new XMLHttpRequest;
  8343. if ("undefined" != typeof ActiveXObject)
  8344. for (e = 0; e < 3; e += 1) {
  8345. n = s[e];
  8346. try {
  8347. t = new ActiveXObject(n)
  8348. } catch (t) {}
  8349. if (t) {
  8350. s = [n];
  8351. break
  8352. }
  8353. }
  8354. return t
  8355. }
  8356. ,
  8357. parseName: function(t) {
  8358. var e, n, i, r = !1, o = t.lastIndexOf("."), s = 0 === t.indexOf("./") || 0 === t.indexOf("../");
  8359. return -1 !== o && (!s || o > 1) ? (e = t.substring(0, o),
  8360. n = t.substring(o + 1)) : e = t,
  8361. i = n || e,
  8362. -1 !== (o = i.indexOf("!")) && (r = "strip" === i.substring(o + 1),
  8363. i = i.substring(0, o),
  8364. n ? n = i : e = i),
  8365. {
  8366. moduleName: e,
  8367. ext: n,
  8368. strip: r
  8369. }
  8370. },
  8371. xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
  8372. useXhr: function(t, n, i, r) {
  8373. var o, s, a, u = e.xdRegExp.exec(t);
  8374. return !(u && (o = u[2],
  8375. s = u[3],
  8376. s = s.split(":"),
  8377. a = s[1],
  8378. s = s[0],
  8379. o && o !== n || s && s.toLowerCase() !== i.toLowerCase() || (a || s) && a !== r))
  8380. },
  8381. finishLoad: function(t, n, i, r) {
  8382. i = n ? e.strip(i) : i,
  8383. f.isBuild && (d[t] = i),
  8384. r(i)
  8385. },
  8386. load: function(t, n, i, r) {
  8387. if (r && r.isBuild && !r.inlineText)
  8388. i();
  8389. else {
  8390. f.isBuild = r && r.isBuild;
  8391. var o = e.parseName(t)
  8392. , s = o.moduleName + (o.ext ? "." + o.ext : "")
  8393. , a = n.toUrl(s)
  8394. , u = f.useXhr || e.useXhr;
  8395. 0 !== a.indexOf("empty:") ? !c || u(a, l, p, h) ? e.get(a, function(n) {
  8396. e.finishLoad(t, o.strip, n, i)
  8397. }, function(t) {
  8398. i.error && i.error(t)
  8399. }) : n([s], function(t) {
  8400. e.finishLoad(o.moduleName + "." + o.ext, o.strip, t, i)
  8401. }) : i()
  8402. }
  8403. },
  8404. write: function(t, n, i, r) {
  8405. if (d.hasOwnProperty(n)) {
  8406. var o = e.jsEscape(d[n]);
  8407. i.asModule(t + "!" + n, "define(function () { return '" + o + "';});\n")
  8408. }
  8409. },
  8410. writeFile: function(t, n, i, r, o) {
  8411. var s = e.parseName(n)
  8412. , a = s.ext ? "." + s.ext : ""
  8413. , u = s.moduleName + a
  8414. , c = i.toUrl(s.moduleName + a) + ".js";
  8415. e.load(u, i, function(n) {
  8416. var i = function(t) {
  8417. return r(c, t)
  8418. };
  8419. i.asModule = function(t, e) {
  8420. return r.asModule(t, c, e)
  8421. }
  8422. ,
  8423. e.write(t, u, i, o)
  8424. }, o)
  8425. }
  8426. },
  8427. "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"),
  8428. e.get = function(t, e, i) {
  8429. try {
  8430. var r = n.readFileSync(t, "utf8");
  8431. "\ufeff" === r[0] && (r = r.substring(1)),
  8432. e(r)
  8433. } catch (t) {
  8434. i && i(t)
  8435. }
  8436. }
  8437. ) : "xhr" === f.env || !f.env && e.createXhr() ? e.get = function(t, n, i, r) {
  8438. var o, s = e.createXhr();
  8439. if (s.open("GET", t, !0),
  8440. r)
  8441. for (o in r)
  8442. r.hasOwnProperty(o) && s.setRequestHeader(o.toLowerCase(), r[o]);
  8443. f.onXhr && f.onXhr(s, t),
  8444. s.onreadystatechange = function(e) {
  8445. var r, o;
  8446. 4 === s.readyState && ((r = s.status || 0) > 399 && r < 600 ? (o = new Error(t + " HTTP status: " + r),
  8447. o.xhr = s,
  8448. i && i(o)) : n(s.responseText),
  8449. f.onXhrComplete && f.onXhrComplete(s, t))
  8450. }
  8451. ,
  8452. s.send(null)
  8453. }
  8454. : "rhino" === f.env || !f.env && "undefined" != typeof Packages && "undefined" != typeof java ? e.get = function(t, e) {
  8455. 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 = "";
  8456. try {
  8457. for (n = new java.lang.StringBuffer,
  8458. (i = s.readLine()) && i.length() && 65279 === i.charAt(0) && (i = i.substring(1)),
  8459. null !== i && n.append(i); null !== (i = s.readLine()); )
  8460. n.append(o),
  8461. n.append(i);
  8462. a = String(n.toString())
  8463. } finally {
  8464. s.close()
  8465. }
  8466. e(a)
  8467. }
  8468. : ("xpconnect" === f.env || !f.env && "undefined" != typeof Components && Components.classes && Components.interfaces) && (i = Components.classes,
  8469. r = Components.interfaces,
  8470. Components.utils.import("resource://gre/modules/FileUtils.jsm"),
  8471. o = "@mozilla.org/windows-registry-key;1"in i,
  8472. e.get = function(t, e) {
  8473. var n, s, a, u = {};
  8474. o && (t = t.replace(/\//g, "\\")),
  8475. a = new FileUtils.File(t);
  8476. try {
  8477. (n = i["@mozilla.org/network/file-input-stream;1"].createInstance(r.nsIFileInputStream)).init(a, 1, 0, !1),
  8478. (s = i["@mozilla.org/intl/converter-input-stream;1"].createInstance(r.nsIConverterInputStream)).init(n, "utf-8", n.available(), r.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),
  8479. s.readString(n.available(), u),
  8480. s.close(),
  8481. n.close(),
  8482. e(u.value)
  8483. } catch (t) {
  8484. throw new Error((a && a.path || "") + ": " + t)
  8485. }
  8486. }
  8487. ),
  8488. e
  8489. }),
  8490. define("text!yubikey/views/yubikey.ejs", [], function() {
  8491. 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>'
  8492. }),
  8493. define("can/view/ejs", ["can/util/library", "can/view", "can/util/string", "can/compute", "can/scanner", "can/render"], function(t) {
  8494. var e = t.extend
  8495. , n = function(t) {
  8496. if (this.constructor !== n) {
  8497. var i = new n(t);
  8498. return function(t, e) {
  8499. return i.render(t, e)
  8500. }
  8501. }
  8502. "function" != typeof t ? (e(this, t),
  8503. this.template = this.scanner.scan(this.text, this.name)) : this.template = {
  8504. fn: t
  8505. }
  8506. };
  8507. return t.EJS = n,
  8508. n.prototype.render = function(t, e) {
  8509. return t = t || {},
  8510. this.template.fn.call(t, t, new n.Helpers(t,e || {}))
  8511. }
  8512. ,
  8513. e(n.prototype, {
  8514. scanner: new t.view.Scanner({
  8515. text: {
  8516. outStart: "with(_VIEW) { with (_CONTEXT) {",
  8517. outEnd: "}}",
  8518. argNames: "_CONTEXT,_VIEW",
  8519. context: "this"
  8520. },
  8521. tokens: [["templateLeft", "<%%"], ["templateRight", "%>"], ["returnLeft", "<%=="], ["escapeLeft", "<%="], ["commentLeft", "<%#"], ["left", "<%"], ["right", "%>"], ["returnRight", "%>"]],
  8522. helpers: [{
  8523. name: /\s*\(([\$\w]+)\)\s*->([^\n]*)/,
  8524. fn: function(t) {
  8525. var e = /\s*\(([\$\w]+)\)\s*->([^\n]*)/
  8526. , n = t.match(e);
  8527. return "can.proxy(function(__){var " + n[1] + "=can.$(__);" + n[2] + "}, this);"
  8528. }
  8529. }],
  8530. transform: function(t) {
  8531. return t.replace(/<%([\s\S]+?)%>/gm, function(t, e) {
  8532. var n, i, r = [];
  8533. e.replace(/[{}]/gm, function(t, e) {
  8534. r.push([t, e])
  8535. });
  8536. do {
  8537. for (n = !1,
  8538. i = r.length - 2; i >= 0; i--)
  8539. if ("{" === r[i][0] && "}" === r[i + 1][0]) {
  8540. r.splice(i, 2),
  8541. n = !0;
  8542. break
  8543. }
  8544. } while (n);if (r.length >= 2) {
  8545. var o, s = ["<%"], a = 0;
  8546. for (i = 0; o = r[i]; i++)
  8547. s.push(e.substring(a, a = o[1])),
  8548. "{" === o[0] && i < r.length - 1 || "}" === o[0] && i > 0 ? s.push("{" === o[0] ? "{ %><% " : " %><% }") : s.push(o[0]),
  8549. ++a;
  8550. return s.push(e.substring(a), "%>"),
  8551. s.join("")
  8552. }
  8553. return "<%" + e + "%>"
  8554. })
  8555. }
  8556. })
  8557. }),
  8558. n.Helpers = function(t, n) {
  8559. this._data = t,
  8560. this._extras = n,
  8561. e(this, n)
  8562. }
  8563. ,
  8564. n.Helpers.prototype = {
  8565. list: function(e, n) {
  8566. t.each(e, function(t, i) {
  8567. n(t, i, e)
  8568. })
  8569. },
  8570. each: function(e, n) {
  8571. t.isArray(e) ? this.list(e, n) : t.view.lists(e, n)
  8572. }
  8573. },
  8574. t.view.register({
  8575. suffix: "ejs",
  8576. script: function(t, e) {
  8577. return "can.EJS(function(_CONTEXT,_VIEW) { " + new n({
  8578. text: e,
  8579. name: t
  8580. }).template.out + " })"
  8581. },
  8582. renderer: function(t, e) {
  8583. return n({
  8584. text: e,
  8585. name: t
  8586. })
  8587. }
  8588. }),
  8589. t.ejs.Helpers = n.Helpers,
  8590. t
  8591. }),
  8592. define("yubikey/yubikey", ["jquery", "can", "smsc", "text!./views/yubikey.ejs", "can/view/ejs"], function(t, e, n, i) {
  8593. return e.ejs("modules_authentication_app_yubikey_views_yubikey", i),
  8594. e.Control.extend({
  8595. init: function() {
  8596. var n = this;
  8597. this.element.dialog({
  8598. title: "",
  8599. modal: !0,
  8600. resizable: !1,
  8601. width: 640,
  8602. height: 360,
  8603. beforeClose: function(e) {
  8604. e.preventDefault(),
  8605. n.options.opener.closeYubiKey(),
  8606. t(this).parents(".smscWindow").remove(),
  8607. t(this).remove()
  8608. }
  8609. }).parents(".ui-dialog:eq(0)").wrap('<div class="smscWindow no-gradient"></div>'),
  8610. this.element.html(e.view("modules_authentication_app_yubikey_views_yubikey", {
  8611. lng_title: this.options.lng.lng_yubikey_title,
  8612. lng_subtitle: !0 === this.options.fromForce ? this.options.lng.lng_yubikey_subtitle_info : this.options.lng.lng_yubikey_subtitle,
  8613. lng_subtitle1: this.options.lng.lng_yubikey_subtitle1,
  8614. lng_subtitle2: this.options.lng.lng_yubikey_subtitle2
  8615. })),
  8616. this.element.dialog("open"),
  8617. this.focus()
  8618. },
  8619. focus: function() {
  8620. this.element.find("input:first").focus()
  8621. },
  8622. "input[name=yubikey] keydown": function(t, e) {
  8623. 13 == e.keyCode && (this.options.opener.handleYubiKey(t.val()),
  8624. this.element.dialog("close"))
  8625. }
  8626. })
  8627. }),
  8628. define("models/totp", ["jquery", "can"], function(t, e) {
  8629. return e.Model({
  8630. getConfig: function(t) {
  8631. return e.ajax({
  8632. url: "/Authentication/Totp/getconfig",
  8633. type: "POST",
  8634. dataType: "json",
  8635. data: t
  8636. }).promise()
  8637. },
  8638. getTwofactorConfig: function(t) {
  8639. return e.ajax({
  8640. url: "/Authentication/Login/gettwofactorconfig",
  8641. type: "POST",
  8642. dataType: "json",
  8643. data: t
  8644. }).promise()
  8645. },
  8646. getValidationConfig: function(t) {
  8647. return e.ajax({
  8648. url: "/Authentication/Login/gettotpvalidationconfig",
  8649. type: "POST",
  8650. dataType: "json",
  8651. data: t
  8652. }).promise()
  8653. },
  8654. validateAndSafeCode: function(t) {
  8655. return e.ajax({
  8656. url: "/Authentication/Totp/validateandsavecode",
  8657. type: "POST",
  8658. dataType: "json",
  8659. data: t
  8660. }).promise()
  8661. },
  8662. validateTwoFactorAndSafeCode: function(t) {
  8663. return e.ajax({
  8664. url: "/Authentication/Login/validateandsavecode",
  8665. type: "POST",
  8666. dataType: "json",
  8667. data: t
  8668. }).promise()
  8669. },
  8670. validateCode: function(t) {
  8671. return e.ajax({
  8672. url: "/Authentication/Totp/validatecode",
  8673. type: "POST",
  8674. dataType: "json",
  8675. data: t
  8676. }).promise()
  8677. },
  8678. unsetTotp: function(t) {
  8679. return e.ajax({
  8680. url: "/Authentication/Totp/unsettotp",
  8681. type: "POST",
  8682. dataType: "json",
  8683. data: t
  8684. }).promise()
  8685. }
  8686. }, {})
  8687. }),
  8688. define("mainui/confirm/amd/confirm", ["jquery", "can", "jqueryui"], function(t, e) {
  8689. return function(n) {
  8690. var i, r, o = {
  8691. title: "",
  8692. msg: "",
  8693. ok_title: "",
  8694. cancel_title: "",
  8695. ok_class: "",
  8696. cancel_class: "",
  8697. smscWindow: !1,
  8698. width: 300,
  8699. height: 150
  8700. }, s = e.extend({}, o, n), a = {}, u = t("#smscConfirmDialog");
  8701. return 0 === u.length ? (t("body").append('<div id="smscConfirmDialog">' + s.msg + "</div>"),
  8702. u = t("#smscConfirmDialog")) : u.html(s.msg),
  8703. u.is(":data(dialog)") || u.dialog({
  8704. autoOpen: !1,
  8705. modal: !0,
  8706. title: s.title,
  8707. resizable: !1,
  8708. width: s.width,
  8709. beforeClose: function(e, n) {
  8710. t(this).remove()
  8711. }
  8712. }),
  8713. "" !== s.cancel_title && (r = s.cancel_title,
  8714. a[r] = {
  8715. click: function() {
  8716. var e = t(this);
  8717. e.trigger("canceled"),
  8718. e.dialog("close")
  8719. },
  8720. text: s.cancel_title,
  8721. class: s.cancel_class
  8722. }),
  8723. "" !== s.ok_title && (i = s.ok_title,
  8724. a[i] = {
  8725. click: function() {
  8726. var e = t(this);
  8727. e.trigger("confirmed"),
  8728. e.dialog("close")
  8729. },
  8730. text: s.ok_title,
  8731. class: s.ok_class
  8732. }),
  8733. u.dialog("option", "buttons", a),
  8734. u.dialog("open"),
  8735. s.smscWindow && (u.parents(".ui-dialog:eq(0)").css("overflow", "visible").wrap('<div class="smscWindow no-gradient"></div>'),
  8736. "" === s.ok_class && (s.ok_class = "smscButton blue"),
  8737. "" === s.cancel_class && (s.cancel_class = "smscButton"),
  8738. 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),
  8739. u.parents(".ui-dialog:eq(0)").find(".ui-dialog-buttonset button:eq(1)").attr("class", s.ok_class))),
  8740. u
  8741. }
  8742. }),
  8743. define("text!totp/views/totp.stache", [], function() {
  8744. 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>'
  8745. }),
  8746. define("text!totp/views/totp_qr.stache", [], function() {
  8747. 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>'
  8748. }),
  8749. define("text!totp/views/totp_manual.stache", [], function() {
  8750. 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>'
  8751. }),
  8752. define("can/view/target", ["can/util/library", "can/elements"], function(t, e, n) {
  8753. function i(t, n, i, r) {
  8754. var o, s, c, h, d, f = i, g = typeof t, v = function() {
  8755. return o || (o = {
  8756. path: i,
  8757. callbacks: []
  8758. },
  8759. n.push(o),
  8760. f = []),
  8761. o
  8762. };
  8763. if ("object" === g) {
  8764. if (t.tag) {
  8765. if (s = l && t.namespace ? r.createElementNS(t.namespace, t.tag) : r.createElement(t.tag),
  8766. t.attrs)
  8767. for (var m in t.attrs) {
  8768. var b = t.attrs[m];
  8769. "function" == typeof b ? v().callbacks.push({
  8770. callback: b
  8771. }) : p(s, m, b)
  8772. }
  8773. if (t.attributes)
  8774. for (h = 0,
  8775. d = t.attributes.length; h < d; h++)
  8776. v().callbacks.push({
  8777. callback: t.attributes[h]
  8778. });
  8779. t.children && t.children.length && (c = o ? o.paths = [] : n,
  8780. s.appendChild(a(t.children, c, f, r)))
  8781. } else if (t.comment && (s = r.createComment(t.comment),
  8782. t.callbacks))
  8783. for (h = 0,
  8784. d = t.attributes.length; h < d; h++)
  8785. v().callbacks.push({
  8786. callback: t.callbacks[h]
  8787. })
  8788. } else
  8789. "string" === g ? s = r.createTextNode(t) : "function" === g && (u ? (s = r.createTextNode(""),
  8790. v().callbacks.push({
  8791. callback: t
  8792. })) : (s = r.createComment("~"),
  8793. v().callbacks.push({
  8794. callback: function() {
  8795. var n = r.createTextNode("");
  8796. return e.replace([this], n),
  8797. t.apply(n, arguments)
  8798. }
  8799. })));
  8800. return s
  8801. }
  8802. function r(t, e, n) {
  8803. 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++)
  8804. a = a.childNodes.item(i[l]);
  8805. for (l = 0; l < c; l++)
  8806. r(a, s[l], n);
  8807. n.push({
  8808. element: a,
  8809. callbacks: o
  8810. })
  8811. }
  8812. function o(t, e) {
  8813. for (var n, i, r, o = t.length, s = 0; s < o; s++) {
  8814. n = (r = t[s]).callbacks.length,
  8815. i = r.element;
  8816. for (var a = 0; a < n; a++)
  8817. r.callbacks[a].callback.apply(i, e)
  8818. }
  8819. }
  8820. function s(e, n) {
  8821. var i = []
  8822. , s = a(e, i, [], n || t.global.document);
  8823. return {
  8824. paths: i,
  8825. clone: s,
  8826. hydrate: function() {
  8827. for (var e = h(this.clone), n = t.makeArray(arguments), s = [], a = 0; a < i.length; a++)
  8828. r(e, i[a], s);
  8829. return o(s, n),
  8830. e
  8831. }
  8832. }
  8833. }
  8834. var a = function(t, e, n, r) {
  8835. for (var o = r.createDocumentFragment(), s = 0, a = t.length; s < a; s++) {
  8836. var u = t[s];
  8837. o.appendChild(i(u, e, n.concat(s), r))
  8838. }
  8839. return o
  8840. }
  8841. , u = "undefined" != typeof document && function() {
  8842. var e = document.createDocumentFragment()
  8843. , n = document.createElement("div");
  8844. n.appendChild(document.createTextNode("")),
  8845. n.appendChild(document.createTextNode("")),
  8846. e.appendChild(n);
  8847. var i = e.cloneNode(!0);
  8848. return 2 === t.childNodes(i.firstChild).length
  8849. }()
  8850. , c = "undefined" != typeof document && function() {
  8851. var t = document.createElement("a");
  8852. return t.innerHTML = "<xyz></xyz>",
  8853. "<xyz></xyz>" === t.cloneNode(!0).innerHTML
  8854. }()
  8855. , l = "undefined" != typeof document && !!document.createElementNS
  8856. , p = t.attr.setAttribute
  8857. , h = c ? function(t) {
  8858. return t.cloneNode(!0)
  8859. }
  8860. : function(e) {
  8861. var n;
  8862. 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()),
  8863. e.attributes) {
  8864. var i = t.makeArray(e.attributes);
  8865. t.each(i, function(t) {
  8866. t && t.specified && p(n, t.nodeName, t.nodeValue)
  8867. })
  8868. }
  8869. return e.childNodes && t.each(e.childNodes, function(t) {
  8870. n.appendChild(h(t))
  8871. }),
  8872. n
  8873. }
  8874. ;
  8875. return s.keepsTextNodes = u,
  8876. t.view.target = s,
  8877. s
  8878. }),
  8879. 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) {
  8880. r = r || t.view.live,
  8881. o = o || t.view.elements,
  8882. s = s || t.view.Scope,
  8883. a = a || t.view.nodeLists;
  8884. var u = /(?:(?:^|(\r?)\n)(\s*)(\{\{([^\}]*)\}\}\}?)([^\S\n\r]*)($|\r?\n))|(\{\{([^\}]*)\}\}\}?)/g
  8885. , c = function(e, n, i, r) {
  8886. for (var o = (t.document || t.global.document).createDocumentFragment(), s = 0, a = e.length; s < a; s++)
  8887. l(o, i.fn(n ? e.attr("" + s) : e[s], r));
  8888. return o
  8889. }
  8890. , l = function(t, e) {
  8891. e && t.appendChild("string" == typeof e ? t.ownerDocument.createTextNode(e) : e)
  8892. }
  8893. , p = function(t, e, n, i) {
  8894. for (var r = "", o = 0, s = t.length; o < s; o++)
  8895. r += n.fn(e ? t.attr("" + o) : t[o], i);
  8896. return r
  8897. }
  8898. , h = {
  8899. expression: i,
  8900. makeEvaluator: function(n, r, o, s, a, u, l, h) {
  8901. if ("^" === s) {
  8902. var d = u;
  8903. u = l,
  8904. l = d
  8905. }
  8906. var f, g;
  8907. if (a instanceof i.Call) {
  8908. if (g = {
  8909. fn: function() {},
  8910. inverse: function() {},
  8911. context: n.attr("."),
  8912. scope: n,
  8913. nodeList: o,
  8914. exprData: a,
  8915. helpersScope: r
  8916. },
  8917. e.convertToScopes(g, n, r, o, u, l),
  8918. f = a.value(n, r, g),
  8919. a.isHelper)
  8920. return f
  8921. } else {
  8922. var v = {
  8923. isArgument: !0,
  8924. args: [n.attr("."), n],
  8925. asCompute: !0
  8926. }
  8927. , m = a.helperAndValue(n, r, v, o, u, l, h)
  8928. , b = m.helper;
  8929. if (f = m.value,
  8930. b)
  8931. return a.evaluator(b, n, r, v, o, u, l, h)
  8932. }
  8933. return s ? "#" === s || "^" === s ? (g = {
  8934. fn: function() {},
  8935. inverse: function() {}
  8936. },
  8937. e.convertToScopes(g, n, r, o, u, l),
  8938. function() {
  8939. var i;
  8940. if ("function" == typeof (i = t.isFunction(f) && f.isComputed ? f() : f))
  8941. return i;
  8942. if (e.isArrayLike(i)) {
  8943. var o = e.isObserveLike(i);
  8944. return (o ? i.attr("length") : i.length) ? (h ? p : c)(i, o, g, r) : g.inverse(n, r)
  8945. }
  8946. return i ? g.fn(i || n, r) : g.inverse(n, r)
  8947. }
  8948. ) : void 0 : f && f.isComputed ? f : function() {
  8949. return "" + (null != f ? f : "")
  8950. }
  8951. },
  8952. makeLiveBindingPartialRenderer: function(e, n) {
  8953. return e = t.trim(e),
  8954. function(i, o, s) {
  8955. var u = [this];
  8956. u.expression = ">" + e,
  8957. a.register(u, null, s || !0, n.directlyNested);
  8958. var c = t.compute(function() {
  8959. var n, r = e, s = o.attr("partials." + r);
  8960. if (s)
  8961. n = s.render ? s.render(i, o) : s(i, o);
  8962. else {
  8963. var a = i.read(r, {
  8964. isArgument: !0
  8965. }).value;
  8966. if (null === a || !a && "*" === r[0])
  8967. return t.frag("");
  8968. a && (r = a),
  8969. n = t.isFunction(r) ? r(i, o) : t.view.render(r, i, o)
  8970. }
  8971. return t.frag(n)
  8972. });
  8973. r.html(this, c, this.parentNode, u)
  8974. }
  8975. },
  8976. makeStringBranchRenderer: function(t, e) {
  8977. var n = h.expression.parse(e)
  8978. , r = t + e;
  8979. return n instanceof i.Helper || n instanceof i.Call || (n = new i.Helper(n,[],{})),
  8980. function(e, i, o, s) {
  8981. var a = e.__cache[r];
  8982. !t && a || (a = d(e, i, null, t, n, o, s, !0),
  8983. t || (e.__cache[r] = a));
  8984. var u = a();
  8985. return null == u ? "" : "" + u
  8986. }
  8987. },
  8988. makeLiveBindingBranchRenderer: function(e, n, s) {
  8989. var u = h.expression.parse(n);
  8990. return u instanceof i.Helper || u instanceof i.Call || (u = new i.Helper(u,[],{})),
  8991. function(i, c, l, p, h) {
  8992. var f = [this];
  8993. f.expression = n,
  8994. a.register(f, null, l || !0, s.directlyNested);
  8995. var g, v = d(i, c, f, e, u, p, h, s.tag), m = v.isComputed;
  8996. (g = m ? v : t.compute(v, null, !1)).computeInstance.bind("change", t.k);
  8997. var b = g();
  8998. "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)),
  8999. g.computeInstance.unbind("change", t.k)
  9000. }
  9001. },
  9002. splitModeFromExpression: function(e, n) {
  9003. var i = (e = t.trim(e)).charAt(0);
  9004. return "#/{&^>!".indexOf(i) >= 0 ? e = t.trim(e.substr(1)) : i = null,
  9005. "{" === i && n.node && (i = null),
  9006. {
  9007. mode: i,
  9008. expression: e
  9009. }
  9010. },
  9011. cleanLineEndings: function(t) {
  9012. return t.replace(u, function(t, e, n, i, r, o, s, a, u, c) {
  9013. o = o || "",
  9014. e = e || "",
  9015. n = n || "";
  9016. var l = f(r || u, {});
  9017. 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" : "")
  9018. })
  9019. },
  9020. Options: e.Options
  9021. }
  9022. , d = h.makeEvaluator
  9023. , f = h.splitModeFromExpression;
  9024. return t.view.mustacheCore = h,
  9025. h
  9026. }),
  9027. define("can/view/html_section", ["can/util/library", "can/view/target", "can/view/utils", "can/view/mustache_core"], function(t, e, n, i) {
  9028. var r = "undefined" != typeof document && function() {
  9029. var t = document.createElement("div");
  9030. return function(e) {
  9031. return -1 === e.indexOf("&") ? e.replace(/\r\n/g, "\n") : (t.innerHTML = e,
  9032. 0 === t.childNodes.length ? "" : t.childNodes.item(0).nodeValue)
  9033. }
  9034. }()
  9035. , o = function() {
  9036. this.stack = [new s]
  9037. };
  9038. t.extend(o.prototype, n.mixins),
  9039. t.extend(o.prototype, {
  9040. startSubSection: function(t) {
  9041. var e = new s(t);
  9042. return this.stack.push(e),
  9043. e
  9044. },
  9045. endSubSectionAndReturnRenderer: function() {
  9046. if (this.last().isEmpty())
  9047. return this.stack.pop(),
  9048. null;
  9049. var e = this.endSection();
  9050. return t.proxy(e.compiled.hydrate, e.compiled)
  9051. },
  9052. startSection: function(t) {
  9053. var e = new s(t);
  9054. this.last().add(e.targetCallback),
  9055. this.stack.push(e)
  9056. },
  9057. endSection: function() {
  9058. return this.last().compile(),
  9059. this.stack.pop()
  9060. },
  9061. inverse: function() {
  9062. this.last().inverse()
  9063. },
  9064. compile: function() {
  9065. var e = this.stack.pop().compile();
  9066. return function(n, r, o) {
  9067. return n instanceof t.view.Scope || (n = t.view.Scope.refsScope().add(n || {})),
  9068. r instanceof i.Options || (r = new i.Options(r || {})),
  9069. e.hydrate(n, r, o)
  9070. }
  9071. },
  9072. push: function(t) {
  9073. this.last().push(t)
  9074. },
  9075. pop: function() {
  9076. return this.last().pop()
  9077. }
  9078. });
  9079. var s = function(e) {
  9080. this.data = "targetData",
  9081. this.targetData = [],
  9082. this.targetStack = [];
  9083. var n = this;
  9084. this.targetCallback = function(i, r, o) {
  9085. e.call(this, i, r, o, t.proxy(n.compiled.hydrate, n.compiled), n.inverseCompiled && t.proxy(n.inverseCompiled.hydrate, n.inverseCompiled))
  9086. }
  9087. };
  9088. return t.extend(s.prototype, {
  9089. inverse: function() {
  9090. this.inverseData = [],
  9091. this.data = "inverseData"
  9092. },
  9093. push: function(t) {
  9094. this.add(t),
  9095. this.targetStack.push(t)
  9096. },
  9097. pop: function() {
  9098. return this.targetStack.pop()
  9099. },
  9100. add: function(e) {
  9101. "string" == typeof e && (e = r(e)),
  9102. this.targetStack.length ? t.last(this.targetStack).children.push(e) : this[this.data].push(e)
  9103. },
  9104. compile: function() {
  9105. return this.compiled = e(this.targetData, t.document || t.global.document),
  9106. this.inverseData && (this.inverseCompiled = e(this.inverseData, t.document || t.global.document),
  9107. delete this.inverseData),
  9108. this.targetStack = this.targetData = null,
  9109. this.compiled
  9110. },
  9111. children: function() {
  9112. return this.targetStack.length ? t.last(this.targetStack).children : this[this.data]
  9113. },
  9114. isEmpty: function() {
  9115. return !this.targetData.length
  9116. }
  9117. }),
  9118. o.HTMLSection = s,
  9119. o
  9120. }),
  9121. define("can/view/live_attr", ["can/util/library", "can/view/live", "can/elements", "can/view/callbacks"], function(t, e, n, i) {
  9122. return e = e || t.view.live,
  9123. n = n || t.view.elements,
  9124. i = i || t.view.callbacks,
  9125. {
  9126. attributes: function(r, o, s, a) {
  9127. var u = {}
  9128. , c = function(o) {
  9129. var c, l = e.getAttributeParts(o);
  9130. for (c in l) {
  9131. var p = l[c];
  9132. if (p !== u[c]) {
  9133. t.attr.set(r, c, p);
  9134. var h = i.attr(c);
  9135. h && h(r, {
  9136. attributeName: c,
  9137. scope: s,
  9138. options: a
  9139. })
  9140. }
  9141. delete u[c]
  9142. }
  9143. for (c in u)
  9144. n.removeAttr(r, c);
  9145. u = l
  9146. }
  9147. , l = function(t, e) {
  9148. c(e)
  9149. };
  9150. o.bind("change", l),
  9151. t.bind.call(r, "removed", function() {
  9152. o.unbind("change", l)
  9153. }),
  9154. c(o())
  9155. }
  9156. }
  9157. }),
  9158. define("can/view/text_section", ["can/util/library", "can/view/live", "can/view/utils", "can/view/live_attr"], function(t, e, n, i) {
  9159. e = e || t.view.live;
  9160. var r = function() {
  9161. this.stack = [new s]
  9162. };
  9163. t.extend(r.prototype, n.mixins),
  9164. t.extend(r.prototype, {
  9165. startSection: function(t) {
  9166. var e = new s;
  9167. this.last().add({
  9168. process: t,
  9169. truthy: e
  9170. }),
  9171. this.stack.push(e)
  9172. },
  9173. endSection: function() {
  9174. this.stack.pop()
  9175. },
  9176. inverse: function() {
  9177. this.stack.pop();
  9178. var t = new s;
  9179. this.last().last().falsey = t,
  9180. this.stack.push(t)
  9181. },
  9182. compile: function(n) {
  9183. var r = this.stack[0].compile();
  9184. return function(o, s) {
  9185. var a = t.compute(function() {
  9186. return r(o, s)
  9187. }, null, !1);
  9188. a.computeInstance.bind("change", t.k);
  9189. var u = a();
  9190. a.computeInstance.hasDependencies ? (n.textContentOnly ? e.text(this, a) : n.attr ? e.simpleAttribute(this, n.attr, a) : i.attributes(this, a, o, s),
  9191. a.computeInstance.unbind("change", t.k)) : n.textContentOnly ? this.nodeValue = u : n.attr ? t.attr.set(this, n.attr, u) : e.setAttributes(this, u)
  9192. }
  9193. }
  9194. });
  9195. var o = function(t, e, n) {
  9196. return function(i, r) {
  9197. return t.call(this, i, r, e, n)
  9198. }
  9199. }
  9200. , s = function() {
  9201. this.values = []
  9202. };
  9203. return t.extend(s.prototype, {
  9204. add: function(t) {
  9205. this.values.push(t)
  9206. },
  9207. last: function() {
  9208. return this.values[this.values.length - 1]
  9209. },
  9210. compile: function() {
  9211. for (var t = this.values, e = t.length, n = 0; n < e; n++) {
  9212. var i = this.values[n];
  9213. "object" == typeof i && (t[n] = o(i.process, i.truthy && i.truthy.compile(), i.falsey && i.falsey.compile()))
  9214. }
  9215. return function(n, i) {
  9216. for (var r, o = "", s = 0; s < e; s++)
  9217. r = t[s],
  9218. o += "string" == typeof r ? r : r.call(this, n, i);
  9219. return o
  9220. }
  9221. }
  9222. }),
  9223. r
  9224. }),
  9225. define("can/view/import", ["can/util/library", "can/view/callbacks"], function(t) {
  9226. t.view.tag("can-import", function(e, n) {
  9227. var i, r = t.$(e), o = e.getAttribute("from"), s = n.options.attr("helpers.module"), a = s ? s.id : void 0;
  9228. i = o ? t.import(o, a) : t.Deferred().reject("No moduleName provided").promise();
  9229. var u = n.scope.attr("%root");
  9230. u && t.isFunction(u.waitFor) && u.waitFor(i),
  9231. t.data(r, "viewModel", i),
  9232. t.data(r, "scope", i);
  9233. var c = n.scope.add(i)
  9234. , l = e.getAttribute("can-tag");
  9235. if (l) {
  9236. var p = t.view.tag(l);
  9237. t.data(r, "preventDataBindings", !0),
  9238. p(e, t.extend(n, {
  9239. scope: c
  9240. })),
  9241. t.data(r, "preventDataBindings", !1),
  9242. t.data(r, "viewModel", i),
  9243. t.data(r, "scope", i)
  9244. } else {
  9245. var h = n.subtemplate ? n.subtemplate(c, n.options) : document.createDocumentFragment()
  9246. , d = t.view.nodeLists.register([], void 0, !0);
  9247. t.one.call(e, "removed", function() {
  9248. t.view.nodeLists.unregister(d)
  9249. }),
  9250. t.appendChild(e, h, t.document),
  9251. t.view.nodeLists.update(d, t.childNodes(e))
  9252. }
  9253. })
  9254. }),
  9255. define("can/view/intermediate_and_imports", ["can/view/mustache_core", "can/view/parser", "can/view/import"], function(t, e) {
  9256. return function(n) {
  9257. var i = t.cleanLineEndings(n)
  9258. , r = []
  9259. , o = []
  9260. , s = {}
  9261. , a = !1
  9262. , u = !1
  9263. , c = !1
  9264. , l = !1
  9265. , p = ""
  9266. , h = "";
  9267. return {
  9268. intermediate: e(i, {
  9269. start: function(t, e) {
  9270. l = e,
  9271. "can-import" === t ? a = !0 : a && (a = !1)
  9272. },
  9273. attrStart: function(t) {
  9274. "from" === t ? u = !0 : "as" !== t && "export-as" !== t || (c = !0)
  9275. },
  9276. attrEnd: function(t) {
  9277. "from" === t ? u = !1 : "as" !== t && "export-as" !== t || (c = !1)
  9278. },
  9279. attrValue: function(t) {
  9280. u && a ? (r.push(t),
  9281. l || o.push(t),
  9282. h = t) : c && a && (p = t)
  9283. },
  9284. end: function(t) {
  9285. "can-import" === t && p && (s[p] = h,
  9286. p = "")
  9287. },
  9288. close: function(t) {
  9289. "can-import" === t && r.pop()
  9290. }
  9291. }, !0),
  9292. imports: r,
  9293. dynamicImports: o,
  9294. ases: s,
  9295. exports: s
  9296. }
  9297. }
  9298. }),
  9299. 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) {
  9300. function c(n) {
  9301. "string" == typeof n && (n = o.cleanLineEndings(n));
  9302. var s = new i
  9303. , a = {
  9304. node: null,
  9305. attr: null,
  9306. sectionElementStack: [],
  9307. text: !1,
  9308. namespaceStack: [],
  9309. textContentOnly: null
  9310. }
  9311. , c = function(t, e, n) {
  9312. if (">" === e)
  9313. t.add(o.makeLiveBindingPartialRenderer(n, a));
  9314. else if ("/" === e)
  9315. t.endSection(),
  9316. t instanceof i && a.sectionElementStack.pop();
  9317. else if ("else" === e)
  9318. t.inverse();
  9319. else {
  9320. var r = t instanceof i ? o.makeLiveBindingBranchRenderer : o.makeStringBranchRenderer;
  9321. "{" === e || "&" === e ? t.add(r(null, n, h())) : "#" === e || "^" === e ? (t.startSection(r(e, n, h())),
  9322. t instanceof i && a.sectionElementStack.push("section")) : t.add(r(null, n, h({
  9323. text: !0
  9324. })))
  9325. }
  9326. }
  9327. , h = function(e) {
  9328. var n = a.sectionElementStack[a.sectionElementStack.length - 1]
  9329. , i = {
  9330. tag: a.node && a.node.tag,
  9331. attr: a.attr && a.attr.name,
  9332. directlyNested: !a.sectionElementStack.length || "section" === n || "custom" === n,
  9333. textContentOnly: !!a.textContentOnly
  9334. };
  9335. return e ? t.simpleExtend(i, e) : i
  9336. }
  9337. , d = function(t, e) {
  9338. t.attributes || (t.attributes = []),
  9339. t.attributes.unshift(e)
  9340. };
  9341. return e(n, {
  9342. start: function(e, n) {
  9343. var i = l[e];
  9344. i && !n && a.namespaceStack.push(i),
  9345. a.node = {
  9346. tag: e,
  9347. children: [],
  9348. namespace: i || t.last(a.namespaceStack)
  9349. }
  9350. },
  9351. end: function(t, e) {
  9352. var n = u.tag(t);
  9353. e ? (s.add(a.node),
  9354. n && d(a.node, function(e, n, i) {
  9355. u.tagHandler(this, t, {
  9356. scope: e,
  9357. options: n,
  9358. subtemplate: null,
  9359. templateType: "stache",
  9360. parentNodeList: i
  9361. })
  9362. })) : (s.push(a.node),
  9363. a.sectionElementStack.push(n ? "custom" : t),
  9364. n ? s.startSubSection() : p[t] && (a.textContentOnly = new r)),
  9365. a.node = null
  9366. },
  9367. close: function(t) {
  9368. l[t] && a.namespaceStack.pop();
  9369. var e, n = u.tag(t);
  9370. n && (e = s.endSubSectionAndReturnRenderer()),
  9371. p[t] && (s.last().add(a.textContentOnly.compile(h())),
  9372. a.textContentOnly = null);
  9373. var i = s.pop();
  9374. n && d(i, function(n, i, r) {
  9375. u.tagHandler(this, t, {
  9376. scope: n,
  9377. options: i,
  9378. subtemplate: e,
  9379. templateType: "stache",
  9380. parentNodeList: r
  9381. })
  9382. }),
  9383. a.sectionElementStack.pop()
  9384. },
  9385. attrStart: function(t) {
  9386. a.node.section ? a.node.section.add(t + '="') : a.attr = {
  9387. name: t,
  9388. value: ""
  9389. }
  9390. },
  9391. attrEnd: function(t) {
  9392. if (a.node.section)
  9393. a.node.section.add('" ');
  9394. else {
  9395. a.node.attrs || (a.node.attrs = {}),
  9396. a.node.attrs[a.attr.name] = a.attr.section ? a.attr.section.compile(h()) : a.attr.value;
  9397. var e = u.attr(t);
  9398. e && (a.node.attributes || (a.node.attributes = []),
  9399. a.node.attributes.push(function(n, i) {
  9400. e(this, {
  9401. attributeName: t,
  9402. scope: n,
  9403. options: i
  9404. })
  9405. })),
  9406. a.attr = null
  9407. }
  9408. },
  9409. attrValue: function(t) {
  9410. var e = a.node.section || a.attr.section;
  9411. e ? e.add(t) : a.attr.value += t
  9412. },
  9413. chars: function(t) {
  9414. (a.textContentOnly || s).add(t)
  9415. },
  9416. special: function(t) {
  9417. var e = o.splitModeFromExpression(t, a)
  9418. , n = e.mode
  9419. , i = e.expression;
  9420. if ("else" !== i) {
  9421. if ("!" !== n)
  9422. if (a.node && a.node.section)
  9423. c(a.node.section, n, i),
  9424. 0 === a.node.section.subSectionDepth() && (a.node.attributes.push(a.node.section.compile(h())),
  9425. delete a.node.section);
  9426. else if (a.attr)
  9427. a.attr.section || (a.attr.section = new r,
  9428. a.attr.value && a.attr.section.add(a.attr.value)),
  9429. c(a.attr.section, n, i);
  9430. else if (a.node)
  9431. if (a.node.attributes || (a.node.attributes = []),
  9432. n) {
  9433. if ("#" !== n && "^" !== n)
  9434. throw new Error(n + " is currently not supported within a tag.");
  9435. a.node.section || (a.node.section = new r),
  9436. c(a.node.section, n, i)
  9437. } else
  9438. a.node.attributes.push(o.makeLiveBindingBranchRenderer(null, i, h()));
  9439. else
  9440. c(a.textContentOnly || s, n, i)
  9441. } else
  9442. (a.attr && a.attr.section ? a.attr.section : a.textContentOnly || s).inverse()
  9443. },
  9444. comment: function(t) {
  9445. s.add({
  9446. comment: t
  9447. })
  9448. },
  9449. done: function() {}
  9450. }),
  9451. s.compile()
  9452. }
  9453. e = e || t.view.parser,
  9454. t.view.parser = e,
  9455. u = u || t.view.callbacks;
  9456. var l = {
  9457. svg: "http://www.w3.org/2000/svg",
  9458. g: "http://www.w3.org/2000/svg"
  9459. }
  9460. , p = {
  9461. style: !0,
  9462. script: !0
  9463. }
  9464. , h = {
  9465. "\n": "\\n",
  9466. "\r": "\\r",
  9467. "\u2028": "\\u2028",
  9468. "\u2029": "\\u2029"
  9469. }
  9470. , d = function(t) {
  9471. return ("" + t).replace(/["'\\\n\r\u2028\u2029]/g, function(t) {
  9472. return "'\"\\".indexOf(t) >= 0 ? "\\" + t : h[t]
  9473. })
  9474. };
  9475. return t.view.register({
  9476. suffix: "stache",
  9477. contentType: "x-stache-template",
  9478. fragRenderer: function(t, e) {
  9479. return c(e)
  9480. },
  9481. script: function(t, e) {
  9482. return 'can.stache("' + d(e) + '")'
  9483. }
  9484. }),
  9485. t.view.ext = ".stache",
  9486. t.extend(t.stache, s),
  9487. t.extend(c, s),
  9488. t.stache.safeString = c.safeString = function(t) {
  9489. return {
  9490. toString: function() {
  9491. return t
  9492. }
  9493. }
  9494. }
  9495. ,
  9496. t.stache.async = function(e) {
  9497. var n = a(e)
  9498. , i = t.map(n.imports, function(e) {
  9499. return t.import(e)
  9500. });
  9501. return t.when.apply(t, i).then(function() {
  9502. return c(n.intermediate)
  9503. })
  9504. }
  9505. ,
  9506. c
  9507. }),
  9508. 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) {
  9509. return e.stache("totp_stache", r),
  9510. e.stache("totp_qr_stache", o),
  9511. e.stache("totp_manual_stache", s),
  9512. e.Control.extend({
  9513. create: function(e) {
  9514. var n = t("#smscDialogTOTP");
  9515. return 0 !== n.length && (n.is(":data(dialog)") && n.dialog("destroy"),
  9516. n.remove()),
  9517. n = t("<div>").attr("id", "smscDialogTOTP"),
  9518. t("body").append(n),
  9519. n.dialog({
  9520. modal: !0,
  9521. width: 720,
  9522. height: 400,
  9523. beforeClose: function(i) {
  9524. i.preventDefault(),
  9525. e.targetElement.trigger("totpDialogClosing", [t("#smscDialogTOTP").data("totpIsSet")]),
  9526. n.dialog("destroy"),
  9527. n.parents(".smscWindow").remove(),
  9528. n.remove()
  9529. }
  9530. }).parents(".ui-dialog:eq(0)").wrap('<div class="smscWindow no-gradient"></div>'),
  9531. new this(n,e)
  9532. }
  9533. }, {
  9534. init: function() {
  9535. var t = this;
  9536. t.element.data("totpIsSet", !1),
  9537. this.options.fromForce ? n.getTwofactorConfig({}).then(function(n) {
  9538. t.config = n,
  9539. t.element.dialog("option", "title", n.lang.totpdialog_title),
  9540. t.element.html(e.view("totp_stache", {
  9541. lang: t.config.lang
  9542. })),
  9543. t._renderQR(),
  9544. t.element.find("#txt_totpCode").focus()
  9545. }) : n.getConfig({}).then(function(n) {
  9546. t.config = n,
  9547. t.element.dialog("option", "title", n.lang.totpdialog_title),
  9548. t.element.html(e.view("totp_stache", {
  9549. lang: t.config.lang
  9550. })),
  9551. t._renderQR(),
  9552. t.element.find("#txt_totpCode").focus()
  9553. })
  9554. },
  9555. _renderQR: function() {
  9556. this.element.find(".rcol .content-holder").html(e.view("totp_qr_stache", {
  9557. lang: this.config.lang,
  9558. qr: this.config.qr
  9559. })),
  9560. this.qrView = !0
  9561. },
  9562. _renderManual: function() {
  9563. this.element.find(".rcol .content-holder").html(e.view("totp_manual_stache", {
  9564. lang: this.config.lang,
  9565. user: this.config.username,
  9566. domain: this.config.domain,
  9567. key: this.config.key
  9568. }, {
  9569. highlightNumbers: function(t) {
  9570. for (var n = "", i = 0, r = t.length; i < r; ++i) {
  9571. var o = t.charAt(i);
  9572. isNaN(o) ? n += o : n += '<span class="hilite">' + o + "</span>"
  9573. }
  9574. return e.mustache.safeString(n)
  9575. }
  9576. })),
  9577. this.qrView = !1
  9578. },
  9579. ".switchView click": function() {
  9580. this.qrView ? this._renderManual() : this._renderQR()
  9581. },
  9582. ".continueButton:not(:disabled) click": function(t) {
  9583. t.attr("disabled", !0);
  9584. var e = this
  9585. , i = this.element.find("#txt_totpCode");
  9586. i.removeClass("error").addClass("loading"),
  9587. "" === i.val() ? (i.addClass("error").removeClass("loading"),
  9588. t.removeAttr("disabled")) : this.options.fromForce ? n.validateTwoFactorAndSafeCode({
  9589. code: i.val()
  9590. }).then(function(t) {
  9591. e._handleValidation(t)
  9592. }) : n.validateAndSafeCode({
  9593. code: i.val()
  9594. }).then(function(t) {
  9595. e._handleValidation(t)
  9596. })
  9597. },
  9598. _handleValidation: function(t) {
  9599. var e = this;
  9600. e.element.find("#txt_totpCode").removeClass("loading"),
  9601. e.element.data("totpIsSet", t),
  9602. i(t ? {
  9603. title: this.config.lang.totpdialog_validate_true_title,
  9604. msg: this.config.lang.totpdialog_validate_true_msg,
  9605. ok_title: this.config.lang.totpdialog_ok
  9606. } : {
  9607. title: this.config.lang.totpdialog_validate_false_title,
  9608. msg: this.config.lang.totpdialog_validate_false_msg,
  9609. ok_title: this.config.lang.totpdialog_ok
  9610. }).on("confirmed", function() {
  9611. e.element.find(".continueButton").removeAttr("disabled"),
  9612. e.element.find("#txt_totpCode").addClass("error").val("").focus(),
  9613. t && e.element.dialog("close")
  9614. })
  9615. },
  9616. "#txt_totpCode keypress": function(t, e) {
  9617. 13 === e.keyCode && this.element.find(".continueButton").trigger("click")
  9618. }
  9619. })
  9620. }),
  9621. define("text!totpvalidation/views/totpvalidation.stache", [], function() {
  9622. 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>'
  9623. }),
  9624. define("totpvalidation/totpvalidation", ["jquery", "can", "../models/totp", "text!./views/totpvalidation.stache", "jqueryui", "can/view/stache"], function(t, e, n, i) {
  9625. return e.stache("totpvalidation_stache", i),
  9626. e.Control.extend({
  9627. create: function(e) {
  9628. var n = t("#smscDialogTOTPValidation");
  9629. return 0 !== n.length && (n.is(":data(dialog)") && n.dialog("destroy"),
  9630. n.remove()),
  9631. n = t("<div>").attr("id", "smscDialogTOTPValidation"),
  9632. t("body").append(n),
  9633. n.dialog({
  9634. modal: !0,
  9635. width: 720,
  9636. height: 360,
  9637. beforeClose: function(i) {
  9638. i.preventDefault(),
  9639. e.targetElement.trigger("totpValidationDialogClosing", [t("#smscDialogTOTPValidation").data("totpValid"), t("#smscDialogTOTPValidation").data("totpCode")]),
  9640. n.dialog("destroy"),
  9641. n.parents(".smscWindow").remove(),
  9642. n.remove()
  9643. }
  9644. }).parents(".ui-dialog:eq(0)").wrap('<div class="smscWindow no-gradient"></div>'),
  9645. new this(n,e)
  9646. }
  9647. }, {
  9648. init: function() {
  9649. var t = this;
  9650. t.element.data("totpValid", !1),
  9651. t.element.data("totpCode", ""),
  9652. n.getValidationConfig({}).then(function(n) {
  9653. t.config = n,
  9654. t.element.dialog("option", "title", n.lang.totpvalidationdialog_title),
  9655. t.element.html(e.view("totpvalidation_stache", {
  9656. lang: t.config.lang
  9657. })),
  9658. t.element.find("#txt_totpCode").focus()
  9659. })
  9660. },
  9661. ".continueButton:not(:disabled) click": function(t) {
  9662. t.attr("disabled", !0);
  9663. var e = this
  9664. , i = this.element.find("#txt_totpCode");
  9665. i.removeClass("error").addClass("loading"),
  9666. "" === i.val() ? (this.element.data("totpCode", ""),
  9667. i.addClass("error").removeClass("loading"),
  9668. t.removeAttr("disabled")) : (this.element.data("totpCode", i.val()),
  9669. e.options.unsetTotp ? n.unsetTotp({
  9670. code: i.val()
  9671. }).then(function(t) {
  9672. e._handleValidation(t)
  9673. }) : this.element.dialog("close"))
  9674. },
  9675. _handleValidation: function(t) {
  9676. this.element.data("totpValid", t),
  9677. t ? this.element.dialog("close") : (this.element.find(".continueButton").removeAttr("disabled"),
  9678. this.element.find("#txt_totpCode").removeClass("loading").addClass("error").val("").focus())
  9679. },
  9680. "#txt_totpCode keypress": function(t, e) {
  9681. 13 === e.keyCode && this.element.find(".continueButton").trigger("click")
  9682. }
  9683. })
  9684. }),
  9685. define("text!twofactor/views/twofactor.ejs", [], function() {
  9686. 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>'
  9687. }),
  9688. define("twofactor/twofactor", ["jquery", "can", "smsc", "../yubikey/yubikey", "../totp/totp", "text!./views/twofactor.ejs", "can/view/ejs"], function(t, e, n, i, r, o) {
  9689. return e.ejs("modules_authentication_app_twofactor_views_twofactor", o),
  9690. e.Control.extend({
  9691. init: function() {
  9692. var n = this;
  9693. this.element.dialog({
  9694. title: "",
  9695. modal: !0,
  9696. resizable: !1,
  9697. width: 640,
  9698. height: 350,
  9699. beforeClose: function(e) {
  9700. e.preventDefault(),
  9701. n.options.opener.closeTwofactor(),
  9702. t(this).parents(".smscWindow").remove(),
  9703. t(this).remove()
  9704. }
  9705. }).parents(".ui-dialog:eq(0)").wrap('<div class="smscWindow no-gradient"></div>'),
  9706. this.element.html(e.view("modules_authentication_app_twofactor_views_twofactor", this.options.lng)),
  9707. this.element.dialog("open")
  9708. },
  9709. focus: function() {
  9710. this.element.find("input:first").focus()
  9711. },
  9712. "input[name=twofactor] keydown": function(t, e) {
  9713. 13 == e.keyCode && (this.options.opener.handleTwofactor(t.val()),
  9714. this.element.dialog("close"))
  9715. },
  9716. ".yubikey click": function(e, r) {
  9717. var o = t("<div>").addClass("yubikey");
  9718. t("body").append(o),
  9719. new i(o,{
  9720. opener: this,
  9721. lng: n.vars.yubikey,
  9722. fromForce: !0
  9723. })
  9724. },
  9725. ".totp click": function(t, e) {
  9726. r.create({
  9727. targetElement: this.element,
  9728. fromForce: !0
  9729. })
  9730. },
  9731. handleYubiKey: function(t) {
  9732. this.options.opener.handleTwoFactorYubikey(t),
  9733. this.element.dialog("close")
  9734. },
  9735. closeYubiKey: function() {},
  9736. " totpDialogClosing": function(t, e, n) {
  9737. n && this.element.dialog("close")
  9738. }
  9739. })
  9740. }),
  9741. define("text!autoreason/views/autoreason.ejs", [], function() {
  9742. 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>'
  9743. }),
  9744. define("autoreason/autoreason", ["jquery", "can", "smsc", "text!./views/autoreason.ejs", "can/view/ejs"], function(t, e, n, i) {
  9745. return e.ejs("modules_authentication_app_autoreason_views_autoreason", i),
  9746. e.Control.extend({
  9747. init: function() {
  9748. var n = this;
  9749. this.element.dialog({
  9750. title: "",
  9751. modal: !0,
  9752. resizable: !1,
  9753. width: 640,
  9754. height: 350,
  9755. beforeClose: function() {
  9756. n.options.opener.closeautoreason(),
  9757. t(this).parents(".smscWindow").remove(),
  9758. t(this).remove()
  9759. }
  9760. }).parents(".ui-dialog:eq(0)").wrap('<div class="smscWindow no-gradient"></div>'),
  9761. this.element.html(e.view("modules_authentication_app_autoreason_views_autoreason", {
  9762. lng: this.options.lng
  9763. })),
  9764. this.element.dialog("open"),
  9765. this.focus(),
  9766. "" !== this.getUrlParam("desknr") && (this.element.find("#desknr").val(this.getUrlParam("desknr")),
  9767. this.roundupComments())
  9768. },
  9769. focus: function() {
  9770. this.element.find("input:first").focus()
  9771. },
  9772. "input keydown": function(t, e) {
  9773. 13 == e.keyCode && this.roundupComments()
  9774. },
  9775. "button.nextbutton click": function(t, e) {
  9776. this.roundupComments()
  9777. },
  9778. getUrlParam: function(t) {
  9779. var e, n, i;
  9780. return t = t.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"),
  9781. e = "[\\?&]" + t + "=([^&#]*)",
  9782. n = new RegExp(e),
  9783. null === (i = n.exec(window.location.href)) ? "" : i[1]
  9784. },
  9785. roundupComments: function() {
  9786. var e = !1
  9787. , n = {};
  9788. this.element.find("input").each(function(i, r) {
  9789. n[t(r).attr("name")] = t(r).val(),
  9790. "" != t(r).val().trim() && (e = !0)
  9791. }),
  9792. e ? (this.options.opener.handleautoreason(n),
  9793. this.element.dialog("close")) : alert("Geef een reden in!")
  9794. }
  9795. })
  9796. }),
  9797. define("text!login/views/login.ejs", [], function() {
  9798. 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>'
  9799. }),
  9800. define("mainui/alert/amd/alert", ["jquery", "can", "jqueryui"], function(t, e) {
  9801. return function(n) {
  9802. var i, r = {
  9803. title: "",
  9804. msg: "",
  9805. ok_title: "",
  9806. width: 300,
  9807. height: "auto"
  9808. }, o = e.extend({}, r, n), s = {}, a = t("#smscAlertDialog");
  9809. return 0 === a.length ? (t("body").append('<div id="smscAlertDialog">' + o.msg + "</div>"),
  9810. a = t("#smscAlertDialog")) : a.html(o.msg),
  9811. a.is(":data(dialog)") || a.dialog({
  9812. autoOpen: !1,
  9813. modal: !0,
  9814. title: o.title,
  9815. resizable: !1,
  9816. width: o.width,
  9817. height: o.height
  9818. }),
  9819. i = o.ok_title,
  9820. s[i] = function() {
  9821. t(this).dialog("close"),
  9822. o.onClose && "function" == typeof o.onClose && o.onClose()
  9823. }
  9824. ,
  9825. a.dialog("option", "buttons", s),
  9826. a.dialog("open"),
  9827. a
  9828. }
  9829. }),
  9830. function(t) {
  9831. t.InFieldLabels = function(e, n, i) {
  9832. var r = this;
  9833. r.$label = t(e),
  9834. r.label = e,
  9835. r.$field = t(n),
  9836. r.field = n,
  9837. r.$label.data("InFieldLabels", r),
  9838. r.showing = !0,
  9839. r.init = function() {
  9840. var e;
  9841. r.options = t.extend({}, t.InFieldLabels.defaultOptions, i),
  9842. r.options.className && r.$label.addClass(r.options.className),
  9843. setTimeout(function() {
  9844. "" !== r.$field.val() ? (r.$label.hide(),
  9845. r.showing = !1) : (r.$label.show(),
  9846. r.showing = !0)
  9847. }, 200),
  9848. r.$field.focus(function() {
  9849. r.fadeOnFocus()
  9850. }).blur(function() {
  9851. r.checkForEmpty(!0)
  9852. }).bind("keydown.infieldlabel", function(t) {
  9853. r.hideOnChange(t)
  9854. }).bind("paste", function() {
  9855. r.setOpacity(0)
  9856. }).change(function() {
  9857. r.checkForEmpty()
  9858. }).bind("onPropertyChange", function() {
  9859. r.checkForEmpty()
  9860. }).bind("keyup.infieldlabel", function() {
  9861. r.checkForEmpty()
  9862. }),
  9863. r.options.pollDuration > 0 && (e = setInterval(function() {
  9864. "" !== r.$field.val() && (r.$label.hide(),
  9865. r.showing = !1,
  9866. clearInterval(e))
  9867. }, r.options.pollDuration))
  9868. }
  9869. ,
  9870. r.fadeOnFocus = function() {
  9871. r.showing && r.setOpacity(r.options.fadeOpacity)
  9872. }
  9873. ,
  9874. r.setOpacity = function(t) {
  9875. r.$label.stop().animate({
  9876. opacity: t
  9877. }, r.options.fadeDuration, function() {
  9878. 0 === t && r.$label.hide()
  9879. }),
  9880. r.showing = t > 0
  9881. }
  9882. ,
  9883. r.checkForEmpty = function(t) {
  9884. "" === r.$field.val() ? (r.prepForShow(),
  9885. r.setOpacity(t ? 1 : r.options.fadeOpacity)) : r.setOpacity(0)
  9886. }
  9887. ,
  9888. r.prepForShow = function() {
  9889. r.showing || (r.$label.css({
  9890. opacity: 0
  9891. }).show(),
  9892. r.$field.bind("keydown.infieldlabel", function(t) {
  9893. r.hideOnChange(t)
  9894. }))
  9895. }
  9896. ,
  9897. r.hideOnChange = function(t) {
  9898. 16 !== t.keyCode && 9 !== t.keyCode && (r.showing && (r.$label.hide(),
  9899. r.showing = !1),
  9900. r.$field.unbind("keydown.infieldlabel"))
  9901. }
  9902. ,
  9903. r.init()
  9904. }
  9905. ,
  9906. t.InFieldLabels.defaultOptions = {
  9907. fadeOpacity: .5,
  9908. fadeDuration: 300,
  9909. pollDuration: 0,
  9910. enabledInputTypes: ["text", "search", "tel", "url", "email", "password", "number", "textarea"],
  9911. className: !1
  9912. },
  9913. t.fn.inFieldLabels = function(e) {
  9914. var n = e && e.enabledInputTypes || t.InFieldLabels.defaultOptions.enabledInputTypes;
  9915. return this.each(function() {
  9916. var i, r = t(this).attr("for");
  9917. r && (i = document.getElementById(r)) && (-1 === t.inArray(i.type, n) && "TEXTAREA" !== i.nodeName || new t.InFieldLabels(this,i,e))
  9918. })
  9919. }
  9920. }(jQuery),
  9921. define("jqplugins/infieldlabel/jquery.infieldlabel", function() {}),
  9922. 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) {
  9923. return e.ejs("modules_authentication_app_login_views_login", u),
  9924. e.Control.extend({
  9925. defaults: {
  9926. statusObject: "Status"
  9927. }
  9928. }, {
  9929. token: "",
  9930. autoLoginStarted: !1,
  9931. isLoginInProgress: !1,
  9932. yubikeyValue: "",
  9933. autoreasonValue: [],
  9934. twoFactorYubikeyValue: "",
  9935. totpCode: "",
  9936. init: function() {
  9937. var n = this
  9938. , i = this.getUrlParam("pk");
  9939. this.element.html(e.view("modules_authentication_app_login_views_login", {
  9940. lng_username: this.options.lng_username,
  9941. lng_password: this.options.lng_password,
  9942. loginbutton: this.options.loginbutton,
  9943. allowGoogle: this.options.allowGoogle,
  9944. googleControllerPath: this.options.googleControllerPath,
  9945. allowOffice365: this.options.allowOffice365,
  9946. office365ControllerPath: this.options.office365ControllerPath,
  9947. login_button_google_title: this.options.login_button_google_title,
  9948. login_button_office365_title: this.options.login_button_office365_title
  9949. })),
  9950. t("#authLeftPaneLoginFadeDiv").fadeIn(),
  9951. t("#authRightPaneLogin label").inFieldLabels({
  9952. fadeOpacity: .8,
  9953. fadeDuration: 250
  9954. }),
  9955. n.element.find("input:first").removeAttr("readonly").focus(),
  9956. i.length >= 32 && i.length <= 48 && this.initYubiAuto(i),
  9957. (SMSC.vars.showUnlockAlert || SMSC.vars.showUnlockAndMailAlert) && new c({
  9958. title: SMSC.vars.login.login_unlock_alert_title,
  9959. msg: SMSC.vars.showUnlockAlert ? SMSC.vars.login.login_unlock_alert_txt : SMSC.vars.login.login_unlock_alert_txtandmail,
  9960. ok_title: SMSC.vars.login.login_unlock_alert_ok
  9961. }),
  9962. this.checkForAutoLogin()
  9963. },
  9964. initYubiAuto: function(e) {
  9965. n.yubiAuto({
  9966. pk: e
  9967. }, t.proxy(this.handleYubiAuto, this))
  9968. },
  9969. handleYubiAuto: function(e) {
  9970. !0 === e.success && !1 !== e.userdata.u && (t("#username").val(e.userdata.u).trigger("keydown"),
  9971. !1 !== e.userdata.p ? (t("#password").attr("type", "password").val(e.userdata.p).trigger("keydown"),
  9972. this.startLogin()) : t("#password").removeAttr("readonly").focus())
  9973. },
  9974. getUrlParam: function(t) {
  9975. var e, n, i;
  9976. return t = t.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"),
  9977. e = "[\\?&]" + t + "=([^&#]*)",
  9978. n = new RegExp(e),
  9979. null === (i = n.exec(window.location.href)) ? "" : i[1]
  9980. },
  9981. checkForAutoLogin: function() {
  9982. var e, i, r;
  9983. this.autoLoginStarted || (this.autoLoginStarted = !0,
  9984. e = this.getUrlParam("mek"),
  9985. i = this.getUrlParam("smk"),
  9986. "" !== e && "" !== i ? (r = {
  9987. mek: e,
  9988. smk: i
  9989. },
  9990. n.getAutoLoginData(r, t.proxy(this.handleAutoLogin, this))) : this.autoLoginStarted = !1)
  9991. },
  9992. handleAutoLogin: function(e) {
  9993. var n = e.username
  9994. , i = e.password;
  9995. t("#username").val(n).trigger("keydown"),
  9996. t("#password").attr("type", "password").val(i).trigger("keydown"),
  9997. this.startLogin()
  9998. },
  9999. "input keydown": function(e, n) {
  10000. if (13 === n.keyCode)
  10001. "username" === n.target.id ? t("#password").removeAttr("readonly").focus() : this.startLogin();
  10002. else if ("username" === n.target.id && 9 === n.keyCode)
  10003. return n.stopImmediatePropagation(),
  10004. t("#password").removeAttr("readonly").focus(),
  10005. !1
  10006. },
  10007. "input focus": "_setInputField",
  10008. "input click": "_setInputField",
  10009. _setInputField: function(t, e) {
  10010. t.removeAttr("readonly"),
  10011. "password" === t.attr("id") && t.attr("type", "password")
  10012. },
  10013. ".input-label click": function(e, n) {
  10014. n.stopImmediatePropagation();
  10015. var i = t("#" + e.attr("for"));
  10016. this._setInputField(i),
  10017. i.focus()
  10018. },
  10019. "#authLeftPaneLoginButton click": function(e) {
  10020. t(e).hasClass("disabled") || this.startLogin()
  10021. },
  10022. verifyStartLogin: function() {
  10023. return !(t("input").filter(function() {
  10024. return "" === this.value
  10025. }).length > 0)
  10026. },
  10027. startLogin: function() {
  10028. if (this.verifyStartLogin() && !this.isLoginInProgress) {
  10029. this.setIsLoginInProgress();
  10030. var e = t("#username").val();
  10031. n.getToken({
  10032. username: e
  10033. }, t.proxy(this.handleToken, this))
  10034. }
  10035. },
  10036. handleToken: function(t) {
  10037. this.token = t.token,
  10038. this.loginStep1()
  10039. },
  10040. loginStep1: function() {
  10041. var e = t("#password").val()
  10042. , i = {
  10043. username: t("#username").val(),
  10044. password: n.encryptPwd(e, this.token),
  10045. hn: this.getUrlParam("hn")
  10046. };
  10047. "" != this.yubikeyValue && (i.yubiKey = this.yubikeyValue),
  10048. "" != this.totpCode && (i.totpCode = this.totpCode),
  10049. "" != this.twoFactorYubikeyValue && (i.twoFactorYubikeyValue = this.twoFactorYubikeyValue),
  10050. void 0 !== this.autoreasonValue.desknr && (i.autoreason = this.autoreasonValue),
  10051. n.sendLoginData(i, t.proxy(this.handleLoginStep1, this))
  10052. },
  10053. handleLoginStep1: function(t) {
  10054. var e = this.yubikeyValue;
  10055. t.success ? this.element.trigger("loginStep1") : (this.yubikeyValue = "",
  10056. this.totpCode = "",
  10057. this.twoFactorYubikeyValue = "",
  10058. t.yubikey_notpassed ? this.showYubiKeyDialog() : t.totp_notpassed ? this.showTotpValidationDialog() : t.twofactormsg ? new c({
  10059. title: SMSC.vars.twofactor.lng_twofactor_alert_title,
  10060. msg: t.msg,
  10061. ok_title: SMSC.vars.twofactor.lng_twofactor_alert_ok
  10062. }) : t.twofactorobligated_error && t.twofactorobligated_notpassed ? this.showTwoFactorDialog() : t.twofactorobligated_error && t.twofactorobligated_notpassed ? this.showTwoFactorDialog() : t.showautoreason ? (this.showAutoReason(),
  10063. this.yubikeyValue = e) : t.counter ? this.element.trigger("status_not_ok_counter", t) : this.element.trigger("loginStep1_failed", [{
  10064. msg: t.msg,
  10065. icon: t.icon
  10066. }]))
  10067. },
  10068. "{statusElement} loginStep1_finished": function() {
  10069. this.loginStep2()
  10070. },
  10071. loginStep2: function() {
  10072. this.handleLoginStep2(),
  10073. n.gatherData({}, "")
  10074. },
  10075. handleLoginStep2: function() {
  10076. var t = this;
  10077. setTimeout(function() {
  10078. t.element.trigger("loginStep2")
  10079. }, 350)
  10080. },
  10081. "{statusElement} loginStep2_finished": function() {
  10082. this.reloadToUri()
  10083. },
  10084. "{statusElement} startStatusNotOk_finished": function() {
  10085. this.unsetIsLoginInProgress()
  10086. },
  10087. "{statusElement} startStatusNotOkCounter_finished": function() {
  10088. this.unsetIsLoginInProgress()
  10089. },
  10090. reloadToUri: function() {
  10091. this.unsetIsLoginInProgress(),
  10092. window.location = this.options.requesturi
  10093. },
  10094. setIsLoginInProgress: function() {
  10095. this.isLoginInProgress = !0,
  10096. this.element.find("button").addClass("disabled")
  10097. },
  10098. unsetIsLoginInProgress: function() {
  10099. this.isLoginInProgress = !1,
  10100. this.element.find("button").removeClass("disabled")
  10101. },
  10102. showYubiKeyDialog: function() {
  10103. var e = t("<div>").addClass("yubikey");
  10104. t("body").append(e),
  10105. new i(e,{
  10106. opener: this,
  10107. lng: SMSC.vars.yubikey
  10108. })
  10109. },
  10110. showTwoFactorDialog: function() {
  10111. var e = t("<div>").addClass("twofactor");
  10112. t("body").append(e),
  10113. new s(e,{
  10114. opener: this,
  10115. lng: SMSC.vars.twofactor
  10116. })
  10117. },
  10118. showAutoReason: function() {
  10119. var e = t("<div>").addClass("autoreason");
  10120. t("body").append(e),
  10121. new a(e,{
  10122. opener: this,
  10123. lng: SMSC.vars.autoreason
  10124. })
  10125. },
  10126. handleautoreason: function(t) {
  10127. this.autoreasonValue = t,
  10128. this.loginStep1()
  10129. },
  10130. closeautoreason: function() {
  10131. this.unsetIsLoginInProgress()
  10132. },
  10133. handleYubiKey: function(t) {
  10134. this.yubikeyValue = t,
  10135. this.loginStep1()
  10136. },
  10137. closeYubiKey: function() {
  10138. this.unsetIsLoginInProgress()
  10139. },
  10140. handleTwoFactorYubikey: function(t) {
  10141. this.twoFactorYubikeyValue = t,
  10142. this.loginStep1()
  10143. },
  10144. closeTwofactor: function() {
  10145. this.unsetIsLoginInProgress()
  10146. },
  10147. showTotpValidationDialog: function() {
  10148. this.totpValidationDialog = o.create({
  10149. targetElement: this.element
  10150. })
  10151. },
  10152. " totpValidationDialogClosing": function(t, e, n, i) {
  10153. "" === i ? this.unsetIsLoginInProgress() : (this.totpCode = i,
  10154. this.loginStep1())
  10155. }
  10156. })
  10157. }),
  10158. define("text!status/views/status.ejs", [], function() {
  10159. return '<div class="status <%= classnames %>"><div><%== lng_status_text %></div></div>'
  10160. }),
  10161. define("status/status", ["jquery", "can", "text!./views/status.ejs", "can/view/ejs"], function(t, e, n) {
  10162. return e.ejs("modules_authentication_app_status_views_status", n),
  10163. e.Control.extend({
  10164. defaults: {
  10165. scrollVal: 70,
  10166. timeoutDuration: 1e3,
  10167. timeoutDurationSlow: 3500,
  10168. timeoutDurationSecond: 1e3,
  10169. animateSpeed: 500
  10170. }
  10171. }, {
  10172. init: function() {
  10173. this.options.is_register_activation && this.setStatusRegister(this.options.is_register_activation_ok),
  10174. this.setFirstStep(),
  10175. 1 === this.options.not_connected_to_account && this.startStatusNotOk(this.options.lng_unkown_account_error)
  10176. },
  10177. setFirstStep: function() {
  10178. this.element.append(e.view("modules_authentication_app_status_views_status", {
  10179. classnames: "ok",
  10180. lng_status_text: this.options.lng_status_start
  10181. }))
  10182. },
  10183. setStatusRegister: function(n) {
  10184. var i = this;
  10185. this.element.prepend(e.view("modules_authentication_app_status_views_status", {
  10186. classnames: "register" + (n ? "" : " failed"),
  10187. lng_status_text: this.options.register_activation_txt
  10188. })),
  10189. i.timeout(function() {
  10190. t.when(i.scrollDown()).then(function() {
  10191. t("div.register").remove()
  10192. })
  10193. }, i.options.timeoutDurationSlow)
  10194. },
  10195. "{loginElement} loginStep1": function() {
  10196. this.startLoginStep1()
  10197. },
  10198. startLoginStep1: function() {
  10199. var e = this;
  10200. t.when(this.startStep1()).then(function() {
  10201. t.when(e.startStep2()).then(function() {
  10202. t.when(e.startStep3()).then(function() {
  10203. e.element.trigger("loginStep1_finished")
  10204. })
  10205. })
  10206. })
  10207. },
  10208. "{loginElement} loginStep2": function() {
  10209. this.startLoginStep2()
  10210. },
  10211. startLoginStep2: function() {
  10212. var e = this;
  10213. t.when(e.startStep4()).then(function() {
  10214. e.element.trigger("loginStep2_finished")
  10215. })
  10216. },
  10217. startStep1: function() {
  10218. return this.element.append(e.view("modules_authentication_app_status_views_status", {
  10219. classnames: "step1",
  10220. lng_status_text: this.options.lng_status_step1
  10221. })),
  10222. this.scrollDown()
  10223. },
  10224. startStep2: function() {
  10225. return this.element.append(e.view("modules_authentication_app_status_views_status", {
  10226. classnames: "step2",
  10227. lng_status_text: this.options.lng_status_step2
  10228. })),
  10229. this.scrollDown()
  10230. },
  10231. startStep3: function() {
  10232. return this.element.append(e.view("modules_authentication_app_status_views_status", {
  10233. classnames: "step3",
  10234. lng_status_text: this.options.lng_status_step3
  10235. })),
  10236. this.scrollDown()
  10237. },
  10238. startStep4: function() {
  10239. return this.element.append(e.view("modules_authentication_app_status_views_status", {
  10240. classnames: "step4",
  10241. lng_status_text: this.options.lng_status_step4
  10242. })),
  10243. this.scrollDown()
  10244. },
  10245. "{loginElement} loginStep1_failed": function(t, e, n) {
  10246. this.startStatusNotOk(n.msg, n.icon)
  10247. },
  10248. startStatusNotOk: function(n, i) {
  10249. i && void 0 !== i || (i = "");
  10250. var r = this;
  10251. this.element.prepend(e.view("modules_authentication_app_status_views_status", {
  10252. classnames: "notok " + i,
  10253. lng_status_text: n,
  10254. icon: i
  10255. })).scrollTop(this.options.scrollVal),
  10256. t.when(this.scrollUp()).then(function() {
  10257. r.timeout(function() {
  10258. t.when(r.scrollDown()).then(function() {
  10259. t("div.status.notok").remove(),
  10260. r.element.trigger("startStatusNotOk_finished")
  10261. })
  10262. }, r.options.timeoutDuration)
  10263. })
  10264. },
  10265. "{loginElement} status_not_ok_counter": function(t, e, n) {
  10266. this.startStatusNotOkCounter(n.msg, n.counter, n.elementID, n.icon)
  10267. },
  10268. startStatusNotOkCounter: function(n, i, r, o) {
  10269. o && void 0 !== o || (o = "");
  10270. var s = this;
  10271. this.element.prepend(e.view("modules_authentication_app_status_views_status", {
  10272. classnames: "notok counter " + o,
  10273. lng_status_text: n,
  10274. icon: o
  10275. })).scrollTop(this.options.scrollVal),
  10276. t.when(this.scrollUp()).then(function() {
  10277. t.when(s.startCountDown(r, i)).then(function() {
  10278. t.when(s.scrollDown()).then(function() {
  10279. t("div.status.notok.counter").remove(),
  10280. s.element.trigger("startStatusNotOkCounter_finished")
  10281. })
  10282. })
  10283. })
  10284. },
  10285. startCountDown: function(e, n) {
  10286. var i = t.Deferred();
  10287. return this.countDown(i, e, n),
  10288. i.promise()
  10289. },
  10290. countDown: function(e, n, i) {
  10291. var r = this;
  10292. t("#" + n).html(i),
  10293. setTimeout(function() {
  10294. 0 === i ? e.resolve() : r.countDown(e, n, i - 1)
  10295. }, r.options.timeoutDurationSecond)
  10296. },
  10297. scrollUp: function() {
  10298. var e = t.Deferred()
  10299. , n = parseInt(this.element.scrollTop(), 10) - this.options.scrollVal;
  10300. return n < 0 && (n = 0),
  10301. this.element.animate({
  10302. scrollTop: n
  10303. }, this.options.animateSpeed, function() {
  10304. e.resolve()
  10305. }),
  10306. e.promise()
  10307. },
  10308. scrollDown: function() {
  10309. var e = this;
  10310. return t.Deferred(function(t) {
  10311. var n = parseInt(e.element.scrollTop(), 10) + e.options.scrollVal;
  10312. e.element.animate({
  10313. scrollTop: n
  10314. }, e.options.animateSpeed, function() {
  10315. t.resolve()
  10316. })
  10317. }).promise()
  10318. },
  10319. timeout: function(t, e) {
  10320. setTimeout(t, e)
  10321. }
  10322. })
  10323. }),
  10324. define("tip/tip", ["jquery", "can"], function(t, e) {
  10325. return e.Control.extend({
  10326. init: function() {
  10327. var t = this.element.find("#smsctipimg")
  10328. , e = this;
  10329. tipID = t.attr("tipid"),
  10330. void 0 !== tipID && t.css("cursor", "pointer").one("click", function() {
  10331. e.getEmbed(tipID)
  10332. })
  10333. },
  10334. getEmbed: function(e) {
  10335. var n = this;
  10336. t.ajax({
  10337. url: "/Authentication/Index/gettipembed",
  10338. type: "post",
  10339. dataType: "json",
  10340. data: {
  10341. tipID: e
  10342. },
  10343. success: function(t) {
  10344. n.animateEmbed(t)
  10345. }
  10346. })
  10347. },
  10348. animateEmbed: function(t) {
  10349. var e = this;
  10350. this.element.find("#smsctipimg").fadeOut("slow", function() {
  10351. e.element.html(t.embed)
  10352. })
  10353. }
  10354. })
  10355. }),
  10356. define("text!menu/views/menu.ejs", [], function() {
  10357. return '<div id="<%= name %>"><%= text %></div>'
  10358. }),
  10359. define("text!recover/views/recover.ejs", [], function() {
  10360. 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>'
  10361. }),
  10362. define("models/recover", ["jquery", "can"], function(t, e) {
  10363. return e.Model({
  10364. sendPwd: function(e, n) {
  10365. t.ajax({
  10366. url: "/Authentication/Recover/sendPwd",
  10367. type: "post",
  10368. dataType: "json",
  10369. data: e,
  10370. success: n
  10371. })
  10372. }
  10373. }, {})
  10374. }),
  10375. 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) {
  10376. return e.ejs("_modules_authentication_app_recover_views_recover", i),
  10377. e.Control.extend({
  10378. defaults: {}
  10379. }, {
  10380. init: function() {
  10381. this.element.html(e.view("_modules_authentication_app_recover_views_recover", {
  10382. lng_username: this.options.lng_username,
  10383. sendbutton: this.options.sendbutton
  10384. })),
  10385. t("#authRightPaneLogin label").inFieldLabels({
  10386. fadeOpacity: .8,
  10387. fadeDuration: 250
  10388. })
  10389. },
  10390. "#sendButton click": function() {
  10391. var e = t("#username").val();
  10392. t("#recover").click(),
  10393. e.length > 0 && o.sendPwd({
  10394. username: e
  10395. }, t.proxy(this.handleSendPwd, this))
  10396. },
  10397. handleSendPwd: function(t) {
  10398. t.success && new r({
  10399. title: n.vars.error.lng_dberror_title,
  10400. msg: t.msg,
  10401. ok_title: "Ok"
  10402. })
  10403. }
  10404. })
  10405. }),
  10406. define("models/register", ["jquery", "can"], function(t, e) {
  10407. return e.Model({
  10408. register: function(e, n) {
  10409. t.ajax({
  10410. url: "/Authentication/Register/register",
  10411. type: "post",
  10412. dataType: "json",
  10413. data: e,
  10414. success: n
  10415. })
  10416. }
  10417. }, {})
  10418. }),
  10419. define("text!register/views/register.ejs", [], function() {
  10420. 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>'
  10421. }),
  10422. 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) {
  10423. return e.ejs("modules_authentication_app_register_views_register", r),
  10424. e.Control.extend({
  10425. init: function() {
  10426. this.element.dialog({
  10427. title: this.options.lng_register,
  10428. modal: !0,
  10429. resizable: !1,
  10430. width: 410,
  10431. beforeClose: function() {
  10432. t(this).remove()
  10433. }
  10434. }).parents(".ui-dialog:eq(0)").addClass("smscWindow"),
  10435. this.element.html(e.view("modules_authentication_app_register_views_register", {
  10436. lng_username: this.options.lng_username,
  10437. lng_password: this.options.lng_password,
  10438. lng_password_confirm: this.options.lng_password_confirm,
  10439. lng_code: this.options.lng_code,
  10440. lng_name: this.options.lng_name,
  10441. lng_surname: this.options.lng_surname,
  10442. lng_email: this.options.lng_email,
  10443. registerbutton: this.options.registerbutton
  10444. })),
  10445. this.element.dialog("open"),
  10446. this.focus()
  10447. },
  10448. focus: function() {
  10449. this.element.find("input:first").focus()
  10450. },
  10451. "#registerButton click": function() {
  10452. var e = t("#register_username")
  10453. , n = e.val()
  10454. , r = t("#register_pwd")
  10455. , o = r.val()
  10456. , s = t("#register_pwd_confirm")
  10457. , a = s.val()
  10458. , u = t("#register_class_code")
  10459. , c = u.val()
  10460. , l = t("#register_name")
  10461. , p = l.val()
  10462. , h = t("#register_surname")
  10463. , d = h.val()
  10464. , f = t("#register_email")
  10465. , g = f.val()
  10466. , v = {}
  10467. , m = !0;
  10468. n.length < 2 ? (e.addClass("error"),
  10469. m = !1) : e.removeClass("error"),
  10470. o.length < 5 ? (r.addClass("error"),
  10471. m = !1) : r.removeClass("error"),
  10472. a.length < 5 ? (s.addClass("error"),
  10473. m = !1) : s.removeClass("error"),
  10474. 0 === c.length ? (u.addClass("error"),
  10475. m = !1) : u.removeClass("error"),
  10476. p.length < 1 ? (l.addClass("error"),
  10477. m = !1) : l.removeClass("error"),
  10478. d.length < 2 ? (h.addClass("error"),
  10479. m = !1) : h.removeClass("error"),
  10480. 0 === g.length ? (f.addClass("error"),
  10481. m = !1) : f.removeClass("error"),
  10482. m && (o !== a ? (r.addClass("error"),
  10483. s.addClass("error"),
  10484. m = !1) : (r.removeClass("error"),
  10485. s.removeClass("error"))),
  10486. m && (v = {
  10487. username: n,
  10488. pwd: o,
  10489. pwd_confirm: a,
  10490. class_code: c,
  10491. name: p,
  10492. surname: d,
  10493. email: g
  10494. },
  10495. i.register(v, t.proxy(this.handleRegister, this)))
  10496. },
  10497. handleRegister: function(t) {
  10498. this.element.dialog("close"),
  10499. new o({
  10500. title: n.vars.error.lng_dberror_title,
  10501. msg: t.msg,
  10502. ok_title: "Ok"
  10503. })
  10504. }
  10505. })
  10506. }),
  10507. 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) {
  10508. return e.ejs("modules_authentication_app_menu_views_menu", i),
  10509. e.Control.extend({
  10510. recover: !1,
  10511. init: function() {
  10512. this.element.empty();
  10513. for (var t in this.options.items)
  10514. this.element.append(e.view("modules_authentication_app_menu_views_menu", {
  10515. name: this.options.items[t].name,
  10516. text: this.options.items[t].text
  10517. }));
  10518. this.recover = !1
  10519. },
  10520. click: function(e, i) {
  10521. var a, u = t(i.target), c = u.attr("id");
  10522. switch (void 0 === this.options.items[c].clicked ? void 0 !== this.options.items[c].toggletext && (u.html(this.options.items[c].toggletext),
  10523. this.options.items[c].clicked = !0) : void 0 !== this.options.items[c].toggletext && (u.html(this.options.items[c].text),
  10524. delete this.options.items[c].clicked),
  10525. c) {
  10526. case "recover":
  10527. this.options.loginElement.data("controls")[0].destroy(),
  10528. !1 === this.recover ? (this.recover = !0,
  10529. new r(this.options.loginElement,this.options.items[c].options)) : (this.recover = !1,
  10530. new o(this.options.loginElement,this.options.loginOptions));
  10531. break;
  10532. case "register":
  10533. a = t("<div>").addClass("register"),
  10534. t("body").append(a),
  10535. new s(a,n.vars.register)
  10536. }
  10537. }
  10538. })
  10539. }),
  10540. define("modernizr", [], function() {
  10541. return window.Modernizr
  10542. }),
  10543. define("bowser", [], function() {
  10544. return window.bowser
  10545. }),
  10546. define("text!coreutils/browsercheck/views/browsercheck.stache", [], function() {
  10547. 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>'
  10548. }),
  10549. define("coreutils/browsercheck/browsercheck", ["jquery", "can", "modernizr", "bowser", "text!./views/browsercheck.stache", "can/view/stache"], function(t, e, n, i, r) {
  10550. return e.stache("browsercheck_views_browsercheck", r),
  10551. e.Control({
  10552. _checkCookiesFailed: !1,
  10553. _checkBorderradiusFailed: !1,
  10554. _checkFlexboxFailed: !1,
  10555. _isInternetExplorerFailed: !1,
  10556. checkAll: function() {
  10557. var t = !0;
  10558. return (t = this.checkCookies()) && (t = this.checkBorderradius()),
  10559. t && (t = this.checkFlexbox()),
  10560. t && (t = !this.isInternetExplorer()),
  10561. t
  10562. },
  10563. isInternetExplorer: function(t) {
  10564. var e = !1;
  10565. return i && !0 === i.msie && (e = !0,
  10566. this._isInternetExplorerFailed = !0,
  10567. this.renderWrongBrowser(t)),
  10568. e
  10569. },
  10570. checkCookies: function() {
  10571. var t = !0;
  10572. return n.cookies || (t = !1,
  10573. this._checkCookiesFailed = !0,
  10574. this.renderWrongBrowser()),
  10575. t
  10576. },
  10577. checkBorderradius: function() {
  10578. var t = !0;
  10579. return n.borderradius || (t = !1,
  10580. this._checkBorderradiusFailed = !0,
  10581. this.renderWrongBrowser()),
  10582. t
  10583. },
  10584. checkFlexbox: function(t) {
  10585. var e = !0;
  10586. return n.flexbox || (e = !1,
  10587. this._checkFlexboxFailed = !0,
  10588. this.renderWrongBrowser(t)),
  10589. e
  10590. },
  10591. renderWrongBrowser: function(i) {
  10592. i || (i = !1),
  10593. this.element.html(e.view("browsercheck_views_browsercheck", {
  10594. type: "wrongbrowser",
  10595. title: this.options.wrongbrowser_title,
  10596. message: this.options.wrongbrowser_message,
  10597. browser_chrome: this.options.browser_chrome,
  10598. browser_ff: this.options.browser_ff,
  10599. browser_ie: this.options.browser_ie,
  10600. browser_edge: this.options.browser_edge,
  10601. browser_safari: this.options.browser_safari,
  10602. extrainfo: this.options.extrainfo,
  10603. extrainfolink: this.options.extrainfolink,
  10604. continueText: this.options.continueText,
  10605. allowContinue: i
  10606. })),
  10607. this.element.find("a:first").focus();
  10608. var r = {}
  10609. , o = "";
  10610. try {
  10611. for (var s in navigator)
  10612. r[s] = navigator[s];
  10613. delete r.plugins,
  10614. delete r.mimeTypes,
  10615. o = JSON.stringify(r)
  10616. } catch (t) {
  10617. r = {
  10618. error: "FAILED parsing navigator",
  10619. userAgent: navigator.userAgent
  10620. },
  10621. o = JSON.stringify(r)
  10622. }
  10623. t.ajax({
  10624. method: "POST",
  10625. url: "/Authentication/Browsercheck/failed",
  10626. data: {
  10627. cookies: this._checkCookiesFailed ? 1 : 0,
  10628. borderradius: this._checkBorderradiusFailed ? 1 : 0,
  10629. flexbox: this._checkFlexboxFailed ? 1 : 0,
  10630. msie: this._isInternetExplorerFailed ? 1 : 0,
  10631. navigator: o,
  10632. modernizrVersion: n._version
  10633. }
  10634. })
  10635. },
  10636. ".continue click": function() {
  10637. this.element.remove(),
  10638. this.destroy()
  10639. }
  10640. })
  10641. }),
  10642. function(t) {
  10643. var e = function(e) {
  10644. this.options = t.extend({}, t.smartbanner.defaults, e);
  10645. var n = navigator.standalone;
  10646. if (this.options.force)
  10647. this.type = this.options.force;
  10648. else if (null != navigator.userAgent.match(/Windows NT/i)) {
  10649. var i = navigator.userAgent.split(/\s*[;)(]\s*/);
  10650. parseFloat(i[1].split(" ").pop()) > 6.1 && (this.type = !1)
  10651. } else
  10652. 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");
  10653. if (this.type && !n && !this.getCookie("sb-closed") && !this.getCookie("sb-installed")) {
  10654. var r, o, s;
  10655. switch (this.type) {
  10656. case "windows":
  10657. r = 'meta[name="msApplication-ID"]',
  10658. o = 'meta[name="ms-store-rt-tracking"]',
  10659. s = this.options.windowsNTConfig || null;
  10660. break;
  10661. case "windows-phone":
  10662. r = 'meta[name="msApplication-WinPhonePackageUrl"]',
  10663. o = 'meta[name="ms-store-phone-tracking"]',
  10664. s = this.options.windowsPhoneConfig || null;
  10665. break;
  10666. case "android":
  10667. r = 'meta[name="google-play-app"]',
  10668. o = 'meta[name="google-play-app-tracking"]',
  10669. s = this.options.androidConfig || null;
  10670. break;
  10671. case "ios":
  10672. r = 'meta[name="apple-itunes-app"]',
  10673. o = 'meta[name="apple-itunes-app-tracking"]',
  10674. s = this.options.iphoneConfig || null
  10675. }
  10676. var a = t(r)
  10677. , u = t(o);
  10678. 0 != a.length && (0 == u.length && (u = t('<meta name="" content="" />')),
  10679. "windows" == this.type ? (this.pfn = t('meta[name="msApplication-PackageFamilyName"]').attr("content"),
  10680. 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],
  10681. this.appTracking = u.attr("content"),
  10682. s && t.extend(this.options, s),
  10683. this.scale = "auto" == this.options.scale ? t(window).width() / window.screen.width : this.options.scale,
  10684. this.scale < 1 && (this.scale = 1),
  10685. this.title = this.options.title ? this.options.title : t("title").text().replace(/\s*[|\-·].*$/, ""),
  10686. this.author = this.options.author ? this.options.author : t('meta[name="author"]').length ? t('meta[name="author"]').attr("content") : window.location.hostname,
  10687. this.create(),
  10688. this.show(),
  10689. this.listen())
  10690. }
  10691. };
  10692. e.prototype = {
  10693. constructor: e,
  10694. create: function() {
  10695. 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;
  10696. if ("" == this.appTracking)
  10697. switch (this.type) {
  10698. case "windows":
  10699. n = "ms-windows-store:PDP?PFN=" + this.pfn;
  10700. break;
  10701. case "windows-phone":
  10702. n = "http://windowsphone.com/s?appId=" + this.appId;
  10703. break;
  10704. case "android":
  10705. n = "market://details?id=" + this.appId;
  10706. break;
  10707. case "ios":
  10708. n = "https://itunes.apple.com/" + this.options.appStoreLanguage + "/app/id" + this.appId
  10709. }
  10710. else
  10711. n = this.appTracking;
  10712. var o = this.options.container;
  10713. if (!(t(o).length < 1)) {
  10714. t(o).append('<div id="smartbanner" class="' + this.type + '"><div class="sb-container"><a href="#" class="sb-close">&times;</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>");
  10715. var s = t("#smartbanner");
  10716. 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")),
  10717. e) {
  10718. var a = t("#smartbanner .sb-icon");
  10719. a.css("background-image", "url(" + e + ")"),
  10720. r && a.addClass("gloss")
  10721. } else
  10722. s.addClass("no-icon");
  10723. this.scale > 1 && (s.css("top", parseFloat(s.css("top")) * this.scale).css("height", parseFloat(s.css("height")) * this.scale),
  10724. 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))
  10725. }
  10726. },
  10727. listen: function() {
  10728. t("#smartbanner .sb-close").on("click", t.proxy(this.close, this)),
  10729. t("#smartbanner .sb-button").on("click", t.proxy(this.install, this))
  10730. },
  10731. show: function(e) {
  10732. var n = t("html");
  10733. n.get(0).className = n.get(0).className + " smartBanner ",
  10734. e && e()
  10735. },
  10736. hide: function(e) {
  10737. t("#smartbanner").detach(),
  10738. e && e()
  10739. },
  10740. close: function(t) {
  10741. t.preventDefault(),
  10742. this.hide(),
  10743. this.setCookie("sb-closed", "true", this.options.daysHidden)
  10744. },
  10745. install: function(t) {
  10746. this.hide(),
  10747. this.setCookie("sb-installed", "true", this.options.daysReminder)
  10748. },
  10749. setCookie: function(t, e, n) {
  10750. var i = new Date;
  10751. i.setDate(i.getDate() + n),
  10752. e = encodeURIComponent(e) + (null == n ? "" : "; expires=" + i.toUTCString()),
  10753. document.cookie = t + "=" + e + "; path=/;"
  10754. },
  10755. getCookie: function(t) {
  10756. var e, n, i, r = document.cookie.split(";");
  10757. for (e = 0; e < r.length; e++)
  10758. if (n = r[e].substr(0, r[e].indexOf("=")),
  10759. i = r[e].substr(r[e].indexOf("=") + 1),
  10760. (n = n.replace(/^\s+|\s+$/g, "")) == t)
  10761. return decodeURIComponent(i);
  10762. return null
  10763. },
  10764. switchType: function() {
  10765. Array.prototype.indexOf || (Array.prototype.indexOf = function(t, e) {
  10766. if (void 0 === this || null === this)
  10767. throw new TypeError('"this" is null or not defined');
  10768. var n = this.length >>> 0;
  10769. for (e = +e || 0,
  10770. Math.abs(e) === 1 / 0 && (e = 0),
  10771. e < 0 && (e += n) < 0 && (e = 0); e < n; e++)
  10772. if (this[e] === t)
  10773. return e;
  10774. return -1
  10775. }
  10776. );
  10777. var e = this;
  10778. e.hide(function() {
  10779. var n = ["ios", "android", "windows", "windows-phone"]
  10780. , i = n.indexOf(e.type) + 1;
  10781. e.type = n[i] ? n[i] : n[0];
  10782. var r = t("android" == e.type ? 'meta[name="google-play-app"]' : 'meta[name="apple-itunes-app"]').attr("content");
  10783. e.appId = /app-id=([^\s,]+)/.exec(r)[1],
  10784. t("#smartbanner").detach(),
  10785. e.create(),
  10786. e.show(),
  10787. window.console && console.log && console.log(e.type)
  10788. })
  10789. }
  10790. },
  10791. t.smartbanner = function(n) {
  10792. var i = t(window)
  10793. , r = i.data("typeahead")
  10794. , o = "object" == typeof n && n;
  10795. r || i.data("typeahead", r = new e(o)),
  10796. "string" == typeof n && r[n]()
  10797. }
  10798. ,
  10799. t.smartbanner.defaults = {
  10800. title: null,
  10801. author: null,
  10802. price: "FREE",
  10803. priceText: "On the store",
  10804. icon: null,
  10805. button: "View in Store",
  10806. appStoreLanguage: "us",
  10807. inAppStore: "On the App Store",
  10808. inGooglePlay: "In Google Play",
  10809. inWindowsStore: "In the Windows Store",
  10810. iconGloss: null,
  10811. daysHidden: 15,
  10812. daysReminder: 90,
  10813. scale: "auto",
  10814. container: "body",
  10815. force: null,
  10816. iphoneConfig: null,
  10817. ipadConfig: null,
  10818. androidConfig: null,
  10819. androidTabsConfig: null,
  10820. windowsPhoneConfig: null,
  10821. windowsNTConfig: null
  10822. },
  10823. t.smartbanner.Constructor = e
  10824. }(window.jQuery),
  10825. define("resources/jqueryplugins/jquery.universal-smartbanner/jquery.ultimate-smartbanner", function() {}),
  10826. require.config({
  10827. baseUrl: "/modules/Authentication/application",
  10828. paths: {
  10829. jquery: "../../../smsc/resources/requirejs-jquery/requirejs-jquery",
  10830. can: "../../../smsc/resources/canjs/2.3.7/amd/can",
  10831. smsc: "../../../smsc/resources/requirejs-smsc/requirejs-smsc",
  10832. jquerypp: "../../../smsc/resources/jquerypp/1.0.1/amd",
  10833. jqueryui: "../../../smsc/resources/requirejs-jqueryui/requirejs-jqueryui",
  10834. modernizr: "../../../smsc/resources/modernizr/requirejs-modernizr",
  10835. bowser: "../../../smsc/resources/bowser/requirejs-bowser",
  10836. text: "../../../smsc/resources/requirejstext/2.0.14/text",
  10837. layout: "../../../smsc/desktop/ui/layout",
  10838. mainui: "../../../smsc/desktop/ui",
  10839. resources: "../../../smsc/resources",
  10840. resources_desktop: "../../../smsc/desktop/resources",
  10841. jqplugins: "../../../includes/jQuery/plugins",
  10842. coreutils: "../../../smsc/utils/"
  10843. },
  10844. shim: {
  10845. can: {
  10846. deps: ["jquery"],
  10847. exports: "can"
  10848. },
  10849. jquerypp: {
  10850. deps: ["jquery"]
  10851. },
  10852. jqueryui: {
  10853. deps: ["jquery"]
  10854. }
  10855. }
  10856. }),
  10857. 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) {
  10858. var u = (t("#smscMain"),
  10859. t("#authRightPaneLogin"))
  10860. , c = t("#statusContainer")
  10861. , l = t("#smsctip")
  10862. , p = t("#browserCheck")
  10863. , h = {}
  10864. , d = {}
  10865. , f = {};
  10866. sessionStorage.clear();
  10867. var g = new a(p,n.vars.check);
  10868. g.checkCookies() && g.checkBorderradius() && (!g.isInternetExplorer(!0) && g.checkFlexbox(!0) && p.remove(),
  10869. d = t.extend({}, n.vars.login, {
  10870. statusElement: c
  10871. }),
  10872. new i(u,d),
  10873. h = t.extend({}, n.vars.status, {
  10874. loginElement: u
  10875. }),
  10876. new r(c,h),
  10877. new o(l),
  10878. f = t.extend({}, n.vars.menu, {
  10879. loginElement: u,
  10880. loginOptions: d
  10881. }),
  10882. new s(t("#authRightPaneOptions"),f),
  10883. t("#browserCheck").length && t("#browserCheck a:first").focus()),
  10884. t.smartbanner({
  10885. title: n.vars.banners.banner_title,
  10886. author: n.vars.banners.banner_title,
  10887. price: n.vars.banners.banner_price,
  10888. priceText: n.vars.banners.banner_applestore,
  10889. icon: null,
  10890. button: n.vars.banners.banner_view,
  10891. daysHidden: 5,
  10892. daysReminder: 90,
  10893. scale: "auto",
  10894. container: "body",
  10895. iphoneConfig: {
  10896. icon: "/smsc/img/apple/apple_128x128.png",
  10897. inAppStore: n.vars.banners.banner_applestore
  10898. },
  10899. ipadConfig: {
  10900. icon: "/smsc/img/apple/apple_128x128.png",
  10901. inAppStore: n.vars.banners.banner_applestore
  10902. },
  10903. androidConfig: {
  10904. icon: "/smsc/img/android_app_logo/android_app_logo_128x128@2x.png",
  10905. inGooglePlay: n.vars.banners.banner_playstore
  10906. },
  10907. androidTabsConfig: {
  10908. icon: "/smsc/img/android_app_logo/android_app_logo_128x128@2x.png",
  10909. inGooglePlay: n.vars.banners.banner_playstore
  10910. },
  10911. windowsPhoneConfig: {
  10912. icon: "/smsc/img/windows_app_logo/windows_app_logo_128x128.png",
  10913. inWindowsStore: n.vars.banners.banner_windowsstore
  10914. },
  10915. windowsNTConfig: {
  10916. icon: "/smsc/img/windows_app_logo/windows_app_logo_128x128.png",
  10917. inWindowsStore: n.vars.banners.banner_windowsstore
  10918. }
  10919. })
  10920. }),
  10921. define("main", function() {});
Add Comment
Please, Sign In to add comment