unpoly-rails 0.36.0 → 0.36.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of unpoly-rails might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 106ec2444fc7bd697fcaf0a696f6c8819ee23841
4
- data.tar.gz: 1cb1981639655f61037a51a69807368b7d88c534
3
+ metadata.gz: f505f549a43c1c4e804fc47e48c2a37835cf7739
4
+ data.tar.gz: 97560cda335dace77c46b021ead934dfb5c238aa
5
5
  SHA512:
6
- metadata.gz: 347cd280e9c2bd4447298967f30a57a4654692b514eafcd9405253f4f10a4218f601b3352d18bbaeb85f2d31ff7a23adef3fc458375dd04cc5711f6b2651a69a
7
- data.tar.gz: d2ce70353bfe925743d274f74ff6dbb678f51e0e98335fbaa7d3fa471d3c1b24df9d5fea9d21a9f69335dfcbbfac523abc9131144b866ddeb8d5e5ae1e269af4
6
+ metadata.gz: d21e8a0b207e8f276e35a61e5718140ec413e718283d817a75e160b5a69fec77e873e7f53ca20fce7a75d4244b0cc24eb878c533457c591499d6b0075477cfe1
7
+ data.tar.gz: 9b38c1909c42c4c4461b7881835d63505c0867f0fb02b3ec149157c3d1293f4e907264009eee8ed68ba69b1c443313413b6992d9b9d2e035bd78dacb95a367e8
@@ -1,11 +1,21 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- All notable changes to this project will be documented in this file.
4
+ Changes to this project will be documented in this file.
5
5
 
6
6
  This project mostly adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
8
 
9
+ 0.36.1
10
+ ------
11
+
12
+ ### Compatible changes
13
+
14
+ - [npm package](/install/npm) now expresses Unpoly's dependency on `jquery`.
15
+ - [Modals](/up.modal) no longer close when clicking an element that exists outside the modal's DOM hierarchy.
16
+ - Fix a bug on IE11 where modals would immediately close after opening if the opening link had an [`[up-instant]`](/up-instant) attribute and the destination page was already cached.
17
+
18
+
9
19
  0.36.0
10
20
  ------
11
21
 
