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
@@ -3,37 +3,11 @@
3
3
  (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(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){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(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===bT,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=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(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(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.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 d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return 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(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,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"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.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):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},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=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!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:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.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++];a.length=d;return 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,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,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(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._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:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return 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 m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);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{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._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(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.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,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return 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 g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.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,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.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):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.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;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=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))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
4
4
  f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!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){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.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(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);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=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.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;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.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){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return 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(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return 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)}}),f.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){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=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]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};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}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{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)m.error(a);else break;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(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},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]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return 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){a.parentNode&&a.parentNode.selectedIndex;return 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,e,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],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return 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){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.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;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 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=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(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}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.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}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.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}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.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 y=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=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[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 V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={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,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(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){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(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=f.clean(arguments);a.push.apply(a,this.toArray());return 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);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
5
5
  {for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(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":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(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]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.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=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.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));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[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","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.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&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return 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,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(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 f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.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 e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return 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||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.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()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!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&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.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}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}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 i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
6
- // Underscore.js 1.3.1
7
- // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
8
- // Underscore is freely distributable under the MIT license.
9
- // Portions of Underscore are inspired or borrowed from Prototype,
10
- // Oliver Steele's Functional, and John Resig's Micro-Templating.
11
- // For all details and documentation:
12
- // http://documentcloud.github.com/underscore
13
- (function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
14
- c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,
15
- h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each=
16
- b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(d,a[e],e,a)===n)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===n)break};b.map=b.collect=function(a,c,b){var e=[];if(a==null)return e;if(x&&a.map===x)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==
17
- null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=
18
- function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e=
19
- e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
20
- function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&(e={value:a,computed:b})});
21
- return e.value};b.shuffle=function(a){var b=[],d;j(a,function(a,f){f==0?b[0]=a:(d=Math.floor(Math.random()*(f+1)),b[f]=b[d],b[d]=a)});return b};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,g){return{value:a,criteria:c.call(d,a,b,g)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,
22
- c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:a.toArray?a.toArray():b.isArray(a)?i.call(a):b.isArguments(a)?i.call(a):b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a,0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-1]};b.rest=
23
- b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,h){if(0==h||(c===true?b.last(d)!=g:!b.include(d,g)))d[d.length]=g,e[e.length]=a[h];return d},[]);
24
- return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,
25
- d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(p&&a.indexOf===p)return a.indexOf(c);for(d=0,e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(D&&a.lastIndexOf===D)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};
26
- var F=function(){};b.bind=function(a,c){var d,e;if(a.bind===s&&s)return s.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));F.prototype=a.prototype;var b=new F,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,
27
- c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i=b.debounce(function(){h=g=false},c);return function(){d=this;e=arguments;var b;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);i()},c));g?h=true:
28
- a.apply(d,e);i();g=true}};b.debounce=function(a,b){var d;return function(){var e=this,f=arguments;clearTimeout(d);d=setTimeout(function(){d=null;a.apply(e,f)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};
29
- b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments,
30
- 1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};
31
- b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};
32
- b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")};b.mixin=function(a){j(b.functions(a),
33
- function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+
34
- u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]=
35
- function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=
36
- true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
6
+ // Underscore.js 1.4.2
7
+ // http://underscorejs.org
8
+ // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
9
+ // Underscore may be freely distributed under the MIT license.
10
+ (function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=r.unshift,l=i.toString,c=i.hasOwnProperty,h=r.forEach,p=r.map,d=r.reduce,v=r.reduceRight,m=r.filter,g=r.every,y=r.some,b=r.indexOf,w=r.lastIndexOf,E=Array.isArray,S=Object.keys,x=s.bind,T=function(e){if(e instanceof T)return e;if(!(this instanceof T))return new T(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=T),exports._=T):e._=T,T.VERSION="1.4.2";var N=T.each=T.forEach=function(e,t,r){if(e==null)return;if(h&&e.forEach===h)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(T.has(e,o)&&t.call(r,e[o],o,e)===n)return};T.map=T.collect=function(e,t,n){var r=[];return e==null?r:p&&e.map===p?e.map(t,n):(N(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)},T.reduce=T.foldl=T.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduce===d)return r&&(t=T.bind(t,r)),i?e.reduce(t,n):e.reduce(t);N(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},T.reduceRight=T.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(v&&e.reduceRight===v)return r&&(t=T.bind(t,r)),arguments.length>2?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=T.keys(e);s=o.length}N(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},T.find=T.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},T.filter=T.select=function(e,t,n){var r=[];return e==null?r:m&&e.filter===m?e.filter(t,n):(N(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},T.reject=function(e,t,n){var r=[];return e==null?r:(N(e,function(e,i,s){t.call(n,e,i,s)||(r[r.length]=e)}),r)},T.every=T.all=function(e,t,r){t||(t=T.identity);var i=!0;return e==null?i:g&&e.every===g?e.every(t,r):(N(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=T.some=T.any=function(e,t,r){t||(t=T.identity);var i=!1;return e==null?i:y&&e.some===y?e.some(t,r):(N(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};T.contains=T.include=function(e,t){var n=!1;return e==null?n:b&&e.indexOf===b?e.indexOf(t)!=-1:(n=C(e,function(e){return e===t}),n)},T.invoke=function(e,t){var n=u.call(arguments,2);return T.map(e,function(e){return(T.isFunction(t)?t:e[t]).apply(e,n)})},T.pluck=function(e,t){return T.map(e,function(e){return e[t]})},T.where=function(e,t){return T.isEmpty(t)?[]:T.filter(e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},T.max=function(e,t,n){if(!t&&T.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&T.isEmpty(e))return-Infinity;var r={computed:-Infinity};return N(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},T.min=function(e,t,n){if(!t&&T.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&T.isEmpty(e))return Infinity;var r={computed:Infinity};return N(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},T.shuffle=function(e){var t,n=0,r=[];return N(e,function(e){t=T.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return T.isFunction(e)?e:function(t){return t[e]}};T.sortBy=function(e,t,n){var r=k(t);return T.pluck(T.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t);return N(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};T.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(T.has(e,t)?e[t]:e[t]=[]).push(n)})},T.countBy=function(e,t,n){return L(e,t,n,function(e,t,n){T.has(e,t)||(e[t]=0),e[t]++})},T.sortedIndex=function(e,t,n,r){n=n==null?T.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},T.toArray=function(e){return e?e.length===+e.length?u.call(e):T.values(e):[]},T.size=function(e){return e.length===+e.length?e.length:T.keys(e).length},T.first=T.head=T.take=function(e,t,n){return t!=null&&!n?u.call(e,0,t):e[0]},T.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},T.last=function(e,t,n){return t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},T.rest=T.tail=T.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},T.compact=function(e){return T.filter(e,function(e){return!!e})};var A=function(e,t,n){return N(e,function(e){T.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};T.flatten=function(e,t){return A(e,t,[])},T.without=function(e){return T.difference(e,u.call(arguments,1))},T.uniq=T.unique=function(e,t,n,r){var i=n?T.map(e,n,r):e,s=[],o=[];return N(i,function(n,r){if(t?!r||o[o.length-1]!==n:!T.contains(o,n))o.push(n),s.push(e[r])}),s},T.union=function(){return T.uniq(a.apply(r,arguments))},T.intersection=function(e){var t=u.call(arguments,1);return T.filter(T.uniq(e),function(e){return T.every(t,function(t){return T.indexOf(t,e)>=0})})},T.difference=function(e){var t=a.apply(r,u.call(arguments,1));return T.filter(e,function(e){return!T.contains(t,e)})},T.zip=function(){var e=u.call(arguments),t=T.max(T.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=T.pluck(e,""+r);return n},T.object=function(e,t){var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},T.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=T.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(b&&e.indexOf===b)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},T.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(w&&e.lastIndexOf===w)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},T.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};T.bind=function(t,n){var r,i;if(t.bind===x&&x)return x.apply(t,u.call(arguments,1));if(!T.isFunction(t))throw new TypeError;return i=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=t.prototype;var e=new O,s=t.apply(e,i.concat(u.call(arguments)));return Object(s)===s?s:e}return t.apply(n,i.concat(u.call(arguments)))}},T.bindAll=function(e){var t=u.call(arguments,1);return t.length==0&&(t=T.functions(e)),N(t,function(t){e[t]=T.bind(e[t],e)}),e},T.memoize=function(e,t){var n={};return t||(t=T.identity),function(){var r=t.apply(this,arguments);return T.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},T.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},T.defer=function(e){return T.delay.apply(T,[e,1].concat(u.call(arguments,1)))},T.throttle=function(e,t){var n,r,i,s,o,u,a=T.debounce(function(){o=s=!1},t);return function(){n=this,r=arguments;var f=function(){i=null,o&&(u=e.apply(n,r)),a()};return i||(i=setTimeout(f,t)),s?o=!0:(s=!0,u=e.apply(n,r)),a(),u}},T.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},T.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},T.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},T.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},T.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},T.keys=S||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)T.has(e,n)&&(t[t.length]=n);return t},T.values=function(e){var t=[];for(var n in e)T.has(e,n)&&t.push(e[n]);return t},T.pairs=function(e){var t=[];for(var n in e)T.has(e,n)&&t.push([n,e[n]]);return t},T.invert=function(e){var t={};for(var n in e)T.has(e,n)&&(t[e[n]]=n);return t},T.functions=T.methods=function(e){var t=[];for(var n in e)T.isFunction(e[n])&&t.push(n);return t.sort()},T.extend=function(e){return N(u.call(arguments,1),function(t){for(var n in t)e[n]=t[n]}),e},T.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return N(n,function(n){n in e&&(t[n]=e[n])}),t},T.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)T.contains(n,i)||(t[i]=e[i]);return t},T.defaults=function(e){return N(u.call(arguments,1),function(t){for(var n in t)e[n]==null&&(e[n]=t[n])}),e},T.clone=function(e){return T.isObject(e)?T.isArray(e)?e.slice():T.extend({},e):e},T.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof T&&(e=e._wrapped),t instanceof T&&(t=t._wrapped);var i=l.call(e);if(i!=l.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i=="[object Array]"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=M(e[o],t[o],n,r)))break}else{var a=e.constructor,f=t.constructor;if(a!==f&&!(T.isFunction(a)&&a instanceof a&&T.isFunction(f)&&f instanceof f))return!1;for(var c in e)if(T.has(e,c)){o++;if(!(u=T.has(t,c)&&M(e[c],t[c],n,r)))break}if(u){for(c in t)if(T.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};T.isEqual=function(e,t){return M(e,t,[],[])},T.isEmpty=function(e){if(e==null)return!0;if(T.isArray(e)||T.isString(e))return e.length===0;for(var t in e)if(T.has(e,t))return!1;return!0},T.isElement=function(e){return!!e&&e.nodeType===1},T.isArray=E||function(e){return l.call(e)=="[object Array]"},T.isObject=function(e){return e===Object(e)},N(["Arguments","Function","String","Number","Date","RegExp"],function(e){T["is"+e]=function(t){return l.call(t)=="[object "+e+"]"}}),T.isArguments(arguments)||(T.isArguments=function(e){return!!e&&!!T.has(e,"callee")}),typeof /./!="function"&&(T.isFunction=function(e){return typeof e=="function"}),T.isFinite=function(e){return T.isNumber(e)&&isFinite(e)},T.isNaN=function(e){return T.isNumber(e)&&e!=+e},T.isBoolean=function(e){return e===!0||e===!1||l.call(e)=="[object Boolean]"},T.isNull=function(e){return e===null},T.isUndefined=function(e){return e===void 0},T.has=function(e,t){return c.call(e,t)},T.noConflict=function(){return e._=t,this},T.identity=function(e){return e},T.times=function(e,t,n){for(var r=0;r<e;r++)t.call(n,r)},T.random=function(e,t){return t==null&&(t=e,e=0),e+(0|Math.random()*(t-e+1))};var _={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};_.unescape=T.invert(_.escape);var D={escape:new RegExp("["+T.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+T.keys(_.unescape).join("|")+")","g")};T.each(["escape","unescape"],function(e){T[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),T.result=function(e,t){if(e==null)return null;var n=e[t];return T.isFunction(n)?n.call(e):n},T.mixin=function(e){N(T.functions(e),function(t){var n=T[t]=e[t];T.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(T,e))}})};var P=0;T.uniqueId=function(e){var t=P++;return e?e+t:t},T.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;T.template=function(e,t,n){n=T.defaults({},n,T.templateSettings);var r=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),i=0,s="__p+='";e.replace(r,function(t,n,r,o,u){s+=e.slice(i,u).replace(j,function(e){return"\\"+B[e]}),s+=n?"'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?"'+\n((__t=("+r+"))==null?'':__t)+\n'":o?"';\n"+o+"\n__p+='":"",i=u+t.length}),s+="';\n",n.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var o=new Function(n.variable||"obj","_",s)}catch(u){throw u.source=s,u}if(t)return o(t,T);var a=function(e){return o.call(this,e,T)};return a.source="function("+(n.variable||"obj")+"){\n"+s+"}",a},T.chain=function(e){return T(e).chain()};var F=function(e){return this._chain?T(e).chain():e};T.mixin(T),N(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];T.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),N(["concat","join","slice"],function(e){var t=r[e];T.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),T.extend(T.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this);
37
11
  (function(k){var o=String.prototype.trim,l=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)}},m=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}var b=function(){b.cache.hasOwnProperty(arguments[0])||(b.cache[arguments[0]]=b.parse(arguments[0]));return b.format.call(null,b.cache[arguments[0]],arguments)};
38
12
  b.format=function(b,n){var e=1,d=b.length,f="",j=[],h,i,g,k;for(h=0;h<d;h++)if(f=a(b[h]),f==="string")j.push(b[h]);else if(f==="array"){g=b[h];if(g[2]){f=n[e];for(i=0;i<g[2].length;i++){if(!f.hasOwnProperty(g[2][i]))throw m('[_.sprintf] property "%s" does not exist',g[2][i]);f=f[g[2][i]]}}else f=g[1]?n[g[1]]:n[e++];if(/[^s]/.test(g[8])&&a(f)!="number")throw m("[_.sprintf] expecting number but found %s",a(f));switch(g[8]){case "b":f=f.toString(2);break;case "c":f=String.fromCharCode(f);break;case "d":f=
39
13
  parseInt(f,10);break;case "e":f=g[7]?f.toExponential(g[7]):f.toExponential();break;case "f":f=g[7]?parseFloat(f).toFixed(g[7]):parseFloat(f);break;case "o":f=f.toString(8);break;case "s":f=(f=String(f))&&g[7]?f.substring(0,g[7]):f;break;case "u":f=Math.abs(f);break;case "x":f=f.toString(16);break;case "X":f=f.toString(16).toUpperCase()}f=/[def]/.test(g[8])&&g[3]&&f>=0?"+"+f:f;i=g[4]?g[4]=="0"?"0":g[4].charAt(1):" ";k=g[6]-String(f).length;i=g[6]?l(i,k):"";j.push(g[5]?f+i:i+f)}return j.join("")};b.cache=
@@ -121,7 +95,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
121
95
  };
122
96
 
123
97
  _.extend(Luca, {
124
- VERSION: "0.9.42",
98
+ VERSION: "0.9.65",
125
99
  core: {},
126
100
  containers: {},
127
101
  components: {},
@@ -129,18 +103,21 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
129
103
  util: {},
130
104
  fields: {},
131
105
  registry: {},
132
- options: {}
106
+ options: {},
107
+ config: {}
133
108
  });
134
109
 
135
110
  _.extend(Luca, Backbone.Events);
136
111
 
137
- Luca.autoRegister = true;
112
+ Luca.autoRegister = Luca.config.autoRegister = true;
113
+
114
+ Luca.developmentMode = Luca.config.developmentMode = false;
138
115
 
139
- Luca.developmentMode = false;
116
+ Luca.enableGlobalObserver = Luca.config.enableGlobalObserver = false;
140
117
 
141
- Luca.enableGlobalObserver = false;
118
+ Luca.enableBootstrap = Luca.config.enableBootstrap = true;
142
119
 
143
- Luca.enableBootstrap = true;
120
+ Luca.config.enhancedViewProperties = true;
144
121
 
145
122
  Luca.keys = {
146
123
  ENTER: 13,
@@ -158,8 +135,8 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
158
135
  return memo;
159
136
  }, {});
160
137
 
161
- Luca.find = function() {
162
- return;
138
+ Luca.find = function(el) {
139
+ return Luca($(el).data('luca-id'));
163
140
  };
164
141
 
165
142
  Luca.supportsEvents = Luca.supportsBackboneEvents = function(obj) {
@@ -330,42 +307,134 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
330
307
  _.mixin(UnderscoreExtensions);
331
308
 
332
309
  }).call(this);
