luca 0.9.42 → 0.9.65

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. data/CHANGELOG +50 -9
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +2 -0
  4. data/README.md +5 -0
  5. data/assets/javascripts/dependencies/underscore-min.js +5 -31
  6. data/lib/generators/luca/application/application_generator.rb +71 -0
  7. data/lib/generators/luca/application/templates/controller.rb +6 -0
  8. data/lib/generators/luca/application/templates/index.html.erb +7 -0
  9. data/lib/generators/luca/application/templates/index.html.haml +6 -0
  10. data/lib/generators/luca/application/templates/javascripts/application.js +28 -0
  11. data/lib/generators/luca/application/templates/javascripts/application.js.coffee +20 -0
  12. data/lib/generators/luca/application/templates/javascripts/config.js +15 -0
  13. data/lib/generators/luca/application/templates/javascripts/config.js.coffee +9 -0
  14. data/lib/generators/luca/application/templates/javascripts/dependencies.js +5 -0
  15. data/lib/generators/luca/application/templates/javascripts/dependencies.js.coffee +5 -0
  16. data/lib/generators/luca/application/templates/javascripts/index.js +9 -0
  17. data/lib/generators/luca/application/templates/javascripts/index.js.coffee +9 -0
  18. data/lib/generators/luca/application/templates/javascripts/main.js +8 -0
  19. data/lib/generators/luca/application/templates/javascripts/main.js.coffee +3 -0
  20. data/lib/generators/luca/application/templates/javascripts/main.jst.ejs +1 -0
  21. data/lib/generators/luca/application/templates/javascripts/router.js +12 -0
  22. data/lib/generators/luca/application/templates/javascripts/router.js.coffee +7 -0
  23. data/lib/luca/rails/version.rb +1 -1
  24. data/spec/components/collection_view_spec.coffee +59 -0
  25. data/spec/components/multi_collection_view_spec.coffee +5 -0
  26. data/{src/templates/components/form_alert → spec/components/pagination_control_spec.coffee} +0 -0
  27. data/spec/components/table_view_spec.coffee +17 -0
  28. data/spec/core/container_spec.coffee +127 -5
  29. data/spec/core/model_spec.coffee +21 -3
  30. data/spec/define_spec.coffee +19 -0
  31. data/spec/mixin_spec.coffee +49 -0
  32. data/spec/modules/filterable_spec.coffee +25 -0
  33. data/spec/modules/paginatable_spec.coffee +0 -0
  34. data/spec/modules/state_model_spec.coffee +0 -0
  35. data/src/components/application.coffee +52 -38
  36. data/src/components/collection_view.coffee +118 -45
  37. data/src/components/fields/checkbox_field.coffee +2 -2
  38. data/src/components/fields/file_upload_field.coffee +0 -3
  39. data/src/components/fields/hidden_field.coffee +0 -3
  40. data/src/components/fields/label_field.coffee +1 -4
  41. data/src/components/fields/select_field.coffee +6 -6
  42. data/src/components/fields/text_area_field.coffee +1 -0
  43. data/src/components/fields/text_field.coffee +4 -0
  44. data/src/components/fields/type_ahead_field.coffee +5 -9
  45. data/src/components/form_view.coffee +28 -23
  46. data/src/components/multi_collection_view.coffee +121 -0
  47. data/src/components/pagination_control.coffee +106 -0
  48. data/src/components/table_view.coffee +22 -13
  49. data/src/containers/card_view.coffee +44 -11
  50. data/src/containers/panel_toolbar.coffee +88 -82
  51. data/src/containers/tab_view.coffee +3 -3
  52. data/src/core/collection.coffee +11 -4
  53. data/src/core/container.coffee +206 -122
  54. data/src/core/field.coffee +13 -10
  55. data/src/core/model.coffee +23 -27
  56. data/src/core/registry.coffee +42 -29
  57. data/src/core/view.coffee +63 -149
  58. data/src/define.coffee +91 -19
  59. data/src/framework.coffee +11 -9
  60. data/src/managers/collection_manager.coffee +24 -8
  61. data/src/modules/application_event_bindings.coffee +19 -0
  62. data/src/modules/collection_event_bindings.coffee +26 -0
  63. data/src/modules/deferrable.coffee +3 -1
  64. data/src/modules/dom_helpers.coffee +49 -0
  65. data/src/modules/enhanced_properties.coffee +23 -0
  66. data/src/modules/filterable.coffee +82 -0
  67. data/src/modules/grid_layout.coffee +13 -1
  68. data/src/modules/{load_mask.coffee → loadmaskable.coffee} +10 -4
  69. data/src/modules/modal_view.coffee +38 -0
  70. data/src/modules/paginatable.coffee +87 -0
  71. data/src/modules/state_model.coffee +16 -0
  72. data/src/modules/templating.coffee +8 -0
  73. data/src/plugins/events.coffee +30 -2
  74. data/src/templates/components/bootstrap_form_controls.jst.ejs +10 -0
  75. data/src/templates/components/collection_loader_view.jst.ejs +6 -0
  76. data/src/templates/components/form_alert.jst.ejs +4 -0
  77. data/src/templates/components/grid_view.jst.ejs +11 -0
  78. data/src/templates/components/grid_view_empty_text.jst.ejs +3 -0
  79. data/src/templates/components/load_mask.jst.ejs +5 -0
  80. data/src/templates/components/nav_bar.jst.ejs +4 -0
  81. data/src/templates/components/pagination.jst.ejs +10 -0
  82. data/src/templates/containers/basic.jst.ejs +1 -0
  83. data/src/templates/containers/tab_selector_container.jst.ejs +12 -0
  84. data/src/templates/containers/tab_view.jst.ejs +2 -0
  85. data/src/templates/containers/toolbar_wrapper.jst.ejs +1 -0
  86. data/src/templates/fields/button_field.jst.ejs +2 -0
  87. data/src/templates/fields/button_field_link.jst.ejs +6 -0
  88. data/src/templates/fields/checkbox_array.jst.ejs +4 -0
  89. data/src/templates/fields/checkbox_array_item.jst.ejs +3 -0
  90. data/src/templates/fields/checkbox_field.jst.ejs +10 -0
  91. data/src/templates/fields/file_upload_field.jst.ejs +10 -0
  92. data/src/templates/fields/hidden_field.jst.ejs +1 -0
  93. data/src/templates/fields/select_field.jst.ejs +11 -0
  94. data/src/templates/fields/text_area_field.jst.ejs +11 -0
  95. data/src/templates/fields/text_field.jst.ejs +16 -0
  96. data/src/templates/table_view.jst.ejs +4 -0
  97. data/src/tools/console.coffee +51 -21
  98. data/src/util.coffee +17 -4
  99. data/vendor/assets/javascripts/luca-ui-base.js +5304 -0
  100. data/vendor/assets/javascripts/luca-ui-bootstrap.js +9 -0
  101. data/vendor/assets/javascripts/luca-ui-development-tools.js +52 -24
  102. data/vendor/assets/javascripts/luca-ui-development-tools.min.js +1 -1
  103. data/vendor/assets/javascripts/luca-ui-full.js +1700 -595
  104. data/vendor/assets/javascripts/luca-ui-full.min.js +7 -6
  105. data/vendor/assets/javascripts/luca-ui-spec.js +6815 -0
  106. data/vendor/assets/javascripts/luca-ui-templates.js +92 -24
  107. data/vendor/assets/javascripts/luca-ui.js +1695 -564
  108. data/vendor/assets/javascripts/luca-ui.min.js +4 -4
  109. metadata +69 -28
  110. data/src/templates/components/bootstrap_form_controls.luca +0 -7
  111. data/src/templates/components/collection_loader_view.luca +0 -5
  112. data/src/templates/components/form_alert.luca +0 -3
  113. data/src/templates/components/grid_view.luca +0 -7
  114. data/src/templates/components/grid_view_empty_text.luca +0 -3
  115. data/src/templates/components/load_mask.luca +0 -3
  116. data/src/templates/components/nav_bar.luca +0 -2
  117. data/src/templates/containers/basic.luca +0 -1
  118. data/src/templates/containers/tab_selector_container.luca +0 -8
  119. data/src/templates/containers/tab_view.luca +0 -2
  120. data/src/templates/containers/toolbar_wrapper.luca +0 -1
  121. data/src/templates/fields/button_field.luca +0 -2
  122. data/src/templates/fields/button_field_link.luca +0 -5
  123. data/src/templates/fields/checkbox_array.luca +0 -4
  124. data/src/templates/fields/checkbox_array_item.luca +0 -4
  125. data/src/templates/fields/checkbox_field.luca +0 -9
  126. data/src/templates/fields/file_upload_field.luca +0 -8
  127. data/src/templates/fields/hidden_field.luca +0 -1
  128. data/src/templates/fields/select_field.luca +0 -8
  129. data/src/templates/fields/text_area_field.luca +0 -8
  130. data/src/templates/fields/text_field.luca +0 -17
  131. data/src/templates/sample/contents.luca +0 -1
  132. data/src/templates/sample/welcome.luca +0 -1
  133. data/src/templates/table_view.luca +0 -4
@@ -1,8 +1,9 @@
1
1
  /*! jQuery v1.7.1 jquery.com | jquery.org/license */(function(a,b){function c(a){return K.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function d(a){if(!pc[a]){var b=H.body,c=K("<"+a+">").appendTo(b),d=c.css("display");c.remove();if(d==="none"||d===""){qc||(qc=H.createElement("iframe"),qc.frameBorder=qc.width=qc.height=0),b.appendChild(qc);if(!rc||!qc.createElement)rc=(qc.contentWindow||qc.contentDocument).document,rc.write((H.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),rc.close();c=rc.createElement(a),rc.body.appendChild(c),d=K.css(c,"display"),b.removeChild(qc)}pc[a]=d}return pc[a]}function e(a,b){var c={};return K.each(vc.concat.apply([],vc.slice(0,b)),function(){c[this]=a}),c}function f(){wc=b}function g(){return setTimeout(f,0),wc=K.now()}function h(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function i(){try{return new a.XMLHttpRequest}catch(b){}}function j(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},f,g,h=d.length,i,j=d[0],k,l,m,n,o;for(f=1;f<h;f++){if(f===1)for(g in a.converters)typeof g=="string"&&(e[g.toLowerCase()]=a.converters[g]);k=j,j=d[f];if(j==="*")j=k;else if(k!=="*"&&k!==j){l=k+" "+j,m=e[l]||e["* "+j];if(!m){o=b;for(n in e){i=n.split(" ");if(i[0]===k||i[0]==="*"){o=e[i[1]+" "+j];if(o){n=e[n],n===!0?m=o:o===!0&&(m=n);break}}}}!m&&!o&&K.error("No conversion from "+l.replace(" "," to ")),m!==!0&&(c=m?m(c):o(n(c)))}}return c}function k(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j)return j!==f[0]&&f.unshift(j),d[j]}function l(a,b,c,d){if(K.isArray(b))K.each(b,function(b,e){c||Rb.test(a)?d(a,e):l(a+"["+(typeof e=="object"||K.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)l(a+"["+e+"]",b[e],c,d);else d(a,b)}function m(a,c){var d,e,f=K.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&K.extend(!0,a,e)}function n(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===ec,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=n(a,c,d,e,l,g)));return(k||!l)&&!g["*"]&&(l=n(a,c,d,e,"*",g)),l}function o(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(K.isFunction(c)){var d=b.toLowerCase().split(ac),e=0,f=d.length,g,h,i;for(;e<f;e++)g=d[e],i=/^\+/.test(g),i&&(g=g.substr(1)||"*"),h=a[g]=a[g]||[],h[i?"unshift":"push"](c)}}}function p(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?Lb:Mb,f=0,g=e.length;if(d>0){if(c!=="border")for(;f<g;f++)c||(d-=parseFloat(K.css(a,"padding"+e[f]))||0),c==="margin"?d+=parseFloat(K.css(a,c+e[f]))||0:d-=parseFloat(K.css(a,"border"+e[f]+"Width"))||0;return d+"px"}d=Nb(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;f<g;f++)d+=parseFloat(K.css(a,"padding"+e[f]))||0,c!=="padding"&&(d+=parseFloat(K.css(a,"border"+e[f]+"Width"))||0),c==="margin"&&(d+=parseFloat(K.css(a,c+e[f]))||0);return d+"px"}function q(a,b){b.src?K.ajax({url:b.src,async:!1,dataType:"script"}):K.globalEval((b.text||b.textContent||b.innerHTML||"").replace(Bb,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function r(a){var b=H.createElement("div");return Db.appendChild(b),b.innerHTML=a.outerHTML,b.firstChild}function s(a){var b=(a.nodeName||"").toLowerCase();b==="input"?t(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&K.grep(a.getElementsByTagName("input"),t)}function t(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function u(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function v(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(K.expando)}}function w(a,b){if(b.nodeType===1&&!!K.hasData(a)){var c,d,e,f=K._data(a),g=K._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)K.event.add(b,c+(h[c][d].namespace?".":"")+h[c][d].namespace,h[c][d],h[c][d].data)}g.data&&(g.data=K.extend({},g.data))}}function x(a,b){return K.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function y(a){var b=pb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function z(a,b,c){b=b||0;if(K.isFunction(b))return K.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return K.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=K.grep(a,function(a){return a.nodeType===1});if(lb.test(b))return K.filter(b,d,!c);b=K.filter(b,d)}return K.grep(a,function(a,d){return K.inArray(a,b)>=0===c})}function A(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function B(){return!0}function C(){return!1}function D(a,b,c){var d=b+"defer",e=b+"queue",f=b+"mark",g=K._data(a,d);g&&(c==="queue"||!K._data(a,e))&&(c==="mark"||!K._data(a,f))&&setTimeout(function(){!K._data(a,e)&&!K._data(a,f)&&(K.removeData(a,d,!0),g.fire())},0)}function E(a){for(var b in a){if(b==="data"&&K.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function F(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(O,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:K.isNumeric(d)?parseFloat(d):N.test(d)?K.parseJSON(d):d}catch(f){}K.data(a,c,d)}else d=b}return d}function G(a){var b=L[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var H=a.document,I=a.navigator,J=a.location,K=function(){function c(){if(!d.isReady){try{H.documentElement.doScroll("left")}catch(a){setTimeout(c,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,m=/^[\],:{}\s]*$/,n=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,o=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,p=/(?:^|:|,)(?:\s*\[)+/g,q=/(webkit)[ \/]([\w.]+)/,r=/(opera)(?:.*version)?[ \/]([\w.]+)/,s=/(msie) ([\w.]+)/,t=/(mozilla)(?:.*? rv:([\w.]+))?/,u=/-([a-z]|[0-9])/ig,v=/^-ms-/,w=function(a,b){return(b+"").toUpperCase()},x=I.userAgent,y,z,A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,J={};return d.fn=d.prototype={constructor:d,init:function(a,c,e){var f,g,i,j;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(a==="body"&&!c&&H.body)return this.context=H,this[0]=H.body,this.selector=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?f=h.exec(a):f=[null,a,null];if(f&&(f[1]||!c)){if(f[1])return c=c instanceof d?c[0]:c,j=c?c.ownerDocument||c:H,i=l.exec(a),i?d.isPlainObject(c)?(a=[H.createElement(i[1])],d.fn.attr.call(a,c,!0)):a=[j.createElement(i[1])]:(i=d.buildFragment([f[1]],[j]),a=(i.cacheable?d.clone(i.fragment):i.fragment).childNodes),d.merge(this,a);g=H.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return e.find(a);this.length=1,this[0]=g}return this.context=H,this.selector=a,this}return!c||c.jquery?(c||e).find(a):this.constructor(c).find(a)}return d.isFunction(a)?e.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),d.makeArray(a,this))},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();return d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")"),e},each:function(a,b){return d.each(this,a,b)},ready:function(a){return d.bindReady(),z.add(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){e=i[c],f=a[c];if(i===f)continue;l&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,h=e&&d.isArray(e)?e:[]):h=e&&d.isPlainObject(e)?e:{},i[c]=d.extend(l,h,f)):f!==b&&(i[c]=f)}return i},d.extend({noConflict:function(b){return a.$===d&&(a.$=f),b&&a.jQuery===d&&(a.jQuery=e),d},isReady:!1,readyWait:1,holdReady:function(a){a?d.readyWait++:d.ready(!0)},ready:function(a){if(a===!0&&!--d.readyWait||a!==!0&&!d.isReady){if(!H.body)return setTimeout(d.ready,1);d.isReady=!0;if(a!==!0&&--d.readyWait>0)return;z.fireWith(H,[d]),d.fn.trigger&&d(H).trigger("ready").off("ready")}},bindReady:function(){if(!z){z=d.Callbacks("once memory");if(H.readyState==="complete")return setTimeout(d.ready,1);if(H.addEventListener)H.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(H.attachEvent){H.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}H.documentElement.doScroll&&b&&c()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):J[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;try{if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var e;for(e in a);return e===b||C.call(a,e)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=d.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(m.test(b.replace(n,"@").replace(o,"]").replace(p,"")))return(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(c){var e,f;try{a.DOMParser?(f=new DOMParser,e=f.parseFromString(c,"text/xml")):(e=new ActiveXObject("Microsoft.XMLDOM"),e.async="false",e.loadXML(c))}catch(g){e=b}return(!e||!e.documentElement||e.getElementsByTagName("parsererror").length)&&d.error("Invalid XML: "+c),e},noop:function(){},globalEval:function(b){b&&i.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(v,"ms-").replace(u,w)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g<h;)if(c.apply(a[g++],e)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:F?function(a){return a==null?"":F.call(a)}:function(a){return a==null?"":(a+"").replace(j,"").replace(k,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var e=d.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||d.isWindow(a)?D.call(c,a):d.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(G)return G.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];return a.length=d,a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,e){var f,g,h=[],i=0,j=a.length,k=a instanceof d||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||d.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,e),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,e),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var e=a[c];c=a,a=e}if(!d.isFunction(a))return b;var f=E.call(arguments,2),g=function(){return a.apply(c,f.concat(E.call(arguments)))};return g.guid=a.guid=a.guid||g.guid||d.guid++,g},access:function(a,c,e,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)d.access(a,j,c[j],f,g,e);return a}if(e!==b){f=!h&&f&&d.isFunction(e);for(var k=0;k<i;k++)g(a[k],c,f?e.call(a[k],k,g(a[k],c)):e,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=q.exec(a)||r.exec(a)||s.exec(a)||a.indexOf("compatible")<0&&t.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(c,e){return e&&e instanceof d&&!(e instanceof a)&&(e=a(e)),d.fn.init.call(this,c,e,b)},a.fn.init.prototype=a.fn;var b=a(H);return a},browser:{}}),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),y=d.uaMatch(x),y.browser&&(d.browser[y.browser]=!0,d.browser.version=y.version),d.browser.webkit&&(d.browser.safari=!0),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(H),H.addEventListener?A=function(){H.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:H.attachEvent&&(A=function(){H.readyState==="complete"&&(H.detachEvent("onreadystatechange",A),d.ready())}),d}(),L={};K.Callbacks=function(a){a=a?L[a]||G(a):{};var c=[],d=[],e,f,g,h,i,j=function(b){var d,e,f,g,h;for(d=0,e=b.length;d<e;d++)f=b[d],g=K.type(f),g==="array"?j(f):g==="function"&&(!a.unique||!l.has(f))&&c.push(f)},k=function(b,j){j=j||[],e=!a.memory||[b,j],f=!0,i=g||0,g=0,h=c.length;for(;c&&i<h;i++)if(c[i].apply(b,j)===!1&&a.stopOnFalse){e=!0;break}f=!1,c&&(a.once?e===!0?l.disable():c=[]:d&&d.length&&(e=d.shift(),l.fireWith(e[0],e[1])))},l={add:function(){if(c){var a=c.length;j(arguments),f?h=c.length:e&&e!==!0&&(g=a,k(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var g=0;g<c.length;g++)if(b[d]===c[g]){f&&g<=h&&(h--,g<=i&&i--),c.splice(g--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){return c=[],this},disable:function(){return c=d=e=b,this},disabled:function(){return!c},lock:function(){return d=b,(!e||e===!0)&&l.disable(),this},locked:function(){return!d},fireWith:function(b,c){return d&&(f?a.once||d.push([b,c]):(!a.once||!e)&&k(b,c)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!e}};return l};var M=[].slice;K.extend({Deferred:function(a){var b=K.Callbacks("once memory"),c=K.Callbacks("once memory"),d=K.Callbacks("memory"),e="pending",f={resolve:b,reject:c,notify:d},g={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){return h.done(a).fail(b).progress(c),this},always:function(){return h.done.apply(h,arguments).fail.apply(h,arguments),this},pipe:function(a,b,c){return K.Deferred(function(d){K.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],f;K.isFunction(c)?h[a](function(){f=c.apply(this,arguments),f&&K.isFunction(f.promise)?f.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===h?d:this,[f])}):h[a](d[e])})}).promise()},promise:function(a){if(a==null)a=g;else for(var b in g)a[b]=g[b];return a}},h=g.promise({}),i;for(i in f)h[i]=f[i].fire,h[i+"With"]=f[i].fireWith;return h.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(h,h),h},when:function(a){function b(a){return function(b){g[a]=arguments.length>1?M.call(arguments,0):b,j.notifyWith(k,g)}}function c(a){return function(b){d[a]=arguments.length>1?M.call(arguments,0):b,--h||j.resolveWith(j,d)}}var d=M.call(arguments,0),e=0,f=d.length,g=Array(f),h=f,i=f,j=f<=1&&a&&K.isFunction(a.promise)?a:K.Deferred(),k=j.promise();if(f>1){for(;e<f;e++)d[e]&&d[e].promise&&K.isFunction(d[e].promise)?d[e].promise().then(c(e),j.reject,b(e)):--h;h||j.resolveWith(j,d)}else j!==a&&j.resolveWith(j,f?[a]:[]);return k}}),K.support=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o=H.createElement("div"),p=H.documentElement;o.setAttribute("className","t"),o.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",c=o.getElementsByTagName("*"),d=o.getElementsByTagName("a")[0];if(!c||!c.length||!d)return{};e=H.createElement("select"),f=e.appendChild(H.createElement("option")),g=o.getElementsByTagName("input")[0],b={leadingWhitespace:o.firstChild.nodeType===3,tbody:!o.getElementsByTagName("tbody").length,htmlSerialize:!!o.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.55/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:g.value==="on",optSelected:f.selected,getSetAttribute:o.className!=="t",enctype:!!H.createElement("form").enctype,html5Clone:H.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},g.checked=!0,b.noCloneChecked=g.cloneNode(!0).checked,e.disabled=!0,b.optDisabled=!f.disabled;try{delete o.test}catch(q){b.deleteExpando=!1}!o.addEventListener&&o.attachEvent&&o.fireEvent&&(o.attachEvent("onclick",function(){b.noCloneEvent=!1}),o.cloneNode(!0).fireEvent("onclick")),g=H.createElement("input"),g.value="t",g.setAttribute("type","radio"),b.radioValue=g.value==="t",g.setAttribute("checked","checked"),o.appendChild(g),i=H.createDocumentFragment(),i.appendChild(o.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=g.checked,i.removeChild(g),i.appendChild(o),o.innerHTML="",a.getComputedStyle&&(h=H.createElement("div"),h.style.width="0",h.style.marginRight="0",o.style.width="2px",o.appendChild(h),b.reliableMarginRight=(parseInt((a.getComputedStyle(h,null)||{marginRight:0}).marginRight,10)||0)===0);if(o.attachEvent)for(m in{submit:1,change:1,focusin:1})l="on"+m,n=l in o,n||(o.setAttribute(l,"return;"),n=typeof o[l]=="function"),b[m+"Bubbles"]=n;return i.removeChild(o),i=e=f=h=o=g=null,K(function(){var a,c,d,e,f,g,h,i,k,l,m,p=H.getElementsByTagName("body")[0];!p||(h=1,i="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",k="visibility:hidden;border:0;",l="style='"+i+"border:5px solid #000;padding:0;'",m="<div "+l+"><div></div></div>"+"<table "+l+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=H.createElement("div"),a.style.cssText=k+"width:0;height:0;position:static;top:0;margin-top:"+h+"px",p.insertBefore(a,p.firstChild),o=H.createElement("div"),a.appendChild(o),o.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",j=o.getElementsByTagName("td"),n=j[0].offsetHeight===0,j[0].style.display="",j[1].style.display="none",b.reliableHiddenOffsets=n&&j[0].offsetHeight===0,o.innerHTML="",o.style.width=o.style.paddingLeft="1px",K.boxModel=b.boxModel=o.offsetWidth===2,typeof o.style.zoom!="undefined"&&(o.style.display="inline",o.style.zoom=1,b.inlineBlockNeedsLayout=o.offsetWidth===2,o.style.display="",o.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=o.offsetWidth!==2),o.style.cssText=i+k,o.innerHTML=m,c=o.firstChild,d=c.firstChild,f=c.nextSibling.firstChild.firstChild,g={doesNotAddBorder:d.offsetTop!==5,doesAddBorderForTableAndCells:f.offsetTop===5},d.style.position="fixed",d.style.top="20px",g.fixedPosition=d.offsetTop===20||d.offsetTop===15,d.style.position=d.style.top="",c.style.overflow="hidden",c.style.position="relative",g.subtractsBorderForOverflowNotVisible=d.offsetTop===-5,g.doesNotIncludeMarginInBodyOffset=p.offsetTop!==h,p.removeChild(a),o=a=null,K.extend(b,g))}),b}();var N=/^(?:\{.*\}|\[.*\])$/,O=/([A-Z])/g;K.extend({cache:{},uuid:0,expando:"jQuery"+(K.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?K.cache[a[K.expando]]:a[K.expando],!!a&&!E(a)},data:function(a,c,d,e){if(!!K.acceptData(a)){var f,g,h,i=K.expando,j=typeof c=="string",k=a.nodeType,l=k?K.cache:a,m=k?a[i]:a[i]&&i,n=c==="events";if((!m||!l[m]||!n&&!e&&!l[m].data)&&j&&d===b)return;m||(k?a[i]=m=++K.uuid:m=i),l[m]||(l[m]={},k||(l[m].toJSON=K.noop));if(typeof c=="object"||typeof c=="function")e?l[m]=K.extend(l[m],c):l[m].data=K.extend(l[m].data,c);return f=g=l[m],e||(g.data||(g.data={}),g=g.data),d!==b&&(g[K.camelCase(c)]=d),n&&!g[c]?f.events:(j?(h=g[c],h==null&&(h=g[K.camelCase(c)])):h=g,h)}},removeData:function(a,b,c){if(!!K.acceptData(a)){var d,e,f,g=K.expando,h=a.nodeType,i=h?K.cache:a,j=h?a[g]:g;if(!i[j])return;if(b){d=c?i[j]:i[j].data;if(d){K.isArray(b)||(b in d?b=[b]:(b=K.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?E:K.isEmptyObject)(d))return}}if(!c){delete i[j].data;if(!E(i[j]))return}K.support.deleteExpando||!i.setInterval?delete i[j]:i[j]=null,h&&(K.support.deleteExpando?delete a[g]:a.removeAttribute?a.removeAttribute(g):a[g]=null)}},_data:function(a,b,c){return K.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=K.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),K.fn.extend({data:function(a,c){var d,e,f,g=null;if(typeof a=="undefined"){if(this.length){g=K.data(this[0]);if(this[0].nodeType===1&&!K._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var h=0,i=e.length;h<i;h++)f=e[h].name,f.indexOf("data-")===0&&(f=K.camelCase(f.substring(5)),F(this[0],f,g[f]));K._data(this[0],"parsedAttrs",!0)}}return g}return typeof a=="object"?this.each(function(){K.data(this,a)}):(d=a.split("."),d[1]=d[1]?"."+d[1]:"",c===b?(g=this.triggerHandler("getData"+d[1]+"!",[d[0]]),g===b&&this.length&&(g=K.data(this[0],a),g=F(this[0],a,g)),g===b&&d[1]?this.data(d[0]):g):this.each(function(){var b=K(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),K.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)}))},removeData:function(a){return this.each(function(){K.removeData(this,a)})}}),K.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",K._data(a,b,(K._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(K._data(b,d)||1)-1;e?K._data(b,d,e):(K.removeData(b,d,!0),D(b,c,"mark"))}},queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=K._data(a,b),c&&(!d||K.isArray(c)?d=K._data(a,b,K.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=K.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),K._data(a,b+".run",e),d.call(a,function(){K.dequeue(a,b)},e)),c.length||(K.removeData(a,b+"queue "+b+".run",!0),D(a,b,"queue"))}}),K.fn.extend({queue:function(a,c){return typeof a!="string"&&(c=a,a="fx"),c===b?K.queue(this[0],a):this.each(function(){var b=K.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&K.dequeue(this,a)})},dequeue:function(a){return this.each(function(){K.dequeue(this,a)})},delay:function(a,b){return a=K.fx?K.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function d(){--h||e.resolveWith(f,[f])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var e=K.Deferred(),f=this,g=f.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=K.data(f[g],i,b,!0)||(K.data(f[g],j,b,!0)||K.data(f[g],k,b,!0))&&K.data(f[g],i,K.Callbacks("once memory"),!0))h++,l.add(d);return d(),e.promise()}});var P=/[\n\t\r]/g,Q=/\s+/,R=/\r/g,S=/^(?:button|input)$/i,T=/^(?:button|input|object|select|textarea)$/i,U=/^a(?:rea)?$/i,V=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,W=K.support.getSetAttribute,X,Y,Z;K.fn.extend({attr:function(a,b){return K.access(this,a,b,!0,K.attr)},removeAttr:function(a){return this.each(function(){K.removeAttr(this,a)})},prop:function(a,b){return K.access(this,a,b,!0,K.prop)},removeProp:function(a){return a=K.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(K.isFunction(a))return this.each(function(b){K(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(Q);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)~f.indexOf(" "+b[g]+" ")||(f+=b[g]+" ");e.className=K.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(K.isFunction(a))return this.each(function(b){K(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(Q);for(d=0,e=this.length;d<e;d++){f=this[d];if(f.nodeType===1&&f.className)if(a){g=(" "+f.className+" ").replace(P," ");for(h=0,i=c.length;h<i;h++)g=g.replace(" "+c[h]+" "," ");f.className=K.trim(g)}else f.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return K.isFunction(a)?this.each(function(c){K(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=K(this),h=b,i=a.split(Q);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&K._data(this,"__className__",this.className),this.className=this.className||a===!1?"":K._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(P," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!!arguments.length)return e=K.isFunction(a),this.each(function(d){var f=K(this),g;if(this.nodeType===1){e?g=a.call(this,d,f.val()):g=a,g==null?g="":typeof g=="number"?g+="":K.isArray(g)&&(g=K.map(g,function(a){return a==null?"":a+""})),c=K.valHooks[this.nodeName.toLowerCase()]||K.valHooks[this.type];if(!c||!("set"in c)||c.set(this,g,"value")===b)this.value=g}});if(f)return c=K.valHooks[f.nodeName.toLowerCase()]||K.valHooks[f.type],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(R,""):d==null?"":d)}}),K.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(K.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!K.nodeName(e.parentNode,"optgroup"))){b=K(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?K(h[f]).val():g},set:function(a,b){var c=K.makeArray(b);return K(a).find("option").each(function(){this.selected=K.inArray(K(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){if(e&&c in K.attrFn)return K(a)[c](d);if(typeof a.getAttribute=="undefined")return K.prop(a,c,d);h=i!==1||!K.isXMLDoc(a),h&&(c=c.toLowerCase(),g=K.attrHooks[c]||(V.test(c)?Y:X));if(d!==b){if(d===null){K.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)}},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(Q),f=d.length;for(;g<f;g++)e=d[g],e&&(c=K.propFix[e]||e,K.attr(a,e,""),a.removeAttribute(W?e:c),V.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(S.test(a.nodeName)&&a.parentNode)K.error("type property can't be changed");else if(!K.support.radioValue&&b==="radio"&&K.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return X&&K.nodeName(a,"button")?X.get(a,b):b in a?a.value:null},set:function(a,b,c){if(X&&K.nodeName(a,"button"))return X.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!!a&&h!==3&&h!==8&&h!==2)return g=h!==1||!K.isXMLDoc(a),g&&(c=K.propFix[c]||c,f=K.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):T.test(a.nodeName)||U.test(a.nodeName)&&a.href?0:b}}}}),K.attrHooks.tabindex=K.propHooks.tabIndex,Y={get:function(a,c){var d,e=K.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?K.removeAttr(a,c):(d=K.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},W||(Z={name:!0,id:!0},X=K.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(Z[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=H.createAttribute(c),a.setAttributeNode(d)),d.nodeValue=b+""}},K.attrHooks.tabindex.set=X.set,K.each(["width","height"],function(a,b){K.attrHooks[b]=K.extend(K.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),K.attrHooks.contenteditable={get:X.get,set:function(a,b,c){b===""&&(b="false"),X.set(a,b,c)}}),K.support.hrefNormalized||K.each(["href","src","width","height"],function(a,c){K.attrHooks[c]=K.extend(K.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),K.support.style||(K.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),K.support.optSelected||(K.propHooks.selected=K.extend(K.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),K.support.enctype||(K.propFix.enctype="encoding"),K.support.checkOn||K.each(["radio","checkbox"],function(){K.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),K.each(["radio","checkbox"],function(){K.valHooks[this]=K.extend(K.valHooks[this],{set:function(a,b){if(K.isArray(b))return a.checked=K.inArray(K(a).val(),b)>=0}})});var $=/^(?:textarea|input|select)$/i,_=/^([^\.]*)?(?:\.(.+))?$/,ab=/\bhover(\.\S+)?\b/,bb=/^key/,cb=/^(?:mouse|contextmenu)|click/,db=/^(?:focusinfocus|focusoutblur)$/,eb=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,fb=function(a){var b=eb.exec(a);return b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)")),b},gb=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},hb=function(a){return K.event.special.hover?a:a.replace(ab,"mouseenter$1 mouseleave$1")};K.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(g=K._data(a)))){d.handler&&(o=d,d=o.handler),d.guid||(d.guid=K.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof K=="undefined"||!!a&&K.event.triggered===a.type?b:K.event.dispatch.apply(h.elem,arguments)},h.elem=a),c=K.trim(hb(c)).split(" ");for(j=0;j<c.length;j++){k=_.exec(c[j])||[],l=k[1],m=(k[2
2
2
  ]||"").split(".").sort(),r=K.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=K.event.special[l]||{},n=K.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,quick:fb(f),namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),K.event.global[l]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var f=K.hasData(a)&&K._data(a),g,h,i,j,k,l,m,n,o,p,q,r;if(!!f&&!!(n=f.events)){b=K.trim(hb(b||"")).split(" ");for(g=0;g<b.length;g++){h=_.exec(b[g])||[],i=j=h[1],k=h[2];if(!i){for(i in n)K.event.remove(a,i+b[g],c,d,!0);continue}o=K.event.special[i]||{},i=(d?o.delegateType:o.bindType)||i,q=n[i]||[],l=q.length,k=k?new RegExp("(^|\\.)"+k.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(m=0;m<q.length;m++)r=q[m],(e||j===r.origType)&&(!c||c.guid===r.guid)&&(!k||k.test(r.namespace))&&(!d||d===r.selector||d==="**"&&r.selector)&&(q.splice(m--,1),r.selector&&q.delegateCount--,o.remove&&o.remove.call(a,r));q.length===0&&l!==q.length&&((!o.teardown||o.teardown.call(a,k)===!1)&&K.removeEvent(a,i,f.handle),delete n[i])}K.isEmptyObject(n)&&(p=f.handle,p&&(p.elem=null),K.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,f){if(!e||e.nodeType!==3&&e.nodeType!==8){var g=c.type||c,h=[],i,j,k,l,m,n,o,p,q,r;if(db.test(g+K.event.triggered))return;g.indexOf("!")>=0&&(g=g.slice(0,-1),j=!0),g.indexOf(".")>=0&&(h=g.split("."),g=h.shift(),h.sort());if((!e||K.event.customEvent[g])&&!K.event.global[g])return;c=typeof c=="object"?c[K.expando]?c:new K.Event(g,c):new K.Event(g),c.type=g,c.isTrigger=!0,c.exclusive=j,c.namespace=h.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,n=g.indexOf(":")<0?"on"+g:"";if(!e){i=K.cache;for(k in i)i[k].events&&i[k].events[g]&&K.event.trigger(c,d,i[k].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?K.makeArray(d):[],d.unshift(c),o=K.event.special[g]||{};if(o.trigger&&o.trigger.apply(e,d)===!1)return;q=[[e,o.bindType||g]];if(!f&&!o.noBubble&&!K.isWindow(e)){r=o.delegateType||g,l=db.test(r+g)?e:e.parentNode,m=null;for(;l;l=l.parentNode)q.push([l,r]),m=l;m&&m===e.ownerDocument&&q.push([m.defaultView||m.parentWindow||a,r])}for(k=0;k<q.length&&!c.isPropagationStopped();k++)l=q[k][0],c.type=q[k][1],p=(K._data(l,"events")||{})[c.type]&&K._data(l,"handle"),p&&p.apply(l,d),p=n&&l[n],p&&K.acceptData(l)&&p.apply(l,d)===!1&&c.preventDefault();return c.type=g,!f&&!c.isDefaultPrevented()&&(!o._default||o._default.apply(e.ownerDocument,d)===!1)&&(g!=="click"||!K.nodeName(e,"a"))&&K.acceptData(e)&&n&&e[g]&&(g!=="focus"&&g!=="blur"||c.target.offsetWidth!==0)&&!K.isWindow(e)&&(m=e[n],m&&(e[n]=null),K.event.triggered=g,e[g](),K.event.triggered=b,m&&(e[n]=m)),c.result}},dispatch:function(c){c=K.event.fix(c||a.event);var d=(K._data(this,"events")||{})[c.type]||[],e=d.delegateCount,f=[].slice.call(arguments,0),g=!c.exclusive&&!c.namespace,h=[],i,j,k,l,m,n,o,p,q,r,s;f[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){l=K(this),l.context=this.ownerDocument||this;for(k=c.target;k!=this;k=k.parentNode||this){n={},p=[],l[0]=k;for(i=0;i<e;i++)q=d[i],r=q.selector,n[r]===b&&(n[r]=q.quick?gb(k,q.quick):l.is(r)),n[r]&&p.push(q);p.length&&h.push({elem:k,matches:p})}}d.length>e&&h.push({elem:this,matches:d.slice(e)});for(i=0;i<h.length&&!c.isPropagationStopped();i++){o=h[i],c.currentTarget=o.elem;for(j=0;j<o.matches.length&&!c.isImmediatePropagationStopped();j++){q=o.matches[j];if(g||!c.namespace&&!q.namespace||c.namespace_re&&c.namespace_re.test(q.namespace))c.data=q.data,c.handleObj=q,m=((K.event.special[q.origType]||{}).handle||q.handler).apply(o.elem,f),m!==b&&(c.result=m,m===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,e,f,g=c.button,h=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||H,e=d.documentElement,f=d.body,a.pageX=c.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),a.pageY=c.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)),!a.relatedTarget&&h&&(a.relatedTarget=h===a.target?c.toElement:h),!a.which&&g!==b&&(a.which=g&1?1:g&2?3:g&4?2:0),a}},fix:function(a){if(a[K.expando])return a;var c,d,e=a,f=K.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=K.Event(e);for(c=g.length;c;)d=g[--c],a[d]=e[d];return a.target||(a.target=e.srcElement||H),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey),f.filter?f.filter(a,e):a},special:{ready:{setup:K.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){K.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=K.extend(new K.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?K.event.trigger(e,null,b):K.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},K.event.handle=K.event.dispatch,K.removeEvent=H.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},K.Event=function(a,b){if(!(this instanceof K.Event))return new K.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?B:C):this.type=a,b&&K.extend(this,b),this.timeStamp=a&&a.timeStamp||K.now(),this[K.expando]=!0},K.Event.prototype={preventDefault:function(){this.isDefaultPrevented=B;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=B;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=B,this.stopPropagation()},isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C},K.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){K.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,f=e.selector,g;if(!d||d!==c&&!K.contains(c,d))a.type=e.origType,g=e.handler.apply(this,arguments),a.type=b;return g}}}),K.support.submitBubbles||(K.event.special.submit={setup:function(){if(K.nodeName(this,"form"))return!1;K.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=K.nodeName(c,"input")||K.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(K.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&K.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(K.nodeName(this,"form"))return!1;K.event.remove(this,"._submit")}}),K.support.changeBubbles||(K.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")K.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),K.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,K.event.simulate("change",this,a,!0))});return!1}K.event.add(this,"beforeactivate._change",function(a){var b=a.target;$.test(b.nodeName)&&!b._change_attached&&(K.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&K.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return K.event.remove(this,"._change"),$.test(this.nodeName)}}),K.support.focusinBubbles||K.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){K.event.simulate(b,a.target,K.event.fix(a),!0)};K.event.special[b]={setup:function(){c++===0&&H.addEventListener(a,d,!0)},teardown:function(){--c===0&&H.removeEventListener(a,d,!0)}}}),K.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=C;else if(!e)return this;return f===1&&(g=e,e=function(a){return K().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=K.guid++)),this.each(function(){K.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;return K(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler),this}if(typeof a=="object"){for(var f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=C),this.each(function(){K.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return K(this.context).on(a,this.selector,b,c),this},die:function(a,b){return K(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){K.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return K.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||K.guid++,d=0,e=function(c){var e=(K._data(this,"lastToggle"+a.guid)||0)%d;return K._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),K.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){K.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},K.attrFn&&(K.attrFn[b]=!0),bb.test(b)&&(K.event.fixHooks[b]=K.event.keyHooks),cb.test(b)&&(K.event.fixHooks[b]=K.event.mouseHooks)}),function(){function a(a,b,c,d,f,g){for(var h=0,i=d.length;h<i;h++){var j=d[h];if(j){var k=!1;j=j[a];while(j){if(j[e]===c){k=d[j.sizset];break}if(j.nodeType===1){g||(j[e]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}d[h]=k}}}function c(a,b,c,d,f,g){for(var h=0,i=d.length;h<i;h++){var j=d[h];if(j){var k=!1;j=j[a];while(j){if(j[e]===c){k=d[j.sizset];break}j.nodeType===1&&!g&&(j[e]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}d[h]=k}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e="sizcache"+(Math.random()+"").replace(".",""),f=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){return i=!1,0});var m=function(a,b,c,e){c=c||[],b=b||H;var f=b;if(b.nodeType!==1&&b.nodeType!==9)return[];if(!a||typeof a!="string")return c;var h,i,j,k,l,n,q,r,t=!0,u=m.isXML(b),v=[],x=a;do{d.exec(""),h=d.exec(x);if(h){x=h[3],v.push(h[1]);if(h[2]){k=h[3];break}}}while(h);if(v.length>1&&p.exec(a))if(v.length===2&&o.relative[v[0]])i=w(v[0]+v[1],b,e);else{i=o.relative[v[0]]?[b]:m(v.shift(),b);while(v.length)a=v.shift(),o.relative[a]&&(a+=v.shift()),i=w(a,i,e)}else{!e&&v.length>1&&b.nodeType===9&&!u&&o.match.ID.test(v[0])&&!o.match.ID.test(v[v.length-1])&&(l=m.find(v.shift(),b,u),b=l.expr?m.filter(l.expr,l.set)[0]:l.set[0]);if(b){l=e?{expr:v.pop(),set:s(e)}:m.find(v.pop(),v.length!==1||v[0]!=="~"&&v[0]!=="+"||!b.parentNode?b:b.parentNode,u),i=l.expr?m.filter(l.expr,l.set):l.set,v.length>0?j=s(i):t=!1;while(v.length)n=v.pop(),q=n,o.relative[n]?q=v.pop():n="",q==null&&(q=b),o.relative[n](j,q,u)}else j=v=[]}j||(j=i),j||m.error(n||a);if(g.call(j)==="[object Array]")if(!t)c.push.apply(c,j);else if(b&&b.nodeType===1)for(r=0;j[r]!=null;r++)j[r]&&(j[r]===!0||j[r].nodeType===1&&m.contains(b,j[r]))&&c.push(i[r]);else for(r=0;j[r]!=null;r++)j[r]&&j[r].nodeType===1&&c.push(i[r]);else s(j,c);return k&&(m(k,f,c,e),m.uniqueSort(c)),c};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}return d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]),{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q){if(g!=null)break;m.error(a)}q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(b,d,e){var g,h=f++,i=a;typeof d=="string"&&!l.test(d)&&(d=d.toLowerCase(),g=d,i=c),i("parentNode",d,h,b,g,e)},"~":function(b,d,e){var g,h=f++,i=a;typeof d=="string"&&!l.test(d)&&(d=d.toLowerCase(),g=d,i=c),i("previousSibling",d,h,b,g,e)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);return a[0]=f++,a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");return!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" "),a},PSEUDO:function(a,b,c,e,f){if(a[1]==="not"){if(!((d.exec(a[3])||"").length>1||/^\w/.test(a[3]))){var g=m.filter(a[3],b,c,!0^f);return c||e.push.apply(e,g),!1}a[3]=m(a[3],null,null,b)}else if(o.match.POS.test(a[0])||o.match.CHILD.test(a[0]))return!0;return a},POS:function(a){return a.unshift(!0),a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,d,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],d=b[3];if(c===1&&d===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[e]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[e]=f}return j=a.nodeIndex-d,c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){return a=Array.prototype.slice.call(a,0),b?(b.push.apply(b,a),b):a};try{Array.prototype.slice.call(H.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;H.documentElement.compareDocumentPosition?u=function(a,b){return a===b?(h=!0,0):!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition?-1:1:a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b)return h=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=H.createElement("div"),c="script"+(new Date).getTime(),d=H.documentElement;a.innerHTML="<a name='"+c+"'/>",d.insertBefore(a,d.firstChild),H.getElementById(c)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),d.removeChild(a),d=a=null}(),function(){var a=H.createElement("div");a.appendChild(H.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),H.querySelectorAll&&function(){var a=m,b=H.createElement("div"),c="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,d,e,f){d=d||H;if(!f&&!m.isXML(d)){var g=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(g&&(d.nodeType===1||d.nodeType===9)){if(g[1])return s(d.getElementsByTagName(b),e);if(g[2]&&o.find.CLASS&&d.getElementsByClassName)return s(d.getElementsByClassName(g[2]),e)}if(d.nodeType===9){if(b==="body"&&d.body)return s([d.body],e);if(g&&g[3]){var h=d.getElementById(g[3]);if(!h||!h.parentNode)return s([],e);if(h.id===g[3])return s([h],e)}try{return s(d.querySelectorAll(b),e)}catch(i){}}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d,k=d.getAttribute("id"),l=k||c,n=d.parentNode,p=/^\s*[+~]/.test(b);k?l=l.replace(/'/g,"\\$&"):d.setAttribute("id",l),p&&n&&(d=d.parentNode);try{if(!p||n)return s(d.querySelectorAll("[id='"+l+"'] "+b),e)}catch(q){}finally{k||j.removeAttribute("id")}}}return a(b,d,e,f)};for(var d in a)m[d]=a[d];b=null}}(),function(){var a=H.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var c=!b.call(H.createElement("div"),"div"),d=!1;try{b.call(H.documentElement,"[test!='']:sizzle")}catch(e){d=!0}m.matchesSelector=function(a,e){e=e.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(d||!o.match.PSEUDO.test(e)&&!/!=/.test(e)){var f=b.call(a,e);if(f||!c||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(e,null,null,[a]).length>0}}}(),function(){var a=H.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),H.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:H.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var w=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=K.attr,m.selectors.attrMap={},K.find=m,K.expr=m.selectors,K.expr[":"]=K.expr.filters,K.unique=m.uniqueSort,K.text=m.getText,K.isXMLDoc=m.isXML,K.contains=m.contains}();var ib=/Until$/,jb=/^(?:parents|prevUntil|prevAll)/,kb=/,/,lb=/^.[^:#\[\.,]*$/,mb=Array.prototype.slice,nb=K.expr.match.POS,ob={children:!0,contents:!0,next:!0,prev:!0};K.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return K(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(K.contains(b[c],this))return!0});var e=this.pushStack("","find",a),f,g,h;for(c=0,d=this.length;c<d;c++){f=e.length,K.find(a,this[c],e);if(c>0)for(g=f;g<e.length;g++)for(h=0;h<f;h++)if(e[h]===e[g]){e.splice(g--,1);break}}return e},has:function(a){var b=K(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(K.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(z(this,a,!1),"not",a)},filter:function(a){return this.pushStack(z(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?nb.test(a)?K(a,this.context).index(this[0])>=0:K.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,f=this[0];if(K.isArray(a)){var g=1;while(f&&f.ownerDocument&&f!==b){for(d=0;d<a.length;d++)K(f).is(a[d])&&c.push({selector:a[d],elem:f,level:g});f=f.parentNode,g++}return c}var h=nb.test(a)||typeof a!="string"?K(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){f=this[d];while(f){if(h?h.index(f)>-1:K.find.matchesSelector(f,a)){c.push(f);break}f=f.parentNode;if(!f||!f.ownerDocument||f===b||f.nodeType===11)break}}return c=c.length>1?K.unique(c):c,this.pushStack(c,"closest",a)},index:function(a){return a?typeof a=="string"?K.inArray(this[0],K(a)):K.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?K(a,b):K.makeArray(a&&a.nodeType?[a]:a),d=K.merge(this.get(),c);return this.pushStack(A(c[0])||A(d[0])?d:K.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),K.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return K.dir(a,"parentNode")},parentsUntil:function(a,b,c){return K.dir(a,"parentNode",c)},next:function(a){return K.nth(a,2,"nextSibling")},prev:function(a){return K.nth(a,2,"previousSibling")},nextAll:function(a){return K.dir(a,"nextSibling")},prevAll:function(a){return K.dir(a,"previousSibling")},nextUntil:function(a,b,c){return K.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return K.dir(a,"previousSibling",c)},siblings:function(a){return K.sibling(a.parentNode.firstChild,a)},children:function(a){return K.sibling(a.firstChild)},contents:function(a){return K.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:K.makeArray(a.childNodes)}},function(a,b){K.fn[a]=function(c,d){var e=K.map(this,b,c);return ib.test(a)||(d=c),d&&typeof d=="string"&&(e=K.filter(d,e)),e=this.length>1&&!ob[a]?K.unique(e):e,(this.length>1||kb.test(d))&&jb.test(a)&&(e=e.reverse()),this.pushStack(e,a,mb.call(arguments).join(","))}}),K.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?K.find.matchesSelector(b[0],a)?[b[0]]:[]:K.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!K(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var pb="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",qb=/ jQuery\d+="(?:\d+|null)"/g,rb=/^\s+/,sb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,tb=/<([\w:]+)/,ub=/<tbody/i,vb=/<|&#?\w+;/,wb=/<(?:script|style)/i,xb=/<(?:script|object|embed|option|style)/i,yb=new RegExp("<(?:"+pb+")","i"),zb=/checked\s*(?:[^=]|=\s*.checked.)/i,Ab=/\/(java|ecma)script/i,Bb=/^\s*<!(?:\[CDATA\[|\-\-)/,Cb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Db=y(H);Cb.optgroup=Cb.option,Cb.tbody=Cb.tfoot=Cb.colgroup=Cb.caption=Cb.thead,Cb.th=Cb.td,K.support.htmlSerialize||(Cb._default=[1,"div<div>","</div>"]),K.fn.extend({text:function(a){return K.isFunction(a)?this.each(function(b){var c=K(this);c.text(a.call(this,b,c.text()))}):typeof a!="object"&&a!==b?this.empty().append((this[0]&&this[0].ownerDocument||H).createTextNode(a)):K.text(this)},wrapAll:function(a){if(K.isFunction(a))return this.each(function(b){K(this).wrapAll(a.call(this,b))});if(this[0]){var b=K(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return K.isFunction(a)?this.each(function(b){K(this).wrapInner(a.call(this,b))}):this.each(function(){var b=K(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=K.isFunction(a);return this.each(function(c){K(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){K.nodeName(this,"body")||K(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=K.clean(arguments);return a.push.apply(a,this.toArray()),this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);return a.push.apply(a,K.clean(arguments)),a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||K.filter(a,[d]).length)!b&&d.nodeType===1&&(K.cleanData(d.getElementsByTagName("*")),K.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&K.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return K.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(qb,""):null;if(typeof a=="string"&&!wb.test(a)&&(K.support.leadingWhitespace||!rb.test(a))&&!Cb[(tb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(sb,"<$1></$2>"
3
- );try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(K.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else K.isFunction(a)?this.each(function(b){var c=K(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){return this[0]&&this[0].parentNode?K.isFunction(a)?this.each(function(b){var c=K(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=K(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;K(this).remove(),b?K(b).before(a):K(c).append(a)})):this.length?this.pushStack(K(K.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,f,g,h,i=a[0],j=[];if(!K.support.checkClone&&arguments.length===3&&typeof i=="string"&&zb.test(i))return this.each(function(){K(this).domManip(a,c,d,!0)});if(K.isFunction(i))return this.each(function(e){var f=K(this);a[0]=i.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){h=i&&i.parentNode,K.support.parentNode&&h&&h.nodeType===11&&h.childNodes.length===this.length?e={fragment:h}:e=K.buildFragment(a,this,j),g=e.fragment,g.childNodes.length===1?f=g=g.firstChild:f=g.firstChild;if(f){c=c&&K.nodeName(f,"tr");for(var k=0,l=this.length,m=l-1;k<l;k++)d.call(c?x(this[k],f):this[k],e.cacheable||l>1&&k<m?K.clone(g,!0,!0):g)}j.length&&K.each(j,q)}return this}}),K.buildFragment=function(a,b,c){var d,e,f,g,h=a[0];return b&&b[0]&&(g=b[0].ownerDocument||b[0]),g.createDocumentFragment||(g=H),a.length===1&&typeof h=="string"&&h.length<512&&g===H&&h.charAt(0)==="<"&&!xb.test(h)&&(K.support.checkClone||!zb.test(h))&&(K.support.html5Clone||!yb.test(h))&&(e=!0,f=K.fragments[h],f&&f!==1&&(d=f)),d||(d=g.createDocumentFragment(),K.clean(a,g,d,c)),e&&(K.fragments[h]=f?d:1),{fragment:d,cacheable:e}},K.fragments={},K.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){K.fn[a]=function(c){var d=[],e=K(c),f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&e.length===1)return e[b](this[0]),this;for(var g=0,h=e.length;g<h;g++){var i=(g>0?this.clone(!0):this).get();K(e[g])[b](i),d=d.concat(i)}return this.pushStack(d,a,e.selector)}}),K.extend({clone:function(a,b,c){var d,e,f,g=K.support.html5Clone||!yb.test("<"+a.nodeName)?a.cloneNode(!0):r(a);if((!K.support.noCloneEvent||!K.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!K.isXMLDoc(a)){v(a,g),d=u(a),e=u(g);for(f=0;d[f];++f)e[f]&&v(d[f],e[f])}if(b){w(a,g);if(c){d=u(a),e=u(g);for(f=0;d[f];++f)w(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var e;b=b||H,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||H);var f=[],g;for(var h=0,i;(i=a[h])!=null;h++){typeof i=="number"&&(i+="");if(!i)continue;if(typeof i=="string")if(!vb.test(i))i=b.createTextNode(i);else{i=i.replace(sb,"<$1></$2>");var j=(tb.exec(i)||["",""])[1].toLowerCase(),k=Cb[j]||Cb._default,l=k[0],m=b.createElement("div");b===H?Db.appendChild(m):y(b).appendChild(m),m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!K.support.tbody){var n=ub.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(g=o.length-1;g>=0;--g)K.nodeName(o[g],"tbody")&&!o[g].childNodes.length&&o[g].parentNode.removeChild(o[g])}!K.support.leadingWhitespace&&rb.test(i)&&m.insertBefore(b.createTextNode(rb.exec(i)[0]),m.firstChild),i=m.childNodes}var p;if(!K.support.appendChecked)if(i[0]&&typeof (p=i.length)=="number")for(g=0;g<p;g++)s(i[g]);else s(i);i.nodeType?f.push(i):f=K.merge(f,i)}if(c){e=function(a){return!a.type||Ab.test(a.type)};for(h=0;f[h];h++)if(d&&K.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))d.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{if(f[h].nodeType===1){var q=K.grep(f[h].getElementsByTagName("script"),e);f.splice.apply(f,[h+1,0].concat(q))}c.appendChild(f[h])}}return f},cleanData:function(a){var b,c,d=K.cache,e=K.event.special,f=K.support.deleteExpando;for(var g=0,h;(h=a[g])!=null;g++){if(h.nodeName&&K.noData[h.nodeName.toLowerCase()])continue;c=h[K.expando];if(c){b=d[c];if(b&&b.events){for(var i in b.events)e[i]?K.event.remove(h,i):K.removeEvent(h,i,b.handle);b.handle&&(b.handle.elem=null)}f?delete h[K.expando]:h.removeAttribute&&h.removeAttribute(K.expando),delete d[c]}}}});var Eb=/alpha\([^)]*\)/i,Fb=/opacity=([^)]*)/,Gb=/([A-Z]|^ms)/g,Hb=/^-?\d+(?:px)?$/i,Ib=/^-?\d/,Jb=/^([\-+])=([\-+.\de]+)/,Kb={position:"absolute",visibility:"hidden",display:"block"},Lb=["Left","Right"],Mb=["Top","Bottom"],Nb,Ob,Pb;K.fn.css=function(a,c){return arguments.length===2&&c===b?this:K.access(this,a,c,!0,function(a,c,d){return d!==b?K.style(a,c,d):K.css(a,c)})},K.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Nb(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":K.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var f,g,h=K.camelCase(c),i=a.style,j=K.cssHooks[h];c=K.cssProps[h]||h;if(d===b)return j&&"get"in j&&(f=j.get(a,!1,e))!==b?f:i[c];g=typeof d,g==="string"&&(f=Jb.exec(d))&&(d=+(f[1]+1)*+f[2]+parseFloat(K.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!K.cssNumber[h]&&(d+="px");if(!j||!("set"in j)||(d=j.set(a,d))!==b)try{i[c]=d}catch(k){}}},css:function(a,c,d){var e,f;c=K.camelCase(c),f=K.cssHooks[c],c=K.cssProps[c]||c,c==="cssFloat"&&(c="float");if(f&&"get"in f&&(e=f.get(a,!0,d))!==b)return e;if(Nb)return Nb(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),K.curCSS=K.css,K.each(["height","width"],function(a,b){K.cssHooks[b]={get:function(a,c,d){var e;if(c)return a.offsetWidth!==0?p(a,b,d):(K.swap(a,Kb,function(){e=p(a,b,d)}),e)},set:function(a,b){if(!Hb.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),K.support.opacity||(K.cssHooks.opacity={get:function(a,b){return Fb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=K.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&K.trim(f.replace(Eb,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=Eb.test(f)?f.replace(Eb,e):f+" "+e}}),K(function(){K.support.reliableMarginRight||(K.cssHooks.marginRight={get:function(a,b){var c;return K.swap(a,{display:"inline-block"},function(){b?c=Nb(a,"margin-right","marginRight"):c=a.style.marginRight}),c}})}),H.defaultView&&H.defaultView.getComputedStyle&&(Ob=function(a,b){var c,d,e;return b=b.replace(Gb,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!K.contains(a.ownerDocument.documentElement,a)&&(c=K.style(a,b))),c}),H.documentElement.currentStyle&&(Pb=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;return f===null&&g&&(e=g[b])&&(f=e),!Hb.test(f)&&Ib.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d)),f===""?"auto":f}),Nb=Ob||Pb,K.expr&&K.expr.filters&&(K.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!K.support.reliableHiddenOffsets&&(a.style&&a.style.display||K.css(a,"display"))==="none"},K.expr.filters.visible=function(a){return!K.expr.filters.hidden(a)});var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/#.*$/,Ub=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,Vb=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,Wb=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Xb=/^(?:GET|HEAD)$/,Yb=/^\/\//,Zb=/\?/,$b=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,_b=/^(?:select|textarea)/i,ac=/\s+/,bc=/([?&])_=[^&]*/,cc=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,dc=K.fn.load,ec={},fc={},gc,hc,ic=["*/"]+["*"];try{gc=J.href}catch(jc){gc=H.createElement("a"),gc.href="",gc=gc.href}hc=cc.exec(gc.toLowerCase())||[],K.fn.extend({load:function(a,c,d){if(typeof a!="string"&&dc)return dc.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}var g="GET";c&&(K.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=K.param(c,K.ajaxSettings.traditional),g="POST"));var h=this;return K.ajax({url:a,type:g,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),h.html(f?K("<div>").append(c.replace($b,"")).find(f):c)),d&&h.each(d,[c,b,a])}}),this},serialize:function(){return K.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?K.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||_b.test(this.nodeName)||Vb.test(this.type))}).map(function(a,b){var c=K(this).val();return c==null?null:K.isArray(c)?K.map(c,function(a,c){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),K.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){K.fn[b]=function(a){return this.on(b,a)}}),K.each(["get","post"],function(a,c){K[c]=function(a,d,e,f){return K.isFunction(d)&&(f=f||e,e=d,d=b),K.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),K.extend({getScript:function(a,c){return K.get(a,b,c,"script")},getJSON:function(a,b,c){return K.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?m(a,K.ajaxSettings):(b=a,a=K.ajaxSettings),m(a,b),a},ajaxSettings:{url:gc,isLocal:Wb.test(hc[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":ic},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":K.parseJSON,"text xml":K.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:o(ec),ajaxTransport:o(fc),ajax:function(a,c){function d(a,c,d,n){if(v!==2){v=2,t&&clearTimeout(t),s=b,q=n||"",y.readyState=a>0?4:0;var o,p,r,u=c,x=d?k(e,y,d):b,z,A;if(a>=200&&a<300||a===304){if(e.ifModified){if(z=y.getResponseHeader("Last-Modified"))K.lastModified[m]=z;if(A=y.getResponseHeader("Etag"))K.etag[m]=A}if(a===304)u="notmodified",o=!0;else try{p=j(e,x),u="success",o=!0}catch(B){u="parsererror",r=B}}else{r=u;if(!u||a)u="error",a<0&&(a=0)}y.status=a,y.statusText=""+(c||u),o?h.resolveWith(f,[p,u,y]):h.rejectWith(f,[y,u,r]),y.statusCode(l),l=b,w&&g.trigger("ajax"+(o?"Success":"Error"),[y,e,o?p:r]),i.fireWith(f,[y,u]),w&&(g.trigger("ajaxComplete",[y,e]),--K.active||K.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var e=K.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof K)?K(f):K.event,h=K.Deferred(),i=K.Callbacks("once memory"),l=e.statusCode||{},m,o={},p={},q,r,s,t,u,v=0,w,x,y={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=p[c]=p[c]||a,o[a]=b}return this},getAllResponseHeaders:function(){return v===2?q:null},getResponseHeader:function(a){var c;if(v===2){if(!r){r={};while(c=Ub.exec(q))r[c[1].toLowerCase()]=c[2]}c=r[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(e.mimeType=a),this},abort:function(a){return a=a||"abort",s&&s.abort(a),d(0,a),this}};h.promise(y),y.success=y.done,y.error=y.fail,y.complete=i.add,y.statusCode=function(a){if(a){var b;if(v<2)for(b in a)l[b]=[l[b],a[b]];else b=a[y.status],y.then(b,b)}return this},e.url=((a||e.url)+"").replace(Tb,"").replace(Yb,hc[1]+"//"),e.dataTypes=K.trim(e.dataType||"*").toLowerCase().split(ac),e.crossDomain==null&&(u=cc.exec(e.url.toLowerCase()),e.crossDomain=!(!u||u[1]==hc[1]&&u[2]==hc[2]&&(u[3]||(u[1]==="http:"?80:443))==(hc[3]||(hc[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!="string"&&(e.data=K.param(e.data,e.traditional)),n(ec,e,c,y);if(v===2)return!1;w=e.global,e.type=e.type.toUpperCase(),e.hasContent=!Xb.test(e.type),w&&K.active++===0&&K.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(Zb.test(e.url)?"&":"?")+e.data,delete e.data),m=e.url;if(e.cache===!1){var z=K.now(),A=e.url.replace(bc,"$1_="+z);e.url=A+(A===e.url?(Zb.test(e.url)?"&":"?")+"_="+z:"")}}(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",e.contentType),e.ifModified&&(m=m||e.url,K.lastModified[m]&&y.setRequestHeader("If-Modified-Since",K.lastModified[m]),K.etag[m]&&y.setRequestHeader("If-None-Match",K.etag[m])),y.setRequestHeader("Accept",e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", "+ic+"; q=0.01":""):e.accepts["*"]);for(x in e.headers)y.setRequestHeader(x,e.headers[x]);if(!e.beforeSend||e.beforeSend.call(f,y,e)!==!1&&v!==2){for(x in{success:1,error:1,complete:1})y[x](e[x]);s=n(fc,e,c,y);if(!s)d(-1,"No Transport");else{y.readyState=1,w&&g.trigger("ajaxSend",[y,e]),e.async&&e.timeout>0&&(t=setTimeout(function(){y.abort("timeout")},e.timeout));try{v=1,s.send(o,d)}catch(B){if(!(v<2))throw B;d(-1,B)}}return y}return y.abort(),!1},param:function(a,c){var d=[],e=function(a,b){b=K.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=K.ajaxSettings.traditional);if(K.isArray(a)||a.jquery&&!K.isPlainObject(a))K.each(a,function(){e(this.name,this.value)});else for(var f in a)l(f,a[f],c,e);return d.join("&").replace(Qb,"+")}}),K.extend({active:0,lastModified:{},etag:{}});var kc=K.now(),lc=/(\=)\?(&|$)|\?\?/i;K.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return K.expando+"_"+kc++}}),K.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(lc.test(b.url)||e&&lc.test(b.data))){var f,g=b.jsonpCallback=K.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h=a[g],i=b.url,j=b.data,k="$1"+g+"$2";return b.jsonp!==!1&&(i=i.replace(lc,k),b.url===i&&(e&&(j=j.replace(lc,k)),b.data===j&&(i+=(/\?/.test(i)?"&":"?")+b.jsonp+"="+g))),b.url=i,b.data=j,a[g]=function(a){f=[a]},d.always(function(){a[g]=h,f&&K.isFunction(h)&&a[g](f[0])}),b.converters["script json"]=function(){return f||K.error(g+" was not called"),f[0]},b.dataTypes[0]="json","script"}}),K.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return K.globalEval(a),a}}}),K.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),K.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=H.head||H.getElementsByTagName("head")[0]||H.documentElement;return{send:function(e,f){c=H.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||f(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var mc=a.ActiveXObject?function(){for(var a in oc)oc[a](0,1)}:!1,nc=0,oc;K.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&i()||h()}:i,function(a){K.extend(K.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(K.ajaxSettings.xhr()),K.support.ajax&&K.ajaxTransport(function(c){if(!c.crossDomain||K.support.cors){var d;return{send:function(e,f){var g=c.xhr(),h,i;c.username?g.open(c.type,c.url,c.async,c.username,c.password):g.open(c.type,c.url,c.async);if(c.xhrFields)for(i in c.xhrFields)g[i]=c.xhrFields[i];c.mimeType&&g.overrideMimeType&&g.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(c.hasContent&&c.data||null),d=function(a,e){var i,j,k,l,m;try{if(d&&(e||g.readyState===4)){d=b,h&&(g.onreadystatechange=K.noop,mc&&delete oc[h]);if(e)g.readyState!==4&&g.abort();else{i=g.status,k=g.getAllResponseHeaders(),l={},m=g.responseXML,m&&m.documentElement&&(l.xml=m),l.text=g.responseText;try{j=g.statusText}catch(n){j=""}!i&&c.isLocal&&!c.crossDomain?i=l.text?200:404:i===1223&&(i=204)}}}catch(o){e||f(-1,o)}l&&f(i,j,l,k)},!c.async||g.readyState===4?d():(h=++nc,mc&&(oc||(oc={},K(a).unload(mc)),oc[h]=d),g.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var pc={},qc,rc,sc=/^(?:toggle|show|hide)$/,tc=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,uc,vc=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],wc;K.fn.extend({show:function(a,b,c){var f,g;if(a||a===0)return this.animate(e("show",3),a,b,c);for(var h=0,i=this.length;h<i;h++)f=this[h],f.style&&(g=f.style.display,!K._data(f,"olddisplay")&&g==="none"&&(g=f.style.display=""),g===""&&K.css(f,"display")==="none"&&K._data(f,"olddisplay",d(f.nodeName)));for(h=0;h<i;h++){f=this[h];if(f.style){g=f.style.display;if(g===""||g==="none")f.style.display=K._data(f,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(e("hide",3),a,b,c);var d,f,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(f=K.css(d,"display"),f!=="none"&&!K._data(d,"olddisplay")&&K._data(d,"olddisplay",f));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:K.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";return K.isFunction(a)&&K.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:K(this).is(":hidden");K(this)[b?"show":"hide"]()}):this.animate(e("toggle",3),a,b,c),this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){function f(){g.queue===!1&&K._mark(this);var b=K.extend({},g),c=this.nodeType===1,e=c&&K(this).is(":hidden"),f,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){f=K.camelCase(i),i!==f&&(a[f]=a[i],delete a[i]),h=a[f],K.isArray(h)?(b.animatedProperties[f]=h[1],h=a[f]=h[0]):b.animatedProperties[f]=b.specialEasing&&b.specialEasing[f]||b.easing||"swing";if(h==="hide"&&e||h==="show"&&!e)return b.complete.call(this);c&&(f==="height"||f==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],K.css(this,"display")==="inline"&&K.css(this,"float")==="none"&&(!K.support.inlineBlockNeedsLayout||d(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new K.fx(this,b,i),h=a[i],sc.test(h)?(o=K._data(this,"toggle"+i)||(h==="toggle"?e?"show":"hide":0),o?(K._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=tc.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(K.cssNumber[i]?"":"px"),n!=="px"&&(K.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,K.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var g=K.speed(b,c,e);return K.isEmptyObject(a)?this.each(g.complete,[!1]):(a=K.extend({},a),g.queue===!1?this.each(f):this.queue(g.queue,f))},stop:function(a,c,d){return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){function b(a,b,c){var e=b[c];K.removeData(a,c,!0),e.stop(d)}var c,e=!1,f=K.timers,g=K._data(this);d||K._unmark(!0,this);if(a==null)for(c in g)g[c]&&g[c].stop&&c.indexOf(".run")===c.length-4&&b(this,g,c);else g[c=a+".run"]&&g[c].stop&&b(this,g,c);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(d?f[c](!0):f[c].saveState(),e=!0,f.splice(c,1));(!d||!e)&&K.dequeue(this,a)})}}),K.each({slideDown:e("show",1),slideUp:e("hide",1),slideToggle:e("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){K.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),K.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?K.extend({},a):{complete:c||!c&&b||K.isFunction(a)&&a,duration:a,easing:c&&b||b&&!K.isFunction(b)&&b};d.duration=K.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in K.fx.speeds?K.fx.speeds[d.duration]:K.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(a){K.isFunction(d.old)&&d.old.call(this),d.queue?K.dequeue(this,d.queue):a!==!1&&K._unmark(this)},d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),K.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(K.fx.step[this.prop]||K.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]==null||!!this.elem.style&&this.elem.style[this.prop]!=null){var a,b=K.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a}return this.elem[this.prop]},custom:function(a,c,d){function e(a){return f.step(a)}var f=this,h=K.fx;this.startTime=wc||g(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(K.cssNumber[this.prop]?"":"px"),e.queue=this.options.queue,e.elem=this.elem,e.saveState=function(){f.options.hide&&K._data(f.elem,"fxshow"+f.prop)===b&&K._data(f.elem,"fxshow"+f.prop,f.start)},e()&&K.timers.push(e)&&!uc&&(uc=setInterval(h.tick,h.interval))},show:function(){var a=K._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||K.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),K(this.elem).show()},hide:function(){this.options.orig[this.prop]=K._data(this.elem,"fxshow"+this.prop)||K.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=wc||g(),f=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(f=!1);if(f){i.overflow!=null&&!K.support.shrinkWrapBlocks&&K.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&K(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)K.style(h,b,i.orig[b]),K.removeData(h,"fxshow"+b,!0),K.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}return i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=K.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update(),!0}},K.extend(K.fx,{tick:function(){var a,b=K.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||K.fx.stop()},interval:13,stop:function(){clearInterval(uc),uc=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){K.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),K.each(["width","height"],function(a,b){K.fx.step[b]=function(a){K.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),K.expr&&K.expr.filters&&(K.expr.filters.animated=function(a){return K.grep(K.timers,function(b){return a===b.elem}).length});var xc=/^t(?:able|d|h)$/i,yc=/^(?:body|html)$/i;"getBoundingClientRect"in H.documentElement?K.fn.offset=function(a){var b=this[0],d;if(a)return this.each(function(b){K.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return K.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!d||!K.contains(g,b))return d?{top:d.top,left:d.left}:{top:0,left:0};var h=f.body,i=c(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||K.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||K.support.boxModel&&g.scrollLeft||h.scrollLeft,n=d.top+l-j,o=d.left+m-k;return{top:n,left:o}}:K.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){K.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return K.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,f=b.ownerDocument,g=f.documentElement,h=f.body,i=f.defaultView,j=i?i.getComputedStyle(b,null):b.currentStyle,k=b.offsetTop,l=b.offsetLeft;while((b=b.parentNode)&&b!==h&&b!==g){if(K.support.fixedPosition&&j.position==="fixed")break;c=i?i.getComputedStyle(b,null):b.currentStyle,k-=b.scrollTop,l-=b.scrollLeft,b===d&&(k+=b.offsetTop,l+=b.offsetLeft,K.support.doesNotAddBorder&&(!K.support.doesAddBorderForTableAndCells||!xc.test(b.nodeName))&&(k+=parseFloat(c.borderTopWidth)||0,l+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),K.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(k+=parseFloat(c.borderTopWidth)||0,l+=parseFloat(c.borderLeftWidth)||0),j=c}if(j.position==="relative"||j.position==="static")k+=h.offsetTop,l+=h.offsetLeft;return K.support.fixedPosition&&j.position==="fixed"&&(k+=Math.max(g.scrollTop,h.scrollTop),l+=Math.max(g.scrollLeft,h.scrollLeft)),{top:k,left:l}},K.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return K.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(K.css(a,"marginTop"))||0,c+=parseFloat(K.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=K.css(a,"position");d==="static"&&(a.style.position="relative");var e=K(a),f=e.offset(),g=K.css(a,"top"),h=K.css(a,"left"),i=(d==="absolute"||d==="fixed")&&K.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),K.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},K.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=yc.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(K.css(a,"marginTop"))||0,c.left-=parseFloat(K.css(a,"marginLeft"))||0,d.top+=parseFloat(K.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(K.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||H.body;while(a&&!yc.test(a.nodeName)&&K.css(a,"position")==="static")a=a.offsetParent;return a})}}),K.each(["Left","Top"],function(a,d){var e="scroll"+d;K.fn[e]=function(d){var f,g;return d===b?(f=this[0],f?(g=c(f),g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:K.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]):null):this.each(function(){g=c(this),g?g.scrollTo(a?K(g).scrollLeft():d,a?d:K(g).scrollTop()):this[e]=d})}}),K.each(["Height","Width"],function(a,c){var d=c.toLowerCase();K.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(K.css(a,d,"padding")):this[d]():null},K.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(K.css(b,d,a?"margin":"border")):this[d]():null},K.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(K.isFunction(a))return this.each(function(b){var c=K(this);c[d](a.call(this,b,c[d]()))});if(K.isWindow(e)){var f=e.document.documentElement["client"+c],g=e.document.body;return e.document.compatMode==="CSS1Compat"&&f||g&&g["client"+c]||f}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=K.css(e,d),i=parseFloat(h);return K.isNumeric(i)?i:h}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=K,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return K})})(window),function(){function a(b,c,d){if(b===c)return b!==0||1/b==1/c;if(b==null||c==null)return b===c;b._chain&&(b=b._wrapped),c._chain&&(c=c._wrapped);if(b.isEqual&&v.isFunction(b.isEqual))return b.isEqual(c);if(c.isEqual&&v.isFunction(c.isEqual))return c.isEqual(b);var e=i.call(b);if(e!=i.call(c))return!1;switch(e){case"[object String]":return b==String(c);case"[object Number]":return b!=+b?c!=+c:b==0?1/b==1/c:b==+c;case"[object Date]":case"[object Boolean]":return+b==+c;case"[object RegExp]":return b.source==c.source&&b.global==c.global&&b.multiline==c.multiline&&b.ignoreCase==c.ignoreCase}if(typeof b!="object"||typeof c!="object")return!1;for(var f=d.length;f--;)if(d[f]==b)return!0;d.push(b);var f=0,g=!0;if(e=="[object Array]"){if(f=b.length,g=f==c.length)for(;f--;)if(!(g=f in b==f in c&&a(b[f],c[f],d)))break}else{if("constructor"in b!="constructor"in c||b.constructor!=c.constructor)return!1;for(var h in b)if(v.has(b,h)&&(f++,!(g=v.has(c,h)&&a(b[h],c[h],d))))break;if(g){for(h in c)if(v.has(c,h)&&!(f--))break;g=!f}}return d.pop(),g}var b=this,c=b._,d={},e=Array.prototype,f=Object.prototype,g=e.slice,h=e.unshift,i=f.toString,j=f.hasOwnProperty,k=e.forEach,l=e.map,m=e.reduce,n=e.reduceRight,o=e.filter,p=e.every,q=e.some,r=e.indexOf,s=e.lastIndexOf,f=Array.isArray,t=Object.keys,u=Function.prototype.bind,v=function(a){return new C(a)};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=v),exports._=v):b._=v,v.VERSION="1.3.1";var w=v.each=v.forEach=function(a,b,c){if(a!=null)if(k&&a.forEach===k)a.forEach(b,c);else if(a.length===+a.length){for(var e=0,f=a.length;e<f;e++)if(e in a&&b.call(c,a[e],e,a)===d)break}else for(e in a)if(v.has(a,e)&&b.call(c,a[e],e,a)===d)break};v.map=v.collect=function(a,b,c){var d=[];return a==null?d:l&&a.map===l?a.map(b,c):(w(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),a.length===+a.length&&(d.length=a.length),d)},v.reduce=v.foldl=v.inject=function(a,b,c,d){var e=arguments.length>2;a==null&&(a=[]);if(m&&a.reduce===m)return d&&(b=v.bind(b,d)),e?a.reduce(b,c):a.reduce(b);w(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},v.reduceRight=v.foldr=function(a,b,c,d){var e=arguments.length>2;a==null&&(a=[]);if(n&&a.reduceRight===n)return d&&(b=v.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=v.toArray(a).reverse();return d&&!e&&(b=v.bind(b,d)),e?v.reduce(f,b,c,d):v.reduce(f,b)},v.find=v.detect=function(a,b,c){var d;return x(a,function(a,e,f){if(b.call(c,a,e,f))return d=a,!0}),d},v.filter=v.select=function(a,b,c){var d=[];return a==null?d:o&&a.filter===o?a.filter(b,c):(w(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},v.reject=function(a,b,c){var d=[];return a==null?d:(w(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)}),d)},v.every=v.all=function(a,b,c){var e=!0;return a==null?e:p&&a.every===p?a.every(b,c):(w(a,function(a,f,g){if(!(e=e&&b.call(c,a,f,g)))return d}),e)};var x=v.some=v.any=function(a,b,c){b||(b=v.identity);var e=!1;return a==null?e:q&&a.some===q?a.some(b,c):(w(a,function(a,f,g){if(e||(e=b.call(c,a,f,g)))return d}),!!e)};v.include=v.contains=function(a,b){var c=!1;return a==null?c:r&&a.indexOf===r?a.indexOf(b)!=-1:c=x(a,function(a){return a===b})},v.invoke=function(a,b){var c=g.call(arguments,2);return v.map(a,function(a){return(v.isFunction(b)?b||a:a[b]).apply(a,c)})},v.pluck=function(a,b){return v.map(a,function(a){return a[b]})},v.max=function(a,b,c){if(!b&&v.isArray(a))return Math.max.apply(Math,a);if(!b&&v.isEmpty(a))return-Infinity;var d={computed:-Infinity};return w(a,function(a,e,f){e=b?b.call(c,a,e,f):a,e>=d.computed&&(d={value:a,computed:e})}),d.value},v.min=function(a,b,c){if(!b&&v.isArray(a))return Math.min.apply(Math,a);if(!b&&v.isEmpty(a))return Infinity;var d={computed:Infinity};return w(a,function(a,e,f){e=b?b.call(c,a,e,f):a,e<d.computed&&(d={value:a,computed:e})}),d.value},v.shuffle=function(a){var b=[],c;return w(a,function(a,d){d==0?b[0]=a:(c=Math.floor(Math.random()*(d+1)),b[d]=b[c],b[c]=a)}),b},v.sortBy=function(a,b,c){return v.pluck(v.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},v.groupBy=function(a,b){var c={},d=v.isFunction(b)?b:function(a){return a[b]};return w(a,function(a,b){var e=d(a,b);(c[e]||(c[e]=[])).push(a)}),c},v.sortedIndex=function(a,b,c){c||(c=v.identity);for(var d=0,e=a.length;d<e;){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},v.toArray=function(a){return a?a.toArray?a.toArray():v.isArray(a)?g.call(a):v.isArguments(a)?g.call(a):v.values(a):[]},v.size=function(a){return v.toArray(a).length},v.first=v.head=function(a,b,c){return b!=null&&!c?g.call
4
- (a,0,b):a[0]},v.initial=function(a,b,c){return g.call(a,0,a.length-(b==null||c?1:b))},v.last=function(a,b,c){return b!=null&&!c?g.call(a,Math.max(a.length-b,0)):a[a.length-1]},v.rest=v.tail=function(a,b,c){return g.call(a,b==null||c?1:b)},v.compact=function(a){return v.filter(a,function(a){return!!a})},v.flatten=function(a,b){return v.reduce(a,function(a,c){return v.isArray(c)?a.concat(b?c:v.flatten(c)):(a[a.length]=c,a)},[])},v.without=function(a){return v.difference(a,g.call(arguments,1))},v.uniq=v.unique=function(a,b,c){var c=c?v.map(a,c):a,d=[];return v.reduce(c,function(c,e,f){if(0==f||(b===!0?v.last(c)!=e:!v.include(c,e)))c[c.length]=e,d[d.length]=a[f];return c},[]),d},v.union=function(){return v.uniq(v.flatten(arguments,!0))},v.intersection=v.intersect=function(a){var b=g.call(arguments,1);return v.filter(v.uniq(a),function(a){return v.every(b,function(b){return v.indexOf(b,a)>=0})})},v.difference=function(a){var b=v.flatten(g.call(arguments,1));return v.filter(a,function(a){return!v.include(b,a)})},v.zip=function(){for(var a=g.call(arguments),b=v.max(v.pluck(a,"length")),c=Array(b),d=0;d<b;d++)c[d]=v.pluck(a,""+d);return c},v.indexOf=function(a,b,c){if(a==null)return-1;var d;if(c)return c=v.sortedIndex(a,b),a[c]===b?c:-1;if(r&&a.indexOf===r)return a.indexOf(b);for(c=0,d=a.length;c<d;c++)if(c in a&&a[c]===b)return c;return-1},v.lastIndexOf=function(a,b){if(a==null)return-1;if(s&&a.lastIndexOf===s)return a.lastIndexOf(b);for(var c=a.length;c--;)if(c in a&&a[c]===b)return c;return-1},v.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0);for(var c=arguments[2]||1,d=Math.max(Math.ceil((b-a)/c),0),e=0,f=Array(d);e<d;)f[e++]=a,a+=c;return f};var y=function(){};v.bind=function(a,b){var c,d;if(a.bind===u&&u)return u.apply(a,g.call(arguments,1));if(!v.isFunction(a))throw new TypeError;return d=g.call(arguments,2),c=function(){if(this instanceof c){y.prototype=a.prototype;var e=new y,f=a.apply(e,d.concat(g.call(arguments)));return Object(f)===f?f:e}return a.apply(b,d.concat(g.call(arguments)))}},v.bindAll=function(a){var b=g.call(arguments,1);return b.length==0&&(b=v.functions(a)),w(b,function(b){a[b]=v.bind(a[b],a)}),a},v.memoize=function(a,b){var c={};return b||(b=v.identity),function(){var d=b.apply(this,arguments);return v.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},v.delay=function(a,b){var c=g.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},v.defer=function(a){return v.delay.apply(v,[a,1].concat(g.call(arguments,1)))},v.throttle=function(a,b){var c,d,e,f,g,h=v.debounce(function(){g=f=!1},b);return function(){c=this,d=arguments;var i;e||(e=setTimeout(function(){e=null,g&&a.apply(c,d),h()},b)),f?g=!0:a.apply(c,d),h(),f=!0}},v.debounce=function(a,b){var c;return function(){var d=this,e=arguments;clearTimeout(c),c=setTimeout(function(){c=null,a.apply(d,e)},b)}},v.once=function(a){var b=!1,c;return function(){return b?c:(b=!0,c=a.apply(this,arguments))}},v.wrap=function(a,b){return function(){var c=[a].concat(g.call(arguments,0));return b.apply(this,c)}},v.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},v.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}},v.keys=t||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],c;for(c in a)v.has(a,c)&&(b[b.length]=c);return b},v.values=function(a){return v.map(a,v.identity)},v.functions=v.methods=function(a){var b=[],c;for(c in a)v.isFunction(a[c])&&b.push(c);return b.sort()},v.extend=function(a){return w(g.call(arguments,1),function(b){for(var c in b)a[c]=b[c]}),a},v.defaults=function(a){return w(g.call(arguments,1),function(b){for(var c in b)a[c]==null&&(a[c]=b[c])}),a},v.clone=function(a){return v.isObject(a)?v.isArray(a)?a.slice():v.extend({},a):a},v.tap=function(a,b){return b(a),a},v.isEqual=function(b,c){return a(b,c,[])},v.isEmpty=function(a){if(v.isArray(a)||v.isString(a))return a.length===0;for(var b in a)if(v.has(a,b))return!1;return!0},v.isElement=function(a){return!!a&&a.nodeType==1},v.isArray=f||function(a){return i.call(a)=="[object Array]"},v.isObject=function(a){return a===Object(a)},v.isArguments=function(a){return i.call(a)=="[object Arguments]"},v.isArguments(arguments)||(v.isArguments=function(a){return!!a&&!!v.has(a,"callee")}),v.isFunction=function(a){return i.call(a)=="[object Function]"},v.isString=function(a){return i.call(a)=="[object String]"},v.isNumber=function(a){return i.call(a)=="[object Number]"},v.isNaN=function(a){return a!==a},v.isBoolean=function(a){return a===!0||a===!1||i.call(a)=="[object Boolean]"},v.isDate=function(a){return i.call(a)=="[object Date]"},v.isRegExp=function(a){return i.call(a)=="[object RegExp]"},v.isNull=function(a){return a===null},v.isUndefined=function(a){return a===void 0},v.has=function(a,b){return j.call(a,b)},v.noConflict=function(){return b._=c,this},v.identity=function(a){return a},v.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},v.escape=function(a){return(""+a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")},v.mixin=function(a){w(v.functions(a),function(b){E(b,v[b]=a[b])})};var z=0;v.uniqueId=function(a){var b=z++;return a?a+b:b},v.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var A=/.^/,B=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};v.template=function(a,b){var c=v.templateSettings,c="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.escape||A,function(a,b){return"',_.escape("+B(b)+"),'"}).replace(c.interpolate||A,function(a,b){return"',"+B(b)+",'"}).replace(c.evaluate||A,function(a,b){return"');"+B(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",d=new Function("obj","_",c);return b?d(b,v):function(a){return d.call(this,a,v)}},v.chain=function(a){return v(a).chain()};var C=function(a){this._wrapped=a};v.prototype=C.prototype;var D=function(a,b){return b?v(a).chain():a},E=function(a,b){C.prototype[a]=function(){var a=g.call(arguments);return h.call(a,this._wrapped),D(b.apply(v,a),this._chain)}};v.mixin(v),w("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=e[a];C.prototype[a]=function(){var c=this._wrapped;b.apply(c,arguments);var d=c.length;return(a=="shift"||a=="splice")&&d===0&&delete c[0],D(c,this._chain)}}),w(["concat","join","slice"],function(a){var b=e[a];C.prototype[a]=function(){return D(b.apply(this._wrapped,arguments),this._chain)}}),C.prototype.chain=function(){return this._chain=!0,this},C.prototype.value=function(){return this._wrapped}}.call(this),function(a){var b=String.prototype.trim,c=function(a,b){for(var c=[];b>0;c[--b]=a);return c.join("")},d=function(a){return function(){for(var b=Array.prototype.slice.call(arguments),c=0;c<b.length;c++)b[c]=b[c]==null?"":""+b[c];return a.apply(null,b)}},e=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}var b=function(){return b.cache.hasOwnProperty(arguments[0])||(b.cache[arguments[0]]=b.parse(arguments[0])),b.format.call(null,b.cache[arguments[0]],arguments)};return b.format=function(b,d){var f=1,g=b.length,h="",i=[],j,k,n,o;for(j=0;j<g;j++)if(h=a(b[j]),h==="string")i.push(b[j]);else if(h==="array"){n=b[j];if(n[2]){h=d[f];for(k=0;k<n[2].length;k++){if(!h.hasOwnProperty(n[2][k]))throw e('[_.sprintf] property "%s" does not exist',n[2][k]);h=h[n[2][k]]}}else h=n[1]?d[n[1]]:d[f++];if(/[^s]/.test(n[8])&&a(h)!="number")throw e("[_.sprintf] expecting number but found %s",a(h));switch(n[8]){case"b":h=h.toString(2);break;case"c":h=String.fromCharCode(h);break;case"d":h=parseInt(h,10);break;case"e":h=n[7]?h.toExponential(n[7]):h.toExponential();break;case"f":h=n[7]?parseFloat(h).toFixed(n[7]):parseFloat(h);break;case"o":h=h.toString(8);break;case"s":h=(h=String(h))&&n[7]?h.substring(0,n[7]):h;break;case"u":h=Math.abs(h);break;case"x":h=h.toString(16);break;case"X":h=h.toString(16).toUpperCase()}h=/[def]/.test(n[8])&&n[3]&&h>=0?"+"+h:h,k=n[4]?n[4]=="0"?"0":n[4].charAt(1):" ",o=n[6]-String(h).length,k=n[6]?c(k,o):"",i.push(n[5]?h+k:k+h)}return i.join("")},b.cache={},b.parse=function(a){for(var b=[],c=[],d=0;a;){if((b=/^[^\x25]+/.exec(a))!==null)c.push(b[0]);else if((b=/^\x25{2}/.exec(a))!==null)c.push("%");else{if((b=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(a))===null)throw"[_.sprintf] huh?";if(b[2]){d|=1;var e=[],f=b[2],g=[];if((g=/^([a-z_][a-z_\d]*)/i.exec(f))===null)throw"[_.sprintf] huh?";for(e.push(g[1]);(f=f.substring(g[0].length))!=="";)if((g=/^\.([a-z_][a-z_\d]*)/i.exec(f))!==null)e.push(g[1]);else{if((g=/^\[(\d+)\]/.exec(f))===null)throw"[_.sprintf] huh?";e.push(g[1])}b[2]=e}else d|=2;if(d===3)throw"[_.sprintf] mixing positional and named placeholders is not (yet) supported";c.push(b)}a=a.substring(b[0].length)}return c},b}(),f={VERSION:"1.2.0",isBlank:d(function(a){return/^\s*$/.test(a)}),stripTags:d(function(a){return a.replace(/<\/?[^>]+>/ig,"")}),capitalize:d(function(a){return a.charAt(0).toUpperCase()+a.substring(1).toLowerCase()}),chop:d(function(a,b){for(var b=b*1||0||a.length,c=[],d=0;d<a.length;)c.push(a.slice(d,d+b)),d+=b;return c}),clean:d(function(a){return f.strip(a.replace(/\s+/g," "))}),count:d(function(a,b){for(var c=0,d,e=0;e<a.length;)d=a.indexOf(b,e),d>=0&&c++,e=e+(d>=0?d:0)+b.length;return c}),chars:d(function(a){return a.split("")}),escapeHTML:d(function(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}),unescapeHTML:d(function(a){return a.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}),escapeRegExp:d(function(a){return a.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")}),insert:d(function(a,b,c){return a=a.split(""),a.splice(b*1||0,0,c),a.join("")}),include:d(function(a,b){return a.indexOf(b)!==-1}),join:d(function(a){var b=Array.prototype.slice.call(arguments);return b.join(b.shift())}),lines:d(function(a){return a.split("\n")}),reverse:d(function(a){return Array.prototype.reverse.apply(String(a).split("")).join("")}),splice:d(function(a,b,c,d){return a=a.split(""),a.splice(b*1||0,c*1||0,d),a.join("")}),startsWith:d(function(a,b){return a.length>=b.length&&a.substring(0,b.length)===b}),endsWith:d(function(a,b){return a.length>=b.length&&a.substring(a.length-b.length)===b}),succ:d(function(a){var b=a.split("");return b.splice(a.length-1,1,String.fromCharCode(a.charCodeAt(a.length-1)+1)),b.join("")}),titleize:d(function(a){for(var a=a.split(" "),b,c=0;c<a.length;c++)b=a[c].split(""),typeof b[0]!="undefined"&&(b[0]=b[0].toUpperCase()),c+1===a.length?a[c]=b.join(""):a[c]=b.join("")+" ";return a.join("")}),camelize:d(function(a){return f.trim(a).replace(/(\-|_|\s)+(.)?/g,function(a,b,c){return c?c.toUpperCase():""})}),underscored:function(a){return f.trim(a).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/\-|\s+/g,"_").toLowerCase()},dasherize:function(a){return f.trim(a).replace(/([a-z\d])([A-Z]+)/g,"$1-$2").replace(/^([A-Z]+)/,"-$1").replace(/\_|\s+/g,"-").toLowerCase()},humanize:function(a){return f.capitalize(this.underscored(a).replace(/_id$/,"").replace(/_/g," "))},trim:d(function(a,c){return!c&&b?b.call(a):(c=c?f.escapeRegExp(c):"\\s",a.replace(RegExp("^["+c+"]+|["+c+"]+$","g"),""))}),ltrim:d(function(a,b){return b=b?f.escapeRegExp(b):"\\s",a.replace(RegExp("^["+b+"]+","g"),"")}),rtrim:d(function(a,b){return b=b?f.escapeRegExp(b):"\\s",a.replace(RegExp("["+b+"]+$","g"),"")}),truncate:d(function(a,b,c){return b=b*1||0,a.length>b?a.slice(0,b)+(c||"..."):a}),prune:d(function(a,b,c){var c=c||"...",b=b*1||0,d="",d=a.substring(b-1,b+1).search(/^\w\w$/)===0?f.rtrim(a.slice(0,b).replace(/([\W][\w]*)$/,"")):f.rtrim(a.slice(0,b)),d=d.replace(/\W+$/,"");return d.length+c.length>a.length?a:d+c}),words:function(a,b){return String(a).split(b||" ")},pad:d(function(a,b,d,e){var f="",f=0,b=b*1||0;d?d.length>1&&(d=d.charAt(0)):d=" ";switch(e){case"right":f=b-a.length,f=c(d,f),a+=f;break;case"both":f=b-a.length,f={left:c(d,Math.ceil(f/2)),right:c(d,Math.floor(f/2))},a=f.left+a+f.right;break;default:f=b-a.length,f=c(d,f),a=f+a}return a}),lpad:function(a,b,c){return f.pad(a,b,c)},rpad:function(a,b,c){return f.pad(a,b,c,"right")},lrpad:function(a,b,c){return f.pad(a,b,c,"both")},sprintf:e,vsprintf:function(a,b){return b.unshift(a),e.apply(null,b)},toNumber:function(a,b){var c;return c=(a*1||0).toFixed(b*1||0)*1||0,c!==0||a==="0"||a===0?c:Number.NaN},strRight:d(function(a,b){var c=b?a.indexOf(b):-1;return c!=-1?a.slice(c+b.length,a.length):a}),strRightBack:d(function(a,b){var c=b?a.lastIndexOf(b):-1;return c!=-1?a.slice(c+b.length,a.length):a}),strLeft:d(function(a,b){var c=b?a.indexOf(b):-1;return c!=-1?a.slice(0,c):a}),strLeftBack:d(function(a,b){var c=a.lastIndexOf(b);return c!=-1?a.slice(0,c):a}),exports:function(){var a={},b;for(b in this)this.hasOwnProperty(b)&&b!="include"&&b!="contains"&&b!="reverse"&&(a[b]=this[b]);return a}};f.strip=f.trim,f.lstrip=f.ltrim,f.rstrip=f.rtrim,f.center=f.lrpad,f.ljust=f.lpad,f.rjust=f.rpad,f.contains=f.include,typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(module.exports=f),exports._s=f):typeof a._!="undefined"?(a._.string=f,a._.str=a._.string):a._={string:f,str:f}}(this||window),function(){var a=this,b=a.Backbone,c=Array.prototype.slice,d=Array.prototype.splice,e;e="undefined"!=typeof exports?exports:a.Backbone={},e.VERSION="0.9.1";var f=a._;!f&&"undefined"!=typeof require&&(f=require("underscore"));var g=a.jQuery||a.Zepto||a.ender;e.setDomLibrary=function(a){g=a},e.noConflict=function(){return a.Backbone=b,this},e.emulateHTTP=!1,e.emulateJSON=!1,e.Events={on:function(a,b,c){for(var d,a=a.split(/\s+/),e=this._callbacks||(this._callbacks={});d=a.shift();){d=e[d]||(e[d]={});var f=d.tail||(d.tail=d.next={});f.callback=b,f.context=c,d.tail=f.next={}}return this},off:function(a,b,c){var d,e,f;if(a){if(e=this._callbacks)for(a=a.split(/\s+/);d=a.shift();)if(f=e[d],delete e[d],b&&f)for(;(f=f.next)&&f.next;)(f.callback!==b||!!c&&f.context!==c)&&this.on(d,f.callback,f.context)}else delete this._callbacks;return this},trigger:function(a){var b,d,e,f;if(!(e=this._callbacks))return this;f=e.all;for((a=a.split(/\s+/)).push(null);b=a.shift();)f&&a.push({next:f.next,tail:f.tail,event:b}),(d=e[b])&&a.push({next:d.next,tail:d.tail});for(f=c.call(arguments,1);d=a.pop();){b=d.tail;for(e=d.event?[d.event].concat(f):f;(d=d.next)!==b;)d.callback.apply(d.context||this,e)}return this}},e.Events.bind=e.Events.on,e.Events.unbind=e.Events.off,e.Model=function(a,b){var c;a||(a={}),b&&b.parse&&(a=this.parse(a));if(c=s(this,"defaults"))a=f.extend({},c,a);b&&b.collection&&(this.collection=b.collection),this.attributes={},this._escapedAttributes={},this.cid=f.uniqueId("c");if(!this.set(a,{silent:!0}))throw Error("Can't create an invalid model");delete this._changed,this._previousAttributes=f.clone(this.attributes),this.initialize.apply(this,arguments)},f.extend(e.Model.prototype,e.Events,{idAttribute:"id",initialize:function(){},toJSON:function(){return f.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;return(b=this._escapedAttributes[a])?b:(b=this.attributes[a],this._escapedAttributes[a]=f.escape(null==b?"":""+b))},has:function(a){return null!=this.attributes[a]},set:function(a,b,c){var d,g;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b),c||(c={});if(!d)return this;d instanceof e.Model&&(d=d.attributes);if(c.unset)for(g in d)d[g]=void 0;if(!this._validate(d,c))return!1;this.idAttribute in d&&(this.id=d[this.idAttribute]);var b=this.attributes,h=this._escapedAttributes,i=this._previousAttributes||{},j=this._setting;this._changed||(this._changed={}),this._setting=!0;for(g in d)if(a=d[g],f.isEqual(b[g],a)||delete h[g],c.unset?delete b[g]:b[g]=a,this._changing&&!f.isEqual(this._changed[g],a)&&(this.trigger("change:"+g,this,a,c),this._moreChanges=!0),delete this._changed[g],!f.isEqual(i[g],a)||f.has(b,g)!=f.has(i,g))this._changed[g]=a;return j||(!c.silent&&this.hasChanged()&&this.change(c),this._setting=!1),this},unset:function(a,b){return(b||(b={})).unset=!0,this.set(a,null,b)},clear:function(a){return(a||(a={})).unset=!0,this.set(f.clone(this.attributes),a)},fetch:function(a){var a=a?f.clone(a):{},b=this,c=a.success;return a.success=function(d,e,f){if(!b.set(b.parse(d,f),a))return!1;c&&c(b,d)},a.error=e.wrapError(a.error,b,a),(this.sync||e.sync).call(this,"read",this,a)},save:function(a,b,c){var d,g;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b),c=c?f.clone(c):{},c.wait&&(g=f.clone(this.attributes)),a=f.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?a:c))return!1;var h=this,i=c.success;return c.success=function(a,b,e){b=h.parse(a,e),c.wait&&(b=f.extend(d||{},b));if(!h.set(b,c))return!1;i?i(h,a):h.trigger("sync",h,a,c)},c.error=e.wrapError(c.error,h,c),b=this.isNew()?"create":"update",b=(this.sync||e.sync).call(this,b,this,c),c.wait&&this.set(g,a),b},destroy:function(a){var a=a?f.clone(a):{},b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};if(this.isNew())return d();a.success=function(e){a.wait&&d(),c?c(b,e):b.trigger("sync",b,e,a)},a.error=e.wrapError(a.error,b,a);var g=(this.sync||e.sync).call(this,"delete",this,a);return a.wait||d(),g},url:function(){var a=s(this.collection,"url")||s(this,"urlRoot")||t();return this.isNew()?a:a+("/"==a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(a){if(this._changing||!this.hasChanged())return this;this._moreChanges=this._changing=!0;for(var b in this._changed)this.trigger("change:"+b,this,this._changed[b],a);for(;this._moreChanges;)this._moreChanges=!1,this.trigger("change",this,a);return this._previousAttributes=f.clone(this.attributes),delete this._changed,this._changing=!1,this},hasChanged:function(a){return arguments.length?this._changed&&f.has(this._changed,a):!f.isEmpty(this._changed)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this._changed):!1;var b,c=!1,d=this._previousAttributes,e;for(e in a)f.isEqual(d[e],b=a[e])||((c||(c={}))[e]=b);return c},previous:function(a){return!arguments.length||!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(a,b){if(b.silent||!this.validate)return!0;var a=f.extend({},this.attributes,a),c=this.validate(a,b);return c?(b&&b.error?b.error(this,c,b):this.trigger("error",this,c,b),!1):!0}}),e.Collection=function(a,b){b||(b={}),b.comparator&&(this.comparator=b.comparator),this._reset(),this.initialize.apply(this,arguments),a&&this.reset(a,{silent:!0,parse:b.parse})},f.extend(e.Collection.prototype,e.Events,{model:e.Model,initialize:function(){},toJSON:function(){return this.map(function(a){return a.toJSON()})},add:function(a,b){var c,e,g,h,i,j={},k={};b||(b={}),a=f.isArray(a)?a.slice():[a];for(c=0,e=a.length;c<e;c++){if(!(g=a[c]=this._prepareModel(a[c],b)))throw Error("Can't add an invalid model to a collection");if(j[h=g.cid]||this._byCid[h]||null!=(i=g.id)&&(k[i]||this._byId[i]))throw Error("Can't add the same model to a collection twice");j[h]=k[i]=g}for(c=0;c<e;c++)(g=a[c]).on("all",this._onModelEvent,this),this._byCid[g.cid]=g,null!=g.id&&(this._byId[g.id]=g);this.length+=e,d.apply(this.models,[null!=b.at?b.at:this.models.length,0].concat(a)),this.comparator&&this.sort({silent:!0});if(b.silent)return this;for(c=0,e=this.models.length;c<e;c++)j[(g=this.models[c]).cid]&&(b.index=c,g.trigger("add",g,this,b));return this},remove:function(a,b){var c,d,e,g;b||(b={}),a=f.isArray(a)?a.slice():[a];for(c=0,d=a.length;c<d;c++)if(g=this.getByCid(a[c])||this.get(a[c]))delete this._byId[g.id],delete this._byCid[g.cid],e=this.indexOf(g),this.models.splice(e,1),this.length--,b.silent||(b.index=e,g.trigger("remove",g,this,b)),this._removeReference(g);return this},get:function(a){return null==a?null:this._byId[null!=a.id?a.id:a]},getByCid:function(a){return a&&this._byCid[a.cid||a]},at:function(a){return this.models[a]},sort:function(a){a||(a={});if(!this.comparator)throw Error("Cannot sort a set without a comparator");var b=f.bind(this.comparator,this);return 1==this.comparator.length?this.models=this.sortBy(b):this.models.sort(b),a.silent||this.trigger("reset",this,a),this},pluck:function(a){return f.map(this.models,function(b){return b.get(a)})},reset:function(a,b){a||(a=[]),b||(b={});for(var c=0,d=this.models.length;c<d;c++)this._removeReference(this.models[c]);return this._reset(),this.add(a,{silent:!0,parse:b.parse}),b.silent||this.trigger("reset",this,b),this},fetch:function(a){a=a?f.clone(a):{},void 0===a.parse&&(a.parse=!0);var b=this,c=a.success;return a.success=function(d,e,f){b[a.add?"add":"reset"](b.parse(d,f),a),c&&c(b,d)},a.error=e.wrapError(a.error,b,a),(this.sync||e.sync).call(this,"read",this,a)},create:function(a,b){var c=this,b=b?f.clone(b):{},a=this._prepareModel(a,b);if(!a)return!1;b.wait||c.add(a,b);var d=b.success;return b.success=function(e,f){b.wait&&c.add(e,b),d?d(e,f):e.trigger("sync",a,f,b)},a.save(null,b),a},parse:function(a){return a},chain:function(){return f(this.models).chain()},_reset:function(){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(a,b){return a instanceof e.Model?a.collection||(a.collection=this):(b.collection=this,a=new this.model(a,b),a._validate(a.attributes,b)||(a=!1)),a},_removeReference:function(a){this==a.collection&&delete a.collection,a.off("all",this._onModelEvent,this)},_onModelEvent:function(a,b,c,d){("add"==a||"remove"==a)&&c!=this||("destroy"==a&&this.remove(b,d),b&&a==="change:"+b.idAttribute&&(delete this._byId[b.previous(b.idAttribute)],this._byId[b.id]=b),this.trigger.apply(this,arguments))}}),f.each("forEach,each,map,reduce,reduceRight,find,detect,filter,select,reject,every,all,some,any,include,contains,invoke,max,min,sortBy,sortedIndex,toArray,size,first,initial,rest,last,without,indexOf,shuffle,lastIndexOf,isEmpty,groupBy".split(","),function(a){e.Collection.prototype[a]=function(){return f[a].apply(f,[this.models].concat(f.toArray(arguments)))}}),e.Router=function(a){a||(a={}),a.routes&&(this.routes=a.routes),this._bindRoutes(),this.initialize.apply(this,arguments)};var h=/:\w+/g,i=/\*\w+/g,j=/[-[\]{}()+?.,\\^$|#\s]/g;f.extend(e.Router.prototype,e.Events,{initialize:function(){},route:function(a,b,c){return e.history||(e.history=new e.History),f.isRegExp(a)||(a=this._routeToRegExp(a)),c||(c=this[b]),e.history.route(a,f.bind(function(d){d=this._extractParameters(a,d),c&&c.apply(this,d),this.trigger.apply(this,["route:"+b].concat(d)),e.history.trigger("route",this,b,d)},this)),this},navigate:function(a,b){e.history.navigate(a,b)},_bindRoutes:function(){if(this.routes){var a=[],b;for(b in this.routes)a.unshift([b,this.routes[b]]);b=0;for(var c=a.length;b<c;b++)this.route(a[b][0],a[b][1],this[a[b][1]])}},_routeToRegExp:function(a){return a=a.replace(j,"\\$&").replace(h,"([^/]+)").replace(i,"(.*?)"),RegExp("^"+a+"$")},_extractParameters:function(a,b){return a.exec(b).slice(1)}}),e.History=function(){this.handlers=[],f.bindAll(this,"checkUrl")};var k=/^[#\/]/,l=/msie [\w.]+/,m=!1;f.extend(e.History.prototype,e.Events,{interval:50,getFragment:function(a,b){if(null==a)if(this._hasPushState||b){var a=window.location.pathname,c=window.location.search;c&&(a+=c)}else a=window.location.hash;return a=decodeURIComponent(a),a.indexOf(this.options.root)||(a=a.substr(this.options.root.length)),a.replace(k,"")},start:function(a){if(m)throw Error("Backbone.history has already been started");this.options=f.extend({},{root:"/"},this.options,a),this._wantsHashChange=!1!==this.options.hashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.options.pushState||!window.history||!window.history.pushState);var a=this.getFragment(),b=document.documentMode;if(b=l.exec(navigator.userAgent.toLowerCase())&&(!b||7>=b))this.iframe=g('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(a);this._hasPushState?g(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!b?g(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=a,m=!0,a=window.location,b=a.pathname==this.options.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!b)return this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&b&&a.hash&&(this.fragment=a.hash.replace(k,""),window.history.replaceState({},document.title,a.protocol+"//"+a.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},stop:function(){g(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),m=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();a==this.fragment&&this.iframe&&(a=this.getFragment(this.iframe.location.hash));if(a==this.fragment||a==decodeURIComponent(this.fragment))return!1;this.iframe&&this.navigate(a),this.loadUrl()||this.loadUrl(window.location.hash)},loadUrl:function(a){var b=this.fragment=this.getFragment(a);return f.any(this.handlers,function(a){if(a.route.test(b))return a.callback(b),!0})},navigate:function(a,b){if(!m)return!1;if(!b||!0===b)b={trigger:b};var c=(a||"").replace(k,"");this.fragment==c||this.fragment==decodeURIComponent(c)||(this._hasPushState?(0!=c.indexOf(this.options.root)&&(c=this.options.root+c),this.fragment=c,window.history[b.replace?"replaceState":"pushState"]({},document.title,c)):this._wantsHashChange?(this.fragment=c,this._updateHash(window.location,c,b.replace),this.iframe&&c!=this.getFragment(this.iframe.location.hash)&&(b.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,c,b.replace))):window.location.assign(this.options.root+a),b.trigger&&this.loadUrl(a))},_updateHash:function(a,b,c){c?a.replace(a.toString().replace(/(javascript:|#).*$/,"")+"#"+b):a.hash=b}}),e.View=function(a){this.cid=f.uniqueId("view"),this._configure(a||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()};var n=/^(\S+)\s*(.*)$/,o="model,collection,el,id,attributes,className,tagName".split(",");f.extend(e.View.prototype,e.Events,{tagName:"div",$:function(a){return this.$el.find(a)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this},make:function(a,b,c){return a=document.createElement(a),b&&g(a).attr(b),c&&g(a).html(c),a},setElement:function(a,b){return this.$el=g(a),this.el=this.$el[0],!1!==b&&this.delegateEvents(),this},delegateEvents:function(a){if(a||(a=s(this,"events"))){this.undelegateEvents();for(var b in a){var c=a[b];f.isFunction(c)||(c=this[a[b]]);if(!c)throw Error('Event "'+a[b]+'" does not exist');var d=b.match(n),e=d[1],d=d[2],c=f.bind(c,this),e=e+(".delegateEvents"+this.cid);""===d?this.$el.bind(e,c):this.$el.delegate(d,e,c)}}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(a){this.options&&(a=f.extend({},this.options,a));for(var b=0,c=o.length;b<c;b++){var d=o[b];a[d]&&(this[d]=a[d])}this.options=a},_ensureElement:function(){if(this.el)this.setElement(this.el,!1);else{var a=s(this,"attributes")||{};this.id&&(a.id=this.id),this.className&&(a["class"]=this.className),this.setElement(this.make(this.tagName,a),!1)}}}),e.Model.extend=e.Collection.extend=e.Router.extend=e.View.extend=function(a,b){var c=r(this,a,b);return c.extend=this.extend,c};var p={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};e.sync=function(a,b,c){var d=p[a],h={type:d,dataType:"json"};return c.url||(h.url=s(b,"url")||t()),!c.data&&b&&("create"==a||"update"==a)&&(h.contentType="application/json",h.data=JSON.stringify(b.toJSON())),e.emulateJSON&&(h.contentType="application/x-www-form-urlencoded",h.data=h.data?{model:h.data}:{}),e.emulateHTTP&&("PUT"===d||"DELETE"===d)&&(e.emulateJSON&&(h.data._method=d),h.type="POST",h.beforeSend=function(a){a.setRequestHeader("X-HTTP-Method-Override",d)}),"GET"!==h.type&&!e.emulateJSON&&(h.processData=!1),g.ajax(f.extend(h,c))},e.wrapError=function(a,b,c){return function(d,e){e=d===b?e:d,a?a(b,e,c):b.trigger("error",b,e,c)}};var q=function(){},r=function(a,b,c){var d;return d=b&&b.hasOwnProperty("constructor")?b.constructor:function(){a.apply(this,arguments)},f.extend(d,a),q.prototype=a.prototype,d.prototype=new q,b&&f.extend(d.prototype,b),c&&f.extend(d,c),d.prototype.constructor=d,d.__super__=a.prototype,d},s=function(a,b){return!a||!a[b]?null:f.isFunction(a[b])?a[b]():a[b]},t=function(){throw Error('A "url" property or function must be specified')}}.call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]===a)return b;return-1};f=function(a){var b,c,d,e,f,g;g=[];for(b in a){d=a[b],c={key:b};if(_.isRegExp(d))c.type="$regex",c.value=d;else if(_(d).isObject())for(e in d)f=d[e],k(e,f)&&(c.type=e,c.value=f);else c.type="$equal",c.value=d;g.push(c)}return g},k=function(a,b){switch(a){case"$in":case"$nin":case"$all":case"$any":return _(b).isArray();case"$size":return _(b).isNumber();case"$regex":return _(b).isRegExp();case"$like":case"$likeI":return _(b).isString();case"$between":return _(b).isArray()&&b.length===2;case"$cb":return _(b).isFunction();default:return!0}},j=function(a,b){switch(a){case"$like":case"$likeI":case"$regex":return _(b).isString();case"$contains":case"$all":case"$any":return _(b).isArray();case"$size":return _(b).isArray()||_(b).isString();case"$in":case"$nin":return b!=null;default:return!0}},g=function(a,b,c,d){switch(a){case"$equal":return c===b;case"$contains":return l.call(c,b)>=0;case"$ne":return c!==b;case"$lt":return c<b;case"$gt":return c>b;case"$lte":return c<=b;case"$gte":return c>=b;case"$between":return b[0]<c&&c<b[1];case"$in":return l.call(b,c)>=0;case"$nin":return l.call(b,c)<0;case"$all":return _(c).all(function(a){return l.call(b,a)>=0});case"$any":return _(c).any(function(a){return l.call(b,a)>=0});case"$size":return c.length===b;case"$exists":case"$has":return c!=null===b;case"$like":return c.indexOf(b)!==-1;case"$likeI":return c.toLowerCase().indexOf(b.toLowerCase())!==-1;case"$regex":return b.test(c);case"$cb":return b.call(d,c);default:return!1}},d=function(a,b,c,d){var e;return e=f(b),_[d](a,function(a){var b,d,f,h,i;for(h=0,i=e.length;h<i;h++){d=e[h],b=a.get(d.key),f=j(d.type,b),f&&(f=g(d.type,d.value,b,a));if(c===f)return c}return!c})},h={$and:function(a,b){return d(a,b,!1,"filter")},$or:function(a,b){return d(a,b,!0,"filter")},$nor:function(a,b){return d(a,b,!0,"reject")},$not:function(a,b){return d(a,b,!1,"reject")}},a=function(a,b,d){var e,f,g,h;return g=JSON.stringify(b),e=(h=a._query_cache)!=null?h:a._query_cache={},f=e[g],f||(f=c(a,b,d),e[g]=f),f},b=function(a,b){var c,d,e;return c=_.intersection(["$and","$not","$or","$nor"],_(b).keys()),d=a.models,c.length===0?h.$and(d,b):(e=function(a,c){return h[c](a,b[c])},_.reduce(c,e,d))},c=function(a,c,d){var e;return e=b(a,c),d.sortBy&&(e=i(e,d)),e},i=function(a,b){return _(b.sortBy).isString()?a=_(a).sortBy(function(a){return a.get(b.sortBy)}):_(b.sortBy).isFunction()&&(a=_(a).sortBy(b.sortBy)),b.order==="desc"&&(a=a.reverse()),a},e=function(a,b){var c,d,e,f;return b.offset?e=b.offset:b.page?e=(b.page-1)*b.limit:e=0,c=e+b.limit,d=a.slice(e,c),b.pager&&_.isFunction(b.pager)&&(f=Math.ceil(a.length/b.limit),b.pager(f,d)),d};if(typeof require!="undefined"){if(typeof _=="undefined"||_===null)_=require("underscore");if(typeof Backbone=="undefined"||Backbone===null)Backbone=require("backbone")}Backbone.QueryCollection=Backbone.Collection.extend({query:function(b,d){var f;return d==null&&(d={}),d.cache?f=a(this,b,d):f=c(this,b,d),d.limit&&(f=e(f,d)),f},where:function(a,b){return b==null&&(b={}),new this.constructor(this.query(a,b))},reset_query_cache:function(){return this._query_cache={}}}),typeof exports!="undefined"&&(exports.QueryCollection=Backbone.QueryCollection)}.call(this),function(){}.call(this),!function(a){a(function(){a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd"
5
- ,msTransition:"MSTransitionEnd",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){function b(){var b=this,d=setTimeout(function(){b.$element.off(a.support.transition.end),c.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(d),c.call(b)})}function c(a){this.$element.hide().trigger("hidden"),d.call(this)}function d(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),f?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(e,this)):e.call(this)):b&&b()}function e(){this.$backdrop.remove(),this.$backdrop=null}function f(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}var g=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};g.prototype={constructor:g,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;a("body").addClass("modal-open"),this.isShown=!0,f.call(this),d.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(d){d&&d.preventDefault();var e=this;d=a.Event("hide"),this.$element.trigger(d);if(!this.isShown||d.isDefaultPrevented())return;this.isShown=!1,a("body").removeClass("modal-open"),f.call(this),this.$element.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?b.call(this):c.call(this)}},a.fn.modal=function(b){return this.each(function(){var c=a(this),d=c.data("modal"),e=a.extend({},a.fn.modal.defaults,c.data(),typeof b=="object"&&b);d||c.data("modal",d=new g(this,e)),typeof b=="string"?d[b]():e.show&&d.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=g,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){function b(){a(c).parent().removeClass("open")}var c='[data-toggle="dropdown"]',d=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};d.prototype={constructor:d,toggle:function(c){var d=a(this),e,f,g;if(d.is(".disabled, :disabled"))return;return f=d.attr("data-target"),f||(f=d.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,"")),e=a(f),e.length||(e=d.parent()),g=e.hasClass("open"),b(),g||e.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var c=a(this),e=c.data("dropdown");e||c.data("dropdown",e=new d(this)),typeof b=="string"&&e[b].call(c)})},a.fn.dropdown.Constructor=d,a(function(){a("html").on("click.dropdown.data-api",b),a("body").on("click.dropdown",".dropdown form",function(a){a.stopPropagation()}).on("click.dropdown.data-api",c,d.prototype.toggle)})}(window.jQuery),!function(a){var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show)return c.show();clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.hide)return c.hide();clearTimeout(this.timeout),c.hoverState="out",this.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},isHTML:function(a){return typeof a!="string"||a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.isHTML(b)?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function b(){var b=setTimeout(function(){d.off(a.support.transition.end).remove()},500);d.one(a.support.transition.end,function(){clearTimeout(b),d.remove()})}var c=this,d=this.tip();d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?b():d.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0}}(window.jQuery),!function(a){var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.isHTML(b)?"html":"text"](b),a.find(".popover-content > *")[this.isHTML(c)?"html":"text"](c),a.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed").remove()}var d=a(this),e=d.attr("data-target"),f;e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close"));if(b.isDefaultPrevented())return;f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.on(a.support.transition.end,c):c()},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b,c,d,e;if(this.transitioning)return;b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find("> .accordion-group > .in");if(d&&d.length){e=d.data("collapse");if(e&&e.transitioning)return;d.collapse("hide"),e||d.data("collapse",null)}this.$element[b](0),this.transition("addClass",a.Event("show"),"shown"),this.$element[b](this.$element[0][c])},hide:function(){var b;if(this.transitioning)return;b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a!==null?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c.type=="show"&&e.reset(),e.transitioning=0,e.$element.trigger(d)};this.$element.trigger(c);if(c.isDefaultPrevented())return;this.transitioning=1,this.$element[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(a)).change(),this.hide()},updater:function(a){return a},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){return c.matcher(a)}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:if(a.type!="keydown")break;a.preventDefault(),this.prev();break;case 40:if(a.type!="keydown")break;a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery),function(){var a,b=Array.prototype.slice;(window||global).Luca=function(){var a,c,d,e,f,g;f=arguments[0],a=2<=arguments.length?b.call(arguments,1):[];if(_.isString(f)&&(g=Luca.cache(f)))return g;if(_.isString(f)&&(g=Luca.find(f)))return g;if(_.isObject(f)&&f.ctype!=null)return Luca.util.lazyComponent(f);_.isObject(f)&&f.defines&&f["extends"]&&(c=f.defines,e=f["extends"]);if(_.isFunction(d=_(a).last()))return d()},_.extend(Luca,{VERSION:"0.9.42",core:{},containers:{},components:{},modules:{},util:{},fields:{},registry:{},options:{}}),_.extend(Luca,Backbone.Events),Luca.autoRegister=!0,Luca.developmentMode=!1,Luca.enableGlobalObserver=!1,Luca.enableBootstrap=!0,Luca.keys={ENTER:13,ESCAPE:27,KEYLEFT:37,KEYUP:38,KEYRIGHT:39,KEYDOWN:40,SPACEBAR:32,FORWARDSLASH:191},Luca.keyMap=_(Luca.keys).inject(function(a,b,c){return a[b]=c.toLowerCase(),a},{}),Luca.find=function(){return},Luca.supportsEvents=Luca.supportsBackboneEvents=function(a){return Luca.isComponent(a)||_.isFunction(a!=null?a.trigger:void 0)||_.isFunction(a!=null?a.bind:void 0)},Luca.isComponent=function(a){return Luca.isBackboneModel(a)||Luca.isBackboneView(a)||Luca.isBackboneCollection(a)},Luca.isComponentPrototype=function(a){return Luca.isViewPrototype(a)||Luca.isModelPrototype(a)||Luca.isCollectionPrototype(a)},Luca.isBackboneModel=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.set:void 0)&&_.isFunction(a!=null?a.get:void 0)&&_.isObject(a!=null?a.attributes:void 0)},Luca.isBackboneView=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.render:void 0)&&!_.isUndefined(a!=null?a.el:void 0)},Luca.isBackboneCollection=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.fetch:void 0)&&_.isFunction(a!=null?a.reset:void 0)},Luca.isViewPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&a.prototype!=null&&a.prototype.make!=null&&a.prototype.$!=null&&a.prototype.render!=null},Luca.isModelPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&(typeof a.prototype=="function"?a.prototype(a.prototype.save!=null&&a.prototype.changedAttributes!=null):void 0)},Luca.isCollectionPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&a.prototype!=null&&!Luca.isModelPrototype(a)&&a.prototype.reset!=null&&a.prototype.select!=null&&a.prototype.reject!=null},Luca.inheritanceChain=function(a){return _(Luca.parentClasses(a)).map(function(a){return Luca.util.resolve(a)})},Luca.parentClasses=function(a){var b,c,d;return c=[],_.isString(a)&&(a=Luca.util.resolve(a)),c.push(a.displayName||((d=a.prototype)!=null?d.displayName:void 0)||Luca.parentClass(a)),b=function(){var b;b=[];while(Luca.parentClass(a)!=null)b.push(a=Luca.parentClass(a));return b}(),c=c.concat(b),_.uniq(c)},Luca.parentClass=function(a){var b,c,d;b=[],_.isString(a)&&(a=Luca.util.resolve(a));if(Luca.isComponent(a))return a.displayName;if(Luca.isComponentPrototype(a))return typeof (c=a.prototype)._superClass=="function"?(d=c._superClass())!=null?d.displayName:void 0:void 0},Luca.template=function(a,b){var c,d,e,f,g;window.JST||(window.JST={});if(_.isFunction(a))return a(b);d=(g=Luca.templates)!=null?g[a]:void 0,c=typeof JST!="undefined"&&JST!==null?JST[a]:void 0,d==null&&c==null&&(e=new RegExp(""+a+"$"),d=_(Luca.templates).detect(function(a,b){return e.exec(b)}),c=_(JST).detect(function(a,b){return e.exec(b)}));if(!d&&!c)throw"Could not find template named "+a;return f=d||c,b!=null?f(b):f},Luca.available_templates=function(a){var b;return a==null&&(a=""),b=_(Luca.templates).keys(),a.length>0?_(b).select(function(b){return b.match(a)}):b},a={module:function(a,b){_.extend(a,b);if(a.included&&_(a.included).isFunction())return a.included.apply(a)},"delete":function(a,b){var c;return c=a[b],delete a[b],c},idle:function(a,b){var c;return b==null&&(b=1e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleShort:function(a,b){var c;return b==null&&(b=100),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleMedium:function(a,b){var c;return b==null&&(b=2e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleLong:function(a,b){var c;return b==null&&(b=5e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}}},_.mixin(a)}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["components/bootstrap_form_controls"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<div class='form-actions'>\n <a class='btn btn-primary submit-button'>\n <i class='icon-ok icon-white'></i>\n Save Changes\n </a>\n <a class='btn reset-button cancel-button'>\n <i class='icon-remove'></i>\n Cancel\n </a>\n</div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["components/collection_loader_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<div class='modal' id='progress-model' style='display: none;'>\n <div class='progress progress-info progress-striped active'>\n <div class='bar' style='width: 0%;'></div>\n </div>\n <div class='message'>\n Initializing...\n </div>\n</div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["components/form_alert"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<div class='",className,"'>\n <a class='close' data-dismiss='alert' href='#'>x</a>\n ",message,"\n</div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["components/grid_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<div class='luca-ui-g-view-wrapper'>\n <div class='g-view-header'></div>\n <div class='luca-ui-g-view-body'>\n <table cellpadding='0' cellspacing='0' class='luca-ui-g-view scrollable-table' width='100%'>\n <thead class='fixed'></thead>\n <tbody class='scrollable'></tbody>\n </table>\n </div>\n <div class='luca-ui-g-view-footer'></div>\n</div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["components/grid_view_empty_text"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<div class='empty-text-wrapper'>\n <p>\n ",text,"\n </p>\n</div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["components/load_mask"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<div class='load-mask'>\n <div class='progress progress-striped active'>\n <div class='bar' style='width:1%'></div>\n </div>\n</div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["components/nav_bar"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<div class='navbar-inner'>\n <div class='luca-ui-navbar-body container'></div>\n</div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["containers/basic"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<div class='",classes,"' id='",id,"' style='",style,"'></div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["containers/tab_selector_container"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push("<div class='tab-selector-container' id='",cid,"-tab-selector'>\n <ul class='nav nav-tabs' id='",cid,"-tabs-nav'>\n ");for(var i=0;i<components.length;i++){__p.push("\n ");var component=components[i];__p.push("\n <li class='tab-selector' data-target='",i,"'>\n <a data-target='",i,"'>\n ",component.title,"\n </a>\n </li>\n ")}__p.push("\n </ul>\n</div>\n")}return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["containers/tab_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<ul class='nav ",navClass,"' id='",cid,"-tabs-selector'></ul>\n<div class='tab-content' id='",cid,"-tab-view-content'></div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["containers/toolbar_wrapper"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<div class='luca-ui-toolbar-wrapper' id='",id,"'></div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["fields/button_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<label>&nbsp</label>\n<input class='btn ",input_class,"' id='",input_id,"' style='",inputStyles,"' type='",input_type,"' value='",input_value,"' />\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["fields/button_field_link"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<a class='btn ",input_class,"'>\n "),icon_class.length&&__p.push("\n <i class='",icon_class,"'></i>\n "),__p.push("\n ",input_value,"\n</a>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["fields/checkbox_array"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<div class='control-group'>\n <label for='",input_id,"'>\n ",label,"\n </label>\n <div class='controls'></div>\n</div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["fields/checkbox_array_item"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<label for='",input_id,"'>\n <input id='",input_id,"' name='",input_name,"' type='checkbox' value='",value,"' />\n ",label,"\n</label>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["fields/checkbox_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<label for='",input_id,"'>\n ",label,"\n <input name='",input_name,"' style='",inputStyles,"' type='checkbox' value='",input_value,"' />\n</label>\n"),helperText&&__p.push("\n<p class='helper-text help-block'>\n ",helperText,"\n</p>\n"),__p.push("\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["fields/file_upload_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<label for='",input_id,"'>\n ",label,"\n</label>\n<input id='",input_id,"' name='",input_name,"' style='",inputStyles,"' type='file' />\n"),helperText&&__p.push("\n<p class='helper-text help-block'>\n ",helperText,"\n</p>\n"),__p.push("\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["fields/hidden_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<input id='",input_id,"' name='",input_name,"' type='hidden' value='",input_value,"' />\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["fields/select_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<label for='",input_id,"'>\n ",label,"\n</label>\n<div class='controls'>\n <select id='",input_id,"' name='",input_name,"' style='",inputStyles,"'></select>\n "),helperText&&__p.push("\n <p class='helper-text help-block'>\n ",helperText,"\n </p>\n "),__p.push("\n</div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["fields/text_area_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<label for='",input_id,"'>\n ",label,"\n</label>\n<textarea class='",input_class,"' id='",input_id,"' name='",input_name,"' style='",inputStyles,"'></textarea>\n"),helperText&&__p.push("\n<p class='helper-text help-block'>\n ",helperText,"\n</p>\n"),__p.push("\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["fields/text_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push(""),(typeof label!="undefined"&&typeof hideLabel!="undefined"&&!hideLabel||typeof hideLabel=="undefined")&&__p.push("\n<label class='control-label' for='",input_id,"'>\n ",label,"\n</label>\n"),__p.push("\n<div class='controls'>\n "),typeof addOn!="undefined"&&__p.push("\n <span class='add-on'>\n ",addOn,"\n </span>\n "),__p.push("\n <input class='",input_class,"' id='",input_id,"' name='",input_name,"' placeholder='",placeHolder,"' style='",inputStyles,"' type='text' />\n "),helperText&&__p.push("\n <p class='helper-text help-block'>\n ",helperText,"\n </p>\n "),__p.push("\n</div>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["sample/contents"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<p>Sample Contents</p>\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates["sample/welcome"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("welcome.luca\n");return __p.join("")}}.call(this),function(){Luca.templates||(Luca.templates={}),Luca.templates.table_view=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push("<thead></thead>\n<tbody class='table-body'></tbody>\n<tfoot></tfoot>\n<caption></caption>\n");return __p.join("")}}.call(this),function(){var currentNamespace;Luca.util.resolve=function(a,b){return b||(b=window||global),_(a.split(/\./)).inject(function(a,b){return a=a!=null?a[b]:void 0},b)},Luca.util.nestedValue=Luca.util.resolve,Luca.util.classify=function(a){return a==null&&(a=""),_.string.camelize(_.string.capitalize(a))},Luca.util.hook=function(a){var b,c,d;return a==null&&(a=""),c=a.split(":"),d=c.shift(),c=_(c).map(function(a){return _.string.capitalize(a)}),b=d+c.join("")},Luca.util.isIE=function(){try{return Object.defineProperty({},"",{}),!1}catch(a){return!0}},currentNamespace=window||global,Luca.util.namespace=function(namespace){return namespace==null?currentNamespace:(currentNamespace=_.isString(namespace)?Luca.util.resolve(namespace,window||global):namespace,currentNamespace!=null?currentNamespace:currentNamespace=eval("(window||global)."+namespace+" = {}"))},Luca.util.lazyComponent=function(config){var componentClass,constructor,ctype;_.isObject(config)&&(ctype=config.ctype||config.type),_.isString(config)&&(ctype=config),componentClass=Luca.registry.lookup(ctype);if(!componentClass)throw"Invalid Component Type: "+ctype+". Did you forget to register it?";return constructor=eval(componentClass),new constructor(config)},Luca.util.selectProperties=function(a,b,c){var d;return d=_(b).values(),_(d).select(a)},Luca.util.loadScript=function(a,b){var c;return c=document.createElement("script"),c.type="text/javascript",c.readyState&&(c.onreadystatechange=function(){return c.readyState==="loaded"||c.readyState==="complete"?(c.onreadystatechange=null,b()):c.onload=function(){return b()}}),c.src=a,document.body.appendChild(c)},Luca.util.make=Backbone.View.prototype.make,Luca.util.list=function(a,b,c){var d,e,f,g;b==null&&(b={}),d=c?"ol":"ul",d=Luca.util.make(d,b);if(_.isArray(a))for(f=0,g=a.length;f<g;f++)e=a[f],$(d).append(Luca.util.make("li",{},e));return d.outerHTML},Luca.util.label=function(a,b,c){var d;return a==null&&(a=""),c==null&&(c="label"),d=c,b!=null&&(d+=" "+c+"-"+b),Luca.util.make("span",{"class":d},a)},Luca.util.badge=function(a,b,c){var d;return a==null&&(a=""),c==null&&(c="badge"),d=c,b!=null&&(d+=" "+c+"-"+b),Luca.util.make("span",{"class":d},a)}}.call(this),function(){Luca.DevelopmentToolHelpers=
6
- {refreshCode:function(){var a;return a=this,_(this.eventHandlerProperties()).each(function(b){return a[b]=a.definitionClass()[b]}),this.autoBindEventHandlers===!0&&this.bindAllEventHandlers(),this.delegateEvents()},eventHandlerProperties:function(){var a;return a=_(this.events).values(),_(a).select(function(a){return _.isString(a)})},eventHandlerFunctions:function(){var a,b=this;return a=_(this.events).values(),_(a).map(function(a){return _.isFunction(a)?a:b[a]})}}}.call(this),function(){var a;a=function(){function a(a,b,c){var d,e=this;this.object=a,c==null&&(c=!0),_.isFunction(b)?d=b:_.isString(b)&&_.isFunction(this.object[b])&&(d=this.object[b]);if(!_.isFunction(d))throw"Must pass a function or a string representing one";c===!0?this.fn=function(){return _.defer(d)}:this.fn=d,this}return a.prototype.until=function(a,b){return a!=null&&b==null&&(b=a,a=this.object),a.once(b,this.fn),this.object},a}(),Luca.Events={defer:function(b,c){return c==null&&(c=!0),new a(this,b,c)},once:function(a,b,c){var d;return c||(c=this),d=function(){return b.apply(c,arguments),this.unbind(a,d)},this.bind(a,d)}}}.call(this),function(){var DefineProxy;Luca.define=function(a){return new DefineProxy(a)},Luca.component=Luca.define,DefineProxy=function(){function DefineProxy(a){var b;this.namespace=Luca.util.namespace(),this.componentId=this.componentName=a,a.match(/\./)&&(this.namespaced=!0,b=a.split("."),this.componentId=b.pop(),this.namespace=b.join("."),Luca.registry.addNamespace(b.join(".")))}return DefineProxy.prototype["in"]=function(a){return this.namespace=a,this},DefineProxy.prototype.from=function(a){return this.superClassName=a,this},DefineProxy.prototype["extends"]=function(a){return this.superClassName=a,this},DefineProxy.prototype.extend=function(a){return this.superClassName=a,this},DefineProxy.prototype.enhance=function(a){return a!=null?this["with"](a):this},DefineProxy.prototype["with"]=function(properties){var at,componentType,_base;return at=this.namespaced?Luca.util.resolve(this.namespace,window||global):window||global,this.namespaced&&at==null&&(eval("(window||global)."+this.namespace+" = {}"),at=Luca.util.resolve(this.namespace,window||global)),at[this.componentId]=Luca.extend(this.superClassName,this.componentName,properties),Luca.autoRegister===!0&&(Luca.isViewPrototype(at[this.componentId])&&(componentType="view"),Luca.isCollectionPrototype(at[this.componentId])&&((_base=Luca.Collection).namespaces||(_base.namespaces=[]),Luca.Collection.namespaces.push(this.namespace),componentType="collection"),Luca.isModelPrototype(at[this.componentId])&&(componentType="model"),Luca.register(_.string.underscored(this.componentId),this.componentName,componentType)),at[this.componentId]},DefineProxy}(),Luca.extend=function(a,b,c){var d,e,f,g,h,i;c==null&&(c={}),f=Luca.util.resolve(a,window||global);if(!_.isFunction(f!=null?f.extend:void 0))throw""+a+" is not a valid component to extend from";c.displayName=b,c._superClass=function(){return f.displayName||(f.displayName=a),f},c._super=function(a,b,c){var d;return(d=this._superClass().prototype[a])!=null?d.apply(b,c):void 0},d=f.extend(c);if(_.isArray(c!=null?c.include:void 0)){i=c.include;for(g=0,h=i.length;g<h;g++)e=i[g],_.isString(e)&&(e=Luca.util.resolve(e)),_.extend(d.prototype,e)}return d},_.mixin({def:Luca.define})}.call(this),function(){Luca.modules.Deferrable={configure_collection:function(a){var b,c,d;a==null&&(a=!0);if(!this.collection)return;_.isString(this.collection)&&(b=(c=Luca.CollectionManager)!=null?c.get():void 0)&&(this.collection=b.getOrCreate(this.collection)),this.collection&&_.isFunction(this.collection.fetch)&&_.isFunction(this.collection.reset)||(this.collection=new Luca.Collection(this.collection.initial_set,this.collection));if((d=this.collection)!=null?d.deferrable_trigger:void 0)this.deferrable_trigger=this.collection.deferrable_trigger;if(a)return this.deferrable=this.collection}}}.call(this),function(){Luca.modules.GridLayout={_included:function(a,b){}}}.call(this),function(){Luca.modules.LoadMaskable={_included:function(a,b){var c=this;_.bindAll(a,"applyLoadMask","disableLoadMask");if(this.loadMask===!0)return this.defer(function(){c.$el.addClass("with-mask");if(c.$(".load-mask").length===0)return c.loadMaskTarget().prepend(Luca.template(c.loadMaskTemplate,c)),c.$(".load-mask").hide()}).until("after:render"),this.on(this.loadmaskEnableEvent||"enable:loadmask",this.applyLoadMask),this.on(this.loadmaskDisableEvent||"disable:loadmask",this.applyLoadMask)},loadMaskTarget:function(){return this.loadMaskEl!=null?this.$(this.loadMaskEl):this.$bodyEl()},disableLoadMask:function(){return this.$(".load-mask .bar").css("width","100%"),this.$(".load-mask").hide(),clearInterval(this.loadMaskInterval)},enableLoadMask:function(){var a,b=this;this.$(".load-mask").show().find(".bar").css("width","0%"),a=this.$(".load-mask .progress").width(),a<20&&(a=this.$el.width())<20&&(a=this.$el.parent().width()),this.loadMaskInterval=setInterval(function(){var a,c;return a=b.$(".load-mask .bar").width(),c=a+12,b.$(".load-mask .bar").css("width",c)},200);if(this.loadMaskTimeout==null)return;return _.delay(function(){return b.disableLoadMask()},this.loadMaskTimeout)},applyLoadMask:function(){return this.$(".load-mask").is(":visible")?this.disableLoadMask():this.enableLoadMask()}}}.call(this),function(){Luca.LocalStore=function(){function a(a){var b;this.name=a,b=localStorage.getItem(this.name),this.data=b&&JSON.parse(b)||{}}return a.prototype.guid=function(){var a;return a=function(){return((1+Math.random())*65536|0).toString(16).substring(1)},a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()},a.prototype.save=function(){return localStorage.setItem(this.name,JSON.stringify(this.data))},a.prototype.create=function(a){return a.id||(a.id=a.attribtues.id=this.guid()),this.data[a.id]=a,this.save(),a},a.prototype.update=function(a){return this.data[a.id]=a,this.save(),a},a.prototype.find=function(a){return this.data[a.id]},a.prototype.findAll=function(){return _.values(this.data)},a.prototype.destroy=function(a){return delete this.data[a.id],this.save(),a},a}(),Backbone.LocalSync=function(a,b,c){var d,e;return e=b.localStorage||b.collection.localStorage,d=function(){switch(a){case"read":return b.id?e.find(b):e.findAll();case"create":return e.create(b);case"update":return e.update(b);case"delete":return e.destroy(b)}}(),d?c.success(d):c.error("Record not found")}}.call(this),function(){var a,b;b={classes:{},model_classes:{},collection_classes:{},namespaces:["Luca.containers","Luca.components"]},a={cid_index:{},name_index:{}},Luca.defaultComponentType="view",Luca.registry.aliases={grid:"grid_view",form:"form_view",text:"text_field",button:"button_field",select:"select_field",card:"card_view",paged:"card_view",wizard:"card_view",collection:"collection_view"},Luca.register=function(a,c,d){d==null&&(d="view"),Luca.trigger("component:registered",a,c);switch(d){case"model":return b.model_classes[a]=c;case"collection":return b.collection_classes[a]=c;default:return b.classes[a]=c}},Luca.development_mode_register=function(a,c){var d,e,f;return d=b.classes[a],Luca.enableDevelopmentTools===!0&&d!=null&&(f=Luca.util.resolve(d,window),e=Luca.registry.findInstancesByClassName(c),_(e).each(function(a){var b;return a!=null?(b=a.refreshCode)!=null?b.call(a,f):void 0:void 0})),Luca.register(a,c)},Luca.registry.addNamespace=function(a){return b.namespaces.push(a),b.namespaces=_(b.namespaces).uniq()},Luca.registry.namespaces=function(a){return a==null&&(a=!0),_(b.namespaces).map(function(b){return a?Luca.util.resolve(b):b})},Luca.registry.lookup=function(a){var c,d,e,f,g,h;if(c=Luca.registry.aliases[a])a=c;return d=b.classes[a],d!=null?d:(e=Luca.util.classify(a),g=Luca.registry.namespaces(),f=(h=_(g).chain().map(function(a){return a[e]}).compact().value())!=null?h[0]:void 0)},Luca.registry.instances=function(){return _(a.cid_index).values()},Luca.registry.findInstancesByClassName=function(a){var b;return b=Luca.registry.instances(),_(b).select(function(b){var c;return b.displayName===a||(typeof b._superClass=="function"?(c=b._superClass())!=null?c.displayName:void 0:void 0)===a})},Luca.registry.classes=function(a){return a==null&&(a=!1),_(_.extend({},b.classes,b.model_classes,b.collection_classes)).map(function(b,c){return a?b:{className:b,ctype:c}})},Luca.cache=function(b,c){var d;return c!=null&&(a.cid_index[b]=c),c=a.cid_index[b],(c!=null?c.component_name:void 0)!=null?a.name_index[c.component_name]=c.cid:(c!=null?c.name:void 0)!=null&&(a.name_index[c.name]=c.cid),c!=null?c:(d=a.name_index[b],a.cid_index[d])}}.call(this),function(){var a=Array.prototype.slice;Luca.Observer=function(){function b(a){var b=this;this.options=a!=null?a:{},_.extend(this,Backbone.Events),this.type=this.options.type,this.options.debugAll&&this.bind("all",function(a,b,c){return console.log("ALL",a,b,c)})}return b.prototype.relay=function(){var b,c;return c=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],console.log("Relaying",trigger,b),this.trigger("event",c,b),this.trigger("event:"+b[0],c,b.slice(1))},b}(),Luca.Observer.enableObservers=function(a){return a==null&&(a={}),Luca.enableGlobalObserver=!0,Luca.ViewObserver=new Luca.Observer(_.extend(a,{type:"view"})),Luca.CollectionObserver=new Luca.Observer(_.extend(a,{type:"collection"}))}}.call(this),function(){var a,b,c,d,e,f;_.def("Luca.View")["extends"]("Backbone.View")["with"]({include:["Luca.Events"],additionalClassNames:[],hooks:["before:initialize","after:initialize","before:render","after:render","first:activation","activation","deactivation"],initialize:function(b){var c,g,h,i,j,k,l,m,n,o,p=this;this.options=b!=null?b:{},this.trigger("before:initialize",this,this.options),_.extend(this,this.options),(this.autoBindEventHandlers===!0||this.bindAllEvents===!0)&&a.call(this),f.call(this),this.name!=null&&(this.cid=_.uniqueId(this.name)),Luca.cache(this.cid,this),this.setupHooks(_(Luca.View.prototype.hooks.concat(this.hooks)).uniq()),this.additionalClassNames&&_.isString(this.additionalClassNames)&&(this.additionalClassNames=this.additionalClassNames.split(" ")),this.gridSpan&&this.additionalClassNames.push("span"+this.gridSpan),this.gridOffset&&this.additionalClassNames.push("offset"+this.gridOffset),this.gridRowFluid&&this.additionalClassNames.push("row-fluid"),this.gridRow&&this.additionalClassNames.push("row");if(((l=this.additionalClassNames)!=null?l.length:void 0)>0){m=this.additionalClassNames;for(h=0,j=m.length;h<j;h++)c=m[h],this.$el.addClass(c)}this.wrapperClass!=null&&this.$wrap(this.wrapperClass),e.call(this),d.call(this),this.delegateEvents(),this.stateful===!0&&this.state==null&&(this.state=new Backbone.Model(this.defaultState||{}),this.set==null&&(this.set=function(){return p.state.set.apply(p.state,argumuments)}),this.get==null&&(this.get=function(){return p.state.get.apply(p.state,argumuments)}));if(((n=this.mixins)!=null?n.length:void 0)>0){o=this.mixins;for(i=0,k=o.length;i<k;i++)g=o[i],Luca.modules[g]._included.call(this,this,g)}return this.trigger("after:initialize",this)},$wrap:function(a){return _.isString(a)&&!a.match(/[<>]/)&&(a=this.make("div",{"class":a})),this.$el.wrap(a)},$template:function(a,b){return b==null&&(b={}),this.$el.html(Luca.template(a,b))},$html:function(a){return this.$el.html(a)},$append:function(a){return this.$el.append(a)},$attach:function(){return this.$container().append(this.el)},$bodyEl:function(){return this.$el},$container:function(){return $(this.container)},setupHooks:function(a){var b=this;return a||(a=this.hooks),_(a).each(function(a){var c,d;d=Luca.util.hook(a),c=function(){var a;return(a=b[d])!=null?a.apply(b,arguments):void 0};if(a!=null?a.match(/once:/):void 0)c=_.once(c);return b.bind(a,c)})},registerEvent:function(a,b){return this.events||(this.events={}),this.events[a]=b,this.delegateEvents()},definitionClass:function(){var a;return(a=Luca.util.resolve(this.displayName,window))!=null?a.prototype:void 0},collections:function(){return Luca.util.selectProperties(Luca.isBackboneCollection,this)},models:function(){return Luca.util.selectProperties(Luca.isBackboneModel,this)},views:function(){return Luca.util.selectProperties(Luca.isBackboneView,this)},debug:function(){var a,b,c,d;if(!this.debugMode&&window.LucaDebugMode==null)return;d=[];for(b=0,c=arguments.length;b<c;b++)a=arguments[b],d.push(console.log([this.name||this.cid,a]));return d},trigger:function(){return Luca.enableGlobalObserver&&(Luca.developmentMode===!0||this.observeEvents===!0)&&(Luca.ViewObserver||(Luca.ViewObserver=new Luca.Observer({type:"view"})),Luca.ViewObserver.relay(this,arguments)),Backbone.View.prototype.trigger.apply(this,arguments)}}),c=Backbone.View.extend,b=function(a){var b;return b=a.render,b||(b=Luca.View.prototype.$attach),a.render=function(){var a,c,d,e,f,g,h=this;return g=this,this.deferrable?(e=this.deferrable_target,Luca.isBackboneCollection(this.deferrable)||(this.deferrable=this.collection),e||(e=this.deferrable),f=this.deferrable_event?this.deferrable_event:"reset",c=function(){return b.call(g),g.trigger("after:render",g)},g.defer(c).until(e,f),g.trigger("before:render",this),a=this.deferrable_trigger||this.deferUntil,a==null?e[this.deferrable_method||"fetch"].call(e):(d=_.once(function(){var a,b;return typeof (a=h.deferrable)[b=h.deferrable_method||"fetch"]=="function"?a[b]():void 0}),(this.deferrable_target||this).bind(this.deferrable_trigger,d)),this):(this.trigger("before:render",this),b.apply(this,arguments),this.trigger("after:render",this),this)},a},a=function(){var a=this;return _(this.events).each(function(b,c){if(_.isString(b))return _.bindAll(a,b)})},d=function(){var a,b,c,d,e,f,g;if(_.isEmpty(this.applicationEvents))return;a=this.app;if(_.isString(a)||_.isUndefined(a))a=(e=Luca.Application)!=null?typeof e.get=="function"?e.get(a):void 0:void 0;if(!Luca.supportsEvents(a))throw"Error binding to the application object on "+(this.name||this.cid);f=this.applicationEvents,g=[];for(c=0,d=f.length;c<d;c++){b=f[c],_.isString(c)&&(c=this[c]);if(!_.isFunction(c))throw"Error registering application event "+b+" on "+(this.name||this.cid);g.push(a.on(b,c))}return g},e=function(){var a,b,c,d,e,f,g,h,i;if(_.isEmpty(this.collectionEvents))return;e=this.collectionManager;if(_.isString(e)||_.isUndefined(e))e=Luca.CollectionManager.get(e);g=this.collectionEvents,i=[];for(f in g){c=g[f],console.log("Sig",f,"Handler",c),h=f.split(" "),d=h[0],b=h[1],a=e.getOrCreate(d);if(!a)throw"Could not find collection specified by "+d;_.isString(c)&&(c=this[c]);if(!_.isFunction(c))throw"invalid collectionEvents configuration";try{i.push(a.bind(b,c))}catch(j){throw console.log("Error Binding To Collection in registerCollectionEvents",this),j}}return i},f=function(){var a,b;b=this.bodyTemplateVars?this.bodyTemplateVars.call(this):this;if(a=this.bodyTemplate)return this.$el.empty(),Luca.View.prototype.$html.call(this,Luca.template(a,b))},Luca.View.extend=function(a){var d,e,f,g;a=b(a);if(a.mixins!=null&&_.isArray(a.mixins)){g=a.mixins;for(e=0,f=g.length;e<f;e++)d=g[e],_.extend(a,Luca.modules[d])}return c.call(this,a)}}.call(this),function(){var a;a=function(){var a,b,c,d,e=this;if(_.isUndefined(this.computed))return;this._computed={},c=this.computed,d=[];for(a in c)b=c[a],this.on("change:"+a,function(){return e._computed[a]=e[a].call(e)}),_.isString(b)&&(b=b.split(",")),d.push(_(b).each(function(b){e.on("change:"+b,function(){return e.trigger("change:"+a)});if(e.has(b))return e.trigger("change:"+a)}));return d},_.def("Luca.Model")["extends"]("Backbone.Model")["with"]({include:["Luca.Events"],initialize:function(){return Backbone.Model.prototype.initialize(this,arguments),a.call(this)},get:function(a){var b;return((b=this.computed)!=null?b.hasOwnProperty(a):void 0)?this._computed[a]:Backbone.Model.prototype.get.call(this,a)}})}.call(this),function(){var a;a="Backbone.Collection",Backbone.QueryCollection!=null&&(a="Backbone.QueryCollection"),_.def("Luca.Collection")["extends"](a)["with"]({include:["Luca.Events"],cachedMethods:[],remoteFilter:!1,initialize:function(a,b){var c,d=this;a==null&&(a=[]),this.options=b,_.extend(this,this.options),this.setupMethodCaching(),this._reset(),this.cached&&console.log("The @cached property of Luca.Collection is being deprecated. Please change to cache_key");if(this.cache_key||(this.cache_key=this.cached))this.bootstrap_cache_key=_.isFunction(this.cache_key)?this.cache_key():this.cache_key;(this.registerAs||this.registerWith)&&console.log("This configuration API is deprecated. use @name and @manager properties instead"),this.name||(this.name=this.registerAs),this.manager||(this.manager=this.registerWith),this.manager=_.isFunction(this.manager)?this.manager():this.manager,this.name&&!this.manager&&(this.manager=Luca.CollectionManager.get()),this.manager&&(this.name||(this.name=this.cache_key()),this.name=_.isFunction(this.name)?this.name():this.name,!this.private&&!this.anonymous&&this.bind("after:initialize",function(){return d.register(d.manager,d.name,d)}));if(this.useLocalStorage===!0&&window.localStorage!=null)throw c=this.bootstrap_cache_key||this.name,"Must specify either a cached or registerAs property to use localStorage";return _.isArray(this.data)&&this.data.length>0&&(this.memoryCollection=!0),this.useNormalUrl!==!0&&this.__wrapUrl(),Backbone.Collection.prototype.initialize.apply(this,[a,this.options]),a&&this.reset(a,{silent:!0,parse:b!=null?b.parse:void 0}),this.trigger("after:initialize")},__wrapUrl:function(){var a,b,c=this;return _.isFunction(this.url)?this.url=_.wrap(this.url,function(a){var b,d,e,f,g;return g=a.apply(c),e=g.split("?"),e.length>1&&(b=_.last(e)),f=c.queryString(),b&&g.match(b)&&(f=f.replace(b,"")),d=""+g+"?"+f,d.match(/\?$/)&&(d=d.replace(/\?$/,"")),d}):(b=this.url,a=this.queryString(),this.url=_([b,a]).compact().join("?"))},queryString:function(){var a,b=this;return a=_(this.base_params||(this.base_params=Luca.Collection.baseParams())).inject(function(a,b,c){var d;return d=""+c+"="+b,a.push(d),a},[]),_.uniq(a).join("&")},resetFilter:function(){return this.base_params=_(Luca.Collection.baseParams()).clone(),this},applyFilter:function(a,b){return a==null&&(a={}),b==null&&(b={}),b.remote!=null==1||this.remoteFilter===!0?(this.applyParams(a),this.fetch(_.extend(b,{refresh:!0}))):this.reset(this.query(a))},applyParams:function(a){return this.base_params=_(Luca.Collection.baseParams()).clone(),_.extend(this.base_params,a),this},register:function(a,b,c){a==null&&(a=Luca.CollectionManager.get()),b==null&&(b="");if(!(b.length>=1))throw"Can not register with a collection manager without a key";if(a==null)throw"Can not register with a collection manager without a valid collection manager";_.isString(a)&&(a=Luca.util.nestedValue(a,window||global));if(!a)throw"Could not register with collection manager";if(_.isFunction(a.add))return a.add(b,c);if(_.isObject(a))return a[b]=c},loadFromBootstrap:function(){if(!this.bootstrap_cache_key)return;return this.reset(this.cached_models()),this.trigger("bootstrapped",this)},bootstrap:function(){return this.loadFromBootstrap()},cached_models:function(){return Luca.Collection.cache(this.bootstrap_cache_key)},fetch:function(a){var b;a==null&&(a={}),this.trigger("before:fetch",this);if(this.memoryCollection===!0)return this.reset(this.data);if(this.cached_models().length&&!a.refresh)return this.bootstrap();b=_.isFunction(this.url)?this.url():this.url;if(!(b&&b.length>1||this.localStorage))return!0;this.fetching=!0;try{return Backbone.Collection.prototype.fetch.apply(this,arguments)}catch(c){throw console.log("Error in Collection.fetch",c),c}},onceLoaded:function(a,b){var c,d=this;b==null&&(b={autoFetch:!0});if(this.length>0&&!this.fetching){a.apply(this,[this]);return}c=function(){return a.apply(d,[d])},this.bind("reset",function(){return c(),this.unbind("reset",this)});if(!this.fetching&&!!b.autoFetch)return this.fetch()},ifLoaded:function(a,b){var c,d=this;b==null&&(b={scope:this,autoFetch:!0}),c=b.scope||this,this.length>0&&!this.fetching&&a.apply(c,[this]),this.bind("reset",function(b){return a.call(c,b)});if(!(this.fetching===!0||!b.autoFetch||this.length>0))return this.fetch()},parse:function(a){var b;return this.fetching=!1,this.trigger("after:response",a),b=this.root!=null?a[this.root]:a,this.bootstrap_cache_key&&Luca.Collection.cache(this.bootstrap_cache_key,b),b},restoreMethodCache:function(){var a,b,c,d;c=this._methodCache,d=[];for(b in c)a=c[b],a.original!=null?(a.args=void 0,d.push(this[b]=a.original)):d.push(void 0);return d},clearMethodCache:function(a){return this._methodCache[a].value=void 0},clearAllMethodsCache:function(){var a,b,c,d;c=this._methodCache,d=[];for(b in c)a=c[b],d.push(this.clearMethodCache(b));return d},setupMethodCaching:function(){var a,b,c;return b=this,c=["reset","add","remove"],a=this._methodCache={},_(this.cachedMethods).each(function(d){var e,f,g,h,i,j,k,l,m;a[d]={name:d,original:b[d],value:void 0},b[d]=function(){var c;return(c=a[d]).value||(c.value=a[d].original.apply(b,arguments))};for(h=0,j=c.length;h<j;h++)g=c[h],b.bind(g,function(){return b.clearAllMethodsCache()});e=d.split(":")[1];if(e){l=e.split(","),m=[];for(i=0,k=l.length;i<k;i++)f=l[i],m.push(b.bind("change:"+f,function(){return b.clearMethodCache({method:d})}));return m}})},query:function(a,b){return a==null&&(a={}),b==null&&(b={}),Backbone.QueryCollection!=null?Backbone.QueryCollection.prototype.query.apply(this,arguments):this.models}}),_.extend(Luca.Collection.prototype,{trigger:function(){return Luca.enableGlobalObserver&&(Luca.CollectionObserver||(Luca.CollectionObserver=new Luca.Observer({type:"collection"})),Luca.CollectionObserver.relay(this,arguments)),Backbone.View.prototype.trigger.apply(this,arguments)}}),Luca.Collection.baseParams=function(a){if(a)return Luca.Collection._baseParams=a;if(_.isFunction(Luca.Collection._baseParams))return Luca.Collection._baseParams();if(_.isObject(Luca.Collection._baseParams))return Luca.Collection._baseParams},Luca.Collection._bootstrapped_models={},Luca.Collection.bootstrap=function(a){return _.extend(Luca.Collection._bootstrapped_models,a)},Luca.Collection.cache=function(a,b){return b?Luca.Collection._bootstrapped_models[a]=b:Luca.Collection._bootstrapped_models[a]||[]}}.call(this),function(){var a;a=function(a,b){var c,d,e,f,g;return a==null&&(a={}),a.orientation||(a.orientation="top"),a.ctype||(a.ctype=this.toolbarType||"panel_toolbar"),f=""+this.cid+"-tbc-"+a.orientation,g=Luca.util.lazyComponent(a),d=this.make("div",{"class":"toolbar-container "+a.orientation,id:f},g.render().el),e=this.bodyClassName||this.bodyTagName,c=function(){switch(a.orientation){case"top":case"left":return e?"before":"prepend";case"bottom":case"right":return e?"after":"append"}}(),(b||this.$bodyEl())[c](d)},_.def("Luca.components.Panel")["extends"]("Luca.View")["with"]({topToolbar:void 0,bottomToolbar:void 0,loadMask:!1,loadMaskTemplate:["components/load_mask"],loadMaskTimeout:3e3,mixins:["LoadMaskable"],initialize:function(a){return this.options=a!=null?a:{},Luca.View.prototype.initialize.apply(this,arguments)},applyStyles:function(a,b){var c,d,e;a==null&&(a={}),b==null&&(b=!1),d=b?this.$bodyEl():this.$el;for(c in a)e=a[c],d.css(c,e);return this},beforeRender:function(){var a;return(a=Luca.View.prototype.beforeRender)!=null&&a.apply(this,arguments),this.styles!=null&&this.applyStyles(this.styles),this.bodyStyles!=null&&this.applyStyles(this.bodyStyles,!0),typeof this.renderToolbars=="function"?this.renderToolbars():void 0},$bodyEl:function(){var a,b,c,d;return c=this.bodyTagName||"div",b=this.bodyClassName||"view-body",this.bodyEl||(this.bodyEl=""+c+"."+b),a=this.$(this.bodyEl),a.length>0?a:a.length!==0||this.bodyClassName==null&&this.bodyTagName==null?$(this.el):(d=this.make(c,{"class":b,"data-auto-appended":!0}),$(this.el).append(d),this.$(this.bodyEl))},$wrap:function(a){return _.isString(a)&&!a.match(/[<>]/)&&(a=this.make("div",{"class":a})),this.$el.wrap(a)},$template:function(a,b){return b==null&&(b={}),this.$html(Luca.template(a,b))},$empty:function(){return this.$bodyEl().empty()},$html:function(a){return this.$bodyEl().html(a)},$append:function(a){return this.$bodyEl().append(a)},renderToolbars:function(){var a=this;return _(["top","left","right","bottom"]).each(function(b){var c;if(c=a[""+b+"Toolbar"])return a.renderToolbar(b,c)})},renderToolbar:function(b,c){return b==null&&(b="top"),c==null&&(c={}),c.parent=this,c.orientation=b,a.call(this,c,c.targetEl)}})}.call(this),function(){_.def("Luca.core.Field")["extends"]("Luca.View")["with"]({className:"luca-ui-text-field luca-ui-field",isField:!0,template:"fields/text_field",labelAlign:"top",hooks:["before:validation","after:validation","on:change"],statuses:["warning","error","success"],initialize:function(a){var b;return this.options=a!=null?a:{},_.extend(this,this.options),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_class||(this.input_class=""),this.helperText||(this.helperText=""),this.required&&((b=this.label)!=null?!b.match(/^\*/):!void 0)&&(this.label||(this.label="*"+this.label)),this.inputStyles||(this.inputStyles=""),this.disabled&&this.disable(),this.updateState(this.state),this.placeHolder||(this.placeHolder=""),Luca.View.prototype.initialize.apply(this,arguments)},beforeRender:function(){return Luca.enableBootstrap&&this.$el.addClass("control-group"),this.required&&this.$el.addClass("required"),this.$el.html(Luca.template(this.template,this)),this.input=$("input",this.el)},change_handler:function(a){return this.trigger("on:change",this,a)},disable:function(){return $("input",this.el).attr("disabled",!0)},enable:function(){return $("input",this.el).attr("disabled",!1)},getValue:function(){var a;a=this.input.attr("value");if(_.str.isBlank(a))return a;switch(this.valueType){case"integer":return parseInt(a);case"string":return""+a;case"float":return parseFloat(a);default:return a}},render:function(){return $(this.container).append(this.$el)},setValue:function(a){return this.input.attr("value",a)},updateState:function(a){var b=this;return _(this.statuses).each(function(c){return b.$el.removeClass(c),b.$el.addClass(a)})}})}.call(this),function(){var a,b,c;c=function(){return this.trigger("before:layout",this),this.prepareLayout(),this.trigger("after:layout",this)},a=function(a,b){var c,d;return d=[],a.height!=null&&d.push("height: "+(_.isNumber(a.height)?a.height+"px":a.height)),a.width!=null&&d.push("width: "+(_.isNumber(a.width)?a.width+"px":a.width)),a.float&&d.push("float: "+a.float),c={"class":(a!=null?a.classes:void 0)||this.componentClass,id:""+this.cid+"-"+b,style:d.join(";"),"data-luca-owner":this.name||this.cid},this.customizeContainerEl!=null&&(c=this.customizeContainerEl(c,a,b)),c},b=function(){return this.trigger("before:components",this,this.components),this.prepareComponents(),this.createComponents(),this.trigger("before:render:components",this,this.components),this.renderComponents(),this.trigger("after:components",this,this.components)},_.def("Luca.core.Container")["extends"]("Luca.components.Panel")["with"]({className:"luca-ui-container",componentTag:"div",componentClass:"luca-ui-panel",isContainer:!0,hooks:["before:components","before:render:components","before:layout","after:components","after:layout","first:activation"],rendered:!1,components:[],initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),this.setupHooks(["before:components","before:render:components","before:layout","after:components","after:layout","first:activation"]),Luca.View.prototype.initialize.apply(this,arguments)},beforeRender:function(){var a;return c.call(this),b.call(this),(a=Luca.components.Panel.prototype.beforeRender)!=null?a.apply(this,arguments):void 0},customizeContainerEl:function(a,b,c){return a},prepareLayout:function(){var b;return b=this,this.componentContainers=_(this.components).map(function(c,d){return a.call(b,c,d)})},prepareComponents:function(){var a,b,c,d,e=this;d=this.components;for(b=0,c=d.length;b<c;b++)a=d[b],_.isString(a)&&(a={type:a});return _(this.components).each(function(a,b){var c,d,f,g;c=d=(g=e.componentContainers)!=null?g[b]:void 0,c["class"]=c["class"]||c.className||c.classes,e.generateComponentElements&&(f=e.make(e.componentTag,d,""),e.$append(f));if(a.container==null)return e.generateComponentElements&&(a.container="#"+d.id),a.container||(a.container=e.$bodyEl())})},createComponents:function(){var a,b=this;if(this.componentsCreated===!0)return;return a=this.componentIndex={name_index:{},cid_index:{}},this.components=_(this.components).map(function(c,d){var e;return e=Luca.isBackboneView(c)?c:(c.type||(c.type=c.ctype),c.type==null?c.components!=null?c.type=c.ctype="container":c.type=c.ctype=Luca.defaultComponentType:void 0,Luca.util.lazyComponent(c)),_.isString(e.getter)&&(b[e.getter]=function(){return e}),!e.container&&e.options.container&&(e.container=e.options.container),a&&e.cid!=null&&(a.cid_index[e.cid]=d),a&&e.name!=null&&(a.name_index[e.name]=d),e}),this.componentsCreated=!0,_.isEmpty(this.componentEvents)||this.registerComponentEvents(),a},renderComponents:function(a){var b;return this.debugMode=a!=null?a:"",this.debug("container render components"),b=this,_(this.components).each(function(a){a.getParent=function(){return b};try{return $(a.container).append(a.el),a.render()}catch(c){console.log("Error Rendering Component "+(a.name||a.cid),a),_.isObject(c)&&(console.log(c.message),console.log(c.stack));if(Luca.silenceRenderErrors!=null!=1)throw c}})},firstActivation:function(){var a;return a=this,this.each(function(b,c){var d;if((b!=null?b.previously_activated:void 0)!==!0)return b!=null&&(d=b.trigger)!=null&&d.call(b,"first:activation",b,a),b.previously_activated=!0})},pluck:function(a){return _(this.components).pluck(a)},invoke:function(a){return _(this.components).invoke(a)},map:function(a){return _(this.components).map(a)},componentEvents:{},registerComponentEvents:function(){var a,b,c,d,e,f,g,h;f=this.componentEvents,h=[];for(d in f)c=f[d],g=d.split(" "),b=g[0],e=g[1],a=this.findComponentByName(b),h.push(a!=null?a.bind(e,this[c]):void 0);return h},findComponentByName:function(a,b){return b==null&&(b=!1),this.findComponent(a,"name_index",b)},findComponentById:function(a,b){return b==null&&(b=!1),this.findComponent(a,"cid_index",b)},findComponent:function(a,b,c){var d,e,f,g,h;b==null&&(b="name"),c==null&&(c=!1),this.componentsCreated!==!0&&this.createComponents(),e=(g=this.componentIndex)!=null?g[b][a]:void 0,d=(h=this.components)!=null?h[e]:void 0;if(d)return d;if(c===!0)return f=_(this.components).detect(function(c){return c!=null?typeof c.findComponent=="function"?c.findComponent(a,b,!0):void 0:void 0}),f!=null?typeof f.findComponent=="function"?f.findComponent(a,b,!0):void 0:void 0},each:function(a){return this.eachComponent(a,!1)},eachComponent:function(a,b){var c=this;return b==null&&(b=!0),_(this.components).each(function(c,d){var e;a.call(c,c,d);if(b)return c!=null?(e=c.eachComponent)!=null?e.apply(c,[a,b]):void 0:void 0})},indexOf:function(a){var b;return b=_(this.components).pluck("name"),_(b).indexOf(a)},activeComponent:function(){return this.activeItem?this.components[this.activeItem]:this},componentElements:function(){return this.$(">."+this.componentClass,this.$bodyEl())},getComponent:function(a){return this.components[a]},rootComponent:function(){return console.log("Calling rootComponent will be deprecated. use isRootComponent instead"),this.getParent==null},isRootComponent:function(){return this.getParent==null},getRootComponent:function(){return this.rootComponent()?this:this.getParent().getRootComponent()},selectByAttribute:function(a,b,c){var d;return c==null&&(c=!1),d=_(this.components).map(function(d){var e,f;return e=[],f=d[a],f===b&&e.push(d),c===!0&&e.push(typeof d.selectByAttribute=="function"?d.selectByAttribute(a,b,!0):void 0),_.compact(e)}),_.flatten(d)},select:function(a,b,c){return c==null&&(c=!1),console.log("Container.select will be replaced by selectByAttribute in 1.0"),Luca.core.Container.prototype.selectByAttribute.apply(this,arguments)}}),Luca.core.Container.componentRenderer=function(a,b){var c;return c=$(b.container)[b.attachWith||"append"],c(b.render().el)}}.call(this),function(){var a,b,c;Luca.CollectionManager=function(){function c(a){var c,d,e,f;this.options=a!=null?a:{},_.extend(this,this.options),d=this;if(c=typeof (e=Luca.CollectionManager).get=="function"?e.get(this.name):void 0)throw"Attempt to create a collection manager with a name which already exists";(f=Luca.CollectionManager).instances||(f.instances={}),_.extend(this,Backbone.Events),_.extend(this,Luca.Events),Luca.CollectionManager.instances[this.name]=d,Luca.CollectionManager.get=function(a){return a==null?d:Luca.CollectionManager.instances[a]},this.state=new
7
- Luca.Model,this.initialCollections&&b.call(this)}return c.prototype.name="primary",c.prototype.collectionNamespace=Luca.Collection.namespace,c.prototype.__collections={},c.prototype.relayEvents=!0,c.prototype.add=function(a,b){var c;return(c=this.currentScope())[a]||(c[a]=b)},c.prototype.allCollections=function(){return _(this.currentScope()).values()},c.prototype.create=function(b,c,d){var e,f,g;return c==null&&(c={}),d==null&&(d=[]),e=c.base,e||(e=a.call(this,b)),c.private&&(c.name=""),f=new e(d,c),this.add(b,f),g=this,this.relayEvents===!0&&this.bind("*",function(){return console.log("Relay Events on Collection Manager *",f,arguments)}),f},c.prototype.currentScope=function(){var a,b;return(a=this.getScope())?(b=this.__collections)[a]||(b[a]={}):this.__collections},c.prototype.each=function(a){return _(this.all()).each(a)},c.prototype.get=function(a){return this.currentScope()[a]},c.prototype.getScope=function(){return},c.prototype.destroy=function(a){var b;return b=this.get(a),delete this.currentScope()[a],b},c.prototype.getOrCreate=function(a,b,c){return b==null&&(b={}),c==null&&(c=[]),this.get(a)||this.create(a,b,c,!1)},c.prototype.collectionCountDidChange=function(){if(this.allCollectionsLoaded())return this.trigger("all_collections_loaded"),this.trigger("initial:load")},c.prototype.allCollectionsLoaded=function(){return this.totalCollectionsCount()===this.loadedCollectionsCount()},c.prototype.totalCollectionsCount=function(){return this.state.get("collections_count")},c.prototype.loadedCollectionsCount=function(){return this.state.get("loaded_collections_count")},c.prototype.private=function(a,b,c){return b==null&&(b={}),c==null&&(c=[]),this.create(a,b,c,!0)},c}(),Luca.CollectionManager.destroyAll=function(){return Luca.CollectionManager.instances={}},a=function(a){var b,c,d,e;return b=Luca.util.classify(a),c=(this.collectionNamespace||window||global)[b],c||(c=(this.collectionNamespace||window||global)[""+b+"Collection"]),c==null&&((e=Luca.Collection.namespaces)!=null?e.length:void 0)>0&&(d=_(Luca.Collection.namespaces.reverse()).map(function(a){return Luca.util.resolve(""+a+"."+b)||Luca.util.resolve(""+a+"."+b+"Collection")}),d=_(d).compact(),d.length>0&&(c=d[0])),c},c=function(){var a,b=this;return a=function(a){var c;return c=b.state.get("loaded_collections_count"),b.state.set("loaded_collections_count",c+1),b.trigger("collection_loaded",a.name),a.unbind("reset")},_(this.initialCollections).each(function(c){var d;return d=b.getOrCreate(c),d.once("reset",function(){return a(d)}),d.fetch()})},b=function(){var a=this;return this.state.set({loaded_collections_count:0,collections_count:this.initialCollections.length}),this.state.bind("change:loaded_collections_count",function(){return a.collectionCountDidChange()}),this.useProgressLoader&&(this.loaderView||(this.loaderView=new Luca.components.CollectionLoaderView({manager:this,name:"collection_loader_view"}))),c.call(this),this}}.call(this),function(){Luca.SocketManager=function(){function a(a){this.options=a!=null?a:{},_.extend(Backbone.Events),this.loadTransport()}return a.prototype.connect=function(){switch(this.options.provider){case"socket.io":return this.socket=io.connect(this.options.socket_host);case"faye.js":return this.socket=new Faye.Client(this.options.socket_host)}},a.prototype.transportLoaded=function(){return this.connect()},a.prototype.transport_script=function(){switch(this.options.provider){case"socket.io":return""+this.options.transport_host+"/socket.io/socket.io.js";case"faye.js":return""+this.options.transport_host+"/faye.js"}},a.prototype.loadTransport=function(){var a,b=this;return a=document.createElement("script"),a.setAttribute("type","text/javascript"),a.setAttribute("src",this.transport_script()),a.onload=this.transportLoaded,Luca.util.isIE()&&(a.onreadystatechange=function(){if(a.readyState==="loaded")return b.transportLoaded()}),document.getElementsByTagName("head")[0].appendChild(a)},a}()}.call(this),function(){_.def("Luca.containers.SplitView")["extends"]("Luca.core.Container")["with"]({componentType:"split_view",containerTemplate:"containers/basic",className:"luca-ui-split-view",componentClass:"luca-ui-panel"})}.call(this),function(){_.def("Luca.containers.ColumnView")["extends"]("Luca.core.Container")["with"]({componentType:"column_view",className:"luca-ui-column-view",components:[],initialize:function(a){return this.options=a!=null?a:{},console.log("Column Views are deprecated in favor of just using grid css on a normal container"),Luca.core.Container.prototype.initialize.apply(this,arguments),this.setColumnWidths()},componentClass:"luca-ui-column",containerTemplate:"containers/basic",generateComponentElements:!0,autoColumnWidths:function(){var a,b=this;return a=[],_(this.components.length).times(function(){return a.push(parseInt(100/b.components.length))}),a},setColumnWidths:function(){return this.columnWidths=this.layout!=null?_(this.layout.split("/")).map(function(a){return parseInt(a)}):this.autoColumnWidths(),this.columnWidths=_(this.columnWidths).map(function(a){return""+a+"%"})},beforeLayout:function(){var a,b=this;return this.debug("column_view before layout"),_(this.columnWidths).each(function(a,c){return b.components[c].float="left",b.components[c].width=a}),(a=Luca.core.Container.prototype.beforeLayout)!=null?a.apply(this,arguments):void 0}})}.call(this),function(){_.def("Luca.containers.CardView")["extends"]("Luca.core.Container")["with"]({componentType:"card_view",className:"luca-ui-card-view-wrapper",activeCard:0,components:[],hooks:["before:card:switch","after:card:switch"],componentClass:"luca-ui-card",generateComponentElements:!0,initialize:function(a){return this.options=a,Luca.core.Container.prototype.initialize.apply(this,arguments),this.setupHooks(this.hooks)},prepareComponents:function(){var a,b=this;return(a=Luca.core.Container.prototype.prepareComponents)!=null&&a.apply(this,arguments),_(this.components).each(function(a,c){return c===b.activeCard?$(a.container).show():$(a.container).hide()})},activeComponentElement:function(){return this.componentElements().eq(this.activeCard)},activeComponent:function(){return this.getComponent(this.activeCard)},customizeContainerEl:function(a,b,c){return a.style+=c===this.activeCard?"display:block;":"display:none;",a},cycle:function(){var a;return a=this.activeCard<this.components.length-1?this.activeCard+1:0,this.activate(a)},find:function(a){return this.findComponentByName(a,!0)},firstActivation:function(){return this.activeComponent().trigger("first:activation",this,this.activeComponent())},activate:function(a,b,c){var d,e,f,g,h,i,j=this;b==null&&(b=!1),_.isFunction(b)&&(b=!1,c=b);if(a===this.activeCard)return;e=this.activeComponent(),d=this.getComponent(a),d||(a=this.indexOf(a),d=this.getComponent(a));if(!d)return;b||(this.trigger("before:card:switch",e,d),e!=null&&(f=e.trigger)!=null&&f.apply(e,["before:deactivation",this,e,d]),d!=null&&(g=d.trigger)!=null&&g.apply(e,["before:activation",this,e,d]),_.defer(function(){return j.$el.data(j.activeAttribute||"active-card",d.name)})),this.componentElements().hide(),d.previously_activated||(d.trigger("first:activation"),d.previously_activated=!0),this.activeCard=a,this.activeComponentElement().show(),b||(this.trigger("after:card:switch",e,d),(h=e.trigger)!=null&&h.apply(e,["deactivation",this,e,d]),(i=d.trigger)!=null&&i.apply(d,["activation",this,e,d]));if(_.isFunction(c))return c.apply(this,[this,e,d])}})}.call(this),function(){_.def("Luca.ModalView")["extends"]("Luca.core.Container")["with"]({closeOnEscape:!0,showOnInitialize:!1,backdrop:!1,className:"luca-ui-container modal",container:function(){return $("body")},toggle:function(){return this.$el.modal("toggle")},show:function(){return this.$el.modal("show")},hide:function(){return this.$el.modal("hide")},render:function(){return this.$el.addClass("modal"),this.fade===!0&&this.$el.addClass("fade"),$("body").append(this.$el),this.$el.modal({backdrop:this.backdrop===!0,keyboard:this.closeOnEscape===!0,show:this.showOnInitialize===!0}),this}}),_.def("Luca.containers.ModalView")["extends"]("Luca.ModalView")["with"]()}.call(this),function(){_.def("Luca.PageView")["extends"]("Luca.containers.CardView")["with"]({version:2})}.call(this),function(){var a,b,c;b=Backbone.View.prototype.make,a=function(a,d){var e,f,g,h,i,j,k,l,m,n,o=this;d==null&&(d=!0);if(a.ctype!=null){a.className||(a.className=""),a.className+="toolbar-component",l=Luca(a).render();if(Luca.isBackboneView(l))return console.log("Adding toolbar component",l),l.el}return a.spacer?b("div",{"class":"spacer "+a.spacer}):a.text?b("div",{"class":"toolbar-text"},a.text):(n="btn-group",a.wrapper!=null&&(n+=" "+a.wrapper),a.align!=null&&(n+=" align-"+a.align),a.group!=null&&a.buttons!=null?(h=c(a.buttons,!1),b("div",{"class":n},h)):(k=a.label||(a.label=""),a.eventId||(a.eventId=_.string.dasherize(a.label.toLowerCase())),a.icon&&(_.string.isBlank(k)&&(k=" "),a.white&&(m="icon-white"),k="<i class='"+(m||"")+" icon-"+a.icon+"' /> "+k),f={"class":_.compact(["btn",a.classes,a.className]).join(" "),"data-eventId":a.eventId,title:a.title||a.description},a.color!=null&&(f["class"]+=" btn-"+a.color),a.dropdown&&(k=""+k+" <span class='caret'></span>",f["class"]+=" dropdown-toggle",f["data-toggle"]="dropdown",j=_(a.dropdown).map(function(a){var c;return c=b("a",{},a[1]),b("li",{"data-eventId":a[0]},c)}),i=b("ul",{"class":"dropdown-menu"},j)),g=b("a",f,k),e="btn-group",a.align!=null&&(e+=" align-"+a.align),d===!0?b("div",{"class":e},[g,i]):g))},c=function(b,c){return c==null&&(c=!0),_(b).map(function(b){return a(b,c)})},_.def("Luca.containers.PanelToolbar")["extends"]("Luca.View")["with"]({className:"luca-ui-toolbar btn-toolbar",buttons:[],well:!0,orientation:"top",autoBindEventHandlers:!0,events:{"click a.btn, click .dropdown-menu li":"clickHandler"},clickHandler:function(a){var b,c,d,e,f;d=e=$(a.target),d.is("i")&&(d=e=$(a.target).parent()),b=e.data("eventid");if(b==null)return;return c=Luca.util.hook(b),f=this.parent||this,_.isFunction(f[c])?f[c].call(this,d,a):f.trigger(b,d,a)},beforeRender:function(){this._super("beforeRender",this,arguments),this.well===!0&&this.$el.addClass("well"),this.$el.addClass("toolbar-"+this.orientation);if(this.styles!=null)return this.applyStyles(this.styles)},render:function(){var a,b=this;return this.$el.empty(),a=c(this.buttons),_(a).each(function(a){return b.$el.append(a)})}})}.call(this),function(){_.def("Luca.containers.PanelView")["extends"]("Luca.core.Container")["with"]({className:"luca-ui-panel",initialize:function(a){return this.options=a!=null?a:{},Luca.core.Container.prototype.initialize.apply(this,arguments)},afterLayout:function(){var a;if(this.template)return a=(Luca.templates||JST)[this.template](this),this.$el.html(a)},render:function(){return $(this.container).append(this.$el)},afterRender:function(){var a,b=this;(a=Luca.core.Container.prototype.afterRender)!=null&&a.apply(this,arguments);if(this.css)return _(this.css).each(function(a,c){return b.$el.css(c,a)})}})}.call(this),function(){_.def("Luca.containers.TabView")["extends"]("Luca.containers.CardView")["with"]({hooks:["before:select","after:select"],componentType:"tab_view",className:"luca-ui-tab-view tabbable",tab_position:"top",tabVerticalOffset:"50px",navClass:"nav-tabs",bodyTemplate:"containers/tab_view",bodyEl:"div.tab-content",initialize:function(a){return this.options=a!=null?a:{},this.navStyle==="list"&&(this.navClass="nav-list"),Luca.containers.CardView.prototype.initialize.apply(this,arguments),_.bindAll(this,"select","highlightSelectedTab"),this.setupHooks(this.hooks),this.bind("after:card:switch",this.highlightSelectedTab)},activeTabSelector:function(){return this.tabSelectors().eq(this.activeCard||this.activeTab||this.activeItem)},beforeLayout:function(){var a;return this.$el.addClass("tabs-"+this.tab_position),this.activeTabSelector().addClass("active"),this.createTabSelectors(),(a=Luca.containers.CardView.prototype.beforeLayout)!=null?a.apply(this,arguments):void 0},afterRender:function(){var a;(a=Luca.containers.CardView.prototype.afterRender)!=null&&a.apply(this,arguments),this.registerEvent("click #"+this.cid+"-tabs-selector li a","select");if(Luca.enableBootstrap&&(this.tab_position==="left"||this.tab_position==="right"))return this.tabContainerWrapper().addClass("span2"),this.tabContentWrapper().addClass("span9")},createTabSelectors:function(){var a;return a=this,this.each(function(b,c){var d,e,f,g;b.tabIcon&&(d="<i class='icon-"+b.tabIcon),e="<a href='#'>"+(d||"")+" "+b.title+"</a>",f=a.make("li",{"class":"tab-selector","data-target":c},e),a.tabContainer().append(f);if(b.navHeading!=null&&((g=a.navHeadings)!=null?!g[b.navHeading]:!void 0))return $(f).before(a.make("li",{"class":"nav-header"},b.navHeading)),a.navHeadings||(a.navHeadings={}),a.navHeadings[b.navHeading]=!0})},highlightSelectedTab:function(){return this.tabSelectors().removeClass("active"),this.activeTabSelector().addClass("active")},select:function(a){var b,c;return a.preventDefault(),b=c=$(a.target),this.trigger("before:select",this),this.activate(c.parent().data("target")),this.trigger("after:select",this)},componentElements:function(){return this.$(">.tab-content >."+this.componentClass)},tabContentWrapper:function(){return $("#"+this.cid+"-tab-view-content")},tabContainerWrapper:function(){return $("#"+this.cid+"-tabs-selector")},tabContainer:function(){return this.$("ul."+this.navClass,this.tabContainerWrapper())},tabSelectors:function(){return this.$("li.tab-selector",this.tabContainer())}})}.call(this),function(){_.def("Luca.containers.Viewport").extend("Luca.containers.CardView")["with"]({activeItem:0,additionalClassNames:"luca-ui-viewport",fullscreen:!0,fluid:!1,initialize:function(a){this.options=a!=null?a:{},_.extend(this,this.options),Luca.enableBootstrap===!0&&(this.wrapperClass=this.fluid===!0?Luca.containers.Viewport.fluidWrapperClass:Luca.containers.Viewport.defaultWrapperClass),Luca.core.Container.prototype.initialize.apply(this,arguments);if(this.fullscreen===!0)return this.enableFullscreen()},enableFluid:function(){return this.enableWrapper()},disableFluid:function(){return this.disableWrapper()},enableWrapper:function(){if(this.wrapperClass!=null)return this.$el.parent().addClass(this.wrapperClass)},disableWrapper:function(){if(this.wrapperClass!=null)return this.$el.parent().removeClass(this.wrapperClass)},enableFullscreen:function(){return $("html,body").addClass("luca-ui-fullscreen"),this.$el.addClass("fullscreen-enabled")},disableFullscreen:function(){return $("html,body").removeClass("luca-ui-fullscreen"),this.$el.removeClass("fullscreen-enabled")},beforeRender:function(){var a;(a=Luca.containers.CardView.prototype.beforeRender)!=null&&a.apply(this,arguments),this.topNav!=null&&this.renderTopNavigation();if(this.bottomNav!=null)return this.renderBottomNavigation()},height:function(){return this.$el.height()},width:function(){return this.$el.width()},afterRender:function(){var a;(a=Luca.containers.CardView.prototype.after)!=null&&a.apply(this,arguments);if(Luca.enableBootstrap===!0&&this.containerClassName)return this.$el.children().wrap('<div class="#{ containerClassName }" />')},renderTopNavigation:function(){var a;if(this.topNav==null)return;return _.isString(this.topNav)&&(this.topNav=Luca.util.lazyComponent(this.topNav)),_.isObject(this.topNav)&&((a=this.topNav).ctype||(a.ctype=this.topNav.type||"nav_bar"),Luca.isBackboneView(this.topNav)||(this.topNav=Luca.util.lazyComponent(this.topNav))),this.topNav.app=this,$("body").prepend(this.topNav.render().el)},renderBottomNavigation:function(){}}),Luca.containers.Viewport.defaultWrapperClass="row",Luca.containers.Viewport.fluidWrapperClass="row-fluid"}.call(this),function(){_.def("Luca.components.Template")["extends"]("Luca.View")["with"]({initialize:function(a){return this.options=a!=null?a:{},console.log("The Use of Luca.components.Template directly is being DEPRECATED"),Luca.View.prototype.initialize.apply(this,arguments)}})}.call(this),function(){var a;a=function(){return Backbone.history.start()},_.def("Luca.Application")["extends"]("Luca.containers.Viewport")["with"]({name:"MyApp",defaultState:{},autoBoot:!1,autoStartHistory:"before:render",useCollectionManager:!0,collectionManager:{},collectionManagerClass:"Luca.CollectionManager",plugin:!1,useController:!0,useKeyHandler:!1,keyEvents:{},components:[{ctype:"template",name:"welcome",template:"sample/welcome",templateContainer:"Luca.templates"}],initialize:function(a){var b,c,d,e,f=this;this.options=a!=null?a:{},c=this,d=this.name,b=typeof Luca.getApplication=="function"?Luca.getApplication():void 0,(e=Luca.Application).instances||(e.instances={}),Luca.Application.instances[d]=c,Luca.containers.Viewport.prototype.initialize.apply(this,arguments),this.state=new Luca.Model(this.defaultState),this.setupMainController(),this.setupCollectionManager(),this.defer(function(){return c.render()}).until(this,"ready"),this.setupRouter(),this.useKeyRouter===!0&&console.log("The useKeyRouter property is being deprecated. switch to useKeyHandler instead"),(this.useKeyHandler===!0||this.useKeyRouter===!0)&&this.keyEvents!=null&&this.setupKeyHandler(),this.plugin!==!0&&!b&&(Luca.getApplication=function(a){return a==null?c:Luca.Application.instances[a]});if(this.autoBoot){if(Luca.util.resolve(this.name))throw"Attempting to override window."+this.name+" when it already exists";return $(function(){return window[d]=c,c.boot()})}},activeView:function(){var a;return(a=this.activeSubSection())?this.view(a):this.view(this.activeSection())},activeSection:function(){return this.get("active_section")},activeSubSection:function(){return this.get("active_sub_section")},activePages:function(){var a=this;return this.$(".luca-ui-controller").map(function(a,b){return $(b).data("active-section")})},boot:function(){return this.trigger("ready")},collection:function(){return this.collectionManager.getOrCreate.apply(this.collectionManager,arguments)},get:function(a){return this.state.get(a)},set:function(a,b,c){return this.state.set.apply(this.state,arguments)},view:function(a){return Luca.cache(a)},navigate_to:function(a,b){return this.getMainController().navigate_to(a,b)},getMainController:function(){return this.useController===!0?this.components[0]:Luca.cache("main_controller")},keyHandler:function(a){var b,c,d,e,f,g,h;if(!a||!this.keyEvents)return;c=$(a.target).is("input")||$(a.target).is("textarea");if(c)return;e=Luca.keyMap[a.keyCode];if(!e)return;f=(a!=null?a.metaKey:void 0)===!0,b=(a!=null?a.ctrlKey:void 0)===!0,g=this.keyEvents,g=f?this.keyEvents.meta:g,g=b?this.keyEvents.control:g,g=f&&b?this.keyEvents.meta_control:g;if(d=g!=null?g[e]:void 0)return this[d]!=null&&_.isFunction(this[d])?(h=this[d])!=null?h.call(this):void 0:this.trigger(d,a,e)},setupControllerBindings:function(){var a,b,c,d=this;return a=this,(b=this.getMainController())!=null&&b.bind("after:card:switch",function(b,c){return d.state.set({active_section:c.name}),a.trigger("page:change")}),(c=this.getMainController())!=null?c.each(function(b){if(b.ctype.match(/controller$/))return b.bind("after:card:switch",function(b,c){return d.state.set({active_sub_section:c.name}),a.trigger("sub:page:change")})}):void 0},setupMainController:function(){var a;if(this.useController===!0)return a=this.components||[],this.components=[{ctype:"controller",name:"main_controller",components:a}],this.defer(this.setupControllerBindings,!1).until("after:components")},setupCollectionManager:function(){var a,b,c,d;if(this.useCollectionManager===!0){_.isString(this.collectionManagerClass)&&(this.collectionManagerClass=Luca.util.resolve(this.collectionManagerClass)),a=this.collectionManagerOptions,_.isObject(this.collectionManager)&&!_.isFunction((c=this.collectionManager)!=null?c.get:void 0)&&(a=this.collectionManager,this.collectionManager=void 0),_.isString(this.collectionManager)&&(a={name:this.collectionManager}),this.collectionManager=typeof (b=Luca.CollectionManager).get=="function"?b.get(a.name):void 0;if(!_.isFunction((d=this.collectionManager)!=null?d.get:void 0))return this.collectionManager=new this.collectionManagerClass(a)}},setupRouter:function(){var b,c;b=this,_.isString(this.router)&&(c=Luca.util.resolve(this.router),this.router=new c({app:b}));if(this.router&&this.autoStartHistory)return this.autoStartHistory===!0&&(this.autoStartHistory="before:render"),this.defer(a,!1).until(this,this.autoStartHistory)},setupKeyHandler:function(){var a,b,c,d,e,f,g;if(!this.keyEvents)return;(c=this.keyEvents).control_meta||(c.control_meta={}),this.keyEvents.meta_control&&_.extend(this.keyEvents.control_meta,this.keyEvents.meta_control),a=_.bind(this.keyHandler,this),f=this.keypressEvents||["keydown"],g=[];for(d=0,e=f.length;d<e;d++)b=f[d],g.push($(document).on(b,a));return g}})}.call(this),function(){_.def("Luca.components.Toolbar")["extends"]("Luca.core.Container")["with"]({className:"luca-ui-toolbar toolbar",position:"bottom",initialize:function(a){return this.options=a!=null?a:{},Luca.core.Container.prototype.initialize.apply(this,arguments)},prepareComponents:function(){var a=this;return _(this.components).each(function(b){return b.container=a.$el})},render:function(){return $(this.container).append(this.el)}})}.call(this),function(){_.def("Luca.components.CollectionLoaderView")["extends"]("Luca.components.Template")["with"]({className:"luca-ui-collection-loader-view",template:"components/collection_loader_view",initialize:function(a){return this.options=a!=null?a:{},Luca.components.Template.prototype.initialize.apply(this,arguments),this.container||(this.container=$("body")),this.manager||(this.manager=Luca.CollectionManager.get()),this.setupBindings()},modalContainer:function(){return $("#progress-modal",this.el)},setupBindings:function(){var a=this;return this.manager.bind("collection_loaded",function(b){var c,d,e,f;return d=a.manager.loadedCollectionsCount(),f=a.manager.totalCollectionsCount(),e=parseInt(d/f*100),c=_.string.titleize(_.string.humanize(b)),a.modalContainer().find(".progress .bar").attr("style","width: "+e+"%;"),a.modalContainer().find(".message").html("Loaded "+c+"...")}),this.manager.bind("all_collections_loaded",function(){return a.modalContainer().find(".message").html("All done!"),_.delay(function(){return a.modalContainer().modal("hide")},400)})}})}.call(this),function(){var a,b;_.def("Luca.components.CollectionView")["extends"]("Luca.components.Panel")["with"]({tagName:"div",className:"luca-ui-collection-view",bodyClassName:"collection-ui-panel",itemTemplate:void 0,itemRenderer:void 0,itemTagName:"li",itemClassName:"collection-item",hooks:["empty:results"],initialize:function(a){var c=this;this.options=a!=null?a:{},_.extend(this,this.options),_.bindAll(this,"refresh");if(this.collection==null&&!this.options.collection)throw"Collection Views must specify a collection";if(this.itemTemplate==null&&this.itemRenderer==null&&this.itemProperty==null)throw"Collection Views must specify an item template or item renderer function";Luca.components.Panel.prototype.initialize.apply(this,arguments),_.isString(this.collection)&&Luca.CollectionManager.get()&&(this.collection=Luca.CollectionManager.get().getOrCreate(this.collection));if(!Luca.isBackboneCollection(this.collection))throw"Collection Views must have a valid backbone collection";this.collection.on("before:fetch",function(){if(c.loadMask===!0)return c.trigger("enable:loadmask")}),this.collection.bind("reset",function(){return c.loadMask===!0&&c.trigger("disable:loadmask"),c.refresh()}),this.collection.bind("add",this.refresh),this.collection.bind("remove",this.refresh),this.observeChanges===!0&&b.call(this);if(this.collection.length>0)return this.refresh()},attributesForItem:function(a,b){return _.extend({},{"class":this.itemClassName,"data-index":a.index,"data-model-id":a.model.get("id")})},contentForItem:function(a){var b,c;return a==null&&(a={}),this.itemTemplate!=null&&(c=Luca.template(this.itemTemplate))&&(b=c.call(this,a)),this.itemRenderer!=null&&_.isFunction(this.itemRenderer)&&(b=this.itemRenderer.call(this,a,a.model,a.index)),this.itemProperty&&(b=a.model.get(this.itemProperty)||a.model[this.itemProperty],_.isFunction(b)&&(b=b())),b},makeItem:function(b,c){var d;return d=this.prepareItem!=null?this.prepareItem.call(this,b,c):{model:b,index:c},a(this.itemTagName,this.attributesForItem(d,b),this.contentForItem(d))},getModels:function(){var a;return((a=this.collection)!=null?a.query:void 0)&&(this.filter||this.filterOptions)?this.collection.query(this.filter,this.filterOptions):this.collection.models},locateItemElement:function(a){return this.$("."+this.itemClassName+"[data-model-id='"+a+"']")},refreshModel:function(a){var b;return b=this.collection.indexOf(a),this.locateItemElement(a.get("id")).empty().append(this.contentForItem({model:a,index:b},a))},refresh:function(){var a=this;return this.$bodyEl().empty(),this.getModels().length===0&&this.trigger("empty:results"),_(this.getModels()).each(function(b,c){return a.$append(a.makeItem(b,c))})},registerEvent:function(a,b,c){var d;return c==null&&_.isFunction(b)&&(c=b,b=void 0),d=_([a,""+this.itemTagName+"."+this.itemClassName,b]).compact().join(" "),Luca.View.prototype.registerEvent(d,c)},render:function(){return this.refresh(),this.$el.parent().length>0&&this.container!=null&&this.$attach(),this}}),a=Luca.View.prototype.make,b=function(){var a=this;return this.collection.on("change",function(b){return a.refreshModel(b)})}}.call(this),function(){_.def("Luca.components.Controller")["extends"]("Luca.containers.CardView")["with"]({additionalClassNames:["luca-ui-controller"],activeAttribute:"active-section",initialize:function(a){var b;this.options=a,Luca.containers.CardView.prototype.initialize.apply(this,arguments),this.defaultCard||(this.defaultCard=(b=this.components[0])!=null?b.name:void 0);if(!this.defaultCard)throw"Controllers must specify a defaultCard property and/or the first component must have a name";return this.state=new Backbone.Model({active_section:this.defaultCard})},each:function(a){var b=this;return _(this.components).each(function(c){return a.apply(b,[c])})},activeSection:function(){return this.get("activeSection")},controllers:function(a){return a==null&&(a=!1),this.select("ctype","controller",a)},availableSections:function(){var a,b=this;return a={},a[this.name]=this.sectionNames(),_(this.controllers()).reduce(function(a,b){return a[b.name]=b.sectionNames(),a},a)},sectionNames:function(a){return a==null&&(a=!1),this.pluck("name")},"default":function(a){return this.navigate_to(this.defaultCard,a)},navigate_to:function(a,b){var c=this;return a||(a=this.defaultCard),this.activate(a,!1,function(a,d,e){c.state.set({active_section:e.name});if(_.isFunction(b))return b.apply(e)}),this.find(a)}})}.call(this),function(){_.def("Luca.fields.ButtonField")["extends"]("Luca.core.Field")["with"]({readOnly:!0,events:{"click input":"click_handler"},hooks:["button:click"],className:"luca-ui-field luca-ui-button-field",template:"fields/button_field",click_handler:function(a){var b,c;return b=c=$(a.currentTarget),this.trigger("button:click")},initialize:function(a){var b;this.options=a!=null?a:{},_.extend(this.options),_.bindAll(this,"click_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments);if((b=this.icon_class)!=null?b.length:void 0)return this.template="fields/button_field_link"},afterInitialize:function(){this.input_id||(this.input_id=_.uniqueId("button")),this.input_name||(this.input_name=this.name||(this.name=this.input_id)),this.input_value||(this.input_value=this.label||(this.label=this.text)),this.input_type||(this.input_type="button"),this.input_class||(this.input_class=this["class"]),this.icon_class||(this.icon_class=""),this.icon_class.length&&!this.icon_class.match(/^icon-/)&&(this.icon_class="icon-"+this.icon_class);if(this.white)return this.icon_class+=" icon-white"},setValue:function(){return!0}})}.call(this),function(){var a;a=Luca.View.prototype.make,_.def("Luca.fields.CheckboxArray")["extends"]("Luca.core.Field")["with"]({version:2,template:"fields/checkbox_array",className:"luca-ui-checkbox-array",events:{"click input":"clickHandler"},selectedItems:[],initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.modules.Deferrable),_.bindAll(this,"renderCheckboxes","clickHandler","checkSelected"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.valueField||(this.valueField="id"),this.displayField||(this.displayField="name")},afterInitialize:function(a){var b;this.options=a!=null?a:{};try{this.configure_collection()}catch(c){console.log("Error Configuring Collection",this,c.message)}return b=this,this.collection.length>0?this.renderCheckboxes():this.defer("renderCheckboxes").until(this.collection,"reset")},clickHandler:function(a){var b;b=$(a.target);if(b.prop("checked"))return this.selectedItems.push(b.val());if(_(this.selectedItems).include(b.val()))return this.selectedItems=_(this.selectedItems).without(b.val())},controls:function(){return this.$(".controls")},renderCheckboxes:function(){var b=this;return this.controls().empty(),this.selectedItems=[],this.collection.each(function(c){var d,e,f,g,h;return h=c.get(b.valueField),g=c.get(b.displayField),f=_.uniqueId(""+b.cid+"_checkbox"),e=a("input",{type:"checkbox","class":"array-checkbox",name:b.input_name,value:h,id:f}),d=a("label",{"for":f},e),$(d).append(" "+g),b.controls().append(d)}),this.trigger("checkboxes:rendered",this.checkboxesRendered=!0),this},uncheckAll:function(){return this.allFields().prop("checked",!1)},allFields:function(){return this.controls().find("input[type='checkbox']")},checkSelected:function(a){var b,c,d,e,f;a!=null&&(this.selectedItems=a),this.uncheckAll(),f=this.selectedItems;for(d=0,e=f.length;d<e;d++)c=f[d],b=this.controls().find("input[value='"+c+"']"),b.prop("checked",!0);return this.selectedItems},getValue:function(){var a,b,c,d,e;d=this.allFields(),e=[];for(b=0,c=d.length;b<c;b++)a=d[b],this.$(a).prop("checked")&&e.push(this.$(a).val());return e},setValue:function(a){var b;return this.selectedItems=a,this.checkboxesRendered===!0?this.checkSelected(a):(b=this,this.defer(function(){return b.checkSelected(a)}).until("checkboxes:rendered"))},getValues:function(){return this.getValue()},setValues:function(a){return this.setValue(a)}})}.call(this),function(){_.def("Luca.fields.CheckboxField")["extends"]("Luca.core.Field")["with"]({events:{"change input":"change_handler"},className:"luca-ui-checkbox-field luca-ui-field",template:"fields/checkbox_field",hooks:["checked","unchecked"],send_blanks:!0,change_handler:function(a){var b,c;return b=c=$(a.target),b.is(":checked")?this.trigger("checked"):this.trigger("unchecked"),this.trigger("on:change",this,a,b.is(":checked"))},initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),_.bindAll(this,"change_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments)},afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_value||(this.input_value=1),this.label||(this.label=this.name)},setValue:function(a){return this.input.attr("checked",a)},getValue:function(){return this.input.is(":checked")}})}.call(this),function(){_.def("Luca.fields.FileUploadField")["extends"]("Luca.core.Field")["with"]({template:"fields/file_upload_field",initialize:function(a){return this.options=a!=null?a:{},Luca.core.Field.prototype.initialize.apply(this,arguments)},afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.helperText||(this.helperText="")}})}.call(this),function(){_.def("Luca.fields.HiddenField")["extends"]("Luca.core.Field")["with"]({template:"fields/hidden_field",initialize:function(a){return this.options=a!=null?a:{},Luca.core.Field.prototype.initialize.apply(this,arguments)},afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_value||(this.input_value=this.value),this.label||(this.label=this.name)}})}.call(this),function(){_.def("Luca.components.LabelField")["extends"]("Luca.core.Field")["with"]({className:"luca-ui-field luca-ui-label-field",getValue:function(){return this.$("input").attr("value")},formatter:function(a){return a||(a=this.getValue()),_.str.titleize(a)},setValue:function(a){return this.trigger("change",a,this.getValue()),this.$("input").attr("value",a),this.$(".value").html(this.formatter(a))}})}.call(this),function(){_.def("Luca.fields.SelectField"
8
- )["extends"]("Luca.core.Field")["with"]({events:{"change select":"change_handler"},hooks:["after:select"],className:"luca-ui-select-field luca-ui-field",template:"fields/select_field",includeBlank:!0,blankValue:"",blankText:"Select One",initialize:function(a){this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.modules.Deferrable),_.bindAll(this,"change_handler","populateOptions","beforeFetch"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name);if(_.isUndefined(this.retainValue))return this.retainValue=!0},afterInitialize:function(){var a;if((a=this.collection)!=null?a.data:void 0)this.valueField||(this.valueField="id"),this.displayField||(this.displayField="name"),this.parseData();try{this.configure_collection()}catch(b){console.log("Error Configuring Collection",this,b.message)}return this.collection.bind("before:fetch",this.beforeFetch),this.collection.bind("reset",this.populateOptions)},parseData:function(){var a=this;return this.collection.data=_(this.collection.data).map(function(b){var c;return _.isArray(b)?(c={},c[a.valueField]=b[0],c[a.displayField]=b[1]||b[0],c):b})},afterRender:function(){var a,b;return this.input=$("select",this.el),((a=this.collection)!=null?(b=a.models)!=null?b.length:void 0:void 0)>0?this.populateOptions():this.collection.trigger("reset")},setValue:function(a){return this.currentValue=a,Luca.core.Field.prototype.setValue.apply(this,arguments)},beforeFetch:function(){return this.resetOptions()},change_handler:function(a){return this.trigger("on:change",this,a)},resetOptions:function(){this.input.html("");if(this.includeBlank)return this.input.append("<option value='"+this.blankValue+"'>"+this.blankText+"</option>")},populateOptions:function(){var a,b=this;return this.resetOptions(),((a=this.collection)!=null?a.each:void 0)!=null&&this.collection.each(function(a){var c,d,e,f;return f=a.get(b.valueField),c=a.get(b.displayField),b.selected&&f===b.selected&&(e="selected"),d="<option "+e+" value='"+f+"'>"+c+"</option>",b.input.append(d)}),this.trigger("after:populate:options",this),this.setValue(this.currentValue)}})}.call(this),function(){_.def("Luca.fields.TextAreaField")["extends"]("Luca.core.Field")["with"]({events:{"keydown input":"keydown_handler","blur input":"blur_handler","focus input":"focus_handler"},template:"fields/text_area_field",height:"200px",width:"90%",initialize:function(a){return this.options=a!=null?a:{},_.bindAll(this,"keydown_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.input_class||(this.input_class=this["class"]),this.inputStyles||(this.inputStyles="height:"+this.height+";width:"+this.width)},setValue:function(a){return $(this.field()).val(a)},getValue:function(){return $(this.field()).val()},field:function(){return this.input=$("textarea#"+this.input_id,this.el)},keydown_handler:function(a){var b,c;return b=c=$(a.currentTarget)},blur_handler:function(a){var b,c;return b=c=$(a.currentTarget)},focus_handler:function(a){var b,c;return b=c=$(a.currentTarget)}})}.call(this),function(){_.def("Luca.fields.TextField")["extends"]("Luca.core.Field")["with"]({events:{"blur input":"blur_handler","focus input":"focus_handler","change input":"change_handler"},template:"fields/text_field",autoBindEventHandlers:!0,send_blanks:!0,keyEventThrottle:300,initialize:function(a){return this.options=a!=null?a:{},this.enableKeyEvents&&this.registerEvent("keyup input","keyup_handler"),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.input_class||(this.input_class=this["class"]),this.prepend&&(this.$el.addClass("input-prepend"),this.addOn=this.prepend),this.append&&(this.$el.addClass("input-append"),this.addOn=this.append),Luca.core.Field.prototype.initialize.apply(this,arguments)},keyup_handler:function(a){return this.trigger("on:keyup",this,a)},blur_handler:function(a){return this.trigger("on:blur",this,a)},focus_handler:function(a){return this.trigger("on:focus",this,a)},change_handler:function(a){return this.trigger("on:change",this,a)}})}.call(this),function(){_.def("Luca.fields.TypeAheadField")["extends"]("Luca.fields.TextField")["with"]({className:"luca-ui-field",getSource:function(){return _.isFunction(this.source)?this.source.call(this):this.source||[]},matcher:function(a){return!0},beforeRender:function(){return this._super("beforeRender",this,arguments),this.$("input").attr("data-provide","typeahead")},afterRender:function(){return this._super("afterRender",this,arguments),this.$("input").typeahead({matcher:this.matcher,source:this.getSource()})}})}.call(this),function(){_.def("Luca.components.FormButtonToolbar")["extends"]("Luca.components.Toolbar")["with"]({className:"luca-ui-form-toolbar form-actions",position:"bottom",includeReset:!1,render:function(){return $(this.container).append(this.el)},initialize:function(a){this.options=a!=null?a:{},Luca.components.Toolbar.prototype.initialize.apply(this,arguments),this.components=[{ctype:"button_field",label:"Submit","class":"btn submit-button"}];if(this.includeReset)return this.components.push({ctype:"button_field",label:"Reset","class":"btn reset-button"})}})}.call(this),function(){var a;a={buttons:[{icon:"remove-sign",label:"Reset",eventId:"click:reset",className:"reset-button",align:"right"},{icon:"ok-sign",white:!0,label:"Save Changes",eventId:"click:submit",color:"success",className:"submit-button",align:"right"}]},_.def("Luca.components.FormView")["extends"]("Luca.core.Container")["with"]({tagName:"form",className:"luca-ui-form-view",hooks:["before:submit","before:reset","before:load","before:load:new","before:load:existing","after:submit","after:reset","after:load","after:load:new","after:load:existing","after:submit:success","after:submit:fatal_error","after:submit:error"],events:{"click .submit-button":"submitHandler","click .reset-button":"resetHandler"},toolbar:!0,legend:"",bodyClassName:"form-view-body",version:"0.9.33333333",initialize:function(a){this.options=a!=null?a:{},this.loadMask==null&&(this.loadMask=Luca.enableBootstrap),Luca.core.Container.prototype.initialize.apply(this,arguments),_.bindAll(this,"submitHandler","resetHandler","renderToolbars","applyLoadMask"),this.state||(this.state=new Backbone.Model),this.setupHooks(this.hooks),this.applyStyleClasses();if(this.toolbar!==!1&&!this.topToolbar&&!this.bottomToolbar){if(this.toolbar==="both"||this.toolbar==="top")this.topToolbar=this.getDefaultToolbar();if(this.toolbar!=="top")return this.bottomToolbar=this.getDefaultToolbar()}},getDefaultToolbar:function(){return a},applyStyleClasses:function(){Luca.enableBootstrap&&this.applyBootstrapStyleClasses(),this.labelAlign&&this.$el.addClass("label-align-"+this.labelAlign);if(this.fieldLayoutClass)return this.$el.addClass(this.fieldLayoutClass)},applyBootstrapStyleClasses:function(){this.labelAlign==="left"&&(this.inlineForm=!0),this.well&&this.$el.addClass("well"),this.searchForm&&this.$el.addClass("form-search"),this.horizontalForm&&this.$el.addClass("form-horizontal");if(this.inlineForm)return this.$el.addClass("form-inline")},resetHandler:function(a){var b,c;return b=c=$(a!=null?a.target:void 0),this.trigger("before:reset",this),this.reset(),this.trigger("after:reset",this)},submitHandler:function(a){var b,c;b=c=$(a!=null?a.target:void 0),this.trigger("before:submit",this),this.loadMask===!0&&this.trigger("enable:loadmask",this);if(this.hasModel())return this.submit()},afterComponents:function(){var a,b=this;return(a=Luca.core.Container.prototype.afterComponents)!=null&&a.apply(this,arguments),this.eachField(function(a){return a.getForm=function(){return b},a.getModel=function(){return b.currentModel()}})},eachField:function(a){return _(this.getFields()).map(a)},getField:function(a){var b;return b=_(this.getFields("name",a)).first(),b!=null?b:_(this.getFields("input_name",a)).first()},getFields:function(a,b){var c;return c=this.selectByAttribute("isField",!0,!0),a!=null&&b!=null&&(c=_(c).select(function(c){var d;return d=c[a],_.isFunction(d)&&(d=d.call(c)),d===b})),c},loadModel:function(a){var b,c,d,e;this.current_model=a,d=this,c=this.getFields(),this.trigger("before:load",this,this.current_model),this.current_model&&((e=this.current_model.beforeFormLoad)!=null&&e.apply(this.current_model,this),b="before:load:"+(this.current_model.isNew()?"new":"existing"),this.trigger(b,this,this.current_model)),this.setValues(this.current_model),this.trigger("after:load",this,this.current_model);if(this.current_model)return this.trigger("after:load:"+(this.current_model.isNew()?"new":"existing"),this,this.current_model)},reset:function(){if(this.current_model!=null)return this.loadModel(this.current_model)},clear:function(){var a=this;return this.current_model=this.defaultModel!=null?this.defaultModel():void 0,_(this.getFields()).each(function(b){try{return b.setValue("")}catch(c){return console.log("Error Clearing",a,b)}})},setValues:function(a,b){var c,d=this;b==null&&(b={}),a||(a=this.currentModel()),c=this.getFields(),_(c).each(function(b){var c,e;c=b.input_name||b.name,(e=a[c])&&_.isFunction(e)&&(e=e.apply(d)),!e&&Luca.isBackboneModel(a)&&(e=a.get(c));if(b.readOnly!==!0)return b!=null?b.setValue(e):void 0});if(b.silent!=null!=1)return this.syncFormWithModel()},getValues:function(a){var b,c=this;return a==null&&(a={}),a.reject_blank==null&&(a.reject_blank=!0),a.skip_buttons==null&&(a.skip_buttons=!0),a.blanks===!1&&(a.reject_blank=!0),b=_(this.getFields()).inject(function(b,c){var d,e,f,g,h;return g=c.getValue(),e=c.input_name||c.name,h=!!_.str.isBlank(g)||!!_.isUndefined(g),d=!a.reject_blank&&!c.send_blanks,a.debug&&console.log(""+e+" Options",a,"Value",g,"Value Is Blank?",h,"Allow Blanks?",d),a.skip_buttons&&c.ctype==="button_field"?f=!0:(h&&d===!1&&(f=!0),c.input_name==="id"&&h===!0&&(f=!0)),a.debug&&console.log("Skip is true on "+e),f!==!0&&(b[e]=g),b},a.defaults||{}),b},submit_success_handler:function(a,b,c){return this.trigger("after:submit",this,a,b),this.loadMask===!0&&this.trigger("disable:loadmask",this),b&&(b!=null?b.success:void 0)===!0?this.trigger("after:submit:success",this,a,b):this.trigger("after:submit:error",this,a,b)},submit_fatal_error_handler:function(a,b,c){return this.trigger("after:submit",this,a,b),this.trigger("after:submit:fatal_error",this,a,b)},submit:function(a,b){a==null&&(a=!0),b==null&&(b={}),_.bindAll(this,"submit_success_handler","submit_fatal_error_handler"),b.success||(b.success=this.submit_success_handler),b.error||(b.error=this.submit_fatal_error_handler),this.syncFormWithModel();if(!a)return;return this.current_model.save(this.current_model.toJSON(),b)},hasModel:function(){return this.current_model!=null},currentModel:function(a){return a==null&&(a={}),(a===!0||(a!=null?a.refresh:void 0)===!0)&&this.syncFormWithModel(),this.current_model},syncFormWithModel:function(){var a;return(a=this.current_model)!=null?a.set(this.getValues()):void 0},setLegend:function(a){return this.legend=a,$("fieldset legend",this.el).first().html(this.legend)},flash:function(a){return this.$(".toolbar-container.top").length>0?this.$(".toolbar-container.top").after(a):this.$bodyEl().prepend(a)},successFlashDelay:1500,successMessage:function(a){var b=this;return this.$(".alert.alert-success").remove(),this.flash(Luca.template("components/form_alert",{className:"alert alert-success",message:a})),_.delay(function(){return b.$(".alert.alert-success").fadeOut()},this.successFlashDelay||0)},errorMessage:function(a){return this.$(".alert.alert-error").remove(),this.flash(Luca.template("components/form_alert",{className:"alert alert-error",message:a}))}})}.call(this),function(){_.def("Luca.components.GridView").extend("Luca.components.Panel")["with"]({bodyTemplate:"components/grid_view",autoBindEventHandlers:!0,events:{"dblclick table tbody tr":"double_click_handler","click table tbody tr":"click_handler"},className:"luca-ui-g-view",rowClass:"luca-ui-g-row",wrapperClass:"luca-ui-g-view-wrapper",additionalWrapperClasses:[],wrapperStyles:{},scrollable:!0,emptyText:"No Results To display.",tableStyle:"striped",defaultHeight:285,defaultWidth:756,maxWidth:void 0,hooks:["before:grid:render","before:render:header","before:render:row","after:grid:render","row:double:click","row:click","after:collection:load"],initialize:function(a){var b=this;return this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.modules.Deferrable),this.loadMask==null&&(this.loadMask=Luca.enableBootstrap),this.loadMask===!0&&(this.loadMaskEl||(this.loadMaskEl=".luca-ui-g-view-body")),Luca.components.Panel.prototype.initialize.apply(this,arguments),this.configure_collection(!0),this.collection.bind("before:fetch",function(){if(b.loadMask===!0)return b.trigger("enable:loadmask")}),this.collection.bind("reset",function(a){return b.refresh(),b.loadMask===!0&&b.trigger("disable:loadmask"),b.trigger("after:collection:load",a)}),this.collection.bind("change",function(a){var c,d;if(b.rendered!==!0)return;try{return d=b.getRowEl(a.id||a.get("id")||a.cid),c=b.render_row(a,b.collection.indexOf(a),{cellsOnly:!0}),$(d).html(c.join(" "))}catch(e){return console.log("Error in change handler for GridView.collection",e,b,a)}})},beforeRender:function(){var a;return(a=Luca.components.Panel.prototype.beforeRender)!=null&&a.apply(this,arguments),this.trigger("before:grid:render",this),this.table=this.$("table.luca-ui-g-view"),this.header=this.$("thead"),this.body=this.$("tbody"),this.footer=this.$("tfoot"),this.wrapper=this.$("."+this.wrapperClass),this.applyCssClasses(),this.scrollable&&this.setDimensions(),this.renderHeader(),this.emptyMessage(),$(this.container).append(this.$el)},afterRender:function(){var a;return(a=Luca.components.Panel.prototype.afterRender)!=null&&a.apply(this,arguments),this.rendered=!0,this.refresh(),this.trigger("after:grid:render",this)},applyCssClasses:function(){var a,b=this;return this.scrollable&&this.$el.addClass("scrollable-g-view"),_(this.additionalWrapperClasses).each(function(a){var c;return(c=b.wrapper)!=null?c.addClass(a):void 0}),Luca.enableBootstrap&&this.table.addClass("table"),_((a=this.tableStyle)!=null?a.split(" "):void 0).each(function(a){return b.table.addClass("table-"+a)})},setDimensions:function(a){var b=this;return this.height||(this.height=this.defaultHeight),this.$(".luca-ui-g-view-body").height(this.height),this.$("tbody.scrollable").height(this.height-23),this.container_width=function(){return $(b.container).width()}(),this.width||(this.width=this.container_width>0?this.container_width:this.defaultWidth),this.width=_([this.width,this.maxWidth||this.width]).max(),this.$(".luca-ui-g-view-body").width(this.width),this.$(".luca-ui-g-view-body table").width(this.width),this.setDefaultColumnWidths()},resize:function(a){var b,c,d=this;b=a-this.width,this.width=a,this.$(".luca-ui-g-view-body").width(this.width),this.$(".luca-ui-g-view-body table").width(this.width);if(this.columns.length>0)return c=b/this.columns.length,_(this.columns).each(function(a,b){var e;return e=$(".column-"+b,d.el),e.width(a.width=a.width+c)})},padLastColumn:function(){var a,b;a=_(this.columns).inject(function(a,b){return a=b.width+a},0),b=this.width-a;if(b>0)return this.lastColumn().width+=b},setDefaultColumnWidths:function(){var a;return a=this.columns.length>0?this.width/this.columns.length:200,_(this.columns).each(function(b){return parseInt(b.width||(b.width=a))}),this.padLastColumn()},lastColumn:function(){return this.columns[this.columns.length-1]},emptyMessage:function(a){return a==null&&(a=""),a||(a=this.emptyText),this.body.html(""),this.body.append(Luca.templates["components/grid_view_empty_text"]({colspan:this.columns.length,text:a}))},refresh:function(){var a=this;this.body.html(""),this.collection.each(function(b,c){return a.render_row.apply(a,[b,c])});if(this.collection.models.length===0)return this.emptyMessage()},ifLoaded:function(a,b){return b||(b=this),a||(a=function(){return!0}),this.collection.ifLoaded(a,b)},applyFilter:function(a,b){return b==null&&(b={auto:!0,refresh:!0}),this.collection.applyFilter(a,b)},renderHeader:function(){var a,b=this;return this.trigger("before:render:header"),a=_(this.columns).map(function(a,b){var c;return c=a.width?"width:"+a.width+"px;":"","<th style='"+c+"' class='column-"+b+"'>"+a.header+"</th>"}),this.header.append("<tr>"+a+"</tr>")},getRowEl:function(a){return this.$("[data-record-id="+a+"]","table")},render_row:function(a,b,c){var d,e,f,g,h,i,j=this;return c==null&&(c={}),h=this.rowClass,g=(a!=null?a.get:void 0)&&(a!=null?a.attributes:void 0)?a.get("id"):"",this.trigger("before:render:row",a,b),e=_(this.columns).map(function(b,c){var d,e,f;return f=j.cell_renderer(a,b,c),e=b.width?"width:"+b.width+"px;":"",d=_.isUndefined(f)?"":f,"<td style='"+e+"' class='column-"+c+"'>"+d+"</td>"}),c.cellsOnly?e:(d="",this.alternateRowClasses&&(d=b%2===0?"even":"odd"),f="<tr data-record-id='"+g+"' data-row-index='"+b+"' class='"+h+" "+d+"' id='row-"+b+"'>"+e+"</tr>",c.contentOnly===!0?f:(i=this.body)!=null?i.append(f):void 0)},cell_renderer:function(a,b,c){var d;return _.isFunction(b.renderer)?b.renderer.apply(this,[a,b,c]):b.data.match(/\w+\.\w+/)?(d=a.attributes||a,Luca.util.nestedValue(b.data,d)):(typeof a.get=="function"?a.get(b.data):void 0)||a[b.data]},double_click_handler:function(a){var b,c,d,e;return b=c=$(a.currentTarget),e=c.data("row-index"),d=this.collection.at(e),this.trigger("row:double:click",this,d,e)},click_handler:function(a){var b,c,d,e;return b=c=$(a.currentTarget),e=c.data("row-index"),d=this.collection.at(e),this.trigger("row:click",this,d,e),$("."+this.rowClass,this.body).removeClass("selected-row"),b.addClass("selected-row")}})}.call(this),function(){_.def("Luca.components.LoadMask")["extends"]("Luca.View")["with"]({className:"luca-ui-load-mask",bodyTemplate:"components/load_mask"})}.call(this),function(){_.def("Luca.components.NavBar")["extends"]("Luca.View")["with"]({fixed:!0,position:"top",className:"navbar",brand:"Luca.js",bodyTemplate:"nav_bar",bodyClassName:"luca-ui-navbar-body",beforeRender:function(){this.fixed&&this.$el.addClass("navbar-fixed-"+this.position),this.brand!=null&&this.content().append("<a class='brand' href='#'>"+this.brand+"</a>");if(this.template)return this.content().append(Luca.template(this.template,this))},render:function(){return this},content:function(){return this.$(".container").eq(0)}})}.call(this),function(){_.def("Luca.PageController")["extends"]("Luca.components.Controller")["with"]({version:2})}.call(this),function(){_.def("Luca.components.RecordManager")["extends"]("Luca.containers.CardView")["with"]({events:{"click .record-manager-grid .edit-link":"edit_handler","click .record-manager-filter .filter-button":"filter_handler","click .record-manager-filter .reset-button":"reset_filter_handler","click .add-button":"add_handler","click .refresh-button":"filter_handler","click .back-to-search-button":"back_to_search_handler"},record_manager:!0,initialize:function(a){var b=this;this.options=a!=null?a:{},Luca.containers.CardView.prototype.initialize.apply(this,arguments);if(!this.name)throw"Record Managers must specify a name";return _.bindAll(this,"add_handler","edit_handler","filter_handler","reset_filter_handler"),this.filterConfig&&_.extend(this.components[0][0],this.filterConfig),this.gridConfig&&_.extend(this.components[0][1],this.gridConfig),this.editorConfig&&_.extend(this.components[1][0],this.editorConfig),this.bind("after:card:switch",function(){b.activeCard===0&&b.trigger("activation:search",b);if(b.activeCard===1)return b.trigger("activation:editor",b)})},components:[{ctype:"split_view",relayFirstActivation:!0,components:[{ctype:"form_view"},{ctype:"grid_view"}]},{ctype:"form_view"}],getSearch:function(a,b){return a==null&&(a=!1),b==null&&(b=!0),a===!0&&this.activate(0),b===!0&&this.getEditor().clear(),_.first(this.components)},getFilter:function(){return _.first(this.getSearch().components)},getGrid:function(){return _.last(this.getSearch().components)},getCollection:function(){return this.getGrid().collection},getEditor:function(a,b){var c=this;return a==null&&(a=!1),b==null&&(b=!1),a===!0&&this.activate(1,function(a,b,c){return c.reset()}),_.last(this.components)},beforeRender:function(){var a;return this.$el.addClass(""+this.resource+"-manager"),(a=Luca.containers.CardView.prototype.beforeRender)!=null&&a.apply(this,arguments),this.$el.addClass(""+this.resource+" record-manager"),this.$el.data("resource",this.resource),$(this.getGrid().el).addClass(""+this.resource+" record-manager-grid"),$(this.getFilter().el).addClass(""+this.resource+" record-manager-filter"),$(this.getEditor().el).addClass(""+this.resource+" record-manager-editor")},afterRender:function(){var a,b,c,d,e,f,g=this;return(f=Luca.containers.CardView.prototype.afterRender)!=null&&f.apply(this,arguments),e=this,d=this.getGrid(),c=this.getFilter(),b=this.getEditor(),a=this.getCollection(),d.bind("row:double:click",function(a,c,d){return e.getEditor(!0),b.loadModel(c)}),b.bind("before:submit",function(){return $(".form-view-flash-container",g.el).html(""),$(".form-view-body",g.el).spin("large")}),b.bind("after:submit",function(){return $(".form-view-body",g.el).spin(!1)}),b.bind("after:submit:fatal_error",function(){return $(".form-view-flash-container",g.el).append("<li class='error'>There was an internal server error saving this record. Please contact developers@benchprep.com to report this error.</li>"),$(".form-view-body",g.el).spin(!1)}),b.bind("after:submit:error",function(a,b,c){return _(c.errors).each(function(a){return $(".form-view-flash-container",g.el).append("<li class='error'>"+a+"</li>")})}),b.bind("after:submit:success",function(a,b,c){return $(".form-view-flash-container",g.el).append("<li class='success'>Successfully Saved Record</li>"),b.set(c.result),a.loadModel(b),d.refresh(),_.delay(function(){return $(".form-view-flash-container li.success",g.el).fadeOut(1e3),$(".form-view-flash-container",g.el).html("")},4e3)}),c.eachComponent(function(a){try{return a.bind("on:change",g.filter_handler)}catch(b){return}})},firstActivation:function(){return this.getGrid().trigger("first:activation",this,this.getGrid()),this.getFilter().trigger("first:activation",this,this.getGrid())},reload:function(){var a,b,c,d;return d=this,c=this.getGrid(),b=this.getFilter(),a=this.getEditor(),b.clear(),c.applyFilter()},manageRecord:function(a){var b,c=this;return b=this.getCollection().get(a),b?this.loadModel(b):(console.log("Could Not Find Model, building and fetching"),b=this.buildModel(),b.set({id:a},{silent:!0}),b.fetch({success:function(a,b){return c.loadModel(a)}}))},loadModel:function(a){return this.current_model=a,this.getEditor(!0).loadModel(this.current_model),this.trigger("model:loaded",this.current_model)},currentModel:function(){return this.getEditor(!1).currentModel()},buildModel:function(){var a,b,c;return b=this.getEditor(!1),a=this.getCollection(),a.add([{}],{silent:!0,at:0}),c=a.at(0)},createModel:function(){return this.loadModel(this.buildModel())},reset_filter_handler:function(a){return this.getFilter().clear(),this.getGrid().applyFilter(this.getFilter().getValues())},filter_handler:function(a){return this.getGrid().applyFilter(this.getFilter().getValues())},edit_handler:function(a){var b,c,d,e;return b=d=$(a.currentTarget),e=d.parents("tr").data("record-id"),e&&(c=this.getGrid().collection.get(e)),c||(c=this.getGrid().collection.at(row_index))},add_handler:function(a){var b,c,d;return b=c=$(a.currentTarget),d=c.parents(".record-manager").eq(0).data("resource")},destroy_handler:function(a){},back_to_search_handler:function(){}})}.call(this),function(){_.def("Luca.Router")["extends"]("Backbone.Router")["with"]({routes:{"":"default"},initialize:function(a){var b=this;return this.options=a,_.extend(this,this.options),this.routeHandlers=_(this.routes).values(),_(this.routeHandlers).each(function(a){return b.bind("route:"+a,function(){return b.trigger.apply(b,["change:navigation",a].concat(_(arguments).flatten()))})})},navigate:function(a,b){return b==null&&(b=!1),Backbone.Router.prototype.navigate.apply(this,arguments),this.buildPathFrom(Backbone.history.getFragment())},buildPathFrom:function(a){var b=this;return _(this.routes).each(function(c,d){var e,f;f=b._routeToRegExp(d);if(f.test(a))return e=b._extractParameters(f,a),b.trigger.apply(b,["change:navigation",c].concat(e))})}})}.call(this),function(){var a;_.def("Luca.components.TableView")["extends"]("Luca.components.CollectionView")["with"]({additionalClassNames:"table",tagName:"table",bodyTemplate:"table_view",bodyTagName:"tbody",bodyClassName:"table-body",itemTagName:"tr",stateful:!0,observeChanges:!0,columns:[],emptyText:"There are no results to display",itemRenderer:function(a,b){return Luca.components.TableView.rowRenderer.call(this,a,b)},emptyResults:function(){return this.$("tbody").append("<tr><td colspan="+this.columns.length+">"+this.emptyText+"</td></tr>")},initialize:function(a){var b=this;return this.options=a!=null?a:{},Luca.components.CollectionView.prototype.initialize.apply(this,arguments),this.defer(function(){return Luca.components.TableView.renderHeader.call(b,b.columns,b.$("thead")),b.$el.removeClass("row-fluid")}).until("before:render")}}),a=Backbone.View.prototype.make,Luca.components.TableView.renderHeader=function(b,c){var d,e,f,g,h,i;f=0,e=function(){var a,c,e;e=[];for(a=0,c=b.length;a<c;a++)d=b[a],e.push("<th data-col-index='"+f+"'>"+d.header+"</th>");return e}(),$(c).append(a("tr",{},e)),f=0,i=[];for(g=0,h=b.length;g<h;g++)d=b[g],d.width!=null&&i.push(this.$("th[data-col-index='"+f+"']",c).css("width",d.width));return i},Luca.components.TableView.rowRenderer=function(a,b,c){var d,e,f,g,h;g=this.columns,h=[];for(e=0,f=g.length;e<f;e++)d=g[e],h.push(Luca.components.TableView.renderColumn.call(this,d,a,b,c));return h},Luca.components.TableView.renderColumn=function(b,c,d,e){var f;return f=d.read(b.reader),a("td",{},f)}}.call(this),function(){_.def("Luca.components.ToolbarDialog")["extends"]("Luca.View")["with"]({className:"luca-ui-toolbar-dialog span well",styles:{position:"absolute","z-Index":"3000","float":"left"},initialize:function(a){return this.options=a!=null?a:{},this._super("initialize",this,arguments)},createWrapper:function(){return this.make("div",{"class":"component-picker span4 well",style:"position: absolute; z-index:12000"})},show:function(){return this.$el.parent().show()},hide:function(){return this.$el.parent().hide()},toggle:function(){return this.$el.parent().toggle()}})}.call(this),function(){}.call(this),function(){}.call(this),function(){}.call(this);
3
+ );try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(K.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else K.isFunction(a)?this.each(function(b){var c=K(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){return this[0]&&this[0].parentNode?K.isFunction(a)?this.each(function(b){var c=K(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=K(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;K(this).remove(),b?K(b).before(a):K(c).append(a)})):this.length?this.pushStack(K(K.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,f,g,h,i=a[0],j=[];if(!K.support.checkClone&&arguments.length===3&&typeof i=="string"&&zb.test(i))return this.each(function(){K(this).domManip(a,c,d,!0)});if(K.isFunction(i))return this.each(function(e){var f=K(this);a[0]=i.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){h=i&&i.parentNode,K.support.parentNode&&h&&h.nodeType===11&&h.childNodes.length===this.length?e={fragment:h}:e=K.buildFragment(a,this,j),g=e.fragment,g.childNodes.length===1?f=g=g.firstChild:f=g.firstChild;if(f){c=c&&K.nodeName(f,"tr");for(var k=0,l=this.length,m=l-1;k<l;k++)d.call(c?x(this[k],f):this[k],e.cacheable||l>1&&k<m?K.clone(g,!0,!0):g)}j.length&&K.each(j,q)}return this}}),K.buildFragment=function(a,b,c){var d,e,f,g,h=a[0];return b&&b[0]&&(g=b[0].ownerDocument||b[0]),g.createDocumentFragment||(g=H),a.length===1&&typeof h=="string"&&h.length<512&&g===H&&h.charAt(0)==="<"&&!xb.test(h)&&(K.support.checkClone||!zb.test(h))&&(K.support.html5Clone||!yb.test(h))&&(e=!0,f=K.fragments[h],f&&f!==1&&(d=f)),d||(d=g.createDocumentFragment(),K.clean(a,g,d,c)),e&&(K.fragments[h]=f?d:1),{fragment:d,cacheable:e}},K.fragments={},K.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){K.fn[a]=function(c){var d=[],e=K(c),f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&e.length===1)return e[b](this[0]),this;for(var g=0,h=e.length;g<h;g++){var i=(g>0?this.clone(!0):this).get();K(e[g])[b](i),d=d.concat(i)}return this.pushStack(d,a,e.selector)}}),K.extend({clone:function(a,b,c){var d,e,f,g=K.support.html5Clone||!yb.test("<"+a.nodeName)?a.cloneNode(!0):r(a);if((!K.support.noCloneEvent||!K.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!K.isXMLDoc(a)){v(a,g),d=u(a),e=u(g);for(f=0;d[f];++f)e[f]&&v(d[f],e[f])}if(b){w(a,g);if(c){d=u(a),e=u(g);for(f=0;d[f];++f)w(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var e;b=b||H,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||H);var f=[],g;for(var h=0,i;(i=a[h])!=null;h++){typeof i=="number"&&(i+="");if(!i)continue;if(typeof i=="string")if(!vb.test(i))i=b.createTextNode(i);else{i=i.replace(sb,"<$1></$2>");var j=(tb.exec(i)||["",""])[1].toLowerCase(),k=Cb[j]||Cb._default,l=k[0],m=b.createElement("div");b===H?Db.appendChild(m):y(b).appendChild(m),m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!K.support.tbody){var n=ub.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(g=o.length-1;g>=0;--g)K.nodeName(o[g],"tbody")&&!o[g].childNodes.length&&o[g].parentNode.removeChild(o[g])}!K.support.leadingWhitespace&&rb.test(i)&&m.insertBefore(b.createTextNode(rb.exec(i)[0]),m.firstChild),i=m.childNodes}var p;if(!K.support.appendChecked)if(i[0]&&typeof (p=i.length)=="number")for(g=0;g<p;g++)s(i[g]);else s(i);i.nodeType?f.push(i):f=K.merge(f,i)}if(c){e=function(a){return!a.type||Ab.test(a.type)};for(h=0;f[h];h++)if(d&&K.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))d.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{if(f[h].nodeType===1){var q=K.grep(f[h].getElementsByTagName("script"),e);f.splice.apply(f,[h+1,0].concat(q))}c.appendChild(f[h])}}return f},cleanData:function(a){var b,c,d=K.cache,e=K.event.special,f=K.support.deleteExpando;for(var g=0,h;(h=a[g])!=null;g++){if(h.nodeName&&K.noData[h.nodeName.toLowerCase()])continue;c=h[K.expando];if(c){b=d[c];if(b&&b.events){for(var i in b.events)e[i]?K.event.remove(h,i):K.removeEvent(h,i,b.handle);b.handle&&(b.handle.elem=null)}f?delete h[K.expando]:h.removeAttribute&&h.removeAttribute(K.expando),delete d[c]}}}});var Eb=/alpha\([^)]*\)/i,Fb=/opacity=([^)]*)/,Gb=/([A-Z]|^ms)/g,Hb=/^-?\d+(?:px)?$/i,Ib=/^-?\d/,Jb=/^([\-+])=([\-+.\de]+)/,Kb={position:"absolute",visibility:"hidden",display:"block"},Lb=["Left","Right"],Mb=["Top","Bottom"],Nb,Ob,Pb;K.fn.css=function(a,c){return arguments.length===2&&c===b?this:K.access(this,a,c,!0,function(a,c,d){return d!==b?K.style(a,c,d):K.css(a,c)})},K.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Nb(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":K.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var f,g,h=K.camelCase(c),i=a.style,j=K.cssHooks[h];c=K.cssProps[h]||h;if(d===b)return j&&"get"in j&&(f=j.get(a,!1,e))!==b?f:i[c];g=typeof d,g==="string"&&(f=Jb.exec(d))&&(d=+(f[1]+1)*+f[2]+parseFloat(K.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!K.cssNumber[h]&&(d+="px");if(!j||!("set"in j)||(d=j.set(a,d))!==b)try{i[c]=d}catch(k){}}},css:function(a,c,d){var e,f;c=K.camelCase(c),f=K.cssHooks[c],c=K.cssProps[c]||c,c==="cssFloat"&&(c="float");if(f&&"get"in f&&(e=f.get(a,!0,d))!==b)return e;if(Nb)return Nb(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),K.curCSS=K.css,K.each(["height","width"],function(a,b){K.cssHooks[b]={get:function(a,c,d){var e;if(c)return a.offsetWidth!==0?p(a,b,d):(K.swap(a,Kb,function(){e=p(a,b,d)}),e)},set:function(a,b){if(!Hb.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),K.support.opacity||(K.cssHooks.opacity={get:function(a,b){return Fb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=K.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&K.trim(f.replace(Eb,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=Eb.test(f)?f.replace(Eb,e):f+" "+e}}),K(function(){K.support.reliableMarginRight||(K.cssHooks.marginRight={get:function(a,b){var c;return K.swap(a,{display:"inline-block"},function(){b?c=Nb(a,"margin-right","marginRight"):c=a.style.marginRight}),c}})}),H.defaultView&&H.defaultView.getComputedStyle&&(Ob=function(a,b){var c,d,e;return b=b.replace(Gb,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!K.contains(a.ownerDocument.documentElement,a)&&(c=K.style(a,b))),c}),H.documentElement.currentStyle&&(Pb=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;return f===null&&g&&(e=g[b])&&(f=e),!Hb.test(f)&&Ib.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d)),f===""?"auto":f}),Nb=Ob||Pb,K.expr&&K.expr.filters&&(K.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!K.support.reliableHiddenOffsets&&(a.style&&a.style.display||K.css(a,"display"))==="none"},K.expr.filters.visible=function(a){return!K.expr.filters.hidden(a)});var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/#.*$/,Ub=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,Vb=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,Wb=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Xb=/^(?:GET|HEAD)$/,Yb=/^\/\//,Zb=/\?/,$b=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,_b=/^(?:select|textarea)/i,ac=/\s+/,bc=/([?&])_=[^&]*/,cc=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,dc=K.fn.load,ec={},fc={},gc,hc,ic=["*/"]+["*"];try{gc=J.href}catch(jc){gc=H.createElement("a"),gc.href="",gc=gc.href}hc=cc.exec(gc.toLowerCase())||[],K.fn.extend({load:function(a,c,d){if(typeof a!="string"&&dc)return dc.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}var g="GET";c&&(K.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=K.param(c,K.ajaxSettings.traditional),g="POST"));var h=this;return K.ajax({url:a,type:g,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),h.html(f?K("<div>").append(c.replace($b,"")).find(f):c)),d&&h.each(d,[c,b,a])}}),this},serialize:function(){return K.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?K.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||_b.test(this.nodeName)||Vb.test(this.type))}).map(function(a,b){var c=K(this).val();return c==null?null:K.isArray(c)?K.map(c,function(a,c){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),K.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){K.fn[b]=function(a){return this.on(b,a)}}),K.each(["get","post"],function(a,c){K[c]=function(a,d,e,f){return K.isFunction(d)&&(f=f||e,e=d,d=b),K.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),K.extend({getScript:function(a,c){return K.get(a,b,c,"script")},getJSON:function(a,b,c){return K.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?m(a,K.ajaxSettings):(b=a,a=K.ajaxSettings),m(a,b),a},ajaxSettings:{url:gc,isLocal:Wb.test(hc[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":ic},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":K.parseJSON,"text xml":K.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:o(ec),ajaxTransport:o(fc),ajax:function(a,c){function d(a,c,d,n){if(v!==2){v=2,t&&clearTimeout(t),s=b,q=n||"",y.readyState=a>0?4:0;var o,p,r,u=c,x=d?k(e,y,d):b,z,A;if(a>=200&&a<300||a===304){if(e.ifModified){if(z=y.getResponseHeader("Last-Modified"))K.lastModified[m]=z;if(A=y.getResponseHeader("Etag"))K.etag[m]=A}if(a===304)u="notmodified",o=!0;else try{p=j(e,x),u="success",o=!0}catch(B){u="parsererror",r=B}}else{r=u;if(!u||a)u="error",a<0&&(a=0)}y.status=a,y.statusText=""+(c||u),o?h.resolveWith(f,[p,u,y]):h.rejectWith(f,[y,u,r]),y.statusCode(l),l=b,w&&g.trigger("ajax"+(o?"Success":"Error"),[y,e,o?p:r]),i.fireWith(f,[y,u]),w&&(g.trigger("ajaxComplete",[y,e]),--K.active||K.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var e=K.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof K)?K(f):K.event,h=K.Deferred(),i=K.Callbacks("once memory"),l=e.statusCode||{},m,o={},p={},q,r,s,t,u,v=0,w,x,y={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=p[c]=p[c]||a,o[a]=b}return this},getAllResponseHeaders:function(){return v===2?q:null},getResponseHeader:function(a){var c;if(v===2){if(!r){r={};while(c=Ub.exec(q))r[c[1].toLowerCase()]=c[2]}c=r[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(e.mimeType=a),this},abort:function(a){return a=a||"abort",s&&s.abort(a),d(0,a),this}};h.promise(y),y.success=y.done,y.error=y.fail,y.complete=i.add,y.statusCode=function(a){if(a){var b;if(v<2)for(b in a)l[b]=[l[b],a[b]];else b=a[y.status],y.then(b,b)}return this},e.url=((a||e.url)+"").replace(Tb,"").replace(Yb,hc[1]+"//"),e.dataTypes=K.trim(e.dataType||"*").toLowerCase().split(ac),e.crossDomain==null&&(u=cc.exec(e.url.toLowerCase()),e.crossDomain=!(!u||u[1]==hc[1]&&u[2]==hc[2]&&(u[3]||(u[1]==="http:"?80:443))==(hc[3]||(hc[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!="string"&&(e.data=K.param(e.data,e.traditional)),n(ec,e,c,y);if(v===2)return!1;w=e.global,e.type=e.type.toUpperCase(),e.hasContent=!Xb.test(e.type),w&&K.active++===0&&K.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(Zb.test(e.url)?"&":"?")+e.data,delete e.data),m=e.url;if(e.cache===!1){var z=K.now(),A=e.url.replace(bc,"$1_="+z);e.url=A+(A===e.url?(Zb.test(e.url)?"&":"?")+"_="+z:"")}}(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",e.contentType),e.ifModified&&(m=m||e.url,K.lastModified[m]&&y.setRequestHeader("If-Modified-Since",K.lastModified[m]),K.etag[m]&&y.setRequestHeader("If-None-Match",K.etag[m])),y.setRequestHeader("Accept",e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", "+ic+"; q=0.01":""):e.accepts["*"]);for(x in e.headers)y.setRequestHeader(x,e.headers[x]);if(!e.beforeSend||e.beforeSend.call(f,y,e)!==!1&&v!==2){for(x in{success:1,error:1,complete:1})y[x](e[x]);s=n(fc,e,c,y);if(!s)d(-1,"No Transport");else{y.readyState=1,w&&g.trigger("ajaxSend",[y,e]),e.async&&e.timeout>0&&(t=setTimeout(function(){y.abort("timeout")},e.timeout));try{v=1,s.send(o,d)}catch(B){if(!(v<2))throw B;d(-1,B)}}return y}return y.abort(),!1},param:function(a,c){var d=[],e=function(a,b){b=K.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=K.ajaxSettings.traditional);if(K.isArray(a)||a.jquery&&!K.isPlainObject(a))K.each(a,function(){e(this.name,this.value)});else for(var f in a)l(f,a[f],c,e);return d.join("&").replace(Qb,"+")}}),K.extend({active:0,lastModified:{},etag:{}});var kc=K.now(),lc=/(\=)\?(&|$)|\?\?/i;K.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return K.expando+"_"+kc++}}),K.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(lc.test(b.url)||e&&lc.test(b.data))){var f,g=b.jsonpCallback=K.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h=a[g],i=b.url,j=b.data,k="$1"+g+"$2";return b.jsonp!==!1&&(i=i.replace(lc,k),b.url===i&&(e&&(j=j.replace(lc,k)),b.data===j&&(i+=(/\?/.test(i)?"&":"?")+b.jsonp+"="+g))),b.url=i,b.data=j,a[g]=function(a){f=[a]},d.always(function(){a[g]=h,f&&K.isFunction(h)&&a[g](f[0])}),b.converters["script json"]=function(){return f||K.error(g+" was not called"),f[0]},b.dataTypes[0]="json","script"}}),K.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return K.globalEval(a),a}}}),K.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),K.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=H.head||H.getElementsByTagName("head")[0]||H.documentElement;return{send:function(e,f){c=H.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||f(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var mc=a.ActiveXObject?function(){for(var a in oc)oc[a](0,1)}:!1,nc=0,oc;K.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&i()||h()}:i,function(a){K.extend(K.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(K.ajaxSettings.xhr()),K.support.ajax&&K.ajaxTransport(function(c){if(!c.crossDomain||K.support.cors){var d;return{send:function(e,f){var g=c.xhr(),h,i;c.username?g.open(c.type,c.url,c.async,c.username,c.password):g.open(c.type,c.url,c.async);if(c.xhrFields)for(i in c.xhrFields)g[i]=c.xhrFields[i];c.mimeType&&g.overrideMimeType&&g.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(c.hasContent&&c.data||null),d=function(a,e){var i,j,k,l,m;try{if(d&&(e||g.readyState===4)){d=b,h&&(g.onreadystatechange=K.noop,mc&&delete oc[h]);if(e)g.readyState!==4&&g.abort();else{i=g.status,k=g.getAllResponseHeaders(),l={},m=g.responseXML,m&&m.documentElement&&(l.xml=m),l.text=g.responseText;try{j=g.statusText}catch(n){j=""}!i&&c.isLocal&&!c.crossDomain?i=l.text?200:404:i===1223&&(i=204)}}}catch(o){e||f(-1,o)}l&&f(i,j,l,k)},!c.async||g.readyState===4?d():(h=++nc,mc&&(oc||(oc={},K(a).unload(mc)),oc[h]=d),g.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var pc={},qc,rc,sc=/^(?:toggle|show|hide)$/,tc=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,uc,vc=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],wc;K.fn.extend({show:function(a,b,c){var f,g;if(a||a===0)return this.animate(e("show",3),a,b,c);for(var h=0,i=this.length;h<i;h++)f=this[h],f.style&&(g=f.style.display,!K._data(f,"olddisplay")&&g==="none"&&(g=f.style.display=""),g===""&&K.css(f,"display")==="none"&&K._data(f,"olddisplay",d(f.nodeName)));for(h=0;h<i;h++){f=this[h];if(f.style){g=f.style.display;if(g===""||g==="none")f.style.display=K._data(f,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(e("hide",3),a,b,c);var d,f,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(f=K.css(d,"display"),f!=="none"&&!K._data(d,"olddisplay")&&K._data(d,"olddisplay",f));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:K.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";return K.isFunction(a)&&K.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:K(this).is(":hidden");K(this)[b?"show":"hide"]()}):this.animate(e("toggle",3),a,b,c),this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){function f(){g.queue===!1&&K._mark(this);var b=K.extend({},g),c=this.nodeType===1,e=c&&K(this).is(":hidden"),f,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){f=K.camelCase(i),i!==f&&(a[f]=a[i],delete a[i]),h=a[f],K.isArray(h)?(b.animatedProperties[f]=h[1],h=a[f]=h[0]):b.animatedProperties[f]=b.specialEasing&&b.specialEasing[f]||b.easing||"swing";if(h==="hide"&&e||h==="show"&&!e)return b.complete.call(this);c&&(f==="height"||f==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],K.css(this,"display")==="inline"&&K.css(this,"float")==="none"&&(!K.support.inlineBlockNeedsLayout||d(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new K.fx(this,b,i),h=a[i],sc.test(h)?(o=K._data(this,"toggle"+i)||(h==="toggle"?e?"show":"hide":0),o?(K._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=tc.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(K.cssNumber[i]?"":"px"),n!=="px"&&(K.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,K.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var g=K.speed(b,c,e);return K.isEmptyObject(a)?this.each(g.complete,[!1]):(a=K.extend({},a),g.queue===!1?this.each(f):this.queue(g.queue,f))},stop:function(a,c,d){return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){function b(a,b,c){var e=b[c];K.removeData(a,c,!0),e.stop(d)}var c,e=!1,f=K.timers,g=K._data(this);d||K._unmark(!0,this);if(a==null)for(c in g)g[c]&&g[c].stop&&c.indexOf(".run")===c.length-4&&b(this,g,c);else g[c=a+".run"]&&g[c].stop&&b(this,g,c);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(d?f[c](!0):f[c].saveState(),e=!0,f.splice(c,1));(!d||!e)&&K.dequeue(this,a)})}}),K.each({slideDown:e("show",1),slideUp:e("hide",1),slideToggle:e("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){K.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),K.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?K.extend({},a):{complete:c||!c&&b||K.isFunction(a)&&a,duration:a,easing:c&&b||b&&!K.isFunction(b)&&b};d.duration=K.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in K.fx.speeds?K.fx.speeds[d.duration]:K.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(a){K.isFunction(d.old)&&d.old.call(this),d.queue?K.dequeue(this,d.queue):a!==!1&&K._unmark(this)},d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),K.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(K.fx.step[this.prop]||K.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]==null||!!this.elem.style&&this.elem.style[this.prop]!=null){var a,b=K.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a}return this.elem[this.prop]},custom:function(a,c,d){function e(a){return f.step(a)}var f=this,h=K.fx;this.startTime=wc||g(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(K.cssNumber[this.prop]?"":"px"),e.queue=this.options.queue,e.elem=this.elem,e.saveState=function(){f.options.hide&&K._data(f.elem,"fxshow"+f.prop)===b&&K._data(f.elem,"fxshow"+f.prop,f.start)},e()&&K.timers.push(e)&&!uc&&(uc=setInterval(h.tick,h.interval))},show:function(){var a=K._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||K.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),K(this.elem).show()},hide:function(){this.options.orig[this.prop]=K._data(this.elem,"fxshow"+this.prop)||K.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=wc||g(),f=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(f=!1);if(f){i.overflow!=null&&!K.support.shrinkWrapBlocks&&K.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&K(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)K.style(h,b,i.orig[b]),K.removeData(h,"fxshow"+b,!0),K.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}return i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=K.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update(),!0}},K.extend(K.fx,{tick:function(){var a,b=K.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||K.fx.stop()},interval:13,stop:function(){clearInterval(uc),uc=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){K.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),K.each(["width","height"],function(a,b){K.fx.step[b]=function(a){K.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),K.expr&&K.expr.filters&&(K.expr.filters.animated=function(a){return K.grep(K.timers,function(b){return a===b.elem}).length});var xc=/^t(?:able|d|h)$/i,yc=/^(?:body|html)$/i;"getBoundingClientRect"in H.documentElement?K.fn.offset=function(a){var b=this[0],d;if(a)return this.each(function(b){K.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return K.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!d||!K.contains(g,b))return d?{top:d.top,left:d.left}:{top:0,left:0};var h=f.body,i=c(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||K.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||K.support.boxModel&&g.scrollLeft||h.scrollLeft,n=d.top+l-j,o=d.left+m-k;return{top:n,left:o}}:K.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){K.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return K.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,f=b.ownerDocument,g=f.documentElement,h=f.body,i=f.defaultView,j=i?i.getComputedStyle(b,null):b.currentStyle,k=b.offsetTop,l=b.offsetLeft;while((b=b.parentNode)&&b!==h&&b!==g){if(K.support.fixedPosition&&j.position==="fixed")break;c=i?i.getComputedStyle(b,null):b.currentStyle,k-=b.scrollTop,l-=b.scrollLeft,b===d&&(k+=b.offsetTop,l+=b.offsetLeft,K.support.doesNotAddBorder&&(!K.support.doesAddBorderForTableAndCells||!xc.test(b.nodeName))&&(k+=parseFloat(c.borderTopWidth)||0,l+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),K.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(k+=parseFloat(c.borderTopWidth)||0,l+=parseFloat(c.borderLeftWidth)||0),j=c}if(j.position==="relative"||j.position==="static")k+=h.offsetTop,l+=h.offsetLeft;return K.support.fixedPosition&&j.position==="fixed"&&(k+=Math.max(g.scrollTop,h.scrollTop),l+=Math.max(g.scrollLeft,h.scrollLeft)),{top:k,left:l}},K.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return K.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(K.css(a,"marginTop"))||0,c+=parseFloat(K.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=K.css(a,"position");d==="static"&&(a.style.position="relative");var e=K(a),f=e.offset(),g=K.css(a,"top"),h=K.css(a,"left"),i=(d==="absolute"||d==="fixed")&&K.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),K.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},K.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=yc.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(K.css(a,"marginTop"))||0,c.left-=parseFloat(K.css(a,"marginLeft"))||0,d.top+=parseFloat(K.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(K.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||H.body;while(a&&!yc.test(a.nodeName)&&K.css(a,"position")==="static")a=a.offsetParent;return a})}}),K.each(["Left","Top"],function(a,d){var e="scroll"+d;K.fn[e]=function(d){var f,g;return d===b?(f=this[0],f?(g=c(f),g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:K.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]):null):this.each(function(){g=c(this),g?g.scrollTo(a?K(g).scrollLeft():d,a?d:K(g).scrollTop()):this[e]=d})}}),K.each(["Height","Width"],function(a,c){var d=c.toLowerCase();K.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(K.css(a,d,"padding")):this[d]():null},K.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(K.css(b,d,a?"margin":"border")):this[d]():null},K.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(K.isFunction(a))return this.each(function(b){var c=K(this);c[d](a.call(this,b,c[d]()))});if(K.isWindow(e)){var f=e.document.documentElement["client"+c],g=e.document.body;return e.document.compatMode==="CSS1Compat"&&f||g&&g["client"+c]||f}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=K.css(e,d),i=parseFloat(h);return K.isNumeric(i)?i:h}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=K,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return K})})(window),function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=Function.prototype,g=d.push,h=d.slice,i=d.concat,j=d.unshift,k=e.toString,l=e.hasOwnProperty,m=d.forEach,n=d.map,o=d.reduce,p=d.reduceRight,q=d.filter,r=d.every,s=d.some,t=d.indexOf,u=d.lastIndexOf,v=Array.isArray,w=Object.keys,x=f.bind,y=function(a){if(a instanceof y)return a;if(!(this instanceof y))return new y(a);this._wrapped=a};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=y),exports._=y):a._=y,y.VERSION="1.4.2";var z=y.each=y.forEach=function(a,b,d){if(a==null)return;if(m&&a.forEach===m)a.forEach(b,d);else if(a.length===+a.length){for(var e=0,f=a.length;e<f;e++)if(b.call(d,a[e],e,a)===c)return}else for(var g in a)if(y.has(a,g)&&b.call(d,a[g],g,a)===c)return};y.map=y.collect=function(a,b,c){var d=[];return a==null?d:n&&a.map===n?a.map(b,c):(z(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),d)},y.reduce=y.foldl=y.inject=function(a,b,c,d){var e=arguments.length>2;a==null&&(a=[]);if(o&&a.reduce===o)return d&&(b=y.bind(b,d)),e?a.reduce(b,c):a.reduce(b);z(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},y.reduceRight=y.foldr=function(a,b,c,d){var e=arguments.length>2;a==null&&(a=[]);if(p&&a.reduceRight===p)return d&&(b=y.bind(b,d)),arguments.length>2?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=y.keys(a);f=g.length}z(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},y.find=y.detect=function(a,b,c){var d;return A(a,function(a,e,f){if(b.call(c,a,e,f))return d=a,!0}),d},y.filter=y.select=function(a,b,c){var d=[];return a==null?d:q&&a.filter===q?a.filter(b,c):(z(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},y.reject=function(a,b,c){var d=[];return a==null?d:(z(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)}),d)},y.every=y.all=function(a,b,d){b||(b=y.identity);var e=!0;return a==null?e:r&&a.every===r?a.every(b,d):(z(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c}),!!e)};var A=y.some=y.any=function(a,b,d){b||(b=y.identity);var e=!1;return a==null?e:s&&a.some===s?a.some(b,d):(z(a,function(a,f,g){if(e||(e=b.call(d,a,f,g)))return c}),!!e)};y.contains=y.include=function(a,b){var c=!1;return a==null?c:t&&a.indexOf===t?a.indexOf(b)!=-1:(c=A(a,function(a){return a===b}),c)},y.invoke=function(a,b){var c=h.call(arguments,2);return y.map(a,function(a){return(y.isFunction(b)?b:a[b]).apply(a,c)})},y.pluck=function(a,b){return y.map(a,function(a){return a[b]})},y.where=function(a,b){return y.isEmpty(b)?[]:y.filter(a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},y.max=function(a,b,c){if(!b&&y.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);if(!b&&y.isEmpty(a))return-Infinity;var d={computed:-Infinity};return z(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})}),d.value},y.min=function(a,b,c){if(!b&&y.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);if(!b&&y.isEmpty(a))return Infinity;var d={computed:Infinity};return z(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})}),d.value},y.shuffle=function(a){var b,c=0,d=[];return z(a,function(a){b=y.random(c++),d[c-1]=d[b],d[b]=a}),d};var B=function(a){return y.isFunction(a)?a:function(b){return b[a]}};y.sortBy=function(a,b,c){var d=B(b);return y.pluck(y.map(a,function(a,b,e){return{value:a,index:b,criteria:d.call(c,a,b,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||c===void 0)return 1;if(c<d||d===void 0)return-1}return a.index<b.index?-1:1}),"value")};var C=function(a,b,c,d){var e={},f=B(b);return z(a,function(b,g){var h=f.call(c,b,g,a);d(e,h,b)}),e};y.groupBy=function(a,b,c){return C(a,b,c,function(a,b,c){(y.has(a,b)?a[b]:a[b]=[]).push(c)})},y.countBy=function(a,b,c){return C(a,b,c,function(a,b,c){y.has(a,b)||(a[b]=0),a[b]++})},y.sortedIndex=function(a,b,c,d){c=c==null?y.identity:B(c);var e=c.call(d,b),f=0,g=a.length;while(f<g){var h=f+g>>>1;c.call(d,a[h])<e?f=h+1:g=h}return f},y.toArray=function(a){return a?a.length===+a.length?h.call(a):y.values(a):[]},y.size=function(a){return a.length===+a.length?a.length:y.keys(a).length},y.first=y.head=y.take=function(a,b,c){return b!=null&&!c?h.call(a,0,b):a[0]},y.initial=function(a,b,c){return h.call(a,0,a.length-(b==null||c?1:b))},y.last=function(a,b,c){return b!=null&&!c?h.call(a,Math.max(a.length-b,0)):a[a.length-1]},y.rest=y.tail=y.drop=function(a,b,c){return h.call(a,b==null||c?1:b)},y.compact=function(a){return y.filter(a,function(a){return!!a})};var D=function(a,b,c){return z(
4
+ a,function(a){y.isArray(a)?b?g.apply(c,a):D(a,b,c):c.push(a)}),c};y.flatten=function(a,b){return D(a,b,[])},y.without=function(a){return y.difference(a,h.call(arguments,1))},y.uniq=y.unique=function(a,b,c,d){var e=c?y.map(a,c,d):a,f=[],g=[];return z(e,function(c,d){if(b?!d||g[g.length-1]!==c:!y.contains(g,c))g.push(c),f.push(a[d])}),f},y.union=function(){return y.uniq(i.apply(d,arguments))},y.intersection=function(a){var b=h.call(arguments,1);return y.filter(y.uniq(a),function(a){return y.every(b,function(b){return y.indexOf(b,a)>=0})})},y.difference=function(a){var b=i.apply(d,h.call(arguments,1));return y.filter(a,function(a){return!y.contains(b,a)})},y.zip=function(){var a=h.call(arguments),b=y.max(y.pluck(a,"length")),c=new Array(b);for(var d=0;d<b;d++)c[d]=y.pluck(a,""+d);return c},y.object=function(a,b){var c={};for(var d=0,e=a.length;d<e;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},y.indexOf=function(a,b,c){if(a==null)return-1;var d=0,e=a.length;if(c){if(typeof c!="number")return d=y.sortedIndex(a,b),a[d]===b?d:-1;d=c<0?Math.max(0,e+c):c}if(t&&a.indexOf===t)return a.indexOf(b,c);for(;d<e;d++)if(a[d]===b)return d;return-1},y.lastIndexOf=function(a,b,c){if(a==null)return-1;var d=c!=null;if(u&&a.lastIndexOf===u)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);var e=d?c:a.length;while(e--)if(a[e]===b)return e;return-1},y.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);while(e<d)f[e++]=a,a+=c;return f};var E=function(){};y.bind=function(a,b){var c,d;if(a.bind===x&&x)return x.apply(a,h.call(arguments,1));if(!y.isFunction(a))throw new TypeError;return d=h.call(arguments,2),c=function(){if(this instanceof c){E.prototype=a.prototype;var e=new E,f=a.apply(e,d.concat(h.call(arguments)));return Object(f)===f?f:e}return a.apply(b,d.concat(h.call(arguments)))}},y.bindAll=function(a){var b=h.call(arguments,1);return b.length==0&&(b=y.functions(a)),z(b,function(b){a[b]=y.bind(a[b],a)}),a},y.memoize=function(a,b){var c={};return b||(b=y.identity),function(){var d=b.apply(this,arguments);return y.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},y.delay=function(a,b){var c=h.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},y.defer=function(a){return y.delay.apply(y,[a,1].concat(h.call(arguments,1)))},y.throttle=function(a,b){var c,d,e,f,g,h,i=y.debounce(function(){g=f=!1},b);return function(){c=this,d=arguments;var j=function(){e=null,g&&(h=a.apply(c,d)),i()};return e||(e=setTimeout(j,b)),f?g=!0:(f=!0,h=a.apply(c,d)),i(),h}},y.debounce=function(a,b,c){var d,e;return function(){var f=this,g=arguments,h=function(){d=null,c||(e=a.apply(f,g))},i=c&&!d;return clearTimeout(d),d=setTimeout(h,b),i&&(e=a.apply(f,g)),e}},y.once=function(a){var b=!1,c;return function(){return b?c:(b=!0,c=a.apply(this,arguments),a=null,c)}},y.wrap=function(a,b){return function(){var c=[a];return g.apply(c,arguments),b.apply(this,c)}},y.compose=function(){var a=arguments;return function(){var b=arguments;for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},y.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}},y.keys=w||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)y.has(a,c)&&(b[b.length]=c);return b},y.values=function(a){var b=[];for(var c in a)y.has(a,c)&&b.push(a[c]);return b},y.pairs=function(a){var b=[];for(var c in a)y.has(a,c)&&b.push([c,a[c]]);return b},y.invert=function(a){var b={};for(var c in a)y.has(a,c)&&(b[a[c]]=c);return b},y.functions=y.methods=function(a){var b=[];for(var c in a)y.isFunction(a[c])&&b.push(c);return b.sort()},y.extend=function(a){return z(h.call(arguments,1),function(b){for(var c in b)a[c]=b[c]}),a},y.pick=function(a){var b={},c=i.apply(d,h.call(arguments,1));return z(c,function(c){c in a&&(b[c]=a[c])}),b},y.omit=function(a){var b={},c=i.apply(d,h.call(arguments,1));for(var e in a)y.contains(c,e)||(b[e]=a[e]);return b},y.defaults=function(a){return z(h.call(arguments,1),function(b){for(var c in b)a[c]==null&&(a[c]=b[c])}),a},y.clone=function(a){return y.isObject(a)?y.isArray(a)?a.slice():y.extend({},a):a},y.tap=function(a,b){return b(a),a};var F=function(a,b,c,d){if(a===b)return a!==0||1/a==1/b;if(a==null||b==null)return a===b;a instanceof y&&(a=a._wrapped),b instanceof y&&(b=b._wrapped);var e=k.call(a);if(e!=k.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:a==0?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if(typeof a!="object"||typeof b!="object")return!1;var f=c.length;while(f--)if(c[f]==a)return d[f]==b;c.push(a),d.push(b);var g=0,h=!0;if(e=="[object Array]"){g=a.length,h=g==b.length;if(h)while(g--)if(!(h=F(a[g],b[g],c,d)))break}else{var i=a.constructor,j=b.constructor;if(i!==j&&!(y.isFunction(i)&&i instanceof i&&y.isFunction(j)&&j instanceof j))return!1;for(var l in a)if(y.has(a,l)){g++;if(!(h=y.has(b,l)&&F(a[l],b[l],c,d)))break}if(h){for(l in b)if(y.has(b,l)&&!(g--))break;h=!g}}return c.pop(),d.pop(),h};y.isEqual=function(a,b){return F(a,b,[],[])},y.isEmpty=function(a){if(a==null)return!0;if(y.isArray(a)||y.isString(a))return a.length===0;for(var b in a)if(y.has(a,b))return!1;return!0},y.isElement=function(a){return!!a&&a.nodeType===1},y.isArray=v||function(a){return k.call(a)=="[object Array]"},y.isObject=function(a){return a===Object(a)},z(["Arguments","Function","String","Number","Date","RegExp"],function(a){y["is"+a]=function(b){return k.call(b)=="[object "+a+"]"}}),y.isArguments(arguments)||(y.isArguments=function(a){return!!a&&!!y.has(a,"callee")}),typeof /./!="function"&&(y.isFunction=function(a){return typeof a=="function"}),y.isFinite=function(a){return y.isNumber(a)&&isFinite(a)},y.isNaN=function(a){return y.isNumber(a)&&a!=+a},y.isBoolean=function(a){return a===!0||a===!1||k.call(a)=="[object Boolean]"},y.isNull=function(a){return a===null},y.isUndefined=function(a){return a===void 0},y.has=function(a,b){return l.call(a,b)},y.noConflict=function(){return a._=b,this},y.identity=function(a){return a},y.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},y.random=function(a,b){return b==null&&(b=a,a=0),a+(0|Math.random()*(b-a+1))};var G={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};G.unescape=y.invert(G.escape);var H={escape:new RegExp("["+y.keys(G.escape).join("")+"]","g"),unescape:new RegExp("("+y.keys(G.unescape).join("|")+")","g")};y.each(["escape","unescape"],function(a){y[a]=function(b){return b==null?"":(""+b).replace(H[a],function(b){return G[a][b]})}}),y.result=function(a,b){if(a==null)return null;var c=a[b];return y.isFunction(c)?c.call(a):c},y.mixin=function(a){z(y.functions(a),function(b){var c=y[b]=a[b];y.prototype[b]=function(){var a=[this._wrapped];return g.apply(a,arguments),M.call(this,c.apply(y,a))}})};var I=0;y.uniqueId=function(a){var b=I++;return a?a+b:b},y.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,K={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},L=/\\|'|\r|\n|\t|\u2028|\u2029/g;y.template=function(a,b,c){c=y.defaults({},c,y.templateSettings);var d=new RegExp([(c.escape||J).source,(c.interpolate||J).source,(c.evaluate||J).source].join("|")+"|$","g"),e=0,f="__p+='";a.replace(d,function(b,c,d,g,h){f+=a.slice(e,h).replace(L,function(a){return"\\"+K[a]}),f+=c?"'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'":d?"'+\n((__t=("+d+"))==null?'':__t)+\n'":g?"';\n"+g+"\n__p+='":"",e=h+b.length}),f+="';\n",c.variable||(f="with(obj||{}){\n"+f+"}\n"),f="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+f+"return __p;\n";try{var g=new Function(c.variable||"obj","_",f)}catch(h){throw h.source=f,h}if(b)return g(b,y);var i=function(a){return g.call(this,a,y)};return i.source="function("+(c.variable||"obj")+"){\n"+f+"}",i},y.chain=function(a){return y(a).chain()};var M=function(a){return this._chain?y(a).chain():a};y.mixin(y),z(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];y.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),(a=="shift"||a=="splice")&&c.length===0&&delete c[0],M.call(this,c)}}),z(["concat","join","slice"],function(a){var b=d[a];y.prototype[a]=function(){return M.call(this,b.apply(this._wrapped,arguments))}}),y.extend(y.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),function(a){var b=String.prototype.trim,c=function(a,b){for(var c=[];b>0;c[--b]=a);return c.join("")},d=function(a){return function(){for(var b=Array.prototype.slice.call(arguments),c=0;c<b.length;c++)b[c]=b[c]==null?"":""+b[c];return a.apply(null,b)}},e=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}var b=function(){return b.cache.hasOwnProperty(arguments[0])||(b.cache[arguments[0]]=b.parse(arguments[0])),b.format.call(null,b.cache[arguments[0]],arguments)};return b.format=function(b,d){var f=1,g=b.length,h="",i=[],j,k,n,o;for(j=0;j<g;j++)if(h=a(b[j]),h==="string")i.push(b[j]);else if(h==="array"){n=b[j];if(n[2]){h=d[f];for(k=0;k<n[2].length;k++){if(!h.hasOwnProperty(n[2][k]))throw e('[_.sprintf] property "%s" does not exist',n[2][k]);h=h[n[2][k]]}}else h=n[1]?d[n[1]]:d[f++];if(/[^s]/.test(n[8])&&a(h)!="number")throw e("[_.sprintf] expecting number but found %s",a(h));switch(n[8]){case"b":h=h.toString(2);break;case"c":h=String.fromCharCode(h);break;case"d":h=parseInt(h,10);break;case"e":h=n[7]?h.toExponential(n[7]):h.toExponential();break;case"f":h=n[7]?parseFloat(h).toFixed(n[7]):parseFloat(h);break;case"o":h=h.toString(8);break;case"s":h=(h=String(h))&&n[7]?h.substring(0,n[7]):h;break;case"u":h=Math.abs(h);break;case"x":h=h.toString(16);break;case"X":h=h.toString(16).toUpperCase()}h=/[def]/.test(n[8])&&n[3]&&h>=0?"+"+h:h,k=n[4]?n[4]=="0"?"0":n[4].charAt(1):" ",o=n[6]-String(h).length,k=n[6]?c(k,o):"",i.push(n[5]?h+k:k+h)}return i.join("")},b.cache={},b.parse=function(a){for(var b=[],c=[],d=0;a;){if((b=/^[^\x25]+/.exec(a))!==null)c.push(b[0]);else if((b=/^\x25{2}/.exec(a))!==null)c.push("%");else{if((b=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(a))===null)throw"[_.sprintf] huh?";if(b[2]){d|=1;var e=[],f=b[2],g=[];if((g=/^([a-z_][a-z_\d]*)/i.exec(f))===null)throw"[_.sprintf] huh?";for(e.push(g[1]);(f=f.substring(g[0].length))!=="";)if((g=/^\.([a-z_][a-z_\d]*)/i.exec(f))!==null)e.push(g[1]);else{if((g=/^\[(\d+)\]/.exec(f))===null)throw"[_.sprintf] huh?";e.push(g[1])}b[2]=e}else d|=2;if(d===3)throw"[_.sprintf] mixing positional and named placeholders is not (yet) supported";c.push(b)}a=a.substring(b[0].length)}return c},b}(),f={VERSION:"1.2.0",isBlank:d(function(a){return/^\s*$/.test(a)}),stripTags:d(function(a){return a.replace(/<\/?[^>]+>/ig,"")}),capitalize:d(function(a){return a.charAt(0).toUpperCase()+a.substring(1).toLowerCase()}),chop:d(function(a,b){for(var b=b*1||0||a.length,c=[],d=0;d<a.length;)c.push(a.slice(d,d+b)),d+=b;return c}),clean:d(function(a){return f.strip(a.replace(/\s+/g," "))}),count:d(function(a,b){for(var c=0,d,e=0;e<a.length;)d=a.indexOf(b,e),d>=0&&c++,e=e+(d>=0?d:0)+b.length;return c}),chars:d(function(a){return a.split("")}),escapeHTML:d(function(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}),unescapeHTML:d(function(a){return a.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}),escapeRegExp:d(function(a){return a.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")}),insert:d(function(a,b,c){return a=a.split(""),a.splice(b*1||0,0,c),a.join("")}),include:d(function(a,b){return a.indexOf(b)!==-1}),join:d(function(a){var b=Array.prototype.slice.call(arguments);return b.join(b.shift())}),lines:d(function(a){return a.split("\n")}),reverse:d(function(a){return Array.prototype.reverse.apply(String(a).split("")).join("")}),splice:d(function(a,b,c,d){return a=a.split(""),a.splice(b*1||0,c*1||0,d),a.join("")}),startsWith:d(function(a,b){return a.length>=b.length&&a.substring(0,b.length)===b}),endsWith:d(function(a,b){return a.length>=b.length&&a.substring(a.length-b.length)===b}),succ:d(function(a){var b=a.split("");return b.splice(a.length-1,1,String.fromCharCode(a.charCodeAt(a.length-1)+1)),b.join("")}),titleize:d(function(a){for(var a=a.split(" "),b,c=0;c<a.length;c++)b=a[c].split(""),typeof b[0]!="undefined"&&(b[0]=b[0].toUpperCase()),c+1===a.length?a[c]=b.join(""):a[c]=b.join("")+" ";return a.join("")}),camelize:d(function(a){return f.trim(a).replace(/(\-|_|\s)+(.)?/g,function(a,b,c){return c?c.toUpperCase():""})}),underscored:function(a){return f.trim(a).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/\-|\s+/g,"_").toLowerCase()},dasherize:function(a){return f.trim(a).replace(/([a-z\d])([A-Z]+)/g,"$1-$2").replace(/^([A-Z]+)/,"-$1").replace(/\_|\s+/g,"-").toLowerCase()},humanize:function(a){return f.capitalize(this.underscored(a).replace(/_id$/,"").replace(/_/g," "))},trim:d(function(a,c){return!c&&b?b.call(a):(c=c?f.escapeRegExp(c):"\\s",a.replace(RegExp("^["+c+"]+|["+c+"]+$","g"),""))}),ltrim:d(function(a,b){return b=b?f.escapeRegExp(b):"\\s",a.replace(RegExp("^["+b+"]+","g"),"")}),rtrim:d(function(a,b){return b=b?f.escapeRegExp(b):"\\s",a.replace(RegExp("["+b+"]+$","g"),"")}),truncate:d(function(a,b,c){return b=b*1||0,a.length>b?a.slice(0,b)+(c||"..."):a}),prune:d(function(a,b,c){var c=c||"...",b=b*1||0,d="",d=a.substring(b-1,b+1).search(/^\w\w$/)===0?f.rtrim(a.slice(0,b).replace(/([\W][\w]*)$/,"")):f.rtrim(a.slice(0,b)),d=d.replace(/\W+$/,"");return d.length+c.length>a.length?a:d+c}),words:function(a,b){return String(a).split(b||" ")},pad:d(function(a,b,d,e){var f="",f=0,b=b*1||0;d?d.length>1&&(d=d.charAt(0)):d=" ";switch(e){case"right":f=b-a.length,f=c(d,f),a+=f;break;case"both":f=b-a.length,f={left:c(d,Math.ceil(f/2)),right:c(d,Math.floor(f/2))},a=f.left+a+f.right;break;default:f=b-a.length,f=c(d,f),a=f+a}return a}),lpad:function(a,b,c){return f.pad(a,b,c)},rpad:function(a,b,c){return f.pad(a,b,c,"right")},lrpad:function(a,b,c){return f.pad(a,b,c,"both")},sprintf:e,vsprintf:function(a,b){return b.unshift(a),e.apply(null,b)},toNumber:function(a,b){var c;return c=(a*1||0).toFixed(b*1||0)*1||0,c!==0||a==="0"||a===0?c:Number.NaN},strRight:d(function(a,b){var c=b?a.indexOf(b):-1;return c!=-1?a.slice(c+b.length,a.length):a}),strRightBack:d(function(a,b){var c=b?a.lastIndexOf(b):-1;return c!=-1?a.slice(c+b.length,a.length):a}),strLeft:d(function(a,b){var c=b?a.indexOf(b):-1;return c!=-1?a.slice(0,c):a}),strLeftBack:d(function(a,b){var c=a.lastIndexOf(b);return c!=-1?a.slice(0,c):a}),exports:function(){var a={},b;for(b in this)this.hasOwnProperty(b)&&b!="include"&&b!="contains"&&b!="reverse"&&(a[b]=this[b]);return a}};f.strip=f.trim,f.lstrip=f.ltrim,f.rstrip=f.rtrim,f.center=f.lrpad,f.ljust=f.lpad,f.rjust=f.rpad,f.contains=f.include,typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(module.exports=f),exports._s=f):typeof a._!="undefined"?(a._.string=f,a._.str=a._.string):a._={string:f,str:f}}(this||window),function(){var a=this,b=a.Backbone,c=Array.prototype.slice,d=Array.prototype.splice,e;e="undefined"!=typeof exports?exports:a.Backbone={},e.VERSION="0.9.1";var f=a._;!f&&"undefined"!=typeof require&&(f=require("underscore"));var g=a.jQuery||a.Zepto||a.ender;e.setDomLibrary=function(a){g=a},e.noConflict=function(){return a.Backbone=b,this},e.emulateHTTP=!1,e.emulateJSON=!1,e.Events={on:function(a,b,c){for(var d,a=a.split(/\s+/),e=this._callbacks||(this._callbacks={});d=a.shift();){d=e[d]||(e[d]={});var f=d.tail||(d.tail=d.next={});f.callback=b,f.context=c,d.tail=f.next={}}return this},off:function(a,b,c){var d,e,f;if(a){if(e=this._callbacks)for(a=a.split(/\s+/);d=a.shift();)if(f=e[d],delete e[d],b&&f)for(;(f=f.next)&&f.next;)(f.callback!==b||!!c&&f.context!==c)&&this.on(d,f.callback,f.context)}else delete this._callbacks;return this},trigger:function(a){var b,d,e,f;if(!(e=this._callbacks))return this;f=e.all;for((a=a.split(/\s+/)).push(null);b=a.shift();)f&&a.push({next:f.next,tail:f.tail,event:b}),(d=e[b])&&a.push({next:d.next,tail:d.tail});for(f=c.call(arguments,1);d=a.pop();){b=d.tail;for(e=d.event?[d.event].concat(f):f;(d=d.next)!==b;)d.callback.apply(d.context||this,e)}return this}},e.Events.bind=e.Events.on,e.Events.unbind=e.Events.off,e.Model=function(a,b){var c;a||(a={}),b&&b.parse&&(a=this.parse(a));if(c=s(this,"defaults"))a=f.extend({},c,a);b&&b.collection&&(this.collection=b.collection),this.attributes={},this._escapedAttributes={},this.cid=f.uniqueId("c");if(!this.set(a,{silent:!0}))throw Error("Can't create an invalid model");delete this._changed,this._previousAttributes=f.clone(this.attributes),this.initialize.apply(this,arguments)},f.extend(e.Model.prototype,e.Events,{idAttribute:"id",initialize:function(){},toJSON:function(){return f.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;return(b=this._escapedAttributes[a])?b:(b=this.attributes[a],this._escapedAttributes[a]=f.escape(null==b?"":""+b))},has:function(a){return null!=this.attributes[a]},set:function(a,b,c){var d,g;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b),c||(c={});if(!d)return this;d instanceof e.Model&&(d=d.attributes);if(c.unset)for(g in d)d[g]=void 0;if(!this._validate(d,c))return!1;this.idAttribute in d&&(this.id=d[this.idAttribute]);var b=this.attributes,h=this._escapedAttributes,i=this._previousAttributes||{},j=this._setting;this._changed||(this._changed={}),this._setting=!0;for(g in d)if(a=d[g],f.isEqual(b[g],a)||delete h[g],c.unset?delete b[g]:b[g]=a,this._changing&&!f.isEqual(this._changed[g],a)&&(this.trigger("change:"+g,this,a,c),this._moreChanges=!0),delete this._changed[g],!f.isEqual(i[g],a)||f.has(b,g)!=f.has(i,g))this._changed[g]=a;return j||(!c.silent&&this.hasChanged()&&this.change(c),this._setting=!1),this},unset:function(a,b){return(b||(b={})).unset=!0,this.set(a,null,b)},clear:function(a){return(a||(a={})).unset=!0,this.set(f.clone(this.attributes),a)},fetch:function(a){var a=a?f.clone(a):{},b=this,c=a.success;return a.success=function(d,e,f){if(!b.set(b.parse(d,f),a))return!1;c&&c(b,d)},a.error=e.wrapError(a.error,b,a),(this.sync||e.sync).call(this,"read",this,a)},save:function(a,b,c){var d,g;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b),c=c?f.clone(c):{},c.wait&&(g=f.clone(this.attributes)),a=f.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?a:c))return!1;var h=this,i=c.success;return c.success=function(a,b,e){b=h.parse(a,e),c.wait&&(b=f.extend(d||{},b));if(!h.set(b,c))return!1;i?i(h,a):h.trigger("sync",h,a,c)},c.error=e.wrapError(c.error,h,c),b=this.isNew()?"create":"update",b=(this.sync||e.sync).call(this,b,this,c),c.wait&&this.set(g,a),b},destroy:function(a){var a=a?f.clone(a):{},b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};if(this.isNew())return d();a.success=function(e){a.wait&&d(),c?c(b,e):b.trigger("sync",b,e,a)},a.error=e.wrapError(a.error,b,a);var g=(this.sync||e.sync).call(this,"delete",this,a);return a.wait||d(),g},url:function(){var a=s(this.collection,"url")||s(this,"urlRoot")||t();return this.isNew()?a:a+("/"==a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(a){if(this._changing||!this.hasChanged())return this;this._moreChanges=this._changing=!0;for(var b in this._changed)this.trigger("change:"+b,this,this._changed[b],a);for(;this._moreChanges;)this._moreChanges=!1,this.trigger("change",this,a);return this._previousAttributes=f.clone(this.attributes),delete this._changed,this._changing=!1,this},hasChanged:function(a){return arguments.length?this._changed&&f.has(this._changed,a):!f.isEmpty(this._changed)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this._changed):!1;var b,c=!1,d=this._previousAttributes,e;for(e in a)f.isEqual(d[e],b=a[e])||((c||(c={}))[e]=b);return c},previous:function(a){return!arguments.length||!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(a,b){if(b.silent||!this.validate)return!0;var a=f.extend({},this.attributes,a),c=this.validate(a,b);return c?(b&&b.error?b.error(this,c,b):this.trigger("error",this,c,b),!1):!0}}),e.Collection=function(a,b){b||(b={}),b.comparator&&(this.comparator=b.comparator),this._reset(),this.initialize.apply(this,arguments),a&&this.reset(a,{silent:!0,parse:b.parse})},f.extend(e.Collection.prototype,e.Events,{model:e.Model,initialize:function(){},toJSON:function(){return this.map(function(a){return a.toJSON()})},add:function(a,b){var c,e,g,h,i,j={},k={};b||(b={}),a=f.isArray(a)?a.slice():[a];for(c=0,e=a.length;c<e;c++){if(!(g=a[c]=this._prepareModel(a[c],b)))throw Error("Can't add an invalid model to a collection");if(j[h=g.cid]||this._byCid[h]||null!=(i=g.id)&&(k[i]||this._byId[i]))throw Error("Can't add the same model to a collection twice");j[h]=k[i]=g}for(c=0;c<e;c++)(g=a[c]).on("all",this._onModelEvent,this),this._byCid[g.cid]=g,null!=g.id&&(this._byId[g.id]=g);this.length+=e,d.apply(this.models,[null!=b.at?b.at:this.models.length,0].concat(a)),this.comparator&&this.sort({silent:!0});if(b.silent)return this;for(c=0,e=this.models.length;c<e;c++)j[(g=this.models[c]).cid]&&(b.index=c,g.trigger("add",g,this,b));return this},remove:function(a,b){var c,d,e,g;b||(b={}),a=f.isArray(a)?a.slice():[a];for(c=0,d=a.length;c<d;c++)if(g=this.getByCid(a[c])||this.get(a[c]))delete this._byId[g.id],delete this._byCid[g.cid],e=this.indexOf(g),this.models.splice(e,1),this.length--,b.silent||(b.index=e,g.trigger("remove",g,this,b)),this._removeReference(g);return this},get:function(a){return null==a?null:this._byId[null!=a.id?a.id:a]},getByCid:function(a){return a&&this._byCid[a.cid||a]},at:function(a){return this.models[a]},sort:function(a){a||(a={});if(!this.comparator)throw Error("Cannot sort a set without a comparator");var b=f.bind(this.comparator,this);return 1==this.comparator.length?this.models=this.sortBy(b):this.models.sort(b),a.silent||this.trigger("reset",this,a),this},pluck:function(a){return f.map(this.models,function(b){return b.get(a)})},reset:function(a,b){a||(a=[]),b||(b={});for(var c=0,d=this.models.length;c<d;c++)this._removeReference(this.models[c]);return this._reset(),this.add(a,{silent:!0,parse:b.parse}),b.silent||this.trigger("reset",this,b),this},fetch:function(a){a=a?f.clone(a):{},void 0===a.parse&&(a.parse=!0);var b=this,c=a.success;return a.success=function(d,e,f){b[a.add?"add":"reset"](b.parse(d,f),a),c&&c(b,d)},a.error=e.wrapError(a.error,b,a),(this.sync||e.sync).call(this,"read",this,a)},create:function(a,b){var c=this,b=b?f.clone(b):{},a=this._prepareModel(a,b);if(!a)return!1;b.wait||c.add(a,b);var d=b.success;return b.success=function(e,f){b.wait&&c.add(e,b),d?d(e,f):e.trigger("sync",a,f,b)},a.save(null,b),a},parse:function(a){return a},chain:function(){return f(this.models).chain()},_reset:function(){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(a,b){return a instanceof e.Model?a.collection||(a.collection=this):(b.collection=this,a=new this.model(a,b),a._validate(a.attributes,b)||(a=!1)),a},_removeReference:function(a){this==a.collection&&delete a.collection,a.off("all",this._onModelEvent,this)},_onModelEvent:function(a,b,c,d){("add"==a||"remove"==a)&&c!=this||("destroy"==a&&this.remove(b,d),b&&a==="change:"+b.idAttribute&&(delete this._byId[b.previous(b.idAttribute)],this._byId[b.id]=b),this.trigger.apply(this,arguments))}}),f.each("forEach,each,map,reduce,reduceRight,find,detect,filter,select,reject,every,all,some,any,include,contains,invoke,max,min,sortBy,sortedIndex,toArray,size,first,initial,rest,last,without,indexOf,shuffle,lastIndexOf,isEmpty,groupBy".split(","),function(a){e.Collection.prototype[a]=function(){return f[a].apply(f,[this.models].concat(f.toArray(arguments)))}}),e.Router=function(a){a||(a={}),a.routes&&(this.routes=a.routes),this._bindRoutes(),this.initialize.apply(this,arguments)};var h=/:\w+/g,i=/\*\w+/g,j=/[-[\]{}()+?.,\\^$|#\s]/g;f.extend(e.Router.prototype,e.Events,{initialize:function(){},route:function(a,b,c){return e.history||(e.history=new e.History),f.isRegExp(a)||(a=this._routeToRegExp(a)),c||(c=this[b]),e.history.route(a,f.bind(function(d){d=this._extractParameters(a,d),c&&c.apply(this,d),this.trigger.apply(this,["route:"+b].concat(d)),e.history.trigger("route",this,b,d)},this)),this},navigate:function(a,b){e.history.navigate(a,b)},_bindRoutes:function(){if(this.routes){var a=[],b;for(b in this.routes)a.unshift([b,this.routes[b]]);b=0;for(var c=a.length;b<c;b++)this.route(a[b][0],a[b][1],this[a[b][1]])}},_routeToRegExp:function(a){return a=a.replace(j,"\\$&").replace(h,"([^/]+)").replace(i,"(.*?)"),RegExp("^"+a+"$")},_extractParameters:function(a,b){return a.exec(b).slice(1)}}),e.History=function(){this.handlers=[],f.bindAll(this,"checkUrl")};var k=/^[#\/]/,l=/msie [\w.]+/,m=!1;f.extend(e.History.prototype,e.Events,{interval:50,getFragment:function(a,b){if(null==a)if(this._hasPushState||b){var a=window.location.pathname,c=window.location.search;c&&(a+=c)}else a=window.location.hash;return a=decodeURIComponent(a),a.indexOf(this.options.root)||(a=a.substr(this.options.root.length)),a.replace(k,"")},start:function(a){if(m)throw Error("Backbone.history has already been started");this.options=f.extend({},{root:"/"},this.options,a),this._wantsHashChange=!1!==this.options.hashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.options.pushState||!window.history||!window.history.pushState);var a=this.getFragment(),b=document.documentMode;if(b=l.exec(navigator.userAgent.toLowerCase())&&(!b||7>=b))this.iframe=g('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(a);this._hasPushState?g(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!b?g(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=a,m=!0,a=window.location,b=a.pathname==this.options.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!b)return this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&b&&a.hash&&(this.fragment=a.hash.replace(k,""),window.history.replaceState({},document.title,a.protocol+"//"+a.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},stop:function(){g(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),m=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();a==this.fragment&&this.iframe&&(a=this.getFragment(this.iframe.location.hash));if(a==this.fragment||a==decodeURIComponent(this.fragment))return!1;this.iframe&&this.navigate(a),this.loadUrl()||this.loadUrl(window.location.hash)},loadUrl:function(a){var b=this.fragment=this.getFragment(a);return f.any(this.handlers,function(a){if(a.route.test(b))return a.callback(b),!0})},navigate:function(a,b){if(!m)return!1;if(!b||!0===b)b={trigger:b};var c=(a||"").replace(k,"");this.fragment==c||this.fragment==decodeURIComponent(c)||(this._hasPushState?(0!=c.indexOf(this.options.root)&&(c=this.options.root+c),this.fragment=c,window.history[b.replace?"replaceState":"pushState"]({},document.title,c)):this._wantsHashChange?(this.fragment=c,this._updateHash(window.location,c,b.replace),this.iframe&&c!=this.getFragment(this.iframe.location.hash)&&(b.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,c,b.replace))):window.location.assign(this.options.root+a),b.trigger&&this.loadUrl(a))},_updateHash:function(a,b,c){c?a.replace(a.toString().replace(/(javascript:|#).*$/,"")+"#"+b):a.hash=b}}),e.View=function(a){this.cid=f.uniqueId("view"),this._configure(a||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()};var n=/^(\S+)\s*(.*)$/,o="model,collection,el,id,attributes,className,tagName".split(",");f.extend(e.View.prototype,e.Events,{tagName:"div",$:function(a){return this.$el.find(a)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this},make:function(a,b,c){return a=document.createElement(a),b&&g(a).attr(b),c&&g(a).html(c),a},setElement:function(a,b){return this.$el=g(a),this.el=this.$el[0],!1!==b&&this.delegateEvents(),this},delegateEvents:function(a){if(a||(a=s(this,"events"))){this.undelegateEvents();for(var b in a){var c=a[b];f.isFunction(c)||(c=this[a[b]]);if(!c)throw Error('Event "'+a[b]+'" does not exist');var d=b.match(n),e=d[1],d=d[2],c=f.bind(c,this),e=e+(".delegateEvents"+this.cid);""===d?this.$el.bind(e,c):this.$el.delegate(d,e,c)}}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(a){this.options&&(a=f.extend({},this.options,a));for(var b=0,c=o.length;b<c;b++){var d=o[b];a[d]&&(this[d]=a[d])}this.options=a},_ensureElement:function(){if(this.el)this.setElement(this.el,!1);else{var a=s(this,"attributes")||{};this.id&&(a.id=this.id),this.className&&(a["class"]=this.className),this.setElement(this.make(this.tagName,a),!1)}}}),e.Model.extend=e.Collection.extend=e.Router.extend=e.View.extend=function(a,b){var c=r(this,a,b);return c.extend=this.extend,c};var p={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};e.sync=function(a,b,c){var d=p[a],h={type:d,dataType:"json"};return c.url||(h.url=s(b,"url")||t()),!c.data&&b&&("create"==a||"update"==a)&&(h.contentType="application/json",h.data=JSON.stringify(b.toJSON())),e.emulateJSON&&(h.contentType="application/x-www-form-urlencoded",h.data=h.data?{model:h.data}:{}),e.emulateHTTP&&("PUT"===d||"DELETE"===d)&&(e.emulateJSON&&(h.data._method=d),h.type="POST",h.beforeSend=function(a){a.setRequestHeader("X-HTTP-Method-Override",d)}),"GET"!==h.type&&!e.emulateJSON&&(h.processData=!1),g.ajax(f.extend(h,c))},e.wrapError=function(a,b,c){return function(d,e){e=d===b?e:d,a?a(b,e,c):b.trigger("error",b,e,c)}};var q=function(){},r=function(a,b,c){var d;return d=b&&b.hasOwnProperty("constructor")?b.constructor:function(){a.apply(this,arguments)},f.extend(d,a),q.prototype=a.prototype,d.prototype=new q,b&&f.extend(d.prototype,b),c&&f.extend(d,c),d.prototype.constructor=d,d.__super__=a.prototype,d},s=function(a,b){return!a||!a[b]?null:f.isFunction(a[b])?a[b]():a[b]},t=function(){throw Error('A "url" property or function must be specified')}}.call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]===a)return b;return-1};f=function(a){var b,c,d,e,f,g;g=[];for(b in a){d=a[b],c={key:b};if(_.isRegExp(d))c.type="$regex",c.value=d;else if(_(d).isObject())for(e in d)f=d[e],k(e,f)&&(c.type=e,c.value=f);else c.type="$equal",c.value=d;g.push(c)}return g},k=function(a,b){switch(a){case"$in":case"$nin":case"$all":case"$any":return _(b).isArray();case"$size":return _(b).isNumber();case"$regex":return _(b).isRegExp();case"$like":case"$likeI":return _(b).isString();case"$between":return _(b).isArray()&&b.length===2;case"$cb":return _(b).isFunction();default:return!0}},j=function(a,b){switch(a){case"$like":case"$likeI":case"$regex":return _(b).isString();case"$contains":case"$all":case"$any":return _(b).isArray();case"$size":return _(b).isArray()||_(b).isString();case"$in":case"$nin":return b!=null;default:return!0}},g=function(a,b,c,d){switch(a){case"$equal":return c===b;case"$contains":return l.call(c,b)>=0;case"$ne":return c!==b;case"$lt":return c<b;case"$gt":return c>b;case"$lte":return c<=b;case"$gte":return c>=b;case"$between":return b[0]<c&&c<b[1];case"$in":return l.call(b,c)>=0;case"$nin":return l.call(b,c)<0;case"$all":return _(c).all(function(a){return l.call(b,a)>=0});case"$any":return _(c).any(function(a){return l.call(b,a)>=0});case"$size":return c.length===b;case"$exists":case"$has":return c!=null===b;case"$like":return c.indexOf(b)!==-1;case"$likeI":return c.toLowerCase().indexOf(b.toLowerCase())!==-1;case"$regex":return b.test(c);case"$cb":return b.call(d,c);default:return!1}},d=function(a,b,c,d){var e;return e=f(b),_[d](a,function(a){var b,d,f,h,i;for(h=0,i=e.length;h<i;h++){d=e[h],b=a.get(d.key)
5
+ ,f=j(d.type,b),f&&(f=g(d.type,d.value,b,a));if(c===f)return c}return!c})},h={$and:function(a,b){return d(a,b,!1,"filter")},$or:function(a,b){return d(a,b,!0,"filter")},$nor:function(a,b){return d(a,b,!0,"reject")},$not:function(a,b){return d(a,b,!1,"reject")}},a=function(a,b,d){var e,f,g,h;return g=JSON.stringify(b),e=(h=a._query_cache)!=null?h:a._query_cache={},f=e[g],f||(f=c(a,b,d),e[g]=f),f},b=function(a,b){var c,d,e;return c=_.intersection(["$and","$not","$or","$nor"],_(b).keys()),d=a.models,c.length===0?h.$and(d,b):(e=function(a,c){return h[c](a,b[c])},_.reduce(c,e,d))},c=function(a,c,d){var e;return e=b(a,c),d.sortBy&&(e=i(e,d)),e},i=function(a,b){return _(b.sortBy).isString()?a=_(a).sortBy(function(a){return a.get(b.sortBy)}):_(b.sortBy).isFunction()&&(a=_(a).sortBy(b.sortBy)),b.order==="desc"&&(a=a.reverse()),a},e=function(a,b){var c,d,e,f;return b.offset?e=b.offset:b.page?e=(b.page-1)*b.limit:e=0,c=e+b.limit,d=a.slice(e,c),b.pager&&_.isFunction(b.pager)&&(f=Math.ceil(a.length/b.limit),b.pager(f,d)),d};if(typeof require!="undefined"){if(typeof _=="undefined"||_===null)_=require("underscore");if(typeof Backbone=="undefined"||Backbone===null)Backbone=require("backbone")}Backbone.QueryCollection=Backbone.Collection.extend({query:function(b,d){var f;return d==null&&(d={}),d.cache?f=a(this,b,d):f=c(this,b,d),d.limit&&(f=e(f,d)),f},where:function(a,b){return b==null&&(b={}),new this.constructor(this.query(a,b))},reset_query_cache:function(){return this._query_cache={}}}),typeof exports!="undefined"&&(exports.QueryCollection=Backbone.QueryCollection)}.call(this),function(){}.call(this),!function(a){a(function(){a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){function b(){var b=this,d=setTimeout(function(){b.$element.off(a.support.transition.end),c.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(d),c.call(b)})}function c(a){this.$element.hide().trigger("hidden"),d.call(this)}function d(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),f?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(e,this)):e.call(this)):b&&b()}function e(){this.$backdrop.remove(),this.$backdrop=null}function f(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}var g=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};g.prototype={constructor:g,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;a("body").addClass("modal-open"),this.isShown=!0,f.call(this),d.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(d){d&&d.preventDefault();var e=this;d=a.Event("hide"),this.$element.trigger(d);if(!this.isShown||d.isDefaultPrevented())return;this.isShown=!1,a("body").removeClass("modal-open"),f.call(this),this.$element.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?b.call(this):c.call(this)}},a.fn.modal=function(b){return this.each(function(){var c=a(this),d=c.data("modal"),e=a.extend({},a.fn.modal.defaults,c.data(),typeof b=="object"&&b);d||c.data("modal",d=new g(this,e)),typeof b=="string"?d[b]():e.show&&d.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=g,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){function b(){a(c).parent().removeClass("open")}var c='[data-toggle="dropdown"]',d=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};d.prototype={constructor:d,toggle:function(c){var d=a(this),e,f,g;if(d.is(".disabled, :disabled"))return;return f=d.attr("data-target"),f||(f=d.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,"")),e=a(f),e.length||(e=d.parent()),g=e.hasClass("open"),b(),g||e.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var c=a(this),e=c.data("dropdown");e||c.data("dropdown",e=new d(this)),typeof b=="string"&&e[b].call(c)})},a.fn.dropdown.Constructor=d,a(function(){a("html").on("click.dropdown.data-api",b),a("body").on("click.dropdown",".dropdown form",function(a){a.stopPropagation()}).on("click.dropdown.data-api",c,d.prototype.toggle)})}(window.jQuery),!function(a){var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show)return c.show();clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.hide)return c.hide();clearTimeout(this.timeout),c.hoverState="out",this.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},isHTML:function(a){return typeof a!="string"||a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.isHTML(b)?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function b(){var b=setTimeout(function(){d.off(a.support.transition.end).remove()},500);d.one(a.support.transition.end,function(){clearTimeout(b),d.remove()})}var c=this,d=this.tip();d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?b():d.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0}}(window.jQuery),!function(a){var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.isHTML(b)?"html":"text"](b),a.find(".popover-content > *")[this.isHTML(c)?"html":"text"](c),a.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed").remove()}var d=a(this),e=d.attr("data-target"),f;e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close"));if(b.isDefaultPrevented())return;f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.on(a.support.transition.end,c):c()},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b,c,d,e;if(this.transitioning)return;b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find("> .accordion-group > .in");if(d&&d.length){e=d.data("collapse");if(e&&e.transitioning)return;d.collapse("hide"),e||d.data("collapse",null)}this.$element[b](0),this.transition("addClass",a.Event("show"),"shown"),this.$element[b](this.$element[0][c])},hide:function(){var b;if(this.transitioning)return;b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a!==null?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c.type=="show"&&e.reset(),e.transitioning=0,e.$element.trigger(d)};this.$element.trigger(c);if(c.isDefaultPrevented())return;this.transitioning=1,this.$element[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(a)).change(),this.hide()},updater:function(a){return a},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){return c.matcher(a)}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:if(a.type!="keydown")break;a.preventDefault(),this.prev();break;case 40:if(a.type!="keydown")break;a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery),function(){var a,b=Array.prototype.slice;(window||global).Luca=function(){var a,c,d,e,f,g;f=arguments[0],a=2<=arguments.length?b.call(arguments,1):[];if(_.isString(f)&&(g=Luca.cache(f)))return g;if(_.isString(f)&&(g=Luca.find(f)))return g;if(_.isObject(f)&&f.ctype!=null)return Luca.util.lazyComponent(f);_.isObject(f)&&f.defines&&f["extends"]&&(c=f.defines,e=f["extends"]);if(_.isFunction(d=_(a).last()))return d()},_.extend(Luca,{VERSION:"0.9.65",core:{},containers:{},components:{},modules:{},util:{},fields:{},registry:{},options:{},config:{}}),_.extend(Luca,Backbone.Events),Luca.autoRegister=Luca.config.autoRegister=!0,Luca.developmentMode=Luca.config.developmentMode=!1,Luca.enableGlobalObserver=Luca.config.enableGlobalObserver=!1,Luca.enableBootstrap=Luca.config.enableBootstrap=!0,Luca.config.enhancedViewProperties=!0,Luca.keys={ENTER:13,ESCAPE:27,KEYLEFT:37,KEYUP:38,KEYRIGHT:39,KEYDOWN:40,SPACEBAR:32,FORWARDSLASH:191},Luca.keyMap=_(Luca.keys).inject(function(a,b,c){return a[b]=c.toLowerCase(),a},{}),Luca.find=function(a){return Luca($(a).data("luca-id"))},Luca.supportsEvents=Luca.supportsBackboneEvents=function(a){return Luca.isComponent(a)||_.isFunction(a!=null?a.trigger:void 0)||_.isFunction(a!=null?a.bind:void 0)},Luca.isComponent=function(a){return Luca.isBackboneModel(a)||Luca.isBackboneView(a)||Luca.isBackboneCollection(a)},Luca.isComponentPrototype=function(a){return Luca.isViewPrototype(a)||Luca.isModelPrototype(a)||Luca.isCollectionPrototype(a)},Luca.isBackboneModel=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.set:void 0)&&_.isFunction(a!=null?a.get:void 0)&&_.isObject(a!=null?a.attributes:void 0)},Luca.isBackboneView=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.render:void 0)&&!_.isUndefined(a!=null?a.el:void 0)},Luca.isBackboneCollection=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.fetch:void 0)&&_.isFunction(a!=null?a.reset:void 0)},Luca.isViewPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&a.prototype!=null&&a.prototype.make!=null&&a.prototype.$!=null&&a.prototype.render!=null},Luca.isModelPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&(typeof a.prototype=="function"?a.prototype(a.prototype.save!=null&&a.prototype.changedAttributes!=null):void 0)},Luca.isCollectionPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&a.prototype!=null&&!Luca.isModelPrototype(a)&&a.prototype.reset!=null&&a.prototype.select!=null&&a.prototype.reject!=null},Luca.inheritanceChain=function(a){return _(Luca.parentClasses(a)).map(function(a){return Luca.util.resolve(a)})},Luca.parentClasses=function(a){var b,c,d;return c=[],_.isString(a)&&(a=Luca.util.resolve(a)),c.push(a.displayName||((d=a.prototype)!=null?d.displayName:void 0)||Luca.parentClass(a)),b=function(){var b;b=[];while(Luca.parentClass(a)!=null)b.push(a=Luca.parentClass(a));return b}(),c=c.concat(b),_.uniq(c)},Luca.parentClass=function(a){var b,c,d;b=[],_.isString(a)&&(a=Luca.util.resolve(a));if(Luca.isComponent(a))return a.displayName;if(Luca.isComponentPrototype(a))return typeof (c=a.prototype)._superClass=="function"?(d=c._superClass())!=null?d.displayName:void 0:void 0},Luca.template=function(a,b){var c,d,e,f,g;window.JST||(window.JST={});if(_.isFunction(a))return a(b);d=(g=Luca.templates)!=null?g[a]:void 0,c=typeof JST!="undefined"&&JST!==null?JST[a]:void 0,d==null&&c==null&&(e=new RegExp(""+a+"$"),d=_(Luca.templates).detect(function(a,b){return e.exec(b)}),c=_(JST).detect(function(a,b){return e.exec(b)}));if(!d&&!c)throw"Could not find template named "+a;return f=d||c,b!=null?f(b):f},Luca.available_templates=function(a){var b;return a==null&&(a=""),b=_(Luca.templates).keys(),a.length>0?_(b).select(function(b){return b.match(a)}):b},a={module:function(a,b){_.extend(a,b);if(a.included&&_(a.included).isFunction())return a.included.apply(a)},"delete":function(a,b){var c;return c=a[b],delete a[b],c},idle:function(a,b){var c;return b==null&&(b=1e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleShort:function(a,b){var c;return b==null&&(b=100),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleMedium:function(a,b){var c;return b==null&&(b=2e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleLong:function(a,b){var c;return b==null&&(b=5e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}}},_.mixin(a)}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/bootstrap_form_controls"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="btn-group form-actions">\n <a class="btn btn-primary submit-button">\n <i class="icon icon-ok icon-white"></i>\n Save Changes\n </a>\n <a class="btn reset-button cancel-button">\n <i class="icon icon-remove"></i>\n Cancel\n </a>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/collection_loader_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div id="progress-modal" class="modal" style="display: none">\n <div class="progress progress-info progress-striped active">\n <div class="bar" style="width:0%;"></div>\n </div>\n <div class="message">Initializing...</div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/form_alert"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="',className,'">\n <a class="close" href="#" data-dismiss="alert">x</a>\n ',message,"\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/grid_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="luca-ui-g-view-wrapper">\n <div class="g-view-header"></div>\n <div class="luca-ui-g-view-body">\n <table class="luca-ui-g-view scrollable-table" width="100%" cellpadding=0 cellspacing=0>\n <thead class="fixed"></thead>\n <tbody class="scrollable"></tbody>\n <tfoot></tfoot>\n </table>\n </div>\n <div class="luca-ui-g-view-header"></div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/grid_view_empty_text"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="empty-text empty-text-wrapper">\n <p>',text,"</p>\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/load_mask"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="load-mask">\n <div class="progress progress-striped active">\n <div class="bar" style="width:0%"></div>\n </div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/nav_bar"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="navbar-inner">\n <div class="luca-ui-navbar-body container">\n </div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/components/pagination"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="pagination">\n <a class="btn previous">\n <i class="icon icon-chevron-left"></i>\n </a>\n <div class="pagination-group">\n </div>\n <a class="btn next">\n <i class="icon icon-chevron-right"></i>\n </a>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/basic"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div id="',id,'" class="',classes,'" style="',style,'"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/tab_selector_container"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div id="',cid,'-tab-selector" class="tab-selector-container">\n <ul id="',cid,'-tabs-nav" class="nav nav-tabs">\n ');for(var i=0;i<components.length;i++){__p.push("\n ");var component=components[i];__p.push('\n <li class="tab-selector" data-target="',i,'">\n <a data-target="',i,'">\n ',component.title,"\n </a>\n </li>\n ")}__p.push("\n </ul>\n</div>\n")}return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/tab_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<ul id="',cid,'-tabs-selector" class="nav ',navClass,'"></ul>\n<div id="',cid,'-tab-view-content" class="tab-content"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/containers/toolbar_wrapper"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="luca-ui-toolbar-wrapper" id="',id,'"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/button_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label>&nbsp;</label>\n<input style="',inputStyles,'" class="btn ',input_class,'" value="',input_value,'" type="',input_type,'" id="<%= input_id" />\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/button_field_link"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<a class="btn ',input_class,'">\n '),icon_class.length&&__p.push('\n <i class="',icon_class,'"></i>\n ',input_value,"\n "),__p.push("\n</a>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/checkbox_array"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="control-group">\n <label for="',input_id,'"><%= label =>\n <div class="controls"><div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/checkbox_array_item"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n <input id="',input_id,'" type="checkbox" name="',input_name,'" value="',value,'" />\n</label>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/checkbox_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n <input type="checkbox" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n</label>\n\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/file_upload_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n <input type="file" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n</label>\n\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/hidden_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push(' <input type="hidden" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/select_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n</label>\n<div class="controls">\n <select name="',input_name,'" value="',input_value,'" style="',inputStyles,'" ></select>\n '),helperText&&__p.push('\n <p class="helper-text help-block">\n ',helperText,"\n </p>\n "),__p.push("\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/text_area_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n</label>\n<div class="controls">\n <textarea name="',input_name,'" style="',inputStyles,'" >',input_value,"</textarea>\n "),helperText&&__p.push('\n <p class="helper-text help-block">\n ',helperText,"\n </p>\n "),__p.push("\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/fields/text_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push(""),(typeof label!="undefined"&&typeof hideLabel!="undefined"&&!hideLabel||typeof hideLabel=="undefined")&&__p.push('\n<label class="control-label" for="',input_id,'">',label,"</label>\n"),__p.push('\n\n<div class="controls">\n'),typeof addOn!="undefined"&&__p.push('\n <span class="add-on">',addOn,"</span>\n"),__p.push('\n<input type="text" name="',input_name,'" style="',inputStyles,'" value="',input_value,'" />\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca-src/templates/table_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<thead></thead>\n<tbody class="table-body"></tbody>\n<tfoot></tfoot>\n<caption></caption>\n');return __p.join("")}}.call(this),function(){var currentNamespace,__slice=Array.prototype.slice;Luca.util.resolve=function(a,b){var c;try{b||(b=window||global),c=_(a.split(/\./)).inject(function(a,b){return a=a!=null?a[b]:void 0},b)}catch(d)
6
+ {throw console.log("Error resolving",a,b),d}return c},Luca.util.nestedValue=Luca.util.resolve,Luca.util.argumentsLogger=function(a){return function(){return console.log(a,arguments)}},Luca.util.read=function(){var a,b;return b=arguments[0],a=2<=arguments.length?__slice.call(arguments,1):[],_.isFunction(b)?b.apply(this,a):b},Luca.util.classify=function(a){return a==null&&(a=""),_.string.camelize(_.string.capitalize(a))},Luca.util.hook=function(a){var b,c,d;return a==null&&(a=""),c=a.split(":"),d=c.shift(),c=_(c).map(function(a){return _.string.capitalize(a)}),b=d+c.join("")},Luca.util.isIE=function(){try{return Object.defineProperty({},"",{}),!1}catch(a){return!0}},currentNamespace=window||global,Luca.util.namespace=function(namespace){return namespace==null?currentNamespace:(currentNamespace=_.isString(namespace)?Luca.util.resolve(namespace,window||global):namespace,currentNamespace!=null?currentNamespace:currentNamespace=eval("(window||global)."+namespace+" = {}"))},Luca.util.lazyComponent=function(config){var componentClass,constructor,ctype;_.isObject(config)&&(ctype=config.ctype||config.type),_.isString(config)&&(ctype=config),componentClass=Luca.registry.lookup(ctype);if(!componentClass)throw"Invalid Component Type: "+ctype+". Did you forget to register it?";return constructor=eval(componentClass),new constructor(config)},Luca.util.selectProperties=function(a,b,c){var d;return d=_(b).values(),_(d).select(a)},Luca.util.loadScript=function(a,b){var c;return c=document.createElement("script"),c.type="text/javascript",c.readyState&&(c.onreadystatechange=function(){return c.readyState==="loaded"||c.readyState==="complete"?(c.onreadystatechange=null,b()):c.onload=function(){return b()}}),c.src=a,document.body.appendChild(c)},Luca.util.make=Backbone.View.prototype.make,Luca.util.list=function(a,b,c){var d,e,f,g;b==null&&(b={}),d=c?"ol":"ul",d=Luca.util.make(d,b);if(_.isArray(a))for(f=0,g=a.length;f<g;f++)e=a[f],$(d).append(Luca.util.make("li",{},e));return d.outerHTML},Luca.util.label=function(a,b,c){var d;return a==null&&(a=""),c==null&&(c="label"),d=c,b!=null&&(d+=" "+c+"-"+b),Luca.util.make("span",{"class":d},a)},Luca.util.badge=function(a,b,c){var d;return a==null&&(a=""),c==null&&(c="badge"),d=c,b!=null&&(d+=" "+c+"-"+b),Luca.util.make("span",{"class":d},a)}}.call(this),function(){Luca.DevelopmentToolHelpers={refreshCode:function(){var a;return a=this,_(this.eventHandlerProperties()).each(function(b){return a[b]=a.definitionClass()[b]}),this.autoBindEventHandlers===!0&&this.bindAllEventHandlers(),this.delegateEvents()},eventHandlerProperties:function(){var a;return a=_(this.events).values(),_(a).select(function(a){return _.isString(a)})},eventHandlerFunctions:function(){var a,b=this;return a=_(this.events).values(),_(a).map(function(a){return _.isFunction(a)?a:b[a]})}}}.call(this),function(){var a,b=Array.prototype.slice;a=function(){function a(a,b,c){var d;this.object=a,c==null&&(c=!0),_.isFunction(b)?d=b:_.isString(b)&&_.isFunction(this.object[b])&&(d=this.object[b]);if(!_.isFunction(d))throw"Must pass a function or a string representing one";c===!0?this.fn=_.bind(function(){return _.defer(d)},this.object):this.fn=_.bind(d,this.object),this}return a.prototype.until=function(a,b){return a!=null&&b==null&&(b=a,a=this.object),a.once(b,this.fn),this.object},a}(),Luca.Events={defer:function(b,c){return c==null&&(c=!0),new a(this,b,c)},once:function(a,b,c){var d;return c||(c=this),d=function(){return b.apply(c,arguments),this.unbind(a,d)},this.bind(a,d)}},Luca.EventsExt={waitUntil:function(a,b){return this.waitFor.call(this,a,b)},waitFor:function(a,c){var d,e;return e=this,d={on:function(b){return b.waitFor.call(b,a,c)},and:function(){var d,f,g,h,i;f=1<=arguments.length?b.call(arguments,0):[],i=[];for(g=0,h=f.length;g<h;g++)d=f[g],d=_.isFunction(d)?d:e[d],i.push(e.once(a,d,c));return i},andThen:function(){return e.and.apply(e,arguments)}}},relayEvent:function(a){var c=this;return{on:function(){var d;return d=1<=arguments.length?b.call(arguments,0):[],{to:function(){var e,f,g,h,i,j;g=1<=arguments.length?b.call(arguments,0):[],j=[];for(h=0,i=g.length;h<i;h++)f=g[h],j.push(function(){var c,g,h,i=this;h=[];for(c=0,g=d.length;c<g;c++)e=d[c],h.push(e.on(a,function(){var c;return c=1<=arguments.length?b.call(arguments,0):[],c.unshift(a),f.trigger.apply(f,c)}));return h}.call(c));return j}}}}}}}.call(this),function(){var DefineProxy,__slice=Array.prototype.slice;_.mixin({def:Luca.component=Luca.define=Luca.register=function(a){return new DefineProxy(a)}}),DefineProxy=function(){function DefineProxy(a){var b;this.namespace=Luca.util.namespace(),this.componentId=this.componentName=a,this.superClassName="Luca.View",a.match(/\./)&&(this.namespaced=!0,b=a.split("."),this.componentId=b.pop(),this.namespace=b.join("."),Luca.registry.addNamespace(b.join(".")))}return DefineProxy.prototype["in"]=function(a){return this.namespace=a,this},DefineProxy.prototype.from=function(a){return this.superClassName=a,this},DefineProxy.prototype["extends"]=function(a){return this.superClassName=a,this},DefineProxy.prototype.extend=function(a){return this.superClassName=a,this},DefineProxy.prototype.triggers=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{hooks:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.hooks.push(a);return this.properties.hooks=_.uniq(this.properties.hooks),this},DefineProxy.prototype.includes=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{include:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.include.push(a);return this.properties.include=_.uniq(this.properties.include),this},DefineProxy.prototype.mixesIn=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{mixins:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.mixins.push(a);return this.properties.mixins=_.uniq(this.properties.mixins),this},DefineProxy.prototype.defaultProperties=function(properties){var at,componentType,_base;return properties==null&&(properties={}),_.defaults(this.properties||(this.properties={}),properties),at=this.namespaced?Luca.util.resolve(this.namespace,window||global):window||global,this.namespaced&&at==null&&(eval("(window||global)."+this.namespace+" = {}"),at=Luca.util.resolve(this.namespace,window||global)),at[this.componentId]=Luca.extend(this.superClassName,this.componentName,this.properties),Luca.autoRegister===!0&&(Luca.isViewPrototype(at[this.componentId])&&(componentType="view"),Luca.isCollectionPrototype(at[this.componentId])&&((_base=Luca.Collection).namespaces||(_base.namespaces=[]),Luca.Collection.namespaces.push(this.namespace),componentType="collection"),Luca.isModelPrototype(at[this.componentId])&&(componentType="model"),Luca.registerComponent(_.string.underscored(this.componentId),this.componentName,componentType)),at[this.componentId]},DefineProxy}(),DefineProxy.prototype.behavesAs=DefineProxy.prototype.uses=DefineProxy.prototype.mixesIn,DefineProxy.prototype.defines=DefineProxy.prototype.defaults=DefineProxy.prototype.exports=DefineProxy.prototype.defaultProperties,DefineProxy.prototype.defaultsTo=DefineProxy.prototype.enhance=DefineProxy.prototype["with"]=DefineProxy.prototype.defaultProperties,Luca.extend=function(a,b,c){var d,e,f,g,h,i;c==null&&(c={}),f=Luca.util.resolve(a,window||global),f.__initializers||(f.__initializers=[]);if(!_.isFunction(f!=null?f.extend:void 0))throw"Error defining "+b+". "+a+" is not a valid component to extend from";c.displayName=b,c._superClass=function(){return f.displayName||(f.displayName=a),f},c._super=function(a,b,c){var d;return b==null&&(b=this),c==null&&(c=[]),(d=this._superClass().prototype[a])!=null?d.apply(b,c):void 0},d=f.extend(c);if(_.isArray(c!=null?c.include:void 0)){i=c.include;for(g=0,h=i.length;g<h;g++)e=i[g],_.isString(e)&&(e=Luca.util.resolve(e)),_.extend(d.prototype,e)}return d},Luca.mixin=function(a){var b,c;return b=_(Luca.mixin.namespaces).detect(function(b){var c;return((c=Luca.util.resolve(b))!=null?c[a]:void 0)!=null}),b||(b="Luca.modules"),c=Luca.util.resolve(b)[a],c==null&&console.log("Could not find "+a+" in ",Luca.mixin.namespaces),c},Luca.mixin.namespaces=["Luca.modules"],Luca.mixin.namespace=function(a){return Luca.mixin.namespaces.push(a),Luca.mixin.namespaces=_(Luca.mixin.namespaces).uniq()},Luca.decorate=function(a){return _.isString(a)&&(a=Luca.util.resolve(a).prototype),{"with":function(b){var c,d,e,f,g;return c=Luca.mixin(b),d=_(c).chain().keys().select(function(a){return(""+a).match(/^__/)}),e=_(c).omit(d.value()),_.extend(a,e),c!=null&&(g=c.__included)!=null&&g.call(c,b),f=a._superClass().prototype.mixins,a.mixins||(a.mixins=[]),a.mixins.push(b),a.mixins=a.mixins.concat(f),a.mixins=_(a.mixins).chain().uniq().compact().value(),a}}}}.call(this),function(){Luca.modules.ApplicationEventBindings={__initializer:function(){var a,b,c,d,e,f,g;if(_.isEmpty(this.applicationEvents))return;a=this.app;if(_.isString(a)||_.isUndefined(a))a=(e=Luca.Application)!=null?typeof e.get=="function"?e.get(a):void 0:void 0;if(!Luca.supportsEvents(a))throw"Error binding to the application object on "+(this.name||this.cid);f=this.applicationEvents,g=[];for(c=0,d=f.length;c<d;c++){b=f[c],_.isString(c)&&(c=this[c]);if(!_.isFunction(c))throw"Error registering application event "+b+" on "+(this.name||this.cid);g.push(a.on(b,c))}return g}}}.call(this),function(){Luca.modules.CollectionEventBindings={__initializer:function(){var a,b,c,d,e,f,g,h,i;if(_.isEmpty(this.collectionEvents))return;e=this.collectionManager||Luca.CollectionManager.get(),g=this.collectionEvents,i=[];for(f in g){c=g[f],h=f.split(" "),d=h[0],b=h[1],a=e.getOrCreate(d);if(!a)throw"Could not find collection specified by "+d;_.isString(c)&&(c=this[c]);if(!_.isFunction(c))throw"invalid collectionEvents configuration";try{i.push(a.on(b,c,a))}catch(j){throw console.log("Error Binding To Collection in registerCollectionEvents",this),j}}return i}}}.call(this),function(){Luca.modules.Deferrable={configure_collection:function(a){var b,c,d;a==null&&(a=!0);if(!this.collection)return;_.isString(this.collection)&&(b=(c=Luca.CollectionManager)!=null?c.get():void 0)&&(this.collection=b.getOrCreate(this.collection)),this.collection&&_.isFunction(this.collection.fetch)&&_.isFunction(this.collection.reset)||(this.collection=new Luca.Collection(this.collection.initial_set,this.collection));if((d=this.collection)!=null?d.deferrable_trigger:void 0)this.deferrable_trigger=this.collection.deferrable_trigger;if(a)return this.deferrable=this.collection}}}.call(this),function(){Luca.modules.DomHelpers={__initializer:function(){var a,b,c,d,e;b=_(this.additionalClassNames||[]).clone(),this.wrapperClass!=null&&this.$wrap(this.wrapperClass),_.isString(b)&&(b=b.split(" ")),this.gridSpan&&b.push("span"+this.gridSpan),this.gridOffset&&b.push("offset"+this.gridOffset),this.gridRowFluid&&b.push("row-fluid"),this.gridRow&&b.push("row");if(b==null)return;e=[];for(c=0,d=b.length;c<d;c++)a=b[c],e.push(this.$el.addClass(a));return e},$wrap:function(a){return _.isString(a)&&!a.match(/[<>]/)&&(a=this.make("div",{"class":a})),this.$el.wrap(a)},$template:function(a,b){return b==null&&(b={}),this.$el.html(Luca.template(a,b))},$html:function(a){return this.$el.html(a)},$append:function(a){return this.$el.append(a)},$attach:function(){return this.$container().append(this.el)},$bodyEl:function(){return this.$el},$container:function(){return $(this.container)}}}.call(this),function(){Luca.modules.EnhancedProperties={__initializer:function(){if(Luca.config.enhancedViewProperties!==!0)return;_.isString(this.collection)&&Luca.CollectionManager.get()&&(this.collection=Luca.CollectionManager.get().getOrCreate(this.collection)),this.template!=null&&this.$template(this.template,this);if(_.isString(this.collectionManager))return this.collectionManager=Luca.CollectionManager.get(this.collectionManager)}}}.call(this),function(){var a,b=Object.prototype.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};Luca.modules.Filterable={__included:function(a,b){return _.extend(Luca.Collection.prototype,{__filters:{}})},__initializer:function(a,b){var c,d,e,f=this;if(this.filterable===!1)return;Luca.isBackboneCollection(this.collection)||(this.collection=typeof (d=Luca.CollectionManager).get=="function"?(e=d.get())!=null?e.getOrCreate(this.collection):void 0:void 0);if(!Luca.isBackboneCollection(this.collection)){this.debug("Skipping Filterable due to no collection being present on "+(this.name||this.cid)),this.debug("Collection",this.collection);return}return this.getCollection||(this.getCollection=function(){return this.collection}),c=this.getFilterState(),this.querySources||(this.querySources=[]),this.optionsSources||(this.optionsSources=[]),this.query||(this.query={}),this.queryOptions||(this.queryOptions={}),this.querySources.push(function(){return c.toQuery()}),this.optionsSources.push(function(){return c.toOptions()}),this.debugMode===!0&&(console.log("Filterable"),console.log(this.querySources),console.log(this.optionsSources)),c.on("change",function(){var a;return f.isRemote()?(a=_.extend(f.getQuery(),f.getQueryOptions()),f.collection.applyFilter(a,f.getQueryOptions())):f.trigger("refresh")}),b},isRemote:function(){return this.getQueryOptions().remote===!0},getFilterState:function(){var b,c;return(b=this.collection.__filters)[c=this.cid]||(b[c]=new a(this.filterable))},setSortBy:function(a,b){return b==null&&(b={}),this.getFilterState().setOption("sortBy",a,b)},applyFilter:function(a,b){return a==null&&(a={}),b==null&&(b={}),b=_.defaults(b,this.getQueryOptions()),a=_.defaults(a,this.getQuery()),this.getFilterState().set({query:a,options:b},b)}},a=function(a){function b(){b.__super__.constructor.apply(this,arguments)}return c(b,a),b.prototype.defaults={options:{},query:{}},b.prototype.setOption=function(a,b,c){var d;return d={},d[a]=b,this.set("options",_.extend(this.toOptions(),d),c)},b.prototype.setQueryOption=function(a,b,c){var d;return d={},d[a]=b,this.set("query",_.extend(this.toQuery(),d),c)},b.prototype.toOptions=function(){return this.toJSON().options},b.prototype.toQuery=function(){return this.toJSON().query},b.prototype.toRemote=function(){var a;return a=this.toOptions(),_.extend(this.toQuery(),{limit:a.limit,page:a.page,sortBy:a.sortBy})},b}(Backbone.Model)}.call(this),function(){Luca.modules.GridLayout={_initializer:function(){this.gridSpan&&this.$el.addClass("span"+this.gridSpan),this.gridOffset&&this.$el.addClass("offset"+this.gridOffset),this.gridRowFluid&&this.$el.addClass("row-fluid");if(this.gridRow)return this.$el.addClass("row")}}}.call(this),function(){Luca.modules.LoadMaskable={__initializer:function(){var a=this;if(this.loadMask!==!0)return;if(this.loadMask===!0)return this.defer(function(){a.$el.addClass("with-mask");if(a.$(".load-mask").length===0)return a.loadMaskTarget().prepend(Luca.template(a.loadMaskTemplate,a)),a.$(".load-mask").hide()}).until("after:render"),this.on(this.loadmaskEnableEvent||"enable:loadmask",this.applyLoadMask,this),this.on(this.loadmaskDisableEvent||"disable:loadmask",this.applyLoadMask,this)},showLoadMask:function(){return this.trigger("enable:loadmask")},hideLoadMask:function(){return this.trigger("disable:loadmask")},loadMaskTarget:function(){return this.loadMaskEl!=null?this.$(this.loadMaskEl):this.$bodyEl()},disableLoadMask:function(){return this.$(".load-mask .bar").css("width","100%"),this.$(".load-mask").hide(),clearInterval(this.loadMaskInterval)},enableLoadMask:function(){var a,b=this;this.$(".load-mask").show().find(".bar").css("width","0%"),a=this.$(".load-mask .progress").width(),a<20&&(a=this.$el.width())<20&&(a=this.$el.parent().width()),this.loadMaskInterval=setInterval(function(){var a,c;return a=b.$(".load-mask .bar").width(),c=a+12,b.$(".load-mask .bar").css("width",c)},200);if(this.loadMaskTimeout==null)return;return _.delay(function(){return b.disableLoadMask()},this.loadMaskTimeout)},applyLoadMask:function(){return this.$(".load-mask").is(":visible")?this.disableLoadMask():this.enableLoadMask()}}}.call(this),function(){Luca.LocalStore=function(){function a(a){var b;this.name=a,b=localStorage.getItem(this.name),this.data=b&&JSON.parse(b)||{}}return a.prototype.guid=function(){var a;return a=function(){return((1+Math.random())*65536|0).toString(16).substring(1)},a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()},a.prototype.save=function(){return localStorage.setItem(this.name,JSON.stringify(this.data))},a.prototype.create=function(a){return a.id||(a.id=a.attribtues.id=this.guid()),this.data[a.id]=a,this.save(),a},a.prototype.update=function(a){return this.data[a.id]=a,this.save(),a},a.prototype.find=function(a){return this.data[a.id]},a.prototype.findAll=function(){return _.values(this.data)},a.prototype.destroy=function(a){return delete this.data[a.id],this.save(),a},a}(),Backbone.LocalSync=function(a,b,c){var d,e;return e=b.localStorage||b.collection.localStorage,d=function(){switch(a){case"read":return b.id?e.find(b):e.findAll();case"create":return e.create(b);case"update":return e.update(b);case"delete":return e.destroy(b)}}(),d?c.success(d):c.error("Record not found")}}.call(this),function(){var a;Luca.modules.ModalView={closeOnEscape:!0,showOnInitialize:!1,backdrop:!1,__initializer:function(){return this.$el.addClass("modal"),this.on("before:render",a,this),this},container:function(){return $("body")},toggle:function(){return this.$el.modal("toggle")},show:function(){return this.$el.modal("show")},hide:function(){return this.$el.modal("hide")}},a=function(){return this.$el.addClass("modal"),this.fade===!0&&this.$el.addClass("fade"),$("body").append(this.$el),this.$el.modal({backdrop:this.backdrop===!0,keyboard:this.closeOnEscape===!0,show:this.showOnInitialize===!0}),this}}.call(this),function(){Luca.modules.Paginatable={paginatorViewClass:"Luca.components.PaginationControl",paginationSelector:".toolbar.bottom",__included:function(){return _.extend(Luca.Collection.prototype,{__paginators:{}})},__initializer:function(){var a,b,c,d,e=this;if(this.paginatable===!1)return;Luca.isBackboneCollection(this.collection)||(this.collection=typeof (c=Luca.CollectionManager).get=="function"?(d=c.get())!=null?d.getOrCreate(this.collection):void 0:void 0);if(!Luca.isBackboneCollection(this.collection)){this.debug("Skipping Paginatable due to no collection being present on "+(this.name||this.cid)),this.debug("collection",this.collection);return}return _.bindAll(this,"paginationControl","pager"),this.getCollection||(this.getCollection=function(){return this.collection}),a=this.getCollection(),b=this.getPaginationState(),this.optionsSources||(this.optionsSources=[]),this.queryOptions||(this.queryOptions={}),this.optionsSources.push(function(){var a;return a=_(b.toJSON()).pick("limit","page","sortBy"),_.extend(a,{pager:e.pager})}),b.on("change:page",function(a){var b;return e.isRemote()?(b=_.extend(e.toQuery(),e.toQueryOptions()),e.collection.applyFilter(b,{remote:!0})):e.trigger("refresh")}),this.on("before:render",this.renderPaginationControl,this)},pager:function(a,b){return this.getPaginationState().set({numberOfPages:a,itemCount:b.length}),this.paginationControl().updateWithPageCount(a,b)},isRemote:function(){return this.getQueryOptions().remote===!0},getPaginationState:function(){var a,b;return(a=this.collection.__paginators)[b=this.cid]||(a[b]=this.paginationControl().state)},paginationContainer:function(){return this.$(">"+this.paginationSelector)},setCurrentPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.getPaginationState().set("page",a,b)},setPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.getPaginationState().set("page",a,b)},setLimit:function(a,b){return a==null&&(a=0),b==null&&(b={}),this.getPaginationState().set("limit",a,b)},paginationControl:function(){return this.paginator!=null?this.paginator:(_.defaults(this.paginatable||(this.paginatable={}),{page:1,limit:20}),this.paginator=Luca.util.lazyComponent({type:"pagination_control",collection:this.getCollection(),defaultState:this.paginatable,parent:this.name||this.cid,debugMode:this.debugMode}),this.paginator)},renderPaginationControl:function(){var a;return a=this.paginationControl(),this.paginationContainer().append(a.render().$el),a}}}.call(this),function(){Luca.modules.StateModel={__initializer:function(){var a=this;if(this.stateful!==!0)return;if(this.state!=null&&!Luca.isBackboneModel(this.state))return;return this.state=new Backbone.Model(this.defaultState||{}),this.set||(this.set=function(){return a.state.set.apply(a.state,arguments)}),this.get||(this.get=function(){return a.state.get.apply(a.state,arguments)}),this.state.on("change",function(b){var c,d,e,f,g,h;a.trigger("state:change",b),d=b.previousAttributes(),g=b.changedAttributes,h=[];for(e=0,f=g.length;e<f;e++)c=g[e],h.push(a.trigger("state:change:"+c,e,b.previous(c)));return h})}}}.call(this),function(){Luca.modules.Templating={__initializer:function(){var a,b,c;c=Luca.util.read.call(this,this.bodyTemplateVars)||{};if(a=this.bodyTemplate)return this.$el.empty(),b=Luca.template(a,c),Luca.View.prototype.$html.call(this,b)}}}.call(this),function(){var a,b;b={classes:{},model_classes:{},collection_classes:{},namespaces:["Luca.containers","Luca.components"]},a={cid_index:{},name_index:{}},Luca.config.defaultComponentClass=Luca.defaultComponentClass="Luca.View",Luca.config.defaultComponentType=Luca.defaultComponentType="view",Luca.registry.aliases={grid:"grid_view",form:"form_view",text:"text_field",button:"button_field",select:"select_field",card:"card_view",paged:"card_view",wizard:"card_view",collection:"collection_view",list:"collection_view",multi:"collection_multi_view",table:"table_view"},Luca.registerComponent=function(a,c,d){d==null&&(d="view"),Luca.trigger("component:registered",a,c);switch(d){case"model":return b.model_classes[a]=c;case"collection":return b.collection_classes[a]=c;default:return b.classes[a]=c}},Luca.development_mode_register=function(a,c){var d,e,f;return d=b.classes[a],Luca.enableDevelopmentTools===!0&&d!=null&&(f=Luca.util.resolve(d,window),e=Luca.registry.findInstancesByClassName(c),_(e).each(function(a){var b;return a!=null?(b=a.refreshCode)!=null?b.call(a,f):void 0:void 0})),Luca.registerComponent(a,c)},Luca.registry.addNamespace=Luca.registry.namespace=function(a){return b.namespaces.push(a),b.namespaces=_(b.namespaces).uniq()},Luca.registry.namespaces=function(a){return a==null&&(a=!0),_(b.namespaces).map(function(b){return a?Luca.util.resolve(b):b})},Luca.registry.lookup=function(a){var c,d,e,f,g,h;if(c=Luca.registry.aliases[a])a=c;return d=b.classes[a],d!=null?d:(e=Luca.util.classify(a),g=Luca.registry.namespaces(),f=(h=_(g).chain().map(function(a){return a[e]}).compact().value())!=null?h[0]:void 0)},Luca.registry.instances=function(){return _(a.cid_index).values()},Luca.registry.findInstancesByClass=function(a){return Luca.registry.findInstancesByClassName(a.displayName)},Luca.registry.findInstancesByClassName=function(a){var b;return _.isString(a)||(a=a.displayName),b=Luca.registry.instances(),_(b).select(function(b){var c,d;return c=b.displayName===a,b.displayName===a||(typeof b._superClass=="function"?(d=b._superClass())!=null?d.displayName:void 0:void 0)===a})},Luca.registry.classes=function(a){return a==null&&(a=!1),_(_.extend({},b.classes,b.model_classes,b.collection_classes)).map(function(b,c){return a?b:{className:b,ctype:c}})},Luca.cache=Luca.cacheInstance=function(b,c){var d;if(b==null)return;return(c!=null?c.doNotCache:void 0)===!0?c:(c!=null&&(a.cid_index[b]=c),c=a.cid_index[b],(c!=null?c.component_name:void 0)!=null?a.name_index[c.component_name]=c.cid:(c!=null?c.name:void 0)!=null&&(a.name_index[c.name]=c.cid),c!=null?c:(d=a.name_index[b],a.cid_index[d]))}}.call(this),function(){var a=Array.prototype.slice;Luca.Observer=function(){function b(a){var b=this;this.options=a!=null?a:{},_.extend(this,Backbone.Events),this.type=this.options.type,this.options.debugAll&&this.bind("all",function(a,b,c){return console.log("ALL",a,b,c)})}return b.prototype.relay=function(){var b,c;return c=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],console.log("Relaying",trigger,b),this.trigger("event",c,b),this.trigger("event:"+b[0],c,b.slice(1))},b}(),Luca.Observer.enableObservers=function(a){return a==null&&(a={}),Luca.enableGlobalObserver=!0,Luca.ViewObserver=new Luca.Observer(_.extend(a,{type:"view"})),Luca.CollectionObserver=new Luca.Observer(_.extend(a,{type:"collection"}))}}.call(this),function(){var a,b,c,d=Array.prototype.slice;c=Luca.register("Luca.View"),c["extends"]("Backbone.View"),c.includes("Luca.Events","Luca.modules.DomHelpers"),c.mixesIn("DomHelpers","Templating","EnhancedProperties","CollectionEventBindings","ApplicationEventBindings","StateModel"),c.triggers("before:initialize","after:initialize","before:render","after:render","first:activation","activation","deactivation"),c.defines({initialize:function(b){return this.options=b!=null?b:{},this.trigger("before:initialize",this,this.options),_.extend(this,this.options),(this.autoBindEventHandlers===!0||this.bindAllEvents===!0)&&a.call(this),this.name!=null&&(this.cid=_.uniqueId(this.name)),this.$el.attr("data-luca-id",this.name||this.cid),Luca.cacheInstance(this.cid,this),this.setupHooks(_(Luca.View.prototype.hooks.concat(this.hooks)).uniq()),this.setupMixins(),this.delegateEvents(),this.trigger("after:initialize",this)},setupMixins:function(){var a,b,c,d,e,f,g,h;if(((d=this.mixins)!=null?d.length:void 0)>0){e=this.mixins,h=[];for(b=0,c=e.length;b<c;b++)a=e[b],h.push((f=Luca.mixin(a))!=null?(g=f.__initializer)!=null?g.call(this,this,a):void 0:void 0);return h}},setupHooks:function(a){var b=this;return a||(a=this.hooks),_(a).each(function(a){var c,d;d=Luca.util.hook(a),c=function(){var a;return(a=this[d])!=null?a.apply(this,arguments):void 0};if(a!=null?a.match(/once:/):void 0)c=_.once(c);return b.on(a,c,b)})},registerEvent:function(a,b){return this.events||(this.events={}),this.events[a]=b,this.delegateEvents()},definitionClass:function(){var a;return(a=Luca.util.resolve(this.displayName,window))!=null?a.prototype:void 0},collections:function(){return Luca.util.selectProperties(Luca.isBackboneCollection,this)},models:function(){return Luca.util.selectProperties(Luca.isBackboneModel,this)},views:function(){return Luca.util.selectProperties(Luca.isBackboneView,this)},debug:function(){var a;a=1<=arguments.length?d.call(arguments,0):[];if(!this.debugMode&&window.LucaDebugMode==null)return;return console.log([this.name||this.cid].concat(d.call(a)))},trigger:function(){return Luca.enableGlobalObserver&&(Luca.developmentMode===!0||this.observeEvents===!0)&&(Luca.ViewObserver||(Luca.ViewObserver=new Luca.Observer({type:"view"})),Luca.ViewObserver.relay(this,arguments)),Backbone.View.prototype.trigger.apply(this,arguments)}}),Luca.View._originalExtend=Backbone.View.extend,Luca.View.renderWrapper=function(a){var b;return b=a.render,b||(b=Luca.View.prototype.$attach),a.render=function(){var a,d,e,f,g,h=this;return c=this,this.deferrable?(f=this.deferrable_target,Luca.isBackboneCollection(this.deferrable)||(this.deferrable=this.collection),f||(f=this.deferrable),g=this.deferrable_event?this.deferrable_event:Luca.View.deferrableEvent,d=function(){return b.call(c),c.trigger("after:render",c)},c.defer(d).until(f,g),c.trigger("before:render",this),a=this.deferrable_trigger||this.deferUntil,a==null?f[this.deferrable_method||"fetch"].call(f):(e=_.once(function(){var a,b;return typeof (a=h.deferrable)[b=h.deferrable_method||"fetch"]=="function"?a[b]():void 0}),(this.deferrable_target||this).bind(this.deferrable_trigger,e)),this):(this.trigger("before:render",this),b.apply(this,arguments),this.trigger("after:render",this),this)},a},a=function(){var a,c,d,e,f;e=[this.events,this.componentEvents,this.collectionEvents,this.applicationEvents],f=[];for(c=0,d=e.length;c<d;c++)a=e[c],_.isEmpty(a)||f.push(b.call(this,a));return f},b=function(a){var b,c,d;a==null&&(a={}),d=[];for(b in a)c=a[b],_.isString(c)?d.push(_.bindAll(this,c)):d.push(void 0);return d},Luca.View.extend=function(a){var b,c,d,e;a=Luca.View.renderWrapper(a);if(a.mixins!=null&&_.isArray(a.mixins)){e=a.mixins;for(c=0,d=e.length;c<d;c++)b=e[c],Luca.decorate(a)["with"](b)}return Luca.View._originalExtend.call(this,a)},Luca.View.deferrableEvent="reset"}.call(this),function(){var a,b;a=Luca.define("Luca.Model"),a["extends"]("Backbone.Model"),a.includes("Luca.Events"),a.defines({initialize:function(){return Backbone.Model.prototype.initialize(this,arguments),b.call(this)},read:function(a){return _.isFunction(this[a])?this[a].call(this):this.get(a)},get:function(a){var b;return((b=this.computed)!=null?b.hasOwnProperty(a):void 0)?this._computed[a]:Backbone.Model.prototype.get.call(this,a)}}),b=function(){var a,b,c,d,e=this;if(_.isUndefined(this.computed))return;this._computed={},c=this.computed,d=[];for(a in c)b=c[a],this.on("change:"+a,function(){return e._computed[a]=e[a].call(e)}),_.isString(b)&&(b=b.split(",")),d.push(_(b).each(function(b){e.on("change:"+b,function(){return e.trigger("change:"+a)});if(e.has(b))return e.trigger("change:"+a)}));return d}}.call(this),function(){var a;a=Luca.define("Luca.Collection"),Backbone.QueryCollection!=null?a["extends"]("Backbone.QueryCollection"):a["extends"]("Backbone.Collection"),a.includes("Luca.Events"),a.defines({model:Luca.Model,cachedMethods:[],remoteFilter:!1,initialize:function(a,b){var c,d=this;a==null&&(a=[]),this.options=b,_.extend(this,this.options),this.setupMethodCaching(),this._reset(),this.cached&&console.log("The @cached property of Luca.Collection is being deprecated. Please change to cache_key");if(this.cache_key||(this.cache_key=this.cached))this.bootstrap_cache_key=_.isFunction(this.cache_key)?this.cache_key():this.cache_key;(this.registerAs||this.registerWith)&&console.log("This configuration API is deprecated. use @name and @manager properties instead"),this.name||(this.name=this.registerAs),this.manager||(this.manager=this.registerWith),this.manager=_.isFunction(this.manager)?this.manager():this.manager,this.name&&!this.manager&&(this.manager=Luca.CollectionManager.get()),this.manager&&(this.name||(this.name=this.cache_key()),this.name=_.isFunction(this.name)?this.name():this.name,!this.private&&!this.anonymous&&this.bind("after:initialize",function(){return d.register(d.manager,d.name,d)}));if(this.useLocalStorage===!0&&window.localStorage!=null)throw c=this.bootstrap_cache_key||this.name,"Must specify either a cached or registerAs property to use localStorage";return _.isArray(this.data)&&this.data.length>0&&(this.memoryCollection=!0),this.useNormalUrl!==!0&&this.__wrapUrl(),Backbone.Collection.prototype.initialize.apply(this,[a,this.options]),a&&this.reset(a,{silent:!0,parse:b!=null?b.parse:void 0}),this.trigger("after:initialize")},__wrapUrl:function(){var a,b,c=this;return _.isFunction(this.url)?this.url=_.wrap(this.url,function(a){var b,d,e,f,g;return g=a.apply(c),e=g.split("?"),e.length>1&&(b=_.last(e)),f=c.queryString(),b&&g.match(b)&&(f=f.replace(b,"")),d=""+g+"?"+f,d.match(/\?$/)&&(d=d.replace(/\?$/,"")),d}):(b=this.url,a=this.queryString(),this.url=_([b,a]).compact().join("?"))},queryString:function(){var a,b=this;return a=_(this.base_params||(this.base_params=Luca.Collection.baseParams())).inject(function(a,b,c){var d;return d=""+c+"="+b,a.push(d),a},[]),_.uniq(a).join("&")},resetFilter:function(){return this.base_params=_(Luca.Collection.baseParams()).clone(),this},applyFilter:function(a,b){return a==null&&(a={}),b==null&&(b={}),b.remote!=null==1||this.remoteFilter===!0?(this.applyParams(a),this.fetch(_.extend(b,{refresh:!0}))):this.reset(this.query(a))},applyParams:function(a){return this.base_params=_(Luca.Collection.baseParams()).clone(),_.extend(this.base_params,a),this},register:function(a,b,c){a==null&&(a=Luca.CollectionManager.get()),b==null&&(b="");if(!(b.length>=1))throw"Can not register with a collection manager without a key";if(a==null)throw"Can not register with a collection manager without a valid collection manager";_.isString(a)&&(a=Luca.util.nestedValue(a,window||global));if(!a)throw"Could not register with collection manager";if(_.isFunction(a.add))return a.add(b,c);if(_.isObject(a))return a[b]=c},loadFromBootstrap:function(){if(!this.bootstrap_cache_key)return;return this.reset(this.cached_models()),this.trigger("bootstrapped",this)},bootstrap:function(){return this.loadFromBootstrap()},cached_models:function(){return Luca.Collection.cache(this.bootstrap_cache_key)},fetch:function(a){var b
7
+ ;a==null&&(a={}),this.trigger("before:fetch",this);if(this.memoryCollection===!0)return this.reset(this.data);if(this.cached_models().length&&!a.refresh)return this.bootstrap();b=_.isFunction(this.url)?this.url():this.url;if(!(b&&b.length>1||this.localStorage))return!0;this.fetching=!0;try{return Backbone.Collection.prototype.fetch.apply(this,arguments)}catch(c){throw console.log("Error in Collection.fetch",c),c}},onceLoaded:function(a,b){var c,d=this;b==null&&(b={autoFetch:!0});if(this.length>0&&!this.fetching){a.apply(this,[this]);return}c=function(){return a.apply(d,[d])},this.bind("reset",function(){return c(),this.unbind("reset",this)});if(!this.fetching&&!!b.autoFetch)return this.fetch()},ifLoaded:function(a,b){var c,d=this;b==null&&(b={scope:this,autoFetch:!0}),c=b.scope||this,this.length>0&&!this.fetching&&a.apply(c,[this]),this.bind("reset",function(b){return a.call(c,b)});if(!(this.fetching===!0||!b.autoFetch||this.length>0))return this.fetch()},parse:function(a){var b;return this.fetching=!1,this.trigger("after:response",a),b=this.root!=null?a[this.root]:a,this.bootstrap_cache_key&&Luca.Collection.cache(this.bootstrap_cache_key,b),b},restoreMethodCache:function(){var a,b,c,d;c=this._methodCache,d=[];for(b in c)a=c[b],a.original!=null?(a.args=void 0,d.push(this[b]=a.original)):d.push(void 0);return d},clearMethodCache:function(a){return this._methodCache[a].value=void 0},clearAllMethodsCache:function(){var a,b,c,d;c=this._methodCache,d=[];for(b in c)a=c[b],d.push(this.clearMethodCache(b));return d},setupMethodCaching:function(){var b,c;return a=this,c=["reset","add","remove"],b=this._methodCache={},_(this.cachedMethods).each(function(d){var e,f,g,h,i,j,k,l,m;b[d]={name:d,original:a[d],value:void 0},a[d]=function(){var c;return(c=b[d]).value||(c.value=b[d].original.apply(a,arguments))};for(h=0,j=c.length;h<j;h++)g=c[h],a.bind(g,function(){return a.clearAllMethodsCache()});e=d.split(":")[1];if(e){l=e.split(","),m=[];for(i=0,k=l.length;i<k;i++)f=l[i],m.push(a.bind("change:"+f,function(){return a.clearMethodCache({method:d})}));return m}})},query:function(a,b){return a==null&&(a={}),b==null&&(b={}),Backbone.QueryCollection!=null?Backbone.QueryCollection.prototype.query.apply(this,arguments):this.models}}),_.extend(Luca.Collection.prototype,{trigger:function(){return Luca.enableGlobalObserver&&(Luca.CollectionObserver||(Luca.CollectionObserver=new Luca.Observer({type:"collection"})),Luca.CollectionObserver.relay(this,arguments)),Backbone.View.prototype.trigger.apply(this,arguments)}}),Luca.Collection.baseParams=function(a){if(a)return Luca.Collection._baseParams=a;if(_.isFunction(Luca.Collection._baseParams))return Luca.Collection._baseParams();if(_.isObject(Luca.Collection._baseParams))return Luca.Collection._baseParams},Luca.Collection._bootstrapped_models={},Luca.Collection.bootstrap=function(a){return _.extend(Luca.Collection._bootstrapped_models,a)},Luca.Collection.cache=function(a,b){return b?Luca.Collection._bootstrapped_models[a]=b:Luca.Collection._bootstrapped_models[a]||[]}}.call(this),function(){var a;a=function(a,b){var c,d,e,f,g;return a==null&&(a={}),a.orientation||(a.orientation="top"),a.ctype||(a.ctype=this.toolbarType||"panel_toolbar"),f=""+this.cid+"-tbc-"+a.orientation,g=Luca.util.lazyComponent(a),d=this.make("div",{"class":"toolbar-container "+a.orientation,id:f},g.render().el),e=this.bodyClassName||this.bodyTagName,c=function(){switch(a.orientation){case"top":case"left":return e?"before":"prepend";case"bottom":case"right":return e?"after":"append"}}(),(b||this.$bodyEl())[c](d)},_.def("Luca.components.Panel")["extends"]("Luca.View")["with"]({topToolbar:void 0,bottomToolbar:void 0,loadMask:!1,loadMaskTemplate:["components/load_mask"],loadMaskTimeout:3e3,mixins:["LoadMaskable"],initialize:function(a){return this.options=a!=null?a:{},Luca.View.prototype.initialize.apply(this,arguments)},applyStyles:function(a,b){var c,d,e;a==null&&(a={}),b==null&&(b=!1),d=b?this.$bodyEl():this.$el;for(c in a)e=a[c],d.css(c,e);return this},beforeRender:function(){var a;return(a=Luca.View.prototype.beforeRender)!=null&&a.apply(this,arguments),this.styles!=null&&this.applyStyles(this.styles),this.bodyStyles!=null&&this.applyStyles(this.bodyStyles,!0),typeof this.renderToolbars=="function"?this.renderToolbars():void 0},$bodyEl:function(){var a,b,c,d;return c=this.bodyTagName||"div",b=this.bodyClassName||"view-body",this.bodyEl||(this.bodyEl=""+c+"."+b),a=this.$(this.bodyEl),a.length>0?a:a.length!==0||this.bodyClassName==null&&this.bodyTagName==null?$(this.el):(d=this.make(c,{"class":b,"data-auto-appended":!0}),$(this.el).append(d),this.$(this.bodyEl))},$wrap:function(a){return _.isString(a)&&!a.match(/[<>]/)&&(a=this.make("div",{"class":a})),this.$el.wrap(a)},$template:function(a,b){return b==null&&(b={}),this.$html(Luca.template(a,b))},$empty:function(){return this.$bodyEl().empty()},$html:function(a){return this.$bodyEl().html(a)},$append:function(a){return this.$bodyEl().append(a)},renderToolbars:function(){var a=this;return _(["top","left","right","bottom"]).each(function(b){var c;if(c=a[""+b+"Toolbar"])return a.renderToolbar(b,c)})},renderToolbar:function(b,c){return b==null&&(b="top"),c==null&&(c={}),c.parent=this,c.orientation=b,a.call(this,c,c.targetEl)}})}.call(this),function(){_.def("Luca.core.Field")["extends"]("Luca.View")["with"]({className:"luca-ui-text-field luca-ui-field",isField:!0,template:"fields/text_field",labelAlign:"top",hooks:["before:validation","after:validation","on:change"],statuses:["warning","error","success"],initialize:function(a){var b;return this.options=a!=null?a:{},_.extend(this,this.options),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_class||(this.input_class=""),this.input_type||(this.input_type=""),this.helperText||(this.helperText=""),this.required&&((b=this.label)!=null?!b.match(/^\*/):!void 0)&&(this.label||(this.label="*"+this.label)),this.inputStyles||(this.inputStyles=""),this.input_value||(this.input_value=this.value||""),this.disabled&&this.disable(),this.updateState(this.state),this.placeHolder||(this.placeHolder=""),Luca.View.prototype.initialize.apply(this,arguments)},beforeRender:function(){Luca.enableBootstrap&&this.$el.addClass("control-group");if(this.required)return this.$el.addClass("required")},change_handler:function(a){return this.trigger("on:change",this,a)},disable:function(){return this.getInputElement().attr("disabled",!0)},enable:function(){return this.getInputElement().attr("disabled",!1)},getValue:function(){var a,b;a=(b=this.getInputElement())!=null?b.attr("value"):void 0;if(_.str.isBlank(a))return a;switch(this.valueType){case"integer":return parseInt(a);case"string":return""+a;case"float":return parseFloat(a);default:return a}},setValue:function(a){var b;return(b=this.getInputElement())!=null?b.attr("value",a):void 0},getInputElement:function(){return this.input||(this.input=this.$("input").eq(0))},updateState:function(a){var b=this;return _(this.statuses).each(function(c){return b.$el.removeClass(c),b.$el.addClass(a)})}})}.call(this),function(){var a,b,c,d,e,f,g,h;b=Luca.register("Luca.core.Container"),b["extends"]("Luca.components.Panel"),b.triggers("before:components","before:render:components","before:layout","after:components","after:layout","first:activation"),b.defines({className:"luca-ui-container",componentTag:"div",componentClass:"luca-ui-panel",isContainer:!0,rendered:!1,components:[],componentEvents:{},initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),this.setupHooks(Luca.core.Container.prototype.hooks),this.components||(this.components=this.fields||(this.fields=this.pages||(this.pages=this.cards||(this.cards=this.views)))),h(this),Luca.View.prototype.initialize.apply(this,arguments)},beforeRender:function(){var a;return f.call(this),e.call(this),(a=Luca.components.Panel.prototype.beforeRender)!=null?a.apply(this,arguments):void 0},customizeContainerEl:function(a,b,c){return a},prepareLayout:function(){return b=this,this.componentContainers=_(this.components).map(function(c,d){return a.call(b,c,d)})},prepareComponents:function(){var a,b,c,d,e=this;d=this.components;for(b=0,c=d.length;b<c;b++)a=d[b],_.isString(a)&&(a={type:a});return _(this.components).each(function(a,b){var c,d,f,g;c=d=(g=e.componentContainers)!=null?g[b]:void 0,c["class"]=c["class"]||c.className||c.classes,e.generateComponentElements&&(f=e.make(e.componentTag,d,""),e.$append(f));if(a.container==null)return e.generateComponentElements&&(a.container="#"+d.id),a.container||(a.container=e.$bodyEl())})},createComponents:function(){var a,c=this;if(this.componentsCreated===!0)return;return a=this.componentIndex={name_index:{},cid_index:{},role_index:{}},b=this,this.components=_(this.components).map(function(a,d){var e,f,h;return e=Luca.isComponent(a)?a:(a.type||(a.type=a.ctype),a.type==null?a.components!=null?a.type=a.ctype="container":a.type=a.ctype=Luca.defaultComponentType:void 0,a=_.defaults(a,b.defaults||{}),f=Luca.util.lazyComponent(a)),!e.container&&((h=e.options)!=null?h.container:void 0)&&(e.container=e.options.container),e.container==null&&(console.log(e,d,c),console.error("could not assign container property to component on container "+(c.name||c.cid))),g(e).at(d)["in"](c.componentIndex),e}),this.componentsCreated=!0,a},renderComponents:function(a){return this.debugMode=a!=null?a:"",this.debug("container render components"),b=this,_(this.components).each(function(a){a.getParent=function(){return b};try{return this.$(a.container).eq(0).append(a.el),a.render()}catch(c){console.log("Error Rendering Component "+(a.name||a.cid),a),_.isObject(c)&&(console.log(c.message),console.log(c.stack));if(Luca.silenceRenderErrors!=null!=1)throw c}})},firstActivation:function(){var a;return a=this,this.each(function(b,c){var d;if((b!=null?b.previously_activated:void 0)!==!0)return b!=null&&(d=b.trigger)!=null&&d.call(b,"first:activation",b,a),b.previously_activated=!0})},_:function(){return _(this.components)},pluck:function(a){return this._().pluck(a)},invoke:function(a){return this._().invoke(a)},select:function(a){return this._().select(a)},detect:function(a){return this._().detect(attribute)},reject:function(a){return this._().reject(a)},map:function(a){return this._().map(a)},registerComponentEvents:function(a){var c,d,e,f,g,h,i,j,k=this;b=this,h=a||this.componentEvents||{},j=[];for(g in h){f=h[g],i=g.split(" "),d=i[0],e=i[1];if(!_.isFunction(this[f]))throw console.log("Error registering component event",g,d,e),"Invalid component event definition "+g+". Specified handler is not a method on the container";if(d==="*")j.push(this.eachComponent(function(a){return a.on(e,k[f],b)}));else{c=this.findComponentForEventBinding(d);if(c==null||!Luca.isComponent(c))throw console.log("Error registering component event",g,d,e),"Invalid component event definition: "+d;j.push(c!=null?c.bind(e,this[f],b):void 0)}}return j},subContainers:function(){return this.select(function(a){return a.isContainer===!0})},roles:function(){return _(this.allChildren()).pluck("role")},allChildren:function(){var a,b;return a=this.components,b=_(this.subContainers()).invoke("allChildren"),_([a,b]).chain().compact().flatten().value()},findComponentForEventBinding:function(a,b){return b==null&&(b=!0),this.findComponentByName(a,b)||this.findComponentByGetter(a,b)||this.findComponentByRole(a,b)},findComponentByGetter:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return b.getter===a})},findComponentByRole:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return b.role===a||b.type===a||b.ctype===a})},findComponentByName:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return b.name===a})},findComponentById:function(a,b){return b==null&&(b=!1),this.findComponent(a,"cid_index",b)},findComponent:function(a,b,c){var d,e,f,g;b==null&&(b="name"),c==null&&(c=!1),this.componentsCreated!==!0&&this.createComponents(),e=(g=this.componentIndex)!=null?g[b][a]:void 0,d=this.components[e];if(d)return d;if(c===!0)return f=_(this.components).detect(function(c){return c!=null?typeof c.findComponent=="function"?c.findComponent(a,b,!0):void 0:void 0}),f!=null?typeof f.findComponent=="function"?f.findComponent(a,b,!0):void 0:void 0},each:function(a){return this.eachComponent(a,!1)},eachComponent:function(a,b){var c=this;return b==null&&(b=!0),_(this.components).each(function(c,d){var e;a.call(c,c,d);if(b)return c!=null?(e=c.eachComponent)!=null?e.apply(c,[a,b]):void 0:void 0})},indexOf:function(a){var b;return b=_(this.components).pluck("name"),_(b).indexOf(a)},activeComponent:function(){return this.activeItem?this.components[this.activeItem]:this},componentElements:function(){return this.$("[data-luca-parent='"+(this.name||this.cid)+"']")},getComponent:function(a){return this.components[a]},isRootComponent:function(){return this.getParent==null},getRootComponent:function(){return this.isRootComponent()?this:this.getParent().getRootComponent()},selectByAttribute:function(a,b,c){var d;return b==null&&(b=void 0),c==null&&(c=!1),d=_(this.components).map(function(d){var e,f;return e=[],f=d[a],(f===b||b==null&&f!=null)&&e.push(d),c===!0&&e.push(typeof d.selectByAttribute=="function"?d.selectByAttribute(a,b,!0):void 0),_.compact(e)}),_.flatten(d)}}),Luca.core.Container.componentRenderer=function(a,b){var c;return c=$(b.container)[b.attachWith||"append"],c(b.render().el)},f=function(){return this.trigger("before:layout",this),this.prepareLayout(),this.trigger("after:layout",this)},a=function(a,b){var c,d;return d=[],a.height!=null&&d.push("height: "+(_.isNumber(a.height)?a.height+"px":a.height)),a.width!=null&&d.push("width: "+(_.isNumber(a.width)?a.width+"px":a.width)),a.float&&d.push("float: "+a.float),c={"class":(a!=null?a.classes:void 0)||this.componentClass,id:""+this.cid+"-"+b,style:d.join(";"),"data-luca-parent":this.name||this.cid},this.customizeContainerEl!=null&&(c=this.customizeContainerEl(c,a,b)),c},c=function(){var a;return b=this,a=_(this.allChildren()).select(function(a){return a.getter!=null}),_(a).each(function(a){var c;return b[c=a.getter]||(b[c]=function(){return console.log(a.getter,a,b),a})})},d=function(){var a;return b=this,a=_(this.allChildren()).select(function(a){return a.role!=null}),_(a).each(function(a){var c;return c=_.str.camelize("get_"+a.role),b[c]||(b[c]=function(){return a})})},e=function(){return this.trigger("before:components",this,this.components),this.prepareComponents(),this.createComponents(),this.trigger("before:render:components",this,this.components),this.renderComponents(),this.trigger("after:components",this,this.components),this.skipGetterMethods!==!0&&(c.call(this),d.call(this)),this.registerComponentEvents()},h=function(){return!0},g=function(a){return{at:function(b){return{"in":function(c){a.cid!=null&&(c.cid_index[a.cid]=b),a.role!=null&&(c.role_index[a.role]=b);if(a.name!=null)return c.name_index[a.name]=b}}}}}}.call(this),function(){var a,b,c;Luca.CollectionManager=function(){function c(a){var c,d,e,f;this.options=a!=null?a:{},_.extend(this,this.options),d=this;if(c=typeof (e=Luca.CollectionManager).get=="function"?e.get(this.name):void 0)throw"Attempt to create a collection manager with a name which already exists";(f=Luca.CollectionManager).instances||(f.instances={}),_.extend(this,Backbone.Events),_.extend(this,Luca.Events),Luca.CollectionManager.instances[this.name]=d,Luca.CollectionManager.get=function(a){return a==null?d:Luca.CollectionManager.instances[a]},this.state=new Luca.Model,this.initialCollections&&b.call(this)}return c.prototype.name="primary",c.prototype.collectionNamespace=Luca.Collection.namespace,c.prototype.__collections={},c.prototype.relayEvents=!0,c.prototype.add=function(a,b){var c;return(c=this.currentScope())[a]||(c[a]=b)},c.prototype.allCollections=function(){return _(this.currentScope()).values()},c.prototype.create=function(b,c,d){var e,f,g;c==null&&(c={}),d==null&&(d=[]),e=c.base,e||(e=a.call(this,b)),c.private&&(c.name="");try{f=new e(d,c)}catch(h){throw console.log("Error creating collection",e,c,b),h}return this.add(b,f),g=this,this.relayEvents===!0&&this.bind("*",function(){return console.log("Relay Events on Collection Manager *",f,arguments)}),f},c.prototype.currentScope=function(){var a,b;return(a=this.getScope())?(b=this.__collections)[a]||(b[a]={}):this.__collections},c.prototype.each=function(a){return _(this.all()).each(a)},c.prototype.get=function(a){return this.currentScope()[a]},c.prototype.getScope=function(){return},c.prototype.destroy=function(a){var b;return b=this.get(a),delete this.currentScope()[a],b},c.prototype.getOrCreate=function(a,b,c){return b==null&&(b={}),c==null&&(c=[]),this.get(a)||this.create(a,b,c,!1)},c.prototype.collectionCountDidChange=function(){if(this.allCollectionsLoaded())return this.trigger("all_collections_loaded"),this.trigger("initial:load")},c.prototype.allCollectionsLoaded=function(){return this.totalCollectionsCount()===this.loadedCollectionsCount()},c.prototype.totalCollectionsCount=function(){return this.state.get("collections_count")},c.prototype.loadedCollectionsCount=function(){return this.state.get("loaded_collections_count")},c.prototype.private=function(a,b,c){return b==null&&(b={}),c==null&&(c=[]),this.create(a,b,c,!0)},c}(),Luca.CollectionManager.isRunning=function(){return _.isEmpty(Luca.CollectionManager.instances)!==!0},Luca.CollectionManager.destroyAll=function(){return Luca.CollectionManager.instances={}},Luca.CollectionManager.loadCollectionsByName=function(a,b){var c,d,e,f,g;g=[];for(e=0,f=a.length;e<f;e++)d=a[e],c=this.getOrCreate(d),c.once("reset",function(){return b(c)}),g.push(c.fetch());return g},a=function(a){var b,c,d,e;return b=Luca.util.classify(a),c=(this.collectionNamespace||window||global)[b],c||(c=(this.collectionNamespace||window||global)[""+b+"Collection"]),c==null&&((e=Luca.Collection.namespaces)!=null?e.length:void 0)>0&&(d=_(Luca.Collection.namespaces.reverse()).map(function(a){return Luca.util.resolve(""+a+"."+b)||Luca.util.resolve(""+a+"."+b+"Collection")}),d=_(d).compact(),d.length>0&&(c=d[0])),c},c=function(){var a,b,c=this;return a=function(a){var b;return b=c.state.get("loaded_collections_count"),c.state.set("loaded_collections_count",b+1),c.trigger("collection_loaded",a.name),a.unbind("reset")},b=this.initialCollections,Luca.CollectionManager.loadCollectionsByName.call(this,b,a)},b=function(){var a=this;return this.state.set({loaded_collections_count:0,collections_count:this.initialCollections.length}),this.state.bind("change:loaded_collections_count",function(){return a.collectionCountDidChange()}),this.useProgressLoader&&(this.loaderView||(this.loaderView=new Luca.components.CollectionLoaderView({manager:this,name:"collection_loader_view"}))),c.call(this),this.initialCollectionsLoadedu,this}}.call(this),function(){Luca.SocketManager=function(){function a(a){this.options=a!=null?a:{},_.extend(Backbone.Events),this.loadTransport()}return a.prototype.connect=function(){switch(this.options.provider){case"socket.io":return this.socket=io.connect(this.options.socket_host);case"faye.js":return this.socket=new Faye.Client(this.options.socket_host)}},a.prototype.transportLoaded=function(){return this.connect()},a.prototype.transport_script=function(){switch(this.options.provider){case"socket.io":return""+this.options.transport_host+"/socket.io/socket.io.js";case"faye.js":return""+this.options.transport_host+"/faye.js"}},a.prototype.loadTransport=function(){var a,b=this;return a=document.createElement("script"),a.setAttribute("type","text/javascript"),a.setAttribute("src",this.transport_script()),a.onload=this.transportLoaded,Luca.util.isIE()&&(a.onreadystatechange=function(){if(a.readyState==="loaded")return b.transportLoaded()}),document.getElementsByTagName("head")[0].appendChild(a)},a}()}.call(this),function(){_.def("Luca.containers.SplitView")["extends"]("Luca.core.Container")["with"]({componentType:"split_view",containerTemplate:"containers/basic",className:"luca-ui-split-view",componentClass:"luca-ui-panel"})}.call(this),function(){_.def("Luca.containers.ColumnView")["extends"]("Luca.core.Container")["with"]({componentType:"column_view",className:"luca-ui-column-view",components:[],initialize:function(a){return this.options=a!=null?a:{},console.log("Column Views are deprecated in favor of just using grid css on a normal container"),Luca.core.Container.prototype.initialize.apply(this,arguments),this.setColumnWidths()},componentClass:"luca-ui-column",containerTemplate:"containers/basic",generateComponentElements:!0,autoColumnWidths:function(){var a,b=this;return a=[],_(this.components.length).times(function(){return a.push(parseInt(100/b.components.length))}),a},setColumnWidths:function(){return this.columnWidths=this.layout!=null?_(this.layout.split("/")).map(function(a){return parseInt(a)}):this.autoColumnWidths(),this.columnWidths=_(this.columnWidths).map(function(a){return""+a+"%"})},beforeLayout:function(){var a,b=this;return this.debug("column_view before layout"),_(this.columnWidths).each(function(a,c){return b.components[c].float="left",b.components[c].width=a}),(a=Luca.core.Container.prototype.beforeLayout)!=null?a.apply(this,arguments):void 0}})}.call(this),function(){var a;a=Luca.define("Luca.containers.CardView"),a["extends"]("Luca.core.Container"),a.defaults({className:"luca-ui-card-view-wrapper",activeCard:0,components:[],hooks:["before:card:switch","after:card:switch"],componentClass:"luca-ui-card",generateComponentElements:!0,initialize:function(a){return this.options=a,Luca.core.Container.prototype.initialize.apply(this,arguments),this.setupHooks(this.hooks),this.components||(this.components=this.pages||(this.pages=this.cards))},prepareComponents:function(){var a;return(a=Luca.core.Container.prototype.prepareComponents)!=null&&a.apply(this,arguments),this.componentElements().hide(),this.activeComponentElement().show()},activeComponentElement:function(){return this.componentElements().eq(this.activeCard)},activeComponent:function(){return this.getComponent(this.activeCard)},customizeContainerEl:function(a,b,c){return a.style+=c===this.activeCard?"display:block;":"display:none;",a},atFirst:function(){return this.activeCard===0},atLast:function(){return this.activeCard===this.components.length-1},next:function(){if(this.atLast())return;return this.activate(this.activeCard+1)},previous:function(){if(this.atFirst())return;return this.activate(this.activeCard-1)},cycle:function(){var a;return a=this.atLast()?0:this.activeCard+1,this.activate(a)},find:function(a){return Luca(a)},firstActivation:function(){return this.activeComponent().trigger("first:activation",this,this.activeComponent())},activate:function(a,b,c){var d,e,f,g,h,i,j=this;b==null&&(b=!1),_.isFunction(b)&&(b=!1,c=b);if(a===this.activeCard)return;e=this.activeComponent(),d=this.getComponent(a),d||(a=this.indexOf(a),d=this.getComponent(a));if(!d)return;b||(this.trigger("before:card:switch",e,d),e!=null&&(f=e.trigger)!=null&&f.apply(e,["before:deactivation",this,e,d]),d!=null&&(g=d.trigger)!=null&&g.apply(e,["before:activation",this,e,d]),_.defer(function(){return j.$el.data(j.activeAttribute||"active-card",d.name)})),this.componentElements().hide(),d.previously_activated||(d.trigger("first:activation"),d.previously_activated=!0),this.activeCard=a,this.activeComponentElement().show(),b||(this.trigger("after:card:switch",e,d),(h=e.trigger)!=null&&h.apply(e,["deactivation",this,e,d]),(i=d.trigger)!=null&&i.apply(d,["activation",this,e,d]));if(_.isFunction(c))return c.apply(this,[this,e,d])}})}.call(this),function(){_.def("Luca.ModalView")["extends"]("Luca.core.Container")["with"]({closeOnEscape:!0,showOnInitialize:!1,backdrop:!1,className:"luca-ui-container modal",container:function(){return $("body")},toggle:function(){return this.$el.modal("toggle")},show:function(){return this.$el.modal("show")},hide:function(){return this.$el.modal("hide")},render:function(){return this.$el.addClass("modal"),this.fade===!0&&this.$el.addClass("fade"),$("body").append(this.$el),this.$el.modal({backdrop:this.backdrop===!0,keyboard:this.closeOnEscape===!0,show:this.showOnInitialize===!0}),this}}),_.def("Luca.containers.ModalView")["extends"]("Luca.ModalView")["with"]()}.call(this),function(){_.def("Luca.PageView")["extends"]("Luca.containers.CardView")["with"]({version:2})}.call(this),function(){var a,b,c,d;c=Luca.register("Luca.components.PanelToolbar"),c["extends"]("Luca.View"),c.defines({buttons:[],className:"luca-ui-toolbar btn-toolbar",well:!0,orientation:"top",autoBindEventHandlers:!0,events:{"click a.btn, click .dropdown-menu li":"clickHandler"},initialize:function(a){var b;this.options=a!=null?a:{},this._super("initialize",this,arguments);if(this.group===!0&&((b=this.buttons)!=null?b.length:void 0)>=0)return this.buttons=[{group:!0,buttons:this.buttons}]},clickHandler:function(a){var b,c,d,e,f;d=e=$(a.target),d.is("i")&&(d=e=$(a.target).parent()),this.selectable===!0&&(e.siblings().removeClass("is-selected"),d.addClass("is-selected"));if(!(b=e.data("eventid")))return;return c=Luca.util.hook(b),f=this.parent||this,_.isFunction(f[c])?f[c].call(this,d,a):f.trigger(b,d,a)},beforeRender:function(){this._super("beforeRender",this,arguments),this.well===!0&&this.$el.addClass("well"),this.selectable===!0&&this.$el.addClass("btn-selectable"),this.$el.addClass("toolbar-"+this.orientation),this.align==="right"&&this.$el.addClass("pull-right");if(this.align==="left")return this.$el.addClass("pull-left")},render:function(){var a,b,c,e;this.$el.empty(),e=d(this.buttons);for(b=0,c=e.length;b<c;b++)a=e[b],this.$el.append(a);return this}}),b=Backbone.View.prototype.make,a=function(a,c){var e,f,g,h,i,j,k,l,m,n,o=this;c==null&&(c=!0);if(a.ctype!=null||a.type!=null){a.className||(a.className=""),a.className+="toolbar-component",l=Luca(a).render();if(Luca.isBackboneView(l))return l.$el}return a.spacer?b("div",{"class":"spacer "+a.spacer}):a.text?b("div",{"class":"toolbar-text"},a.text):(n="btn-group",a.wrapper!=null&&(n+=""+a.wrapper),a.align!=null&&(n+="pull-"+a.align+" align-"+a.align),a.selectable===!0&&(n+="btn-selectable"),a.group!=null&&a.buttons!=null?(h=d(a.buttons,!1),b("div",{"class":n},h)):(k=a.label||(a.label=""),a.eventId||(a.eventId=_.string.dasherize(a.label.toLowerCase())),a.icon&&(_.string.isBlank(k)&&(k=" "),a.white&&(m="icon-white"),k="<i class='"+(m||"")+" icon-"+a.icon+"' /> "+k),f={"class":_.compact(["btn",a.classes,a.className]).join(" "),"data-eventId":a.eventId,title:a.title||a.description},a.color!=null&&(f["class"]+=" btn-"+a.color),a.selected!=null&&(f["class"]+=" is-selected"),a.dropdown&&(k=""+k+" <span class='caret'></span>",f["class"]+=" dropdown-toggle",f["data-toggle"]="dropdown",j=_(a.dropdown).map(function(a){var c;return c=b("a",{},a[1]),b("li",{"data-eventId":a[0]},c)}),i=b("ul",{"class":"dropdown-menu"},j)),g=b("a",f,k),e="btn-group",a.align!=null&&(e+=" align-"+a.align),c===!0?b("div",{"class":e},[g,i]):g))},d=function(b,c){var d,e,f,g;b==null&&(b=[]),c==null&&(c=!0),g=[];for(e=0,f=b.length;e<f;e++)d=b[e],g.push(a(d,c));return g}}.call(this),function(){_.def("Luca.containers.PanelView")["extends"]("Luca.core.Container")["with"]({className:"luca-ui-panel",initialize:function(a){return this.options=a!=null?a:{},Luca.core.Container.prototype.initialize.apply(this,arguments)},afterLayout:function(){var a;if(this.template)return a=(Luca.templates||JST)[this.template](this),this.$el.html(a)},render:function(){return $(this.container).append(this.$el)},afterRender:function(){var a,b=this;(a=Luca.core.Container.prototype.afterRender)!=null&&a.apply(this,arguments);if(this.css)return _(this.css).each(function(a,c){return b.$el.css(c,a)})}})}.call(this),function(){_.def("Luca.containers.TabView")["extends"]("Luca.containers.CardView")["with"]({hooks:["before:select","after:select"],componentType:"tab_view",className:"luca-ui-tab-view tabbable",tab_position:"top",tabVerticalOffset:"50px",navClass:"nav-tabs",bodyTemplate:"containers/tab_view",bodyEl:"div.tab-content",initialize:function(a){return this.options=a!=null?a:{},this.navStyle==="list"&&(this.navClass="nav-list"),Luca.containers.CardView.prototype.initialize.apply(this,arguments),_.bindAll(this,"select","highlightSelectedTab"),this.setupHooks(this.hooks),this.bind("after:card:switch",this.highlightSelectedTab)},activeTabSelector:function(){return this.tabSelectors().eq(this.activeCard||this.activeTab||this.activeItem)},beforeLayout:function(){var a;return this.$el.addClass("tabs-"+this.tab_position),this.activeTabSelector().addClass("active"),this.createTabSelectors(),(a=Luca.containers.CardView.prototype.beforeLayout)!=null?a.apply(this,arguments):void 0},afterRender:function(){var a,b;(b=Luca.containers.CardView.prototype.afterRender)!=null&&b.apply(this,arguments),a=this.tabContainer().attr("id"),this.registerEvent("click #"+a+" li a","select");if(Luca.enableBootstrap&&(this.tab_position==="left"||this.tab_position==="right"))return this.tabContainerWrapper().addClass("span2"),this.tabContentWrapper().addClass("span9")},createTabSelectors:function(){var a;return a=this,this.each(function(b,c){var d,e,f,g;b.tabIcon&&(d="<i class='icon-"+b.tabIcon+"'></i>"),e="<a href='#'>"+(d||"")+" "+b.title+"</a>",f=a.make("li",{"class":"tab-selector","data-target":c},e),a.tabContainer().append(f);if(b.navHeading!=null&&((g=a.navHeadings)!=null?!g[b.navHeading]:!void 0))return $(f).before(a.make("li",{"class":"nav-header"},b.navHeading)),a.navHeadings||(a.navHeadings={}),a.navHeadings[b.navHeading]=!0})},highlightSelectedTab:function(){return this.tabSelectors().removeClass("active"),this.activeTabSelector().addClass("active")},select:function(a){var b,c;return a.preventDefault(),b=c=$(a.target),this.trigger("before:select",this),this.activate(c.parent().data("target")),this.trigger("after:select",this)},componentElements:function(){return this.$(">.tab-content >."+this.componentClass)},tabContentWrapper:function(){return $("#"+this.cid+"-tab-view-content")},tabContainerWrapper:function(){return $("#"+this.cid+"-tabs-selector")},tabContainer:function(){return this.$("ul."+this.navClass,this.tabContainerWrapper())},tabSelectors:function(){return this.$("li.tab-selector",this.tabContainer())}})}.call(this),function(){_.def("Luca.containers.Viewport").extend("Luca.containers.CardView")["with"]({activeItem:0,additionalClassNames:"luca-ui-viewport",fullscreen:!0,fluid:!1,initialize:function(a){this.options=a!=null?a:{},_.extend(this,this.options),Luca.enableBootstrap===!0&&(this.wrapperClass=this.fluid===!0?Luca.containers.Viewport.fluidWrapperClass:Luca.containers.Viewport.defaultWrapperClass),Luca.core.Container.prototype.initialize.apply(this,arguments);if(this.fullscreen===!0)return this.enableFullscreen()},enableFluid:function(){return this.enableWrapper()},disableFluid:function(){return this.disableWrapper()},enableWrapper:function(){if(this.wrapperClass!=null)return this.$el.parent().addClass(this.wrapperClass)},disableWrapper:function(){if(this.wrapperClass!=null)return this.$el.parent().removeClass(this.wrapperClass)},enableFullscreen:function(){return $("html,body").addClass("luca-ui-fullscreen"),this.$el.addClass("fullscreen-enabled")},disableFullscreen:function(){return $("html,body").removeClass("luca-ui-fullscreen"),this.$el.removeClass("fullscreen-enabled")},beforeRender:function(){var a;(a=Luca.containers.CardView.prototype.beforeRender)!=null&&a.apply(this,arguments),this.topNav!=null&&this.renderTopNavigation();if(this.bottomNav!=null)return this.renderBottomNavigation()},height:function(){return this.$el.height()},width:function(){return this.$el.width()},afterRender:function(){var a;(a=Luca.containers.CardView.prototype.after)!=null&&a.apply(this,arguments);if(Luca.enableBootstrap===!0&&this.containerClassName)return this.$el.children().wrap('<div class="#{ containerClassName }" />')},renderTopNavigation:function(){var a;if(this.topNav==null)return;return _.isString(this.topNav)&&(this.topNav=Luca.util.lazyComponent(this.topNav)),_.isObject(this.topNav)&&((a=this.topNav).ctype||(a.ctype=this.topNav.type||"nav_bar"),Luca.isBackboneView(this.topNav)||(this.topNav=Luca.util.lazyComponent(this.topNav))),this.topNav.app=this,$("body").prepend(this.topNav.render().el)},renderBottomNavigation:function(){}}),Luca.containers.Viewport.defaultWrapperClass="row",Luca.containers.Viewport.fluidWrapperClass="row-fluid"}.call(this),function(){_.def("Luca.components.Template")["extends"]("Luca.View")["with"]({initialize:function(a){return this.options=a!=null?a:{},console.log("The Use of Luca.components.Template directly is being DEPRECATED"),Luca.View.prototype.initialize.apply(this,arguments)}})}.call
8
+ (this),function(){Luca.util.startHistory=function(){return Backbone.history.start()},_.def("Luca.Application")["extends"]("Luca.containers.Viewport")["with"]({name:"MyApp",defaultState:{},autoBoot:!1,autoStartHistory:"before:render",useCollectionManager:!0,collectionManager:{},collectionManagerClass:"Luca.CollectionManager",plugin:!1,useController:!0,useKeyHandler:!1,keyEvents:{},components:[{ctype:"template",name:"welcome",template:"sample/welcome",templateContainer:"Luca.templates"}],initialize:function(a){var b,c,d,e,f=this;this.options=a!=null?a:{},c=this,d=this.name,b=typeof Luca.getApplication=="function"?Luca.getApplication():void 0,(e=Luca.Application).instances||(e.instances={}),Luca.Application.instances[d]=c,Luca.containers.Viewport.prototype.initialize.apply(this,arguments),this.state=new Luca.Model(this.defaultState),this.useController===!0&&this.setupMainController(),this.setupCollectionManager(),this.defer(function(){return c.render()}).until(this,"ready"),this.setupRouter(),this.useKeyRouter===!0&&console.log("The useKeyRouter property is being deprecated. switch to useKeyHandler instead"),(this.useKeyHandler===!0||this.useKeyRouter===!0)&&this.keyEvents!=null&&this.setupKeyHandler(),this.plugin!==!0&&!b&&(Luca.getApplication=function(a){return a==null?c:Luca.Application.instances[a]});if(this.autoBoot){if(Luca.util.resolve(this.name))throw"Attempting to override window."+this.name+" when it already exists";return $(function(){return window[d]=c,c.boot()})}},activeView:function(){var a;return(a=this.activeSubSection())?this.view(a):this.view(this.activeSection())},activeSection:function(){return this.get("active_section")},activeSubSection:function(){return this.get("active_sub_section")},activePages:function(){var a=this;return this.$(".luca-ui-controller").map(function(a,b){return $(b).data("active-section")})},boot:function(){return this.trigger("ready")},collection:function(){return this.collectionManager.getOrCreate.apply(this.collectionManager,arguments)},get:function(a){return this.state.get(a)},set:function(a,b,c){return this.state.set.apply(this.state,arguments)},view:function(a){return Luca.cache(a)},navigate_to:function(a,b){return this.getMainController().navigate_to(a,b)},getMainController:function(){return this.useController===!0?this.components[0]:Luca.cache("main_controller")},keyHandler:function(a){var b,c,d,e,f,g,h;if(!a||!this.keyEvents)return;c=$(a.target).is("input")||$(a.target).is("textarea");if(c)return;e=Luca.keyMap[a.keyCode];if(!e)return;f=(a!=null?a.metaKey:void 0)===!0,b=(a!=null?a.ctrlKey:void 0)===!0,g=this.keyEvents,g=f?this.keyEvents.meta:g,g=b?this.keyEvents.control:g,g=f&&b?this.keyEvents.meta_control:g;if(d=g!=null?g[e]:void 0)return this[d]!=null&&_.isFunction(this[d])?(h=this[d])!=null?h.call(this):void 0:this.trigger(d,a,e)},setupControllerBindings:function(){var a,b,c,d=this;return a=this,(b=this.getMainController())!=null&&b.bind("after:card:switch",function(b,c){return d.state.set({active_section:c.name}),a.trigger("page:change")}),(c=this.getMainController())!=null?c.each(function(b){var c;c=b.type||b.type;if(c.match(/controller$/))return b.bind("after:card:switch",function(b,c){return d.state.set({active_sub_section:c.name}),a.trigger("sub:page:change")})}):void 0},setupMainController:function(){var a;if(this.useController===!0)return a=this.components||[],this.components=[{type:"controller",name:"main_controller",components:a}],this.defer(this.setupControllerBindings,!1).until("after:components")},setupCollectionManager:function(){var a,b,c,d,e;if(this.useCollectionManager!==!0)return;if(this.collectionManager!=null&&((c=this.collectionManager)!=null?c.get:void 0)!=null)return;_.isString(this.collectionManagerClass)&&(this.collectionManagerClass=Luca.util.resolve(this.collectionManagerClass)),a=this.collectionManagerOptions||{},_.isObject(this.collectionManager)&&!_.isFunction((d=this.collectionManager)!=null?d.get:void 0)&&(a=this.collectionManager,this.collectionManager=void 0),_.isString(this.collectionManager)&&(a={name:this.collectionManager}),this.collectionManager=typeof (b=Luca.CollectionManager).get=="function"?b.get(a.name):void 0;if(!_.isFunction((e=this.collectionManager)!=null?e.get:void 0))return this.collectionManager=new this.collectionManagerClass(a)},setupRouter:function(){var a,b;a=this,_.isString(this.router)&&(b=Luca.util.resolve(this.router),this.router=new b({app:a}));if(this.router&&this.autoStartHistory)return this.autoStartHistory===!0&&(this.autoStartHistory="before:render"),this.defer(Luca.util.startHistory,!1).until(this,this.autoStartHistory)},setupKeyHandler:function(){var a,b,c,d,e,f,g;if(!this.keyEvents)return;(c=this.keyEvents).control_meta||(c.control_meta={}),this.keyEvents.meta_control&&_.extend(this.keyEvents.control_meta,this.keyEvents.meta_control),a=_.bind(this.keyHandler,this),f=this.keypressEvents||["keydown"],g=[];for(d=0,e=f.length;d<e;d++)b=f[d],g.push($(document).on(b,a));return g}})}.call(this),function(){_.def("Luca.components.Toolbar")["extends"]("Luca.core.Container")["with"]({className:"luca-ui-toolbar toolbar",position:"bottom",initialize:function(a){return this.options=a!=null?a:{},Luca.core.Container.prototype.initialize.apply(this,arguments)},prepareComponents:function(){var a=this;return _(this.components).each(function(b){return b.container=a.$el})},render:function(){return $(this.container).append(this.el)}})}.call(this),function(){_.def("Luca.components.CollectionLoaderView")["extends"]("Luca.components.Template")["with"]({className:"luca-ui-collection-loader-view",template:"components/collection_loader_view",initialize:function(a){return this.options=a!=null?a:{},Luca.components.Template.prototype.initialize.apply(this,arguments),this.container||(this.container=$("body")),this.manager||(this.manager=Luca.CollectionManager.get()),this.setupBindings()},modalContainer:function(){return $("#progress-modal",this.el)},setupBindings:function(){var a=this;return this.manager.bind("collection_loaded",function(b){var c,d,e,f;return d=a.manager.loadedCollectionsCount(),f=a.manager.totalCollectionsCount(),e=parseInt(d/f*100),c=_.string.titleize(_.string.humanize(b)),a.modalContainer().find(".progress .bar").attr("style","width: "+e+"%;"),a.modalContainer().find(".message").html("Loaded "+c+"...")}),this.manager.bind("all_collections_loaded",function(){return a.modalContainer().find(".message").html("All done!"),_.delay(function(){return a.modalContainer().modal("hide")},400)})}})}.call(this),function(){var a,b;a=Luca.define("Luca.components.CollectionView"),a["extends"]("Luca.components.Panel"),a.behavesAs("LoadMaskable","Filterable","Paginatable"),a.triggers("before:refresh","after:refresh","refresh","empty:results"),a.defaults({tagName:"ol",className:"luca-ui-collection-view",bodyClassName:"collection-ui-panel",itemTemplate:void 0,itemRenderer:void 0,itemTagName:"li",itemClassName:"collection-item",initialize:function(a){var b=this;this.options=a!=null?a:{},_.extend(this,this.options),_.bindAll(this,"refresh");if(this.collection==null&&!this.options.collection)throw console.log("Error on initialize of collection view",this),"Collection Views must specify a collection";if(this.itemTemplate==null&&this.itemRenderer==null&&this.itemProperty==null)throw"Collection Views must specify an item template or item renderer function";_.isString(this.collection)&&(Luca.CollectionManager.get()?this.collection=Luca.CollectionManager.get().getOrCreate(this.collection):console.log("String Collection but no collection manager"));if(!Luca.isBackboneCollection(this.collection))throw console.log("Missing Collection on "+(this.name||this.cid),this,this.collection),"Collection Views must have a valid backbone collection";return Luca.components.Panel.prototype.initialize.apply(this,arguments),this.autoRefreshOnModelsPresent!==!1&&this.defer(function(){if(b.collection.length>0)return b.refresh()}).until("after:render"),this.on("refresh",this.refresh,this)},attributesForItem:function(a,b){return _.extend({},{"class":this.itemClassName,"data-index":a.index,"data-model-id":a.model.get("id")})},contentForItem:function(a){var b,c;return a==null&&(a={}),this.itemTemplate!=null&&(c=Luca.template(this.itemTemplate))?b=c.call(this,a):this.itemRenderer!=null&&_.isFunction(this.itemRenderer)?b=this.itemRenderer.call(this,a,a.model,a.index):this.itemProperty&&a.model!=null?b=a.model.read(this.itemProperty):""},makeItem:function(a,c){var d,e,f;f=this.prepareItem!=null?this.prepareItem.call(this,a,c):{model:a,index:c},d=this.attributesForItem(f,a),e=this.contentForItem(f);try{return b(this.itemTagName,d,e)}catch(g){return console.log("Error generating DOM element for CollectionView",this,a,c)}},getCollection:function(){return this.collection},applyQuery:function(a,b){return a==null&&(a={}),b==null&&(b={}),this.query=a,this.queryOptions=b,this.refresh(),this},getQuery:function(){var a,b,c,d,e;a=this.query||(this.query={}),e=_(this.querySources||[]).compact();for(c=0,d=e.length;c<d;c++)b=e[c],a=_.extend(a,b()||{});return a},getQueryOptions:function(){var a,b,c,d,e;b=this.queryOptions||(this.queryOptions={}),e=_(this.optionsSources||[]).compact();for(c=0,d=e.length;c<d;c++)a=e[c],b=_.extend(b,a()||{});return b},getModels:function(a,b){var c;return((c=this.collection)!=null?c.query:void 0)?(a||(a=this.getQuery()),b||(b=this.getQueryOptions()),this.collection.query(a,b)):this.collection.models},locateItemElement:function(a){return this.$("."+this.itemClassName+"[data-model-id='"+a+"']")},refreshModel:function(a){var b;return b=this.collection.indexOf(a),this.locateItemElement(a.get("id")).empty().append(this.contentForItem({model:a,index:b},a)),this.trigger("model:refreshed",b,a)},refresh:function(a,b,c){var d,e,f,g;a||(a=this.getQuery()),b||(b=this.getQueryOptions()),c||(c=this.getModels(a,b)),this.$bodyEl().empty(),this.trigger("before:refresh",c,a,b),c.length===0&&this.trigger("empty:results"),d=0;for(f=0,g=c.length;f<g;f++)e=c[f],this.$append(this.makeItem(e,d++));return this.trigger("after:refresh",c,a,b),this},registerEvent:function(a,b,c){var d;return c==null&&_.isFunction(b)&&(c=b,b=void 0),d=_([a,""+this.itemTagName+"."+this.itemClassName,b]).compact().join(" "),Luca.View.prototype.registerEvent(d,c)},render:function(){return this.refresh(),this.$el.parent().length>0&&this.container!=null&&this.$attach(),this}}),b=Luca.View.prototype.make}.call(this),function(){_.def("Luca.components.Controller")["extends"]("Luca.containers.CardView")["with"]({additionalClassNames:["luca-ui-controller"],activeAttribute:"active-section",initialize:function(a){var b;this.options=a,Luca.containers.CardView.prototype.initialize.apply(this,arguments),this.defaultCard||(this.defaultCard=(b=this.components[0])!=null?b.name:void 0);if(!this.defaultCard)throw"Controllers must specify a defaultCard property and/or the first component must have a name";return this.state=new Backbone.Model({active_section:this.defaultCard})},each:function(a){var b=this;return _(this.components).each(function(c){return a.apply(b,[c])})},activeSection:function(){return this.get("activeSection")},controllers:function(a){return a==null&&(a=!1),this.select("ctype","controller",a)},availableSections:function(){var a,b=this;return a={},a[this.name]=this.sectionNames(),_(this.controllers()).reduce(function(a,b){return a[b.name]=b.sectionNames(),a},a)},sectionNames:function(a){return a==null&&(a=!1),this.pluck("name")},"default":function(a){return this.navigate_to(this.defaultCard,a)},navigate_to:function(a,b){var c=this;return a||(a=this.defaultCard),this.activate(a,!1,function(a,d,e){c.state.set({active_section:e.name});if(_.isFunction(b))return b.apply(e)}),this.find(a)}})}.call(this),function(){_.def("Luca.fields.ButtonField")["extends"]("Luca.core.Field")["with"]({readOnly:!0,events:{"click input":"click_handler"},hooks:["button:click"],className:"luca-ui-field luca-ui-button-field",template:"fields/button_field",click_handler:function(a){var b,c;return b=c=$(a.currentTarget),this.trigger("button:click")},initialize:function(a){var b;this.options=a!=null?a:{},_.extend(this.options),_.bindAll(this,"click_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments);if((b=this.icon_class)!=null?b.length:void 0)return this.template="fields/button_field_link"},afterInitialize:function(){this.input_id||(this.input_id=_.uniqueId("button")),this.input_name||(this.input_name=this.name||(this.name=this.input_id)),this.input_value||(this.input_value=this.label||(this.label=this.text)),this.input_type||(this.input_type="button"),this.input_class||(this.input_class=this["class"]),this.icon_class||(this.icon_class=""),this.icon_class.length&&!this.icon_class.match(/^icon-/)&&(this.icon_class="icon-"+this.icon_class);if(this.white)return this.icon_class+=" icon-white"},setValue:function(){return!0}})}.call(this),function(){var a;a=Luca.View.prototype.make,_.def("Luca.fields.CheckboxArray")["extends"]("Luca.core.Field")["with"]({version:2,template:"fields/checkbox_array",className:"luca-ui-checkbox-array",events:{"click input":"clickHandler"},selectedItems:[],initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.modules.Deferrable),_.bindAll(this,"renderCheckboxes","clickHandler","checkSelected"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.valueField||(this.valueField="id"),this.displayField||(this.displayField="name")},afterInitialize:function(a){var b;this.options=a!=null?a:{};try{this.configure_collection()}catch(c){console.log("Error Configuring Collection",this,c.message)}return b=this,this.collection.length>0?this.renderCheckboxes():this.defer("renderCheckboxes").until(this.collection,"reset")},clickHandler:function(a){var b;b=$(a.target);if(b.prop("checked"))return this.selectedItems.push(b.val());if(_(this.selectedItems).include(b.val()))return this.selectedItems=_(this.selectedItems).without(b.val())},controls:function(){return this.$(".controls")},renderCheckboxes:function(){var b=this;return this.controls().empty(),this.selectedItems=[],this.collection.each(function(c){var d,e,f,g,h;return h=c.get(b.valueField),g=c.get(b.displayField),f=_.uniqueId(""+b.cid+"_checkbox"),e=a("input",{type:"checkbox","class":"array-checkbox",name:b.input_name,value:h,id:f}),d=a("label",{"for":f},e),$(d).append(" "+g),b.controls().append(d)}),this.trigger("checkboxes:rendered",this.checkboxesRendered=!0),this},uncheckAll:function(){return this.allFields().prop("checked",!1)},allFields:function(){return this.controls().find("input[type='checkbox']")},checkSelected:function(a){var b,c,d,e,f;a!=null&&(this.selectedItems=a),this.uncheckAll(),f=this.selectedItems;for(d=0,e=f.length;d<e;d++)c=f[d],b=this.controls().find("input[value='"+c+"']"),b.prop("checked",!0);return this.selectedItems},getValue:function(){var a,b,c,d,e;d=this.allFields(),e=[];for(b=0,c=d.length;b<c;b++)a=d[b],this.$(a).prop("checked")&&e.push(this.$(a).val());return e},setValue:function(a){var b;return this.selectedItems=a,this.checkboxesRendered===!0?this.checkSelected(a):(b=this,this.defer(function(){return b.checkSelected(a)}).until("checkboxes:rendered"))},getValues:function(){return this.getValue()},setValues:function(a){return this.setValue(a)}})}.call(this),function(){_.def("Luca.fields.CheckboxField")["extends"]("Luca.core.Field")["with"]({events:{"change input":"change_handler"},className:"luca-ui-checkbox-field luca-ui-field",template:"fields/checkbox_field",hooks:["checked","unchecked"],send_blanks:!0,change_handler:function(a){var b,c;return b=c=$(a.target),b.is(":checked")?this.trigger("checked"):this.trigger("unchecked"),this.trigger("on:change",this,a,b.is(":checked"))},initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),_.bindAll(this,"change_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments)},afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_value||(this.input_value=1),this.label||(this.label=this.name)},setValue:function(a){return this.getInputElement().attr("checked",a)},getValue:function(){return this.getInputElement().is(":checked")}})}.call(this),function(){_.def("Luca.fields.FileUploadField")["extends"]("Luca.core.Field")["with"]({template:"fields/file_upload_field",afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.helperText||(this.helperText="")}})}.call(this),function(){_.def("Luca.fields.HiddenField")["extends"]("Luca.core.Field")["with"]({template:"fields/hidden_field",afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_value||(this.input_value=this.value),this.label||(this.label=this.name)}})}.call(this),function(){_.def("Luca.components.LabelField")["extends"]("Luca.core.Field")["with"]({className:"luca-ui-field luca-ui-label-field",formatter:function(a){return a||(a=this.getValue()),_.str.titleize(a)},setValue:function(a){return this.trigger("change",a,this.getValue()),this.getInputElement().attr("value",a),this.$(".value").html(this.formatter(a))}})}.call(this),function(){_.def("Luca.fields.SelectField")["extends"]("Luca.core.Field")["with"]({events:{"change select":"change_handler"},hooks:["after:select"],className:"luca-ui-select-field luca-ui-field",template:"fields/select_field",includeBlank:!0,blankValue:"",blankText:"Select One",initialize:function(a){this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.modules.Deferrable),_.bindAll(this,"change_handler","populateOptions","beforeFetch"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name);if(_.isUndefined(this.retainValue))return this.retainValue=!0},afterInitialize:function(){var a;if((a=this.collection)!=null?a.data:void 0)this.valueField||(this.valueField="id"),this.displayField||(this.displayField="name"),this.parseData();try{this.configure_collection()}catch(b){console.log("Error Configuring Collection",this,b.message)}return this.collection.bind("before:fetch",this.beforeFetch),this.collection.bind("reset",this.populateOptions)},parseData:function(){var a=this;return this.collection.data=_(this.collection.data).map(function(b){var c;return _.isArray(b)?(c={},c[a.valueField]=b[0],c[a.displayField]=b[1]||b[0],c):b})},getInputElement:function(){return this.input||(this.input=this.$("select").eq(0))},afterRender:function(){var a,b;return((a=this.collection)!=null?(b=a.models)!=null?b.length:void 0:void 0)>0?this.populateOptions():this.collection.trigger("reset")},setValue:function(a){return this.currentValue=a,Luca.core.Field.prototype.setValue.apply(this,arguments)},beforeFetch:function(){return this.resetOptions()},change_handler:function(a){return this.trigger("on:change",this,a)},resetOptions:function(){this.getInputElement().html("");if(this.includeBlank)return this.getInputElement().append("<option value='"+this.blankValue+"'>"+this.blankText+"</option>")},populateOptions:function(){var a,b=this;return this.resetOptions(),((a=this.collection)!=null?a.each:void 0)!=null&&this.collection.each(function(a){var c,d,e,f;return f=a.get(b.valueField),c=a.get(b.displayField),b.selected&&f===b.selected&&(e="selected"),d="<option "+e+" value='"+f+"'>"+c+"</option>",b.getInputElement().append(d)}),this.trigger("after:populate:options",this),this.setValue(this.currentValue)}})}.call(this),function(){_.def("Luca.fields.TextAreaField")["extends"]("Luca.core.Field")["with"]({events:{"keydown input":"keydown_handler","blur input":"blur_handler","focus input":"focus_handler"},template:"fields/text_area_field",height:"200px",width:"90%",initialize:function(a){return this.options=a!=null?a:{},_.bindAll(this,"keydown_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.input_class||(this.input_class=this["class"]),this.input_value||(this.input_value=""),this.inputStyles||(this.inputStyles="height:"+this.height+";width:"+this.width)},setValue:function(a){return $(this.field()).val(a)},getValue:function(){return $(this.field()).val()},field:function(){return this.input=$("textarea#"+this.input_id,this.el)},keydown_handler:function(a){var b,c;return b=c=$(a.currentTarget)},blur_handler:function(a){var b,c;return b=c=$(a.currentTarget)},focus_handler:function(a){var b,c;return b=c=$(a.currentTarget)}})}.call(this),function(){_.def("Luca.fields.TextField")["extends"]("Luca.core.Field")["with"]({events:{"blur input":"blur_handler","focus input":"focus_handler","change input":"change_handler"},template:"fields/text_field",autoBindEventHandlers:!0,send_blanks:!0,keyEventThrottle:300,initialize:function(a){return this.options=a!=null?a:{},this.enableKeyEvents&&this.registerEvent("keyup input","keyup_handler"),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.input_class||(this.input_class=this["class"]),this.input_value||(this.input_value=this.value||""),this.prepend&&(this.$el.addClass("input-prepend"),this.addOn=this.prepend),this.append&&(this.$el.addClass("input-append"),this.addOn=this.append),Luca.core.Field.prototype.initialize.apply(this,arguments)},keyup_handler:function(a){return this.trigger("on:keyup",this,a)},blur_handler:function(a){return this.trigger("on:blur",this,a)},focus_handler:function(a){return this.trigger("on:focus",this,a)},change_handler:function(a){return this.trigger("on:change",this,a)}})}.call(this),function(){_.def("Luca.fields.TypeAheadField")["extends"]("Luca.fields.TextField")["with"]({className:"luca-ui-field",getSource:function(){return Luca.util.read(this.source)||[]},matcher:function(a){return!0},beforeRender:function(){return Luca.fields.TextField.prototype.beforeRender.apply(this,arguments),this.getInputElement().attr("data-provide","typeahead")},afterRender:function(){return Luca.fields.TextField.prototype.afterRender.apply(this,arguments),this.getInputElement().typeahead({matcher:this.matcher,source:this.getSource()})}})}.call(this),function(){_.def("Luca.components.FormButtonToolbar")["extends"]("Luca.components.Toolbar")["with"]({className:"luca-ui-form-toolbar form-actions",position:"bottom",includeReset:!1,render:function(){return $(this.container).append(this.el)},initialize:function(a){this.options=a!=null?a:{},Luca.components.Toolbar.prototype.initialize.apply(this,arguments),this.components=[{ctype:"button_field",label:"Submit","class":"btn submit-button"}];if(this.includeReset)return this.components.push({ctype:"button_field",label:"Reset","class":"btn reset-button"})}})}.call(this),function(){_.def("Luca.components.FormView")["extends"]("Luca.core.Container")["with"]({tagName:"form",className:"luca-ui-form-view",hooks:["before:submit","before:reset","before:load","before:load:new","before:load:existing","after:submit","after:reset","after:load","after:load:new","after:load:existing","after:submit:success","after:submit:fatal_error","after:submit:error"],events:{"click .submit-button":"submitHandler","click .reset-button":"resetHandler"},toolbar:!0,legend:"",bodyClassName:"form-view-body",version:"0.9.33333333",initialize:function(a){this.options=a!=null?a:{},this.loadMask==null&&(this.loadMask=Luca.enableBootstrap),Luca.core.Container.prototype.initialize.apply(this,arguments),this.components||(this.components=this.fields),_.bindAll(this,"submitHandler","resetHandler","renderToolbars","applyLoadMask"),this.state||(this.state=new Backbone.Model),this.setupHooks(this.hooks),this.applyStyleClasses();if(this.toolbar!==!1&&!this.topToolbar&&!this.bottomToolbar){if(this.toolbar==="both"||this.toolbar==="top")this.topToolbar=this.getDefaultToolbar();if(this.toolbar!=="top")return this.bottomToolbar=this.getDefaultToolbar()}},getDefaultToolbar:function(){return Luca.components.FormView.defaultFormViewToolbar},applyStyleClasses:function(){Luca.enableBootstrap&&this.applyBootstrapStyleClasses(),this.labelAlign&&this.$el.addClass("label-align-"+this.labelAlign);if(this.fieldLayoutClass)return this.$el.addClass(this.fieldLayoutClass)},applyBootstrapStyleClasses:function(){this.labelAlign==="left"&&(this.inlineForm=!0),this.well&&this.$el.addClass("well"),this.searchForm&&this.$el.addClass("form-search"),this.horizontalForm&&this.$el.addClass("form-horizontal");if(this.inlineForm)return this.$el.addClass("form-inline")},resetHandler:function(a){var b,c;return b=c=$(a!=null?a.target:void 0),this.trigger("before:reset",this),this.reset(),this.trigger("after:reset",this)},submitHandler:function(a){var b,c;b=c=$(a!=null?a.target:void 0),this.trigger("before:submit",this),this.loadMask===!0&&this.trigger("enable:loadmask",this);if(this.hasModel())return this.submit()},afterComponents:function(){var a,b=this;return(a=Luca.core.Container.prototype.afterComponents)!=null&&a.apply(this,arguments),this.eachField(function(a){return a.getForm=function(){return b},a.getModel=function(){return b.currentModel()}})},eachField:function(a){return _(this.getFields()).map(a)},getField:function(a){var b;return b=_(this.getFields("name",a)).first(),b!=null?b:_(this.getFields("input_name",a)).first()},getFields:function(a,b){var c;return c=this.selectByAttribute("isField",!0,!0),a!=null&&b!=null&&(c=_(c).select(function(c){var d;return d=c[a],_.isFunction(d)&&(d=d.call(c)),d===b})),c},loadModel:function(a){var b,c,d,e;this.current_model=a,d=this,c=this.getFields(),this.trigger("before:load",this,this.current_model),this.current_model&&((e=this.current_model.beforeFormLoad)!=null&&e.apply(this.current_model,this),b="before:load:"+(this.current_model.isNew()?"new":"existing"),this.trigger(b,this,this.current_model)),this.setValues(this.current_model),this.trigger("after:load",this,this.current_model);if(this.current_model)return this.trigger("after:load:"+(this.current_model.isNew()?"new":"existing"),this,this.current_model)},reset:function(){if(this.current_model!=null)return this.loadModel(this.current_model)},clear:function(){var a=this;return this.current_model=this.defaultModel!=null?this.defaultModel():void 0,_(this.getFields()).each(function(b){try{return b.setValue("")}catch(c){return console.log("Error Clearing",a,b)}})},setValues:function(a,b){var c,d=this;b==null&&(b={}),a||(a=this.currentModel()),c=this.getFields(),_(c).each(function(b){var c,e;c=b.input_name||b.name,(e=a[c])&&_.isFunction(e)&&(e=e.apply(d)),!e&&Luca.isBackboneModel(a)&&(e=a.get(c));if(b.readOnly!==!0)return b!=null?b.setValue(e):void 0});if(b.silent!=null!=1)return this.syncFormWithModel()},getValues:function(a){var b,c=this;return a==null&&(a={}),a.reject_blank==null&&(a.reject_blank=!0),a.skip_buttons==null&&(a.skip_buttons=!0),a.blanks===!1&&(a.reject_blank=!0),b=_(this.getFields()).inject(function(b,c){var d,e,f,g,h;return g=c.getValue(),e=c.input_name||c.name,h=!!_.str.isBlank(g)||!!_.isUndefined(g),d=!a.reject_blank&&!c.send_blanks,a.debug&&console.log(""+e+" Options",a,"Value",g,"Value Is Blank?",h,"Allow Blanks?",d),a.skip_buttons&&c.ctype==="button_field"?f=!0:(h&&d===!1&&(f=!0),c.input_name==="id"&&h===!0&&(f=!0)),a.debug&&console.log("Skip is true on "+e),f!==!0&&(b[e]=g),b},a.defaults||{}),b},submit_success_handler:function(a,b,c){return this.trigger("after:submit",this,a,b),this.loadMask===!0&&this.trigger("disable:loadmask",this),b&&(b!=null?b.success:void 0)===!0?this.trigger("after:submit:success",this,a,b):this.trigger("after:submit:error",this,a,b)},submit_fatal_error_handler:function(a,b,c){return this.trigger("after:submit",this,a,b),this.trigger("after:submit:fatal_error",this,a,b)},submit:function(a,b){a==null&&(a=!0),b==null&&(b={}),_.bindAll(this,"submit_success_handler","submit_fatal_error_handler"),b.success||(b.success=this.submit_success_handler),b.error||(b.error=this.submit_fatal_error_handler),this.syncFormWithModel();if(!a)return;return this.current_model.save(this.current_model.toJSON(),b)},hasModel:function(){return this.current_model!=null},currentModel:function(a){return a==null&&(a={}),(a===!0||(a!=null?a.refresh:void 0)===!0)&&this.syncFormWithModel(),this.current_model},syncFormWithModel:function(){var a;return(a=this.current_model)!=null?a.set(this.getValues()):void 0},setLegend:function(a){return this.legend=a,$("fieldset legend",this.el).first().html(this.legend)},flash:function(a){return this.$(".toolbar-container.top").length>0?this.$(".toolbar-container.top").after(a):this.$bodyEl().prepend(a)},successFlashDelay:1500,successMessage:function(a){var b=this;return this.$(".alert.alert-success").remove(),this.flash(Luca.template("components/form_alert",{className:"alert alert-success",message:a})),_.delay(function(){return b.$(".alert.alert-success").fadeOut()},this.successFlashDelay||0)},errorMessage:function(a){return this.$(".alert.alert-error").remove(),this.flash(Luca.template("components/form_alert",{className:"alert alert-error",message:a}))}}),Luca.components.FormView.defaultFormViewToolbar={buttons:[{icon:"remove-sign",label:"Reset",eventId:"click:reset",className:"reset-button",align:"right"},{icon:"ok-sign",white:!0,label:"Save Changes",eventId:"click:submit",color:"success",className:"submit-button",align:"right"}]}}.call(this),function(){_.def("Luca.components.GridView").extend("Luca.components.Panel")["with"]({bodyTemplate:"components/grid_view",autoBindEventHandlers:!0,events:{"dblclick table tbody tr":"double_click_handler","click table tbody tr":"click_handler"},className:"luca-ui-g-view",rowClass:"luca-ui-g-row",wrapperClass:"luca-ui-g-view-wrapper",additionalWrapperClasses:[],wrapperStyles:{},scrollable:!0,emptyText:"No Results To display.",tableStyle:"striped",defaultHeight:285,defaultWidth:756,maxWidth:void 0,hooks:["before:grid:render","before:render:header","before:render:row","after:grid:render","row:double:click","row:click","after:collection:load"],initialize:function(a){var b=this;return this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.modules.Deferrable),this.loadMask==null&&(this.loadMask=Luca.enableBootstrap),this.loadMask===!0&&(this.loadMaskEl||(this.loadMaskEl=".luca-ui-g-view-body")),Luca.components.Panel.prototype.initialize.apply(this,arguments),this.configure_collection(!0),this.collection.bind("before:fetch",function(){if(b.loadMask===!0)return b.trigger("enable:loadmask")}),this.collection.bind("reset",function(a){return b.refresh(),b.loadMask===!0&&b.trigger("disable:loadmask"),b.trigger("after:collection:load",a)}),this.collection.bind("change",function(a){var c,d;if(b.rendered!==!0)return;try{return d=b.getRowEl(a.id||a.get("id")||a.cid),c=b.render_row(a,b.collection.indexOf(a),{cellsOnly:!0}),$(d).html(c.join(" "))}catch(e){return console.log("Error in change handler for GridView.collection",e,b,a)}})},beforeRender:function(){var a;return(a=Luca.components.Panel.prototype.beforeRender)!=null&&a.apply(this,arguments),this.trigger("before:grid:render",this),this.table=this.$("table.luca-ui-g-view"),this.header=this.$("thead"),this.body=this.$("tbody"),this.footer=this.$("tfoot"),this.wrapper=this.$("."+this.wrapperClass),this.applyCssClasses(),this.scrollable&&this.setDimensions(),this.renderHeader(),this.emptyMessage(),$(this.container).append(this.$el)},afterRender:function(){var a;return(a=Luca.components.Panel.prototype.afterRender)!=null&&a.apply(this,arguments),this.rendered=!0,this.refresh(),this.trigger("after:grid:render",this)},applyCssClasses:function(){var a,b=this;return this.scrollable&&this.$el.addClass("scrollable-g-view"),_(this.additionalWrapperClasses).each(function(a){var c;return(c=b.wrapper)!=null?c.addClass(a):void 0}),Luca.enableBootstrap&&this.table.addClass("table"),_((a=this.tableStyle)!=null?a.split(" "):void 0).each(function(a){return b.table.addClass("table-"+a)})},setDimensions:function(a){var b=this;return this.height||(this.height=this.defaultHeight),this.$(".luca-ui-g-view-body").height(this.height),this.$("tbody.scrollable").height(this.height-23),this.container_width=function(){return $(b.container).width()}(),this.width||(this.width=this.container_width>0?this.container_width:this.defaultWidth),this.width=_([this.width,this.maxWidth||this.width]).max(),this.$(".luca-ui-g-view-body").width(this.width),this.$(".luca-ui-g-view-body table"
9
+ ).width(this.width),this.setDefaultColumnWidths()},resize:function(a){var b,c,d=this;b=a-this.width,this.width=a,this.$(".luca-ui-g-view-body").width(this.width),this.$(".luca-ui-g-view-body table").width(this.width);if(this.columns.length>0)return c=b/this.columns.length,_(this.columns).each(function(a,b){var e;return e=$(".column-"+b,d.el),e.width(a.width=a.width+c)})},padLastColumn:function(){var a,b;a=_(this.columns).inject(function(a,b){return a=b.width+a},0),b=this.width-a;if(b>0)return this.lastColumn().width+=b},setDefaultColumnWidths:function(){var a;return a=this.columns.length>0?this.width/this.columns.length:200,_(this.columns).each(function(b){return parseInt(b.width||(b.width=a))}),this.padLastColumn()},lastColumn:function(){return this.columns[this.columns.length-1]},emptyMessage:function(a){return a==null&&(a=""),a||(a=this.emptyText),this.body.html(""),this.body.append(Luca.templates["components/grid_view_empty_text"]({colspan:this.columns.length,text:a}))},refresh:function(){var a=this;this.body.html(""),this.collection.each(function(b,c){return a.render_row.apply(a,[b,c])});if(this.collection.models.length===0)return this.emptyMessage()},ifLoaded:function(a,b){return b||(b=this),a||(a=function(){return!0}),this.collection.ifLoaded(a,b)},applyFilter:function(a,b){return b==null&&(b={auto:!0,refresh:!0}),this.collection.applyFilter(a,b)},renderHeader:function(){var a,b=this;return this.trigger("before:render:header"),a=_(this.columns).map(function(a,b){var c;return c=a.width?"width:"+a.width+"px;":"","<th style='"+c+"' class='column-"+b+"'>"+a.header+"</th>"}),this.header.append("<tr>"+a+"</tr>")},getRowEl:function(a){return this.$("[data-record-id="+a+"]","table")},render_row:function(a,b,c){var d,e,f,g,h,i,j=this;return c==null&&(c={}),h=this.rowClass,g=(a!=null?a.get:void 0)&&(a!=null?a.attributes:void 0)?a.get("id"):"",this.trigger("before:render:row",a,b),e=_(this.columns).map(function(b,c){var d,e,f;return f=j.cell_renderer(a,b,c),e=b.width?"width:"+b.width+"px;":"",d=_.isUndefined(f)?"":f,"<td style='"+e+"' class='column-"+c+"'>"+d+"</td>"}),c.cellsOnly?e:(d="",this.alternateRowClasses&&(d=b%2===0?"even":"odd"),f="<tr data-record-id='"+g+"' data-row-index='"+b+"' class='"+h+" "+d+"' id='row-"+b+"'>"+e+"</tr>",c.contentOnly===!0?f:(i=this.body)!=null?i.append(f):void 0)},cell_renderer:function(a,b,c){var d;return _.isFunction(b.renderer)?b.renderer.apply(this,[a,b,c]):b.data.match(/\w+\.\w+/)?(d=a.attributes||a,Luca.util.nestedValue(b.data,d)):(typeof a.get=="function"?a.get(b.data):void 0)||a[b.data]},double_click_handler:function(a){var b,c,d,e;return b=c=$(a.currentTarget),e=c.data("row-index"),d=this.collection.at(e),this.trigger("row:double:click",this,d,e)},click_handler:function(a){var b,c,d,e;return b=c=$(a.currentTarget),e=c.data("row-index"),d=this.collection.at(e),this.trigger("row:click",this,d,e),$("."+this.rowClass,this.body).removeClass("selected-row"),b.addClass("selected-row")}})}.call(this),function(){_.def("Luca.components.LoadMask")["extends"]("Luca.View")["with"]({className:"luca-ui-load-mask",bodyTemplate:"components/load_mask"})}.call(this),function(){var a,b,c;a=Luca.define("Luca.components.MultiCollectionView"),a["extends"]("Luca.containers.CardView"),a.behavesAs("LoadMaskable","Filterable","Paginatable"),a.triggers("before:refresh","after:refresh","refresh","empty:results"),a.defaultsTo({version:1,stateful:!0,defaultState:{activeView:0},viewContainerClass:"luca-ui-multi-view-container",initialize:function(a){var d,e,f,g;this.options=a!=null?a:{},this.components||(this.components=this.views),g=this.components;for(e=0,f=g.length;e<f;e++)d=g[e],c(d);return this.on("refresh",this.refresh,this),this.on("after:card:switch",this.refresh,this),this.on("after:components",b,this),this.debug("multi collection , proto initialize"),Luca.containers.CardView.prototype.initialize.apply(this,arguments)},relayAfterRefresh:function(a,b,c){return this.trigger("after:refresh",a,b,c)},refresh:function(){var a;return(a=this.activeComponent())!=null?a.trigger("refresh"):void 0},getCollection:function(){return this.collection},applyQuery:function(a,b){return a==null&&(a={}),b==null&&(b={}),this.query=a,this.queryOptions=b,this},getQuery:function(){var a,b,c,d,e;this.debug("Get Query"),a=this.query||(this.query={}),e=this.querySources;for(c=0,d=e.length;c<d;c++)b=e[c],a=_.extend(a,b()||{});return a},getQueryOptions:function(){var a,b,c,d,e;this.debug("Get Query Options"),b=this.queryOptions||(this.queryOptions={}),e=this.optionsSources;for(c=0,d=e.length;c<d;c++)a=e[c],b=_.extend(b,a()||{});return b}}),b=function(){var a,b,c,d,e,f,g=this;b=this,e=this.components,f=[];for(c=0,d=e.length;c<d;c++)a=e[c],a.on("after:refresh",function(a,b,c){return g.debug("collection member after refresh"),g.trigger("after:refresh",a,b,c)}),f.push(_.extend(a,{collection:b.getCollection(),getQuery:function(){return b.getQuery.call(b)},getQueryOptions:function(){return b.getQueryOptions.call(b)}}));return f},c=function(a){var b;b=a.type||a.ctype;if(b==="collection"||b==="collection_view"||b==="table"||b==="table_view")return;throw"The MultiCollectionView expects to contain multiple collection views"}}.call(this),function(){_.def("Luca.components.NavBar")["extends"]("Luca.View")["with"]({fixed:!0,position:"top",className:"navbar",brand:"Luca.js",bodyTemplate:"nav_bar",bodyClassName:"luca-ui-navbar-body",beforeRender:function(){this.fixed&&this.$el.addClass("navbar-fixed-"+this.position),this.brand!=null&&this.content().append("<a class='brand' href='#'>"+this.brand+"</a>");if(this.template)return this.content().append(Luca.template(this.template,this))},render:function(){return this},content:function(){return this.$(".container").eq(0)}})}.call(this),function(){_.def("Luca.PageController")["extends"]("Luca.components.Controller")["with"]({version:2})}.call(this),function(){var a;a=Luca.register("Luca.components.PaginationControl"),a["extends"]("Luca.View"),a.defines({template:"components/pagination",stateful:!0,autoBindEventHandlers:!0,events:{"click a[data-page-number]":"selectPage","click a.next":"nextPage","click a.prev":"previousPage"},afterInitialize:function(){var a=this;return _.bindAll(this,"updateWithPageCount"),this.state.on("change",function(b,c){return a.updateWithPageCount(b.get("numberOfPages"))})},limit:function(){var a;return parseInt(this.state.get("limit")||((a=this.collection)!=null?a.length:void 0))},page:function(){return parseInt(this.state.get("page")||1)},nextPage:function(){if(!this.nextEnabled())return;return this.state.set("page",this.page()+1)},previousPage:function(){if(!this.previousEnabled())return;return this.state.set("page",this.page()-1)},selectPage:function(a){var b,c;return b=c=this.$(a.target),b.is("a.page")||(b=c=c.closest("a.page")),c.siblings().removeClass("is-selected"),b.addClass("is-selected"),this.setPage(c.data("page-number"))},setPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.state.set("page",a,b)},setLimit:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.state.set("limit",a,b)},pageButtonContainer:function(){return this.$(".group")},previousEnabled:function(){return this.page()>1},nextEnabled:function(){return this.page()<this.totalPages()},previousButton:function(){return this.$("a.page.prev")},nextButton:function(){return this.$("a.page.next")},pageButtons:function(){return this.$("a[data-page-number]",this.pageButtonContainer())},updateWithPageCount:function(a,b){var c,d=this;return this.pageCount=a,b==null&&(b=[]),c=b.length,console.log("Update With Page Count",this.pageCount,c),this.pageButtonContainer().empty(),_(this.pageCount).times(function(a){var b,c;return c=a+1,b=d.make("a",{"data-page-number":c,"class":"page"},c),d.pageButtonContainer().append(b)}),this.toggleNavigationButtons(),this.selectActivePageButton(),this},toggleNavigationButtons:function(){this.$("a.next, a.prev").addClass("disabled"),this.nextEnabled()&&this.nextButton().removeClass("disabled");if(this.previousEnabled())return this.previousButton().removeClass("disabled")},selectActivePageButton:function(){return this.activePageButton().addClass("is-selected")},activePageButton:function(){return this.pageButtons().filter("[data-page-number='"+this.page()+"']")},totalPages:function(){return this.pageCount},totalItems:function(){var a;return parseInt(((a=this.collection)!=null?a.length:void 0)||0)},itemsPerPage:function(a,b){return b==null&&(b={}),a!=null&&this.state.set("limit",a,b),parseInt(this.state.get("limit"))}})}.call(this),function(){_.def("Luca.components.RecordManager")["extends"]("Luca.containers.CardView")["with"]({events:{"click .record-manager-grid .edit-link":"edit_handler","click .record-manager-filter .filter-button":"filter_handler","click .record-manager-filter .reset-button":"reset_filter_handler","click .add-button":"add_handler","click .refresh-button":"filter_handler","click .back-to-search-button":"back_to_search_handler"},record_manager:!0,initialize:function(a){var b=this;this.options=a!=null?a:{},Luca.containers.CardView.prototype.initialize.apply(this,arguments);if(!this.name)throw"Record Managers must specify a name";return _.bindAll(this,"add_handler","edit_handler","filter_handler","reset_filter_handler"),this.filterConfig&&_.extend(this.components[0][0],this.filterConfig),this.gridConfig&&_.extend(this.components[0][1],this.gridConfig),this.editorConfig&&_.extend(this.components[1][0],this.editorConfig),this.bind("after:card:switch",function(){b.activeCard===0&&b.trigger("activation:search",b);if(b.activeCard===1)return b.trigger("activation:editor",b)})},components:[{ctype:"split_view",relayFirstActivation:!0,components:[{ctype:"form_view"},{ctype:"grid_view"}]},{ctype:"form_view"}],getSearch:function(a,b){return a==null&&(a=!1),b==null&&(b=!0),a===!0&&this.activate(0),b===!0&&this.getEditor().clear(),_.first(this.components)},getFilter:function(){return _.first(this.getSearch().components)},getGrid:function(){return _.last(this.getSearch().components)},getCollection:function(){return this.getGrid().collection},getEditor:function(a,b){var c=this;return a==null&&(a=!1),b==null&&(b=!1),a===!0&&this.activate(1,function(a,b,c){return c.reset()}),_.last(this.components)},beforeRender:function(){var a;return this.$el.addClass(""+this.resource+"-manager"),(a=Luca.containers.CardView.prototype.beforeRender)!=null&&a.apply(this,arguments),this.$el.addClass(""+this.resource+" record-manager"),this.$el.data("resource",this.resource),$(this.getGrid().el).addClass(""+this.resource+" record-manager-grid"),$(this.getFilter().el).addClass(""+this.resource+" record-manager-filter"),$(this.getEditor().el).addClass(""+this.resource+" record-manager-editor")},afterRender:function(){var a,b,c,d,e,f,g=this;return(f=Luca.containers.CardView.prototype.afterRender)!=null&&f.apply(this,arguments),e=this,d=this.getGrid(),c=this.getFilter(),b=this.getEditor(),a=this.getCollection(),d.bind("row:double:click",function(a,c,d){return e.getEditor(!0),b.loadModel(c)}),b.bind("before:submit",function(){return $(".form-view-flash-container",g.el).html(""),$(".form-view-body",g.el).spin("large")}),b.bind("after:submit",function(){return $(".form-view-body",g.el).spin(!1)}),b.bind("after:submit:fatal_error",function(){return $(".form-view-flash-container",g.el).append("<li class='error'>There was an internal server error saving this record. Please contact developers@benchprep.com to report this error.</li>"),$(".form-view-body",g.el).spin(!1)}),b.bind("after:submit:error",function(a,b,c){return _(c.errors).each(function(a){return $(".form-view-flash-container",g.el).append("<li class='error'>"+a+"</li>")})}),b.bind("after:submit:success",function(a,b,c){return $(".form-view-flash-container",g.el).append("<li class='success'>Successfully Saved Record</li>"),b.set(c.result),a.loadModel(b),d.refresh(),_.delay(function(){return $(".form-view-flash-container li.success",g.el).fadeOut(1e3),$(".form-view-flash-container",g.el).html("")},4e3)}),c.eachComponent(function(a){try{return a.bind("on:change",g.filter_handler)}catch(b){return}})},firstActivation:function(){return this.getGrid().trigger("first:activation",this,this.getGrid()),this.getFilter().trigger("first:activation",this,this.getGrid())},reload:function(){var a,b,c,d;return d=this,c=this.getGrid(),b=this.getFilter(),a=this.getEditor(),b.clear(),c.applyFilter()},manageRecord:function(a){var b,c=this;return b=this.getCollection().get(a),b?this.loadModel(b):(console.log("Could Not Find Model, building and fetching"),b=this.buildModel(),b.set({id:a},{silent:!0}),b.fetch({success:function(a,b){return c.loadModel(a)}}))},loadModel:function(a){return this.current_model=a,this.getEditor(!0).loadModel(this.current_model),this.trigger("model:loaded",this.current_model)},currentModel:function(){return this.getEditor(!1).currentModel()},buildModel:function(){var a,b,c;return b=this.getEditor(!1),a=this.getCollection(),a.add([{}],{silent:!0,at:0}),c=a.at(0)},createModel:function(){return this.loadModel(this.buildModel())},reset_filter_handler:function(a){return this.getFilter().clear(),this.getGrid().applyFilter(this.getFilter().getValues())},filter_handler:function(a){return this.getGrid().applyFilter(this.getFilter().getValues())},edit_handler:function(a){var b,c,d,e;return b=d=$(a.currentTarget),e=d.parents("tr").data("record-id"),e&&(c=this.getGrid().collection.get(e)),c||(c=this.getGrid().collection.at(row_index))},add_handler:function(a){var b,c,d;return b=c=$(a.currentTarget),d=c.parents(".record-manager").eq(0).data("resource")},destroy_handler:function(a){},back_to_search_handler:function(){}})}.call(this),function(){_.def("Luca.Router")["extends"]("Backbone.Router")["with"]({routes:{"":"default"},initialize:function(a){var b=this;return this.options=a,_.extend(this,this.options),this.routeHandlers=_(this.routes).values(),_(this.routeHandlers).each(function(a){return b.bind("route:"+a,function(){return b.trigger.apply(b,["change:navigation",a].concat(_(arguments).flatten()))})})},navigate:function(a,b){return b==null&&(b=!1),Backbone.Router.prototype.navigate.apply(this,arguments),this.buildPathFrom(Backbone.history.getFragment())},buildPathFrom:function(a){var b=this;return _(this.routes).each(function(c,d){var e,f;f=b._routeToRegExp(d);if(f.test(a))return e=b._extractParameters(f,a),b.trigger.apply(b,["change:navigation",c].concat(e))})}})}.call(this),function(){var a;_.def("Luca.components.TableView")["extends"]("Luca.components.CollectionView")["with"]({additionalClassNames:"table",tagName:"table",bodyTemplate:"table_view",bodyTagName:"tbody",bodyClassName:"table-body",itemTagName:"tr",stateful:!0,observeChanges:!0,columns:[],emptyText:"There are no results to display",itemRenderer:function(a,b){return Luca.components.TableView.rowRenderer.call(this,a,b)},initialize:function(a){var b,c=this;return this.options=a!=null?a:{},Luca.components.CollectionView.prototype.initialize.apply(this,arguments),this.columns=function(){var a,c,d,e;d=this.columns,e=[];for(a=0,c=d.length;a<c;a++)b=d[a],_.isString(b)&&(b={reader:b}),b.header==null&&(b.header=_.str.titleize(_.str.humanize(b.reader))),e.push(b);return e}.call(this),this.defer(function(){return Luca.components.TableView.renderHeader.call(c,c.columns,c.$("thead"))}).until("after:render")}}),a=Backbone.View.prototype.make,Luca.components.TableView.renderHeader=function(a,b){var c,d,e,f,g,h;e=0,d=function(){var b,d,f;f=[];for(b=0,d=a.length;b<d;b++)c=a[b],f.push("<th data-col-index='"+e++ +"'>"+c.header+"</th>");return f}(),this.$(b).append("<tr>"+d.join("")+"</tr>"),e=0,h=[];for(f=0,g=a.length;f<g;f++)c=a[f],c.width!=null&&h.push(this.$("th[data-col-index='"+e++ +"']",b).css("width",c.width));return h},Luca.components.TableView.rowRenderer=function(a,b,c){var d,e,f,g,h,i;d=0,h=this.columns,i=[];for(f=0,g=h.length;f<g;f++)e=h[f],i.push(Luca.components.TableView.renderColumn.call(this,e,a,b,d++));return i},Luca.components.TableView.renderColumn=function(b,c,d,e){var f;return f=d.read(b.reader),_.isFunction(b.renderer)&&(f=b.renderer.call(this,f,d,b)),a("td",{"data-col-index":e},f)}}.call(this),function(){_.def("Luca.components.ToolbarDialog")["extends"]("Luca.View")["with"]({className:"luca-ui-toolbar-dialog span well",styles:{position:"absolute","z-Index":"3000","float":"left"},initialize:function(a){return this.options=a!=null?a:{},this._super("initialize",this,arguments)},createWrapper:function(){return this.make("div",{"class":"component-picker span4 well",style:"position: absolute; z-index:12000"})},show:function(){return this.$el.parent().show()},hide:function(){return this.$el.parent().hide()},toggle:function(){return this.$el.parent().toggle()}})}.call(this),function(){}.call(this),function(){}.call(this),function(){}.call(this);