From f25052fd4c8bf85ef11f776fe899268daccfdca6 Mon Sep 17 00:00:00 2001 From: "Mark Aherne (Faerdan)" Date: Mon, 6 Jan 2014 02:49:25 +0000 Subject: [PATCH] NanoUI updates. * Simplified the code used in ui_interact procs and updated all current uses. * Removed ununused jsviews JavaScript code (replaced it with vanilla jsrender). * Added a message to the UI which shows if JavaScript is disabled (people with JavaScript disabled previously got blank UIs). --- code/game/dna/dna_modifier.dm | 24 +- code/game/machinery/cryo.dm | 23 +- code/game/objects/items/devices/PDA/PDA.dm | 43 +- code/game/objects/items/devices/uplinks.dm | 19 +- code/modules/nano/nanomanager.dm | 25 +- code/modules/nano/nanoui.dm | 1 + code/modules/reagents/Chemistry-Machinery.dm | 27 +- .../machinery/geosample_scanner.dm | 21 +- nano/css/shared.css | 12 +- nano/js/libraries.min.js | 2 +- nano/js/libraries/2-jsrender.js | 1520 ++++++ nano/js/libraries/2-jsviews.js | 4666 ----------------- 12 files changed, 1620 insertions(+), 4763 deletions(-) create mode 100644 nano/js/libraries/2-jsrender.js delete mode 100644 nano/js/libraries/2-jsviews.js diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm index 6be58f811d..6b91a6c491 100644 --- a/code/game/dna/dna_modifier.dm +++ b/code/game/dna/dna_modifier.dm @@ -365,7 +365,7 @@ /** * The ui_interact proc is used to open and update Nano UIs * If ui_interact is not used then the UI will not update correctly - * ui_interact is currently defined for /atom/movable + * ui_interact is currently defined for /atom/movable (which is inherited by /obj and /mob) * * @param user /mob The mob who is interacting with this ui * @param ui_key string A string key to use for this ui. Allows for multiple unique uis on one obj/mob (defaut value "main") @@ -451,23 +451,19 @@ if (connected.beaker.reagents && connected.beaker.reagents.reagent_list.len) for(var/datum/reagent/R in connected.beaker.reagents.reagent_list) data["beakerVolume"] += R.volume - - if (!ui) // no ui has been passed, so we'll search for one - { - ui = nanomanager.get_open_ui(user, src, ui_key) - } + + // update the ui if it exists, returns null if no ui is passed/found + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) if (!ui) - // the ui does not exist, so we'll create a new one + // the ui does not exist, so we'll create a new() one + // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm ui = new(user, src, ui_key, "dna_modifier.tmpl", "DNA Modifier Console", 660, 700) - // When the UI is first opened this is the data it will use - ui.set_initial_data(data) + // when the ui is first opened this is the data it will use + ui.set_initial_data(data) + // open the new ui window ui.open() - // Auto update every Master Controller tick + // auto update every Master Controller tick ui.set_auto_update(1) - else - // The UI is already open so push the new data to it - ui.push_data(data) - return /obj/machinery/computer/scan_consolenew/Topic(href, href_list) if(..()) diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index e3f34200ca..b909404a1c 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -65,7 +65,7 @@ /** * The ui_interact proc is used to open and update Nano UIs * If ui_interact is not used then the UI will not update correctly - * ui_interact is currently defined for /atom/movable + * ui_interact is currently defined for /atom/movable (which is inherited by /obj and /mob) * * @param user /mob The mob who is interacting with this ui * @param ui_key string A string key to use for this ui. Allows for multiple unique uis on one obj/mob (defaut value "main") @@ -120,23 +120,18 @@ for(var/datum/reagent/R in beaker.reagents.reagent_list) data["beakerVolume"] += R.volume - if (!ui) // no ui has been passed, so we'll search for one - { - ui = nanomanager.get_open_ui(user, src, ui_key) - } + // update the ui if it exists, returns null if no ui is passed/found + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) if (!ui) - // the ui does not exist, so we'll create a new one + // the ui does not exist, so we'll create a new() one + // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm ui = new(user, src, ui_key, "cryo.tmpl", "Cryo Cell Control System", 520, 410) - // When the UI is first opened this is the data it will use - ui.set_initial_data(data) + // when the ui is first opened this is the data it will use + ui.set_initial_data(data) + // open the new ui window ui.open() - // Auto update every Master Controller tick + // auto update every Master Controller tick ui.set_auto_update(1) - else - // The UI is already open so push the new data to it - ui.push_data(data) - return - //user.set_machine(src) /obj/machinery/atmospherics/unary/cryo_cell/Topic(href, href_list) if(usr == occupant) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 668a5d09f3..213702f3c8 100755 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -319,24 +319,9 @@ var/global/list/obj/item/device/pda/PDAs = list() return attack_self(M) return - - - -/* Notes for those wanting to modify this code or even understand it. - There are two modes: New UI and a UI already existing. - If the UI is new, you define your variables, if the ui already exists if it didn't have variables in data for what you want to add - then it won't add it even if you make a data["blahblah"] for it. That's the reason for the = null all over the place, so that. - ui.push_data(data) proc has to have the var structure already setup otherwise it can't push the update. - - The exception to the "YOU HAVE TO DEFINE IT" rule is cartridges, we later force - the ui to close if a cartridge is inserted so that never will be a problem. - So there will never be a time a UI creation causes that to be a problem. -*/ - -/obj/item/device/pda/ui_interact(mob/user, ui_key = "main") +/obj/item/device/pda/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) var/title = "Personal Data Assistant" - var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, ui_key) - + var/data[0] // This is the data that will be sent to the PDA @@ -430,11 +415,11 @@ var/global/list/obj/item/device/pda/PDAs = list() data["convo_name"] = null data["convo_job"] = null - if(!ui || mode==41) + if(mode==41) data["manifest"] = data_core.get_manifest_json() - if(!ui || mode==3) + if(mode==3) var/turf/T = get_turf_or_move(user.loc) if(!isnull(T) || mode!=3) var/datum/gas_mixture/environment = T.return_air() @@ -470,22 +455,18 @@ var/global/list/obj/item/device/pda/PDAs = list() "reading" = 0\ ) - - - + // update the ui if it exists, returns null if no ui is passed/found + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) if (!ui) - // the ui does not exist, so we'll create a new one + // the ui does not exist, so we'll create a new() one + // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm ui = new(user, src, ui_key, "pda.tmpl", title, 630, 600) - // When the UI is first opened this is the data it will use - ui.set_initial_data(data) + // when the ui is first opened this is the data it will use + ui.set_initial_data(data) + // open the new ui window ui.open() + // auto update every Master Controller tick ui.set_auto_update(1) - else - // The UI is already open so push the new data to it - ui.push_data(data) - return - - //NOTE: graphic resources are loaded on client login /obj/item/device/pda/attack_self(mob/user as mob) diff --git a/code/game/objects/items/devices/uplinks.dm b/code/game/objects/items/devices/uplinks.dm index 4e42765238..8f6fd0f632 100644 --- a/code/game/objects/items/devices/uplinks.dm +++ b/code/game/objects/items/devices/uplinks.dm @@ -344,25 +344,24 @@ A list of items and costs is stored under the datum of every game mode, alongsid /* NANO UI FOR UPLINK WOOP WOOP */ -/obj/item/device/uplink/hidden/ui_interact(mob/user, ui_key = "main") +/obj/item/device/uplink/hidden/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) var/title = "Syndicate Uplink" var/data[0] data["crystals"] = uses data["nano_items"] = nanoui_items data["welcome"] = welcome - - var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, ui_key) + + // update the ui if it exists, returns null if no ui is passed/found + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) if (!ui) - // the ui does not exist, so we'll create a new one + // the ui does not exist, so we'll create a new() one + // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm ui = new(user, src, ui_key, "uplink.tmpl", title, 450, 600) - // When the UI is first opened this is the data it will use - ui.set_initial_data(data) + // when the ui is first opened this is the data it will use + ui.set_initial_data(data) + // open the new ui window ui.open() - else - // The UI is already open so push the new data to it - ui.push_data(data) - return // Interaction code. Gathers a list of items purchasable from the paren't uplink and displays it. It also adds a lock button. /obj/item/device/uplink/hidden/interact(mob/user) diff --git a/code/modules/nano/nanomanager.dm b/code/modules/nano/nanomanager.dm index 2e967d6fae..d137b87351 100644 --- a/code/modules/nano/nanomanager.dm +++ b/code/modules/nano/nanomanager.dm @@ -14,6 +14,29 @@ /datum/nanomanager/New() return + /** + * Get an open /nanoui ui for the current user, src_object and ui_key and try to update it with data + * + * @param user /mob The mob who opened/owns the ui + * @param src_object /obj|/mob The obj or mob which the ui belongs to + * @param ui_key string A string key used for the ui + * @param ui /datum/nanoui An existing instance of the ui (can be null) + * @param data list The data to be passed to the ui, if it exists + * + * @return /nanoui Returns the found ui, for null if none exists + */ +/datum/nanomanager/proc/try_update_ui(var/mob/user, src_object, ui_key, var/datum/nanoui/ui, data) + if (!ui) // no ui has been passed, so we'll search for one + { + ui = get_open_ui(user, src, ui_key) + } + if (ui) + // The UI is already open so push the data to it + ui.push_data(data) + return ui + + return null + /** * Get an open /nanoui ui for the current user, src_object and ui_key * @@ -21,7 +44,7 @@ * @param src_object /obj|/mob The obj or mob which the ui belongs to * @param ui_key string A string key used for the ui * - * @return /nanoui Returns the found ui, for null if none exists + * @return /nanoui Returns the found ui, or null if none exists */ /datum/nanomanager/proc/get_open_ui(var/mob/user, src_object, ui_key) var/src_object_key = "\ref[src_object]" diff --git a/code/modules/nano/nanoui.dm b/code/modules/nano/nanoui.dm index d25252a6ab..0a68fcd597 100644 --- a/code/modules/nano/nanoui.dm +++ b/code/modules/nano/nanoui.dm @@ -308,6 +308,7 @@ nanoui is used to open and update nano browser uis
[title ? "
[title]
" : ""]
+ "} /** diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm index 9de1bfe886..776e07e42c 100644 --- a/code/modules/reagents/Chemistry-Machinery.dm +++ b/code/modules/reagents/Chemistry-Machinery.dm @@ -10,7 +10,7 @@ icon_state = "dispenser" use_power = 0 idle_power_usage = 40 - var/ui_name = "Chem Dispenser 5000" + var/ui_title = "Chem Dispenser 5000" var/energy = 100 var/max_energy = 100 var/amount = 30 @@ -104,7 +104,7 @@ * * @return nothing */ -/obj/machinery/chem_dispenser/ui_interact(mob/user, ui_key = "main") +/obj/machinery/chem_dispenser/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) if(stat & (BROKEN|NOPOWER)) return if(user.stat || user.restrained()) return @@ -140,18 +140,17 @@ if(temp) chemicals.Add(list(list("title" = temp.name, "id" = temp.id, "commands" = list("dispense" = temp.id)))) // list in a list because Byond merges the first list... data["chemicals"] = chemicals - - var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, ui_key) + + // update the ui if it exists, returns null if no ui is passed/found + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) if (!ui) - // the ui does not exist, so we'll create a new one - ui = new(user, src, ui_key, "chem_dispenser.tmpl", ui_name, 370, 605) - // When the UI is first opened this is the data it will use - ui.set_initial_data(data) + // the ui does not exist, so we'll create a new() one + // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm + ui = new(user, src, ui_key, "chem_dispenser.tmpl", ui_title, 370, 605) + // when the ui is first opened this is the data it will use + ui.set_initial_data(data) + // open the new ui window ui.open() - else - // The UI is already open so push the new data to it - ui.push_data(data) - return /obj/machinery/chem_dispenser/Topic(href, href_list) if(stat & (NOPOWER|BROKEN)) @@ -225,7 +224,7 @@ icon_state = "soda_dispenser" name = "soda fountain" desc = "A drink fabricating machine, capable of producing many sugary drinks with just one touch." - ui_name = "Soda Dispens-o-matic" + ui_title = "Soda Dispens-o-matic" energy = 100 accept_glass = 1 max_energy = 100 @@ -248,7 +247,7 @@ /obj/machinery/chem_dispenser/beer icon_state = "booze_dispenser" name = "booze dispenser" - ui_name = "Booze Portal 9001" + ui_title = "Booze Portal 9001" energy = 100 accept_glass = 1 max_energy = 100 diff --git a/code/modules/research/xenoarchaeology/machinery/geosample_scanner.dm b/code/modules/research/xenoarchaeology/machinery/geosample_scanner.dm index 6dcd45c825..ab386bd3ae 100644 --- a/code/modules/research/xenoarchaeology/machinery/geosample_scanner.dm +++ b/code/modules/research/xenoarchaeology/machinery/geosample_scanner.dm @@ -114,7 +114,7 @@ if(total_purity && fresh_coolant) coolant_purity = total_purity / fresh_coolant -/obj/machinery/radiocarbon_spectrometer/ui_interact(mob/user, ui_key = "radio_spectro") +/obj/machinery/radiocarbon_spectrometer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null) if(user.stat) return @@ -144,20 +144,19 @@ data["radiation"] = round(radiation) data["t_left_radspike"] = round(t_left_radspike) data["rad_shield_on"] = rad_shield - - var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, ui_key) + + // update the ui if it exists, returns null if no ui is passed/found + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data) if (!ui) - // the ui does not exist, so we'll create a new one + // the ui does not exist, so we'll create a new() one + // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm ui = new(user, src, ui_key, "geoscanner.tmpl", "High Res Radiocarbon Spectrometer", 900, 825) - // When the UI is first opened this is the data it will use - ui.set_initial_data(data) + // when the ui is first opened this is the data it will use + ui.set_initial_data(data) + // open the new ui window ui.open() - // Auto update every Master Controller tick + // auto update every Master Controller tick ui.set_auto_update(1) - else - // The UI is already open so push the new data to it - ui.push_data(data) - return /obj/machinery/radiocarbon_spectrometer/process() if(scanning) diff --git a/nano/css/shared.css b/nano/css/shared.css index 241ec579ab..a2c74ef939 100644 --- a/nano/css/shared.css +++ b/nano/css/shared.css @@ -140,6 +140,16 @@ h4 { clear: both; padding: 8px; } +#uiNoJavaScript { + position: relative; + background: url(uiNoticeBackground.jpg) 50% 50%; + color: #000000; + font-size: 14px; + font-style: italic; + font-weight: bold; + padding: 3px 4px 3px 4px; + margin: 4px 0 4px 0; +} .white { color: white; @@ -167,7 +177,7 @@ h4 { .notice { position: relative; background: url(uiNoticeBackground.jpg) 50% 50%; - color: #15345A; + color: #000000; font-size: 12px; font-style: italic; font-weight: bold; diff --git a/nano/js/libraries.min.js b/nano/js/libraries.min.js index 450e59c9a4..11c9ffb918 100644 --- a/nano/js/libraries.min.js +++ b/nano/js/libraries.min.js @@ -1 +1 @@ -(function(e,t){function H(e){var t=e.length,n=w.type(e);if(w.isWindow(e)){return false}if(e.nodeType===1&&t){return true}return n==="array"||n!=="function"&&(t===0||typeof t==="number"&&t>0&&t-1 in e)}function j(e){var t=B[e]={};w.each(e.match(S)||[],function(e,n){t[n]=true});return t}function q(e,n,r,i){if(!w.acceptData(e)){return}var s,o,u=w.expando,a=e.nodeType,f=a?w.cache:e,l=a?e[u]:e[u]&&u;if((!l||!f[l]||!i&&!f[l].data)&&r===t&&typeof n==="string"){return}if(!l){if(a){l=e[u]=c.pop()||w.guid++}else{l=u}}if(!f[l]){f[l]=a?{}:{toJSON:w.noop}}if(typeof n==="object"||typeof n==="function"){if(i){f[l]=w.extend(f[l],n)}else{f[l].data=w.extend(f[l].data,n)}}o=f[l];if(!i){if(!o.data){o.data={}}o=o.data}if(r!==t){o[w.camelCase(n)]=r}if(typeof n==="string"){s=o[n];if(s==null){s=o[w.camelCase(n)]}}else{s=o}return s}function R(e,t,n){if(!w.acceptData(e)){return}var r,i,s=e.nodeType,o=s?w.cache:e,u=s?e[w.expando]:w.expando;if(!o[u]){return}if(t){r=n?o[u]:o[u].data;if(r){if(!w.isArray(t)){if(t in r){t=[t]}else{t=w.camelCase(t);if(t in r){t=[t]}else{t=t.split(" ")}}}else{t=t.concat(w.map(t,w.camelCase))}i=t.length;while(i--){delete r[t[i]]}if(n?!z(r):!w.isEmptyObject(r)){return}}}if(!n){delete o[u].data;if(!z(o[u])){return}}if(s){w.cleanData([e],true)}else if(w.support.deleteExpando||o!=o.window){delete o[u]}else{o[u]=null}}function U(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(I,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r==="string"){try{r=r==="true"?true:r==="false"?false:r==="null"?null:+r+""===r?+r:F.test(r)?w.parseJSON(r):r}catch(s){}w.data(e,n,r)}else{r=t}}return r}function z(e){var t;for(t in e){if(t==="data"&&w.isEmptyObject(e[t])){continue}if(t!=="toJSON"){return false}}return true}function it(){return true}function st(){return false}function ot(){try{return o.activeElement}catch(e){}}function ct(e,t){do{e=e[t]}while(e&&e.nodeType!==1);return e}function ht(e,t,n){if(w.isFunction(t)){return w.grep(e,function(e,r){return!!t.call(e,r,e)!==n})}if(t.nodeType){return w.grep(e,function(e){return e===t!==n})}if(typeof t==="string"){if(ut.test(t)){return w.filter(t,e,n)}t=w.filter(t,e)}return w.grep(e,function(e){return w.inArray(e,t)>=0!==n})}function pt(e){var t=dt.split("|"),n=e.createDocumentFragment();if(n.createElement){while(t.length){n.createElement(t.pop())}}return n}function Mt(e,t){return w.nodeName(e,"table")&&w.nodeName(t.nodeType===1?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function _t(e){e.type=(w.find.attr(e,"type")!==null)+"/"+e.type;return e}function Dt(e){var t=Ct.exec(e.type);if(t){e.type=t[1]}else{e.removeAttribute("type")}return e}function Pt(e,t){var n,r=0;for(;(n=e[r])!=null;r++){w._data(n,"globalEval",!t||w._data(t[r],"globalEval"))}}function Ht(e,t){if(t.nodeType!==1||!w.hasData(e)){return}var n,r,i,s=w._data(e),o=w._data(t,s),u=s.events;if(u){delete o.handle;o.events={};for(n in u){for(r=0,i=u[n].length;r").css("cssText","display:block !important")).appendTo(t.documentElement);t=(It[0].contentWindow||It[0].contentDocument).document;t.write("");t.close();n=fn(e,t);It.detach()}Qt[e]=n}return n}function fn(e,t){var n=w(t.createElement(e)).appendTo(t.body),r=w.css(n[0],"display");n.remove();return r}function vn(e,t,n,r){var i;if(w.isArray(t)){w.each(t,function(t,i){if(n||cn.test(e)){r(e,i)}else{vn(e+"["+(typeof i==="object"?t:"")+"]",i,n,r)}})}else if(!n&&w.type(t)==="object"){for(i in t){vn(e+"["+i+"]",t[i],n,r)}}else{r(e,t)}}function _n(e){return function(t,n){if(typeof t!=="string"){n=t;t="*"}var r,i=0,s=t.toLowerCase().match(S)||[];if(w.isFunction(n)){while(r=s[i++]){if(r[0]==="+"){r=r.slice(1)||"*";(e[r]=e[r]||[]).unshift(n)}else{(e[r]=e[r]||[]).push(n)}}}}}function Dn(e,t,n,r){function o(u){var a;i[u]=true;w.each(e[u]||[],function(e,u){var f=u(t,n,r);if(typeof f==="string"&&!s&&!i[f]){t.dataTypes.unshift(f);o(f);return false}else if(s){return!(a=f)}});return a}var i={},s=e===An;return o(t.dataTypes[0])||!i["*"]&&o("*")}function Pn(e,n){var r,i,s=w.ajaxSettings.flatOptions||{};for(i in n){if(n[i]!==t){(s[i]?e:r||(r={}))[i]=n[i]}}if(r){w.extend(true,e,r)}return e}function Hn(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes;while(f[0]==="*"){f.shift();if(s===t){s=e.mimeType||n.getResponseHeader("Content-Type")}}if(s){for(u in a){if(a[u]&&a[u].test(s)){f.unshift(u);break}}}if(f[0]in r){o=f[0]}else{for(u in r){if(!f[0]||e.converters[u+" "+f[0]]){o=u;break}if(!i){i=u}}o=o||i}if(o){if(o!==f[0]){f.unshift(o)}return r[o]}}function Bn(e,t,n,r){var i,s,o,u,a,f={},l=e.dataTypes.slice();if(l[1]){for(o in e.converters){f[o.toLowerCase()]=e.converters[o]}}s=l.shift();while(s){if(e.responseFields[s]){n[e.responseFields[s]]=t}if(!a&&r&&e.dataFilter){t=e.dataFilter(t,e.dataType)}a=s;s=l.shift();if(s){if(s==="*"){s=a}else if(a!=="*"&&a!==s){o=f[a+" "+s]||f["* "+s];if(!o){for(i in f){u=i.split(" ");if(u[1]===s){o=f[a+" "+u[0]]||f["* "+u[0]];if(o){if(o===true){o=f[i]}else if(f[i]!==true){s=u[0];l.unshift(u[1])}break}}}}if(o!==true){if(o&&e["throws"]){t=o(t)}else{try{t=o(t)}catch(c){return{state:"parsererror",error:o?c:"No conversion from "+a+" to "+s}}}}}}}return{state:"success",data:t}}function zn(){try{return new e.XMLHttpRequest}catch(t){}}function Wn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function Yn(){setTimeout(function(){Xn=t});return Xn=w.now()}function Zn(e,t,n){var r,i=(Gn[t]||[]).concat(Gn["*"]),s=0,o=i.length;for(;s)[^>]*|#([\w-]*))$/,N=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,C=/^[\],:{}\s]*$/,k=/(?:^|:|,)(?:\s*\[)+/g,L=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,O=/^-ms-/,M=/-([\da-z])/gi,_=function(e,t){return t.toUpperCase()},D=function(e){if(o.addEventListener||e.type==="load"||o.readyState==="complete"){P();w.ready()}},P=function(){if(o.addEventListener){o.removeEventListener("DOMContentLoaded",D,false);e.removeEventListener("load",D,false)}else{o.detachEvent("onreadystatechange",D);e.detachEvent("onload",D)}};w.fn=w.prototype={jquery:h,constructor:w,init:function(e,n,r){var i,s;if(!e){return this}if(typeof e==="string"){if(e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3){i=[null,e,null]}else{i=T.exec(e)}if(i&&(i[1]||!n)){if(i[1]){n=n instanceof w?n[0]:n;w.merge(this,w.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,true));if(N.test(i[1])&&w.isPlainObject(n)){for(i in n){if(w.isFunction(this[i])){this[i](n[i])}else{this.attr(i,n[i])}}}return this}else{s=o.getElementById(i[2]);if(s&&s.parentNode){if(s.id!==i[2]){return r.find(e)}this.length=1;this[0]=s}this.context=o;this.selector=e;return this}}else if(!n||n.jquery){return(n||r).find(e)}else{return this.constructor(n).find(e)}}else if(e.nodeType){this.context=this[0]=e;this.length=1;return this}else if(w.isFunction(e)){return r.ready(e)}if(e.selector!==t){this.selector=e.selector;this.context=e.context}return w.makeArray(e,this)},selector:"",length:0,toArray:function(){return v.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);t.prevObject=this;t.context=this.context;return t},each:function(e,t){return w.each(this,e,t)},ready:function(e){w.ready.promise().done(e);return this},slice:function(){return this.pushStack(v.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n0){return}n.resolveWith(o,[w]);if(w.fn.trigger){w(o).trigger("ready").off("ready")}},isFunction:function(e){return w.type(e)==="function"},isArray:Array.isArray||function(e){return w.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){if(e==null){return String(e)}return typeof e==="object"||typeof e==="function"?l[g.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||w.type(e)!=="object"||e.nodeType||w.isWindow(e)){return false}try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf")){return false}}catch(r){return false}if(w.support.ownLast){for(n in e){return y.call(e,n)}}for(n in e){}return n===t||y.call(e,n)},isEmptyObject:function(e){var t;for(t in e){return false}return true},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){if(!e||typeof e!=="string"){return null}if(typeof t==="boolean"){n=t;t=false}t=t||o;var r=N.exec(e),i=!n&&[];if(r){return[t.createElement(r[1])]}r=w.buildFragment([e],t,i);if(i){w(i).remove()}return w.merge([],r.childNodes)},parseJSON:function(t){if(e.JSON&&e.JSON.parse){return e.JSON.parse(t)}if(t===null){return t}if(typeof t==="string"){t=w.trim(t);if(t){if(C.test(t.replace(L,"@").replace(A,"]").replace(k,""))){return(new Function("return "+t))()}}}w.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!=="string"){return null}try{if(e.DOMParser){i=new DOMParser;r=i.parseFromString(n,"text/xml")}else{r=new ActiveXObject("Microsoft.XMLDOM");r.async="false";r.loadXML(n)}}catch(s){r=t}if(!r||!r.documentElement||r.getElementsByTagName("parsererror").length){w.error("Invalid XML: "+n)}return r},noop:function(){},globalEval:function(t){if(t&&w.trim(t)){(e.execScript||function(t){e["eval"].call(e,t)})(t)}},camelCase:function(e){return e.replace(O,"ms-").replace(M,_)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,s=e.length,o=H(e);if(n){if(o){for(;is.cacheLength){delete t[e.shift()]}return t[n]=r}var e=[];return t}function at(e){e[b]=true;return e}function ft(e){var t=h.createElement("div");try{return!!e(t)}catch(n){return false}finally{if(t.parentNode){t.parentNode.removeChild(t)}t=null}}function lt(e,t){var n=e.split("|"),r=e.length;while(r--){s.attrHandle[n[r]]=t}}function ct(e,t){var n=t&&e,r=n&&e.nodeType===1&&t.nodeType===1&&(~t.sourceIndex||O)-(~e.sourceIndex||O);if(r){return r}if(n){while(n=n.nextSibling){if(n===t){return-1}}}return e?1:-1}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function dt(e){return at(function(t){t=+t;return at(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--){if(n[i=s[o]]){n[i]=!(r[i]=n[i])}}})})}function vt(){}function mt(e,t){var n,r,i,o,u,a,f,l=N[e+" "];if(l){return t?0:l.slice(0)}u=e;a=[];f=s.preFilter;while(u){if(!n||(r=X.exec(u))){if(r){u=u.slice(r[0].length)||u}a.push(i=[])}n=false;if(r=V.exec(u)){n=r.shift();i.push({value:n,type:r[0].replace(W," ")});u=u.slice(n.length)}for(o in s.filter){if((r=G[o].exec(u))&&(!f[o]||(r=f[o](r)))){n=r.shift();i.push({value:n,type:o,matches:r});u=u.slice(n.length)}}if(!n){break}}return t?u.length:u?ot.error(e):N(e,a).slice(0)}function gt(e){var t=0,n=e.length,r="";for(;t1?function(t,n,r){var i=e.length;while(i--){if(!e[i](t,n,r)){return false}}return true}:e[0]}function wt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u-1){s[f]=!(o[f]=c)}}}}else{g=wt(g===o?g.splice(d,g.length):g);if(i){i(null,o,g,a)}else{H.apply(o,g)}}})}function St(e){var t,n,r,i=e.length,o=s.relative[e[0].type],u=o||s.relative[" "],a=o?1:0,l=yt(function(e){return e===t},u,true),c=yt(function(e){return j.call(t,e)>-1},u,true),h=[function(e,n,r){return!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r))}];for(;a1&&bt(h),a>1&>(e.slice(0,a-1).concat({value:e[a-2].type===" "?"*":""})).replace(W,"$1"),n,a0,o=e.length>0,u=function(u,a,l,c,p){var d,v,m,g=[],y=0,b="0",w=u&&[],E=p!=null,x=f,T=u||o&&s.find["TAG"]("*",p&&a.parentNode||a),N=S+=x==null?1:Math.random()||.1;if(E){f=a!==h&&a;i=n}for(;(d=T[b])!=null;b++){if(o&&d){v=0;while(m=e[v++]){if(m(d,a,l)){c.push(d);break}}if(E){S=N;i=++n}}if(r){if(d=!m&&d){y--}if(u){w.push(d)}}}y+=b;if(r&&b!==y){v=0;while(m=t[v++]){m(w,g,a,l)}if(u){if(y>0){while(b--){if(!(w[b]||g[b])){g[b]=D.call(c)}}}g=wt(g)}H.apply(c,g);if(E&&!u&&g.length>0&&y+t.length>1){ot.uniqueSort(c)}}if(E){S=N;f=x}return w};return r?at(u):u}function Tt(e,t,n){var r=0,i=t.length;for(;r2&&(f=u[0]).type==="ID"&&r.getById&&t.nodeType===9&&d&&s.relative[u[1].type]){t=(s.find["ID"](f.matches[0].replace(rt,it),t)||[])[0];if(!t){return n}e=e.slice(u.shift().value.length)}o=G["needsContext"].test(e)?0:u.length;while(o--){f=u[o];if(s.relative[l=f.type]){break}if(c=s.find[l]){if(i=c(f.matches[0].replace(rt,it),$.test(u[0].type)&&t.parentNode||t)){u.splice(o,1);e=i.length&>(u);if(!e){H.apply(n,i);return n}break}}}}}a(e,h)(i,t,!d,n,$.test(e));return n}var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b="sizzle"+ -(new Date),E=e.document,S=0,x=0,T=ut(),N=ut(),C=ut(),k=false,L=function(e,t){if(e===t){k=true;return 0}return 0},A=typeof t,O=1<<31,M={}.hasOwnProperty,_=[],D=_.pop,P=_.push,H=_.push,B=_.slice,j=_.indexOf||function(e){var t=0,n=this.length;for(;t+~]|"+I+")"+I+"*"),$=new RegExp(I+"*[+~]"),J=new RegExp("="+I+"*([^\\]'\"]*)"+I+"*\\]","g"),K=new RegExp(z),Q=new RegExp("^"+R+"$"),G={ID:new RegExp("^#("+q+")"),CLASS:new RegExp("^\\.("+q+")"),TAG:new RegExp("^("+q.replace("w","w*")+")"),ATTR:new RegExp("^"+U),PSEUDO:new RegExp("^"+z),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+I+"*(even|odd|(([+-]|)(\\d*)n|)"+I+"*(?:([+-]|)"+I+"*(\\d+)|))"+I+"*\\)|)","i"),bool:new RegExp("^(?:"+F+")$","i"),needsContext:new RegExp("^"+I+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+I+"*((?:-\\d)?\\d*)"+I+"*\\)|)(?=[^-]|$)","i")},Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=new RegExp("\\\\([\\da-f]{1,6}"+I+"?|("+I+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,r&1023|56320)};try{H.apply(_=B.call(E.childNodes),E.childNodes);_[E.childNodes.length].nodeType}catch(st){H={apply:_.length?function(e,t){P.apply(e,B.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]){}e.length=n-1}}}u=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":false};r=ot.support={};c=ot.setDocument=function(e){var t=e?e.ownerDocument||e:E,n=t.defaultView;if(t===h||t.nodeType!==9||!t.documentElement){return h}h=t;p=t.documentElement;d=!u(t);if(n&&n.attachEvent&&n!==n.top){n.attachEvent("onbeforeunload",function(){c()})}r.attributes=ft(function(e){e.className="i";return!e.getAttribute("className")});r.getElementsByTagName=ft(function(e){e.appendChild(t.createComment(""));return!e.getElementsByTagName("*").length});r.getElementsByClassName=ft(function(e){e.innerHTML="
";e.firstChild.className="i";return e.getElementsByClassName("i").length===2});r.getById=ft(function(e){p.appendChild(e).id=b;return!t.getElementsByName||!t.getElementsByName(b).length});if(r.getById){s.find["ID"]=function(e,t){if(typeof t.getElementById!==A&&d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}};s.filter["ID"]=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}}else{delete s.find["ID"];s.filter["ID"]=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}}s.find["TAG"]=r.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!==A){return t.getElementsByTagName(e)}}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if(e==="*"){while(n=s[i++]){if(n.nodeType===1){r.push(n)}}return r}return s};s.find["CLASS"]=r.getElementsByClassName&&function(e,t){if(typeof t.getElementsByClassName!==A&&d){return t.getElementsByClassName(e)}};m=[];v=[];if(r.qsa=Y.test(t.querySelectorAll)){ft(function(e){e.innerHTML="";if(!e.querySelectorAll("[selected]").length){v.push("\\["+I+"*(?:value|"+F+")")}if(!e.querySelectorAll(":checked").length){v.push(":checked")}});ft(function(e){var n=t.createElement("input");n.setAttribute("type","hidden");e.appendChild(n).setAttribute("t","");if(e.querySelectorAll("[t^='']").length){v.push("[*^$]="+I+"*(?:''|\"\")")}if(!e.querySelectorAll(":enabled").length){v.push(":enabled",":disabled")}e.querySelectorAll("*,:x");v.push(",.*:")})}if(r.matchesSelector=Y.test(g=p.webkitMatchesSelector||p.mozMatchesSelector||p.oMatchesSelector||p.msMatchesSelector)){ft(function(e){r.disconnectedMatch=g.call(e,"div");g.call(e,"[s!='']:x");m.push("!=",z)})}v=v.length&&new RegExp(v.join("|"));m=m.length&&new RegExp(m.join("|"));y=Y.test(p.contains)||p.compareDocumentPosition?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&(n.contains?n.contains(r):e.compareDocumentPosition&&e.compareDocumentPosition(r)&16))}:function(e,t){if(t){while(t=t.parentNode){if(t===e){return true}}}return false};L=p.compareDocumentPosition?function(e,n){if(e===n){k=true;return 0}var i=n.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(n);if(i){if(i&1||!r.sortDetached&&n.compareDocumentPosition(e)===i){if(e===t||y(E,e)){return-1}if(n===t||y(E,n)){return 1}return l?j.call(l,e)-j.call(l,n):0}return i&4?-1:1}return e.compareDocumentPosition?-1:1}:function(e,n){var r,i=0,s=e.parentNode,o=n.parentNode,u=[e],a=[n];if(e===n){k=true;return 0}else if(!s||!o){return e===t?-1:n===t?1:s?-1:o?1:l?j.call(l,e)-j.call(l,n):0}else if(s===o){return ct(e,n)}r=e;while(r=r.parentNode){u.unshift(r)}r=n;while(r=r.parentNode){a.unshift(r)}while(u[i]===a[i]){i++}return i?ct(u[i],a[i]):u[i]===E?-1:a[i]===E?1:0};return t};ot.matches=function(e,t){return ot(e,null,null,t)};ot.matchesSelector=function(e,t){if((e.ownerDocument||e)!==h){c(e)}t=t.replace(J,"='$1']");if(r.matchesSelector&&d&&(!m||!m.test(t))&&(!v||!v.test(t))){try{var n=g.call(e,t);if(n||r.disconnectedMatch||e.document&&e.document.nodeType!==11){return n}}catch(i){}}return ot(t,h,null,[e]).length>0};ot.contains=function(e,t){if((e.ownerDocument||e)!==h){c(e)}return y(e,t)};ot.attr=function(e,n){if((e.ownerDocument||e)!==h){c(e)}var i=s.attrHandle[n.toLowerCase()],o=i&&M.call(s.attrHandle,n.toLowerCase())?i(e,n,!d):t;return o===t?r.attributes||!d?e.getAttribute(n):(o=e.getAttributeNode(n))&&o.specified?o.value:null:o};ot.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};ot.uniqueSort=function(e){var t,n=[],i=0,s=0;k=!r.detectDuplicates;l=!r.sortStable&&e.slice(0);e.sort(L);if(k){while(t=e[s++]){if(t===e[s]){i=n.push(s)}}while(i--){e.splice(n[i],1)}}return e};o=ot.getText=function(e){var t,n="",r=0,i=e.nodeType;if(!i){for(;t=e[r];r++){n+=o(t)}}else if(i===1||i===9||i===11){if(typeof e.textContent==="string"){return e.textContent}else{for(e=e.firstChild;e;e=e.nextSibling){n+=o(e)}}}else if(i===3||i===4){return e.nodeValue}return n};s=ot.selectors={cacheLength:50,createPseudo:at,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){e[1]=e[1].replace(rt,it);e[3]=(e[4]||e[5]||"").replace(rt,it);if(e[2]==="~="){e[3]=" "+e[3]+" "}return e.slice(0,4)},CHILD:function(e){e[1]=e[1].toLowerCase();if(e[1].slice(0,3)==="nth"){if(!e[3]){ot.error(e[0])}e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd"));e[5]=+(e[7]+e[8]||e[3]==="odd")}else if(e[3]){ot.error(e[0])}return e},PSEUDO:function(e){var n,r=!e[5]&&e[2];if(G["CHILD"].test(e[0])){return null}if(e[3]&&e[4]!==t){e[2]=e[4]}else if(r&&K.test(r)&&(n=mt(r,true))&&(n=r.indexOf(")",r.length-n)-r.length)){e[0]=e[0].slice(0,n);e[2]=r.slice(0,n)}return e.slice(0,3)}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return e==="*"?function(){return true}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=new RegExp("(^|"+I+")"+e+"("+I+"|$)"))&&T(e,function(e){return t.test(typeof e.className==="string"&&e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);if(i==null){return t==="!="}if(!t){return true}i+="";return t==="="?i===n:t==="!="?i!==n:t==="^="?n&&i.indexOf(n)===0:t==="*="?n&&i.indexOf(n)>-1:t==="$="?n&&i.slice(-n.length)===n:t==="~="?(" "+i+" ").indexOf(n)>-1:t==="|="?i===n||i.slice(0,n.length+1)===n+"-":false}},CHILD:function(e,t,n,r,i){var s=e.slice(0,3)!=="nth",o=e.slice(-4)!=="last",u=t==="of-type";return r===1&&i===0?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u;if(m){if(s){while(v){c=t;while(c=c[v]){if(u?c.nodeName.toLowerCase()===g:c.nodeType===1){return false}}d=v=e==="only"&&!d&&"nextSibling"}return true}d=[o?m.firstChild:m.lastChild];if(o&&y){l=m[b]||(m[b]={});f=l[e]||[];p=f[0]===S&&f[1];h=f[0]===S&&f[2];c=p&&m.childNodes[p];while(c=++p&&c&&c[v]||(h=p=0)||d.pop()){if(c.nodeType===1&&++h&&c===t){l[e]=[S,p,h];break}}}else if(y&&(f=(t[b]||(t[b]={}))[e])&&f[0]===S){h=f[1]}else{while(c=++p&&c&&c[v]||(h=p=0)||d.pop()){if((u?c.nodeName.toLowerCase()===g:c.nodeType===1)&&++h){if(y){(c[b]||(c[b]={}))[e]=[S,h]}if(c===t){break}}}}h-=i;return h===r||h%r===0&&h/r>=0}}},PSEUDO:function(e,t){var n,r=s.pseudos[e]||s.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);if(r[b]){return r(t)}if(r.length>1){n=[e,e,"",t];return s.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var i,s=r(e,t),o=s.length;while(o--){i=j.call(e,s[o]);e[i]=!(n[i]=s[o])}}):function(e){return r(e,0,n)}}return r}},pseudos:{not:at(function(e){var t=[],n=[],r=a(e.replace(W,"$1"));return r[b]?at(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--){if(s=o[u]){e[u]=!(t[u]=s)}}}):function(e,i,s){t[0]=e;r(t,null,s,n);return!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:at(function(e){if(!Q.test(e||"")){ot.error("unsupported lang: "+e)}e=e.replace(rt,it).toLowerCase();return function(t){var n;do{if(n=d?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang")){n=n.toLowerCase();return n===e||n.indexOf(e+"-")===0}}while((t=t.parentNode)&&t.nodeType===1);return false}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===p},focus:function(e){return e===h.activeElement&&(!h.hasFocus||h.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===false},disabled:function(e){return e.disabled===true},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling){if(e.nodeName>"@"||e.nodeType===3||e.nodeType===4){return false}}return true},parent:function(e){return!s.pseudos["empty"](e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},text:function(e){var t;return e.nodeName.toLowerCase()==="input"&&e.type==="text"&&((t=e.getAttribute("type"))==null||t.toLowerCase()===e.type)},first:dt(function(){return[0]}),last:dt(function(e,t){return[t-1]}),eq:dt(function(e,t,n){return[n<0?n+t:n]}),even:dt(function(e,t){var n=0;for(;n=0;){e.push(r)}return e}),gt:dt(function(e,t,n){var r=n<0?n+t:n;for(;++r";e.firstChild.setAttribute("value","");return e.firstChild.getAttribute("value")===""})){lt("value",function(e,t,n){if(!n&&e.nodeName.toLowerCase()==="input"){return e.defaultValue}})}if(!ft(function(e){return e.getAttribute("disabled")==null})){lt(F,function(e,t,n){var r;if(!n){return(r=e.getAttributeNode(t))&&r.specified?r.value:e[t]===true?t.toLowerCase():null}})}w.find=ot;w.expr=ot.selectors;w.expr[":"]=w.expr.pseudos;w.unique=ot.uniqueSort;w.text=ot.getText;w.isXMLDoc=ot.isXML;w.contains=ot.contains})(e);var B={};w.Callbacks=function(e){e=typeof e==="string"?B[e]||j(e):w.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){r=e.memory&&t;i=true;o=u||0;u=0;s=a.length;n=true;for(;a&&o-1){a.splice(r,1);if(n){if(r<=s){s--}if(r<=o){o--}}}})}return this},has:function(e){return e?w.inArray(e,a)>-1:!!(a&&a.length)},empty:function(){a=[];s=0;return this},disable:function(){a=f=r=t;return this},disabled:function(){return!a},lock:function(){f=t;if(!r){c.disable()}return this},locked:function(){return!f},fireWith:function(e,t){if(a&&(!i||f)){t=t||[];t=[e,t.slice?t.slice():t];if(n){f.push(t)}else{l(t)}}return this},fire:function(){c.fireWith(this,arguments);return this},fired:function(){return!!i}};return c};w.extend({Deferred:function(e){var t=[["resolve","done",w.Callbacks("once memory"),"resolved"],["reject","fail",w.Callbacks("once memory"),"rejected"],["notify","progress",w.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){i.done(arguments).fail(arguments);return this},then:function(){var e=arguments;return w.Deferred(function(n){w.each(t,function(t,s){var o=s[0],u=w.isFunction(e[t])&&e[t];i[s[1]](function(){var e=u&&u.apply(this,arguments);if(e&&w.isFunction(e.promise)){e.promise().done(n.resolve).fail(n.reject).progress(n.notify)}else{n[o+"With"](this===r?n.promise():this,u?[e]:arguments)}})});e=null}).promise()},promise:function(e){return e!=null?w.extend(e,r):r}},i={};r.pipe=r.then;w.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add;if(u){o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock)}i[s[0]]=function(){i[s[0]+"With"](this===i?r:this,arguments);return this};i[s[0]+"With"]=o.fireWith});r.promise(i);if(e){e.call(i,i)}return i},when:function(e){var t=0,n=v.call(arguments),r=n.length,i=r!==1||e&&w.isFunction(e.promise)?r:0,s=i===1?e:w.Deferred(),o=function(e,t,n){return function(r){t[e]=this;n[e]=arguments.length>1?v.call(arguments):r;if(n===u){s.notifyWith(t,n)}else if(!--i){s.resolveWith(t,n)}}},u,a,f;if(r>1){u=new Array(r);a=new Array(r);f=new Array(r);for(;t
a";n=p.getElementsByTagName("*")||[];r=p.getElementsByTagName("a")[0];if(!r||!r.style||!n.length){return t}u=o.createElement("select");f=u.appendChild(o.createElement("option"));s=p.getElementsByTagName("input")[0];r.style.cssText="top:1px;float:left;opacity:.5";t.getSetAttribute=p.className!=="t";t.leadingWhitespace=p.firstChild.nodeType===3;t.tbody=!p.getElementsByTagName("tbody").length;t.htmlSerialize=!!p.getElementsByTagName("link").length;t.style=/top/.test(r.getAttribute("style"));t.hrefNormalized=r.getAttribute("href")==="/a";t.opacity=/^0.5/.test(r.style.opacity);t.cssFloat=!!r.style.cssFloat;t.checkOn=!!s.value;t.optSelected=f.selected;t.enctype=!!o.createElement("form").enctype;t.html5Clone=o.createElement("nav").cloneNode(true).outerHTML!=="<:nav>";t.inlineBlockNeedsLayout=false;t.shrinkWrapBlocks=false;t.pixelPosition=false;t.deleteExpando=true;t.noCloneEvent=true;t.reliableMarginRight=true;t.boxSizingReliable=true;s.checked=true;t.noCloneChecked=s.cloneNode(true).checked;u.disabled=true;t.optDisabled=!f.disabled;try{delete p.test}catch(d){t.deleteExpando=false}s=o.createElement("input");s.setAttribute("value","");t.input=s.getAttribute("value")==="";s.value="t";s.setAttribute("type","radio");t.radioValue=s.value==="t";s.setAttribute("checked","t");s.setAttribute("name","t");a=o.createDocumentFragment();a.appendChild(s);t.appendChecked=s.checked;t.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;if(p.attachEvent){p.attachEvent("onclick",function(){t.noCloneEvent=false});p.cloneNode(true).click()}for(h in{submit:true,change:true,focusin:true}){p.setAttribute(l="on"+h,"t");t[h+"Bubbles"]=l in e||p.attributes[l].expando===false}p.style.backgroundClip="content-box";p.cloneNode(true).style.backgroundClip="";t.clearCloneStyle=p.style.backgroundClip==="content-box";for(h in w(t)){break}t.ownLast=h!=="0";w(function(){var n,r,s,u="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",a=o.getElementsByTagName("body")[0];if(!a){return}n=o.createElement("div");n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";a.appendChild(n).appendChild(p);p.innerHTML="
t
";s=p.getElementsByTagName("td");s[0].style.cssText="padding:0;margin:0;border:0;display:none";c=s[0].offsetHeight===0;s[0].style.display="";s[1].style.display="none";t.reliableHiddenOffsets=c&&s[0].offsetHeight===0;p.innerHTML="";p.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";w.swap(a,a.style.zoom!=null?{zoom:1}:{},function(){t.boxSizing=p.offsetWidth===4});if(e.getComputedStyle){t.pixelPosition=(e.getComputedStyle(p,null)||{}).top!=="1%";t.boxSizingReliable=(e.getComputedStyle(p,null)||{width:"4px"}).width==="4px";r=p.appendChild(o.createElement("div"));r.style.cssText=p.style.cssText=u;r.style.marginRight=r.style.width="0";p.style.width="1px";t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)}if(typeof p.style.zoom!==i){p.innerHTML="";p.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1";t.inlineBlockNeedsLayout=p.offsetWidth===3;p.style.display="block";p.innerHTML="
";p.firstChild.style.width="5px";t.shrinkWrapBlocks=p.offsetWidth!==3;if(t.inlineBlockNeedsLayout){a.style.zoom=1}}a.removeChild(n);n=p=s=r=null});n=u=a=f=r=s=null;return t}({});var F=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;w.extend({cache:{},noData:{applet:true,embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){e=e.nodeType?w.cache[e[w.expando]]:e[w.expando];return!!e&&!z(e)},data:function(e,t,n){return q(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return q(e,t,n,true)},_removeData:function(e,t){return R(e,t,true)},acceptData:function(e){if(e.nodeType&&e.nodeType!==1&&e.nodeType!==9){return false}var t=e.nodeName&&w.noData[e.nodeName.toLowerCase()];return!t||t!==true&&e.getAttribute("classid")===t}});w.fn.extend({data:function(e,n){var r,i,s=null,o=0,u=this[0];if(e===t){if(this.length){s=w.data(u);if(u.nodeType===1&&!w._data(u,"parsedAttrs")){r=u.attributes;for(;o1?this.each(function(){w.data(this,e,n)}):u?U(u,e,w.data(u,e)):null},removeData:function(e){return this.each(function(){w.removeData(this,e)})}});w.extend({queue:function(e,t,n){var r;if(e){t=(t||"fx")+"queue";r=w._data(e,t);if(n){if(!r||w.isArray(n)){r=w._data(e,t,w.makeArray(n))}else{r.push(n)}}return r||[]}},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),s=w._queueHooks(e,t),o=function(){w.dequeue(e,t)};if(i==="inprogress"){i=n.shift();r--}if(i){if(t==="fx"){n.unshift("inprogress")}delete s.stop;i.call(e,o,s)}if(!r&&s){s.empty.fire()}},_queueHooks:function(e,t){var n=t+"queueHooks";return w._data(e,n)||w._data(e,n,{empty:w.Callbacks("once memory").add(function(){w._removeData(e,t+"queue");w._removeData(e,n)})})}});w.fn.extend({queue:function(e,n){var r=2;if(typeof e!=="string"){n=e;e="fx";r--}if(arguments.length1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})},prop:function(e,t){return w.access(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){e=w.propFix[e]||e;return this.each(function(){try{this[e]=t;delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o=0,u=this.length,a=typeof e==="string"&&e;if(w.isFunction(e)){return this.each(function(t){w(this).addClass(e.call(this,t,this.className))})}if(a){t=(e||"").match(S)||[];for(;o=0){r=r.replace(" "+i+" "," ")}}n.className=e?w.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e;if(typeof t==="boolean"&&n==="string"){return t?this.addClass(e):this.removeClass(e)}if(w.isFunction(e)){return this.each(function(n){w(this).toggleClass(e.call(this,n,this.className,t),t)})}return this.each(function(){if(n==="string"){var t,r=0,s=w(this),o=e.match(S)||[];while(t=o[r++]){if(s.hasClass(t)){s.removeClass(t)}else{s.addClass(t)}}}else if(n===i||n==="boolean"){if(this.className){w._data(this,"__className__",this.className)}this.className=this.className||e===false?"":w._data(this,"__className__")||""}})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n=0){return true}}return false},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s){r=w.valHooks[s.type]||w.valHooks[s.nodeName.toLowerCase()];if(r&&"get"in r&&(n=r.get(s,"value"))!==t){return n}n=s.value;return typeof n==="string"?n.replace($,""):n==null?"":n}return}i=w.isFunction(e);return this.each(function(n){var s;if(this.nodeType!==1){return}if(i){s=e.call(this,n,w(this).val())}else{s=e}if(s==null){s=""}else if(typeof s==="number"){s+=""}else if(w.isArray(s)){s=w.map(s,function(e){return e==null?"":e+""})}r=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()];if(!r||!("set"in r)||r.set(this,s,"value")===t){this.value=s}})}});w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return t!=null?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a=0){n=true}}if(!n){e.selectedIndex=-1}return s}}},attr:function(e,n,r){var s,o,u=e.nodeType;if(!e||u===3||u===8||u===2){return}if(typeof e.getAttribute===i){return w.prop(e,n,r)}if(u!==1||!w.isXMLDoc(e)){n=n.toLowerCase();s=w.attrHooks[n]||(w.expr.match.bool.test(n)?X:W)}if(r!==t){if(r===null){w.removeAttr(e,n)}else if(s&&"set"in s&&(o=s.set(e,r,n))!==t){return o}else{e.setAttribute(n,r+"");return r}}else if(s&&"get"in s&&(o=s.get(e,n))!==null){return o}else{o=w.find.attr(e,n);return o==null?t:o}},removeAttr:function(e,t){var n,r,i=0,s=t&&t.match(S);if(s&&e.nodeType===1){while(n=s[i++]){r=w.propFix[n]||n;if(w.expr.match.bool.test(n)){if(Y&&G||!Q.test(n)){e[r]=false}else{e[w.camelCase("default-"+n)]=e[r]=false}}else{w.attr(e,n,"")}e.removeAttribute(G?n:r)}}},attrHooks:{type:{set:function(e,t){if(!w.support.radioValue&&t==="radio"&&w.nodeName(e,"input")){var n=e.value;e.setAttribute("type",t);if(n){e.value=n}return t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2){return}o=u!==1||!w.isXMLDoc(e);if(o){n=w.propFix[n]||n;s=w.propHooks[n]}if(r!==t){return s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r}else{return s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]}},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):J.test(e.nodeName)||K.test(e.nodeName)&&e.href?0:-1}}}});X={set:function(e,t,n){if(t===false){w.removeAttr(e,n)}else if(Y&&G||!Q.test(n)){e.setAttribute(!G&&w.propFix[n]||n,n)}else{e[w.camelCase("default-"+n)]=e[n]=true}return n}};w.each(w.expr.match.bool.source.match(/\w+/g),function(e,n){var r=w.expr.attrHandle[n]||w.find.attr;w.expr.attrHandle[n]=Y&&G||!Q.test(n)?function(e,n,i){var s=w.expr.attrHandle[n],o=i?t:(w.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;w.expr.attrHandle[n]=s;return o}:function(e,n,r){return r?t:e[w.camelCase("default-"+n)]?n.toLowerCase():null}});if(!Y||!G){w.attrHooks.value={set:function(e,t,n){if(w.nodeName(e,"input")){e.defaultValue=t}else{return W&&W.set(e,t,n)}}}}if(!G){W={set:function(e,n,r){var i=e.getAttributeNode(r);if(!i){e.setAttributeNode(i=e.ownerDocument.createAttribute(r))}i.value=n+="";return r==="value"||n===e.getAttribute(r)?n:t}};w.expr.attrHandle.id=w.expr.attrHandle.name=w.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.value!==""?i.value:null};w.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:W.set};w.attrHooks.contenteditable={set:function(e,t,n){W.set(e,t===""?false:t,n)}};w.each(["width","height"],function(e,t){w.attrHooks[t]={set:function(e,n){if(n===""){e.setAttribute(t,"auto");return n}}}})}if(!w.support.hrefNormalized){w.each(["href","src"],function(e,t){w.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})}if(!w.support.style){w.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}}if(!w.support.optSelected){w.propHooks.selected={get:function(e){var t=e.parentNode;if(t){t.selectedIndex;if(t.parentNode){t.parentNode.selectedIndex}}return null}}}w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});if(!w.support.enctype){w.propFix.enctype="encoding"}w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(w.isArray(t)){return e.checked=w.inArray(w(e).val(),t)>=0}}};if(!w.support.checkOn){w.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value}}});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;w.event={global:{},add:function(e,n,r,s,o){var u,a,f,l,c,h,p,d,v,m,g,y=w._data(e);if(!y){return}if(r.handler){l=r;r=l.handler;o=l.selector}if(!r.guid){r.guid=w.guid++}if(!(a=y.events)){a=y.events={}}if(!(h=y.handle)){h=y.handle=function(e){return typeof w!==i&&(!e||w.event.triggered!==e.type)?w.event.dispatch.apply(h.elem,arguments):t};h.elem=e}n=(n||"").match(S)||[""];f=n.length;while(f--){u=rt.exec(n[f])||[];v=g=u[1];m=(u[2]||"").split(".").sort();if(!v){continue}c=w.event.special[v]||{};v=(o?c.delegateType:c.bindType)||v;c=w.event.special[v]||{};p=w.extend({type:v,origType:g,data:s,handler:r,guid:r.guid,selector:o,needsContext:o&&w.expr.match.needsContext.test(o),namespace:m.join(".")},l);if(!(d=a[v])){d=a[v]=[];d.delegateCount=0;if(!c.setup||c.setup.call(e,s,m,h)===false){if(e.addEventListener){e.addEventListener(v,h,false)}else if(e.attachEvent){e.attachEvent("on"+v,h)}}}if(c.add){c.add.call(e,p);if(!p.handler.guid){p.handler.guid=r.guid}}if(o){d.splice(d.delegateCount++,0,p)}else{d.push(p)}w.event.global[v]=true}e=null},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=w.hasData(e)&&w._data(e);if(!m||!(l=m.events)){return}t=(t||"").match(S)||[""];f=t.length;while(f--){u=rt.exec(t[f])||[];p=v=u[1];d=(u[2]||"").split(".").sort();if(!p){for(p in l){w.event.remove(e,p+t[f],n,r,true)}continue}c=w.event.special[p]||{};p=(r?c.delegateType:c.bindType)||p;h=l[p]||[];u=u[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)");a=s=h.length;while(s--){o=h[s];if((i||v===o.origType)&&(!n||n.guid===o.guid)&&(!u||u.test(o.namespace))&&(!r||r===o.selector||r==="**"&&o.selector)){h.splice(s,1);if(o.selector){h.delegateCount--}if(c.remove){c.remove.call(e,o)}}}if(a&&!h.length){if(!c.teardown||c.teardown.call(e,d,m.handle)===false){w.removeEvent(e,p,m.handle)}delete l[p]}}if(w.isEmptyObject(l)){delete m.handle;w._removeData(e,"events")}},trigger:function(n,r,i,s){var u,a,f,l,c,h,p,d=[i||o],v=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];f=h=i=i||o;if(i.nodeType===3||i.nodeType===8){return}if(nt.test(v+w.event.triggered)){return}if(v.indexOf(".")>=0){m=v.split(".");v=m.shift();m.sort()}a=v.indexOf(":")<0&&"on"+v;n=n[w.expando]?n:new w.Event(v,typeof n==="object"&&n);n.isTrigger=s?2:3;n.namespace=m.join(".");n.namespace_re=n.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;n.result=t;if(!n.target){n.target=i}r=r==null?[n]:w.makeArray(r,[n]);c=w.event.special[v]||{};if(!s&&c.trigger&&c.trigger.apply(i,r)===false){return}if(!s&&!c.noBubble&&!w.isWindow(i)){l=c.delegateType||v;if(!nt.test(l+v)){f=f.parentNode}for(;f;f=f.parentNode){d.push(f);h=f}if(h===(i.ownerDocument||o)){d.push(h.defaultView||h.parentWindow||e)}}p=0;while((f=d[p++])&&!n.isPropagationStopped()){n.type=p>1?l:c.bindType||v;u=(w._data(f,"events")||{})[n.type]&&w._data(f,"handle");if(u){u.apply(f,r)}u=a&&f[a];if(u&&w.acceptData(f)&&u.apply&&u.apply(f,r)===false){n.preventDefault()}}n.type=v;if(!s&&!n.isDefaultPrevented()){if((!c._default||c._default.apply(d.pop(),r)===false)&&w.acceptData(i)){if(a&&i[v]&&!w.isWindow(i)){h=i[a];if(h){i[a]=null}w.event.triggered=v;try{i[v]()}catch(g){}w.event.triggered=t;if(h){i[a]=h}}}}return n.result},dispatch:function(e){e=w.event.fix(e);var n,r,i,s,o,u=[],a=v.call(arguments),f=(w._data(this,"events")||{})[e.type]||[],l=w.event.special[e.type]||{};a[0]=e;e.delegateTarget=this;if(l.preDispatch&&l.preDispatch.call(this,e)===false){return}u=w.event.handlers.call(this,e,f);n=0;while((s=u[n++])&&!e.isPropagationStopped()){e.currentTarget=s.elem;o=0;while((i=s.handlers[o++])&&!e.isImmediatePropagationStopped()){if(!e.namespace_re||e.namespace_re.test(i.namespace)){e.handleObj=i;e.data=i.data;r=((w.event.special[i.origType]||{}).handle||i.handler).apply(s.elem,a);if(r!==t){if((e.result=r)===false){e.preventDefault();e.stopPropagation()}}}}}if(l.postDispatch){l.postDispatch.call(this,e)}return e.result},handlers:function(e,n){var r,i,s,o,u=[],a=n.delegateCount,f=e.target;if(a&&f.nodeType&&(!e.button||e.type!=="click")){for(;f!=this;f=f.parentNode||this){if(f.nodeType===1&&(f.disabled!==true||e.type!=="click")){s=[];for(o=0;o=0:w.find(r,this,null,[f]).length}if(s[r]){s.push(i)}}if(s.length){u.push({elem:f,handlers:s})}}}}if(a1?w.unique(n):n);n.selector=this.selector?this.selector+" "+e:e;return n},has:function(e){var t,n=w(e,this),r=n.length;return this.filter(function(){for(t=0;t-1:n.nodeType===1&&w.find.matchesSelector(n,e))){n=s.push(n);break}}}return this.pushStack(s.length>1?w.unique(s):s)},index:function(e){if(!e){return this[0]&&this[0].parentNode?this.first().prevAll().length:-1}if(typeof e==="string"){return w.inArray(this[0],w(e))}return w.inArray(e.jquery?e[0]:e,this)},add:function(e,t){var n=typeof e==="string"?w(e,t):w.makeArray(e&&e.nodeType?[e]:e),r=w.merge(this.get(),n);return this.pushStack(w.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}});w.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return w.dir(e,"parentNode")},parentsUntil:function(e,t,n){return w.dir(e,"parentNode",n)},next:function(e){return ct(e,"nextSibling")},prev:function(e){return ct(e,"previousSibling")},nextAll:function(e){return w.dir(e,"nextSibling")},prevAll:function(e){return w.dir(e,"previousSibling")},nextUntil:function(e,t,n){return w.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return w.dir(e,"previousSibling",n)},siblings:function(e){return w.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return w.sibling(e.firstChild)},contents:function(e){return w.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:w.merge([],e.childNodes)}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);if(e.slice(-5)!=="Until"){r=n}if(r&&typeof r==="string"){i=w.filter(r,i)}if(this.length>1){if(!lt[e]){i=w.unique(i)}if(at.test(e)){i=i.reverse()}}return this.pushStack(i)}});w.extend({filter:function(e,t,n){var r=t[0];if(n){e=":not("+e+")"}return t.length===1&&r.nodeType===1?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return e.nodeType===1}))},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!w(s).is(r))){if(s.nodeType===1){i.push(s)}s=s[n]}return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling){if(e.nodeType===1&&e!==t){n.push(e)}}return n}});var dt="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|"+"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",vt=/ jQuery\d+="(?:null|\d+)"/g,mt=new RegExp("<(?:"+dt+")[\\s/>]","i"),gt=/^\s+/,yt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,wt=/\s*$/g,Lt={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:w.support.htmlSerialize?[0,"",""]:[1,"X
","
"]},At=pt(o),Ot=At.appendChild(o.createElement("div"));Lt.optgroup=Lt.option;Lt.tbody=Lt.tfoot=Lt.colgroup=Lt.caption=Lt.thead;Lt.th=Lt.td;w.fn.extend({text:function(e){return w.access(this,function(e){return e===t?w.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=Mt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=Mt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){if(this.parentNode){this.parentNode.insertBefore(e,this)}})},after:function(){return this.domManip(arguments,function(e){if(this.parentNode){this.parentNode.insertBefore(e,this.nextSibling)}})},remove:function(e,t){var n,r=e?w.filter(e,this):this,i=0;for(;(n=r[i])!=null;i++){if(!t&&n.nodeType===1){w.cleanData(jt(n))}if(n.parentNode){if(t&&w.contains(n.ownerDocument,n)){Pt(jt(n,"script"))}n.parentNode.removeChild(n)}}return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){if(e.nodeType===1){w.cleanData(jt(e,false))}while(e.firstChild){e.removeChild(e.firstChild)}if(e.options&&w.nodeName(e,"select")){e.options.length=0}}return this},clone:function(e,t){e=e==null?false:e;t=t==null?e:t;return this.map(function(){return w.clone(this,e,t)})},html:function(e){return w.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t){return n.nodeType===1?n.innerHTML.replace(vt,""):t}if(typeof e==="string"&&!St.test(e)&&(w.support.htmlSerialize||!mt.test(e))&&(w.support.leadingWhitespace||!gt.test(e))&&!Lt[(bt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(yt,"<$1>");try{for(;r")){s=e.cloneNode(true)}else{Ot.innerHTML=e.outerHTML;Ot.removeChild(s=Ot.firstChild)}if((!w.support.noCloneEvent||!w.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!w.isXMLDoc(e)){r=jt(s);u=jt(e);for(o=0;(i=u[o])!=null;++o){if(r[o]){Bt(i,r[o])}}}if(t){if(n){u=u||jt(e);r=r||jt(s);for(o=0;(i=u[o])!=null;o++){Ht(i,r[o])}}else{Ht(e,s)}}r=jt(s,"script");if(r.length>0){Pt(r,!a&&jt(e,"script"))}r=u=i=null;return s},buildFragment:function(e,t,n,r){var i,s,o,u,a,f,l,c=e.length,h=pt(t),p=[],d=0;for(;d")+l[2];i=l[0];while(i--){u=u.lastChild}if(!w.support.leadingWhitespace&>.test(s)){p.push(t.createTextNode(gt.exec(s)[0]))}if(!w.support.tbody){s=a==="table"&&!wt.test(s)?u.firstChild:l[1]===""&&!wt.test(s)?u:0;i=s&&s.childNodes.length;while(i--){if(w.nodeName(f=s.childNodes[i],"tbody")&&!f.childNodes.length){s.removeChild(f)}}}w.merge(p,u.childNodes);u.textContent="";while(u.firstChild){u.removeChild(u.firstChild)}u=h.lastChild}}}if(u){h.removeChild(u)}if(!w.support.appendChecked){w.grep(jt(p,"input"),Ft)}d=0;while(s=p[d++]){if(r&&w.inArray(s,r)!==-1){continue}o=w.contains(s.ownerDocument,s);u=jt(h.appendChild(s),"script");if(o){Pt(u)}if(n){i=0;while(s=u[i++]){if(Nt.test(s.type||"")){n.push(s)}}}}u=null;return h},cleanData:function(e,t){var n,r,s,o,u=0,a=w.expando,f=w.cache,l=w.support.deleteExpando,h=w.event.special;for(;(n=e[u])!=null;u++){if(t||w.acceptData(n)){s=n[a];o=s&&f[s];if(o){if(o.events){for(r in o.events){if(h[r]){w.event.remove(n,r)}else{w.removeEvent(n,r,o.handle)}}}if(f[s]){delete f[s];if(l){delete n[a]}else if(typeof n.removeAttribute!==i){n.removeAttribute(a)}else{n[a]=null}c.push(s)}}}}},_evalUrl:function(e){return w.ajax({url:e,type:"GET",dataType:"script",async:false,global:false,"throws":true})}});w.fn.extend({wrapAll:function(e){if(w.isFunction(e)){return this.each(function(t){w(this).wrapAll(e.call(this,t))})}if(this[0]){var t=w(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){t.insertBefore(this[0])}t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1){e=e.firstChild}return e}).append(this)}return this},wrapInner:function(e){if(w.isFunction(e)){return this.each(function(t){w(this).wrapInner(e.call(this,t))})}return this.each(function(){var t=w(this),n=t.contents();if(n.length){n.wrapAll(e)}else{t.append(e)}})},wrap:function(e){var t=w.isFunction(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){if(!w.nodeName(this,"body")){w(this).replaceWith(this.childNodes)}}).end()}});var It,qt,Rt,Ut=/alpha\([^)]*\)/i,zt=/opacity\s*=\s*([^)]*)/,Wt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Vt=/^margin/,$t=new RegExp("^("+E+")(.*)$","i"),Jt=new RegExp("^("+E+")(?!px)[a-z%]+$","i"),Kt=new RegExp("^([+-])=("+E+")","i"),Qt={BODY:"block"},Gt={position:"absolute",visibility:"hidden",display:"block"},Yt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];w.fn.extend({css:function(e,n){return w.access(this,function(e,n,r){var i,s,o={},u=0;if(w.isArray(n)){s=qt(e);i=n.length;for(;u1)},show:function(){return rn(this,true)},hide:function(){return rn(this)},toggle:function(e){if(typeof e==="boolean"){return e?this.show():this.hide()}return this.each(function(){if(nn(this)){w(this).show()}else{w(this).hide()}})}});w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Rt(e,"opacity");return n===""?"1":n}}}},cssNumber:{columnCount:true,fillOpacity:true,fontWeight:true,lineHeight:true,opacity:true,order:true,orphans:true,widows:true,zIndex:true,zoom:true},cssProps:{"float":w.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style){return}var s,o,u,a=w.camelCase(n),f=e.style;n=w.cssProps[a]||(w.cssProps[a]=tn(f,a));u=w.cssHooks[n]||w.cssHooks[a];if(r!==t){o=typeof r;if(o==="string"&&(s=Kt.exec(r))){r=(s[1]+1)*s[2]+parseFloat(w.css(e,n));o="number"}if(r==null||o==="number"&&isNaN(r)){return}if(o==="number"&&!w.cssNumber[a]){r+="px"}if(!w.support.clearCloneStyle&&r===""&&n.indexOf("background")===0){f[n]="inherit"}if(!u||!("set"in u)||(r=u.set(e,r,i))!==t){try{f[n]=r}catch(l){}}}else{if(u&&"get"in u&&(s=u.get(e,false,i))!==t){return s}return f[n]}},css:function(e,n,r,i){var s,o,u,a=w.camelCase(n);n=w.cssProps[a]||(w.cssProps[a]=tn(e.style,a));u=w.cssHooks[n]||w.cssHooks[a];if(u&&"get"in u){o=u.get(e,true,r)}if(o===t){o=Rt(e,n,i)}if(o==="normal"&&n in Yt){o=Yt[n]}if(r===""||r){s=parseFloat(o);return r===true||w.isNumeric(s)?s||0:o}return o}});if(e.getComputedStyle){qt=function(t){return e.getComputedStyle(t,null)};Rt=function(e,n,r){var i,s,o,u=r||qt(e),a=u?u.getPropertyValue(n)||u[n]:t,f=e.style;if(u){if(a===""&&!w.contains(e.ownerDocument,e)){a=w.style(e,n)}if(Jt.test(a)&&Vt.test(n)){i=f.width;s=f.minWidth;o=f.maxWidth;f.minWidth=f.maxWidth=f.width=a;a=u.width;f.width=i;f.minWidth=s;f.maxWidth=o}}return a}}else if(o.documentElement.currentStyle){qt=function(e){return e.currentStyle};Rt=function(e,n,r){var i,s,o,u=r||qt(e),a=u?u[n]:t,f=e.style;if(a==null&&f&&f[n]){a=f[n]}if(Jt.test(a)&&!Wt.test(n)){i=f.left;s=e.runtimeStyle;o=s&&s.left;if(o){s.left=e.currentStyle.left}f.left=n==="fontSize"?"1em":a;a=f.pixelLeft+"px";f.left=i;if(o){s.left=o}}return a===""?"auto":a}}w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n){return e.offsetWidth===0&&Xt.test(w.css(e,"display"))?w.swap(e,Gt,function(){return un(e,t,r)}):un(e,t,r)}},set:function(e,n,r){var i=r&&qt(e);return sn(e,n,r?on(e,t,r,w.support.boxSizing&&w.css(e,"boxSizing",false,i)==="border-box",i):0)}}});if(!w.support.opacity){w.cssHooks.opacity={get:function(e,t){return zt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=w.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if((t>=1||t==="")&&w.trim(s.replace(Ut,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(t===""||r&&!r.filter){return}}n.filter=Ut.test(s)?s.replace(Ut,i):s+" "+i}}}w(function(){if(!w.support.reliableMarginRight){w.cssHooks.marginRight={get:function(e,t){if(t){return w.swap(e,{display:"inline-block"},Rt,[e,"marginRight"])}}}}if(!w.support.pixelPosition&&w.fn.position){w.each(["top","left"],function(e,t){w.cssHooks[t]={get:function(e,n){if(n){n=Rt(e,t);return Jt.test(n)?w(e).position()[t]+"px":n}}}})}});if(w.expr&&w.expr.filters){w.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||!w.support.reliableHiddenOffsets&&(e.style&&e.style.display||w.css(e,"display"))==="none"};w.expr.filters.visible=function(e){return!w.expr.filters.hidden(e)}}w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){var r=0,i={},s=typeof n==="string"?n.split(" "):[n];for(;r<4;r++){i[e+Zt[r]+t]=s[r]||s[r-2]||s[0]}return i}};if(!Vt.test(e)){w.cssHooks[e+t].set=sn}});var ln=/%20/g,cn=/\[\]$/,hn=/\r?\n/g,pn=/^(?:submit|button|image|reset|file)$/i,dn=/^(?:input|select|textarea|keygen)/i;w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&dn.test(this.nodeName)&&!pn.test(e)&&(this.checked||!xt.test(e))}).map(function(e,t){var n=w(this).val();return n==null?null:w.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(hn,"\r\n")}}):{name:t.name,value:n.replace(hn,"\r\n")}}).get()}});w.param=function(e,n){var r,i=[],s=function(e,t){t=w.isFunction(t)?t():t==null?"":t;i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t){n=w.ajaxSettings&&w.ajaxSettings.traditional}if(w.isArray(e)||e.jquery&&!w.isPlainObject(e)){w.each(e,function(){s(this.name,this.value)})}else{for(r in e){vn(r,e[r],n,s)}}return i.join("&").replace(ln,"+")};w.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(e,t){w.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}});w.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,gn,yn=w.now(),bn=/\?/,wn=/#.*$/,En=/([?&])_=[^&]*/,Sn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,xn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Tn=/^(?:GET|HEAD)$/,Nn=/^\/\//,Cn=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,kn=w.fn.load,Ln={},An={},On="*/".concat("*");try{gn=s.href}catch(Mn){gn=o.createElement("a");gn.href="";gn=gn.href}mn=Cn.exec(gn.toLowerCase())||[];w.fn.load=function(e,n,r){if(typeof e!=="string"&&kn){return kn.apply(this,arguments)}var i,s,o,u=this,a=e.indexOf(" ");if(a>=0){i=e.slice(a,e.length);e=e.slice(0,a)}if(w.isFunction(n)){r=n;n=t}else if(n&&typeof n==="object"){o="POST"}if(u.length>0){w.ajax({url:e,type:o,dataType:"html",data:n}).done(function(e){s=arguments;u.html(i?w("
").append(w.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){u.each(r,s||[e.responseText,t,e])})}return this};w.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){w.fn[t]=function(e){return this.on(t,e)}});w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:gn,type:"GET",isLocal:xn.test(mn[1]),global:true,processData:true,async:true,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":On,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":true,"text json":w.parseJSON,"text xml":w.parseXML},flatOptions:{url:true,context:true}},ajaxSetup:function(e,t){return t?Pn(Pn(e,w.ajaxSettings),t):Pn(w.ajaxSettings,e)},ajaxPrefilter:_n(Ln),ajaxTransport:_n(An),ajax:function(e,n){function N(e,n,r,i){var l,g,y,E,S,T=n;if(b===2){return}b=2;if(u){clearTimeout(u)}f=t;o=i||"";x.readyState=e>0?4:0;l=e>=200&&e<300||e===304;if(r){E=Hn(c,x,r)}E=Bn(c,E,x,l);if(l){if(c.ifModified){S=x.getResponseHeader("Last-Modified");if(S){w.lastModified[s]=S}S=x.getResponseHeader("etag");if(S){w.etag[s]=S}}if(e===204||c.type==="HEAD"){T="nocontent"}else if(e===304){T="notmodified"}else{T=E.state;g=E.data;y=E.error;l=!y}}else{y=T;if(e||!T){T="error";if(e<0){e=0}}}x.status=e;x.statusText=(n||T)+"";if(l){d.resolveWith(h,[g,T,x])}else{d.rejectWith(h,[x,T,y])}x.statusCode(m);m=t;if(a){p.trigger(l?"ajaxSuccess":"ajaxError",[x,c,l?g:y])}v.fireWith(h,[x,T]);if(a){p.trigger("ajaxComplete",[x,c]);if(!--w.active){w.event.trigger("ajaxStop")}}}if(typeof e==="object"){n=e;e=t}n=n||{};var r,i,s,o,u,a,f,l,c=w.ajaxSetup({},n),h=c.context||c,p=c.context&&(h.nodeType||h.jquery)?w(h):w.event,d=w.Deferred(),v=w.Callbacks("once memory"),m=c.statusCode||{},g={},y={},b=0,E="canceled",x={readyState:0,getResponseHeader:function(e){var t;if(b===2){if(!l){l={};while(t=Sn.exec(o)){l[t[1].toLowerCase()]=t[2]}}t=l[e.toLowerCase()]}return t==null?null:t},getAllResponseHeaders:function(){return b===2?o:null},setRequestHeader:function(e,t){var n=e.toLowerCase();if(!b){e=y[n]=y[n]||e;g[e]=t}return this},overrideMimeType:function(e){if(!b){c.mimeType=e}return this},statusCode:function(e){var t;if(e){if(b<2){for(t in e){m[t]=[m[t],e[t]]}}else{x.always(e[x.status])}}return this},abort:function(e){var t=e||E;if(f){f.abort(t)}N(0,t);return this}};d.promise(x).complete=v.add;x.success=x.done;x.error=x.fail;c.url=((e||c.url||gn)+"").replace(wn,"").replace(Nn,mn[1]+"//");c.type=n.method||n.type||c.method||c.type;c.dataTypes=w.trim(c.dataType||"*").toLowerCase().match(S)||[""];if(c.crossDomain==null){r=Cn.exec(c.url.toLowerCase());c.crossDomain=!!(r&&(r[1]!==mn[1]||r[2]!==mn[2]||(r[3]||(r[1]==="http:"?"80":"443"))!==(mn[3]||(mn[1]==="http:"?"80":"443"))))}if(c.data&&c.processData&&typeof c.data!=="string"){c.data=w.param(c.data,c.traditional)}Dn(Ln,c,n,x);if(b===2){return x}a=c.global;if(a&&w.active++===0){w.event.trigger("ajaxStart")}c.type=c.type.toUpperCase();c.hasContent=!Tn.test(c.type);s=c.url;if(!c.hasContent){if(c.data){s=c.url+=(bn.test(s)?"&":"?")+c.data;delete c.data}if(c.cache===false){c.url=En.test(s)?s.replace(En,"$1_="+yn++):s+(bn.test(s)?"&":"?")+"_="+yn++}}if(c.ifModified){if(w.lastModified[s]){x.setRequestHeader("If-Modified-Since",w.lastModified[s])}if(w.etag[s]){x.setRequestHeader("If-None-Match",w.etag[s])}}if(c.data&&c.hasContent&&c.contentType!==false||n.contentType){x.setRequestHeader("Content-Type",c.contentType)}x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+On+"; q=0.01":""):c.accepts["*"]);for(i in c.headers){x.setRequestHeader(i,c.headers[i])}if(c.beforeSend&&(c.beforeSend.call(h,x,c)===false||b===2)){return x.abort()}E="abort";for(i in{success:1,error:1,complete:1}){x[i](c[i])}f=Dn(An,c,n,x);if(!f){N(-1,"No Transport")}else{x.readyState=1;if(a){p.trigger("ajaxSend",[x,c])}if(c.async&&c.timeout>0){u=setTimeout(function(){x.abort("timeout")},c.timeout)}try{b=1;f.send(g,N)}catch(T){if(b<2){N(-1,T)}else{throw T}}}return x},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,n){return w.get(e,t,n,"script")}});w.each(["get","post"],function(e,n){w[n]=function(e,r,i,s){if(w.isFunction(r)){s=s||i;i=r;r=t}return w.ajax({url:e,type:n,dataType:s,data:r,success:i})}});w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){w.globalEval(e);return e}}});w.ajaxPrefilter("script",function(e){if(e.cache===t){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});w.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||w("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script");n.async=true;if(e.scriptCharset){n.charset=e.scriptCharset}n.src=e.url;n.onload=n.onreadystatechange=function(e,t){if(t||!n.readyState||/loaded|complete/.test(n.readyState)){n.onload=n.onreadystatechange=null;if(n.parentNode){n.parentNode.removeChild(n)}n=null;if(!t){i(200,"success")}}};r.insertBefore(n,r.firstChild)},abort:function(){if(n){n.onload(t,true)}}}}});var jn=[],Fn=/(=)\?(?=&|$)|\?\?/;w.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=jn.pop()||w.expando+"_"+yn++;this[e]=true;return e}});w.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.jsonp!==false&&(Fn.test(n.url)?"url":typeof n.data==="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Fn.test(n.data)&&"data");if(a||n.dataTypes[0]==="jsonp"){s=n.jsonpCallback=w.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback;if(a){n[a]=n[a].replace(Fn,"$1"+s)}else if(n.jsonp!==false){n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+s}n.converters["script json"]=function(){if(!u){w.error(s+" was not called")}return u[0]};n.dataTypes[0]="json";o=e[s];e[s]=function(){u=arguments};i.always(function(){e[s]=o;if(n[s]){n.jsonpCallback=r.jsonpCallback;jn.push(s)}if(u&&w.isFunction(o)){o(u[0])}u=o=t});return"script"}});var In,qn,Rn=0,Un=e.ActiveXObject&&function(){var e;for(e in In){In[e](t,true)}};w.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&zn()||Wn()}:zn;qn=w.ajaxSettings.xhr();w.support.cors=!!qn&&"withCredentials"in qn;qn=w.support.ajax=!!qn;if(qn){w.ajaxTransport(function(n){if(!n.crossDomain||w.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();if(n.username){a.open(n.type,n.url,n.async,n.username,n.password)}else{a.open(n.type,n.url,n.async)}if(n.xhrFields){for(u in n.xhrFields){a[u]=n.xhrFields[u]}}if(n.mimeType&&a.overrideMimeType){a.overrideMimeType(n.mimeType)}if(!n.crossDomain&&!i["X-Requested-With"]){i["X-Requested-With"]="XMLHttpRequest"}try{for(u in i){a.setRequestHeader(u,i[u])}}catch(f){}a.send(n.hasContent&&n.data||null);r=function(e,i){var u,f,l,c;try{if(r&&(i||a.readyState===4)){r=t;if(o){a.onreadystatechange=w.noop;if(Un){delete In[o]}}if(i){if(a.readyState!==4){a.abort()}}else{c={};u=a.status;f=a.getAllResponseHeaders();if(typeof a.responseText==="string"){c.text=a.responseText}try{l=a.statusText}catch(h){l=""}if(!u&&n.isLocal&&!n.crossDomain){u=c.text?200:404}else if(u===1223){u=204}}}}catch(p){if(!i){s(-1,p)}}if(c){s(u,l,c,f)}};if(!n.async){r()}else if(a.readyState===4){setTimeout(r)}else{o=++Rn;if(Un){if(!In){In={};w(e).unload(Un)}In[o]=r}a.onreadystatechange=r}},abort:function(){if(r){r(t,true)}}}}})}var Xn,Vn,$n=/^(?:toggle|show|hide)$/,Jn=new RegExp("^(?:([+-])=|)("+E+")([a-z%]*)$","i"),Kn=/queueHooks$/,Qn=[nr],Gn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Jn.exec(t),s=i&&i[3]||(w.cssNumber[e]?"":"px"),o=(w.cssNumber[e]||s!=="px"&&+r)&&Jn.exec(w.css(n.elem,e)),u=1,a=20;if(o&&o[3]!==s){s=s||o[3];i=i||[];o=+r||1;do{u=u||".5";o=o/u;w.style(n.elem,e,o+s)}while(u!==(u=n.cur()/r)&&u!==1&&--a)}if(i){o=n.start=+o||+r||0;n.unit=s;n.end=i[1]?o+(i[1]+1)*i[2]:+i[2]}return n}]};w.Animation=w.extend(er,{tweener:function(e,t){if(w.isFunction(e)){t=e;e=["*"]}else{e=e.split(" ")}var n,r=0,i=e.length;for(;r-1,f={},l={},c,h;if(a){l=i.position();c=l.top;h=l.left}else{c=parseFloat(o)||0;h=parseFloat(u)||0}if(w.isFunction(t)){t=t.call(e,n,s)}if(t.top!=null){f.top=t.top-s.top+c}if(t.left!=null){f.left=t.left-s.left+h}if("using"in t){t.using.call(e,f)}else{i.css(f)}}};w.fn.extend({position:function(){if(!this[0]){return}var e,t,n={top:0,left:0},r=this[0];if(w.css(r,"position")==="fixed"){t=r.getBoundingClientRect()}else{e=this.offsetParent();t=this.offset();if(!w.nodeName(e[0],"html")){n=e.offset()}n.top+=w.css(e[0],"borderTopWidth",true);n.left+=w.css(e[0],"borderLeftWidth",true)}return{top:t.top-n.top-w.css(r,"marginTop",true),left:t.left-n.left-w.css(r,"marginLeft",true)}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||u;while(e&&!w.nodeName(e,"html")&&w.css(e,"position")==="static"){e=e.offsetParent}return e||u})}});w.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);w.fn[e]=function(i){return w.access(this,function(e,i,s){var o=sr(e);if(s===t){return o?n in o?o[n]:o.document.documentElement[i]:e[i]}if(o){o.scrollTo(!r?s:w(o).scrollLeft(),r?s:w(o).scrollTop())}else{e[i]=s}},e,i,arguments.length,null)}});w.each({Height:"height",Width:"width"},function(e,n){w.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){w.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!=="boolean"),u=r||(i===true||s===true?"margin":"border");return w.access(this,function(n,r,i){var s;if(w.isWindow(n)){return n.document.documentElement["client"+e]}if(n.nodeType===9){s=n.documentElement;return Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])}return i===t?w.css(n,r,u):w.style(n,r,i,u)},n,o?i:t,o,null)}})});w.fn.size=function(){return this.length};w.fn.andSelf=w.fn.addBack;if(typeof module==="object"&&module&&typeof module.exports==="object"){module.exports=w}else{e.jQuery=e.$=w;if(typeof define==="function"&&define.amd){define("jquery",[],function(){return w})}}})(window);(function(e,t,n){"use strict";function O(e,t){if(t&&t.onError){if(t.onError(e)===false){return}}this.name="JsRender Error";this.message=e||"JsRender error"}function M(e,t){var n;e=e||{};for(n in t){e[n]=t[n]}return e}function _(e,t,n){if(!it.rTag||e){a=e?e.charAt(0):a;f=e?e.charAt(1):f;l=t?t.charAt(0):l;c=t?t.charAt(1):c;h=n||h;e="\\"+a+"(\\"+h+")?\\"+f;t="\\"+l+"\\"+c;o="(?:(?:(\\w+(?=[\\/\\s\\"+l+"]))|(?:(\\w+)?(:)|(>)|!--((?:[^-]|-(?!-))*)--|(\\*)))"+"\\s*((?:[^\\"+l+"]|\\"+l+"(?!\\"+c+"))*?)";it.rTag=o+")";o=new RegExp(e+o+"(\\/)?|(?:\\/(\\w+)))"+t,"g");u=new RegExp("<.*>|([^\\\\]|^)[{}]|"+e+".*"+t)}return[a,f,l,c,h]}function D(e,t){if(!t){t=e;e=n}var r,i,s,o,u=this,a=!t||t==="root";if(e){o=u.type===t?u:n;if(!o){r=u.views;if(u._.useKey){for(i in r){if(o=r[i].get(e,t)){break}}}else for(i=0,s=r.length;!o&&i0){try{h=n.nodeType>0?n:!u.test(n)&&t&&t(e.document).find(n)[0]}catch(i){}if(h){n=h.getAttribute(C);r=r||n;n=et[n];if(!n){r=r||"_"+x++;h.setAttribute(C,r);n=et[r]=z(r,h.innerHTML,s,o,a,f)}}return n}}var c,h;i=i||"";c=l(i);f=f||(i.markup?i:{});f.tmplName=r;if(s){f._parentTmpl=s}if(!c&&i.markup&&(c=l(i.markup))){if(c.fn&&(c.debug!==i.debug||c.allowCode!==i.allowCode)){c=c.markup}}if(c!==n){if(r&&!s){k[r]=function(){return i.render.apply(i,arguments)}}if(c.fn||i.fn){if(c.fn){if(r&&r!==c.tmplName){i=Y(f,c)}else{i=c}}}else{i=W(c,f);K(c.replace(g,"\\$&"),i)}R(f);return i}}function W(e,t){var n,r=st.wrapMap||{},s=M({markup:e,tmpls:[],links:{},tags:{},bnds:[],_is:"template",render:V},t);if(!t.htmlTag){n=w.exec(e);s.htmlTag=n?n[1].toLowerCase():""}n=r[s.htmlTag];if(n&&n!==r.div){s.markup=i.trim(s.markup)}return s}function X(e,t){function r(s,o,u){var a,f,l,c;if(s&&""+s!==s&&!s.nodeType&&!s.markup){for(l in s){r(l,s[l],o)}return A}if(o===n){o=s;s=n}if(s&&""+s!==s){u=o;o=s;s=n}c=u?u[i]=u[i]||{}:r;f=t.compile;if(a=it.onBeforeStoreItem){f=a(c,s,o,f)||f}if(!s){o=f(n,o)}else if(o===null){delete c[s]}else{c[s]=f?o=f(s,o,u,e,t):o}if(f&&o){o._is=e}if(a=it.onStoreItem){a(c,s,o,f)}return o}var i=e+"s";A[i]=r;L[e]=t}function V(e,t,r,s,o,u){var a,f,l,c,h,p,d,v,m,g,y,b,w,E=this,S=!E.attr||E.attr==="html",x="";if(s===true){d=true;s=0}if(E.tag){v=E;E=E.tag;g=E._;b=E.tagName;w=v.tmpl;t=Y(t,E.ctx);m=v.content;if(v.props.link===false){t=t||{};t.link=false}r=r||v.view;e=e===n?r:e}else{w=E.jquery&&(E[0]||$('Unknown template: "'+E.selector+'"'))||E}if(w){if(!r&&e&&e._is==="view"){r=e}if(r){m=m||r.content;u=u||r._.onRender;if(e===r){e=r.data;o=true}t=Y(t,r.ctx)}if(!r||r.data===n){(t=t||{}).root=e}if(!w.fn){w=et[w]||et(w)}if(w){u=(t&&t.link)!==false&&S&&u;y=u;if(u===true){y=n;u=r._.onRender}t=w.helpers?Y(w.helpers,t):t;if(i.isArray(e)&&!o){c=d?r:s!==n&&r||q(t,"array",r,e,w,s,m,u);for(a=0,f=e.length;a":u+o}if(_){L="prm"+i;_="try{var "+L+"=["+a+"][0];}catch(e){"+L+'="";}\n';a=L}}else{if(S){w=W(x,D);w.tmplName=b+"/"+o;Q(S,w);y.push(w)}if(!C){E=o;N=M;M=""}T=e[i+1];T=T&&T[0]==="else"}f+=",args:["+a+"]}";if(k&&g||u&&o!==">"){A=new Function("data,view,j,u"," // "+b+" "+O+" "+o+"\n"+_+"return {"+f+";");A.paths=g;A._ctxs=o;if(r){return A}d=1}M+=k?"\n"+(g?"":_)+(r?"return ":"ret+=")+(d?(d=0,p=true,'c("'+u+'",view,'+(g?(m[O-1]=A,O):"{"+f)+");"):o===">"?(c=true,"h("+a+");"):(h=true,"(v="+a+")!="+(r?"=":"")+'u?v:"";')):(l=true,"{view:view,tmpl:"+(S?y.length:"0")+","+f+",");if(E&&!T){M="["+M.slice(0,-1)+"]";if(r||g){M=new Function("data,view,j,u"," // "+b+" "+O+" "+E+"\nreturn "+M+";");if(g){(m[O-1]=M).paths=g}M._ctxs=o;if(r){return M}}M=N+'\nret+=t("'+E+'",view,this,'+(O||M)+");";g=0;E=0}}}}M="// "+b+"\nvar j=j||"+(t?"jQuery.":"js")+"views"+(h?",v":"")+(l?",t=j._tag":"")+(p?",c=j._cnvt":"")+(c?",h=j.converters.html":"")+(r?";\n":',ret="";\n')+(st.tryCatch?"try{\n":"")+(D.debug?"debugger;":"")+M+(r?"\n":"\nreturn ret;\n")+(st.tryCatch?"\n}catch(e){return j._err(e);}":"");try{M=new Function("data,view,j,u",M)}catch(H){J("Compiled template code:\n\n"+M,H)}if(n){n.fn=M}return M}function G(e,t,n){function r(r,d,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B){function F(e,n,r,u,a,f,l,c){if(r){if(t){if(i==="linkTo"){s=t._jsvto=t._jsvto||[];s.push(E)}if(!i||o){t.push(E.slice(n.length))}}if(r!=="."){var h=(u?'view.hlp("'+u+'")':a?"view":"data")+(c?(f?"."+f:u?"":a?"":"."+r)+(l||""):(c=u?"":a?f||"":r,""));h=h+(c?"."+c:"");return n+(h.slice(0,9)==="view.data"?h.slice(5):h)}}return e}var j;S=S||"";b=b||d||L;E=E||N;C=C||D||"";if(x){J(e)}else{if(t&&_&&!y&&!g){if(!i||o||s){j=v[m];if(B.length-1>H-j){j=B.slice(j,H+1);_=f+":"+j+l;_=u[_]=u[_]||K(a+_+c,n,true);if(!_.paths){G(j,_.paths=[],n)}(s||t).push({_jsvOb:_})}}}return y?(y=!A,y?r:'"'):g?(g=!O,g?r:'"'):(b?(m++,v[m]=H++,b):"")+(P?m?"":i?(i=o=s=false,"\b"):",":T?(m&&J(e),i=E,o=w,"\b"+E+":"):E?E.split("^").join(".").replace(p,F)+(C?(h[++m]=true,E.charAt(0)!=="."&&(v[m]=H),C):S):S?S:M?(h[m--]=false,M)+(C?(h[++m]=true,C):""):k?(h[m]||J(e),","):d?"":(y=A,g=O,'"'))}}var i,s,o,u=n.links,h={},v={0:-1},m=0,g=false,y=false;return(e+" ").replace(/\)\^/g,").").replace(d,r)}function Y(e,t){return e&&e!==t?t?M(M({},t),e):e:t&&M({},t)}function Z(e){return N[e]||(N[e]="&#"+e.charCodeAt(0)+";")}function ut(e){var t=this,r=t.tagCtx,s=!arguments.length,o="",u=s||0;if(!t.rendering.done){if(s){o=n}else if(e!==n){e=t.prep?t.prep(e):e;o+=r.render(e);u+=i.isArray(e)?e.length:1}if(t.rendering.done=u){t.selected=r.index}}return o}if(t&&t.views||e.jsviews){return}var r="v1.0.0-beta",i,s,o,u,a="{",f="{",l="}",c="}",h="^",p=/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,d=/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(!*?[#~]?[\w$.^]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=\s*\.|\s*\^|\s*$)|[)\]])([([]?))|(\s+)/g,v=/[ \t]*(\r\n|\n|\r)/g,m=/\\(['"])/g,g=/['"\\]/g,y=/\x08(~)?([^\x08]+)\x08/g,b=/^if\s/,w=/<(\w+)[>\s]/,E=/[\x00`><"'&]/g,S=E,x=0,T=0,N={"&":"&","<":"<",">":">","\0":"�","'":"'",'"':""","`":"`"},C="data-jsv-tmpl",k={},L={template:{compile:z},tag:{compile:U},helper:{},converter:{}},A={jsviews:r,render:k,settings:{delimiters:_,debugMode:true,tryCatch:true},sub:{View:q,Error:O,tmplFn:K,parse:G,extend:M,error:$,syntaxError:J},_cnvt:j,_tag:I,_err:function(e){return st.debugMode?"Error: "+(e.message||e)+". ":""}};(O.prototype=new Error).constructor=O;P.depends=function(){return[this.get("item"),"index"]};H.depends=function(){return["index"]};for(s in L){X(s,L[s])}var et=A.templates,tt=A.converters,nt=A.helpers,rt=A.tags,it=A.sub,st=A.settings,ot="Error: #index in nested view: use #getIndex()";if(t){i=t;i.fn.render=V}else{i=e.jsviews={};i.isArray=Array&&Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}}i.render=k;i.views=A;i.templates=et=A.templates;rt({"else":function(){},"if":{render:function(e){var t=this,n=t.rendering.done||!e&&(arguments.length||!t.tagCtx.index)?"":(t.rendering.done=true,t.selected=t.tagCtx.index,t.tagCtx.render());return n},onUpdate:function(e,t,n){var r,i,s;for(r=0;(i=this.tagCtxs[r])&&i.args.length;r++){i=i.args[0];s=!i!==!n[r].args[0];if(!!i||s){return s}}return false},flow:true},"for":{render:ut,onArrayChange:function(e,t){var n,r=this,i=t.change;if(this.tagCtxs[1]&&(i==="insert"&&e.target.length===t.items.length||i==="remove"&&!e.target.length||i==="refresh"&&!t.oldItems.length!==!e.target.length)){this.refresh()}else{for(n in r._.arrVws){n=r._.arrVws[n];if(n.data===e.target){n._.onArrayChange.apply(n,arguments)}}}e.done=true},flow:true},props:{prep:function(e){var t,n=[];for(t in e){n.push({key:t,prop:e[t]})}return n},render:ut,flow:true},include:{flow:true},"*":{render:function(e){return e},flow:true}});tt({html:function(e){return e!=n?String(e).replace(S,Z):""},attr:function(e){return e!=n?String(e).replace(E,Z):e===null?e:""},url:function(e){return e!=n?encodeURI(String(e)):e===null?e:""}});_()})(this,this.jQuery);(function(e,t,n){"use strict";function x(e){return l(e)?new N(e):new T(e)}function T(e){this._data=e;return this}function N(e){this._data=e;return this}function C(e){return l(e)?[e]:e}function k(e,t){e=l(e)?e:[e];var n,r,i=t,s=i,o=e.length,u=[];for(n=0;n1){f=f[u.shift()]}a._setProperty(f,u.join("."),t,r)}}return a},_setProperty:function(e,t,n,r){var i,s,o=t?e[t]:e;if(y(o)){if(o.set){s=o;i=o.set===true?o:o.set;o=o.call(e)}}if(o!==n||r&&o!=n){if(!(o instanceof Date)||o>n||o-1&&e<=n.length){t=l(t)?t:[t];if(t.length){this._insert(e,t)}}return this},_insert:function(e,t){var n=this._data,r=n.length;f.apply(n,[e,0].concat(t));this._trigger({change:"insert",index:e,items:t},r)},remove:function(e,t){var r,i=this._data;if(e===n){e=i.length-1}e=p(e);t=t?p(t):t===0?0:1;if(t>-1&&e>-1){r=i.slice(e,e+t);t=r.length;if(t){this._remove(e,t,r)}}return this},_remove:function(e,t,n){var r=this._data,i=r.length;r.splice(e,t);this._trigger({change:"remove",index:e,items:n},i)},move:function(e,t,n){n=n?p(n):n===0?0:1;e=p(e);t=p(t);if(n>0&&e>-1&&t>-1&&e!==t){var r=this._data.slice(e,e+n);n=r.length;if(n){this._move(e,t,n,r)}}return this},_move:function(e,t,n,r){var i=this._data,s=i.length;i.splice(e,n);i.splice.apply(i,[t,0].concat(r));this._trigger({change:"move",oldIndex:e,index:t,items:r},s)},refresh:function(e){var t=this._data.slice(0);this._refresh(t,e);return this},_refresh:function(e,t){var n=this._data,r=n.length;f.apply(n,[0,n.length].concat(t));this._trigger({change:"refresh",oldItems:e},r)},_trigger:function(e,n){var r=this._data,i=r.length,s=t([r]);s.triggerHandler(v,e);if(i!==n){s.triggerHandler(d,{change:"set",path:"length",value:i,oldValue:n})}}};o[d]=o[v]={remove:function(e){if((e=e.data)&&(e.off=1,e=e.cb)){i=m[s=e._bnd]}},teardown:function(e){if(i){delete i[t.data(this,"obId")];L(i,s)}}}})(this,this.jQuery||this.jsviews);(function(e,t,n){"use strict";function ht(e){var n=this.linkedElem;if(n){pt({target:n[0],stopImmediatePropagation:t.noop},e)}}function pt(e,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,E,S,T=e.target,d=T._jsvBnd,N=/&(\d+)\+?/g;if(d){while(p=N.exec(d)){if(p=rt[p[1]]){if(E=p.to){u=p.linkCtx;h=u.view;b=u.tag;c=t(T);g=h.hlp(M);y=h.hlp(_);o=wt(T);i=R[o];if(r===n){r=w(o)?o(T):i?c[i]():c.attr(o)}f=E[1];E=E[0];if(f){if(w(f)){a=f}else{a=h.getRsc("converters",f)}}if(a){r=a.call(b,r)}m=h.linkCtx;h.linkCtx=u;S={change:"change",oldValue:u._val,value:r};if((!g||!(s=g.call(u,e,S)===false))&&(!b||!b.onBeforeChange||!(s=b.onBeforeChange(e,S)===false))&&r!==n){l=E[0];if(r!==n&&l){l=l._jsvOb?l._ob:l;if(b){b._.chging=true}x(l).setProperty(E[2]||E[1],r);if(y){y.call(u,e,S)}if(b){if(b.onAfterChange){b.onAfterChange(e,S)}delete b._.chging}}}h.linkCtx=m;if(s){e.stopImmediatePropagation()}}}}}}function dt(e,r,i){var s,o,u,a=this,f=a.data,l=a.elem,c=a.convert,h=l.parentNode,p=h,d=a.view,m=d.ctx,g=d.linkCtx,y=d.hlp(M);d.linkCtx=a;if(h&&(!y||!(r&&y.call(a,e,r)===false))&&!(r&&e.data.prop!=="*"&&e.data.prop!==r.path)){if(r){a.eventArgs=r}if(r||a._initVal){delete a._initVal;o=i.call(d.tmpl,f,d,v);s=vt(o,a,u,a.attr||wt(l,true,c!==n));if(u=a.tag){if(r&&u.onUpdate&&u.onUpdate(e,r,o)===false||s==="none"){u.tagCtxs=o=o[0]?o:[o];u.tagCtx=o[0];if(s==="html"){u.onBeforeLink&&u.onBeforeLink()}It(u,u.tagCtx);xt(a,f,l);d.linkCtx=g;return}if(u._.chging){return}o=u.tagName.slice(-1)===":"?v._cnvt(u.tagName.slice(0,-1),d,o):v._tag(u,d,d.tmpl,o,true)}else if(i._ctxs){c=c===""?"true":c;o=c?v._cnvt(c,d,o):v._tag(i._ctxs,d,d.tmpl,o,true);u=d._.tag;s=a.attr||s}if(mt(o,a,s,u)&&r&&(y=d.hlp(_))){y.call(a,e,r)}}if(u){u.contents=Ht;u.nodes=Bt;u.childTags=jt;u.currentCtxs=Ft;u.update=ht;u.refresh=Rt;It(u,u.tagCtx)}if((u=a.tag)&&u.tagName.slice(-1)!==":"){a._hdlr.array=u.onArrayChange?function(e,t){a.tag.onArrayChange(e,t)}:t.noop}xt(a,f,l);d.linkCtx=g}}function vt(e,r,i,s){var o,u,a,f,l=i&&i.parentElem||r.elem;if(e!==n){f=t(l);s=i&&i.attr||s;if(w(e)){X(r.expr+": missing parens")}if(s==="visible"){s="css-display"}if(a=/^css-/.test(s)&&s.slice(4)){o=t.style(l,a);if(+e===e){o=parseInt(o)}o=t.style(l,a)}else if(s!=="link"){if(s==="value"){if(l.type===H){o=f.prop(s=P)}}else if(s===B){if(l.value===""+e){o=f.prop(P)}else{return s}}if(o===n){u=R[s];o=u?f[u]():f.attr(s)}}r._val=o}return s}function mt(e,r,i,s){var o,u,a,f,l,c,h,p=e!==n,d=r.data,v=s&&s.parentElem||r.elem,m=t(v),g=r.view,y=r._val,b=g.ctx,w=g.linkCtx,E=s||i==="html";if(s){s.parentElem=s.parentElem||r.expr||s._elCnt?v:v.parentNode;a=s._prv;f=s._nxt}if(!p){if(i==="html"&&s&&s.onBeforeLink){s.onBeforeLink()}return}if(/^css-/.test(i)){if(i==="css-display"){e=e?yt(v):"none"}if(E=E||y!==e){t.style(v,i.slice(4),e)}}else if(i!=="link"){if(i===P){h=1;e=e&&e!=="false"}else if(i===B){if(v.value===""+e){e=true;h=1;i=P}else{xt(r,d,v);return}}else if(i==="selected"||i==="disabled"||i==="multiple"||i==="readlonly"){e=e&&e!=="false"?i:null}if(o=R[i]){if(i==="html"){g.linkCtx=r;g.ctx=r.ctx;if(s&&s._.inline){c=s.nodes(true);if(s._elCnt){if(a&&a!==f){Jt(a,f,v,s._tgId,"^",true)}a=a?a.previousSibling:f?f.previousSibling:v.lastChild}t(c).remove();if(s&&s.onBeforeLink){s.onBeforeLink()}l=g.link(g.data,v,a,f,e,s&&{tag:s._tgId,lazyLink:s.tagCtx.props.lazyLink})}else{if(p){m.empty()}if(s&&s.onBeforeLink){s.onBeforeLink()}if(p){l=g.link(d,v,a,f,e,s&&{tag:s._tgId})}}g.linkCtx=w;g.ctx=b}else if(E=E||y!==e){if(i==="text"&&v.children&&!v.children[0]){if(v.textContent!==n){v.textContent=e}else{v.innerText=e===null?"":e}}else{m[o](e)}}}else if(E=E||y!==e){m[h?"prop":"attr"](i,e===n&&!h?null:e)}r._val=e}return l||E}function gt(e,t){var n=this,r=n.hlp(M),i=n.hlp(_);if(!r||r.call(this,e,t)!==false){if(t){var s=t.change,o=t.index,u=t.items;switch(s){case"insert":n.addViews(o,u);break;case"remove":n.removeViews(o,u.length);break;case"move":n.refresh();break;case"refresh":n.refresh();break}}if(i){i.call(this,e,t)}}}function yt(t){var n,r,i=e.getComputedStyle,s=(t.currentStyle||i.call(e,t,"")).display;if(s==="none"&&!(s=tt[r=t.nodeName])){n=d.createElement(r);d.body.appendChild(n);s=(i?i.call(e,n,""):n.currentStyle).display;tt[r]=s;d.body.removeChild(n)}return s}function bt(e){var r,i,s=e.data,o=e._.bnd;if(!e._.useKey&&o){if(i=e._.bndArr){t([i[1]]).off(L,i[0]);e._.bndArr=n}if(o!==!!o&&o._.inline){if(s){o._.arrVws[e._.id]=e}else{delete o._.arrVws[e._.id]}}else if(s){r=function(t){if(!(t.data&&t.data.off)){gt.apply(e,arguments)}};t([s]).on(L,r);e._.bndArr=[r,s]}}}function wt(e,t,n){var r=e.nodeName.toLowerCase(),i=g.merge[r];return i?t?r==="input"&&e.type===B?B:i.to:i.from:t?n?"text":"html":""}function Et(e,r,i,s,o,u,a){var f,l,c,h,p,d=e.parentElem,v=e._prv,m=e._nxt,g=e._elCnt;if(v&&v.parentNode!==d){X("Missing parentNode")}if(a){h=e.nodes();if(g&&v&&v!==m){Jt(v,m,d,e._.id,"_",true)}e.removeViews(n,n,true);l=m;if(g){v=v?v.previousSibling:m?m.previousSibling:d.lastChild}t(h).remove();for(p in e._.bnds){zt(p)}}else{if(r){c=s[r-1];if(!c){return false}v=c._nxt}if(g){l=v;v=l?l.previousSibling:d.lastChild}else{l=v.nextSibling}}f=i.render(o,u,e,a||r,e._.useKey&&a,true);e.link(o,d,v,l,f,c)}function St(e,t,r){var i,s,o,u;if(r){o="^`";s=t._.tag||{_:{inline:true,bnd:r},tagCtx:{view:t},flow:true};i=s._tgId;if(!i){rt[i=it++]=s;s._tgId=""+i}}else{o="_`";nt[i=t._.id]=t}return"#"+i+o+(e===n?"":e)+"/"+i+o}function xt(e,t,r){var i,s,o,u=e.convertBack,a=e.tag,f=[],l=e._bndId||""+it++,c=e._hdlr;delete e._bndId;if(a){o=a.linkedElem,f=a.depends||f;f=w(f)?a.depends(a):f}if(!e._depends||""+e._depends!==""+f){if(e._depends){x._apply(t,e._depends,c,true)}i=x._apply(t,e.fn.paths,f,c,e._ctxCb);i.elem=r;i.linkCtx=e;i._tgId=l;r._jsvBnd=r._jsvBnd||"";r._jsvBnd+="&"+l;if(o){i.to=[[],u];s=o.length;while(s--){o[s]._jsvBnd=r._jsvBnd+"+"}}e._depends=f;e.view._.bnds[l]=l;rt[l]=i;if(a){if(a.onAfterBind){a.onAfterBind(i)}if(!a.flow&&!a._.inline){r.setAttribute(N,(r.getAttribute(N)||"")+"#"+l+"^/"+l+"^");a._tgId=""+l}}if(o||u!==n){qt(i,u)}}}function Tt(e,t,n,r,i,s){return Nt(this,e,t,n,r,i,s)}function Nt(e,r,i,u,a,f,l){if(e&&r){r=r.jquery?r:t(r);if(!s){s=d.body;t(s).on(O,pt)}var c,h,p,v,m,g,y,b,w,E=St,S=u&&u.target==="replace",x=r.length;while(x--){y=r[x];if(""+e===e){m=o(y);b=m.ctx;m.ctx=u;kt(e,y,o(y),i);m.ctx=b}else{a=a||o(y);if(e.markup!==n){if(a.link===false){u=u||{};u.link=E=false}if(S){g=y.parentNode}p=e.render(i,u,a,n,n,E);if(g){f=y.previousSibling;l=y.nextSibling;t.cleanData([y],true);g.removeChild(y);y=g}else{f=l=n;t(y).empty()}}else if(e!==true){break}if(y._dfr&&!l){v=Mt(y._dfr,true,ut);for(c=0,h=v.length;c' in:\n"+a)}}Et=wt;pt=Xt.shift();wt=G[pt];c=c?"":"";if(Et){zt+=Tt;Tt="";if(!wt){m=c+F+"@"+zt+j+(h||"");zt=Vt.shift()}else{zt+="-"}}}if(wt){if(o){Tt+=o}else{t=c||d||""}if(w){t+=w;if(Tt){t+=" "+N+'="'+Tt+'"';Tt=""}}}else{t=o?t+m+s+F+o+j+u+w:m||e}if(w){Xt.unshift(pt);pt=w.slice(1);if(Xt[0]&&Xt[0]===Y[pt]){X("Parent of
must be ")}dt=et[pt];if((wt=G[pt])&&!Et){Vt.unshift(zt);zt=""}Et=wt;if(zt&&wt){zt+="+"}}return t}function h(e,t){var s,o,u,a,f,l,c,h=[];if(e){if(e._tkns.charAt(0)==="@"){t=L.previousSibling;L.parentNode.removeChild(L);L=null}T=e.length;while(T--){M=e[T];u=M.ch;if(s=M.path){x=s.length-1;while(o=s.charAt(x--)){if(o==="+"){if(s.charAt(x)==="-"){x--;t=t.previousSibling}else{t=t.parentNode}}else{t=t.lastChild}}}if(u==="^"){if(w=rt[f=M.id]){c=t&&(!L||L.parentNode!==t);if(!L||c){w.parentElem=t}if(M.elCnt&&c){t._dfr=(M.open?"#":"/")+f+u+(t._dfr||"")}h.push([c?null:L,M])}}else if(A=nt[f=M.id]){if(!A.link){A.parentElem=t||L&&L.parentNode||r;y(A,i);A._.onRender=St;A._.onArrayChange=gt;bt(A)}a=A.parentElem;if(M.open){A._elCnt=M.elCnt;if(t){t._dfr="#"+f+u+(t._dfr||"")}else{if(!A._prv){a._dfr=At(a._dfr,"#"+f+u)}A._prv=L}}else{if(t&&(!L||L.parentNode!==t)){t._dfr="/"+f+u+(t._dfr||"");A._nxt=n}else if(L){if(!A._nxt){a._dfr=At(a._dfr,"/"+f+u)}A._nxt=L}b=A.linkCtx;if(l=A.ctx&&A.ctx.onAfterCreate||$t){l.call(b,A)}}}}T=h.length;while(T--){Wt.push(h[T])}}return!e||e.elCnt}function v(e){var t,n;if(e){T=e.length;for(x=0;x' in:\n"+a)}K.appendChild(mt);xt=Z[xt]||Z.div;ut=xt[0];vt.innerHTML=xt[1]+a+xt[2];while(ut--){vt=vt.lastChild}K.removeChild(mt);at=d.createDocumentFragment();while(ft=vt.firstChild){at.appendChild(ft)}r.insertBefore(at,u)}if(Lt){setTimeout(m,0)}else{m()}return Lt&&Lt.promise()}function kt(e,t,r,i,s,o){var f,h,p,d,v,g,y,b,w,E,S;if(s){E=rt[s];E=E.linkCtx?E.linkCtx.tag:E;w=E.linkCtx||{data:i,elem:E._elCnt?E.parentElem:t,view:r,ctx:r.ctx,attr:"html",fn:E._.bnd,tag:E,_bndId:s};Lt(w,w.fn)}else if(e&&t){f=r.tmpl;e=Pt(e,wt(t));u.lastIndex=0;while(h=u.exec(e)){S=u.lastIndex;p=s?"html":h[1];y=h[3];v=h[10];d=n;w={data:i,elem:E&&E._elCnt?E.parentElem:t,view:r,ctx:o||r.ctx,attr:p,_initVal:!h[2]};if(h[6]){if(!p&&(d=/:([\w$]*)$/.exec(v))){d=d[1];if(d!==n){g=-d.length-1;y=y.slice(0,g-1)+l;v=v.slice(0,g)}}if(d===null){d=n}w.convert=h[5]||""}w.expr=p+y;b=f.links[y];if(!b){f.links[y]=b=m.tmplFn(a+y+c,f,true,d);m.parse(v,b.paths=[],f)}w.fn=b;if(!p&&d!==n){w.convertBack=d}Lt(w,b);u.lastIndex=S}}}function Lt(e,t){function n(n,r){dt.call(e,n,r,t)}e._ctxCb=Vt(e.view);e._hdlr=n;n(true)}function At(e,t){var n;return e?(n=e.indexOf(t),n+1?e.slice(0,n)+e.slice(n+t.length):e):""}function Ot(e){return e&&(""+e===e?e:e.tagName==="SCRIPT"?e.type.slice(3):e.nodeType===1&&e.getAttribute(N)||"")}function Mt(e,t,n){function r(e,t,n,r,s,u){o.push({elCnt:i,id:r,ch:s,open:t,close:n,path:u,token:e})}var i,s,o=[];if(s=t?e:Ot(e)){o.elCnt=!e.type;i=s.charAt(0)==="@"||!e.type;o._tkns=s;s.replace(n||ct,r);return o}}function _t(e,t){if(e){if(e.type==="jsv"){e.parentNode.removeChild(e)}else if(t&&e.getAttribute(C)===""){e.removeAttribute(C)}}}function Dt(e,t){var n=e;while(t&&n&&n.nodeType!==1){n=n.previousSibling}if(n){if(n.nodeType!==1){n=d.createElement("SCRIPT");n.type="jsv";e.parentNode.insertBefore(n,e)}else if(!Ot(n)&&!n.getAttribute(C)){n.setAttribute(C,"")}}return n}function Pt(e,n){e=t.trim(e).replace(J,"\\$&");return e.slice(-1)!==l?e=f+":"+e+(n?":":"")+l:e}function Ht(e,r){if(e!==!!e){r=e;e=n}var i,s=t(this.nodes());if(s[0]){i=r?s.filter(r):s;s=e&&r?i.add(s.find(r)):i}return s}function Bt(e,t,n){var r,i=this,s=i._elCnt,o=!t&&s,u=[];t=t||i._prv;n=n||i._nxt;r=o?t===i._nxt?i.parentElem.lastSibling:t:i._.inline===false?t||i.linkCtx.elem.firstChild:t&&t.nextSibling;while(r&&(!n||r!==n)){if(e||s||r.tagName!=="SCRIPT"){u.push(r)}r=r.nextSibling}return u}function jt(e,t){if(e!==!!e){t=e;e=n}var r=this,i=r.link?r:r.tagCtx.view,s=r._prv,o=r._elCnt,u=[];if(s){i.link(n,r.parentElem,o?s.previousSibling:s,r._nxt,n,{get:{tags:u,deep:e,name:t,id:o&&r._tgId}})}return u}function Ft(){var e=this.tagCtx.view;return this._.bnd.call(e.tmpl,e.data,e,v)}function It(e,t){var r,i,s,o,u,a,f,l,c,h,p=t.view,d=e.linkCtx=e.linkCtx||{tag:e,data:p.data,view:p,ctx:p.ctx};if(e.onAfterLink){e.onAfterLink(t,d)}i=e.targetTag?e.targetTag.linkedElem:e.linkedElem;if(!e._.chging&&i&&(s=i[0])){o=s.type===B;r=d.convert;u=r?w(r)?r(t.args[0]):v._cnvt(r,p,t):t.args[0];if(s!==d.elem){c=i.length;while(c--){s=i[c];h=s._jsvLnkdEl;if(e._.inline&&(!h||h!==e&&h.targetTag!==e)){s._jsvLnkdEl=e;s._jsvBnd=d.elem?d.elem._jsvBnd:e._prv._jsvBnd;a=s._jsvBnd.slice(1).split("&");l=a.length;while(l--){qt(rt[a[l]],d.convertBack)}}if(o){s[P]=u===s.value}}}if(!o&&s.value!==n&&u!==n){if(s.type===H){s[P]=u&&u!=="false"}else{s.value=u}}}}function qt(e,t){var n,r,i,s,o=e.linkCtx,u=o.data,a=o.fn.paths;if(e){if(n=a._jsvto){a=n}r=a.length;while(r&&""+(i=a[--r])!==i){}if(i&&(!o.tag||o.tag.tagCtx.args.length)){i=a[r]=i.split("^").join(".");e.to=i.charAt(0)==="."?[[s=a[r-1],i.slice(1)],t]:[o._ctxCb(a[0])||[u,a[0]],t];if(n&&s){e.to[0][0]=o._ctxCb(s,u)}}else{e.to=[[],t]}}}function Rt(e){var t,r,i=this,s=i.linkCtx,o=i.tagCtx.view;if(i.disposed){X("Removed tag")}if(e===n){e=v._tag(i,o,o.tmpl,i.currentCtxs?i.currentCtxs():i.tagCtxs,true)}if(e+""===e){r=i._.inline?"html":s.attr||wt(i.parentElem,true);t=mt(e,s,r,i)}It(i,i.tagCtx);return t||i}function Ut(e){var t,r,i,s,o,u,a,f=[],l=e.length,c=l;while(c--){f.push(e[c])}c=l;while(c--){s=f[c];if(s.parentNode){if(a=s._jsvBnd){a=a.slice(1).split("&");s._jsvBnd="";r=a.length;while(r--){zt(a[r],s._jsvLnkdEl)}}if(o=Mt(Ot(s)+(s._dfr||""),true,at)){for(t=0,i=o.length;t',F='', - openScript = ' - data-linked tag, close marker - // TODO add validation to track whether we are in attribute context (not yet hit preceding ending with a >) or element content of current 'parentTag' - // and according disallow inserting script markers in attribute context. Similar for elCnt too, so no "
" or "
...{{/if}}..." - preceding = id - ? (preceding + endOfElCnt + spaceBefore + openScript + id + closeScript + spaceAfter + tag) - : endOfElCnt || all; - } - if (tag) { - // If there are ids (markers since the last tag), move them to the defer string - tagStack.unshift(parentTag); - parentTag = tag.slice(1); - if (tagStack[0] && tagStack[0] === badParent[parentTag]) { - // Missing - // TODO: replace this by smart insertion of tags - error('Parent of must be '); - } - isVoid = voidElems[parentTag]; - if ((elCnt = elContent[parentTag]) && !prevElCnt) { - deferStack.unshift(defer); - defer = ""; - } - prevElCnt = elCnt; -//TODO Consider providing validation which throws if you place as child of , etc. - since if not caught, -//this can cause errors subsequently which are difficult to debug. -// if (elContent[tagStack[0]]>2 && !elCnt) { -// error(parentTag + " in " + tagStack[0]); -// } - if (defer && elCnt) { - defer += "+"; // Will be used for stepping back through deferred tokens - } - } - return preceding; - } - - function processViewInfos(vwInfos, targetParent) { - // If targetParent, we are processing viewInfos (which may include navigation through '+-' paths) and hooking up to the right parentElem etc. - // (and elem may also be defined - the next node) - // If no targetParent, then we are processing viewInfos on newly inserted content - var deferPath, deferChar, bindChar, parentElem, id, onAftCr, deep, - addedBindEls = []; - - // In elCnt context (element-only content model), prevNode is the first node after the open, nextNode is the first node after the close. - // If both are null/undefined, then open and close are at end of parent content, so the view is empty, and its placeholder is the - // 'lastChild' of the parentNode. If there is a prevNode, then it is either the first node in the view, or the view is empty and - // its placeholder is the 'previousSibling' of the prevNode, which is also the nextNode. - if (vwInfos) { - //targetParent = targetParent || targetElem && targetElem.previousSibling; - //targetParent = targetElem ? targetElem.previousSibling : targetParent; - if (vwInfos._tkns.charAt(0) === "@") { - // We are processing newly inserted content. This is a special script element that was created in convertMarkers() to process deferred bindings, - // and inserted following the target parent element - because no element tags (outside elCnt) were encountered to carry those binding tokens. - // We will step back from the preceding sibling of this element, looking at targetParent elements until we find the one that the current binding - // token belongs to. Set elem to null (the special script element), and remove it from the DOM. - targetParent = elem.previousSibling; - elem.parentNode.removeChild(elem); - elem = null; - } - len = vwInfos.length; - while (len--) { - vwInfo = vwInfos[len]; - //if (prevIds.indexOf(vwInfo.token) < 0) { // This token is a newly created view or tag binding - bindChar = vwInfo.ch; - if (deferPath = vwInfo.path) { - // We have a 'deferred path' - j = deferPath.length - 1; - while (deferChar = deferPath.charAt(j--)) { - // Use the "+" and"-" characters to navigate the path back to the original parent node where the deferred bindings ocurred - if (deferChar === "+") { - if (deferPath.charAt(j) === "-") { - j--; - targetParent = targetParent.previousSibling; - } else { - targetParent = targetParent.parentNode; - } - } else { - targetParent = targetParent.lastChild; - } - // Note: Can use previousSibling and lastChild, not previousElementSibling and lastElementChild, - // since we have removed white space within elCnt. Hence support IE < 9 - } - } - if (bindChar === "^") { - if (tag = bindingStore[id = vwInfo.id]) { - // The binding may have been deleted, for example in a different handler to an array collectionChange event - // This is a tag binding - deep = targetParent && (!elem || elem.parentNode !== targetParent); // We are stepping back looking for the right targetParent, - // or we are linking existing content and this element is in elCnt, not an immediate child of the targetParent. - if (!elem || deep) { - tag.parentElem = targetParent; - } - if (vwInfo.elCnt && deep) { - // With element only content, if there is no following element, or if the binding is deeper than the following element - // then we need to set the open or close token as a deferred binding annotation on the parent - targetParent._dfr = (vwInfo.open ? "#" : "/") + id + bindChar + (targetParent._dfr || ""); - } - // This is an open or close marker for a data-linked tag {^{...}}. Add it to bindEls. - addedBindEls.push([deep ? null : elem, vwInfo]); - } - } else if (view = viewStore[id = vwInfo.id]) { - // The view may have been deleted, for example in a different handler to an array collectionChange event - if (!view.link) { - // If view is not already extended for JsViews, extend and initialize the view object created in JsRender, as a JsViews view - view.parentElem = targetParent || elem && elem.parentNode || parentNode; - $extend(view, LinkedView); - view._.onRender = addBindingMarkers; - view._.onArrayChange = arrayChangeHandler; - setArrayChangeLink(view); - } - parentElem = view.parentElem; - if (vwInfo.open) { - // This is an 'open view' node (preceding script marker node, - // or if elCnt, the first element in the view, with a data-jsv annotation) for binding - view._elCnt = vwInfo.elCnt; - if (targetParent) { - targetParent._dfr = "#" + id + bindChar + (targetParent._dfr || ""); - } else { - // No targetParent, so there is a ._nxt elem (and this is processing tokens on the elem) - if (!view._prv) { - parentElem._dfr = removeSubStr(parentElem._dfr, "#" + id + bindChar); - } - view._prv = elem; - } - } else { - // This is a 'close view' marker node for binding - if (targetParent && (!elem || elem.parentNode !== targetParent)) { - // There is no ._nxt so add token to _dfr. It is deferred. - targetParent._dfr = "/" + id + bindChar + (targetParent._dfr || ""); - view._nxt = undefined; - } else if (elem) { - // This view did not have a ._nxt, but has one now, so token may be in _dfr, and must be removed. (No longer deferred) - if (!view._nxt) { - parentElem._dfr = removeSubStr(parentElem._dfr, "/" + id + bindChar); - } - view._nxt = elem; - } - linkCtx = view.linkCtx; - if (onAftCr = view.ctx && view.ctx.onAfterCreate || onAfterCreate) { - onAftCr.call(linkCtx, view); - } - } - //} - } - } - len = addedBindEls.length; - while (len--) { - // These were added in reverse order to addedBindEls. We push them in BindEls in the correct order. - bindEls.push(addedBindEls[len]); - } - } - return !vwInfos || vwInfos.elCnt; - } - - function getViewInfos(vwInfos) { - // Used by view.childTags() and tag.childTags() - // Similar to processViewInfos in how it steps through bindings to find tags. Only finds data-linked tags. - var level, parentTag; - - if (vwInfos) { - len = vwInfos.length; - for (j = 0; j < len; j++) { - vwInfo = vwInfos[j]; - if (get.id) { - get.id = get.id !== vwInfo.id && get.id; - } else { - // This is an open marker for a data-linked tag {^{...}}, within the content of the tag whose id is get.id. Add it to bindEls. - parentTag = tag = bindingStore[vwInfo.id].linkCtx.tag; - if (!tag.flow) { - if (!deep) { - level = 1; - while (parentTag = parentTag.parent) { - level++; - } - tagDepth = tagDepth || level; // The level of the first tag encountered. - } - if ((deep || level === tagDepth) && (!tagName || tag.tagName === tagName)) { - // Filter on top-level or tagName as appropriate - tags.push(tag); - } - } - } - } - } - } - - function dataLink() { - //================ Data-link and fixup of data-jsv annotations ================ - elems = qsa ? parentNode.querySelectorAll(linkViewsSel) : $(linkViewsSel, parentNode).get(); - l = elems.length; - - // The prevNode will be in the returned query, since we called markPrevOrNextNode() on it. - // But it may have contained nodes that satisfy the selector also. - if (prevNode && prevNode.innerHTML) { - // Find the last contained node of prevNode, to use as the prevNode - so we only link subsequent elems in the query - prevNodes = qsa ? prevNode.querySelectorAll(linkViewsSel) : $(linkViewsSel, prevNode).get(); - prevNode = prevNodes.length ? prevNodes[prevNodes.length - 1] : prevNode; - } - - tagDepth = 0; - for (i = 0; i < l; i++) { - elem = elems[i]; - if (prevNode && !found) { - // If prevNode is set, not false, skip linking. If this element is the prevNode, set to false so subsequent elements will link. - found = (elem === prevNode); - } else if (nextNode && elem === nextNode) { - // If nextNode is set then break when we get to nextNode - break; - } else if (elem.parentNode - // elem has not been removed from DOM - && processInfos(viewInfos(elem, undefined, tags && rOpenTagMarkers)) - // If a link() call, processViewInfos() adds bindings to bindEls, and returns true for non-script nodes, for adding data-link bindings - // If a childTags() call, getViewInfos returns array of tag bindings. - && !get && elem.getAttribute($viewsLinkAttr)) { - bindEls.push([elem]); // A data-linked element so add to bindEls too - } - } - - // Remove temporary marker script nodes they were added by markPrevOrNextNode - unmarkPrevOrNextNode(prevNode, elCnt); - unmarkPrevOrNextNode(nextNode, elCnt); - - if (get) { - lazyLink && lazyLink.resolve(); - return; - } - - if (elCnt && defer + ids) { - // There are some views with elCnt, for which the open or close did not precede any HTML tag - so they have not been processed yet - elem = nextNode; - if (defer) { - if (nextNode) { - processViewInfos(viewInfos(defer + "+", true), nextNode); - } else { - processViewInfos(viewInfos(defer, true), parentNode); - } - } - processViewInfos(viewInfos(ids, true), parentNode); - // If there were any tokens on nextNode which have now been associated with inserted HTML tags, remove them from nextNode - if (nextNode) { - tokens = nextNode.getAttribute(jsvAttrStr); - if (l = tokens.indexOf(prevIds) + 1) { - tokens = tokens.slice(l + prevIds.length - 1); - } - nextNode.setAttribute(jsvAttrStr, ids + tokens); - } - } - - //================ Bind the data-linked elements and tags ================ - l = bindEls.length; - for (i = 0; i < l; i++) { - elem = bindEls[i]; - linkInfo = elem[1]; - elem = elem[0]; - if (linkInfo) { - tag = bindingStore[linkInfo.id]; - if (linkCtx = tag.linkCtx) { - // The tag may have been stored temporarily on the bindingStore - or may have already been replaced by the actual binding - tag = linkCtx.tag; - tag.linkCtx = linkCtx; - } - if (linkInfo.open) { - // This is an 'open linked tag' binding annotation for a data-linked tag {^{...}} - if (elem) { - tag.parentElem = elem.parentNode; - tag._prv = elem; - } - tag._elCnt = linkInfo.elCnt; - if (tag && (!tag.onBeforeLink || tag.onBeforeLink() !== false) && !tag._.bound) { - // By default we data-link depth-last ("on the way in"), which is better for perf. But if a tag needs nested tags to be linked (refreshed) - // first, before linking its content, then make onBeforeLink() return false. In that case we data-link depth-first ("on the way out"), so nested tags will have already refreshed. - tag._.bound = true; - view = tag.tagCtx.view; - addDataBinding(undefined, tag._prv, view, view.data||outerData, linkInfo.id); - } - - tag._.linking = true; - } else { - tag._nxt = elem; - if (tag._.linking) { - // This is a 'close linked tag' binding annotation - // Add data binding - tagCtx = tag.tagCtx; - view = tagCtx.view; - tag.contents = getContents; - tag.nodes = getNodes; - tag.childTags = getChildTags; - tag.currentCtxs = getCurrentCtxs; - tag.update = updateTag; - tag.refresh = refreshTag; - delete tag._.linking; - if (!tag._.bound) { - tag._.bound = true; - addDataBinding(undefined, tag._prv, view, view.data||outerData, linkInfo.id); - } - callAfterLink(tag, tagCtx); - } - } - } else { - view = $view(elem); - // Add data binding for a data-linked element (with data-link attribute) - addDataBinding(elem.getAttribute($viewsLinkAttr), elem, view, view.data||outerData, undefined, context); - } - } - lazyLink && lazyLink.resolve(); - } - //==== /end of nested functions ==== - - var linkCtx, tag, i, l, j, len, elems, elem, view, vwInfos, vwInfo, linkInfo, prevNodes, token, prevView, nextView, node, tags, deep, tagName, tagCtx, cvt, - tagDepth, get, depth, fragment, copiedNode, firstTag, parentTag, isVoid, wrapper, div, tokens, elCnt, prevElCnt, htmlTag, ids, prevIds, found, lazyLink, linkedElem, - noDomLevel0 = $viewsSettings.noDomLevel0, - self = this, - thisId = self._.id + "_", - defer = "", - // The marker ids for which no tag was encountered (empty views or final closing markers) which we carry over to container tag - bindEls = [], - tagStack = [], - deferStack = [], - onAfterCreate = self.hlp(onAfterCreateStr), - processInfos = processViewInfos; - - if (refresh) { - lazyLink = refresh.lazyLink && $.Deferred(); - if (refresh.tmpl) { - // refresh is the prevView, passed in from addViews() - prevView = "/" + refresh._.id + "_"; - } else { - get = refresh.get; - if (refresh.tag) { - thisId = refresh.tag + "^"; - refresh = true; - } - } - refresh = refresh === true; - } - - if (get) { - processInfos = getViewInfos; - tags = get.tags; - deep = get.deep; - tagName = get.name; - } - - parentNode = parentNode - ? ("" + parentNode === parentNode - ? $(parentNode)[0] // It is a string, so treat as selector - : parentNode.jquery - ? parentNode[0] // A jQuery object - take first element. - : parentNode) - : (self.parentElem // view.link() - || document.body); // link(null, data) to link the whole document - - parentTag = parentNode.tagName.toLowerCase(); - elCnt = !!elContent[parentTag]; - - prevNode = prevNode && markPrevOrNextNode(prevNode, elCnt); - nextNode = nextNode && markPrevOrNextNode(nextNode, elCnt) || null; - - if (html !== undefined) { - //================ Insert html into DOM using documentFragments (and wrapping HTML appropriately). ================ - // Also convert markers to DOM annotations, based on content model. - // Corresponds to nextNode ? $(nextNode).before(html) : $(parentNode).html(html); - // but allows insertion to wrap correctly even with inserted script nodes. jQuery version will fail e.g. under tbody or select. - // This version should also be slightly faster - div = document.createElement("div"); - wrapper = div; - prevIds = ids = ""; - htmlTag = parentNode.namespaceURI === "http://www.w3.org/2000/svg" ? "svg_ns" : (firstTag = rFirstElem.exec(html)) && firstTag[1] || ""; - if (noDomLevel0 && firstTag && firstTag[2]) { - error("Unsupported: " + firstTag[2]); // For security reasons, don't allow insertion of elements with onFoo attributes. - } - if (elCnt) { - // Now look for following view, and find its tokens, or if not found, get the parentNode._dfr tokens - node = nextNode; - while (node && !(nextView = viewInfos(node))) { - node = node.nextSibling; - } - if (tokens = nextView ? nextView._tkns : parentNode._dfr) { - token = prevView || ""; - if (refresh || !prevView) { - token += "#" + thisId; - } - j = tokens.indexOf(token); - if (j + 1) { - j += token.length; - // Transfer the initial tokens to inserted nodes, by setting them as the ids variable, picked up in convertMarkers - prevIds = ids = tokens.slice(0, j); - tokens = tokens.slice(j); - if (nextView) { - node.setAttribute(jsvAttrStr, tokens); - } else { - parentNode._dfr = tokens; - } - } - } - } - - //================ Convert the markers to DOM annotations, based on content model. ================ -// oldElCnt = elCnt; - isVoid = undefined; - html = ("" + html).replace(rConvertMarkers, convertMarkers); -// if (!!oldElCnt !== !!elCnt) { -// error("Parse: " + html); // Parse error. Content not well-formed? -// } - if (validate && tagStack.length) { - syntaxError("Mismatched '<" + parentTag + "...>' in:\n" + html); // Unmatched tag - } - // Append wrapper element to doc fragment - safeFragment.appendChild(div); - - // Go to html and back, then peel off extra wrappers - // Corresponds to jQuery $(nextNode).before(html) or $(parentNode).html(html); - // but supports svg elements, and other features missing from jQuery version (and this version should also be slightly faster) - htmlTag = wrapMap[htmlTag] || wrapMap.div; - depth = htmlTag[0]; - wrapper.innerHTML = htmlTag[1] + html + htmlTag[2]; - while (depth--) { - wrapper = wrapper.lastChild; - } - safeFragment.removeChild(div); - fragment = document.createDocumentFragment(); - while (copiedNode = wrapper.firstChild) { - fragment.appendChild(copiedNode); - } - // Insert into the DOM - parentNode.insertBefore(fragment, nextNode); - } - - if (lazyLink) { - setTimeout(dataLink, 0); - } else { - dataLink(); - } - - return lazyLink && lazyLink.promise(); - } - - function addDataBinding(linkMarkup, node, currentView, data, boundTagId, context) { - // Add data binding for data-linked elements or {^{...}} data-linked tags - var tmpl, tokens, attr, convertBack, params, trimLen, tagExpr, linkFn, linkCtx, tag, rTagIndex; - - if (boundTagId) { - // {^{...}} data-linked tag. So only one linkTag in linkMarkup - tag = bindingStore[boundTagId]; - tag = tag.linkCtx ? tag.linkCtx.tag : tag; - - linkCtx = tag.linkCtx || { - data: data, // source - elem: tag._elCnt ? tag.parentElem : node, // target - view: currentView, - ctx: currentView.ctx, - attr: "html", // Script marker nodes are associated with {^{ and always target HTML. - fn: tag._.bnd, - tag: tag, - // Pass the boundTagId in the linkCtx, so that it can be picked up in observeAndBind - _bndId: boundTagId - }; - bindDataLinkTarget(linkCtx, linkCtx.fn); - } else if (linkMarkup && node) { - // Compiled linkFn expressions could be stored in the tmpl.links array of the template - // TODO - consider also caching globally so that if {{:foo}} or data-link="foo" occurs in different places, - // the compiled template for this is cached and only compiled once... - //links = currentView.links || currentView.tmpl.links; - - tmpl = currentView.tmpl; - -// if (!(linkTags = links[linkMarkup])) { - // This is the first time this view template has been linked, so we compile the data-link expressions, and store them on the template. - - linkMarkup = normalizeLinkTag(linkMarkup, defaultAttr(node)); - rTag.lastIndex = 0; - while (tokens = rTag.exec(linkMarkup)) { // TODO require } to be followed by whitespace or $, and remove the \}(!\}) option. - // Iterate over the data-link expressions, for different target attrs, - // (only one if there is a boundTagId - the case of data-linked tag {^{...}}) - // e.g. )|!--((?:[^-]|-(?!-))*)--|(\*)))\s*((?:[^}]|}(?!}))*?))}) - return this; - })(); - - //=============== - // Public helpers - //=============== - - $viewsSub.viewInfos = viewInfos; - // Expose viewInfos() as public helper method - - //==================================== - // Additional members for linked views - //==================================== - - function transferViewTokens(prevNode, nextNode, parentElem, id, viewOrTagChar, refresh) { - // Transfer tokens on prevNode of viewToRemove/viewToRefresh to nextNode or parentElem._dfr - var i, l, vwInfos, vwInfo, viewOrTag, viewId, tokens, - precedingLength = 0, - emptyView = prevNode === nextNode; - - if (prevNode) { - // prevNode is either the first node in the viewOrTag, or has been replaced by the vwInfos tokens string - vwInfos = viewInfos(prevNode) || []; - for (i = 0, l = vwInfos.length; i < l; i++) { - // Step through views or tags on the prevNode - vwInfo = vwInfos[i]; - viewId = vwInfo.id; - if (viewId === id && vwInfo.ch === viewOrTagChar) { - if (refresh) { - // This is viewOrTagToRefresh, this is the last viewOrTag to process... - l = 0; - } else { - // This is viewOrTagToRemove, so we are done... - break; - } - } - if (!emptyView) { - viewOrTag = vwInfo.ch === "_" - ? viewStore[viewId] - : bindingStore[viewId].linkCtx.tag; - if (vwInfo.open) { - // A "#m" token - viewOrTag._prv = nextNode; - } else if (vwInfo.close) { - // A "/m" token - viewOrTag._nxt = nextNode; - } - } - precedingLength += viewId.length + 2; - } - - if (precedingLength) { - prevNode.setAttribute(jsvAttrStr, prevNode.getAttribute(jsvAttrStr).slice(precedingLength)); - } - tokens = nextNode ? nextNode.getAttribute(jsvAttrStr) : parentElem._dfr; - if (l = tokens.indexOf("/" + id + viewOrTagChar) + 1) { - tokens = vwInfos._tkns.slice(0, precedingLength) + tokens.slice(l + (refresh ? -1 : id.length + 1)); - } - if (tokens) { - if (nextNode) { - // If viewOrTagToRemove was an empty viewOrTag, we will remove both #n and /n - // (and any intervening tokens) from the nextNode (=== prevNode) - // If viewOrTagToRemove was not empty, we will take tokens preceding #n from prevNode, - // and concatenate with tokens following /n on nextNode - nextNode.setAttribute(jsvAttrStr, tokens); - } else { - parentElem._dfr = tokens; - } - } - } else { - // !prevNode, so there may be a deferred nodes token on the parentElem. Remove it. - parentElem._dfr = removeSubStr(parentElem._dfr, "#" + id + viewOrTagChar); - if (!refresh && !nextNode) { - // If this viewOrTag is being removed, and there was no .nxt, remove closing token from deferred tokens - parentElem._dfr = removeSubStr(parentElem._dfr, "/" + id + viewOrTagChar); - } - } - } - - LinkedView = { - // Note: a linked view will also, after linking have nodes[], _prv (prevNode), _nxt (nextNode) ... - addViews: function(index, dataItems, tmpl) { - // if view is not an array view, do nothing - var i, viewsCount, - self = this, - itemsCount = dataItems.length, - views = self.views; - - if (!self._.useKey && itemsCount && (tmpl = self.tmpl)) { - // view is of type "array" - // Use passed-in template if provided, since self added view may use a different template than the original one used to render the array. - viewsCount = views.length + itemsCount; - - if (renderAndLink(self, index, tmpl, views, dataItems, self.ctx) !== false) { - for (i = index + itemsCount; i < viewsCount; i++) { - $observable(views[i]).setProperty("index", i); - // This is fixing up index, but not key, and not index on child views. From child views, use view.getIndex() - } - } - } - return self; - }, - - removeViews: function(index, itemsCount, keepNodes) { - // view.removeViews() removes all the child views - // view.removeViews(index) removes the child view with specified index or key - // view.removeViews(index, count) removes the specified nummber of child views, starting with the specified index - function removeView(index) { - var id, bindId, parentElem, prevNode, nextNode, nodesToRemove, - viewToRemove = views[index]; - - if (viewToRemove && viewToRemove.link) { - id = viewToRemove._.id; - if (!keepNodes) { - // Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views - nodesToRemove = viewToRemove.nodes(); - } - - // Remove child views, without removing nodes - viewToRemove.removeViews(undefined, undefined, true); - - viewToRemove.data = undefined; // Set data to undefined: used as a flag that this view is being removed - prevNode = viewToRemove._prv; - nextNode = viewToRemove._nxt; - parentElem = viewToRemove.parentElem; - // If prevNode and nextNode are the same, the view is empty - if (!keepNodes) { - // Remove the HTML nodes from the DOM, unless they have already been removed, including nodes of child views - if (viewToRemove._elCnt) { - // if keepNodes is false (and transferring of tokens has not already been done at a higher level) - // then transfer tokens from prevNode which is being removed, to nextNode. - transferViewTokens(prevNode, nextNode, parentElem, id, "_"); - } - $(nodesToRemove).remove(); - } - if (!viewToRemove._elCnt) { - prevNode.parentNode && parentElem.removeChild(prevNode); - nextNode.parentNode && parentElem.removeChild(nextNode); - } - setArrayChangeLink(viewToRemove); - for (bindId in viewToRemove._.bnds) { - removeViewBinding(bindId); - } - delete viewStore[id]; - } - } - - var current, view, viewsCount, - self = this, - isArray = !self._.useKey, - views = self.views; - - if (isArray) { - viewsCount = views.length; - } - if (index === undefined) { - // Remove all child views - if (isArray) { - // views and data are arrays - current = viewsCount; - while (current--) { - removeView(current); - } - self.views = []; - } else { - // views and data are objects - for (view in views) { - // Remove by key - removeView(view); - } - self.views = {}; - } - } else { - if (itemsCount === undefined) { - if (isArray) { - // The parentView is data array view. - // Set itemsCount to 1, to remove this item - itemsCount = 1; - } else { - // Remove child view with key 'index' - removeView(index); - delete views[index]; - } - } - if (isArray && itemsCount) { - current = index + itemsCount; - // Remove indexed items (parentView is data array view); - while (current-- > index) { - removeView(current); - } - views.splice(index, itemsCount); - if (viewsCount = views.length) { - // Fixup index on following view items... - while (index < viewsCount) { - $observable(views[index]).setProperty("index", index++); - } - } - } - } - return this; - }, - - refresh: function(context) { - var self = this, - parent = self.parent; - - if (parent) { - renderAndLink(self, self.index, self.tmpl, parent.views, self.data, context, true); - setArrayChangeLink(self); - } - return self; - }, - - nodes: getNodes, - contents: getContents, - childTags: getChildTags, - link: viewLink - }; - - //========================= - // Extend $.views.settings - //========================= - - $viewsSettings.merge = { - input: { - from: inputAttrib, to: "value" - }, - textarea: valueBinding, - select: valueBinding, - optgroup: { - to: "label" - } - }; - - if ($viewsSettings.debugMode) { - // In debug mode create global for accessing views, etc - validate = !$viewsSettings.noValidate; - global._jsv = { - views: viewStore, - bindings: bindingStore - }; - } - - //======================== - // JsViews-specific converters - //======================== - - $converters.merge = function(val) { - // Special converter used in data-linking to space-separated lists, such as className: - // Currently only supports toggle semantics - and has no effect if toggle string is not specified - // data-link="class{merge:boolExpr toggle=className}" - var regularExpression, - currentValue = this.linkCtx._val || "", - toggle = this.tagCtx.props.toggle; - - if (toggle) { - // We are toggling the class specified by the toggle property, - // and the boolean val binding is driving the insert/remove toggle - - regularExpression = toggle.replace(/[\\^$.|?*+()[{]/g, "\\$&"); - // Escape any regular expression special characters (metacharacters) within the toggle string - regularExpression = "(\\s(?=" + regularExpression + "$)|(\\s))?(" + regularExpression + "(\\s|$))" - - currentValue = currentValue.replace(new RegExp(regularExpression), "$2") - val = currentValue + (val ? (currentValue && " ") + toggle : "") - } - return val; - }; - - //======================== - // JsViews-specific tags - //======================== - - $views.tags("on", { - attr: "none", - onAfterLink: function(tagCtx, linkCtx) { - var self = this, - elem = $(linkCtx.elem), - args = tagCtx.args, - data = tagCtx.props.data, - handler = args.pop(), - selector = args[1] || null, - contextOb = tagCtx.props.context; - - data = data !== undefined ? data : null; - handler = handler.fn && contextOb ? handler.fn : handler; //??VERIFY - elem.on(args[0], selector, data, function(ev) { - handler.call(contextOb || self.leaf, ev); - }); - }, - onAfterBind: function(binding) { - this.leaf = binding.leaf; - }, - flow: true - }); - - //======================== - // Extend jQuery namespace - //======================== - - $extend($, { - - //======================= - // jQuery $.view() plugin - //======================= - - view: $views.view = $view = function(node, inner, type) { - // $.view() returns top view - // $.view(node) returns view that contains node - // $.view(selector) returns view that contains first selected element - // $.view(nodeOrSelector, type) returns nearest containing view of given type - // $.view(nodeOrSelector, "root") returns root containing view (child of top view) - // $.view(nodeOrSelector, true, type) returns nearest inner (contained) view of given type - - if (inner !== !!inner) { - // inner not boolean, so this is view(nodeOrSelector, type) - type = inner; - inner = undefined; - } - var view, vwInfos, i, j, k, l, elem, elems, - level = 0, - body = document.body; - - if (node && node !== body && topView._.useKey > 1) { - // Perf optimization for common cases - - node = "" + node === node - ? $(node)[0] - : node.jquery - ? node[0] - : node; - - if (node) { - if (inner) { - // Treat supplied node as a container element and return the first view encountered. - elems = qsa ? node.querySelectorAll(bindElsSel) : $(bindElsSel, node).get(); - l = elems.length; - for (i = 0; i < l; i++) { - elem = elems[i]; - vwInfos = viewInfos(elem, undefined, rOpenViewMarkers); - - for (j = 0, k = vwInfos.length; j < k; j++) { - view = vwInfos[j]; - if (view = viewStore[view.id]) { - view = view && type ? view.get(true, type) : view; - if (view) { - return view; - } - } - } - } - } else { - while (node) { - // Move back through siblings and up through parents to find preceding node which is a _prv (prevNode) - // script marker node for a non-element-content view, or a _prv (first node) for an elCnt view - if (vwInfos = viewInfos(node, undefined, rViewMarkers)) { - l = vwInfos.length; - while (l--) { - view = vwInfos[l]; - if (view.open) { - if (level < 1) { - view = viewStore[view.id]; - return view && type ? view.get(type) : view || topView; - } - level--; - } else { - // level starts at zero. If we hit a view.close, then we move level to 1, and we don't return a view until - // we are back at level zero (or a parent view with level < 0) - level++; - } - } - } - node = node.previousSibling || node.parentNode; - } - } - } - } - return inner ? undefined : topView; - }, - - link: $views.link = $link, - unlink: $views.unlink = $unlink, - - //===================== - // override $.cleanData - //===================== - cleanData: function(elems) { - if (elems.length) { - // Remove JsViews bindings. Also, remove from the DOM any corresponding script marker nodes - clean(elems); - // (elems HTMLCollection no longer includes removed script marker nodes) - oldCleanData.call($, elems); - } - } - }); - - //=============================== - // Extend jQuery instance plugins - //=============================== - - $extend($.fn, { - link: function(expr, from, context, parentView, prevNode, nextNode) { - return $link(expr, this, from, context, parentView, prevNode, nextNode); - }, - unlink: function(expr) { - return $unlink(expr, this); - }, - view: function(type) { - return $view(this[0], type); - } - }); - - //=============== - // Extend topView - //=============== - - $extend(topView, {tmpl: {links: {}, tags: {}}}); - $extend(topView, LinkedView); - topView._.onRender = addBindingMarkers; - -//TODO -// Tests for {{props}} tag. -// add tests for "on" binding. -// Tests for different attr settings on tags -// tests of onAfterBind extensibility -})(this, this.jQuery);