333
- (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);
334
- (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);
335
- (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);
336
- (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);
337
- (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);
338
- (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);
339
- (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);
340
- (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);
341
- (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);
342
- (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);
343
- (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);
344
- (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);
345
- (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 '); if(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);
346
- (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);
347
- (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);
348
- (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'); if(helperText) { __p.push('\n<p class=\'helper-text help-block\'>\n ', helperText ,'\n</p>\n'); } __p.push('\n');}return __p.join('');}; }).call(this);
349
- (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'); if(helperText) { __p.push('\n<p class=\'helper-text help-block\'>\n ', helperText ,'\n</p>\n'); } __p.push('\n');}return __p.join('');}; }).call(this);
350
- (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);
351
- (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 '); if(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);
352
- (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'); if(helperText) { __p.push('\n<p class=\'helper-text help-block\'>\n ', helperText ,'\n</p>\n'); } __p.push('\n');}return __p.join('');}; }).call(this);
353
- (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(''); if(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 '); if( 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 '); if(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);
354
- (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);
355
- (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);
356
- (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);
357
310
  (function() {
358
- var currentNamespace;
311
+ this.JST || (this.JST = {});
312
+ 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('');};
313
+ }).call(this);
314
+ (function() {
315
+ this.JST || (this.JST = {});
316
+ 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('');};
317
+ }).call(this);
318
+ (function() {
319
+ this.JST || (this.JST = {});
320
+ 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('');};
321
+ }).call(this);
322
+ (function() {
323
+ this.JST || (this.JST = {});
324
+ 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('');};
325
+ }).call(this);
326
+ (function() {
327
+ this.JST || (this.JST = {});
328
+ 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('');};
329
+ }).call(this);
330
+ (function() {
331
+ this.JST || (this.JST = {});
332
+ 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('');};
333
+ }).call(this);
334
+ (function() {
335
+ this.JST || (this.JST = {});
336
+ 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('');};
337
+ }).call(this);
338
+ (function() {
339
+ this.JST || (this.JST = {});
340
+ 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('');};
341
+ }).call(this);
342
+ (function() {
343
+ this.JST || (this.JST = {});
344
+ 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('');};
345
+ }).call(this);
346
+ (function() {
347
+ this.JST || (this.JST = {});
348
+ 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('');};
349
+ }).call(this);
350
+ (function() {
351
+ this.JST || (this.JST = {});
352
+ 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('');};
353
+ }).call(this);
354
+ (function() {
355
+ this.JST || (this.JST = {});
356
+ 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('');};
357
+ }).call(this);
358
+ (function() {
359
+ this.JST || (this.JST = {});
360
+ 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('');};
361
+ }).call(this);
362
+ (function() {
363
+ this.JST || (this.JST = {});
364
+ 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 '); if(icon_class.length) { __p.push('\n <i class="', icon_class ,'"></i>\n ', input_value ,'\n '); } __p.push('\n</a>\n');}return __p.join('');};
365
+ }).call(this);
366
+ (function() {
367
+ this.JST || (this.JST = {});
368
+ 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('');};
369
+ }).call(this);
370
+ (function() {
371
+ this.JST || (this.JST = {});
372
+ 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('');};
373
+ }).call(this);
374
+ (function() {
375
+ this.JST || (this.JST = {});
376
+ 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'); if(helperText) { __p.push('\n<p class="helper-text help-block">\n ', helperText ,'\n</p>\n'); } __p.push('\n');}return __p.join('');};
377
+ }).call(this);
378
+ (function() {
379
+ this.JST || (this.JST = {});
380
+ 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'); if(helperText) { __p.push('\n<p class="helper-text help-block">\n ', helperText ,'\n</p>\n'); } __p.push('\n');}return __p.join('');};
381
+ }).call(this);
382
+ (function() {
383
+ this.JST || (this.JST = {});
384
+ 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('');};
385
+ }).call(this);
386
+ (function() {
387
+ this.JST || (this.JST = {});
388
+ 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 '); if(helperText) { __p.push('\n <p class="helper-text help-block">\n ', helperText ,'\n </p>\n '); } __p.push('\n</div>\n');}return __p.join('');};
389
+ }).call(this);
390
+ (function() {
391
+ this.JST || (this.JST = {});
392
+ 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 '); if(helperText) { __p.push('\n <p class="helper-text help-block">\n ', helperText ,'\n </p>\n '); } __p.push('\n</div>\n');}return __p.join('');};
393
+ }).call(this);
394
+ (function() {
395
+ this.JST || (this.JST = {});
396
+ this.JST["luca-src/templates/fields/text_field"] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push(''); if(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'); if( 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'); if(helperText) { __p.push('\n<p class="helper-text help-block">\n ', helperText ,'\n</p>\n'); } __p.push('\n\n</div>\n');}return __p.join('');};
397
+ }).call(this);
398
+ (function() {
399
+ this.JST || (this.JST = {});
400
+ 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('');};
401
+ }).call(this);
402
+ (function() {
403
+ var currentNamespace,
404
+ __slice = Array.prototype.slice;
359
405
 
360
406
  Luca.util.resolve = function(accessor, source_object) {
361
- source_object || (source_object = window || global);
362
- return _(accessor.split(/\./)).inject(function(obj, key) {
363
- return obj = obj != null ? obj[key] : void 0;
364
- }, source_object);
407
+ var resolved;
408
+ try {
409
+ source_object || (source_object = window || global);
410
+ resolved = _(accessor.split(/\./)).inject(function(obj, key) {
411
+ return obj = obj != null ? obj[key] : void 0;
412
+ }, source_object);
413
+ } catch (e) {
414
+ console.log("Error resolving", accessor, source_object);
415
+ throw e;
416
+ }
417
+ return resolved;
365
418
  };
366
419
 
367
420
  Luca.util.nestedValue = Luca.util.resolve;
368
421
 
422
+ Luca.util.argumentsLogger = function(prompt) {
423
+ return function() {
424
+ return console.log(prompt, arguments);
425
+ };
426
+ };
427
+
428
+ Luca.util.read = function() {
429
+ var args, property;
430
+ property = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
431
+ if (_.isFunction(property)) {
432
+ return property.apply(this, args);
433
+ } else {
434
+ return property;
435
+ }
436
+ };
437
+
369
438
  Luca.util.classify = function(string) {
370
439
  if (string == null) string = "";
371
440
  return _.string.camelize(_.string.capitalize(string));
@@ -512,13 +581,13 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
512
581
 
513
582
  }).call(this);
514
583
  (function() {
515
- var DeferredBindingProxy;
584
+ var DeferredBindingProxy,
585
+ __slice = Array.prototype.slice;
516
586
 
517
587
  DeferredBindingProxy = (function() {
518
588
 
519
589
  function DeferredBindingProxy(object, operation, wrapWithUnderscore) {
520
- var fn,
521
- _this = this;
590
+ var fn;
522
591
  this.object = object;
523
592
  if (wrapWithUnderscore == null) wrapWithUnderscore = true;
524
593
  if (_.isFunction(operation)) {
@@ -530,11 +599,11 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
530
599
  throw "Must pass a function or a string representing one";
531
600
  }
532
601
  if (wrapWithUnderscore === true) {
533
- this.fn = function() {
602
+ this.fn = _.bind(function() {
534
603
  return _.defer(fn);
535
- };
604
+ }, this.object);
536
605
  } else {
537
- this.fn = fn;
606
+ this.fn = _.bind(fn, this.object);
538
607
  }
539
608
  this;
540
609
  }
@@ -568,15 +637,80 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
568
637
  }
569
638
  };
570
639
 
640
+ Luca.EventsExt = {
641
+ waitUntil: function(trigger, context) {
642
+ return this.waitFor.call(this, trigger, context);
643
+ },
644
+ waitFor: function(trigger, context) {
645
+ var proxy, self;
646
+ self = this;
647
+ return proxy = {
648
+ on: function(target) {
649
+ return target.waitFor.call(target, trigger, context);
650
+ },
651
+ and: function() {
652
+ var fn, runList, _i, _len, _results;
653
+ runList = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
654
+ _results = [];
655
+ for (_i = 0, _len = runList.length; _i < _len; _i++) {
656
+ fn = runList[_i];
657
+ fn = _.isFunction(fn) ? fn : self[fn];
658
+ _results.push(self.once(trigger, fn, context));
659
+ }
660
+ return _results;
661
+ },
662
+ andThen: function() {
663
+ return self.and.apply(self, arguments);
664
+ }
665
+ };
666
+ },
667
+ relayEvent: function(trigger) {
668
+ var _this = this;
669
+ return {
670
+ on: function() {
671
+ var components;
672
+ components = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
673
+ return {
674
+ to: function() {
675
+ var component, target, targets, _i, _len, _results;
676
+ targets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
677
+ _results = [];
678
+ for (_i = 0, _len = targets.length; _i < _len; _i++) {
679
+ target = targets[_i];
680
+ _results.push((function() {
681
+ var _j, _len2, _results2,
682
+ _this = this;
683
+ _results2 = [];
684
+ for (_j = 0, _len2 = components.length; _j < _len2; _j++) {
685
+ component = components[_j];
686
+ _results2.push(component.on(trigger, function() {
687
+ var args;
688
+ args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
689
+ args.unshift(trigger);
690
+ return target.trigger.apply(target, args);
691
+ }));
692
+ }
693
+ return _results2;
694
+ }).call(_this));
695
+ }
696
+ return _results;
697
+ }
698
+ };
699
+ }
700
+ };
701
+ }
702
+ };
703
+
571
704
  }).call(this);
572
705
  (function() {
573
- var DefineProxy;
574
-
575
- Luca.define = function(componentName) {
576
- return new DefineProxy(componentName);
577
- };
706
+ var DefineProxy,
707
+ __slice = Array.prototype.slice;
578
708
 
579
- Luca.component = Luca.define;
709
+ _.mixin({
710
+ def: Luca.component = Luca.define = Luca.register = function(componentName) {
711
+ return new DefineProxy(componentName);
712
+ }
713
+ });
580
714
 
581
715
  DefineProxy = (function() {
582
716
 
@@ -584,6 +718,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
584
718
  var parts;
585
719
  this.namespace = Luca.util.namespace();
586
720
  this.componentId = this.componentName = componentName;
721
+ this.superClassName = 'Luca.View';
587
722
  if (componentName.match(/\./)) {
588
723
  this.namespaced = true;
589
724
  parts = componentName.split('.');
@@ -613,19 +748,58 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
613
748
  return this;
614
749
  };
615
750
 
616
- DefineProxy.prototype.enhance = function(properties) {
617
- if (properties != null) return this["with"](properties);
751
+ DefineProxy.prototype.triggers = function() {
752
+ var hook, hooks, _i, _len;
753
+ hooks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
754
+ _.defaults(this.properties || (this.properties = {}), {
755
+ hooks: []
756
+ });
757
+ for (_i = 0, _len = hooks.length; _i < _len; _i++) {
758
+ hook = hooks[_i];
759
+ this.properties.hooks.push(hook);
760
+ }
761
+ this.properties.hooks = _.uniq(this.properties.hooks);
762
+ return this;
763
+ };
764
+
765
+ DefineProxy.prototype.includes = function() {
766
+ var include, includes, _i, _len;
767
+ includes = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
768
+ _.defaults(this.properties || (this.properties = {}), {
769
+ include: []
770
+ });
771
+ for (_i = 0, _len = includes.length; _i < _len; _i++) {
772
+ include = includes[_i];
773
+ this.properties.include.push(include);
774
+ }
775
+ this.properties.include = _.uniq(this.properties.include);
776
+ return this;
777
+ };
778
+
779
+ DefineProxy.prototype.mixesIn = function() {
780
+ var mixin, mixins, _i, _len;
781
+ mixins = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
782
+ _.defaults(this.properties || (this.properties = {}), {
783
+ mixins: []
784
+ });
785
+ for (_i = 0, _len = mixins.length; _i < _len; _i++) {
786
+ mixin = mixins[_i];
787
+ this.properties.mixins.push(mixin);
788
+ }
789
+ this.properties.mixins = _.uniq(this.properties.mixins);
618
790
  return this;
619
791
  };
620
792
 
621
- DefineProxy.prototype["with"] = function(properties) {
793
+ DefineProxy.prototype.defaultProperties = function(properties) {
622
794
  var at, componentType, _base;
795
+ if (properties == null) properties = {};
796
+ _.defaults((this.properties || (this.properties = {})), properties);
623
797
  at = this.namespaced ? Luca.util.resolve(this.namespace, window || global) : window || global;
624
798
  if (this.namespaced && !(at != null)) {
625
799
  eval("(window||global)." + this.namespace + " = {}");
626
800
  at = Luca.util.resolve(this.namespace, window || global);
627
801
  }
628
- at[this.componentId] = Luca.extend(this.superClassName, this.componentName, properties);
802
+ at[this.componentId] = Luca.extend(this.superClassName, this.componentName, this.properties);
629
803
  if (Luca.autoRegister === true) {
630
804
  if (Luca.isViewPrototype(at[this.componentId])) componentType = "view";
631
805
  if (Luca.isCollectionPrototype(at[this.componentId])) {
@@ -634,7 +808,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
634
808
  componentType = "collection";
635
809
  }
636
810
  if (Luca.isModelPrototype(at[this.componentId])) componentType = "model";
637
- Luca.register(_.string.underscored(this.componentId), this.componentName, componentType);
811
+ Luca.registerComponent(_.string.underscored(this.componentId), this.componentName, componentType);
638
812
  }
639
813
  return at[this.componentId];
640
814
  };
@@ -643,12 +817,19 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
643
817
 
644
818
  })();
645
819
 
820
+ DefineProxy.prototype.behavesAs = DefineProxy.prototype.uses = DefineProxy.prototype.mixesIn;
821
+
822
+ DefineProxy.prototype.defines = DefineProxy.prototype.defaults = DefineProxy.prototype.exports = DefineProxy.prototype.defaultProperties;
823
+
824
+ DefineProxy.prototype.defaultsTo = DefineProxy.prototype.enhance = DefineProxy.prototype["with"] = DefineProxy.prototype.defaultProperties;
825
+
646
826
  Luca.extend = function(superClassName, childName, properties) {
647
- var definition, mixin, superClass, _i, _len, _ref;
827
+ var definition, include, superClass, _i, _len, _ref;
648
828
  if (properties == null) properties = {};
649
829
  superClass = Luca.util.resolve(superClassName, window || global);
830
+ superClass.__initializers || (superClass.__initializers = []);
650
831
  if (!_.isFunction(superClass != null ? superClass.extend : void 0)) {
651
- throw "" + superClassName + " is not a valid component to extend from";
832
+ throw "Error defining " + childName + ". " + superClassName + " is not a valid component to extend from";
652
833
  }
653
834
  properties.displayName = childName;
654
835
  properties._superClass = function() {
@@ -657,23 +838,126 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
657
838
  };
658
839
  properties._super = function(method, context, args) {
659
840
  var _ref;
841
+ if (context == null) context = this;
842
+ if (args == null) args = [];
660
843
  return (_ref = this._superClass().prototype[method]) != null ? _ref.apply(context, args) : void 0;
661
844
  };
662
845
  definition = superClass.extend(properties);
663
846
  if (_.isArray(properties != null ? properties.include : void 0)) {
664
847
  _ref = properties.include;
665
848
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
666
- mixin = _ref[_i];
667
- if (_.isString(mixin)) mixin = Luca.util.resolve(mixin);
668
- _.extend(definition.prototype, mixin);
849
+ include = _ref[_i];
850
+ if (_.isString(include)) include = Luca.util.resolve(include);
851
+ _.extend(definition.prototype, include);
669
852
  }
670
853
  }
671
854
  return definition;
672
855
  };
673
856
 
674
- _.mixin({
675
- def: Luca.define
676
- });
857
+ Luca.mixin = function(mixinName) {
858
+ var namespace, resolved;
859
+ namespace = _(Luca.mixin.namespaces).detect(function(space) {
860
+ var _ref;
861
+ return ((_ref = Luca.util.resolve(space)) != null ? _ref[mixinName] : void 0) != null;
862
+ });
863
+ namespace || (namespace = "Luca.modules");
864
+ resolved = Luca.util.resolve(namespace)[mixinName];
865
+ if (resolved == null) {
866
+ console.log("Could not find " + mixinName + " in ", Luca.mixin.namespaces);
867
+ }
868
+ return resolved;
869
+ };
870
+
871
+ Luca.mixin.namespaces = ["Luca.modules"];
872
+
873
+ Luca.mixin.namespace = function(namespace) {
874
+ Luca.mixin.namespaces.push(namespace);
875
+ return Luca.mixin.namespaces = _(Luca.mixin.namespaces).uniq();
876
+ };
877
+
878
+ Luca.decorate = function(componentPrototype) {
879
+ if (_.isString(componentPrototype)) {
880
+ componentPrototype = Luca.util.resolve(componentPrototype).prototype;
881
+ }
882
+ return {
883
+ "with": function(mixin) {
884
+ var mixinDefinition, mixinPrivates, sanitized, superclassMixins, _ref;
885
+ mixinDefinition = Luca.mixin(mixin);
886
+ mixinPrivates = _(mixinDefinition).chain().keys().select(function(key) {
887
+ return ("" + key).match(/^__/);
888
+ });
889
+ sanitized = _(mixinDefinition).omit(mixinPrivates.value());
890
+ _.extend(componentPrototype, sanitized);
891
+ if (mixinDefinition != null) {
892
+ if ((_ref = mixinDefinition.__included) != null) {
893
+ _ref.call(mixinDefinition, mixin);
894
+ }
895
+ }
896
+ superclassMixins = componentPrototype._superClass().prototype.mixins;
897
+ componentPrototype.mixins || (componentPrototype.mixins = []);
898
+ componentPrototype.mixins.push(mixin);
899
+ componentPrototype.mixins = componentPrototype.mixins.concat(superclassMixins);
900
+ componentPrototype.mixins = _(componentPrototype.mixins).chain().uniq().compact().value();
901
+ return componentPrototype;
902
+ }
903
+ };
904
+ };
905
+
906
+ }).call(this);
907
+ (function() {
908
+
909
+ Luca.modules.ApplicationEventBindings = {
910
+ __initializer: function() {
911
+ var app, eventTrigger, handler, _len, _ref, _ref2, _results;
912
+ if (_.isEmpty(this.applicationEvents)) return;
913
+ app = this.app;
914
+ if (_.isString(app) || _.isUndefined(app)) {
915
+ app = (_ref = Luca.Application) != null ? typeof _ref.get === "function" ? _ref.get(app) : void 0 : void 0;
916
+ }
917
+ if (!Luca.supportsEvents(app)) {
918
+ throw "Error binding to the application object on " + (this.name || this.cid);
919
+ }
920
+ _ref2 = this.applicationEvents;
921
+ _results = [];
922
+ for (handler = 0, _len = _ref2.length; handler < _len; handler++) {
923
+ eventTrigger = _ref2[handler];
924
+ if (_.isString(handler)) handler = this[handler];
925
+ if (!_.isFunction(handler)) {
926
+ throw "Error registering application event " + eventTrigger + " on " + (this.name || this.cid);
927
+ }
928
+ _results.push(app.on(eventTrigger, handler));
929
+ }
930
+ return _results;
931
+ }
932
+ };
933
+
934
+ }).call(this);
935
+ (function() {
936
+
937
+ Luca.modules.CollectionEventBindings = {
938
+ __initializer: function() {
939
+ var collection, eventTrigger, handler, key, manager, signature, _ref, _ref2, _results;
940
+ if (_.isEmpty(this.collectionEvents)) return;
941
+ manager = this.collectionManager || Luca.CollectionManager.get();
942
+ _ref = this.collectionEvents;
943
+ _results = [];
944
+ for (signature in _ref) {
945
+ handler = _ref[signature];
946
+ _ref2 = signature.split(" "), key = _ref2[0], eventTrigger = _ref2[1];
947
+ collection = manager.getOrCreate(key);
948
+ if (!collection) throw "Could not find collection specified by " + key;
949
+ if (_.isString(handler)) handler = this[handler];
950
+ if (!_.isFunction(handler)) throw "invalid collectionEvents configuration";
951
+ try {
952
+ _results.push(collection.on(eventTrigger, handler, collection));
953
+ } catch (e) {
954
+ console.log("Error Binding To Collection in registerCollectionEvents", this);
955
+ throw e;
956
+ }
957
+ }
958
+ return _results;
959
+ }
960
+ };
677
961
 
678
962
  }).call(this);
679
963
  (function() {
@@ -696,20 +980,219 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
696
980
  }
697
981
  };
698
982
 
983
+ }).call(this);
984
+ (function() {
985
+
986
+ Luca.modules.DomHelpers = {
987
+ __initializer: function() {
988
+ var additional, additionalClasses, _i, _len, _results;
989
+ additionalClasses = _(this.additionalClassNames || []).clone();
990
+ if (this.wrapperClass != null) this.$wrap(this.wrapperClass);
991
+ if (_.isString(additionalClasses)) {
992
+ additionalClasses = additionalClasses.split(" ");
993
+ }
994
+ if (this.gridSpan) additionalClasses.push("span" + this.gridSpan);
995
+ if (this.gridOffset) additionalClasses.push("offset" + this.gridOffset);
996
+ if (this.gridRowFluid) additionalClasses.push("row-fluid");
997
+ if (this.gridRow) additionalClasses.push("row");
998
+ if (additionalClasses == null) return;
999
+ _results = [];
1000
+ for (_i = 0, _len = additionalClasses.length; _i < _len; _i++) {
1001
+ additional = additionalClasses[_i];
1002
+ _results.push(this.$el.addClass(additional));
1003
+ }
1004
+ return _results;
1005
+ },
1006
+ $wrap: function(wrapper) {
1007
+ if (_.isString(wrapper) && !wrapper.match(/[<>]/)) {
1008
+ wrapper = this.make("div", {
1009
+ "class": wrapper
1010
+ });
1011
+ }
1012
+ return this.$el.wrap(wrapper);
1013
+ },
1014
+ $template: function(template, variables) {
1015
+ if (variables == null) variables = {};
1016
+ return this.$el.html(Luca.template(template, variables));
1017
+ },
1018
+ $html: function(content) {
1019
+ return this.$el.html(content);
1020
+ },
1021
+ $append: function(content) {
1022
+ return this.$el.append(content);
1023
+ },
1024
+ $attach: function() {
1025
+ return this.$container().append(this.el);
1026
+ },
1027
+ $bodyEl: function() {
1028
+ return this.$el;
1029
+ },
1030
+ $container: function() {
1031
+ return $(this.container);
1032
+ }
1033
+ };
1034
+
1035
+ }).call(this);
1036
+ (function() {
1037
+
1038
+ Luca.modules.EnhancedProperties = {
1039
+ __initializer: function() {
1040
+ if (Luca.config.enhancedViewProperties !== true) return;
1041
+ if (_.isString(this.collection) && Luca.CollectionManager.get()) {
1042
+ this.collection = Luca.CollectionManager.get().getOrCreate(this.collection);
1043
+ }
1044
+ if (this.template != null) this.$template(this.template, this);
1045
+ if (_.isString(this.collectionManager)) {
1046
+ return this.collectionManager = Luca.CollectionManager.get(this.collectionManager);
1047
+ }
1048
+ }
1049
+ };
1050
+
1051
+ }).call(this);
1052
+ (function() {
1053
+ var FilterModel,
1054
+ __hasProp = Object.prototype.hasOwnProperty,
1055
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
1056
+
1057
+ Luca.modules.Filterable = {
1058
+ __included: function(component, module) {
1059
+ return _.extend(Luca.Collection.prototype, {
1060
+ __filters: {}
1061
+ });
1062
+ },
1063
+ __initializer: function(component, module) {
1064
+ var filter, _base, _ref,
1065
+ _this = this;
1066
+ if (this.filterable === false) return;
1067
+ if (!Luca.isBackboneCollection(this.collection)) {
1068
+ this.collection = typeof (_base = Luca.CollectionManager).get === "function" ? (_ref = _base.get()) != null ? _ref.getOrCreate(this.collection) : void 0 : void 0;
1069
+ }
1070
+ if (!Luca.isBackboneCollection(this.collection)) {
1071
+ this.debug("Skipping Filterable due to no collection being present on " + (this.name || this.cid));
1072
+ this.debug("Collection", this.collection);
1073
+ return;
1074
+ }
1075
+ this.getCollection || (this.getCollection = function() {
1076
+ return this.collection;
1077
+ });
1078
+ filter = this.getFilterState();
1079
+ this.querySources || (this.querySources = []);
1080
+ this.optionsSources || (this.optionsSources = []);
1081
+ this.query || (this.query = {});
1082
+ this.queryOptions || (this.queryOptions = {});
1083
+ this.querySources.push((function() {
1084
+ return filter.toQuery();
1085
+ }));
1086
+ this.optionsSources.push((function() {
1087
+ return filter.toOptions();
1088
+ }));
1089
+ if (this.debugMode === true) {
1090
+ console.log("Filterable");
1091
+ console.log(this.querySources);
1092
+ console.log(this.optionsSources);
1093
+ }
1094
+ filter.on("change", function() {
1095
+ var merged;
1096
+ if (_this.isRemote()) {
1097
+ merged = _.extend(_this.getQuery(), _this.getQueryOptions());
1098
+ return _this.collection.applyFilter(merged, _this.getQueryOptions());
1099
+ } else {
1100
+ return _this.trigger("refresh");
1101
+ }
1102
+ });
1103
+ return module;
1104
+ },
1105
+ isRemote: function() {
1106
+ return this.getQueryOptions().remote === true;
1107
+ },
1108
+ getFilterState: function() {
1109
+ var _base, _name;
1110
+ return (_base = this.collection.__filters)[_name = this.cid] || (_base[_name] = new FilterModel(this.filterable));
1111
+ },
1112
+ setSortBy: function(sortBy, options) {
1113
+ if (options == null) options = {};
1114
+ return this.getFilterState().setOption('sortBy', sortBy, options);
1115
+ },
1116
+ applyFilter: function(query, options) {
1117
+ if (query == null) query = {};
1118
+ if (options == null) options = {};
1119
+ options = _.defaults(options, this.getQueryOptions());
1120
+ query = _.defaults(query, this.getQuery());
1121
+ return this.getFilterState().set({
1122
+ query: query,
1123
+ options: options
1124
+ }, options);
1125
+ }
1126
+ };
1127
+
1128
+ FilterModel = (function(_super) {
1129
+
1130
+ __extends(FilterModel, _super);
1131
+
1132
+ function FilterModel() {
1133
+ FilterModel.__super__.constructor.apply(this, arguments);
1134
+ }
1135
+
1136
+ FilterModel.prototype.defaults = {
1137
+ options: {},
1138
+ query: {}
1139
+ };
1140
+
1141
+ FilterModel.prototype.setOption = function(option, value, options) {
1142
+ var payload;
1143
+ payload = {};
1144
+ payload[option] = value;
1145
+ return this.set('options', _.extend(this.toOptions(), payload), options);
1146
+ };
1147
+
1148
+ FilterModel.prototype.setQueryOption = function(option, value, options) {
1149
+ var payload;
1150
+ payload = {};
1151
+ payload[option] = value;
1152
+ return this.set('query', _.extend(this.toQuery(), payload), options);
1153
+ };
1154
+
1155
+ FilterModel.prototype.toOptions = function() {
1156
+ return this.toJSON().options;
1157
+ };
1158
+
1159
+ FilterModel.prototype.toQuery = function() {
1160
+ return this.toJSON().query;
1161
+ };
1162
+
1163
+ FilterModel.prototype.toRemote = function() {
1164
+ var options;
1165
+ options = this.toOptions();
1166
+ return _.extend(this.toQuery(), {
1167
+ limit: options.limit,
1168
+ page: options.page,
1169
+ sortBy: options.sortBy
1170
+ });
1171
+ };
1172
+
1173
+ return FilterModel;
1174
+
1175
+ })(Backbone.Model);
1176
+
699
1177
  }).call(this);
