upjs-rails 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/dist/up.min.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){window.up={}}).call(this),function(){var e=[].slice;up.util=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,x,S,C,T,E,$,A,P,O,U,D,j,M,R,z,F,L,W,H,I,_,K,Q,N,X,B,V,G,J,q,Y,Z,et,tt,nt,rt,ot,ut,it,at,st,lt,ct,pt,ft,dt,mt,ht,vt,gt,yt,bt,wt,kt,xt,St,Ct,Tt,Et,$t,At,Pt,Ot,Ut,Dt,jt;return Z=function(t){var n,r;return n=void 0,r=!1,function(){var o;return o=1<=arguments.length?e.call(arguments,0):[],r?n:(r=!0,n=t.apply(null,o))}},u=function(e){return e=d(e),e.selector&&(e.headers||(e.headers={}),e.headers["X-Up-Selector"]=e.selector),t.ajax(e)},Q=function(e,t){return t=t.toString(),(""===t||"80"===t)&&"http:"===e||"443"===t&&"https:"===e},ut=function(e,t){var n,r,o;return n=ft(e),r=n.protocol+"//"+n.hostname,Q(n.protocol,n.port)||(r+=":"+n.port),o=n.pathname,"/"!==o[0]&&(o="/"+o),(null!=t?t.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=t?t.hash:void 0)===!0&&(r+=n.hash),(null!=t?t.search:void 0)!==!1&&(r+=n.search),r},ft=function(e){var n;return n=null,N(e)?(n=t("<a>").attr({href:e}).get(0),O(n.hostname)&&(n.href=n.href)):n=At(e),n},ot=function(e){return e?e.toUpperCase():"GET"},n=function(e){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;for(v=e.split(/[ >]/),o=null,p=f=0,m=v.length;m>f;p=++f){for(a=v[p],i=a.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),g="div",u=[],c=null,d=0,h=i.length;h>d;d++)switch(s=i[d],s[0]){case".":u.push(s.substr(1));break;case"#":c=s.substr(1);break;default:g=s}l="<"+g,u.length&&(l+=' class="'+u.join(" ")+'"'),c&&(l+=' id="'+c+'"'),l+=">",n=t(l),r&&n.appendTo(r),0===p&&(o=n),r=n}return o},h=function(e,t){var n;return n=document.createElement(e),_(t)&&(n.innerHTML=t),n},y=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n="[UP] "+n,(r=up.browser).puts.apply(r,["debug",n].concat(e.call(t)))},jt=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n="[UP] "+n,(r=up.browser).puts.apply(r,["warn",n].concat(e.call(t)))},k=function(){var n,r,o,u;throw r=1<=arguments.length?e.call(arguments,0):[],r[0]="[UP] "+r[0],(u=up.browser).puts.apply(u,["error"].concat(e.call(r))),o=S.apply(null,r),n=dt(t(".up-error"))||t('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(o),new Error(o)},o=/\%[odisf]/g,S=function(){var t,n,r,u;return t=1<=arguments.length?e.call(arguments,0):[],u=t[0],n=0,r=80,u.replace(o,function(){var e,o;return n+=1,e=t[n],o=typeof e,"string"===o?(e=e.replace(/\s+/g," "),e.length>r&&(e=e.substr(0,r)+"\u2026"),e='"'+e+'"'):e="undefined"===o?"undefined":"number"===o||"function"===o?e.toString():JSON.stringify(e),e.length>r&&(e=e.substr(0,r)+" \u2026",("object"===o||"function"===o)&&(e+=" }")),e})},kt=function(e){var n,r,o,u,i,a,s,l,c,p;if(n=t(e),c=void 0,y("Creating selector from element %o",n.get(0)),p=dt(n.attr("up-id")))c="[up-id='"+p+"']";else if(u=dt(n.attr("id")))c="#"+u;else if(l=dt(n.attr("name")))c="[name='"+l+"']";else if(r=dt(n.attr("class")))for(o=r.split(" "),c="",i=0,s=o.length;s>i;i++)a=o[i],c+="."+a;else c=n.prop("tagName").toLowerCase();return c},v=function(e){var t,n,r,o,u,i,a,s,l,c,p,f;return l=function(e){return"<"+e+"(?: [^>]*)?>"},i=function(e){return"</"+e+">"},t="(?:.|\\n)*?",u=function(e){return"("+e+")"},f=new RegExp(l("head")+t+l("title")+u(t)+i("title")+t+i("body"),"i"),o=new RegExp(l("body")+u(t)+i("body"),"i"),(r=e.match(o))?(s=document.createElement("html"),n=h("body",r[1]),s.appendChild(n),(p=e.match(f))&&(a=h("head"),s.appendChild(a),c=h("title",p[1]),a.appendChild(c)),s):h("div",e)},C=t.extend,$t=t.trim,w=function(e,t){var n,r,o,u,i;for(i=[],n=o=0,u=e.length;u>o;n=++o)r=e[n],i.push(t(r,n));return i},q=w,Ct=function(e,t){var n,r,o,u;for(u=[],n=r=0,o=e-1;o>=0?o>=r:r>=o;n=o>=0?++r:--r)u.push(t(n));return u},W=function(e){return null===e},X=function(e){return void 0===e},D=function(e){return!X(e)},L=function(e){return X(e)||W(e)},R=function(e){return!L(e)},O=function(e){return L(e)||I(e)&&0===Object.keys(e).length||0===e.length},dt=function(e,t){return null==t&&(t=_),t(e)?e:void 0},_=function(e){return!O(e)},M=function(e){return"function"==typeof e},N=function(e){return"string"==typeof e},H=function(e){return"number"==typeof e},z=function(e){return"object"==typeof e&&!!e},I=function(e){return z(e)||"function"==typeof e},j=function(e){return!(!e||1!==e.nodeType)},F=function(e){return e instanceof jQuery},K=function(e){return I(e)&&M(e.then)},U=function(e){return K(e)&&M(e.resolve)},P=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Et=function(e){return Array.prototype.slice.call(e)},d=function(e){return P(e)?e.slice():C({},e)},At=function(e){return F(e)?e.get(0):e},et=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],C.apply(null,[{}].concat(e.call(t)))},pt=function(e,t){var n,r,o,u;if(o=e?d(e):{},t)for(r in t)n=t[r],u=o[r],R(u)?I(n)&&I(u)&&(o[r]=pt(u,n)):o[r]=n;return o},ct=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],b(t,R)},b=function(e,t){var n,r,o,u;for(u=void 0,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=n;break}return u},i=function(e,t){var n,r,o,u;for(u=!1,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=!0;break}return u},c=function(e){return wt(e,R)},Pt=function(e){var t;return t={},wt(e,function(e){return t.hasOwnProperty(e)?!1:t[e]=!0})},wt=function(e,t){var n;return n=[],w(e,function(e){return t(e)?n.push(e):void 0}),n},mt=function(){var t,n,r,o;return t=arguments[0],r=2<=arguments.length?e.call(arguments,1):[],o=function(){var e,o,u;for(u=[],e=0,o=r.length;o>e;e++)n=r[e],u.push(t.attr(n));return u}(),b(o,_)},rt=function(e){return setTimeout(e,0)},G=function(e){return e[e.length-1]},l=function(){var e;return e=document.documentElement,{width:e.clientWidth,height:e.clientHeight}},bt=Z(function(){var e,n,r;return e=t("<div>").css({position:"absolute",top:"0",left:"0",width:"50px",height:"50px",overflowY:"scroll"}),e.appendTo(document.body),n=e.get(0),r=n.offsetWidth-n.clientWidth,e.remove(),r}),st=function(t){var n;return n=void 0,function(){var r;return r=1<=arguments.length?e.call(arguments,0):[],null!=t&&(n=t.apply(null,r)),t=void 0,n}},St=function(e,t,n){var r,o;return o=e.css(Object.keys(t)),e.css(t),r=function(){return e.css(o)},n?(n(),r()):st(r)},A=function(e){var t,n;return n=e.css(["transform","-webkit-transform"]),O(n)||"none"===n.transform?(t=function(){return e.css(n)},e.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):t=function(){},t},g=function(e,n,o){var u,i,a,s,l,c;return u=t(e),up.browser.canCssTransition()?(o=pt(o,{duration:300,delay:0,easing:"ease"}),i=t.Deferred(),s={"transition-property":Object.keys(n).join(", "),"transition-duration":o.duration+"ms","transition-delay":o.delay+"ms","transition-timing-function":o.easing},l=A(u),c=St(u,s),u.css(n),i.then(l),i.then(c),u.data(r,i),i.then(function(){return u.removeData(r)}),a=setTimeout(function(){return i.resolve()},o.duration+o.delay),i.then(function(){return clearTimeout(a)}),i):(u.css(n),gt())},r="up-animation-promise",E=function(e){return t(e).each(function(){var e;return(e=t(this).data(r))?e.resolve():void 0})},Y=function(e,n){var r,o,u,i,a,s;return n=pt(n,{relative:!1,inner:!1,full:!1}),n.relative?n.relative===!0?i=e.position():(r=t(n.relative),a=e.offset(),r.is(document)?i=a:(u=r.offset(),i={left:a.left-u.left,top:a.top-u.top})):i=e.offset(),o={left:i.left,top:i.top},n.inner?(o.width=e.width(),o.height=e.height()):(o.width=e.outerWidth(),o.height=e.outerHeight()),n.full&&(s=l(),o.right=s.width-(o.left+o.width),o.bottom=s.height-(o.top+o.height)),o},m=function(e,t){var n,r,o,u,i;for(u=e.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)n=u[r],i.push(n.specified?t.attr(n.name,n.value):void 0);return i},T=function(e,t){return e.find(t).addBack(t)},x=function(e){return 27===e.keyCode},f=function(e,t){return e.indexOf(t)>=0},s=function(e,t){var n;switch(n=e.attr(t)){case"false":return!1;case"true":return!0;case"":return!0;default:return n}},J=function(e){return e.getResponseHeader("X-Up-Location")},Tt=function(e){return e.getResponseHeader("X-Up-Title")},tt=function(e){return e.getResponseHeader("X-Up-Method")},lt=function(){var t,n,r,o,u,i;for(o=arguments[0],u=2<=arguments.length?e.call(arguments,1):[],t={},n=0,r=u.length;r>n;n++)i=u[n],o.hasOwnProperty(i)&&(t[i]=o[i]);return t},B=function(e){return!(e.metaKey||e.shiftKey||e.ctrlKey)},V=function(e){var t;return t=X(e.button)||0===e.button,t&&B(e)},gt=function(){var e;return e=t.Deferred(),e.resolve(),e},yt=function(){return gt().promise()},Ot=function(){return t.Deferred()},Ut=function(){return Ot().promise()},it=function(){return t()},vt=function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],r=t.when.apply(t,n),r.resolve=function(){return w(n,function(e){return"function"==typeof e.resolve?e.resolve():void 0})},r},xt=function(e,t){var n,r,o;r=[];for(n in t)o=t[n],r.push(L(e.attr(n))?e.attr(n,o):void 0);return r},ht=function(e,t){var n;return n=e.indexOf(t),n>=0?(e.splice(n,1),t):void 0},nt=function(e){var n,r,o,u,a,s,l;for(a={},l=[],r=[],o=0,u=e.length;u>o;o++)s=e[o],N(s)?l.push(s):r.push(s);return a.parsed=r,l.length&&(n=l.join(", "),a.parsed.push(n)),a.select=function(){return a.find(void 0)},a.find=function(e){var n,r,o,u,i,s;for(r=it(),i=a.parsed,o=0,u=i.length;u>o;o++)s=i[o],n=e?e.find(s):t(s),r=r.add(n);return r},a.findWithSelf=function(e){var t;return t=a.find(e),a.doesMatch(e)&&(t=t.add(e)),t},a.doesMatch=function(e){var n;return n=t(e),i(a.parsed,function(e){return n.is(e)})},a.seekUp=function(e){var n,r,o;for(o=t(e),n=o,r=void 0;n.length;){if(a.doesMatch(n)){r=n;break}n=n.parent()}return r||it()},a},a=function(t){var n,r,o,u,i,a,s,l,c,p,f,m;return null==t&&(t={}),f=void 0,r=function(){return f={}},r(),s=function(){var n;return n=1<=arguments.length?e.call(arguments,0):[],t.log?(n[0]="["+t.log+"] "+n[0],y.apply(null,n)):void 0},a=function(){return Object.keys(f)},l=function(){return L(t.size)?void 0:M(t.size)?t.size():H(t.size)?t.size:k("Invalid size config: %o",t.size)},o=function(){return L(t.expiry)?void 0:M(t.expiry)?t.expiry():H(t.expiry)?t.expiry:k("Invalid expiry config: %o",t.expiry)},c=function(e){return t.key?t.key(e):e.toString()},$t=function(){var e,t,n,r;return r=d(a()),n=l(),n&&r.length>n&&(e=null,t=null,w(r,function(n){var r,o;return r=f[n],o=r.timestamp,!t||t>o?(e=n,t=o):void 0}),e)?delete f[e]:void 0},n=function(e,t){var n;return n=u(e),D(n)?p(t,n):void 0},m=function(){return(new Date).valueOf()},p=function(e,t){var n;return n=c(e),f[n]={timestamp:m(),value:t}},ht=function(e){var t;return t=c(e),delete f[t]},i=function(e){var t,n;return t=o(),t?(n=m()-e.timestamp,n<o()):!0},u=function(e,t){var n,r;return null==t&&(t=void 0),r=c(e),(n=f[r])?i(n)?(s("Cache hit for %o",e),n.value):(s("Discarding stale cache entry for %o",e),ht(e),t):(s("Cache miss for %o",e),t)},{alias:n,get:u,set:p,remove:ht,clear:r,keys:a}},p=function(e){var t;return null==e&&(e={}),t={},t.reset=function(){return C(t,e)},t.reset(),Object.preventExtensions(t),t},Dt=function(e){var t,n;return e=At(e),t=e.parentNode,n=Et(e.childNodes),w(n,function(n){return t.insertBefore(n,e)}),t.removeChild(e)},at=function(e){var t,n;for(t=void 0;(e=e.parent())&&e.length;)if(n=e.css("position"),"absolute"===n||"relative"===n||e.is("body")){t=e;break}return t},$=function(e,n){var r,o,u,i;return r=t(e),o=at(r),u=r.position(),i=o.offset(),r.css({position:"absolute",left:u.left-i.left,top:u.top-i.top+n.scrollTop(),right:"",bottom:""})},{offsetParent:at,fixedToAbsolute:$,presentAttr:mt,createElement:h,parseUrl:ft,normalizeUrl:ut,normalizeMethod:ot,createElementFromHtml:v,$createElementFromSelector:n,selectorForElement:kt,ajax:u,extend:C,copy:d,merge:et,options:pt,option:ct,error:k,debug:y,warn:jt,each:w,map:q,times:Ct,any:i,detect:b,select:wt,compact:c,uniq:Pt,last:G,isNull:W,isDefined:D,isUndefined:X,isGiven:R,isMissing:L,isPresent:_,isBlank:O,presence:dt,isObject:I,isFunction:M,isString:N,isElement:j,isJQuery:F,isPromise:K,isDeferred:U,isHash:z,isUnmodifiedKeyEvent:B,isUnmodifiedMouseEvent:V,nullJQuery:it,unJQuery:At,nextFrame:rt,measure:Y,temporaryCss:St,cssAnimate:g,finishCssAnimate:E,forceCompositing:A,escapePressed:x,copyAttributes:m,findWithSelf:T,contains:f,isArray:P,toArray:Et,castedAttr:s,locationFromXhr:J,titleFromXhr:Tt,methodFromXhr:tt,clientSize:l,only:lt,trim:$t,unresolvableDeferred:Ot,unresolvablePromise:Ut,resolvedPromise:yt,resolvedDeferred:gt,resolvableWhen:vt,setMissingAttrs:xt,remove:ht,memoize:Z,scrollbarWidth:bt,config:p,cache:a,unwrapElement:Dt,multiSelector:nt,evalConsoleTemplate:S}}($),up.error=up.util.error,up.warn=up.util.warn,up.debug=up.util.debug}.call(this),function(){var e=[].slice;up.browser=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h;return m=up.util,p=function(e,n){var r,o,u,i,a,s;return null==n&&(n={}),a=m.option(n.method,"get").toLowerCase(),"get"===a?location.href=e:t.rails?(s=n.target,u=t.rails.csrfToken(),o=t.rails.csrfParam(),r=t("<form method='post' action='"+e+"'></form>"),i="<input name='_method' value='"+a+"' type='hidden' />",m.isDefined(o)&&m.isDefined(u)&&(i+="<input name='"+o+"' value='"+u+"' type='hidden' />"),s&&r.attr("target",s),r.hide().append(i).appendTo("body"),r.submit()):error("Can't fake a "+a.toUpperCase()+" request without Rails UJS")},d=function(){var t,n,r;return r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],m.isDefined(console[r])||(r="log"),o()?console[r].apply(console,t):(n=m.evalConsoleTemplate.apply(m,t),console[r](n))},h=function(){return location.href},a=m.memoize(function(){return m.isUndefined(document.addEventListener)}),s=m.memoize(function(){return a()||-1!==navigator.appVersion.indexOf("MSIE 9.")}),u=m.memoize(function(){return m.isDefined(history.pushState)&&"get"===i()}),n=m.memoize(function(){return"transition"in document.documentElement.style}),r=m.memoize(function(){return"oninput"in document.createElement("input")}),o=m.memoize(function(){return!s()}),l=m.memoize(function(){var e,n,r,o;return o=t.fn.jquery,r=o.split("."),e=parseInt(r[0]),n=parseInt(r[1]),e>=2||1===e&&n>=9}),f=function(e){var t,n;return n=null!=(t=document.cookie.match(new RegExp(e+"=(\\w+)")))?t[1]:void 0,m.isPresent(n)&&(document.cookie=e+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"),n},i=m.memoize(function(){return(f("_up_request_method")||"get").toLowerCase()}),c=function(){return!a()&&l()},{url:h,loadPage:p,canPushState:u,canCssTransition:n,canInputEvent:r,canLogSubstitution:o,isSupported:c,puts:d}}(jQuery)}.call(this),function(){var e=[].slice;up.bus=function(t){var n,r,o,u,i,a,s,l,c,p,f,d;return f=up.util,a=[],r=null,d=function(e){return function(n){var r;return r=n.$element||t(this),e.apply(r.get(0),[n,r,up.syntax.data(r)])}},i=function(){var n,r,o,u,i;return r=1<=arguments.length?e.call(arguments,0):[],up.browser.isSupported()?(u=f.copy(r),i=u.length-1,o=u[i],u[i]=d(o),a.push(u),n=t(document),n.on.apply(n,u),function(){return n.off.apply(n,u)}):function(){}},o=function(e,n){var r,o;return null==n&&(n={}),o=t.Event(e,n),r=n.$element||t(document),f.debug("Emitting %o on %o with props %o",e,r,n),r.trigger(o),o},s=function(){var t,n;return t=1<=arguments.length?e.call(arguments,0):[],n=o.apply(null,t),!n.isDefaultPrevented()},l=function(e){return i("keydown","body",function(t){return f.escapePressed(t)?e(t):void 0})},p=function(){return r=f.copy(a)},c=function(){var e,n,o,u;for(n=0,o=a.length;o>n;n++)e=a[n],f.contains(r,e)||(u=t(document)).off.apply(u,e);return a=f.copy(r)},u=function(){return up.emit("up:framework:reset")},n=function(){return up.browser.isSupported()?up.emit("up:framework:boot"):void 0},i("up:framework:boot",p),i("up:framework:reset",c),{on:i,emit:o,nobodyPrevents:s,onEscape:l,emitReset:u,boot:n}}(jQuery),up.on=up.bus.on,up.emit=up.bus.emit,up.reset=up.bus.emitReset,up.boot=up.bus.boot}.call(this),function(){var e=[].slice;up.syntax=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m;return m=up.util,n="up-destroyable",r="up-destroyer",a=[],l=null,i=function(){var t,n,r;return r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],up.browser.isSupported()?(i=t.pop(),n=m.options(t[0],{batch:!1}),a.push({selector:r,callback:i,batch:n.batch})):void 0},o=function(e,t,o){var u;return m.debug("Applying compiler %o on %o",e.selector,o),u=e.callback.apply(o,[t,s(t)]),m.isFunction(u)?(t.addClass(n),t.data(r,u)):void 0},u=function(e){var n,r,u,s;for(m.debug("Compiling fragment %o",e),s=[],r=0,u=a.length;u>r;r++)i=a[r],n=m.findWithSelf(e,i.selector),s.push(n.length?i.batch?o(i,n,n.get()):n.each(function(){return o(i,t(this),this)}):void 0);return s},f=function(e){return m.findWithSelf(e,"."+n).each(function(){var e,n;return e=t(this),(n=e.data(r))()})},s=function(e){var n,r;return n=t(e),r=n.attr("up-data"),m.isString(r)&&""!==m.trim(r)?JSON.parse(r):{}},d=function(){return l=m.copy(a)},p=function(){return a=m.copy(l)},c=function(e){var n;return n=t(e),up.emit("up:fragment:inserted",{$element:n}),n},up.on("ready",function(){return c(document.body)}),up.on("up:fragment:inserted",function(e){return u(e.$element)}),up.on("up:fragment:destroy",function(e){return f(e.$element)}),up.on("up:framework:boot",d),up.on("up:framework:reset",p),{compiler:i,hello:c,data:s}}(jQuery),up.compiler=up.syntax.compiler,up.hello=up.syntax.hello,up.ready=function(){return up.util.error("up.ready no longer exists. Please use up.hello instead.")},up.awaken=function(){return up.util.error("up.awaken no longer exists. Please use up.compiler instead.")}}.call(this),function(){up.history=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return v=up.util,n=v.config({popTargets:["body"],restoreScroll:!0}),c=void 0,i=void 0,m=function(){return n.reset(),c=void 0,i=void 0},a=function(e){return v.normalizeUrl(e,{hash:!0})},r=function(){return a(up.browser.url())},o=function(e){return a(e)===r()},s=function(e){return i&&(c=i,i=void 0),i=e},d=function(e,t){return u("replace",e,t)},p=function(e,t){return u("push",e,t)},u=function(e,n,u){var i,a;return u=v.options(u,{force:!1}),u.force||!o(n)?up.browser.canPushState()?(i=e+"State",a=t(),v.debug("Changing history to URL %o (%o)",n,e),window.history[i](a,"",n),s(r())):v.error("This browser doesn't support history.pushState"):void 0},t=function(){return{fromUp:!0}},h=function(e){var t,o;return o=r(),v.debug("Restoring state %o (now on "+o+")",e),t=n.popTargets.join(", "),up.replace(t,o,{history:!1,reveal:!1,transition:"none",saveScroll:!1,restoreScroll:n.restoreScroll})},l=function(e){var t;return v.debug("History state popped to URL %o",r()),s(r()),up.layout.saveScroll({url:c}),t=e.originalEvent.state,(null!=t?t.fromUp:void 0)?h(t):v.debug("Discarding unknown state %o",t)},up.browser.canPushState()&&(f=function(){return e(window).on("popstate",l),d(r(),{force:!0})},"undefined"!=typeof jasmine&&null!==jasmine?f():setTimeout(f,100)),up.compiler("[up-back]",function(e){return v.isPresent(c)?(v.setMissingAttrs(e,{"up-href":c,"up-restore-scroll":""}),e.removeAttr("up-back"),up.link.makeFollowable(e)):void 0}),up.on("up:framework:reset",m),{config:n,defaults:function(){return v.error("up.history.defaults(...) no longer exists. Set values on he up.history.config property instead.")},push:p,replace:d,url:r,previousUrl:function(){return c},normalizeUrl:a}}(jQuery)}.call(this),function(){var slice=[].slice;up.layout=function($){var SCROLL_PROMISE_KEY,anchoredRight,config,finishScrolling,fixedChildren,lastScrollTops,measureObstruction,reset,restoreScroll,reveal,revealOrRestoreScroll,saveScroll,scroll,scrollTops,u,viewportOf,viewportSelector,viewports,viewportsWithin;return u=up.util,config=u.config({duration:0,viewports:[document,".up-modal","[up-viewport]"],fixedTop:["[up-fixed~=top]"],fixedBottom:["[up-fixed~=bottom]"],anchoredRight:["[up-anchored~=right]","[up-fixed~=top]","[up-fixed~=bottom]","[up-fixed~=right]"],snap:50,substance:150,easing:"swing"}),lastScrollTops=u.cache({size:30,key:up.history.normalizeUrl}),reset=function(){return config.reset(),lastScrollTops.clear()},SCROLL_PROMISE_KEY="up-scroll-promise",scroll=function(e,t,n){var r,o,i,a,s;return r=$(e),n=u.options(n),i=u.option(n.duration,config.duration),a=u.option(n.easing,config.easing),finishScrolling(r),i>0?(o=$.Deferred(),r.data(SCROLL_PROMISE_KEY,o),o.then(function(){return r.removeData(SCROLL_PROMISE_KEY),r.finish()}),s={scrollTop:t},r.get(0)===document&&(r=$("html, body")),r.animate(s,{duration:i,easing:a,complete:function(){return o.resolve()}}),o):(r.scrollTop(t),u.resolvedDeferred())},finishScrolling=function(e){return $(e).each(function(){var e;return(e=$(this).data(SCROLL_PROMISE_KEY))?e.resolve():void 0})},anchoredRight=function(){return u.multiSelector(config.anchoredRight).select()},measureObstruction=function(){var e,t,n,r;return n=function(e,t){var n,r;return n=$(e),r=n.css(t),u.isPresent(r)||u.error("Fixed element %o must have a CSS attribute %o",n,t),parseInt(r)+n.height()},t=function(){var e,t,o,u;for(o=$(config.fixedTop.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"top"));return u}(),e=function(){var e,t,o,u;for(o=$(config.fixedBottom.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"bottom"));return u}(),{top:Math.max.apply(Math,[0].concat(slice.call(t))),bottom:Math.max.apply(Math,[0].concat(slice.call(e)))}},reveal=function(e,t){var n,r,o,i,a,s,l,c,p,f,d,m,h,v;return u.debug("Revealing %o",e),t=u.options(t),n=$(e),r=t.viewport?$(t.viewport):viewportOf(n),m=u.option(t.snap,config.snap),v=r.is(document),h=v?u.clientSize().height:r.height(),p=r.scrollTop(),s=p,c=void 0,l=void 0,v?(l=measureObstruction(),c=0):(l={top:0,bottom:0},c=p),f=function(){return s+l.top},d=function(){return s+h-l.bottom-1},o=u.measure(n,{relative:r}),i=o.top+c,a=i+Math.min(o.height,config.substance)-1,a>d()&&(s+=a-d()),(i<f()||t.top)&&(s=i-l.top),m>s&&(s=0),s!==p?scroll(r,s,t):u.resolvedDeferred()},viewportSelector=function(){return u.multiSelector(config.viewports)},viewportOf=function(e){var t,n;return t=$(e),n=viewportSelector().seekUp(t),n.length||u.error("Could not find viewport for %o",t),n},viewportsWithin=function(e){var t;return t=$(e),viewportSelector().findWithSelf(t)},viewports=function(){return viewportSelector().select()},scrollTops=function(){var e,t,n,r,o,u,i;for(u={},o=config.viewports,t=0,r=o.length;r>t;t++)i=o[t],e=$(i),e.length&&(n=i,i===document&&(n="document"),u[n]=e.scrollTop());return u},fixedChildren=function(e){var t,n;return null==e&&(e=void 0),e||(e=document.body),n=$(e),t=n.find("[up-fixed]"),u.isPresent(config.fixedTop)&&(t=t.add(n.find(config.fixedTop.join(", ")))),u.isPresent(config.fixedBottom)&&(t=t.add(n.find(config.fixedBottom.join(", ")))),t},saveScroll=function(e){var t,n;return null==e&&(e={}),n=u.option(e.url,up.history.url()),t=u.option(e.tops,scrollTops()),u.debug("Saving scroll positions for URL %o: %o",n,t),lastScrollTops.set(n,t)},restoreScroll=function(e){var t,n,r,o,i,a,s,l,c;null==e&&(e={}),c=up.history.url(),o=void 0,e.around?(n=viewportsWithin(e.around),t=viewportOf(e.around),o=t.add(n)):o=viewports(),l=lastScrollTops.get(c),u.debug("Restoring scroll positions for URL %o (viewports are %o, saved tops are %o)",c,o,l);for(i in l)s=l[i],a="document"===i?document:i,r=o.filter(a),scroll(r,s,{duration:0});return u.resolvedDeferred()},revealOrRestoreScroll=function(e,t){var n,r,o,i;return n=$(e),t.restoreScroll?restoreScroll({around:n}):t.reveal?(t.source&&(i=u.parseUrl(t.source),i.hash&&"#"!==i.hash&&(o=i.hash.substr(1),r=u.findWithSelf(n,"#"+o+", a[name='"+o+"']"),r.length&&(n=r))),reveal(n)):u.resolvedDeferred()},up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),reveal:reveal,scroll:scroll,finishScrolling:finishScrolling,config:config,defaults:function(){return u.error("up.layout.defaults(...) no longer exists. Set values on he up.layout.config property instead.")},viewportOf:viewportOf,viewportsWithin:viewportsWithin,viewports:viewports,scrollTops:scrollTops,saveScroll:saveScroll,restoreScroll:restoreScroll,revealOrRestoreScroll:revealOrRestoreScroll,anchoredRight:anchoredRight,fixedChildren:fixedChildren}}(jQuery),up.scroll=up.layout.scroll,up.reveal=up.layout.reveal}.call(this),function(){up.flow=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,m=function(t,n){var r;return r=e(t),g.isPresent(n)&&(n=g.normalizeUrl(n)),r.attr("up-source",n)},h=function(t){var n;return n=e(t).closest("[up-source]"),g.presence(n.attr("up-source"))||up.browser.url()},d=function(e,t){var n,r,o;return g.isString(e)?(o=e,g.contains(o,"&")&&((n=g.presence(t.origin))?(r=g.selectorForElement(n),o=o.replace(/\&/,r)):g.error("Found origin reference %o in selector %o, but options.origin is missing","&",o))):o=g.selectorForElement(e),o},f=function(e,t,n){var r,o,u;return g.debug("Replace %o with %o (options %o)",e,t,n),n=g.options(n),u=d(e,n),up.browser.canPushState()||n.history===!1?(o={url:t,method:n.method,selector:u,cache:n.cache,preload:n.preload,headers:n.headers},r=up.proxy.ajax(o),r.done(function(e,r,i){var s,l;return(s=g.locationFromXhr(i))&&(g.debug("Location from server: %o",s),l={url:s,method:g.methodFromXhr(i),selector:u},up.proxy.alias(o,l),t=s),n.history!==!1&&(n.history=t),n.source!==!1&&(n.source=t),n.title||(n.title=g.titleFromXhr(i)),n.preload?void 0:a(u,e,n)}),r.fail(g.error),r):(n.preload||up.browser.loadPage(t,g.only(n,"method")),g.unresolvablePromise())},a=function(e,t,n){var r,u,i,a,s,p,f,m,h;for(m=d(e,n),n=g.options(n,{historyMethod:"push"}),n.source=g.option(n.source,n.history),p=c(t),n.title||(n.title=p.title()),n.saveScroll!==!1&&up.layout.saveScroll(),s=l(m,n),f=[],i=0,a=s.length;a>i;i++)h=s[i],u=o(h.selector),r=p.find(h.selector).first(),f.push(v(u,r,h.pseudoClass,h.transition,n));return f},o=function(e){return u(".up-popup "+e)||u(".up-modal "+e)||u(e)||i(e)},i=function(e){var t;return t="Could not find selector %o in current body HTML","#"===t[0]&&(t+=" (avoid using IDs)"),g.error(t,e)},c=function(t){var n;return n=g.createElementFromHtml(t),{title:function(){var e;return null!=(e=n.querySelector("title"))?e.textContent:void 0},find:function(r){var o;return(o=e.find(r,n)[0])?e(o):g.error("Could not find selector %o in response %o",r,t)}}},r=function(e,n){return"function"==typeof n.insert&&n.insert(e),n.history&&(n.title&&(document.title=n.title),up.history[n.historyMethod](n.history)),n.source!==!1&&m(e,n.source),t(e),up.hello(e)},v=function(e,t,o,u,i){var a,s;return u||(u="none"),up.motion.finish(e),o?(s="before"===o?"prepend":"append",a=t.contents().wrap('<span class="up-insertion"></span>').parent(),e[s](a),g.copyAttributes(t,e),r(a.children(),i),up.layout.revealOrRestoreScroll(a,i).then(function(){return up.animate(a,u,i)}).then(function(){g.unwrapElement(a)})):n(e,{animation:function(){return t.insertBefore(e),r(t,i),e.is("body")&&"none"!==u&&g.error("Cannot apply transitions to body-elements (%o)",u),up.morph(e,t,u,i)}})},l=function(e,t){var n,r,o,u,i,a,s,l,c,p,f,d;for(f=t.transition||t.animation||"none",n=/\ *,\ */,r=e.split(n),g.isPresent(f)&&(d=f.split(n)),s=[],o=u=0,i=r.length;i>u;o=++u)l=r[o],c=l.match(/^(.+?)(?:\:(before|after))?$/),e=c[1],"html"===e&&(e="body"),a=c[2],p=d[o]||g.last(d),s.push({selector:e,pseudoClass:a,transition:p});return s},t=function(e){var t,n;return n="[autofocus]:last",t=g.findWithSelf(e,n),t.length&&t.get(0)!==document.activeElement?t.focus():void 0},s=function(e){var t;return t=".up-ghost, .up-destroying",0===e.closest(t).length},u=function(t){var n,r,o,u,i,a;for(u=void 0,u=g.isString(t)?e(t).get():t,r=void 0,i=0,a=u.length;a>i;i++)if(o=u[i],n=e(o),s(n)){r=n;break}return r},n=function(t,n){var r,o,u;return r=e(t),up.bus.nobodyPrevents("up:fragment:destroy",{$element:r})?(n=g.options(n,{animation:"none"}),o=up.motion.animateOptions(n),r.addClass("up-destroying"),g.isPresent(n.url)&&up.history.push(n.url),g.isPresent(n.title)&&(document.title=n.title),u=g.presence(n.animation,g.isDeferred)||up.motion.animate(r,n.animation,o),u.then(function(){return up.emit("up:fragment:destroyed",{$element:r}),r.remove()}),u):e.Deferred()},p=function(e,t){var n;return t=g.options(t,{cache:!1}),n=t.url||h(e),f(e,n,t)},up.on("ready",function(){return m(document.body,up.browser.url())}),{replace:f,reload:p,destroy:n,implant:a,first:u,resolveSelector:d}}(jQuery),up.replace=up.flow.replace,up.implant=up.flow.implant,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.first=up.flow.first}.call(this),function(){up.motion=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,x,S;return x=up.util,u={},s={},k={},l={},a=x.config({duration:300,delay:0,easing:"ease"}),v=function(){return u=x.copy(s),k=x.copy(l),a.reset()},n=function(t,o,u){var a;return a=e(t),p(a),u=r(u),("none"===o||o===!1)&&m(),x.isFunction(o)?i(o(a,u),o):x.isString(o)?n(a,c(o),u):x.isHash(o)?x.cssAnimate(a,o,u):x.error("Unknown animation type %o",o)},r=function(e,t){var n;return null==t&&(t=null),e=x.options(e),n={},n.easing=x.option(e.easing,null!=t?t.attr("up-easing"):void 0,a.easing),n.duration=Number(x.option(e.duration,null!=t?t.attr("up-duration"):void 0,a.duration)),n.delay=Number(x.option(e.delay,null!=t?t.attr("up-delay"):void 0,a.delay)),n},c=function(e){return u[e]||x.error("Unknown animation %o",e)},t="up-ghosting-promise",S=function(e,n,r,o){var u,i,a,s,l,c,p;return s=void 0,i=void 0,l=void 0,a=void 0,u=up.layout.viewportOf(e),x.temporaryCss(n,{display:"none"},function(){return s=h(e,u),s.$ghost.addClass("up-destroying"),s.$bounds.addClass("up-destroying"),l=u.scrollTop()}),x.temporaryCss(e,{display:"none"},function(){return up.layout.revealOrRestoreScroll(n,r),i=h(n,u),a=u.scrollTop()}),s.moveTop(a-l),e.hide(),p=x.temporaryCss(n,{opacity:"0"}),c=o(s.$ghost,i.$ghost),e.data(t,c),n.data(t,c),c.then(function(){return e.removeData(t),n.removeData(t),p(),s.$bounds.remove(),i.$bounds.remove()}),c},p=function(t){return e(t).each(function(){var t;return t=e(this),x.finishCssAnimate(t),f(t)})},f=function(e){var n;return(n=e.data(t))?(x.debug("Canceling existing ghosting on %o",e),"function"==typeof n.resolve?n.resolve():void 0):void 0},i=function(e,t){return x.isDeferred(e)?e:x.error("Did not return a promise with .then and .resolve methods: %o",t)},d=function(t,o,a,s){var l,c,f,m,h,v,b;return x.debug("Morphing %o to %o (using %o)",t,o,a),c=e(t),l=e(o),h=x.only(s,"reveal","restoreScroll","source"),h=x.extend(h,r(s)),up.browser.canCssTransition()?(p(c),p(l),"none"===a||a===!1||(f=u[a])?(m=y(c,l,h),m.then(function(){return n(l,f||"none",s)}),m):(b=x.presence(a,x.isFunction)||k[a])?S(c,l,h,function(e,t){var n;return n=b(e,t,h),i(n,a)}):x.isString(a)&&a.indexOf("/")>=0?(v=a.split("/"),b=function(e,t,r){return g(n(e,v[0],r),n(t,v[1],r))},d(c,l,b,h)):x.error("Unknown transition %o",a)):y(c,l,h)},y=function(e,t,n){return e.hide(),up.layout.revealOrRestoreScroll(t,n)},h=function(t,n){var r,o,u,i,a,s,l,c,p;for(i=x.measure(t,{relative:!0,inner:!0}),u=t.clone(),u.find("script").remove(),u.css({position:"static"===t.css("position")?"static":"relative",top:"",right:"",bottom:"",left:"",width:"100%",height:"100%"}),u.addClass("up-ghost"),r=e('<div class="up-bounds"></div>'),r.css({position:"absolute"}),r.css(i),p=i.top,c=function(e){return 0!==e?(p+=e,r.css({top:p})):void 0},u.appendTo(r),r.insertBefore(t),c(t.offset().top-u.offset().top),o=up.layout.fixedChildren(u),s=0,l=o.length;l>s;s++)a=o[s],x.fixedToAbsolute(a,n);return{$ghost:u,$bounds:r,moveTop:c}},w=function(e,t){return k[e]=t},o=function(e,t){return u[e]=t},b=function(){return s=x.copy(u),l=x.copy(k)},g=x.resolvableWhen,m=x.resolvedDeferred,o("none",m),o("fade-in",function(e,t){return e.css({opacity:0}),n(e,{opacity:1},t)}),o("fade-out",function(e,t){return e.css({opacity:1}),n(e,{opacity:0},t)}),o("move-to-top",function(e,t){var r,o;return r=x.measure(e),o=r.top+r.height,e.css({"margin-top":"0px"}),n(e,{"margin-top":"-"+o+"px"},t)}),o("move-from-top",function(e,t){var r,o;return r=x.measure(e),o=r.top+r.height,e.css({"margin-top":"-"+o+"px"}),n(e,{"margin-top":"0px"},t)}),o("move-to-bottom",function(e,t){var r,o;return r=x.measure(e),o=x.clientSize().height-r.top,e.css({"margin-top":"0px"}),n(e,{"margin-top":o+"px"},t)}),o("move-from-bottom",function(e,t){var r,o;return r=x.measure(e),o=x.clientSize().height-r.top,e.css({"margin-top":o+"px"}),n(e,{"margin-top":"0px"},t)}),o("move-to-left",function(e,t){var r,o;return r=x.measure(e),o=r.left+r.width,e.css({"margin-left":"0px"}),n(e,{"margin-left":"-"+o+"px"},t)}),o("move-from-left",function(e,t){var r,o;return r=x.measure(e),o=r.left+r.width,e.css({"margin-left":"-"+o+"px"}),n(e,{"margin-left":"0px"},t)}),o("move-to-right",function(e,t){var r,o;return r=x.measure(e),o=x.clientSize().width-r.left,e.css({"margin-left":"0px"}),n(e,{"margin-left":o+"px"},t)}),o("move-from-right",function(e,t){var r,o;return r=x.measure(e),o=x.clientSize().width-r.left,e.css({"margin-left":o+"px"}),n(e,{"margin-left":"0px"},t)}),o("roll-down",function(e,t){var r,o;
2
- return r=e.height(),o=x.temporaryCss(e,{height:"0px",overflow:"hidden"}),n(e,{height:r+"px"},t).then(o)}),w("none",m),w("move-left",function(e,t,r){return g(n(e,"move-to-left",r),n(t,"move-from-right",r))}),w("move-right",function(e,t,r){return g(n(e,"move-to-right",r),n(t,"move-from-left",r))}),w("move-up",function(e,t,r){return g(n(e,"move-to-top",r),n(t,"move-from-bottom",r))}),w("move-down",function(e,t,r){return g(n(e,"move-to-bottom",r),n(t,"move-from-top",r))}),w("cross-fade",function(e,t,r){return g(n(e,"fade-out",r),n(t,"fade-in",r))}),up.on("up:framework:boot",b),up.on("up:framework:reset",v),{morph:d,animate:n,animateOptions:r,finish:p,transition:w,animation:o,config:a,defaults:function(){return x.error("up.motion.defaults(...) no longer exists. Set values on he up.motion.config property instead.")},none:m,when:g,prependCopy:h}}(jQuery),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){up.proxy=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,x,S,C,T,E,$,A,P;return P=up.util,t=void 0,C=void 0,i=void 0,x=void 0,a=void 0,m=P.config({busyDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5}),l=function(e){return k(e),[e.url,e.method,e.data,e.selector].join("|")},s=P.cache({size:function(){return m.cacheSize},expiry:function(){return m.cacheExpiry},key:l,log:"up.proxy"}),h=function(e){var t,n,r,o,u,i,a;for(e=k(e),n=[e],"html"!==e.selector&&(i=P.merge(e,{selector:"html"}),n.push(i),"body"!==e.selector&&(u=P.merge(e,{selector:"body"}),n.push(u))),r=0,o=n.length;o>r;r++)if(t=n[r],a=s.get(t))return a},$=s.set,T=s.remove,d=s.clear,p=function(){return clearTimeout(C),C=null},c=function(){return clearTimeout(i),i=null},E=function(){return t=null,p(),c(),x=0,m.reset(),a=!1,s.clear()},E(),o=s.alias,k=function(e){return e._normalized||(e.method=P.normalizeMethod(e.method),e.url&&(e.url=P.normalizeUrl(e.url)),e.selector||(e.selector="body"),e._normalized=!0),e},r=function(e){var t,n,r,o,u;return t=e.cache===!0,n=e.cache===!1,u=P.only(e,"url","method","data","selector","headers","_normalized"),r=!0,g(u)||t?(o=h(u))&&!n?r="pending"===o.state():(o=y(u),$(u,o),o.fail(function(){return T(u)})):(d(),o=y(u)),r&&!e.preload&&(w(),o.always(b)),o},n=["GET","OPTIONS","HEAD"],v=function(){return 0===x},u=function(){return x>0},w=function(){var e,t;return t=v(),x+=1,t?(e=function(){return u()?(up.emit("up:proxy:busy"),a=!0):void 0},m.busyDelay>0?i=setTimeout(e,m.busyDelay):e()):void 0},b=function(){return x-=1,v()&&a?(up.emit("up:proxy:idle"),a=!1):void 0},y=function(e){var t;return P.debug("Loading URL %o",e.url),up.emit("up:proxy:load",e),t=P.ajax(e),t.always(function(){return up.emit("up:proxy:received",e)}),t},g=function(e){return k(e),P.contains(n,e.method)},f=function(e){var n,r;return r=parseInt(P.presentAttr(e,"up-delay"))||m.preloadDelay,e.is(t)?void 0:(t=e,p(),n=function(){return S(e),t=null},A(n,r))},A=function(e,t){return C=setTimeout(e,t)},S=function(t,n){var r,o;return r=e(t),n=P.options(n),o=up.link.followMethod(r,n),g({method:o})?(P.debug("Preloading %o",r),n.preload=!0,up.follow(r,n)):(P.debug("Won't preload %o due to unsafe method %o",r,o),P.resolvedPromise())},up.on("mouseover mousedown touchstart","[up-preload]",function(e,t){return up.link.childClicked(e,t)?void 0:f(t)}),up.on("up:framework:reset",E),{preload:S,ajax:r,get:h,alias:o,clear:d,remove:T,idle:v,busy:u,config:m,defaults:function(){return P.error("up.proxy.defaults(...) no longer exists. Set values on he up.proxy.config property instead.")}}}(jQuery)}.call(this),function(){up.link=function($){var childClicked,follow,followMethod,makeFollowable,shouldProcessLinkEvent,u,visit;return u=up.util,visit=function(e,t){var n;return t=u.options(t),n=u.option(t.target,"body"),up.replace(n,e,t)},follow=function(e,t){var n,r,o;return n=$(e),t=u.options(t),o=u.option(n.attr("up-href"),n.attr("href")),r=u.option(t.target,n.attr("up-target"),"body"),t.transition=u.option(t.transition,u.castedAttr(n,"up-transition"),u.castedAttr(n,"up-animation")),t.history=u.option(t.history,u.castedAttr(n,"up-history")),t.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),t.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),t.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),t.method=followMethod(n,t),t.origin=u.option(t.origin,n),t=u.merge(t,up.motion.animateOptions(t,n)),up.replace(r,o,t)},followMethod=function(e,t){var n;return n=$(e),t=u.options(t),u.option(t.method,n.attr("up-method"),n.attr("data-method"),"get").toUpperCase()},up.on("click","a[up-target], [up-href][up-target]",function(e,t){return shouldProcessLinkEvent(e,t)?t.is("[up-instant]")?e.preventDefault():(e.preventDefault(),follow(t)):void 0}),up.on("mousedown","a[up-instant], [up-href][up-instant]",function(e,t){return shouldProcessLinkEvent(e,t)?(e.preventDefault(),follow(t)):void 0}),childClicked=function(e,t){var n,r;return n=$(e.target),r=n.closest("a, [up-href]"),r.length&&t.find(r).length},shouldProcessLinkEvent=function(e,t){return u.isUnmodifiedMouseEvent(e)&&!childClicked(e,t)},makeFollowable=function(e){var t;return t=$(e),u.isMissing(t.attr("up-target"))&&u.isMissing(t.attr("up-follow"))?t.attr("up-follow",""):void 0},up.on("click","a[up-follow], [up-href][up-follow]",function(e,t){return shouldProcessLinkEvent(e,t)?t.is("[up-instant]")?e.preventDefault():(e.preventDefault(),follow(t)):void 0}),up.compiler("[up-expand]",function(e){var t,n,r,o,i,a,s,l;for(o=e.find("a, [up-href]").get(0),o||u.error("No link to expand within %o",e),l=/^up-/,a={},a["up-href"]=$(o).attr("href"),s=o.attributes,n=0,r=s.length;r>n;n++)t=s[n],i=t.name,i.match(l)&&(a[i]=t.value);return u.setMissingAttrs(e,a),e.removeAttr("up-expand"),makeFollowable(e)}),up.compiler("[up-dash]",function(e){var t,n;return n=u.castedAttr(e,"up-dash"),t={"up-preload":"true","up-instant":"true"},n===!0?t["up-follow"]="":t["up-target"]=n,u.setMissingAttrs(e,t),e.removeAttr("up-dash")}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,makeFollowable:makeFollowable,childClicked:childClicked,followMethod:followMethod}}(jQuery),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){var slice=[].slice;up.form=function($){var autosubmit,config,observe,observeForm,reset,resolveValidateTarget,submit,u,validate;return u=up.util,config=u.config({validateTargets:["[up-fieldset]:has(&)","fieldset:has(&)","label:has(&)","form:has(&)"],fields:[":input"],observeDelay:0}),reset=function(){return config.reset()},submit=function(e,t){var n,r,o,i,a,s,l,c,p,f,d,m,h,v;return n=$(e).closest("form"),t=u.options(t),f=u.option(t.target,n.attr("up-target"),"body"),f=up.flow.resolveSelector(f,t),r=u.option(t.failTarget,n.attr("up-fail-target"))||u.selectorForElement(n),r=up.flow.resolveSelector(r,t),s=u.option(t.history,u.castedAttr(n,"up-history"),!0),d=u.option(t.transition,u.castedAttr(n,"up-transition")),o=u.option(t.failTransition,u.castedAttr(n,"up-fail-transition"),d),l=u.option(t.method,n.attr("up-method"),n.attr("data-method"),n.attr("method"),"post").toUpperCase(),a=u.option(t.headers,{}),c={},c.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),c.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),c.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),c.origin=u.option(t.origin,n),c=u.extend(c,up.motion.animateOptions(t,n)),v=u.option(t.cache,u.castedAttr(n,"up-cache")),h=u.option(t.url,n.attr("action"),up.browser.url()),i=n.find("input[type=file]").length,t.validate&&(a["X-Up-Validate"]=t.validate,i)?u.unresolvablePromise():(n.addClass("up-active"),i||!up.browser.canPushState()&&s!==!1?(n.get(0).submit(),u.unresolvablePromise()):(p={url:h,method:l,data:n.serialize(),selector:f,cache:v,headers:a},m=function(e){var t;return h=void 0,u.isGiven(s)&&(s===!1||u.isString(s)?h=s:(t=u.locationFromXhr(e))?h=t:"GET"===p.type&&(h=p.url+"?"+p.data)),u.option(h,!1)},up.proxy.ajax(p).always(function(){return n.removeClass("up-active")}).done(function(e,t,n){var r;return r=u.merge(c,{history:m(n),transition:d}),up.flow.implant(f,e,r)}).fail(function(e){var t,n;return n=e.responseText,t=u.merge(c,{transition:o}),up.flow.implant(r,n,t)})))},observe=function(){var $element,args,callback,callbackArg,callbackPromise,callbackTimer,changeEvents,check,clearTimer,delay,knownValue,nextCallback,options,rawCallback,runNextCallback,selectorOrElement;return selectorOrElement=arguments[0],args=2<=arguments.length?slice.call(arguments,1):[],options={},callbackArg=void 0,1===args.length&&(callbackArg=args[0]),args.length>1&&(options=u.options(args[0]),callbackArg=args[1]),$element=$(selectorOrElement),options=u.options(options),delay=u.option($element.attr("up-delay"),options.delay,config.observeDelay),delay=parseInt(delay),callback=null,u.isGiven(options.change)&&up.error("up.observe now takes the change callback as the last argument"),rawCallback=u.option(u.presentAttr($element,"op-observe"),callbackArg),callback=u.isString(rawCallback)?function(value,$field){return eval(rawCallback)}:rawCallback||u.error("up.observe: No change callback given"),$element.is("form")?observeForm($element,options,callback):(knownValue=null,callbackTimer=null,callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var e;return nextCallback?(e=nextCallback(),nextCallback=null,e):void 0},check=function(){var e,t;return t=$element.val(),e=u.isNull(knownValue),knownValue===t||(knownValue=t,e)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($element.get(0),[t,$element])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var e;return e=runNextCallback(),callbackPromise=u.isPromise(e)?e:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$element.on(changeEvents,check),check(),function(){return $element.off(changeEvents,check),clearTimer()})},observeForm=function(e,t,n){var r,o;return r=u.multiSelector(config.fields).find(e),o=u.map(r,function(e){return observe(e,n)}),function(){var e,t,n,r;for(r=[],t=0,n=o.length;n>t;t++)e=o[t],r.push(e());return r}},autosubmit=function(e,t){return console.log("autosubmit %o",e),observe(e,t,function(e,t){var n;return n=t.closest("form"),t.addClass("up-active"),submit(n).always(function(){return t.removeClass("up-active")})})},resolveValidateTarget=function(e,t){var n;return n=u.option(t.target,e.attr("up-validate")),u.isBlank(n)&&(n||(n=u.detect(config.validateTargets,function(n){var r;return r=up.flow.resolveSelector(n,t),e.closest(r).length}))),u.isBlank(n)&&error("Could not find default validation target for %o (tried ancestors %o)",e,config.validateTargets),u.isString(n)||(n=u.selectorForElement(n)),n},validate=function(e,t){var n,r,o;return n=$(e),t=u.options(t),t.origin=n,t.target=resolveValidateTarget(n,t),t.failTarget=t.target,t.history=!1,t.headers=u.option(t.headers,{}),t.validate=n.attr("name")||"__none__",t=u.merge(t,up.motion.animateOptions(t,n)),r=n.closest("form"),o=up.submit(r,t)},up.on("submit","form[up-target]",function(e,t){return e.preventDefault(),submit(t)}),up.on("change","[up-validate]",function(e,t){return validate(t)}),up.compiler("[up-observe]",function(e){return observe(e)}),up.compiler("[up-autosubmit]",function(e){return autosubmit(e)}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),config:config,submit:submit,observe:observe,validate:validate}}(jQuery),up.submit=up.form.submit,up.observe=up.form.observe,up.autosubmit=up.form.autosubmit,up.validate=up.form.validate}.call(this),function(){up.popup=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h;return m=up.util,s=void 0,i=function(){var t;return t=e(".up-popup"),t.attr("up-covered-url")},o=m.config({openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right"}),f=function(){return r(),o.reset()},d=function(e,t,n){var r,o;return o=m.measure(e,{full:!0}),r=function(){switch(n){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.bottom+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return m.error("Unknown position %o",n)}}(),t.attr("up-position",n),t.css(r),c(t)},c=function(e){var t,n,r,o,u,i,a;if(n=m.measure(e,{full:!0}),r=null,o=null,n.right<0&&(r=-n.right),n.bottom<0&&(o=-n.bottom),n.left<0&&(r=n.left),n.top<0&&(o=n.top),r&&((u=parseInt(e.css("left")))?e.css("left",u-r):(i=parseInt(e.css("right")))&&e.css("right",i+r)),o){if(a=parseInt(e.css("top")))return e.css("top",a-o);if(t=parseInt(e.css("bottom")))return e.css("bottom",t+o)}},p=function(){var t;return t=e(".up-popup"),t.attr("up-covered-url",up.browser.url()),t.attr("up-covered-title",document.title)},l=function(){var t;return t=e(".up-popup"),t.removeAttr("up-covered-url"),t.removeAttr("up-covered-title")},a=function(e,t,n){var r,o;return o=m.$createElementFromSelector(".up-popup"),n&&o.attr("up-sticky",""),r=m.$createElementFromSelector(t),r.appendTo(o),o.appendTo(document.body),p(),o.hide(),o},h=function(e,t,n,r,o){var u;return t.show(),d(e,t,n),u=up.animate(t,r,o),u.then(function(){return up.emit("up:popup:opened")}),u},t=function(t,n){var u,i,s,l,c,p,f,d,v;return u=e(t),n=m.options(n),v=m.option(n.url,u.attr("href")),f=m.option(n.target,u.attr("up-popup"),"body"),p=m.option(n.position,u.attr("up-position"),o.position),l=m.option(n.animation,u.attr("up-animation"),o.openAnimation),d=m.option(n.sticky,m.castedAttr(u,"up-sticky")),c=up.browser.canPushState()?m.option(n.history,m.castedAttr(u,"up-history"),!1):!1,s=up.motion.animateOptions(n,u),r(),up.bus.nobodyPrevents("up:popup:open",{url:v})?(i=a(u,f,d),up.replace(f,v,{history:c,insert:function(){return h(u,i,p,l,s)}})):m.unresolvableDeferred()},r=function(t){var n,r;return n=e(".up-popup"),n.length?up.bus.nobodyPrevents("up:popup:close",{$element:n})?(t=m.options(t,{animation:o.closeAnimation,url:n.attr("up-covered-url"),title:n.attr("up-covered-title")}),s=void 0,r=up.destroy(n,t),r.then(function(){return up.emit("up:popup:closed")}),r):m.unresolvableDeferred():m.resolvedDeferred()},n=function(){return e(".up-popup").is("[up-sticky]")?void 0:(l(),r())},u=function(t){var n;return n=e(t),n.closest(".up-popup").length>0},up.on("click","a[up-popup]",function(e,n){return e.preventDefault(),n.is(".up-current")?r():t(n)}),up.on("click","body",function(t){var n;return n=e(t.target),n.closest(".up-popup").length||n.closest("[up-popup]").length?void 0:r()}),up.on("up:fragment:inserted",function(e,t){var r;return u(t)?(r=t.attr("up-source"))?s=r:void 0:n()}),up.bus.onEscape(function(){return r()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-popup").length?(r(),e.preventDefault()):void 0}),up.on("up:framework:reset",f),{attach:t,close:r,url:function(){return s},coveredUrl:i,config:o,defaults:function(){return m.error("up.popup.defaults(...) no longer exists. Set values on he up.popup.config property instead.")},contains:u,open:function(){return up.error("up.popup.open no longer exists. Please use up.popup.attach instead.")},source:function(){return up.error("up.popup.source no longer exists. Please use up.popup.url instead.")}}}(jQuery)}.call(this),function(){up.modal=function($){var autoclose,close,config,contains,coveredUrl,createHiddenModal,currentUrl,discardHistory,follow,open,rememberHistory,reset,shiftElements,templateHtml,u,unshiftElements,updated,visit;return u=up.util,config=u.config({maxWidth:null,minWidth:null,width:null,height:null,openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"\xd7",template:function(e){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+e.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}}),currentUrl=void 0,coveredUrl=function(){var e;return e=$(".up-modal"),e.attr("up-covered-url")},reset=function(){return close(),currentUrl=void 0,config.reset()},templateHtml=function(){var e;return e=config.template,u.isFunction(e)?e(config):e},rememberHistory=function(){var e;return e=$(".up-modal"),e.attr("up-covered-url",up.browser.url()),e.attr("up-covered-title",document.title)},discardHistory=function(){var e;return e=$(".up-modal"),e.removeAttr("up-covered-url"),e.removeAttr("up-covered-title")},createHiddenModal=function(e){var t,n,r,o;return r=$(templateHtml()),e.sticky&&r.attr("up-sticky",""),r.attr("up-covered-url",up.browser.url()),r.attr("up-covered-title",document.title),n=r.find(".up-modal-dialog"),u.isPresent(e.width)&&n.css("width",e.width),u.isPresent(e.maxWidth)&&n.css("max-width",e.maxWidth),u.isPresent(e.height)&&n.css("height",e.height),t=r.find(".up-modal-content"),o=u.$createElementFromSelector(e.selector),o.appendTo(t),r.appendTo(document.body),rememberHistory(),r.hide(),r},unshiftElements=[],shiftElements=function(){var e,t,n,r;return n=u.scrollbarWidth(),e=parseInt($("body").css("padding-right")),t=n+e,r=u.temporaryCss($("body"),{"padding-right":t+"px","overflow-y":"hidden"}),unshiftElements.push(r),up.layout.anchoredRight().each(function(){var e,t,r,o;return e=$(this),t=parseInt(e.css("right")),r=n+t,o=u.temporaryCss(e,{right:r}),unshiftElements.push(o)})},updated=function(e,t,n){var r;return shiftElements(),e.show(),r=up.animate(e,t,n),r.then(function(){return up.emit("up:modal:opened")})},follow=function(e,t){return t=u.options(t),t.$link=$(e),open(t)},visit=function(e,t){return t=u.options(t),t.url=e,open(t)},open=function(e){var t,n,r,o,i,a,s,l,c,p,f;return e=u.options(e),t=u.option(e.$link,u.nullJQuery()),p=u.option(e.url,t.attr("up-href"),t.attr("href")),l=u.option(e.target,t.attr("up-modal"),"body"),f=u.option(e.width,t.attr("up-width"),config.width),s=u.option(e.maxWidth,t.attr("up-max-width"),config.maxWidth),i=u.option(e.height,t.attr("up-height"),config.height),o=u.option(e.animation,t.attr("up-animation"),config.openAnimation),c=u.option(e.sticky,u.castedAttr(t,"up-sticky")),a=up.browser.canPushState()?u.option(e.history,u.castedAttr(t,"up-history"),!0):!1,r=up.motion.animateOptions(e,t),close(),up.bus.nobodyPrevents("up:modal:open",{url:p})?(n=createHiddenModal({selector:l,width:f,maxWidth:s,height:i,sticky:c}),up.replace(l,p,{history:a,insert:function(){return updated(n,o,r)}})):u.unresolvableDeferred()},close=function(e){var t,n;return t=$(".up-modal"),t.length?up.bus.nobodyPrevents("up:modal:close",{$element:t})?(e=u.options(e,{animation:config.closeAnimation,url:t.attr("up-covered-url"),title:t.attr("up-covered-title")}),currentUrl=void 0,n=up.destroy(t,e),n.then(function(){for(var e;e=unshiftElements.pop();)e();return up.emit("up:modal:closed")}),n):u.unresolvableDeferred():u.resolvedDeferred()},autoclose=function(){return $(".up-modal").is("[up-sticky]")?void 0:(discardHistory(),close())},contains=function(e){var t;return t=$(e),t.closest(".up-modal").length>0},up.on("click","a[up-modal]",function(e,t){return e.preventDefault(),t.is(".up-current")?close():follow(t)}),up.on("click","body",function(e){var t;return t=$(e.target),t.closest(".up-modal-dialog").length||t.closest("[up-modal]").length?void 0:close()}),up.on("up:fragment:inserted",function(e,t){var n;if(contains(t)){if(n=t.attr("up-source"))return currentUrl=n}else if(!up.popup.contains(t))return autoclose()}),up.bus.onEscape(function(){return close()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-modal").length?(close(),e.preventDefault()):void 0}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,open:function(){return up.error("up.modal.open no longer exists. Please use either up.modal.follow or up.modal.visit.")},close:close,url:function(){return currentUrl},coveredUrl:coveredUrl,config:config,defaults:function(){return u.error("up.modal.defaults(...) no longer exists. Set values on he up.modal.config property instead.")},contains:contains,source:function(){return up.error("up.popup.source no longer exists. Please use up.popup.url instead.")}}}(jQuery)}.call(this),function(){up.tooltip=function(e){var t,n,r,o,u,i,a;return a=up.util,r=a.config({position:"top",openAnimation:"fade-in",closeAnimation:"fade-out"}),u=function(){return r.reset()},i=function(e,t,n){var r,o,u;return o=a.measure(e),u=a.measure(t),r=function(){switch(n){case"top":return{left:o.left+.5*(o.width-u.width),top:o.top-u.height};case"bottom":return{left:o.left+.5*(o.width-u.width),top:o.top+o.height};default:return a.error("Unknown position %o",n)}}(),t.attr("up-position",n),t.css(r)},o=function(e){var t;return t=a.$createElementFromSelector(".up-tooltip"),a.isGiven(e.text)?t.text(e.text):t.html(e.html),t.appendTo(document.body),t},t=function(t,u){var s,l,c,p,f,d,m;return null==u&&(u={}),s=e(t),f=a.option(u.html,s.attr("up-tooltip-html")),m=a.option(u.text,s.attr("up-tooltip")),d=a.option(u.position,s.attr("up-position"),r.position),p=a.option(u.animation,a.castedAttr(s,"up-animation"),r.openAnimation),c=up.motion.animateOptions(u,s),n(),l=o({text:m,html:f}),i(s,l,d),up.animate(l,p,c)},n=function(t){var n;return n=e(".up-tooltip"),n.length?(t=a.options(t,{animation:r.closeAnimation}),t=a.merge(t,up.motion.animateOptions(t)),up.destroy(n,t)):void 0},up.compiler("[up-tooltip], [up-tooltip-html]",function(e){return e.on("mouseover",function(){return t(e)}),e.on("mouseout",function(){return n()})}),up.on("click","body",function(){return n()}),up.on("up:framework:reset",n),up.bus.onEscape(function(){return n()}),up.on("up:framework:reset",u),{attach:t,close:n,open:function(){return a.error("up.tooltip.open no longer exists. Use up.tooltip.attach instead.")}}}(jQuery)}.call(this),function(){up.navigation=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return h=up.util,i=h.config({currentClasses:["up-current"]}),p=function(){return i.reset()},a=function(){var e;return e=i.currentClasses,e=e.concat(["up-current"]),e=h.uniq(e),e.join(" ")},t="up-active",n=["a","[up-href]","[up-alias]"],o=n.join(", "),u=function(){var e,t,r;for(r=[],e=0,t=n.length;t>e;e++)m=n[e],r.push(m+"[up-instant]");return r}().join(", "),r="."+t,c=function(e){return h.isPresent(e)?h.normalizeUrl(e,{search:!1,stripTrailingSlash:!0}):void 0},d=function(e){var t,n,r,o,u,i,a,s,l,p;for(s=[],i=["href","up-href","up-alias"],n=0,o=i.length;o>n;n++)if(t=i[n],l=h.presentAttr(e,t))for(p="up-alias"===t?l.split(" "):[l],r=0,u=p.length;u>r;r++)a=p[r],"#"!==a&&(a=c(a),s.push(a));return s},g=function(e){var t,n,r,o;return e=h.compact(e),r=function(e){return"*"===e.substr(-1)?n(e.slice(0,-1)):t(e)},t=function(t){return h.contains(e,t)},n=function(t){return h.detect(e,function(e){return 0===e.indexOf(t)})},o=function(e){return h.detect(e,r)},{matchesAny:o}},l=function(){var t,n;return t=g([c(up.browser.url()),c(up.modal.url()),c(up.modal.coveredUrl()),c(up.popup.url()),c(up.popup.coveredUrl())]),n=a(),h.each(e(o),function(r){var o,u;return o=e(r),u=d(o),t.matchesAny(u)?o.addClass(n):o.hasClass(n)&&0===o.closest(".up-destroying").length?o.removeClass(n):void 0})},f=function(e){return v(),e=s(e),e.addClass(t)},s=function(e){return h.presence(e.parents(o))||e},v=function(){return e(r).removeClass(t)},up.on("click",o,function(e,t){return h.isUnmodifiedMouseEvent(e)&&!t.is("[up-instant]")?f(t):void 0}),up.on("mousedown",u,function(e,t){return h.isUnmodifiedMouseEvent(e)?f(t):void 0}),up.on("up:fragment:inserted",function(){return v(),l()}),up.on("up:fragment:destroyed",function(e,t){return t.is(".up-modal, .up-popup")?l():void 0}),up.on("up:framework:reset",p),{config:i,defaults:function(){return h.error("up.navigation.defaults(...) no longer exists. Set values on he up.navigation.config property instead.")}}}(jQuery)}.call(this),function(){up.boot()}.call(this);
1
+ (function(){window.up={}}).call(this),function(){var e=[].slice;up.util=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,x,S,C,T,E,$,A,P,U,O,D,M,j,R,z,F,L,W,H,I,_,K,Q,q,N,X,B,V,G,J,Y,Z,et,tt,nt,rt,ot,ut,it,at,st,lt,ct,pt,ft,dt,mt,ht,vt,gt,yt,bt,wt,kt,xt,St,Ct,Tt,Et,$t,At,Pt,Ut,Ot,Dt,Mt;return Z=function(t){var n,r;return n=void 0,r=!1,function(){var o;return o=1<=arguments.length?e.call(arguments,0):[],r?n:(r=!0,n=t.apply(null,o))}},u=function(e){return e=d(e),e.selector&&(e.headers||(e.headers={}),e.headers["X-Up-Selector"]=e.selector),t.ajax(e)},Q=function(e,t){return t=t.toString(),(""===t||"80"===t)&&"http:"===e||"443"===t&&"https:"===e},ut=function(e,t){var n,r,o;return n=ft(e),r=n.protocol+"//"+n.hostname,Q(n.protocol,n.port)||(r+=":"+n.port),o=n.pathname,"/"!==o[0]&&(o="/"+o),(null!=t?t.stripTrailingSlash:void 0)===!0&&(o=o.replace(/\/$/,"")),r+=o,(null!=t?t.hash:void 0)===!0&&(r+=n.hash),(null!=t?t.search:void 0)!==!1&&(r+=n.search),r},ft=function(e){var n;return n=null,q(e)?(n=t("<a>").attr({href:e}).get(0),U(n.hostname)&&(n.href=n.href)):n=At(e),n},ot=function(e){return e?e.toUpperCase():"GET"},n=function(e){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;for(v=e.split(/[ >]/),o=null,p=f=0,m=v.length;m>f;p=++f){for(a=v[p],i=a.match(/(^|\.|\#)[A-Za-z0-9\-_]+/g),g="div",u=[],c=null,d=0,h=i.length;h>d;d++)switch(s=i[d],s[0]){case".":u.push(s.substr(1));break;case"#":c=s.substr(1);break;default:g=s}l="<"+g,u.length&&(l+=' class="'+u.join(" ")+'"'),c&&(l+=' id="'+c+'"'),l+=">",n=t(l),r&&n.appendTo(r),0===p&&(o=n),r=n}return o},h=function(e,t){var n;return n=document.createElement(e),_(t)&&(n.innerHTML=t),n},y=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n="[UP] "+n,(r=up.browser).puts.apply(r,["debug",n].concat(e.call(t)))},Mt=function(){var t,n,r;return n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],n="[UP] "+n,(r=up.browser).puts.apply(r,["warn",n].concat(e.call(t)))},k=function(){var n,r,o,u;throw r=1<=arguments.length?e.call(arguments,0):[],r[0]="[UP] "+r[0],(u=up.browser).puts.apply(u,["error"].concat(e.call(r))),o=S.apply(null,r),n=dt(t(".up-error"))||t('<div class="up-error"></div>').prependTo("body"),n.addClass("up-error"),n.text(o),new Error(o)},o=/\%[odisf]/g,S=function(){var t,n,r,u;return t=1<=arguments.length?e.call(arguments,0):[],u=t[0],n=0,r=80,u.replace(o,function(){var e,o;return n+=1,e=t[n],o=typeof e,"string"===o?(e=e.replace(/\s+/g," "),e.length>r&&(e=e.substr(0,r)+"\u2026"),e='"'+e+'"'):e="undefined"===o?"undefined":"number"===o||"function"===o?e.toString():JSON.stringify(e),e.length>r&&(e=e.substr(0,r)+" \u2026",("object"===o||"function"===o)&&(e+=" }")),e})},kt=function(e){var n,r,o,u,i,a,s,l,c,p;if(n=t(e),c=void 0,y("Creating selector from element %o",n.get(0)),p=dt(n.attr("up-id")))c="[up-id='"+p+"']";else if(u=dt(n.attr("id")))c="#"+u;else if(l=dt(n.attr("name")))c="[name='"+l+"']";else if(r=dt(n.attr("class")))for(o=r.split(" "),c="",i=0,s=o.length;s>i;i++)a=o[i],c+="."+a;else c=n.prop("tagName").toLowerCase();return c},v=function(e){var t,n,r,o,u,i,a,s,l,c,p,f;return l=function(e){return"<"+e+"(?: [^>]*)?>"},i=function(e){return"</"+e+">"},t="(?:.|\\n)*?",u=function(e){return"("+e+")"},f=new RegExp(l("head")+t+l("title")+u(t)+i("title")+t+i("body"),"i"),o=new RegExp(l("body")+u(t)+i("body"),"i"),(r=e.match(o))?(s=document.createElement("html"),n=h("body",r[1]),s.appendChild(n),(p=e.match(f))&&(a=h("head"),s.appendChild(a),c=h("title",p[1]),a.appendChild(c)),s):h("div",e)},C=t.extend,$t=t.trim,w=function(e,t){var n,r,o,u,i;for(i=[],n=o=0,u=e.length;u>o;n=++o)r=e[n],i.push(t(r,n));return i},J=w,Ct=function(e,t){var n,r,o,u;for(u=[],n=r=0,o=e-1;o>=0?o>=r:r>=o;n=o>=0?++r:--r)u.push(t(n));return u},W=function(e){return null===e},N=function(e){return void 0===e},D=function(e){return!N(e)},L=function(e){return N(e)||W(e)},R=function(e){return!L(e)},U=function(e){return L(e)||I(e)&&0===Object.keys(e).length||0===e.length},dt=function(e,t){return null==t&&(t=_),t(e)?e:void 0},_=function(e){return!U(e)},j=function(e){return"function"==typeof e},q=function(e){return"string"==typeof e},H=function(e){return"number"==typeof e},z=function(e){return"object"==typeof e&&!!e},I=function(e){return z(e)||"function"==typeof e},M=function(e){return!(!e||1!==e.nodeType)},F=function(e){return e instanceof jQuery},K=function(e){return I(e)&&j(e.then)},O=function(e){return K(e)&&j(e.resolve)},P=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},Et=function(e){return Array.prototype.slice.call(e)},d=function(e){return P(e)?e.slice():C({},e)},At=function(e){return F(e)?e.get(0):e},et=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],C.apply(null,[{}].concat(e.call(t)))},pt=function(e,t){var n,r,o,u;if(o=e?d(e):{},t)for(r in t)n=t[r],u=o[r],R(u)?I(n)&&I(u)&&(o[r]=pt(u,n)):o[r]=n;return o},ct=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],b(t,R)},b=function(e,t){var n,r,o,u;for(u=void 0,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=n;break}return u},i=function(e,t){var n,r,o,u;for(u=!1,r=0,o=e.length;o>r;r++)if(n=e[r],t(n)){u=!0;break}return u},c=function(e){return wt(e,R)},Pt=function(e){var t;return t={},wt(e,function(e){return t.hasOwnProperty(e)?!1:t[e]=!0})},wt=function(e,t){var n;return n=[],w(e,function(e){return t(e)?n.push(e):void 0}),n},mt=function(){var t,n,r,o;return t=arguments[0],r=2<=arguments.length?e.call(arguments,1):[],o=function(){var e,o,u;for(u=[],e=0,o=r.length;o>e;e++)n=r[e],u.push(t.attr(n));return u}(),b(o,_)},rt=function(e){return setTimeout(e,0)},V=function(e){return e[e.length-1]},l=function(){var e;return e=document.documentElement,{width:e.clientWidth,height:e.clientHeight}},bt=Z(function(){var e,n,r;return e=t("<div>").css({position:"absolute",top:"0",left:"0",width:"50px",height:"50px",overflowY:"scroll"}),e.appendTo(document.body),n=e.get(0),r=n.offsetWidth-n.clientWidth,e.remove(),r}),st=function(t){var n;return n=void 0,function(){var r;return r=1<=arguments.length?e.call(arguments,0):[],null!=t&&(n=t.apply(null,r)),t=void 0,n}},St=function(e,t,n){var r,o;return o=e.css(Object.keys(t)),e.css(t),r=function(){return e.css(o)},n?(n(),r()):st(r)},A=function(e){var t,n;return n=e.css(["transform","-webkit-transform"]),U(n)||"none"===n.transform?(t=function(){return e.css(n)},e.css({transform:"translateZ(0)","-webkit-transform":"translateZ(0)"})):t=function(){},t},g=function(e,n,o){var u,i,a,s,l,c;return u=t(e),o=pt(o,{duration:300,delay:0,easing:"ease"}),i=t.Deferred(),s={"transition-property":Object.keys(n).join(", "),"transition-duration":o.duration+"ms","transition-delay":o.delay+"ms","transition-timing-function":o.easing},l=A(u),c=St(u,s),u.css(n),i.then(l),i.then(c),u.data(r,i),i.then(function(){return u.removeData(r)}),a=setTimeout(function(){return i.resolve()},o.duration+o.delay),i.then(function(){return clearTimeout(a)}),i},r="up-animation-promise",E=function(e){return t(e).each(function(){var e;return(e=t(this).data(r))?e.resolve():void 0})},Y=function(e,n){var r,o,u,i,a,s;return n=pt(n,{relative:!1,inner:!1,full:!1}),n.relative?n.relative===!0?i=e.position():(r=t(n.relative),a=e.offset(),r.is(document)?i=a:(u=r.offset(),i={left:a.left-u.left,top:a.top-u.top})):i=e.offset(),o={left:i.left,top:i.top},n.inner?(o.width=e.width(),o.height=e.height()):(o.width=e.outerWidth(),o.height=e.outerHeight()),n.full&&(s=l(),o.right=s.width-(o.left+o.width),o.bottom=s.height-(o.top+o.height)),o},m=function(e,t){var n,r,o,u,i;for(u=e.get(0).attributes,i=[],r=0,o=u.length;o>r;r++)n=u[r],i.push(n.specified?t.attr(n.name,n.value):void 0);return i},T=function(e,t){return e.find(t).addBack(t)},x=function(e){return 27===e.keyCode},f=function(e,t){return e.indexOf(t)>=0},s=function(e,t){var n;switch(n=e.attr(t)){case"false":return!1;case"true":return!0;case"":return!0;default:return n}},G=function(e){return e.getResponseHeader("X-Up-Location")},Tt=function(e){return e.getResponseHeader("X-Up-Title")},tt=function(e){return e.getResponseHeader("X-Up-Method")},lt=function(){var t,n,r,o,u,i;for(o=arguments[0],u=2<=arguments.length?e.call(arguments,1):[],t={},n=0,r=u.length;r>n;n++)i=u[n],o.hasOwnProperty(i)&&(t[i]=o[i]);return t},X=function(e){return!(e.metaKey||e.shiftKey||e.ctrlKey)},B=function(e){var t;return t=N(e.button)||0===e.button,t&&X(e)},gt=function(){var e;return e=t.Deferred(),e.resolve(),e},yt=function(){return gt().promise()},Ut=function(){return t.Deferred()},Ot=function(){return Ut().promise()},it=function(){return t()},vt=function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],r=t.when.apply(t,n),r.resolve=function(){return w(n,function(e){return"function"==typeof e.resolve?e.resolve():void 0})},r},xt=function(e,t){var n,r,o;r=[];for(n in t)o=t[n],r.push(L(e.attr(n))?e.attr(n,o):void 0);return r},ht=function(e,t){var n;return n=e.indexOf(t),n>=0?(e.splice(n,1),t):void 0},nt=function(e){var n,r,o,u,a,s,l;for(a={},l=[],r=[],o=0,u=e.length;u>o;o++)s=e[o],q(s)?l.push(s):r.push(s);return a.parsed=r,l.length&&(n=l.join(", "),a.parsed.push(n)),a.select=function(){return a.find(void 0)},a.find=function(e){var n,r,o,u,i,s;for(r=it(),i=a.parsed,o=0,u=i.length;u>o;o++)s=i[o],n=e?e.find(s):t(s),r=r.add(n);return r},a.findWithSelf=function(e){var t;return t=a.find(e),a.doesMatch(e)&&(t=t.add(e)),t},a.doesMatch=function(e){var n;return n=t(e),i(a.parsed,function(e){return n.is(e)})},a.seekUp=function(e){var n,r,o;for(o=t(e),n=o,r=void 0;n.length;){if(a.doesMatch(n)){r=n;break}n=n.parent()}return r||it()},a},a=function(t){var n,r,o,u,i,a,s,l,c,p,f,m;return null==t&&(t={}),f=void 0,r=function(){return f={}},r(),s=function(){var n;return n=1<=arguments.length?e.call(arguments,0):[],t.log?(n[0]="["+t.log+"] "+n[0],y.apply(null,n)):void 0},a=function(){return Object.keys(f)},l=function(){return L(t.size)?void 0:j(t.size)?t.size():H(t.size)?t.size:k("Invalid size config: %o",t.size)},o=function(){return L(t.expiry)?void 0:j(t.expiry)?t.expiry():H(t.expiry)?t.expiry:k("Invalid expiry config: %o",t.expiry)},c=function(e){return t.key?t.key(e):e.toString()},$t=function(){var e,t,n,r;return r=d(a()),n=l(),n&&r.length>n&&(e=null,t=null,w(r,function(n){var r,o;return r=f[n],o=r.timestamp,!t||t>o?(e=n,t=o):void 0}),e)?delete f[e]:void 0},n=function(e,t){var n;return n=u(e),D(n)?p(t,n):void 0},m=function(){return(new Date).valueOf()},p=function(e,t){var n;return n=c(e),f[n]={timestamp:m(),value:t}},ht=function(e){var t;return t=c(e),delete f[t]},i=function(e){var t,n;return t=o(),t?(n=m()-e.timestamp,n<o()):!0},u=function(e,t){var n,r;return null==t&&(t=void 0),r=c(e),(n=f[r])?i(n)?(s("Cache hit for %o",e),n.value):(s("Discarding stale cache entry for %o",e),ht(e),t):(s("Cache miss for %o",e),t)},{alias:n,get:u,set:p,remove:ht,clear:r,keys:a}},p=function(e){var t;return null==e&&(e={}),t={},t.reset=function(){return C(t,e)},t.reset(),Object.preventExtensions(t),t},Dt=function(e){var t,n;return e=At(e),t=e.parentNode,n=Et(e.childNodes),w(n,function(n){return t.insertBefore(n,e)}),t.removeChild(e)},at=function(e){var t,n;for(t=void 0;(e=e.parent())&&e.length;)if(n=e.css("position"),"absolute"===n||"relative"===n||e.is("body")){t=e;break}return t},$=function(e,n){var r,o,u,i;return r=t(e),o=at(r),u=r.position(),i=o.offset(),r.css({position:"absolute",left:u.left-i.left,top:u.top-i.top+n.scrollTop(),right:"",bottom:""})},{offsetParent:at,fixedToAbsolute:$,presentAttr:mt,createElement:h,parseUrl:ft,normalizeUrl:ut,normalizeMethod:ot,createElementFromHtml:v,$createElementFromSelector:n,selectorForElement:kt,ajax:u,extend:C,copy:d,merge:et,options:pt,option:ct,error:k,debug:y,warn:Mt,each:w,map:J,times:Ct,any:i,detect:b,select:wt,compact:c,uniq:Pt,last:V,isNull:W,isDefined:D,isUndefined:N,isGiven:R,isMissing:L,isPresent:_,isBlank:U,presence:dt,isObject:I,isFunction:j,isString:q,isElement:M,isJQuery:F,isPromise:K,isDeferred:O,isHash:z,isUnmodifiedKeyEvent:X,isUnmodifiedMouseEvent:B,nullJQuery:it,unJQuery:At,nextFrame:rt,measure:Y,temporaryCss:St,cssAnimate:g,finishCssAnimate:E,forceCompositing:A,escapePressed:x,copyAttributes:m,findWithSelf:T,contains:f,isArray:P,toArray:Et,castedAttr:s,locationFromXhr:G,titleFromXhr:Tt,methodFromXhr:tt,clientSize:l,only:lt,trim:$t,unresolvableDeferred:Ut,unresolvablePromise:Ot,resolvedPromise:yt,resolvedDeferred:gt,resolvableWhen:vt,setMissingAttrs:xt,remove:ht,memoize:Z,scrollbarWidth:bt,config:p,cache:a,unwrapElement:Dt,multiSelector:nt,evalConsoleTemplate:S}}($),up.error=up.util.error,up.warn=up.util.warn,up.debug=up.util.debug}.call(this),function(){var e=[].slice;up.browser=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h;return m=up.util,p=function(e,n){var r,o,u,i,a,s;return null==n&&(n={}),a=m.option(n.method,"get").toLowerCase(),"get"===a?location.href=e:t.rails?(s=n.target,u=t.rails.csrfToken(),o=t.rails.csrfParam(),r=t("<form method='post' action='"+e+"'></form>"),i="<input name='_method' value='"+a+"' type='hidden' />",m.isDefined(o)&&m.isDefined(u)&&(i+="<input name='"+o+"' value='"+u+"' type='hidden' />"),s&&r.attr("target",s),r.hide().append(i).appendTo("body"),r.submit()):error("Can't fake a "+a.toUpperCase()+" request without Rails UJS")},d=function(){var t,n,r;return r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],m.isDefined(console[r])||(r="log"),o()?console[r].apply(console,t):(n=m.evalConsoleTemplate.apply(m,t),console[r](n))},h=function(){return location.href},a=m.memoize(function(){return m.isUndefined(document.addEventListener)}),s=m.memoize(function(){return a()||-1!==navigator.appVersion.indexOf("MSIE 9.")}),u=m.memoize(function(){return m.isDefined(history.pushState)&&"get"===i()}),n=m.memoize(function(){return"transition"in document.documentElement.style}),r=m.memoize(function(){return"oninput"in document.createElement("input")}),o=m.memoize(function(){return!s()}),l=m.memoize(function(){var e,n,r,o;return o=t.fn.jquery,r=o.split("."),e=parseInt(r[0]),n=parseInt(r[1]),e>=2||1===e&&n>=9}),f=function(e){var t,n;return n=null!=(t=document.cookie.match(new RegExp(e+"=(\\w+)")))?t[1]:void 0,m.isPresent(n)&&(document.cookie=e+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"),n},i=m.memoize(function(){return(f("_up_request_method")||"get").toLowerCase()}),c=function(){return!a()&&l()},{url:h,loadPage:p,canPushState:u,canCssTransition:n,canInputEvent:r,canLogSubstitution:o,isSupported:c,puts:d}}(jQuery)}.call(this),function(){var e=[].slice;up.bus=function(t){var n,r,o,u,i,a,s,l,c,p,f,d;return f=up.util,a=[],r=null,d=function(e){return function(n){var r;return r=n.$element||t(this),e.apply(r.get(0),[n,r,up.syntax.data(r)])}},i=function(){var n,r,o,u,i;return r=1<=arguments.length?e.call(arguments,0):[],up.browser.isSupported()?(u=f.copy(r),i=u.length-1,o=u[i],u[i]=d(o),a.push(u),n=t(document),n.on.apply(n,u),function(){return n.off.apply(n,u)}):function(){}},o=function(e,n){var r,o;return null==n&&(n={}),o=t.Event(e,n),r=n.$element||t(document),f.debug("Emitting %o on %o with props %o",e,r,n),r.trigger(o),o},s=function(){var t,n;return t=1<=arguments.length?e.call(arguments,0):[],n=o.apply(null,t),!n.isDefaultPrevented()},l=function(e){return i("keydown","body",function(t){return f.escapePressed(t)?e(t):void 0})},p=function(){return r=f.copy(a)},c=function(){var e,n,o,u;for(n=0,o=a.length;o>n;n++)e=a[n],f.contains(r,e)||(u=t(document)).off.apply(u,e);return a=f.copy(r)},u=function(){return up.emit("up:framework:reset")},n=function(){return up.browser.isSupported()?up.emit("up:framework:boot"):void 0},i("up:framework:boot",p),i("up:framework:reset",c),{on:i,emit:o,nobodyPrevents:s,onEscape:l,emitReset:u,boot:n}}(jQuery),up.on=up.bus.on,up.emit=up.bus.emit,up.reset=up.bus.emitReset,up.boot=up.bus.boot}.call(this),function(){var e=[].slice;up.syntax=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m;return m=up.util,n="up-destroyable",r="up-destroyer",a=[],l=null,i=function(){var t,n,r;return r=arguments[0],t=2<=arguments.length?e.call(arguments,1):[],up.browser.isSupported()?(i=t.pop(),n=m.options(t[0],{batch:!1}),a.push({selector:r,callback:i,batch:n.batch})):void 0},o=function(e,t,o){var u;return m.debug("Applying compiler %o on %o",e.selector,o),u=e.callback.apply(o,[t,s(t)]),m.isFunction(u)?(t.addClass(n),t.data(r,u)):void 0},u=function(e){var n,r,u,s;for(m.debug("Compiling fragment %o",e),s=[],r=0,u=a.length;u>r;r++)i=a[r],n=m.findWithSelf(e,i.selector),s.push(n.length?i.batch?o(i,n,n.get()):n.each(function(){return o(i,t(this),this)}):void 0);return s},f=function(e){return m.findWithSelf(e,"."+n).each(function(){var e,n;return e=t(this),(n=e.data(r))()})},s=function(e){var n,r;return n=t(e),r=n.attr("up-data"),m.isString(r)&&""!==m.trim(r)?JSON.parse(r):{}},d=function(){return l=m.copy(a)},p=function(){return a=m.copy(l)},c=function(e,n){var r,o;return r=t(e),o=m.options(n,{$element:r}),up.emit("up:fragment:inserted",o),r},up.on("ready",function(){return c(document.body)}),up.on("up:fragment:inserted",function(e){return u(e.$element)}),up.on("up:fragment:destroy",function(e){return f(e.$element)}),up.on("up:framework:boot",d),up.on("up:framework:reset",p),{compiler:i,hello:c,data:s}}(jQuery),up.compiler=up.syntax.compiler,up.hello=up.syntax.hello,up.ready=function(){return up.util.error("up.ready no longer exists. Please use up.hello instead.")},up.awaken=function(){return up.util.error("up.awaken no longer exists. Please use up.compiler instead.")}}.call(this),function(){up.history=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v;return v=up.util,n=v.config({popTargets:["body"],restoreScroll:!0}),c=void 0,i=void 0,m=function(){return n.reset(),c=void 0,i=void 0},a=function(e){return v.normalizeUrl(e,{hash:!0})},r=function(){return a(up.browser.url())},o=function(e){return a(e)===r()},s=function(e){return i&&(c=i,i=void 0),i=e},d=function(e,t){return u("replace",e,t)},p=function(e,t){return u("push",e,t)},u=function(e,n,u){var i,a;return u=v.options(u,{force:!1}),u.force||!o(n)?up.browser.canPushState()?(i=e+"State",a=t(),v.debug("Changing history to URL %o (%o)",n,e),window.history[i](a,"",n),s(r())):v.error("This browser doesn't support history.pushState"):void 0},t=function(){return{fromUp:!0}},h=function(e){var t,o;return o=r(),v.debug("Restoring state %o (now on "+o+")",e),t=n.popTargets.join(", "),up.replace(t,o,{history:!1,reveal:!1,transition:"none",saveScroll:!1,restoreScroll:n.restoreScroll})},l=function(e){var t;return v.debug("History state popped to URL %o",r()),s(r()),up.layout.saveScroll({url:c}),t=e.originalEvent.state,(null!=t?t.fromUp:void 0)?h(t):v.debug("Discarding unknown state %o",t)},up.browser.canPushState()&&(f=function(){return e(window).on("popstate",l),d(r(),{force:!0})},"undefined"!=typeof jasmine&&null!==jasmine?f():setTimeout(f,100)),up.compiler("[up-back]",function(e){return v.isPresent(c)?(v.setMissingAttrs(e,{"up-href":c,"up-restore-scroll":""}),e.removeAttr("up-back"),up.link.makeFollowable(e)):void 0}),up.on("up:framework:reset",m),{config:n,defaults:function(){return v.error("up.history.defaults(...) no longer exists. Set values on he up.history.config property instead.")},push:p,replace:d,url:r,previousUrl:function(){return c},normalizeUrl:a}}(jQuery)}.call(this),function(){var slice=[].slice;up.layout=function($){var SCROLL_PROMISE_KEY,anchoredRight,config,finishScrolling,fixedChildren,lastScrollTops,measureObstruction,reset,restoreScroll,reveal,revealOrRestoreScroll,saveScroll,scroll,scrollTops,u,viewportOf,viewportSelector,viewports,viewportsWithin;return u=up.util,config=u.config({duration:0,viewports:[document,".up-modal","[up-viewport]"],fixedTop:["[up-fixed~=top]"],fixedBottom:["[up-fixed~=bottom]"],anchoredRight:["[up-anchored~=right]","[up-fixed~=top]","[up-fixed~=bottom]","[up-fixed~=right]"],snap:50,substance:150,easing:"swing"}),lastScrollTops=u.cache({size:30,key:up.history.normalizeUrl}),reset=function(){return config.reset(),lastScrollTops.clear()},SCROLL_PROMISE_KEY="up-scroll-promise",scroll=function(e,t,n){var r,o,i,a,s;return r=$(e),n=u.options(n),i=u.option(n.duration,config.duration),a=u.option(n.easing,config.easing),finishScrolling(r),i>0?(o=$.Deferred(),r.data(SCROLL_PROMISE_KEY,o),o.then(function(){return r.removeData(SCROLL_PROMISE_KEY),r.finish()}),s={scrollTop:t},r.get(0)===document&&(r=$("html, body")),r.animate(s,{duration:i,easing:a,complete:function(){return o.resolve()}}),o):(r.scrollTop(t),u.resolvedDeferred())},finishScrolling=function(e){return $(e).each(function(){var e;return(e=$(this).data(SCROLL_PROMISE_KEY))?e.resolve():void 0})},anchoredRight=function(){return u.multiSelector(config.anchoredRight).select()},measureObstruction=function(){var e,t,n,r;return n=function(e,t){var n,r;return n=$(e),r=n.css(t),u.isPresent(r)||u.error("Fixed element %o must have a CSS attribute %o",n,t),parseInt(r)+n.height()},t=function(){var e,t,o,u;for(o=$(config.fixedTop.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"top"));return u}(),e=function(){var e,t,o,u;for(o=$(config.fixedBottom.join(", ")),u=[],e=0,t=o.length;t>e;e++)r=o[e],u.push(n(r,"bottom"));return u}(),{top:Math.max.apply(Math,[0].concat(slice.call(t))),bottom:Math.max.apply(Math,[0].concat(slice.call(e)))}},reveal=function(e,t){var n,r,o,i,a,s,l,c,p,f,d,m,h,v;return u.debug("Revealing %o",e),t=u.options(t),n=$(e),r=t.viewport?$(t.viewport):viewportOf(n),m=u.option(t.snap,config.snap),v=r.is(document),h=v?u.clientSize().height:r.height(),p=r.scrollTop(),s=p,c=void 0,l=void 0,v?(l=measureObstruction(),c=0):(l={top:0,bottom:0},c=p),f=function(){return s+l.top},d=function(){return s+h-l.bottom-1},o=u.measure(n,{relative:r}),i=o.top+c,a=i+Math.min(o.height,config.substance)-1,a>d()&&(s+=a-d()),(i<f()||t.top)&&(s=i-l.top),m>s&&(s=0),s!==p?scroll(r,s,t):u.resolvedDeferred()},viewportSelector=function(){return u.multiSelector(config.viewports)},viewportOf=function(e){var t,n;return t=$(e),n=viewportSelector().seekUp(t),n.length||u.error("Could not find viewport for %o",t),n},viewportsWithin=function(e){var t;return t=$(e),viewportSelector().findWithSelf(t)},viewports=function(){return viewportSelector().select()},scrollTops=function(){var e,t,n,r,o,u,i;for(u={},o=config.viewports,t=0,r=o.length;r>t;t++)i=o[t],e=$(i),e.length&&(n=i,i===document&&(n="document"),u[n]=e.scrollTop());return u},fixedChildren=function(e){var t,n;return null==e&&(e=void 0),e||(e=document.body),n=$(e),t=n.find("[up-fixed]"),u.isPresent(config.fixedTop)&&(t=t.add(n.find(config.fixedTop.join(", ")))),u.isPresent(config.fixedBottom)&&(t=t.add(n.find(config.fixedBottom.join(", ")))),t},saveScroll=function(e){var t,n;return null==e&&(e={}),n=u.option(e.url,up.history.url()),t=u.option(e.tops,scrollTops()),u.debug("Saving scroll positions for URL %o: %o",n,t),lastScrollTops.set(n,t)},restoreScroll=function(e){var t,n,r,o,i,a,s,l,c;null==e&&(e={}),c=up.history.url(),o=void 0,e.around?(n=viewportsWithin(e.around),t=viewportOf(e.around),o=t.add(n)):o=viewports(),l=lastScrollTops.get(c),u.debug("Restoring scroll positions for URL %o (viewports are %o, saved tops are %o)",c,o,l);for(i in l)s=l[i],a="document"===i?document:i,r=o.filter(a),scroll(r,s,{duration:0});return u.resolvedDeferred()},revealOrRestoreScroll=function(e,t){var n,r,o,i;return n=$(e),t.restoreScroll?restoreScroll({around:n}):t.reveal?(t.source&&(i=u.parseUrl(t.source),i.hash&&"#"!==i.hash&&(o=i.hash.substr(1),r=u.findWithSelf(n,"#"+o+", a[name='"+o+"']"),r.length&&(n=r))),reveal(n)):u.resolvedDeferred()},up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),reveal:reveal,scroll:scroll,finishScrolling:finishScrolling,config:config,defaults:function(){return u.error("up.layout.defaults(...) no longer exists. Set values on he up.layout.config property instead.")},viewportOf:viewportOf,viewportsWithin:viewportsWithin,viewports:viewports,scrollTops:scrollTops,saveScroll:saveScroll,restoreScroll:restoreScroll,revealOrRestoreScroll:revealOrRestoreScroll,anchoredRight:anchoredRight,fixedChildren:fixedChildren}}(jQuery),up.scroll=up.layout.scroll,up.reveal=up.layout.reveal}.call(this),function(){up.flow=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return g=up.util,m=function(t,n){var r;return r=e(t),g.isPresent(n)&&(n=g.normalizeUrl(n)),r.attr("up-source",n)},h=function(t){var n;return n=e(t).closest("[up-source]"),g.presence(n.attr("up-source"))||up.browser.url()},d=function(e,t){var n,r,o;return g.isString(e)?(o=e,g.contains(o,"&")&&((n=g.presence(t.origin))?(r=g.selectorForElement(n),o=o.replace(/\&/,r)):g.error("Found origin reference %o in selector %o, but options.origin is missing","&",o))):o=g.selectorForElement(e),o},f=function(e,t,n){var r,o,u;return g.debug("Replace %o with %o (options %o)",e,t,n),n=g.options(n),u=d(e,n),up.browser.canPushState()||n.history===!1?(o={url:t,method:n.method,selector:u,cache:n.cache,preload:n.preload,headers:n.headers},r=up.proxy.ajax(o),r.done(function(e,r,a){var s,l;return(s=g.locationFromXhr(a))&&(g.debug("Location from server: %o",s),l={url:s,method:g.methodFromXhr(a),selector:u},up.proxy.alias(o,l),t=s),n.history!==!1&&(n.history=t),n.source!==!1&&(n.source=t),n.title||(n.title=g.titleFromXhr(a)),n.preload?void 0:i(u,e,n)}),r.fail(g.error),r):(n.preload||up.browser.loadPage(t,g.only(n,"method")),g.unresolvablePromise())},i=function(e,t,n){var r,u,i,a,s,p,f,m,h,y;for(h=d(e,n),n=g.options(n,{historyMethod:"push",requireMatch:!0}),n.source=g.option(n.source,n.history),f=c(t,n),n.title||(n.title=f.title()),n.saveScroll!==!1&&up.layout.saveScroll(),s=l(h,n),m=[],i=0,a=s.length;a>i;i++)y=s[i],u=o(y.selector,n),r=null!=(p=f.find(y.selector))?p.first():void 0,m.push(u&&r?v(u,r,y.pseudoClass,y.transition,n):void 0);return m},o=function(e,t){return u(".up-popup "+e)||u(".up-modal "+e)||u(e)||s(e,t)},s=function(e,t){var n;return t.requireMatch?(n="Could not find selector %o in current body HTML","#"===n[0]&&(n+=" (avoid using IDs)"),g.error(n,e)):void 0},c=function(t,n){var r;return r=g.createElementFromHtml(t),{title:function(){var e;return null!=(e=r.querySelector("title"))?e.textContent:void 0},find:function(o){var u;return(u=e.find(o,r)[0])?e(u):n.requireMatch?g.error("Could not find selector %o in response %o",o,t):void 0}}},r=function(e,n){return n.history&&(n.title&&(document.title=n.title),up.history[n.historyMethod](n.history)),n.source!==!1&&m(e,n.source),t(e),up.hello(e,{origin:n.origin})},v=function(e,t,o,u,i){var a,s;return u||(u="none"),up.motion.finish(e),o?(s="before"===o?"prepend":"append",a=t.contents().wrap('<span class="up-insertion"></span>').parent(),e[s](a),g.copyAttributes(t,e),r(a.children(),i),up.layout.revealOrRestoreScroll(a,i).then(function(){return up.animate(a,u,i)}).then(function(){g.unwrapElement(a)})):n(e,{animation:function(){return t.insertBefore(e),r(t,i),e.is("body")&&"none"!==u&&g.error("Cannot apply transitions to body-elements (%o)",u),up.morph(e,t,u,i)}})},l=function(e,t){var n,r,o,u,i,a,s,l,c,p,f,d;for(f=t.transition||t.animation||"none",n=/\ *,\ */,r=e.split(n),g.isPresent(f)&&(d=f.split(n)),s=[],o=u=0,i=r.length;i>u;o=++u)l=r[o],c=l.match(/^(.+?)(?:\:(before|after))?$/),e=c[1],"html"===e&&(e="body"),a=c[2],p=d[o]||g.last(d),s.push({selector:e,pseudoClass:a,transition:p});return s},t=function(e){var t,n;return n="[autofocus]:last",t=g.findWithSelf(e,n),t.length&&t.get(0)!==document.activeElement?t.focus():void 0},a=function(e){var t;return t=".up-ghost, .up-destroying",0===e.closest(t).length},u=function(t){var n,r,o,u,i,s;for(u=void 0,u=g.isString(t)?e(t).get():t,r=void 0,i=0,s=u.length;s>i;i++)if(o=u[i],n=e(o),a(n)){r=n;break}return r},n=function(t,n){var r,o,u;return r=e(t),up.bus.nobodyPrevents("up:fragment:destroy",{$element:r})?(n=g.options(n,{animation:"none"}),o=up.motion.animateOptions(n),r.addClass("up-destroying"),g.isPresent(n.url)&&up.history.push(n.url),g.isPresent(n.title)&&(document.title=n.title),u=g.presence(n.animation,g.isDeferred)||up.motion.animate(r,n.animation,o),u.then(function(){return up.emit("up:fragment:destroyed",{$element:r}),r.remove()}),u):e.Deferred()},p=function(e,t){var n;return t=g.options(t,{cache:!1}),n=t.url||h(e),f(e,n,t)},up.on("ready",function(){return m(document.body,up.browser.url())}),{replace:f,reload:p,destroy:n,implant:i,first:u,resolveSelector:d}}(jQuery),up.replace=up.flow.replace,up.implant=up.flow.implant,up.reload=up.flow.reload,up.destroy=up.flow.destroy,up.first=up.flow.first}.call(this),function(){up.motion=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,x,S,C;return S=up.util,u={},s={},x={},l={},a=S.config({duration:300,delay:0,easing:"ease",enabled:!0}),g=function(){return u=S.copy(s),x=S.copy(l),a.reset()},d=function(){return a.enabled&&up.browser.canCssTransition()},n=function(t,o,u){var a;return a=e(t),p(a),u=r(u),("none"===o||o===!1)&&h(),S.isFunction(o)?i(o(a,u),o):S.isString(o)?n(a,c(o),u):S.isHash(o)?d()?S.cssAnimate(a,o,u):(a.css(o),S.resolvedDeferred()):S.error("Unknown animation type %o",o)},r=function(e,t){var n;return null==t&&(t=null),e=S.options(e),n={},n.easing=S.option(e.easing,null!=t?t.attr("up-easing"):void 0,a.easing),n.duration=Number(S.option(e.duration,null!=t?t.attr("up-duration"):void 0,a.duration)),n.delay=Number(S.option(e.delay,null!=t?t.attr("up-delay"):void 0,a.delay)),n},c=function(e){return u[e]||S.error("Unknown animation %o",e)},t="up-ghosting-promise",C=function(e,n,r,o){var u,i,a,s,l,c,p;return s=void 0,i=void 0,l=void 0,a=void 0,u=up.layout.viewportOf(e),S.temporaryCss(n,{display:"none"},function(){return s=v(e,u),s.$ghost.addClass("up-destroying"),s.$bounds.addClass("up-destroying"),l=u.scrollTop()}),S.temporaryCss(e,{display:"none"},function(){return up.layout.revealOrRestoreScroll(n,r),i=v(n,u),a=u.scrollTop()}),s.moveTop(a-l),e.hide(),p=S.temporaryCss(n,{opacity:"0"}),c=o(s.$ghost,i.$ghost),e.data(t,c),n.data(t,c),c.then(function(){return e.removeData(t),n.removeData(t),p(),s.$bounds.remove(),i.$bounds.remove()}),c},p=function(t){return e(t).each(function(){var t;return t=e(this),S.finishCssAnimate(t),f(t)})},f=function(e){var n;return(n=e.data(t))?(S.debug("Canceling existing ghosting on %o",e),"function"==typeof n.resolve?n.resolve():void 0):void 0},i=function(e,t){return S.isDeferred(e)?e:S.error("Did not return a promise with .then and .resolve methods: %o",t)},m=function(t,o,a,s){var l,c,f,h,v,g,w;return S.debug("Morphing %o to %o (using %o)",t,o,a),c=e(t),l=e(o),v=S.only(s,"reveal","restoreScroll","source"),v=S.extend(v,r(s)),d()?(p(c),p(l),"none"===a||a===!1||(f=u[a])?(h=b(c,l,v),h.then(function(){return n(l,f||"none",s)}),h):(w=S.presence(a,S.isFunction)||x[a])?C(c,l,v,function(e,t){var n;return n=w(e,t,v),i(n,a)}):S.isString(a)&&a.indexOf("/")>=0?(g=a.split("/"),w=function(e,t,r){return y(n(e,g[0],r),n(t,g[1],r))},m(c,l,w,v)):S.error("Unknown transition %o",a)):b(c,l,v)},b=function(e,t,n){return e.hide(),up.layout.revealOrRestoreScroll(t,n)},v=function(t,n){var r,o,u,i,a,s,l,c,p;for(i=S.measure(t,{relative:!0,inner:!0}),u=t.clone(),u.find("script").remove(),u.css({position:"static"===t.css("position")?"static":"relative",top:"",right:"",bottom:"",left:"",width:"100%",height:"100%"}),u.addClass("up-ghost"),r=e('<div class="up-bounds"></div>'),r.css({position:"absolute"}),r.css(i),p=i.top,c=function(e){return 0!==e?(p+=e,r.css({top:p})):void 0},u.appendTo(r),r.insertBefore(t),c(t.offset().top-u.offset().top),o=up.layout.fixedChildren(u),s=0,l=o.length;l>s;s++)a=o[s],S.fixedToAbsolute(a,n);return{$ghost:u,$bounds:r,moveTop:c}},k=function(e,t){return x[e]=t},o=function(e,t){return u[e]=t},w=function(){return s=S.copy(u),l=S.copy(x)},y=S.resolvableWhen,h=S.resolvedDeferred,o("none",h),o("fade-in",function(e,t){return e.css({opacity:0}),n(e,{opacity:1},t)}),o("fade-out",function(e,t){return e.css({opacity:1}),n(e,{opacity:0},t)}),o("move-to-top",function(e,t){var r,o;return r=S.measure(e),o=r.top+r.height,e.css({"margin-top":"0px"}),n(e,{"margin-top":"-"+o+"px"},t)}),o("move-from-top",function(e,t){var r,o;return r=S.measure(e),o=r.top+r.height,e.css({"margin-top":"-"+o+"px"}),n(e,{"margin-top":"0px"},t)}),o("move-to-bottom",function(e,t){var r,o;return r=S.measure(e),o=S.clientSize().height-r.top,e.css({"margin-top":"0px"}),n(e,{"margin-top":o+"px"},t)}),o("move-from-bottom",function(e,t){var r,o;return r=S.measure(e),o=S.clientSize().height-r.top,e.css({"margin-top":o+"px"}),n(e,{"margin-top":"0px"},t)}),o("move-to-left",function(e,t){var r,o;return r=S.measure(e),o=r.left+r.width,e.css({"margin-left":"0px"}),n(e,{"margin-left":"-"+o+"px"},t)}),o("move-from-left",function(e,t){var r,o;return r=S.measure(e),o=r.left+r.width,e.css({"margin-left":"-"+o+"px"}),n(e,{"margin-left":"0px"},t)}),o("move-to-right",function(e,t){var r,o;return r=S.measure(e),o=S.clientSize().width-r.left,e.css({"margin-left":"0px"}),n(e,{"margin-left":o+"px"},t)}),o("move-from-right",function(e,t){var r,o;
2
+ return r=S.measure(e),o=S.clientSize().width-r.left,e.css({"margin-left":o+"px"}),n(e,{"margin-left":"0px"},t)}),o("roll-down",function(e,t){var r,o;return r=e.height(),o=S.temporaryCss(e,{height:"0px",overflow:"hidden"}),n(e,{height:r+"px"},t).then(o)}),k("none",h),k("move-left",function(e,t,r){return y(n(e,"move-to-left",r),n(t,"move-from-right",r))}),k("move-right",function(e,t,r){return y(n(e,"move-to-right",r),n(t,"move-from-left",r))}),k("move-up",function(e,t,r){return y(n(e,"move-to-top",r),n(t,"move-from-bottom",r))}),k("move-down",function(e,t,r){return y(n(e,"move-to-bottom",r),n(t,"move-from-top",r))}),k("cross-fade",function(e,t,r){return y(n(e,"fade-out",r),n(t,"fade-in",r))}),up.on("up:framework:boot",w),up.on("up:framework:reset",g),{morph:m,animate:n,animateOptions:r,finish:p,transition:k,animation:o,config:a,isEnabled:d,defaults:function(){return S.error("up.motion.defaults(...) no longer exists. Set values on he up.motion.config property instead.")},none:h,when:y,prependCopy:v}}(jQuery),up.transition=up.motion.transition,up.animation=up.motion.animation,up.morph=up.motion.morph,up.animate=up.motion.animate}.call(this),function(){var e=[].slice;up.proxy=function(t){var n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g,y,b,w,k,x,S,C,T,E,$,A,P,U,O,D,M,j;return j=up.util,n=void 0,$=void 0,a=void 0,C=void 0,s=void 0,P=[],h=j.config({busyDelay:300,preloadDelay:75,cacheSize:70,cacheExpiry:3e5,maxRequests:4}),c=function(e){return S(e),[e.url,e.method,e.data,e.selector].join("|")},l=j.cache({size:function(){return h.cacheSize},expiry:function(){return h.cacheExpiry},key:c,log:"up.proxy"}),v=function(e){var t,n,r,o,u,i,a;for(e=S(e),n=[e],"html"!==e.selector&&(i=j.merge(e,{selector:"html"}),n.push(i),"body"!==e.selector&&(u=j.merge(e,{selector:"body"}),n.push(u))),r=0,o=n.length;o>r;r++)if(t=n[r],a=l.get(t))return a},D=l.set,U=l.remove,m=l.clear,f=function(){return clearTimeout($),$=null},p=function(){return clearTimeout(a),a=null},O=function(){return n=null,f(),p(),C=0,h.reset(),s=!1,l.clear(),P=[]},O(),u=l.alias,S=function(e){return e._normalized||(e.method=j.normalizeMethod(e.method),e.url&&(e.url=j.normalizeUrl(e.url)),e.selector||(e.selector="body"),e._normalized=!0),e},o=function(e){var t,n,r,o,u;return t=e.cache===!0,n=e.cache===!1,u=j.only(e,"url","method","data","selector","headers","_normalized"),r=!0,y(u)||t?(o=v(u))&&!n?r="pending"===o.state():(o=k(u),D(u,o),o.fail(function(){return U(u)})):(m(),o=k(u)),r&&!e.preload&&(x(),o.always(w)),o},r=["GET","OPTIONS","HEAD"],g=function(){return 0===C},i=function(){return C>0},x=function(){var e,t;return t=g(),C+=1,t?(e=function(){return i()?(up.emit("up:proxy:busy"),s=!0):void 0},h.busyDelay>0?a=setTimeout(e,h.busyDelay):e()):void 0},w=function(){return C-=1,g()&&s?(up.emit("up:proxy:idle"),s=!1):void 0},k=function(e){return C<h.maxRequests?b(e):A(e)},A=function(e){var n,r;return j.debug("Queuing URL %o",e.url),n=t.Deferred(),r={deferred:n,request:e},P.push(r),n.promise()},b=function(e){var t;return j.debug("Loading URL %o",e.url),up.emit("up:proxy:load",e),t=j.ajax(e),t.always(function(){return up.emit("up:proxy:received",e),T()}),t},T=function(){var t,n;return(t=P.shift())?(n=b(t.request),n.done(function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],(r=t.deferred).resolve.apply(r,n)}),n.fail(function(){var n,r;return n=1<=arguments.length?e.call(arguments,0):[],(r=t.deferred).reject.apply(r,n)})):void 0},y=function(e){return S(e),j.contains(r,e.method)},d=function(e){var t,r;return r=parseInt(j.presentAttr(e,"up-delay"))||h.preloadDelay,e.is(n)?void 0:(n=e,f(),t=function(){return E(e),n=null},M(t,r))},M=function(e,t){return $=setTimeout(e,t)},E=function(e,n){var r,o;return r=t(e),n=j.options(n),o=up.link.followMethod(r,n),y({method:o})?(j.debug("Preloading %o",r),n.preload=!0,up.follow(r,n)):(j.debug("Won't preload %o due to unsafe method %o",r,o),j.resolvedPromise())},up.on("mouseover mousedown touchstart","[up-preload]",function(e,t){return up.link.childClicked(e,t)?void 0:d(t)}),up.on("up:framework:reset",O),{preload:E,ajax:o,get:v,alias:u,clear:m,remove:U,idle:g,busy:i,config:h,defaults:function(){return j.error("up.proxy.defaults(...) no longer exists. Set values on he up.proxy.config property instead.")}}}(jQuery)}.call(this),function(){up.link=function($){var childClicked,follow,followMethod,makeFollowable,shouldProcessLinkEvent,u,visit;return u=up.util,visit=function(e,t){var n;return t=u.options(t),n=u.option(t.target,"body"),up.replace(n,e,t)},follow=function(e,t){var n,r,o;return n=$(e),t=u.options(t),o=u.option(n.attr("up-href"),n.attr("href")),r=u.option(t.target,n.attr("up-target"),"body"),t.transition=u.option(t.transition,u.castedAttr(n,"up-transition"),u.castedAttr(n,"up-animation")),t.history=u.option(t.history,u.castedAttr(n,"up-history")),t.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),t.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),t.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),t.method=followMethod(n,t),t.origin=u.option(t.origin,n),t=u.merge(t,up.motion.animateOptions(t,n)),up.replace(r,o,t)},followMethod=function(e,t){var n;return n=$(e),t=u.options(t),u.option(t.method,n.attr("up-method"),n.attr("data-method"),"get").toUpperCase()},up.on("click","a[up-target], [up-href][up-target]",function(e,t){return shouldProcessLinkEvent(e,t)?t.is("[up-instant]")?e.preventDefault():(e.preventDefault(),follow(t)):void 0}),up.on("mousedown","a[up-instant], [up-href][up-instant]",function(e,t){return shouldProcessLinkEvent(e,t)?(e.preventDefault(),follow(t)):void 0}),childClicked=function(e,t){var n,r;return n=$(e.target),r=n.closest("a, [up-href]"),r.length&&t.find(r).length},shouldProcessLinkEvent=function(e,t){return u.isUnmodifiedMouseEvent(e)&&!childClicked(e,t)},makeFollowable=function(e){var t;return t=$(e),u.isMissing(t.attr("up-target"))&&u.isMissing(t.attr("up-follow"))?t.attr("up-follow",""):void 0},up.on("click","a[up-follow], [up-href][up-follow]",function(e,t){return shouldProcessLinkEvent(e,t)?t.is("[up-instant]")?e.preventDefault():(e.preventDefault(),follow(t)):void 0}),up.compiler("[up-expand]",function(e){var t,n,r,o,i,a,s,l;for(o=e.find("a, [up-href]").get(0),o||u.error("No link to expand within %o",e),l=/^up-/,a={},a["up-href"]=$(o).attr("href"),s=o.attributes,n=0,r=s.length;r>n;n++)t=s[n],i=t.name,i.match(l)&&(a[i]=t.value);return u.setMissingAttrs(e,a),e.removeAttr("up-expand"),makeFollowable(e)}),up.compiler("[up-dash]",function(e){var t,n;return n=u.castedAttr(e,"up-dash"),t={"up-preload":"true","up-instant":"true"},n===!0?t["up-follow"]="":t["up-target"]=n,u.setMissingAttrs(e,t),e.removeAttr("up-dash")}),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,makeFollowable:makeFollowable,childClicked:childClicked,followMethod:followMethod}}(jQuery),up.visit=up.link.visit,up.follow=up.link.follow}.call(this),function(){var slice=[].slice;up.form=function($){var autosubmit,config,observe,observeForm,reset,resolveValidateTarget,submit,u,validate;return u=up.util,config=u.config({validateTargets:["[up-fieldset]:has(&)","fieldset:has(&)","label:has(&)","form:has(&)"],fields:[":input"],observeDelay:0}),reset=function(){return config.reset()},submit=function(e,t){var n,r,o,i,a,s,l,c,p,f,d,m,h,v;return n=$(e).closest("form"),t=u.options(t),f=u.option(t.target,n.attr("up-target"),"body"),f=up.flow.resolveSelector(f,t),r=u.option(t.failTarget,n.attr("up-fail-target"))||u.selectorForElement(n),r=up.flow.resolveSelector(r,t),s=u.option(t.history,u.castedAttr(n,"up-history"),!0),d=u.option(t.transition,u.castedAttr(n,"up-transition")),o=u.option(t.failTransition,u.castedAttr(n,"up-fail-transition"),d),l=u.option(t.method,n.attr("up-method"),n.attr("data-method"),n.attr("method"),"post").toUpperCase(),a=u.option(t.headers,{}),c={},c.reveal=u.option(t.reveal,u.castedAttr(n,"up-reveal"),!0),c.cache=u.option(t.cache,u.castedAttr(n,"up-cache")),c.restoreScroll=u.option(t.restoreScroll,u.castedAttr(n,"up-restore-scroll")),c.origin=u.option(t.origin,n),c=u.extend(c,up.motion.animateOptions(t,n)),v=u.option(t.cache,u.castedAttr(n,"up-cache")),h=u.option(t.url,n.attr("action"),up.browser.url()),i=n.find("input[type=file]").length,t.validate&&(a["X-Up-Validate"]=t.validate,i)?u.unresolvablePromise():(n.addClass("up-active"),i||!up.browser.canPushState()&&s!==!1?(n.get(0).submit(),u.unresolvablePromise()):(p={url:h,method:l,data:n.serialize(),selector:f,cache:v,headers:a},m=function(e){var t;return h=void 0,u.isGiven(s)&&(s===!1||u.isString(s)?h=s:(t=u.locationFromXhr(e))?h=t:"GET"===p.type&&(h=p.url+"?"+p.data)),u.option(h,!1)},up.proxy.ajax(p).always(function(){return n.removeClass("up-active")}).done(function(e,t,n){var r;return r=u.merge(c,{history:m(n),transition:d}),up.flow.implant(f,e,r)}).fail(function(e){var t,n;return n=e.responseText,t=u.merge(c,{transition:o}),up.flow.implant(r,n,t)})))},observe=function(){var $element,args,callback,callbackArg,callbackPromise,callbackTimer,changeEvents,check,clearTimer,delay,knownValue,nextCallback,options,rawCallback,runNextCallback,selectorOrElement;return selectorOrElement=arguments[0],args=2<=arguments.length?slice.call(arguments,1):[],options={},callbackArg=void 0,1===args.length&&(callbackArg=args[0]),args.length>1&&(options=u.options(args[0]),callbackArg=args[1]),$element=$(selectorOrElement),options=u.options(options),delay=u.option($element.attr("up-delay"),options.delay,config.observeDelay),delay=parseInt(delay),callback=null,u.isGiven(options.change)&&up.error("up.observe now takes the change callback as the last argument"),rawCallback=u.option(u.presentAttr($element,"op-observe"),callbackArg),callback=u.isString(rawCallback)?function(value,$field){return eval(rawCallback)}:rawCallback||u.error("up.observe: No change callback given"),$element.is("form")?observeForm($element,options,callback):(knownValue=null,callbackTimer=null,callbackPromise=u.resolvedPromise(),nextCallback=null,runNextCallback=function(){var e;return nextCallback?(e=nextCallback(),nextCallback=null,e):void 0},check=function(){var e,t;return t=$element.val(),e=u.isNull(knownValue),knownValue===t||(knownValue=t,e)?void 0:(clearTimer(),nextCallback=function(){return callback.apply($element.get(0),[t,$element])},callbackTimer=setTimeout(function(){return callbackPromise.then(function(){var e;return e=runNextCallback(),callbackPromise=u.isPromise(e)?e:u.resolvedPromise()})},delay))},clearTimer=function(){return clearTimeout(callbackTimer)},changeEvents=up.browser.canInputEvent()?"input change":"input change keypress paste cut click propertychange",$element.on(changeEvents,check),check(),function(){return $element.off(changeEvents,check),clearTimer()})},observeForm=function(e,t,n){var r,o;return r=u.multiSelector(config.fields).find(e),o=u.map(r,function(e){return observe(e,n)}),function(){var e,t,n,r;for(r=[],t=0,n=o.length;n>t;t++)e=o[t],r.push(e());return r}},autosubmit=function(e,t){return console.log("autosubmit %o",e),observe(e,t,function(e,t){var n;return n=t.closest("form"),t.addClass("up-active"),submit(n).always(function(){return t.removeClass("up-active")})})},resolveValidateTarget=function(e,t){var n;return n=u.option(t.target,e.attr("up-validate")),u.isBlank(n)&&(n||(n=u.detect(config.validateTargets,function(n){var r;return r=up.flow.resolveSelector(n,t),e.closest(r).length}))),u.isBlank(n)&&error("Could not find default validation target for %o (tried ancestors %o)",e,config.validateTargets),u.isString(n)||(n=u.selectorForElement(n)),n},validate=function(e,t){var n,r,o;return n=$(e),t=u.options(t),t.origin=n,t.target=resolveValidateTarget(n,t),t.failTarget=t.target,t.history=!1,t.headers=u.option(t.headers,{}),t.validate=n.attr("name")||"__none__",t=u.merge(t,up.motion.animateOptions(t,n)),r=n.closest("form"),o=up.submit(r,t)},up.on("submit","form[up-target]",function(e,t){return e.preventDefault(),submit(t)}),up.on("change","[up-validate]",function(e,t){return validate(t)}),up.compiler("[up-observe]",function(e){return observe(e)}),up.compiler("[up-autosubmit]",function(e){return autosubmit(e)}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),config:config,submit:submit,observe:observe,validate:validate}}(jQuery),up.submit=up.form.submit,up.observe=up.form.observe,up.autosubmit=up.form.autosubmit,up.validate=up.form.validate}.call(this),function(){up.popup=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h;return m=up.util,s=void 0,i=function(){var t;return t=e(".up-popup"),t.attr("up-covered-url")},o=m.config({openAnimation:"fade-in",closeAnimation:"fade-out",position:"bottom-right",history:!1}),f=function(){return r(),o.reset()},d=function(e,t,n){var r,o;return o=m.measure(e,{full:!0}),r=function(){switch(n){case"bottom-right":return{right:o.right,top:o.top+o.height};case"bottom-left":return{left:o.left,top:o.top+o.height};case"top-right":return{right:o.right,bottom:o.top};case"top-left":return{left:o.left,bottom:o.top};default:return m.error("Unknown position %o",n)}}(),t.attr("up-position",n),t.css(r),c(t)},c=function(e){var t,n,r,o,u,i,a;if(n=m.measure(e,{full:!0}),r=null,o=null,n.right<0&&(r=-n.right),n.bottom<0&&(o=-n.bottom),n.left<0&&(r=n.left),n.top<0&&(o=n.top),r&&((u=parseInt(e.css("left")))?e.css("left",u-r):(i=parseInt(e.css("right")))&&e.css("right",i+r)),o){if(a=parseInt(e.css("top")))return e.css("top",a-o);if(t=parseInt(e.css("bottom")))return e.css("bottom",t+o)}},p=function(){var t;return t=e(".up-popup"),t.attr("up-covered-url",up.browser.url()),t.attr("up-covered-title",document.title)},l=function(){var t;return t=e(".up-popup"),t.removeAttr("up-covered-url"),t.removeAttr("up-covered-title")},a=function(e,t,n){var r,o;return o=m.$createElementFromSelector(".up-popup"),n&&o.attr("up-sticky",""),r=m.$createElementFromSelector(t),r.appendTo(o),o.appendTo(document.body),p(),o.hide(),o},h=function(t,n,r,o){var u,i;return u=e(".up-popup"),u.is(":hidden")?(u.show(),d(t,u,n),i=up.animate(u,r,o),i.then(function(){return up.emit("up:popup:opened")})):void 0},t=function(t,n){var u,i,s,l,c,p,f,d,v;return u=e(t),u.length||m.error("Cannot attach popup to non-existing element %o",t),n=m.options(n),v=m.option(n.url,u.attr("href")),f=m.option(n.target,u.attr("up-popup"),"body"),c=m.option(n.position,u.attr("up-position"),o.position),s=m.option(n.animation,u.attr("up-animation"),o.openAnimation),d=m.option(n.sticky,m.castedAttr(u,"up-sticky")),l=up.browser.canPushState()?m.option(n.history,m.castedAttr(u,"up-history"),o.history):!1,i=up.motion.animateOptions(n,u),r(),up.bus.nobodyPrevents("up:popup:open",{url:v})?(a(u,f,d),p=up.replace(f,v,{history:l,requireMatch:!1}),p.then(function(){return h(u,c,s,i)}),p):m.unresolvableDeferred()},r=function(t){var n,r;return n=e(".up-popup"),n.length?up.bus.nobodyPrevents("up:popup:close",{$element:n})?(t=m.options(t,{animation:o.closeAnimation,url:n.attr("up-covered-url"),title:n.attr("up-covered-title")}),s=void 0,r=up.destroy(n,t),r.then(function(){return up.emit("up:popup:closed")}),r):m.unresolvableDeferred():m.resolvedDeferred()},n=function(){return e(".up-popup").is("[up-sticky]")?void 0:(l(),r())},u=function(t){var n;return n=e(t),n.closest(".up-popup").length>0},up.on("click","a[up-popup]",function(e,n){return e.preventDefault(),n.is(".up-current")?r():t(n)}),up.on("click","body",function(t){var n;return n=e(t.target),n.closest(".up-popup").length||n.closest("[up-popup]").length?void 0:r()}),up.on("up:fragment:inserted",function(e,t){var r;if(u(t)){if(r=t.attr("up-source"))return s=r}else if(u(e.origin))return n()}),up.bus.onEscape(function(){return r()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-popup").length?(r(),e.preventDefault()):void 0}),up.on("up:framework:reset",f),{attach:t,close:r,url:function(){return s},coveredUrl:i,config:o,defaults:function(){return m.error("up.popup.defaults(...) no longer exists. Set values on he up.popup.config property instead.")},contains:u,open:function(){return up.error("up.popup.open no longer exists. Please use up.popup.attach instead.")},source:function(){return up.error("up.popup.source no longer exists. Please use up.popup.url instead.")}}}(jQuery)}.call(this),function(){up.modal=function($){var autoclose,close,config,contains,coveredUrl,createHiddenModal,currentUrl,discardHistory,follow,open,rememberHistory,reset,shiftElements,templateHtml,u,unshiftElements,updated,visit;return u=up.util,config=u.config({maxWidth:null,minWidth:null,width:null,height:null,history:!0,openAnimation:"fade-in",closeAnimation:"fade-out",closeLabel:"\xd7",template:function(e){return'<div class="up-modal">\n <div class="up-modal-dialog">\n <div class="up-modal-close" up-close>'+e.closeLabel+'</div>\n <div class="up-modal-content"></div>\n </div>\n</div>'}}),currentUrl=void 0,coveredUrl=function(){var e;return e=$(".up-modal"),e.attr("up-covered-url")},reset=function(){return close(),currentUrl=void 0,config.reset()},templateHtml=function(){var e;return e=config.template,u.isFunction(e)?e(config):e},rememberHistory=function(){var e;return e=$(".up-modal"),e.attr("up-covered-url",up.browser.url()),e.attr("up-covered-title",document.title)},discardHistory=function(){var e;return e=$(".up-modal"),e.removeAttr("up-covered-url"),e.removeAttr("up-covered-title")},createHiddenModal=function(e){var t,n,r,o;return r=$(templateHtml()),e.sticky&&r.attr("up-sticky",""),r.attr("up-covered-url",up.browser.url()),r.attr("up-covered-title",document.title),n=r.find(".up-modal-dialog"),u.isPresent(e.width)&&n.css("width",e.width),u.isPresent(e.maxWidth)&&n.css("max-width",e.maxWidth),u.isPresent(e.height)&&n.css("height",e.height),t=r.find(".up-modal-content"),o=u.$createElementFromSelector(e.selector),o.appendTo(t),r.appendTo(document.body),rememberHistory(),r.hide(),r},unshiftElements=[],shiftElements=function(){var e,t,n,r;return n=u.scrollbarWidth(),e=parseInt($("body").css("padding-right")),t=n+e,r=u.temporaryCss($("body"),{"padding-right":t+"px","overflow-y":"hidden"}),unshiftElements.push(r),up.layout.anchoredRight().each(function(){var e,t,r,o;return e=$(this),t=parseInt(e.css("right")),r=n+t,o=u.temporaryCss(e,{right:r}),unshiftElements.push(o)})},updated=function(e,t){var n,r;return n=$(".up-modal"),n.is(":hidden")?(shiftElements(),n.show(),r=up.animate(n,e,t),r.then(function(){return up.emit("up:modal:opened")})):void 0},follow=function(e,t){return t=u.options(t),t.$link=$(e),open(t)},visit=function(e,t){return t=u.options(t),t.url=e,open(t)},open=function(e){var t,n,r,o,i,a,s,l,c,p,f;return e=u.options(e),t=u.option(e.$link,u.nullJQuery()),p=u.option(e.url,t.attr("up-href"),t.attr("href")),l=u.option(e.target,t.attr("up-modal"),"body"),f=u.option(e.width,t.attr("up-width"),config.width),a=u.option(e.maxWidth,t.attr("up-max-width"),config.maxWidth),o=u.option(e.height,t.attr("up-height"),config.height),r=u.option(e.animation,t.attr("up-animation"),config.openAnimation),c=u.option(e.sticky,u.castedAttr(t,"up-sticky")),i=up.browser.canPushState()?u.option(e.history,u.castedAttr(t,"up-history"),config.history):!1,n=up.motion.animateOptions(e,t),close(),up.bus.nobodyPrevents("up:modal:open",{url:p})?(createHiddenModal({selector:l,width:f,maxWidth:a,height:o,sticky:c}),s=up.replace(l,p,{history:i,requireMatch:!1}),s.then(function(){return updated(r,n)}),s):u.unresolvableDeferred()},close=function(e){var t,n;return t=$(".up-modal"),t.length?up.bus.nobodyPrevents("up:modal:close",{$element:t})?(e=u.options(e,{animation:config.closeAnimation,url:t.attr("up-covered-url"),title:t.attr("up-covered-title")}),currentUrl=void 0,n=up.destroy(t,e),n.then(function(){for(var e;e=unshiftElements.pop();)e();return up.emit("up:modal:closed")}),n):u.unresolvableDeferred():u.resolvedDeferred()},autoclose=function(){return $(".up-modal").is("[up-sticky]")?void 0:(discardHistory(),close())},contains=function(e){var t;return t=$(e),t.closest(".up-modal").length>0},up.on("click","a[up-modal]",function(e,t){return e.preventDefault(),t.is(".up-current")?close():follow(t)}),up.on("click","body",function(e){var t;return t=$(e.target),t.closest(".up-modal-dialog").length||t.closest("[up-modal]").length?void 0:close()}),up.on("up:fragment:inserted",function(e,t){var n;if(contains(t)){if(n=t.attr("up-source"))return currentUrl=n}else if(!up.popup.contains(t)&&contains(e.origin))return autoclose()}),up.bus.onEscape(function(){return close()}),up.on("click","[up-close]",function(e,t){return t.closest(".up-modal").length?(close(),e.preventDefault()):void 0}),up.on("up:framework:reset",reset),{knife:eval("undefined"!=typeof Knife&&null!==Knife?Knife.point:void 0),visit:visit,follow:follow,open:function(){return up.error("up.modal.open no longer exists. Please use either up.modal.follow or up.modal.visit.")},close:close,url:function(){return currentUrl},coveredUrl:coveredUrl,config:config,defaults:function(){return u.error("up.modal.defaults(...) no longer exists. Set values on he up.modal.config property instead.")},contains:contains,source:function(){return up.error("up.popup.source no longer exists. Please use up.popup.url instead.")}}}(jQuery)}.call(this),function(){up.tooltip=function(e){var t,n,r,o,u,i,a;return a=up.util,r=a.config({position:"top",openAnimation:"fade-in",closeAnimation:"fade-out"}),u=function(){return r.reset()},i=function(e,t,n){var r,o,u;return o=a.measure(e),u=a.measure(t),r=function(){switch(n){case"top":return{left:o.left+.5*(o.width-u.width),top:o.top-u.height};case"bottom":return{left:o.left+.5*(o.width-u.width),top:o.top+o.height};default:return a.error("Unknown position %o",n)}}(),t.attr("up-position",n),t.css(r)},o=function(e){var t;return t=a.$createElementFromSelector(".up-tooltip"),a.isGiven(e.text)?t.text(e.text):t.html(e.html),t.appendTo(document.body),t},t=function(t,u){var s,l,c,p,f,d,m;return null==u&&(u={}),s=e(t),f=a.option(u.html,s.attr("up-tooltip-html")),m=a.option(u.text,s.attr("up-tooltip")),d=a.option(u.position,s.attr("up-position"),r.position),p=a.option(u.animation,a.castedAttr(s,"up-animation"),r.openAnimation),c=up.motion.animateOptions(u,s),n(),l=o({text:m,html:f}),i(s,l,d),up.animate(l,p,c)},n=function(t){var n;return n=e(".up-tooltip"),n.length?(t=a.options(t,{animation:r.closeAnimation}),t=a.merge(t,up.motion.animateOptions(t)),up.destroy(n,t)):void 0},up.compiler("[up-tooltip], [up-tooltip-html]",function(e){return e.on("mouseover",function(){return t(e)}),e.on("mouseout",function(){return n()})}),up.on("click","body",function(){return n()}),up.on("up:framework:reset",n),up.bus.onEscape(function(){return n()}),up.on("up:framework:reset",u),{attach:t,close:n,open:function(){return a.error("up.tooltip.open no longer exists. Use up.tooltip.attach instead.")}}}(jQuery)}.call(this),function(){up.navigation=function(e){var t,n,r,o,u,i,a,s,l,c,p,f,d,m,h,v,g;return h=up.util,i=h.config({currentClasses:["up-current"]}),p=function(){return i.reset()},a=function(){var e;return e=i.currentClasses,e=e.concat(["up-current"]),e=h.uniq(e),e.join(" ")},t="up-active",n=["a","[up-href]","[up-alias]"],o=n.join(", "),u=function(){var e,t,r;for(r=[],e=0,t=n.length;t>e;e++)m=n[e],r.push(m+"[up-instant]");return r}().join(", "),r="."+t,c=function(e){return h.isPresent(e)?h.normalizeUrl(e,{search:!1,stripTrailingSlash:!0}):void 0},d=function(e){var t,n,r,o,u,i,a,s,l,p;for(s=[],i=["href","up-href","up-alias"],n=0,o=i.length;o>n;n++)if(t=i[n],l=h.presentAttr(e,t))for(p="up-alias"===t?l.split(" "):[l],r=0,u=p.length;u>r;r++)a=p[r],"#"!==a&&(a=c(a),s.push(a));return s},g=function(e){var t,n,r,o;return e=h.compact(e),r=function(e){return"*"===e.substr(-1)?n(e.slice(0,-1)):t(e)},t=function(t){return h.contains(e,t)},n=function(t){return h.detect(e,function(e){return 0===e.indexOf(t)})},o=function(e){return h.detect(e,r)},{matchesAny:o}},l=function(){var t,n;return t=g([c(up.browser.url()),c(up.modal.url()),c(up.modal.coveredUrl()),c(up.popup.url()),c(up.popup.coveredUrl())]),n=a(),h.each(e(o),function(r){var o,u;return o=e(r),u=d(o),t.matchesAny(u)?o.addClass(n):o.hasClass(n)&&0===o.closest(".up-destroying").length?o.removeClass(n):void 0})},f=function(e){return v(),e=s(e),e.addClass(t)},s=function(e){return h.presence(e.parents(o))||e},v=function(){return e(r).removeClass(t)},up.on("click",o,function(e,t){return h.isUnmodifiedMouseEvent(e)&&!t.is("[up-instant]")?f(t):void 0}),up.on("mousedown",u,function(e,t){return h.isUnmodifiedMouseEvent(e)?f(t):void 0}),up.on("up:fragment:inserted",function(){return v(),l()}),up.on("up:fragment:destroyed",function(e,t){return t.is(".up-modal, .up-popup")?l():void 0}),up.on("up:framework:reset",p),{config:i,defaults:function(){return h.error("up.navigation.defaults(...) no longer exists. Set values on he up.navigation.config property instead.")}}}(jQuery)}.call(this),function(){up.boot()}.call(this);
@@ -146,6 +146,9 @@ up.flow = (($) ->
146
146
  @param {Object} [options.headers={}]
147
147
  An object of additional header key/value pairs to send along
148
148
  with the request.
149
+ @param {Boolean} [options.requireMatch=true]
150
+ Whether to raise an error if the given selector is missing in
151
+ either the current page or in the response.
149
152
  @return {Promise}
150
153
  A promise that will be resolved when the page has been updated.
151
154
  @stable
@@ -232,33 +235,36 @@ up.flow = (($) ->
232
235
  implant = (selectorOrElement, html, options) ->
233
236
  selector = resolveSelector(selectorOrElement, options)
234
237
  options = u.options(options,
235
- historyMethod: 'push'
238
+ historyMethod: 'push',
239
+ requireMatch: true
236
240
  )
237
241
  options.source = u.option(options.source, options.history)
238
- response = parseResponse(html)
242
+ response = parseResponse(html, options)
239
243
  options.title ||= response.title()
240
244
 
241
245
  up.layout.saveScroll() unless options.saveScroll == false
242
246
 
243
247
  for step in parseImplantSteps(selector, options)
244
- $old = findOldFragment(step.selector)
245
- $new = response.find(step.selector).first()
246
- swapElements($old, $new, step.pseudoClass, step.transition, options)
248
+ $old = findOldFragment(step.selector, options)
249
+ $new = response.find(step.selector)?.first()
250
+ if $old && $new
251
+ swapElements($old, $new, step.pseudoClass, step.transition, options)
247
252
 
248
- findOldFragment = (selector) ->
253
+ findOldFragment = (selector, options) ->
249
254
  # Prefer to replace fragments in an open popup or modal
250
255
  first(".up-popup #{selector}") ||
251
256
  first(".up-modal #{selector}") ||
252
257
  first(selector) ||
253
- fragmentNotFound(selector)
258
+ oldFragmentNotFound(selector, options)
254
259
 
255
- fragmentNotFound = (selector) ->
256
- message = 'Could not find selector %o in current body HTML'
257
- if message[0] == '#'
258
- message += ' (avoid using IDs)'
259
- u.error(message, selector)
260
+ oldFragmentNotFound = (selector, options) ->
261
+ if options.requireMatch
262
+ message = 'Could not find selector %o in current body HTML'
263
+ if message[0] == '#'
264
+ message += ' (avoid using IDs)'
265
+ u.error(message, selector)
260
266
 
261
- parseResponse = (html) ->
267
+ parseResponse = (html, options) ->
262
268
  # jQuery cannot construct transient elements that contain <html> or <body> tags
263
269
  htmlElement = u.createElementFromHtml(html)
264
270
  title: -> htmlElement.querySelector("title")?.textContent
@@ -270,11 +276,10 @@ up.flow = (($) ->
270
276
  # It returns an array of DOM elements, NOT a jQuery collection.
271
277
  if child = $.find(selector, htmlElement)[0]
272
278
  $(child)
273
- else
279
+ else if options.requireMatch
274
280
  u.error("Could not find selector %o in response %o", selector, html)
275
281
 
276
282
  elementsInserted = ($new, options) ->
277
- options.insert?($new)
278
283
  if options.history
279
284
  document.title = options.title if options.title
280
285
  up.history[options.historyMethod](options.history)
@@ -283,9 +288,9 @@ up.flow = (($) ->
283
288
  unless options.source is false
284
289
  setSource($new, options.source)
285
290
  autofocus($new)
286
- # The fragment should be readiet before animating,
291
+ # The fragment should be compiled before animating,
287
292
  # so transitions see .up-current classes
288
- up.hello($new)
293
+ up.hello($new, origin: options.origin)
289
294
 
290
295
  swapElements = ($old, $new, pseudoClass, transition, options) ->
291
296
  transition ||= 'none'
@@ -619,7 +619,7 @@ up.form = (($) ->
619
619
  You can change this default behavior by setting `up.config.validateTargets`:
620
620
 
621
621
  // Always update the entire form containing the current field ("&")
622
- up.config.validateTargets = ['form &']
622
+ up.form.config.validateTargets = ['form &']
623
623
 
624
624
  You can also individually override what to update by setting the `up-validate`
625
625
  attribute to a CSS selector:
@@ -43,7 +43,7 @@ configure Up.js to [use a different HTML structure](/up.modal.config).
43
43
  \#\#\#\# Closing behavior
44
44
 
45
45
  By default the dialog automatically closes
46
- *whenever a page fragment below the dialog is updated*.
46
+ *whenever a page fragment behind the dialog is updated*.
47
47
  This is useful to have the dialog interact with the page that
48
48
  opened it, e.g. by updating parts of a larger form or by signing in a user
49
49
  and revealing additional information.
@@ -94,6 +94,8 @@ up.modal = (($) ->
94
94
  @param {String} [config.closeAnimation='fade-out']
95
95
  The animation used to close the modal. The animation will be applied
96
96
  to both the dialog box and the overlay dimming the page.
97
+ @param {String} [config.history=true]
98
+ Whether opening a modal will add a browser history entry.
97
99
  @stable
98
100
  ###
99
101
  config = u.config
@@ -101,6 +103,7 @@ up.modal = (($) ->
101
103
  minWidth: null
102
104
  width: null
103
105
  height: null
106
+ history: true
104
107
  openAnimation: 'fade-in'
105
108
  closeAnimation: 'fade-out'
106
109
  closeLabel: '×'
@@ -126,7 +129,7 @@ up.modal = (($) ->
126
129
  currentUrl = undefined
127
130
 
128
131
  ###*
129
- Returns the URL of the page below the modal overlay.
132
+ Returns the URL of the page behind the modal overlay.
130
133
 
131
134
  @function up.modal.coveredUrl
132
135
  @return {String}
@@ -200,11 +203,13 @@ up.modal = (($) ->
200
203
  unshiftElement = u.temporaryCss($element, 'right': elementRightShift)
201
204
  unshiftElements.push(unshiftElement)
202
205
 
203
- updated = ($modal, animation, animateOptions) ->
204
- shiftElements()
205
- $modal.show()
206
- deferred = up.animate($modal, animation, animateOptions)
207
- deferred.then -> up.emit('up:modal:opened')
206
+ updated = (animation, animateOptions) ->
207
+ $modal = $('.up-modal')
208
+ if $modal.is(':hidden')
209
+ shiftElements()
210
+ $modal.show()
211
+ deferred = up.animate($modal, animation, animateOptions)
212
+ deferred.then -> up.emit('up:modal:opened')
208
213
 
209
214
  ###*
210
215
  Opens the given link's destination in a modal overlay:
@@ -268,7 +273,7 @@ up.modal = (($) ->
268
273
  The CSS selector to extract from the response.
269
274
  The extracted content will be placed into the dialog window.
270
275
  @param {Object} options
271
- See options for [previous `up.modal.open` variant](/up.modal.open).
276
+ See options for [`up.modal.follow`](/up.modal.follow).
272
277
  @return {Promise}
273
278
  A promise that will be resolved when the popup has been loaded and rendered.
274
279
  @stable
@@ -295,21 +300,21 @@ up.modal = (($) ->
295
300
  # Although we usually fall back to full page loads if a browser doesn't support pushState,
296
301
  # in the case of modals we assume that the developer would rather see a dialog
297
302
  # without an URL update.
298
- history = if up.browser.canPushState() then u.option(options.history, u.castedAttr($link, 'up-history'), true) else false
303
+ history = if up.browser.canPushState() then u.option(options.history, u.castedAttr($link, 'up-history'), config.history) else false
299
304
  animateOptions = up.motion.animateOptions(options, $link)
300
305
 
301
306
  close()
302
307
 
303
308
  if up.bus.nobodyPrevents('up:modal:open', url: url)
304
- $modal = createHiddenModal
309
+ createHiddenModal
305
310
  selector: selector
306
311
  width: width
307
312
  maxWidth: maxWidth
308
313
  height: height
309
314
  sticky: sticky
310
- up.replace selector, url,
311
- history: history
312
- insert: -> updated($modal, animation, animateOptions)
315
+ promise = up.replace(selector, url, history: history, requireMatch: false)
316
+ promise.then -> updated(animation, animateOptions)
317
+ promise
313
318
  else
314
319
  # Although someone prevented the destruction, keep a uniform API for
315
320
  # callers by returning a Deferred that will never be resolved.
@@ -445,7 +450,7 @@ up.modal = (($) ->
445
450
  if contains($fragment)
446
451
  if newSource = $fragment.attr('up-source')
447
452
  currentUrl = newSource
448
- else if !up.popup.contains($fragment)
453
+ else if !up.popup.contains($fragment) && contains(event.origin)
449
454
  autoclose()
450
455
  )
451
456
 
@@ -44,18 +44,41 @@ up.motion = (($) ->
44
44
  @param {Number} [config.duration=300]
45
45
  @param {Number} [config.delay=0]
46
46
  @param {String} [config.easing='ease']
47
+ @param {Boolean} [config.enabled=true]
48
+ Whether animation is enabled.
49
+
50
+ Set this to `false` to disable animation globally.
51
+ This can be useful in full-stack integration tests like a Selenium test suite.
52
+
53
+ Regardless of this setting, all animations will be skipped on browsers
54
+ that do not support [CSS transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions).
47
55
  @stable
48
56
  ###
49
57
  config = u.config
50
58
  duration: 300
51
59
  delay: 0
52
60
  easing: 'ease'
61
+ enabled: true
53
62
 
54
63
  reset = ->
55
64
  animations = u.copy(defaultAnimations)
56
65
  transitions = u.copy(defaultTransitions)
57
66
  config.reset()
58
67
 
68
+ ###*
69
+ Returns whether Up.js will perform animations.
70
+
71
+ Animations will be performed if the browser supports
72
+ [CSS transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions)
73
+ and if [`up.motion.config.enabled`](/up.motion.config) is set to `true` (which is the default).
74
+
75
+ @function up.motion.isEnabled
76
+ @return {Boolean}
77
+ @stable
78
+ ###
79
+ isEnabled = ->
80
+ config.enabled && up.browser.canCssTransition()
81
+
59
82
  ###*
60
83
  Applies the given animation to the given element.
61
84
 
@@ -138,7 +161,12 @@ up.motion = (($) ->
138
161
  else if u.isString(animation)
139
162
  animate($element, findAnimation(animation), options)
140
163
  else if u.isHash(animation)
141
- u.cssAnimate($element, animation, options)
164
+ if isEnabled()
165
+ u.cssAnimate($element, animation, options)
166
+ else
167
+ # Directly set the last frame
168
+ $element.css(animation)
169
+ u.resolvedDeferred()
142
170
  else
143
171
  u.error("Unknown animation type %o", animation)
144
172
 
@@ -324,7 +352,7 @@ up.motion = (($) ->
324
352
  parsedOptions = u.only(options, 'reveal', 'restoreScroll', 'source')
325
353
  parsedOptions = u.extend(parsedOptions, animateOptions(options))
326
354
 
327
- if up.browser.canCssTransition()
355
+ if isEnabled()
328
356
  finish($old)
329
357
  finish($new)
330
358
 
@@ -636,6 +664,7 @@ up.motion = (($) ->
636
664
  transition: transition
637
665
  animation: animation
638
666
  config: config
667
+ isEnabled: isEnabled
639
668
  defaults: -> u.error('up.motion.defaults(...) no longer exists. Set values on he up.motion.config property instead.')
640
669
  none: none
641
670
  when: resolvableWhen
@@ -31,7 +31,7 @@ By default the popup uses the following DOM structure:
31
31
  The popup closes when the user clicks anywhere outside the popup area.
32
32
 
33
33
  By default the popup also closes
34
- *whenever a page fragment below the popup is updated*.
34
+ *whenever a page fragment behind the popup is updated*.
35
35
  This is useful to have the popup interact with the page that
36
36
  opened it, e.g. by updating parts of a larger form or by signing in a user
37
37
  and revealing additional information.
@@ -58,7 +58,7 @@ up.popup = (($) ->
58
58
  currentUrl = undefined
59
59
 
60
60
  ###*
61
- Returns the URL of the page or modal below the popup.
61
+ Returns the URL of the page or modal behind the popup.
62
62
 
63
63
  @function up.popup.coveredUrl
64
64
  @return {String}
@@ -80,12 +80,15 @@ up.popup = (($) ->
80
80
  Defines where the popup is attached to the opening element.
81
81
 
82
82
  Valid values are `bottom-right`, `bottom-left`, `top-right` and `top-left`.
83
+ @param {String} [config.history=false]
84
+ Whether opening a popup will add a browser history entry.
83
85
  @stable
84
86
  ###
85
87
  config = u.config
86
88
  openAnimation: 'fade-in'
87
89
  closeAnimation: 'fade-out'
88
90
  position: 'bottom-right'
91
+ history: false
89
92
 
90
93
  reset = ->
91
94
  close()
@@ -99,7 +102,7 @@ up.popup = (($) ->
99
102
  top: linkBox.top + linkBox.height
100
103
  when "bottom-left"
101
104
  left: linkBox.left
102
- top: linkBox.bottom + linkBox.height
105
+ top: linkBox.top + linkBox.height
103
106
  when "top-right"
104
107
  right: linkBox.right
105
108
  bottom: linkBox.top
@@ -158,13 +161,14 @@ up.popup = (($) ->
158
161
  $popup.hide()
159
162
  $popup
160
163
 
161
- updated = ($link, $popup, position, animation, animateOptions) ->
162
- $popup.show()
163
- setPosition($link, $popup, position)
164
- deferred = up.animate($popup, animation, animateOptions)
165
- deferred.then -> up.emit('up:popup:opened')
166
- deferred
167
-
164
+ updated = ($link, position, animation, animateOptions) ->
165
+ $popup = $('.up-popup')
166
+ if $popup.is(':hidden')
167
+ $popup.show()
168
+ setPosition($link, $popup, position)
169
+ deferred = up.animate($popup, animation, animateOptions)
170
+ deferred.then -> up.emit('up:popup:opened')
171
+
168
172
  ###*
169
173
  Attaches a popup overlay to the given element or selector.
170
174
 
@@ -174,6 +178,9 @@ up.popup = (($) ->
174
178
  @param {Element|jQuery|String} elementOrSelector
175
179
  @param {String} [options.url]
176
180
  @param {String} [options.position='bottom-right']
181
+ Defines where the popup is attached to the opening element.
182
+
183
+ Valid values are `bottom-right`, `bottom-left`, `top-right` and `top-left`.
177
184
  @param {String} [options.animation]
178
185
  The animation to use when opening the popup.
179
186
  @param {Number} [options.duration]
@@ -192,6 +199,7 @@ up.popup = (($) ->
192
199
  ###
193
200
  attach = (linkOrSelector, options) ->
194
201
  $link = $(linkOrSelector)
202
+ $link.length or u.error('Cannot attach popup to non-existing element %o', linkOrSelector)
195
203
 
196
204
  options = u.options(options)
197
205
  url = u.option(options.url, $link.attr('href'))
@@ -199,18 +207,16 @@ up.popup = (($) ->
199
207
  position = u.option(options.position, $link.attr('up-position'), config.position)
200
208
  animation = u.option(options.animation, $link.attr('up-animation'), config.openAnimation)
201
209
  sticky = u.option(options.sticky, u.castedAttr($link, 'up-sticky'))
202
- history = if up.browser.canPushState() then u.option(options.history, u.castedAttr($link, 'up-history'), false) else false
210
+ history = if up.browser.canPushState() then u.option(options.history, u.castedAttr($link, 'up-history'), config.history) else false
203
211
  animateOptions = up.motion.animateOptions(options, $link)
204
212
 
205
213
  close()
206
214
 
207
215
  if up.bus.nobodyPrevents('up:popup:open', url: url)
208
- $popup = createHiddenPopup($link, selector, sticky)
209
-
210
- up.replace(selector, url,
211
- history: history
212
- insert: -> updated($link, $popup, position, animation, animateOptions)
213
- )
216
+ createHiddenPopup($link, selector, sticky)
217
+ promise = up.replace(selector, url, history: history, requireMatch: false)
218
+ promise.then -> updated($link, position, animation, animateOptions)
219
+ promise
214
220
  else
215
221
  # Although someone prevented the destruction, keep a uniform API for
216
222
  # callers by returning a Deferred that will never be resolved.
@@ -309,14 +315,19 @@ up.popup = (($) ->
309
315
  <a href="/decks" up-popup=".deck_list">Switch deck</a>
310
316
 
311
317
  If the `up-sticky` attribute is set, the dialog does not auto-close
312
- if a page fragment below the popup overlay updates:
318
+ if a page fragment behind the popup overlay updates:
313
319
 
314
320
  <a href="/decks" up-popup=".deck_list">Switch deck</a>
315
321
  <a href="/settings" up-popup=".options" up-sticky>Settings</a>
316
322
 
317
323
  @selector a[up-popup]
318
- @param [up-sticky]
319
324
  @param [up-position]
325
+ Defines where the popup is attached to the opening element.
326
+
327
+ Valid values are `bottom-right`, `bottom-left`, `top-right` and `top-left`.
328
+ @param [up-sticky]
329
+ If set to `true`, the popup remains
330
+ open even if the page changes in the background.
320
331
  @stable
321
332
  ###
322
333
  up.on('click', 'a[up-popup]', (event, $link) ->
@@ -339,7 +350,7 @@ up.popup = (($) ->
339
350
  if contains($fragment)
340
351
  if newSource = $fragment.attr('up-source')
341
352
  currentUrl = newSource
342
- else
353
+ else if contains(event.origin)
343
354
  autoclose()
344
355
  )
345
356
 
@@ -63,6 +63,8 @@ up.proxy = (($) ->
63
63
  pendingCount = undefined
64
64
  busyEventEmitted = undefined
65
65
 
66
+ queuedRequests = []
67
+
66
68
  ###*
67
69
  @property up.proxy.config
68
70
  @param {Number} [config.preloadDelay=75]
@@ -77,6 +79,15 @@ up.proxy = (($) ->
77
79
  @param {Number} [config.busyDelay=300]
78
80
  How long the proxy waits until emitting the [`up:proxy:busy` event](/up:proxy:busy).
79
81
  Use this to prevent flickering of spinners.
82
+ @param {Number} [config.maxRequests=4]
83
+ The maximum number of concurrent requests to allow before additional
84
+ requests are queued. This currently ignores preloading requests.
85
+
86
+ You might find it useful to set this to `1` in full-stack integration
87
+ tests (e.g. Selenium).
88
+
89
+ Note that your browser might [impose its own request limit](http://www.browserscope.org/?category=network)
90
+ regardless of what you configure here.
80
91
  @stable
81
92
  ###
82
93
  config = u.config
@@ -84,6 +95,7 @@ up.proxy = (($) ->
84
95
  preloadDelay: 75
85
96
  cacheSize: 70
86
97
  cacheExpiry: 1000 * 60 * 5
98
+ maxRequests: 4
87
99
 
88
100
  cacheKey = (request) ->
89
101
  normalizeRequest(request)
@@ -178,6 +190,7 @@ up.proxy = (($) ->
178
190
  config.reset()
179
191
  busyEventEmitted = false
180
192
  cache.clear()
193
+ queuedRequests = []
181
194
 
182
195
  reset()
183
196
 
@@ -229,23 +242,26 @@ up.proxy = (($) ->
229
242
 
230
243
  pending = true
231
244
 
232
- # We don't cache non-GET responses unless `options.cache`
233
- # is explicitly set to `true`.
245
+ # Non-GET requests always touch the network
246
+ # unless `options.cache` is explicitly set to `true`.
247
+ # These requests are never cached.
234
248
  if !isIdempotent(request) && !forceCache
235
249
  clear()
236
- promise = load(request)
237
- # If a cached response is available, we use it unless
238
- # `options.cache` is explicitly set to `false`.
250
+ promise = loadOrQueue(request)
251
+ # If we have an existing promise matching this new request,
252
+ # we use it unless `options.cache` is explicitly set to `false`.
253
+ # The promise might still be pending.
239
254
  else if (promise = get(request)) && !ignoreCache
240
255
  pending = (promise.state() == 'pending')
256
+ # If no existing promise is available, we make a network request.
241
257
  else
242
- promise = load(request)
258
+ promise = loadOrQueue(request)
243
259
  set(request, promise)
244
260
  # Don't cache failed requests
245
261
  promise.fail -> remove(request)
246
262
 
247
263
  if pending && !options.preload
248
- # This will actually make `pendingCount` higher than the actual
264
+ # This might actually make `pendingCount` higher than the actual
249
265
  # number of outstanding requests. However, we need to cover the
250
266
  # following case:
251
267
  #
@@ -340,13 +356,36 @@ up.proxy = (($) ->
340
356
  @stable
341
357
  ###
342
358
 
359
+ loadOrQueue = (request) ->
360
+ if pendingCount < config.maxRequests
361
+ load(request)
362
+ else
363
+ queue(request)
364
+
365
+ queue = (request) ->
366
+ u.debug('Queuing URL %o', request.url)
367
+ deferred = $.Deferred()
368
+ entry =
369
+ deferred: deferred
370
+ request: request
371
+ queuedRequests.push(entry)
372
+ deferred.promise()
373
+
343
374
  load = (request) ->
344
375
  u.debug('Loading URL %o', request.url)
345
376
  up.emit('up:proxy:load', request)
346
377
  promise = u.ajax(request)
347
- promise.always -> up.emit('up:proxy:received', request)
378
+ promise.always ->
379
+ up.emit('up:proxy:received', request)
380
+ pokeQueue()
348
381
  promise
349
382
 
383
+ pokeQueue = ->
384
+ if entry = queuedRequests.shift()
385
+ promise = load(entry.request)
386
+ promise.done (args...) -> entry.deferred.resolve(args...)
387
+ promise.fail (args...) -> entry.deferred.reject(args...)
388
+
350
389
  ###*
351
390
  This event is [emitted]/(up.emit) before an [AJAX request](/up.proxy.ajax)
352
391
  is starting to load.