@@ -18,7 +28,7 @@ This project mostly adheres to [Semantic Versioning](http://semver.org/).
18
28
  - When [submitting a form](/form-up-target), the `name` and `value` of the submit button is now included with the form parameters.
19
29
  - [Going back in history](/up.history) after a [fragment update](/up.link) now always restores elements the page layer, never a selector in [modals](/up.modal) or [popups](/up.popup).
20
30
  - [Going back in history](/up.history) now always closes a [modal](/up.modal) or [popup](/up.popup).
21
- - Switch to [unpkg](https://unpkg.com) as our CDN.
31
+ - Switch to [unpkg](https://unpkg.com) as our [CDN](/install/cdn).
22
32
 
23
33
 
24
34
  0.35.2
@@ -797,7 +807,7 @@ Refactored internals. No API changes.
797
807
 
798
808
  ### Breaking changes
799
809
 
800
- - `up.bus.emit()` is now [`up.emit()`](http://unpoly.com/up.emit/)
810
+ - `up.bus.emit()` is now [`up.emit()`](/up.emit)
801
811
  - When `up.first()` finds no match, return `undefined` instead of `null`.
802
812
 
803
813
 
@@ -1022,7 +1032,7 @@ Refactored internals. No API changes.
1022
1032
 
1023
1033
  ### Compatible changes
1024
1034
 
1025
- - Unpoly will now emit [events](http://unpoly.com/up.bus) `proxy:busy` and `proxy:idle` whenever it is loading or is done loading content over HTTP.
1035
+ - Unpoly will now emit [events](/up.bus) `proxy:busy` and `proxy:idle` whenever it is loading or is done loading content over HTTP.
1026
1036
  - Add an option `up.proxy.defaults('busyDelay')` to delay the `proxy:busy` event in order to prevent flickering of loading spinners.
1027
1037
 
1028
1038
 
@@ -1073,7 +1083,7 @@ Refactored internals. No API changes.
1073
1083
 
1074
1084
  ### Compatible changes
1075
1085
 
1076
- - Use [up.proxy](http://unpoly.com/up.proxy) when submitting a form.
1086
+ - Use [up.proxy](/up.proxy) when submitting a form.
1077
1087
 
1078
1088
 
1079
1089
  0.7.2
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
- [Unpoly](http://unpoly.com)
1
+ [Unpoly](https://unpoly.com)
2
2
  ======
3
3
 
4
4
  Unobtrusive JavaScript framework for server-side applications
5
5
  -------------------------------------------------------------
6
6
 
7
- [Unpoly](http://unpoly.com) enables fast and flexible frontends with minimal changes to your server-side code.
7
+ [Unpoly](https://unpoly.com) enables fast and flexible frontends with minimal changes to your server-side code.
8
8
 
9
9
  This repository is home to both the Unpoly javascript code and its (optional) bindings for Ruby on Rails (`unpoly-rails` gem).
10
10
 
@@ -12,7 +12,7 @@ This repository is home to both the Unpoly javascript code and its (optional) bi
12
12
  Getting started
13
13
  ---------------
14
14
 
15
- - See [unpoly.com](http://unpoly.com) for more information and JavaScript API documentation.
15
+ - See [unpoly.com](https://unpoly.com) for more information and JavaScript API documentation.
16
16
  - See [`CHANGELOG.md`](https://github.com/unpoly/unpoly/blob/master/CHANGELOG.md) for notable changes.
17
17
  - See [`README_RAILS.md`](https://github.com/unpoly/unpoly/blob/master/README_RAILS.md) documentation of the Rails bindings.
18
18
 
@@ -76,7 +76,7 @@ Always remember to build, commit and push build artifacts before calling `rake p
76
76
 
77
77
  If you have done this process a few times and know what you're doing, you can call `rake publish:all` to run all these steps in sequence.
78
78
 
79
- After you have published all release channels, remember to update [unpoly.com](http://unpoly.com/) so users see the new version, CDN link and CHANGELOG.
79
+ After you have published all release channels, remember to update [unpoly.com](https://unpoly.com/) so users see the new version, CDN link and CHANGELOG.
80
80
 
81
81
 
82
82
  Credits
@@ -1,7 +1,7 @@
1
1
  unpoly-rails: Ruby on Rails bindings for Unpoly
2
2
  ===============================================
3
3
 
4
- [Unpoly](http://unpoly.com) is a backend-agnostic [unobtrusive JavaScript](https://en.wikipedia.org/wiki/Unobtrusive_JavaScript) framework. `unpoly-rails` gives your [Ruby on Rails](http://rubyonrails.org/) application some convenience candy when you are using Unpoly in your frontend.
4
+ [Unpoly](https://unpoly.com) is a backend-agnostic [unobtrusive JavaScript](https://en.wikipedia.org/wiki/Unobtrusive_JavaScript) framework. `unpoly-rails` gives your [Ruby on Rails](http://rubyonrails.org/) application some convenience candy when you are using Unpoly in your frontend.
5
5
 
6
6
 
7
7
  Features
@@ -11,11 +11,11 @@ The methods documented below are available in all controllers, views and helpers
11
11
 
12
12
  ### Detecting a fragment update
13
13
 
14
- To test whether the current request is a [fragment update](http://unpoly.com/up.link):
14
+ To test whether the current request is a [fragment update](https://unpoly.com/up.link):
15
15
 
16
16
  up?
17
17
 
18
- To retrieve the CSS selector that is being [updated](http://unpoly.com/up.link):
18
+ To retrieve the CSS selector that is being [updated](https://unpoly.com/up.link):
19
19
 
20
20
  up.target
21
21
 
@@ -38,7 +38,7 @@ This is useful when you skip rendering the `<head>` in an Unpoly request.
38
38
 
39
39
  ### Detecting an Unpoly form validation
40
40
 
41
- To test whether the current request is a [form validation](http://unpoly.com/up-validate):
41
+ To test whether the current request is a [form validation](https://unpoly.com/up-validate):
42
42
 
43
43
  up.validate?
44
44
 
@@ -66,7 +66,7 @@ When detecting a validation request, the server is expected to validate (but not
66
66
  `unpoly-rails` installs a `before_action` into all controllers which echoes the request's URL as a response header `X-Up-Location` and the request's
67
67
  HTTP method as `X-Up-Method`.
68
68
 
69
- The Unpoly frontend [requires these headers to detect redirects](http://unpoly.com/form-up-target#redirects), which are otherwise undetectable for an AJAX client.
69
+ The Unpoly frontend [requires these headers to detect redirects](https://unpoly.com/form-up-target#redirects), which are otherwise undetectable for an AJAX client.
70
70
 
71
71
  ### Automatic method detection for initial page load
72
72
 
@@ -82,7 +82,7 @@ What you still need to do manually
82
82
 
83
83
  ### Failed form submissions must return a non-200 status code
84
84
 
85
- Unpoly lets you submit forms via AJAX by using the [`form[up-target]`](http://unpoly.com/form-up-target) selector or [`up.submit()`](http://unpoly.com/up.submit) function.
85
+ Unpoly lets you submit forms via AJAX by using the [`form[up-target]`](https://unpoly.com/form-up-target) selector or [`up.submit()`](https://unpoly.com/up.submit) function.
86
86
 
87
87
  For Unpoly to be able to detect a failed form submission, the form must be re-rendered with a non-200 HTTP status code. We recommend to use either 400 (bad request) or 422 (unprocessable entity).
88
88
 
data/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unpoly",
3
- "homepage": "http://unpoly.com",
3
+ "homepage": "https://unpoly.com",
4
4
  "authors": [
5
5
  "Henning Koch <henning@triskweline.de>"
6
6
  ],
@@ -5,7 +5,7 @@
5
5
 
6
6
  (function() {
7
7
  window.up = {
8
- version: "0.36.0",
8
+ version: "0.36.1",
9
9
  renamedModule: function(oldName, newName) {
10
10
  return typeof Object.defineProperty === "function" ? Object.defineProperty(up, oldName, {
11
11
  get: function() {
@@ -92,7 +92,7 @@ that might save you from loading something like [Underscore.js](http://underscor
92
92
  Whether to include an `#hash` anchor in the normalized URL
93
93
  @param {Boolean} [options.search=true]
94
94
  Whether to include a `?query` string in the normalized URL
95
- @param {Boolean} [options.stripTrailingSlash=true]
95
+ @param {Boolean} [options.stripTrailingSlash=false]
96
96
  Whether to strip a trailing slash from the pathname
97
97
  @internal
98
98
  */
@@ -2524,7 +2524,7 @@ The **simplest implementation** is to set these headers for every request.
2524
2524
 
2525
2525
  \#\#\# Optimizing responses
2526
2526
 
2527
- When [updating a fragment](http://unpoly.com/up.link), Unpoly will send
2527
+ When [updating a fragment](/up.link), Unpoly will send
2528
2528
  an additional HTTP header containing the CSS selector that is being replaced:
2529
2529
 
2530
2530
  ```http
@@ -2538,7 +2538,7 @@ expensive sidebar if the sidebar is not targeted.
2538
2538
 
2539
2539
  \#\#\# Pushing a document title to the client
2540
2540
 
2541
- When [updating a fragment](http://unpoly.com/up.link), Unpoly will by default
2541
+ When [updating a fragment](/up.link), Unpoly will by default
2542
2542
  extract the `<title>` from the server response and update the document title accordingly.
2543
2543
 
2544
2544
  The server can also force Unpoly to set a document title by passing a HTTP header:
@@ -2554,7 +2554,7 @@ no longer includes a `<title>`, you can instead use the HTTP header to pass the
2554
2554
 
2555
2555
  \#\#\# Signaling failed form submissions
2556
2556
 
2557
- When [submitting a form via AJAX](http://unpoly.com/form-up-target)
2557
+ When [submitting a form via AJAX](/form-up-target)
2558
2558
  Unpoly needs to know whether the form submission has failed (to update the form with
2559
2559
  validation errors) or succeeded (to update the `up-target` selector).
2560
2560
 
@@ -2581,7 +2581,7 @@ To do so in [Ruby on Rails](http://rubyonrails.org/), pass a [`:status` option t
2581
2581
 
2582
2582
  \#\#\# Detecting live form validations
2583
2583
 
2584
- When [validating a form](http://unpoly.com/up-validate), Unpoly will
2584
+ When [validating a form](/up-validate), Unpoly will
2585
2585
  send an additional HTTP header containing a CSS selector for the form that is
2586
2586
  being updated:
2587
2587
 
@@ -10836,7 +10836,7 @@ or function.
10836
10836
  up.link.onAction('[up-modal]', function($link) {
10837
10837
  return followAsap($link);
10838
10838
  });
10839
- up.on('click', function(event) {
10839
+ up.on('click', '.up-modal', function(event) {
10840
10840
  var $target;
10841
10841
  if (!state.closable) {
10842
10842
  return;
@@ -1,3 +1,3 @@
1
- (function(){window.up={version:"0.36.0",renamedModule:function(t,e){return"function"==typeof Object.defineProperty?Object.defineProperty(up,t,{get:function(){return up.log.warn("up."+t+" has been renamed to up."+e),up[e]}}):void 0}}}).call(this),function(){var t=[].slice,e={}.hasOwnProperty,n=function(t,e){return function(){return t.apply(e,arguments)}};up.util=function(r){var o,i,u,a,s,l,c,p,f,d,h,m,v,g,y,b,w,k,S,A,T,$,P,E,x,D,C,O,F,R,U,H,M,N,j,L,_,K,I,z,W,q,Q,J,B,V,X,G,Y,Z,tt,et,nt,rt,ot,it,ut,at,st,lt,ct,pt,ft,dt,ht,mt,vt,gt,yt,bt,wt,kt,St,At,Tt,$t,Pt,Et,xt,Dt,Ct,Ot,Ft,Rt,Ut,Ht,Mt,Nt,jt,Lt,_t,Kt,It,zt,Wt,qt,Qt,Jt,Bt,Vt,Xt,Gt,Yt,Zt,te,ee,ne,re,oe,ie,ue,ae,se,le,ce,pe,fe,de,he,me;return $t=r.noop,wt=function(e){var n,r;return n=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?n:(r=!0,n=e.apply(null,o))}},ct=function(t,e){return e=e.toString(),(""===e||"80"===e)&&"http:"===t||"443"===e&&"https:"===t},Et=function(t,e){var n,r,o;return n=Nt(t),r=n.protocol+"//"+n.hostname,ct(n.protocol,n.port)||(r+=":"+n.port),o=n.pathname,"/"!==o[0]&&(o="/"+o),(null!=e?e.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=e?e.hash:void 0)===!0&&(r+=n.hash),(null!=e?e.search:void 0)!==!1&&(r+=n.search),r},Nt=function(t){var e;return e=null,pt(t)?(e=r("<a>").attr({href:t}).get(0),Q(e.hostname)&&(e.href=e.href)):e=ce(t),e},Pt=function(t){return t?t.toUpperCase():"GET"},o=function(t){var e,n,o,i,u,a,s,l,c,p,f,d,h,m,v,g;for(v=t.split(/[ >]/),o=null,f=c=0,h=v.length;h>c;f=++c){for(a=v[f],u=a.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),g="div",i=[],p=null,d=0,m=u.length;m>d;d++)switch(s=u[d],s[0]){case".":i.push(s.substr(1));break;case"#":p=s.substr(1);break;default:g=s}l="<"+g,i.length&&(l+=' class="'+i.join(" ")+'"'),p&&(l+=' id="'+p+'"'),l+=">",e=r(l),n&&e.appendTo(n),0===f&&(o=e),n=e}return o},A=function(t,e){var n;return n=document.createElement(t),at(e)&&(n.innerHTML=e),n},i=function(t,e){var n;return null==e&&(e=document.body),n=o(t),n.addClass("up-placeholder"),n.appendTo(e),n},ee=function(t){var e,n,o,i,u,a,s,l,c;if(e=r(t),l=void 0,c=_t(e.attr("up-id")))l="[up-id='"+c+"']";else if(i=_t(e.attr("id")))l="#"+i;else if(s=_t(e.attr("name")))l="[name='"+s+"']";else if(n=_t(Tt(e)))for(l="",o=0,a=n.length;a>o;o++)u=n[o],l+="."+u;else l=e.prop("tagName").toLowerCase();return l},Tt=function(t){var e,n;return e=t.attr("class")||"",n=e.split(" "),te(n,function(t){return at(t)&&!t.match(/^up-/)})},Ut=function(t){return new RegExp("<"+t+"(?: [^>]*)?>","i")},T=function(t){var e,n;return e=Ut("body"),t.match(e)?(n=new DOMParser,n.parseFromString(t,"text/html")):A("div",t)},h=function(){var n,r,o,i,u,a,s;for(a=arguments[0],u=2<=arguments.length?t.call(arguments,1):[],n=0,o=u.length;o>n;n++){i=u[n];for(r in i)e.call(i,r)&&(s=i[r],a[r]=s)}return a},d=Object.assign||h,le=r.trim,D=function(t,e){var n,r,o,i,u;for(u=[],r=n=0,i=t.length;i>n;r=++n)o=t[r],u.push(e(o,r));return u},gt=D,ae=function(t,e){var n,r,o,i;for(i=[],r=n=0,o=t-1;o>=0?o>=n:n>=o;r=o>=0?++n:--n)i.push(e(r));return i},ot=function(t){return null===t},dt=function(t){return void 0===t},B=function(t){return!dt(t)},rt=function(t){return dt(t)||ot(t)},tt=function(t){return!rt(t)},Q=function(t){return rt(t)||ut(t)&&0===Object.keys(t).length||0===t.length},_t=function(t,e){return null==e&&(e=at),e(t)?t:void 0},at=function(t){return!Q(t)},Z=function(t){return"function"==typeof t},pt=function(t){return"string"==typeof t},it=function(t){return"number"==typeof t},et=function(t){return"object"==typeof t&&!!t},ut=function(t){return et(t)||"function"==typeof t},X=function(t){return!(!t||1!==t.nodeType)},nt=function(t){return t instanceof jQuery},st=function(t){return ut(t)&&Z(t.then)},J=function(t){return st(t)&&Z(t.resolve)},q=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},Y=function(t){return t instanceof FormData},se=function(t){return Array.prototype.slice.call(t)},k=function(t){return q(t)?t.slice():et(t)?d({},t):void 0},ce=function(t){return nt(t)?t.get(0):t},kt=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],d.apply(null,[{}].concat(t.call(e)))},Mt=function(t,e){var n,r,o,i;if(o=t?k(t):{},e)for(r in e)n=e[r],i=o[r],tt(i)?ut(n)&&ut(i)&&(o[r]=Mt(i,n)):o[r]=n;return o},Ht=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],E(e,tt)},E=function(t,e){var n,r,o,i;for(i=void 0,r=0,o=t.length;o>r;r++)if(n=t[r],e(n)){i=n;break}return i},p=function(t,e){var n,r,o,i;for(i=!1,r=0,o=t.length;o>r;r++)if(n=t[r],e(n)){i=!0;break}return i},c=function(t,e){var n,r,o,i;for(i=!0,r=0,o=t.length;o>r;r++)if(n=t[r],!e(n)){i=!1;break}return i},y=function(t){return te(t,tt)},pe=function(t){var e;return e={},te(t,function(t){return e.hasOwnProperty(t)?!1:e[t]=!0})},te=function(t,e){var n;return n=[],D(t,function(t){return e(t)?n.push(t):void 0}),n},Wt=function(t,e){return te(t,function(t){return!e(t)})},W=function(t,e){return te(t,function(t){return w(e,t)})},Kt=function(){var e,n,r,o;return e=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,i;for(i=[],t=0,o=r.length;o>t;t++)n=r[t],i.push(e.attr(n));return i}(),E(o,at)},oe=function(t,e){return t>0?setTimeout(e,t):void e()},At=function(t){return setTimeout(t,0)},vt=function(t){return t[t.length-1]},g=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},Zt=wt(function(){var t,e,n;return t=r("<div>"),t.attr("up-viewport",""),t.css({position:"absolute",top:"0",left:"0",width:"100px",height:"100px",overflowY:"scroll"}),t.appendTo(document.body),e=t.get(0),n=e.offsetWidth-e.clientWidth,t.remove(),n}),x=function(){var t,e,n,o,i,u;return e=document.body,t=r(e),u=document.documentElement,n=t.css("overflow-y"),i="scroll"===n,o="hidden"===n,i||!o&&u.scrollHeight>u.clientHeight},Ct=function(e){var n;return n=void 0,function(){var r;return r=1<=arguments.length?t.call(arguments,0):[],null!=e&&(n=e.apply(null,r)),e=void 0,n}},ue=function(t,e,n){var o,i,u;return o=r(t),u=o.css(Object.keys(e)),o.css(e),i=function(){return o.css(u)},n?(n(),i()):Ct(i)},_=function(t){var e,n;return n=t.css(["transform","-webkit-transform"]),Q(n)||"none"===n.transform?(e=function(){return t.css(n)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):e=function(){},e},K=function(t){return t=ce(t),t.offsetHeight},$=function(t,e,n){var o,i,u,s,l,c,p;return o=r(t),n=Mt(n,{duration:300,delay:0,easing:"ease"}),0===n.duration?(o.css(e),Gt()):(i=r.Deferred(),c=Object.keys(e),l={"transition-property":c.join(", "),"transition-duration":n.duration+"ms","transition-delay":n.delay+"ms","transition-timing-function":n.easing},u=o.css(Object.keys(l)),s=function(t){var e;return e=t.originalEvent.propertyName,w(c,e)?i.resolve():void 0},o.on("transitionend",s),i.then(function(){var t;return o.removeClass("up-animating"),o.off("transitionend",s),o.removeData(a),p(),o.css({transition:"none"}),t=!("none"===u["transition-property"]||"all"===u["transition-property"]&&"0"===u["transition-duration"][0]),t?(K(o),o.css(u)):void 0}),o.addClass("up-animating"),p=_(o),o.css(l),o.data(a,i),o.css(e),i)},a="up-animation-deferred",N=function(t){return r(t).each(function(){var t;return(t=jt(this,a))?t.resolve():void 0})},yt=function(t){var e,n;return e=r(t),n=e.css(["margin-top","margin-right","margin-bottom","margin-left"]),{top:parseFloat(n["margin-top"]),right:parseFloat(n["margin-right"]),bottom:parseFloat(n["margin-bottom"]),left:parseFloat(n["margin-left"])}},bt=function(t,e){var n,o,i,u,a,s;return e=Mt(e,{relative:!1,inner:!1,includeMargin:!1}),e.relative?e.relative===!0?u=t.position():(n=r(e.relative),a=t.offset(),n.is(document)?u=a:(i=n.offset(),u={left:a.left-i.left,top:a.top-i.top})):u=t.offset(),o={left:u.left,top:u.top},e.inner?(o.width=t.width(),o.height=t.height()):(o.width=t.outerWidth(),o.height=t.outerHeight()),e.includeMargin&&(s=yt(t),o.left-=s.left,o.top-=s.top,o.height+=s.top+s.bottom,o.width+=s.left+s.right),o},S=function(t,e){var n,r,o,i,u;for(i=t.get(0).attributes,u=[],r=0,o=i.length;o>r;r++)n=i[r],n.specified?u.push(e.attr(n.name,n.value)):u.push(void 0);return u},M=function(t,e){return t.find(e).addBack(e)},O=function(t){return 27===t.keyCode},w=function(t,e){return t.indexOf(e)>=0},v=function(t,e){var n;switch(n=t.attr(e)){case"false":return!1;case"true":return!0;case"":return!0;default:return n}},Ot=function(){var e,n,r,o,i,u;for(o=arguments[0],i=2<=arguments.length?t.call(arguments,1):[],e={},n=0,r=i.length;r>n;n++)u=i[n],o.hasOwnProperty(u)&&(e[u]=o[u]);return e},R=function(){var e,n,r,o,i,u;for(o=arguments[0],i=2<=arguments.length?t.call(arguments,1):[],e=k(o),n=0,r=i.length;r>n;n++)u=i[n],delete e[u];return e},ht=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},mt=function(t){var e;return e=dt(t.button)||0===t.button,e&&ht(t)},Gt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.Deferred(),n.resolve.apply(n,e),n},Yt=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],Gt.apply(null,e).promise()},qt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.Deferred(),n.reject.apply(n,e),n.promise()},lt=function(t){return st(t)&&"resolved"===("function"==typeof t.state?t.state():void 0)},lt=function(t){return st(t)&&"resolved"===("function"==typeof t.state?t.state():void 0)},fe=function(){return r.Deferred()},de=function(){return fe().promise()},xt=function(){return r()},Xt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.when.apply(r,[Gt()].concat(t.call(e))),n.resolve=wt(function(){return D(e,function(t){return t.resolve()})}),n},re=function(t,e){var n,r,o;r=[];for(n in e)o=e[n],rt(t.attr(n))?r.push(t.attr(n,o)):r.push(void 0);return r},Qt=function(t,e){var n;return n=t.indexOf(e),n>=0?(t.splice(n,1),e):void 0},St=function(t){var e,n,o,i,u,a,s;for(u={},s=[],n=[],o=0,i=t.length;i>o;o++)a=t[o],pt(a)?s.push(a):n.push(a);return u.parsed=n,s.length&&(e=s.join(", "),u.parsed.push(e)),u.select=function(){return u.find(void 0)},u.find=function(t){var e,n,o,i,a,s;for(n=xt(),a=u.parsed,o=0,i=a.length;i>o;o++)s=a[o],e=t?t.find(s):r(s),n=n.add(e);return n},u.findWithSelf=function(t){var e;return e=u.find(t),u.doesMatch(t)&&(e=e.add(t)),e},u.doesMatch=function(t){var e;return e=r(t),p(u.parsed,function(t){return e.is(t)})},u.seekUp=function(t){var e,n,o;for(o=r(t),e=o,n=void 0;e.length;){if(u.doesMatch(e)){n=e;break}e=e.parent()}return n||xt()},u},F=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],Z(n)?n.apply(null,e):n},m=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m;return null==e&&(e={}),h=void 0,p=function(){return F(e.size)},o=function(){return F(e.expiry)},f=function(t){return e.key?e.key(t):t.toString()},u=function(){return 0!==p()&&0!==o()},r=function(){return h={}},r(),l=function(){var n;return n=1<=arguments.length?t.call(arguments,0):[],e.logPrefix?(n[0]="["+e.logPrefix+"] "+n[0],up.puts.apply(up,n)):void 0},s=function(){return Object.keys(h)},c=function(){var t,e,n,r;return r=k(s()),t=p(),t&&r.length>=t&&(e=null,n=null,D(r,function(t){var r,o;return r=h[t],o=r.timestamp,!n||n>o?(e=t,n=o):void 0}),e)?delete h[e]:void 0},n=function(t,e){var n;return n=i(t,{silent:!0}),B(n)?d(e,n):void 0},m=function(){return(new Date).valueOf()},d=function(t,e){var n;return u()?(c(),n=f(t),h[n]={timestamp:m(),value:e}):void 0},Qt=function(t){var e;return e=f(t),delete h[e]},a=function(t){var e,n;return e=o(),e?(n=m()-t.timestamp,e>n):!0},i=function(t,e){var n,r;return null==e&&(e={}),r=f(t),(n=h[r])?a(n)?(e.silent||l("Cache hit for '%s'",t),n.value):(e.silent||l("Discarding stale cache entry for '%s'",t),void Qt(t)):void(e.silent||l("Cache miss for '%s'",t))},{alias:n,get:i,set:d,remove:Qt,clear:r,keys:s}},b=function(t){var e;return e=Rt(t),Object.preventExtensions(e),e},Rt=function(t){var e;return null==t&&(t={}),e={},e.reset=function(){var n;return n=t,Z(n)&&(n=n()),d(e,n)},e.reset(),e},he=function(t){var e,n;return t=ce(t),e=t.parentNode,n=se(t.childNodes),D(n,function(n){return e.insertBefore(n,t)}),e.removeChild(t)},Dt=function(t){var e,n;for(e=void 0;(t=t.parent())&&t.length;)if(n=t.css("position"),"absolute"===n||"relative"===n||t.is("body")){e=t;break}return e},G=function(t){var e,n;for(e=r(t);;){if(n=e.css("position"),"fixed"===n)return!0;if(e=e.parent(),0===e.length||e.is(document))return!1}},j=function(t,e){var n,o,i,u;return n=r(t),o=Dt(n),i=n.position(),u=o.offset(),n.css({position:"absolute",left:i.left-u.left,top:i.top-u.top+e.scrollTop(),right:"",bottom:""})},Jt=function(t){var e,n,r,o,i,u,a;if(Y(t))return up.fail("Cannot convert FormData into an array");for(u=Bt(t),e=[],a=u.split("&"),n=0,r=a.length;r>n;n++)i=a[n],at(i)&&(o=i.split("="),e.push({name:decodeURIComponent(o[0]),value:decodeURIComponent(o[1])}));return e},Bt=function(t){var e;return Y(t)?up.fail("Cannot convert FormData into a query string"):at(t)?(e=r.param(t),e=e.replace(/\+/g,"%20")):""},u=function(t){var e,n;return n="input[type=submit], button[type=submit], button:not([type])",e=r(document.activeElement),e.is(n)&&t.has(e)?e:t.find(n).first()},Vt=function(t){var e,n,o,i,a,s;return n=r(t),s=n.find("input[type=file]").length,e=u(n),o=e.attr("name"),i=e.val(),a=s?new FormData(n.get(0)):n.serializeArray(),at(o)&&f(a,o,i),a},f=function(t,e,n){var r;return Y(t)?t.append(e,n):q(t)?t.push({name:e,value:n}):ut(t)?t[e]=n:(pt(t)||rt(t))&&(r=Bt([{name:e,value:n}]),t=at(t)?[t,r].join("&"):r),t},H=function(){var e,n,r,o,i,u;throw e=1<=arguments.length?t.call(arguments,0):[],q(e[0])?(r=e[0],u=e[1]||{}):(r=e,u={}),(o=up.log).error.apply(o,r),me().then(function(){return up.toast.open(r,u)}),n=(i=up.browser).sprintf.apply(i,r),new Error(n)},l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},C=function(t){return t.replace(/[&<>"]/g,function(t){return l[t]})},Lt=function(t,e){var n;return n=t[e],delete t[e],n},jt=function(t,e){var n,o;return n=r(t),o=n.data(e),n.removeData(e),o},U=function(t){var e;return e=vt(t),et(e)&&!nt(e)?t.pop():{}},Ft=function(t){var e;return e=r(t).css("opacity"),tt(e)?parseFloat(e):void 0},me=wt(function(){var t;return r.isReady?Yt():(t=r.Deferred(),r(function(){return t.resolve()}),t.promise())}),z=function(t){return t},V=function(t){return t=ce(t),!jQuery.contains(document.documentElement,t)},It=function(e){var n,o;return n=r.Deferred(),o=function(){var r,o;return r=1<=arguments.length?t.call(arguments,0):[],o=e.apply(null,r),st(o)?o.then(function(){return n.resolve(o)}):n.resolve(o),o},o.promise=n.promise(),o},s=function(){function e(){this.asap=n(this.asap,this),this.poke=n(this.poke,this),this.allTasks=n(this.allTasks,this),this.promise=n(this.promise,this),this.reset=n(this.reset,this),this.reset()}return e.prototype.reset=function(){return this.queue=[],this.currentTask=void 0},e.prototype.promise=function(){var t;return t=gt(this.allTasks(),function(t){return t.promise}),r.when.apply(r,t)},e.prototype.allTasks=function(){var t;return t=[],this.currentTask&&t.push(this.currentTask),t=t.concat(this.queue)},e.prototype.poke=function(){var t;return!this.currentTask&&(this.currentTask=this.queue.shift())?(t=this.currentTask(),t.always(function(t){return function(){return t.currentTask=void 0,t.poke()}}(this))):void 0},e.prototype.asap=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],this.queue=gt(e,It),this.poke()},e}(),ie=function(t){var e;return e=r(t),e.is("[type=checkbox], [type=radio]")&&!e.is(":checked")?void 0:e.val()},ne=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],function(){return gt(e,function(t){return t()})}},zt=function(t){var e,n;return e=r.Deferred(),n=oe(t,function(){return e.resolve()}),e.cancel=function(){return clearTimeout(n)},e},I=function(t){var e,n,r,o;return e=bt(t),r=g(),n=e.left+.5*e.width,o=.5*r.width,o>n?"left":"right"},P=function(t,e){var n;return n=r("<div></div>"),n.insertAfter(t),t.detach(),n.replaceWith(e),t},L=function(t){var e,n,r,o;for(e=[],n=0,r=t.length;r>n;n++)o=t[n],q(o)?e=e.concat(o):e.push(o);return e},ft=function(t){return!!t},{isDetached:V,requestDataAsArray:Jt,requestDataAsQuery:Bt,appendRequestData:f,requestDataFromForm:Vt,offsetParent:Dt,fixedToAbsolute:j,isFixed:G,presentAttr:Kt,createElement:A,parseUrl:Nt,normalizeUrl:Et,normalizeMethod:Pt,createElementFromHtml:T,$createElementFromSelector:o,$createPlaceholder:i,selectorForElement:ee,assign:d,assignPolyfill:h,copy:k,merge:kt,options:Mt,option:Ht,fail:H,each:D,map:gt,times:ae,any:p,all:c,detect:E,select:te,reject:Wt,intersect:W,compact:y,uniq:pe,last:vt,isNull:ot,isDefined:B,isUndefined:dt,isGiven:tt,isMissing:rt,isPresent:at,isBlank:Q,presence:_t,isObject:ut,isFunction:Z,isString:pt,isNumber:it,isElement:X,isJQuery:nt,isPromise:st,isResolvedPromise:lt,isDeferred:J,isHash:et,isArray:q,isFormData:Y,isUnmodifiedKeyEvent:ht,isUnmodifiedMouseEvent:mt,nullJQuery:xt,unJQuery:ce,setTimer:oe,nextFrame:At,measure:bt,temporaryCss:ue,cssAnimate:$,finishCssAnimate:N,forceCompositing:_,forceRepaint:K,escapePressed:O,copyAttributes:S,findWithSelf:M,contains:w,toArray:se,castedAttr:v,clientSize:g,only:Ot,except:R,trim:le,unresolvableDeferred:fe,unresolvablePromise:de,resolvedPromise:Yt,rejectedPromise:qt,resolvedDeferred:Gt,resolvableWhen:Xt,setMissingAttrs:re,remove:Qt,memoize:wt,scrollbarWidth:Zt,documentHasVerticalScrollbar:x,config:b,openConfig:Rt,cache:m,unwrapElement:he,multiSelector:St,error:H,pluckData:jt,pluckKey:Lt,extractOptions:U,isDetached:V,noop:$t,opacity:Ft,whenReady:me,identity:z,escapeHtml:C,DivertibleChain:s,submittedValue:ie,sequence:ne,promiseTimer:zt,previewable:It,evalOption:F,horizontalScreenHalf:I,detachWith:P,flatten:L,isTruthy:ft}}(jQuery),up.fail=up.util.fail}.call(this),function(){up.protocol=function(t){var e,n,r,o,i,u;return u=up.util,r=function(t){return t.getResponseHeader(e.locationHeader)},i=function(t){return t.getResponseHeader(e.titleHeader)},o=function(t){var n;return(n=t.getResponseHeader(e.methodHeader))?u.normalizeMethod(n):void 0},n=u.memoize(function(){var t;return t=up.browser.popCookie(e.methodCookie),(t||"get").toLowerCase()}),e=u.config({targetHeader:"X-Up-Target",locationHeader:"X-Up-Location",validateHeader:"X-Up-Validate",titleHeader:"X-Up-Title",methodHeader:"X-Up-Method",methodCookie:"_up_method",methodParam:"_method"}),{config:e,locationFromXhr:r,titleFromXhr:i,methodFromXhr:o,initialRequestMethod:n}}(jQuery)}.call(this),function(){var slice=[].slice;up.browser=function($){var CONSOLE_PLACEHOLDERS,canConsole,canCssTransition,canDomParser,canFormData,canInputEvent,canPushState,hash,isIE10OrWorse,isRecentJQuery,isSupported,loadPage,polyfilledSessionStorage,popCookie,puts,sessionStorage,setLocationHref,sprintf,sprintfWithFormattedArgs,stringifyArg,submitForm,u,url,whenConfirmed;return u=up.util,loadPage=function(t,e){var n,r,o,i,a;return null==e&&(e={}),i=u.option(e.method,"get").toLowerCase(),"get"===i?(a=u.requestDataAsQuery(e.data),a&&(t=t+"?"+a),setLocationHref(t)):(n=$("<form method='post' action='"+t+"' class='up-page-loader'></form>"),r=function(t){var e;return e=$('<input type="hidden">'),e.attr(t),e.appendTo(n)},r({name:up.protocol.config.methodParam,value:i}),(o=up.rails.csrfField())&&r(o),u.each(u.requestDataAsArray(e.data),r),n.hide().appendTo("body"),submitForm(n))},submitForm=function(t){return t.submit()},setLocationHref=function(t){return location.href=t},puts=function(){var t,e;return e=arguments[0],t=2<=arguments.length?slice.call(arguments,1):[],console[e].apply(console,t)},CONSOLE_PLACEHOLDERS=/\%[odisf]/g,stringifyArg=function(t){var e,n,r,o,i,a,s,l,c;if(a=200,r="",u.isString(t))l=t.replace(/[\n\r\t ]+/g," "),l=l.replace(/^[\n\r\t ]+/,""),l=l.replace(/[\n\r\t ]$/,""),l='"'+l+'"',r='"';else if(u.isUndefined(t))l="undefined";else if(u.isNumber(t)||u.isFunction(t))l=t.toString();else if(u.isArray(t))l="["+u.map(t,stringifyArg).join(", ")+"]",r="]";else if(u.isJQuery(t))l="$("+u.map(t,stringifyArg).join(", ")+")",r=")";else if(u.isElement(t)){for(e=$(t),l="<"+t.tagName.toLowerCase(),s=["id","name","class"],o=0,i=s.length;i>o;o++)n=s[o],(c=e.attr(n))&&(l+=" "+n+'="'+c+'"');l+=">",r=">"}else l=JSON.stringify(t);return l.length>a&&(l=l.substr(0,a)+" \u2026",l+=r),l},sprintf=function(){var t,e;return e=arguments[0],t=2<=arguments.length?slice.call(arguments,1):[],sprintfWithFormattedArgs.apply(null,[u.identity,e].concat(slice.call(t)))},sprintfWithFormattedArgs=function(){var t,e,n,r;return e=arguments[0],r=arguments[1],t=3<=arguments.length?slice.call(arguments,2):[],u.isBlank(r)?"":(n=0,r.replace(CONSOLE_PLACEHOLDERS,function(){var r;return r=t[n],r=e(stringifyArg(r)),n+=1,r}))},url=function(){return location.href},isIE10OrWorse=u.memoize(function(){return!window.atob}),canPushState=u.memoize(function(){return u.isDefined(history.pushState)&&"get"===up.protocol.initialRequestMethod()}),canCssTransition=u.memoize(function(){return"transition"in document.documentElement.style}),canInputEvent=u.memoize(function(){return"oninput"in document.createElement("input")}),canFormData=u.memoize(function(){return!!window.FormData}),canDomParser=u.memoize(function(){return!!window.DOMParser}),canConsole=u.memoize(function(){return window.console&&console.debug&&console.info&&console.warn&&console.error&&console.group&&console.groupCollapsed&&console.groupEnd}),isRecentJQuery=u.memoize(function(){var t,e,n,r;return r=$.fn.jquery,n=r.split("."),t=parseInt(n[0]),e=parseInt(n[1]),t>=2||1===t&&e>=9}),popCookie=function(t){var e,n;return n=null!=(e=document.cookie.match(new RegExp(t+"=(\\w+)")))?e[1]:void 0,u.isPresent(n)&&(document.cookie=t+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"),n},whenConfirmed=function(t){return t.preload||u.isBlank(t.confirm)||window.confirm(t.confirm)?u.resolvedPromise():u.unresolvablePromise()},isSupported=function(){return!isIE10OrWorse()&&isRecentJQuery()&&canConsole()&&canPushState()&&canDomParser()&&canFormData()&&canCssTransition()&&canInputEvent()},sessionStorage=u.memoize(function(){try{return window.sessionStorage}catch(t){return polyfilledSessionStorage()}}),polyfilledSessionStorage=function(){var t;return t={},{getItem:function(e){return t[e]},setItem:function(e,n){return t[e]=n}}},hash=function(t){return t||(t=location.hash),t||(t=""),"#"===t[0]&&(t=t.substr(1)),u.presence(t)},{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),url:url,loadPage:loadPage,canPushState:canPushState,whenConfirmed:whenConfirmed,isSupported:isSupported,puts:puts,sprintf:sprintf,sprintfWithFormattedArgs:sprintfWithFormattedArgs,sessionStorage:sessionStorage,popCookie:popCookie,hash:hash}}(jQuery)}.call(this),function(){var slice=[].slice;up.bus=function($){var boot,consumeAction,emit,emitReset,forgetUpDescription,haltEvent,live,liveUpDescriptions,logEmission,nextUpDescriptionNumber,nobodyPrevents,onEscape,rememberUpDescription,restoreSnapshot,snapshot,u,unbind,upDescriptionNumber,upDescriptionToJqueryDescription,upListenerToJqueryListener,whenEmitted;return u=up.util,liveUpDescriptions={},nextUpDescriptionNumber=0,upListenerToJqueryListener=function(t){return function(e){var n;return n=e.$element||$(this),t.apply(n.get(0),[e,n,up.syntax.data(n)])}},upDescriptionToJqueryDescription=function(t,e){var n,r,o;return n=u.copy(t),o=n.pop(),r=void 0,e?(r=upListenerToJqueryListener(o),o._asJqueryListener=r,o._descriptionNumber=++nextUpDescriptionNumber):(r=o._asJqueryListener,r||up.fail("up.off: The event listener %o was never registered through up.on")),n.push(r),n},live=function(){var t,e,n;return n=1<=arguments.length?slice.call(arguments,0):[],up.browser.isSupported()?(t=upDescriptionToJqueryDescription(n,!0),rememberUpDescription(n),(e=$(document)).on.apply(e,t),function(){return unbind.apply(null,n)}):function(){}},unbind=function(){var t,e,n;return n=1<=arguments.length?slice.call(arguments,0):[],t=upDescriptionToJqueryDescription(n,!1),forgetUpDescription(n),(e=$(document)).off.apply(e,t)},rememberUpDescription=function(t){var e;return e=upDescriptionNumber(t),liveUpDescriptions[e]=t},forgetUpDescription=function(t){var e;return e=upDescriptionNumber(t),delete liveUpDescriptions[e]},upDescriptionNumber=function(t){return u.last(t)._descriptionNumber},emit=function(t,e){var n,r;return null==e&&(e={}),r=$.Event(t,e),(n=e.$element)?delete e.$element:n=$(document),logEmission(t,e),n.trigger(r),r},logEmission=function(t,e){var n,r,o;return e.hasOwnProperty("message")?(n=e.message,delete e.message,n!==!1&&(u.isArray(n)?(o=n,n=o[0],r=2<=o.length?slice.call(o,1):[]):r=[],n)?u.isPresent(e)?up.puts.apply(up,[n+" (%s (%o))"].concat(slice.call(r),[t],[e])):up.puts.apply(up,[n+" (%s)"].concat(slice.call(r),[t])):void 0):u.isPresent(e)?up.puts("Emitted event %s (%o)",t,e):up.puts("Emitted event %s",t)},nobodyPrevents=function(){var t,e;return t=1<=arguments.length?slice.call(arguments,0):[],e=emit.apply(null,t),e.isDefaultPrevented()?(up.puts("An observer prevented the event %s",t[0]),!1):!0},whenEmitted=function(){var t,e;return t=1<=arguments.length?slice.call(arguments,0):[],e=$.Deferred(),nobodyPrevents.apply(null,t)&&e.resolve(),e.promise()},onEscape=function(t){return live("keydown","body",function(e){return u.escapePressed(e)?t(e):void 0})},haltEvent=function(t){return t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault()},consumeAction=function(t){return haltEvent(t),"up:action:consumed"!==t.type?emit("up:action:consumed",{$element:$(t.target),message:!1}):void 0},snapshot=function(){var t,e,n,r;for(r=[],e=0,n=liveUpDescriptions.length;n>e;e++)t=liveUpDescriptions[e],r.push(t.isDefault=!0);return r},restoreSnapshot=function(){var t,e,n,r,o;for(e=u.reject(liveUpDescriptions,function(t){return t.isDefault}),o=[],n=0,r=e.length;r>n;n++)t=e[n],o.push(unbind.apply(null,t));return o},emitReset=function(){return emit("up:framework:reset",{message:"Resetting framework"})},boot=function(){return up.browser.isSupported()?(emit("up:framework:boot",{message:"Booting framework"}),emit("up:framework:booted",{message:"Framework booted"}),u.nextFrame(function(){return u.whenReady().then(function(){return emit("up:app:boot",{message:"Booting user application"}),emit("up:app:booted",{message:"User application booted"})})})):"function"==typeof console.log?console.log("Unpoly doesn't support this browser. Framework was not booted."):void 0},live("up:framework:booted",snapshot),live("up:framework:reset",restoreSnapshot),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),on:live,off:unbind,emit:emit,nobodyPrevents:nobodyPrevents,whenEmitted:whenEmitted,onEscape:onEscape,emitReset:emitReset,haltEvent:haltEvent,consumeAction:consumeAction,boot:boot}}(jQuery),up.on=up.bus.on,up.off=up.bus.off,up.emit=up.bus.emit,up.reset=up.bus.emitReset,up.boot=up.bus.boot}.call(this),function(){var t=[].slice;up.log=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v;return m=up.util,r=up.browser,n="up.log.enabled",o=m.config({prefix:"[UP] ",enabled:"true"===r.sessionStorage().getItem(n),collapse:!1}),d=function(){return o.reset()},c=function(t){return""+o.prefix+t},i=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],o.enabled&&n?r.puts.apply(r,["debug",c(n)].concat(t.call(e))):void 0},f=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],o.enabled&&n?r.puts.apply(r,["log",c(n)].concat(t.call(e))):void 0},v=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n?r.puts.apply(r,["warn",c(n)].concat(t.call(e))):void 0},l=function(){var e,n,i,u;if(i=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n=e.pop(),!o.enabled||!i)return n();u=o.collapse?"groupCollapsed":"group",r.puts.apply(r,[u,c(i)].concat(t.call(e)));try{return n()}finally{i&&r.puts("groupEnd")}},s=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n?r.puts.apply(r,["error",c(n)].concat(t.call(e))):void 0},p=function(){var t;return t=" __ _____ ___ ___ / /_ __\n"+("/ // / _ \\/ _ \\/ _ \\/ / // / "+up.version+"\n")+"\\___/_//_/ .__/\\___/_/\\_. / \n / / / /\n\n",t+=o.enabled?"Call `up.log.disable()` to disable logging for this session.":"Call `up.log.enable()` to enable logging for this session.",r.puts("log",t)},up.on("up:framework:boot",p),up.on("up:framework:reset",d),h=function(t){return r.sessionStorage().setItem(n,t.toString()),o.enabled=t},a=function(){return h(!0)},u=function(){return h(!1)},{puts:f,debug:i,error:s,warn:v,group:l,config:o,enable:a,disable:u}}(jQuery),up.puts=up.log.puts}.call(this),function(){var t=[].slice;up.toast=function(e){var n,r,o,i,u,a,s,l,c,p;return p=up.util,o=up.browser,n=function(t){return"<span class='up-toast-variable'>"+p.escapeHtml(t)+"</span>"},c=p.config({$toast:null}),l=function(){return i(),c.reset()},a=function(e){return p.isArray(e)?(e[0]=p.escapeHtml(e[0]),e=o.sprintfWithFormattedArgs.apply(o,[n].concat(t.call(e)))):e=p.escapeHtml(e),e},u=function(){return!!c.$toast},r=function(t,n,r){var o;return o=e('<span class="up-toast-action"></span>').text(n),o.on("click",r),o.appendTo(t)},s=function(t,n){var o,u,s,l;return null==n&&(n={}),i(),s=e('<div class="up-toast"></div>').prependTo("body"),u=e('<div class="up-toast-message"></div>').appendTo(s),o=e('<div class="up-toast-actions"></div>').appendTo(s),t=a(t),u.html(t),(l=n.action||n.inspect)&&r(o,l.label,l.callback),r(o,"Close",i),c.$toast=s},i=function(){return u()?(c.$toast.remove(),c.$toast=null):void 0},up.on("up:framework:reset",l),{open:s,close:i,reset:l,isOpen:u}}(jQuery)}.call(this),function(){var t=[].slice;up.syntax=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v,g,y;return y=up.util,n="up-destructible",r="up-destructors",c=[],m=[],l=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],d.apply(null,[c].concat(t.call(e)))},h=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],d.apply(null,[m].concat(t.call(e)))},u=function(){var e,n,r,o;return o=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n=e.pop(),r=y.options(e[0],{priority:0}),"first"===r.priority?r.priority=Number.POSITIVE_INFINITY:"last"===r.priority&&(r.priority=Number.NEGATIVE_INFINITY),{selector:o,callback:n,priority:r.priority,batch:r.batch,keep:r.keep}},d=function(){var e,n,r,o,i;if(i=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()){for(r=u.apply(null,e),n=0;(o=i[n])&&o.priority>=r.priority;)n+=1;return i.splice(n,0,r)}},i=function(t,e,n){var r,i,u,a,s,l,c;for(up.puts(t.isDefault?void 0:"Compiling '%s' on %o",t.selector,n),t.keep&&(c=y.isString(t.keep)?t.keep:"",e.attr("up-keep",c)),l=t.callback.apply(n,[e,p(e)]),a=f(l),s=[],i=0,u=a.length;u>i;i++)r=a[i],s.push(o(e,r));return s},f=function(t){return y.isFunction(t)?[t]:y.isArray(t)&&y.all(t,y.isFunction)?t:[]},o=function(t,e){var o;return t.addClass(n),o=t.data(r)||[],o.push(e),t.data(r,o)},s=function(t,n){var r;return n=y.options(n),r=e(n.skip),up.log.group("Compiling fragment %o",t.get(0),function(){var n,o,u,a,s,p;for(s=[m,c],p=[],o=0,u=s.length;u>o;o++)a=s[o],p.push(function(){var o,u,s;for(s=[],o=0,u=a.length;u>o;o++)l=a[o],n=y.findWithSelf(t,l.selector),n=n.filter(function(){var t;return t=e(this),y.all(r,function(e){return 0===t.closest(e).length})}),n.length?s.push(up.log.group(l.isDefault?void 0:"Compiling '%s' on %d element(s)",l.selector,n.length,function(){return l.batch?i(l,n,n.get()):n.each(function(){return i(l,e(this),this)})})):s.push(void 0);return s}());return p})},a=function(t){return y.findWithSelf(t,"."+n).each(function(){var t,o,i,u,a;if(t=e(this),i=t.data(r)){for(u=0,a=i.length;a>u;u++)(o=i[u])();return t.removeData(r),t.removeClass(n)}})},p=function(t){var n,r;return n=e(t),r=n.attr("up-data"),y.isString(r)&&""!==y.trim(r)?JSON.parse(r):{}},g=function(){var t;return t=function(t){return t.isDefault=!0},y.each(c,t),y.each(m,t)},v=function(){var t;return t=function(t){return t.isDefault},c=y.select(c,t),m=y.select(m,t)},up.on("up:framework:booted",g),up.on("up:framework:reset",v),{compiler:l,macro:h,compile:s,clean:a,data:p}}(jQuery),up.compiler=up.syntax.compiler,up.macro=up.syntax.macro}.call(this),function(){up.history=function(t){var e,n,r,o,i,u,a,s,l,c,p,f,d,h,m,v;return v=up.util,n=v.config({popTargets:["body"],restoreScroll:!0}),c=void 0,u=void 0,h=function(){return n.reset(),c=void 0,u=void 0},a=function(t,e){return e||(e={}),e.hash=!0,v.normalizeUrl(t,e)},r=function(t){return a(up.browser.url(),t)},o=function(t){var e;return e={stripTrailingSlash:!0},a(t,e)===r(e)},s=function(t){return u&&(c=u,u=void 0),u=t},d=function(t){return i("replaceState",t)},p=function(t,e){return e=v.options(e,{force:!1}),t=a(t),!e.force&&o(t)||!up.bus.nobodyPrevents("up:history:push",{url:t,message:"Adding history entry for "+t})?void 0:(i("pushState",t),up.emit("up:history:pushed",{url:t,message:"Advanced to location "+t
1
+ (function(){window.up={version:"0.36.1",renamedModule:function(t,e){return"function"==typeof Object.defineProperty?Object.defineProperty(up,t,{get:function(){return up.log.warn("up."+t+" has been renamed to up."+e),up[e]}}):void 0}}}).call(this),function(){var t=[].slice,e={}.hasOwnProperty,n=function(t,e){return function(){return t.apply(e,arguments)}};up.util=function(r){var o,i,u,a,s,l,c,p,f,d,h,m,v,g,y,b,w,k,S,A,T,$,P,E,x,D,C,O,F,R,U,H,M,N,j,L,_,K,I,z,W,q,Q,J,B,V,X,G,Y,Z,tt,et,nt,rt,ot,it,ut,at,st,lt,ct,pt,ft,dt,ht,mt,vt,gt,yt,bt,wt,kt,St,At,Tt,$t,Pt,Et,xt,Dt,Ct,Ot,Ft,Rt,Ut,Ht,Mt,Nt,jt,Lt,_t,Kt,It,zt,Wt,qt,Qt,Jt,Bt,Vt,Xt,Gt,Yt,Zt,te,ee,ne,re,oe,ie,ue,ae,se,le,ce,pe,fe,de,he,me;return $t=r.noop,wt=function(e){var n,r;return n=void 0,r=!1,function(){var o;return o=1<=arguments.length?t.call(arguments,0):[],r?n:(r=!0,n=e.apply(null,o))}},ct=function(t,e){return e=e.toString(),(""===e||"80"===e)&&"http:"===t||"443"===e&&"https:"===t},Et=function(t,e){var n,r,o;return n=Nt(t),r=n.protocol+"//"+n.hostname,ct(n.protocol,n.port)||(r+=":"+n.port),o=n.pathname,"/"!==o[0]&&(o="/"+o),(null!=e?e.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=e?e.hash:void 0)===!0&&(r+=n.hash),(null!=e?e.search:void 0)!==!1&&(r+=n.search),r},Nt=function(t){var e;return e=null,pt(t)?(e=r("<a>").attr({href:t}).get(0),Q(e.hostname)&&(e.href=e.href)):e=ce(t),e},Pt=function(t){return t?t.toUpperCase():"GET"},o=function(t){var e,n,o,i,u,a,s,l,c,p,f,d,h,m,v,g;for(v=t.split(/[ >]/),o=null,f=c=0,h=v.length;h>c;f=++c){for(a=v[f],u=a.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),g="div",i=[],p=null,d=0,m=u.length;m>d;d++)switch(s=u[d],s[0]){case".":i.push(s.substr(1));break;case"#":p=s.substr(1);break;default:g=s}l="<"+g,i.length&&(l+=' class="'+i.join(" ")+'"'),p&&(l+=' id="'+p+'"'),l+=">",e=r(l),n&&e.appendTo(n),0===f&&(o=e),n=e}return o},A=function(t,e){var n;return n=document.createElement(t),at(e)&&(n.innerHTML=e),n},i=function(t,e){var n;return null==e&&(e=document.body),n=o(t),n.addClass("up-placeholder"),n.appendTo(e),n},ee=function(t){var e,n,o,i,u,a,s,l,c;if(e=r(t),l=void 0,c=_t(e.attr("up-id")))l="[up-id='"+c+"']";else if(i=_t(e.attr("id")))l="#"+i;else if(s=_t(e.attr("name")))l="[name='"+s+"']";else if(n=_t(Tt(e)))for(l="",o=0,a=n.length;a>o;o++)u=n[o],l+="."+u;else l=e.prop("tagName").toLowerCase();return l},Tt=function(t){var e,n;return e=t.attr("class")||"",n=e.split(" "),te(n,function(t){return at(t)&&!t.match(/^up-/)})},Ut=function(t){return new RegExp("<"+t+"(?: [^>]*)?>","i")},T=function(t){var e,n;return e=Ut("body"),t.match(e)?(n=new DOMParser,n.parseFromString(t,"text/html")):A("div",t)},h=function(){var n,r,o,i,u,a,s;for(a=arguments[0],u=2<=arguments.length?t.call(arguments,1):[],n=0,o=u.length;o>n;n++){i=u[n];for(r in i)e.call(i,r)&&(s=i[r],a[r]=s)}return a},d=Object.assign||h,le=r.trim,D=function(t,e){var n,r,o,i,u;for(u=[],r=n=0,i=t.length;i>n;r=++n)o=t[r],u.push(e(o,r));return u},gt=D,ae=function(t,e){var n,r,o,i;for(i=[],r=n=0,o=t-1;o>=0?o>=n:n>=o;r=o>=0?++n:--n)i.push(e(r));return i},ot=function(t){return null===t},dt=function(t){return void 0===t},B=function(t){return!dt(t)},rt=function(t){return dt(t)||ot(t)},tt=function(t){return!rt(t)},Q=function(t){return rt(t)||ut(t)&&0===Object.keys(t).length||0===t.length},_t=function(t,e){return null==e&&(e=at),e(t)?t:void 0},at=function(t){return!Q(t)},Z=function(t){return"function"==typeof t},pt=function(t){return"string"==typeof t},it=function(t){return"number"==typeof t},et=function(t){return"object"==typeof t&&!!t},ut=function(t){return et(t)||"function"==typeof t},X=function(t){return!(!t||1!==t.nodeType)},nt=function(t){return t instanceof jQuery},st=function(t){return ut(t)&&Z(t.then)},J=function(t){return st(t)&&Z(t.resolve)},q=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},Y=function(t){return t instanceof FormData},se=function(t){return Array.prototype.slice.call(t)},k=function(t){return q(t)?t.slice():et(t)?d({},t):void 0},ce=function(t){return nt(t)?t.get(0):t},kt=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],d.apply(null,[{}].concat(t.call(e)))},Mt=function(t,e){var n,r,o,i;if(o=t?k(t):{},e)for(r in e)n=e[r],i=o[r],tt(i)?ut(n)&&ut(i)&&(o[r]=Mt(i,n)):o[r]=n;return o},Ht=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],E(e,tt)},E=function(t,e){var n,r,o,i;for(i=void 0,r=0,o=t.length;o>r;r++)if(n=t[r],e(n)){i=n;break}return i},p=function(t,e){var n,r,o,i;for(i=!1,r=0,o=t.length;o>r;r++)if(n=t[r],e(n)){i=!0;break}return i},c=function(t,e){var n,r,o,i;for(i=!0,r=0,o=t.length;o>r;r++)if(n=t[r],!e(n)){i=!1;break}return i},y=function(t){return te(t,tt)},pe=function(t){var e;return e={},te(t,function(t){return e.hasOwnProperty(t)?!1:e[t]=!0})},te=function(t,e){var n;return n=[],D(t,function(t){return e(t)?n.push(t):void 0}),n},Wt=function(t,e){return te(t,function(t){return!e(t)})},W=function(t,e){return te(t,function(t){return w(e,t)})},Kt=function(){var e,n,r,o;return e=arguments[0],r=2<=arguments.length?t.call(arguments,1):[],o=function(){var t,o,i;for(i=[],t=0,o=r.length;o>t;t++)n=r[t],i.push(e.attr(n));return i}(),E(o,at)},oe=function(t,e){return t>0?setTimeout(e,t):void e()},At=function(t){return setTimeout(t,0)},vt=function(t){return t[t.length-1]},g=function(){var t;return t=document.documentElement,{width:t.clientWidth,height:t.clientHeight}},Zt=wt(function(){var t,e,n;return t=r("<div>"),t.attr("up-viewport",""),t.css({position:"absolute",top:"0",left:"0",width:"100px",height:"100px",overflowY:"scroll"}),t.appendTo(document.body),e=t.get(0),n=e.offsetWidth-e.clientWidth,t.remove(),n}),x=function(){var t,e,n,o,i,u;return e=document.body,t=r(e),u=document.documentElement,n=t.css("overflow-y"),i="scroll"===n,o="hidden"===n,i||!o&&u.scrollHeight>u.clientHeight},Ct=function(e){var n;return n=void 0,function(){var r;return r=1<=arguments.length?t.call(arguments,0):[],null!=e&&(n=e.apply(null,r)),e=void 0,n}},ue=function(t,e,n){var o,i,u;return o=r(t),u=o.css(Object.keys(e)),o.css(e),i=function(){return o.css(u)},n?(n(),i()):Ct(i)},_=function(t){var e,n;return n=t.css(["transform","-webkit-transform"]),Q(n)||"none"===n.transform?(e=function(){return t.css(n)},t.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):e=function(){},e},K=function(t){return t=ce(t),t.offsetHeight},$=function(t,e,n){var o,i,u,s,l,c,p;return o=r(t),n=Mt(n,{duration:300,delay:0,easing:"ease"}),0===n.duration?(o.css(e),Gt()):(i=r.Deferred(),c=Object.keys(e),l={"transition-property":c.join(", "),"transition-duration":n.duration+"ms","transition-delay":n.delay+"ms","transition-timing-function":n.easing},u=o.css(Object.keys(l)),s=function(t){var e;return e=t.originalEvent.propertyName,w(c,e)?i.resolve():void 0},o.on("transitionend",s),i.then(function(){var t;return o.removeClass("up-animating"),o.off("transitionend",s),o.removeData(a),p(),o.css({transition:"none"}),t=!("none"===u["transition-property"]||"all"===u["transition-property"]&&"0"===u["transition-duration"][0]),t?(K(o),o.css(u)):void 0}),o.addClass("up-animating"),p=_(o),o.css(l),o.data(a,i),o.css(e),i)},a="up-animation-deferred",N=function(t){return r(t).each(function(){var t;return(t=jt(this,a))?t.resolve():void 0})},yt=function(t){var e,n;return e=r(t),n=e.css(["margin-top","margin-right","margin-bottom","margin-left"]),{top:parseFloat(n["margin-top"]),right:parseFloat(n["margin-right"]),bottom:parseFloat(n["margin-bottom"]),left:parseFloat(n["margin-left"])}},bt=function(t,e){var n,o,i,u,a,s;return e=Mt(e,{relative:!1,inner:!1,includeMargin:!1}),e.relative?e.relative===!0?u=t.position():(n=r(e.relative),a=t.offset(),n.is(document)?u=a:(i=n.offset(),u={left:a.left-i.left,top:a.top-i.top})):u=t.offset(),o={left:u.left,top:u.top},e.inner?(o.width=t.width(),o.height=t.height()):(o.width=t.outerWidth(),o.height=t.outerHeight()),e.includeMargin&&(s=yt(t),o.left-=s.left,o.top-=s.top,o.height+=s.top+s.bottom,o.width+=s.left+s.right),o},S=function(t,e){var n,r,o,i,u;for(i=t.get(0).attributes,u=[],r=0,o=i.length;o>r;r++)n=i[r],n.specified?u.push(e.attr(n.name,n.value)):u.push(void 0);return u},M=function(t,e){return t.find(e).addBack(e)},O=function(t){return 27===t.keyCode},w=function(t,e){return t.indexOf(e)>=0},v=function(t,e){var n;switch(n=t.attr(e)){case"false":return!1;case"true":return!0;case"":return!0;default:return n}},Ot=function(){var e,n,r,o,i,u;for(o=arguments[0],i=2<=arguments.length?t.call(arguments,1):[],e={},n=0,r=i.length;r>n;n++)u=i[n],o.hasOwnProperty(u)&&(e[u]=o[u]);return e},R=function(){var e,n,r,o,i,u;for(o=arguments[0],i=2<=arguments.length?t.call(arguments,1):[],e=k(o),n=0,r=i.length;r>n;n++)u=i[n],delete e[u];return e},ht=function(t){return!(t.metaKey||t.shiftKey||t.ctrlKey)},mt=function(t){var e;return e=dt(t.button)||0===t.button,e&&ht(t)},Gt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.Deferred(),n.resolve.apply(n,e),n},Yt=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],Gt.apply(null,e).promise()},qt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.Deferred(),n.reject.apply(n,e),n.promise()},lt=function(t){return st(t)&&"resolved"===("function"==typeof t.state?t.state():void 0)},lt=function(t){return st(t)&&"resolved"===("function"==typeof t.state?t.state():void 0)},fe=function(){return r.Deferred()},de=function(){return fe().promise()},xt=function(){return r()},Xt=function(){var e,n;return e=1<=arguments.length?t.call(arguments,0):[],n=r.when.apply(r,[Gt()].concat(t.call(e))),n.resolve=wt(function(){return D(e,function(t){return t.resolve()})}),n},re=function(t,e){var n,r,o;r=[];for(n in e)o=e[n],rt(t.attr(n))?r.push(t.attr(n,o)):r.push(void 0);return r},Qt=function(t,e){var n;return n=t.indexOf(e),n>=0?(t.splice(n,1),e):void 0},St=function(t){var e,n,o,i,u,a,s;for(u={},s=[],n=[],o=0,i=t.length;i>o;o++)a=t[o],pt(a)?s.push(a):n.push(a);return u.parsed=n,s.length&&(e=s.join(", "),u.parsed.push(e)),u.select=function(){return u.find(void 0)},u.find=function(t){var e,n,o,i,a,s;for(n=xt(),a=u.parsed,o=0,i=a.length;i>o;o++)s=a[o],e=t?t.find(s):r(s),n=n.add(e);return n},u.findWithSelf=function(t){var e;return e=u.find(t),u.doesMatch(t)&&(e=e.add(t)),e},u.doesMatch=function(t){var e;return e=r(t),p(u.parsed,function(t){return e.is(t)})},u.seekUp=function(t){var e,n,o;for(o=r(t),e=o,n=void 0;e.length;){if(u.doesMatch(e)){n=e;break}e=e.parent()}return n||xt()},u},F=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],Z(n)?n.apply(null,e):n},m=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m;return null==e&&(e={}),h=void 0,p=function(){return F(e.size)},o=function(){return F(e.expiry)},f=function(t){return e.key?e.key(t):t.toString()},u=function(){return 0!==p()&&0!==o()},r=function(){return h={}},r(),l=function(){var n;return n=1<=arguments.length?t.call(arguments,0):[],e.logPrefix?(n[0]="["+e.logPrefix+"] "+n[0],up.puts.apply(up,n)):void 0},s=function(){return Object.keys(h)},c=function(){var t,e,n,r;return r=k(s()),t=p(),t&&r.length>=t&&(e=null,n=null,D(r,function(t){var r,o;return r=h[t],o=r.timestamp,!n||n>o?(e=t,n=o):void 0}),e)?delete h[e]:void 0},n=function(t,e){var n;return n=i(t,{silent:!0}),B(n)?d(e,n):void 0},m=function(){return(new Date).valueOf()},d=function(t,e){var n;return u()?(c(),n=f(t),h[n]={timestamp:m(),value:e}):void 0},Qt=function(t){var e;return e=f(t),delete h[e]},a=function(t){var e,n;return e=o(),e?(n=m()-t.timestamp,e>n):!0},i=function(t,e){var n,r;return null==e&&(e={}),r=f(t),(n=h[r])?a(n)?(e.silent||l("Cache hit for '%s'",t),n.value):(e.silent||l("Discarding stale cache entry for '%s'",t),void Qt(t)):void(e.silent||l("Cache miss for '%s'",t))},{alias:n,get:i,set:d,remove:Qt,clear:r,keys:s}},b=function(t){var e;return e=Rt(t),Object.preventExtensions(e),e},Rt=function(t){var e;return null==t&&(t={}),e={},e.reset=function(){var n;return n=t,Z(n)&&(n=n()),d(e,n)},e.reset(),e},he=function(t){var e,n;return t=ce(t),e=t.parentNode,n=se(t.childNodes),D(n,function(n){return e.insertBefore(n,t)}),e.removeChild(t)},Dt=function(t){var e,n;for(e=void 0;(t=t.parent())&&t.length;)if(n=t.css("position"),"absolute"===n||"relative"===n||t.is("body")){e=t;break}return e},G=function(t){var e,n;for(e=r(t);;){if(n=e.css("position"),"fixed"===n)return!0;if(e=e.parent(),0===e.length||e.is(document))return!1}},j=function(t,e){var n,o,i,u;return n=r(t),o=Dt(n),i=n.position(),u=o.offset(),n.css({position:"absolute",left:i.left-u.left,top:i.top-u.top+e.scrollTop(),right:"",bottom:""})},Jt=function(t){var e,n,r,o,i,u,a;if(Y(t))return up.fail("Cannot convert FormData into an array");for(u=Bt(t),e=[],a=u.split("&"),n=0,r=a.length;r>n;n++)i=a[n],at(i)&&(o=i.split("="),e.push({name:decodeURIComponent(o[0]),value:decodeURIComponent(o[1])}));return e},Bt=function(t){var e;return Y(t)?up.fail("Cannot convert FormData into a query string"):at(t)?(e=r.param(t),e=e.replace(/\+/g,"%20")):""},u=function(t){var e,n;return n="input[type=submit], button[type=submit], button:not([type])",e=r(document.activeElement),e.is(n)&&t.has(e)?e:t.find(n).first()},Vt=function(t){var e,n,o,i,a,s;return n=r(t),s=n.find("input[type=file]").length,e=u(n),o=e.attr("name"),i=e.val(),a=s?new FormData(n.get(0)):n.serializeArray(),at(o)&&f(a,o,i),a},f=function(t,e,n){var r;return Y(t)?t.append(e,n):q(t)?t.push({name:e,value:n}):ut(t)?t[e]=n:(pt(t)||rt(t))&&(r=Bt([{name:e,value:n}]),t=at(t)?[t,r].join("&"):r),t},H=function(){var e,n,r,o,i,u;throw e=1<=arguments.length?t.call(arguments,0):[],q(e[0])?(r=e[0],u=e[1]||{}):(r=e,u={}),(o=up.log).error.apply(o,r),me().then(function(){return up.toast.open(r,u)}),n=(i=up.browser).sprintf.apply(i,r),new Error(n)},l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},C=function(t){return t.replace(/[&<>"]/g,function(t){return l[t]})},Lt=function(t,e){var n;return n=t[e],delete t[e],n},jt=function(t,e){var n,o;return n=r(t),o=n.data(e),n.removeData(e),o},U=function(t){var e;return e=vt(t),et(e)&&!nt(e)?t.pop():{}},Ft=function(t){var e;return e=r(t).css("opacity"),tt(e)?parseFloat(e):void 0},me=wt(function(){var t;return r.isReady?Yt():(t=r.Deferred(),r(function(){return t.resolve()}),t.promise())}),z=function(t){return t},V=function(t){return t=ce(t),!jQuery.contains(document.documentElement,t)},It=function(e){var n,o;return n=r.Deferred(),o=function(){var r,o;return r=1<=arguments.length?t.call(arguments,0):[],o=e.apply(null,r),st(o)?o.then(function(){return n.resolve(o)}):n.resolve(o),o},o.promise=n.promise(),o},s=function(){function e(){this.asap=n(this.asap,this),this.poke=n(this.poke,this),this.allTasks=n(this.allTasks,this),this.promise=n(this.promise,this),this.reset=n(this.reset,this),this.reset()}return e.prototype.reset=function(){return this.queue=[],this.currentTask=void 0},e.prototype.promise=function(){var t;return t=gt(this.allTasks(),function(t){return t.promise}),r.when.apply(r,t)},e.prototype.allTasks=function(){var t;return t=[],this.currentTask&&t.push(this.currentTask),t=t.concat(this.queue)},e.prototype.poke=function(){var t;return!this.currentTask&&(this.currentTask=this.queue.shift())?(t=this.currentTask(),t.always(function(t){return function(){return t.currentTask=void 0,t.poke()}}(this))):void 0},e.prototype.asap=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],this.queue=gt(e,It),this.poke()},e}(),ie=function(t){var e;return e=r(t),e.is("[type=checkbox], [type=radio]")&&!e.is(":checked")?void 0:e.val()},ne=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],function(){return gt(e,function(t){return t()})}},zt=function(t){var e,n;return e=r.Deferred(),n=oe(t,function(){return e.resolve()}),e.cancel=function(){return clearTimeout(n)},e},I=function(t){var e,n,r,o;return e=bt(t),r=g(),n=e.left+.5*e.width,o=.5*r.width,o>n?"left":"right"},P=function(t,e){var n;return n=r("<div></div>"),n.insertAfter(t),t.detach(),n.replaceWith(e),t},L=function(t){var e,n,r,o;for(e=[],n=0,r=t.length;r>n;n++)o=t[n],q(o)?e=e.concat(o):e.push(o);return e},ft=function(t){return!!t},{isDetached:V,requestDataAsArray:Jt,requestDataAsQuery:Bt,appendRequestData:f,requestDataFromForm:Vt,offsetParent:Dt,fixedToAbsolute:j,isFixed:G,presentAttr:Kt,createElement:A,parseUrl:Nt,normalizeUrl:Et,normalizeMethod:Pt,createElementFromHtml:T,$createElementFromSelector:o,$createPlaceholder:i,selectorForElement:ee,assign:d,assignPolyfill:h,copy:k,merge:kt,options:Mt,option:Ht,fail:H,each:D,map:gt,times:ae,any:p,all:c,detect:E,select:te,reject:Wt,intersect:W,compact:y,uniq:pe,last:vt,isNull:ot,isDefined:B,isUndefined:dt,isGiven:tt,isMissing:rt,isPresent:at,isBlank:Q,presence:_t,isObject:ut,isFunction:Z,isString:pt,isNumber:it,isElement:X,isJQuery:nt,isPromise:st,isResolvedPromise:lt,isDeferred:J,isHash:et,isArray:q,isFormData:Y,isUnmodifiedKeyEvent:ht,isUnmodifiedMouseEvent:mt,nullJQuery:xt,unJQuery:ce,setTimer:oe,nextFrame:At,measure:bt,temporaryCss:ue,cssAnimate:$,finishCssAnimate:N,forceCompositing:_,forceRepaint:K,escapePressed:O,copyAttributes:S,findWithSelf:M,contains:w,toArray:se,castedAttr:v,clientSize:g,only:Ot,except:R,trim:le,unresolvableDeferred:fe,unresolvablePromise:de,resolvedPromise:Yt,rejectedPromise:qt,resolvedDeferred:Gt,resolvableWhen:Xt,setMissingAttrs:re,remove:Qt,memoize:wt,scrollbarWidth:Zt,documentHasVerticalScrollbar:x,config:b,openConfig:Rt,cache:m,unwrapElement:he,multiSelector:St,error:H,pluckData:jt,pluckKey:Lt,extractOptions:U,isDetached:V,noop:$t,opacity:Ft,whenReady:me,identity:z,escapeHtml:C,DivertibleChain:s,submittedValue:ie,sequence:ne,promiseTimer:zt,previewable:It,evalOption:F,horizontalScreenHalf:I,detachWith:P,flatten:L,isTruthy:ft}}(jQuery),up.fail=up.util.fail}.call(this),function(){up.protocol=function(t){var e,n,r,o,i,u;return u=up.util,r=function(t){return t.getResponseHeader(e.locationHeader)},i=function(t){return t.getResponseHeader(e.titleHeader)},o=function(t){var n;return(n=t.getResponseHeader(e.methodHeader))?u.normalizeMethod(n):void 0},n=u.memoize(function(){var t;return t=up.browser.popCookie(e.methodCookie),(t||"get").toLowerCase()}),e=u.config({targetHeader:"X-Up-Target",locationHeader:"X-Up-Location",validateHeader:"X-Up-Validate",titleHeader:"X-Up-Title",methodHeader:"X-Up-Method",methodCookie:"_up_method",methodParam:"_method"}),{config:e,locationFromXhr:r,titleFromXhr:i,methodFromXhr:o,initialRequestMethod:n}}(jQuery)}.call(this),function(){var slice=[].slice;up.browser=function($){var CONSOLE_PLACEHOLDERS,canConsole,canCssTransition,canDomParser,canFormData,canInputEvent,canPushState,hash,isIE10OrWorse,isRecentJQuery,isSupported,loadPage,polyfilledSessionStorage,popCookie,puts,sessionStorage,setLocationHref,sprintf,sprintfWithFormattedArgs,stringifyArg,submitForm,u,url,whenConfirmed;return u=up.util,loadPage=function(t,e){var n,r,o,i,a;return null==e&&(e={}),i=u.option(e.method,"get").toLowerCase(),"get"===i?(a=u.requestDataAsQuery(e.data),a&&(t=t+"?"+a),setLocationHref(t)):(n=$("<form method='post' action='"+t+"' class='up-page-loader'></form>"),r=function(t){var e;return e=$('<input type="hidden">'),e.attr(t),e.appendTo(n)},r({name:up.protocol.config.methodParam,value:i}),(o=up.rails.csrfField())&&r(o),u.each(u.requestDataAsArray(e.data),r),n.hide().appendTo("body"),submitForm(n))},submitForm=function(t){return t.submit()},setLocationHref=function(t){return location.href=t},puts=function(){var t,e;return e=arguments[0],t=2<=arguments.length?slice.call(arguments,1):[],console[e].apply(console,t)},CONSOLE_PLACEHOLDERS=/\%[odisf]/g,stringifyArg=function(t){var e,n,r,o,i,a,s,l,c;if(a=200,r="",u.isString(t))l=t.replace(/[\n\r\t ]+/g," "),l=l.replace(/^[\n\r\t ]+/,""),l=l.replace(/[\n\r\t ]$/,""),l='"'+l+'"',r='"';else if(u.isUndefined(t))l="undefined";else if(u.isNumber(t)||u.isFunction(t))l=t.toString();else if(u.isArray(t))l="["+u.map(t,stringifyArg).join(", ")+"]",r="]";else if(u.isJQuery(t))l="$("+u.map(t,stringifyArg).join(", ")+")",r=")";else if(u.isElement(t)){for(e=$(t),l="<"+t.tagName.toLowerCase(),s=["id","name","class"],o=0,i=s.length;i>o;o++)n=s[o],(c=e.attr(n))&&(l+=" "+n+'="'+c+'"');l+=">",r=">"}else l=JSON.stringify(t);return l.length>a&&(l=l.substr(0,a)+" \u2026",l+=r),l},sprintf=function(){var t,e;return e=arguments[0],t=2<=arguments.length?slice.call(arguments,1):[],sprintfWithFormattedArgs.apply(null,[u.identity,e].concat(slice.call(t)))},sprintfWithFormattedArgs=function(){var t,e,n,r;return e=arguments[0],r=arguments[1],t=3<=arguments.length?slice.call(arguments,2):[],u.isBlank(r)?"":(n=0,r.replace(CONSOLE_PLACEHOLDERS,function(){var r;return r=t[n],r=e(stringifyArg(r)),n+=1,r}))},url=function(){return location.href},isIE10OrWorse=u.memoize(function(){return!window.atob}),canPushState=u.memoize(function(){return u.isDefined(history.pushState)&&"get"===up.protocol.initialRequestMethod()}),canCssTransition=u.memoize(function(){return"transition"in document.documentElement.style}),canInputEvent=u.memoize(function(){return"oninput"in document.createElement("input")}),canFormData=u.memoize(function(){return!!window.FormData}),canDomParser=u.memoize(function(){return!!window.DOMParser}),canConsole=u.memoize(function(){return window.console&&console.debug&&console.info&&console.warn&&console.error&&console.group&&console.groupCollapsed&&console.groupEnd}),isRecentJQuery=u.memoize(function(){var t,e,n,r;return r=$.fn.jquery,n=r.split("."),t=parseInt(n[0]),e=parseInt(n[1]),t>=2||1===t&&e>=9}),popCookie=function(t){var e,n;return n=null!=(e=document.cookie.match(new RegExp(t+"=(\\w+)")))?e[1]:void 0,u.isPresent(n)&&(document.cookie=t+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"),n},whenConfirmed=function(t){return t.preload||u.isBlank(t.confirm)||window.confirm(t.confirm)?u.resolvedPromise():u.unresolvablePromise()},isSupported=function(){return!isIE10OrWorse()&&isRecentJQuery()&&canConsole()&&canPushState()&&canDomParser()&&canFormData()&&canCssTransition()&&canInputEvent()},sessionStorage=u.memoize(function(){try{return window.sessionStorage}catch(t){return polyfilledSessionStorage()}}),polyfilledSessionStorage=function(){var t;return t={},{getItem:function(e){return t[e]},setItem:function(e,n){return t[e]=n}}},hash=function(t){return t||(t=location.hash),t||(t=""),"#"===t[0]&&(t=t.substr(1)),u.presence(t)},{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),url:url,loadPage:loadPage,canPushState:canPushState,whenConfirmed:whenConfirmed,isSupported:isSupported,puts:puts,sprintf:sprintf,sprintfWithFormattedArgs:sprintfWithFormattedArgs,sessionStorage:sessionStorage,popCookie:popCookie,hash:hash}}(jQuery)}.call(this),function(){var slice=[].slice;up.bus=function($){var boot,consumeAction,emit,emitReset,forgetUpDescription,haltEvent,live,liveUpDescriptions,logEmission,nextUpDescriptionNumber,nobodyPrevents,onEscape,rememberUpDescription,restoreSnapshot,snapshot,u,unbind,upDescriptionNumber,upDescriptionToJqueryDescription,upListenerToJqueryListener,whenEmitted;return u=up.util,liveUpDescriptions={},nextUpDescriptionNumber=0,upListenerToJqueryListener=function(t){return function(e){var n;return n=e.$element||$(this),t.apply(n.get(0),[e,n,up.syntax.data(n)])}},upDescriptionToJqueryDescription=function(t,e){var n,r,o;return n=u.copy(t),o=n.pop(),r=void 0,e?(r=upListenerToJqueryListener(o),o._asJqueryListener=r,o._descriptionNumber=++nextUpDescriptionNumber):(r=o._asJqueryListener,r||up.fail("up.off: The event listener %o was never registered through up.on")),n.push(r),n},live=function(){var t,e,n;return n=1<=arguments.length?slice.call(arguments,0):[],up.browser.isSupported()?(t=upDescriptionToJqueryDescription(n,!0),rememberUpDescription(n),(e=$(document)).on.apply(e,t),function(){return unbind.apply(null,n)}):function(){}},unbind=function(){var t,e,n;return n=1<=arguments.length?slice.call(arguments,0):[],t=upDescriptionToJqueryDescription(n,!1),forgetUpDescription(n),(e=$(document)).off.apply(e,t)},rememberUpDescription=function(t){var e;return e=upDescriptionNumber(t),liveUpDescriptions[e]=t},forgetUpDescription=function(t){var e;return e=upDescriptionNumber(t),delete liveUpDescriptions[e]},upDescriptionNumber=function(t){return u.last(t)._descriptionNumber},emit=function(t,e){var n,r;return null==e&&(e={}),r=$.Event(t,e),(n=e.$element)?delete e.$element:n=$(document),logEmission(t,e),n.trigger(r),r},logEmission=function(t,e){var n,r,o;return e.hasOwnProperty("message")?(n=e.message,delete e.message,n!==!1&&(u.isArray(n)?(o=n,n=o[0],r=2<=o.length?slice.call(o,1):[]):r=[],n)?u.isPresent(e)?up.puts.apply(up,[n+" (%s (%o))"].concat(slice.call(r),[t],[e])):up.puts.apply(up,[n+" (%s)"].concat(slice.call(r),[t])):void 0):u.isPresent(e)?up.puts("Emitted event %s (%o)",t,e):up.puts("Emitted event %s",t)},nobodyPrevents=function(){var t,e;return t=1<=arguments.length?slice.call(arguments,0):[],e=emit.apply(null,t),e.isDefaultPrevented()?(up.puts("An observer prevented the event %s",t[0]),!1):!0},whenEmitted=function(){var t,e;return t=1<=arguments.length?slice.call(arguments,0):[],e=$.Deferred(),nobodyPrevents.apply(null,t)&&e.resolve(),e.promise()},onEscape=function(t){return live("keydown","body",function(e){return u.escapePressed(e)?t(e):void 0})},haltEvent=function(t){return t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault()},consumeAction=function(t){return haltEvent(t),"up:action:consumed"!==t.type?emit("up:action:consumed",{$element:$(t.target),message:!1}):void 0},snapshot=function(){var t,e,n,r;for(r=[],e=0,n=liveUpDescriptions.length;n>e;e++)t=liveUpDescriptions[e],r.push(t.isDefault=!0);return r},restoreSnapshot=function(){var t,e,n,r,o;for(e=u.reject(liveUpDescriptions,function(t){return t.isDefault}),o=[],n=0,r=e.length;r>n;n++)t=e[n],o.push(unbind.apply(null,t));return o},emitReset=function(){return emit("up:framework:reset",{message:"Resetting framework"})},boot=function(){return up.browser.isSupported()?(emit("up:framework:boot",{message:"Booting framework"}),emit("up:framework:booted",{message:"Framework booted"}),u.nextFrame(function(){return u.whenReady().then(function(){return emit("up:app:boot",{message:"Booting user application"}),emit("up:app:booted",{message:"User application booted"})})})):"function"==typeof console.log?console.log("Unpoly doesn't support this browser. Framework was not booted."):void 0},live("up:framework:booted",snapshot),live("up:framework:reset",restoreSnapshot),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),on:live,off:unbind,emit:emit,nobodyPrevents:nobodyPrevents,whenEmitted:whenEmitted,onEscape:onEscape,emitReset:emitReset,haltEvent:haltEvent,consumeAction:consumeAction,boot:boot}}(jQuery),up.on=up.bus.on,up.off=up.bus.off,up.emit=up.bus.emit,up.reset=up.bus.emitReset,up.boot=up.bus.boot}.call(this),function(){var t=[].slice;up.log=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v;return m=up.util,r=up.browser,n="up.log.enabled",o=m.config({prefix:"[UP] ",enabled:"true"===r.sessionStorage().getItem(n),collapse:!1}),d=function(){return o.reset()},c=function(t){return""+o.prefix+t},i=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],o.enabled&&n?r.puts.apply(r,["debug",c(n)].concat(t.call(e))):void 0},f=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],o.enabled&&n?r.puts.apply(r,["log",c(n)].concat(t.call(e))):void 0},v=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n?r.puts.apply(r,["warn",c(n)].concat(t.call(e))):void 0},l=function(){var e,n,i,u;if(i=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n=e.pop(),!o.enabled||!i)return n();u=o.collapse?"groupCollapsed":"group",r.puts.apply(r,[u,c(i)].concat(t.call(e)));try{return n()}finally{i&&r.puts("groupEnd")}},s=function(){var e,n;return n=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n?r.puts.apply(r,["error",c(n)].concat(t.call(e))):void 0},p=function(){var t;return t=" __ _____ ___ ___ / /_ __\n"+("/ // / _ \\/ _ \\/ _ \\/ / // / "+up.version+"\n")+"\\___/_//_/ .__/\\___/_/\\_. / \n / / / /\n\n",t+=o.enabled?"Call `up.log.disable()` to disable logging for this session.":"Call `up.log.enable()` to enable logging for this session.",r.puts("log",t)},up.on("up:framework:boot",p),up.on("up:framework:reset",d),h=function(t){return r.sessionStorage().setItem(n,t.toString()),o.enabled=t},a=function(){return h(!0)},u=function(){return h(!1)},{puts:f,debug:i,error:s,warn:v,group:l,config:o,enable:a,disable:u}}(jQuery),up.puts=up.log.puts}.call(this),function(){var t=[].slice;up.toast=function(e){var n,r,o,i,u,a,s,l,c,p;return p=up.util,o=up.browser,n=function(t){return"<span class='up-toast-variable'>"+p.escapeHtml(t)+"</span>"},c=p.config({$toast:null}),l=function(){return i(),c.reset()},a=function(e){return p.isArray(e)?(e[0]=p.escapeHtml(e[0]),e=o.sprintfWithFormattedArgs.apply(o,[n].concat(t.call(e)))):e=p.escapeHtml(e),e},u=function(){return!!c.$toast},r=function(t,n,r){var o;return o=e('<span class="up-toast-action"></span>').text(n),o.on("click",r),o.appendTo(t)},s=function(t,n){var o,u,s,l;return null==n&&(n={}),i(),s=e('<div class="up-toast"></div>').prependTo("body"),u=e('<div class="up-toast-message"></div>').appendTo(s),o=e('<div class="up-toast-actions"></div>').appendTo(s),t=a(t),u.html(t),(l=n.action||n.inspect)&&r(o,l.label,l.callback),r(o,"Close",i),c.$toast=s},i=function(){return u()?(c.$toast.remove(),c.$toast=null):void 0},up.on("up:framework:reset",l),{open:s,close:i,reset:l,isOpen:u}}(jQuery)}.call(this),function(){var t=[].slice;up.syntax=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v,g,y;return y=up.util,n="up-destructible",r="up-destructors",c=[],m=[],l=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],d.apply(null,[c].concat(t.call(e)))},h=function(){var e;return e=1<=arguments.length?t.call(arguments,0):[],d.apply(null,[m].concat(t.call(e)))},u=function(){var e,n,r,o;return o=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],n=e.pop(),r=y.options(e[0],{priority:0}),"first"===r.priority?r.priority=Number.POSITIVE_INFINITY:"last"===r.priority&&(r.priority=Number.NEGATIVE_INFINITY),{selector:o,callback:n,priority:r.priority,batch:r.batch,keep:r.keep}},d=function(){var e,n,r,o,i;if(i=arguments[0],e=2<=arguments.length?t.call(arguments,1):[],up.browser.isSupported()){for(r=u.apply(null,e),n=0;(o=i[n])&&o.priority>=r.priority;)n+=1;return i.splice(n,0,r)}},i=function(t,e,n){var r,i,u,a,s,l,c;for(up.puts(t.isDefault?void 0:"Compiling '%s' on %o",t.selector,n),t.keep&&(c=y.isString(t.keep)?t.keep:"",e.attr("up-keep",c)),l=t.callback.apply(n,[e,p(e)]),a=f(l),s=[],i=0,u=a.length;u>i;i++)r=a[i],s.push(o(e,r));return s},f=function(t){return y.isFunction(t)?[t]:y.isArray(t)&&y.all(t,y.isFunction)?t:[]},o=function(t,e){var o;return t.addClass(n),o=t.data(r)||[],o.push(e),t.data(r,o)},s=function(t,n){var r;return n=y.options(n),r=e(n.skip),up.log.group("Compiling fragment %o",t.get(0),function(){var n,o,u,a,s,p;for(s=[m,c],p=[],o=0,u=s.length;u>o;o++)a=s[o],p.push(function(){var o,u,s;for(s=[],o=0,u=a.length;u>o;o++)l=a[o],n=y.findWithSelf(t,l.selector),n=n.filter(function(){var t;return t=e(this),y.all(r,function(e){return 0===t.closest(e).length})}),n.length?s.push(up.log.group(l.isDefault?void 0:"Compiling '%s' on %d element(s)",l.selector,n.length,function(){return l.batch?i(l,n,n.get()):n.each(function(){return i(l,e(this),this)})})):s.push(void 0);return s}());return p})},a=function(t){return y.findWithSelf(t,"."+n).each(function(){var t,o,i,u,a;if(t=e(this),i=t.data(r)){for(u=0,a=i.length;a>u;u++)(o=i[u])();return t.removeData(r),t.removeClass(n)}})},p=function(t){var n,r;return n=e(t),r=n.attr("up-data"),y.isString(r)&&""!==y.trim(r)?JSON.parse(r):{}},g=function(){var t;return t=function(t){return t.isDefault=!0},y.each(c,t),y.each(m,t)},v=function(){var t;return t=function(t){return t.isDefault},c=y.select(c,t),m=y.select(m,t)},up.on("up:framework:booted",g),up.on("up:framework:reset",v),{compiler:l,macro:h,compile:s,clean:a,data:p}}(jQuery),up.compiler=up.syntax.compiler,up.macro=up.syntax.macro}.call(this),function(){up.history=function(t){var e,n,r,o,i,u,a,s,l,c,p,f,d,h,m,v;return v=up.util,n=v.config({popTargets:["body"],restoreScroll:!0}),c=void 0,u=void 0,h=function(){return n.reset(),c=void 0,u=void 0},a=function(t,e){return e||(e={}),e.hash=!0,v.normalizeUrl(t,e)},r=function(t){return a(up.browser.url(),t)},o=function(t){var e;return e={stripTrailingSlash:!0},a(t,e)===r(e)},s=function(t){return u&&(c=u,u=void 0),u=t},d=function(t){return i("replaceState",t)},p=function(t,e){return e=v.options(e,{force:!1}),t=a(t),!e.force&&o(t)||!up.bus.nobodyPrevents("up:history:push",{url:t,message:"Adding history entry for "+t})?void 0:(i("pushState",t),up.emit("up:history:pushed",{url:t,message:"Advanced to location "+t
2
2
  }))},i=function(t,n){var o;return up.browser.canPushState()?(o=e(),window.history[t](o,"",n),s(r())):up.fail("This browser doesn't support history."+t)},e=function(){return{fromUp:!0}},m=function(t){var e,o,i;return(null!=t?t.fromUp:void 0)?(i=r(),up.emit("up:history:restore",{url:i,message:"Restoring location "+i}),e=n.popTargets.join(", "),o=up.replace(e,i,{history:!1,title:!0,reveal:!1,transition:"none",saveScroll:!1,restoreScroll:n.restoreScroll,layer:"page"}),o.then(function(){return i=r(),up.emit("up:history:restored",{url:i,message:"Restored location "+i})})):up.puts("Ignoring a state not pushed by Unpoly (%o)",t)},l=function(t){var e;return s(r()),up.layout.saveScroll({url:c}),e=t.originalEvent.state,m(e)},up.browser.canPushState()&&(f=function(){return t(window).on("popstate",l),d(r(),{force:!0})},"undefined"!=typeof jasmine&&null!==jasmine?f():setTimeout(f,100)),up.compiler("[up-back]",function(t){return v.isPresent(c)?(v.setMissingAttrs(t,{"up-href":c,"up-restore-scroll":""}),t.removeAttr("up-back"),up.link.makeFollowable(t)):void 0}),up.on("up:framework:reset",h),{config:n,push:p,replace:d,url:r,isUrl:o,previousUrl:function(){return c},normalizeUrl:a}}(jQuery)}.call(this),function(){var slice=[].slice;up.layout=function($){var SCROLL_PROMISE_KEY,anchoredRight,config,finishScrolling,firstHashTarget,fixedChildren,lastScrollTops,measureObstruction,reset,restoreScroll,reveal,revealHash,revealOrRestoreScroll,saveScroll,scroll,scrollTopKey,scrollTops,u,viewportOf,viewportSelector,viewports,viewportsWithin;return u=up.util,config=u.config({duration:0,viewports:[document,".up-modal-viewport","[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(t,e,n){var r,o,i,a,s;return r=$(t),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:e},r.get(0)===document&&(r=$("html, body")),r.animate(s,{duration:i,easing:a,complete:function(){return o.resolve()}}),o):(r.scrollTop(e),u.resolvedDeferred())},finishScrolling=function(t){return $(t).each(function(){var t;return(t=$(this).data(SCROLL_PROMISE_KEY))?t.resolve():void 0})},anchoredRight=function(){return u.multiSelector(config.anchoredRight).select()},measureObstruction=function(){var t,e,n,r;return n=function(t,e){var n,r;return n=$(t),r=n.css(e),u.isPresent(r)||up.fail("Fixed element %o must have a CSS attribute %s",n.get(0),e),parseFloat(r)+n.height()},e=function(){var t,e,o,i;for(o=$(config.fixedTop.join(", ")),i=[],t=0,e=o.length;e>t;t++)r=o[t],i.push(n(r,"top"));return i}(),t=function(){var t,e,o,i;for(o=$(config.fixedBottom.join(", ")),i=[],t=0,e=o.length;e>t;t++)r=o[t],i.push(n(r,"bottom"));return i}(),{top:Math.max.apply(Math,[0].concat(slice.call(e))),bottom:Math.max.apply(Math,[0].concat(slice.call(t)))}},reveal=function(t,e){var n,r,o,i,a,s,l,c,p,f,d,h,m,v;return n=$(t),up.puts("Revealing fragment %o",t.get(0)),e=u.options(e),r=e.viewport?$(e.viewport):viewportOf(n),h=u.option(e.snap,config.snap),v=r.is(document),m=v?u.clientSize().height:r.outerHeight(),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+m-l.bottom-1},o=u.measure(n,{relative:r,includeMargin:!0}),i=o.top+c,a=i+Math.min(o.height,config.substance)-1,a>d()&&(s+=a-d()),(i<f()||e.top)&&(s=i-l.top),h>s&&o.top<.5*m&&(s=0),s!==p?scroll(r,s,e):u.resolvedDeferred()},revealHash=function(){var t,e;return(e=up.browser.hash())?(t=firstHashTarget(e))?reveal(t):u.rejectedPromise():u.resolvedPromise()},viewportSelector=function(){return u.multiSelector(config.viewports)},viewportOf=function(t,e){var n,r;return null==e&&(e={}),n=$(t),r=viewportSelector().seekUp(n),0===r.length&&e.strict!==!1&&up.fail("Could not find viewport for %o",n),r},viewportsWithin=function(t){var e;return e=$(t),viewportSelector().findWithSelf(e)},viewports=function(){return viewportSelector().select()},scrollTopKey=function(t){var e;return e=$(t),e.is(document)?"document":u.selectorForElement(e)},scrollTops=function(){var t,e,n,r,o;for(o={},r=config.viewports,e=0,n=r.length;n>e;e++)t=r[e],$(t).each(function(){var t,e,n;return t=$(this),e=scrollTopKey(t),n=t.scrollTop(),o[e]=n});return o},fixedChildren=function(t){var e,n;return null==t&&(t=void 0),t||(t=document.body),n=$(t),e=n.find("[up-fixed]"),u.isPresent(config.fixedTop)&&(e=e.add(n.find(config.fixedTop.join(", ")))),u.isPresent(config.fixedBottom)&&(e=e.add(n.find(config.fixedBottom.join(", ")))),e},saveScroll=function(t){var e,n;return null==t&&(t={}),n=u.option(t.url,up.history.url()),e=u.option(t.tops,scrollTops()),up.puts("Saving scroll positions for URL %s (%o)",n,e),lastScrollTops.set(n,e)},restoreScroll=function(t){var e,n,r,o,i;return null==t&&(t={}),i=up.history.url(),r=void 0,t.around?(n=viewportsWithin(t.around),e=viewportOf(t.around),r=e.add(n)):r=viewports(),o=lastScrollTops.get(i),up.log.group("Restoring scroll positions for URL %s to %o",i,o,function(){return r.each(function(){var t,e,n;return t=$(this),e=scrollTopKey(t),n=o[e]||0,scroll(t,n,{duration:0})}),u.resolvedDeferred()})},revealOrRestoreScroll=function(t,e){var n,r,o,i;return n=$(t),e.restoreScroll?restoreScroll({around:n}):e.reveal?(i={},e.source&&(o=u.parseUrl(e.source),(r=firstHashTarget(o.hash))&&(n=r,i.top=!0)),reveal(n,i)):u.resolvedDeferred()},firstHashTarget=function(t){return(t=up.browser.hash(t))?up.first("[id='"+t+"'], a[name='"+t+"']"):void 0},up.on("up:app:booted",revealHash),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),reveal:reveal,revealHash:revealHash,firstHashTarget:firstHashTarget,scroll:scroll,finishScrolling:finishScrolling,config:config,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,up.revealHash=up.layout.revealHash}.call(this),function(){up.dom=function($){var autofocus,bestMatchingSteps,bestPreflightSelector,config,destroy,emitFragmentInserted,emitFragmentKept,extract,filterScripts,findKeepPlan,first,firstInLayer,firstInPriority,hello,isRealElement,layerOf,matchesLayer,parseResponse,processResponse,reload,replace,reset,resolveSelector,setSource,shouldExtractTitle,source,swapBody,swapElements,transferKeepableElements,u,updateHistoryAndTitle;return u=up.util,config=u.config({fallbacks:["body"],fallbackTransition:"none",runInlineScripts:!0,runLinkedScripts:!1}),reset=function(){return config.reset()},setSource=function(t,e){var n;return n=$(t),u.isPresent(e)&&(e=u.normalizeUrl(e)),n.attr("up-source",e)},source=function(t){var e;return e=$(t).closest("[up-source]"),u.presence(e.attr("up-source"))||up.browser.url()},resolveSelector=function(t,e){var n,r;return u.isString(t)?(r=t,u.contains(r,"&")&&(u.isPresent(e)?(n=u.selectorForElement(e),r=r.replace(/\&/,n)):up.fail("Found origin reference (%s) in selector %s, but no origin was given","&",r))):r=u.selectorForElement(t),r},replace=function(t,e,n){var r,o,i,a,s,l,c,p;return n=u.options(n),up.browser.canPushState()||n.history===!1?(n.inspectResponse=function(){return up.browser.loadPage(e,u.only(n,"method","data"))},c=u.merge(n,{humanizedTarget:"target"}),o=u.merge(n,{humanizedTarget:"failure target",provideTarget:void 0}),p=bestPreflightSelector(t,c),r=bestPreflightSelector(n.failTarget,o),l={url:e,method:n.method,data:n.data,target:p,failTarget:r,cache:n.cache,preload:n.preload,headers:n.headers,timeout:n.timeout},a=function(t,n,r){return processResponse(!0,p,e,l,r,c)},i=function(t,n,i){var a,s;return s=function(){return u.rejectedPromise(t,n,i)},t.responseText?(a=processResponse(!1,r,e,l,t,o),a.then(s,s)):s()},s=up.ajax(l),s=s.then(a,i)):(n.preload||up.browser.loadPage(e,u.only(n,"method","data")),u.unresolvablePromise())},processResponse=function(t,e,n,r,o,i){var a,s,l,c,p;return i.method=u.normalizeMethod(u.option(up.protocol.methodFromXhr(o),i.method)),a="GET"===i.method,(p=up.protocol.locationFromXhr(o))?(n=p,t&&up.proxy.isCachable(r)&&(s={url:n,method:up.protocol.methodFromXhr(o),target:e},up.proxy.alias(r,s))):a&&(l=u.requestDataAsQuery(i.data))&&(n=n+"?"+l),t?a?(i.history===!1||u.isString(i.history)||(i.history=n),i.source===!1||u.isString(i.source)||(i.source=n)):(u.isString(i.history)||(i.history=!1),u.isString(i.source)||(i.source="keep")):(i.transition=i.failTransition,i.failTransition=void 0,a?(i.history!==!1&&(i.history=n),i.source!==!1&&(i.source=n)):(i.source="keep",i.history=!1)),shouldExtractTitle(i)&&(c=up.protocol.titleFromXhr(o))&&(i.title=c),i.preload?u.resolvedPromise():extract(e,o.responseText,i)},shouldExtractTitle=function(t){return!(t.title===!1||u.isString(t.title)||t.history===!1&&t.title!==!0)},extract=function(t,e,n){return up.log.group("Extracting %s from %d bytes of HTML",t,null!=e?e.length:void 0,function(){var r,o,i,a,s,l,c;for(n=u.options(n,{historyMethod:"push",requireMatch:!0,keep:!0,layer:"auto"}),n.saveScroll!==!1&&up.layout.saveScroll(),"function"==typeof n.provideTarget&&n.provideTarget(),a=parseResponse(e),o=bestMatchingSteps(t,a,n),shouldExtractTitle(n)&&(s=a.title())&&(n.title=s),updateHistoryAndTitle(n),c=[],r=0,i=o.length;i>r;r++)l=o[r],up.log.group("Updating %s",l.selector,function(){var t;return filterScripts(l.$new,n),t=swapElements(l.$old,l.$new,l.pseudoClass,l.transition,n),c.push(t),n.reveal=!1});return $.when.apply($,c)})},bestPreflightSelector=function(t,e){var n;return n=new up.dom.ExtractCascade(t,e),n.bestPreflightSelector()},bestMatchingSteps=function(t,e,n){var r;return n=u.merge(n,{response:e}),r=new up.dom.ExtractCascade(t,n),r.bestMatchingSteps()},filterScripts=function(t,e){var n,r,o,i,a,s,l,c,p,f;for(c=u.option(e.runInlineScripts,config.runInlineScripts),p=u.option(e.runLinkedScripts,config.runLinkedScripts),r=u.findWithSelf(t,"script"),l=[],o=0,s=r.length;s>o;o++)f=r[o],n=$(f),a=u.isPresent(n.attr("src")),i=!a,a&&p||i&&c?l.push(void 0):l.push(n.remove());return l},parseResponse=function(t){var e;return e=u.createElementFromHtml(t),{title:function(){var t;return null!=(t=e.querySelector("head title"))?t.textContent:void 0},first:function(t){var n;return(n=$.find(t,e)[0])?$(n):void 0}}},updateHistoryAndTitle=function(t){return t=u.options(t,{historyMethod:"push"}),t.history&&up.history[t.historyMethod](t.history),u.isString(t.title)?document.title=t.title:void 0},swapElements=function(t,e,n,r,o){var i,a,s,l;return r||(r="none"),"keep"===o.source&&(o=u.merge(o,{source:source(t)})),up.motion.finish(t),n?(i=e.contents().wrapAll('<div class="up-insertion"></div>').parent(),"before"===n?t.prepend(i):t.append(i),hello(i.children(),o),s=up.layout.revealOrRestoreScroll(i,o),s=s.then(function(){return up.animate(i,r,o)}),s=s.then(function(){return u.unwrapElement(i)})):(a=findKeepPlan(t,e,o))?(emitFragmentKept(a),s=u.resolvedPromise()):(l=function(){return o.keepPlans=transferKeepableElements(t,e,o),t.is("body")?(swapBody(t,e),r=!1):e.insertBefore(t),o.source!==!1&&setSource(e,o.source),autofocus(e),hello(e,o),up.morph(t,e,r,o)},s=destroy(t,{animation:l})),s},swapBody=function(t,e){return t.replaceWith(e)},transferKeepableElements=function(t,e,n){var r,o,i,a,s,l,c,p;if(a=[],n.keep)for(p=t.find("[up-keep]"),i=0,l=p.length;l>i;i++)s=p[i],r=$(s),(c=findKeepPlan(r,e,u.merge(n,{descendantsOnly:!0})))&&(o=r.clone(),up.util.detachWith(r,o),c.$newElement.replaceWith(r),a.push(c));return a},findKeepPlan=function(t,e,n){var r,o,i,a,s;return n.keep&&(r=t,(a=u.castedAttr(r,"up-keep"))&&(u.isString(a)||(a="&"),a=resolveSelector(a,r),o=n.descendantsOnly?e.find(a):u.findWithSelf(e,a),o=o.first(),o.length&&o.is("[up-keep]")&&(s={$element:r,$newElement:o,newData:up.syntax.data(o)},i=u.merge(s,{message:["Keeping element %o",r.get(0)]}),up.bus.nobodyPrevents("up:fragment:keep",i))))?s:void 0},hello=function(t,e){var n,r,o,i,a,s;for(n=$(t),e=u.options(e,{keepPlans:[]}),o=[],s=e.keepPlans,r=0,i=s.length;i>r;r++)a=s[r],emitFragmentKept(a),o.push(a.$element);return up.syntax.compile(n,{skip:o}),emitFragmentInserted(n,e),n},emitFragmentInserted=function(t,e){var n;return n=$(t),up.emit("up:fragment:inserted",{$element:n,message:["Inserted fragment %o",n.get(0)],origin:e.origin})},emitFragmentKept=function(t){var e;return e=u.merge(t,{message:["Kept fragment %o",t.$element.get(0)]}),up.emit("up:fragment:kept",e)},autofocus=function(t){var e,n;return n="[autofocus]:last",e=u.findWithSelf(t,n),e.length&&e.get(0)!==document.activeElement?e.focus():void 0},isRealElement=function(t){var e;return e=".up-ghost, .up-destroying",0===t.closest(e).length},first=function(t,e){var n;return e=u.options(e,{layer:"auto"}),n=resolveSelector(t,e.origin),"auto"===e.layer?firstInPriority(n,e.origin):firstInLayer(n,e.layer)},firstInPriority=function(t,e){var n,r,o,i,a,s;for(i=["popup","modal","page"],n=void 0,u.isPresent(e)&&(s=layerOf(e),u.remove(i,s),i.unshift(s)),r=0,a=i.length;a>r&&(o=i[r],!(n=firstInLayer(t,o)));r++);return n},firstInLayer=function(t,e){var n,r,o,i,u,a;for(r=$(t),o=void 0,u=0,a=r.length;a>u;u++)if(i=r[u],n=$(i),isRealElement(n)&&matchesLayer(n,e)){o=n;break}return o},layerOf=function(t){var e;return e=$(t),up.popup.contains(e)?"popup":up.modal.contains(e)?"modal":"page"},matchesLayer=function(t,e){return layerOf(t)===e},destroy=function(t,e){var n,r,o,i,a;return n=$(t),n.is(".up-placeholder, .up-tooltip, .up-modal, .up-popup")||(i=["Destroying fragment %o",n.get(0)],a=["Destroyed fragment %o",n.get(0)]),0===n.length?u.resolvedDeferred():up.bus.nobodyPrevents("up:fragment:destroy",{$element:n,message:i})?(e=u.options(e,{animation:!1}),r=up.motion.animateOptions(e),n.addClass("up-destroying"),updateHistoryAndTitle(e),o=u.presence(e.animation,u.isDeferred)||up.motion.animate(n,e.animation,r),o.then(function(){return up.syntax.clean(n),up.emit("up:fragment:destroyed",{$element:n,message:a}),n.remove()}),o):$.Deferred()},reload=function(t,e){var n;return e=u.options(e,{cache:!1}),n=e.url||source(t),replace(t,n,e)},up.on("up:app:boot",function(){var t;return t=$(document.body),setSource(t,up.browser.url()),hello(t)}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),replace:replace,reload:reload,destroy:destroy,extract:extract,first:first,source:source,resolveSelector:resolveSelector,hello:hello,config:config}}(jQuery),up.replace=up.dom.replace,up.extract=up.dom.extract,up.reload=up.dom.reload,up.destroy=up.dom.destroy,up.first=up.dom.first,up.hello=up.dom.hello,up.renamedModule("flow","dom")}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}};t=up.util,up.dom.ExtractCascade=function(){function n(n,r){this.oldPlanNotFound=e(this.oldPlanNotFound,this),this.matchingPlanNotFound=e(this.matchingPlanNotFound,this),this.bestMatchingSteps=e(this.bestMatchingSteps,this),this.bestPreflightSelector=e(this.bestPreflightSelector,this),this.detectPlan=e(this.detectPlan,this),this.matchingPlan=e(this.matchingPlan,this),this.newPlan=e(this.newPlan,this),this.oldPlan=e(this.oldPlan,this),this.options=t.options(r,{humanizedTarget:"selector",layer:"auto"}),this.candidates=this.buildCandidates(n),this.plans=t.map(this.candidates,function(e){return function(n,r){var o;return o=t.copy(e.options),r>0&&(o.transition=up.dom.config.fallbackTransition),new up.dom.ExtractPlan(n,o)}}(this))}return n.prototype.buildCandidates=function(e){var n;return n=[e,this.options.fallback,up.dom.config.fallbacks],n=t.flatten(n),n=t.select(n,t.isTruthy),(this.options.fallback===!1||this.options.provideTarget)&&(n=[n[0]]),n},n.prototype.oldPlan=function(){return this.detectPlan("oldExists")},n.prototype.newPlan=function(){return this.detectPlan("newExists")},n.prototype.matchingPlan=function(){return this.detectPlan("matchExists")},n.prototype.detectPlan=function(e){return t.detect(this.plans,function(t){return t[e]()})},n.prototype.bestPreflightSelector=function(){var t;return this.options.provideTarget?this.plans[0].selector:(t=this.oldPlan())?t.selector:this.oldPlanNotFound()},n.prototype.bestMatchingSteps=function(){var t;return(t=this.matchingPlan())?t.steps:this.matchingPlanNotFound()},n.prototype.matchingPlanNotFound=function(){var t,e;return this.newPlan()?this.oldPlanNotFound():(e=this.oldPlan()?"Could not find "+this.options.humanizedTarget+" in response":"Could not match "+this.options.humanizedTarget+" in current page and response",this.response&&this.options.inspectResponse&&(t={label:"Open response",callback:this.options.inspectResponse}),up.fail([e+" (tried %o)",this.candidates],{action:t}))},n.prototype.oldPlanNotFound=function(){var t;return t=this.options.layer,"auto"===t&&(t="page, modal or popup"),up.fail("Could not find "+this.options.humanizedTarget+" in current "+t+" (tried %o)",this.candidates)},n}()}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}};t=up.util,up.dom.ExtractPlan=function(){function n(t,n){this.parseSteps=e(this.parseSteps,this),this.matchExists=e(this.matchExists,this),this.newExists=e(this.newExists,this),this.oldExists=e(this.oldExists,this),this.findNew=e(this.findNew,this),this.findOld=e(this.findOld,this),this.origin=n.origin,this.selector=up.dom.resolveSelector(t,n.origin),this.transition=n.transition||n.animation||"none",this.response=n.response,this.steps=this.parseSteps()}return n.prototype.findOld=function(){return t.each(this.steps,function(t){return t.$old=up.dom.first(t.selector,this.options)})},n.prototype.findNew=function(){return t.each(this.steps,function(t){return function(e){return e.$new=t.response.first(e.selector)}}(this))},n.prototype.oldExists=function(){return this.findOld(),t.all(this.steps,function(t){return t.$old})},n.prototype.newExists=function(){return this.findNew(),t.all(this.steps,function(t){return t.$new})},n.prototype.matchExists=function(){return this.oldExists()&&this.newExists()},n.prototype.parseSteps=function(){var e,n,r;return r=t.isString(this.transition)?this.transition.split(e):[this.transition],e=/\ *,\ */,n=this.selector.split(e),t.map(n,function(e,n){var o,i,u,a;return o=e.match(/^(.+?)(?:\:(before|after))?$/),o||up.fail('Could not parse selector literal "%s"',e),u=o[1],"html"===u&&(u="body"),i=o[2],a=r[n]||t.last(r),{selector:u,pseudoClass:i,transition:a}})},n}()}.call(this),function(){var t=[].slice;up.motion=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v,g,y,b,w,k,S,A,T,$,P,E,x,D;return x=up.util,a={},c={},P={},p={},l=x.config({duration:300,delay:0,easing:"ease",enabled:!0}),k=function(){return h(),a=x.copy(c),P=x.copy(p),l.reset()},v=function(){return l.enabled},o=function(t,n,r){var u;return u=e(t),h(u),r=i(r),g(n)?b():x.isFunction(n)?s(n(u,r),n):x.isString(n)?o(u,d(n),r):x.isHash(n)?v()?x.cssAnimate(u,n,r):(u.css(n),x.resolvedDeferred()):up.fail("Unknown animation type for %o",n)},i=function(){var e,n,r,o,i;return n=1<=arguments.length?t.call(arguments,0):[],i=n.shift()||{},e=x.isJQuery(n[0])?n.shift():x.nullJQuery(),o=x.isObject(n[0])?n.shift():{},r={},r.easing=x.option(i.easing,x.presentAttr(e,"up-easing"),o.easing,l.easing),r.duration=Number(x.option(i.duration,x.presentAttr(e,"up-duration"),o.duration,l.duration)),r.delay=Number(x.option(i.delay,x.presentAttr(e,"up-delay"),o.delay,l.delay)),r},d=function(t){return a[t]||up.fail("Unknown animation %o",t)},r="up-ghosting-deferred",n="up-ghosting",D=function(t,e,o,i){var u,a,s,l,c,p,f,d;return o.copy===!1||t.is(".up-ghost")||e.is(".up-ghost")?i(t,e):(p=void 0,l=void 0,f=void 0,c=void 0,a=up.layout.viewportOf(t),u=t.add(e),x.temporaryCss(e,{display:"none"},function(){return p=w(t,a),f=a.scrollTop()}),x.temporaryCss(t,{display:"none"},function(){return up.layout.revealOrRestoreScroll(e,o),l=w(e,a),c=a.scrollTop()}),p.moveTop(c-f),t.hide(),d=x.temporaryCss(e,{opacity:"0"}),s=i(p.$ghost,l.$ghost),u.data(r,s),u.addClass(n),s.then(function(){return u.removeData(r),u.removeClass(n),d(),p.$bounds.remove(),l.$bounds.remove()}),s)},h=function(t){var r,o,i;return null==t&&(t=".up-animating"),v()?(o=e(t),r=x.findWithSelf(o,".up-animating"),x.finishCssAnimate(r),i=x.findWithSelf(o,"."+n),m(i)):void 0},m=function(t){return t.each(function(){var t,n;return t=e(this),(n=x.pluckData(t,r))?n.resolve():void 0})},s=function(t,e){return x.isDeferred(t)?t:up.fail("Did not return a promise with .then and .resolve methods: %o",e)},y=function(t,n,r,u){var l,c,p;return u=x.options(u),p=v()&&!g(r),c=e(t),l=e(n),up.log.group(p?"Morphing %o to %o (using %s, %o)":void 0,c.get(0),l.get(0),r,u,function(){var t,e,n,d;return e=x.only(u,"reveal","restoreScroll","source"),e=x.assign(e,i(u)),h(c),h(l),p?(f(c),f(l),(t=a[r])?(A(c,l,e),o(l,t,e)):(d=x.presence(r,x.isFunction)||P[r])?D(c,l,e,function(t,n){var o;return o=d(t,n,e),s(o,r)}):x.isString(r)&&r.indexOf("/")>=0?(n=r.split("/"),d=function(t,e,r){return S(o(t,n[0],r),o(e,n[1],r))},y(c,l,d,e)):up.fail("Unknown transition %o",r)):A(c,l,e)})},f=function(t){var e;return 0===t.parents("body").length?(e=t.get(0),up.fail("Can't morph a <%s> element (%o)",e.tagName,e)):void 0},A=function(t,e,n){return t.hide(),up.layout.revealOrRestoreScroll(e,n)},w=function(t,n){var r,o,i,u,a,s,l,c,p;for(u=x.measure(t,{relative:!0,inner:!0}),i=t.clone(),i.find("script").remove(),i.css({position:"static"===t.css("position")?"static":"relative",top:"auto",right:"auto",bottom:"auto",left:"auto",width:"100%",height:"100%"}),i.addClass("up-ghost"),r=e('<div class="up-bounds"></div>'),r.css({position:"absolute"}),r.css(u),p=u.top,c=function(t){return 0!==t?(p+=t,r.css({top:p})):void 0},i.appendTo(r),r.insertBefore(t),c(t.offset().top-i.offset().top),o=up.layout.fixedChildren(i),s=0,l=o.length;l>s;s++)a=o[s],x.fixedToAbsolute(a,n);return{$ghost:i,$bounds:r,moveTop:c}},$=function(t,e){return P[t]=e},u=function(t,e){return a[t]=e},T=function(){return c=x.copy(a),p=x.copy(P)},S=x.resolvableWhen,b=x.resolvedDeferred,g=function(t){return t===!1||"none"===t||x.isMissing(t)||x.isResolvedPromise(t)},u("none",b),u("fade-in",function(t,e){return t.css({opacity:0}),o(t,{opacity:1},e)}),u("fade-out",function(t,e){return t.css({opacity:1}),o(t,{opacity:0},e)}),E=function(t,e){return{transform:"translate("+t+"px, "+e+"px)"}},u("move-to-top",function(t,e){var n,r;return n=x.measure(t),r=n.top+n.height,t.css(E(0,0)),o(t,E(0,-r),e)}),u("move-from-top",function(t,e){var n,r;return n=x.measure(t),r=n.top+n.height,t.css(E(0,-r)),o(t,E(0,0),e)}),u("move-to-bottom",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().height-n.top,t.css(E(0,0)),o(t,E(0,r),e)}),u("move-from-bottom",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().height-n.top,t.css(E(0,r)),o(t,E(0,0),e)}),u("move-to-left",function(t,e){var n,r;return n=x.measure(t),r=n.left+n.width,t.css(E(0,0)),o(t,E(-r,0),e)}),u("move-from-left",function(t,e){var n,r;return n=x.measure(t),r=n.left+n.width,t.css(E(-r,0)),o(t,E(0,0),e)}),u("move-to-right",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().width-n.left,t.css(E(0,0)),o(t,E(r,0),e)}),u("move-from-right",function(t,e){var n,r;return n=x.measure(t),r=x.clientSize().width-n.left,t.css(E(r,0)),o(t,E(0,0),e)}),u("roll-down",function(t,e){var n,r,i;return r=t.height(),i=x.temporaryCss(t,{height:"0px",overflow:"hidden"}),n=o(t,{height:r+"px"},e),n.then(i),n}),$("none",b),$("move-left",function(t,e,n){return S(o(t,"move-to-left",n),o(e,"move-from-right",n))}),$("move-right",function(t,e,n){return S(o(t,"move-to-right",n),o(e,"move-from-left",n))}),$("move-up",function(t,e,n){return S(o(t,"move-to-top",n),o(e,"move-from-bottom",n))}),$("move-down",function(t,e,n){return S(o(t,"move-to-bottom",n),o(e,"move-from-top",n))}),$("cross-fade",function(t,e,n){return S(o(t,"fade-out",n),o(e,"fade-in",n))}),up.on("up:framework:booted",T),up.on("up:framework:reset",k),{morph:y,animate:o,animateOptions:i,finish:h,transition:$,animation:u,config:l,isEnabled:v,none:b,when:S,prependCopy:w,isNone:g}}(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 t=[].slice;up.proxy=function(e){var n,r,o,i,u,a,s,l,c,p,f,d,h,m,v,g,y,b,w,k,S,A,T,$,P,E,x,D,C,O,F,R,U,H;return H=up.util,n=void 0,$=void 0,F=void 0,S=void 0,R=void 0,E=[],p=H.config({slowDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5,maxRequests:4,wrapMethods:["PATCH","PUT","DELETE"],safeMethods:["GET","OPTIONS","HEAD"]}),u=function(t){return k(t),[t.url,t.method,H.requestDataAsQuery(t.data),t.target].join("|")},i=H.cache({size:function(){return p.cacheSize},expiry:function(){return p.cacheExpiry},key:u}),f=function(t){var e,n,r,o,u,a,s;if(t=k(t),h(t))for(n=[t],"html"!==t.target&&(a=H.merge(t,{target:"html"}),n.push(a),"body"!==t.target&&(u=H.merge(t,{target:"body"}),n.push(u))),r=0,o=n.length;o>r;r++)if(e=n[r],s=i.get(e))return s},a=function(){return clearTimeout($),$=null},s=function(){return clearTimeout(F),F=null},D=function(){return n=null,a(),s(),S=0,p.reset(),i.clear(),R=!1,E=[]},D(),k=function(t){return t._normalized||(t.method=H.normalizeMethod(t.method),t.url&&(t.url=H.normalizeUrl(t.url)),t.target||(t.target="body"),t._normalized=!0),t},r=function(){var e,n,r,o,i,u,a;return e=1<=arguments.length?t.call(arguments,0):[],o=H.extractOptions(e),H.isGiven(e[0])&&(o.url=e[0]),n=o.cache===!0,r=o.cache===!1,a=H.only(o,"url","method","data","target","headers","timeout","_normalized"),a=k(a),i=!0,m(a)||n?(u=f(a))&&!r?(up.puts("Re-using cached response for %s %s",a.method,a.url),i="pending"===u.state()):(u=b(a),O(a,u),u.fail(function(){return x(a)})):(c(),u=b(a)),i&&!o.preload&&(w(),u.always(y)),u},h=function(t){return!H.isFormData(t.data)},v=function(){return 0===S},d=function(){return S>0},w=function(){var t,e;return e=v(),S+=1,e?(t=function(){return d()?(up.emit("up:proxy:slow",{message:"Proxy is busy"}),R=!0):void 0},F=H.setTimer(p.slowDelay,t)):void 0},y=function(){return S-=1,v()&&R?(up.emit("up:proxy:recover",{message:"Proxy is idle"}),R=!1):void 0},b=function(t){return S<p.maxRequests?g(t):P(t)},P=function(t){var n,r;return up.puts("Queuing request for %s %s",t.method,t.url),n=e.Deferred(),r={deferred:n,request:t},E.push(r),n.promise()},g=function(t){var n;return up.emit("up:proxy:load",H.merge(t,{message:["Loading %s %s",t.method,t.url]})),t=H.copy(t),t.headers||(t.headers={}),t.headers[up.protocol.config.targetHeader]=t.target,H.contains(p.wrapMethods,t.method)&&(t.data=H.appendRequestData(t.data,up.protocol.config.methodParam,t.method),t.method="POST"),H.isFormData(t.data)&&(t.contentType=!1,t.processData=!1),n=e.ajax(t),n.done(function(e,n,r){return C(t,r)}),n.fail(function(e,n,r){return C(t,e)}),n},C=function(t,e){var n;return up.emit("up:proxy:received",H.merge(t,{message:["Server responded with %s %s (%d bytes)",e.status,e.statusText,null!=(n=e.responseText)?n.length:void 0]})),A()},A=function(){var e,n;(e=E.shift())&&(n=g(e.request),n.done(function(){var n,r;return n=1<=arguments.length?t.call(arguments,0):[],(r=e.deferred).resolve.apply(r,n)}),n.fail(function(){var n,r;return n=1<=arguments.length?t.call(arguments,0):[],(r=e.deferred).reject.apply(r,n)}))},o=i.alias,O=i.set,x=i.remove,c=i.clear,m=function(t){return k(t),H.contains(p.safeMethods,t.method)},l=function(t){var e,r;return r=parseInt(H.presentAttr(t,"up-delay"))||p.preloadDelay,t.is(n)?void 0:(n=t,a(),e=function(){return T(t),n=null},U(e,r))},U=function(t,e){return $=setTimeout(t,e)},T=function(t,n){var r,o;return r=e(t),n=H.options(n),o=up.link.followMethod(r,n),m({method:o})?up.log.group("Preloading link %o",r,function(){return n.preload=!0,up.follow(r,n)}):(up.puts("Won't preload %o due to unsafe method %s",r,o),H.resolvedPromise())},up.on("mouseover mousedown touchstart","[up-preload]",function(t,e){return up.link.childClicked(t,e)?void 0:l(e)}),up.on("up:framework:reset",D),{preload:T,ajax:r,get:f,alias:o,clear:c,remove:x,isIdle:v,isBusy:d,isCachable:h,config:p}}(jQuery),up.ajax=up.proxy.ajax}.call(this),function(){up.link=function($){var allowDefault,childClicked,follow,followMethod,followVariantSelectors,isFollowable,makeFollowable,onAction,shouldProcessLinkEvent,u,visit;return u=up.util,visit=function(t,e){var n;return e=u.options(e),n=u.option(e.target,"body"),up.replace(n,t,e)},follow=function(t,e){var n,r,o;return n=$(t),e=u.options(e),o=u.option(n.attr("up-href"),n.attr("href")),r=u.option(e.target,n.attr("up-target")),e.failTarget=u.option(e.failTarget,n.attr("up-fail-target")),e.fallback=u.option(e.fallback,n.attr("up-fallback")),e.transition=u.option(e.transition,u.castedAttr(n,"up-transition"),"none"),e.failTransition=u.option(e.failTransition,u.castedAttr(n,"up-fail-transition"),"none"),e.history=u.option(e.history,u.castedAttr(n,"up-history")),e.reveal=u.option(e.reveal,u.castedAttr(n,"up-reveal"),!0),e.cache=u.option(e.cache,u.castedAttr(n,"up-cache")),e.restoreScroll=u.option(e.restoreScroll,u.castedAttr(n,"up-restore-scroll")),e.method=followMethod(n,e),e.origin=u.option(e.origin,n),e.layer=u.option(e.layer,n.attr("up-layer"),"auto"),e.confirm=u.option(e.confirm,n.attr("up-confirm")),e=u.merge(e,up.motion.animateOptions(e,n)),up.browser.whenConfirmed(e).then(function(){return up.replace(r,o,e)})},followMethod=function(t,e){var n;return n=$(t),e=u.options(e),u.option(e.method,n.attr("up-method"),n.attr("data-method"),"get").toUpperCase()},childClicked=function(t,e){var n,r;return n=$(t.target),r=n.closest("a, [up-href]"),r.length&&e.find(r).length},shouldProcessLinkEvent=function(t,e){return u.isUnmodifiedMouseEvent(t)&&!childClicked(t,e)},followVariantSelectors=[],allowDefault=function(t){},onAction=function(t,e){var n;return followVariantSelectors.push(t),n=function(t){return up.feedback.start(t,function(){return e(t)})},up.on("click","a"+t+", [up-href]"+t,function(t,e){return shouldProcessLinkEvent(t,e)?e.is("[up-instant]")?up.bus.haltEvent(t):(up.bus.consumeAction(t),n(e)):allowDefault(t)}),up.on("mousedown","a"+t+"[up-instant], [up-href]"+t+"[up-instant]",function(t,e){return shouldProcessLinkEvent(t,e)?(up.bus.consumeAction(t),n(e)):void 0})},isFollowable=function(t){var e;return e=$(t),u.any(followVariantSelectors,function(t){return e.is(t)})},makeFollowable=function(t){var e;return e=$(t),isFollowable(e)?void 0:e.attr("up-follow","")},onAction("[up-target]",function(t){return follow(t)}),onAction("[up-follow]",function(t){return follow(t)}),up.macro("[up-dash]",{priority:"last"},function(t){var e,n;return n=u.castedAttr(t,"up-dash"),t.removeAttr("up-dash"),e={"up-preload":"","up-instant":""},n===!0?makeFollowable(t):e["up-target"]=n,u.setMissingAttrs(t,e)}),up.macro("[up-expand]",{priority:"last"},function(t){var e,n,r,o,i,a,s,l,c,p;if(e=t.find("a, [up-href]"),(c=t.attr("up-expand"))&&(e=e.filter(c)),i=e.get(0)){for(p=/^up-/,s={},s["up-href"]=$(i).attr("href"),l=i.attributes,r=0,o=l.length;o>r;r++)n=l[r],a=n.name,a.match(p)&&(s[a]=n.value);return u.setMissingAttrs(t,s),t.removeAttr("up-expand"),makeFollowable(t)}}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,makeFollowable:makeFollowable,isFollowable:isFollowable,shouldProcessLinkEvent:shouldProcessLinkEvent,childClicked:childClicked,followMethod:followMethod,onAction:onAction}}(jQuery),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){var slice=[].slice;up.form=function($){var autosubmit,config,findSwitcherForTarget,observe,observeField,reset,resolveValidateTarget,submit,switchTarget,switchTargets,switcherValues,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(t,e){var n,r,o,i;return n=$(t).closest("form"),e=u.options(e),o=u.option(e.target,n.attr("up-target"),"body"),i=u.option(e.url,n.attr("action"),up.browser.url()),e.failTarget=u.option(e.failTarget,n.attr("up-fail-target"))||u.selectorForElement(n),e.fallback=u.option(e.fallback,n.attr("up-fallback")),e.history=u.option(e.history,u.castedAttr(n,"up-history"),!0),e.transition=u.option(e.transition,u.castedAttr(n,"up-transition"),"none"),e.failTransition=u.option(e.failTransition,u.castedAttr(n,"up-fail-transition"),"none"),e.method=u.option(e.method,n.attr("up-method"),n.attr("data-method"),n.attr("method"),"post").toUpperCase(),
3
- e.headers=u.option(e.headers,{}),e.reveal=u.option(e.reveal,u.castedAttr(n,"up-reveal"),!0),e.cache=u.option(e.cache,u.castedAttr(n,"up-cache")),e.restoreScroll=u.option(e.restoreScroll,u.castedAttr(n,"up-restore-scroll")),e.origin=u.option(e.origin,n),e.layer=u.option(e.layer,n.attr("up-layer"),"auto"),e.data=u.requestDataFromForm(n),e=u.merge(e,up.motion.animateOptions(e,n)),e.validate&&(e.headers||(e.headers={}),e.transition=!1,e.failTransition=!1,e.headers[up.protocol.config.validateHeader]=e.validate),up.feedback.start(n),up.browser.canPushState()||e.history===!1?(r=up.replace(o,i,e),r.always(function(){return up.feedback.stop(n)}),r):(n.get(0).submit(),u.unresolvablePromise())},observe=function(){var $element,$fields,callback,callbackArg,delay,destructors,extraArgs,options,rawCallback,selectorOrElement;return selectorOrElement=arguments[0],extraArgs=2<=arguments.length?slice.call(arguments,1):[],options={},callbackArg=void 0,1===extraArgs.length?callbackArg=extraArgs[0]:extraArgs.length>1&&(options=u.options(extraArgs[0]),callbackArg=extraArgs[1]),$element=$(selectorOrElement),callback=null,rawCallback=u.option(callbackArg,u.presentAttr($element,"up-observe")),callback=u.isString(rawCallback)?function(value,$field){return eval(rawCallback)}:rawCallback||up.fail("up.observe: No change callback given"),delay=u.option(u.presentAttr($element,"up-delay"),options.delay,config.observeDelay),delay=parseInt(delay),$fields=u.multiSelector(config.fields).findWithSelf($element),destructors=u.map($fields,function(t){return observeField($(t),delay,callback)}),u.sequence.apply(u,destructors)},observeField=function(t,e,n){var r,o,i,a,s,l;return a=u.submittedValue(t),l=void 0,i=u.resolvedPromise(),s=function(e){var r;return a=e,r=n.apply(t.get(0),[e,t]),i=u.isPromise(r)?r:r},o=function(){var n,r;return r=u.submittedValue(t),a!==r?(n=function(){return s(r)},null!=l&&l.cancel(),l=u.promiseTimer(e),$.when(l,i).then(n)):void 0},r="input change",t.on(r,o),function(){return t.off(r,o),null!=l?l.cancel():void 0}},autosubmit=function(t,e){return observe(t,e,function(t,e){var n;return n=e.closest("form"),up.feedback.start(e,function(){return submit(n)})})},resolveValidateTarget=function(t,e){var n;return n=u.option(e.target,t.attr("up-validate")),u.isBlank(n)&&(n||(n=u.detect(config.validateTargets,function(n){var r;return r=up.dom.resolveSelector(n,e.origin),t.closest(r).length}))),u.isBlank(n)&&up.fail("Could not find default validation target for %o (tried ancestors %o)",t.get(0),config.validateTargets),u.isString(n)||(n=u.selectorForElement(n)),n},validate=function(t,e){var n,r,o;return n=$(t),e=u.options(e),e.origin=n,e.target=resolveValidateTarget(n,e),e.failTarget=e.target,e.history=!1,e.headers=u.option(e.headers,{}),e.validate=n.attr("name")||"__none__",e=u.merge(e,up.motion.animateOptions(e,n)),r=n.closest("form"),o=up.submit(r,e)},switcherValues=function(t){var e,n,r,o;return t.is("input[type=checkbox]")?t.is(":checked")?(r=t.val(),n=":checked"):n=":unchecked":t.is("input[type=radio]")?(e=t.closest("form, body").find("input[type='radio'][name='"+t.attr("name")+"']:checked"),e.length?(n=":checked",r=e.val()):n=":unchecked"):r=t.val(),o=[],u.isPresent(r)?(o.push(r),o.push(":present")):o.push(":blank"),u.isPresent(n)&&o.push(n),o},switchTargets=function(t,e){var n,r,o;return n=$(t),e=u.options(e),o=u.option(e.target,n.attr("up-switch")),u.isPresent(o)||up.fail("No switch target given for %o",n.get(0)),r=switcherValues(n),$(o).each(function(){return switchTarget($(this),r)})},switchTarget=function(t,e){var n,r,o,i;return n=$(t),e||(e=switcherValues(findSwitcherForTarget(n))),(r=n.attr("up-hide-for"))?(r=r.split(" "),o=0===u.intersect(e,r).length):(i=(i=n.attr("up-show-for"))?i.split(" "):[":present",":checked"],o=u.intersect(e,i).length>0),n.toggle(o),n.addClass("up-switched")},findSwitcherForTarget=function(t){var e,n;return e=$("[up-switch]"),n=u.detect(e,function(e){var n;return n=$(e).attr("up-switch"),t.is(n)}),n?$(n):u.fail("Could not find [up-switch] field for %o",$element.get(0))},up.on("submit","form[up-target]",function(t,e){return up.bus.consumeAction(t),submit(e)}),up.on("change","[up-validate]",function(t,e){return validate(e)}),up.on("change","[up-switch]",function(t,e){return switchTargets(e)}),up.compiler("[up-switch]",function(t){return switchTargets(t)}),up.compiler("[up-show-for]:not(.up-switched), [up-hide-for]:not(.up-switched)",function(t){return switchTarget(t)}),up.compiler("[up-observe]",function(t){return observe(t)}),up.compiler("[up-autosubmit]",function(t){return autosubmit(t)}),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,switchTargets:switchTargets,autosubmit:autosubmit}}(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 align,attachAsap,attachNow,autoclose,chain,closeAsap,closeNow,config,contains,createHiddenFrame,discardHistory,isOpen,reset,state,u,unveilFrame;return u=up.util,config=u.config({openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:150,closeDuration:100,openEasing:null,closeEasing:null,position:"bottom-right",history:!1}),state=u.config({phase:"closed",$anchor:null,$popup:null,position:null,sticky:null,url:null,coveredUrl:null,coveredTitle:null}),chain=new u.DivertibleChain,reset=function(){var t;return null!=(t=state.$popup)&&t.remove(),state.reset(),chain.reset(),config.reset()},align=function(){var t,e,n;switch(t={},n=u.measure(state.$popup),u.isFixed(state.$anchor)?(e=state.$anchor.get(0).getBoundingClientRect(),t.position="fixed"):e=u.measure(state.$anchor),state.position){case"bottom-right":t.top=e.top+e.height,t.left=e.left+e.width-n.width;break;case"bottom-left":t.top=e.top+e.height,t.left=e.left;break;case"top-right":t.top=e.top-n.height,t.left=e.left+e.width-n.width;break;case"top-left":t.top=e.top-n.height,t.left=e.left;break;default:up.fail("Unknown position option '%s'",state.position)}return state.$popup.attr("up-position",state.position),state.$popup.css(t)},discardHistory=function(){return state.coveredTitle=null,state.coveredUrl=null},createHiddenFrame=function(t){var e;return e=u.$createElementFromSelector(".up-popup"),u.$createPlaceholder(t,e),e.hide(),e.appendTo(document.body),state.$popup=e},unveilFrame=function(){return state.$popup.show()},isOpen=function(){return"opened"===state.phase||"opening"===state.phase},attachAsap=function(t,e){var n;return n=function(){return attachNow(t,e)},isOpen()?chain.asap(closeNow,n):chain.asap(n),chain.promise()},attachNow=function(t,e){var n,r,o,i,a,s;return n=$(t),n.length||up.fail("Cannot attach popup to non-existing element %o",t),e=u.options(e),s=u.option(u.pluckKey(e,"url"),n.attr("up-href"),n.attr("href")),o=u.option(u.pluckKey(e,"html")),a=u.option(u.pluckKey(e,"target"),n.attr("up-popup"),"body"),i=u.option(e.position,n.attr("up-position"),config.position),e.animation=u.option(e.animation,n.attr("up-animation"),config.openAnimation),e.sticky=u.option(e.sticky,u.castedAttr(n,"up-sticky"),config.sticky),e.history=up.browser.canPushState()?u.option(e.history,u.castedAttr(n,"up-history"),config.history):!1,e.confirm=u.option(e.confirm,n.attr("up-confirm")),e.method=up.link.followMethod(n,e),e.layer="popup",r=up.motion.animateOptions(e,n,{duration:config.openDuration,easing:config.openEasing}),up.browser.whenConfirmed(e).then(function(){return up.bus.whenEmitted("up:popup:open",{url:s,message:"Opening popup"}).then(function(){var t,l;return state.phase="opening",state.$anchor=n,state.position=i,e.history&&(state.coveredUrl=up.browser.url(),state.coveredTitle=document.title),state.sticky=e.sticky,e.provideTarget=function(){return createHiddenFrame(a)},t=u.merge(e,{animation:!1}),l=o?up.extract(a,o,t):up.replace(a,s,t),l=l.then(function(){return align(),unveilFrame(),up.animate(state.$popup,e.animation,r)}),l=l.then(function(){return state.phase="opened",up.emit("up:popup:opened",{message:"Popup opened"})})})})},closeAsap=function(t){return isOpen()&&chain.asap(function(){return closeNow(t)}),chain.promise()},closeNow=function(t){var e;return isOpen()?(t=u.options(t,{animation:config.closeAnimation,history:state.coveredUrl,title:state.coveredTitle}),e=up.motion.animateOptions(t,{duration:config.closeDuration,easing:config.closeEasing}),u.assign(t,e),up.bus.whenEmitted("up:popup:close",{message:"Closing popup",$element:state.$popup}).then(function(){return state.phase="closing",state.url=null,state.coveredUrl=null,state.coveredTitle=null,up.destroy(state.$popup,t).then(function(){return state.phase="closed",state.$popup=null,state.$anchor=null,state.sticky=null,up.emit("up:popup:closed",{message:"Popup closed"})})})):u.resolvedPromise()},autoclose=function(){return state.sticky?void 0:(discardHistory(),closeAsap())},contains=function(t){var e;return e=$(t),e.closest(".up-popup").length>0},up.link.onAction("[up-popup]",function(t){return t.is(".up-current")?closeAsap():attachAsap(t)}),up.on("click up:action:consumed",function(t){var e;return e=$(t.target),e.closest(".up-popup, [up-popup]").length?void 0:closeAsap()}),up.on("up:fragment:inserted",function(t,e){var n;if(contains(e)){if(n=e.attr("up-source"))return state.url=n}else if(contains(t.origin))return autoclose()}),up.bus.onEscape(closeAsap),up.on("click",".up-popup [up-close]",function(t,e){return closeAsap(),up.bus.consumeAction(t)}),up.on("up:history:restore",closeAsap),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),attach:attachAsap,close:closeAsap,url:function(){return state.url},coveredUrl:function(){return state.coveredUrl},config:config,contains:contains,isOpen:isOpen}}(jQuery)}.call(this),function(){up.modal=function($){var animate,autoclose,chain,closeAsap,closeNow,config,contains,createHiddenFrame,discardHistory,extractAsap,flavor,flavorDefault,flavorOverrides,flavors,followAsap,isOpen,markAsAnimating,openAsap,openNow,reset,shiftElements,state,templateHtml,u,unshiftElements,unveilFrame,visitAsap;return u=up.util,config=u.config({maxWidth:null,width:null,height:null,history:!0,openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:null,closeDuration:null,openEasing:null,closeEasing:null,backdropOpenAnimation:"fade-in",backdropCloseAnimation:"fade-out",closeLabel:"\xd7",closable:!0,sticky:!1,flavor:"default",position:null,template:function(t){return'<div class="up-modal">\n <div class="up-modal-backdrop"></div>\n <div class="up-modal-viewport">\n <div class="up-modal-dialog">\n <div class="up-modal-content"></div>\n <div class="up-modal-close" up-close>'+t.closeLabel+"</div>\n </div>\n </div>\n</div>"}}),flavors=u.openConfig({"default":{}}),state=u.config(function(){return{phase:"closed",$anchor:null,$modal:null,sticky:null,closable:null,flavor:null,url:null,coveredUrl:null,coveredTitle:null,position:null,unshifters:[]}}),chain=new u.DivertibleChain,reset=function(){var t;return null!=(t=state.$modal)&&t.remove(),unshiftElements(),state.reset(),chain.reset(),config.reset(),flavors.reset()},templateHtml=function(){var t;return t=flavorDefault("template"),u.evalOption(t,{closeLabel:flavorDefault("closeLabel")})},discardHistory=function(){return state.coveredTitle=null,state.coveredUrl=null},createHiddenFrame=function(t,e){var n,r,o;return o=$(templateHtml()),o.attr("up-flavor",state.flavor),u.isPresent(state.position)&&o.attr("up-position",state.position),r=o.find(".up-modal-dialog"),u.isPresent(e.width)&&r.css("width",e.width),u.isPresent(e.maxWidth)&&r.css("max-width",e.maxWidth),u.isPresent(e.height)&&r.css("height",e.height),state.closable||o.find(".up-modal-close").remove(),n=o.find(".up-modal-content"),u.$createPlaceholder(t,n),o.hide(),o.appendTo(document.body),state.$modal=o},unveilFrame=function(){return state.$modal.show()},shiftElements=function(){var t,e,n,r,o;return u.documentHasVerticalScrollbar()?(t=$("body"),r=u.scrollbarWidth(),e=parseFloat(t.css("padding-right")),n=r+e,o=u.temporaryCss(t,{"padding-right":n+"px","overflow-y":"hidden"}),state.unshifters.push(o),up.layout.anchoredRight().each(function(){var t,e,n,o;return t=$(this),e=parseFloat(t.css("right")),n=r+e,o=u.temporaryCss(t,{right:n}),state.unshifters.push(o)})):void 0},unshiftElements=function(){var t,e;for(t=[];e=state.unshifters.pop();)t.push(e());return t},isOpen=function(){return"opened"===state.phase||"opening"===state.phase},followAsap=function(t,e){return e=u.options(e),e.$link=$(t),openAsap(e)},visitAsap=function(t,e){return e=u.options(e),e.url=t,openAsap(e)},extractAsap=function(t,e,n){return n=u.options(n),n.html=e,n.history=u.option(n.history,!1),n.target=t,openAsap(n)},openAsap=function(t){var e;return e=function(){return openNow(t)},isOpen()?chain.asap(closeNow,e):chain.asap(e),chain.promise()},openNow=function(t){var e,n,r,o,i;return t=u.options(t),e=u.option(u.pluckKey(t,"$link"),u.nullJQuery()),i=u.option(u.pluckKey(t,"url"),e.attr("up-href"),e.attr("href")),r=u.option(u.pluckKey(t,"html")),o=u.option(u.pluckKey(t,"target"),e.attr("up-modal"),"body"),t.flavor=u.option(t.flavor,e.attr("up-flavor"),config.flavor),t.position=u.option(t.position,e.attr("up-position"),flavorDefault("position",t.flavor)),t.position=u.evalOption(t.position,{$link:e}),t.width=u.option(t.width,e.attr("up-width"),flavorDefault("width",t.flavor)),t.maxWidth=u.option(t.maxWidth,e.attr("up-max-width"),flavorDefault("maxWidth",t.flavor)),t.height=u.option(t.height,e.attr("up-height"),flavorDefault("height")),t.animation=u.option(t.animation,e.attr("up-animation"),flavorDefault("openAnimation",t.flavor)),t.animation=u.evalOption(t.animation,{position:t.position}),t.backdropAnimation=u.option(t.backdropAnimation,e.attr("up-backdrop-animation"),flavorDefault("backdropOpenAnimation",t.flavor)),t.backdropAnimation=u.evalOption(t.backdropAnimation,{position:t.position}),t.sticky=u.option(t.sticky,u.castedAttr(e,"up-sticky"),flavorDefault("sticky",t.flavor)),t.closable=u.option(t.closable,u.castedAttr(e,"up-closable"),flavorDefault("closable",t.flavor)),t.confirm=u.option(t.confirm,e.attr("up-confirm")),t.method=up.link.followMethod(e,t),t.layer="modal",n=up.motion.animateOptions(t,e,{duration:flavorDefault("openDuration",t.flavor),easing:flavorDefault("openEasing",t.flavor)}),t.history=u.option(t.history,u.castedAttr(e,"up-history"),flavorDefault("history",t.flavor)),up.browser.canPushState()||(t.history=!1),up.browser.whenConfirmed(t).then(function(){return up.bus.whenEmitted("up:modal:open",{url:i,message:"Opening modal"}).then(function(){var e,a;return state.phase="opening",state.flavor=t.flavor,state.sticky=t.sticky,state.closable=t.closable,state.position=t.position,t.history&&(state.coveredUrl=up.browser.url(),state.coveredTitle=document.title),t.provideTarget=function(){return createHiddenFrame(o,t)},e=u.merge(t,{animation:!1}),a=r?up.extract(o,r,e):up.replace(o,i,e),a=a.then(function(){return shiftElements(),unveilFrame(),animate(t.animation,t.backdropAnimation,n)}),a=a.then(function(){return state.phase="opened",up.emit("up:modal:opened",{message:"Modal opened"})})})})},closeAsap=function(t){return isOpen()&&chain.asap(function(){return closeNow(t)}),chain.promise()},closeNow=function(t){var e,n,r,o;return isOpen()?(t=u.options(t),o=u.option(t.animation,flavorDefault("closeAnimation")),o=u.evalOption(o,{position:state.position}),n=u.option(t.backdropAnimation,flavorDefault("backdropCloseAnimation")),n=u.evalOption(n,{position:state.position}),e=up.motion.animateOptions(t,{duration:flavorDefault("closeDuration"),easing:flavorDefault("closeEasing")}),r=u.options(u.except(t,"animation","duration","easing","delay"),{history:state.coveredUrl,title:state.coveredTitle}),up.bus.whenEmitted("up:modal:close",{$element:state.$modal,message:"Closing modal"}).then(function(){var t;return state.phase="closing",state.url=null,state.coveredUrl=null,state.coveredTitle=null,t=animate(o,n,e),t=t.then(function(){return up.destroy(state.$modal,r)}),t=t.then(function(){return unshiftElements(),state.phase="closed",state.$modal=null,state.flavor=null,state.sticky=null,state.closable=null,state.position=null,up.emit("up:modal:closed",{message:"Modal closed"})})})):u.resolvedPromise()},markAsAnimating=function(t){return null==t&&(t=!0),state.$modal.toggleClass("up-modal-animating",t)},animate=function(t,e,n){var r;return up.motion.isNone(t)?u.resolvedPromise():(markAsAnimating(),r=$.when(up.animate(state.$modal.find(".up-modal-viewport"),t,n),up.animate(state.$modal.find(".up-modal-backdrop"),e,n)),r=r.then(function(){return markAsAnimating(!1)}))},autoclose=function(){return state.sticky?void 0:(discardHistory(),closeAsap())},contains=function(t){var e;return e=$(t),e.closest(".up-modal").length>0},flavor=function(t,e){return null==e&&(e={}),up.log.warn("The up.modal.flavor function is deprecated. Use the up.modal.flavors property instead."),u.assign(flavorOverrides(t),e)},flavorOverrides=function(t){return flavors[t]||(flavors[t]={})},flavorDefault=function(t,e){var n;return null==e&&(e=state.flavor),e&&(n=flavorOverrides(e)[t]),u.isMissing(n)&&(n=config[t]),n},up.link.onAction("[up-modal]",function(t){return followAsap(t)}),up.on("click",function(t){var e;if(state.closable)return e=$(t.target),e.closest(".up-modal-dialog").length||e.closest("[up-modal]").length?void 0:(up.bus.consumeAction(t),closeAsap())}),up.on("up:fragment:inserted",function(t,e){var n;if(contains(e)){if(n=e.attr("up-source"))return state.url=n}else if(contains(t.origin)&&!up.popup.contains(e))return autoclose()}),up.bus.onEscape(function(){return state.closable?closeAsap():void 0}),up.on("click",".up-modal [up-close]",function(t,e){return closeAsap(),up.bus.consumeAction(t)}),up.macro("[up-drawer]",function(t){var e;return e=t.attr("up-drawer"),t.attr({"up-modal":e,"up-flavor":"drawer"})}),flavors.drawer={openAnimation:function(t){switch(t.position){case"left":return"move-from-left";case"right":return"move-from-right"}},closeAnimation:function(t){switch(t.position){case"left":return"move-to-left";case"right":return"move-to-right"}},position:function(t){return u.isPresent(t.$link)?u.horizontalScreenHalf(t.$link):"left"}},up.on("up:history:restore",closeAsap),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visitAsap,follow:followAsap,extract:extractAsap,close:closeAsap,url:function(){return state.url},coveredUrl:function(){return state.coveredUrl},config:config,flavors:flavors,contains:contains,isOpen:isOpen,flavor:flavor}}(jQuery)}.call(this),function(){up.tooltip=function(t){var e,n,r,o,i,u,a,s,l,c,p,f;return f=up.util,a=f.config({position:"top",openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:100,closeDuration:50,openEasing:null,closeEasing:null}),p=f.config({phase:"closed",$anchor:null,$tooltip:null,position:null}),o=new f.DivertibleChain,c=function(){var t;return null!=(t=p.$tooltip)&&t.remove(),p.reset(),o.reset(),a.reset()},e=function(){var t,e,n;switch(t={},n=f.measure(p.$tooltip),f.isFixed(p.$anchor)?(e=p.$anchor.get(0).getBoundingClientRect(),t.position="fixed"):e=f.measure(p.$anchor),p.position){case"top":t.top=e.top-n.height,t.left=e.left+.5*(e.width-n.width);break;case"left":t.top=e.top+.5*(e.height-n.height),t.left=e.left-n.width;break;case"right":t.top=e.top+.5*(e.height-n.height),t.left=e.left+e.width;break;case"bottom":t.top=e.top+e.height,t.left=e.left+.5*(e.width-n.width);break;default:up.fail("Unknown position option '%s'",p.position)}return p.$tooltip.attr("up-position",p.position),p.$tooltip.css(t)},s=function(t){var e;return e=f.$createElementFromSelector(".up-tooltip"),f.isGiven(t.text)?e.text(t.text):e.html(t.html),e.appendTo(document.body),p.$tooltip=e},n=function(t,e){var n;return null==e&&(e={}),n=function(){return r(t,e)},l()?o.asap(u,n):o.asap(n),o.promise()},r=function(n,r){var o,i,u,l,c,d;return o=t(n),r=f.options(r),l=f.option(r.html,o.attr("up-tooltip-html")),d=f.option(r.text,o.attr("up-tooltip")),c=f.option(r.position,o.attr("up-position"),a.position),u=f.option(r.animation,f.castedAttr(o,"up-animation"),a.openAnimation),i=up.motion.animateOptions(r,o,{duration:a.openDuration,easing:a.openEasing}),p.phase="opening",p.$anchor=o,s({text:d,html:l}),p.position=c,e(),up.animate(p.$tooltip,u,i).then(function(){return p.phase="opened"})},i=function(t){return l()&&o.asap(function(){return u(t)}),o.promise()},u=function(t){var e;return l()?(t=f.options(t,{animation:a.closeAnimation}),e=up.motion.animateOptions(t,{duration:a.closeDuration,easing:a.closeEasing}),f.assign(t,e),p.phase="closing",up.destroy(p.$tooltip,t).then(function(){return p.phase="closed",p.$tooltip=null,p.$anchor=null})):f.resolvedPromise()},l=function(){return"opening"===p.phase||"opened"===p.phase},up.compiler("[up-tooltip], [up-tooltip-html]",function(t){return t.on("mouseenter",function(){return n(t)}),t.on("mouseleave",function(){return i()})}),up.on("click up:action:consumed",function(t){return i()}),up.on("up:framework:reset",c),up.bus.onEscape(function(){return i()}),{config:a,attach:n,isOpen:l,close:i}}(jQuery)}.call(this),function(){up.feedback=function(t){var e,n,r,o,i,u,a,s,l,c,p,f,d;return f=up.util,r=f.config({currentClasses:["up-current"]}),s=function(){return r.reset()},o=function(){var t;return t=r.currentClasses,t=t.concat(["up-current"]),t=f.uniq(t),t.join(" ")},e="up-active",n="a, [up-href]",a=function(t){return f.isPresent(t)?f.normalizeUrl(t,{stripTrailingSlash:!0}):void 0},l=function(t){var e,n,r,o,i,u,s,l,c,p;for(l=[],u=["href","up-href","up-alias"],n=0,o=u.length;o>n;n++)if(e=u[n],c=f.presentAttr(t,e))for(p="up-alias"===e?c.split(" "):[c],r=0,i=p.length;i>r;r++)s=p[r],"#"!==s&&(s=a(s),l.push(s));return l},d=function(t){var e,n,r,o;return t=f.compact(t),r=function(t){return"*"===t.substr(-1)?n(t.slice(0,-1)):e(t)},e=function(e){return f.contains(t,e)},n=function(e){return f.detect(t,function(t){return 0===t.indexOf(e)})},o=function(t){return f.detect(t,r)},{matchesAny:o}},u=function(){var e,r;return e=d([a(up.browser.url()),a(up.modal.url()),a(up.modal.coveredUrl()),a(up.popup.url()),a(up.popup.coveredUrl())]),r=o(),f.each(t(n),function(n){var o,i;return o=t(n),i=l(o),e.matchesAny(i)?o.addClass(r):o.hasClass(r)&&0===o.closest(".up-destroying").length?o.removeClass(r):void 0})},i=function(e){var r;return r=t(e),r.is(n)&&(r=f.presence(r.parent(n))||r),r},c=function(t,n){var r,o;return r=i(t),r.addClass(e),n?(o=n(),f.isPromise(o)?o.always(function(){return p(r)}):up.warn("Expected block to return a promise, but got %o",o),o):void 0},p=function(t){var n;return n=i(t),n.removeClass(e)},up.on("up:fragment:inserted",function(){return u()}),up.on("up:fragment:destroyed",function(t,e){return e.is(".up-modal, .up-popup")?u():void 0}),up.on("up:framework:reset",s),{config:r,start:c,stop:p}}(jQuery),up.renamedModule("navigation","feedback")}.call(this),function(){up.rails=function(t){var e,n,r,o;return r=up.util,o=function(t){return t.is("[up-follow], [up-target], [up-modal], [up-popup]")},n=function(){return r.isGiven(t.rails)},r.each(["method","confirm"],function(t){var e,i;return e="data-"+t,i="up-"+t,up.compiler("["+e+"]",function(t){var u;return n()&&o(t)?(u={},u[i]=t.attr(e),r.setMissingAttrs(t,u),t.removeAttr(e)):void 0})}),e=function(){return n()?{name:t.rails.csrfParam(),value:t.rails.csrfToken()}:void 0},{csrfField:e,isRails:n}}(jQuery)}.call(this),function(){up.boot()}.call(this);
3
+ e.headers=u.option(e.headers,{}),e.reveal=u.option(e.reveal,u.castedAttr(n,"up-reveal"),!0),e.cache=u.option(e.cache,u.castedAttr(n,"up-cache")),e.restoreScroll=u.option(e.restoreScroll,u.castedAttr(n,"up-restore-scroll")),e.origin=u.option(e.origin,n),e.layer=u.option(e.layer,n.attr("up-layer"),"auto"),e.data=u.requestDataFromForm(n),e=u.merge(e,up.motion.animateOptions(e,n)),e.validate&&(e.headers||(e.headers={}),e.transition=!1,e.failTransition=!1,e.headers[up.protocol.config.validateHeader]=e.validate),up.feedback.start(n),up.browser.canPushState()||e.history===!1?(r=up.replace(o,i,e),r.always(function(){return up.feedback.stop(n)}),r):(n.get(0).submit(),u.unresolvablePromise())},observe=function(){var $element,$fields,callback,callbackArg,delay,destructors,extraArgs,options,rawCallback,selectorOrElement;return selectorOrElement=arguments[0],extraArgs=2<=arguments.length?slice.call(arguments,1):[],options={},callbackArg=void 0,1===extraArgs.length?callbackArg=extraArgs[0]:extraArgs.length>1&&(options=u.options(extraArgs[0]),callbackArg=extraArgs[1]),$element=$(selectorOrElement),callback=null,rawCallback=u.option(callbackArg,u.presentAttr($element,"up-observe")),callback=u.isString(rawCallback)?function(value,$field){return eval(rawCallback)}:rawCallback||up.fail("up.observe: No change callback given"),delay=u.option(u.presentAttr($element,"up-delay"),options.delay,config.observeDelay),delay=parseInt(delay),$fields=u.multiSelector(config.fields).findWithSelf($element),destructors=u.map($fields,function(t){return observeField($(t),delay,callback)}),u.sequence.apply(u,destructors)},observeField=function(t,e,n){var r,o,i,a,s,l;return a=u.submittedValue(t),l=void 0,i=u.resolvedPromise(),s=function(e){var r;return a=e,r=n.apply(t.get(0),[e,t]),i=u.isPromise(r)?r:r},o=function(){var n,r;return r=u.submittedValue(t),a!==r?(n=function(){return s(r)},null!=l&&l.cancel(),l=u.promiseTimer(e),$.when(l,i).then(n)):void 0},r="input change",t.on(r,o),function(){return t.off(r,o),null!=l?l.cancel():void 0}},autosubmit=function(t,e){return observe(t,e,function(t,e){var n;return n=e.closest("form"),up.feedback.start(e,function(){return submit(n)})})},resolveValidateTarget=function(t,e){var n;return n=u.option(e.target,t.attr("up-validate")),u.isBlank(n)&&(n||(n=u.detect(config.validateTargets,function(n){var r;return r=up.dom.resolveSelector(n,e.origin),t.closest(r).length}))),u.isBlank(n)&&up.fail("Could not find default validation target for %o (tried ancestors %o)",t.get(0),config.validateTargets),u.isString(n)||(n=u.selectorForElement(n)),n},validate=function(t,e){var n,r,o;return n=$(t),e=u.options(e),e.origin=n,e.target=resolveValidateTarget(n,e),e.failTarget=e.target,e.history=!1,e.headers=u.option(e.headers,{}),e.validate=n.attr("name")||"__none__",e=u.merge(e,up.motion.animateOptions(e,n)),r=n.closest("form"),o=up.submit(r,e)},switcherValues=function(t){var e,n,r,o;return t.is("input[type=checkbox]")?t.is(":checked")?(r=t.val(),n=":checked"):n=":unchecked":t.is("input[type=radio]")?(e=t.closest("form, body").find("input[type='radio'][name='"+t.attr("name")+"']:checked"),e.length?(n=":checked",r=e.val()):n=":unchecked"):r=t.val(),o=[],u.isPresent(r)?(o.push(r),o.push(":present")):o.push(":blank"),u.isPresent(n)&&o.push(n),o},switchTargets=function(t,e){var n,r,o;return n=$(t),e=u.options(e),o=u.option(e.target,n.attr("up-switch")),u.isPresent(o)||up.fail("No switch target given for %o",n.get(0)),r=switcherValues(n),$(o).each(function(){return switchTarget($(this),r)})},switchTarget=function(t,e){var n,r,o,i;return n=$(t),e||(e=switcherValues(findSwitcherForTarget(n))),(r=n.attr("up-hide-for"))?(r=r.split(" "),o=0===u.intersect(e,r).length):(i=(i=n.attr("up-show-for"))?i.split(" "):[":present",":checked"],o=u.intersect(e,i).length>0),n.toggle(o),n.addClass("up-switched")},findSwitcherForTarget=function(t){var e,n;return e=$("[up-switch]"),n=u.detect(e,function(e){var n;return n=$(e).attr("up-switch"),t.is(n)}),n?$(n):u.fail("Could not find [up-switch] field for %o",$element.get(0))},up.on("submit","form[up-target]",function(t,e){return up.bus.consumeAction(t),submit(e)}),up.on("change","[up-validate]",function(t,e){return validate(e)}),up.on("change","[up-switch]",function(t,e){return switchTargets(e)}),up.compiler("[up-switch]",function(t){return switchTargets(t)}),up.compiler("[up-show-for]:not(.up-switched), [up-hide-for]:not(.up-switched)",function(t){return switchTarget(t)}),up.compiler("[up-observe]",function(t){return observe(t)}),up.compiler("[up-autosubmit]",function(t){return autosubmit(t)}),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,switchTargets:switchTargets,autosubmit:autosubmit}}(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 align,attachAsap,attachNow,autoclose,chain,closeAsap,closeNow,config,contains,createHiddenFrame,discardHistory,isOpen,reset,state,u,unveilFrame;return u=up.util,config=u.config({openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:150,closeDuration:100,openEasing:null,closeEasing:null,position:"bottom-right",history:!1}),state=u.config({phase:"closed",$anchor:null,$popup:null,position:null,sticky:null,url:null,coveredUrl:null,coveredTitle:null}),chain=new u.DivertibleChain,reset=function(){var t;return null!=(t=state.$popup)&&t.remove(),state.reset(),chain.reset(),config.reset()},align=function(){var t,e,n;switch(t={},n=u.measure(state.$popup),u.isFixed(state.$anchor)?(e=state.$anchor.get(0).getBoundingClientRect(),t.position="fixed"):e=u.measure(state.$anchor),state.position){case"bottom-right":t.top=e.top+e.height,t.left=e.left+e.width-n.width;break;case"bottom-left":t.top=e.top+e.height,t.left=e.left;break;case"top-right":t.top=e.top-n.height,t.left=e.left+e.width-n.width;break;case"top-left":t.top=e.top-n.height,t.left=e.left;break;default:up.fail("Unknown position option '%s'",state.position)}return state.$popup.attr("up-position",state.position),state.$popup.css(t)},discardHistory=function(){return state.coveredTitle=null,state.coveredUrl=null},createHiddenFrame=function(t){var e;return e=u.$createElementFromSelector(".up-popup"),u.$createPlaceholder(t,e),e.hide(),e.appendTo(document.body),state.$popup=e},unveilFrame=function(){return state.$popup.show()},isOpen=function(){return"opened"===state.phase||"opening"===state.phase},attachAsap=function(t,e){var n;return n=function(){return attachNow(t,e)},isOpen()?chain.asap(closeNow,n):chain.asap(n),chain.promise()},attachNow=function(t,e){var n,r,o,i,a,s;return n=$(t),n.length||up.fail("Cannot attach popup to non-existing element %o",t),e=u.options(e),s=u.option(u.pluckKey(e,"url"),n.attr("up-href"),n.attr("href")),o=u.option(u.pluckKey(e,"html")),a=u.option(u.pluckKey(e,"target"),n.attr("up-popup"),"body"),i=u.option(e.position,n.attr("up-position"),config.position),e.animation=u.option(e.animation,n.attr("up-animation"),config.openAnimation),e.sticky=u.option(e.sticky,u.castedAttr(n,"up-sticky"),config.sticky),e.history=up.browser.canPushState()?u.option(e.history,u.castedAttr(n,"up-history"),config.history):!1,e.confirm=u.option(e.confirm,n.attr("up-confirm")),e.method=up.link.followMethod(n,e),e.layer="popup",r=up.motion.animateOptions(e,n,{duration:config.openDuration,easing:config.openEasing}),up.browser.whenConfirmed(e).then(function(){return up.bus.whenEmitted("up:popup:open",{url:s,message:"Opening popup"}).then(function(){var t,l;return state.phase="opening",state.$anchor=n,state.position=i,e.history&&(state.coveredUrl=up.browser.url(),state.coveredTitle=document.title),state.sticky=e.sticky,e.provideTarget=function(){return createHiddenFrame(a)},t=u.merge(e,{animation:!1}),l=o?up.extract(a,o,t):up.replace(a,s,t),l=l.then(function(){return align(),unveilFrame(),up.animate(state.$popup,e.animation,r)}),l=l.then(function(){return state.phase="opened",up.emit("up:popup:opened",{message:"Popup opened"})})})})},closeAsap=function(t){return isOpen()&&chain.asap(function(){return closeNow(t)}),chain.promise()},closeNow=function(t){var e;return isOpen()?(t=u.options(t,{animation:config.closeAnimation,history:state.coveredUrl,title:state.coveredTitle}),e=up.motion.animateOptions(t,{duration:config.closeDuration,easing:config.closeEasing}),u.assign(t,e),up.bus.whenEmitted("up:popup:close",{message:"Closing popup",$element:state.$popup}).then(function(){return state.phase="closing",state.url=null,state.coveredUrl=null,state.coveredTitle=null,up.destroy(state.$popup,t).then(function(){return state.phase="closed",state.$popup=null,state.$anchor=null,state.sticky=null,up.emit("up:popup:closed",{message:"Popup closed"})})})):u.resolvedPromise()},autoclose=function(){return state.sticky?void 0:(discardHistory(),closeAsap())},contains=function(t){var e;return e=$(t),e.closest(".up-popup").length>0},up.link.onAction("[up-popup]",function(t){return t.is(".up-current")?closeAsap():attachAsap(t)}),up.on("click up:action:consumed",function(t){var e;return e=$(t.target),e.closest(".up-popup, [up-popup]").length?void 0:closeAsap()}),up.on("up:fragment:inserted",function(t,e){var n;if(contains(e)){if(n=e.attr("up-source"))return state.url=n}else if(contains(t.origin))return autoclose()}),up.bus.onEscape(closeAsap),up.on("click",".up-popup [up-close]",function(t,e){return closeAsap(),up.bus.consumeAction(t)}),up.on("up:history:restore",closeAsap),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),attach:attachAsap,close:closeAsap,url:function(){return state.url},coveredUrl:function(){return state.coveredUrl},config:config,contains:contains,isOpen:isOpen}}(jQuery)}.call(this),function(){up.modal=function($){var animate,autoclose,chain,closeAsap,closeNow,config,contains,createHiddenFrame,discardHistory,extractAsap,flavor,flavorDefault,flavorOverrides,flavors,followAsap,isOpen,markAsAnimating,openAsap,openNow,reset,shiftElements,state,templateHtml,u,unshiftElements,unveilFrame,visitAsap;return u=up.util,config=u.config({maxWidth:null,width:null,height:null,history:!0,openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:null,closeDuration:null,openEasing:null,closeEasing:null,backdropOpenAnimation:"fade-in",backdropCloseAnimation:"fade-out",closeLabel:"\xd7",closable:!0,sticky:!1,flavor:"default",position:null,template:function(t){return'<div class="up-modal">\n <div class="up-modal-backdrop"></div>\n <div class="up-modal-viewport">\n <div class="up-modal-dialog">\n <div class="up-modal-content"></div>\n <div class="up-modal-close" up-close>'+t.closeLabel+"</div>\n </div>\n </div>\n</div>"}}),flavors=u.openConfig({"default":{}}),state=u.config(function(){return{phase:"closed",$anchor:null,$modal:null,sticky:null,closable:null,flavor:null,url:null,coveredUrl:null,coveredTitle:null,position:null,unshifters:[]}}),chain=new u.DivertibleChain,reset=function(){var t;return null!=(t=state.$modal)&&t.remove(),unshiftElements(),state.reset(),chain.reset(),config.reset(),flavors.reset()},templateHtml=function(){var t;return t=flavorDefault("template"),u.evalOption(t,{closeLabel:flavorDefault("closeLabel")})},discardHistory=function(){return state.coveredTitle=null,state.coveredUrl=null},createHiddenFrame=function(t,e){var n,r,o;return o=$(templateHtml()),o.attr("up-flavor",state.flavor),u.isPresent(state.position)&&o.attr("up-position",state.position),r=o.find(".up-modal-dialog"),u.isPresent(e.width)&&r.css("width",e.width),u.isPresent(e.maxWidth)&&r.css("max-width",e.maxWidth),u.isPresent(e.height)&&r.css("height",e.height),state.closable||o.find(".up-modal-close").remove(),n=o.find(".up-modal-content"),u.$createPlaceholder(t,n),o.hide(),o.appendTo(document.body),state.$modal=o},unveilFrame=function(){return state.$modal.show()},shiftElements=function(){var t,e,n,r,o;return u.documentHasVerticalScrollbar()?(t=$("body"),r=u.scrollbarWidth(),e=parseFloat(t.css("padding-right")),n=r+e,o=u.temporaryCss(t,{"padding-right":n+"px","overflow-y":"hidden"}),state.unshifters.push(o),up.layout.anchoredRight().each(function(){var t,e,n,o;return t=$(this),e=parseFloat(t.css("right")),n=r+e,o=u.temporaryCss(t,{right:n}),state.unshifters.push(o)})):void 0},unshiftElements=function(){var t,e;for(t=[];e=state.unshifters.pop();)t.push(e());return t},isOpen=function(){return"opened"===state.phase||"opening"===state.phase},followAsap=function(t,e){return e=u.options(e),e.$link=$(t),openAsap(e)},visitAsap=function(t,e){return e=u.options(e),e.url=t,openAsap(e)},extractAsap=function(t,e,n){return n=u.options(n),n.html=e,n.history=u.option(n.history,!1),n.target=t,openAsap(n)},openAsap=function(t){var e;return e=function(){return openNow(t)},isOpen()?chain.asap(closeNow,e):chain.asap(e),chain.promise()},openNow=function(t){var e,n,r,o,i;return t=u.options(t),e=u.option(u.pluckKey(t,"$link"),u.nullJQuery()),i=u.option(u.pluckKey(t,"url"),e.attr("up-href"),e.attr("href")),r=u.option(u.pluckKey(t,"html")),o=u.option(u.pluckKey(t,"target"),e.attr("up-modal"),"body"),t.flavor=u.option(t.flavor,e.attr("up-flavor"),config.flavor),t.position=u.option(t.position,e.attr("up-position"),flavorDefault("position",t.flavor)),t.position=u.evalOption(t.position,{$link:e}),t.width=u.option(t.width,e.attr("up-width"),flavorDefault("width",t.flavor)),t.maxWidth=u.option(t.maxWidth,e.attr("up-max-width"),flavorDefault("maxWidth",t.flavor)),t.height=u.option(t.height,e.attr("up-height"),flavorDefault("height")),t.animation=u.option(t.animation,e.attr("up-animation"),flavorDefault("openAnimation",t.flavor)),t.animation=u.evalOption(t.animation,{position:t.position}),t.backdropAnimation=u.option(t.backdropAnimation,e.attr("up-backdrop-animation"),flavorDefault("backdropOpenAnimation",t.flavor)),t.backdropAnimation=u.evalOption(t.backdropAnimation,{position:t.position}),t.sticky=u.option(t.sticky,u.castedAttr(e,"up-sticky"),flavorDefault("sticky",t.flavor)),t.closable=u.option(t.closable,u.castedAttr(e,"up-closable"),flavorDefault("closable",t.flavor)),t.confirm=u.option(t.confirm,e.attr("up-confirm")),t.method=up.link.followMethod(e,t),t.layer="modal",n=up.motion.animateOptions(t,e,{duration:flavorDefault("openDuration",t.flavor),easing:flavorDefault("openEasing",t.flavor)}),t.history=u.option(t.history,u.castedAttr(e,"up-history"),flavorDefault("history",t.flavor)),up.browser.canPushState()||(t.history=!1),up.browser.whenConfirmed(t).then(function(){return up.bus.whenEmitted("up:modal:open",{url:i,message:"Opening modal"}).then(function(){var e,a;return state.phase="opening",state.flavor=t.flavor,state.sticky=t.sticky,state.closable=t.closable,state.position=t.position,t.history&&(state.coveredUrl=up.browser.url(),state.coveredTitle=document.title),t.provideTarget=function(){return createHiddenFrame(o,t)},e=u.merge(t,{animation:!1}),a=r?up.extract(o,r,e):up.replace(o,i,e),a=a.then(function(){return shiftElements(),unveilFrame(),animate(t.animation,t.backdropAnimation,n)}),a=a.then(function(){return state.phase="opened",up.emit("up:modal:opened",{message:"Modal opened"})})})})},closeAsap=function(t){return isOpen()&&chain.asap(function(){return closeNow(t)}),chain.promise()},closeNow=function(t){var e,n,r,o;return isOpen()?(t=u.options(t),o=u.option(t.animation,flavorDefault("closeAnimation")),o=u.evalOption(o,{position:state.position}),n=u.option(t.backdropAnimation,flavorDefault("backdropCloseAnimation")),n=u.evalOption(n,{position:state.position}),e=up.motion.animateOptions(t,{duration:flavorDefault("closeDuration"),easing:flavorDefault("closeEasing")}),r=u.options(u.except(t,"animation","duration","easing","delay"),{history:state.coveredUrl,title:state.coveredTitle}),up.bus.whenEmitted("up:modal:close",{$element:state.$modal,message:"Closing modal"}).then(function(){var t;return state.phase="closing",state.url=null,state.coveredUrl=null,state.coveredTitle=null,t=animate(o,n,e),t=t.then(function(){return up.destroy(state.$modal,r)}),t=t.then(function(){return unshiftElements(),state.phase="closed",state.$modal=null,state.flavor=null,state.sticky=null,state.closable=null,state.position=null,up.emit("up:modal:closed",{message:"Modal closed"})})})):u.resolvedPromise()},markAsAnimating=function(t){return null==t&&(t=!0),state.$modal.toggleClass("up-modal-animating",t)},animate=function(t,e,n){var r;return up.motion.isNone(t)?u.resolvedPromise():(markAsAnimating(),r=$.when(up.animate(state.$modal.find(".up-modal-viewport"),t,n),up.animate(state.$modal.find(".up-modal-backdrop"),e,n)),r=r.then(function(){return markAsAnimating(!1)}))},autoclose=function(){return state.sticky?void 0:(discardHistory(),closeAsap())},contains=function(t){var e;return e=$(t),e.closest(".up-modal").length>0},flavor=function(t,e){return null==e&&(e={}),up.log.warn("The up.modal.flavor function is deprecated. Use the up.modal.flavors property instead."),u.assign(flavorOverrides(t),e)},flavorOverrides=function(t){return flavors[t]||(flavors[t]={})},flavorDefault=function(t,e){var n;return null==e&&(e=state.flavor),e&&(n=flavorOverrides(e)[t]),u.isMissing(n)&&(n=config[t]),n},up.link.onAction("[up-modal]",function(t){return followAsap(t)}),up.on("click",".up-modal",function(t){var e;if(state.closable)return e=$(t.target),e.closest(".up-modal-dialog").length||e.closest("[up-modal]").length?void 0:(up.bus.consumeAction(t),closeAsap())}),up.on("up:fragment:inserted",function(t,e){var n;if(contains(e)){if(n=e.attr("up-source"))return state.url=n}else if(contains(t.origin)&&!up.popup.contains(e))return autoclose()}),up.bus.onEscape(function(){return state.closable?closeAsap():void 0}),up.on("click",".up-modal [up-close]",function(t,e){return closeAsap(),up.bus.consumeAction(t)}),up.macro("[up-drawer]",function(t){var e;return e=t.attr("up-drawer"),t.attr({"up-modal":e,"up-flavor":"drawer"})}),flavors.drawer={openAnimation:function(t){switch(t.position){case"left":return"move-from-left";case"right":return"move-from-right"}},closeAnimation:function(t){switch(t.position){case"left":return"move-to-left";case"right":return"move-to-right"}},position:function(t){return u.isPresent(t.$link)?u.horizontalScreenHalf(t.$link):"left"}},up.on("up:history:restore",closeAsap),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visitAsap,follow:followAsap,extract:extractAsap,close:closeAsap,url:function(){return state.url},coveredUrl:function(){return state.coveredUrl},config:config,flavors:flavors,contains:contains,isOpen:isOpen,flavor:flavor}}(jQuery)}.call(this),function(){up.tooltip=function(t){var e,n,r,o,i,u,a,s,l,c,p,f;return f=up.util,a=f.config({position:"top",openAnimation:"fade-in",closeAnimation:"fade-out",openDuration:100,closeDuration:50,openEasing:null,closeEasing:null}),p=f.config({phase:"closed",$anchor:null,$tooltip:null,position:null}),o=new f.DivertibleChain,c=function(){var t;return null!=(t=p.$tooltip)&&t.remove(),p.reset(),o.reset(),a.reset()},e=function(){var t,e,n;switch(t={},n=f.measure(p.$tooltip),f.isFixed(p.$anchor)?(e=p.$anchor.get(0).getBoundingClientRect(),t.position="fixed"):e=f.measure(p.$anchor),p.position){case"top":t.top=e.top-n.height,t.left=e.left+.5*(e.width-n.width);break;case"left":t.top=e.top+.5*(e.height-n.height),t.left=e.left-n.width;break;case"right":t.top=e.top+.5*(e.height-n.height),t.left=e.left+e.width;break;case"bottom":t.top=e.top+e.height,t.left=e.left+.5*(e.width-n.width);break;default:up.fail("Unknown position option '%s'",p.position)}return p.$tooltip.attr("up-position",p.position),p.$tooltip.css(t)},s=function(t){var e;return e=f.$createElementFromSelector(".up-tooltip"),f.isGiven(t.text)?e.text(t.text):e.html(t.html),e.appendTo(document.body),p.$tooltip=e},n=function(t,e){var n;return null==e&&(e={}),n=function(){return r(t,e)},l()?o.asap(u,n):o.asap(n),o.promise()},r=function(n,r){var o,i,u,l,c,d;return o=t(n),r=f.options(r),l=f.option(r.html,o.attr("up-tooltip-html")),d=f.option(r.text,o.attr("up-tooltip")),c=f.option(r.position,o.attr("up-position"),a.position),u=f.option(r.animation,f.castedAttr(o,"up-animation"),a.openAnimation),i=up.motion.animateOptions(r,o,{duration:a.openDuration,easing:a.openEasing}),p.phase="opening",p.$anchor=o,s({text:d,html:l}),p.position=c,e(),up.animate(p.$tooltip,u,i).then(function(){return p.phase="opened"})},i=function(t){return l()&&o.asap(function(){return u(t)}),o.promise()},u=function(t){var e;return l()?(t=f.options(t,{animation:a.closeAnimation}),e=up.motion.animateOptions(t,{duration:a.closeDuration,easing:a.closeEasing}),f.assign(t,e),p.phase="closing",up.destroy(p.$tooltip,t).then(function(){return p.phase="closed",p.$tooltip=null,p.$anchor=null})):f.resolvedPromise()},l=function(){return"opening"===p.phase||"opened"===p.phase},up.compiler("[up-tooltip], [up-tooltip-html]",function(t){return t.on("mouseenter",function(){return n(t)}),t.on("mouseleave",function(){return i()})}),up.on("click up:action:consumed",function(t){return i()}),up.on("up:framework:reset",c),up.bus.onEscape(function(){return i()}),{config:a,attach:n,isOpen:l,close:i}}(jQuery)}.call(this),function(){up.feedback=function(t){var e,n,r,o,i,u,a,s,l,c,p,f,d;return f=up.util,r=f.config({currentClasses:["up-current"]}),s=function(){return r.reset()},o=function(){var t;return t=r.currentClasses,t=t.concat(["up-current"]),t=f.uniq(t),t.join(" ")},e="up-active",n="a, [up-href]",a=function(t){return f.isPresent(t)?f.normalizeUrl(t,{stripTrailingSlash:!0}):void 0},l=function(t){var e,n,r,o,i,u,s,l,c,p;for(l=[],u=["href","up-href","up-alias"],n=0,o=u.length;o>n;n++)if(e=u[n],c=f.presentAttr(t,e))for(p="up-alias"===e?c.split(" "):[c],r=0,i=p.length;i>r;r++)s=p[r],"#"!==s&&(s=a(s),l.push(s));return l},d=function(t){var e,n,r,o;return t=f.compact(t),r=function(t){return"*"===t.substr(-1)?n(t.slice(0,-1)):e(t)},e=function(e){return f.contains(t,e)},n=function(e){return f.detect(t,function(t){return 0===t.indexOf(e)})},o=function(t){return f.detect(t,r)},{matchesAny:o}},u=function(){var e,r;return e=d([a(up.browser.url()),a(up.modal.url()),a(up.modal.coveredUrl()),a(up.popup.url()),a(up.popup.coveredUrl())]),r=o(),f.each(t(n),function(n){var o,i;return o=t(n),i=l(o),e.matchesAny(i)?o.addClass(r):o.hasClass(r)&&0===o.closest(".up-destroying").length?o.removeClass(r):void 0})},i=function(e){var r;return r=t(e),r.is(n)&&(r=f.presence(r.parent(n))||r),r},c=function(t,n){var r,o;return r=i(t),r.addClass(e),n?(o=n(),f.isPromise(o)?o.always(function(){return p(r)}):up.warn("Expected block to return a promise, but got %o",o),o):void 0},p=function(t){var n;return n=i(t),n.removeClass(e)},up.on("up:fragment:inserted",function(){return u()}),up.on("up:fragment:destroyed",function(t,e){return e.is(".up-modal, .up-popup")?u():void 0}),up.on("up:framework:reset",s),{config:r,start:c,stop:p}}(jQuery),up.renamedModule("navigation","feedback")}.call(this),function(){up.rails=function(t){var e,n,r,o;return r=up.util,o=function(t){return t.is("[up-follow], [up-target], [up-modal], [up-popup]")},n=function(){return r.isGiven(t.rails)},r.each(["method","confirm"],function(t){var e,i;return e="data-"+t,i="up-"+t,up.compiler("["+e+"]",function(t){var u;return n()&&o(t)?(u={},u[i]=t.attr(e),r.setMissingAttrs(t,u),t.removeAttr(e)):void 0})}),e=function(){return n()?{name:t.rails.csrfParam(),value:t.rails.csrfToken()}:void 0},{csrfField:e,isRails:n}}(jQuery)}.call(this),function(){up.boot()}.call(this);
@@ -245,6 +245,7 @@ up.browser = (($) ->
245
245
  parts = version.split('.')
246
246
  major = parseInt(parts[0])
247
247
  minor = parseInt(parts[1])
248
+ # When updating minimum jQuery, also update the dependency in package.json.
248
249
  major >= 2 || (major == 1 && minor >= 9)
249
250
 
250
251
  ###*
@@ -692,9 +692,11 @@ up.modal = (($) ->
692
692
  up.link.onAction '[up-modal]', ($link) ->
693
693
  followAsap($link)
694
694
 
695
- # Close the modal when someone clicks outside the dialog
696
- # (but not on a modal opener).
697
- up.on('click', (event) ->
695
+ # Close the modal when someone clicks outside the dialog (but not on a modal opener).
696
+ # Note that we cannot listen to clicks on .up-modal-backdrop, which is a sister element
697
+ # of .up-modal-viewport. Since the user will effectively click on the viewport, not
698
+ # the backdrop, backdrop will not receive a bubbling event.
699
+ up.on('click', '.up-modal', (event) ->
698
700
  return unless state.closable
699
701
 
700
702
  $target = $(event.target)
@@ -40,7 +40,7 @@ The **simplest implementation** is to set these headers for every request.
40
40
 
41
41
  \#\#\# Optimizing responses
42
42
 
43
- When [updating a fragment](http://unpoly.com/up.link), Unpoly will send
43
+ When [updating a fragment](/up.link), Unpoly will send
44
44
  an additional HTTP header containing the CSS selector that is being replaced:
45
45
 
46
46
  ```http
@@ -54,7 +54,7 @@ expensive sidebar if the sidebar is not targeted.
54
54
 
55
55
  \#\#\# Pushing a document title to the client
56
56
 
57
- When [updating a fragment](http://unpoly.com/up.link), Unpoly will by default
57
+ When [updating a fragment](/up.link), Unpoly will by default
58
58
  extract the `<title>` from the server response and update the document title accordingly.
59
59
 
60
60
  The server can also force Unpoly to set a document title by passing a HTTP header:
@@ -70,7 +70,7 @@ no longer includes a `<title>`, you can instead use the HTTP header to pass the
70
70
 
71
71
  \#\#\# Signaling failed form submissions
72
72
 
73
- When [submitting a form via AJAX](http://unpoly.com/form-up-target)
73
+ When [submitting a form via AJAX](/form-up-target)
74
74
  Unpoly needs to know whether the form submission has failed (to update the form with
75
75
  validation errors) or succeeded (to update the `up-target` selector).
76
76
 
@@ -97,7 +97,7 @@ To do so in [Ruby on Rails](http://rubyonrails.org/), pass a [`:status` option t
97
97
 
98
98
  \#\#\# Detecting live form validations
99
99
 
100
- When [validating a form](http://unpoly.com/up-validate), Unpoly will
100
+ When [validating a form](/up-validate), Unpoly will
101
101
  send an additional HTTP header containing a CSS selector for the form that is
102
102
  being updated:
103
103
 
@@ -58,7 +58,7 @@ up.util = (($) ->
58
58
  Whether to include an `#hash` anchor in the normalized URL
59
59
  @param {Boolean} [options.search=true]
60
60
  Whether to include a `?query` string in the normalized URL
61
- @param {Boolean} [options.stripTrailingSlash=true]
61
+ @param {Boolean} [options.stripTrailingSlash=false]
62
62
  Whether to strip a trailing slash from the pathname
63
63
  @internal
64
64
  ###
@@ -13,7 +13,7 @@ module Unpoly
13
13
 
14
14
  ##
15
15
  # Returns whether the current request is an
16
- # [page fragment update](http://unpoly.com/up.replace) triggered by an
16
+ # [page fragment update](https://unpoly.com/up.replace) triggered by an
17
17
  # Unpoly frontend.
18
18
  def up?
19
19
  target.present?
@@ -22,7 +22,7 @@ module Unpoly
22
22
  alias_method :unpoly?, :up?
23
23
 
24
24
  ##
25
- # If the current request is a [fragment update](http://unpoly.com/up.replace),
25
+ # If the current request is a [fragment update](https://unpoly.com/up.replace),
26
26
  # this returns the CSS selector of the page fragment that should be updated.
27
27
  #
28
28
  # The Unpoly frontend will expect an HTML response containing an element
@@ -63,13 +63,13 @@ module Unpoly
63
63
 
64
64
  ##
65
65
  # Returns whether the current form submission should be
66
- # [validated](http://unpoly.com/up-validate) (and not be saved to the database).
66
+ # [validated](https://unpoly.com/up-validate) (and not be saved to the database).
67
67
  def validate?
68
68
  validate_name.present?
69
69
  end
70
70
 
71
71
  ##
72
- # If the current form submission is a [validation](http://unpoly.com/up-validate),
72
+ # If the current form submission is a [validation](https://unpoly.com/up-validate),
73
73
  # this returns the name attribute of the form field that has triggered
74
74
  # the validation.
75
75
  def validate_name
@@ -19,7 +19,7 @@ module Unpoly
19
19
  ##
20
20
  # :method: up?
21
21
  # Returns whether the current request is an
22
- # [page fragment update](http://unpoly.com/up.replace) triggered by an
22
+ # [page fragment update](https://unpoly.com/up.replace) triggered by an
23
23
  # Unpoly frontend.
24
24
  delegate :up?, :unpoly?, :to => :up
25
25
 
@@ -4,6 +4,6 @@ module Unpoly
4
4
  # The current version of the unpoly-rails gem.
5
5
  # This version number is also used for releases of the Unpoly
6
6
  # frontend code.
7
- VERSION = '0.36.0'
7
+ VERSION = '0.36.1'
8
8
  end
9
9
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unpoly",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "description": "Unobtrusive JavaScript framework",
5
5
  "main": "dist/unpoly.js",
6
6
  "files": [
@@ -32,5 +32,8 @@
32
32
  "bugs": {
33
33
  "url": "https://github.com/unpoly/unpoly/issues"
34
34
  },
35
- "homepage": "http://unpoly.com"
35
+ "homepage": "https://unpoly.com",
36
+ "dependencies": {
37
+ "jquery": ">=1.9"
38
+ }
36
39
  }
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- unpoly-rails (0.35.2)
4
+ unpoly-rails (0.36.0)
5
5
  rails (>= 3)
6
6
 
7
7
  GEM
@@ -0,0 +1,11 @@
1
+ u = up.util
2
+
3
+ beforeEach ->
4
+ jasmine.addMatchers
5
+ toEqualUrl: (util, customEqualityTesters) ->
6
+ compare: (actual, expected, normalizeOptions = {}) ->
7
+ normalizedActual = u.normalizeUrl(actual, normalizeOptions)
8
+ normalizedExpected = u.normalizeUrl(expected, normalizeOptions)
9
+ pass: normalizedActual == normalizedExpected
10
+
11
+
@@ -117,7 +117,7 @@ describe 'up.dom', ->
117
117
  it "encodes the given params into the URL of a GET request", ->
118
118
  givenParams = { 'foo-key': 'foo-value', 'bar-key': 'bar-value' }
119
119
  up.replace('.middle', '/path', method: 'get', data: givenParams)
120
- expect(@lastRequest().url).toEndWith('/path?foo-key=foo-value&bar-key=bar-value')
120
+ expect(@lastRequest().url).toEqualUrl('/path?foo-key=foo-value&bar-key=bar-value')
121
121
 
122
122
  it 'uses a HTTP method given as { method } option', ->
123
123
  up.replace('.middle', '/path', method: 'put')
@@ -172,55 +172,55 @@ describe 'up.dom', ->
172
172
  promise = up.replace('.middle', '/path')
173
173
  @respond()
174
174
  promise.then ->
175
- expect(location.href).toEndWith('/path')
175
+ expect(location.href).toEqualUrl('/path')
176
176
  done()
177
177
 
178
178
  it 'does not add a history entry after non-GET requests', ->
179
179
  promise = up.replace('.middle', '/path', method: 'post')
180
180
  @respond()
181
- expect(location.href).toEndWith(@hrefBeforeExample)
181
+ expect(location.href).toEqualUrl(@hrefBeforeExample)
182
182
 
183
183
  it 'adds a history entry after non-GET requests if the response includes a { X-Up-Method: "get" } header (will happen after a redirect)', ->
184
184
  promise = up.replace('.middle', '/path', method: 'post')
185
185
  @respond(responseHeaders: { 'X-Up-Method': 'GET' })
186
- expect(location.href).toEndWith('/path')
186
+ expect(location.href).toEqualUrl('/path')
187
187
 
188
188
  it 'does not a history entry after a failed GET-request', ->
189
189
  promise = up.replace('.middle', '/path', method: 'post', failTarget: '.middle')
190
190
  @respond(status: 500)
191
- expect(location.href).toEndWith(@hrefBeforeExample)
191
+ expect(location.href).toEqualUrl(@hrefBeforeExample)
192
192
 
193
193
  it 'does not add a history entry with { history: false } option', ->
194
194
  promise = up.replace('.middle', '/path', history: false)
195
195
  @respond()
196
- expect(location.href).toEndWith(@hrefBeforeExample)
196
+ expect(location.href).toEqualUrl(@hrefBeforeExample)
197
197
 
198
198
  it "detects a redirect's new URL when the server sets an X-Up-Location header", ->
199
199
  promise = up.replace('.middle', '/path')
200
200
  @respond(responseHeaders: { 'X-Up-Location': '/other-path' })
201
- expect(location.href).toEndWith('/other-path')
201
+ expect(location.href).toEqualUrl('/other-path')
202
202
 
203
203
  it 'adds params from a { data } option to the URL of a GET request', ->
204
204
  promise = up.replace('.middle', '/path', data: { 'foo-key': 'foo value', 'bar-key': 'bar value' })
205
205
  @respond()
206
- expect(location.href).toEndWith('/path?foo-key=foo%20value&bar-key=bar%20value')
206
+ expect(location.href).toEqualUrl('/path?foo-key=foo%20value&bar-key=bar%20value')
207
207
 
208
208
  describe 'if a URL is given as { history } option', ->
209
209
 
210
210
  it 'uses that URL as the new location after a GET request', ->
211
211
  promise = up.replace('.middle', '/path', history: '/given-path')
212
212
  @respond(failTarget: '.middle')
213
- expect(location.href).toEndWith('/given-path')
213
+ expect(location.href).toEqualUrl('/given-path')
214
214
 
215
215
  it 'adds a history entry after a non-GET request', ->
216
216
  promise = up.replace('.middle', '/path', method: 'post', history: '/given-path')
217
217
  @respond(failTarget: '.middle')
218
- expect(location.href).toEndWith('/given-path')
218
+ expect(location.href).toEqualUrl('/given-path')
219
219
 
220
220
  it 'does not add a history entry after a failed non-GET request', ->
221
221
  promise = up.replace('.middle', '/path', method: 'post', history: '/given-path', failTarget: '.middle')
222
222
  @respond(failTarget: '.middle', status: 500)
223
- expect(location.href).toEndWith(@hrefBeforeExample)
223
+ expect(location.href).toEqualUrl(@hrefBeforeExample)
224
224
 
225
225
  describe 'source', ->
226
226
 
@@ -236,25 +236,25 @@ describe 'up.dom', ->
236
236
  up.replace('.middle', '/path', method: 'post')
237
237
  @respond()
238
238
  expect($('.middle')).toHaveText('new-middle')
239
- expect(up.dom.source('.middle')).toEndWith('/previous-source')
239
+ expect(up.dom.source('.middle')).toEqualUrl('/previous-source')
240
240
 
241
241
  describe 'if a URL is given as { source } option', ->
242
242
 
243
243
  it 'uses that URL as the source for a GET request', ->
244
244
  promise = up.replace('.middle', '/path', source: '/given-path')
245
245
  @respond()
246
- expect(up.dom.source('.middle')).toEndWith('/given-path')
246
+ expect(up.dom.source('.middle')).toEqualUrl('/given-path')
247
247
 
248
248
  it 'uses that URL as the source after a non-GET request', ->
249
249
  promise = up.replace('.middle', '/path', method: 'post', source: '/given-path')
250
250
  @respond()
251
- expect(up.dom.source('.middle')).toEndWith('/given-path')
251
+ expect(up.dom.source('.middle')).toEqualUrl('/given-path')
252
252
 
253
253
  it 'ignores the option and reuses the previous source after a failed non-GET request', ->
254
254
  @oldMiddle.attr('up-source', '/previous-source')
255
255
  promise = up.replace('.middle', '/path', method: 'post', source: '/given-path', failTarget: '.middle')
256
256
  @respond(status: 500)
257
- expect(up.dom.source('.middle')).toEndWith('/previous-source')
257
+ expect(up.dom.source('.middle')).toEqualUrl('/previous-source')
258
258
 
259
259
  describe 'document title', ->
260
260
 
@@ -1320,7 +1320,7 @@ describe 'up.dom', ->
1320
1320
  it 'allows to pass a new history entry as { history } option', ->
1321
1321
  affix('.element')
1322
1322
  up.destroy('.element', history: '/new-path')
1323
- expect(location.href).toEndWith('/new-path')
1323
+ expect(location.href).toEqualUrl('/new-path')
1324
1324
 
1325
1325
  it 'allows to pass a new document title as { title } option', ->
1326
1326
  affix('.element')
@@ -312,14 +312,14 @@ describe 'up.form', ->
312
312
  </div>
313
313
  """
314
314
 
315
- expect(up.browser.url()).toEndWith('/other-path')
315
+ expect(up.browser.url()).toEqualUrl('/other-path')
316
316
 
317
317
  describe 'with { history } option', ->
318
318
 
319
319
  it 'uses the given URL as the new browser location if the request succeeded', ->
320
320
  up.submit(@$form, history: '/given-path')
321
321
  @respondWith('<div class="response">new-text</div>')
322
- expect(up.browser.url()).toEndWith('/given-path')
322
+ expect(up.browser.url()).toEqualUrl('/given-path')
323
323
 
324
324
  it 'keeps the current browser location if the request failed', ->
325
325
  up.submit(@$form, history: '/given-path', failTarget: '.response')
@@ -14,7 +14,7 @@ describe 'up.history', ->
14
14
 
15
15
  it 'does not strip a trailing slash from the current URL', ->
16
16
  history.replaceState?({}, 'title', '/host/path/')
17
- expect(up.history.url()).toEndWith('/host/path/')
17
+ expect(up.history.url()).toEqualUrl('/host/path/')
18
18
 
19
19
  describe 'up.history.isUrl', ->
20
20
 
@@ -50,8 +50,8 @@ describe 'up.history', ->
50
50
  up.history.push('/one')
51
51
  up.history.push('/two')
52
52
  $element = up.hello(affix('a[href="/three"][up-back]').text('text'))
53
- expect($element.attr('href')).toEndWith('/three')
54
- expect($element.attr('up-href')).toEndWith('/one')
53
+ expect($element.attr('href')).toEqualUrl('/three')
54
+ expect($element.attr('up-href')).toEqualUrl('/one')
55
55
  expect($element.attr('up-restore-scroll')).toBe('')
56
56
  expect($element.attr('up-follow')).toBe('')
57
57
 
@@ -156,7 +156,7 @@ describe 'up.history', ->
156
156
 
157
157
  u.setTimer 50, ->
158
158
 
159
- expect(location.href).toEndWith('/two')
159
+ expect(location.href).toEqualUrl('/two')
160
160
 
161
161
  history.back()
162
162
 
@@ -63,7 +63,7 @@ describe 'up.modal', ->
63
63
  expect('.up-modal-dialog .before').not.toExist()
64
64
  expect('.up-modal-dialog .after').not.toExist()
65
65
 
66
- expect(location.pathname).toEndWith('/foo')
66
+ expect(location.pathname).toEqualUrl('/foo')
67
67
 
68
68
  it "doesn't create an .up-modal frame and replaces { failTarget } if the server returns a non-200 response", ->
69
69
  affix('.error').text('old error')
@@ -321,7 +321,7 @@ describe 'up.modal', ->
321
321
  visitPromise = up.modal.visit('/bar', target: '.container')
322
322
  @respondWith('<div class="container">text</div>')
323
323
  visitPromise.then ->
324
- expect(up.modal.coveredUrl()).toEndWith('/foo')
324
+ expect(up.modal.coveredUrl()).toEqualUrl('/foo')
325
325
  up.modal.close().then ->
326
326
  expect(up.modal.coveredUrl()).toBeMissing()
327
327
  done()
@@ -375,37 +375,49 @@ describe 'up.modal', ->
375
375
  describe 'a[up-modal]', ->
376
376
 
377
377
  beforeEach ->
378
+ up.motion.config.enabled = false
379
+
380
+ # Some examples only want to check if follow() has been called, without
381
+ # actually making a request.
378
382
  @stubFollow = =>
379
383
  @$link = affix('a[href="/path"][up-modal=".target"]')
380
384
  @followSpy = up.modal.knife.mock('followAsap').and.returnValue(u.resolvedPromise())
381
385
  @defaultSpy = up.link.knife.mock('allowDefault').and.callFake((event) -> event.preventDefault())
382
386
 
383
- it 'opens the clicked link in a modal', ->
384
- @stubFollow()
387
+ it 'opens the clicked link in a modal', (done) ->
388
+ @$link = affix('a[href="/path"][up-modal=".target"]')
385
389
  Trigger.click(@$link)
386
- expect(@followSpy).toHaveBeenCalledWith(@$link)
390
+ lastRequest = @lastRequest()
391
+ expect(lastRequest.url).toEqualUrl('/path')
392
+ @respondWith '<div class="target">new content</div>'
393
+ u.nextFrame =>
394
+ expect('.up-modal').toExist()
395
+ expect('.up-modal-content').toHaveText('new content')
396
+ done()
397
+
398
+ describe 'when modifier keys are held', ->
399
+
400
+ # IE does not call JavaScript and always performs the default action on right clicks
401
+ unless navigator.userAgent.match(/Trident/)
402
+ it 'does nothing if the right mouse button is used', ->
403
+ @stubFollow()
404
+ Trigger.click(@$link, button: 2)
405
+ expect(@followSpy).not.toHaveBeenCalled()
387
406
 
388
- # IE does not call JavaScript and always performs the default action on right clicks
389
- unless navigator.userAgent.match(/Trident/)
390
- it 'does nothing if the right mouse button is used', ->
407
+ it 'does nothing if shift is pressed during the click', ->
391
408
  @stubFollow()
392
- Trigger.click(@$link, button: 2)
409
+ Trigger.click(@$link, shiftKey: true)
393
410
  expect(@followSpy).not.toHaveBeenCalled()
394
411
 
395
- it 'does nothing if shift is pressed during the click', ->
396
- @stubFollow()
397
- Trigger.click(@$link, shiftKey: true)
398
- expect(@followSpy).not.toHaveBeenCalled()
399
-
400
- it 'does nothing if ctrl is pressed during the click', ->
401
- @stubFollow()
402
- Trigger.click(@$link, ctrlKey: true)
403
- expect(@followSpy).not.toHaveBeenCalled()
412
+ it 'does nothing if ctrl is pressed during the click', ->
413
+ @stubFollow()
414
+ Trigger.click(@$link, ctrlKey: true)
415
+ expect(@followSpy).not.toHaveBeenCalled()
404
416
 
405
- it 'does nothing if meta is pressed during the click', ->
406
- @stubFollow()
407
- Trigger.click(@$link, metaKey: true)
408
- expect(@followSpy).not.toHaveBeenCalled()
417
+ it 'does nothing if meta is pressed during the click', ->
418
+ @stubFollow()
419
+ Trigger.click(@$link, metaKey: true)
420
+ expect(@followSpy).not.toHaveBeenCalled()
409
421
 
410
422
  describe 'with [up-instant] modifier', ->
411
423
 
@@ -476,6 +488,34 @@ describe 'up.modal', ->
476
488
  expect('.up-modal').not.toExist()
477
489
  done()
478
490
 
491
+ it 'allows to open a modal after closing a previous modul with the escape key (bugfix)', (done) ->
492
+ up.motion.config.enabled = false
493
+
494
+ $link1 = affix('a[href="/path1"][up-modal=".target"]')
495
+ $link2 = affix('a[href="/path2"][up-modal=".target"]')
496
+ Trigger.clickSequence($link1)
497
+
498
+ u.nextFrame =>
499
+ @respondWith('<div class="target">content 1</div>')
500
+
501
+ u.nextFrame =>
502
+ expect(up.modal.isOpen()).toBe(true)
503
+
504
+ escapeEvent = $.Event('keydown', keyCode: 27)
505
+ $('body').trigger(escapeEvent)
506
+
507
+ u.nextFrame =>
508
+ expect(up.modal.isOpen()).toBe(false)
509
+
510
+ Trigger.clickSequence($link2)
511
+
512
+ u.nextFrame =>
513
+ @respondWith('<div class="target">content 1</div>')
514
+
515
+ u.nextFrame =>
516
+ expect(up.modal.isOpen()).toBe(true)
517
+ done()
518
+
479
519
 
480
520
  describe '[up-drawer]', ->
481
521
 
@@ -542,7 +582,7 @@ describe 'up.modal', ->
542
582
  expect(backgroundClicked).toHaveBeenCalled()
543
583
  done()
544
584
 
545
- describe 'template behavior', ->
585
+ describe 'closing', ->
546
586
 
547
587
  it 'closes the modal on close icon click', (done) ->
548
588
  up.modal.extract('.modal', '<div class="modal">Modal content</div>', animation: false)
@@ -564,6 +604,15 @@ describe 'up.modal', ->
564
604
  expect(up.modal.isOpen()).toBe(false)
565
605
  done()
566
606
 
607
+ it "does not close the modal when clicking on an element outside the modal's DOM hierarchy", (done) ->
608
+ $container = affix('.container')
609
+ up.modal.extract('.modal', '<div class="modal">Modal content</div>', animation: false)
610
+
611
+ Trigger.clickSequence($container)
612
+ u.nextFrame ->
613
+ expect(up.modal.isOpen()).toBe(true)
614
+ done()
615
+
567
616
  it 'closes the modal when the user presses the escape key', (done) ->
568
617
  wasClosed = false
569
618
  up.modal.extract('.modal', '<div class="modal">Modal content</div>', animation: false)
@@ -639,7 +688,7 @@ describe 'up.modal', ->
639
688
  origin: $('.inside'), history: '/new-location') # Provoke auto-close
640
689
 
641
690
  u.setTimer 50, ->
642
- expect(location.href).toEndWith '/new-location'
691
+ expect(location.href).toEqualUrl '/new-location'
643
692
  done()
644
693
 
645
694
  it 'does not auto-close the modal when a replacement from inside the modal affects a selector inside the modal', ->
@@ -135,7 +135,7 @@ describe 'up.popup', ->
135
135
  $popupLink = affix('a[href="/bar"][up-popup=".container"][up-history="true"]')
136
136
  Trigger.clickSequence($popupLink)
137
137
  @respondWith('<div class="container">text</div>')
138
- expect(up.popup.coveredUrl()).toEndWith('/foo')
138
+ expect(up.popup.coveredUrl()).toEqualUrl('/foo')
139
139
  up.popup.close().then ->
140
140
  expect(up.popup.coveredUrl()).toBeMissing()
141
141
  done()
@@ -342,7 +342,7 @@ describe 'up.popup', ->
342
342
  origin: $('.inside'), history: '/new-location') # Provoke auto-close
343
343
 
344
344
  u.setTimer 50, ->
345
- expect(location.href).toEndWith '/new-location'
345
+ expect(location.href).toEqualUrl '/new-location'
346
346
  done()
347
347
 
348
348
  it 'does not auto-close the popup when a replacement from inside the popup affects a selector inside the popup', ->
@@ -13,14 +13,14 @@ describe 'up.proxy', ->
13
13
  it 'makes a request with the given URL and params', ->
14
14
  up.ajax('/foo', data: { key: 'value' }, method: 'post')
15
15
  request = @lastRequest()
16
- expect(request.url).toEndWith('/foo')
16
+ expect(request.url).toEqualUrl('/foo')
17
17
  expect(request.data()).toEqual(key: ['value'])
18
18
  expect(request.method).toEqual('POST')
19
19
 
20
20
  it 'also allows to pass the URL as a { url } option instead', ->
21
21
  up.ajax(url: '/foo', data: { key: 'value' }, method: 'post')
22
22
  request = @lastRequest()
23
- expect(request.url).toEndWith('/foo')
23
+ expect(request.url).toEqualUrl('/foo')
24
24
  expect(request.data()).toEqual(key: ['value'])
25
25
  expect(request.method).toEqual('POST')
26
26
 
@@ -409,6 +409,9 @@ describe 'up.util', ->
409
409
  it 'normalizes a full URL', ->
410
410
  expect(up.util.normalizeUrl('http://example.com/foo/bar')).toBe('http://example.com/foo/bar')
411
411
 
412
+ it 'does not strip a trailing slash by default', ->
413
+ expect(up.util.normalizeUrl('/foo/')).toEqual("http://#{location.hostname}:#{location.port}/foo/")
414
+
412
415
  describe 'up.util.detect', ->
413
416
 
414
417
  it 'finds the first element in the given array that matches the given tester', ->
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unpoly-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.0
4
+ version: 0.36.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-22 00:00:00.000000000 Z
11
+ date: 2017-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -235,6 +235,7 @@ files:
235
235
  - spec_app/spec/javascripts/helpers/to_contain.js.coffee
236
236
  - spec_app/spec/javascripts/helpers/to_end_with.js.coffee
237
237
  - spec_app/spec/javascripts/helpers/to_equal_jquery.js.coffee
238
+ - spec_app/spec/javascripts/helpers/to_equal_url.coffee
238
239
  - spec_app/spec/javascripts/helpers/to_have_request_method.js.coffee
239
240
  - spec_app/spec/javascripts/helpers/trigger.js.coffee
240
241
  - spec_app/spec/javascripts/helpers/wait_until_dom_ready.js.coffee