dolt 0.17.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/.travis.yml +8 -0
  2. data/Gemfile.lock +3 -3
  3. data/bin/dolt +1 -4
  4. data/dolt.gemspec +2 -2
  5. data/lib/dolt/sinatra/actions.rb +1 -0
  6. data/lib/dolt/sinatra/multi_repo_browser.rb +2 -0
  7. data/lib/dolt/sinatra/single_repo_browser.rb +2 -0
  8. data/vendor/ui/.gitmodules +3 -0
  9. data/vendor/ui/autolint.js +13 -0
  10. data/vendor/ui/buster.js +8 -5
  11. data/vendor/ui/css/gitorious.css +13 -29
  12. data/vendor/ui/dist/gitorious3.min.js +3 -3
  13. data/vendor/ui/js/src/app.js +17 -0
  14. data/vendor/ui/js/src/components/abbrev.js +2 -3
  15. data/vendor/ui/js/src/components/blob.js +133 -18
  16. data/vendor/ui/js/src/components/clone-url-selection.js +5 -0
  17. data/vendor/ui/js/src/components/dropdown.js +3 -2
  18. data/vendor/ui/js/src/components/ganalytics.js +5 -2
  19. data/vendor/ui/js/src/components/live-markdown-preview.js +13 -17
  20. data/vendor/ui/js/src/components/ref-selector.js +4 -3
  21. data/vendor/ui/js/src/components/tree-history.js +3 -2
  22. data/vendor/ui/js/src/components/url.js +2 -1
  23. data/vendor/ui/js/src/gitorious.js +21 -15
  24. data/vendor/ui/js/src/logger.js +19 -6
  25. data/vendor/ui/js/test/components/abbrev-test.js +1 -0
  26. data/vendor/ui/js/test/components/blob-test.js +90 -0
  27. data/vendor/ui/js/test/components/clone-url-selection-test.js +25 -0
  28. data/vendor/ui/js/test/components/commit-linker-test.js +26 -21
  29. data/vendor/ui/js/test/components/live-markdown-preview-test.js +37 -0
  30. data/vendor/ui/js/test/components/profile-menu-test.js +1 -1
  31. data/vendor/ui/js/test/components/ref-selector-test.js +1 -1
  32. data/vendor/ui/js/test/components/tree-history-test.js +5 -3
  33. data/vendor/ui/js/test/components/url-template-test.js +9 -5
  34. metadata +9 -5
  35. data/lib/dolt/ruby19.rb +0 -24
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - rbx-18mode
5
+ - rbx-19mode
6
+ - ruby-head
7
+ - 1.8.7
8
+ - ree
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dolt (0.17.0)
4
+ dolt (0.18.0)
5
5
  json (~> 1.5)
6
- libdolt (~> 0.20)
6
+ libdolt (~> 0.21)
7
7
  main (~> 5.2)
8
8
  sinatra (~> 1.0)
9
9
  thin (~> 1.4)
@@ -20,7 +20,7 @@ GEM
20
20
  github-markup (0.7.5)
21
21
  htmlentities (4.3.1)
22
22
  json (1.8.0)
23
- libdolt (0.20.0)
23
+ libdolt (0.21.0)
24
24
  htmlentities (~> 4.3)
25
25
  json (~> 1.7)
26
26
  makeup (~> 0.2)
data/bin/dolt CHANGED
@@ -5,11 +5,8 @@ require "thin"
5
5
  require "sinatra/base"
6
6
  require "cgi"
7
7
  require "main"
8
- if RUBY_VERSION < "1.9"
9
- require "dolt/ruby19"
10
- end
11
- ### TODO: Extract this into a testable API
12
8
 
9
+ ### TODO: Extract this into a testable API
13
10
 
14
11
  class DoltApp
15
12
  def initialize(layout_base)
@@ -11,7 +11,7 @@ end
11
11
 
12
12
  Gem::Specification.new do |s|
13
13
  s.name = "dolt"
14
- s.version = "0.17.0"
14
+ s.version = "0.18.0"
15
15
  s.authors = ["Christian Johansen"]
16
16
  s.email = ["christian@gitorious.org"]
17
17
  s.homepage = "http://gitorious.org/gitorious/dolt"
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.rubyforge_project = "dolt"
22
22
 
23
- s.add_dependency "libdolt", "~>0.20"
23
+ s.add_dependency "libdolt", "~>0.21"
24
24
  s.add_dependency "thin", "~>1.4"
25
25
  s.add_dependency "sinatra", "~>1.0"
26
26
  s.add_dependency "tiltout", "~>1.4"
@@ -17,6 +17,7 @@
17
17
  #++
18
18
  require "json"
19
19
  require "time"
20
+ require "cgi"
20
21
 
21
22
  module Dolt
22
23
  module Sinatra
@@ -27,6 +27,8 @@ module Dolt
27
27
  include Dolt::View::Blob
28
28
  include Dolt::View::Tree
29
29
 
30
+ not_found { renderer.render("404") }
31
+
30
32
  get "/" do
31
33
  response["Content-Type"] = "text/html"
32
34
  body(renderer.render(:index, { :repositories => actions.repositories }))
@@ -33,6 +33,8 @@ module Dolt
33
33
  super(actions, renderer)
34
34
  end
35
35
 
36
+ not_found { renderer.render("404") }
37
+
36
38
  get "/" do
37
39
  redirect("/tree/master:")
38
40
  end
@@ -25,3 +25,6 @@
25
25
  [submodule "js/lib/uinit"]
26
26
  path = js/lib/uinit
27
27
  url = https://git.gitorious.org/gitorious/uinit.git
