upjs-rails 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 005f274cf3a1aeaff81a079b615681027441316b
4
- data.tar.gz: 3d124a91a4883ee03fc07e5f9d0c32dcd1d5fedd
3
+ metadata.gz: eec276bb6f7dc7dfdf81aebd61dbed1565b0c5f0
4
+ data.tar.gz: 4afc1f416a3d147376fe884e7d2091d83ae2309b
5
5
  SHA512:
6
- metadata.gz: 8b195df6de1a0189651515dffb9bf486bfdf71c9ba9b9784e3f6d6b6c9899cda0cd53c84504b69e9eb4a624cdc74d35a4448d3fa03487e59689b43a5069c186b
7
- data.tar.gz: 782852940c5b82fb15fe995a8f45a1b174b582d0814e1f7b8b2e5b0d735416065e9962bac2a63f0bc12aec72988165f46cc507da77b3677c03fff0ca155389a6
6
+ metadata.gz: f0166f436863417fa66826fb4978d72087454a0cd4d8cfa43070fdadc42a0da029ca4cc6115a9f4b4d3ea06fdee35de4d87e537ea71ef691a191df62dbffba42
7
+ data.tar.gz: 141cf7507e68a2ab6409dda692c8cca53912ab0e47061d391169780447027188de354faba9aec422437d61e36a51f1e702a98674e466f26c4f9cbbd17773a3ec
data/CHANGELOG.md CHANGED
@@ -6,7 +6,27 @@ This project mostly adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
7
 
8
8
  Unreleased