700
1178
  (function() {
701
1179
 
702
1180
  Luca.modules.GridLayout = {
703
- _included: function(view, module) {}
1181
+ _initializer: function() {
1182
+ if (this.gridSpan) this.$el.addClass("span" + this.gridSpan);
1183
+ if (this.gridOffset) this.$el.addClass("offset" + this.gridOffset);
1184
+ if (this.gridRowFluid) this.$el.addClass("row-fluid");
1185
+ if (this.gridRow) return this.$el.addClass("row");
1186
+ }
704
1187
  };
705
1188
 
706
1189
  }).call(this);
707
1190
  (function() {
708
1191
 
709
1192
  Luca.modules.LoadMaskable = {
710
- _included: function(self, module) {
1193
+ __initializer: function() {
711
1194
  var _this = this;
712
- _.bindAll(self, "applyLoadMask", "disableLoadMask");
1195
+ if (this.loadMask !== true) return;
713
1196
  if (this.loadMask === true) {
714
1197
  this.defer(function() {
715
1198
  _this.$el.addClass('with-mask');
@@ -718,10 +1201,16 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
718
1201
  return _this.$('.load-mask').hide();
719
1202
  }
720
1203
  }).until("after:render");
721
- this.on(this.loadmaskEnableEvent || "enable:loadmask", this.applyLoadMask);
722
- return this.on(this.loadmaskDisableEvent || "disable:loadmask", this.applyLoadMask);
1204
+ this.on(this.loadmaskEnableEvent || "enable:loadmask", this.applyLoadMask, this);
1205
+ return this.on(this.loadmaskDisableEvent || "disable:loadmask", this.applyLoadMask, this);
723
1206
  }
724
1207
  },
1208
+ showLoadMask: function() {
1209
+ return this.trigger("enable:loadmask");
1210
+ },
1211
+ hideLoadMask: function() {
1212
+ return this.trigger("disable:loadmask");
1213
+ },
725
1214
  loadMaskTarget: function() {
726
1215
  if (this.loadMaskEl != null) {
727
1216
  return this.$(this.loadMaskEl);
@@ -845,7 +1334,197 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
845
1334
 
846
1335
  }).call(this);
847
1336
  (function() {
848
- var component_cache, registry;
1337
+ var applyModalConfig;
1338
+
1339
+ Luca.modules.ModalView = {
1340
+ closeOnEscape: true,
1341
+ showOnInitialize: false,
1342
+ backdrop: false,
1343
+ __initializer: function() {
1344
+ this.$el.addClass("modal");
1345
+ this.on("before:render", applyModalConfig, this);
1346
+ return this;
1347
+ },
1348
+ container: function() {
1349
+ return $('body');
1350
+ },
1351
+ toggle: function() {
1352
+ return this.$el.modal('toggle');
1353
+ },
1354
+ show: function() {
1355
+ return this.$el.modal('show');
1356
+ },
1357
+ hide: function() {
1358
+ return this.$el.modal('hide');
1359
+ }
1360
+ };
1361
+
1362
+ applyModalConfig = function() {
1363
+ this.$el.addClass('modal');
1364
+ if (this.fade === true) this.$el.addClass('fade');
1365
+ $('body').append(this.$el);
1366
+ this.$el.modal({
1367
+ backdrop: this.backdrop === true,
1368
+ keyboard: this.closeOnEscape === true,
1369
+ show: this.showOnInitialize === true
1370
+ });
1371
+ return this;
1372
+ };
1373
+
1374
+ }).call(this);
1375
+ (function() {
1376
+
1377
+ Luca.modules.Paginatable = {
1378
+ paginatorViewClass: 'Luca.components.PaginationControl',
1379
+ paginationSelector: ".toolbar.bottom",
1380
+ __included: function() {
1381
+ return _.extend(Luca.Collection.prototype, {
1382
+ __paginators: {}
1383
+ });
1384
+ },
1385
+ __initializer: function() {
1386
+ var collection, paginationState, _base, _ref,
1387
+ _this = this;
1388
+ if (this.paginatable === false) return;
1389
+ if (!Luca.isBackboneCollection(this.collection)) {
1390
+ this.collection = typeof (_base = Luca.CollectionManager).get === "function" ? (_ref = _base.get()) != null ? _ref.getOrCreate(this.collection) : void 0 : void 0;
1391
+ }
1392
+ if (!Luca.isBackboneCollection(this.collection)) {
1393
+ this.debug("Skipping Paginatable due to no collection being present on " + (this.name || this.cid));
1394
+ this.debug("collection", this.collection);
1395
+ return;
1396
+ }
1397
+ _.bindAll(this, "paginationControl", "pager");
1398
+ this.getCollection || (this.getCollection = function() {
1399
+ return this.collection;
1400
+ });
1401
+ collection = this.getCollection();
1402
+ paginationState = this.getPaginationState();
1403
+ this.optionsSources || (this.optionsSources = []);
1404
+ this.queryOptions || (this.queryOptions = {});
1405
+ this.optionsSources.push(function() {
1406
+ var options;
1407
+ options = _(paginationState.toJSON()).pick('limit', 'page', 'sortBy');
1408
+ return _.extend(options, {
1409
+ pager: _this.pager
1410
+ });
1411
+ });
1412
+ paginationState.on("change:page", function(state) {
1413
+ var filter;
1414
+ if (_this.isRemote()) {
1415
+ filter = _.extend(_this.toQuery(), _this.toQueryOptions());
1416
+ return _this.collection.applyFilter(filter, {
1417
+ remote: true
1418
+ });
1419
+ } else {
1420
+ return _this.trigger("refresh");
1421
+ }
1422
+ });
1423
+ return this.on("before:render", this.renderPaginationControl, this);
1424
+ },
1425
+ pager: function(numberOfPages, models) {
1426
+ this.getPaginationState().set({
1427
+ numberOfPages: numberOfPages,
1428
+ itemCount: models.length
1429
+ });
1430
+ return this.paginationControl().updateWithPageCount(numberOfPages, models);
1431
+ },
1432
+ isRemote: function() {
1433
+ return this.getQueryOptions().remote === true;
1434
+ },
1435
+ getPaginationState: function() {
1436
+ var _base, _name;
1437
+ return (_base = this.collection.__paginators)[_name = this.cid] || (_base[_name] = this.paginationControl().state);
1438
+ },
1439
+ paginationContainer: function() {
1440
+ return this.$(">" + this.paginationSelector);
1441
+ },
1442
+ setCurrentPage: function(page, options) {
1443
+ if (page == null) page = 1;
1444
+ if (options == null) options = {};
1445
+ return this.getPaginationState().set('page', page, options);
1446
+ },
1447
+ setPage: function(page, options) {
1448
+ if (page == null) page = 1;
1449
+ if (options == null) options = {};
1450
+ return this.getPaginationState().set('page', page, options);
1451
+ },
1452
+ setLimit: function(limit, options) {
1453
+ if (limit == null) limit = 0;
1454
+ if (options == null) options = {};
1455
+ return this.getPaginationState().set('limit', limit, options);
1456
+ },
1457
+ paginationControl: function() {
1458
+ if (this.paginator != null) return this.paginator;
1459
+ _.defaults(this.paginatable || (this.paginatable = {}), {
1460
+ page: 1,
1461
+ limit: 20
1462
+ });
1463
+ this.paginator = Luca.util.lazyComponent({
1464
+ type: "pagination_control",
1465
+ collection: this.getCollection(),
1466
+ defaultState: this.paginatable,
1467
+ parent: this.name || this.cid,
1468
+ debugMode: this.debugMode
1469
+ });
1470
+ return this.paginator;
1471
+ },
1472
+ renderPaginationControl: function() {
1473
+ var control;
1474
+ control = this.paginationControl();
1475
+ this.paginationContainer().append(control.render().$el);
1476
+ return control;
1477
+ }
1478
+ };
1479
+
1480
+ }).call(this);
1481
+ (function() {
1482
+
1483
+ Luca.modules.StateModel = {
1484
+ __initializer: function() {
1485
+ var _this = this;
1486
+ if (this.stateful !== true) return;
1487
+ if ((this.state != null) && !Luca.isBackboneModel(this.state)) return;
1488
+ this.state = new Backbone.Model(this.defaultState || {});
1489
+ this.set || (this.set = function() {
1490
+ return _this.state.set.apply(_this.state, arguments);
1491
+ });
1492
+ this.get || (this.get = function() {
1493
+ return _this.state.get.apply(_this.state, arguments);
1494
+ });
1495
+ return this.state.on("change", function(state) {
1496
+ var changed, previousValues, value, _len, _ref, _results;
1497
+ _this.trigger("state:change", state);
1498
+ previousValues = state.previousAttributes();
1499
+ _ref = state.changedAttributes;
1500
+ _results = [];
1501
+ for (value = 0, _len = _ref.length; value < _len; value++) {
1502
+ changed = _ref[value];
1503
+ _results.push(_this.trigger("state:change:" + changed, value, state.previous(changed)));
1504
+ }
1505
+ return _results;
1506
+ });
1507
+ }
1508
+ };
1509
+
1510
+ }).call(this);
1511
+ (function() {
1512
+
1513
+ Luca.modules.Templating = {
1514
+ __initializer: function() {
1515
+ var template, templateContent, templateVars;
1516
+ templateVars = Luca.util.read.call(this, this.bodyTemplateVars) || {};
1517
+ if (template = this.bodyTemplate) {
1518
+ this.$el.empty();
1519
+ templateContent = Luca.template(template, templateVars);
1520
+ return Luca.View.prototype.$html.call(this, templateContent);
1521
+ }
1522
+ }
1523
+ };
1524
+
1525
+ }).call(this);
1526
+ (function() {
1527
+ var componentCacheStore, registry;
849
1528
 
850
1529
  registry = {
851
1530
  classes: {},
@@ -854,12 +1533,14 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
854
1533
  namespaces: ['Luca.containers', 'Luca.components']
855
1534
  };
856
1535
 
857
- component_cache = {
1536
+ componentCacheStore = {
858
1537
  cid_index: {},
859
1538
  name_index: {}
860
1539
  };
861
1540
 
862
- Luca.defaultComponentType = 'view';
1541
+ Luca.config.defaultComponentClass = Luca.defaultComponentClass = 'Luca.View';
1542
+
1543
+ Luca.config.defaultComponentType = Luca.defaultComponentType = 'view';
863
1544
 
864
1545
  Luca.registry.aliases = {
865
1546
  grid: "grid_view",
@@ -870,10 +1551,13 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
870
1551
  card: "card_view",
871
1552
  paged: "card_view",
872
1553
  wizard: "card_view",
873
- collection: "collection_view"
1554
+ collection: "collection_view",
1555
+ list: "collection_view",
1556
+ multi: "collection_multi_view",
1557
+ table: "table_view"
874
1558
  };
875
1559
 
876
- Luca.register = function(component, prototypeName, componentType) {
1560
+ Luca.registerComponent = function(component, prototypeName, componentType) {
877
1561
  if (componentType == null) componentType = "view";
878
1562
  Luca.trigger("component:registered", component, prototypeName);
879
1563
  switch (componentType) {
@@ -897,10 +1581,10 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
897
1581
  return instance != null ? (_ref = instance.refreshCode) != null ? _ref.call(instance, prototypeDefinition) : void 0 : void 0;
898
1582
  });
899
1583
  }
900
- return Luca.register(component, prototypeName);
1584
+ return Luca.registerComponent(component, prototypeName);
901
1585
  };
902
1586
 
903
- Luca.registry.addNamespace = function(identifier) {
1587
+ Luca.registry.addNamespace = Luca.registry.namespace = function(identifier) {
904
1588
  registry.namespaces.push(identifier);
905
1589
  return registry.namespaces = _(registry.namespaces).uniq();
906
1590
  };
@@ -929,14 +1613,20 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
929
1613
  };
930
1614
 
931
1615
  Luca.registry.instances = function() {
932
- return _(component_cache.cid_index).values();
1616
+ return _(componentCacheStore.cid_index).values();
1617
+ };
1618
+
1619
+ Luca.registry.findInstancesByClass = function(componentClass) {
1620
+ return Luca.registry.findInstancesByClassName(componentClass.displayName);
933
1621
  };
934
1622
 
935
1623
  Luca.registry.findInstancesByClassName = function(className) {
936
1624
  var instances;
1625
+ if (!_.isString(className)) className = className.displayName;
937
1626
  instances = Luca.registry.instances();
938
1627
  return _(instances).select(function(instance) {
939
- var _ref;
1628
+ var isClass, _ref;
1629
+ isClass = instance.displayName === className;
940
1630
  return instance.displayName === className || (typeof instance._superClass === "function" ? (_ref = instance._superClass()) != null ? _ref.displayName : void 0 : void 0) === className;
941
1631
  });
942
1632
  };
@@ -955,18 +1645,20 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
955
1645
  });
956
1646
  };
957
1647
 
958
- Luca.cache = function(needle, component) {
1648
+ Luca.cache = Luca.cacheInstance = function(cacheKey, object) {
959
1649
  var lookup_id;
960
- if (component != null) component_cache.cid_index[needle] = component;
961
- component = component_cache.cid_index[needle];
962
- if ((component != null ? component.component_name : void 0) != null) {
963
- component_cache.name_index[component.component_name] = component.cid;
964
- } else if ((component != null ? component.name : void 0) != null) {
965
- component_cache.name_index[component.name] = component.cid;
1650
+ if (cacheKey == null) return;
1651
+ if ((object != null ? object.doNotCache : void 0) === true) return object;
1652
+ if (object != null) componentCacheStore.cid_index[cacheKey] = object;
1653
+ object = componentCacheStore.cid_index[cacheKey];
1654
+ if ((object != null ? object.component_name : void 0) != null) {
1655
+ componentCacheStore.name_index[object.component_name] = object.cid;
1656
+ } else if ((object != null ? object.name : void 0) != null) {
1657
+ componentCacheStore.name_index[object.name] = object.cid;
966
1658
  }
967
- if (component != null) return component;
968
- lookup_id = component_cache.name_index[needle];
969
- return component_cache.cid_index[lookup_id];
1659
+ if (object != null) return object;
1660
+ lookup_id = componentCacheStore.name_index[cacheKey];
1661
+ return componentCacheStore.cid_index[lookup_id];
970
1662
  };
971
1663
 
972
1664
  }).call(this);
@@ -1012,95 +1704,46 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1012
1704
 
1013
1705
  }).call(this);