28
+ [submodule "js/lib/samsam"]
29
+ path = js/lib/samsam
30
+ url = git@github.com:busterjs/samsam.git
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ paths: ["js/src/**/*.js", "js/test/**/*.js"],
3
+ linter: "jslint",
4
+ linterOptions: {
5
+ sloppy: true,
6
+ vars: true,
7
+ browser: true,
8
+ plusplus: true,
9
+ nomen: true,
10
+ predef: []
11
+ },
12
+ excludes: []
13
+ };
@@ -1,5 +1,5 @@
1
1
  exports["Baseline"] = {
2
- sources: ["js/src/app.js", "js/src/components/**/*.js"],
2
+ sources: ["js/src/components/**/*.js"],
3
3
  testHelpers: ["js/test-libs/*.js"],
4
4
  tests: ["js/test/**/*-test.js"],
5
5
  extensions: [require("buster-html-doc")]
@@ -7,17 +7,20 @@ exports["Baseline"] = {
7
7
 
8
8
  exports["Build test"] = {
9
9
  extends: "Baseline",
10
- libs: ["dist/gts-ui-deps.js"]
10
+ libs: ["dist/gitorious3.min.js"]
11
11
  };
12
12
 
13
13
  exports["Browser tests"] = {
14
14
  extends: "Baseline",
15
15
  libs: [
16
- "js/lib/when/when.js",
17
- "js/lib/bane/lib/bane.js",
18
16
  "js/lib/culljs/lib/cull.js",
19
17
  "js/lib/dome/lib/dome.js",
20
18
  "js/lib/dome/lib/event.js",
21
- "js/lib/spin.js/dist/spin.min.js"
19
+ "js/lib/spin.js/spin.js",
20
+ "js/lib/when/when.js",
21
+ "js/lib/bane/lib/bane.js",
22
+ "js/lib/reqwest/reqwest.js",
23
+ "js/lib/uinit/lib/uinit.js",
24
+ "js/lib/showdown/src/showdown.js"
22
25
  ]
23
26
  };
@@ -1,8 +1,6 @@
1
1
  @import "syntax-highlight.css";
2
2
 
3
- /**
4
- * Bootstrap tweaks
5
- */
3
+ /** Bootstrap tweaks */
6
4
 
7
5
  /* The default responsive Bootstrap layout is too wide */
8
6
  .container,
@@ -15,9 +13,7 @@ body h1 {
15
13
  margin-bottom: 0.25em;
16
14
  }
17
15
 
18
- /**
19
- * Header
20
- */
16
+ /** Header */
21
17
  body .gts-masthead {
22
18
  margin-bottom: 0;
23
19
  }
@@ -28,7 +24,7 @@ body .gts-masthead {
28
24
  background-color: #201e1e;
29
25
  }
30
26
 
31
- /* Get the logo and top bar alignment right. */
27
+ /** Get the logo and top bar alignment right. */
32
28
  .gts-masthead .container {
33
29
  padding-bottom: 8px;
34
30
  padding-top: 20px;
@@ -39,18 +35,11 @@ body .gts-masthead {
39
35
  margin: -4px 20px 6px 0;
40
36
  }
41
37
 
42
- .gts-clone-source {
43
- margin-left: 30px;
44
- }
45
-
46
38
  .gts-masthead .navbar-inner .btn-group {
47
39
  padding-right: 0;
48
40
  }
49
41
 
50
- /**
51
- * Repo "boxes"
52
- */
53
-
42
+ /** Repo "boxes" */
54
43
  .gts-repo-header {
55
44
  background: #f5f5f5;
56
45
  border-bottom: 1px solid #ddd;
@@ -58,6 +47,10 @@ body .gts-masthead {
58
47
  padding: 20px 0 0;
59
48
  }
60
49
 
50
+ .gts-clone-source {
51
+ margin-left: 30px;
52
+ }
53
+
61
54
  tt {
62
55
  font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
63
56
  }
@@ -238,9 +231,7 @@ ul.gts-blob-view li {
238
231
  padding-right: 0;
239
232
  }
240
233
 
241
- /**
242
- * Private repositories
243
- */
234
+ /** Private repositories */
244
235
  .gts-private {
245
236
  background: url(../images/white-980x1.png) repeat-y 50% 0 #222;
246
237
  }
@@ -251,9 +242,7 @@ ul.gts-blob-view li {
251
242
  background-position: 100% 0;
252
243
  }
253
244
 
254
- /**
255
- * Repo URLs
256
- */
245
+ /** Repo URLs */
257
246
  .gts-repo-url {
258
247
  position: relative;
259
248
  z-index: 1;
@@ -280,9 +269,7 @@ input[type=url].gts-current-repo-url {
280
269
  margin-bottom: 35px;
281
270
  }
282
271
 
283
- /**
284
- * Date headings
285
- */
272
+ /** Date headings */
286
273
  .gts-date-heading {
287
274
  background-color: #f7f7f9;
288
275
  border-bottom: 1px solid #e1e1e8;
@@ -338,9 +325,7 @@ input[type=url].gts-current-repo-url {
338
325
  text-decoration: underline;
339
326
  }
340
327
 
341
- /**
342
- * Footer
343
- */
328
+ /** Footer */
344
329
  .footer {
345
330
  border-top: 1px solid #e5e5e5;
346
331
  margin-top: 45px;
@@ -360,7 +345,6 @@ input[type=url].gts-current-repo-url {
360
345
  padding-top: 12px;
361
346
  }
362
347
 
363
-
364
348
  /* Branch graph */
365
349
  .capillary p {
366
350
  white-space: normal;
@@ -621,7 +605,6 @@ input[type=text].gts-ref-input {
621
605
  padding: 2px;
622
606
  }
623
607
 
624
-
625
608
  .gts-markup pre code {
626
609
  font-size: inherit;
627
610
  }
@@ -635,6 +618,7 @@ input[type=text].gts-ref-input {
635
618
  min-height: 20px;
636
619
  padding: 19px;
637
620
  }
621
+
638
622
  .gts-readme .gts-page-header {
639
623
  background-color: #f5f5f5;
640
624
  border-radius: 4px 0px 0px 4px;
@@ -1,3 +1,3 @@
1
- var cull=function(e){"use strict";function r(e){return!!e&&typeof e=="object"&&typeof e.length=="number"&&!e.tagName}function i(e){return n.call(e)==="[object Array]"?e:n.call(e)==="[object Arguments]"?t.call(e):typeof e=="undefined"||e===null?[]:t.call(arguments)}function s(e,t){var n,r;for(n=0,r=t.length;n<r;++n)e(t[n],n,t);return t}function o(e){return typeof e=="function"}function u(e,t,n){var r=0,i,s=n,o=t;arguments.length===2&&(s=t,o=s[0],r=1),typeof s=="string"&&(s=s.split(""));for(i=s.length;r<i;++r)o=e(o,s[r]);return o}function a(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(!e(t[n]))return!1;return!0}function f(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e(t[n]))return!0;return!1}function l(e,t){var n,r,i,s;for(n=0,r=t.length;n<r;++n){e(t[n])?i=!0:s=!0;if(i&&s)return!0}return!1}function c(e){return e.trim&&e.trim()||e.replace(/^\s+|\s+$/,"")}function h(e){return e}function p(e){return typeof e!="undefined"&&e!==null}function d(e){return function(t){return e.call(this,t)}}function v(e){return function(t){return t[e]}}function m(e,t){return function(n){return n[e].apply(n,i(t))}}function g(e){return function(t){return e===t}}function b(e,t){var n=i(e);return function(){var e=n.length,r=arguments;while(e--)r=[n[e].apply(t||this,r)];return r[0]}}function w(){var e=arguments;return function(t){return t.apply(this,e)}}function E(e){var n=t.call(arguments,1);return function(){return e.apply(this,n.concat(t.call(arguments)))}}function S(e,n){var r=typeof n=="string"?e[n]:n,i=t.call(arguments,2);return function(){return r.apply(e,i.concat(t.call(arguments)))}}function x(e){var t=[],n,i;for(n=0,i=e.length;n<i;n++)t=t.concat(r(e[n])?x(e[n]):e[n]);return t}function T(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e===t[n])return n;return-1}function N(e){var t=[],n,r;for(n=0,r=e.length;n<r;++n)T(e[n],t)<0&&t.push(e[n]);return t}function C(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e(t[n]))return t[n]}function k(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;++r)e(t[r])&&n.push(t[r]);return n}function L(e,t){return k(function(e){return T(e,t)<0},e)}function A(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(t);return n}function O(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(e[t]);return n}function _(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r++)n.push(e(t[r]));return n}function D(e){return function(){return!e.apply(this,arguments)}}function P(e,t){return k(D(e),t)}function H(e,t){return i(e).concat(i(t))}function B(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r+=e)n.push(t.slice(r,r+e));return n}function j(e,t){return M(_(e,M(t)))}function F(e,t){return u(H,_(e,t))}function I(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r+=1)n.push(t[r]),r<i-1&&n.push(e);return n}function q(e,n,r){var i=e[n];e[n]=function(){var e=i.apply(this,arguments),n=r.apply(this,[e].concat(t.call(arguments)));return typeof n!="undefined"?n:e}}function R(e,t,n){var r=e[t];e[t]=function(){return n.apply(this,arguments),r.apply(this,arguments)}}function U(e,t,n){var r=E(n,e[t]);e[t]=function(){return r.apply(this,arguments)}}var t=Array.prototype.slice,n=Object.prototype.toString,y="compose takes func|[funcs] and optional thisp object",M=E(k,p);return{trim:c,doall:s,reduce:u,all:a,some:f,onlySome:l,isFunction:o,isList:r,toList:i,identity:h,defined:p,unary:d,prop:v,func:m,eq:g,compose:b,callWith:w,partial:E,bind:S,keys:A,values:O,concat:H,flatten:x,uniq:N,first:C,select:k,negate:D,reject:P,seldef:M,map:_,mapdef:j,mapcat:F,partition:B,difference:L,interpose:I,indexOf:T,after:q,before:R,around:U}}(this);typeof require=="function"&&typeof module!="undefined"&&(module.exports=cull);var dome=function(e){function t(n){if(e.isList(n))return e.flatten(e.map(t,n));var r=[],i=n.firstChild;while(i)i.nodeType===1&&r.push(i),i=i.nextSibling;return r}function n(e){return document.getElementById(e)}function r(e,t){var n=t||document;if(n.getElementsByClassName)return n.getElementsByClassName(e);var r=n.getElementsByTagName("*"),i,s,o=[],u=new RegExp("(^|\\s)"+e+"(\\s|$)");for(i=0,s=r.length;i<s;++i)u.test(r[i].className)&&o.push(r[i]);return o}function i(e){e.parentNode.removeChild(e)}function s(e,t){var n=new RegExp("(^|\\s)"+e+"(\\s|$)");return n.test(t.className)}function o(t,n){if(e.isList(n))return e.doall(e.partial(o,t),n);if(s(t,n))return;n.className=e.trim(n.className+" "+t)}function u(t,n){if(e.isList(n))return e.doall(e.partial(u,t),n);if(!s(t,n))return;var r=new RegExp("\\b"+t+"\\b","g");n.className=e.trim(n.className.replace(r,""))}function a(e){var t=e.nodeType;if(t===1||t===9||t===11){if(typeof e.textContent=="string")return e.textContent;var n="";for(e=e.firstChild;e;e=e.nextSibling)n+=a(e);return n}return t===3||t===4?e.nodeValue:""}function f(t){var n=document.createDocumentFragment();return e.doall(e.bind(n,"appendChild"),e.toList(t)),n}function c(e){return e?(typeof e._dome_uuid!="number"&&(e._dome_uuid=l++),e._dome_uuid):null}function p(e,t){if(!t||!e)return!1;var n=c(e);h[n]||(h[n]={});if(h[n][c(t)])return!0;var r=[];while(t&&t!==e)r.push(c(t)),t=t.parentNode;var i=!!t;for(var s=0,o=r.length;s<o;s++)h[n][r[s]]=i;return i}function m(e,t){var n;e=e||{};for(n in e)e.hasOwnProperty(n)&&(t.setAttribute("data-"+n,e[n]),t["data-"+n]=e[n])}function g(e,t){return t.getAttribute("data-"+e)}function b(e,t){var n,r;e=e||{};for(n in e)e.hasOwnProperty(n)&&(r=y[n],r?r(t,e[n]):t[n]=e[n])}function w(t,n){t=e.toList(t);var r,i;for(r=0,i=t.length;r<i;++r)typeof t[r]=="string"?n.appendChild(document.createTextNode(t[r])):n.appendChild(t[r])}function E(e,t){t.innerHTML="",w(e,t)}var l=0,h={},d,v=function(t){return t!==null&&typeof t!="undefined"&&(typeof t.nodeType!="undefined"||typeof t=="string"||e.isList(t))},y={style:function(e,t){var n;for(n in t)t.hasOwnProperty(n)&&(e.style[n]=t[n])},data:function(e,t){m(t,e)}};return d=function(e,t,n){if(!n&&v(t))return d(e,{},t);var r=document.createElement(e);return b(t,r),w(n||[],r),r},d.toString=function(){return"dome.el()"},e.doall(function(t){d[t]=e.partial(d,t)},["a","br","div","fieldset","form","h2","h3","h4","h5","img","input","label","li","p","span","strong","textarea","ul","span","select","option","ol","iframe","table","tr","td","pre","button","i"]),{propmap:y,el:d,setProp:b,append:w,setContent:E,children:t,id:n,byClass:r,remove:i,frag:f,text:a,data:{get:g,set:m},cn:{has:s,add:o,rm:u},uuid:c,contains:p}}(this.cull);(function(e,t){function n(e,t){return/^(?:function|object|unknown)$/.test(typeof e[t])}function a(e,t){return function(n){t.call(i[e],n||window.event)}}function f(e,t){return{handler:t,wrappedHandler:a(e,t)}}function c(e,t,n,r){s(t,n,function(t){e(t.target,n,t)&&r.call(t.target,t)})}var r=function(){if(typeof document.documentElement.uniqueID!="undefined")return function(e){return e.uniqueID};var e=0;return function(t){return t.__uniqueID||(t.__uniqueID="uniqueID__"+e,e+=1),t.__uniqueID}}(),i={},s,o,u=document.documentElement;if(n(u,"addEventListener")&&n(u,"removeEventListener")&&n(window,"addEventListener")&&n(window,"removeEventListener"))s=function(e,t,n){return e.addEventListener(t,n,!1),{cancel:function(){o(e,t,n)}}},o=function(e,t,n){e.removeEventListener(t,n,!1)};else if(n(u,"attachEvent")&&n(u,"detachEvent")&&n(window,"attachEvent")&&n("detachEvent")){var l={};s=function(e,t,n){var s=r(e);i[s]=e,l[s]||(l[s]={}),l[s][t]||(l[s][t]=[]);var u=f(s,n);return l[s][t].push(u),e.attachEvent("on"+t,u.wrappedHandler),{cancel:function(){o(e,t,n)}}},o=function(t,n,i){var s=r(t);if(!l[s]||!l[s][n])return;l[s][n]=e.select(function(e){if(e.handler!==i)return!0;t.detachEvent("on"+n,e.wrappedHandler)},l[s][n])}}c.bycn=function(n,r,i,s){c(e.partial(t.cn.has,n),r,i,s)},dome.events={mouseenter:function(e,t){var n=null,r=s(e,"mouseover",function(r){n!==e&&(t.call(e,r),n=e)}),i=s(e,"mouseout",function(t){var r=t.relatedTarget||t.toElement;try{r&&!r.nodeName&&(r=r.parentNode)}catch(t){return}e!==r&&!dome.contains(e,r)&&(n=null)});return{cancel:function(){r.cancel(),i.cancel()}}},mouseleave:function(e,t){return s(e,"mouseout",function(n){!dome.contains(e,n.relatedTarget)&&e!==n.relatedTarget&&t.call(e,n)})}},dome.on=function(e,t,n){return dome.events[t]?dome.events[t](e,n):s(e,t,n)},dome.off=o,dome.delegate=c,dome.propmap.events=function(t,n){e.doall(function(e){s(t,e,n[e])},e.keys(n))}})(cull,dome),!function(e,t,n){function o(e,n){var r=t.createElement(e||"div"),i;for(i in n)r[i]=n[i];return r}function u(e){for(var t=1,n=arguments.length;t<n;t++)e.appendChild(arguments[t]);return e}function f(e,t,n,r){var o=["opacity",t,~~(e*100),n,r].join("-"),u=.01+n/r*100,f=Math.max(1-(1-e)/t*(100-u),e),l=s.substring(0,s.indexOf("Animation")).toLowerCase(),c=l&&"-"+l+"-"||"";return i[o]||(a.insertRule("@"+c+"keyframes "+o+"{"+"0%{opacity:"+f+"}"+u+"%{opacity:"+e+"}"+(u+.01)+"%{opacity:1}"+(u+t)%100+"%{opacity:"+e+"}"+"100%{opacity:"+f+"}"+"}",a.cssRules.length),i[o]=1),o}function l(e,t){var i=e.style,s,o;if(i[t]!==n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(o=0;o<r.length;o++){s=r[o]+t;if(i[s]!==n)return s}}function c(e,t){for(var n in t)e.style[l(e,n)||n]=t[n];return e}function h(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)e[i]===n&&(e[i]=r[i])}return e}function p(e){var t={x:e.offsetLeft,y:e.offsetTop};while(e=e.offsetParent)t.x+=e.offsetLeft,t.y+=e.offsetTop;return t}function v(e){if(!this.spin)return new v(e);this.opts=h(e||{},v.defaults,d)}var r=["webkit","Moz","ms","O"],i={},s,a=function(){var e=o("style",{type:"text/css"});return u(t.getElementsByTagName("head")[0],e),e.sheet||e.styleSheet}(),d={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};v.defaults={},h(v.prototype,{spin:function(e){this.stop();var t=this,n=t.opts,r=t.el=c(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),i=n.radius+n.length+n.width,u,a;e&&(e.insertBefore(r,e.firstChild||null),a=p(e),u=p(r),c(r,{left:(n.left=="auto"?a.x-u.x+(e.offsetWidth>>1):parseInt(n.left,10)+i)+"px",top:(n.top=="auto"?a.y-u.y+(e.offsetHeight>>1):parseInt(n.top,10)+i)+"px"})),r.setAttribute("aria-role","progressbar"),t.lines(r,t.opts);if(!s){var f=0,l=n.fps,h=l/n.speed,d=(1-n.opacity)/(h*n.trail/100),v=h/n.lines;(function m(){f++;for(var e=n.lines;e;e--){var i=Math.max(1-(f+e*v)%h*d,n.opacity);t.opacity(r,n.lines-e,i,n)}t.timeout=t.el&&setTimeout(m,~~(1e3/l))})()}return t},stop:function(){var e=this.el;return e&&(clearTimeout(this.timeout),e.parentNode&&e.parentNode.removeChild(e),this.el=n),this},lines:function(e,t){function i(e,r){return c(o(),{position:"absolute",width:t.length+t.width+"px",height:t.width+"px",background:e,boxShadow:r,transformOrigin:"left",transform:"rotate("+~~(360/t.lines*n+t.rotate)+"deg) translate("+t.radius+"px"+",0)",borderRadius:(t.corners*t.width>>1)+"px"})}var n=0,r;for(;n<t.lines;n++)r=c(o(),{position:"absolute",top:1+~(t.width/2)+"px",transform:t.hwaccel?"translate3d(0,0,0)":"",opacity:t.opacity,animation:s&&f(t.opacity,t.trail,n,t.lines)+" "+1/t.speed+"s linear infinite"}),t.shadow&&u(r,c(i("#000","0 0 4px #000"),{top:"2px"})),u(e,u(r,i(t.color,"0 0 1px rgba(0,0,0,.1)")));return e},opacity:function(e,t,n){t<e.childNodes.length&&(e.childNodes[t].style.opacity=n)}}),function(){function e(e,t){return o("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',t)}var t=c(o("group"),{behavior:"url(#default#VML)"});!l(t,"transform")&&t.adj?(a.addRule(".spin-vml","behavior:url(#default#VML)"),v.prototype.lines=function(t,n){function s(){return c(e("group",{coordsize:i+" "+i,coordorigin:-r+" "+ -r}),{width:i,height:i})}function l(t,i,o){u(a,u(c(s(),{rotation:360/n.lines*t+"deg",left:~~i}),u(c(e("roundrect",{arcsize:n.corners}),{width:r,height:n.width,left:n.radius,top:-n.width>>1,filter:o}),e("fill",{color:n.color,opacity:n.opacity}),e("stroke",{opacity:0}))))}var r=n.length+n.width,i=2*r,o=-(n.width+n.length)*2+"px",a=c(s(),{position:"absolute",top:o,left:o}),f;if(n.shadow)for(f=1;f<=n.lines;f++)l(f,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(f=1;f<=n.lines;f++)l(f);return u(t,a)},v.prototype.opacity=function(e,t,n,r){var i=e.firstChild;r=r.shadow&&r.lines||0,i&&t+r<i.childNodes.length&&(i=i.childNodes[t+r],i=i&&i.firstChild,i=i&&i.firstChild,i&&(i.opacity=n))}):s=l(t,"animation")}(),typeof define=="function"&&define.amd?define(function(){return v}):e.Spinner=v}(window,document),function(e){"use strict";e(function(){function r(e,t,n,r){return i(e).then(t,n,r)}function i(e){var t,n;return e instanceof o?t=e:l(e)?(n=f(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=u(e),t}function s(e){return r(e,a)}function o(e){this.then=e}function u(e){var t=new o(function(t){try{return i(typeof t=="function"?t(e):e)}catch(n){return a(n)}});return t}function a(e){var t=new o(function(t,n){try{return i(typeof n=="function"?n(e):a(e))}catch(r){return a(r)}});return t}function f(){function h(e,t,n){return u(e,t,n)}function p(e){return c(i(e))}function d(e){return c(a(e))}function v(e){return l(e)}var e,t,r,s,u,l,c;return t=new o(h),e={then:h,resolve:p,reject:d,progress:v,promise:t,resolver:{resolve:p,reject:d,progress:v}},r=[],s=[],u=function(e,t,n){var i,o;return i=f(),o=typeof n=="function"?function(e){try{i.progress(n(e))}catch(t){i.progress(t)}}:function(e){i.progress(e)},r.push(function(n){n.then(e,t).then(i.resolve,i.reject,o)}),s.push(o),i.promise},l=function(e){return y(s,e),e},c=function(e){return u=e.then,c=i,l=E,y(r,e),s=r=n,e},e}function l(e){return e&&typeof e.then=="function"}function c(e,t,n,i,s){return b(2,arguments),r(e,function(e){function g(e){p(e)}function y(e){h(e)}var o,u,a,l,c,h,p,d,v,m;v=e.length>>>0,o=Math.max(0,Math.min(t,v)),a=[],u=v-o+1,l=[],c=f();if(!o)c.resolve(a);else{d=c.progress,p=function(e){l.push(e),--u||(h=p=w,c.reject(l))},h=function(e){a.push(e),--o||(h=p=w,c.resolve(a))};for(m=0;m<v;++m)m in e&&r(e[m],y,g,d)}return c.promise.then(n,i,s)})}function h(e,t,n,r){function i(e){return t?t(e[0]):e[0]}return c(e,1,i,n,r)}function p(e,t,n,r){return b(1,arguments),v(e,E).then(t,n,r)}function d(){return v(arguments,E)}function v(e,t){return r(e,function(e){var n,i,s,o,u,a;s=i=e.length>>>0,n=[],a=f();if(!s)a.resolve(n);else{o=function(i,o){r(i,t).then(function(e){n[o]=e,--s||a.resolve(n)},a.reject)};for(u=0;u<i;u++)u in e?o(e[u],u):--s}return a.promise})}function m(n,i){var s=t.call(arguments,1);return r(n,function(t){var n;return n=t.length,s[0]=function(e,t,s){return r(e,function(e){return r(t,function(t){return i(e,t,s,n)})})},e.apply(t,s)})}function g(e,t,n){var i=arguments.length>2;return r(e,function(e){return e=i?n:e,t.resolve(e),e},function(e){return t.reject(e),a(e)},t.progress)}function y(e,t){var n,r=0;while(n=e[r++])n(t)}function b(e,t){var n,r=t.length;while(r>e){n=t[--r];if(n!=null&&typeof n!="function")throw new Error("arg "+r+" must be a function")}}function w(){}function E(e){return e}var e,t,n;return r.defer=f,r.resolve=i,r.reject=s,r.join=d,r.all=p,r.map=v,r.reduce=m,r.any=h,r.some=c,r.chain=g,r.isPromise=l,o.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(n,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return p(t,function(t){return e.apply(n,t)})})}},t=[].slice,e=[].reduce||function(e){var t,n,r,i,s;s=0,t=Object(this),i=t.length>>>0,n=arguments;if(n.length<=1)for(;;){if(s in t){r=t[s++];break}if(++s>=i)throw new TypeError}else r=n[1];for(;s<i;++s)s in t&&(r=e(r,t[s],s,t));return r},r})}(typeof define=="function"&&define.amd?define:function(e){typeof exports=="object"?module.exports=e():this.when=e()}),(typeof define=="function"&&define.amd&&function(e){define(e)}||typeof module=="object"&&function(e){module.exports=e()}||function(e){this.bane=e()})(function(){"use strict";function t(e,t,n){var r,i=n.length;if(i>0){for(r=0;r<i;++r)n[r](e,t);return}setTimeout(function(){throw t.message=e+" listener threw error: "+t.message,t},0)}function n(e){if(typeof e!="function")throw new TypeError("Listener is not function");return e}function r(e){return e.supervisors||(e.supervisors=[]),e.supervisors}function i(e,t){return e.listeners||(e.listeners={}),t&&!e.listeners[t]&&(e.listeners[t]=[]),t?e.listeners[t]:e.listeners}function s(e){return e.errbacks||(e.errbacks=[]),e.errbacks}function o(o){function u(e,n,r){try{n.listener.apply(n.thisp||o,r)}catch(i){t(e,i,s(o))}}return o=o||{},o.on=function(e,t,s){if(typeof e=="function")return r(this).push({listener:e,thisp:t});i(this,e).push({listener:n(t),thisp:s})},o.off=function(e,t){var n,o,u,a;if(!e){n=r(this),n.splice(0,n.length),o=i(this);for(u in o)o.hasOwnProperty(u)&&(n=i(this,u),n.splice(0,n.length));n=s(this),n.splice(0,n.length);return}typeof e=="function"?(n=r(this),t=e):n=i(this,e);if(!t){n.splice(0,n.length);return}for(u=0,a=n.length;u<a;++u)if(n[u].listener===t){n.splice(u,1);return}},o.once=function(e,t,n){var r=function(){o.off(e,r),t.apply(this,arguments)};o.on(e,r,n)},o.bind=function(e,t){var n,r,i;if(!t)for(n in e)typeof e[n]=="function"&&this.on(n,e[n],e);else for(r=0,i=t.length;r<i;++r){if(typeof e[t[r]]!="function")throw new Error("No such method "+t[r]);this.on(t[r],e[t[r]],e)}return e},o.emit=function(t){var n=r(this),s=e.call(arguments),o,a;for(o=0,a=n.length;o<a;++o)u(t,n[o],s);n=i(this,t).slice(),s=e.call(arguments,1);for(o=0,a=n.length;o<a;++o)u(t,n[o],s)},o.errback=function(e){this.errbacks||(this.errbacks=[]),this.errbacks.push(n(e))},o}var e=Array.prototype.slice;return{createEventEmitter:o}}),function(e,t,n){typeof module!="undefined"&&module.exports?module.exports=n():typeof define=="function"&&define.amd?define(n):t[e]=n()}("reqwest",this,function(){function handleReadyState(e,t,n){return function(){e&&e[readyState]==4&&(e.onreadystatechange=noop,twoHundo.test(e.status)?t(e):n(e))}}function setHeaders(e,t){var n=t.headers||{},r;n.Accept=n.Accept||defaultHeaders.accept[t.type]||defaultHeaders.accept["*"],!t.crossOrigin&&!n[requestedWith]&&(n[requestedWith]=defaultHeaders.requestedWith),n[contentType]||(n[contentType]=t.contentType||defaultHeaders.contentType);for(r in n)n.hasOwnProperty(r)&&e.setRequestHeader(r,n[r])}function setCredentials(e,t){typeof t.withCredentials!="undefined"&&typeof e.withCredentials!="undefined"&&(e.withCredentials=!!t.withCredentials)}function generalCallback(e){lastValue=e}function urlappend(e,t){return e+(/\?/.test(e)?"&":"?")+t}function handleJsonp(e,t,n,r){var i=uniqid++,s=e.jsonpCallback||"callback",o=e.jsonpCallbackName||reqwest.getcallbackPrefix(i),u=new RegExp("((^|\\?|&)"+s+")=([^&]+)"),a=r.match(u),f=doc.createElement("script"),l=0,c=navigator.userAgent.indexOf("MSIE 10.0")!==-1;a?a[3]==="?"?r=r.replace(u,"$1="+o):o=a[3]:r=urlappend(r,s+"="+o),win[o]=generalCallback,f.type="text/javascript",f.src=r,f.async=!0,typeof f.onreadystatechange!="undefined"&&!c&&(f.event="onclick",f.htmlFor=f.id="_reqwest_"+i),f.onload=f.onreadystatechange=function(){if(f[readyState]&&f[readyState]!=="complete"&&f[readyState]!=="loaded"||l)return!1;f.onload=f.onreadystatechange=null,f.onclick&&f.onclick(),e.success&&e.success(lastValue),lastValue=undefined,head.removeChild(f),l=1},head.appendChild(f)}function getRequest(e,t,n){var r=(e.method||"GET").toUpperCase(),i=typeof e=="string"?e:e.url,s=e.processData!==!1&&e.data&&typeof e.data!="string"?reqwest.toQueryString(e.data):e.data||null,o;return(e.type=="jsonp"||r=="GET")&&s&&(i=urlappend(i,s),s=null),e.type=="jsonp"?handleJsonp(e,t,n,i):(o=xhr(),o.open(r,i,!0),setHeaders(o,e),setCredentials(o,e),o.onreadystatechange=handleReadyState(o,t,n),e.before&&e.before(o),o.send(s),o)}function Reqwest(e,t){this.o=e,this.fn=t,init.apply(this,arguments)}function setType(e){var t=e.match(/\.(json|jsonp|html|xml)(\?|$)/);return t?t[1]:"js"}function init(o,fn){function complete(e){o.timeout&&clearTimeout(self.timeout),self.timeout=null;while(self._completeHandlers.length>0)self._completeHandlers.shift()(e)}function success(resp){var r=resp.responseText;if(r)switch(type){case"json":try{resp=win.JSON?win.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML}self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp);while(self._fulfillmentHandlers.length>0)self._fulfillmentHandlers.shift()(resp);complete(resp)}function error(e,t,n){self._responseArgs.resp=e,self._responseArgs.msg=t,self._responseArgs.t=n,self._erred=!0;while(self._errorHandlers.length>0)self._errorHandlers.shift()(e,t,n);complete(e)}this.url=typeof o=="string"?o:o.url,this.timeout=null,this._fulfilled=!1,this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this,type=o.type||setType(this.url);fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort()},o.timeout)),o.success&&this._fulfillmentHandlers.push(function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest(o,success,error)}function reqwest(e,t){return new Reqwest(e,t)}function normalize(e){return e?e.replace(/\r?\n/g,"\r\n"):""}function serial(e,t){var n=e.name,r=e.tagName.toLowerCase(),i=function(e){e&&!e.disabled&&t(n,normalize(e.attributes.value&&e.attributes.value.specified?e.value:e.text))};if(e.disabled||!n)return;switch(r){case"input":if(!/reset|button|image|file/i.test(e.type)){var s=/checkbox/i.test(e.type),o=/radio/i.test(e.type),u=e.value;(!s&&!o||e.checked)&&t(n,normalize(s&&u===""?"on":u))}break;case"textarea":t(n,normalize(e.value));break;case"select":if(e.type.toLowerCase()==="select-one")i(e.selectedIndex>=0?e.options[e.selectedIndex]:null);else for(var a=0;e.length&&a<e.length;a++)e.options[a].selected&&i(e.options[a])}}function eachFormElement(){var e=this,t,n,r,i=function(t,n){for(var i=0;i<n.length;i++){var s=t[byTag](n[i]);for(r=0;r<s.length;r++)serial(s[r],e)}};for(n=0;n<arguments.length;n++)t=arguments[n],/input|select|textarea/i.test(t.tagName)&&serial(t,e),i(t,["input","select","textarea"])}function serializeQueryString(){return reqwest.toQueryString(reqwest.serializeArray.apply(null,arguments))}function serializeHash(){var e={};return eachFormElement.apply(function(t,n){t in e?(e[t]&&!isArray(e[t])&&(e[t]=[e[t]]),e[t].push(n)):e[t]=n},arguments),e}var win=window,doc=document,twoHundo=/^20\d$/,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",requestedWith="X-Requested-With",head=doc[byTag]("head")[0],uniqid=0,callbackPrefix="reqwest_"+ +(new Date),lastValue,xmlHttpRequest="XMLHttpRequest",noop=function(){},isArray=typeof Array.isArray=="function"?Array.isArray:function(e){return e instanceof Array},defaultHeaders={contentType:"application/x-www-form-urlencoded",requestedWith:xmlHttpRequest,accept:{"*":"text/javascript, text/html, application/xml, text/xml, */*",xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",js:"application/javascript, text/javascript"}},xhr=win[xmlHttpRequest]?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")};return Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)},then:function(e,t){return this._fulfilled?e(this._responseArgs.resp):this._erred?t(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):(this._fulfillmentHandlers.push(e),this._errorHandlers.push(t)),this},always:function(e){return this._fulfilled||this._erred?e(this._responseArgs.resp):this._completeHandlers.push(e),this},fail:function(e){return this._erred?e(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):this._errorHandlers.push(e),this}},reqwest.serializeArray=function(){var e=[];return eachFormElement.apply(function(t,n){e.push({name:t,value:n})},arguments),e},reqwest.serialize=function(){if(arguments.length===0)return"";var e,t,n=Array.prototype.slice.call(arguments,0);return e=n.pop(),e&&e.nodeType&&n.push(e)&&(e=null),e&&(e=e.type),e=="map"?t=serializeHash:e=="array"?t=reqwest.serializeArray:t=serializeQueryString,t.apply(null,n)},reqwest.toQueryString=function(e){var t="",n,r=encodeURIComponent,i=function(e,n){t+=r(e)+"="+r(n)+"&"};if(isArray(e))for(n=0;e&&n<e.length;n++)i(e[n].name,e[n].value);else for(var s in e){if(!Object.hasOwnProperty.call(e,s))continue;var o=e[s];if(isArray(o))for(n=0;n<o.length;n++)i(s,o[n]);else i(s,e[s])}return t.replace(/&$/,"").replace(/%20/g,"+")},reqwest.getcallbackPrefix=function(e){return callbackPrefix},reqwest.compat=function(e,t){return e&&(e.type&&(e.method=e.type)&&delete e.type,e.dataType&&(e.type=e.dataType),e.jsonpCallback&&(e.jsonpCallbackName=e.jsonpCallback)&&delete e.jsonpCallback,e.jsonp&&(e.jsonpCallback=e.jsonp)),new Reqwest(e,t)},reqwest}),this.uinit=function(){function t(t,n){return e.reduce(function(e,n){return e&&t[n]&&t[n].loaded},!0,n.depends||[])}function n(t,n){return e.map(function(e){return t[e].result},n)}function r(e,t,r,i){e.emit("loading",r);var s=n(t,r.depends||[]),o=when.defer();return when.all(s).then(function(t){var n=(i?[i]:[]).concat(t);try{var s=r.action.apply(null,n);if(s||r.nullable)r.loaded=!0,r.result=s,e.emit("loaded",r,s)}catch(u){e.emit("error",r,u)}o.resolve()},function(t){e.emit("error",r,t),o.resolve()}),o.promise}function i(t,n){var i=e.partial(r,t,t.features,n);return n.elements?when.all(e.map(i,dome.byClass(n.elements,t.context))):i()}function s(e,n){return!n.lazy&&!n.loaded&&n.action&&t(e,n)}function o(e){return e&&e.lazy&&!e.loaded}function u(t,n){var r=function(e){return t[e]};return e.uniq(e.reduce(function(t,n){return t.concat(e.select(o,e.map(r,n.depends||[])))},[],n))}function a(t,n){return e.doall(function(t){e.doall(function(e){t[e]=n[e]},e.keys(n))},t)}function f(e){return a(e,{lazy:!1,wasLazy:!0})}function l(t){e.doall(function(e){e.action&&(e.loaded=!1),e.wasLazy&&(delete e.wasLazy,e.lazy=!0)},t)}function c(t,n){if(!t.listeners||!t.listeners.pending)return;e.doall(e.bind(t,"emit","pending"),e.select(function(e){return!e.ready&&!e.loaded},n))}function h(t,n){function l(){var r=e.first(o,a);if(!r)return c(t,n);i(t,r).then(function(){if(!r.loaded){var t=e.indexOf(r,a);a=a.slice(0,t).concat(a.slice(t+1))}l()})}var r=f(u(t.features,n)),o=e.partial(s,t.features),a=e.uniq(r.concat(n));l()}function p(e,t){if(e[t])throw new Error("Cannot add duplicate "+t)}function v(){return e.map(function(e){return d.features[e]||{name:e,type:"Unknown"}},this.depends||[])}function m(e,t){t.hasOwnProperty("nullable")||(t.nullable=!0),t.dependencies=v,e.features[t.name]=t,e.tryPending()}function g(t,n){var r=[],i,s=e.values(n);do i=r.length,cull.doall(function(t){r=r.concat(e.select(function(n){return e.indexOf(t,n.depends||[])>=0},s))},t),r=e.uniq(r),t=e.map(e.prop("name"),r);while(i!==r.length);return r}function y(e,t,n){typeof e=="function"&&(n=t,t=e,e=t.name);if(!e)throw new Error("Name cannot be blank");var r=n||{};return r.name=e,r.action=t,r}var e=cull,d;return d=bane.createEventEmitter({features:{},env:function(e,t){if(t===null||t===undefined)return;this.nullableEnv(e,t)},nullableEnv:function(e,t){var n=!!this.env[e];n||p(this.features,e),this.env[e]=t,m(this,{name:e,result:t,loaded:!0});if(n&&this.loaded){var r=g([e],this.features);l(r),h(this,r)}},data:function(e,t,n){var r=y(e,t,n);return p(this.features,r.name),typeof r.lazy!="boolean"&&(r.lazy=!0),typeof r.nullable!="boolean"&&(r.nullable=!1),m(this,r)},feature:function(e,t,n){var r=y(e,t,n);p(this.features,r.name);if(typeof r.action!="function")throw new Error("Cannot add feature "+r.name+", action is not a function ("+typeof r.action+")");m(this,r)},scanEnvAttrs:function(e,t){var n=e.getElementsByTagName("*"),r=[e].concat([].slice.call(n,0)),i,s,o,u;for(var a=0,f=r.length;a<f;++a){s=r[a].attributes;for(o=0,u=s.length;o<u;++o)i=s.item(o),i.nodeName.indexOf(t)===0&&this.env(i.nodeName.slice(t.length),i.nodeValue)}},load:function(t){this.loaded&&l(e.values(this.features)),this.loaded=!0,this.context=t,this.tryPending()},tryPending:function(){if(!this.loaded)return;this.emit("init"),h(this,e.values(this.features))}}),d};var Showdown={extensions:{}},forEach=Showdown.forEach=function(e,t){if(typeof e.forEach=="function")e.forEach(t);else{var n,r=e.length;for(n=0;n<r;n++)t(e[n],n,e)}},stdExtName=function(e){return e.replace(/[_-]||\s/g,"").toLowerCase()};Showdown.converter=function(e){var t,n,r,i=0,s=[],o=[];if(typeof module!="undefind"&&typeof exports!="undefined"&&typeof require!="undefind"){var u=require("fs");if(u){var a=u.readdirSync((__dirname||".")+"/extensions").filter(function(e){return~e.indexOf(".js")}).map(function(e){return e.replace(/\.js$/,"")});Showdown.forEach(a,function(e){var t=stdExtName(e);Showdown.extensions[t]=require("./extensions/"+e)})}}this.makeHtml=function(e){return t={},n={},r=[],e=e.replace(/~/g,"~T"),e=e.replace(/\$/g,"~D"),e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n"),e="\n\n"+e+"\n\n",e=F(e),e=e.replace(/^[ \t]+$/mg,""),Showdown.forEach(s,function(t){e=l(t,e)}),e=N(e),e=h(e),e=c(e),e=d(e),e=B(e),e=e.replace(/~D/g,"$$"),e=e.replace(/~T/g,"~"),Showdown.forEach(o,function(t){e=l(t,e)}),e};if(e&&e.extensions){var f=this;Showdown.forEach(e.extensions,function(e){typeof e=="string"&&(e=Showdown.extensions[stdExtName(e)]);if(typeof e!="function")throw"Extension '"+e+"' could not be loaded. It was either not found or is not a valid extension.";Showdown.forEach(e(f),function(e){e.type?e.type==="language"||e.type==="lang"?s.push(e):(e.type==="output"||e.type==="html")&&o.push(e):o.push(e)})})}var l=function(e,t){if(e.regex){var n=new RegExp(e.regex,"g");return t.replace(n,e.replace)}if(e.filter)return e.filter(t)},c=function(e){return e+="~0",e=e.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm,function(e,r,i,s,o){return r=r.toLowerCase(),t[r]=_(i),s?s+o:(o&&(n[r]=o.replace(/"/g,"&quot;")),"")}),e=e.replace(/~0/,""),e},h=function(e){e=e.replace(/\n/g,"\n\n");var t="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del|style|section|header|footer|nav|article|aside",n="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside";return e=e.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,p),e=e.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,p),e=e.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,p),e=e.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,p),e=e.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,p),e=e.replace(/\n\n/g,"\n"),e},p=function(e,t){var n=t;return n=n.replace(/\n\n/g,"\n"),n=n.replace(/^\n/,""),n=n.replace(/\n+$/g,""),n="\n\n~K"+(r.push(n)-1)+"K\n\n",n},d=function(e){e=E(e);var t=C("<hr />");return e=e.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,t),e=e.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,t),e=e.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,t),e=x(e),e=T(e),e=O(e),e=h(e),e=M(e),e},v=function(e){return e=k(e),e=m(e),e=D(e),e=b(e),e=g(e),e=P(e),e=_(e),e=A(e),e=e.replace(/ +\n/g," <br />\n"),e},m=function(e){var t=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;return e=e.replace(t,function(e){var t=e.replace(/(.)<\/?code>(?=.)/g,"$1`");return t=I(t,"\\`*_"),t}),e},g=function(e){return e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,y),e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,y),e=e.replace(/(\[([^\[\]]+)\])()()()()()/g,y),e},y=function(e,r,i,s,o,u,a,f){f==undefined&&(f="");var l=r,c=i,h=s.toLowerCase(),p=o,d=f;if(p==""){h==""&&(h=c.toLowerCase().replace(/ ?\n/g," ")),p="#"+h;if(t[h]!=undefined)p=t[h],n[h]!=undefined&&(d=n[h]);else{if(!(l.search(/\(\s*\)$/m)>-1))return l;p=""}}p=I(p,"*_");var v='<a href="'+p+'"';return d!=""&&(d=d.replace(/"/g,"&quot;"),d=I(d,"*_"),v+=' title="'+d+'"'),v+=">"+c+"</a>",v},b=function(e){return e=e.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,w),e=e.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,w),e},w=function(e,r,i,s,o,u,a,f){var l=r,c=i,h=s.toLowerCase(),p=o,d=f;d||(d="");if(p==""){h==""&&(h=c.toLowerCase().replace(/ ?\n/g," ")),p="#"+h;if(t[h]==undefined)return l;p=t[h],n[h]!=undefined&&(d=n[h])}c=
2
- c.replace(/"/g,"&quot;"),p=I(p,"*_");var v='<img src="'+p+'" alt="'+c+'"';return d=d.replace(/"/g,"&quot;"),d=I(d,"*_"),v+=' title="'+d+'"',v+=" />",v},E=function(e){function t(e){return e.replace(/[^\w]/g,"").toLowerCase()}return e=e.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(e,n){return C('<h1 id="'+t(n)+'">'+v(n)+"</h1>")}),e=e.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(e,n){return C('<h2 id="'+t(n)+'">'+v(n)+"</h2>")}),e=e.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(e,n,r){var i=n.length;return C("<h"+i+' id="'+t(r)+'">'+v(r)+"</h"+i+">")}),e},S,x=function(e){e+="~0";var t=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return i?e=e.replace(t,function(e,t,n){var r=t,i=n.search(/[*+-]/g)>-1?"ul":"ol";r=r.replace(/\n{2,}/g,"\n\n\n");var s=S(r);return s=s.replace(/\s+$/,""),s="<"+i+">"+s+"</"+i+">\n",s}):(t=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,e=e.replace(t,function(e,t,n,r){var i=t,s=n,o=r.search(/[*+-]/g)>-1?"ul":"ol",s=s.replace(/\n{2,}/g,"\n\n\n"),u=S(s);return u=i+"<"+o+">\n"+u+"</"+o+">\n",u})),e=e.replace(/~0/,""),e};S=function(e){return i++,e=e.replace(/\n{2,}$/,"\n"),e+="~0",e=e.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(e,t,n,r,i){var s=i,o=t,u=n;return o||s.search(/\n{2,}/)>-1?s=d(j(s)):(s=x(j(s)),s=s.replace(/\n$/,""),s=v(s)),"<li>"+s+"</li>\n"}),e=e.replace(/~0/g,""),i--,e};var T=function(e){return e+="~0",e=e.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(e,t,n){var r=t,i=n;return r=L(j(r)),r=F(r),r=r.replace(/^\n+/g,""),r=r.replace(/\n+$/g,""),r="<pre><code>"+r+"\n</code></pre>",C(r)+i}),e=e.replace(/~0/,""),e},N=function(e){return e+="~0",e=e.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(e,t,n){var r=t,i=n;return i=L(i),i=F(i),i=i.replace(/^\n+/g,""),i=i.replace(/\n+$/g,""),i="<pre><code"+(r?' class="'+r+'"':"")+">"+i+"\n</code></pre>",C(i)}),e=e.replace(/~0/,""),e},C=function(e){return e=e.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(r.push(e)-1)+"K\n\n"},k=function(e){return e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,t,n,r,i){var s=r;return s=s.replace(/^([ \t]*)/g,""),s=s.replace(/[ \t]*$/g,""),s=L(s),t+"<code>"+s+"</code>"}),e},L=function(e){return e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=I(e,"*_{}[]\\",!1),e},A=function(e){return e=e.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>"),e=e.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>"),e},O=function(e){return e=e.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(e,t){var n=t;return n=n.replace(/^[ \t]*>[ \t]?/gm,"~0"),n=n.replace(/~0/g,""),n=n.replace(/^[ \t]+$/gm,""),n=d(n),n=n.replace(/(^|\n)/g,"$1 "),n=n.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(e,t){var n=t;return n=n.replace(/^ /mg,"~0"),n=n.replace(/~0/g,""),n}),C("<blockquote>\n"+n+"\n</blockquote>")}),e},M=function(e){e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,"");var t=e.split(/\n{2,}/g),n=[],i=t.length;for(var s=0;s<i;s++){var o=t[s];o.search(/~K(\d+)K/g)>=0?n.push(o):o.search(/\S/)>=0&&(o=v(o),o=o.replace(/^([ \t]*)/g,"<p>"),o+="</p>",n.push(o))}i=n.length;for(var s=0;s<i;s++)while(n[s].search(/~K(\d+)K/)>=0){var u=r[RegExp.$1];u=u.replace(/\$/g,"$$$$"),n[s]=n[s].replace(/~K\d+K/,u)}return n.join("\n\n")},_=function(e){return e=e.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;"),e=e.replace(/<(?![a-z\/?\$!])/gi,"&lt;"),e},D=function(e){return e=e.replace(/\\(\\)/g,q),e=e.replace(/\\([`*_{}\[\]()>#+-.!])/g,q),e},P=function(e){return e=e.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>'),e=e.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(e,t){return H(B(t))}),e},H=function(e){var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e="mailto:"+e,e=e.replace(/./g,function(e){if(e=="@")e=t[Math.floor(Math.random()*2)](e);else if(e!=":"){var n=Math.random();e=n>.9?t[2](e):n>.45?t[1](e):t[0](e)}return e}),e='<a href="'+e+'">'+e+"</a>",e=e.replace(/">.+:/g,'">'),e},B=function(e){return e=e.replace(/~E(\d+)E/g,function(e,t){var n=parseInt(t);return String.fromCharCode(n)}),e},j=function(e){return e=e.replace(/^(\t|[ ]{1,4})/gm,"~0"),e=e.replace(/~0/g,""),e},F=function(e){return e=e.replace(/\t(?=\t)/g," "),e=e.replace(/\t/g,"~A~B"),e=e.replace(/~B(.+?)~A/g,function(e,t,n){var r=t,i=4-r.length%4;for(var s=0;s<i;s++)r+=" ";return r}),e=e.replace(/~A/g," "),e=e.replace(/~B/g,""),e},I=function(e,t,n){var r="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";n&&(r="\\\\"+r);var i=new RegExp(r,"g");return e=e.replace(i,q),e},q=function(e,t){var n=t.charCodeAt(0);return"~E"+n+"E"}},typeof module!="undefined"&&(module.exports=Showdown),typeof define=="function"&&define.amd&&define("showdown",function(){return Showdown});// Set up a global, shared app instance
3
- function refUrlTpl(e,t){return gts.url.templatize(e,{ref:t})}this.gts=this.gts||{},this.gts.app=this.uinit(),this.gts.dropdown=function(e){return function(n){function s(){r&&(r.parentNode.removeChild(r),r=null),e.cn.rm("open",n),i=!1}function o(t){if(i)return s();"ontouchstart"in document.documentElement&&(r=e.el("div",{className:"dropdown-backdrop",events:{click:s}}),t.insertBefore(r,t)),e.cn.add("open",t),i=!0}var r,i=!1;e.on(n,"click",function(e){o(this),e.preventDefault(),e.stopPropagation()}),e.on(document.documentElement,"click",s),e.on(document.documentElement,"keydown",function(e){if(e.keyCode!==27)return;s(),e.preventDefault(),e.stopPropagation()})}}(dome);var gts=this.gts||{};gts.googleAnalytics=function(e,t){window._gaq=window._gaq||[],window._gaq.push(["_setAccount",e]),t&&window._gaq.push(["_setDomainName",t]),window._gaq.push(["_trackPageview"]);var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js",(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(n)};var gts=this.gts||{};gts.abbrev=function(e,t,n){return e.length<=t?e:(n=n||"",cull.reduce(function(e,r){return e.join(" ").length+r.length+n.length<=t&&e.push(r),e},[],e.split(" ")).join(" ")+n)},this.gts=this.gts||{},this.gts.url=function(){function e(e){var t=e.split("/");return t.shift(),t.shift(),t.shift(),"/"+t.join("/")}function t(t,n){return cull.reduce(function(e,t){return e.replace(new RegExp(n[t],"g"),"#{"+t+"}")},e(t),cull.keys(n))}function n(e,t){return cull.reduce(function(e,n){return e.replace(new RegExp("#{"+n+"}","g"),t[n])},e,cull.keys(t))}function r(e){var t=/(blame|blob|tree|history|raw|source|readme)\//,n=e.split(t)[2];return n&&n.split(":")[0]||null}return{templatize:t,render:n,currentRef:r}}(),this.gts=this.gts||{},this.gts.refSelector=function(e){function t(e,t){return(e||"#{ref}").replace(/#\{ref\}/g,t)}function n(e,t,n){return cull.select(function(e){return e[0]===t||e[1]===t},n[e]||[])[0]}function r(t,r){var i=n("heads",r,t),s="branch";return i||(i=n("tags",r,t),s="tag"),i||(s="ref"),e.a({href:"#",className:"dropdown-toggle",innerHTML:'<span class="caret"></span> <em>'+s+":</em> "+(i&&i[0]||r)})}function i(n){var r=e.input({type:"text",className:"gts-ref-input"}),i=e.form({className:"gts-ref-input",events:{submit:function(e){e.preventDefault(),window.location=t(n,r.value)}}},[r]);return e.li({className:"gts-dropdown-input",events:{click:function(e){e.stopPropagation()}}},[e.strong(["Enter ref: ",i])])}function s(n,r,i){var s=[e.li({className:"dropdown-label"},[e.strong(n)])];return cull.reduce(function(n,r){return n.push(e.li(e.a({href:t(i,r[1])},r[0]))),n},s,r.sort())}function o(t,n){return e.ul({className:"dropdown-menu"},[i(n)].concat(s("Branches",t.heads||[],n)).concat(s("Tags",t.tags||[],n)))}function u(t,n,i){return e.div({className:"dropdown gts-branch-selector pull-right"},[r(t,n),o(t,i)])}function a(e,t,n,r){var i=u(t,n,r);e.appendChild(i),this.gts.dropdown(i)}return a.build=u,a}(dome.el),this.gts=this.gts||{},this.gts.treeHistory=function(e,t){function n(e,t){return e.getElementsByTagName(t)}function s(t,n){return e.select(function(e){return e.name===t},n)[0]}function o(e){if(!Date.parse)return"";var t=new Date(Date.parse(e));return i[t.getMonth()]+" "+t.getDate()+" "+t.getFullYear()}function u(e){for(var t=0,n=e.length;t<n;++t)if(dome.cn.has("gts-name",e[t]))return t;return t}function a(e){return(e&&dome.text(e)||"").trim()}var r=function(e,t){var i=n(n(e,"tbody")[0],"td")[2],s=(new Spinner({lines:13,length:1,width:2,radius:6,corners:1,rotate:0,color:"#000",speed:1,trail:60,shadow:!1,hwaccel:!0,className:"spinner",zIndex:2e9,top:"auto",left:"auto"})).spin(i);reqwest({url:t,type:"json",success:function(t){s.stop(),r.annotate(e,t)}})},i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dev"];return r.annotateRow=function(e,t){var r=n(t,"td"),i=u(r),f=s(a(r[i]),e);if(!f)return;var l=f.history[0];r[i+1].innerHTML=o(l.date),dome.data.set({"gts-commit-oid":l.oid},r[i+2]),r[i+2].innerHTML="#"+l.oid.slice(0,7);var c=l.summary.trim();r[i+3].innerHTML=gts.abbrev(c,50," [...]")+" ("+l.author.name+")"},r.annotate=function(t,i){e.doall(e.partial(function(e,t){r.annotateRow(e,t)},i),n(n(t,"tbody")[0],"tr"))},r}(cull);var gts=this.gts||{};(function(e,t){gts.commitLinker=function(e,n,r){t.cn.add("gts-commit-linker",e),t.delegate.bycn("gts-commit-oid",e,"click",function(e){r(gts.url.render(n,{oid:dome.data.get("gts-commit-oid",this)}))})}})(cull.partial,dome),this.gts.userRepoViewState=function(e){return reqwest({url:e,type:"json"})};var gts=this.gts||{};(function(e,t){function n(e,n,r){var i=r?[t.i({className:"icon-"+r}),e]:[e];return t.li(t.a({href:n},i))}gts.profileMenu=function(r,i){if(!i)return;e.setContent([t.a({className:"btn btn-inverse",href:i.dashboardPath},[t.i({className:"icon-user icon-white"}),i.login]),t.a({className:"btn btn-inverse dropdown-toggle",href:"#",data:{toggle:"dropdown"}},t.span({className:"caret"}," ")),t.ul({className:"dropdown-menu"},[n("Edit",i.editPath,"pencil"),n("Messages",i.messagesPath,"envelope"),t.li({className:"divider"}),n("Dashboard",i.dashboardPath),n("Public profile",i.profilePath),n("Log out",i.logoutPath)])],r)}})(dome,dome.el),this.gts.cloneUrlSelection=function(t){var n=t.getElementsByTagName("input")[0];n&&dome.on(n,"focus",function(e){this.select()}),dome.delegate.bycn("gts-repo-url",t,"click",function(e){e.preventDefault();var n=dome.byClass("gts-repo-url",t);cull.doall(cull.partial(dome.cn.rm,"active"),n);if(e.target){dome.cn.add("active",e.target);var r=dome.byClass("gts-current-repo-url")[0];r.value=e.target.href,r.focus()}})},this.gts.blob=function(){function e(e,t,n){var r=function(){dome.cn.add("focus",this)},i=function(){dome.cn.rm("focus",this)};cull.doall(function(e){dome.on(e,"mouseenter",r),dome.on(e,"mouseleave",i)},e.getElementsByTagName("li"))}function t(e){var t=e.match(/\#l(\d+)(?:-(\d+))?/i);if(!t)return;var n=Math.min(t[2]||t[1],t[1]),r=Math.max(t[2]||t[1],t[1]);return[n,r]}function n(e,t){var n=t[0]-1,r=t[1]-1,i=e.getElementsByTagName("li");cull.doall(function(e,t){var i=n<=t&&t<=r;dome.cn[i?"add":"rm"]("region",e)},e.getElementsByTagName("li"))}return{highlightLineOnFocus:e,regionFromUrl:t,highlightRegion:n}}(),this.gts.liveMarkdownPreview=function(t){function u(e){return e<10?"0"+e:e}function a(){var e=new Date;return'<p><img width="24" height="24" class="gts-avatar" alt="avatar" src="http://cageme.herokuapp.com/24/24?'+o+'">'+'<a href="/~zmalltalker">Marius Mathiesen</a>'+u(e.getHours())+":"+u(e.getMinutes())+'. <a href="#">Edit comment</a></p>'}function f(e){n.style.display=e?"block":"none",n.getElementsByTagName("div")[0].innerHTML=e}function l(){s=t.value,s!==i&&(i=s,f(r.makeHtml(s))),setTimeout(l,20)}var n=document.getElementById(t.getAttribute("data-gts-preview-target"));if(!n||typeof Showdown=="undefined")return;var r=new Showdown.converter,i,s,o=(new Date).getTime();l()},this.gts.loadRefs=function(e){return reqwest({url:e,type:"json"})},gts.app.env("url",window.location.href),gts.app.env("redirect",function(e){window.location=e}),"onpopstate"in window&&(window.onpopstate=function(e){gts.app.env("url",window.location.href)}),gts.app.data("current-ref",gts.url.currentRef,{depends:["url"]}),gts.app.data("ref-url-template",refUrlTpl,{depends:["url","current-ref"]}),gts.app.data("repository-refs",gts.loadRefs,{depends:["repository-refs-url"]}),gts.app.data("user-repo-view-state",gts.userRepoViewState,{depends:["user-repository-path"]}),gts.app.data("current-user",cull.prop("user"),{depends:["user-repo-view-state"]}),gts.app.data("blob-region",gts.blob.regionFromUrl,{depends:["url"]}),gts.app.feature("google-analytics",gts.googleAnalytics,{depends:["analytics-account","analytics-domain-name"]}),gts.app.feature("ref-selector",gts.refSelector,{elements:["gts-ref-selector-ph"],depends:["repository-refs","current-ref","ref-url-template"]}),gts.app.feature("tree-history",gts.treeHistory,{elements:["gts-tree-explorer"],depends:["tree-history-url"]}),gts.app.feature("commit-linker",gts.commitLinker,{elements:["gts-body"],depends:["commit-url-template","redirect"]}),gts.app.feature("profile-menu",gts.profileMenu,{elements:["login_button"],depends:["current-user"]}),gts.app.feature("clone-url-selection",gts.cloneUrlSelection,{elements:["gts-repo-urls"]}),gts.app.feature("highlight-region",gts.blob.highlightRegion,{elements:["gts-lines"],depends:["blob-region"]}),gts.app.feature("highlight-line-mouseover",gts.blob.highlightLineOnFocus,{elements:["gts-lines"]}),gts.app.feature("live-markdown-preview",gts.liveMarkdownPreview,{elements:["gts-live-markdown-preview"]}),setTimeout(function(){gts.app.scanEnvAttrs(document.body,"data-gts-env-"),gts.app.load(document.body)},10);
1
+ var cull=function(e){"use strict";function r(e){return!!e&&typeof e=="object"&&typeof e.length=="number"&&!e.tagName}function i(e){return n.call(e)==="[object Array]"?e:n.call(e)==="[object Arguments]"?t.call(e):typeof e=="undefined"||e===null?[]:t.call(arguments)}function s(e,t){var n,r;for(n=0,r=t.length;n<r;++n)e(t[n],n,t);return t}function o(e){return typeof e=="function"}function u(e,t,n){var r=0,i,s=n,o=t;arguments.length===2&&(s=t,o=s[0],r=1),typeof s=="string"&&(s=s.split(""));for(i=s.length;r<i;++r)o=e(o,s[r]);return o}function a(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(!e(t[n]))return!1;return!0}function f(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e(t[n]))return!0;return!1}function l(e,t){var n,r,i,s;for(n=0,r=t.length;n<r;++n){e(t[n])?i=!0:s=!0;if(i&&s)return!0}return!1}function c(e){return e.trim&&e.trim()||e.replace(/^\s+|\s+$/,"")}function h(e){return e}function p(e){return typeof e!="undefined"&&e!==null}function d(e){return function(t){return e.call(this,t)}}function v(e){return function(t){return t[e]}}function m(e,t){return function(n){return n[e].apply(n,i(t))}}function g(e){return function(t){return e===t}}function b(e,t){var n=i(e);return function(){var e=n.length,r=arguments;while(e--)r=[n[e].apply(t||this,r)];return r[0]}}function w(){var e=arguments;return function(t){return t.apply(this,e)}}function E(e){var n=t.call(arguments,1);return function(){return e.apply(this,n.concat(t.call(arguments)))}}function S(e,n){var r=typeof n=="string"?e[n]:n,i=t.call(arguments,2);return function(){return r.apply(e,i.concat(t.call(arguments)))}}function x(e){var t=[],n,i;for(n=0,i=e.length;n<i;n++)t=t.concat(r(e[n])?x(e[n]):e[n]);return t}function T(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e===t[n])return n;return-1}function N(e){var t=[],n,r;for(n=0,r=e.length;n<r;++n)T(e[n],t)<0&&t.push(e[n]);return t}function C(e,t){var n,r;for(n=0,r=t.length;n<r;++n)if(e(t[n]))return t[n]}function k(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;++r)e(t[r])&&n.push(t[r]);return n}function L(e,t){return k(function(e){return T(e,t)<0},e)}function A(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(t);return n}function O(e){var t,n=[];for(t in e)e.hasOwnProperty(t)&&n.push(e[t]);return n}function _(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r++)n.push(e(t[r]));return n}function D(e){return function(){return!e.apply(this,arguments)}}function P(e,t){return k(D(e),t)}function H(e,t){return i(e).concat(i(t))}function B(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r+=e)n.push(t.slice(r,r+e));return n}function j(e,t){return M(_(e,M(t)))}function F(e,t){return u(H,_(e,t))}function I(e,t){var n=[],r,i;for(r=0,i=t.length;r<i;r+=1)n.push(t[r]),r<i-1&&n.push(e);return n}function q(e,n,r){var i=e[n];e[n]=function(){var e=i.apply(this,arguments),n=r.apply(this,[e].concat(t.call(arguments)));return typeof n!="undefined"?n:e}}function R(e,t,n){var r=e[t];e[t]=function(){return n.apply(this,arguments),r.apply(this,arguments)}}function U(e,t,n){var r=E(n,e[t]);e[t]=function(){return r.apply(this,arguments)}}var t=Array.prototype.slice,n=Object.prototype.toString,y="compose takes func|[funcs] and optional thisp object",M=E(k,p);return{trim:c,doall:s,reduce:u,all:a,some:f,onlySome:l,isFunction:o,isList:r,toList:i,identity:h,defined:p,unary:d,prop:v,func:m,eq:g,compose:b,callWith:w,partial:E,bind:S,keys:A,values:O,concat:H,flatten:x,uniq:N,first:C,select:k,negate:D,reject:P,seldef:M,map:_,mapdef:j,mapcat:F,partition:B,difference:L,interpose:I,indexOf:T,after:q,before:R,around:U}}(this);typeof require=="function"&&typeof module!="undefined"&&(module.exports=cull);var dome=function(e){function t(n){if(e.isList(n))return e.flatten(e.map(t,n));var r=[],i=n.firstChild;while(i)i.nodeType===1&&r.push(i),i=i.nextSibling;return r}function n(e){return document.getElementById(e)}function r(e,t){var n=t||document;if(n.getElementsByClassName)return n.getElementsByClassName(e);var r=n.getElementsByTagName("*"),i,s,o=[],u=new RegExp("(^|\\s)"+e+"(\\s|$)");for(i=0,s=r.length;i<s;++i)u.test(r[i].className)&&o.push(r[i]);return o}function i(e){e.parentNode.removeChild(e)}function s(e,t){var n=new RegExp("(^|\\s)"+e+"(\\s|$)");return n.test(t.className)}function o(t,n){if(e.isList(n))return e.doall(e.partial(o,t),n);if(s(t,n))return;n.className=e.trim(n.className+" "+t)}function u(t,n){if(e.isList(n))return e.doall(e.partial(u,t),n);if(!s(t,n))return;var r=new RegExp("\\b"+t+"\\b","g");n.className=e.trim(n.className.replace(r,""))}function a(e){var t=e.nodeType;if(t===1||t===9||t===11){if(typeof e.textContent=="string")return e.textContent;var n="";for(e=e.firstChild;e;e=e.nextSibling)n+=a(e);return n}return t===3||t===4?e.nodeValue:""}function f(t){var n=document.createDocumentFragment();return e.doall(e.bind(n,"appendChild"),e.toList(t)),n}function c(e){return e?(typeof e._dome_uuid!="number"&&(e._dome_uuid=l++),e._dome_uuid):null}function p(e,t){if(!t||!e)return!1;var n=c(e);h[n]||(h[n]={});if(h[n][c(t)])return!0;var r=[];while(t&&t!==e)r.push(c(t)),t=t.parentNode;var i=!!t;for(var s=0,o=r.length;s<o;s++)h[n][r[s]]=i;return i}function m(e,t){var n;e=e||{};for(n in e)e.hasOwnProperty(n)&&(t.setAttribute("data-"+n,e[n]),t["data-"+n]=e[n])}function g(e,t){return t.getAttribute("data-"+e)}function b(e,t){var n,r;e=e||{};for(n in e)e.hasOwnProperty(n)&&(r=y[n],r?r(t,e[n]):t[n]=e[n])}function w(t,n){t=e.toList(t);var r,i;for(r=0,i=t.length;r<i;++r)typeof t[r]=="string"?n.appendChild(document.createTextNode(t[r])):n.appendChild(t[r])}function E(e,t){t.innerHTML="",w(e,t)}var l=0,h={},d,v=function(t){return t!==null&&typeof t!="undefined"&&(typeof t.nodeType!="undefined"||typeof t=="string"||e.isList(t))},y={style:function(e,t){var n;for(n in t)t.hasOwnProperty(n)&&(e.style[n]=t[n])},data:function(e,t){m(t,e)}};return d=function(e,t,n){if(!n&&v(t))return d(e,{},t);var r=document.createElement(e);return b(t,r),w(n||[],r),r},d.toString=function(){return"dome.el()"},e.doall(function(t){d[t]=e.partial(d,t)},["a","br","div","fieldset","form","h2","h3","h4","h5","img","input","label","li","p","span","strong","textarea","ul","span","select","option","ol","iframe","table","tr","td","pre","button","i"]),{propmap:y,el:d,setProp:b,append:w,setContent:E,children:t,id:n,byClass:r,remove:i,frag:f,text:a,data:{get:g,set:m},cn:{has:s,add:o,rm:u},uuid:c,contains:p}}(this.cull);(function(e,t){function n(e,t){return/^(?:function|object|unknown)$/.test(typeof e[t])}function a(e,t){return function(n){t.call(i[e],n||window.event)}}function f(e,t){return{handler:t,wrappedHandler:a(e,t)}}function c(e,t,n,r){s(t,n,function(t){e(t.target,n,t)&&r.call(t.target,t)})}var r=function(){if(typeof document.documentElement.uniqueID!="undefined")return function(e){return e.uniqueID};var e=0;return function(t){return t.__uniqueID||(t.__uniqueID="uniqueID__"+e,e+=1),t.__uniqueID}}(),i={},s,o,u=document.documentElement;if(n(u,"addEventListener")&&n(u,"removeEventListener")&&n(window,"addEventListener")&&n(window,"removeEventListener"))s=function(e,t,n){return e.addEventListener(t,n,!1),{cancel:function(){o(e,t,n)}}},o=function(e,t,n){e.removeEventListener(t,n,!1)};else if(n(u,"attachEvent")&&n(u,"detachEvent")&&n(window,"attachEvent")&&n("detachEvent")){var l={};s=function(e,t,n){var s=r(e);i[s]=e,l[s]||(l[s]={}),l[s][t]||(l[s][t]=[]);var u=f(s,n);return l[s][t].push(u),e.attachEvent("on"+t,u.wrappedHandler),{cancel:function(){o(e,t,n)}}},o=function(t,n,i){var s=r(t);if(!l[s]||!l[s][n])return;l[s][n]=e.select(function(e){if(e.handler!==i)return!0;t.detachEvent("on"+n,e.wrappedHandler)},l[s][n])}}c.bycn=function(n,r,i,s){c(e.partial(t.cn.has,n),r,i,s)},dome.events={mouseenter:function(e,t){var n=null,r=s(e,"mouseover",function(r){n!==e&&(t.call(e,r),n=e)}),i=s(e,"mouseout",function(t){var r=t.relatedTarget||t.toElement;try{r&&!r.nodeName&&(r=r.parentNode)}catch(t){return}e!==r&&!dome.contains(e,r)&&(n=null)});return{cancel:function(){r.cancel(),i.cancel()}}},mouseleave:function(e,t){return s(e,"mouseout",function(n){!dome.contains(e,n.relatedTarget)&&e!==n.relatedTarget&&t.call(e,n)})}},dome.on=function(e,t,n){return dome.events[t]?dome.events[t](e,n):s(e,t,n)},dome.off=o,dome.delegate=c,dome.propmap.events=function(t,n){e.doall(function(e){s(t,e,n[e])},e.keys(n))}})(cull,dome),!function(e,t,n){function o(e,n){var r=t.createElement(e||"div"),i;for(i in n)r[i]=n[i];return r}function u(e){for(var t=1,n=arguments.length;t<n;t++)e.appendChild(arguments[t]);return e}function f(e,t,n,r){var o=["opacity",t,~~(e*100),n,r].join("-"),u=.01+n/r*100,f=Math.max(1-(1-e)/t*(100-u),e),l=s.substring(0,s.indexOf("Animation")).toLowerCase(),c=l&&"-"+l+"-"||"";return i[o]||(a.insertRule("@"+c+"keyframes "+o+"{"+"0%{opacity:"+f+"}"+u+"%{opacity:"+e+"}"+(u+.01)+"%{opacity:1}"+(u+t)%100+"%{opacity:"+e+"}"+"100%{opacity:"+f+"}"+"}",a.cssRules.length),i[o]=1),o}function l(e,t){var i=e.style,s,o;if(i[t]!==n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(o=0;o<r.length;o++){s=r[o]+t;if(i[s]!==n)return s}}function c(e,t){for(var n in t)e.style[l(e,n)||n]=t[n];return e}function h(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)e[i]===n&&(e[i]=r[i])}return e}function p(e){var t={x:e.offsetLeft,y:e.offsetTop};while(e=e.offsetParent)t.x+=e.offsetLeft,t.y+=e.offsetTop;return t}function v(e){if(!this.spin)return new v(e);this.opts=h(e||{},v.defaults,d)}var r=["webkit","Moz","ms","O"],i={},s,a=function(){var e=o("style",{type:"text/css"});return u(t.getElementsByTagName("head")[0],e),e.sheet||e.styleSheet}(),d={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};v.defaults={},h(v.prototype,{spin:function(e){this.stop();var t=this,n=t.opts,r=t.el=c(o(0,{className:n.className}),{position:n.position,width:0,zIndex:n.zIndex}),i=n.radius+n.length+n.width,u,a;e&&(e.insertBefore(r,e.firstChild||null),a=p(e),u=p(r),c(r,{left:(n.left=="auto"?a.x-u.x+(e.offsetWidth>>1):parseInt(n.left,10)+i)+"px",top:(n.top=="auto"?a.y-u.y+(e.offsetHeight>>1):parseInt(n.top,10)+i)+"px"})),r.setAttribute("aria-role","progressbar"),t.lines(r,t.opts);if(!s){var f=0,l=n.fps,h=l/n.speed,d=(1-n.opacity)/(h*n.trail/100),v=h/n.lines;(function m(){f++;for(var e=n.lines;e;e--){var i=Math.max(1-(f+e*v)%h*d,n.opacity);t.opacity(r,n.lines-e,i,n)}t.timeout=t.el&&setTimeout(m,~~(1e3/l))})()}return t},stop:function(){var e=this.el;return e&&(clearTimeout(this.timeout),e.parentNode&&e.parentNode.removeChild(e),this.el=n),this},lines:function(e,t){function i(e,r){return c(o(),{position:"absolute",width:t.length+t.width+"px",height:t.width+"px",background:e,boxShadow:r,transformOrigin:"left",transform:"rotate("+~~(360/t.lines*n+t.rotate)+"deg) translate("+t.radius+"px"+",0)",borderRadius:(t.corners*t.width>>1)+"px"})}var n=0,r;for(;n<t.lines;n++)r=c(o(),{position:"absolute",top:1+~(t.width/2)+"px",transform:t.hwaccel?"translate3d(0,0,0)":"",opacity:t.opacity,animation:s&&f(t.opacity,t.trail,n,t.lines)+" "+1/t.speed+"s linear infinite"}),t.shadow&&u(r,c(i("#000","0 0 4px #000"),{top:"2px"})),u(e,u(r,i(t.color,"0 0 1px rgba(0,0,0,.1)")));return e},opacity:function(e,t,n){t<e.childNodes.length&&(e.childNodes[t].style.opacity=n)}}),function(){function e(e,t){return o("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',t)}var t=c(o("group"),{behavior:"url(#default#VML)"});!l(t,"transform")&&t.adj?(a.addRule(".spin-vml","behavior:url(#default#VML)"),v.prototype.lines=function(t,n){function s(){return c(e("group",{coordsize:i+" "+i,coordorigin:-r+" "+ -r}),{width:i,height:i})}function l(t,i,o){u(a,u(c(s(),{rotation:360/n.lines*t+"deg",left:~~i}),u(c(e("roundrect",{arcsize:n.corners}),{width:r,height:n.width,left:n.radius,top:-n.width>>1,filter:o}),e("fill",{color:n.color,opacity:n.opacity}),e("stroke",{opacity:0}))))}var r=n.length+n.width,i=2*r,o=-(n.width+n.length)*2+"px",a=c(s(),{position:"absolute",top:o,left:o}),f;if(n.shadow)for(f=1;f<=n.lines;f++)l(f,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(f=1;f<=n.lines;f++)l(f);return u(t,a)},v.prototype.opacity=function(e,t,n,r){var i=e.firstChild;r=r.shadow&&r.lines||0,i&&t+r<i.childNodes.length&&(i=i.childNodes[t+r],i=i&&i.firstChild,i=i&&i.firstChild,i&&(i.opacity=n))}):s=l(t,"animation")}(),typeof define=="function"&&define.amd?define(function(){return v}):e.Spinner=v}(window,document),function(e){"use strict";e(function(){function r(e,t,n,r){return i(e).then(t,n,r)}function i(e){var t,n;return e instanceof o?t=e:l(e)?(n=f(),e.then(function(e){n.resolve(e)},function(e){n.reject(e)},function(e){n.progress(e)}),t=n.promise):t=u(e),t}function s(e){return r(e,a)}function o(e){this.then=e}function u(e){var t=new o(function(t){try{return i(typeof t=="function"?t(e):e)}catch(n){return a(n)}});return t}function a(e){var t=new o(function(t,n){try{return i(typeof n=="function"?n(e):a(e))}catch(r){return a(r)}});return t}function f(){function h(e,t,n){return u(e,t,n)}function p(e){return c(i(e))}function d(e){return c(a(e))}function v(e){return l(e)}var e,t,r,s,u,l,c;return t=new o(h),e={then:h,resolve:p,reject:d,progress:v,promise:t,resolver:{resolve:p,reject:d,progress:v}},r=[],s=[],u=function(e,t,n){var i,o;return i=f(),o=typeof n=="function"?function(e){try{i.progress(n(e))}catch(t){i.progress(t)}}:function(e){i.progress(e)},r.push(function(n){n.then(e,t).then(i.resolve,i.reject,o)}),s.push(o),i.promise},l=function(e){return y(s,e),e},c=function(e){return u=e.then,c=i,l=E,y(r,e),s=r=n,e},e}function l(e){return e&&typeof e.then=="function"}function c(e,t,n,i,s){return b(2,arguments),r(e,function(e){function g(e){p(e)}function y(e){h(e)}var o,u,a,l,c,h,p,d,v,m;v=e.length>>>0,o=Math.max(0,Math.min(t,v)),a=[],u=v-o+1,l=[],c=f();if(!o)c.resolve(a);else{d=c.progress,p=function(e){l.push(e),--u||(h=p=w,c.reject(l))},h=function(e){a.push(e),--o||(h=p=w,c.resolve(a))};for(m=0;m<v;++m)m in e&&r(e[m],y,g,d)}return c.promise.then(n,i,s)})}function h(e,t,n,r){function i(e){return t?t(e[0]):e[0]}return c(e,1,i,n,r)}function p(e,t,n,r){return b(1,arguments),v(e,E).then(t,n,r)}function d(){return v(arguments,E)}function v(e,t){return r(e,function(e){var n,i,s,o,u,a;s=i=e.length>>>0,n=[],a=f();if(!s)a.resolve(n);else{o=function(i,o){r(i,t).then(function(e){n[o]=e,--s||a.resolve(n)},a.reject)};for(u=0;u<i;u++)u in e?o(e[u],u):--s}return a.promise})}function m(n,i){var s=t.call(arguments,1);return r(n,function(t){var n;return n=t.length,s[0]=function(e,t,s){return r(e,function(e){return r(t,function(t){return i(e,t,s,n)})})},e.apply(t,s)})}function g(e,t,n){var i=arguments.length>2;return r(e,function(e){return e=i?n:e,t.resolve(e),e},function(e){return t.reject(e),a(e)},t.progress)}function y(e,t){var n,r=0;while(n=e[r++])n(t)}function b(e,t){var n,r=t.length;while(r>e){n=t[--r];if(n!=null&&typeof n!="function")throw new Error("arg "+r+" must be a function")}}function w(){}function E(e){return e}var e,t,n;return r.defer=f,r.resolve=i,r.reject=s,r.join=d,r.all=p,r.map=v,r.reduce=m,r.any=h,r.some=c,r.chain=g,r.isPromise=l,o.prototype={always:function(e,t){return this.then(e,e,t)},otherwise:function(e){return this.then(n,e)},yield:function(e){return this.then(function(){return e})},spread:function(e){return this.then(function(t){return p(t,function(t){return e.apply(n,t)})})}},t=[].slice,e=[].reduce||function(e){var t,n,r,i,s;s=0,t=Object(this),i=t.length>>>0,n=arguments;if(n.length<=1)for(;;){if(s in t){r=t[s++];break}if(++s>=i)throw new TypeError}else r=n[1];for(;s<i;++s)s in t&&(r=e(r,t[s],s,t));return r},r})}(typeof define=="function"&&define.amd?define:function(e){typeof exports=="object"?module.exports=e():this.when=e()}),(typeof define=="function"&&define.amd&&function(e){define(e)}||typeof module=="object"&&function(e){module.exports=e()}||function(e){this.bane=e()})(function(){"use strict";function t(e,t,n){var r,i=n.length;if(i>0){for(r=0;r<i;++r)n[r](e,t);return}setTimeout(function(){throw t.message=e+" listener threw error: "+t.message,t},0)}function n(e){if(typeof e!="function")throw new TypeError("Listener is not function");return e}function r(e){return e.supervisors||(e.supervisors=[]),e.supervisors}function i(e,t){return e.listeners||(e.listeners={}),t&&!e.listeners[t]&&(e.listeners[t]=[]),t?e.listeners[t]:e.listeners}function s(e){return e.errbacks||(e.errbacks=[]),e.errbacks}function o(o){function u(e,n,r){try{n.listener.apply(n.thisp||o,r)}catch(i){t(e,i,s(o))}}return o=o||{},o.on=function(e,t,s){if(typeof e=="function")return r(this).push({listener:e,thisp:t});i(this,e).push({listener:n(t),thisp:s})},o.off=function(e,t){var n,o,u,a;if(!e){n=r(this),n.splice(0,n.length),o=i(this);for(u in o)o.hasOwnProperty(u)&&(n=i(this,u),n.splice(0,n.length));n=s(this),n.splice(0,n.length);return}typeof e=="function"?(n=r(this),t=e):n=i(this,e);if(!t){n.splice(0,n.length);return}for(u=0,a=n.length;u<a;++u)if(n[u].listener===t){n.splice(u,1);return}},o.once=function(e,t,n){var r=function(){o.off(e,r),t.apply(this,arguments)};o.on(e,r,n)},o.bind=function(e,t){var n,r,i;if(!t)for(n in e)typeof e[n]=="function"&&this.on(n,e[n],e);else for(r=0,i=t.length;r<i;++r){if(typeof e[t[r]]!="function")throw new Error("No such method "+t[r]);this.on(t[r],e[t[r]],e)}return e},o.emit=function(t){var n=r(this),s=e.call(arguments),o,a;for(o=0,a=n.length;o<a;++o)u(t,n[o],s);n=i(this,t).slice(),s=e.call(arguments,1);for(o=0,a=n.length;o<a;++o)u(t,n[o],s)},o.errback=function(e){this.errbacks||(this.errbacks=[]),this.errbacks.push(n(e))},o}var e=Array.prototype.slice;return{createEventEmitter:o}}),function(e,t,n){typeof module!="undefined"&&module.exports?module.exports=n():typeof define=="function"&&define.amd?define(n):t[e]=n()}("reqwest",this,function(){function handleReadyState(e,t,n){return function(){e&&e[readyState]==4&&(e.onreadystatechange=noop,twoHundo.test(e.status)?t(e):n(e))}}function setHeaders(e,t){var n=t.headers||{},r;n.Accept=n.Accept||defaultHeaders.accept[t.type]||defaultHeaders.accept["*"],!t.crossOrigin&&!n[requestedWith]&&(n[requestedWith]=defaultHeaders.requestedWith),n[contentType]||(n[contentType]=t.contentType||defaultHeaders.contentType);for(r in n)n.hasOwnProperty(r)&&e.setRequestHeader(r,n[r])}function setCredentials(e,t){typeof t.withCredentials!="undefined"&&typeof e.withCredentials!="undefined"&&(e.withCredentials=!!t.withCredentials)}function generalCallback(e){lastValue=e}function urlappend(e,t){return e+(/\?/.test(e)?"&":"?")+t}function handleJsonp(e,t,n,r){var i=uniqid++,s=e.jsonpCallback||"callback",o=e.jsonpCallbackName||reqwest.getcallbackPrefix(i),u=new RegExp("((^|\\?|&)"+s+")=([^&]+)"),a=r.match(u),f=doc.createElement("script"),l=0,c=navigator.userAgent.indexOf("MSIE 10.0")!==-1;a?a[3]==="?"?r=r.replace(u,"$1="+o):o=a[3]:r=urlappend(r,s+"="+o),win[o]=generalCallback,f.type="text/javascript",f.src=r,f.async=!0,typeof f.onreadystatechange!="undefined"&&!c&&(f.event="onclick",f.htmlFor=f.id="_reqwest_"+i),f.onload=f.onreadystatechange=function(){if(f[readyState]&&f[readyState]!=="complete"&&f[readyState]!=="loaded"||l)return!1;f.onload=f.onreadystatechange=null,f.onclick&&f.onclick(),e.success&&e.success(lastValue),lastValue=undefined,head.removeChild(f),l=1},head.appendChild(f)}function getRequest(e,t,n){var r=(e.method||"GET").toUpperCase(),i=typeof e=="string"?e:e.url,s=e.processData!==!1&&e.data&&typeof e.data!="string"?reqwest.toQueryString(e.data):e.data||null,o;return(e.type=="jsonp"||r=="GET")&&s&&(i=urlappend(i,s),s=null),e.type=="jsonp"?handleJsonp(e,t,n,i):(o=xhr(),o.open(r,i,!0),setHeaders(o,e),setCredentials(o,e),o.onreadystatechange=handleReadyState(o,t,n),e.before&&e.before(o),o.send(s),o)}function Reqwest(e,t){this.o=e,this.fn=t,init.apply(this,arguments)}function setType(e){var t=e.match(/\.(json|jsonp|html|xml)(\?|$)/);return t?t[1]:"js"}function init(o,fn){function complete(e){o.timeout&&clearTimeout(self.timeout),self.timeout=null;while(self._completeHandlers.length>0)self._completeHandlers.shift()(e)}function success(resp){var r=resp.responseText;if(r)switch(type){case"json":try{resp=win.JSON?win.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML}self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp);while(self._fulfillmentHandlers.length>0)self._fulfillmentHandlers.shift()(resp);complete(resp)}function error(e,t,n){self._responseArgs.resp=e,self._responseArgs.msg=t,self._responseArgs.t=n,self._erred=!0;while(self._errorHandlers.length>0)self._errorHandlers.shift()(e,t,n);complete(e)}this.url=typeof o=="string"?o:o.url,this.timeout=null,this._fulfilled=!1,this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this,type=o.type||setType(this.url);fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort()},o.timeout)),o.success&&this._fulfillmentHandlers.push(function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest(o,success,error)}function reqwest(e,t){return new Reqwest(e,t)}function normalize(e){return e?e.replace(/\r?\n/g,"\r\n"):""}function serial(e,t){var n=e.name,r=e.tagName.toLowerCase(),i=function(e){e&&!e.disabled&&t(n,normalize(e.attributes.value&&e.attributes.value.specified?e.value:e.text))};if(e.disabled||!n)return;switch(r){case"input":if(!/reset|button|image|file/i.test(e.type)){var s=/checkbox/i.test(e.type),o=/radio/i.test(e.type),u=e.value;(!s&&!o||e.checked)&&t(n,normalize(s&&u===""?"on":u))}break;case"textarea":t(n,normalize(e.value));break;case"select":if(e.type.toLowerCase()==="select-one")i(e.selectedIndex>=0?e.options[e.selectedIndex]:null);else for(var a=0;e.length&&a<e.length;a++)e.options[a].selected&&i(e.options[a])}}function eachFormElement(){var e=this,t,n,r,i=function(t,n){for(var i=0;i<n.length;i++){var s=t[byTag](n[i]);for(r=0;r<s.length;r++)serial(s[r],e)}};for(n=0;n<arguments.length;n++)t=arguments[n],/input|select|textarea/i.test(t.tagName)&&serial(t,e),i(t,["input","select","textarea"])}function serializeQueryString(){return reqwest.toQueryString(reqwest.serializeArray.apply(null,arguments))}function serializeHash(){var e={};return eachFormElement.apply(function(t,n){t in e?(e[t]&&!isArray(e[t])&&(e[t]=[e[t]]),e[t].push(n)):e[t]=n},arguments),e}var win=window,doc=document,twoHundo=/^20\d$/,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",requestedWith="X-Requested-With",head=doc[byTag]("head")[0],uniqid=0,callbackPrefix="reqwest_"+ +(new Date),lastValue,xmlHttpRequest="XMLHttpRequest",noop=function(){},isArray=typeof Array.isArray=="function"?Array.isArray:function(e){return e instanceof Array},defaultHeaders={contentType:"application/x-www-form-urlencoded",requestedWith:xmlHttpRequest,accept:{"*":"text/javascript, text/html, application/xml, text/xml, */*",xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",js:"application/javascript, text/javascript"}},xhr=win[xmlHttpRequest]?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")};return Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)},then:function(e,t){return this._fulfilled?e(this._responseArgs.resp):this._erred?t(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):(this._fulfillmentHandlers.push(e),this._errorHandlers.push(t)),this},always:function(e){return this._fulfilled||this._erred?e(this._responseArgs.resp):this._completeHandlers.push(e),this},fail:function(e){return this._erred?e(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):this._errorHandlers.push(e),this}},reqwest.serializeArray=function(){var e=[];return eachFormElement.apply(function(t,n){e.push({name:t,value:n})},arguments),e},reqwest.serialize=function(){if(arguments.length===0)return"";var e,t,n=Array.prototype.slice.call(arguments,0);return e=n.pop(),e&&e.nodeType&&n.push(e)&&(e=null),e&&(e=e.type),e=="map"?t=serializeHash:e=="array"?t=reqwest.serializeArray:t=serializeQueryString,t.apply(null,n)},reqwest.toQueryString=function(e){var t="",n,r=encodeURIComponent,i=function(e,n){t+=r(e)+"="+r(n)+"&"};if(isArray(e))for(n=0;e&&n<e.length;n++)i(e[n].name,e[n].value);else for(var s in e){if(!Object.hasOwnProperty.call(e,s))continue;var o=e[s];if(isArray(o))for(n=0;n<o.length;n++)i(s,o[n]);else i(s,e[s])}return t.replace(/&$/,"").replace(/%20/g,"+")},reqwest.getcallbackPrefix=function(e){return callbackPrefix},reqwest.compat=function(e,t){return e&&(e.type&&(e.method=e.type)&&delete e.type,e.dataType&&(e.type=e.dataType),e.jsonpCallback&&(e.jsonpCallbackName=e.jsonpCallback)&&delete e.jsonpCallback,e.jsonp&&(e.jsonpCallback=e.jsonp)),new Reqwest(e,t)},reqwest}),this.uinit=function(){function t(t,n){return e.reduce(function(e,n){return e&&t[n]&&t[n].loaded},!0,n.depends||[])}function n(t,n){return e.map(function(e){return t[e].result},n)}function r(e,t){r.cache[e.name]=t}function i(e,t){var n=r.cache[e.name];if(!n)return!1;for(var i=0,s=t.length;i<s;++i)if(!uinit.areEqual(t[i],n[i]))return!1;return!0}function s(e,t,s,o){s.reloading?e.emit("reloading",s):e.emit("loading",s);var u=n(t,s.depends||[]),a=when.defer();return when.all(u).then(function(t){var n=(o?[o]:[]).concat(t),u=s.serializeArgs.apply(s,n);if(s.reloading&&i(s,u))return e.emit("skip",s),a.resolve();r(s,u);try{var f=s.action.apply(null,n);if(f||s.nullable)s.loaded=!0,s.result=f,e.emit("loaded",s,f)}catch(l){e.emit("error",s,l)}a.resolve()},function(t){e.emit("error",s,t),a.resolve()}),a.promise}function o(t,n){var r=e.partial(s,t,t.features,n);return n.elements?when.all(e.map(r,dome.byClass(n.elements,t.context))):r()}function u(e,n){return!n.lazy&&!n.loaded&&n.action&&t(e,n)}function a(e){return e&&e.lazy&&!e.loaded}function f(t,n){var r=function(e){return t[e]};return e.uniq(e.reduce(function(t,n){return t.concat(e.select(a,e.map(r,n.depends||[])))},[],n))}function l(t,n){return e.doall(function(t){e.doall(function(e){t[e]=n[e]},e.keys(n))},t)}function c(e){return l(e,{lazy:!1,wasLazy:!0})}function h(t){e.doall(function(e){e.action&&(e.loaded=!1,delete e.reloading),e.wasLazy&&(delete e.wasLazy,e.lazy=!0)},t)}function p(t,n){if(!t.listeners||!t.listeners.pending)return;e.doall(e.bind(t,"emit","pending"),e.select(function(e){return!e.ready&&!e.loaded&&!e.reloading},n))}function d(t,n,r){function l(){var i=e.first(s,a);if(!i)return p(t,n),typeof r=="function"?r():null;o(t,i).then(function(){if(!i.loaded){var t=e.indexOf(i,a);a=a.slice(0,t).concat(a.slice(t+1))}l()})}var i=c(f(t.features,n)),s=e.partial(u,t.features),a=e.uniq(i.concat(n));l()}function v(e,t){if(e[t])throw new Error("Cannot add duplicate "+t)}function g(){return e.map(function(e){return m.features[e]||{name:e,type:"Unknown"}},this.depends||[])}function y(t,n){n.hasOwnProperty("nullable")||(n.nullable=!0),n.hasOwnProperty("serializeArgs")||(n.serializeArgs=function(){return e.map(function(e){return e&&e.tagName&&e.appendChild?dome.uuid(e):e},arguments)}),n.dependencies=g,t.features[n.name]=n,t.tryPending()}function b(t,n){var r=[],i,s=e.values(n);do i=r.length,cull.doall(function(t){r=r.concat(e.select(function(n){return e.indexOf(t,n.depends||[])>=0},s))},t),r=e.uniq(r),t=e.map(e.prop("name"),r);while(i!==r.length);return r}function w(e,t,n){typeof e=="function"&&(n=t,t=e,e=t.name);if(!e)throw new Error("Name cannot be blank");var r=n||{};return r.name=e,r.action=t,r}function E(t,n){var r=b([n],t.features);h(r),e.doall(function(e){e.reloading=!0},r),d(t,r)}var e=cull;r.cache={};var m;return m=bane.createEventEmitter({features:{},env:function(e,t){if(t===null||t===undefined)return;this.nullableEnv(e,t)},nullableEnv:function(e,t){var n=!!this.env[e];n||v(this.features,e);var r=t!==this.env[e];this.env[e]=t,y(this,{name:e,result:t,loaded:!0}),n&&this.loaded&&r&&E(this,e)},data:function(e,t,n){var r=w(e,t,n);return v(this.features,r.name),typeof r.lazy!="boolean"&&(r.lazy=!0),typeof r.nullable!="boolean"&&(r.nullable=!1),y(this,r)},feature:function(e,t,n){var r=w(e,t,n);v(this.features,r.name);if(typeof r.action!="function")throw new Error("Cannot add feature "+r.name+", action is not a function ("+typeof r.action+")");y(this,r)},scanEnvAttrs:function(e,t){var n=e.getElementsByTagName("*"),r=[e].concat([].slice.call(n,0)),i,s,o,u;for(var a=0,f=r.length;a<f;++a){s=r[a].attributes;for(o=0,u=s.length;o<u;++o)i=s.item(o),i.nodeName.indexOf(t)===0&&this.env(i.nodeName.slice(t.length),i.nodeValue)}},load:function(t){this.loaded&&h(e.values(this.features)),this.loaded=!0,this.context=t,this.tryPending()},tryPending:function(){if(!this.loaded)return;this.emit("init"),d(this,e.values(this.features))}}),m},this.uinit.areEqual=function(e,t){return e===t};var Showdown={extensions:{}},forEach=Showdown.forEach=function(e,t){if(typeof e.forEach=="function")e.forEach(t);else{var n,r=e.length;for(n=0;n<r;n++)t(e[n],n,e)}},stdExtName=function(e){return e.replace(/[_-]||\s/g,"").toLowerCase()};Showdown.converter=function(e){var t,n,r,i=0,s=[],o=[];if(typeof module!="undefind"&&typeof exports!="undefined"&&typeof require!="undefind"){var u=require("fs");if(u){var a=u.readdirSync((__dirname||".")+"/extensions").filter(function(e){return~e.indexOf(".js")}).map(function(e){return e.replace(/\.js$/,"")});Showdown.forEach(a,function(e){var t=stdExtName(e);Showdown.extensions[t]=require("./extensions/"+e)})}}this.makeHtml=function(e){return t={},n={},r=[],e=e.replace(/~/g,"~T"),e=e.replace(/\$/g,"~D"),e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n"),e="\n\n"+e+"\n\n",e=F(e),e=e.replace(/^[ \t]+$/mg,""),Showdown.forEach(s,function(t){e=l(t,e)}),e=N(e),e=h(e),e=c(e),e=d(e),e=B(e),e=e.replace(/~D/g,"$$"),e=e.replace(/~T/g,"~"),Showdown.forEach(o,function(t){e=l(t,e)}),e};if(e&&e.extensions){var f=this;Showdown.forEach(e.extensions,function(e){typeof e=="string"&&(e=Showdown.extensions[stdExtName(e)]);if(typeof e!="function")throw"Extension '"+e+"' could not be loaded. It was either not found or is not a valid extension.";Showdown.forEach(e(f),function(e){e.type?e.type==="language"||e.type==="lang"?s.push(e):(e.type==="output"||e.type==="html")&&o.push(e):o.push(e)})})}var l=function(e,t){if(e.regex){var n=new RegExp(e.regex,"g");return t.replace(n,e.replace)}if(e.filter)return e.filter(t)},c=function(e){return e+="~0",e=e.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm,function(e,r,i,s,o){return r=r.toLowerCase(),t[r]=_(i),s?s+o:(o&&(n[r]=o.replace(/"/g,"&quot;")),"")}),e=e.replace(/~0/,""),e},h=function(e){e=e.replace(/\n/g,"\n\n");var t="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del|style|section|header|footer|nav|article|aside",n="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside";return e=e.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,p),e=e.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,p),e=e.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,p),e=e.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,p),e=e.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,p),e=e.replace(/\n\n/g,"\n"),e},p=function(e,t){var n=t;return n=n.replace(/\n\n/g,"\n"),n=n.replace(/^\n/,""),n=n.replace(/\n+$/g,""),n="\n\n~K"+(r.push(n)-1)+"K\n\n",n},d=function(e){e=E(e);var t=C("<hr />");return e=e.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,t),e=e.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,t),e=e.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,t),e=x(e),e=T(e),e=O(e),e=h(e),e=M(e),e},v=function(e){return e=k(e),e=m(e),e=D(e),e=b(e),e=g(e),e=P(e),e=_(e),e=A(e),e=e.replace(/ +\n/g," <br />\n"),e},m=function(e){var t=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;return e=e.replace(t,function(e){var t=e.replace(/(.)<\/?code>(?=.)/g,"$1`");return t=I(t,"\\`*_"),t}),e},g=function(e){return e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,y),e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,y),e=e.replace(/(\[([^\[\]]+)\])()()()()()/g,y),e},y=function(e,r,i,s,o,u,a,f){f==undefined&&(f="");var l=r,c=i,h=s.toLowerCase(),p=o,d=f;if(p==""){h==""&&(h=
2
+ c.toLowerCase().replace(/ ?\n/g," ")),p="#"+h;if(t[h]!=undefined)p=t[h],n[h]!=undefined&&(d=n[h]);else{if(!(l.search(/\(\s*\)$/m)>-1))return l;p=""}}p=I(p,"*_");var v='<a href="'+p+'"';return d!=""&&(d=d.replace(/"/g,"&quot;"),d=I(d,"*_"),v+=' title="'+d+'"'),v+=">"+c+"</a>",v},b=function(e){return e=e.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,w),e=e.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,w),e},w=function(e,r,i,s,o,u,a,f){var l=r,c=i,h=s.toLowerCase(),p=o,d=f;d||(d="");if(p==""){h==""&&(h=c.toLowerCase().replace(/ ?\n/g," ")),p="#"+h;if(t[h]==undefined)return l;p=t[h],n[h]!=undefined&&(d=n[h])}c=c.replace(/"/g,"&quot;"),p=I(p,"*_");var v='<img src="'+p+'" alt="'+c+'"';return d=d.replace(/"/g,"&quot;"),d=I(d,"*_"),v+=' title="'+d+'"',v+=" />",v},E=function(e){function t(e){return e.replace(/[^\w]/g,"").toLowerCase()}return e=e.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(e,n){return C('<h1 id="'+t(n)+'">'+v(n)+"</h1>")}),e=e.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(e,n){return C('<h2 id="'+t(n)+'">'+v(n)+"</h2>")}),e=e.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(e,n,r){var i=n.length;return C("<h"+i+' id="'+t(r)+'">'+v(r)+"</h"+i+">")}),e},S,x=function(e){e+="~0";var t=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return i?e=e.replace(t,function(e,t,n){var r=t,i=n.search(/[*+-]/g)>-1?"ul":"ol";r=r.replace(/\n{2,}/g,"\n\n\n");var s=S(r);return s=s.replace(/\s+$/,""),s="<"+i+">"+s+"</"+i+">\n",s}):(t=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,e=e.replace(t,function(e,t,n,r){var i=t,s=n,o=r.search(/[*+-]/g)>-1?"ul":"ol",s=s.replace(/\n{2,}/g,"\n\n\n"),u=S(s);return u=i+"<"+o+">\n"+u+"</"+o+">\n",u})),e=e.replace(/~0/,""),e};S=function(e){return i++,e=e.replace(/\n{2,}$/,"\n"),e+="~0",e=e.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(e,t,n,r,i){var s=i,o=t,u=n;return o||s.search(/\n{2,}/)>-1?s=d(j(s)):(s=x(j(s)),s=s.replace(/\n$/,""),s=v(s)),"<li>"+s+"</li>\n"}),e=e.replace(/~0/g,""),i--,e};var T=function(e){return e+="~0",e=e.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(e,t,n){var r=t,i=n;return r=L(j(r)),r=F(r),r=r.replace(/^\n+/g,""),r=r.replace(/\n+$/g,""),r="<pre><code>"+r+"\n</code></pre>",C(r)+i}),e=e.replace(/~0/,""),e},N=function(e){return e+="~0",e=e.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(e,t,n){var r=t,i=n;return i=L(i),i=F(i),i=i.replace(/^\n+/g,""),i=i.replace(/\n+$/g,""),i="<pre><code"+(r?' class="'+r+'"':"")+">"+i+"\n</code></pre>",C(i)}),e=e.replace(/~0/,""),e},C=function(e){return e=e.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(r.push(e)-1)+"K\n\n"},k=function(e){return e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,t,n,r,i){var s=r;return s=s.replace(/^([ \t]*)/g,""),s=s.replace(/[ \t]*$/g,""),s=L(s),t+"<code>"+s+"</code>"}),e},L=function(e){return e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=I(e,"*_{}[]\\",!1),e},A=function(e){return e=e.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>"),e=e.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>"),e},O=function(e){return e=e.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(e,t){var n=t;return n=n.replace(/^[ \t]*>[ \t]?/gm,"~0"),n=n.replace(/~0/g,""),n=n.replace(/^[ \t]+$/gm,""),n=d(n),n=n.replace(/(^|\n)/g,"$1 "),n=n.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(e,t){var n=t;return n=n.replace(/^ /mg,"~0"),n=n.replace(/~0/g,""),n}),C("<blockquote>\n"+n+"\n</blockquote>")}),e},M=function(e){e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,"");var t=e.split(/\n{2,}/g),n=[],i=t.length;for(var s=0;s<i;s++){var o=t[s];o.search(/~K(\d+)K/g)>=0?n.push(o):o.search(/\S/)>=0&&(o=v(o),o=o.replace(/^([ \t]*)/g,"<p>"),o+="</p>",n.push(o))}i=n.length;for(var s=0;s<i;s++)while(n[s].search(/~K(\d+)K/)>=0){var u=r[RegExp.$1];u=u.replace(/\$/g,"$$$$"),n[s]=n[s].replace(/~K\d+K/,u)}return n.join("\n\n")},_=function(e){return e=e.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;"),e=e.replace(/<(?![a-z\/?\$!])/gi,"&lt;"),e},D=function(e){return e=e.replace(/\\(\\)/g,q),e=e.replace(/\\([`*_{}\[\]()>#+-.!])/g,q),e},P=function(e){return e=e.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>'),e=e.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(e,t){return H(B(t))}),e},H=function(e){var t=[function(e){return"&#"+e.charCodeAt(0)+";"},function(e){return"&#x"+e.charCodeAt(0).toString(16)+";"},function(e){return e}];return e="mailto:"+e,e=e.replace(/./g,function(e){if(e=="@")e=t[Math.floor(Math.random()*2)](e);else if(e!=":"){var n=Math.random();e=n>.9?t[2](e):n>.45?t[1](e):t[0](e)}return e}),e='<a href="'+e+'">'+e+"</a>",e=e.replace(/">.+:/g,'">'),e},B=function(e){return e=e.replace(/~E(\d+)E/g,function(e,t){var n=parseInt(t);return String.fromCharCode(n)}),e},j=function(e){return e=e.replace(/^(\t|[ ]{1,4})/gm,"~0"),e=e.replace(/~0/g,""),e},F=function(e){return e=e.replace(/\t(?=\t)/g," "),e=e.replace(/\t/g,"~A~B"),e=e.replace(/~B(.+?)~A/g,function(e,t,n){var r=t,i=4-r.length%4;for(var s=0;s<i;s++)r+=" ";return r}),e=e.replace(/~A/g," "),e=e.replace(/~B/g,""),e},I=function(e,t,n){var r="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";n&&(r="\\\\"+r);var i=new RegExp(r,"g");return e=e.replace(i,q),e},q=function(e,t){var n=t.charCodeAt(0);return"~E"+n+"E"}},typeof module!="undefined"&&(module.exports=Showdown),typeof define=="function"&&define.amd&&define("showdown",function(){return Showdown});// Set up a global, shared app instance
3
+ this.gts=this.gts||{},this.gts.app=this.uinit(),function(){var e=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};this.uinit.areEqual=function t(n,r){if(n===r)return!0;if(e(n)||!e(r))return n.length!==r.length;var i,s;for(i=0,s=n.length;i<s;++i)if(!t(n[i],r[i]))return!1;return!0}}(),this.gts.dropdown=function(e){return function(n){function s(){r&&(r.parentNode.removeChild(r),r=null),e.cn.rm("open",n),i=!1}function o(t){if(i)return s();document.documentElement.hasOwnProperty("ontouchstart")&&(r=e.el("div",{className:"dropdown-backdrop",events:{click:s}}),t.insertBefore(r,t)),e.cn.add("open",t),i=!0}var r,i=!1;e.on(n,"click",function(e){o(this),e.preventDefault(),e.stopPropagation()}),e.on(document.documentElement,"click",s),e.on(document.documentElement,"keydown",function(e){if(e.keyCode!==27)return;s(),e.preventDefault(),e.stopPropagation()})}}(dome);var gts=this.gts||{};gts.googleAnalytics=function(e,t){window._gaq=window._gaq||[],window._gaq.push(["_setAccount",e]),t&&window._gaq.push(["_setDomainName",t]),window._gaq.push(["_trackPageview"]);var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=("https:"===document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js",(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(n)},this.gts=this.gts||{},this.gts.abbrev=function(e,t,n){return e.length<=t?e:(n=n||"",cull.reduce(function(e,r){return e.join(" ").length+r.length+n.length<=t&&e.push(r),e},[],e.split(" ")).join(" ")+n)},this.gts=this.gts||{},this.gts.url=function(){function e(e){var t=e.split("/");return t.shift(),t.shift(),t.shift(),"/"+t.join("/")}function t(t,n){return cull.reduce(function(e,t){return e.replace(new RegExp(n[t],"g"),"#{"+t+"}")},e(t),cull.keys(n))}function n(e,t){return cull.reduce(function(e,n){return e.replace(new RegExp("#{"+n+"}","g"),t[n])},e,cull.keys(t))}function r(e){var t=/(blame|blob|tree|history|raw|source|readme)\//,n=e.split(t)[2];return n&&n.split(":")[0]||null}return{templatize:t,render:n,currentRef:r}}(),this.gts=this.gts||{},this.gts.refSelector=function(e){function t(e,t){return(e||"#{ref}").replace(/#\{ref\}/g,t)}function n(e,t,n){return cull.select(function(e){return e[0]===t||e[1]===t},n[e]||[])[0]}function r(t,r){var i=n("heads",r,t),s="branch";return i||(i=n("tags",r,t),s="tag"),i||(s="ref"),e.a({href:"#",className:"dropdown-toggle",innerHTML:'<span class="caret"></span> <em>'+s+":</em> "+(i&&i[0]||r)})}function i(n){var r=e.input({type:"text",className:"gts-ref-input"}),i=e.form({className:"gts-ref-input",events:{submit:function(e){e.preventDefault(),window.location=t(n,r.value)}}},[r]);return e.li({className:"gts-dropdown-input",events:{click:function(e){e.stopPropagation()}}},[e.strong(["Enter ref: ",i])])}function s(n,r,i){var s=[e.li({className:"dropdown-label"},[e.strong(n)])];return cull.reduce(function(n,r){var s=t(i,r[1]);return n.push(e.li(e.a({href:s},r[0]))),n},s,r.sort())}function o(t,n){return e.ul({className:"dropdown-menu"},[i(n)].concat(s("Branches",t.heads||[],n)).concat(s("Tags",t.tags||[],n)))}function u(t,n,i){return e.div({className:"dropdown gts-branch-selector pull-right"},[r(t,n),o(t,i)])}function a(e,t,n,r){var i=u(t,n,r);e.appendChild(i),this.gts.dropdown(i)}return a.build=u,a}(dome.el),this.gts=this.gts||{},this.gts.treeHistory=function(e,t){function n(e,t){return e.getElementsByTagName(t)}function s(t,n){return e.select(function(e){return e.name===t},n)[0]}function o(e){if(!Date.parse)return"";var t=new Date(Date.parse(e));return i[t.getMonth()]+" "+t.getDate()+" "+t.getFullYear()}function u(e){var t,n;for(t=0,n=e.length;t<n;++t)if(dome.cn.has("gts-name",e[t]))return t;return t}function a(e){return(e&&dome.text(e)||"").trim()}var r=function(e,t){var i=n(n(e,"tbody")[0],"td")[2],s=(new Spinner({lines:13,length:1,width:2,radius:6,corners:1,rotate:0,color:"#000",speed:1,trail:60,shadow:!1,hwaccel:!0,className:"spinner",zIndex:2e9,top:"auto",left:"auto"})).spin(i);reqwest({url:t,type:"json",success:function(t){s.stop(),r.annotate(e,t)}})},i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dev"];return r.annotateRow=function(e,t){var r=n(t,"td"),i=u(r),f=s(a(r[i]),e);if(!f)return;var l=f.history[0];r[i+1].innerHTML=o(l.date),dome.data.set({"gts-commit-oid":l.oid},r[i+2]),r[i+2].innerHTML="#"+l.oid.slice(0,7);var c=l.summary.trim();r[i+3].innerHTML=gts.abbrev(c,50," [...]")+" ("+l.author.name+")"},r.annotate=function(t,i){e.doall(e.partial(function(e,t){r.annotateRow(e,t)},i),n(n(t,"tbody")[0],"tr"))},r}(cull);var gts=this.gts||{};(function(e,t){gts.commitLinker=function(e,n,r){t.cn.add("gts-commit-linker",e),t.delegate.bycn("gts-commit-oid",e,"click",function(e){r(gts.url.render(n,{oid:dome.data.get("gts-commit-oid",this)}))})}})(cull.partial,dome),this.gts.userRepoViewState=function(e){return reqwest({url:e,type:"json"})};var gts=this.gts||{};(function(e,t){function n(e,n,r){var i=r?[t.i({className:"icon-"+r}),e]:[e];return t.li(t.a({href:n},i))}gts.profileMenu=function(r,i){if(!i)return;e.setContent([t.a({className:"btn btn-inverse",href:i.dashboardPath},[t.i({className:"icon-user icon-white"}),i.login]),t.a({className:"btn btn-inverse dropdown-toggle",href:"#",data:{toggle:"dropdown"}},t.span({className:"caret"}," ")),t.ul({className:"dropdown-menu"},[n("Edit",i.editPath,"pencil"),n("Messages",i.messagesPath,"envelope"),t.li({className:"divider"}),n("Dashboard",i.dashboardPath),n("Public profile",i.profilePath),n("Log out",i.logoutPath)])],r)}})(dome,dome.el),this.gts=this.gts||{},this.gts.cloneUrlSelection=function(t){var n=t.getElementsByTagName("input")[0];n&&dome.on(n,"focus",function(e){this.select()}),dome.delegate.bycn("gts-repo-url",t,"click",function(e){e.preventDefault();var n=dome.byClass("gts-repo-url",t);cull.doall(cull.partial(dome.cn.rm,"active"),n);if(e.target){dome.cn.add("active",e.target);var r=dome.byClass("gts-current-repo-url")[0];r.value=e.target.href,r.focus()}})},this.gts=this.gts||{},this.gts.blob=function(){function e(e,t){var n=t[0]-1,r=t[1]-1,i=e.getElementsByTagName("li");cull.doall(function(e,t){var i=n<=t&&t<=r;dome.cn[i?"add":"rm"]("region",e)},e.getElementsByTagName("li"))}function t(e){while(e&&e.tagName!=="LI")e=e.parentNode;var t=e&&e.className.match(/L(\d+)/)[1];if(!t)return;return parseInt(t,10)+1}function n(t,n,r){var i=n[0];i+=n[1]!==n[0]?"-"+n[1]:"",r("#L"+i),e(t,n)}function r(e,t){return t=typeof t=="number"?t:e,[Math.min(e,t),Math.max(e,t)]}function i(e,i){var s=!1,o,u=[];dome.on(document.body,"keydown",function(e){s=e.which===16}),dome.on(document.body,"keyup",function(e){s=e.which!==16}),dome.on(e,"click",function(u){var a,f=t(u.target);if(!s||!o)o=u.target;o&&s?(a=r(t(o),f),u.preventDefault()):a=[f,f],n(e,a,i)})}function s(e,t){var n=function(){dome.cn.add("focus",this)},r=function(){dome.cn.rm("focus",this)};cull.doall(function(e){dome.on(e,"mouseenter",n),dome.on(e,"mouseleave",r)},e.getElementsByTagName("li")),i(e,t)}function o(e){var t=e.match(/\#l(\d+)(?:-(\d+))?/i);if(!t)return;return r(t[1],t[2]&&Number(t[2]))}return{trackFocus:s,regionFromUrl:o,highlightRegion:e}}(),this.gts.liveMarkdownPreview=function(t){function u(e){r.style.display=e?"block":"none",r.getElementsByTagName("div")[0].innerHTML=e}function a(){o=t.value,o!==s&&(s=o,u(i.makeHtml(o))),setTimeout(a,20)}var n=t.getAttribute("data-gts-preview-target"),r=document.getElementById(n);if(!r||typeof Showdown=="undefined")return;var i=new Showdown.converter,s,o;a()},gts.app.env("url",window.location.href),gts.app.env("redirect",function(e){window.location=e}),window.hasOwnProperty("onpopstate")&&(window.onpopstate=function(e){gts.app.env("url",window.location.href)}),gts.app.data("ref-url-template",function(e,t){return gts.url.templatize(e,{ref:t})},{depends:["url","current-ref"],serializeArgs:function(e,t){return[e.split("#")[0],t]}}),gts.app.data("repository-refs",function(e){return reqwest({url:e,type:"json"})},{depends:["repository-refs-url"]}),gts.app.data("current-ref",gts.url.currentRef,{depends:["url"]}),gts.app.data("user-repo-view-state",gts.userRepoViewState,{depends:["user-repository-path"]}),gts.app.data("current-user",cull.prop("user"),{depends:["user-repo-view-state"]}),gts.app.data("blob-region",gts.blob.regionFromUrl,{depends:["url"]}),gts.app.feature("google-analytics",gts.googleAnalytics,{depends:["analytics-account","analytics-domain-name"]}),gts.app.feature("ref-selector",gts.refSelector,{elements:["gts-ref-selector-ph"],depends:["repository-refs","current-ref","ref-url-template"]}),gts.app.feature("tree-history",gts.treeHistory,{elements:["gts-tree-explorer"],depends:["tree-history-url"]}),gts.app.feature("commit-linker",gts.commitLinker,{elements:["gts-body"],depends:["commit-url-template","redirect"]}),gts.app.feature("profile-menu",gts.profileMenu,{elements:["login_button"],depends:["current-user"]}),gts.app.feature("clone-url-selection",gts.cloneUrlSelection,{elements:["gts-repo-urls"]}),gts.app.feature("highlight-region",gts.blob.highlightRegion,{elements:["gts-lines"],depends:["blob-region"]}),gts.app.feature("track-blob-focus",gts.blob.trackFocus,{elements:["gts-lines"],depends:["redirect"]}),gts.app.feature("live-markdown-preview",gts.liveMarkdownPreview,{elements:["gts-live-markdown-preview"]}),setTimeout(function(){gts.app.scanEnvAttrs(document.body,"data-gts-env-"),gts.app.load(document.body)},10);
@@ -1,3 +1,20 @@
1
1
  // Set up a global, shared app instance
2
2
  this.gts = this.gts || {};
3
3
  this.gts.app = this.uinit();
4
+
5
+ (function () {
6
+ var isArray = Array.isArray || function (arr) {
7
+ return Object.prototype.toString.call(arr) === "[object Array]";
8
+ };
9
+
10
+ this.uinit.areEqual = function areEqual(a, b) {
11
+ if (a === b) { return true; }
12
+ if (isArray(a) || !isArray(b)) { return a.length !== b.length; }
13
+
14
+ var i, l;
15
+ for (i = 0, l = a.length; i < l; ++i) {
16
+ if (!areEqual(a[i], b[i])) { return false; }
17
+ }
18
+ return true;
19
+ };
20
+ }());
@@ -1,6 +1,5 @@
1
1
  /*global cull*/
2
- // The global, shared Gitorious namespace
3
- var gts = this.gts || {};
2
+ this.gts = this.gts || {};
4
3
 
5
4
  /**
6
5
  * Abbreviates a string to fit within a predefined width. If the
@@ -12,7 +11,7 @@ var gts = this.gts || {};
12
11
  * with the suffix is guaranteed to not be wider than the specified
13
12
  * width.
14
13
  */
15
- gts.abbrev = function (sentence, width, suffix) {
14
+ this.gts.abbrev = function (sentence, width, suffix) {
16
15
  if (sentence.length <= width) { return sentence; }
17
16
  suffix = suffix || "";
18
17
 
@@ -1,6 +1,126 @@
1
1
  /*global cull, dome*/
2
+ this.gts = this.gts || {};
3
+
4
+ /**
5
+ * Utilities for working with syntax highligted blobs. Assumes the markup for
6
+ * blobs generated by Dolt. Exports three functions:
7
+ *
8
+ * * trackFocus
9
+ * Sets up events to highlight lines on mouseover, and allows the user to
10
+ * highlight regions
11
+ * * regionFromUrl
12
+ * Parses the URL and finds line number or region to highlight
13
+ * * highlightRegion
14
+ * Highlights a region
15
+ *
16
+ * The following functions all assume that a blob is contained in some root
17
+ * element that represents each line in the file as an li element.
18
+ *
19
+ * A "region" is an array of two numbers, denoting the first and last line of
20
+ * a consecutive region. Both boundaries are inclusive. Regions start at 1 (not
21
+ * 0).
22
+ * [1, 2] - The region consisting of the first and second line, inclusive
23
+ * [1, 1] - The first line
24
+ * [10, 14] - The region of lines 10, 11, 12, 13 and 14
25
+ */
2
26
  this.gts.blob = (function () {
3
- function highlightLineOnFocus(element, start, end) {
27
+ /**
28
+ * Accepts the root element of a blob and a region, and adds the "region"
29
+ * class name to all li elements in the region.
30
+ */
31
+ function highlightRegion(element, region) {
32
+ // Line numbers are 1-based, but ElementLists are 0-indexed,
33
+ // offset region accordingly
34
+ var start = region[0] - 1;
35
+ var end = region[1] - 1;
36
+ var lines = element.getElementsByTagName("li");
37
+
38
+ cull.doall(function (li, num) {
39
+ var inRegion = start <= num && num <= end;
40
+ dome.cn[inRegion ? "add" : "rm"]("region", li);
41
+ }, element.getElementsByTagName("li"));
42
+ }
43
+
44
+ /**
45
+ * Given an li element representing a line, return which line number it
46
+ * represents.
47
+ */
48
+ function getLineNum(element) {
49
+ while (element && element.tagName !== "LI") {
50
+ element = element.parentNode;
51
+ }
52
+ var lineNum = element && element.className.match(/L(\d+)/)[1];
53
+ if (!lineNum) { return; }
54
+ return parseInt(lineNum, 10) + 1;
55
+ }
56
+
57
+ /**
58
+ * Set the active region. Marks the region and updates the URL with the
59
+ * new region as an anchor ("#L<start>-<end>").
60
+ */
61
+ function setRegion(element, region, redirect) {
62
+ var regionStr = region[0];
63
+ regionStr += region[1] !== region[0] ? "-" + region[1] : "";
64
+ redirect("#L" + regionStr);
65
+ highlightRegion(element, region);
66
+ }
67
+
68
+ /**
69
+ * Given two numbers, return a region where the lowest number is the start
70
+ * and the highest number is the end. The end is optional, in which case
71
+ * the [start, start] region is returned.
72
+ */
73
+ function orderedRegion(start, end) {
74
+ end = typeof end === "number" ? end : start;
75
+ return [Math.min(start, end), Math.max(start, end)];
76
+ }
77
+
78
+ /**
79
+ * Track selected region through clicks on lines.
80
+ *
81
+ * Clicking a line highlights it by setting the region to that line
82
+ * (e.g [n, n]).
83
+ *
84
+ * Holding shift while clicking a line makes a region starting at the
85
+ * previously clicked line and ending at the line being clicked. Example:
86
+ *
87
+ * Click on line 4. Press shift, click line 9. Lines 4, 5, 6, 7, 8 and 9
88
+ * will be highlighted. While holding shift, click line 1. Lines 1, 2, 3 and
89
+ * 4 will be highlighted. Release shift, click line 5, line 5 (and no
90
+ * others) will be highlighted.
91
+ */
92
+ function trackSelectedRegion(element, redirect) {
93
+ var shift = false, anchor;
94
+ var events = [];
95
+
96
+ dome.on(document.body, "keydown", function (e) {
97
+ shift = e.which === 16;
98
+ });
99
+ dome.on(document.body, "keyup", function (e) {
100
+ shift = e.which !== 16;
101
+ });
102
+
103
+ dome.on(element, "click", function (e) {
104
+ var region, currLine = getLineNum(e.target);
105
+ if (!shift || !anchor) { anchor = e.target; }
106
+
107
+ if (anchor && shift) {
108
+ region = orderedRegion(getLineNum(anchor), currLine);
109
+ e.preventDefault();
110
+ } else {
111
+ region = [currLine, currLine];
112
+ }
113
+
114
+ setRegion(element, region, redirect);
115
+ });
116
+ }
117
+
118
+ /**
119
+ * Track focus on lines by highlighting lines as the cursor hovers them, and
120
+ * by highlighting (and selecting) regions as lines are clicked (see the
121
+ * above function)
122
+ */
123
+ function trackFocus(element, redirect) {
4
124
  var highlight = function () { dome.cn.add("focus", this); };
5
125
  var dim = function () { dome.cn.rm("focus", this); };
6
126
 
@@ -8,31 +128,26 @@ this.gts.blob = (function () {
8
128
  dome.on(li, "mouseenter", highlight);
9
129
  dome.on(li, "mouseleave", dim);
10
130
  }, element.getElementsByTagName("li"));
131
+
132
+ trackSelectedRegion(element, redirect);
11
133
  }
12
134
 
135
+ /**
136
+ * Regions can be specified over the URL by using the #L<start>[-<end>]
137
+ * syntax. This function extracts it. Examples:
138
+ *
139
+ * /some/url#L1 - [1, 1]
140
+ * /some/url#L1-2 - [1, 2]
141
+ * /some/url#l12-2 - [2, 12] (ordered)
142
+ */
13
143
  function regionFromUrl(url) {
14
144
  var matches = url.match(/\#l(\d+)(?:-(\d+))?/i);
15
145
  if (!matches) { return; }
16
- var start = Math.min(matches[2] || matches[1], matches[1]);
17
- var end = Math.max(matches[2] || matches[1], matches[1]);
18
- return [start, end];
19
- }
20
-
21
- function highlightRegion(element, region) {
22
- // Line numbers are 1-based, but ElementLists are 0-indexed,
23
- // offset region accordingly
24
- var start = region[0] - 1;
25
- var end = region[1] - 1;
26
- var lines = element.getElementsByTagName("li");
27
-
28
- cull.doall(function (li, num) {
29
- var inRegion = start <= num && num <= end;
30
- dome.cn[inRegion ? "add" : "rm"]("region", li);
31
- }, element.getElementsByTagName("li"));
146
+ return orderedRegion(matches[1], matches[2] && Number(matches[2]));
32
147
  }
33
148
 
34
149
  return {
35
- highlightLineOnFocus: highlightLineOnFocus,
150
+ trackFocus: trackFocus,
36
151
  regionFromUrl: regionFromUrl,
37
152
  highlightRegion: highlightRegion
38
153
  };