-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
1 lines (1 loc) · 61.5 KB
/
index.js
File metadata and controls
1 lines (1 loc) · 61.5 KB
1
(function(e,t,n,r,i){var s={},o=function(t){return e.Function("return "+t)()},u=e.document,a,f=function(t,i){var o={exports:{}};s[t]=1,n[t]=o.exports;if(!i)i=i||e[t];else if(typeof i=="function"){var u=p;r[t]&&r[t].sandbox&&typeof u=="function"&&(u=a),i=i(u,o.exports,o)||o.exports}return i=i,n[t]=i},l={},c=function(e,t,n,r){var i=l[e],s;if(i)for(var o=0,u=i.length;o<u;o++)s=i[o](t,n,r)||s,s&&(t=s[0]||t,n=s[1]||n,r=s[2]||r);return s||[t,n,r]},h=function(e,t){l[e]||(l[e]=[]),l[e].push(t)},p=function(e){var t=n[e],r=c(4,e,t);return r&&(e=r[0],t=r[1]),s[e]&&t?t:(typeof t=="string"&&t.indexOf("(function(")===0&&(t=o(t)),f(e,t))},d={exports:{}};for(var v in n)s[v]=0;(function(){function e(e){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(i(r)+":"+t(e[r]));return"{"+n.join(",")+"}"}function t(n){if(typeof n=="string")return i(n);if(typeof n=="boolean")return""+n;if(n.join){if(n.length==0)return"[]";var r=[];for(var s=0,o=n.length;s<o;s+=1)r.push(t(n[s]));return"["+r.join(",")+"]"}return typeof n=="number"?n:e(n)}function n(e){return"0000".substr(e.length)+e}function r(e){switch(e){case"\b":return"\\b";case"\f":return"\\f";case"\n":return"\\n";case"\r":return"\\r";case" ":return"\\t";case'"':return'\\"';case"\\":return"\\\\";default:return"\\u"+n(e.charCodeAt(0).toString(16))}}function i(e){return'"'+e.replace(/[\u0000-\u001f"\\\u007f-\uffff]/g,r)+'"'}function s(e){for(var t=this.length;t-->0;)if(this[t]===e)return t;return-1}})(),function(){function e(e,t){return!s[e]&&typeof t=="string"&&t.charAt(0)=="@"}function t(t,r){if(e(t,r)){t=r.replace("@","");var i=n[t];r=i===r?a:i}return[t,r]}h(4,t)}(),t(p,d.exports,d)})(this,function(e,t,n){$("html").attr("lang",e("lang")),e("ready").pipe(function(){e("index")})},{ymaps:"@ymaps",config:function(e,t,n){var r={character:{sprite_size:64,sprite_scale:.5,sprite_url:"images/characters-2.png",default_photo:"http://placehold.it/1280x1024"},charactersCount:11,ymapsApi:"http://api-maps.yandex.ru/2.0.36/?coordorder=longlat&load=package.standard&lang=%lang",mapState:{center:[60.650875169164664,56.84878426050872],zoom:16,type:"yandex#satellite",behaviors:["default","scrollZoom"]},mapOptions:{minZoom:13,maxZoom:23},newbie_days:7,disqus:{shortname:"2layer"}};n.exports=r},index:function(e,t,n){var r=e("lang"),i=new(e("charactersCollection")),s=new(e("monstersCollection")),o=e("backbone"),u=e("galleryView"),a=new u({el:".js-gallery-layer",collection:i}),f=e("mapView"),l=new f({el:"#map",collection:i,monsters:s}),c=e("onlineView"),h=new c({el:".online",collection:i}),p=e("pageView"),d=new p({el:".js-about-page:lang("+r+")",name:"about"});s.fetch(),i.fetch(),o.history.start()},lang:function(e,t,n){var r=["en","ru"],i=((navigator.language||navigator.browserLanguage||"").match(/^[a-z]{2}/)||0)[0];r.indexOf(i)<0&&(i=r[0]),n.exports=i},ready:function(e,t,n){var r=e("lang"),i=e("config"),s=i.ymapsApi.replace("%lang",r),o=$.getScript(s).pipe(function(){var e=$.Deferred();return window.ymaps.ready(e.resolve),e.promise()}),u=$.Deferred();$(u.resolve),n.exports=$.when(o,u.promise())},router:function(e,t,n){function r(e,t){return u("!"+e,t)}var i=e("backbone"),s=e("_"),o=["content_state_map","content_state_page","content_state_gallery"].join(" "),u=s.bind(i.history.navigate,i.history);i.history.navigate=r;var a=i.Router.extend({routes:{"!":"hideAll","!gallery/:id":"showGallery","!:page":"showPage","*default":"redirectToFullHashBang"},initialize:function(){this.$body=$(".content"),this.$galleryLayers=this.$body.find(".js-gallery-layer"),this.$pageLayer=this.$body.find(".js-page-layer"),this.$contentLayers=this.$galleryLayers.add(this.$pageLayer),this.$pages=this.$body.find(".page"),this._bindDefaultEvents()},_bindDefaultEvents:function(){var e=this;this.$contentLayers.click(function(t){$(t.target).is(e.$contentLayers)&&e.navigate("",{trigger:!0})}),this.$contentLayers.find(">div").click(function(e){return $(e.target).is("button,a")}),$(window).keyup(function(t){t.which===27&&e.navigate("",{trigger:!0})})},showPage:function(e){var t=this.$pages.filter(".js-"+e+"-page");t.is(":visible")?this._activate("map"):(this._activate("page"),this.$pages.addClass("hidden"),t.removeClass("hidden"))},showGallery:function(){this._activate("gallery")},hideAll:function(){this._activate("map")},redirectToFullHashBang:function(){var e=i.history.getHash();if(e.charAt(0)==="!")return;this.navigate(e,{trigger:!0})},_activate:function(e){this.$body.removeClass(o).addClass("content_state_"+e);switch(e){case"page":this.$galleryLayers.addClass("hidden"),this.$pageLayer.removeClass("hidden");break;case"gallery":this.$galleryLayers.removeClass("hidden"),this.$pageLayer.addClass("hidden");break;case"map":default:this.$contentLayers.addClass("hidden")}}});n.exports=new a},disqusView:function(e,t,n){function r(e){var t=$(e.el),n=t.data();return l.$el.appendTo(t),l.reset(n),l}var i=e("_"),s=e("lang"),o=e("disqus"),u=e("config").disqus,a=e("backbone"),f=a.View.extend({template:i.template(e("disqusTemplate")),initialize:function(){this.setElement(this.template())},reset:function(e){return o(u.shortname).pipe(function(t){t.reset({reload:!0,config:function(){this.page.identifier=e.identifier||window.location.hash,this.page.url=e.url||window.location,this.page.title=e.title||document.title,this.page.shortname=u.shortname,this.language=e.language||s}})})}}),l=new f;n.exports=r},galleryView:function(e,t,n){var r=e("_"),i=e("backbone"),s=e("router"),o=e("lang"),u=e("disqusView"),a=i.View.extend({template:r.template(e("galleryTemplate")),events:{"click .gallery__image":"changeImage"},initialize:function(){this.index=0,this._bindEvents()},_bindEvents:function(){s.on("route:showGallery",function(e){if(!this.collection.length)return;this.go(e-1)},this),s.once("route:showGallery",function(e){if(this.collection.length)return;this.collection.once("sync",function(){this.go(e-1)},this)},this)},changeImage:function(e){var t=$(e.target),n=t.position().left,r=(e.pageX-n)/t.width();r<.2?this.prev():this.next()},render:function(e){var t=e.attributes,n={src:t.photo_small,classId:t.class_id,name:t.name,href:t.photo_url,isNewbie:e.isNewbie(),timeOnline:e.timeOnline()};this.$el.html(this.template(n)),this._initShareButton(),this._initDisqus()},_initShareButton:function(){if(!window.Ya||!Ya.share)return;this.$el.find(".share__buttons").each(function(){var e=$(this);Ya.share({element:e[0],theme:e.attr("data-yashareTheme"),l10n:e.attr("data-yashareL10n"),image:e.attr("data-yashareImage"),link:e.attr("data-yashareLink"),title:e.attr("data-yashareTitle"),description:e.attr("data-yashareDescription"),elementStyle:{type:e.attr("data-yashareType"),quickServices:e.attr("data-yashareQuickServices").split(",")}})})},_initDisqus:function(){new u({el:this.$el.find(".disqus")})},go:function(e){if(this.collection.length<=e||e<0){s.navigate("",{trigger:!0});return}this.index=e,this.render(this.collection.at(e))},_pageUrl:function(e){return"gallery/"+(e+1)},_navigate:function(e){s.navigate(this._pageUrl(e),{trigger:!0})},showById:function(e){var t=this.collection.get(e),n=this.collection.indexOf(t);this._navigate(n)},next:function(){this.index++,this.index>this.collection.length-1&&(this.index=0),this._navigate(this.index)},prev:function(){this.index--,this.index<0&&(this.index=this.collection.length-1),this._navigate(this.index)}});n.exports=a},mapView:function(e,t,n){var r=e("ymaps"),i=e("config"),s=e("backbone"),o=e("_"),u=e("router"),a=i.character.sprite_size,f=i.character.sprite_scale,l=i.character.sprite_url,c=s.View.extend({initialize:function(e){this.monsters=e.monsters,this.map=new r.Map(this.el,i.mapState,i.mapOptions),this._createGeoObjectsCollections(),this._addEvents()},_createGeoObjectsCollections:function(){o.each(["monstersGeoObjects","charactersGeoObjects"],function(e){this[e]=new r.GeoObjectCollection,this.map.geoObjects.add(this[e])},this)},_addEvents:function(){this.collection.on("add",function(e){this._addCharacter(e.toJSON())},this),this.monsters.on("add",function(e){this._addMonster(e.toJSON())},this)},_addCharacter:function(e){var t=e.class_id,n=e.name,i=new r.Placemark(e.location,{hintContent:n},{iconImageHref:l,iconImageSize:[a*f,a*f],iconImageClipRect:[[t*a,0],[(t+1)*a,a]],iconImageOffset:[-a*f/2,-a*f]});i.events.add("click",function(){i.hint.hide($.noop,!0),u.navigate("gallery/"+e.id,{trigger:!0})}),this.charactersGeoObjects.add(i),this._fitCharactersInViewPort()},_fitCharactersInViewPort:o.debounce(function(){this.map.setBounds(this.charactersGeoObjects.getBounds())},5),_addMonster:function(e){var t=e.image,n=new r.Placemark(e.location,{},{iconImageHref:t.url,iconImageSize:[t.width*t.scale,t.height*t.scale],iconImageOffset:[-t.width*t.scale/2,-t.height*t.scale]});this.monstersGeoObjects.add(n)}});n.exports=c},onlineView:function(e,t,n){var r=e("_"),i=e("lang"),s=e("config"),o=e("backbone"),u=o.View.extend({template:r.template(e("online__itemTemplate")),initialize:function(){this._addEvents()},_addEvents:function(){this.collection.on("sync",function(){this.renderAll(),this.collection.on("add",this.render,this)},this)},renderAll:function(){var e=this.collection.map(function(e){return this._renderModel(e)},this);this.$el.empty().html(e.join(""))},_renderModel:function(e){var t=e.toJSON(),n=r.extend({is_newbie:e.isNewbie(),date_calendar:e.dateCalendar()},t);return this.template(n)},render:function(e){this.$el.append(this._renderModel(e))}});n.exports=u},pageView:function(e,t,n){var r=e("backbone"),i=e("router"),s=e("disqusView"),o=r.View.extend({initialize:function(e){i.on("route:showPage",function(t){if(e.name!==t)return;this._initDisqus()},this)},_initDisqus:function(){new s({el:this.$el.find(".disqus")})}});n.exports=o},characterModel:function(e,t,n){var r=e("backbone"),i=e("lang"),s=e("config"),o=e(i==="ru"?"moment-ru":"moment"),u=0,a=r.Model.extend({defaults:function(){return{id:++u,name:Math.random().toString(16),class_id:0|Math.random()*s.charactersCount,photo_small:s.character.default_photo,photo_url:s.character.default_photo,date:new Date}},isNewbie:function(){return o().diff(this.get("date"),"days")<s.newbie_days},dateCalendar:function(){return o(this.get("date")).calendar()},timeOnline:function(){return o.duration(o(this.get("date")).diff()).humanize()}});n.exports=a},monsterModel:function(e,t,n){var r=e("backbone"),i=e("config"),s=0,o=r.Model.extend({defaults:function(){return{id:++s,image:{}}}});n.exports=o},abstractCollection:function(e,t,n){var r=e("backbone"),i=e("_"),s=r.Collection.extend({parse:function(e){return i.map(e.features,function(e){return i.extend(e.properties,{location:e.geometry.coordinates})})},toJSON:function(){var e=this.map(function(e){var t=e.toJSON();return{type:"Feature",geometry:{type:"Point",coordinates:t.location},properties:i.omit(t,"location")}});return{type:"FeatureCollection",features:e}}});n.exports=s},charactersCollection:function(e,t,n){var r=e("abstractCollection"),i=e("characterModel"),s=r.extend({url:"data/characters.geojson",model:i});n.exports=s},monstersCollection:function(e,t,n){var r=e("abstractCollection"),i=e("monsterModel"),s=r.extend({url:"data/monsters.geojson",model:i});n.exports=s},disqusTemplate:'<div id="disqus_thread"></div>',galleryTemplate:'<div class="gallery">\n <div class="gallery__licence" lang="en"><a href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">Using photo CC BY-NC-SA 3.0</a></div>\n <div class="gallery__licence" lang="ru"><a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.ru" target="_blank">Использование фотографии CC BY-NC-SA 3.0</a></div>\n <img src="<%= src %>" class="gallery__image">\n <div class="share share_mode_float">\n <div class="yashare-auto-init share__buttons"\n data-yashareTitle="2Layer - фото-проект"\n data-yashareDescription="2Layer - фото-проект, разбавляющий жизнь дополнительной реальностью"\n data-yashareImage="<%= src %>"\n data-yashareL10n="ru"\n data-yashareType="link"\n data-yashareQuickServices="vkontakte,facebook,twitter,odnoklassniki,moimir,gplus,pinterest"\n lang="ru"></div>\n <div class="yashare-auto-init share__buttons"\n data-yashareTitle="2Layer - photo-project"\n data-yashareDescription="2Layer - photo-project, that adds alternative reality to life"\n data-yashareImage="<%= src %>"\n data-yashareL10n="en"\n data-yashareType="link"\n data-yashareQuickServices="facebook,twitter,gplus,pinterest"\n lang="en"></div>\n </div>\n <div class="gallery__title">\n <span class="icon icon_margin_yes icon_id_<%= classId %><% if (isNewbie) { %> icon_newbie_yes<% } %>"></span><a class="gallery__link" href="<%= href %>" target="_blank"><%= name %></a>\n </div>\n <div class="gallery__date" lang="ru">Уже <%= timeOnline %> онлайн!</div>\n <div class="gallery__date" lang="en"><%= timeOnline %> online!</div>\n\n <div class="disqus" data-title="<%= name %>"></div>\n\n <div class="button-panel">\n <a href="#!"><button class="button button_ok">OK</button></a>\n </div>\n <a href="#!" class="gallery__close">×</a>\n</div>',online__itemTemplate:'<li class="online__item" id="<%= id %>">\n <div>\n <span class="icon icon_margin_yes icon_id_<%= class_id %><% if (is_newbie) { %> icon_newbie_yes<% } %>"></span><a class="online__link" href="#!gallery/<%= id %>"><%= name %></a>\n </div>\n <div class="online__date"><%= date_calendar %></div>\n</li>',moment:function(e,t,n){(function(t){function r(e,t){return function(n){return l(e.call(this,n),t)}}function i(e){return function(t){return this.lang().ordinal(e.call(this,t))}}function s(){}function o(e){a(this,e)}function u(e){var t=this._data={},n=e.years||e.year||e.y||0,r=e.months||e.month||e.M||0,i=e.weeks||e.week||e.w||0,s=e.days||e.day||e.d||0,o=e.hours||e.hour||e.h||0,u=e.minutes||e.minute||e.m||0,a=e.seconds||e.second||e.s||0,l=e.milliseconds||e.millisecond||e.ms||0;this._milliseconds=l+a*1e3+u*6e4+o*36e5,this._days=s+i*7,this._months=r+n*12,t.milliseconds=l%1e3,a+=f(l/1e3),t.seconds=a%60,u+=f(a/60),t.minutes=u%60,o+=f(u/60),t.hours=o%24,s+=f(o/24),s+=i*7,t.days=s%30,r+=f(s/30),t.months=r%12,n+=f(r/12),t.years=n}function a(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function f(e){return e<0?Math.ceil(e):Math.floor(e)}function l(e,t){var n=e+"";while(n.length<t)n="0"+n;return n}function c(e,t,n){var r=t._milliseconds,i=t._days,s=t._months,o;r&&e._d.setTime(+e+r*n),i&&e.date(e.date()+i*n),s&&(o=e.date(),e.date(1).month(e.month()+s*n).date(Math.min(o,e.daysInMonth())))}function h(e){return Object.prototype.toString.call(e)==="[object Array]"}function p(e,t){var n=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),i=0,s;for(s=0;s<n;s++)~~e[s]!==~~t[s]&&i++;return i+r}function d(e,t){return t.abbr=e,j[e]||(j[e]=new s),j[e].set(t),j[e]}function v(t){return t?(!j[t]&&F&&e("./lang/"+t),j[t]):D.fn._lang}function m(e){return e.match(/\[.*\]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function g(e){var t=e.match(q),n,r;for(n=0,r=t.length;n<r;n++)ut[t[n]]?t[n]=ut[t[n]]:t[n]=m(t[n]);return function(i){var s="";for(n=0;n<r;n++)s+=typeof t[n].call=="function"?t[n].call(i,e):t[n];return s}}function y(e,t){function n(t){return e.lang().longDateFormat(t)||t}var r=5;while(r--&&R.test(t))t=t.replace(R,n);return it[t]||(it[t]=g(t)),it[t](e)}function b(e){switch(e){case"DDDD":return X;case"YYYY":return V;case"YYYYY":return $;case"S":case"SS":case"SSS":case"DDD":return W;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return J;case"X":return G;case"Z":case"ZZ":return K;case"T":return Q;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return z;default:return new RegExp(e.replace("\\",""))}}function w(e,t,n){var r,i,s=n._a;switch(e){case"M":case"MM":s[1]=t==null?0:~~t-1;break;case"MMM":case"MMMM":r=v(n._l).monthsParse(t),r!=null?s[1]=r:n._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":t!=null&&(s[2]=~~t);break;case"YY":s[0]=~~t+(~~t>68?1900:2e3);break;case"YYYY":case"YYYYY":s[0]=~~t;break;case"a":case"A":n._isPm=(t+"").toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":s[3]=~~t;break;case"m":case"mm":s[4]=~~t;break;case"s":case"ss":s[5]=~~t;break;case"S":case"SS":case"SSS":s[6]=~~(("0."+t)*1e3);break;case"X":n._d=new Date(parseFloat(t)*1e3);break;case"Z":case"ZZ":n._useUTC=!0,r=(t+"").match(tt),r&&r[1]&&(n._tzh=~~r[1]),r&&r[2]&&(n._tzm=~~r[2]),r&&r[0]==="+"&&(n._tzh=-n._tzh,n._tzm=-n._tzm)}t==null&&(n._isValid=!1)}function E(e){var t,n,r=[];if(e._d)return;for(t=0;t<7;t++)e._a[t]=r[t]=e._a[t]==null?t===2?1:0:e._a[t];r[3]+=e._tzh||0,r[4]+=e._tzm||0,n=new Date(0),e._useUTC?(n.setUTCFullYear(r[0],r[1],r[2]),n.setUTCHours(r[3],r[4],r[5],r[6])):(n.setFullYear(r[0],r[1],r[2]),n.setHours(r[3],r[4],r[5],r[6])),e._d=n}function S(e){var t=e._f.match(q),n=e._i,r,i;e._a=[];for(r=0;r<t.length;r++)i=(b(t[r]).exec(n)||[])[0],i&&(n=n.slice(n.indexOf(i)+i.length)),ut[t[r]]&&w(t[r],i,e);e._isPm&&e._a[3]<12&&(e._a[3]+=12),e._isPm===!1&&e._a[3]===12&&(e._a[3]=0),E(e)}function x(e){var t,n,r,i=99,s,u,f;while(e._f.length){t=a({},e),t._f=e._f.pop(),S(t),n=new o(t);if(n.isValid()){r=n;break}f=p(t._a,n.toArray()),f<i&&(i=f,r=n)}a(e,r)}function T(e){var t,n=e._i;if(Y.exec(n)){e._f="YYYY-MM-DDT";for(t=0;t<4;t++)if(et[t][1].exec(n)){e._f+=et[t][0];break}K.exec(n)&&(e._f+=" Z"),S(e)}else e._d=new Date(n)}function N(e){var n=e._i,r=I.exec(n);n===t?e._d=new Date:r?e._d=new Date(+r[1]):typeof n=="string"?T(e):h(n)?(e._a=n.slice(0),E(e)):e._d=n instanceof Date?new Date(+n):new Date(n)}function C(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}function k(e,t,n){var r=H(Math.abs(e)/1e3),i=H(r/60),s=H(i/60),o=H(s/24),u=H(o/365),a=r<45&&["s",r]||i===1&&["m"]||i<45&&["mm",i]||s===1&&["h"]||s<22&&["hh",s]||o===1&&["d"]||o<=25&&["dd",o]||o<=45&&["M"]||o<345&&["MM",H(o/30)]||u===1&&["y"]||["yy",u];return a[2]=t,a[3]=e>0,a[4]=n,C.apply({},a)}function L(e,t,n){var r=n-t,i=n-e.day();return i>r&&(i-=7),i<r-7&&(i+=7),Math.ceil(D(e).add("d",i).dayOfYear()/7)}function A(e){var t=e._i,n=e._f;return t===null||t===""?null:(typeof t=="string"&&(e._i=t=v().preparse(t)),D.isMoment(t)?(e=a({},t),e._d=new Date(+t._d)):n?h(n)?x(e):S(e):N(e),new o(e))}function O(e,t){D.fn[e]=D.fn[e+"s"]=function(e){var n=this._isUTC?"UTC":"";return e!=null?(this._d["set"+n+t](e),this):this._d["get"+n+t]()}}function M(e){D.duration.fn[e]=function(){return this._data[e]}}function _(e,t){D.duration.fn["as"+e]=function(){return+this/t}}var D,P="2.0.0",H=Math.round,B,j={},F=typeof n!="undefined"&&n.exports,I=/^\/?Date\((\-?\d+)/i,q=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,R=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,U=/([0-9a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)/gi,z=/\d\d?/,W=/\d{1,3}/,X=/\d{3}/,V=/\d{1,4}/,$=/[+\-]?\d{1,6}/,J=/[0-9]*[a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF]+\s*?[\u0600-\u06FF]+/i,K=/Z|[\+\-]\d\d:?\d\d/i,Q=/T/i,G=/[\+\-]?\d+(\.\d{1,3})?/,Y=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,Z="YYYY-MM-DDTHH:mm:ssZ",et=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],tt=/([\+\-]|\d\d)/gi,nt="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),rt={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},it={},st="DDD w W M D d".split(" "),ot="M D H h m s w W".split(" "),ut={M:function(){return this.month()+1},MMM:function(e){return this.lang().monthsShort(this,e)},MMMM:function(e){return this.lang().months(this,e)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(e){return this.lang().weekdaysMin(this,e)},ddd:function(e){return this.lang().weekdaysShort(this,e)},dddd:function(e){return this.lang().weekdays(this,e)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return l(this.year()%100,2)},YYYY:function(){return l(this.year(),4)},YYYYY:function(){return l(this.year(),5)},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return l(~~(this.milliseconds()/10),2)},SSS:function(){return l(this.milliseconds(),3)},Z:function(){var e=-this.zone(),t="+";return e<0&&(e=-e,t="-"),t+l(~~(e/60),2)+":"+l(~~e%60,2)},ZZ:function(){var e=-this.zone(),t="+";return e<0&&(e=-e,t="-"),t+l(~~(10*e/6),4)},X:function(){return this.unix()}};while(st.length)B=st.pop(),ut[B+"o"]=i(ut[B]);while(ot.length)B=ot.pop(),ut[B+B]=r(ut[B],2);ut.DDDD=r(ut.DDD,3),s.prototype={set:function(e){var t,n;for(n in e)t=e[n],typeof t=="function"?this[n]=t:this["_"+n]=t},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(e){return this._months[e.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(e){return this._monthsShort[e.month()]},monthsParse:function(e){var t,n,r,i;this._monthsParse||(this._monthsParse=[]);for(t=0;t<12;t++){this._monthsParse[t]||(n=D([2e3,t]),r="^"+this.months(n,"")+"|^"+this.monthsShort(n,""),this._monthsParse[t]=new RegExp(r.replace(".",""),"i"));if(this._monthsParse[t].test(e))return t}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(e){return this._weekdays[e.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(e){return this._weekdaysShort[e.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(e){return this._weekdaysMin[e.day()]},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(e){var t=this._longDateFormat[e];return!t&&this._longDateFormat[e.toUpperCase()]&&(t=this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e]=t),t},meridiem:function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},calendar:function(e,t){var n=this._calendar[e];return typeof n=="function"?n.apply(t):n},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(e,t,n,r){var i=this._relativeTime[n];return typeof i=="function"?i(e,t,n,r):i.replace(/%d/i,e)},pastFuture:function(e,t){var n=this._relativeTime[e>0?"future":"past"];return typeof n=="function"?n(t):n.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace("%d",e)},_ordinal:"%d",preparse:function(e){return e},postformat:function(e){return e},week:function(e){return L(e,this._week.dow,this._week.doy)},_week:{dow:0,doy:6}},D=function(e,t,n){return A({_i:e,_f:t,_l:n,_isUTC:!1})},D.utc=function(e,t,n){return A({_useUTC:!0,_isUTC:!0,_l:n,_i:e,_f:t})},D.unix=function(e){return D(e*1e3)},D.duration=function(e,t){var n=D.isDuration(e),r=typeof e=="number",i=n?e._data:r?{}:e,s;return r&&(t?i[t]=e:i.milliseconds=e),s=new u(i),n&&e.hasOwnProperty("_lang")&&(s._lang=e._lang),s},D.version=P,D.defaultFormat=Z,D.lang=function(e,t){var n;if(!e)return D.fn._lang._abbr;t?d(e,t):j[e]||v(e),D.duration.fn._lang=D.fn._lang=v(e)},D.langData=function(e){return e&&e._lang&&e._lang._abbr&&(e=e._lang._abbr),v(e)},D.isMoment=function(e){return e instanceof o},D.isDuration=function(e){return e instanceof u},D.fn=o.prototype={clone:function(){return D(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._d},toJSON:function(){return D.utc(this).format("YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return this._isValid==null&&(this._a?this._isValid=!p(this._a,(this._isUTC?D.utc(this._a):D(this._a)).toArray()):this._isValid=!isNaN(this._d.getTime())),!!this._isValid},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(e){var t=y(this,e||D.defaultFormat);return this.lang().postformat(t)},add:function(e,t){var n;return typeof e=="string"?n=D.duration(+t,e):n=D.duration(e,t),c(this,n,1),this},subtract:function(e,t){var n;return typeof e=="string"?n=D.duration(+t,e):n=D.duration(e,t),c(this,n,-1),this},diff:function(e,t,n){var r=this._isUTC?D(e).utc():D(e).local(),i=(this.zone()-r.zone())*6e4,s,o;return t&&(t=t.replace(/s$/,"")),t==="year"||t==="month"?(s=(this.daysInMonth()+r.daysInMonth())*432e5,o=(this.year()-r.year())*12+(this.month()-r.month()),o+=(this-D(this).startOf("month")-(r-D(r).startOf("month")))/s,t==="year"&&(o/=12)):(s=this-r-i,o=t==="second"?s/1e3:t==="minute"?s/6e4:t==="hour"?s/36e5:t==="day"?s/864e5:t==="week"?s/6048e5:s),n?o:f(o)},from:function(e,t){return D.duration(this.diff(e)).lang(this.lang()._abbr).humanize(!t)},fromNow:function(e){return this.from(D(),e)},calendar:function(){var e=this.diff(D().startOf("day"),"days",!0),t=e<-6?"sameElse":e<-1?"lastWeek":e<0?"lastDay":e<1?"sameDay":e<2?"nextDay":e<7?"nextWeek":"sameElse";return this.format(this.lang().calendar(t,this))},isLeapYear:function(){var e=this.year();return e%4===0&&e%100!==0||e%400===0},isDST:function(){return this.zone()<D([this.year()]).zone()||this.zone()<D([this.year(),5]).zone()},day:function(e){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return e==null?t:this.add({d:e-t})},startOf:function(e){e=e.replace(/s$/,"");switch(e){case"year":this.month(0);case"month":this.date(1);case"week":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return e==="week"&&this.day(0),this},endOf:function(e){return this.startOf(e).add(e.replace(/s?$/,"s"),1).subtract("ms",1)},isAfter:function(e,t){return t=typeof t!="undefined"?t:"millisecond",+this.clone().startOf(t)>+D(e).startOf(t)},isBefore:function(e,t){return t=typeof t!="undefined"?t:"millisecond",+this.clone().startOf(t)<+D(e).startOf(t)},isSame:function(e,t){return t=typeof t!="undefined"?t:"millisecond",+this.clone().startOf(t)===+D(e).startOf(t)},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return D.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(e){var t=H((D(this).startOf("day")-D(this).startOf("year"))/864e5)+1;return e==null?t:this.add("d",e-t)},isoWeek:function(e){var t=L(this,1,4);return e==null?t:this.add("d",(e-t)*7)},week:function(e){var t=this.lang().week(this);return e==null?t:this.add("d",(e-t)*7)},lang:function(e){return e===t?this._lang:(this._lang=v(e),this)}};for(B=0;B<nt.length;B++)O(nt[B].toLowerCase().replace(/s$/,""),nt[B]);O("year","FullYear"),D.fn.days=D.fn.day,D.fn.weeks=D.fn.week,D.fn.isoWeeks=D.fn.isoWeek,D.duration.fn=u.prototype={weeks:function(){return f(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months*2592e6},humanize:function(e){var t=+this,n=k(t,!e,this.lang());return e&&(n=this.lang().pastFuture(t,n)),this.lang().postformat(n)},lang:D.fn.lang};for(B in rt)rt.hasOwnProperty(B)&&(_(B,rt[B]),M(B.toLowerCase()));_("Weeks",6048e5),D.lang("en",{ordinal:function(e){var t=e%10,n=~~(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+n}}),F&&(n.exports=D),typeof ender=="undefined"&&(this.moment=D),typeof define=="function"&&define.amd&&define("moment",[],function(){return D})}).call(this)},"moment-ru":function(e,t,n){function r(e,t){var n=e.split("_");return 1===t%10&&11!==t%100?n[0]:t%10>=2&&4>=t%10&&(10>t%100||t%100>=20)?n[1]:n[2]}function i(e,t,n){var i={mm:"минута_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",MM:"месяц_месяца_месяцев",yy:"год_года_лет"};return"m"===n?t?"минута":"минуту":e+" "+r(i[n],+e)}function s(e,t){var n={nominative:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),accusative:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_")},r=/D[oD]? *MMMM?/.test(t)?"accusative":"nominative";return n[r][e.month()]}function o(e,t){var n={nominative:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),accusative:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_")},r=/\[ ?[Вв] ?(?:прошлую|следующую)? ?\] ?dddd/.test(t)?"accusative":"nominative";return n[r][e.day()]}var u=e("moment");u.lang("ru",{months:s,monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:o,weekdaysShort:"вск_пнд_втр_срд_чтв_птн_сбт".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., LT",LLLL:"dddd, D MMMM YYYY г., LT"},calendar:{sameDay:"[Сегодня в] LT",nextDay:"[Завтра в] LT",lastDay:"[Вчера в] LT",nextWeek:function(){return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT"},lastWeek:function(){switch(this.day()){case 0:return"[В прошлое] dddd [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",m:i,mm:i,h:"час",hh:i,d:"день",dd:i,M:"месяц",MM:i,y:"год",yy:i},ordinal:"%d.",week:{dow:1,doy:7}}),n.exports=u},underscore:function(e,t,n){(function(){var e=this,r=e._,i={},s=Array.prototype,o=Object.prototype,u=Function.prototype,a=s.push,f=s.slice,l=s.concat,c=o.toString,h=o.hasOwnProperty,p=s.forEach,d=s.map,v=s.reduce,m=s.reduceRight,g=s.filter,y=s.every,b=s.some,w=s.indexOf,E=s.lastIndexOf,S=Array.isArray,x=Object.keys,T=u.bind,N=function(e){return e instanceof N?e:this instanceof N?(this._wrapped=e,void 0):new N(e)};"undefined"!=typeof t?("undefined"!=typeof n&&n.exports&&(t=n.exports=N),t._=N):e._=N,N.VERSION="1.4.4";var C=N.each=N.forEach=function(e,t,n){if(null!=e)if(p&&e.forEach===p)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,s=e.length;s>r;r++)if(t.call(n,e[r],r,e)===i)return}else for(var o in e)if(N.has(e,o)&&t.call(n,e[o],o,e)===i)return};N.map=N.collect=function(e,t,n){var r=[];return null==e?r:d&&e.map===d?e.map(t,n):(C(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)};var k="Reduce of empty array with no initial value";N.reduce=N.foldl=N.inject=function(e,t,n,r){var i=arguments.length>2;if(null==e&&(e=[]),v&&e.reduce===v)return r&&(t=N.bind(t,r)),i?e.reduce(t,n):e.reduce(t);if(C(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)}),!i)throw new TypeError(k);return n},N.reduceRight=N.foldr=function(e,t,n,r){var i=arguments.length>2;if(null==e&&(e=[]),m&&e.reduceRight===m)return r&&(t=N.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=N.keys(e);s=o.length}if(C(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)}),!i)throw new TypeError(k);return n},N.find=N.detect=function(e,t,n){var r;return L(e,function(e,i,s){return t.call(n,e,i,s)?(r=e,!0):void 0}),r},N.filter=N.select=function(e,t,n){var r=[];return null==e?r:g&&e.filter===g?e.filter(t,n):(C(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},N.reject=function(e,t,n){return N.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},N.every=N.all=function(e,t,n){t||(t=N.identity);var r=!0;return null==e?r:y&&e.every===y?e.every(t,n):(C(e,function(e,s,o){return(r=r&&t.call(n,e,s,o))?void 0:i}),!!r)};var L=N.some=N.any=function(e,t,n){t||(t=N.identity);var r=!1;return null==e?r:b&&e.some===b?e.some(t,n):(C(e,function(e,s,o){return r||(r=t.call(n,e,s,o))?i:void 0}),!!r)};N.contains=N.include=function(e,t){return null==e?!1:w&&e.indexOf===w?e.indexOf(t)!=-1:L(e,function(e){return e===t})},N.invoke=function(e,t){var n=f.call(arguments,2),r=N.isFunction(t);return N.map(e,function(e){return(r?t:e[t]).apply(e,n)})},N.pluck=function(e,t){return N.map(e,function(e){return e[t]})},N.where=function(e,t,n){return N.isEmpty(t)?n?null:[]:N[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},N.findWhere=function(e,t){return N.where(e,t,!0)},N.max=function(e,t,n){if(!t&&N.isArray(e)&&e[0]===+e[0]&&65535>e.length)return Math.max.apply(Math,e);if(!t&&N.isEmpty(e))return-1/0;var r={computed:-1/0,value:-1/0};return C(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},N.min=function(e,t,n){if(!t&&N.isArray(e)&&e[0]===+e[0]&&65535>e.length)return Math.min.apply(Math,e);if(!t&&N.isEmpty(e))return 1/0;var r={computed:1/0,value:1/0};return C(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;r.computed>o&&(r={value:e,computed:o})}),r.value},N.shuffle=function(e){var t,n=0,r=[];return C(e,function(e){t=N.random(n++),r[n-1]=r[t],r[t]=e}),r};var A=function(e){return N.isFunction(e)?e:function(t){return t[e]}};N.sortBy=function(e,t,n){var r=A(t);return N.pluck(N.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(r>n||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var O=function(e,t,n,r){var i={},s=A(t||N.identity);return C(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};N.groupBy=function(e,t,n){return O(e,t,n,function(e,t,n){(N.has(e,t)?e[t]:e[t]=[]).push(n)})},N.countBy=function(e,t,n){return O(e,t,n,function(e,t){N.has(e,t)||(e[t]=0),e[t]++})},N.sortedIndex=function(e,t,n,r){n=null==n?N.identity:A(n);for(var i=n.call(r,t),s=0,o=e.length;o>s;){var u=s+o>>>1;i>n.call(r,e[u])?s=u+1:o=u}return s},N.toArray=function(e){return e?N.isArray(e)?f.call(e):e.length===+e.length?N.map(e,N.identity):N.values(e):[]},N.size=function(e){return null==e?0:e.length===+e.length?e.length:N.keys(e).length},N.first=N.head=N.take=function(e,t,n){return null==e?void 0:null==t||n?e[0]:f.call(e,0,t)},N.initial=function(e,t,n){return f.call(e,0,e.length-(null==t||n?1:t))},N.last=function(e,t,n){return null==e?void 0:null==t||n?e[e.length-1]:f.call(e,Math.max(e.length-t,0))},N.rest=N.tail=N.drop=function(e,t,n){return f.call(e,null==t||n?1:t)},N.compact=function(e){return N.filter(e,N.identity)};var M=function(e,t,n){return C(e,function(e){N.isArray(e)?t?a.apply(n,e):M(e,t,n):n.push(e)}),n};N.flatten=function(e,t){return M(e,t,[])},N.without=function(e){return N.difference(e,f.call(arguments,1))},N.uniq=N.unique=function(e,t,n,r){N.isFunction(t)&&(r=n,n=t,t=!1);var i=n?N.map(e,n,r):e,s=[],o=[];return C(i,function(n,r){(t?r&&o[o.length-1]===n:N.contains(o,n))||(o.push(n),s.push(e[r]))}),s},N.union=function(){return N.uniq(l.apply(s,arguments))},N.intersection=function(e){var t=f.call(arguments,1);return N.filter(N.uniq(e),function(e){return N.every(t,function(t){return N.indexOf(t,e)>=0})})},N.difference=function(e){var t=l.apply(s,f.call(arguments,1));return N.filter(e,function(e){return!N.contains(t,e)})},N.zip=function(){for(var e=f.call(arguments),t=N.max(N.pluck(e,"length")),n=Array(t),r=0;t>r;r++)n[r]=N.pluck(e,""+r);return n},N.object=function(e,t){if(null==e)return{};for(var n={},r=0,i=e.length;i>r;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},N.indexOf=function(e,t,n){if(null==e)return-1;var r=0,i=e.length;if(n){if("number"!=typeof n)return r=N.sortedIndex(e,t),e[r]===t?r:-1;r=0>n?Math.max(0,i+n):n}if(w&&e.indexOf===w)return e.indexOf(t,n);for(;i>r;r++)if(e[r]===t)return r;return-1},N.lastIndexOf=function(e,t,n){if(null==e)return-1;var r=null!=n;if(E&&e.lastIndexOf===E)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);for(var i=r?n:e.length;i--;)if(e[i]===t)return i;return-1},N.range=function(e,t,n){1>=arguments.length&&(t=e||0,e=0),n=arguments[2]||1;for(var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=Array(r);r>i;)s[i++]=e,e+=n;return s},N.bind=function(e,t){if(e.bind===T&&T)return T.apply(e,f.call(arguments,1));var n=f.call(arguments,2);return function(){return e.apply(t,n.concat(f.call(arguments)))}},N.partial=function(e){var t=f.call(arguments,1);return function(){return e.apply(this,t.concat(f.call(arguments)))}},N.bindAll=function(e){var t=f.call(arguments,1);return 0===t.length&&(t=N.functions(e)),C(t,function(t){e[t]=N.bind(e[t],e)}),e},N.memoize=function(e,t){var n={};return t||(t=N.identity),function(){var r=t.apply(this,arguments);return N.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},N.delay=function(e,t){var n=f.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},N.defer=function(e){return N.delay.apply(N,[e,1].concat(f.call(arguments,1)))},N.throttle=function(e,t){var n,r,i,s,o=0,u=function(){o=new Date,i=null,s=e.apply(n,r)};return function(){var a=new Date,f=t-(a-o);return n=this,r=arguments,0>=f?(clearTimeout(i),i=null,o=a,s=e.apply(n,r)):i||(i=setTimeout(u,f)),s}},N.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},N.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},N.wrap=function(e,t){return function(){var n=[e];return a.apply(n,arguments),t.apply(this,n)}},N.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},N.after=function(e,t){return 0>=e?t():function(){return 1>--e?t.apply(this,arguments):void 0}},N.keys=x||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)N.has(e,n)&&(t[t.length]=n);return t},N.values=function(e){var t=[];for(var n in e)N.has(e,n)&&t.push(e[n]);return t},N.pairs=function(e){var t=[];for(var n in e)N.has(e,n)&&t.push([n,e[n]]);return t},N.invert=function(e){var t={};for(var n in e)N.has(e,n)&&(t[e[n]]=n);return t},N.functions=N.methods=function(e){var t=[];for(var n in e)N.isFunction(e[n])&&t.push(n);return t.sort()},N.extend=function(e){return C(f.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},N.pick=function(e){var t={},n=l.apply(s,f.call(arguments,1));return C(n,function(n){n in e&&(t[n]=e[n])}),t},N.omit=function(e){var t={},n=l.apply(s,f.call(arguments,1));for(var r in e)N.contains(n,r)||(t[r]=e[r]);return t},N.defaults=function(e){return C(f.call(arguments,1),function(t){if(t)for(var n in t)null==e[n]&&(e[n]=t[n])}),e},N.clone=function(e){return N.isObject(e)?N.isArray(e)?e.slice():N.extend({},e):e},N.tap=function(e,t){return t(e),e};var _=function(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;e instanceof N&&(e=e._wrapped),t instanceof N&&(t=t._wrapped);var i=c.call(e);if(i!=c.call(t))return!1;switch(i){case"[object String]":return e==t+"";case"[object Number]":return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if("object"!=typeof e||"object"!=typeof t)return!1;for(var s=n.length;s--;)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if("[object Array]"==i){if(o=e.length,u=o==t.length)for(;o--&&(u=_(e[o],t[o],n,r)););}else{var a=e.constructor,f=t.constructor;if(a!==f&&!(N.isFunction(a)&&a instanceof a&&N.isFunction(f)&&f instanceof f))return!1;for(var l in e)if(N.has(e,l)&&(o++,!(u=N.has(t,l)&&_(e[l],t[l],n,r))))break;if(u){for(l in t)if(N.has(t,l)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};N.isEqual=function(e,t){return _(e,t,[],[])},N.isEmpty=function(e){if(null==e)return!0;if(N.isArray(e)||N.isString(e))return 0===e.length;for(var t in e)if(N.has(e,t))return!1;return!0},N.isElement=function(e){return!!e&&1===e.nodeType},N.isArray=S||function(e){return"[object Array]"==c.call(e)},N.isObject=function(e){return e===Object(e)},C(["Arguments","Function","String","Number","Date","RegExp"],function(e){N["is"+e]=function(t){return c.call(t)=="[object "+e+"]"}}),N.isArguments(arguments)||(N.isArguments=function(e){return!!e&&!!N.has(e,"callee")}),"function"!=typeof /./&&(N.isFunction=function(e){return"function"==typeof e}),N.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},N.isNaN=function(e){return N.isNumber(e)&&e!=+e},N.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==c.call(e)},N.isNull=function(e){return null===e},N.isUndefined=function(e){return e===void 0},N.has=function(e,t){return h.call(e,t)},N.noConflict=function(){return e._=r,this},N.identity=function(e){return e},N.times=function(e,t,n){for(var r=Array(e),i=0;e>i;i++)r[i]=t.call(n,i);return r},N.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var D={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};D.unescape=N.invert(D.escape);var P={escape:RegExp("["+N.keys(D.escape).join("")+"]","g"),unescape:RegExp("("+N.keys(D.unescape).join("|")+")","g")};N.each(["escape","unescape"],function(e){N[e]=function(t){return null==t?"":(""+t).replace(P[e],function(t){return D[e][t]})}}),N.result=function(e,t){if(null==e)return null;var n=e[t];return N.isFunction(n)?n.call(e):n},N.mixin=function(e){C(N.functions(e),function(t){var n=N[t]=e[t];N.prototype[t]=function(){var e=[this._wrapped];return a.apply(e,arguments),I.call(this,n.apply(N,e))}})};var H=0;N.uniqueId=function(e){var t=++H+"";return e?e+t:t},N.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var B=/(.)^/,j={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},F=/\\|'|\r|\n|\t|\u2028|\u2029/g;N.template=function(e,t,n){var r;n=N.defaults({},n,N.templateSettings);var i=RegExp([(n.escape||B).source,(n.interpolate||B).source,(n.evaluate||B).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(F,function(e){return"\\"+j[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,N);var a=function(e){return r.call(this,e,N)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},N.chain=function(e){return N(e).chain()};var I=function(e){return this._chain?N(e).chain():e};N.mixin(N),C(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=s[e];N.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!=e&&"splice"!=e||0!==n.length||delete n[0],I.call(this,n)}}),C(["concat","join","slice"],function(e){var t=s[e];N.prototype[e]=function(){return I.call(this,t.apply(this._wrapped,arguments))}}),N.extend(N.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},_:"@underscore",backbone:function(e,t,n){(function(){var n=this,r=n.Backbone,i=[],s=i.push,o=i.slice,u=i.splice,a;typeof t!="undefined"?a=t:a=n.Backbone={},a.VERSION="1.0.0";var f=n._;!f&&typeof e!="undefined"&&(f=e("underscore")),a.$=n.jQuery||n.Zepto||n.ender||n.$,a.noConflict=function(){return n.Backbone=r,this},a.emulateHTTP=!1,a.emulateJSON=!1;var l=a.Events={on:function(e,t,n){if(!h(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,n){if(!h(this,"once",e,[t,n])||!t)return this;var r=this,i=f.once(function(){r.off(e,i),t.apply(this,arguments)});return i._callback=t,this.on(e,i,n)},off:function(e,t,n){var r,i,s,o,u,a,l,c;if(!this._events||!h(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events={},this;o=e?[e]:f.keys(this._events);for(u=0,a=o.length;u<a;u++){e=o[u];if(s=this._events[e]){this._events[e]=r=[];if(t||n)for(l=0,c=s.length;l<c;l++)i=s[l],(t&&t!==i.callback&&t!==i.callback._callback||n&&n!==i.context)&&r.push(i);r.length||delete this._events[e]}}return this},trigger:function(e){if(!this._events)return this;var t=o.call(arguments,1);if(!h(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&p(n,t),r&&p(r,arguments),this},stopListening:function(e,t,n){var r=this._listeners;if(!r)return this;var i=!t&&!n;typeof t=="object"&&(n=this),e&&((r={})[e._listenerId]=e);for(var s in r)r[s].off(t,n,this),i&&delete this._listeners[s];return this}},c=/\s+/,h=function(e,t,n,r){if(!n)return!0;if(typeof n=="object"){for(var i in n)e[t].apply(e,[i,n[i]].concat(r));return!1}if(c.test(n)){var s=n.split(c);for(var o=0,u=s.length;o<u;o++)e[t].apply(e,[s[o]].concat(r));return!1}return!0},p=function(e,t){var n,r=-1,i=e.length,s=t[0],o=t[1],u=t[2];switch(t.length){case 0:while(++r<i)(n=e[r]).callback.call(n.ctx);return;case 1:while(++r<i)(n=e[r]).callback.call(n.ctx,s);return;case 2:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o);return;case 3:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o,u);return;default:while(++r<i)(n=e[r]).callback.apply(n.ctx,t)}},d={listenTo:"on",listenToOnce:"once"};f.each(d,function(e,t){l[t]=function(t,n,r){var i=this._listeners||(this._listeners={}),s=t._listenerId||(t._listenerId=f.uniqueId("l"));return i[s]=t,typeof n=="object"&&(r=this),t[e](n,r,this),this}}),l.bind=l.on,l.unbind=l.off,f.extend(a,l);var v=a.Model=function(e,t){var n,r=e||{};t||(t={}),this.cid=f.uniqueId("c"),this.attributes={},f.extend(this,f.pick(t,m)),t.parse&&(r=this.parse(r,t)||{});if(n=f.result(this,"defaults"))r=f.defaults({},r,n);this.set(r,t),this.changed={},this.initialize.apply(this,arguments)},m=["url","urlRoot","collection"];f.extend(v.prototype,l,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return f.clone(this.attributes)},sync:function(){return a.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return f.escape(this.get(e))},has:function(e){return this.get(e)!=null},set:function(e,t,n){var r,i,s,o,u,a,l,c;if(e==null)return this;typeof e=="object"?(i=e,n=t):(i={})[e]=t,n||(n={});if(!this._validate(i,n))return!1;s=n.unset,u=n.silent,o=[],a=this._changing,this._changing=!0,a||(this._previousAttributes=f.clone(this.attributes),this.changed={}),c=this.attributes,l=this._previousAttributes,this.idAttribute in i&&(this.id=i[this.idAttribute]);for(r in i)t=i[r],f.isEqual(c[r],t)||o.push(r),f.isEqual(l[r],t)?delete this.changed[r]:this.changed[r]=t,s?delete c[r]:c[r]=t;if(!u){o.length&&(this._pending=!0);for(var h=0,p=o.length;h<p;h++)this.trigger("change:"+o[h],this,c[o[h]],n)}if(a)return this;if(!u)while(this._pending)this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,f.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var n in this.attributes)t[n]=void 0;return this.set(t,f.extend({},e,{unset:!0}))},hasChanged:function(e){return e==null?!f.isEmpty(this.changed):f.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?f.clone(this.changed):!1;var t,n=!1,r=this._changing?this._previousAttributes:this.attributes;for(var i in e){if(f.isEqual(r[i],t=e[i]))continue;(n||(n={}))[i]=t}return n},previous:function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},previousAttributes:function(){return f.clone(this._previousAttributes)},fetch:function(e){e=e?f.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=this,n=e.success;return e.success=function(r){if(!t.set(t.parse(r,e),e))return!1;n&&n(t,r,e),t.trigger("sync",t,r,e)},I(this,e),this.sync("read",this,e)},save:function(e,t,n){var r,i,s,o=this.attributes;e==null||typeof e=="object"?(r=e,n=t):(r={})[e]=t;if(r&&(!n||!n.wait)&&!this.set(r,n))return!1;n=f.extend({validate:!0},n);if(!this._validate(r,n))return!1;r&&n.wait&&(this.attributes=f.extend({},o,r)),n.parse===void 0&&(n.parse=!0);var u=this,a=n.success;return n.success=function(e){u.attributes=o;var t=u.parse(e,n);n.wait&&(t=f.extend(r||{},t));if(f.isObject(t)&&!u.set(t,n))return!1;a&&a(u,e,n),u.trigger("sync",u,e,n)},I(this,n),i=this.isNew()?"create":n.patch?"patch":"update",i==="patch"&&(n.attrs=r),s=this.sync(i,this,n),r&&n.wait&&(this.attributes=o),s},destroy:function(e){e=e?f.clone(e):{};var t=this,n=e.success,r=function(){t.trigger("destroy",t,t.collection,e)};e.success=function(i){(e.wait||t.isNew())&&r(),n&&n(t,i,e),t.isNew()||t.trigger("sync",t,i,e)};if(this.isNew())return e.success(),!1;I(this,e);var i=this.sync("delete",this,e);return e.wait||r(),i},url:function(){var e=f.result(this,"urlRoot")||f.result(this.collection,"url")||F();return this.isNew()?e:e+(e.charAt(e.length-1)==="/"?"":"/")+encodeURIComponent(this.id)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},isValid:function(e){return this._validate({},f.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=f.extend({},this.attributes,e);var n=this.validationError=this.validate(e,t)||null;return n?(this.trigger("invalid",this,n,f.extend(t||{},{validationError:n})),!1):!0}});var g=["keys","values","pairs","invert","pick","omit"];f.each(g,function(e){v.prototype[e]=function(){var t=o.call(arguments);return t.unshift(this.attributes),f[e].apply(f,t)}});var y=a.Collection=function(e,t){t||(t={}),t.url&&(this.url=t.url),t.model&&(this.model=t.model),t.comparator!==void 0&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,f.extend({silent:!0},t))},b={add:!0,remove:!0,merge:!0},w={add:!0,merge:!1,remove:!1};f.extend(y.prototype,l,{model:v,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return a.sync.apply(this,arguments)},add:function(e,t){return this.set(e,f.defaults(t||{},w))},remove:function(e,t){e=f.isArray(e)?e.slice():[e],t||(t={});var n,r,i,s;for(n=0,r=e.length;n<r;n++){s=this.get(e[n]);if(!s)continue;delete this._byId[s.id],delete this._byId[s.cid],i=this.indexOf(s),this.models.splice(i,1),this.length--,t.silent||(t.index=i,s.trigger("remove",s,this,t)),this._removeReference(s)}return this},set:function(e,t){t=f.defaults(t||{},b),t.parse&&(e=this.parse(e,t)),f.isArray(e)||(e=e?[e]:[]);var n,r,i,o,a,l,c=t.at,h=this.comparator&&c==null&&t.sort!==!1,p=f.isString(this.comparator)?this.comparator:null,d=[],v=[],m={};for(n=0,r=e.length;n<r;n++){if(!(i=this._prepareModel(e[n],t)))continue;(a=this.get(i))?(t.remove&&(m[a.cid]=!0),t.merge&&(a.set(i.attributes,t),h&&!l&&a.hasChanged(p)&&(l=!0))):t.add&&(d.push(i),i.on("all",this._onModelEvent,this),this._byId[i.cid]=i,i.id!=null&&(this._byId[i.id]=i))}if(t.remove){for(n=0,r=this.length;n<r;++n)m[(i=this.models[n]).cid]||v.push(i);v.length&&this.remove(v,t)}d.length&&(h&&(l=!0),this.length+=d.length,c!=null?u.apply(this.models,[c,0].concat(d)):s.apply(this.models,d)),l&&this.sort({silent:!0});if(t.silent)return this;for(n=0,r=d.length;n<r;n++)(i=d[n]).trigger("add",i,this,t);return l&&this.trigger("sort",this,t),this},reset:function(e,t){t||(t={});for(var n=0,r=this.models.length;n<r;n++)this._removeReference(this.models[n]);return t.previousModels=this.models,this._reset(),this.add(e,f.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),this},push:function(e,t){return e=this._prepareModel(e,t),this.add(e,f.extend({at:this.length},t)),e},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return e=this._prepareModel(e,t),this.add(e,f.extend({at:0},t)),e},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(e,t){return this.models.slice(e,t)},get:function(e){return e==null?void 0:this._byId[e.id!=null?e.id:e.cid||e]},at:function(e){return this.models[e]},where:function(e,t){return f.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),f.isString(this.comparator)||this.comparator.length===1?this.models=this.sortBy(this.comparator,this):this.models.sort(f.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},sortedIndex:function(e,t,n){t||(t=this.comparator);var r=f.isFunction(t)?t:function(e){return e.get(t)};return f.sortedIndex(this.models,e,r,n)},pluck:function(e){return f.invoke(this.models,"get",e)},fetch:function(e){e=e?f.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=e.success,n=this;return e.success=function(r){var i=e.reset?"reset":"set";n[i](r,e),t&&t(n,r,e),n.trigger("sync",n,r,e)},I(this,e),this.sync("read",this,e)},create:function(e,t){t=t?f.clone(t):{};if(!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var n=this,r=t.success;return t.success=function(i){t.wait&&n.add(e,t),r&&r(e,i,t)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof v)return e.collection||(e.collection=this),e;t||(t={}),t.collection=this;var n=new this.model(e,t);return n._validate(e,t)?n:(this.trigger("invalid",this,e,t),!1)},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if((e==="add"||e==="remove")&&n!==this)return;e==="destroy"&&this.remove(t,r),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],t.id!=null&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments)}});var E=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","indexOf","shuffle","lastIndexOf","isEmpty","chain"];f.each(E,function(e){y.prototype[e]=function(){var t=o.call(arguments);return t.unshift(this.models),f[e].apply(f,t)}});var S=["groupBy","countBy","sortBy"];f.each(S,function(e){y.prototype[e]=function(t,n){var r=f.isFunction(t)?t:function(e){return e.get(t)};return f[e](this.models,r,n)}});var x=a.View=function(e){this.cid=f.uniqueId("view"),this._configure(e||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},T=/^(\S+)\s*(.*)$/,N=["model","collection","el","id","attributes","className","tagName","events"];f.extend(x.prototype,l,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=e instanceof a.$?e:a.$(e),this.el=this.$el[0],t!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=f.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var n=e[t];f.isFunction(n)||(n=this[e[t]]);if(!n)continue;var r=t.match(T),i=r[1],s=r[2];n=f.bind(n,this),i+=".delegateEvents"+this.cid,s===""?this.$el.on(i,n):this.$el.on(i,s,n)}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_configure:function(e){this.options&&(e=f.extend({},f.result(this,"options"),e)),f.extend(this,f.pick(e,N)),this.options=e},_ensureElement:function(){if(!this.el){var e=f.extend({},f.result(this,"attributes"));this.id&&(e.id=f.result(this,"id")),this.className&&(e["class"]=f.result(this,"className"));var t=a.$("<"+f.result(this,"tagName")+">").attr(e);this.setElement(t,!1)}else this.setElement(f.result(this,"el"),!1)}}),a.sync=function(e,t,n){var r=C[e];f.defaults(n||(n={}),{emulateHTTP:a.emulateHTTP,emulateJSON:a.emulateJSON});var i={type:r,dataType:"json"};n.url||(i.url=f.result(t,"url")||F()),n.data==null&&t&&(e==="create"||e==="update"||e==="patch")&&(i.contentType="application/json",i.data=JSON.stringify(n.attrs||t.toJSON(n))),n.emulateJSON&&(i.contentType="application/x-www-form-urlencoded",i.data=i.data?{model:i.data}:{});if(n.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){i.type="POST",n.emulateJSON&&(i.data._method=r);var s=n.beforeSend;n.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",r);if(s)return s.apply(this,arguments)}}i.type!=="GET"&&!n.emulateJSON&&(i.processData=!1),i.type==="PATCH"&&window.ActiveXObject&&(!window.external||!window.external.msActiveXFilteringEnabled)&&(i.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var o=n.xhr=a.ajax(f.extend(i,n));return t.trigger("request",t,o,n),o};var C={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};a.ajax=function(){return a.$.ajax.apply(a.$,arguments)};var k=a.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},L=/\((.*?)\)/g,A=/(\(\?)?:\w+/g,O=/\*\w+/g,M=/[\-{}\[\]+?.,\\\^$|#\s]/g;f.extend(k.prototype,l,{initialize:function(){},route:function(e,t,n){f.isRegExp(e)||(e=this._routeToRegExp(e)),f.isFunction(t)&&(n=t,t=""),n||(n=this[t]);var r=this;return a.history.route(e,function(i){var s=r._extractParameters(e,i);n&&n.apply(r,s),r.trigger.apply(r,["route:"+t].concat(s)),r.trigger("route",t,s),a.history.trigger("route",r,t,s)}),this},navigate:function(e,t){return a.history.navigate(e,t),this},_bindRoutes:function(){if(!this.routes)return;this.routes=f.result(this,"routes");var e,t=f.keys(this.routes);while((e=t.pop())!=null)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(M,"\\$&").replace(L,"(?:$1)?").replace(A,function(e,t){return t?e:"([^/]+)"}).replace(O,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var n=e.exec(t).slice(1);return f.map(n,function(e){return e?decodeURIComponent(e):null})}});var _=a.History=function(){this.handlers=[],f.bindAll(this,"checkUrl"),typeof window!="undefined"&&(this.location=window.location,this.history=window.history)},D=/^[#\/]|\s+$/g,P=/^\/+|\/+$/g,H=/msie [\w.]+/,B=/\/$/;_.started=!1,f.extend(_.prototype,l,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(e==null)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(B,"");e.indexOf(n)||(e=e.substr(n.length))}else e=this.getHash();return e.replace(D,"")},start:function(e){if(_.started)throw new Error("Backbone.history has already been started");_.started=!0,this.options=f.extend({},{root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var t=this.getFragment(),n=document.documentMode,r=H.exec(navigator.userAgent.toLowerCase())&&(!n||n<=7);this.root=("/"+this.root+"/").replace(P,"/"),r&&this._wantsHashChange&&(this.iframe=a.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(t)),this._hasPushState?a.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!r?a.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=t;var i=this.location,s=i.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!s)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&s&&i.hash&&(this.fragment=this.getHash().replace(D,""),this.history.replaceState({},document.title,this.root+this.fragment+i.search));if(!this.options.silent)return this.loadUrl()},stop:function(){a.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),_.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t===this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe)));if(t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(e){var t=this.fragment=this.getFragment(e),n=f.any(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0});return n},navigate:function(e,t){if(!_.started)return!1;if(!t||t===!0)t={trigger:t};e=this.getFragment(e||"");if(this.fragment===e)return;this.fragment=e;var n=this.root+e;if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}t.trigger&&this.loadUrl(e)},_updateHash:function(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),a.history=new _;var j=function(e,t){var n=this,r;e&&f.has(e,"constructor")?r=e.constructor:r=function(){return n.apply(this,arguments)},f.extend(r,n,t);var i=function(){this.constructor=r};return i.prototype=n.prototype,r.prototype=new i,e&&f.extend(r.prototype,e),r.__super__=n.prototype,r};v.extend=y.extend=k.extend=x.extend=_.extend=j;var F=function(){throw new Error('A "url" property or function must be specified')},I=function(e,t){var n=t.error;t.error=function(r){n&&n(e,r,t),e.trigger("error",e,r,t)}}}).call(this)},disqus:function(e,t,n){var r;n.exports=function(e){return r=r||$.getScript("https://"+e+".disqus.com/embed.js").pipe(function(){return window.DISQUS}),r}}},{},{})