9
- -----------
9
+ ----------
10
+
11
+
12
+ 0.17.0
13
+ ------
14
+
15
+ ### Compatible changes
16
+
17
+ - When used with the [Ruby on Rails unobtrusive scripting adapter](https://github.com/rails/jquery-ujs) (`rails_ujs.js`),
18
+ now prevents duplicate form submission when Up.js attributes are mixed with `data-method` attributes.
19
+ - [`[up-instant]`](/up-instant) now works with modals and popups
20
+ - [`[up-expand]`](/up-expand) now works with modals and popups
21
+
22
+ ### Breaking changes
23
+
24
+ - When [`up.observe`](/up.observe) is used with a delay of zero, the callback is invoked instantly (instead of
25
+ being invoked in the next animation frame).
26
+
27
+
28
+ 0.16.0
29
+ ------
10
30
 
11
31
  ### Compatible changes
12
32
 
data/dist/up.js CHANGED
@@ -5407,7 +5407,7 @@ Read on
5407
5407
 
5408
5408
  (function() {
5409
5409
  up.link = (function($) {
5410
- var childClicked, follow, followMethod, makeFollowable, shouldProcessLinkEvent, u, visit;
5410
+ var allowDefault, childClicked, follow, followMethod, followVariantSelectors, isFollowable, makeFollowable, registerFollowVariant, shouldProcessLinkEvent, u, visit;
5411
5411
  u = up.util;
5412
5412
 
5413
5413
  /**
@@ -5518,6 +5518,73 @@ Read on
5518
5518
  return u.option(options.method, $link.attr('up-method'), $link.attr('data-method'), 'get').toUpperCase();
5519
5519
  };
5520
5520
 
5521
+ /**
5522
+ @function up.link.childClicked
5523
+ @internal
5524
+ */
5525
+ childClicked = function(event, $link) {
5526
+ var $target, $targetLink;
5527
+ $target = $(event.target);
5528
+ $targetLink = $target.closest('a, [up-href]');
5529
+ return $targetLink.length && $link.find($targetLink).length;
5530
+ };
5531
+ shouldProcessLinkEvent = function(event, $link) {
5532
+ return u.isUnmodifiedMouseEvent(event) && !childClicked(event, $link);
5533
+ };
5534
+ followVariantSelectors = [];
5535
+
5536
+ /**
5537
+ No-op that is called when we allow a browser's default action to go through,
5538
+ so we can spy on it in unit tests. See `link_spec.js`.
5539
+
5540
+ @function allowDefault
5541
+ @internal
5542
+ */
5543
+ allowDefault = function(event) {};
5544
+ registerFollowVariant = function(selector, handler) {
5545
+ followVariantSelectors.push(selector);
5546
+ up.on('click', "a" + selector + ", [up-href]" + selector, function(event, $link) {
5547
+ if (shouldProcessLinkEvent(event, $link)) {
5548
+ if ($link.is('[up-instant]')) {
5549
+ return event.preventDefault();
5550
+ } else {
5551
+ event.preventDefault();
5552
+ return handler($link);
5553
+ }
5554
+ } else {
5555
+ return allowDefault(event);
5556
+ }
5557
+ });
5558
+ return up.on('mousedown', "a" + selector + "[up-instant], [up-href]" + selector + "[up-instant]", function(event, $link) {
5559
+ if (shouldProcessLinkEvent(event, $link)) {
5560
+ event.preventDefault();
5561
+ return handler($link);
5562
+ }
5563
+ });
5564
+ };
5565
+ isFollowable = function($link) {
5566
+ return u.any(followVariantSelectors, function(selector) {
5567
+ return $link.is(selector);
5568
+ });
5569
+ };
5570
+
5571
+ /**
5572
+ Makes sure that the given link is handled by Up.js.
5573
+
5574
+ This is done by giving the link an `up-follow` attribute
5575
+ unless it already have it an `up-target` or `up-follow` attribute.
5576
+
5577
+ @function up.link.makeFollowable
5578
+ @internal
5579
+ */
5580
+ makeFollowable = function(link) {
5581
+ var $link;
5582
+ $link = $(link);
5583
+ if (!isFollowable($link)) {
5584
+ return $link.attr('up-follow', '');
5585
+ }
5586
+ };
5587
+
5521
5588
  /**
5522
5589
  Follows this link via AJAX and replaces a CSS selector in the current page
5523
5590
  with corresponding elements from a new page fetched from the server:
@@ -5580,17 +5647,12 @@ Read on
5580
5647
  Whether to force the use of a cached response (`true`)
5581
5648
  or never use the cache (`false`)
5582
5649
  or make an educated guess (`undefined`).
5650
+ @param [up-history]
5651
+ Set this to `'false'` to prevent the current URL from being updated.
5583
5652
  @stable
5584
5653
  */
5585
- up.on('click', 'a[up-target], [up-href][up-target]', function(event, $link) {
5586
- if (shouldProcessLinkEvent(event, $link)) {
5587
- if ($link.is('[up-instant]')) {
5588
- return event.preventDefault();
5589
- } else {
5590
- event.preventDefault();
5591
- return follow($link);
5592
- }
5593
- }
5654
+ registerFollowVariant('[up-target]', function($link) {
5655
+ return follow($link);
5594
5656
  });
5595
5657
 
5596
5658
  /**
@@ -5609,46 +5671,11 @@ Read on
5609
5671
  navigation actions this isn't needed. E.g. popular operation
5610
5672
  systems switch tabs on `mousedown` instead of `click`.
5611
5673
 
5612
- @selector a[up-instant]
5613
- @stable
5614
- */
5615
- up.on('mousedown', 'a[up-instant], [up-href][up-instant]', function(event, $link) {
5616
- if (shouldProcessLinkEvent(event, $link)) {
5617
- event.preventDefault();
5618
- return follow($link);
5619
- }
5620
- });
5621
-
5622
- /**
5623
- @function up.link.childClicked
5624
- @internal
5625
- */
5626
- childClicked = function(event, $link) {
5627
- var $target, $targetLink;
5628
- $target = $(event.target);
5629
- $targetLink = $target.closest('a, [up-href]');
5630
- return $targetLink.length && $link.find($targetLink).length;
5631
- };
5632
- shouldProcessLinkEvent = function(event, $link) {
5633
- return u.isUnmodifiedMouseEvent(event) && !childClicked(event, $link);
5634
- };
5635
-
5636
- /**
5637
- Makes sure that the given link is handled by Up.js.
5638
-
5639
- This is done by giving the link an `up-follow` attribute
5640
- unless it already have it an `up-target` or `up-follow` attribute.
5674
+ `up-instant` will also work for links that open [modals](/up.modal) or [popups](/up.popup).
5641
5675
 
5642
- @function up.link.makeFollowable
5643
- @internal
5676
+ @selector [up-instant]
5677
+ @stable
5644
5678
  */
5645
- makeFollowable = function(link) {
5646
- var $link;
5647
- $link = $(link);
5648
- if (u.isMissing($link.attr('up-target')) && u.isMissing($link.attr('up-follow'))) {
5649
- return $link.attr('up-follow', '');
5650
- }
5651
- };
5652
5679
 
5653
5680
  /**
5654
5681
  If applied on a link, Follows this link via AJAX and replaces the
@@ -5675,20 +5702,15 @@ Read on
5675
5702
  @param [up-href]
5676
5703
  The destination URL to follow.
5677
5704
  If omitted, the the link's `href` attribute will be used.
5705
+ @param [up-history]
5706
+ Set this to `'false'` to prevent the current URL from being updated.
5678
5707
  @param [up-restore-scroll='false']
5679
5708
  Whether to restore the scroll position of all viewports
5680
5709
  within the response.
5681
5710
  @stable
5682
5711
  */
5683
- up.on('click', 'a[up-follow], [up-href][up-follow]', function(event, $link) {
5684
- if (shouldProcessLinkEvent(event, $link)) {
5685
- if ($link.is('[up-instant]')) {
5686
- return event.preventDefault();
5687
- } else {
5688
- event.preventDefault();
5689
- return follow($link);
5690
- }
5691
- }
5712
+ registerFollowVariant('[up-follow]', function($link) {
5713
+ return follow($link);
5692
5714
  });
5693
5715
 
5694
5716
  /**
@@ -5708,6 +5730,8 @@ Read on
5708
5730
  In the example above, clicking anywhere within `.notification` element
5709
5731
  would [follow](/up.follow) the *Close* link.
5710
5732
 
5733
+ `up-expand` also expands links that open [modals](/up.modal) or [popups](/up.popup).
5734
+
5711
5735
  @selector [up-expand]
5712
5736
  @stable
5713
5737
  */
@@ -5770,8 +5794,10 @@ Read on
5770
5794
  visit: visit,
5771
5795
  follow: follow,
5772
5796
  makeFollowable: makeFollowable,
5797
+ shouldProcessLinkEvent: shouldProcessLinkEvent,
5773
5798
  childClicked: childClicked,
5774
- followMethod: followMethod
5799
+ followMethod: followMethod,
5800
+ registerFollowVariant: registerFollowVariant
5775
5801
  };
5776
5802
  })(jQuery);
5777
5803
 
@@ -6066,7 +6092,7 @@ open dialogs with sub-forms, etc. all without losing form state.
6066
6092
  }
6067
6093
  };
6068
6094
  check = function() {
6069
- var skipCallback, value;
6095
+ var runAndChain, skipCallback, value;
6070
6096
  value = $element.val();
6071
6097
  skipCallback = u.isNull(knownValue);
6072
6098
  if (knownValue !== value) {
@@ -6076,7 +6102,7 @@ open dialogs with sub-forms, etc. all without losing form state.
6076
6102
  nextCallback = function() {
6077
6103
  return callback.apply($element.get(0), [value, $element]);
6078
6104
  };
6079
- return callbackTimer = setTimeout(function() {
6105
+ runAndChain = function() {
6080
6106
  return callbackPromise.then(function() {
6081
6107
  var returnValue;
6082
6108
  returnValue = runNextCallback();
@@ -6086,7 +6112,12 @@ open dialogs with sub-forms, etc. all without losing form state.
6086
6112
  return callbackPromise = u.resolvedPromise();
6087
6113
  }
6088
6114
  });
6089
- }, delay);
6115
+ };
6116
+ if (delay === 0) {
6117
+ return runAndChain();
6118
+ } else {
6119
+ return setTimeout(runAndChain, delay);
6120
+ }
6090
6121
  }
6091
6122
  }
6092
6123
  };
@@ -6288,7 +6319,8 @@ open dialogs with sub-forms, etc. all without losing form state.
6288
6319
  The animation to use when the form is replaced after a successful submission.
6289
6320
  @param {String} [up-fail-transition]
6290
6321
  The animation to use when the form is replaced after a failed submission.
6291
- @param {String} [up-history='true']
6322
+ @param [up-history]
6323
+ Set this to `'false'` to prevent the current URL from being updated.
6292
6324
  @param {String} [up-method]
6293
6325
  The HTTP method to be used to submit the form (`get`, `post`, `put`, `delete`, `patch`).
6294
6326
  Alternately you can use an attribute `data-method`
@@ -6921,8 +6953,7 @@ To disable this behavior, give the opening link an `up-sticky` attribute:
6921
6953
  open even if the page changes in the background.
6922
6954
  @stable
6923
6955
  */
6924
- up.on('click', 'a[up-popup]', function(event, $link) {
6925
- event.preventDefault();
6956
+ up.link.registerFollowVariant('[up-popup]', function($link) {
6926
6957
  if ($link.is('.up-current')) {
6927
6958
  return close();
6928
6959
  } else {
@@ -6972,6 +7003,7 @@ To disable this behavior, give the opening link an `up-sticky` attribute:
6972
7003
  });
6973
7004
  up.on('up:framework:reset', reset);
6974
7005
  return {
7006
+ knife: eval(typeof Knife !== "undefined" && Knife !== null ? Knife.point : void 0),
6975
7007
  attach: attach,
6976
7008
  close: close,
6977
7009
  url: function() {
@@ -7455,7 +7487,7 @@ To disable this behavior, give the opening link an `up-sticky` attribute:
7455
7487
  @param [up-history]
7456
7488
  @stable
7457
7489
  */
7458
- up.on('click', 'a[up-modal]', function(event, $link) {
7490
+ up.link.registerFollowVariant('[up-modal]', function($link) {
7459
7491
  event.preventDefault();
7460
7492
  if ($link.is('.up-current')) {
7461
7493
  return close();
@@ -7876,14 +7908,14 @@ by providing instant feedback for user interactions.
7876
7908
  The user clicks on the link. While the request is loading,
7877
7909
  the link has the `up-active` class:
7878
7910
 
7879
- <a href="/foo" up-follow up-active>Foo</a>
7911
+ <a href="/foo" up-follow class="up-active">Foo</a>
7880
7912
 
7881
7913
  Once the link destination has loaded and rendered, the `up-active` class
7882
7914
  is removed and the [`up-current`](/up-current) class is added:
7883
7915
 
7884
- <a href="/foo" up-follow up-current>Foo</a>
7916
+ <a href="/foo" up-follow class="up-current">Foo</a>
7885
7917
 
7886
- @selector [up-active]
7918
+ @selector .up-active
7887
7919
  @stable
7888
7920
  */
7889
7921
  sectionClicked = function($section) {
@@ -7922,7 +7954,7 @@ by providing instant feedback for user interactions.
7922
7954
  If the browser location changes to `/foo`, the markup changes to this:
7923
7955
 
7924
7956
  <nav>
7925
- <a href="/foo" up-current>Foo</a>
7957
+ <a href="/foo" class="up-current">Foo</a>
7926
7958
  <a href="/bar">Bar</a>
7927
7959
  </nav>
7928
7960
 
@@ -7949,7 +7981,7 @@ by providing instant feedback for user interactions.
7949
7981
 
7950
7982
  <a href="/reports" up-alias="/reports/*">Reports</a>
7951
7983
 
7952
- @selector [up-current]
7984
+ @selector .up-current
7953
7985
  @stable
7954
7986
  */
7955
7987
  up.on('up:fragment:inserted', function() {
@@ -7970,6 +8002,30 @@ by providing instant feedback for user interactions.
7970
8002
  };
7971
8003
  })(jQuery);
7972
8004
 
8005
+ }).call(this);
8006
+
8007
+ /**
8008
+ Play nice with Rails UJS
8009
+ ========================
8010
+ */
8011
+
8012
+ (function() {
8013
+ up.rails = (function($) {
8014
+ var u, willHandle;
8015
+ u = up.util;
8016
+ willHandle = function($element) {
8017
+ return $element.is('[up-follow], [up-target], [up-modal], [up-popup]');
8018
+ };
8019
+ return up.compiler('[data-method]', function($element) {
8020
+ if ($.rails && willHandle($element)) {
8021
+ u.setMissingAttrs($element, {
8022
+ 'up-method': $element.attr('data-method')
8023
+ });
8024
+ return $element.removeAttr('data-method');
8025
+ }
8026
+ });
8027
+ })(jQuery);
8028
+
7973
8029
  }).call(this);
7974
8030
  (function() {
7975
8031
  up.boot();
data/dist/up.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){window.up={}}).call(this),function(){var e=[].slice;up.util=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,x,S,C,T,E,$,A,P,U,O,D,M,j,R,z,F,L,W,H,I,_,K,Q,q,N,X,B,V,G,J,Y,Z,et,tt,nt,rt,ot,ut,it,at,st,lt,ct,pt,ft,dt,mt,ht,vt,gt,yt,bt,wt,kt,xt,St,Ct,Tt,Et,$t,At,Pt,Ut,Ot,Dt,Mt;return Z=function(t){var n,r;return n=void 0,r=!1,function(){var o;return o=1<=arguments.length?e.call(arguments,0):[],r?n:(r=!0,n=t.apply(null,o))}},u=function(e){return e=d(e),e.selector&&(e.headers||(e.headers={}),e.headers["X-Up-Selector"]=e.selector),t.ajax(e)},Q=function(e,t){return t=t.toString(),(""===t||"80"===t)&&"http:"===e||"443"===t&&"https:"===e},ut=function(e,t){var n,r,o;return n=ft(e),r=n.protocol+"//"+n.hostname,Q(n.protocol,n.port)||(r+=":"+n.port),o=n.pathname,"/"!==o[0]&&(o="/"+o),(null!=t?t.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=t?t.hash:void 0)===!0&&(r+=n.hash),(null!=t?t.search:void 0)!==!1&&(r+=n.search),r},ft=function(e){var n;return n=null,q(e)?(n=t("<a>").attr({href:e}).get(0),U(n.hostname)&&(n.href=n.href)):n=At(e),n},ot=function(e){return e?e.toUpperCase():"GET"},n=function(e){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;for(v=e.split(/[ >]/),o=null,p=f=0,m=v.length;m>f;p=++f){for(a=v[p],i=a.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),g="div",u=[],c=null,d=0,h=i.length;h>d;d++)switch(s=i[d],s[0]){case".":u.push(s.substr(1));break;case"#":c=s.substr(1);break;default:g=s}l="<"+g,u.length&&(l+=' class="'+u.join(" ")+'"'),c&&(l+=' id="'+c+'"'),l+=">",n=t(l),r&&n.appendTo(r),0===p&&(o=n),r=n}return o},h=function(e,t){var n;return n=document.createElement(e),_(t)&&(n.innerHTML=t),n},y=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n="[UP] "+n,(r=up.browser).puts.apply(r,["debug",n].concat(e.call(t)))},Mt=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n="[UP] "+n,(r=up.browser).puts.apply(r,["warn",n].concat(e.call(t)))},k=function(){var n,r,o,u;throw r=1<=arguments.length?e.call(arguments,0):[],r[0]="[UP] "+r[0],(u=up.browser).puts.apply(u,["error"].concat(e.call(r))),o=S.apply(null,r),n=dt(t(".up-error"))||t('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(o),new Error(o)},o=/\%[odisf]/g,S=function(){var t,n,r,u;return t=1<=arguments.length?e.call(arguments,0):[],u=t[0],n=0,r=80,u.replace(o,function(){var e,o;return n+=1,e=t[n],o=typeof e,"string"===o?(e=e.replace(/\s+/g," "),e.length>r&&(e=e.substr(0,r)+"\u2026"),e='"'+e+'"'):e="undefined"===o?"undefined":"number"===o||"function"===o?e.toString():JSON.stringify(e),e.length>r&&(e=e.substr(0,r)+" \u2026",("object"===o||"function"===o)&&(e+=" }")),e})},kt=function(e){var n,r,o,u,i,a,s,l,c,p;if(n=t(e),c=void 0,y("Creating selector from element %o",n.get(0)),p=dt(n.attr("up-id")))c="[up-id='"+p+"']";else if(u=dt(n.attr("id")))c="#"+u;else if(l=dt(n.attr("name")))c="[name='"+l+"']";else if(r=dt(n.attr("class")))for(o=r.split(" "),c="",i=0,s=o.length;s>i;i++)a=o[i],c+="."+a;else c=n.prop("tagName").toLowerCase();return c},v=function(e){var t,n,r,o,u,i,a,s,l,c,p,f;return l=function(e){return"<"+e+"(?: [^>]*)?>"},i=function(e){return"</"+e+">"},t="(?:.|\\n)*?",u=function(e){return"("+e+")"},f=new RegExp(l("head")+t+l("title")+u(t)+i("title")+t+i("body"),"i"),o=new RegExp(l("body")+u(t)+i("body"),"i"),(r=e.match(o))?(s=document.createElement("html"),n=h("body",r[1]),s.appendChild(n),(p=e.match(f))&&(a=h("head"),s.appendChild(a),c=h("title",p[1]),a.appendChild(c)),s):h("div",e)},C=t.extend,$t=t.trim,w=function(e,t){var n,r,o,u,i;for(i=[],n=o=0,u=e.length;u>o;n=++o)r=e[n],i.push(t(r,n));return i},J=w,Ct=function(e,t){var n,r,o,u;for(u=[],n=r=0,o=e-1;o>=0?o>=r:r>=o;n=o>=0?++r:--r)u.push(t(n));return u},W=function(e){return null===e},N=function(e){return void 0===e},D=function(e){return!N(e)},L=function(e){return N(e)||W(e)},R=function(e){return!L(e)},U=function(e){return L(e)||I(e)&&0===Object.keys(e).length||0===e.length},dt=function(e,t){return null==t&&(t=_),t(e)?e:void 0},_=function(e){return!U(e)},j=function(e){return"function"==typeof e},q=function(e){return"string"==typeof e},H=function(e){return"number"==typeof e},z=function(e){return"object"==typeof e&&!!e},I=function(e){return z(e)||"function"==typeof e},M=function(e){return!(!e||1!==e.nodeType)},F=function(e){return e instanceof jQuery},K=function(e){return I(e)&&j(e.then)},O=function(e){return K(e)&&j(e.resolve)},P=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Et=function(e){return Array.prototype.slice.call(e)},d=function(e){return P(e)?e.slice():C({},e)},At=function(e){return F(e)?e.get(0):e},et=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],C.apply(null,[{}].concat(e.call(t)))},pt=function(e,t){var n,r,o,u;if(o=e?d(e):{},t)for(r in t)n=t[r],u=o[r],R(u)?I(n)&&I(u)&&(o[r]=pt(u,n)):o[r]=n;return o},ct=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],b(t,R)},b=function(e,t){var n,r,o,u;for(u=void 0,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=n;break}return u},i=function(e,t){var n,r,o,u;for(u=!1,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=!0;break}return u},c=function(e){return wt(e,R)},Pt=function(e){var t;return t={},wt(e,function(e){return t.hasOwnProperty(e)?!1:t[e]=!0})},wt=function(e,t){var n;return n=[],w(e,function(e){return t(e)?n.push(e):void 0}),n},mt=function(){var t,n,r,o;return t=arguments[0],r=2<=arguments.length?e.call(arguments,1):[],o=function(){var e,o,u;for(u=[],e=0,o=r.length;o>e;e++)n=r[e],u.push(t.attr(n));return u}(),b(o,_)},rt=function(e){return setTimeout(e,0)},V=function(e){return e[e.length-1]},l=function(){var e;return e=document.documentElement,{width:e.clientWidth,height:e.clientHeight}},bt=Z(function(){var e,n,r;return e=t("<div>").css({position:"absolute",top:"0",left:"0",width:"50px",height:"50px",overflowY:"scroll"}),e.appendTo(document.body),n=e.get(0),r=n.offsetWidth-n.clientWidth,e.remove(),r}),st=function(t){var n;return n=void 0,function(){var r;return r=1<=arguments.length?e.call(arguments,0):[],null!=t&&(n=t.apply(null,r)),t=void 0,n}},St=function(e,t,n){var r,o;return o=e.css(Object.keys(t)),e.css(t),r=function(){return e.css(o)},n?(n(),r()):st(r)},A=function(e){var t,n;return n=e.css(["transform","-webkit-transform"]),U(n)||"none"===n.transform?(t=function(){return e.css(n)},e.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):t=function(){},t},g=function(e,n,o){var u,i,a,s,l,c;return u=t(e),o=pt(o,{duration:300,delay:0,easing:"ease"}),i=t.Deferred(),s={"transition-property":Object.keys(n).join(", "),"transition-duration":o.duration+"ms","transition-delay":o.delay+"ms","transition-timing-function":o.easing},l=A(u),c=St(u,s),u.css(n),i.then(l),i.then(c),u.data(r,i),i.then(function(){return u.removeData(r)}),a=setTimeout(function(){return i.resolve()},o.duration+o.delay),i.then(function(){return clearTimeout(a)}),i},r="up-animation-promise",E=function(e){return t(e).each(function(){var e;return(e=t(this).data(r))?e.resolve():void 0})},Y=function(e,n){var r,o,u,i,a,s;return n=pt(n,{relative:!1,inner:!1,full:!1}),n.relative?n.relative===!0?i=e.position():(r=t(n.relative),a=e.offset(),r.is(document)?i=a:(u=r.offset(),i={left:a.left-u.left,top:a.top-u.top})):i=e.offset(),o={left:i.left,top:i.top},n.inner?(o.width=e.width(),o.height=e.height()):(o.width=e.outerWidth(),o.height=e.outerHeight()),n.full&&(s=l(),o.right=s.width-(o.left+o.width),o.bottom=s.height-(o.top+o.height)),o},m=function(e,t){var n,r,o,u,i;for(u=e.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)n=u[r],i.push(n.specified?t.attr(n.name,n.value):void 0);return i},T=function(e,t){return e.find(t).addBack(t)},x=function(e){return 27===e.keyCode},f=function(e,t){return e.indexOf(t)>=0},s=function(e,t){var n;switch(n=e.attr(t)){case"false":return!1;case"true":return!0;case"":return!0;default:return n}},G=function(e){return e.getResponseHeader("X-Up-Location")},Tt=function(e){return e.getResponseHeader("X-Up-Title")},tt=function(e){return e.getResponseHeader("X-Up-Method")},lt=function(){var t,n,r,o,u,i;for(o=arguments[0],u=2<=arguments.length?e.call(arguments,1):[],t={},n=0,r=u.length;r>n;n++)i=u[n],o.hasOwnProperty(i)&&(t[i]=o[i]);return t},X=function(e){return!(e.metaKey||e.shiftKey||e.ctrlKey)},B=function(e){var t;return t=N(e.button)||0===e.button,t&&X(e)},gt=function(){var e;return e=t.Deferred(),e.resolve(),e},yt=function(){return gt().promise()},Ut=function(){return t.Deferred()},Ot=function(){return Ut().promise()},it=function(){return t()},vt=function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],r=t.when.apply(t,n),r.resolve=function(){return w(n,function(e){return"function"==typeof e.resolve?e.resolve():void 0})},r},xt=function(e,t){var n,r,o;r=[];for(n in t)o=t[n],r.push(L(e.attr(n))?e.attr(n,o):void 0);return r},ht=function(e,t){var n;return n=e.indexOf(t),n>=0?(e.splice(n,1),t):void 0},nt=function(e){var n,r,o,u,a,s,l;for(a={},l=[],r=[],o=0,u=e.length;u>o;o++)s=e[o],q(s)?l.push(s):r.push(s);return a.parsed=r,l.length&&(n=l.join(", "),a.parsed.push(n)),a.select=function(){return a.find(void 0)},a.find=function(e){var n,r,o,u,i,s;for(r=it(),i=a.parsed,o=0,u=i.length;u>o;o++)s=i[o],n=e?e.find(s):t(s),r=r.add(n);return r},a.findWithSelf=function(e){var t;return t=a.find(e),a.doesMatch(e)&&(t=t.add(e)),t},a.doesMatch=function(e){var n;return n=t(e),i(a.parsed,function(e){return n.is(e)})},a.seekUp=function(e){var n,r,o;for(o=t(e),n=o,r=void 0;n.length;){if(a.doesMatch(n)){r=n;break}n=n.parent()}return r||it()},a},a=function(t){var n,r,o,u,i,a,s,l,c,p,f,m;return null==t&&(t={}),f=void 0,r=function(){return f={}},r(),s=function(){var n;return n=1<=arguments.length?e.call(arguments,0):[],t.log?(n[0]="["+t.log+"] "+n[0],y.apply(null,n)):void 0},a=function(){return Object.keys(f)},l=function(){return L(t.size)?void 0:j(t.size)?t.size():H(t.size)?t.size:k("Invalid size config: %o",t.size)},o=function(){return L(t.expiry)?void 0:j(t.expiry)?t.expiry():H(t.expiry)?t.expiry:k("Invalid expiry config: %o",t.expiry)},c=function(e){return t.key?t.key(e):e.toString()},$t=function(){var e,t,n,r;return r=d(a()),n=l(),n&&r.length>n&&(e=null,t=null,w(r,function(n){var r,o;return r=f[n],o=r.timestamp,!t||t>o?(e=n,t=o):void 0}),e)?delete f[e]:void 0},n=function(e,t){var n;return n=u(e),D(n)?p(t,n):void 0},m=function(){return(new Date).valueOf()},p=function(e,t){var n;return n=c(e),f[n]={timestamp:m(),value:t}},ht=function(e){var t;return t=c(e),delete f[t]},i=function(e){var t,n;return t=o(),t?(n=m()-e.timestamp,n<o()):!0},u=function(e,t){var n,r;return null==t&&(t=void 0),r=c(e),(n=f[r])?i(n)?(s("Cache hit for %o",e),n.value):(s("Discarding stale cache entry for %o",e),ht(e),t):(s("Cache miss for %o",e),t)},{alias:n,get:u,set:p,remove:ht,clear:r,keys:a}},p=function(e){var t;return null==e&&(e={}),t={},t.reset=function(){return C(t,e)},t.reset(),Object.preventExtensions(t),t},Dt=function(e){var t,n;return e=At(e),t=e.parentNode,n=Et(e.childNodes),w(n,function(n){return t.insertBefore(n,e)}),t.removeChild(e)},at=function(e){var t,n;for(t=void 0;(e=e.parent())&&e.length;)if(n=e.css("position"),"absolute"===n||"relative"===n||e.is("body")){t=e;break}return t},$=function(e,n){var r,o,u,i;return r=t(e),o=at(r),u=r.position(),i=o.offset(),r.css({position:"absolute",left:u.left-i.left,top:u.top-i.top+n.scrollTop(),right:"",bottom:""})},{offsetParent:at,fixedToAbsolute:$,presentAttr:mt,createElement:h,parseUrl:ft,normalizeUrl:ut,normalizeMethod:ot,createElementFromHtml:v,$createElementFromSelector:n,selectorForElement:kt,ajax:u,extend:C,copy:d,merge:et,options:pt,option:ct,error:k,debug:y,warn:Mt,each:w,map:J,times:Ct,any:i,detect:b,select:wt,compact:c,uniq:Pt,last:V,isNull:W,isDefined:D,isUndefined:N,isGiven:R,isMissing:L,isPresent:_,isBlank:U,presence:dt,isObject:I,isFunction:j,isString:q,isElement:M,isJQuery:F,isPromise:K,isDeferred:O,isHash:z,isUnmodifiedKeyEvent:X,isUnmodifiedMouseEvent:B,nullJQuery:it,unJQuery:At,nextFrame:rt,measure:Y,temporaryCss:St,cssAnimate:g,finishCssAnimate:E,forceCompositing:A,escapePressed:x,copyAttributes:m,findWithSelf:T,contains:f,isArray:P,toArray:Et,castedAttr:s,locationFromXhr:G,titleFromXhr:Tt,methodFromXhr:tt,clientSize:l,only:lt,trim:$t,unresolvableDeferred:Ut,unresolvablePromise:Ot,resolvedPromise:yt,resolvedDeferred:gt,resolvableWhen:vt,setMissingAttrs:xt,remove:ht,memoize:Z,scrollbarWidth:bt,config:p,cache:a,unwrapElement:Dt,multiSelector:nt,evalConsoleTemplate:S}}($),up.error=up.util.error,up.warn=up.util.warn,up.debug=up.util.debug}.call(this),function(){var e=[].slice;up.browser=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h;return m=up.util,p=function(e,n){var r,o,u,i,a,s;return null==n&&(n={}),a=m.option(n.method,"get").toLowerCase(),"get"===a?location.href=e:t.rails?(s=n.target,u=t.rails.csrfToken(),o=t.rails.csrfParam(),r=t("<form method='post' action='"+e+"'></form>"),i="<input name='_method' value='"+a+"' type='hidden' />",m.isDefined(o)&&m.isDefined(u)&&(i+="<input name='"+o+"' value='"+u+"' type='hidden' />"),s&&r.attr("target",s),r.hide().append(i).appendTo("body"),r.submit()):error("Can't fake a "+a.toUpperCase()+" request without Rails UJS")},d=function(){var t,n,r;return r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],m.isDefined(console[r])||(r="log"),o()?console[r].apply(console,t):(n=m.evalConsoleTemplate.apply(m,t),console[r](n))},h=function(){return location.href},a=m.memoize(function(){return m.isUndefined(document.addEventListener)}),s=m.memoize(function(){return a()||-1!==navigator.appVersion.indexOf("MSIE 9.")}),u=m.memoize(function(){return m.isDefined(history.pushState)&&"get"===i()}),n=m.memoize(function(){return"transition"in document.documentElement.style}),r=m.memoize(function(){return"oninput"in document.createElement("input")}),o=m.memoize(function(){return!s()}),l=m.memoize(function(){var e,n,r,o;return o=t.fn.jquery,r=o.split("."),e=parseInt(r[0]),n=parseInt(r[1]),e>=2||1===e&&n>=9}),f=function(e){var t,n;return n=null!=(t=document.cookie.match(new RegExp(e+"=(\\w+)")))?t[1]:void 0,m.isPresent(n)&&(document.cookie=e+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"),n},i=m.memoize(function(){return(f("_up_request_method")||"get").toLowerCase()}),c=function(){return!a()&&l()},{url:h,loadPage:p,canPushState:u,canCssTransition:n,canInputEvent:r,canLogSubstitution:o,isSupported:c,puts:d}}(jQuery)}.call(this),function(){var e=[].slice;up.bus=function(t){var n,r,o,u,i,a,s,l,c,p,f,d;return f=up.util,a=[],r=null,d=function(e){return function(n){var r;return r=n.$element||t(this),e.apply(r.get(0),[n,r,up.syntax.data(r)])}},i=function(){var n,r,o,u,i;return r=1<=arguments.length?e.call(arguments,0):[],up.browser.isSupported()?(u=f.copy(r),i=u.length-1,o=u[i],u[i]=d(o),a.push(u),n=t(document),n.on.apply(n,u),function(){return n.off.apply(n,u)}):function(){}},o=function(e,n){var r,o;return null==n&&(n={}),o=t.Event(e,n),r=n.$element||t(document),f.debug("Emitting %o on %o with props %o",e,r,n),r.trigger(o),o},s=function(){var t,n;return t=1<=arguments.length?e.call(arguments,0):[],n=o.apply(null,t),!n.isDefaultPrevented()},l=function(e){return i("keydown","body",function(t){return f.escapePressed(t)?e(t):void 0})},p=function(){return r=f.copy(a)},c=function(){var e,n,o,u;for(n=0,o=a.length;o>n;n++)e=a[n],f.contains(r,e)||(u=t(document)).off.apply(u,e);return a=f.copy(r)},u=function(){return up.emit("up:framework:reset")},n=function(){return up.browser.isSupported()?up.emit("up:framework:boot"):void 0},i("up:framework:boot",p),i("up:framework:reset",c),{on:i,emit:o,nobodyPrevents:s,onEscape:l,emitReset:u,boot:n}}(jQuery),up.on=up.bus.on,up.emit=up.bus.emit,up.reset=up.bus.emitReset,up.boot=up.bus.boot}.call(this),function(){var e=[].slice;up.syntax=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m;return m=up.util,n="up-destroyable",r="up-destroyer",a=[],l=null,i=function(){var t,n,r;return r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],up.browser.isSupported()?(i=t.pop(),n=m.options(t[0],{batch:!1}),a.push({selector:r,callback:i,batch:n.batch})):void 0},o=function(e,t,o){var u;return m.debug("Applying compiler %o on %o",e.selector,o),u=e.callback.apply(o,[t,s(t)]),m.isFunction(u)?(t.addClass(n),t.data(r,u)):void 0},u=function(e){var n,r,u,s;for(m.debug("Compiling fragment %o",e),s=[],r=0,u=a.length;u>r;r++)i=a[r],n=m.findWithSelf(e,i.selector),s.push(n.length?i.batch?o(i,n,n.get()):n.each(function(){return o(i,t(this),this)}):void 0);return s},f=function(e){return m.findWithSelf(e,"."+n).each(function(){var e,n;return e=t(this),(n=e.data(r))()})},s=function(e){var n,r;return n=t(e),r=n.attr("up-data"),m.isString(r)&&""!==m.trim(r)?JSON.parse(r):{}},d=function(){return l=m.copy(a)},p=function(){return a=m.copy(l)},c=function(e,n){var r,o;return r=t(e),o=m.options(n,{$element:r}),up.emit("up:fragment:inserted",o),r},up.on("ready",function(){return c(document.body)}),up.on("up:fragment:inserted",function(e){return u(e.$element)}),up.on("up:fragment:destroy",function(e){return f(e.$element)}),up.on("up:framework:boot",d),up.on("up:framework:reset",p),{compiler:i,hello:c,data:s}}(jQuery),up.compiler=up.syntax.compiler,up.hello=up.syntax.hello,up.ready=function(){return up.util.error("up.ready no longer exists. Please use up.hello instead.")},up.awaken=function(){return up.util.error("up.awaken no longer exists. Please use up.compiler instead.")}}.call(this),function(){up.history=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return v=up.util,n=v.config({popTargets:["body"],restoreScroll:!0}),c=void 0,i=void 0,m=function(){return n.reset(),c=void 0,i=void 0},a=function(e){return v.normalizeUrl(e,{hash:!0})},r=function(){return a(up.browser.url())},o=function(e){return a(e)===r()},s=function(e){return i&&(c=i,i=void 0),i=e},d=function(e,t){return u("replace",e,t)},p=function(e,t){return u("push",e,t)},u=function(e,n,u){var i,a;return u=v.options(u,{force:!1}),u.force||!o(n)?up.browser.canPushState()?(i=e+"State",a=t(),v.debug("Changing history to URL %o (%o)",n,e),window.history[i](a,"",n),s(r())):v.error("This browser doesn't support history.pushState"):void 0},t=function(){return{fromUp:!0}},h=function(e){var t,o;return o=r(),v.debug("Restoring state %o (now on "+o+")",e),t=n.popTargets.join(", "),up.replace(t,o,{history:!1,reveal:!1,transition:"none",saveScroll:!1,restoreScroll:n.restoreScroll})},l=function(e){var t;return v.debug("History state popped to URL %o",r()),s(r()),up.layout.saveScroll({url:c}),t=e.originalEvent.state,(null!=t?t.fromUp:void 0)?h(t):v.debug("Discarding unknown state %o",t)},up.browser.canPushState()&&(f=function(){return e(window).on("popstate",l),d(r(),{force:!0})},"undefined"!=typeof jasmine&&null!==jasmine?f():setTimeout(f,100)),up.compiler("[up-back]",function(e){return v.isPresent(c)?(v.setMissingAttrs(e,{"up-href":c,"up-restore-scroll":""}),e.removeAttr("up-back"),up.link.makeFollowable(e)):void 0}),up.on("up:framework:reset",m),{config:n,defaults:function(){return v.error("up.history.defaults(...) no longer exists. Set values on he up.history.config property instead.")},push:p,replace:d,url:r,previousUrl:function(){return c},normalizeUrl:a}}(jQuery)}.call(this),function(){var slice=[].slice;up.layout=function($){var SCROLL_PROMISE_KEY,anchoredRight,config,finishScrolling,fixedChildren,lastScrollTops,measureObstruction,reset,restoreScroll,reveal,revealOrRestoreScroll,saveScroll,scroll,scrollTops,u,viewportOf,viewportSelector,viewports,viewportsWithin;return u=up.util,config=u.config({duration:0,viewports:[document,".up-modal","[up-viewport]"],fixedTop:["[up-fixed~=top]"],fixedBottom:["[up-fixed~=bottom]"],anchoredRight:["[up-anchored~=right]","[up-fixed~=top]","[up-fixed~=bottom]","[up-fixed~=right]"],snap:50,substance:150,easing:"swing"}),lastScrollTops=u.cache({size:30,key:up.history.normalizeUrl}),reset=function(){return config.reset(),lastScrollTops.clear()},SCROLL_PROMISE_KEY="up-scroll-promise",scroll=function(e,t,n){var r,o,i,a,s;return r=$(e),n=u.options(n),i=u.option(n.duration,config.duration),a=u.option(n.easing,config.easing),finishScrolling(r),i>0?(o=$.Deferred(),r.data(SCROLL_PROMISE_KEY,o),o.then(function(){return r.removeData(SCROLL_PROMISE_KEY),r.finish()}),s={scrollTop:t},r.get(0)===document&&(r=$("html, body")),r.animate(s,{duration:i,easing:a,complete:function(){return o.resolve()}}),o):(r.scrollTop(t),u.resolvedDeferred())},finishScrolling=function(e){return $(e).each(function(){var e;return(e=$(this).data(SCROLL_PROMISE_KEY))?e.resolve():void 0})},anchoredRight=function(){return u.multiSelector(config.anchoredRight).select()},measureObstruction=function(){var e,t,n,r;return n=function(e,t){var n,r;return n=$(e),r=n.css(t),u.isPresent(r)||u.error("Fixed element %o must have a CSS attribute %o",n,t),parseInt(r)+n.height()},t=function(){var e,t,o,u;for(o=$(config.fixedTop.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"top"));return u}(),e=function(){var e,t,o,u;for(o=$(config.fixedBottom.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"bottom"));return u}(),{top:Math.max.apply(Math,[0].concat(slice.call(t))),bottom:Math.max.apply(Math,[0].concat(slice.call(e)))}},reveal=function(e,t){var n,r,o,i,a,s,l,c,p,f,d,m,h,v;return u.debug("Revealing %o",e),t=u.options(t),n=$(e),r=t.viewport?$(t.viewport):viewportOf(n),m=u.option(t.snap,config.snap),v=r.is(document),h=v?u.clientSize().height:r.height(),p=r.scrollTop(),s=p,c=void 0,l=void 0,v?(l=measureObstruction(),c=0):(l={top:0,bottom:0},c=p),f=function(){return s+l.top},d=function(){return s+h-l.bottom-1},o=u.measure(n,{relative:r}),i=o.top+c,a=i+Math.min(o.height,config.substance)-1,a>d()&&(s+=a-d()),(i<f()||t.top)&&(s=i-l.top),m>s&&(s=0),s!==p?scroll(r,s,t):u.resolvedDeferred()},viewportSelector=function(){return u.multiSelector(config.viewports)},viewportOf=function(e){var t,n;return t=$(e),n=viewportSelector().seekUp(t),n.length||u.error("Could not find viewport for %o",t),n},viewportsWithin=function(e){var t;return t=$(e),viewportSelector().findWithSelf(t)},viewports=function(){return viewportSelector().select()},scrollTops=function(){var e,t,n,r,o,u,i;for(u={},o=config.viewports,t=0,r=o.length;r>t;t++)i=o[t],e=$(i),e.length&&(n=i,i===document&&(n="document"),u[n]=e.scrollTop());return u},fixedChildren=function(e){var t,n;return null==e&&(e=void 0),e||(e=document.body),n=$(e),t=n.find("[up-fixed]"),u.isPresent(config.fixedTop)&&(t=t.add(n.find(config.fixedTop.join(", ")))),u.isPresent(config.fixedBottom)&&(t=t.add(n.find(config.fixedBottom.join(", ")))),t},saveScroll=function(e){var t,n;return null==e&&(e={}),n=u.option(e.url,up.history.url()),t=u.option(e.tops,scrollTops()),u.debug("Saving scroll positions for URL %o: %o",n,t),lastScrollTops.set(n,t)},restoreScroll=function(e){var t,n,r,o,i,a,s,l,c;null==e&&(e={}),c=up.history.url(),o=void 0,e.around?(n=viewportsWithin(e.around),t=viewportOf(e.around),o=t.add(n)):o=viewports(),l=lastScrollTops.get(c),u.debug("Restoring scroll positions for URL %o (viewports are %o, saved tops are %o)",c,o,l);for(i in l)s=l[i],a="document"===i?document:i,r=o.filter(a),scroll(r,s,{duration:0});return u.resolvedDeferred()},revealOrRestoreScroll=function(e,t){var n,r,o,i;return n=$(e),t.restoreScroll?restoreScroll({around:n}):t.reveal?(t.source&&(i=u.parseUrl(t.source),i.hash&&"#"!==i.hash&&(o=i.hash.substr(1),r=u.findWithSelf(n,"#"+o+", a[name='"+o+"']"),r.length&&(n=r))),reveal(n)):u.resolvedDeferred()},up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),reveal:reveal,scroll:scroll,finishScrolling:finishScrolling,config:config,defaults:function(){return u.error("up.layout.defaults(...) no longer exists. Set values on he up.layout.config property instead.")},viewportOf:viewportOf,viewportsWithin:viewportsWithin,viewports:viewports,scrollTops:scrollTops,saveScroll:saveScroll,restoreScroll:restoreScroll,revealOrRestoreScroll:revealOrRestoreScroll,anchoredRight:anchoredRight,fixedChildren:fixedChildren}}(jQuery),up.scroll=up.layout.scroll,up.reveal=up.layout.reveal}.call(this),function(){up.flow=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,m=function(t,n){var r;return r=e(t),g.isPresent(n)&&(n=g.normalizeUrl(n)),r.attr("up-source",n)},h=function(t){var n;return n=e(t).closest("[up-source]"),g.presence(n.attr("up-source"))||up.browser.url()},d=function(e,t){var n,r,o;return g.isString(e)?(o=e,g.contains(o,"&")&&((n=g.presence(t.origin))?(r=g.selectorForElement(n),o=o.replace(/\&/,r)):g.error("Found origin reference %o in selector %o, but options.origin is missing","&",o))):o=g.selectorForElement(e),o},f=function(e,t,n){var r,o,u;return g.debug("Replace %o with %o (options %o)",e,t,n),n=g.options(n),u=d(e,n),up.browser.canPushState()||n.history===!1?(o={url:t,method:n.method,selector:u,cache:n.cache,preload:n.preload,headers:n.headers},r=up.proxy.ajax(o),r.done(function(e,r,a){var s,l;return(s=g.locationFromXhr(a))&&(g.debug("Location from server: %o",s),l={url:s,method:g.methodFromXhr(a),selector:u},up.proxy.alias(o,l),t=s),n.history!==!1&&(n.history=t),n.source!==!1&&(n.source=t),n.title||(n.title=g.titleFromXhr(a)),n.preload?void 0:i(u,e,n)}),r.fail(g.error),r):(n.preload||up.browser.loadPage(t,g.only(n,"method")),g.unresolvablePromise())},i=function(e,t,n){var r,u,i,a,s,p,f,m,h,y;for(h=d(e,n),n=g.options(n,{historyMethod:"push",requireMatch:!0}),n.source=g.option(n.source,n.history),f=c(t,n),n.title||(n.title=f.title()),n.saveScroll!==!1&&up.layout.saveScroll(),s=l(h,n),m=[],i=0,a=s.length;a>i;i++)y=s[i],u=o(y.selector,n),r=null!=(p=f.find(y.selector))?p.first():void 0,m.push(u&&r?v(u,r,y.pseudoClass,y.transition,n):void 0);return m},o=function(e,t){return u(".up-popup "+e)||u(".up-modal "+e)||u(e)||s(e,t)},s=function(e,t){var n;return t.requireMatch?(n="Could not find selector %o in current body HTML","#"===n[0]&&(n+=" (avoid using IDs)"),g.error(n,e)):void 0},c=function(t,n){var r;return r=g.createElementFromHtml(t),{title:function(){var e;return null!=(e=r.querySelector("title"))?e.textContent:void 0},find:function(o){var u;return(u=e.find(o,r)[0])?e(u):n.requireMatch?g.error("Could not find selector %o in response %o",o,t):void 0}}},r=function(e,n){return n.history&&(n.title&&(document.title=n.title),up.history[n.historyMethod](n.history)),n.source!==!1&&m(e,n.source),t(e),up.hello(e,{origin:n.origin})},v=function(e,t,o,u,i){var a,s;return u||(u="none"),up.motion.finish(e),o?(s="before"===o?"prepend":"append",a=t.contents().wrap('<span class="up-insertion"></span>').parent(),e[s](a),g.copyAttributes(t,e),r(a.children(),i),up.layout.revealOrRestoreScroll(a,i).then(function(){return up.animate(a,u,i)}).then(function(){g.unwrapElement(a)})):n(e,{animation:function(){return t.insertBefore(e),r(t,i),e.is("body")&&"none"!==u&&g.error("Cannot apply transitions to body-elements (%o)",u),up.morph(e,t,u,i)}})},l=function(e,t){var n,r,o,u,i,a,s,l,c,p,f,d;for(f=t.transition||t.animation||"none",n=/\ *,\ */,r=e.split(n),g.isPresent(f)&&(d=f.split(n)),s=[],o=u=0,i=r.length;i>u;o=++u)l=r[o],c=l.match(/^(.+?)(?:\:(before|after))?$/),e=c[1],"html"===e&&(e="body"),a=c[2],p=d[o]||g.last(d),s.push({selector:e,pseudoClass:a,transition:p});return s},t=function(e){var t,n;return n="[autofocus]:last",t=g.findWithSelf(e,n),t.length&&t.get(0)!==document.activeElement?t.focus():void 0},a=function(e){var t;return t=".up-ghost, .up-destroying",0===e.closest(t).length},u=function(t){var n,r,o,u,i,s;for(u=void 0,u=g.isString(t)?e(t).get():t,r=void 0,i=0,s=u.length;s>i;i++)if(o=u[i],n=e(o),a(n)){r=n;break}return r},n=function(t,n){var r,o,u;return r=e(t),up.bus.nobodyPrevents("up:fragment:destroy",{$element:r})?(n=g.options(n,{animation:"none"}),o=up.motion.animateOptions(n),r.addClass("up-destroying"),g.isPresent(n.url)&&up.history.push(n.url),g.isPresent(n.title)&&(document.title=n.title),u=g.presence(n.animation,g.isDeferred)||up.motion.animate(r,n.animation,o),u.then(function(){return up.emit("up:fragment:destroyed",{$element:r}),r.remove()}),u):e.Deferred()},p=function(e,t){var n;return t=g.options(t,{cache:!1}),n=t.url||h(e),f(e,n,t)},up.on("ready",function(){return m(document.body,up.browser.url())}),{replace:f,reload:p,destroy:n,implant:i,first:u,resolveSelector:d}}(jQuery),up.replace=up.flow.replace,up.implant=up.flow.implant,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.first=up.flow.first}.call(this),function(){up.motion=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,x,S,C;return S=up.util,u={},s={},x={},l={},a=S.config({duration:300,delay:0,easing:"ease",enabled:!0}),g=function(){return u=S.copy(s),x=S.copy(l),a.reset()},d=function(){return a.enabled&&up.browser.canCssTransition()},n=function(t,o,u){var a;return a=e(t),p(a),u=r(u),("none"===o||o===!1)&&h(),S.isFunction(o)?i(o(a,u),o):S.isString(o)?n(a,c(o),u):S.isHash(o)?d()?S.cssAnimate(a,o,u):(a.css(o),S.resolvedDeferred()):S.error("Unknown animation type %o",o)},r=function(e,t){var n;return null==t&&(t=null),e=S.options(e),n={},n.easing=S.option(e.easing,null!=t?t.attr("up-easing"):void 0,a.easing),n.duration=Number(S.option(e.duration,null!=t?t.attr("up-duration"):void 0,a.duration)),n.delay=Number(S.option(e.delay,null!=t?t.attr("up-delay"):void 0,a.delay)),n},c=function(e){return u[e]||S.error("Unknown animation %o",e)},t="up-ghosting-promise",C=function(e,n,r,o){var u,i,a,s,l,c,p;return s=void 0,i=void 0,l=void 0,a=void 0,u=up.layout.viewportOf(e),S.temporaryCss(n,{display:"none"},function(){return s=v(e,u),s.$ghost.addClass("up-destroying"),s.$bounds.addClass("up-destroying"),l=u.scrollTop()}),S.temporaryCss(e,{display:"none"},function(){return up.layout.revealOrRestoreScroll(n,r),i=v(n,u),a=u.scrollTop()}),s.moveTop(a-l),e.hide(),p=S.temporaryCss(n,{opacity:"0"}),c=o(s.$ghost,i.$ghost),e.data(t,c),n.data(t,c),c.then(function(){return e.removeData(t),n.removeData(t),p(),s.$bounds.remove(),i.$bounds.remove()}),c},p=function(t){return e(t).each(function(){var t;return t=e(this),S.finishCssAnimate(t),f(t)})},f=function(e){var n;return(n=e.data(t))?(S.debug("Canceling existing ghosting on %o",e),"function"==typeof n.resolve?n.resolve():void 0):void 0},i=function(e,t){return S.isDeferred(e)?e:S.error("Did not return a promise with .then and .resolve methods: %o",t)},m=function(t,o,a,s){var l,c,f,h,v,g,w;return S.debug("Morphing %o to %o (using %o)",t,o,a),c=e(t),l=e(o),v=S.only(s,"reveal","restoreScroll","source"),v=S.extend(v,r(s)),d()?(p(c),p(l),"none"===a||a===!1||(f=u[a])?(h=b(c,l,v),h.then(function(){return n(l,f||"none",s)}),h):(w=S.presence(a,S.isFunction)||x[a])?C(c,l,v,function(e,t){var n;return n=w(e,t,v),i(n,a)}):S.isString(a)&&a.indexOf("/")>=0?(g=a.split("/"),w=function(e,t,r){return y(n(e,g[0],r),n(t,g[1],r))},m(c,l,w,v)):S.error("Unknown transition %o",a)):b(c,l,v)},b=function(e,t,n){return e.hide(),up.layout.revealOrRestoreScroll(t,n)},v=function(t,n){var r,o,u,i,a,s,l,c,p;for(i=S.measure(t,{relative:!0,inner:!0}),u=t.clone(),u.find("script").remove(),u.css({position:"static"===t.css("position")?"static":"relative",top:"",right:"",bottom:"",left:"",width:"100%",height:"100%"}),u.addClass("up-ghost"),r=e('<div class="up-bounds"></div>'),r.css({position:"absolute"}),r.css(i),p=i.top,c=function(e){return 0!==e?(p+=e,r.css({top:p})):void 0},u.appendTo(r),r.insertBefore(t),c(t.offset().top-u.offset().top),o=up.layout.fixedChildren(u),s=0,l=o.length;l>s;s++)a=o[s],S.fixedToAbsolute(a,n);return{$ghost:u,$bounds:r,moveTop:c}},k=function(e,t){return x[e]=t},o=function(e,t){return u[e]=t},w=function(){return s=S.copy(u),l=S.copy(x)},y=S.resolvableWhen,h=S.resolvedDeferred,o("none",h),o("fade-in",function(e,t){return e.css({opacity:0}),n(e,{opacity:1},t)}),o("fade-out",function(e,t){return e.css({opacity:1}),n(e,{opacity:0},t)}),o("move-to-top",function(e,t){var r,o;return r=S.measure(e),o=r.top+r.height,e.css({"margin-top":"0px"}),n(e,{"margin-top":"-"+o+"px"},t)}),o("move-from-top",function(e,t){var r,o;return r=S.measure(e),o=r.top+r.height,e.css({"margin-top":"-"+o+"px"}),n(e,{"margin-top":"0px"},t)}),o("move-to-bottom",function(e,t){var r,o;return r=S.measure(e),o=S.clientSize().height-r.top,e.css({"margin-top":"0px"}),n(e,{"margin-top":o+"px"},t)}),o("move-from-bottom",function(e,t){var r,o;return r=S.measure(e),o=S.clientSize().height-r.top,e.css({"margin-top":o+"px"}),n(e,{"margin-top":"0px"},t)}),o("move-to-left",function(e,t){var r,o;return r=S.measure(e),o=r.left+r.width,e.css({"margin-left":"0px"}),n(e,{"margin-left":"-"+o+"px"},t)}),o("move-from-left",function(e,t){var r,o;return r=S.measure(e),o=r.left+r.width,e.css({"margin-left":"-"+o+"px"}),n(e,{"margin-left":"0px"},t)}),o("move-to-right",function(e,t){var r,o;return r=S.measure(e),o=S.clientSize().width-r.left,e.css({"margin-left":"0px"}),n(e,{"margin-left":o+"px"},t)}),o("move-from-right",function(e,t){var r,o;
2
- return r=S.measure(e),o=S.clientSize().width-r.left,e.css({"margin-left":o+"px"}),n(e,{"margin-left":"0px"},t)}),o("roll-down",function(e,t){var r,o;return r=e.height(),o=S.temporaryCss(e,{height:"0px",overflow:"hidden"}),n(e,{height:r+"px"},t).then(o)}),k("none",h),k("move-left",function(e,t,r){return y(n(e,"move-to-left",r),n(t,"move-from-right",r))}),k("move-right",function(e,t,r){return y(n(e,"move-to-right",r),n(t,"move-from-left",r))}),k("move-up",function(e,t,r){return y(n(e,"move-to-top",r),n(t,"move-from-bottom",r))}),k("move-down",function(e,t,r){return y(n(e,"move-to-bottom",r),n(t,"move-from-top",r))}),k("cross-fade",function(e,t,r){return y(n(e,"fade-out",r),n(t,"fade-in",r))}),up.on("up:framework:boot",w),up.on("up:framework:reset",g),{morph:m,animate:n,animateOptions:r,finish:p,transition:k,animation:o,config:a,isEnabled:d,defaults:function(){return S.error("up.motion.defaults(...) no longer exists. Set values on he up.motion.config property instead.")},none:h,when:y,prependCopy:v}}(jQuery),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){var e=[].slice;up.proxy=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,x,S,C,T,E,$,A,P,U,O,D,M,j;return j=up.util,n=void 0,$=void 0,a=void 0,C=void 0,s=void 0,P=[],h=j.config({busyDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5,maxRequests:4}),c=function(e){return S(e),[e.url,e.method,e.data,e.selector].join("|")},l=j.cache({size:function(){return h.cacheSize},expiry:function(){return h.cacheExpiry},key:c,log:"up.proxy"}),v=function(e){var t,n,r,o,u,i,a;for(e=S(e),n=[e],"html"!==e.selector&&(i=j.merge(e,{selector:"html"}),n.push(i),"body"!==e.selector&&(u=j.merge(e,{selector:"body"}),n.push(u))),r=0,o=n.length;o>r;r++)if(t=n[r],a=l.get(t))return a},D=l.set,U=l.remove,m=l.clear,f=function(){return clearTimeout($),$=null},p=function(){return clearTimeout(a),a=null},O=function(){return n=null,f(),p(),C=0,h.reset(),s=!1,l.clear(),P=[]},O(),u=l.alias,S=function(e){return e._normalized||(e.method=j.normalizeMethod(e.method),e.url&&(e.url=j.normalizeUrl(e.url)),e.selector||(e.selector="body"),e._normalized=!0),e},o=function(e){var t,n,r,o,u;return t=e.cache===!0,n=e.cache===!1,u=j.only(e,"url","method","data","selector","headers","_normalized"),r=!0,y(u)||t?(o=v(u))&&!n?r="pending"===o.state():(o=k(u),D(u,o),o.fail(function(){return U(u)})):(m(),o=k(u)),r&&!e.preload&&(x(),o.always(w)),o},r=["GET","OPTIONS","HEAD"],g=function(){return 0===C},i=function(){return C>0},x=function(){var e,t;return t=g(),C+=1,t?(e=function(){return i()?(up.emit("up:proxy:busy"),s=!0):void 0},h.busyDelay>0?a=setTimeout(e,h.busyDelay):e()):void 0},w=function(){return C-=1,g()&&s?(up.emit("up:proxy:idle"),s=!1):void 0},k=function(e){return C<h.maxRequests?b(e):A(e)},A=function(e){var n,r;return j.debug("Queuing URL %o",e.url),n=t.Deferred(),r={deferred:n,request:e},P.push(r),n.promise()},b=function(e){var t;return j.debug("Loading URL %o",e.url),up.emit("up:proxy:load",e),t=j.ajax(e),t.always(function(){return up.emit("up:proxy:received",e),T()}),t},T=function(){var t,n;return(t=P.shift())?(n=b(t.request),n.done(function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],(r=t.deferred).resolve.apply(r,n)}),n.fail(function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],(r=t.deferred).reject.apply(r,n)})):void 0},y=function(e){return S(e),j.contains(r,e.method)},d=function(e){var t,r;return r=parseInt(j.presentAttr(e,"up-delay"))||h.preloadDelay,e.is(n)?void 0:(n=e,f(),t=function(){return E(e),n=null},M(t,r))},M=function(e,t){return $=setTimeout(e,t)},E=function(e,n){var r,o;return r=t(e),n=j.options(n),o=up.link.followMethod(r,n),y({method:o})?(j.debug("Preloading %o",r),n.preload=!0,up.follow(r,n)):(j.debug("Won't preload %o due to unsafe method %o",r,o),j.resolvedPromise())},up.on("mouseover mousedown touchstart","[up-preload]",function(e,t){return up.link.childClicked(e,t)?void 0:d(t)}),up.on("up:framework:reset",O),{preload:E,ajax:o,get:v,alias:u,clear:m,remove:U,idle:g,busy:i,config:h,defaults:function(){return j.error("up.proxy.defaults(...) no longer exists. Set values on he up.proxy.config property instead.")}}}(jQuery)}.call(this),function(){up.link=function($){var childClicked,follow,followMethod,makeFollowable,shouldProcessLinkEvent,u,visit;return u=up.util,visit=function(e,t){var n;return t=u.options(t),n=u.option(t.target,"body"),up.replace(n,e,t)},follow=function(e,t){var n,r,o;return n=$(e),t=u.options(t),o=u.option(n.attr("up-href"),n.attr("href")),r=u.option(t.target,n.attr("up-target"),"body"),t.transition=u.option(t.transition,u.castedAttr(n,"up-transition"),u.castedAttr(n,"up-animation")),t.history=u.option(t.history,u.castedAttr(n,"up-history")),t.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),t.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),t.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),t.method=followMethod(n,t),t.origin=u.option(t.origin,n),t=u.merge(t,up.motion.animateOptions(t,n)),up.replace(r,o,t)},followMethod=function(e,t){var n;return n=$(e),t=u.options(t),u.option(t.method,n.attr("up-method"),n.attr("data-method"),"get").toUpperCase()},up.on("click","a[up-target], [up-href][up-target]",function(e,t){return shouldProcessLinkEvent(e,t)?t.is("[up-instant]")?e.preventDefault():(e.preventDefault(),follow(t)):void 0}),up.on("mousedown","a[up-instant], [up-href][up-instant]",function(e,t){return shouldProcessLinkEvent(e,t)?(e.preventDefault(),follow(t)):void 0}),childClicked=function(e,t){var n,r;return n=$(e.target),r=n.closest("a, [up-href]"),r.length&&t.find(r).length},shouldProcessLinkEvent=function(e,t){return u.isUnmodifiedMouseEvent(e)&&!childClicked(e,t)},makeFollowable=function(e){var t;return t=$(e),u.isMissing(t.attr("up-target"))&&u.isMissing(t.attr("up-follow"))?t.attr("up-follow",""):void 0},up.on("click","a[up-follow], [up-href][up-follow]",function(e,t){return shouldProcessLinkEvent(e,t)?t.is("[up-instant]")?e.preventDefault():(e.preventDefault(),follow(t)):void 0}),up.compiler("[up-expand]",function(e){var t,n,r,o,i,a,s,l;for(o=e.find("a, [up-href]").get(0),o||u.error("No link to expand within %o",e),l=/^up-/,a={},a["up-href"]=$(o).attr("href"),s=o.attributes,n=0,r=s.length;r>n;n++)t=s[n],i=t.name,i.match(l)&&(a[i]=t.value);return u.setMissingAttrs(e,a),e.removeAttr("up-expand"),makeFollowable(e)}),up.compiler("[up-dash]",function(e){var t,n;return n=u.castedAttr(e,"up-dash"),t={"up-preload":"true","up-instant":"true"},n===!0?t["up-follow"]="":t["up-target"]=n,u.setMissingAttrs(e,t),e.removeAttr("up-dash")}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,makeFollowable:makeFollowable,childClicked:childClicked,followMethod:followMethod}}(jQuery),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){var slice=[].slice;up.form=function($){var autosubmit,config,observe,observeForm,reset,resolveValidateTarget,submit,u,validate;return u=up.util,config=u.config({validateTargets:["[up-fieldset]:has(&)","fieldset:has(&)","label:has(&)","form:has(&)"],fields:[":input"],observeDelay:0}),reset=function(){return config.reset()},submit=function(e,t){var n,r,o,i,a,s,l,c,p,f,d,m,h,v;return n=$(e).closest("form"),t=u.options(t),f=u.option(t.target,n.attr("up-target"),"body"),f=up.flow.resolveSelector(f,t),r=u.option(t.failTarget,n.attr("up-fail-target"))||u.selectorForElement(n),r=up.flow.resolveSelector(r,t),s=u.option(t.history,u.castedAttr(n,"up-history"),!0),d=u.option(t.transition,u.castedAttr(n,"up-transition")),o=u.option(t.failTransition,u.castedAttr(n,"up-fail-transition"),d),l=u.option(t.method,n.attr("up-method"),n.attr("data-method"),n.attr("method"),"post").toUpperCase(),a=u.option(t.headers,{}),c={},c.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),c.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),c.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),c.origin=u.option(t.origin,n),c=u.extend(c,up.motion.animateOptions(t,n)),v=u.option(t.cache,u.castedAttr(n,"up-cache")),h=u.option(t.url,n.attr("action"),up.browser.url()),i=n.find("input[type=file]").length,t.validate&&(a["X-Up-Validate"]=t.validate,i)?u.unresolvablePromise():(n.addClass("up-active"),i||!up.browser.canPushState()&&s!==!1?(n.get(0).submit(),u.unresolvablePromise()):(p={url:h,method:l,data:n.serialize(),selector:f,cache:v,headers:a},m=function(e){var t;return h=void 0,u.isGiven(s)&&(s===!1||u.isString(s)?h=s:(t=u.locationFromXhr(e))?h=t:"GET"===p.type&&(h=p.url+"?"+p.data)),u.option(h,!1)},up.proxy.ajax(p).always(function(){return n.removeClass("up-active")}).done(function(e,t,n){var r;return r=u.merge(c,{history:m(n),transition:d}),up.flow.implant(f,e,r)}).fail(function(e){var t,n;return n=e.responseText,t=u.merge(c,{transition:o}),up.flow.implant(r,n,t)})))},observe=function(){var $element,args,callback,callbackArg,callbackPromise,callbackTimer,changeEvents,check,clearTimer,delay,knownValue,nextCallback,options,rawCallback,runNextCallback,selectorOrElement;return selectorOrElement=arguments[0],args=2<=arguments.length?slice.call(arguments,1):[],options={},callbackArg=void 0,1===args.length&&(callbackArg=args[0]),args.length>1&&(options=u.options(args[0]),callbackArg=args[1]),$element=$(selectorOrElement),options=u.options(options),delay=u.option($element.attr("up-delay"),options.delay,config.observeDelay),delay=parseInt(delay),callback=null,u.isGiven(options.change)&&up.error("up.observe now takes the change callback as the last argument"),rawCallback=u.option(u.presentAttr($element,"op-observe"),callbackArg),callback=u.isString(rawCallback)?function(value,$field){return eval(rawCallback)}:rawCallback||u.error("up.observe: No change callback given"),$element.is("form")?observeForm($element,options,callback):(knownValue=null,callbackTimer=null,callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var e;return nextCallback?(e=nextCallback(),nextCallback=null,e):void 0},check=function(){var e,t;return t=$element.val(),e=u.isNull(knownValue),knownValue===t||(knownValue=t,e)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($element.get(0),[t,$element])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var e;return e=runNextCallback(),callbackPromise=u.isPromise(e)?e:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$element.on(changeEvents,check),check(),function(){return $element.off(changeEvents,check),clearTimer()})},observeForm=function(e,t,n){var r,o;return r=u.multiSelector(config.fields).find(e),o=u.map(r,function(e){return observe(e,n)}),function(){var e,t,n,r;for(r=[],t=0,n=o.length;n>t;t++)e=o[t],r.push(e());return r}},autosubmit=function(e,t){return console.log("autosubmit %o",e),observe(e,t,function(e,t){var n;return n=t.closest("form"),t.addClass("up-active"),submit(n).always(function(){return t.removeClass("up-active")})})},resolveValidateTarget=function(e,t){var n;return n=u.option(t.target,e.attr("up-validate")),u.isBlank(n)&&(n||(n=u.detect(config.validateTargets,function(n){var r;return r=up.flow.resolveSelector(n,t),e.closest(r).length}))),u.isBlank(n)&&error("Could not find default validation target for %o (tried ancestors %o)",e,config.validateTargets),u.isString(n)||(n=u.selectorForElement(n)),n},validate=function(e,t){var n,r,o;return n=$(e),t=u.options(t),t.origin=n,t.target=resolveValidateTarget(n,t),t.failTarget=t.target,t.history=!1,t.headers=u.option(t.headers,{}),t.validate=n.attr("name")||"__none__",t=u.merge(t,up.motion.animateOptions(t,n)),r=n.closest("form"),o=up.submit(r,t)},up.on("submit","form[up-target]",function(e,t){return e.preventDefault(),submit(t)}),up.on("change","[up-validate]",function(e,t){return validate(t)}),up.compiler("[up-observe]",function(e){return observe(e)}),up.compiler("[up-autosubmit]",function(e){return autosubmit(e)}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),config:config,submit:submit,observe:observe,validate:validate}}(jQuery),up.submit=up.form.submit,up.observe=up.form.observe,up.autosubmit=up.form.autosubmit,up.validate=up.form.validate}.call(this),function(){up.popup=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h;return m=up.util,s=void 0,i=function(){var t;return t=e(".up-popup"),t.attr("up-covered-url")},o=m.config({openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right",history:!1}),f=function(){return r(),o.reset()},d=function(e,t,n){var r,o;return o=m.measure(e,{full:!0}),r=function(){switch(n){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.top+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return m.error("Unknown position %o",n)}}(),t.attr("up-position",n),t.css(r),c(t)},c=function(e){var t,n,r,o,u,i,a;if(n=m.measure(e,{full:!0}),r=null,o=null,n.right<0&&(r=-n.right),n.bottom<0&&(o=-n.bottom),n.left<0&&(r=n.left),n.top<0&&(o=n.top),r&&((u=parseInt(e.css("left")))?e.css("left",u-r):(i=parseInt(e.css("right")))&&e.css("right",i+r)),o){if(a=parseInt(e.css("top")))return e.css("top",a-o);if(t=parseInt(e.css("bottom")))return e.css("bottom",t+o)}},p=function(){var t;return t=e(".up-popup"),t.attr("up-covered-url",up.browser.url()),t.attr("up-covered-title",document.title)},l=function(){var t;return t=e(".up-popup"),t.removeAttr("up-covered-url"),t.removeAttr("up-covered-title")},a=function(e,t,n){var r,o;return o=m.$createElementFromSelector(".up-popup"),n&&o.attr("up-sticky",""),r=m.$createElementFromSelector(t),r.appendTo(o),o.appendTo(document.body),p(),o.hide(),o},h=function(t,n,r,o){var u,i;return u=e(".up-popup"),u.is(":hidden")?(u.show(),d(t,u,n),i=up.animate(u,r,o),i.then(function(){return up.emit("up:popup:opened")})):void 0},t=function(t,n){var u,i,s,l,c,p,f,d,v;return u=e(t),u.length||m.error("Cannot attach popup to non-existing element %o",t),n=m.options(n),v=m.option(n.url,u.attr("href")),f=m.option(n.target,u.attr("up-popup"),"body"),c=m.option(n.position,u.attr("up-position"),o.position),s=m.option(n.animation,u.attr("up-animation"),o.openAnimation),d=m.option(n.sticky,m.castedAttr(u,"up-sticky")),l=up.browser.canPushState()?m.option(n.history,m.castedAttr(u,"up-history"),o.history):!1,i=up.motion.animateOptions(n,u),r(),up.bus.nobodyPrevents("up:popup:open",{url:v})?(a(u,f,d),p=up.replace(f,v,{history:l,requireMatch:!1}),p.then(function(){return h(u,c,s,i)}),p):m.unresolvableDeferred()},r=function(t){var n,r;return n=e(".up-popup"),n.length?up.bus.nobodyPrevents("up:popup:close",{$element:n})?(t=m.options(t,{animation:o.closeAnimation,url:n.attr("up-covered-url"),title:n.attr("up-covered-title")}),s=void 0,r=up.destroy(n,t),r.then(function(){return up.emit("up:popup:closed")}),r):m.unresolvableDeferred():m.resolvedDeferred()},n=function(){return e(".up-popup").is("[up-sticky]")?void 0:(l(),r())},u=function(t){var n;return n=e(t),n.closest(".up-popup").length>0},up.on("click","a[up-popup]",function(e,n){return e.preventDefault(),n.is(".up-current")?r():t(n)}),up.on("click","body",function(t){var n;return n=e(t.target),n.closest(".up-popup").length||n.closest("[up-popup]").length?void 0:r()}),up.on("up:fragment:inserted",function(e,t){var r;if(u(t)){if(r=t.attr("up-source"))return s=r}else if(u(e.origin))return n()}),up.bus.onEscape(function(){return r()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-popup").length?(r(),e.preventDefault()):void 0}),up.on("up:framework:reset",f),{attach:t,close:r,url:function(){return s},coveredUrl:i,config:o,defaults:function(){return m.error("up.popup.defaults(...) no longer exists. Set values on he up.popup.config property instead.")},contains:u,open:function(){return up.error("up.popup.open no longer exists. Please use up.popup.attach instead.")},source:function(){return up.error("up.popup.source no longer exists. Please use up.popup.url instead.")}}}(jQuery)}.call(this),function(){up.modal=function($){var autoclose,close,config,contains,coveredUrl,createHiddenModal,currentUrl,discardHistory,follow,open,rememberHistory,reset,shiftElements,templateHtml,u,unshiftElements,updated,visit;return u=up.util,config=u.config({maxWidth:null,minWidth:null,width:null,height:null,history:!0,openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"\xd7",template:function(e){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+e.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}}),currentUrl=void 0,coveredUrl=function(){var e;return e=$(".up-modal"),e.attr("up-covered-url")},reset=function(){return close(),currentUrl=void 0,config.reset()},templateHtml=function(){var e;return e=config.template,u.isFunction(e)?e(config):e},rememberHistory=function(){var e;return e=$(".up-modal"),e.attr("up-covered-url",up.browser.url()),e.attr("up-covered-title",document.title)},discardHistory=function(){var e;return e=$(".up-modal"),e.removeAttr("up-covered-url"),e.removeAttr("up-covered-title")},createHiddenModal=function(e){var t,n,r,o;return r=$(templateHtml()),e.sticky&&r.attr("up-sticky",""),r.attr("up-covered-url",up.browser.url()),r.attr("up-covered-title",document.title),n=r.find(".up-modal-dialog"),u.isPresent(e.width)&&n.css("width",e.width),u.isPresent(e.maxWidth)&&n.css("max-width",e.maxWidth),u.isPresent(e.height)&&n.css("height",e.height),t=r.find(".up-modal-content"),o=u.$createElementFromSelector(e.selector),o.appendTo(t),r.appendTo(document.body),rememberHistory(),r.hide(),r},unshiftElements=[],shiftElements=function(){var e,t,n,r;return n=u.scrollbarWidth(),e=parseInt($("body").css("padding-right")),t=n+e,r=u.temporaryCss($("body"),{"padding-right":t+"px","overflow-y":"hidden"}),unshiftElements.push(r),up.layout.anchoredRight().each(function(){var e,t,r,o;return e=$(this),t=parseInt(e.css("right")),r=n+t,o=u.temporaryCss(e,{right:r}),unshiftElements.push(o)})},updated=function(e,t){var n,r;return n=$(".up-modal"),n.is(":hidden")?(shiftElements(),n.show(),r=up.animate(n,e,t),r.then(function(){return up.emit("up:modal:opened")})):void 0},follow=function(e,t){return t=u.options(t),t.$link=$(e),open(t)},visit=function(e,t){return t=u.options(t),t.url=e,open(t)},open=function(e){var t,n,r,o,i,a,s,l,c,p,f;return e=u.options(e),t=u.option(e.$link,u.nullJQuery()),p=u.option(e.url,t.attr("up-href"),t.attr("href")),l=u.option(e.target,t.attr("up-modal"),"body"),f=u.option(e.width,t.attr("up-width"),config.width),a=u.option(e.maxWidth,t.attr("up-max-width"),config.maxWidth),o=u.option(e.height,t.attr("up-height"),config.height),r=u.option(e.animation,t.attr("up-animation"),config.openAnimation),c=u.option(e.sticky,u.castedAttr(t,"up-sticky")),i=up.browser.canPushState()?u.option(e.history,u.castedAttr(t,"up-history"),config.history):!1,n=up.motion.animateOptions(e,t),close(),up.bus.nobodyPrevents("up:modal:open",{url:p})?(createHiddenModal({selector:l,width:f,maxWidth:a,height:o,sticky:c}),s=up.replace(l,p,{history:i,requireMatch:!1}),s.then(function(){return updated(r,n)}),s):u.unresolvableDeferred()},close=function(e){var t,n;return t=$(".up-modal"),t.length?up.bus.nobodyPrevents("up:modal:close",{$element:t})?(e=u.options(e,{animation:config.closeAnimation,url:t.attr("up-covered-url"),title:t.attr("up-covered-title")}),currentUrl=void 0,n=up.destroy(t,e),n.then(function(){for(var e;e=unshiftElements.pop();)e();return up.emit("up:modal:closed")}),n):u.unresolvableDeferred():u.resolvedDeferred()},autoclose=function(){return $(".up-modal").is("[up-sticky]")?void 0:(discardHistory(),close())},contains=function(e){var t;return t=$(e),t.closest(".up-modal").length>0},up.on("click","a[up-modal]",function(e,t){return e.preventDefault(),t.is(".up-current")?close():follow(t)}),up.on("click","body",function(e){var t;return t=$(e.target),t.closest(".up-modal-dialog").length||t.closest("[up-modal]").length?void 0:close()}),up.on("up:fragment:inserted",function(e,t){var n;if(contains(t)){if(n=t.attr("up-source"))return currentUrl=n}else if(!up.popup.contains(t)&&contains(e.origin))return autoclose()}),up.bus.onEscape(function(){return close()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-modal").length?(close(),e.preventDefault()):void 0}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,open:function(){return up.error("up.modal.open no longer exists. Please use either up.modal.follow or up.modal.visit.")},close:close,url:function(){return currentUrl},coveredUrl:coveredUrl,config:config,defaults:function(){return u.error("up.modal.defaults(...) no longer exists. Set values on he up.modal.config property instead.")},contains:contains,source:function(){return up.error("up.popup.source no longer exists. Please use up.popup.url instead.")}}}(jQuery)}.call(this),function(){up.tooltip=function(e){var t,n,r,o,u,i,a;return a=up.util,r=a.config({position:"top",openAnimation:"fade-in",closeAnimation:"fade-out"}),u=function(){return r.reset()},i=function(e,t,n){var r,o,u;return o=a.measure(e),u=a.measure(t),r=function(){switch(n){case"top":return{left:o.left+.5*(o.width-u.width),top:o.top-u.height};case"bottom":return{left:o.left+.5*(o.width-u.width),top:o.top+o.height};default:return a.error("Unknown position %o",n)}}(),t.attr("up-position",n),t.css(r)},o=function(e){var t;return t=a.$createElementFromSelector(".up-tooltip"),a.isGiven(e.text)?t.text(e.text):t.html(e.html),t.appendTo(document.body),t},t=function(t,u){var s,l,c,p,f,d,m;return null==u&&(u={}),s=e(t),f=a.option(u.html,s.attr("up-tooltip-html")),m=a.option(u.text,s.attr("up-tooltip")),d=a.option(u.position,s.attr("up-position"),r.position),p=a.option(u.animation,a.castedAttr(s,"up-animation"),r.openAnimation),c=up.motion.animateOptions(u,s),n(),l=o({text:m,html:f}),i(s,l,d),up.animate(l,p,c)},n=function(t){var n;return n=e(".up-tooltip"),n.length?(t=a.options(t,{animation:r.closeAnimation}),t=a.merge(t,up.motion.animateOptions(t)),up.destroy(n,t)):void 0},up.compiler("[up-tooltip], [up-tooltip-html]",function(e){return e.on("mouseover",function(){return t(e)}),e.on("mouseout",function(){return n()})}),up.on("click","body",function(){return n()}),up.on("up:framework:reset",n),up.bus.onEscape(function(){return n()}),up.on("up:framework:reset",u),{attach:t,close:n,open:function(){return a.error("up.tooltip.open no longer exists. Use up.tooltip.attach instead.")}}}(jQuery)}.call(this),function(){up.navigation=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return h=up.util,i=h.config({currentClasses:["up-current"]}),p=function(){return i.reset()},a=function(){var e;return e=i.currentClasses,e=e.concat(["up-current"]),e=h.uniq(e),e.join(" ")},t="up-active",n=["a","[up-href]","[up-alias]"],o=n.join(", "),u=function(){var e,t,r;for(r=[],e=0,t=n.length;t>e;e++)m=n[e],r.push(m+"[up-instant]");return r}().join(", "),r="."+t,c=function(e){return h.isPresent(e)?h.normalizeUrl(e,{search:!1,stripTrailingSlash:!0}):void 0},d=function(e){var t,n,r,o,u,i,a,s,l,p;for(s=[],i=["href","up-href","up-alias"],n=0,o=i.length;o>n;n++)if(t=i[n],l=h.presentAttr(e,t))for(p="up-alias"===t?l.split(" "):[l],r=0,u=p.length;u>r;r++)a=p[r],"#"!==a&&(a=c(a),s.push(a));return s},g=function(e){var t,n,r,o;return e=h.compact(e),r=function(e){return"*"===e.substr(-1)?n(e.slice(0,-1)):t(e)},t=function(t){return h.contains(e,t)},n=function(t){return h.detect(e,function(e){return 0===e.indexOf(t)})},o=function(e){return h.detect(e,r)},{matchesAny:o}},l=function(){var t,n;return t=g([c(up.browser.url()),c(up.modal.url()),c(up.modal.coveredUrl()),c(up.popup.url()),c(up.popup.coveredUrl())]),n=a(),h.each(e(o),function(r){var o,u;return o=e(r),u=d(o),t.matchesAny(u)?o.addClass(n):o.hasClass(n)&&0===o.closest(".up-destroying").length?o.removeClass(n):void 0})},f=function(e){return v(),e=s(e),e.addClass(t)},s=function(e){return h.presence(e.parents(o))||e},v=function(){return e(r).removeClass(t)},up.on("click",o,function(e,t){return h.isUnmodifiedMouseEvent(e)&&!t.is("[up-instant]")?f(t):void 0}),up.on("mousedown",u,function(e,t){return h.isUnmodifiedMouseEvent(e)?f(t):void 0}),up.on("up:fragment:inserted",function(){return v(),l()}),up.on("up:fragment:destroyed",function(e,t){return t.is(".up-modal, .up-popup")?l():void 0}),up.on("up:framework:reset",p),{config:i,defaults:function(){return h.error("up.navigation.defaults(...) no longer exists. Set values on he up.navigation.config property instead.")}}}(jQuery)}.call(this),function(){up.boot()}.call(this);
1
+ (function(){window.up={}}).call(this),function(){var e=[].slice;up.util=function(t){var n,r,o,u,i,a,l,s,c,p,f,d,m,h,v,g,y,b,w,k,x,S,C,$,T,E,P,A,U,O,D,j,F,M,R,z,H,L,W,I,V,K,_,Q,q,N,X,B,G,J,Y,Z,et,tt,nt,rt,ot,ut,it,at,lt,st,ct,pt,ft,dt,mt,ht,vt,gt,yt,bt,wt,kt,xt,St,Ct,$t,Tt,Et,Pt,At,Ut,Ot,Dt,jt;return Z=function(t){var n,r;return n=void 0,r=!1,function(){var o;return o=1<=arguments.length?e.call(arguments,0):[],r?n:(r=!0,n=t.apply(null,o))}},u=function(e){return e=d(e),e.selector&&(e.headers||(e.headers={}),e.headers["X-Up-Selector"]=e.selector),t.ajax(e)},_=function(e,t){return t=t.toString(),(""===t||"80"===t)&&"http:"===e||"443"===t&&"https:"===e},ut=function(e,t){var n,r,o;return n=ft(e),r=n.protocol+"//"+n.hostname,_(n.protocol,n.port)||(r+=":"+n.port),o=n.pathname,"/"!==o[0]&&(o="/"+o),(null!=t?t.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=t?t.hash:void 0)===!0&&(r+=n.hash),(null!=t?t.search:void 0)!==!1&&(r+=n.search),r},ft=function(e){var n;return n=null,Q(e)?(n=t("<a>").attr({href:e}).get(0),U(n.hostname)&&(n.href=n.href)):n=Pt(e),n},ot=function(e){return e?e.toUpperCase():"GET"},n=function(e){var n,r,o,u,i,a,l,s,c,p,f,d,m,h,v,g;for(v=e.split(/[ >]/),o=null,p=f=0,m=v.length;m>f;p=++f){for(a=v[p],i=a.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),g="div",u=[],c=null,d=0,h=i.length;h>d;d++)switch(l=i[d],l[0]){case".":u.push(l.substr(1));break;case"#":c=l.substr(1);break;default:g=l}s="<"+g,u.length&&(s+=' class="'+u.join(" ")+'"'),c&&(s+=' id="'+c+'"'),s+=">",n=t(s),r&&n.appendTo(r),0===p&&(o=n),r=n}return o},h=function(e,t){var n;return n=document.createElement(e),V(t)&&(n.innerHTML=t),n},y=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n="[UP] "+n,(r=up.browser).puts.apply(r,["debug",n].concat(e.call(t)))},jt=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n="[UP] "+n,(r=up.browser).puts.apply(r,["warn",n].concat(e.call(t)))},k=function(){var n,r,o,u;throw r=1<=arguments.length?e.call(arguments,0):[],r[0]="[UP] "+r[0],(u=up.browser).puts.apply(u,["error"].concat(e.call(r))),o=S.apply(null,r),n=dt(t(".up-error"))||t('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(o),new Error(o)},o=/\%[odisf]/g,S=function(){var t,n,r,u;return t=1<=arguments.length?e.call(arguments,0):[],u=t[0],n=0,r=80,u.replace(o,function(){var e,o;return n+=1,e=t[n],o=typeof e,"string"===o?(e=e.replace(/\s+/g," "),e.length>r&&(e=e.substr(0,r)+"\u2026"),e='"'+e+'"'):e="undefined"===o?"undefined":"number"===o||"function"===o?e.toString():JSON.stringify(e),e.length>r&&(e=e.substr(0,r)+" \u2026",("object"===o||"function"===o)&&(e+=" }")),e})},kt=function(e){var n,r,o,u,i,a,l,s,c,p;if(n=t(e),c=void 0,y("Creating selector from element %o",n.get(0)),p=dt(n.attr("up-id")))c="[up-id='"+p+"']";else if(u=dt(n.attr("id")))c="#"+u;else if(s=dt(n.attr("name")))c="[name='"+s+"']";else if(r=dt(n.attr("class")))for(o=r.split(" "),c="",i=0,l=o.length;l>i;i++)a=o[i],c+="."+a;else c=n.prop("tagName").toLowerCase();return c},v=function(e){var t,n,r,o,u,i,a,l,s,c,p,f;return s=function(e){return"<"+e+"(?: [^>]*)?>"},i=function(e){return"</"+e+">"},t="(?:.|\\n)*?",u=function(e){return"("+e+")"},f=new RegExp(s("head")+t+s("title")+u(t)+i("title")+t+i("body"),"i"),o=new RegExp(s("body")+u(t)+i("body"),"i"),(r=e.match(o))?(l=document.createElement("html"),n=h("body",r[1]),l.appendChild(n),(p=e.match(f))&&(a=h("head"),l.appendChild(a),c=h("title",p[1]),a.appendChild(c)),l):h("div",e)},C=t.extend,Et=t.trim,w=function(e,t){var n,r,o,u,i;for(i=[],n=o=0,u=e.length;u>o;n=++o)r=e[n],i.push(t(r,n));return i},J=w,Ct=function(e,t){var n,r,o,u;for(u=[],n=r=0,o=e-1;o>=0?o>=r:r>=o;n=o>=0?++r:--r)u.push(t(n));return u},L=function(e){return null===e},q=function(e){return void 0===e},D=function(e){return!q(e)},H=function(e){return q(e)||L(e)},M=function(e){return!H(e)},U=function(e){return H(e)||I(e)&&0===Object.keys(e).length||0===e.length},dt=function(e,t){return null==t&&(t=V),t(e)?e:void 0},V=function(e){return!U(e)},F=function(e){return"function"==typeof e},Q=function(e){return"string"==typeof e},W=function(e){return"number"==typeof e},R=function(e){return"object"==typeof e&&!!e},I=function(e){return R(e)||"function"==typeof e},j=function(e){return!(!e||1!==e.nodeType)},z=function(e){return e instanceof jQuery},K=function(e){return I(e)&&F(e.then)},O=function(e){return K(e)&&F(e.resolve)},A=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Tt=function(e){return Array.prototype.slice.call(e)},d=function(e){return A(e)?e.slice():C({},e)},Pt=function(e){return z(e)?e.get(0):e},et=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],C.apply(null,[{}].concat(e.call(t)))},pt=function(e,t){var n,r,o,u;if(o=e?d(e):{},t)for(r in t)n=t[r],u=o[r],M(u)?I(n)&&I(u)&&(o[r]=pt(u,n)):o[r]=n;return o},ct=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],b(t,M)},b=function(e,t){var n,r,o,u;for(u=void 0,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=n;break}return u},i=function(e,t){var n,r,o,u;for(u=!1,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=!0;break}return u},c=function(e){return wt(e,M)},At=function(e){var t;return t={},wt(e,function(e){return t.hasOwnProperty(e)?!1:t[e]=!0})},wt=function(e,t){var n;return n=[],w(e,function(e){return t(e)?n.push(e):void 0}),n},mt=function(){var t,n,r,o;return t=arguments[0],r=2<=arguments.length?e.call(arguments,1):[],o=function(){var e,o,u;for(u=[],e=0,o=r.length;o>e;e++)n=r[e],u.push(t.attr(n));return u}(),b(o,V)},rt=function(e){return setTimeout(e,0)},B=function(e){return e[e.length-1]},s=function(){var e;return e=document.documentElement,{width:e.clientWidth,height:e.clientHeight}},bt=Z(function(){var e,n,r;return e=t("<div>").css({position:"absolute",top:"0",left:"0",width:"50px",height:"50px",overflowY:"scroll"}),e.appendTo(document.body),n=e.get(0),r=n.offsetWidth-n.clientWidth,e.remove(),r}),lt=function(t){var n;return n=void 0,function(){var r;return r=1<=arguments.length?e.call(arguments,0):[],null!=t&&(n=t.apply(null,r)),t=void 0,n}},St=function(e,t,n){var r,o;return o=e.css(Object.keys(t)),e.css(t),r=function(){return e.css(o)},n?(n(),r()):lt(r)},P=function(e){var t,n;return n=e.css(["transform","-webkit-transform"]),U(n)||"none"===n.transform?(t=function(){return e.css(n)},e.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):t=function(){},t},g=function(e,n,o){var u,i,a,l,s,c;return u=t(e),o=pt(o,{duration:300,delay:0,easing:"ease"}),i=t.Deferred(),l={"transition-property":Object.keys(n).join(", "),"transition-duration":o.duration+"ms","transition-delay":o.delay+"ms","transition-timing-function":o.easing},s=P(u),c=St(u,l),u.css(n),i.then(s),i.then(c),u.data(r,i),i.then(function(){return u.removeData(r)}),a=setTimeout(function(){return i.resolve()},o.duration+o.delay),i.then(function(){return clearTimeout(a)}),i},r="up-animation-promise",T=function(e){return t(e).each(function(){var e;return(e=t(this).data(r))?e.resolve():void 0})},Y=function(e,n){var r,o,u,i,a,l;return n=pt(n,{relative:!1,inner:!1,full:!1}),n.relative?n.relative===!0?i=e.position():(r=t(n.relative),a=e.offset(),r.is(document)?i=a:(u=r.offset(),i={left:a.left-u.left,top:a.top-u.top})):i=e.offset(),o={left:i.left,top:i.top},n.inner?(o.width=e.width(),o.height=e.height()):(o.width=e.outerWidth(),o.height=e.outerHeight()),n.full&&(l=s(),o.right=l.width-(o.left+o.width),o.bottom=l.height-(o.top+o.height)),o},m=function(e,t){var n,r,o,u,i;for(u=e.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)n=u[r],i.push(n.specified?t.attr(n.name,n.value):void 0);return i},$=function(e,t){return e.find(t).addBack(t)},x=function(e){return 27===e.keyCode},f=function(e,t){return e.indexOf(t)>=0},l=function(e,t){var n;switch(n=e.attr(t)){case"false":return!1;case"true":return!0;case"":return!0;default:return n}},G=function(e){return e.getResponseHeader("X-Up-Location")},$t=function(e){return e.getResponseHeader("X-Up-Title")},tt=function(e){return e.getResponseHeader("X-Up-Method")},st=function(){var t,n,r,o,u,i;for(o=arguments[0],u=2<=arguments.length?e.call(arguments,1):[],t={},n=0,r=u.length;r>n;n++)i=u[n],o.hasOwnProperty(i)&&(t[i]=o[i]);return t},N=function(e){return!(e.metaKey||e.shiftKey||e.ctrlKey)},X=function(e){var t;return t=q(e.button)||0===e.button,t&&N(e)},gt=function(){var e;return e=t.Deferred(),e.resolve(),e},yt=function(){return gt().promise()},Ut=function(){return t.Deferred()},Ot=function(){return Ut().promise()},it=function(){return t()},vt=function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],r=t.when.apply(t,n),r.resolve=function(){return w(n,function(e){return"function"==typeof e.resolve?e.resolve():void 0})},r},xt=function(e,t){var n,r,o;r=[];for(n in t)o=t[n],r.push(H(e.attr(n))?e.attr(n,o):void 0);return r},ht=function(e,t){var n;return n=e.indexOf(t),n>=0?(e.splice(n,1),t):void 0},nt=function(e){var n,r,o,u,a,l,s;for(a={},s=[],r=[],o=0,u=e.length;u>o;o++)l=e[o],Q(l)?s.push(l):r.push(l);return a.parsed=r,s.length&&(n=s.join(", "),a.parsed.push(n)),a.select=function(){return a.find(void 0)},a.find=function(e){var n,r,o,u,i,l;for(r=it(),i=a.parsed,o=0,u=i.length;u>o;o++)l=i[o],n=e?e.find(l):t(l),r=r.add(n);return r},a.findWithSelf=function(e){var t;return t=a.find(e),a.doesMatch(e)&&(t=t.add(e)),t},a.doesMatch=function(e){var n;return n=t(e),i(a.parsed,function(e){return n.is(e)})},a.seekUp=function(e){var n,r,o;for(o=t(e),n=o,r=void 0;n.length;){if(a.doesMatch(n)){r=n;break}n=n.parent()}return r||it()},a},a=function(t){var n,r,o,u,i,a,l,s,c,p,f,m;return null==t&&(t={}),f=void 0,r=function(){return f={}},r(),l=function(){var n;return n=1<=arguments.length?e.call(arguments,0):[],t.log?(n[0]="["+t.log+"] "+n[0],y.apply(null,n)):void 0},a=function(){return Object.keys(f)},s=function(){return H(t.size)?void 0:F(t.size)?t.size():W(t.size)?t.size:k("Invalid size config: %o",t.size)},o=function(){return H(t.expiry)?void 0:F(t.expiry)?t.expiry():W(t.expiry)?t.expiry:k("Invalid expiry config: %o",t.expiry)},c=function(e){return t.key?t.key(e):e.toString()},Et=function(){var e,t,n,r;return r=d(a()),n=s(),n&&r.length>n&&(e=null,t=null,w(r,function(n){var r,o;return r=f[n],o=r.timestamp,!t||t>o?(e=n,t=o):void 0}),e)?delete f[e]:void 0},n=function(e,t){var n;return n=u(e),D(n)?p(t,n):void 0},m=function(){return(new Date).valueOf()},p=function(e,t){var n;return n=c(e),f[n]={timestamp:m(),value:t}},ht=function(e){var t;return t=c(e),delete f[t]},i=function(e){var t,n;return t=o(),t?(n=m()-e.timestamp,n<o()):!0},u=function(e,t){var n,r;return null==t&&(t=void 0),r=c(e),(n=f[r])?i(n)?(l("Cache hit for %o",e),n.value):(l("Discarding stale cache entry for %o",e),ht(e),t):(l("Cache miss for %o",e),t)},{alias:n,get:u,set:p,remove:ht,clear:r,keys:a}},p=function(e){var t;return null==e&&(e={}),t={},t.reset=function(){return C(t,e)},t.reset(),Object.preventExtensions(t),t},Dt=function(e){var t,n;return e=Pt(e),t=e.parentNode,n=Tt(e.childNodes),w(n,function(n){return t.insertBefore(n,e)}),t.removeChild(e)},at=function(e){var t,n;for(t=void 0;(e=e.parent())&&e.length;)if(n=e.css("position"),"absolute"===n||"relative"===n||e.is("body")){t=e;break}return t},E=function(e,n){var r,o,u,i;return r=t(e),o=at(r),u=r.position(),i=o.offset(),r.css({position:"absolute",left:u.left-i.left,top:u.top-i.top+n.scrollTop(),right:"",bottom:""})},{offsetParent:at,fixedToAbsolute:E,presentAttr:mt,createElement:h,parseUrl:ft,normalizeUrl:ut,normalizeMethod:ot,createElementFromHtml:v,$createElementFromSelector:n,selectorForElement:kt,ajax:u,extend:C,copy:d,merge:et,options:pt,option:ct,error:k,debug:y,warn:jt,each:w,map:J,times:Ct,any:i,detect:b,select:wt,compact:c,uniq:At,last:B,isNull:L,isDefined:D,isUndefined:q,isGiven:M,isMissing:H,isPresent:V,isBlank:U,presence:dt,isObject:I,isFunction:F,isString:Q,isElement:j,isJQuery:z,isPromise:K,isDeferred:O,isHash:R,isUnmodifiedKeyEvent:N,isUnmodifiedMouseEvent:X,nullJQuery:it,unJQuery:Pt,nextFrame:rt,measure:Y,temporaryCss:St,cssAnimate:g,finishCssAnimate:T,forceCompositing:P,escapePressed:x,copyAttributes:m,findWithSelf:$,contains:f,isArray:A,toArray:Tt,castedAttr:l,locationFromXhr:G,titleFromXhr:$t,methodFromXhr:tt,clientSize:s,only:st,trim:Et,unresolvableDeferred:Ut,unresolvablePromise:Ot,resolvedPromise:yt,resolvedDeferred:gt,resolvableWhen:vt,setMissingAttrs:xt,remove:ht,memoize:Z,scrollbarWidth:bt,config:p,cache:a,unwrapElement:Dt,multiSelector:nt,evalConsoleTemplate:S}}($),up.error=up.util.error,up.warn=up.util.warn,up.debug=up.util.debug}.call(this),function(){var e=[].slice;up.browser=function(t){var n,r,o,u,i,a,l,s,c,p,f,d,m,h;return m=up.util,p=function(e,n){var r,o,u,i,a,l;return null==n&&(n={}),a=m.option(n.method,"get").toLowerCase(),"get"===a?location.href=e:t.rails?(l=n.target,u=t.rails.csrfToken(),o=t.rails.csrfParam(),r=t("<form method='post' action='"+e+"'></form>"),i="<input name='_method' value='"+a+"' type='hidden' />",m.isDefined(o)&&m.isDefined(u)&&(i+="<input name='"+o+"' value='"+u+"' type='hidden' />"),l&&r.attr("target",l),r.hide().append(i).appendTo("body"),r.submit()):error("Can't fake a "+a.toUpperCase()+" request without Rails UJS")},d=function(){var t,n,r;return r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],m.isDefined(console[r])||(r="log"),o()?console[r].apply(console,t):(n=m.evalConsoleTemplate.apply(m,t),console[r](n))},h=function(){return location.href},a=m.memoize(function(){return m.isUndefined(document.addEventListener)}),l=m.memoize(function(){return a()||-1!==navigator.appVersion.indexOf("MSIE 9.")}),u=m.memoize(function(){return m.isDefined(history.pushState)&&"get"===i()}),n=m.memoize(function(){return"transition"in document.documentElement.style}),r=m.memoize(function(){return"oninput"in document.createElement("input")}),o=m.memoize(function(){return!l()}),s=m.memoize(function(){var e,n,r,o;return o=t.fn.jquery,r=o.split("."),e=parseInt(r[0]),n=parseInt(r[1]),e>=2||1===e&&n>=9}),f=function(e){var t,n;return n=null!=(t=document.cookie.match(new RegExp(e+"=(\\w+)")))?t[1]:void 0,m.isPresent(n)&&(document.cookie=e+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"),n},i=m.memoize(function(){return(f("_up_request_method")||"get").toLowerCase()}),c=function(){return!a()&&s()},{url:h,loadPage:p,canPushState:u,canCssTransition:n,canInputEvent:r,canLogSubstitution:o,isSupported:c,puts:d}}(jQuery)}.call(this),function(){var e=[].slice;up.bus=function(t){var n,r,o,u,i,a,l,s,c,p,f,d;return f=up.util,a=[],r=null,d=function(e){return function(n){var r;return r=n.$element||t(this),e.apply(r.get(0),[n,r,up.syntax.data(r)])}},i=function(){var n,r,o,u,i;return r=1<=arguments.length?e.call(arguments,0):[],up.browser.isSupported()?(u=f.copy(r),i=u.length-1,o=u[i],u[i]=d(o),a.push(u),n=t(document),n.on.apply(n,u),function(){return n.off.apply(n,u)}):function(){}},o=function(e,n){var r,o;return null==n&&(n={}),o=t.Event(e,n),r=n.$element||t(document),f.debug("Emitting %o on %o with props %o",e,r,n),r.trigger(o),o},l=function(){var t,n;return t=1<=arguments.length?e.call(arguments,0):[],n=o.apply(null,t),!n.isDefaultPrevented()},s=function(e){return i("keydown","body",function(t){return f.escapePressed(t)?e(t):void 0})},p=function(){return r=f.copy(a)},c=function(){var e,n,o,u;for(n=0,o=a.length;o>n;n++)e=a[n],f.contains(r,e)||(u=t(document)).off.apply(u,e);return a=f.copy(r)},u=function(){return up.emit("up:framework:reset")},n=function(){return up.browser.isSupported()?up.emit("up:framework:boot"):void 0},i("up:framework:boot",p),i("up:framework:reset",c),{on:i,emit:o,nobodyPrevents:l,onEscape:s,emitReset:u,boot:n}}(jQuery),up.on=up.bus.on,up.emit=up.bus.emit,up.reset=up.bus.emitReset,up.boot=up.bus.boot}.call(this),function(){var e=[].slice;up.syntax=function(t){var n,r,o,u,i,a,l,s,c,p,f,d,m;return m=up.util,n="up-destroyable",r="up-destroyer",a=[],s=null,i=function(){var t,n,r;return r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],up.browser.isSupported()?(i=t.pop(),n=m.options(t[0],{batch:!1}),a.push({selector:r,callback:i,batch:n.batch})):void 0},o=function(e,t,o){var u;return m.debug("Applying compiler %o on %o",e.selector,o),u=e.callback.apply(o,[t,l(t)]),m.isFunction(u)?(t.addClass(n),t.data(r,u)):void 0},u=function(e){var n,r,u,l;for(m.debug("Compiling fragment %o",e),l=[],r=0,u=a.length;u>r;r++)i=a[r],n=m.findWithSelf(e,i.selector),l.push(n.length?i.batch?o(i,n,n.get()):n.each(function(){return o(i,t(this),this)}):void 0);return l},f=function(e){return m.findWithSelf(e,"."+n).each(function(){var e,n;return e=t(this),(n=e.data(r))()})},l=function(e){var n,r;return n=t(e),r=n.attr("up-data"),m.isString(r)&&""!==m.trim(r)?JSON.parse(r):{}},d=function(){return s=m.copy(a)},p=function(){return a=m.copy(s)},c=function(e,n){var r,o;return r=t(e),o=m.options(n,{$element:r}),up.emit("up:fragment:inserted",o),r},up.on("ready",function(){return c(document.body)}),up.on("up:fragment:inserted",function(e){return u(e.$element)}),up.on("up:fragment:destroy",function(e){return f(e.$element)}),up.on("up:framework:boot",d),up.on("up:framework:reset",p),{compiler:i,hello:c,data:l}}(jQuery),up.compiler=up.syntax.compiler,up.hello=up.syntax.hello,up.ready=function(){return up.util.error("up.ready no longer exists. Please use up.hello instead.")},up.awaken=function(){return up.util.error("up.awaken no longer exists. Please use up.compiler instead.")}}.call(this),function(){up.history=function(e){var t,n,r,o,u,i,a,l,s,c,p,f,d,m,h,v;return v=up.util,n=v.config({popTargets:["body"],restoreScroll:!0}),c=void 0,i=void 0,m=function(){return n.reset(),c=void 0,i=void 0},a=function(e){return v.normalizeUrl(e,{hash:!0})},r=function(){return a(up.browser.url())},o=function(e){return a(e)===r()},l=function(e){return i&&(c=i,i=void 0),i=e},d=function(e,t){return u("replace",e,t)},p=function(e,t){return u("push",e,t)},u=function(e,n,u){var i,a;return u=v.options(u,{force:!1}),u.force||!o(n)?up.browser.canPushState()?(i=e+"State",a=t(),v.debug("Changing history to URL %o (%o)",n,e),window.history[i](a,"",n),l(r())):v.error("This browser doesn't support history.pushState"):void 0},t=function(){return{fromUp:!0}},h=function(e){var t,o;return o=r(),v.debug("Restoring state %o (now on "+o+")",e),t=n.popTargets.join(", "),up.replace(t,o,{history:!1,reveal:!1,transition:"none",saveScroll:!1,restoreScroll:n.restoreScroll})},s=function(e){var t;return v.debug("History state popped to URL %o",r()),l(r()),up.layout.saveScroll({url:c}),t=e.originalEvent.state,(null!=t?t.fromUp:void 0)?h(t):v.debug("Discarding unknown state %o",t)},up.browser.canPushState()&&(f=function(){return e(window).on("popstate",s),d(r(),{force:!0})},"undefined"!=typeof jasmine&&null!==jasmine?f():setTimeout(f,100)),up.compiler("[up-back]",function(e){return v.isPresent(c)?(v.setMissingAttrs(e,{"up-href":c,"up-restore-scroll":""}),e.removeAttr("up-back"),up.link.makeFollowable(e)):void 0}),up.on("up:framework:reset",m),{config:n,defaults:function(){return v.error("up.history.defaults(...) no longer exists. Set values on he up.history.config property instead.")},push:p,replace:d,url:r,previousUrl:function(){return c},normalizeUrl:a}}(jQuery)}.call(this),function(){var slice=[].slice;up.layout=function($){var SCROLL_PROMISE_KEY,anchoredRight,config,finishScrolling,fixedChildren,lastScrollTops,measureObstruction,reset,restoreScroll,reveal,revealOrRestoreScroll,saveScroll,scroll,scrollTops,u,viewportOf,viewportSelector,viewports,viewportsWithin;return u=up.util,config=u.config({duration:0,viewports:[document,".up-modal","[up-viewport]"],fixedTop:["[up-fixed~=top]"],fixedBottom:["[up-fixed~=bottom]"],anchoredRight:["[up-anchored~=right]","[up-fixed~=top]","[up-fixed~=bottom]","[up-fixed~=right]"],snap:50,substance:150,easing:"swing"}),lastScrollTops=u.cache({size:30,key:up.history.normalizeUrl}),reset=function(){return config.reset(),lastScrollTops.clear()},SCROLL_PROMISE_KEY="up-scroll-promise",scroll=function(e,t,n){var r,o,i,a,l;return r=$(e),n=u.options(n),i=u.option(n.duration,config.duration),a=u.option(n.easing,config.easing),finishScrolling(r),i>0?(o=$.Deferred(),r.data(SCROLL_PROMISE_KEY,o),o.then(function(){return r.removeData(SCROLL_PROMISE_KEY),r.finish()}),l={scrollTop:t},r.get(0)===document&&(r=$("html, body")),r.animate(l,{duration:i,easing:a,complete:function(){return o.resolve()}}),o):(r.scrollTop(t),u.resolvedDeferred())},finishScrolling=function(e){return $(e).each(function(){var e;return(e=$(this).data(SCROLL_PROMISE_KEY))?e.resolve():void 0})},anchoredRight=function(){return u.multiSelector(config.anchoredRight).select()},measureObstruction=function(){var e,t,n,r;return n=function(e,t){var n,r;return n=$(e),r=n.css(t),u.isPresent(r)||u.error("Fixed element %o must have a CSS attribute %o",n,t),parseInt(r)+n.height()},t=function(){var e,t,o,u;for(o=$(config.fixedTop.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"top"));return u}(),e=function(){var e,t,o,u;for(o=$(config.fixedBottom.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"bottom"));return u}(),{top:Math.max.apply(Math,[0].concat(slice.call(t))),bottom:Math.max.apply(Math,[0].concat(slice.call(e)))}},reveal=function(e,t){var n,r,o,i,a,l,s,c,p,f,d,m,h,v;return u.debug("Revealing %o",e),t=u.options(t),n=$(e),r=t.viewport?$(t.viewport):viewportOf(n),m=u.option(t.snap,config.snap),v=r.is(document),h=v?u.clientSize().height:r.height(),p=r.scrollTop(),l=p,c=void 0,s=void 0,v?(s=measureObstruction(),c=0):(s={top:0,bottom:0},c=p),f=function(){return l+s.top},d=function(){return l+h-s.bottom-1},o=u.measure(n,{relative:r}),i=o.top+c,a=i+Math.min(o.height,config.substance)-1,a>d()&&(l+=a-d()),(i<f()||t.top)&&(l=i-s.top),m>l&&(l=0),l!==p?scroll(r,l,t):u.resolvedDeferred()},viewportSelector=function(){return u.multiSelector(config.viewports)},viewportOf=function(e){var t,n;return t=$(e),n=viewportSelector().seekUp(t),n.length||u.error("Could not find viewport for %o",t),n},viewportsWithin=function(e){var t;return t=$(e),viewportSelector().findWithSelf(t)},viewports=function(){return viewportSelector().select()},scrollTops=function(){var e,t,n,r,o,u,i;for(u={},o=config.viewports,t=0,r=o.length;r>t;t++)i=o[t],e=$(i),e.length&&(n=i,i===document&&(n="document"),u[n]=e.scrollTop());return u},fixedChildren=function(e){var t,n;return null==e&&(e=void 0),e||(e=document.body),n=$(e),t=n.find("[up-fixed]"),u.isPresent(config.fixedTop)&&(t=t.add(n.find(config.fixedTop.join(", ")))),u.isPresent(config.fixedBottom)&&(t=t.add(n.find(config.fixedBottom.join(", ")))),t},saveScroll=function(e){var t,n;return null==e&&(e={}),n=u.option(e.url,up.history.url()),t=u.option(e.tops,scrollTops()),u.debug("Saving scroll positions for URL %o: %o",n,t),lastScrollTops.set(n,t)},restoreScroll=function(e){var t,n,r,o,i,a,l,s,c;null==e&&(e={}),c=up.history.url(),o=void 0,e.around?(n=viewportsWithin(e.around),t=viewportOf(e.around),o=t.add(n)):o=viewports(),s=lastScrollTops.get(c),u.debug("Restoring scroll positions for URL %o (viewports are %o, saved tops are %o)",c,o,s);for(i in s)l=s[i],a="document"===i?document:i,r=o.filter(a),scroll(r,l,{duration:0});return u.resolvedDeferred()},revealOrRestoreScroll=function(e,t){var n,r,o,i;return n=$(e),t.restoreScroll?restoreScroll({around:n}):t.reveal?(t.source&&(i=u.parseUrl(t.source),i.hash&&"#"!==i.hash&&(o=i.hash.substr(1),r=u.findWithSelf(n,"#"+o+", a[name='"+o+"']"),r.length&&(n=r))),reveal(n)):u.resolvedDeferred()},up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),reveal:reveal,scroll:scroll,finishScrolling:finishScrolling,config:config,defaults:function(){return u.error("up.layout.defaults(...) no longer exists. Set values on he up.layout.config property instead.")},viewportOf:viewportOf,viewportsWithin:viewportsWithin,viewports:viewports,scrollTops:scrollTops,saveScroll:saveScroll,restoreScroll:restoreScroll,revealOrRestoreScroll:revealOrRestoreScroll,anchoredRight:anchoredRight,fixedChildren:fixedChildren}}(jQuery),up.scroll=up.layout.scroll,up.reveal=up.layout.reveal}.call(this),function(){up.flow=function(e){var t,n,r,o,u,i,a,l,s,c,p,f,d,m,h,v,g;return g=up.util,m=function(t,n){var r;return r=e(t),g.isPresent(n)&&(n=g.normalizeUrl(n)),r.attr("up-source",n)},h=function(t){var n;return n=e(t).closest("[up-source]"),g.presence(n.attr("up-source"))||up.browser.url()},d=function(e,t){var n,r,o;return g.isString(e)?(o=e,g.contains(o,"&")&&((n=g.presence(t.origin))?(r=g.selectorForElement(n),o=o.replace(/\&/,r)):g.error("Found origin reference %o in selector %o, but options.origin is missing","&",o))):o=g.selectorForElement(e),o},f=function(e,t,n){var r,o,u;return g.debug("Replace %o with %o (options %o)",e,t,n),n=g.options(n),u=d(e,n),up.browser.canPushState()||n.history===!1?(o={url:t,method:n.method,selector:u,cache:n.cache,preload:n.preload,headers:n.headers},r=up.proxy.ajax(o),r.done(function(e,r,a){var l,s;return(l=g.locationFromXhr(a))&&(g.debug("Location from server: %o",l),s={url:l,method:g.methodFromXhr(a),selector:u},up.proxy.alias(o,s),t=l),n.history!==!1&&(n.history=t),n.source!==!1&&(n.source=t),n.title||(n.title=g.titleFromXhr(a)),n.preload?void 0:i(u,e,n)}),r.fail(g.error),r):(n.preload||up.browser.loadPage(t,g.only(n,"method")),g.unresolvablePromise())},i=function(e,t,n){var r,u,i,a,l,p,f,m,h,y;for(h=d(e,n),n=g.options(n,{historyMethod:"push",requireMatch:!0}),n.source=g.option(n.source,n.history),f=c(t,n),n.title||(n.title=f.title()),n.saveScroll!==!1&&up.layout.saveScroll(),l=s(h,n),m=[],i=0,a=l.length;a>i;i++)y=l[i],u=o(y.selector,n),r=null!=(p=f.find(y.selector))?p.first():void 0,m.push(u&&r?v(u,r,y.pseudoClass,y.transition,n):void 0);return m},o=function(e,t){return u(".up-popup "+e)||u(".up-modal "+e)||u(e)||l(e,t)},l=function(e,t){var n;return t.requireMatch?(n="Could not find selector %o in current body HTML","#"===n[0]&&(n+=" (avoid using IDs)"),g.error(n,e)):void 0},c=function(t,n){var r;return r=g.createElementFromHtml(t),{title:function(){var e;return null!=(e=r.querySelector("title"))?e.textContent:void 0},find:function(o){var u;return(u=e.find(o,r)[0])?e(u):n.requireMatch?g.error("Could not find selector %o in response %o",o,t):void 0}}},r=function(e,n){return n.history&&(n.title&&(document.title=n.title),up.history[n.historyMethod](n.history)),n.source!==!1&&m(e,n.source),t(e),up.hello(e,{origin:n.origin})},v=function(e,t,o,u,i){var a,l;return u||(u="none"),up.motion.finish(e),o?(l="before"===o?"prepend":"append",a=t.contents().wrap('<span class="up-insertion"></span>').parent(),e[l](a),g.copyAttributes(t,e),r(a.children(),i),up.layout.revealOrRestoreScroll(a,i).then(function(){return up.animate(a,u,i)}).then(function(){g.unwrapElement(a)})):n(e,{animation:function(){return t.insertBefore(e),r(t,i),e.is("body")&&"none"!==u&&g.error("Cannot apply transitions to body-elements (%o)",u),up.morph(e,t,u,i)}})},s=function(e,t){var n,r,o,u,i,a,l,s,c,p,f,d;for(f=t.transition||t.animation||"none",n=/\ *,\ */,r=e.split(n),g.isPresent(f)&&(d=f.split(n)),l=[],o=u=0,i=r.length;i>u;o=++u)s=r[o],c=s.match(/^(.+?)(?:\:(before|after))?$/),e=c[1],"html"===e&&(e="body"),a=c[2],p=d[o]||g.last(d),l.push({selector:e,pseudoClass:a,transition:p});return l},t=function(e){var t,n;return n="[autofocus]:last",t=g.findWithSelf(e,n),t.length&&t.get(0)!==document.activeElement?t.focus():void 0},a=function(e){var t;return t=".up-ghost, .up-destroying",0===e.closest(t).length},u=function(t){var n,r,o,u,i,l;for(u=void 0,u=g.isString(t)?e(t).get():t,r=void 0,i=0,l=u.length;l>i;i++)if(o=u[i],n=e(o),a(n)){r=n;break}return r},n=function(t,n){var r,o,u;return r=e(t),up.bus.nobodyPrevents("up:fragment:destroy",{$element:r})?(n=g.options(n,{animation:"none"}),o=up.motion.animateOptions(n),r.addClass("up-destroying"),g.isPresent(n.url)&&up.history.push(n.url),g.isPresent(n.title)&&(document.title=n.title),u=g.presence(n.animation,g.isDeferred)||up.motion.animate(r,n.animation,o),u.then(function(){return up.emit("up:fragment:destroyed",{$element:r}),r.remove()}),u):e.Deferred()},p=function(e,t){var n;return t=g.options(t,{cache:!1}),n=t.url||h(e),f(e,n,t)},up.on("ready",function(){return m(document.body,up.browser.url())}),{replace:f,reload:p,destroy:n,implant:i,first:u,resolveSelector:d}}(jQuery),up.replace=up.flow.replace,up.implant=up.flow.implant,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.first=up.flow.first}.call(this),function(){up.motion=function(e){var t,n,r,o,u,i,a,l,s,c,p,f,d,m,h,v,g,y,b,w,k,x,S,C;return S=up.util,u={},l={},x={},s={},a=S.config({duration:300,delay:0,easing:"ease",enabled:!0}),g=function(){return u=S.copy(l),x=S.copy(s),a.reset()},d=function(){return a.enabled&&up.browser.canCssTransition()},n=function(t,o,u){var a;return a=e(t),p(a),u=r(u),("none"===o||o===!1)&&h(),S.isFunction(o)?i(o(a,u),o):S.isString(o)?n(a,c(o),u):S.isHash(o)?d()?S.cssAnimate(a,o,u):(a.css(o),S.resolvedDeferred()):S.error("Unknown animation type %o",o)},r=function(e,t){var n;return null==t&&(t=null),e=S.options(e),n={},n.easing=S.option(e.easing,null!=t?t.attr("up-easing"):void 0,a.easing),n.duration=Number(S.option(e.duration,null!=t?t.attr("up-duration"):void 0,a.duration)),n.delay=Number(S.option(e.delay,null!=t?t.attr("up-delay"):void 0,a.delay)),n},c=function(e){return u[e]||S.error("Unknown animation %o",e)},t="up-ghosting-promise",C=function(e,n,r,o){var u,i,a,l,s,c,p;return l=void 0,i=void 0,s=void 0,a=void 0,u=up.layout.viewportOf(e),S.temporaryCss(n,{display:"none"},function(){return l=v(e,u),l.$ghost.addClass("up-destroying"),l.$bounds.addClass("up-destroying"),s=u.scrollTop()}),S.temporaryCss(e,{display:"none"},function(){return up.layout.revealOrRestoreScroll(n,r),i=v(n,u),a=u.scrollTop()}),l.moveTop(a-s),e.hide(),p=S.temporaryCss(n,{opacity:"0"}),c=o(l.$ghost,i.$ghost),e.data(t,c),n.data(t,c),c.then(function(){return e.removeData(t),n.removeData(t),p(),l.$bounds.remove(),i.$bounds.remove()}),c},p=function(t){return e(t).each(function(){var t;return t=e(this),S.finishCssAnimate(t),f(t)})},f=function(e){var n;return(n=e.data(t))?(S.debug("Canceling existing ghosting on %o",e),"function"==typeof n.resolve?n.resolve():void 0):void 0},i=function(e,t){return S.isDeferred(e)?e:S.error("Did not return a promise with .then and .resolve methods: %o",t)},m=function(t,o,a,l){var s,c,f,h,v,g,w;return S.debug("Morphing %o to %o (using %o)",t,o,a),c=e(t),s=e(o),v=S.only(l,"reveal","restoreScroll","source"),v=S.extend(v,r(l)),d()?(p(c),p(s),"none"===a||a===!1||(f=u[a])?(h=b(c,s,v),h.then(function(){return n(s,f||"none",l)}),h):(w=S.presence(a,S.isFunction)||x[a])?C(c,s,v,function(e,t){var n;return n=w(e,t,v),i(n,a)}):S.isString(a)&&a.indexOf("/")>=0?(g=a.split("/"),w=function(e,t,r){return y(n(e,g[0],r),n(t,g[1],r))},m(c,s,w,v)):S.error("Unknown transition %o",a)):b(c,s,v)},b=function(e,t,n){return e.hide(),up.layout.revealOrRestoreScroll(t,n)},v=function(t,n){var r,o,u,i,a,l,s,c,p;for(i=S.measure(t,{relative:!0,inner:!0}),u=t.clone(),u.find("script").remove(),u.css({position:"static"===t.css("position")?"static":"relative",top:"",right:"",bottom:"",left:"",width:"100%",height:"100%"}),u.addClass("up-ghost"),r=e('<div class="up-bounds"></div>'),r.css({position:"absolute"}),r.css(i),p=i.top,c=function(e){return 0!==e?(p+=e,r.css({top:p})):void 0},u.appendTo(r),r.insertBefore(t),c(t.offset().top-u.offset().top),o=up.layout.fixedChildren(u),l=0,s=o.length;s>l;l++)a=o[l],S.fixedToAbsolute(a,n);return{$ghost:u,$bounds:r,moveTop:c}},k=function(e,t){return x[e]=t},o=function(e,t){return u[e]=t},w=function(){return l=S.copy(u),s=S.copy(x)},y=S.resolvableWhen,h=S.resolvedDeferred,o("none",h),o("fade-in",function(e,t){return e.css({opacity:0}),n(e,{opacity:1},t)}),o("fade-out",function(e,t){return e.css({opacity:1}),n(e,{opacity:0},t)}),o("move-to-top",function(e,t){var r,o;return r=S.measure(e),o=r.top+r.height,e.css({"margin-top":"0px"}),n(e,{"margin-top":"-"+o+"px"},t)}),o("move-from-top",function(e,t){var r,o;return r=S.measure(e),o=r.top+r.height,e.css({"margin-top":"-"+o+"px"}),n(e,{"margin-top":"0px"},t)}),o("move-to-bottom",function(e,t){var r,o;return r=S.measure(e),o=S.clientSize().height-r.top,e.css({"margin-top":"0px"}),n(e,{"margin-top":o+"px"},t)}),o("move-from-bottom",function(e,t){var r,o;return r=S.measure(e),o=S.clientSize().height-r.top,e.css({"margin-top":o+"px"}),n(e,{"margin-top":"0px"},t)}),o("move-to-left",function(e,t){var r,o;return r=S.measure(e),o=r.left+r.width,e.css({"margin-left":"0px"}),n(e,{"margin-left":"-"+o+"px"},t)}),o("move-from-left",function(e,t){var r,o;return r=S.measure(e),o=r.left+r.width,e.css({"margin-left":"-"+o+"px"}),n(e,{"margin-left":"0px"},t)}),o("move-to-right",function(e,t){var r,o;return r=S.measure(e),o=S.clientSize().width-r.left,e.css({"margin-left":"0px"}),n(e,{"margin-left":o+"px"},t)}),o("move-from-right",function(e,t){var r,o;
2
+ return r=S.measure(e),o=S.clientSize().width-r.left,e.css({"margin-left":o+"px"}),n(e,{"margin-left":"0px"},t)}),o("roll-down",function(e,t){var r,o;return r=e.height(),o=S.temporaryCss(e,{height:"0px",overflow:"hidden"}),n(e,{height:r+"px"},t).then(o)}),k("none",h),k("move-left",function(e,t,r){return y(n(e,"move-to-left",r),n(t,"move-from-right",r))}),k("move-right",function(e,t,r){return y(n(e,"move-to-right",r),n(t,"move-from-left",r))}),k("move-up",function(e,t,r){return y(n(e,"move-to-top",r),n(t,"move-from-bottom",r))}),k("move-down",function(e,t,r){return y(n(e,"move-to-bottom",r),n(t,"move-from-top",r))}),k("cross-fade",function(e,t,r){return y(n(e,"fade-out",r),n(t,"fade-in",r))}),up.on("up:framework:boot",w),up.on("up:framework:reset",g),{morph:m,animate:n,animateOptions:r,finish:p,transition:k,animation:o,config:a,isEnabled:d,defaults:function(){return S.error("up.motion.defaults(...) no longer exists. Set values on he up.motion.config property instead.")},none:h,when:y,prependCopy:v}}(jQuery),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){var e=[].slice;up.proxy=function(t){var n,r,o,u,i,a,l,s,c,p,f,d,m,h,v,g,y,b,w,k,x,S,C,$,T,E,P,A,U,O,D,j,F;return F=up.util,n=void 0,E=void 0,a=void 0,C=void 0,l=void 0,A=[],h=F.config({busyDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5,maxRequests:4}),c=function(e){return S(e),[e.url,e.method,e.data,e.selector].join("|")},s=F.cache({size:function(){return h.cacheSize},expiry:function(){return h.cacheExpiry},key:c,log:"up.proxy"}),v=function(e){var t,n,r,o,u,i,a;for(e=S(e),n=[e],"html"!==e.selector&&(i=F.merge(e,{selector:"html"}),n.push(i),"body"!==e.selector&&(u=F.merge(e,{selector:"body"}),n.push(u))),r=0,o=n.length;o>r;r++)if(t=n[r],a=s.get(t))return a},D=s.set,U=s.remove,m=s.clear,f=function(){return clearTimeout(E),E=null},p=function(){return clearTimeout(a),a=null},O=function(){return n=null,f(),p(),C=0,h.reset(),l=!1,s.clear(),A=[]},O(),u=s.alias,S=function(e){return e._normalized||(e.method=F.normalizeMethod(e.method),e.url&&(e.url=F.normalizeUrl(e.url)),e.selector||(e.selector="body"),e._normalized=!0),e},o=function(e){var t,n,r,o,u;return t=e.cache===!0,n=e.cache===!1,u=F.only(e,"url","method","data","selector","headers","_normalized"),r=!0,y(u)||t?(o=v(u))&&!n?r="pending"===o.state():(o=k(u),D(u,o),o.fail(function(){return U(u)})):(m(),o=k(u)),r&&!e.preload&&(x(),o.always(w)),o},r=["GET","OPTIONS","HEAD"],g=function(){return 0===C},i=function(){return C>0},x=function(){var e,t;return t=g(),C+=1,t?(e=function(){return i()?(up.emit("up:proxy:busy"),l=!0):void 0},h.busyDelay>0?a=setTimeout(e,h.busyDelay):e()):void 0},w=function(){return C-=1,g()&&l?(up.emit("up:proxy:idle"),l=!1):void 0},k=function(e){return C<h.maxRequests?b(e):P(e)},P=function(e){var n,r;return F.debug("Queuing URL %o",e.url),n=t.Deferred(),r={deferred:n,request:e},A.push(r),n.promise()},b=function(e){var t;return F.debug("Loading URL %o",e.url),up.emit("up:proxy:load",e),t=F.ajax(e),t.always(function(){return up.emit("up:proxy:received",e),$()}),t},$=function(){var t,n;return(t=A.shift())?(n=b(t.request),n.done(function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],(r=t.deferred).resolve.apply(r,n)}),n.fail(function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],(r=t.deferred).reject.apply(r,n)})):void 0},y=function(e){return S(e),F.contains(r,e.method)},d=function(e){var t,r;return r=parseInt(F.presentAttr(e,"up-delay"))||h.preloadDelay,e.is(n)?void 0:(n=e,f(),t=function(){return T(e),n=null},j(t,r))},j=function(e,t){return E=setTimeout(e,t)},T=function(e,n){var r,o;return r=t(e),n=F.options(n),o=up.link.followMethod(r,n),y({method:o})?(F.debug("Preloading %o",r),n.preload=!0,up.follow(r,n)):(F.debug("Won't preload %o due to unsafe method %o",r,o),F.resolvedPromise())},up.on("mouseover mousedown touchstart","[up-preload]",function(e,t){return up.link.childClicked(e,t)?void 0:d(t)}),up.on("up:framework:reset",O),{preload:T,ajax:o,get:v,alias:u,clear:m,remove:U,idle:g,busy:i,config:h,defaults:function(){return F.error("up.proxy.defaults(...) no longer exists. Set values on he up.proxy.config property instead.")}}}(jQuery)}.call(this),function(){up.link=function($){var allowDefault,childClicked,follow,followMethod,followVariantSelectors,isFollowable,makeFollowable,registerFollowVariant,shouldProcessLinkEvent,u,visit;return u=up.util,visit=function(e,t){var n;return t=u.options(t),n=u.option(t.target,"body"),up.replace(n,e,t)},follow=function(e,t){var n,r,o;return n=$(e),t=u.options(t),o=u.option(n.attr("up-href"),n.attr("href")),r=u.option(t.target,n.attr("up-target"),"body"),t.transition=u.option(t.transition,u.castedAttr(n,"up-transition"),u.castedAttr(n,"up-animation")),t.history=u.option(t.history,u.castedAttr(n,"up-history")),t.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),t.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),t.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),t.method=followMethod(n,t),t.origin=u.option(t.origin,n),t=u.merge(t,up.motion.animateOptions(t,n)),up.replace(r,o,t)},followMethod=function(e,t){var n;return n=$(e),t=u.options(t),u.option(t.method,n.attr("up-method"),n.attr("data-method"),"get").toUpperCase()},childClicked=function(e,t){var n,r;return n=$(e.target),r=n.closest("a, [up-href]"),r.length&&t.find(r).length},shouldProcessLinkEvent=function(e,t){return u.isUnmodifiedMouseEvent(e)&&!childClicked(e,t)},followVariantSelectors=[],allowDefault=function(){},registerFollowVariant=function(e,t){return followVariantSelectors.push(e),up.on("click","a"+e+", [up-href]"+e,function(e,n){return shouldProcessLinkEvent(e,n)?n.is("[up-instant]")?e.preventDefault():(e.preventDefault(),t(n)):allowDefault(e)}),up.on("mousedown","a"+e+"[up-instant], [up-href]"+e+"[up-instant]",function(e,n){return shouldProcessLinkEvent(e,n)?(e.preventDefault(),t(n)):void 0})},isFollowable=function(e){return u.any(followVariantSelectors,function(t){return e.is(t)})},makeFollowable=function(e){var t;return t=$(e),isFollowable(t)?void 0:t.attr("up-follow","")},registerFollowVariant("[up-target]",function(e){return follow(e)}),registerFollowVariant("[up-follow]",function(e){return follow(e)}),up.compiler("[up-expand]",function(e){var t,n,r,o,i,a,l,s;for(o=e.find("a, [up-href]").get(0),o||u.error("No link to expand within %o",e),s=/^up-/,a={},a["up-href"]=$(o).attr("href"),l=o.attributes,n=0,r=l.length;r>n;n++)t=l[n],i=t.name,i.match(s)&&(a[i]=t.value);return u.setMissingAttrs(e,a),e.removeAttr("up-expand"),makeFollowable(e)}),up.compiler("[up-dash]",function(e){var t,n;return n=u.castedAttr(e,"up-dash"),t={"up-preload":"true","up-instant":"true"},n===!0?t["up-follow"]="":t["up-target"]=n,u.setMissingAttrs(e,t),e.removeAttr("up-dash")}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,makeFollowable:makeFollowable,shouldProcessLinkEvent:shouldProcessLinkEvent,childClicked:childClicked,followMethod:followMethod,registerFollowVariant:registerFollowVariant}}(jQuery),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){var slice=[].slice;up.form=function($){var autosubmit,config,observe,observeForm,reset,resolveValidateTarget,submit,u,validate;return u=up.util,config=u.config({validateTargets:["[up-fieldset]:has(&)","fieldset:has(&)","label:has(&)","form:has(&)"],fields:[":input"],observeDelay:0}),reset=function(){return config.reset()},submit=function(e,t){var n,r,o,i,a,l,s,c,p,f,d,m,h,v;return n=$(e).closest("form"),t=u.options(t),f=u.option(t.target,n.attr("up-target"),"body"),f=up.flow.resolveSelector(f,t),r=u.option(t.failTarget,n.attr("up-fail-target"))||u.selectorForElement(n),r=up.flow.resolveSelector(r,t),l=u.option(t.history,u.castedAttr(n,"up-history"),!0),d=u.option(t.transition,u.castedAttr(n,"up-transition")),o=u.option(t.failTransition,u.castedAttr(n,"up-fail-transition"),d),s=u.option(t.method,n.attr("up-method"),n.attr("data-method"),n.attr("method"),"post").toUpperCase(),a=u.option(t.headers,{}),c={},c.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),c.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),c.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),c.origin=u.option(t.origin,n),c=u.extend(c,up.motion.animateOptions(t,n)),v=u.option(t.cache,u.castedAttr(n,"up-cache")),h=u.option(t.url,n.attr("action"),up.browser.url()),i=n.find("input[type=file]").length,t.validate&&(a["X-Up-Validate"]=t.validate,i)?u.unresolvablePromise():(n.addClass("up-active"),i||!up.browser.canPushState()&&l!==!1?(n.get(0).submit(),u.unresolvablePromise()):(p={url:h,method:s,data:n.serialize(),selector:f,cache:v,headers:a},m=function(e){var t;return h=void 0,u.isGiven(l)&&(l===!1||u.isString(l)?h=l:(t=u.locationFromXhr(e))?h=t:"GET"===p.type&&(h=p.url+"?"+p.data)),u.option(h,!1)},up.proxy.ajax(p).always(function(){return n.removeClass("up-active")}).done(function(e,t,n){var r;return r=u.merge(c,{history:m(n),transition:d}),up.flow.implant(f,e,r)}).fail(function(e){var t,n;return n=e.responseText,t=u.merge(c,{transition:o}),up.flow.implant(r,n,t)})))},observe=function(){var $element,args,callback,callbackArg,callbackPromise,callbackTimer,changeEvents,check,clearTimer,delay,knownValue,nextCallback,options,rawCallback,runNextCallback,selectorOrElement;return selectorOrElement=arguments[0],args=2<=arguments.length?slice.call(arguments,1):[],options={},callbackArg=void 0,1===args.length&&(callbackArg=args[0]),args.length>1&&(options=u.options(args[0]),callbackArg=args[1]),$element=$(selectorOrElement),options=u.options(options),delay=u.option($element.attr("up-delay"),options.delay,config.observeDelay),delay=parseInt(delay),callback=null,u.isGiven(options.change)&&up.error("up.observe now takes the change callback as the last argument"),rawCallback=u.option(u.presentAttr($element,"op-observe"),callbackArg),callback=u.isString(rawCallback)?function(value,$field){return eval(rawCallback)}:rawCallback||u.error("up.observe: No change callback given"),$element.is("form")?observeForm($element,options,callback):(knownValue=null,callbackTimer=null,callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var e;return nextCallback?(e=nextCallback(),nextCallback=null,e):void 0},check=function(){var e,t,n;return n=$element.val(),t=u.isNull(knownValue),knownValue===n||(knownValue=n,t)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($element.get(0),[n,$element])},e=function(){return callbackPromise.then(function(){var e;return e=runNextCallback(),callbackPromise=u.isPromise(e)?e:u.resolvedPromise()})},0===delay?e():setTimeout(e,delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$element.on(changeEvents,check),check(),function(){return $element.off(changeEvents,check),clearTimer()})},observeForm=function(e,t,n){var r,o;return r=u.multiSelector(config.fields).find(e),o=u.map(r,function(e){return observe(e,n)}),function(){var e,t,n,r;for(r=[],t=0,n=o.length;n>t;t++)e=o[t],r.push(e());return r}},autosubmit=function(e,t){return console.log("autosubmit %o",e),observe(e,t,function(e,t){var n;return n=t.closest("form"),t.addClass("up-active"),submit(n).always(function(){return t.removeClass("up-active")})})},resolveValidateTarget=function(e,t){var n;return n=u.option(t.target,e.attr("up-validate")),u.isBlank(n)&&(n||(n=u.detect(config.validateTargets,function(n){var r;return r=up.flow.resolveSelector(n,t),e.closest(r).length}))),u.isBlank(n)&&error("Could not find default validation target for %o (tried ancestors %o)",e,config.validateTargets),u.isString(n)||(n=u.selectorForElement(n)),n},validate=function(e,t){var n,r,o;return n=$(e),t=u.options(t),t.origin=n,t.target=resolveValidateTarget(n,t),t.failTarget=t.target,t.history=!1,t.headers=u.option(t.headers,{}),t.validate=n.attr("name")||"__none__",t=u.merge(t,up.motion.animateOptions(t,n)),r=n.closest("form"),o=up.submit(r,t)},up.on("submit","form[up-target]",function(e,t){return e.preventDefault(),submit(t)}),up.on("change","[up-validate]",function(e,t){return validate(t)}),up.compiler("[up-observe]",function(e){return observe(e)}),up.compiler("[up-autosubmit]",function(e){return autosubmit(e)}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),config:config,submit:submit,observe:observe,validate:validate}}(jQuery),up.submit=up.form.submit,up.observe=up.form.observe,up.autosubmit=up.form.autosubmit,up.validate=up.form.validate}.call(this),function(){up.popup=function($){var attach,autoclose,close,config,contains,coveredUrl,createHiddenPopup,currentUrl,discardHistory,ensureInViewport,rememberHistory,reset,setPosition,u,updated;return u=up.util,currentUrl=void 0,coveredUrl=function(){var e;return e=$(".up-popup"),e.attr("up-covered-url")},config=u.config({openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right",history:!1}),reset=function(){return close(),config.reset()},setPosition=function(e,t,n){var r,o;return o=u.measure(e,{full:!0}),r=function(){switch(n){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.top+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return u.error("Unknown position %o",n)}}(),t.attr("up-position",n),t.css(r),ensureInViewport(t)},ensureInViewport=function(e){var t,n,r,o,i,a,l;if(n=u.measure(e,{full:!0}),r=null,o=null,n.right<0&&(r=-n.right),n.bottom<0&&(o=-n.bottom),n.left<0&&(r=n.left),n.top<0&&(o=n.top),r&&((i=parseInt(e.css("left")))?e.css("left",i-r):(a=parseInt(e.css("right")))&&e.css("right",a+r)),o){if(l=parseInt(e.css("top")))return e.css("top",l-o);if(t=parseInt(e.css("bottom")))return e.css("bottom",t+o)}},rememberHistory=function(){var e;return e=$(".up-popup"),e.attr("up-covered-url",up.browser.url()),e.attr("up-covered-title",document.title)},discardHistory=function(){var e;return e=$(".up-popup"),e.removeAttr("up-covered-url"),e.removeAttr("up-covered-title")},createHiddenPopup=function(e,t,n){var r,o;return o=u.$createElementFromSelector(".up-popup"),n&&o.attr("up-sticky",""),r=u.$createElementFromSelector(t),r.appendTo(o),o.appendTo(document.body),rememberHistory(),o.hide(),o},updated=function(e,t,n,r){var o,u;return o=$(".up-popup"),o.is(":hidden")?(o.show(),setPosition(e,o,t),u=up.animate(o,n,r),u.then(function(){return up.emit("up:popup:opened")})):void 0},attach=function(e,t){var n,r,o,i,a,l,s,c,p;return n=$(e),n.length||u.error("Cannot attach popup to non-existing element %o",e),t=u.options(t),p=u.option(t.url,n.attr("href")),s=u.option(t.target,n.attr("up-popup"),"body"),a=u.option(t.position,n.attr("up-position"),config.position),o=u.option(t.animation,n.attr("up-animation"),config.openAnimation),c=u.option(t.sticky,u.castedAttr(n,"up-sticky")),i=up.browser.canPushState()?u.option(t.history,u.castedAttr(n,"up-history"),config.history):!1,r=up.motion.animateOptions(t,n),close(),up.bus.nobodyPrevents("up:popup:open",{url:p})?(createHiddenPopup(n,s,c),l=up.replace(s,p,{history:i,requireMatch:!1}),l.then(function(){return updated(n,a,o,r)}),l):u.unresolvableDeferred()},close=function(e){var t,n;return t=$(".up-popup"),t.length?up.bus.nobodyPrevents("up:popup:close",{$element:t})?(e=u.options(e,{animation:config.closeAnimation,url:t.attr("up-covered-url"),title:t.attr("up-covered-title")}),currentUrl=void 0,n=up.destroy(t,e),n.then(function(){return up.emit("up:popup:closed")}),n):u.unresolvableDeferred():u.resolvedDeferred()},autoclose=function(){return $(".up-popup").is("[up-sticky]")?void 0:(discardHistory(),close())},contains=function(e){var t;return t=$(e),t.closest(".up-popup").length>0},up.link.registerFollowVariant("[up-popup]",function(e){return e.is(".up-current")?close():attach(e)}),up.on("click","body",function(e){var t;return t=$(e.target),t.closest(".up-popup").length||t.closest("[up-popup]").length?void 0:close()}),up.on("up:fragment:inserted",function(e,t){var n;if(contains(t)){if(n=t.attr("up-source"))return currentUrl=n}else if(contains(e.origin))return autoclose()}),up.bus.onEscape(function(){return close()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-popup").length?(close(),e.preventDefault()):void 0}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),attach:attach,close:close,url:function(){return currentUrl},coveredUrl:coveredUrl,config:config,defaults:function(){return u.error("up.popup.defaults(...) no longer exists. Set values on he up.popup.config property instead.")},contains:contains,open:function(){return up.error("up.popup.open no longer exists. Please use up.popup.attach instead.")},source:function(){return up.error("up.popup.source no longer exists. Please use up.popup.url instead.")}}}(jQuery)}.call(this),function(){up.modal=function($){var autoclose,close,config,contains,coveredUrl,createHiddenModal,currentUrl,discardHistory,follow,open,rememberHistory,reset,shiftElements,templateHtml,u,unshiftElements,updated,visit;return u=up.util,config=u.config({maxWidth:null,minWidth:null,width:null,height:null,history:!0,openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"\xd7",template:function(e){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+e.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}}),currentUrl=void 0,coveredUrl=function(){var e;return e=$(".up-modal"),e.attr("up-covered-url")},reset=function(){return close(),currentUrl=void 0,config.reset()},templateHtml=function(){var e;return e=config.template,u.isFunction(e)?e(config):e},rememberHistory=function(){var e;return e=$(".up-modal"),e.attr("up-covered-url",up.browser.url()),e.attr("up-covered-title",document.title)},discardHistory=function(){var e;return e=$(".up-modal"),e.removeAttr("up-covered-url"),e.removeAttr("up-covered-title")},createHiddenModal=function(e){var t,n,r,o;return r=$(templateHtml()),e.sticky&&r.attr("up-sticky",""),r.attr("up-covered-url",up.browser.url()),r.attr("up-covered-title",document.title),n=r.find(".up-modal-dialog"),u.isPresent(e.width)&&n.css("width",e.width),u.isPresent(e.maxWidth)&&n.css("max-width",e.maxWidth),u.isPresent(e.height)&&n.css("height",e.height),t=r.find(".up-modal-content"),o=u.$createElementFromSelector(e.selector),o.appendTo(t),r.appendTo(document.body),rememberHistory(),r.hide(),r},unshiftElements=[],shiftElements=function(){var e,t,n,r;return n=u.scrollbarWidth(),e=parseInt($("body").css("padding-right")),t=n+e,r=u.temporaryCss($("body"),{"padding-right":t+"px","overflow-y":"hidden"}),unshiftElements.push(r),up.layout.anchoredRight().each(function(){var e,t,r,o;return e=$(this),t=parseInt(e.css("right")),r=n+t,o=u.temporaryCss(e,{right:r}),unshiftElements.push(o)})},updated=function(e,t){var n,r;return n=$(".up-modal"),n.is(":hidden")?(shiftElements(),n.show(),r=up.animate(n,e,t),r.then(function(){return up.emit("up:modal:opened")})):void 0},follow=function(e,t){return t=u.options(t),t.$link=$(e),open(t)},visit=function(e,t){return t=u.options(t),t.url=e,open(t)},open=function(e){var t,n,r,o,i,a,l,s,c,p,f;return e=u.options(e),t=u.option(e.$link,u.nullJQuery()),p=u.option(e.url,t.attr("up-href"),t.attr("href")),s=u.option(e.target,t.attr("up-modal"),"body"),f=u.option(e.width,t.attr("up-width"),config.width),a=u.option(e.maxWidth,t.attr("up-max-width"),config.maxWidth),o=u.option(e.height,t.attr("up-height"),config.height),r=u.option(e.animation,t.attr("up-animation"),config.openAnimation),c=u.option(e.sticky,u.castedAttr(t,"up-sticky")),i=up.browser.canPushState()?u.option(e.history,u.castedAttr(t,"up-history"),config.history):!1,n=up.motion.animateOptions(e,t),close(),up.bus.nobodyPrevents("up:modal:open",{url:p})?(createHiddenModal({selector:s,width:f,maxWidth:a,height:o,sticky:c}),l=up.replace(s,p,{history:i,requireMatch:!1}),l.then(function(){return updated(r,n)}),l):u.unresolvableDeferred()},close=function(e){var t,n;return t=$(".up-modal"),t.length?up.bus.nobodyPrevents("up:modal:close",{$element:t})?(e=u.options(e,{animation:config.closeAnimation,url:t.attr("up-covered-url"),title:t.attr("up-covered-title")}),currentUrl=void 0,n=up.destroy(t,e),n.then(function(){for(var e;e=unshiftElements.pop();)e();return up.emit("up:modal:closed")}),n):u.unresolvableDeferred():u.resolvedDeferred()},autoclose=function(){return $(".up-modal").is("[up-sticky]")?void 0:(discardHistory(),close())},contains=function(e){var t;return t=$(e),t.closest(".up-modal").length>0},up.link.registerFollowVariant("[up-modal]",function(e){return event.preventDefault(),e.is(".up-current")?close():follow(e)}),up.on("click","body",function(e){var t;return t=$(e.target),t.closest(".up-modal-dialog").length||t.closest("[up-modal]").length?void 0:close()}),up.on("up:fragment:inserted",function(e,t){var n;if(contains(t)){if(n=t.attr("up-source"))return currentUrl=n}else if(!up.popup.contains(t)&&contains(e.origin))return autoclose()}),up.bus.onEscape(function(){return close()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-modal").length?(close(),e.preventDefault()):void 0}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,open:function(){return up.error("up.modal.open no longer exists. Please use either up.modal.follow or up.modal.visit.")},close:close,url:function(){return currentUrl},coveredUrl:coveredUrl,config:config,defaults:function(){return u.error("up.modal.defaults(...) no longer exists. Set values on he up.modal.config property instead.")},contains:contains,source:function(){return up.error("up.popup.source no longer exists. Please use up.popup.url instead.")}}}(jQuery)}.call(this),function(){up.tooltip=function(e){var t,n,r,o,u,i,a;return a=up.util,r=a.config({position:"top",openAnimation:"fade-in",closeAnimation:"fade-out"}),u=function(){return r.reset()},i=function(e,t,n){var r,o,u;return o=a.measure(e),u=a.measure(t),r=function(){switch(n){case"top":return{left:o.left+.5*(o.width-u.width),top:o.top-u.height};case"bottom":return{left:o.left+.5*(o.width-u.width),top:o.top+o.height};default:return a.error("Unknown position %o",n)}}(),t.attr("up-position",n),t.css(r)},o=function(e){var t;return t=a.$createElementFromSelector(".up-tooltip"),a.isGiven(e.text)?t.text(e.text):t.html(e.html),t.appendTo(document.body),t},t=function(t,u){var l,s,c,p,f,d,m;return null==u&&(u={}),l=e(t),f=a.option(u.html,l.attr("up-tooltip-html")),m=a.option(u.text,l.attr("up-tooltip")),d=a.option(u.position,l.attr("up-position"),r.position),p=a.option(u.animation,a.castedAttr(l,"up-animation"),r.openAnimation),c=up.motion.animateOptions(u,l),n(),s=o({text:m,html:f}),i(l,s,d),up.animate(s,p,c)},n=function(t){var n;return n=e(".up-tooltip"),n.length?(t=a.options(t,{animation:r.closeAnimation}),t=a.merge(t,up.motion.animateOptions(t)),up.destroy(n,t)):void 0},up.compiler("[up-tooltip], [up-tooltip-html]",function(e){return e.on("mouseover",function(){return t(e)}),e.on("mouseout",function(){return n()})}),up.on("click","body",function(){return n()}),up.on("up:framework:reset",n),up.bus.onEscape(function(){return n()}),up.on("up:framework:reset",u),{attach:t,close:n,open:function(){return a.error("up.tooltip.open no longer exists. Use up.tooltip.attach instead.")}}}(jQuery)}.call(this),function(){up.navigation=function(e){var t,n,r,o,u,i,a,l,s,c,p,f,d,m,h,v,g;return h=up.util,i=h.config({currentClasses:["up-current"]}),p=function(){return i.reset()},a=function(){var e;return e=i.currentClasses,e=e.concat(["up-current"]),e=h.uniq(e),e.join(" ")},t="up-active",n=["a","[up-href]","[up-alias]"],o=n.join(", "),u=function(){var e,t,r;for(r=[],e=0,t=n.length;t>e;e++)m=n[e],r.push(m+"[up-instant]");return r}().join(", "),r="."+t,c=function(e){return h.isPresent(e)?h.normalizeUrl(e,{search:!1,stripTrailingSlash:!0}):void 0},d=function(e){var t,n,r,o,u,i,a,l,s,p;for(l=[],i=["href","up-href","up-alias"],n=0,o=i.length;o>n;n++)if(t=i[n],s=h.presentAttr(e,t))for(p="up-alias"===t?s.split(" "):[s],r=0,u=p.length;u>r;r++)a=p[r],"#"!==a&&(a=c(a),l.push(a));return l},g=function(e){var t,n,r,o;return e=h.compact(e),r=function(e){return"*"===e.substr(-1)?n(e.slice(0,-1)):t(e)},t=function(t){return h.contains(e,t)},n=function(t){return h.detect(e,function(e){return 0===e.indexOf(t)})},o=function(e){return h.detect(e,r)},{matchesAny:o}},s=function(){var t,n;return t=g([c(up.browser.url()),c(up.modal.url()),c(up.modal.coveredUrl()),c(up.popup.url()),c(up.popup.coveredUrl())]),n=a(),h.each(e(o),function(r){var o,u;return o=e(r),u=d(o),t.matchesAny(u)?o.addClass(n):o.hasClass(n)&&0===o.closest(".up-destroying").length?o.removeClass(n):void 0})},f=function(e){return v(),e=l(e),e.addClass(t)},l=function(e){return h.presence(e.parents(o))||e},v=function(){return e(r).removeClass(t)},up.on("click",o,function(e,t){return h.isUnmodifiedMouseEvent(e)&&!t.is("[up-instant]")?f(t):void 0}),up.on("mousedown",u,function(e,t){return h.isUnmodifiedMouseEvent(e)?f(t):void 0}),up.on("up:fragment:inserted",function(){return v(),s()}),up.on("up:fragment:destroyed",function(e,t){return t.is(".up-modal, .up-popup")?s():void 0}),up.on("up:framework:reset",p),{config:i,defaults:function(){return h.error("up.navigation.defaults(...) no longer exists. Set values on he up.navigation.config property instead.")}}}(jQuery)}.call(this),function(){up.rails=function(e){var t,n;return t=up.util,n=function(e){return e.is("[up-follow], [up-target], [up-modal], [up-popup]")},up.compiler("[data-method]",function(r){return e.rails&&n(r)?(t.setMissingAttrs(r,{"up-method":r.attr("data-method")}),r.removeAttr("data-method")):void 0})}(jQuery)}.call(this),function(){up.boot()}.call(this);
@@ -14,6 +14,7 @@
14
14
  #= require up/modal
15
15
  #= require up/tooltip
16
16
  #= require up/navigation
17
+ #= require up/rails
17
18
 
18
19
  up.boot()
19
20
 
@@ -289,20 +289,21 @@ up.form = (($) ->
289
289
  unless skipCallback
290
290
  clearTimer()
291
291
  nextCallback = -> callback.apply($element.get(0), [value, $element])
292
- callbackTimer = setTimeout(
293
- ->
294
- # Only run the callback once the previous callback's
295
- # promise resolves.
296
- callbackPromise.then ->
297
- returnValue = runNextCallback()
298
- # If the callback returns a promise, we will remember it
299
- # and chain additional callback invocations to it.
300
- if u.isPromise(returnValue)
301
- callbackPromise = returnValue
302
- else
303
- callbackPromise = u.resolvedPromise()
304
- , delay
305
- )
292
+ runAndChain = ->
293
+ # Only run the callback once the previous callback's
294
+ # promise resolves.
295
+ callbackPromise.then ->
296
+ returnValue = runNextCallback()
297
+ # If the callback returns a promise, we will remember it
298
+ # and chain additional callback invocations to it.
299
+ if u.isPromise(returnValue)
300
+ callbackPromise = returnValue
301
+ else
302
+ callbackPromise = u.resolvedPromise()
303
+ if delay == 0
304
+ runAndChain()
305
+ else
306
+ setTimeout(runAndChain, delay)
306
307
 
307
308
  clearTimer = ->
308
309
  clearTimeout(callbackTimer)
@@ -492,7 +493,8 @@ up.form = (($) ->
492
493
  The animation to use when the form is replaced after a successful submission.
493
494
  @param {String} [up-fail-transition]
494
495
  The animation to use when the form is replaced after a failed submission.
495
- @param {String} [up-history='true']
496
+ @param [up-history]
497
+ Set this to `'false'` to prevent the current URL from being updated.
496
498
  @param {String} [up-method]
497
499
  The HTTP method to be used to submit the form (`get`, `post`, `put`, `delete`, `patch`).
498
500
  Alternately you can use an attribute `data-method`
@@ -190,6 +190,64 @@ up.link = (($) ->
190
190
  options = u.options(options)
191
191
  u.option(options.method, $link.attr('up-method'), $link.attr('data-method'), 'get').toUpperCase()
192
192
 
193
+ ###*
194
+ @function up.link.childClicked
195
+ @internal
196
+ ###
197
+ childClicked = (event, $link) ->
198
+ $target = $(event.target)
199
+ $targetLink = $target.closest('a, [up-href]')
200
+ $targetLink.length && $link.find($targetLink).length
201
+
202
+ shouldProcessLinkEvent = (event, $link) ->
203
+ u.isUnmodifiedMouseEvent(event) && !childClicked(event, $link)
204
+
205
+ followVariantSelectors = []
206
+
207
+ ###*
208
+ No-op that is called when we allow a browser's default action to go through,
209
+ so we can spy on it in unit tests. See `link_spec.js`.
210
+
211
+ @function allowDefault
212
+ @internal
213
+ ###
214
+ allowDefault = (event) ->
215
+
216
+ registerFollowVariant = (selector, handler) ->
217
+ followVariantSelectors.push(selector)
218
+ up.on 'click', "a#{selector}, [up-href]#{selector}", (event, $link) ->
219
+ if shouldProcessLinkEvent(event, $link)
220
+ if $link.is('[up-instant]')
221
+ # If the link was already processed on mousedown, we still need
222
+ # to prevent the later click event's default behavior.
223
+ event.preventDefault()
224
+ else
225
+ event.preventDefault()
226
+ handler($link)
227
+ else
228
+ allowDefault(event)
229
+
230
+ up.on 'mousedown', "a#{selector}[up-instant], [up-href]#{selector}[up-instant]", (event, $link) ->
231
+ if shouldProcessLinkEvent(event, $link)
232
+ event.preventDefault()
233
+ handler($link)
234
+
235
+ isFollowable = ($link) ->
236
+ u.any followVariantSelectors, (selector) -> $link.is(selector)
237
+
238
+ ###*
239
+ Makes sure that the given link is handled by Up.js.
240
+
241
+ This is done by giving the link an `up-follow` attribute
242
+ unless it already have it an `up-target` or `up-follow` attribute.
243
+
244
+ @function up.link.makeFollowable
245
+ @internal
246
+ ###
247
+ makeFollowable = (link) ->
248
+ $link = $(link)
249
+ $link.attr('up-follow', '') unless isFollowable($link)
250
+
193
251
  ###*
194
252
  Follows this link via AJAX and replaces a CSS selector in the current page
195
253
  with corresponding elements from a new page fetched from the server:
@@ -252,17 +310,12 @@ up.link = (($) ->
252
310
  Whether to force the use of a cached response (`true`)
253
311
  or never use the cache (`false`)
254
312
  or make an educated guess (`undefined`).
313
+ @param [up-history]
314
+ Set this to `'false'` to prevent the current URL from being updated.
255
315
  @stable
256
316
  ###
257
- up.on 'click', 'a[up-target], [up-href][up-target]', (event, $link) ->
258
- if shouldProcessLinkEvent(event, $link)
259
- if $link.is('[up-instant]')
260
- # If the link was already processed on mousedown, we still need
261
- # to prevent the later click event's default behavior.
262
- event.preventDefault()
263
- else
264
- event.preventDefault()
265
- follow($link)
317
+ registerFollowVariant '[up-target]', ($link) ->
318
+ follow($link)
266
319
 
267
320
  ###*
268
321
  By adding an `up-instant` attribute to a link, the destination will be
@@ -280,39 +333,11 @@ up.link = (($) ->
280
333
  navigation actions this isn't needed. E.g. popular operation
281
334
  systems switch tabs on `mousedown` instead of `click`.
282
335
 
283
- @selector a[up-instant]
284
- @stable
285
- ###
286
- up.on 'mousedown', 'a[up-instant], [up-href][up-instant]', (event, $link) ->
287
- if shouldProcessLinkEvent(event, $link)
288
- event.preventDefault()
289
- follow($link)
290
-
291
- ###*
292
- @function up.link.childClicked
293
- @internal
294
- ###
295
- childClicked = (event, $link) ->
296
- $target = $(event.target)
297
- $targetLink = $target.closest('a, [up-href]')
298
- $targetLink.length && $link.find($targetLink).length
299
-
300
- shouldProcessLinkEvent = (event, $link) ->
301
- u.isUnmodifiedMouseEvent(event) && !childClicked(event, $link)
336
+ `up-instant` will also work for links that open [modals](/up.modal) or [popups](/up.popup).
302
337
 
303
- ###*
304
- Makes sure that the given link is handled by Up.js.
305
-
306
- This is done by giving the link an `up-follow` attribute
307
- unless it already have it an `up-target` or `up-follow` attribute.
308
-
309
- @function up.link.makeFollowable
310
- @internal
338
+ @selector [up-instant]
339
+ @stable
311
340
  ###
312
- makeFollowable = (link) ->
313
- $link = $(link)
314
- if u.isMissing($link.attr('up-target')) && u.isMissing($link.attr('up-follow'))
315
- $link.attr('up-follow', '')
316
341
 
317
342
  ###*
318
343
  If applied on a link, Follows this link via AJAX and replaces the
@@ -339,20 +364,15 @@ up.link = (($) ->
339
364
  @param [up-href]
340
365
  The destination URL to follow.
341
366
  If omitted, the the link's `href` attribute will be used.
367
+ @param [up-history]
368
+ Set this to `'false'` to prevent the current URL from being updated.
342
369
  @param [up-restore-scroll='false']
343
370
  Whether to restore the scroll position of all viewports
344
371
  within the response.
345
372
  @stable
346
373
  ###
347
- up.on 'click', 'a[up-follow], [up-href][up-follow]', (event, $link) ->
348
- if shouldProcessLinkEvent(event, $link)
349
- if $link.is('[up-instant]')
350
- # If the link was already processed on mousedown, we still need
351
- # to prevent the later click event's default behavior.
352
- event.preventDefault()
353
- else
354
- event.preventDefault()
355
- follow($link)
374
+ registerFollowVariant '[up-follow]', ($link) ->
375
+ follow($link)
356
376
 
357
377
  ###*
358
378
  Add an `up-expand` class to any element that contains a link
@@ -371,6 +391,8 @@ up.link = (($) ->
371
391
  In the example above, clicking anywhere within `.notification` element
372
392
  would [follow](/up.follow) the *Close* link.
373
393
 
394
+ `up-expand` also expands links that open [modals](/up.modal) or [popups](/up.popup).
395
+
374
396
  @selector [up-expand]
375
397
  @stable
376
398
  ###
@@ -422,12 +444,15 @@ up.link = (($) ->
422
444
  u.setMissingAttrs($element, newAttrs)
423
445
  $element.removeAttr('up-dash')
424
446
 
447
+
425
448
  knife: eval(Knife?.point)
426
449
  visit: visit
427
450
  follow: follow
428
451
  makeFollowable: makeFollowable
452
+ shouldProcessLinkEvent: shouldProcessLinkEvent
429
453
  childClicked: childClicked
430
454
  followMethod: followMethod
455
+ registerFollowVariant: registerFollowVariant
431
456
 
432
457
  )(jQuery)
433
458