1014
1706
  (function() {
1015
- var bindAllEventHandlers, customizeRender, originalExtend, registerApplicationEvents, registerCollectionEvents, setupBodyTemplate;
1707
+ var bindAllEventHandlers, bindEventHandlers, view,
1708
+ __slice = Array.prototype.slice;
1709
+
1710
+ view = Luca.register("Luca.View");
1711
+
1712
+ view["extends"]("Backbone.View");
1713
+
1714
+ view.includes("Luca.Events", "Luca.modules.DomHelpers");
1715
+
1716
+ view.mixesIn("DomHelpers", "Templating", "EnhancedProperties", "CollectionEventBindings", "ApplicationEventBindings", "StateModel");
1016
1717
 
1017
- _.def("Luca.View")["extends"]("Backbone.View")["with"]({
1018
- include: ['Luca.Events'],
1019
- additionalClassNames: [],
1020
- hooks: ["before:initialize", "after:initialize", "before:render", "after:render", "first:activation", "activation", "deactivation"],
1718
+ view.triggers("before:initialize", "after:initialize", "before:render", "after:render", "first:activation", "activation", "deactivation");
1719
+
1720
+ view.defines({
1021
1721
  initialize: function(options) {
1022
- var additional, module, _i, _j, _len, _len2, _ref, _ref2, _ref3, _ref4,
1023
- _this = this;
1024
1722
  this.options = options != null ? options : {};
1025
1723
  this.trigger("before:initialize", this, this.options);
1026
1724
  _.extend(this, this.options);
1027
1725
  if (this.autoBindEventHandlers === true || this.bindAllEvents === true) {
1028
1726
  bindAllEventHandlers.call(this);
1029
1727
  }
1030
- setupBodyTemplate.call(this);
1031
1728
  if (this.name != null) this.cid = _.uniqueId(this.name);
1032
- Luca.cache(this.cid, this);
1729
+ this.$el.attr("data-luca-id", this.name || this.cid);
1730
+ Luca.cacheInstance(this.cid, this);
1033
1731
  this.setupHooks(_(Luca.View.prototype.hooks.concat(this.hooks)).uniq());
1034
- if (this.additionalClassNames) {
1035
- if (_.isString(this.additionalClassNames)) {
1036
- this.additionalClassNames = this.additionalClassNames.split(" ");
1037
- }
1038
- }
1039
- if (this.gridSpan) this.additionalClassNames.push("span" + this.gridSpan);
1040
- if (this.gridOffset) {
1041
- this.additionalClassNames.push("offset" + this.gridOffset);
1042
- }
1043
- if (this.gridRowFluid) this.additionalClassNames.push("row-fluid");
1044
- if (this.gridRow) this.additionalClassNames.push("row");
1045
- if (((_ref = this.additionalClassNames) != null ? _ref.length : void 0) > 0) {
1046
- _ref2 = this.additionalClassNames;
1047
- for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
1048
- additional = _ref2[_i];
1049
- this.$el.addClass(additional);
1050
- }
1051
- }
1052
- if (this.wrapperClass != null) this.$wrap(this.wrapperClass);
1053
- registerCollectionEvents.call(this);
1054
- registerApplicationEvents.call(this);
1732
+ this.setupMixins();
1055
1733
  this.delegateEvents();
1056
- if (this.stateful === true && !(this.state != null)) {
1057
- this.state = new Backbone.Model(this.defaultState || {});
1058
- if (this.set == null) {
1059
- this.set = function() {
1060
- return _this.state.set.apply(_this.state, argumuments);
1061
- };
1062
- }
1063
- if (this.get == null) {
1064
- this.get = function() {
1065
- return _this.state.get.apply(_this.state, argumuments);
1066
- };
1067
- }
1068
- }
1069
- if (((_ref3 = this.mixins) != null ? _ref3.length : void 0) > 0) {
1070
- _ref4 = this.mixins;
1071
- for (_j = 0, _len2 = _ref4.length; _j < _len2; _j++) {
1072
- module = _ref4[_j];
1073
- Luca.modules[module]._included.call(this, this, module);
1074
- }
1075
- }
1076
1734
  return this.trigger("after:initialize", this);
1077
1735
  },
1078
- $wrap: function(wrapper) {
1079
- if (_.isString(wrapper) && !wrapper.match(/[<>]/)) {
1080
- wrapper = this.make("div", {
1081
- "class": wrapper
1082
- });
1736
+ setupMixins: function() {
1737
+ var module, _i, _len, _ref, _ref2, _ref3, _ref4, _results;
1738
+ if (((_ref = this.mixins) != null ? _ref.length : void 0) > 0) {
1739
+ _ref2 = this.mixins;
1740
+ _results = [];
1741
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
1742
+ module = _ref2[_i];
1743
+ _results.push((_ref3 = Luca.mixin(module)) != null ? (_ref4 = _ref3.__initializer) != null ? _ref4.call(this, this, module) : void 0 : void 0);
1744
+ }
1745
+ return _results;
1083
1746
  }
1084
- return this.$el.wrap(wrapper);
1085
- },
1086
- $template: function(template, variables) {
1087
- if (variables == null) variables = {};
1088
- return this.$el.html(Luca.template(template, variables));
1089
- },
1090
- $html: function(content) {
1091
- return this.$el.html(content);
1092
- },
1093
- $append: function(content) {
1094
- return this.$el.append(content);
1095
- },
1096
- $attach: function() {
1097
- return this.$container().append(this.el);
1098
- },
1099
- $bodyEl: function() {
1100
- return this.$el;
1101
- },
1102
- $container: function() {
1103
- return $(this.container);
1104
1747
  },
1105
1748
  setupHooks: function(set) {
1106
1749
  var _this = this;
@@ -1110,12 +1753,12 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1110
1753
  fn = Luca.util.hook(eventId);
1111
1754
  callback = function() {
1112
1755
  var _ref;
1113
- return (_ref = _this[fn]) != null ? _ref.apply(_this, arguments) : void 0;
1756
+ return (_ref = this[fn]) != null ? _ref.apply(this, arguments) : void 0;
1114
1757
  };
1115
1758
  if (eventId != null ? eventId.match(/once:/) : void 0) {
1116
1759
  callback = _.once(callback);
1117
1760
  }
1118
- return _this.bind(eventId, callback);
1761
+ return _this.on(eventId, callback, _this);
1119
1762
  });
1120
1763
  },
1121
1764
  registerEvent: function(selector, handler) {
@@ -1137,14 +1780,10 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1137
1780
  return Luca.util.selectProperties(Luca.isBackboneView, this);
1138
1781
  },
1139
1782
  debug: function() {
1140
- var message, _i, _len, _results;
1783
+ var args;
1784
+ args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
1141
1785
  if (!(this.debugMode || (window.LucaDebugMode != null))) return;
1142
- _results = [];
1143
- for (_i = 0, _len = arguments.length; _i < _len; _i++) {
1144
- message = arguments[_i];
1145
- _results.push(console.log([this.name || this.cid, message]));
1146
- }
1147
- return _results;
1786
+ return console.log([this.name || this.cid].concat(__slice.call(args)));
1148
1787
  },
1149
1788
  trigger: function() {
1150
1789
  if (Luca.enableGlobalObserver) {
@@ -1159,14 +1798,14 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1159
1798
  }
1160
1799
  });
1161
1800
 
1162
- originalExtend = Backbone.View.extend;
1801
+ Luca.View._originalExtend = Backbone.View.extend;
1163
1802
 
1164
- customizeRender = function(definition) {
1803
+ Luca.View.renderWrapper = function(definition) {
1165
1804
  var _base;
1166
1805
  _base = definition.render;
1167
1806
  _base || (_base = Luca.View.prototype.$attach);
1168
1807
  definition.render = function() {
1169
- var autoTrigger, deferred, fn, target, trigger, view,
1808
+ var autoTrigger, deferred, fn, target, trigger,
1170
1809
  _this = this;
1171
1810
  view = this;
1172
1811
  if (this.deferrable) {
@@ -1175,7 +1814,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1175
1814
  this.deferrable = this.collection;
1176
1815
  }
1177
1816
  target || (target = this.deferrable);
1178
- trigger = this.deferrable_event ? this.deferrable_event : "reset";
1817
+ trigger = this.deferrable_event ? this.deferrable_event : Luca.View.deferrableEvent;
1179
1818
  deferred = function() {
1180
1819
  _base.call(view);
1181
1820
  return view.trigger("after:render", view);
@@ -1203,88 +1842,78 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1203
1842
  return definition;
1204
1843
  };
1205
1844
 
1206
- bindAllEventHandlers = function() {
1207
- var _this = this;
1208
- return _(this.events).each(function(handler, event) {
1209
- if (_.isString(handler)) return _.bindAll(_this, handler);
1210
- });
1211
- };
1212
-
1213
- registerApplicationEvents = function() {
1214
- var app, eventTrigger, handler, _len, _ref, _ref2, _results;
1215
- if (_.isEmpty(this.applicationEvents)) return;
1216
- app = this.app;
1217
- if (_.isString(app) || _.isUndefined(app)) {
1218
- app = (_ref = Luca.Application) != null ? typeof _ref.get === "function" ? _ref.get(app) : void 0 : void 0;
1219
- }
1220
- if (!Luca.supportsEvents(app)) {
1221
- throw "Error binding to the application object on " + (this.name || this.cid);
1222
- }
1223
- _ref2 = this.applicationEvents;
1224
- _results = [];
1225
- for (handler = 0, _len = _ref2.length; handler < _len; handler++) {
1226
- eventTrigger = _ref2[handler];
1227
- if (_.isString(handler)) handler = this[handler];
1228
- if (!_.isFunction(handler)) {
1229
- throw "Error registering application event " + eventTrigger + " on " + (this.name || this.cid);
1230
- }
1231
- _results.push(app.on(eventTrigger, handler));
1232
- }
1233
- return _results;
1234
- };
1235
-
1236
- registerCollectionEvents = function() {
1237
- var collection, eventTrigger, handler, key, manager, signature, _ref, _ref2, _results;
1238
- if (_.isEmpty(this.collectionEvents)) return;
1239
- manager = this.collectionManager;
1240
- if (_.isString(manager) || _.isUndefined(manager)) {
1241
- manager = Luca.CollectionManager.get(manager);
1242
- }
1243
- _ref = this.collectionEvents;
1244
- _results = [];
1245
- for (signature in _ref) {
1246
- handler = _ref[signature];
1247
- console.log("Sig", signature, "Handler", handler);
1248
- _ref2 = signature.split(" "), key = _ref2[0], eventTrigger = _ref2[1];
1249
- collection = manager.getOrCreate(key);
1250
- if (!collection) throw "Could not find collection specified by " + key;
1251
- if (_.isString(handler)) handler = this[handler];
1252
- if (!_.isFunction(handler)) throw "invalid collectionEvents configuration";
1253
- try {
1254
- _results.push(collection.bind(eventTrigger, handler));
1255
- } catch (e) {
1256
- console.log("Error Binding To Collection in registerCollectionEvents", this);
1257
- throw e;
1258
- }
1845
+ bindAllEventHandlers = function() {
1846
+ var config, _i, _len, _ref, _results;
1847
+ _ref = [this.events, this.componentEvents, this.collectionEvents, this.applicationEvents];
1848
+ _results = [];
1849
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1850
+ config = _ref[_i];
1851
+ if (!_.isEmpty(config)) _results.push(bindEventHandlers.call(this, config));
1259
1852
  }
1260
1853
  return _results;
1261
1854
  };
1262
1855
 
1263
- setupBodyTemplate = function() {
1264
- var template, templateVars;
1265
- templateVars = this.bodyTemplateVars ? this.bodyTemplateVars.call(this) : this;
1266
- if (template = this.bodyTemplate) {
1267
- this.$el.empty();
1268
- return Luca.View.prototype.$html.call(this, Luca.template(template, templateVars));
1856
+ bindEventHandlers = function(events) {
1857
+ var eventSignature, handler, _results;
1858
+ if (events == null) events = {};
1859
+ _results = [];
1860
+ for (eventSignature in events) {
1861
+ handler = events[eventSignature];
1862
+ if (_.isString(handler)) {
1863
+ _results.push(_.bindAll(this, handler));
1864
+ } else {
1865
+ _results.push(void 0);
1866
+ }
1269
1867
  }
1868
+ return _results;
1270
1869
  };
1271
1870
 
1272
1871
  Luca.View.extend = function(definition) {
1273
1872
  var module, _i, _len, _ref;
1274
- definition = customizeRender(definition);
1873
+ definition = Luca.View.renderWrapper(definition);
1275
1874
  if ((definition.mixins != null) && _.isArray(definition.mixins)) {
1276
1875
  _ref = definition.mixins;
1277
1876
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1278
1877
  module = _ref[_i];
1279
- _.extend(definition, Luca.modules[module]);
1878
+ Luca.decorate(definition)["with"](module);
1280
1879
  }
1281
1880
  }
1282
- return originalExtend.call(this, definition);
1881
+ return Luca.View._originalExtend.call(this, definition);
1283
1882
  };
1284
1883
 
1884
+ Luca.View.deferrableEvent = "reset";
1885
+
1285
1886
  }).call(this);
1286
1887
  (function() {
1287
- var setupComputedProperties;
1888
+ var model, setupComputedProperties;
1889
+
1890
+ model = Luca.define('Luca.Model');
1891
+
1892
+ model["extends"]('Backbone.Model');
1893
+
1894
+ model.includes('Luca.Events');
1895
+
1896
+ model.defines({
1897
+ initialize: function() {
1898
+ Backbone.Model.prototype.initialize(this, arguments);
1899
+ return setupComputedProperties.call(this);
1900
+ },
1901
+ read: function(attr) {
1902
+ if (_.isFunction(this[attr])) {
1903
+ return this[attr].call(this);
1904
+ } else {
1905
+ return this.get(attr);
1906
+ }
1907
+ },
1908
+ get: function(attr) {
1909
+ var _ref;
1910
+ if ((_ref = this.computed) != null ? _ref.hasOwnProperty(attr) : void 0) {
1911
+ return this._computed[attr];
1912
+ } else {
1913
+ return Backbone.Model.prototype.get.call(this, attr);
1914
+ }
1915
+ }
1916
+ });
1288
1917
 
1289
1918
  setupComputedProperties = function() {
1290
1919
  var attr, dependencies, _ref, _results,
@@ -1309,32 +1938,22 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1309
1938
  return _results;
1310
1939
  };
1311
1940
 
1312
- _.def('Luca.Model')["extends"]('Backbone.Model')["with"]({
1313
- include: ['Luca.Events'],
1314
- initialize: function() {
1315
- Backbone.Model.prototype.initialize(this, arguments);
1316
- return setupComputedProperties.call(this);
1317
- },
1318
- get: function(attr) {
1319
- var _ref;
1320
- if ((_ref = this.computed) != null ? _ref.hasOwnProperty(attr) : void 0) {
1321
- return this._computed[attr];
1322
- } else {
1323
- return Backbone.Model.prototype.get.call(this, attr);
1324
- }
1325
- }
1326
- });
1327
-
1328
1941
  }).call(this);
1329
1942
  (function() {
1330
- var source;
1943
+ var collection;
1944
+
1945
+ collection = Luca.define('Luca.Collection');
1331
1946
 
1332
- source = 'Backbone.Collection';
1947
+ if (Backbone.QueryCollection != null) {
1948
+ collection["extends"]('Backbone.QueryCollection');
1949
+ } else {
1950
+ collection["extends"]('Backbone.Collection');
1951
+ }
1333
1952
 
1334
- if (Backbone.QueryCollection != null) source = 'Backbone.QueryCollection';
1953
+ collection.includes('Luca.Events');
1335
1954
 
1336
- _.def("Luca.Collection")["extends"](source)["with"]({
1337
- include: ['Luca.Events'],
1955
+ collection.defines({
1956
+ model: Luca.Model,
1338
1957
  cachedMethods: [],
1339
1958
  remoteFilter: false,
1340
1959
  initialize: function(models, options) {
@@ -1567,7 +2186,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1567
2186
  return _results;
1568
2187
  },
1569
2188
  setupMethodCaching: function() {
1570
- var cache, collection, membershipEvents;
2189
+ var cache, membershipEvents;
1571
2190
  collection = this;
1572
2191
  membershipEvents = ["reset", "add", "remove"];
1573
2192
  cache = this._methodCache = {};
@@ -1790,11 +2409,13 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1790
2409
  this.input_id || (this.input_id = _.uniqueId('field'));
1791
2410
  this.input_name || (this.input_name = this.name);
1792
2411
  this.input_class || (this.input_class = "");
2412
+ this.input_type || (this.input_type = "");
1793
2413
  this.helperText || (this.helperText = "");
1794
2414
  if (this.required && !((_ref = this.label) != null ? _ref.match(/^\*/) : void 0)) {
1795
2415
  this.label || (this.label = "*" + this.label);
1796
2416
  }
1797
2417
  this.inputStyles || (this.inputStyles = "");
2418
+ this.input_value || (this.input_value = this.value || "");
1798
2419
  if (this.disabled) this.disable();
1799
2420
  this.updateState(this.state);
1800
2421
  this.placeHolder || (this.placeHolder = "");
@@ -1802,22 +2423,20 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1802
2423
  },
1803
2424
  beforeRender: function() {
1804
2425
  if (Luca.enableBootstrap) this.$el.addClass('control-group');
1805
- if (this.required) this.$el.addClass('required');
1806
- this.$el.html(Luca.template(this.template, this));
1807
- return this.input = $('input', this.el);
2426
+ if (this.required) return this.$el.addClass('required');
1808
2427
  },
1809
2428
  change_handler: function(e) {
1810
2429
  return this.trigger("on:change", this, e);
1811
2430
  },
1812
2431
  disable: function() {
1813
- return $("input", this.el).attr('disabled', true);
2432
+ return this.getInputElement().attr('disabled', true);
1814
2433
  },
1815
2434
  enable: function() {
1816
- return $("input", this.el).attr('disabled', false);
2435
+ return this.getInputElement().attr('disabled', false);
1817
2436
  },
1818
2437
  getValue: function() {
1819
- var raw;
1820
- raw = this.input.attr('value');
2438
+ var raw, _ref;
2439
+ raw = (_ref = this.getInputElement()) != null ? _ref.attr('value') : void 0;
1821
2440
  if (_.str.isBlank(raw)) return raw;
1822
2441
  switch (this.valueType) {
1823
2442
  case "integer":
@@ -1830,11 +2449,12 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1830
2449
  return raw;
1831
2450
  }
1832
2451
  },
1833
- render: function() {
1834
- return $(this.container).append(this.$el);
1835
- },
1836
2452
  setValue: function(value) {
1837
- return this.input.attr('value', value);
2453
+ var _ref;
2454
+ return (_ref = this.getInputElement()) != null ? _ref.attr('value', value) : void 0;
2455
+ },
2456
+ getInputElement: function() {
2457
+ return this.input || (this.input = this.$('input').eq(0));
1838
2458
  },
1839
2459
  updateState: function(state) {
1840
2460
  var _this = this;
@@ -1847,57 +2467,28 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1847
2467
 
1848
2468
  }).call(this);
1849
2469
  (function() {
1850
- var applyDOMConfig, doComponents, doLayout;
2470
+ var applyDOMConfig, container, createGetterMethods, createMethodsToGetComponentsByRole, doComponents, doLayout, indexComponent, validateContainerConfiguration;
1851
2471
 
1852
- doLayout = function() {
1853
- this.trigger("before:layout", this);
1854
- this.prepareLayout();
1855
- return this.trigger("after:layout", this);
1856
- };
2472
+ container = Luca.register("Luca.core.Container");
1857
2473
 
1858
- applyDOMConfig = function(panel, panelIndex) {
1859
- var config, style_declarations;
1860
- style_declarations = [];
1861
- if (panel.height != null) {
1862
- style_declarations.push("height: " + (_.isNumber(panel.height) ? panel.height + 'px' : panel.height));
1863
- }
1864
- if (panel.width != null) {
1865
- style_declarations.push("width: " + (_.isNumber(panel.width) ? panel.width + 'px' : panel.width));
1866
- }
1867
- if (panel.float) style_declarations.push("float: " + panel.float);
1868
- config = {
1869
- "class": (panel != null ? panel.classes : void 0) || this.componentClass,
1870
- id: "" + this.cid + "-" + panelIndex,
1871
- style: style_declarations.join(';'),
1872
- "data-luca-owner": this.name || this.cid
1873
- };
1874
- if (this.customizeContainerEl != null) {
1875
- config = this.customizeContainerEl(config, panel, panelIndex);
1876
- }
1877
- return config;
1878
- };
2474
+ container["extends"]("Luca.components.Panel");
1879
2475
 
1880
- doComponents = function() {
1881
- this.trigger("before:components", this, this.components);
1882
- this.prepareComponents();
1883
- this.createComponents();
1884
- this.trigger("before:render:components", this, this.components);
1885
- this.renderComponents();
1886
- return this.trigger("after:components", this, this.components);
1887
- };
2476
+ container.triggers("before:components", "before:render:components", "before:layout", "after:components", "after:layout", "first:activation");
1888
2477
 
1889
- _.def('Luca.core.Container')["extends"]('Luca.components.Panel')["with"]({
2478
+ container.defines({
1890
2479
  className: 'luca-ui-container',
1891
2480
  componentTag: 'div',
1892
2481
  componentClass: 'luca-ui-panel',
1893
2482
  isContainer: true,
1894
- hooks: ["before:components", "before:render:components", "before:layout", "after:components", "after:layout", "first:activation"],
1895
2483
  rendered: false,
1896
2484
  components: [],
2485
+ componentEvents: {},
1897
2486
  initialize: function(options) {
1898
2487
  this.options = options != null ? options : {};
1899
2488
  _.extend(this, this.options);
1900
- this.setupHooks(["before:components", "before:render:components", "before:layout", "after:components", "after:layout", "first:activation"]);
2489
+ this.setupHooks(Luca.core.Container.prototype.hooks);
2490
+ this.components || (this.components = this.fields || (this.fields = this.pages || (this.pages = this.cards || (this.cards = this.views))));
2491
+ validateContainerConfiguration(this);
1901
2492
  return Luca.View.prototype.initialize.apply(this, arguments);
1902
2493
  },
1903
2494
  beforeRender: function() {
@@ -1910,7 +2501,6 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1910
2501
  return containerEl;
1911
2502
  },
1912
2503
  prepareLayout: function() {
1913
- var container;
1914
2504
  container = this;
1915
2505
  return this.componentContainers = _(this.components).map(function(component, index) {
1916
2506
  return applyDOMConfig.call(container, component, index);
@@ -1950,31 +2540,27 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1950
2540
  if (this.componentsCreated === true) return;
1951
2541
  map = this.componentIndex = {
1952
2542
  name_index: {},
1953
- cid_index: {}
2543
+ cid_index: {},
2544
+ role_index: {}
1954
2545
  };
2546
+ container = this;
1955
2547
  this.components = _(this.components).map(function(object, index) {
1956
- var component;
1957
- component = Luca.isBackboneView(object) ? object : (object.type || (object.type = object.ctype), !(object.type != null) ? object.components != null ? object.type = object.ctype = 'container' : object.type = object.ctype = Luca.defaultComponentType : void 0, Luca.util.lazyComponent(object));
1958
- if (_.isString(component.getter)) {
1959
- _this[component.getter] = (function() {
1960
- return component;
1961
- });
1962
- }
1963
- if (!component.container && component.options.container) {
2548
+ var component, created, _ref;
2549
+ component = Luca.isComponent(object) ? object : (object.type || (object.type = object.ctype), !(object.type != null) ? object.components != null ? object.type = object.ctype = 'container' : object.type = object.ctype = Luca.defaultComponentType : void 0, object = _.defaults(object, container.defaults || {}), created = Luca.util.lazyComponent(object));
2550
+ if (!component.container && ((_ref = component.options) != null ? _ref.container : void 0)) {
1964
2551
  component.container = component.options.container;
1965
2552
  }
1966
- if (map && (component.cid != null)) map.cid_index[component.cid] = index;
1967
- if (map && (component.name != null)) {
1968
- map.name_index[component.name] = index;
2553
+ if (!(component.container != null)) {
2554
+ console.log(component, index, _this);
2555
+ console.error("could not assign container property to component on container " + (_this.name || _this.cid));
1969
2556
  }
2557
+ indexComponent(component).at(index)["in"](_this.componentIndex);
1970
2558
  return component;
1971
2559
  });
1972
2560
  this.componentsCreated = true;
1973
- if (!_.isEmpty(this.componentEvents)) this.registerComponentEvents();
1974
2561
  return map;
1975
2562
  },
1976
2563
  renderComponents: function(debugMode) {
1977
- var container;
1978
2564
  this.debugMode = debugMode != null ? debugMode : "";
1979
2565
  this.debug("container render components");
1980
2566
  container = this;
@@ -1983,7 +2569,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
1983
2569
  return container;
1984
2570
  };
1985
2571
  try {
1986
- $(component.container).append(component.el);
2572
+ this.$(component.container).eq(0).append(component.el);
1987
2573
  return component.render();
1988
2574
  } catch (e) {
1989
2575
  console.log("Error Rendering Component " + (component.name || component.cid), component);
@@ -2010,43 +2596,102 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2010
2596
  }
2011
2597
  });
2012
2598
  },
2599
+ _: function() {
2600
+ return _(this.components);
2601
+ },
2013
2602
  pluck: function(attribute) {
2014
- return _(this.components).pluck(attribute);
2603
+ return this._().pluck(attribute);
2015
2604
  },
2016
2605
  invoke: function(method) {
2017
- return _(this.components).invoke(method);
2606
+ return this._().invoke(method);
2607
+ },
2608
+ select: function(fn) {
2609
+ return this._().select(fn);
2610
+ },
2611
+ detect: function(fn) {
2612
+ return this._().detect(attribute);
2613
+ },
2614
+ reject: function(fn) {
2615
+ return this._().reject(fn);
2018
2616
  },
2019
2617
  map: function(fn) {
2020
- return _(this.components).map(fn);
2618
+ return this._().map(fn);
2021
2619
  },
2022
- componentEvents: {},
2023
- registerComponentEvents: function() {
2024
- var component, componentName, handler, listener, trigger, _ref, _ref2, _results;
2025
- _ref = this.componentEvents;
2620
+ registerComponentEvents: function(eventList) {
2621
+ var component, componentNameOrRole, eventId, handler, listener, _ref, _ref2, _results,
2622
+ _this = this;
2623
+ container = this;
2624
+ _ref = eventList || this.componentEvents || {};
2026
2625
  _results = [];
2027
2626
  for (listener in _ref) {
2028
2627
  handler = _ref[listener];
2029
- _ref2 = listener.split(' '), componentName = _ref2[0], trigger = _ref2[1];
2030
- component = this.findComponentByName(componentName);
2031
- _results.push(component != null ? component.bind(trigger, this[handler]) : void 0);
2628
+ _ref2 = listener.split(' '), componentNameOrRole = _ref2[0], eventId = _ref2[1];
2629
+ if (!_.isFunction(this[handler])) {
2630
+ console.log("Error registering component event", listener, componentNameOrRole, eventId);
2631
+ throw "Invalid component event definition " + listener + ". Specified handler is not a method on the container";
2632
+ }
2633
+ if (componentNameOrRole === "*") {
2634
+ _results.push(this.eachComponent(function(component) {
2635
+ return component.on(eventId, _this[handler], container);
2636
+ }));
2637
+ } else {
2638
+ component = this.findComponentForEventBinding(componentNameOrRole);
2639
+ if (!((component != null) && Luca.isComponent(component))) {
2640
+ console.log("Error registering component event", listener, componentNameOrRole, eventId);
2641
+ throw "Invalid component event definition: " + componentNameOrRole;
2642
+ }
2643
+ _results.push(component != null ? component.bind(eventId, this[handler], container) : void 0);
2644
+ }
2032
2645
  }
2033
2646
  return _results;
2034
2647
  },
2648
+ subContainers: function() {
2649
+ return this.select(function(component) {
2650
+ return component.isContainer === true;
2651
+ });
2652
+ },
2653
+ roles: function() {
2654
+ return _(this.allChildren()).pluck('role');
2655
+ },
2656
+ allChildren: function() {
2657
+ var children, grandchildren;
2658
+ children = this.components;
2659
+ grandchildren = _(this.subContainers()).invoke('allChildren');
2660
+ return _([children, grandchildren]).chain().compact().flatten().value();
2661
+ },
2662
+ findComponentForEventBinding: function(nameRoleOrGetter, deep) {
2663
+ if (deep == null) deep = true;
2664
+ return this.findComponentByName(nameRoleOrGetter, deep) || this.findComponentByGetter(nameRoleOrGetter, deep) || this.findComponentByRole(nameRoleOrGetter, deep);
2665
+ },
2666
+ findComponentByGetter: function(getter, deep) {
2667
+ if (deep == null) deep = false;
2668
+ return _(this.allChildren()).detect(function(component) {
2669
+ return component.getter === getter;
2670
+ });
2671
+ },
2672
+ findComponentByRole: function(role, deep) {
2673
+ if (deep == null) deep = false;
2674
+ return _(this.allChildren()).detect(function(component) {
2675
+ return component.role === role || component.type === role || component.ctype === role;
2676
+ });
2677
+ },
2035
2678
  findComponentByName: function(name, deep) {
2036
2679
  if (deep == null) deep = false;
2037
- return this.findComponent(name, "name_index", deep);
2680
+ return _(this.allChildren()).detect(function(component) {
2681
+ return component.name === name;
2682
+ });
2038
2683
  },
2039
2684
  findComponentById: function(id, deep) {
2040
2685
  if (deep == null) deep = false;
2041
2686
  return this.findComponent(id, "cid_index", deep);
2042
2687
  },
2043
2688
  findComponent: function(needle, haystack, deep) {
2044
- var component, position, sub_container, _ref, _ref2;
2689
+ var component, position, sub_container, _ref;
2045
2690
  if (haystack == null) haystack = "name";
2046
2691
  if (deep == null) deep = false;
2047
2692
  if (this.componentsCreated !== true) this.createComponents();
2048
2693
  position = (_ref = this.componentIndex) != null ? _ref[haystack][needle] : void 0;
2049
- component = (_ref2 = this.components) != null ? _ref2[position] : void 0;
2694
+ component = this.components[position];
2050
2695
  if (component) return component;
2051
2696
  if (deep === true) {
2052
2697
  sub_container = _(this.components).detect(function(component) {
@@ -2079,20 +2724,16 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2079
2724
  return this.components[this.activeItem];
2080
2725
  },
2081
2726
  componentElements: function() {
2082
- return this.$(">." + this.componentClass, this.$bodyEl());
2727
+ return this.$("[data-luca-parent='" + (this.name || this.cid) + "']");
2083
2728
  },
2084
2729
  getComponent: function(needle) {
2085
2730
  return this.components[needle];
2086
2731
  },
2087
- rootComponent: function() {
2088
- console.log("Calling rootComponent will be deprecated. use isRootComponent instead");
2089
- return !(this.getParent != null);
2090
- },
2091
2732
  isRootComponent: function() {
2092
2733
  return !(this.getParent != null);
2093
2734
  },
2094
2735
  getRootComponent: function() {
2095
- if (this.rootComponent()) {
2736
+ if (this.isRootComponent()) {
2096
2737
  return this;
2097
2738
  } else {
2098
2739
  return this.getParent().getRootComponent();
@@ -2100,23 +2741,21 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2100
2741
  },
2101
2742
  selectByAttribute: function(attribute, value, deep) {
2102
2743
  var components;
2744
+ if (value == null) value = void 0;
2103
2745
  if (deep == null) deep = false;
2104
2746
  components = _(this.components).map(function(component) {
2105
2747
  var matches, test;
2106
2748
  matches = [];
2107
2749
  test = component[attribute];
2108
- if (test === value) matches.push(component);
2750
+ if (test === value || (!(value != null) && (test != null))) {
2751
+ matches.push(component);
2752
+ }
2109
2753
  if (deep === true) {
2110
2754
  matches.push(typeof component.selectByAttribute === "function" ? component.selectByAttribute(attribute, value, true) : void 0);
2111
2755
  }
2112
2756
  return _.compact(matches);
2113
2757
  });
2114
2758
  return _.flatten(components);
2115
- },
2116
- select: function(attribute, value, deep) {
2117
- if (deep == null) deep = false;
2118
- console.log("Container.select will be replaced by selectByAttribute in 1.0");
2119
- return Luca.core.Container.prototype.selectByAttribute.apply(this, arguments);
2120
2759
  }
2121
2760
  });
2122
2761
 
@@ -2126,6 +2765,98 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2126
2765
  return attachMethod(component.render().el);
2127
2766
  };
2128
2767
 
2768
+ doLayout = function() {
2769
+ this.trigger("before:layout", this);
2770
+ this.prepareLayout();
2771
+ return this.trigger("after:layout", this);
2772
+ };
2773
+
2774
+ applyDOMConfig = function(panel, panelIndex) {
2775
+ var config, style_declarations;
2776
+ style_declarations = [];
2777
+ if (panel.height != null) {
2778
+ style_declarations.push("height: " + (_.isNumber(panel.height) ? panel.height + 'px' : panel.height));
2779
+ }
2780
+ if (panel.width != null) {
2781
+ style_declarations.push("width: " + (_.isNumber(panel.width) ? panel.width + 'px' : panel.width));
2782
+ }
2783
+ if (panel.float) style_declarations.push("float: " + panel.float);
2784
+ config = {
2785
+ "class": (panel != null ? panel.classes : void 0) || this.componentClass,
2786
+ id: "" + this.cid + "-" + panelIndex,
2787
+ style: style_declarations.join(';'),
2788
+ "data-luca-parent": this.name || this.cid
2789
+ };
2790
+ if (this.customizeContainerEl != null) {
2791
+ config = this.customizeContainerEl(config, panel, panelIndex);
2792
+ }
2793
+ return config;
2794
+ };
2795
+
2796
+ createGetterMethods = function() {
2797
+ var childrenWithGetter;
2798
+ container = this;
2799
+ childrenWithGetter = _(this.allChildren()).select(function(component) {
2800
+ return component.getter != null;
2801
+ });
2802
+ return _(childrenWithGetter).each(function(component) {
2803
+ var _name;
2804
+ return container[_name = component.getter] || (container[_name] = function() {
2805
+ console.log(component.getter, component, container);
2806
+ return component;
2807
+ });
2808
+ });
2809
+ };
2810
+
2811
+ createMethodsToGetComponentsByRole = function() {
2812
+ var childrenWithRole;
2813
+ container = this;
2814
+ childrenWithRole = _(this.allChildren()).select(function(component) {
2815
+ return component.role != null;
2816
+ });
2817
+ return _(childrenWithRole).each(function(component) {
2818
+ var getter;
2819
+ getter = _.str.camelize("get_" + component.role);
2820
+ return container[getter] || (container[getter] = function() {
2821
+ return component;
2822
+ });
2823
+ });
2824
+ };
2825
+
2826
+ doComponents = function() {
2827
+ this.trigger("before:components", this, this.components);
2828
+ this.prepareComponents();
2829
+ this.createComponents();
2830
+ this.trigger("before:render:components", this, this.components);
2831
+ this.renderComponents();
2832
+ this.trigger("after:components", this, this.components);
2833
+ if (this.skipGetterMethods !== true) {
2834
+ createGetterMethods.call(this);
2835
+ createMethodsToGetComponentsByRole.call(this);
2836
+ }
2837
+ return this.registerComponentEvents();
2838
+ };
2839
+
2840
+ validateContainerConfiguration = function() {
2841
+ return true;
2842
+ };
2843
+
2844
+ indexComponent = function(component) {
2845
+ return {
2846
+ at: function(index) {
2847
+ return {
2848
+ "in": function(map) {
2849
+ if (component.cid != null) map.cid_index[component.cid] = index;
2850
+ if (component.role != null) map.role_index[component.role] = index;
2851
+ if (component.name != null) {
2852
+ return map.name_index[component.name] = index;
2853
+ }
2854
+ }
2855
+ };
2856
+ }
2857
+ };
2858
+ };
2859
+
2129
2860
  }).call(this);
2130
2861
  (function() {
2131
2862
  var guessCollectionClass, handleInitialCollections, loadInitialCollections;
@@ -2176,7 +2907,12 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2176
2907
  CollectionClass = collectionOptions.base;
2177
2908
  CollectionClass || (CollectionClass = guessCollectionClass.call(this, key));
2178
2909
  if (collectionOptions.private) collectionOptions.name = "";
2179
- collection = new CollectionClass(initialModels, collectionOptions);
2910
+ try {
2911
+ collection = new CollectionClass(initialModels, collectionOptions);
2912
+ } catch (e) {
2913
+ console.log("Error creating collection", CollectionClass, collectionOptions, key);
2914
+ throw e;
2915
+ }
2180
2916
  this.add(key, collection);
2181
2917
  collectionManager = this;
2182
2918
  if (this.relayEvents === true) {
@@ -2250,10 +2986,28 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2250
2986
 
2251
2987
  })();
2252
2988
 
2989
+ Luca.CollectionManager.isRunning = function() {
2990
+ return _.isEmpty(Luca.CollectionManager.instances) !== true;
2991
+ };
2992
+
2253
2993
  Luca.CollectionManager.destroyAll = function() {
2254
2994
  return Luca.CollectionManager.instances = {};
2255
2995
  };
2256
2996
 
2997
+ Luca.CollectionManager.loadCollectionsByName = function(set, callback) {
2998
+ var collection, name, _i, _len, _results;
2999
+ _results = [];
3000
+ for (_i = 0, _len = set.length; _i < _len; _i++) {
3001
+ name = set[_i];
3002
+ collection = this.getOrCreate(name);
3003
+ collection.once("reset", function() {
3004
+ return callback(collection);
3005
+ });
3006
+ _results.push(collection.fetch());
3007
+ }
3008
+ return _results;
3009
+ };
3010
+
2257
3011
  guessCollectionClass = function(key) {
2258
3012
  var classified, guess, guesses, _ref;
2259
3013
  classified = Luca.util.classify(key);
@@ -2270,7 +3024,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2270
3024
  };
2271
3025
 
2272
3026
  loadInitialCollections = function() {
2273
- var collectionDidLoad,
3027
+ var collectionDidLoad, set,
2274
3028
  _this = this;
2275
3029
  collectionDidLoad = function(collection) {
2276
3030
  var current;
@@ -2279,14 +3033,8 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2279
3033
  _this.trigger("collection_loaded", collection.name);
2280
3034
  return collection.unbind("reset");
2281
3035
  };
2282
- return _(this.initialCollections).each(function(name) {
2283
- var collection;
2284
- collection = _this.getOrCreate(name);
2285
- collection.once("reset", function() {
2286
- return collectionDidLoad(collection);
2287
- });
2288
- return collection.fetch();
2289
- });
3036
+ set = this.initialCollections;
3037
+ return Luca.CollectionManager.loadCollectionsByName.call(this, set, collectionDidLoad);
2290
3038
  };
2291
3039
 
2292
3040
  handleInitialCollections = function() {
@@ -2305,6 +3053,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2305
3053
  }));
2306
3054
  }
2307
3055
  loadInitialCollections.call(this);
3056
+ this.initialCollectionsLoadedu;
2308
3057
  return this;
2309
3058
  };
2310
3059
 
@@ -2417,9 +3166,13 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2417
3166
 
2418
3167
  }).call(this);
2419
3168
  (function() {
3169
+ var component;
3170
+
3171
+ component = Luca.define("Luca.containers.CardView");
2420
3172
 
2421
- _.def("Luca.containers.CardView")["extends"]("Luca.core.Container")["with"]({
2422
- componentType: 'card_view',
3173
+ component["extends"]("Luca.core.Container");
3174
+
3175
+ component.defaults({
2423
3176
  className: 'luca-ui-card-view-wrapper',
2424
3177
  activeCard: 0,
2425
3178
  components: [],
@@ -2429,21 +3182,16 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2429
3182
  initialize: function(options) {
2430
3183
  this.options = options;
2431
3184
  Luca.core.Container.prototype.initialize.apply(this, arguments);
2432
- return this.setupHooks(this.hooks);
3185
+ this.setupHooks(this.hooks);
3186
+ return this.components || (this.components = this.pages || (this.pages = this.cards));
2433
3187
  },
2434
3188
  prepareComponents: function() {
2435
- var _ref,
2436
- _this = this;
3189
+ var _ref;
2437
3190
  if ((_ref = Luca.core.Container.prototype.prepareComponents) != null) {
2438
3191
  _ref.apply(this, arguments);
2439
3192
  }
2440
- return _(this.components).each(function(component, index) {
2441
- if (index === _this.activeCard) {
2442
- return $(component.container).show();
2443
- } else {
2444
- return $(component.container).hide();
2445
- }
2446
- });
3193
+ this.componentElements().hide();
3194
+ return this.activeComponentElement().show();
2447
3195
  },
2448
3196
  activeComponentElement: function() {
2449
3197
  return this.componentElements().eq(this.activeCard);
@@ -2455,13 +3203,27 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2455
3203
  containerEl.style += panelIndex === this.activeCard ? "display:block;" : "display:none;";
2456
3204
  return containerEl;
2457
3205
  },
3206
+ atFirst: function() {
3207
+ return this.activeCard === 0;
3208
+ },
3209
+ atLast: function() {
3210
+ return this.activeCard === this.components.length - 1;
3211
+ },
3212
+ next: function() {
3213
+ if (this.atLast()) return;
3214
+ return this.activate(this.activeCard + 1);
3215
+ },
3216
+ previous: function() {
3217
+ if (this.atFirst()) return;
3218
+ return this.activate(this.activeCard - 1);
3219
+ },
2458
3220
  cycle: function() {
2459
3221
  var nextIndex;
2460
- nextIndex = this.activeCard < this.components.length - 1 ? this.activeCard + 1 : 0;
3222
+ nextIndex = this.atLast() ? 0 : this.activeCard + 1;
2461
3223
  return this.activate(nextIndex);
2462
3224
  },
2463
3225
  find: function(name) {
2464
- return this.findComponentByName(name, true);
3226
+ return Luca(name);
2465
3227
  },
2466
3228
  firstActivation: function() {
2467
3229
  return this.activeComponent().trigger("first:activation", this, this.activeComponent());
@@ -2553,33 +3315,93 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2553
3315
  }
2554
3316
  });
2555
3317
 
2556
- _.def("Luca.containers.ModalView")["extends"]("Luca.ModalView")["with"]();
2557
-
2558
- }).call(this);
2559
- (function() {
2560
-
2561
- _.def("Luca.PageView")["extends"]("Luca.containers.CardView")["with"]({
2562
- version: 2
2563
- });
2564
-
2565
- }).call(this);
2566
- (function() {
2567
- var buildButton, make, prepareButtons;
2568
-
3318
+ _.def("Luca.containers.ModalView")["extends"]("Luca.ModalView")["with"]();
3319
+
3320
+ }).call(this);
3321
+ (function() {
3322
+
3323
+ _.def("Luca.PageView")["extends"]("Luca.containers.CardView")["with"]({
3324
+ version: 2
3325
+ });
3326
+
3327
+ }).call(this);
3328
+ (function() {
3329
+ var buildButton, make, panelToolbar, prepareButtons;
3330
+
3331
+ panelToolbar = Luca.register("Luca.components.PanelToolbar");
3332
+
3333
+ panelToolbar["extends"]("Luca.View");
3334
+
3335
+ panelToolbar.defines({
3336
+ buttons: [],
3337
+ className: "luca-ui-toolbar btn-toolbar",
3338
+ well: true,
3339
+ orientation: 'top',
3340
+ autoBindEventHandlers: true,
3341
+ events: {
3342
+ "click a.btn, click .dropdown-menu li": "clickHandler"
3343
+ },
3344
+ initialize: function(options) {
3345
+ var _ref;
3346
+ this.options = options != null ? options : {};
3347
+ this._super("initialize", this, arguments);
3348
+ if (this.group === true && ((_ref = this.buttons) != null ? _ref.length : void 0) >= 0) {
3349
+ return this.buttons = [
3350
+ {
3351
+ group: true,
3352
+ buttons: this.buttons
3353
+ }
3354
+ ];
3355
+ }
3356
+ },
3357
+ clickHandler: function(e) {
3358
+ var eventId, hook, me, my, source;
3359
+ me = my = $(e.target);
3360
+ if (me.is('i')) me = my = $(e.target).parent();
3361
+ if (this.selectable === true) {
3362
+ my.siblings().removeClass("is-selected");
3363
+ me.addClass('is-selected');
3364
+ }
3365
+ if (!(eventId = my.data('eventid'))) return;
3366
+ hook = Luca.util.hook(eventId);
3367
+ source = this.parent || this;
3368
+ if (_.isFunction(source[hook])) {
3369
+ return source[hook].call(this, me, e);
3370
+ } else {
3371
+ return source.trigger(eventId, me, e);
3372
+ }
3373
+ },
3374
+ beforeRender: function() {
3375
+ this._super("beforeRender", this, arguments);
3376
+ if (this.well === true) this.$el.addClass('well');
3377
+ if (this.selectable === true) this.$el.addClass('btn-selectable');
3378
+ this.$el.addClass("toolbar-" + this.orientation);
3379
+ if (this.align === "right") this.$el.addClass("pull-right");
3380
+ if (this.align === "left") return this.$el.addClass("pull-left");
3381
+ },
3382
+ render: function() {
3383
+ var element, _i, _len, _ref;
3384
+ this.$el.empty();
3385
+ _ref = prepareButtons(this.buttons);
3386
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
3387
+ element = _ref[_i];
3388
+ this.$el.append(element);
3389
+ }
3390
+ return this;
3391
+ }
3392
+ });
3393
+
2569
3394
  make = Backbone.View.prototype.make;
2570
3395
 
2571
3396
  buildButton = function(config, wrap) {
2572
3397
  var autoWrapClass, buttonAttributes, buttonEl, buttons, dropdownEl, dropdownItems, label, object, white, wrapper,
2573
3398
  _this = this;
2574
3399
  if (wrap == null) wrap = true;
2575
- if (config.ctype != null) {
3400
+ if ((config.ctype != null) || (config.type != null)) {
2576
3401
  config.className || (config.className = "");
2577
3402
  config.className += 'toolbar-component';
2578
3403
  object = Luca(config).render();
2579
- if (Luca.isBackboneView(object)) {
2580
- console.log("Adding toolbar component", object);
2581
- return object.el;
2582
- }
3404
+ if (Luca.isBackboneView(object)) return object.$el;
2583
3405
  }
2584
3406
  if (config.spacer) {
2585
3407
  return make("div", {
@@ -2592,8 +3414,11 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2592
3414
  }, config.text);
2593
3415
  }
2594
3416
  wrapper = 'btn-group';
2595
- if (config.wrapper != null) wrapper += " " + config.wrapper;
2596
- if (config.align != null) wrapper += " align-" + config.align;
3417
+ if (config.wrapper != null) wrapper += "" + config.wrapper;
3418
+ if (config.align != null) {
3419
+ wrapper += "pull-" + config.align + " align-" + config.align;
3420
+ }
3421
+ if (config.selectable === true) wrapper += 'btn-selectable';
2597
3422
  if ((config.group != null) && (config.buttons != null)) {
2598
3423
  buttons = prepareButtons(config.buttons, false);
2599
3424
  return make("div", {
@@ -2615,6 +3440,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2615
3440
  if (config.color != null) {
2616
3441
  buttonAttributes["class"] += " btn-" + config.color;
2617
3442
  }
3443
+ if (config.selected != null) buttonAttributes["class"] += " is-selected";
2618
3444
  if (config.dropdown) {
2619
3445
  label = "" + label + " <span class='caret'></span>";
2620
3446
  buttonAttributes["class"] += " dropdown-toggle";
@@ -2644,51 +3470,16 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2644
3470
  };
2645
3471
 
2646
3472
  prepareButtons = function(buttons, wrap) {
3473
+ var button, _i, _len, _results;
3474
+ if (buttons == null) buttons = [];
2647
3475
  if (wrap == null) wrap = true;
2648
- return _(buttons).map(function(button) {
2649
- return buildButton(button, wrap);
2650
- });
2651
- };
2652
-
2653
- _.def("Luca.containers.PanelToolbar")["extends"]("Luca.View")["with"]({
2654
- className: "luca-ui-toolbar btn-toolbar",
2655
- buttons: [],
2656
- well: true,
2657
- orientation: 'top',
2658
- autoBindEventHandlers: true,
2659
- events: {
2660
- "click a.btn, click .dropdown-menu li": "clickHandler"
2661
- },
2662
- clickHandler: function(e) {
2663
- var eventId, hook, me, my, source;
2664
- me = my = $(e.target);
2665
- if (me.is('i')) me = my = $(e.target).parent();
2666
- eventId = my.data('eventid');
2667
- if (eventId == null) return;
2668
- hook = Luca.util.hook(eventId);
2669
- source = this.parent || this;
2670
- if (_.isFunction(source[hook])) {
2671
- return source[hook].call(this, me, e);
2672
- } else {
2673
- return source.trigger(eventId, me, e);
2674
- }
2675
- },
2676
- beforeRender: function() {
2677
- this._super("beforeRender", this, arguments);
2678
- if (this.well === true) this.$el.addClass('well');
2679
- this.$el.addClass("toolbar-" + this.orientation);
2680
- if (this.styles != null) return this.applyStyles(this.styles);
2681
- },
2682
- render: function() {
2683
- var elements,
2684
- _this = this;
2685
- this.$el.empty();
2686
- elements = prepareButtons(this.buttons);
2687
- return _(elements).each(function(element) {
2688
- return _this.$el.append(element);
2689
- });
3476
+ _results = [];
3477
+ for (_i = 0, _len = buttons.length; _i < _len; _i++) {
3478
+ button = buttons[_i];
3479
+ _results.push(buildButton(button, wrap));
2690
3480
  }
2691
- });
3481
+ return _results;
3482
+ };
2692
3483
 
2693
3484
  }).call(this);
2694
3485
  (function() {
@@ -2754,11 +3545,12 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2754
3545
  return (_ref = Luca.containers.CardView.prototype.beforeLayout) != null ? _ref.apply(this, arguments) : void 0;
2755
3546
  },
2756
3547
  afterRender: function() {
2757
- var _ref;
3548
+ var tabContainerId, _ref;
2758
3549
  if ((_ref = Luca.containers.CardView.prototype.afterRender) != null) {
2759
3550
  _ref.apply(this, arguments);
2760
3551
  }
2761
- this.registerEvent("click #" + this.cid + "-tabs-selector li a", "select");
3552
+ tabContainerId = this.tabContainer().attr("id");
3553
+ this.registerEvent("click #" + tabContainerId + " li a", "select");
2762
3554
  if (Luca.enableBootstrap && (this.tab_position === "left" || this.tab_position === "right")) {
2763
3555
  this.tabContainerWrapper().addClass("span2");
2764
3556
  return this.tabContentWrapper().addClass("span9");
@@ -2769,7 +3561,9 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2769
3561
  tabView = this;
2770
3562
  return this.each(function(component, index) {
2771
3563
  var icon, link, selector, _ref;
2772
- if (component.tabIcon) icon = "<i class='icon-" + component.tabIcon;
3564
+ if (component.tabIcon) {
3565
+ icon = "<i class='icon-" + component.tabIcon + "'></i>";
3566
+ }
2773
3567
  link = "<a href='#'>" + (icon || '') + " " + component.title + "</a>";
2774
3568
  selector = tabView.make("li", {
2775
3569
  "class": "tab-selector",
@@ -2913,9 +3707,8 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2913
3707
 
2914
3708
  }).call(this);
2915
3709
  (function() {
2916
- var startHistory;
2917
3710
 
2918
- startHistory = function() {
3711
+ Luca.util.startHistory = function() {
2919
3712
  return Backbone.history.start();
2920
3713
  };
2921
3714
 
@@ -2950,7 +3743,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
2950
3743
  Luca.Application.instances[appName] = app;
2951
3744
  Luca.containers.Viewport.prototype.initialize.apply(this, arguments);
2952
3745
  this.state = new Luca.Model(this.defaultState);
2953
- this.setupMainController();
3746
+ if (this.useController === true) this.setupMainController();
2954
3747
  this.setupCollectionManager();
2955
3748
  this.defer(function() {
2956
3749
  return app.render();
@@ -3054,7 +3847,9 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3054
3847
  });
3055
3848
  }
3056
3849
  return (_ref2 = this.getMainController()) != null ? _ref2.each(function(component) {
3057
- if (component.ctype.match(/controller$/)) {
3850
+ var type;
3851
+ type = component.type || component.type;
3852
+ if (type.match(/controller$/)) {
3058
3853
  return component.bind("after:card:switch", function(previous, current) {
3059
3854
  _this.state.set({
3060
3855
  active_sub_section: current.name
@@ -3070,7 +3865,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3070
3865
  definedComponents = this.components || [];
3071
3866
  this.components = [
3072
3867
  {
3073
- ctype: 'controller',
3868
+ type: 'controller',
3074
3869
  name: "main_controller",
3075
3870
  components: definedComponents
3076
3871
  }
@@ -3079,25 +3874,27 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3079
3874
  }
3080
3875
  },
3081
3876
  setupCollectionManager: function() {
3082
- var collectionManagerOptions, _base, _ref, _ref2;
3083
- if (this.useCollectionManager === true) {
3084
- if (_.isString(this.collectionManagerClass)) {
3085
- this.collectionManagerClass = Luca.util.resolve(this.collectionManagerClass);
3086
- }
3087
- collectionManagerOptions = this.collectionManagerOptions;
3088
- if (_.isObject(this.collectionManager) && !_.isFunction((_ref = this.collectionManager) != null ? _ref.get : void 0)) {
3089
- collectionManagerOptions = this.collectionManager;
3090
- this.collectionManager = void 0;
3091
- }
3092
- if (_.isString(this.collectionManager)) {
3093
- collectionManagerOptions = {
3094
- name: this.collectionManager
3095
- };
3096
- }
3097
- this.collectionManager = typeof (_base = Luca.CollectionManager).get === "function" ? _base.get(collectionManagerOptions.name) : void 0;
3098
- if (!_.isFunction((_ref2 = this.collectionManager) != null ? _ref2.get : void 0)) {
3099
- return this.collectionManager = new this.collectionManagerClass(collectionManagerOptions);
3100
- }
3877
+ var collectionManagerOptions, _base, _ref, _ref2, _ref3;
3878
+ if (this.useCollectionManager !== true) return;
3879
+ if ((this.collectionManager != null) && (((_ref = this.collectionManager) != null ? _ref.get : void 0) != null)) {
3880
+ return;
3881
+ }
3882
+ if (_.isString(this.collectionManagerClass)) {
3883
+ this.collectionManagerClass = Luca.util.resolve(this.collectionManagerClass);
3884
+ }
3885
+ collectionManagerOptions = this.collectionManagerOptions || {};
3886
+ if (_.isObject(this.collectionManager) && !_.isFunction((_ref2 = this.collectionManager) != null ? _ref2.get : void 0)) {
3887
+ collectionManagerOptions = this.collectionManager;
3888
+ this.collectionManager = void 0;
3889
+ }
3890
+ if (_.isString(this.collectionManager)) {
3891
+ collectionManagerOptions = {
3892
+ name: this.collectionManager
3893
+ };
3894
+ }
3895
+ this.collectionManager = typeof (_base = Luca.CollectionManager).get === "function" ? _base.get(collectionManagerOptions.name) : void 0;
3896
+ if (!_.isFunction((_ref3 = this.collectionManager) != null ? _ref3.get : void 0)) {
3897
+ return this.collectionManager = new this.collectionManagerClass(collectionManagerOptions);
3101
3898
  }
3102
3899
  },
3103
3900
  setupRouter: function() {
@@ -3113,7 +3910,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3113
3910
  if (this.autoStartHistory === true) {
3114
3911
  this.autoStartHistory = "before:render";
3115
3912
  }
3116
- return this.defer(startHistory, false).until(this, this.autoStartHistory);
3913
+ return this.defer(Luca.util.startHistory, false).until(this, this.autoStartHistory);
3117
3914
  }
3118
3915
  },
3119
3916
  setupKeyHandler: function() {
@@ -3193,47 +3990,70 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3193
3990
 
3194
3991
  }).call(this);
3195
3992
  (function() {
3196
- var make, setupChangeObserver;
3993
+ var collectionView, make;
3994
+
3995
+ collectionView = Luca.define("Luca.components.CollectionView");
3197
3996
 
3198
- _.def("Luca.components.CollectionView")["extends"]("Luca.components.Panel")["with"]({
3199
- tagName: "div",
3997
+ collectionView["extends"]("Luca.components.Panel");
3998
+
3999
+ collectionView.behavesAs("LoadMaskable", "Filterable", "Paginatable");
4000
+
4001
+ collectionView.triggers("before:refresh", "after:refresh", "refresh", "empty:results");
4002
+
4003
+ collectionView.defaults({
4004
+ tagName: "ol",
3200
4005
  className: "luca-ui-collection-view",
3201
4006
  bodyClassName: "collection-ui-panel",
3202
4007
  itemTemplate: void 0,
3203
4008
  itemRenderer: void 0,
3204
4009
  itemTagName: 'li',
3205
4010
  itemClassName: 'collection-item',
3206
- hooks: ["empty:results"],
3207
4011
  initialize: function(options) {
3208
4012
  var _this = this;
3209
4013
  this.options = options != null ? options : {};
3210
4014
  _.extend(this, this.options);
3211
4015
  _.bindAll(this, "refresh");
3212
4016
  if (!((this.collection != null) || this.options.collection)) {
4017
+ console.log("Error on initialize of collection view", this);
3213
4018
  throw "Collection Views must specify a collection";
3214
4019
  }
3215
4020
  if (!((this.itemTemplate != null) || (this.itemRenderer != null) || (this.itemProperty != null))) {
3216
4021
  throw "Collection Views must specify an item template or item renderer function";
3217
4022
  }
3218
- Luca.components.Panel.prototype.initialize.apply(this, arguments);
3219
- if (_.isString(this.collection) && Luca.CollectionManager.get()) {
3220
- this.collection = Luca.CollectionManager.get().getOrCreate(this.collection);
4023
+ if (_.isString(this.collection)) {
4024
+ if (Luca.CollectionManager.get()) {
4025
+ this.collection = Luca.CollectionManager.get().getOrCreate(this.collection);
4026
+ } else {
4027
+ console.log("String Collection but no collection manager");
4028
+ }
3221
4029
  }
3222
- if (Luca.isBackboneCollection(this.collection)) {
4030
+ if (!Luca.isBackboneCollection(this.collection)) {
4031
+ console.log("Missing Collection on " + (this.name || this.cid), this, this.collection);
4032
+ throw "Collection Views must have a valid backbone collection";
3223
4033
  this.collection.on("before:fetch", function() {
3224
- if (_this.loadMask === true) return _this.trigger("enable:loadmask");
4034
+ return _this.trigger("enable:loadmask");
3225
4035
  });
3226
4036
  this.collection.bind("reset", function() {
3227
- if (_this.loadMask === true) _this.trigger("disable:loadmask");
4037
+ _this.refresh();
4038
+ return _this.trigger("disable:loadmask");
4039
+ });
4040
+ this.collection.bind("remove", function() {
3228
4041
  return _this.refresh();
3229
4042
  });
3230
- this.collection.bind("add", this.refresh);
3231
- this.collection.bind("remove", this.refresh);
3232
- if (this.observeChanges === true) setupChangeObserver.call(this);
3233
- } else {
3234
- throw "Collection Views must have a valid backbone collection";
4043
+ this.collection.bind("add", function() {
4044
+ return _this.refresh();
4045
+ });
4046
+ if (this.observeChanges === true) {
4047
+ this.collection.on("change", this.refreshModel, this);
4048
+ }
4049
+ }
4050
+ Luca.components.Panel.prototype.initialize.apply(this, arguments);
4051
+ if (this.autoRefreshOnModelsPresent !== false) {
4052
+ this.defer(function() {
4053
+ if (_this.collection.length > 0) return _this.refresh();
4054
+ }).until("after:render");
3235
4055
  }
3236
- if (this.collection.length > 0) return this.refresh();
4056
+ return this.on("refresh", this.refresh, this);
3237
4057
  },
3238
4058
  attributesForItem: function(item, model) {
3239
4059
  return _.extend({}, {
@@ -3246,29 +4066,67 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3246
4066
  var content, templateFn;
3247
4067
  if (item == null) item = {};
3248
4068
  if ((this.itemTemplate != null) && (templateFn = Luca.template(this.itemTemplate))) {
3249
- content = templateFn.call(this, item);
4069
+ return content = templateFn.call(this, item);
3250
4070
  }
3251
4071
  if ((this.itemRenderer != null) && _.isFunction(this.itemRenderer)) {
3252
- content = this.itemRenderer.call(this, item, item.model, item.index);
4072
+ return content = this.itemRenderer.call(this, item, item.model, item.index);
3253
4073
  }
3254
- if (this.itemProperty) {
3255
- content = item.model.get(this.itemProperty) || item.model[this.itemProperty];
3256
- if (_.isFunction(content)) content = content();
4074
+ if (this.itemProperty && (item.model != null)) {
4075
+ return content = item.model.read(this.itemProperty);
3257
4076
  }
3258
- return content;
4077
+ return "";
3259
4078
  },
3260
4079
  makeItem: function(model, index) {
3261
- var item;
4080
+ var attributes, content, item;
3262
4081
  item = this.prepareItem != null ? this.prepareItem.call(this, model, index) : {
3263
4082
  model: model,
3264
4083
  index: index
3265
4084
  };
3266
- return make(this.itemTagName, this.attributesForItem(item, model), this.contentForItem(item));
4085
+ attributes = this.attributesForItem(item, model);
4086
+ content = this.contentForItem(item);
4087
+ try {
4088
+ return make(this.itemTagName, attributes, content);
4089
+ } catch (e) {
4090
+ return console.log("Error generating DOM element for CollectionView", this, model, index);
4091
+ }
4092
+ },
4093
+ getCollection: function() {
4094
+ return this.collection;
4095
+ },
4096
+ applyQuery: function(query, queryOptions) {
4097
+ if (query == null) query = {};
4098
+ if (queryOptions == null) queryOptions = {};
4099
+ this.query = query;
4100
+ this.queryOptions = queryOptions;
4101
+ this.refresh();
4102
+ return this;
4103
+ },
4104
+ getQuery: function() {
4105
+ var query, querySource, _i, _len, _ref;
4106
+ query = this.query || (this.query = {});
4107
+ _ref = _(this.querySources || []).compact();
4108
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
4109
+ querySource = _ref[_i];
4110
+ query = _.extend(query, querySource() || {});
4111
+ }
4112
+ return query;
4113
+ },
4114
+ getQueryOptions: function() {
4115
+ var optionSource, options, _i, _len, _ref;
4116
+ options = this.queryOptions || (this.queryOptions = {});
4117
+ _ref = _(this.optionsSources || []).compact();
4118
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
4119
+ optionSource = _ref[_i];
4120
+ options = _.extend(options, optionSource() || {});
4121
+ }
4122
+ return options;
3267
4123
  },
3268
- getModels: function() {
4124
+ getModels: function(query, options) {
3269
4125
  var _ref;
3270
- if (((_ref = this.collection) != null ? _ref.query : void 0) && (this.filter || this.filterOptions)) {
3271
- return this.collection.query(this.filter, this.filterOptions);
4126
+ if ((_ref = this.collection) != null ? _ref.query : void 0) {
4127
+ query || (query = this.getQuery());
4128
+ options || (options = this.getQueryOptions());
4129
+ return this.collection.query(query, options);
3272
4130
  } else {
3273
4131
  return this.collection.models;
3274
4132
  }
@@ -3279,18 +4137,27 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3279
4137
  refreshModel: function(model) {
3280
4138
  var index;
3281
4139
  index = this.collection.indexOf(model);
3282
- return this.locateItemElement(model.get('id')).empty().append(this.contentForItem({
4140
+ this.locateItemElement(model.get('id')).empty().append(this.contentForItem({
3283
4141
  model: model,
3284
4142
  index: index
3285
4143
  }, model));
4144
+ return this.trigger("model:refreshed", index, model);
3286
4145
  },
3287
- refresh: function() {
3288
- var _this = this;
4146
+ refresh: function(query, options, models) {
4147
+ var index, model, _i, _len;
4148
+ query || (query = this.getQuery());
4149
+ options || (options = this.getQueryOptions());
4150
+ models || (models = this.getModels(query, options));
3289
4151
  this.$bodyEl().empty();
3290
- if (this.getModels().length === 0) this.trigger("empty:results");
3291
- return _(this.getModels()).each(function(model, index) {
3292
- return _this.$append(_this.makeItem(model, index));
3293
- });
4152
+ this.trigger("before:refresh", models, query, options);
4153
+ if (models.length === 0) this.trigger("empty:results");
4154
+ index = 0;
4155
+ for (_i = 0, _len = models.length; _i < _len; _i++) {
4156
+ model = models[_i];
4157
+ this.$append(this.makeItem(model, index++));
4158
+ }
4159
+ this.trigger("after:refresh", models, query, options);
4160
+ return this;
3294
4161
  },
3295
4162
  registerEvent: function(domEvent, selector, handler) {
3296
4163
  var eventTrigger;
@@ -3310,13 +4177,6 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3310
4177
 
3311
4178
  make = Luca.View.prototype.make;
3312
4179
 
3313
- setupChangeObserver = function() {
3314
- var _this = this;
3315
- return this.collection.on("change", function(model) {
3316
- return _this.refreshModel(model);
3317
- });
3318
- };
3319
-
3320
4180
  }).call(this);
3321
4181
  (function() {
3322
4182
 
@@ -3583,10 +4443,10 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3583
4443
  return this.label || (this.label = this.name);
3584
4444
  },
3585
4445
  setValue: function(checked) {
3586
- return this.input.attr('checked', checked);
4446
+ return this.getInputElement().attr('checked', checked);
3587
4447
  },
3588
4448
  getValue: function() {
3589
- return this.input.is(":checked");
4449
+ return this.getInputElement().is(":checked");
3590
4450
  }
3591
4451
  });
3592
4452
 
@@ -3595,10 +4455,6 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3595
4455
 
3596
4456
  _.def('Luca.fields.FileUploadField')["extends"]('Luca.core.Field')["with"]({
3597
4457
  template: 'fields/file_upload_field',
3598
- initialize: function(options) {
3599
- this.options = options != null ? options : {};
3600
- return Luca.core.Field.prototype.initialize.apply(this, arguments);
3601
- },
3602
4458
  afterInitialize: function() {
3603
4459
  this.input_id || (this.input_id = _.uniqueId('field'));
3604
4460
  this.input_name || (this.input_name = this.name);
@@ -3612,10 +4468,6 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3612
4468
 
3613
4469
  _.def('Luca.fields.HiddenField')["extends"]('Luca.core.Field')["with"]({
3614
4470
  template: 'fields/hidden_field',
3615
- initialize: function(options) {
3616
- this.options = options != null ? options : {};
3617
- return Luca.core.Field.prototype.initialize.apply(this, arguments);
3618
- },
3619
4471
  afterInitialize: function() {
3620
4472
  this.input_id || (this.input_id = _.uniqueId('field'));
3621
4473
  this.input_name || (this.input_name = this.name);
@@ -3629,16 +4481,13 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3629
4481
 
3630
4482
  _.def("Luca.components.LabelField")["extends"]("Luca.core.Field")["with"]({
3631
4483
  className: "luca-ui-field luca-ui-label-field",
3632
- getValue: function() {
3633
- return this.$('input').attr('value');
3634
- },
3635
4484
  formatter: function(value) {
3636
4485
  value || (value = this.getValue());
3637
4486
  return _.str.titleize(value);
3638
4487
  },
3639
4488
  setValue: function(value) {
3640
4489
  this.trigger("change", value, this.getValue());
3641
- this.$('input').attr('value', value);
4490
+ this.getInputElement().attr('value', value);
3642
4491
  return this.$('.value').html(this.formatter(value));
3643
4492
  }
3644
4493
  });
@@ -3693,9 +4542,11 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3693
4542
  return hash;
3694
4543
  });
3695
4544
  },
4545
+ getInputElement: function() {
4546
+ return this.input || (this.input = this.$('select').eq(0));
4547
+ },
3696
4548
  afterRender: function() {
3697
4549
  var _ref, _ref2;
3698
- this.input = $('select', this.el);
3699
4550
  if (((_ref = this.collection) != null ? (_ref2 = _ref.models) != null ? _ref2.length : void 0 : void 0) > 0) {
3700
4551
  return this.populateOptions();
3701
4552
  } else {
@@ -3713,9 +4564,9 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3713
4564
  return this.trigger("on:change", this, e);
3714
4565
  },
3715
4566
  resetOptions: function() {
3716
- this.input.html('');
4567
+ this.getInputElement().html('');
3717
4568
  if (this.includeBlank) {
3718
- return this.input.append("<option value='" + this.blankValue + "'>" + this.blankText + "</option>");
4569
+ return this.getInputElement().append("<option value='" + this.blankValue + "'>" + this.blankText + "</option>");
3719
4570
  }
3720
4571
  },
3721
4572
  populateOptions: function() {
@@ -3729,7 +4580,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3729
4580
  display = model.get(_this.displayField);
3730
4581
  if (_this.selected && value === _this.selected) selected = "selected";
3731
4582
  option = "<option " + selected + " value='" + value + "'>" + display + "</option>";
3732
- return _this.input.append(option);
4583
+ return _this.getInputElement().append(option);
3733
4584
  });
3734
4585
  }
3735
4586
  this.trigger("after:populate:options", this);
@@ -3757,6 +4608,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3757
4608
  this.input_name || (this.input_name = this.name);
3758
4609
  this.label || (this.label = this.name);
3759
4610
  this.input_class || (this.input_class = this["class"]);
4611
+ this.input_value || (this.input_value = "");
3760
4612
  return this.inputStyles || (this.inputStyles = "height:" + this.height + ";width:" + this.width);
3761
4613
  },
3762
4614
  setValue: function(value) {
@@ -3802,6 +4654,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3802
4654
  this.input_name || (this.input_name = this.name);
3803
4655
  this.label || (this.label = this.name);
3804
4656
  this.input_class || (this.input_class = this["class"]);
4657
+ this.input_value || (this.input_value = this.value || "");
3805
4658
  if (this.prepend) {
3806
4659
  this.$el.addClass('input-prepend');
3807
4660
  this.addOn = this.prepend;
@@ -3832,19 +4685,18 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3832
4685
  _.def('Luca.fields.TypeAheadField')["extends"]('Luca.fields.TextField')["with"]({
3833
4686
  className: 'luca-ui-field',
3834
4687
  getSource: function() {
3835
- if (_.isFunction(this.source)) return this.source.call(this);
3836
- return this.source || [];
4688
+ return Luca.util.read(this.source) || [];
3837
4689
  },
3838
4690
  matcher: function(item) {
3839
4691
  return true;
3840
4692
  },
3841
4693
  beforeRender: function() {
3842
- this._super("beforeRender", this, arguments);
3843
- return this.$('input').attr('data-provide', 'typeahead');
4694
+ Luca.fields.TextField.prototype.beforeRender.apply(this, arguments);
4695
+ return this.getInputElement().attr('data-provide', 'typeahead');
3844
4696
  },
3845
4697
  afterRender: function() {
3846
- this._super("afterRender", this, arguments);
3847
- return this.$('input').typeahead({
4698
+ Luca.fields.TextField.prototype.afterRender.apply(this, arguments);
4699
+ return this.getInputElement().typeahead({
3848
4700
  matcher: this.matcher,
3849
4701
  source: this.getSource()
3850
4702
  });
@@ -3883,27 +4735,6 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3883
4735
 
3884
4736
  }).call(this);
3885
4737
  (function() {
3886
- var defaultToolbar;
3887
-
3888
- defaultToolbar = {
3889
- buttons: [
3890
- {
3891
- icon: "remove-sign",
3892
- label: "Reset",
3893
- eventId: "click:reset",
3894
- className: "reset-button",
3895
- align: 'right'
3896
- }, {
3897
- icon: "ok-sign",
3898
- white: true,
3899
- label: "Save Changes",
3900
- eventId: "click:submit",
3901
- color: "success",
3902
- className: 'submit-button',
3903
- align: 'right'
3904
- }
3905
- ]
3906
- };
3907
4738
 
3908
4739
  _.def("Luca.components.FormView")["extends"]('Luca.core.Container')["with"]({
3909
4740
  tagName: 'form',
@@ -3921,6 +4752,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3921
4752
  this.options = options != null ? options : {};
3922
4753
  if (this.loadMask == null) this.loadMask = Luca.enableBootstrap;
3923
4754
  Luca.core.Container.prototype.initialize.apply(this, arguments);
4755
+ this.components || (this.components = this.fields);
3924
4756
  _.bindAll(this, "submitHandler", "resetHandler", "renderToolbars", "applyLoadMask");
3925
4757
  this.state || (this.state = new Backbone.Model);
3926
4758
  this.setupHooks(this.hooks);
@@ -3935,7 +4767,7 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
3935
4767
  }
3936
4768
  },
3937
4769
  getDefaultToolbar: function() {
3938
- return defaultToolbar;
4770
+ return Luca.components.FormView.defaultFormViewToolbar;
3939
4771
  },
3940
4772
  applyStyleClasses: function() {
3941
4773
  if (Luca.enableBootstrap) this.applyBootstrapStyleClasses();
@@ -4149,6 +4981,26 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
4149
4981
  }
4150
4982
  });
4151
4983
 
4984
+ Luca.components.FormView.defaultFormViewToolbar = {
4985
+ buttons: [
4986
+ {
4987
+ icon: "remove-sign",
4988
+ label: "Reset",
4989
+ eventId: "click:reset",
4990
+ className: "reset-button",
4991
+ align: 'right'
4992
+ }, {
4993
+ icon: "ok-sign",
4994
+ white: true,
4995
+ label: "Save Changes",
4996
+ eventId: "click:submit",
4997
+ color: "success",
4998
+ className: 'submit-button',
4999
+ align: 'right'
5000
+ }
5001
+ ]
5002
+ };
5003
+
4152
5004
  }).call(this);
4153
5005
  (function() {
4154
5006
 
@@ -4399,6 +5251,115 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
4399
5251
  bodyTemplate: "components/load_mask"
4400
5252
  });
4401
5253
 
5254
+ }).call(this);
5255
+ (function() {
5256
+ var multiView, propagateCollectionComponents, validateComponent;
5257
+
5258
+ multiView = Luca.define("Luca.components.MultiCollectionView");
5259
+
5260
+ multiView["extends"]("Luca.containers.CardView");
5261
+
5262
+ multiView.behavesAs("LoadMaskable", "Filterable", "Paginatable");
5263
+
5264
+ multiView.triggers("before:refresh", "after:refresh", "refresh", "empty:results");
5265
+
5266
+ multiView.defaultsTo({
5267
+ version: 1,
5268
+ stateful: true,
5269
+ defaultState: {
5270
+ activeView: 0
5271
+ },
5272
+ viewContainerClass: "luca-ui-multi-view-container",
5273
+ initialize: function(options) {
5274
+ var view, _i, _len, _ref;
5275
+ this.options = options != null ? options : {};
5276
+ this.components || (this.components = this.views);
5277
+ _ref = this.components;
5278
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
5279
+ view = _ref[_i];
5280
+ validateComponent(view);
5281
+ }
5282
+ this.on("refresh", this.refresh, this);
5283
+ this.on("after:card:switch", this.refresh, this);
5284
+ this.on("after:components", propagateCollectionComponents, this);
5285
+ this.debug("multi collection , proto initialize");
5286
+ return Luca.containers.CardView.prototype.initialize.apply(this, arguments);
5287
+ },
5288
+ relayAfterRefresh: function(models, query, options) {
5289
+ return this.trigger("after:refresh", models, query, options);
5290
+ },
5291
+ refresh: function() {
5292
+ var _ref;
5293
+ return (_ref = this.activeComponent()) != null ? _ref.trigger("refresh") : void 0;
5294
+ },
5295
+ getCollection: function() {
5296
+ return this.collection;
5297
+ },
5298
+ applyQuery: function(query, queryOptions) {
5299
+ if (query == null) query = {};
5300
+ if (queryOptions == null) queryOptions = {};
5301
+ this.query = query;
5302
+ this.queryOptions = queryOptions;
5303
+ return this;
5304
+ },
5305
+ getQuery: function() {
5306
+ var query, querySource, _i, _len, _ref;
5307
+ this.debug("Get Query");
5308
+ query = this.query || (this.query = {});
5309
+ _ref = this.querySources;
5310
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
5311
+ querySource = _ref[_i];
5312
+ query = _.extend(query, querySource() || {});
5313
+ }
5314
+ return query;
5315
+ },
5316
+ getQueryOptions: function() {
5317
+ var optionSource, options, _i, _len, _ref;
5318
+ this.debug("Get Query Options");
5319
+ options = this.queryOptions || (this.queryOptions = {});
5320
+ _ref = this.optionsSources;
5321
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
5322
+ optionSource = _ref[_i];
5323
+ options = _.extend(options, optionSource() || {});
5324
+ }
5325
+ return options;
5326
+ }
5327
+ });
5328
+
5329
+ propagateCollectionComponents = function() {
5330
+ var component, container, _i, _len, _ref, _results,
5331
+ _this = this;
5332
+ container = this;
5333
+ _ref = this.components;
5334
+ _results = [];
5335
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
5336
+ component = _ref[_i];
5337
+ component.on("after:refresh", function(models, query, options) {
5338
+ _this.debug("collection member after refresh");
5339
+ return _this.trigger("after:refresh", models, query, options);
5340
+ });
5341
+ _results.push(_.extend(component, {
5342
+ collection: container.getCollection(),
5343
+ getQuery: function() {
5344
+ return container.getQuery.call(container);
5345
+ },
5346
+ getQueryOptions: function() {
5347
+ return container.getQueryOptions.call(container);
5348
+ }
5349
+ }));
5350
+ }
5351
+ return _results;
5352
+ };
5353
+
5354
+ validateComponent = function(component) {
5355
+ var type;
5356
+ type = component.type || component.ctype;
5357
+ if (type === "collection" || type === "collection_view" || type === "table" || type === "table_view") {
5358
+ return;
5359
+ }
5360
+ throw "The MultiCollectionView expects to contain multiple collection views";
5361
+ };
5362
+
4402
5363
  }).call(this);
4403
5364
  (function() {
4404
5365
 
@@ -4433,6 +5394,129 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
4433
5394
  version: 2
4434
5395
  });
4435
5396
 
5397
+ }).call(this);
5398
+ (function() {
5399
+ var paginationControl;
5400
+
5401
+ paginationControl = Luca.register("Luca.components.PaginationControl");
5402
+
5403
+ paginationControl["extends"]("Luca.View");
5404
+
5405
+ paginationControl.defines({
5406
+ template: "components/pagination",
5407
+ stateful: true,
5408
+ autoBindEventHandlers: true,
5409
+ events: {
5410
+ "click a[data-page-number]": "selectPage",
5411
+ "click a.next": "nextPage",
5412
+ "click a.prev": "previousPage"
5413
+ },
5414
+ afterInitialize: function() {
5415
+ var _this = this;
5416
+ _.bindAll(this, "updateWithPageCount");
5417
+ return this.state.on("change", function(state, numberOfPages) {
5418
+ return _this.updateWithPageCount(state.get('numberOfPages'));
5419
+ });
5420
+ },
5421
+ limit: function() {
5422
+ var _ref;
5423
+ return parseInt(this.state.get('limit') || ((_ref = this.collection) != null ? _ref.length : void 0));
5424
+ },
5425
+ page: function() {
5426
+ return parseInt(this.state.get('page') || 1);
5427
+ },
5428
+ nextPage: function() {
5429
+ if (!this.nextEnabled()) return;
5430
+ return this.state.set('page', this.page() + 1);
5431
+ },
5432
+ previousPage: function() {
5433
+ if (!this.previousEnabled()) return;
5434
+ return this.state.set('page', this.page() - 1);
5435
+ },
5436
+ selectPage: function(e) {
5437
+ var me, my;
5438
+ me = my = this.$(e.target);
5439
+ if (!me.is('a.page')) me = my = my.closest('a.page');
5440
+ my.siblings().removeClass('is-selected');
5441
+ me.addClass('is-selected');
5442
+ return this.setPage(my.data('page-number'));
5443
+ },
5444
+ setPage: function(page, options) {
5445
+ if (page == null) page = 1;
5446
+ if (options == null) options = {};
5447
+ return this.state.set('page', page, options);
5448
+ },
5449
+ setLimit: function(limit, options) {
5450
+ if (limit == null) limit = 1;
5451
+ if (options == null) options = {};
5452
+ return this.state.set('limit', limit, options);
5453
+ },
5454
+ pageButtonContainer: function() {
5455
+ return this.$('.group');
5456
+ },
5457
+ previousEnabled: function() {
5458
+ return this.page() > 1;
5459
+ },
5460
+ nextEnabled: function() {
5461
+ return this.page() < this.totalPages();
5462
+ },
5463
+ previousButton: function() {
5464
+ return this.$('a.page.prev');
5465
+ },
5466
+ nextButton: function() {
5467
+ return this.$('a.page.next');
5468
+ },
5469
+ pageButtons: function() {
5470
+ return this.$('a[data-page-number]', this.pageButtonContainer());
5471
+ },
5472
+ updateWithPageCount: function(pageCount, models) {
5473
+ var modelCount,
5474
+ _this = this;
5475
+ this.pageCount = pageCount;
5476
+ if (models == null) models = [];
5477
+ modelCount = models.length;
5478
+ console.log("Update With Page Count", this.pageCount, modelCount);
5479
+ this.pageButtonContainer().empty();
5480
+ _(this.pageCount).times(function(index) {
5481
+ var button, page;
5482
+ page = index + 1;
5483
+ button = _this.make("a", {
5484
+ "data-page-number": page,
5485
+ "class": "page"
5486
+ }, page);
5487
+ return _this.pageButtonContainer().append(button);
5488
+ });
5489
+ this.toggleNavigationButtons();
5490
+ this.selectActivePageButton();
5491
+ return this;
5492
+ },
5493
+ toggleNavigationButtons: function() {
5494
+ this.$('a.next, a.prev').addClass('disabled');
5495
+ if (this.nextEnabled()) this.nextButton().removeClass('disabled');
5496
+ if (this.previousEnabled()) {
5497
+ return this.previousButton().removeClass('disabled');
5498
+ }
5499
+ },
5500
+ selectActivePageButton: function() {
5501
+ return this.activePageButton().addClass('is-selected');
5502
+ },
5503
+ activePageButton: function() {
5504
+ return this.pageButtons().filter("[data-page-number='" + (this.page()) + "']");
5505
+ },
5506
+ totalPages: function() {
5507
+ return this.pageCount;
5508
+ },
5509
+ totalItems: function() {
5510
+ var _ref;
5511
+ return parseInt(((_ref = this.collection) != null ? _ref.length : void 0) || 0);
5512
+ },
5513
+ itemsPerPage: function(value, options) {
5514
+ if (options == null) options = {};
5515
+ if (value != null) this.state.set("limit", value, options);
5516
+ return parseInt(this.state.get("limit"));
5517
+ }
5518
+ });
5519
+
4436
5520
  }).call(this);
4437
5521
  (function() {
4438
5522
 
@@ -4694,17 +5778,32 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
4694
5778
  itemRenderer: function(item, model) {
4695
5779
  return Luca.components.TableView.rowRenderer.call(this, item, model);
4696
5780
  },
4697
- emptyResults: function() {
4698
- return this.$('tbody').append("<tr><td colspan=" + this.columns.length + ">" + this.emptyText + "</td></tr>");
4699
- },
4700
5781
  initialize: function(options) {
4701
- var _this = this;
5782
+ var column,
5783
+ _this = this;
4702
5784
  this.options = options != null ? options : {};
4703
5785
  Luca.components.CollectionView.prototype.initialize.apply(this, arguments);
5786
+ this.columns = (function() {
5787
+ var _i, _len, _ref, _results;
5788
+ _ref = this.columns;
5789
+ _results = [];
5790
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
5791
+ column = _ref[_i];
5792
+ if (_.isString(column)) {
5793
+ column = {
5794
+ reader: column
5795
+ };
5796
+ }
5797
+ if (!(column.header != null)) {
5798
+ column.header = _.str.titleize(_.str.humanize(column.reader));
5799
+ }
5800
+ _results.push(column);
5801
+ }
5802
+ return _results;
5803
+ }).call(this);
4704
5804
  return this.defer(function() {
4705
- Luca.components.TableView.renderHeader.call(_this, _this.columns, _this.$('thead'));
4706
- return _this.$el.removeClass('row-fluid');
4707
- }).until("before:render");
5805
+ return Luca.components.TableView.renderHeader.call(_this, _this.columns, _this.$('thead'));
5806
+ }).until("after:render");
4708
5807
  }
4709
5808
  });
4710
5809
 
@@ -4718,29 +5817,30 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
4718
5817
  _results = [];
4719
5818
  for (_i = 0, _len = columns.length; _i < _len; _i++) {
4720
5819
  column = columns[_i];
4721
- _results.push("<th data-col-index='" + index + "'>" + column.header + "</th>");
5820
+ _results.push("<th data-col-index='" + (index++) + "'>" + column.header + "</th>");
4722
5821
  }
4723
5822
  return _results;
4724
5823
  })();
4725
- $(targetElement).append(make("tr", {}, content));
5824
+ this.$(targetElement).append("<tr>" + (content.join('')) + "</tr>");
4726
5825
  index = 0;
4727
5826
  _results = [];
4728
5827
  for (_i = 0, _len = columns.length; _i < _len; _i++) {
4729
5828
  column = columns[_i];
4730
5829
  if (column.width != null) {
4731
- _results.push(this.$("th[data-col-index='" + index + "']", targetElement).css('width', column.width));
5830
+ _results.push(this.$("th[data-col-index='" + (index++) + "']", targetElement).css('width', column.width));
4732
5831
  }
4733
5832
  }
4734
5833
  return _results;
4735
5834
  };
4736
5835
 
4737
5836
  Luca.components.TableView.rowRenderer = function(item, model, index) {
4738
- var columnConfig, _i, _len, _ref, _results;
5837
+ var colIndex, columnConfig, _i, _len, _ref, _results;
5838
+ colIndex = 0;
4739
5839
  _ref = this.columns;
4740
5840
  _results = [];
4741
5841
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
4742
5842
  columnConfig = _ref[_i];
4743
- _results.push(Luca.components.TableView.renderColumn.call(this, columnConfig, item, model, index));
5843
+ _results.push(Luca.components.TableView.renderColumn.call(this, columnConfig, item, model, colIndex++));
4744
5844
  }
4745
5845
  return _results;
4746
5846
  };
@@ -4748,7 +5848,12 @@ null:f.isFunction(a[b])?a[b]():a[b]},o=function(){throw Error('A "url" property
4748
5848
  Luca.components.TableView.renderColumn = function(column, item, model, index) {
4749
5849
  var cellValue;
4750
5850
  cellValue = model.read(column.reader);
4751
- return make("td", {}, cellValue);
5851
+ if (_.isFunction(column.renderer)) {
5852
+ cellValue = column.renderer.call(this, cellValue, model, column);
5853
+ }
5854
+ return make("td", {
5855
+ "data-col-index": index
5856
+ }, cellValue);
4752
5857
  };
4753
5858
 
4754
5859
  }).call(this);