From 18863bee7fecab07d873e559180de98293fde31b Mon Sep 17 00:00:00 2001 From: TuxCoder Date: Fri, 8 Apr 2022 21:29:23 +0200 Subject: [PATCH] move migration, bugfixes, .... --- MANIFEST.in | 1 + browser_app/index.js | 3 + lenticular_cloud/app.py | 6 +- lenticular_cloud/application.cfg | 1 + lenticular_cloud/cli.py | 5 +- .../migrations}/README | 0 .../migrations}/alembic.ini | 0 .../migrations}/env.py | 0 .../migrations}/script.py.mako | 0 .../versions/52a21983d2a8_add_webauthn.py | 2 +- .../migrations}/versions/ff2f2e871dfc_init.py | 0 lenticular_cloud/model.py | 2 +- lenticular_cloud/static/main.js | 2 +- lenticular_cloud/static/main.js.LICENSE.txt | 2 + lenticular_cloud/static/main.js.map | 2 +- .../template/frontend/webauthn_list.html | 30 ++++ .../template/frontend/webauthn_register.html | 140 ++++++++++++++++++ lenticular_cloud/template/skelet.html.j2 | 5 +- lenticular_cloud/views/admin.py | 3 +- lenticular_cloud/views/api.py | 40 ++++- lenticular_cloud/views/auth.py | 1 + lenticular_cloud/views/frontend.py | 26 ++-- lenticular_cloud/views/oauth2.py | 2 +- package-lock.json | 14 ++ package.json | 1 + 25 files changed, 255 insertions(+), 33 deletions(-) rename {migrations => lenticular_cloud/migrations}/README (100%) rename {migrations => lenticular_cloud/migrations}/alembic.ini (100%) rename {migrations => lenticular_cloud/migrations}/env.py (100%) rename {migrations => lenticular_cloud/migrations}/script.py.mako (100%) rename {migrations => lenticular_cloud/migrations}/versions/52a21983d2a8_add_webauthn.py (94%) rename {migrations => lenticular_cloud/migrations}/versions/ff2f2e871dfc_init.py (100%) create mode 100644 lenticular_cloud/template/frontend/webauthn_list.html create mode 100644 lenticular_cloud/template/frontend/webauthn_register.html diff --git a/MANIFEST.in b/MANIFEST.in index a95d7d4..50e47fa 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ recursive-include lenticular_cloud/template * recursive-include lenticular_cloud/static ** +recursive-include lenticular_cloud/migrations ** include lenticular_cloud/*.cfg diff --git a/browser_app/index.js b/browser_app/index.js index e371e7b..86dc750 100644 --- a/browser_app/index.js +++ b/browser_app/index.js @@ -4,6 +4,7 @@ import 'jquery-form' import {ConfirmDialog, Dialog} from './confirm-modal.js'; jQuery = window.$ = window.jQuery = require('jquery'); +var cbor = require('cbor-web'); var forge = require('node-forge'); var QRCode = require("qrcode-svg"); var pki = require('node-forge/lib/pki'); @@ -16,6 +17,8 @@ const $ = document.querySelector.bind(document); const $$ = document.querySelectorAll.bind(document); +window.CBOR = cbor; + /* Convert an ArrayBuffer into a string from https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String diff --git a/lenticular_cloud/app.py b/lenticular_cloud/app.py index 2955da3..f21c093 100644 --- a/lenticular_cloud/app.py +++ b/lenticular_cloud/app.py @@ -6,6 +6,7 @@ import subprocess from ory_hydra_client import Client import os +from pathlib import Path from ldap3 import Connection, Server, ALL from . import model @@ -32,13 +33,14 @@ def create_app() -> Flask: #app.ldap_orm = Connection(app.config['LDAP_URL'], app.config['LDAP_BIND_DN'], app.config['LDAP_BIND_PW'], auto_bind=True) server = Server(app.config['LDAP_URL'], get_info=ALL) - app.ldap_conn = Connection(server, app.config['LDAP_BIND_DN'], app.config['LDAP_BIND_PW'], auto_bind="DEFAULT") + app.ldap_conn = Connection(server, app.config['LDAP_BIND_DN'], app.config['LDAP_BIND_PW'], auto_bind=True) # TODO auto_bind read docu model.ldap_conn = app.ldap_conn model.base_dn = app.config['LDAP_BASE_DN'] from .model import db, migrate db.init_app(app) - migrate.init_app(app, db) + migration_dir = Path(app.root_path) / 'migrations' + migrate.init_app(app, db, directory=str(migration_dir)) # with app.app_context(): # db.create_all() diff --git a/lenticular_cloud/application.cfg b/lenticular_cloud/application.cfg index 2303459..15ef56d 100644 --- a/lenticular_cloud/application.cfg +++ b/lenticular_cloud/application.cfg @@ -5,6 +5,7 @@ PREFERRED_URL_SCHEME = 'https' DATA_FOLDER = "../data" +SCRIPT_LOCATION="lenticular_cloud:migrations" SQLALCHEMY_DATABASE_URI = f'sqlite:///{DATA_FOLDER}/db.sqlite' SQLALCHEMY_TRACK_MODIFICATIONS=False diff --git a/lenticular_cloud/cli.py b/lenticular_cloud/cli.py index 7c205c9..c35dbc5 100644 --- a/lenticular_cloud/cli.py +++ b/lenticular_cloud/cli.py @@ -3,6 +3,7 @@ from .model import db, User, UserSignUp from .app import create_app from werkzeug.middleware.proxy_fix import ProxyFix from flask_migrate import upgrade +from pathlib import Path import logging import os @@ -78,7 +79,9 @@ def cli_run(app, args): app.run(debug=True, host='127.0.0.1', port=5000) def cli_db_upgrade(args): - upgrade() + app = create_app() + migration_dir = Path(app.root_path) / 'migrations' + upgrade( str(migration_dir) ) if __name__ == "__main__": diff --git a/migrations/README b/lenticular_cloud/migrations/README similarity index 100% rename from migrations/README rename to lenticular_cloud/migrations/README diff --git a/migrations/alembic.ini b/lenticular_cloud/migrations/alembic.ini similarity index 100% rename from migrations/alembic.ini rename to lenticular_cloud/migrations/alembic.ini diff --git a/migrations/env.py b/lenticular_cloud/migrations/env.py similarity index 100% rename from migrations/env.py rename to lenticular_cloud/migrations/env.py diff --git a/migrations/script.py.mako b/lenticular_cloud/migrations/script.py.mako similarity index 100% rename from migrations/script.py.mako rename to lenticular_cloud/migrations/script.py.mako diff --git a/migrations/versions/52a21983d2a8_add_webauthn.py b/lenticular_cloud/migrations/versions/52a21983d2a8_add_webauthn.py similarity index 94% rename from migrations/versions/52a21983d2a8_add_webauthn.py rename to lenticular_cloud/migrations/versions/52a21983d2a8_add_webauthn.py index 1d503d5..63106a2 100644 --- a/migrations/versions/52a21983d2a8_add_webauthn.py +++ b/lenticular_cloud/migrations/versions/52a21983d2a8_add_webauthn.py @@ -20,7 +20,7 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('webauthn_credential', sa.Column('id', sa.Integer(), nullable=False), - sa.Column('user_id', sa.Integer(), nullable=False), + sa.Column('user_id', sa.String(length=36), nullable=False), sa.Column('user_handle', sa.String(length=64), nullable=False), sa.Column('credential_data', sa.LargeBinary(), nullable=False), sa.Column('name', sa.String(length=250), nullable=True), diff --git a/migrations/versions/ff2f2e871dfc_init.py b/lenticular_cloud/migrations/versions/ff2f2e871dfc_init.py similarity index 100% rename from migrations/versions/ff2f2e871dfc_init.py rename to lenticular_cloud/migrations/versions/ff2f2e871dfc_init.py diff --git a/lenticular_cloud/model.py b/lenticular_cloud/model.py index b5356a9..72a097d 100644 --- a/lenticular_cloud/model.py +++ b/lenticular_cloud/model.py @@ -340,7 +340,7 @@ class WebauthnCredential(db.Model): # pylint: disable=too-few-public-methods """Webauthn credential model""" id = db.Column(db.Integer, primary_key=True) - user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='CASCADE'), nullable=False) + user_id = db.Column(db.String(length=36), db.ForeignKey('user.id', ondelete='CASCADE'), nullable=False) user_handle = db.Column(db.String(64), nullable=False) credential_data = db.Column(db.LargeBinary, nullable=False) name = db.Column(db.String(250)) diff --git a/lenticular_cloud/static/main.js b/lenticular_cloud/static/main.js index 7f70398..619894e 100644 --- a/lenticular_cloud/static/main.js +++ b/lenticular_cloud/static/main.js @@ -1,3 +1,3 @@ /*! For license information please see main.js.LICENSE.txt */ -(()=>{var e={3734:function(e,t,r){!function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(t),a=n(r);function o(e,t){for(var r=0;r=o)throw new Error("Bootstrap's JavaScript requires at least jQuery v1.9.1 but less than v4.0.0")}};v.jQueryDetection(),m();var C="alert",E="4.6.1",b="bs.alert",T="."+b,S=".data-api",_=i.default.fn[C],A="alert",I="fade",w="show",B="close"+T,N="closed"+T,k="click"+T+S,L='[data-dismiss="alert"]',D=function(){function e(e){this._element=e}var t=e.prototype;return t.close=function(e){var t=this._element;e&&(t=this._getRootElement(e)),this._triggerCloseEvent(t).isDefaultPrevented()||this._removeElement(t)},t.dispose=function(){i.default.removeData(this._element,b),this._element=null},t._getRootElement=function(e){var t=v.getSelectorFromElement(e),r=!1;return t&&(r=document.querySelector(t)),r||(r=i.default(e).closest("."+A)[0]),r},t._triggerCloseEvent=function(e){var t=i.default.Event(B);return i.default(e).trigger(t),t},t._removeElement=function(e){var t=this;if(i.default(e).removeClass(w),i.default(e).hasClass(I)){var r=v.getTransitionDurationFromElement(e);i.default(e).one(v.TRANSITION_END,(function(r){return t._destroyElement(e,r)})).emulateTransitionEnd(r)}else this._destroyElement(e)},t._destroyElement=function(e){i.default(e).detach().trigger(N).remove()},e._jQueryInterface=function(t){return this.each((function(){var r=i.default(this),n=r.data(b);n||(n=new e(this),r.data(b,n)),"close"===t&&n[t](this)}))},e._handleDismiss=function(e){return function(t){t&&t.preventDefault(),e.close(this)}},s(e,null,[{key:"VERSION",get:function(){return E}}]),e}();i.default(document).on(k,L,D._handleDismiss(new D)),i.default.fn[C]=D._jQueryInterface,i.default.fn[C].Constructor=D,i.default.fn[C].noConflict=function(){return i.default.fn[C]=_,D._jQueryInterface};var x="button",R="4.6.1",U="bs.button",P="."+U,O=".data-api",V=i.default.fn[x],M="active",j="btn",K="focus",F="click"+P+O,q="focus"+P+O+" blur"+P+O,H="load"+P+O,G='[data-toggle^="button"]',Q='[data-toggle="buttons"]',z='[data-toggle="button"]',W='[data-toggle="buttons"] .btn',X='input:not([type="hidden"])',Y=".active",$=".btn",Z=function(){function e(e){this._element=e,this.shouldAvoidTriggerChange=!1}var t=e.prototype;return t.toggle=function(){var e=!0,t=!0,r=i.default(this._element).closest(Q)[0];if(r){var n=this._element.querySelector(X);if(n){if("radio"===n.type)if(n.checked&&this._element.classList.contains(M))e=!1;else{var a=r.querySelector(Y);a&&i.default(a).removeClass(M)}e&&("checkbox"!==n.type&&"radio"!==n.type||(n.checked=!this._element.classList.contains(M)),this.shouldAvoidTriggerChange||i.default(n).trigger("change")),n.focus(),t=!1}}this._element.hasAttribute("disabled")||this._element.classList.contains("disabled")||(t&&this._element.setAttribute("aria-pressed",!this._element.classList.contains(M)),e&&i.default(this._element).toggleClass(M))},t.dispose=function(){i.default.removeData(this._element,U),this._element=null},e._jQueryInterface=function(t,r){return this.each((function(){var n=i.default(this),a=n.data(U);a||(a=new e(this),n.data(U,a)),a.shouldAvoidTriggerChange=r,"toggle"===t&&a[t]()}))},s(e,null,[{key:"VERSION",get:function(){return R}}]),e}();i.default(document).on(F,G,(function(e){var t=e.target,r=t;if(i.default(t).hasClass(j)||(t=i.default(t).closest($)[0]),!t||t.hasAttribute("disabled")||t.classList.contains("disabled"))e.preventDefault();else{var n=t.querySelector(X);if(n&&(n.hasAttribute("disabled")||n.classList.contains("disabled")))return void e.preventDefault();"INPUT"!==r.tagName&&"LABEL"===t.tagName||Z._jQueryInterface.call(i.default(t),"toggle","INPUT"===r.tagName)}})).on(q,G,(function(e){var t=i.default(e.target).closest($)[0];i.default(t).toggleClass(K,/^focus(in)?$/.test(e.type))})),i.default(window).on(H,(function(){for(var e=[].slice.call(document.querySelectorAll(W)),t=0,r=e.length;t0,this._pointerEvent=Boolean(window.PointerEvent||window.MSPointerEvent),this._addEventListeners()}var t=e.prototype;return t.next=function(){this._isSliding||this._slide(me)},t.nextWhenVisible=function(){var e=i.default(this._element);!document.hidden&&e.is(":visible")&&"hidden"!==e.css("visibility")&&this.next()},t.prev=function(){this._isSliding||this._slide(ve)},t.pause=function(e){e||(this._isPaused=!0),this._element.querySelector(Ve)&&(v.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},t.cycle=function(e){e||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._updateInterval(),this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},t.to=function(e){var t=this;this._activeElement=this._element.querySelector(Ue);var r=this._getItemIndex(this._activeElement);if(!(e>this._items.length-1||e<0))if(this._isSliding)i.default(this._element).one(Te,(function(){return t.to(e)}));else{if(r===e)return this.pause(),void this.cycle();var n=e>r?me:ve;this._slide(n,this._items[e])}},t.dispose=function(){i.default(this._element).off(re),i.default.removeData(this._element,te),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},t._getConfig=function(e){return e=l({},Fe,e),v.typeCheckConfig(J,e,qe),e},t._handleSwipe=function(){var e=Math.abs(this.touchDeltaX);if(!(e<=le)){var t=e/this.touchDeltaX;this.touchDeltaX=0,t>0&&this.prev(),t<0&&this.next()}},t._addEventListeners=function(){var e=this;this._config.keyboard&&i.default(this._element).on(Se,(function(t){return e._keydown(t)})),"hover"===this._config.pause&&i.default(this._element).on(_e,(function(t){return e.pause(t)})).on(Ae,(function(t){return e.cycle(t)})),this._config.touch&&this._addTouchEventListeners()},t._addTouchEventListeners=function(){var e=this;if(this._touchSupported){var t=function(t){e._pointerEvent&&He[t.originalEvent.pointerType.toUpperCase()]?e.touchStartX=t.originalEvent.clientX:e._pointerEvent||(e.touchStartX=t.originalEvent.touches[0].clientX)},r=function(t){e.touchDeltaX=t.originalEvent.touches&&t.originalEvent.touches.length>1?0:t.originalEvent.touches[0].clientX-e.touchStartX},n=function(t){e._pointerEvent&&He[t.originalEvent.pointerType.toUpperCase()]&&(e.touchDeltaX=t.originalEvent.clientX-e.touchStartX),e._handleSwipe(),"hover"===e._config.pause&&(e.pause(),e.touchTimeout&&clearTimeout(e.touchTimeout),e.touchTimeout=setTimeout((function(t){return e.cycle(t)}),se+e._config.interval))};i.default(this._element.querySelectorAll(Oe)).on(Le,(function(e){return e.preventDefault()})),this._pointerEvent?(i.default(this._element).on(Ne,(function(e){return t(e)})),i.default(this._element).on(ke,(function(e){return n(e)})),this._element.classList.add(ye)):(i.default(this._element).on(Ie,(function(e){return t(e)})),i.default(this._element).on(we,(function(e){return r(e)})),i.default(this._element).on(Be,(function(e){return n(e)})))}},t._keydown=function(e){if(!/input|textarea/i.test(e.target.tagName))switch(e.which){case ae:e.preventDefault(),this.prev();break;case oe:e.preventDefault(),this.next()}},t._getItemIndex=function(e){return this._items=e&&e.parentNode?[].slice.call(e.parentNode.querySelectorAll(Pe)):[],this._items.indexOf(e)},t._getItemByDirection=function(e,t){var r=e===me,n=e===ve,i=this._getItemIndex(t),a=this._items.length-1;if((n&&0===i||r&&i===a)&&!this._config.wrap)return t;var o=(i+(e===ve?-1:1))%this._items.length;return-1===o?this._items[this._items.length-1]:this._items[o]},t._triggerSlideEvent=function(e,t){var r=this._getItemIndex(e),n=this._getItemIndex(this._element.querySelector(Ue)),a=i.default.Event(be,{relatedTarget:e,direction:t,from:n,to:r});return i.default(this._element).trigger(a),a},t._setActiveIndicatorElement=function(e){if(this._indicatorsElement){var t=[].slice.call(this._indicatorsElement.querySelectorAll(Re));i.default(t).removeClass(ce);var r=this._indicatorsElement.children[this._getItemIndex(e)];r&&i.default(r).addClass(ce)}},t._updateInterval=function(){var e=this._activeElement||this._element.querySelector(Ue);if(e){var t=parseInt(e.getAttribute("data-interval"),10);t?(this._config.defaultInterval=this._config.defaultInterval||this._config.interval,this._config.interval=t):this._config.interval=this._config.defaultInterval||this._config.interval}},t._slide=function(e,t){var r,n,a,o=this,s=this._element.querySelector(Ue),l=this._getItemIndex(s),u=t||s&&this._getItemByDirection(e,s),c=this._getItemIndex(u),f=Boolean(this._interval);if(e===me?(r=he,n=pe,a=Ce):(r=de,n=ge,a=Ee),u&&i.default(u).hasClass(ce))this._isSliding=!1;else if(!this._triggerSlideEvent(u,a).isDefaultPrevented()&&s&&u){this._isSliding=!0,f&&this.pause(),this._setActiveIndicatorElement(u),this._activeElement=u;var d=i.default.Event(Te,{relatedTarget:u,direction:a,from:l,to:c});if(i.default(this._element).hasClass(fe)){i.default(u).addClass(n),v.reflow(u),i.default(s).addClass(r),i.default(u).addClass(r);var h=v.getTransitionDurationFromElement(s);i.default(s).one(v.TRANSITION_END,(function(){i.default(u).removeClass(r+" "+n).addClass(ce),i.default(s).removeClass(ce+" "+n+" "+r),o._isSliding=!1,setTimeout((function(){return i.default(o._element).trigger(d)}),0)})).emulateTransitionEnd(h)}else i.default(s).removeClass(ce),i.default(u).addClass(ce),this._isSliding=!1,i.default(this._element).trigger(d);f&&this.cycle()}},e._jQueryInterface=function(t){return this.each((function(){var r=i.default(this).data(te),n=l({},Fe,i.default(this).data());"object"==typeof t&&(n=l({},n,t));var a="string"==typeof t?t:n.slide;if(r||(r=new e(this,n),i.default(this).data(te,r)),"number"==typeof t)r.to(t);else if("string"==typeof a){if(void 0===r[a])throw new TypeError('No method named "'+a+'"');r[a]()}else n.interval&&n.ride&&(r.pause(),r.cycle())}))},e._dataApiClickHandler=function(t){var r=v.getSelectorFromElement(this);if(r){var n=i.default(r)[0];if(n&&i.default(n).hasClass(ue)){var a=l({},i.default(n).data(),i.default(this).data()),o=this.getAttribute("data-slide-to");o&&(a.interval=!1),e._jQueryInterface.call(i.default(n),a),o&&i.default(n).data(te).to(o),t.preventDefault()}}},s(e,null,[{key:"VERSION",get:function(){return ee}},{key:"Default",get:function(){return Fe}}]),e}();i.default(document).on(xe,je,Ge._dataApiClickHandler),i.default(window).on(De,(function(){for(var e=[].slice.call(document.querySelectorAll(Ke)),t=0,r=e.length;t0&&(this._selector=o,this._triggerArray.push(a))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var t=e.prototype;return t.toggle=function(){i.default(this._element).hasClass(Ze)?this.hide():this.show()},t.show=function(){var t,r,n=this;if(!(this._isTransitioning||i.default(this._element).hasClass(Ze)||(this._parent&&0===(t=[].slice.call(this._parent.querySelectorAll(ut)).filter((function(e){return"string"==typeof n._config.parent?e.getAttribute("data-parent")===n._config.parent:e.classList.contains(Je)}))).length&&(t=null),t&&(r=i.default(t).not(this._selector).data(We))&&r._isTransitioning))){var a=i.default.Event(it);if(i.default(this._element).trigger(a),!a.isDefaultPrevented()){t&&(e._jQueryInterface.call(i.default(t).not(this._selector),"hide"),r||i.default(t).data(We,null));var o=this._getDimension();i.default(this._element).removeClass(Je).addClass(et),this._element.style[o]=0,this._triggerArray.length&&i.default(this._triggerArray).removeClass(tt).attr("aria-expanded",!0),this.setTransitioning(!0);var s=function(){i.default(n._element).removeClass(et).addClass(Je+" "+Ze),n._element.style[o]="",n.setTransitioning(!1),i.default(n._element).trigger(at)},l="scroll"+(o[0].toUpperCase()+o.slice(1)),u=v.getTransitionDurationFromElement(this._element);i.default(this._element).one(v.TRANSITION_END,s).emulateTransitionEnd(u),this._element.style[o]=this._element[l]+"px"}}},t.hide=function(){var e=this;if(!this._isTransitioning&&i.default(this._element).hasClass(Ze)){var t=i.default.Event(ot);if(i.default(this._element).trigger(t),!t.isDefaultPrevented()){var r=this._getDimension();this._element.style[r]=this._element.getBoundingClientRect()[r]+"px",v.reflow(this._element),i.default(this._element).addClass(et).removeClass(Je+" "+Ze);var n=this._triggerArray.length;if(n>0)for(var a=0;a0},t._getOffset=function(){var e=this,t={};return"function"==typeof this._config.offset?t.fn=function(t){return t.offsets=l({},t.offsets,e._config.offset(t.offsets,e._element)),t}:t.offset=this._config.offset,t},t._getPopperConfig=function(){var e={placement:this._getPlacement(),modifiers:{offset:this._getOffset(),flip:{enabled:this._config.flip},preventOverflow:{boundariesElement:this._config.boundary}}};return"static"===this._config.display&&(e.modifiers.applyStyle={enabled:!1}),l({},e,this._config.popperConfig)},e._jQueryInterface=function(t){return this.each((function(){var r=i.default(this).data(yt);if(r||(r=new e(this,"object"==typeof t?t:null),i.default(this).data(yt,r)),"string"==typeof t){if(void 0===r[t])throw new TypeError('No method named "'+t+'"');r[t]()}}))},e._clearMenus=function(t){if(!t||t.which!==At&&("keyup"!==t.type||t.which===Tt))for(var r=[].slice.call(document.querySelectorAll(Ft)),n=0,a=r.length;n0&&o--,t.which===_t&&odocument.documentElement.clientHeight;r||(this._element.style.overflowY="hidden"),this._element.classList.add(gr);var n=v.getTransitionDurationFromElement(this._dialog);i.default(this._element).off(v.TRANSITION_END),i.default(this._element).one(v.TRANSITION_END,(function(){e._element.classList.remove(gr),r||i.default(e._element).one(v.TRANSITION_END,(function(){e._element.style.overflowY=""})).emulateTransitionEnd(e._element,n)})).emulateTransitionEnd(n),this._element.focus()}},t._showElement=function(e){var t=this,r=i.default(this._element).hasClass(hr),n=this._dialog?this._dialog.querySelector(Nr):null;this._element.parentNode&&this._element.parentNode.nodeType===Node.ELEMENT_NODE||document.body.appendChild(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),i.default(this._dialog).hasClass(ur)&&n?n.scrollTop=0:this._element.scrollTop=0,r&&v.reflow(this._element),i.default(this._element).addClass(pr),this._config.focus&&this._enforceFocus();var a=i.default.Event(Er,{relatedTarget:e}),o=function(){t._config.focus&&t._element.focus(),t._isTransitioning=!1,i.default(t._element).trigger(a)};if(r){var s=v.getTransitionDurationFromElement(this._dialog);i.default(this._dialog).one(v.TRANSITION_END,o).emulateTransitionEnd(s)}else o()},t._enforceFocus=function(){var e=this;i.default(document).off(br).on(br,(function(t){document!==t.target&&e._element!==t.target&&0===i.default(e._element).has(t.target).length&&e._element.focus()}))},t._setEscapeEvent=function(){var e=this;this._isShown?i.default(this._element).on(_r,(function(t){e._config.keyboard&&t.which===lr?(t.preventDefault(),e.hide()):e._config.keyboard||t.which!==lr||e._triggerBackdropTransition()})):this._isShown||i.default(this._element).off(_r)},t._setResizeEvent=function(){var e=this;this._isShown?i.default(window).on(Tr,(function(t){return e.handleUpdate(t)})):i.default(window).off(Tr)},t._hideModal=function(){var e=this;this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._showBackdrop((function(){i.default(document.body).removeClass(dr),e._resetAdjustments(),e._resetScrollbar(),i.default(e._element).trigger(vr)}))},t._removeBackdrop=function(){this._backdrop&&(i.default(this._backdrop).remove(),this._backdrop=null)},t._showBackdrop=function(e){var t=this,r=i.default(this._element).hasClass(hr)?hr:"";if(this._isShown&&this._config.backdrop){if(this._backdrop=document.createElement("div"),this._backdrop.className=fr,r&&this._backdrop.classList.add(r),i.default(this._backdrop).appendTo(document.body),i.default(this._element).on(Sr,(function(e){t._ignoreBackdropClick?t._ignoreBackdropClick=!1:e.target===e.currentTarget&&("static"===t._config.backdrop?t._triggerBackdropTransition():t.hide())})),r&&v.reflow(this._backdrop),i.default(this._backdrop).addClass(pr),!e)return;if(!r)return void e();var n=v.getTransitionDurationFromElement(this._backdrop);i.default(this._backdrop).one(v.TRANSITION_END,e).emulateTransitionEnd(n)}else if(!this._isShown&&this._backdrop){i.default(this._backdrop).removeClass(pr);var a=function(){t._removeBackdrop(),e&&e()};if(i.default(this._element).hasClass(hr)){var o=v.getTransitionDurationFromElement(this._backdrop);i.default(this._backdrop).one(v.TRANSITION_END,a).emulateTransitionEnd(o)}else a()}else e&&e()},t._adjustDialog=function(){var e=this._element.scrollHeight>document.documentElement.clientHeight;!this._isBodyOverflowing&&e&&(this._element.style.paddingLeft=this._scrollbarWidth+"px"),this._isBodyOverflowing&&!e&&(this._element.style.paddingRight=this._scrollbarWidth+"px")},t._resetAdjustments=function(){this._element.style.paddingLeft="",this._element.style.paddingRight=""},t._checkScrollbar=function(){var e=document.body.getBoundingClientRect();this._isBodyOverflowing=Math.round(e.left+e.right)
',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",customClass:"",sanitize:!0,sanitizeFn:null,whiteList:Vr,popperConfig:null},cn={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string|function)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)",customClass:"(string|function)",sanitize:"boolean",sanitizeFn:"(null|function)",whiteList:"object",popperConfig:"(null|object)"},fn={HIDE:"hide"+Qr,HIDDEN:"hidden"+Qr,SHOW:"show"+Qr,SHOWN:"shown"+Qr,INSERTED:"inserted"+Qr,CLICK:"click"+Qr,FOCUSIN:"focusin"+Qr,FOCUSOUT:"focusout"+Qr,MOUSEENTER:"mouseenter"+Qr,MOUSELEAVE:"mouseleave"+Qr},dn=function(){function e(e,t){if(void 0===a.default)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=e,this.config=this._getConfig(t),this.tip=null,this._setListeners()}var t=e.prototype;return t.enable=function(){this._isEnabled=!0},t.disable=function(){this._isEnabled=!1},t.toggleEnabled=function(){this._isEnabled=!this._isEnabled},t.toggle=function(e){if(this._isEnabled)if(e){var t=this.constructor.DATA_KEY,r=i.default(e.currentTarget).data(t);r||(r=new this.constructor(e.currentTarget,this._getDelegateConfig()),i.default(e.currentTarget).data(t,r)),r._activeTrigger.click=!r._activeTrigger.click,r._isWithActiveTrigger()?r._enter(null,r):r._leave(null,r)}else{if(i.default(this.getTipElement()).hasClass(Zr))return void this._leave(null,this);this._enter(null,this)}},t.dispose=function(){clearTimeout(this._timeout),i.default.removeData(this.element,this.constructor.DATA_KEY),i.default(this.element).off(this.constructor.EVENT_KEY),i.default(this.element).closest(".modal").off("hide.bs.modal",this._hideModalHandler),this.tip&&i.default(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},t.show=function(){var e=this;if("none"===i.default(this.element).css("display"))throw new Error("Please use show on visible elements");var t=i.default.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){i.default(this.element).trigger(t);var r=v.findShadowRoot(this.element),n=i.default.contains(null!==r?r:this.element.ownerDocument.documentElement,this.element);if(t.isDefaultPrevented()||!n)return;var o=this.getTipElement(),s=v.getUID(this.constructor.NAME);o.setAttribute("id",s),this.element.setAttribute("aria-describedby",s),this.setContent(),this.config.animation&&i.default(o).addClass($r);var l="function"==typeof this.config.placement?this.config.placement.call(this,o,this.element):this.config.placement,u=this._getAttachment(l);this.addAttachmentClass(u);var c=this._getContainer();i.default(o).data(this.constructor.DATA_KEY,this),i.default.contains(this.element.ownerDocument.documentElement,this.tip)||i.default(o).appendTo(c),i.default(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new a.default(this.element,o,this._getPopperConfig(u)),i.default(o).addClass(Zr),i.default(o).addClass(this.config.customClass),"ontouchstart"in document.documentElement&&i.default(document.body).children().on("mouseover",null,i.default.noop);var f=function(){e.config.animation&&e._fixTransition();var t=e._hoverState;e._hoverState=null,i.default(e.element).trigger(e.constructor.Event.SHOWN),t===en&&e._leave(null,e)};if(i.default(this.tip).hasClass($r)){var d=v.getTransitionDurationFromElement(this.tip);i.default(this.tip).one(v.TRANSITION_END,f).emulateTransitionEnd(d)}else f()}},t.hide=function(e){var t=this,r=this.getTipElement(),n=i.default.Event(this.constructor.Event.HIDE),a=function(){t._hoverState!==Jr&&r.parentNode&&r.parentNode.removeChild(r),t._cleanTipClass(),t.element.removeAttribute("aria-describedby"),i.default(t.element).trigger(t.constructor.Event.HIDDEN),null!==t._popper&&t._popper.destroy(),e&&e()};if(i.default(this.element).trigger(n),!n.isDefaultPrevented()){if(i.default(r).removeClass(Zr),"ontouchstart"in document.documentElement&&i.default(document.body).children().off("mouseover",null,i.default.noop),this._activeTrigger[on]=!1,this._activeTrigger[an]=!1,this._activeTrigger[nn]=!1,i.default(this.tip).hasClass($r)){var o=v.getTransitionDurationFromElement(r);i.default(r).one(v.TRANSITION_END,a).emulateTransitionEnd(o)}else a();this._hoverState=""}},t.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},t.isWithContent=function(){return Boolean(this.getTitle())},t.addAttachmentClass=function(e){i.default(this.getTipElement()).addClass(Wr+"-"+e)},t.getTipElement=function(){return this.tip=this.tip||i.default(this.config.template)[0],this.tip},t.setContent=function(){var e=this.getTipElement();this.setElementContent(i.default(e.querySelectorAll(tn)),this.getTitle()),i.default(e).removeClass($r+" "+Zr)},t.setElementContent=function(e,t){"object"!=typeof t||!t.nodeType&&!t.jquery?this.config.html?(this.config.sanitize&&(t=Fr(t,this.config.whiteList,this.config.sanitizeFn)),e.html(t)):e.text(t):this.config.html?i.default(t).parent().is(e)||e.empty().append(t):e.text(i.default(t).text())},t.getTitle=function(){var e=this.element.getAttribute("data-original-title");return e||(e="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),e},t._getPopperConfig=function(e){var t=this;return l({},{placement:e,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:rn},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(e){e.originalPlacement!==e.placement&&t._handlePopperPlacementChange(e)},onUpdate:function(e){return t._handlePopperPlacementChange(e)}},this.config.popperConfig)},t._getOffset=function(){var e=this,t={};return"function"==typeof this.config.offset?t.fn=function(t){return t.offsets=l({},t.offsets,e.config.offset(t.offsets,e.element)),t}:t.offset=this.config.offset,t},t._getContainer=function(){return!1===this.config.container?document.body:v.isElement(this.config.container)?i.default(this.config.container):i.default(document).find(this.config.container)},t._getAttachment=function(e){return ln[e.toUpperCase()]},t._setListeners=function(){var e=this;this.config.trigger.split(" ").forEach((function(t){if("click"===t)i.default(e.element).on(e.constructor.Event.CLICK,e.config.selector,(function(t){return e.toggle(t)}));else if(t!==sn){var r=t===nn?e.constructor.Event.MOUSEENTER:e.constructor.Event.FOCUSIN,n=t===nn?e.constructor.Event.MOUSELEAVE:e.constructor.Event.FOCUSOUT;i.default(e.element).on(r,e.config.selector,(function(t){return e._enter(t)})).on(n,e.config.selector,(function(t){return e._leave(t)}))}})),this._hideModalHandler=function(){e.element&&e.hide()},i.default(this.element).closest(".modal").on("hide.bs.modal",this._hideModalHandler),this.config.selector?this.config=l({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},t._fixTitle=function(){var e=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==e)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},t._enter=function(e,t){var r=this.constructor.DATA_KEY;(t=t||i.default(e.currentTarget).data(r))||(t=new this.constructor(e.currentTarget,this._getDelegateConfig()),i.default(e.currentTarget).data(r,t)),e&&(t._activeTrigger["focusin"===e.type?an:nn]=!0),i.default(t.getTipElement()).hasClass(Zr)||t._hoverState===Jr?t._hoverState=Jr:(clearTimeout(t._timeout),t._hoverState=Jr,t.config.delay&&t.config.delay.show?t._timeout=setTimeout((function(){t._hoverState===Jr&&t.show()}),t.config.delay.show):t.show())},t._leave=function(e,t){var r=this.constructor.DATA_KEY;(t=t||i.default(e.currentTarget).data(r))||(t=new this.constructor(e.currentTarget,this._getDelegateConfig()),i.default(e.currentTarget).data(r,t)),e&&(t._activeTrigger["focusout"===e.type?an:nn]=!1),t._isWithActiveTrigger()||(clearTimeout(t._timeout),t._hoverState=en,t.config.delay&&t.config.delay.hide?t._timeout=setTimeout((function(){t._hoverState===en&&t.hide()}),t.config.delay.hide):t.hide())},t._isWithActiveTrigger=function(){for(var e in this._activeTrigger)if(this._activeTrigger[e])return!0;return!1},t._getConfig=function(e){var t=i.default(this.element).data();return Object.keys(t).forEach((function(e){-1!==Yr.indexOf(e)&&delete t[e]})),"number"==typeof(e=l({},this.constructor.Default,t,"object"==typeof e&&e?e:{})).delay&&(e.delay={show:e.delay,hide:e.delay}),"number"==typeof e.title&&(e.title=e.title.toString()),"number"==typeof e.content&&(e.content=e.content.toString()),v.typeCheckConfig(qr,e,this.constructor.DefaultType),e.sanitize&&(e.template=Fr(e.template,e.whiteList,e.sanitizeFn)),e},t._getDelegateConfig=function(){var e={};if(this.config)for(var t in this.config)this.constructor.Default[t]!==this.config[t]&&(e[t]=this.config[t]);return e},t._cleanTipClass=function(){var e=i.default(this.getTipElement()),t=e.attr("class").match(Xr);null!==t&&t.length&&e.removeClass(t.join(""))},t._handlePopperPlacementChange=function(e){this.tip=e.instance.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(e.placement))},t._fixTransition=function(){var e=this.getTipElement(),t=this.config.animation;null===e.getAttribute("x-placement")&&(i.default(e).removeClass($r),this.config.animation=!1,this.hide(),this.show(),this.config.animation=t)},e._jQueryInterface=function(t){return this.each((function(){var r=i.default(this),n=r.data(Gr),a="object"==typeof t&&t;if((n||!/dispose|hide/.test(t))&&(n||(n=new e(this,a),r.data(Gr,n)),"string"==typeof t)){if(void 0===n[t])throw new TypeError('No method named "'+t+'"');n[t]()}}))},s(e,null,[{key:"VERSION",get:function(){return Hr}},{key:"Default",get:function(){return un}},{key:"NAME",get:function(){return qr}},{key:"DATA_KEY",get:function(){return Gr}},{key:"Event",get:function(){return fn}},{key:"EVENT_KEY",get:function(){return Qr}},{key:"DefaultType",get:function(){return cn}}]),e}();i.default.fn[qr]=dn._jQueryInterface,i.default.fn[qr].Constructor=dn,i.default.fn[qr].noConflict=function(){return i.default.fn[qr]=zr,dn._jQueryInterface};var hn="popover",pn="4.6.1",gn="bs.popover",yn="."+gn,mn=i.default.fn[hn],vn="bs-popover",Cn=new RegExp("(^|\\s)"+vn+"\\S+","g"),En="fade",bn="show",Tn=".popover-header",Sn=".popover-body",_n=l({},dn.Default,{placement:"right",trigger:"click",content:"",template:''}),An=l({},dn.DefaultType,{content:"(string|element|function)"}),In={HIDE:"hide"+yn,HIDDEN:"hidden"+yn,SHOW:"show"+yn,SHOWN:"shown"+yn,INSERTED:"inserted"+yn,CLICK:"click"+yn,FOCUSIN:"focusin"+yn,FOCUSOUT:"focusout"+yn,MOUSEENTER:"mouseenter"+yn,MOUSELEAVE:"mouseleave"+yn},wn=function(e){function t(){return e.apply(this,arguments)||this}u(t,e);var r=t.prototype;return r.isWithContent=function(){return this.getTitle()||this._getContent()},r.addAttachmentClass=function(e){i.default(this.getTipElement()).addClass(vn+"-"+e)},r.getTipElement=function(){return this.tip=this.tip||i.default(this.config.template)[0],this.tip},r.setContent=function(){var e=i.default(this.getTipElement());this.setElementContent(e.find(Tn),this.getTitle());var t=this._getContent();"function"==typeof t&&(t=t.call(this.element)),this.setElementContent(e.find(Sn),t),e.removeClass(En+" "+bn)},r._getContent=function(){return this.element.getAttribute("data-content")||this.config.content},r._cleanTipClass=function(){var e=i.default(this.getTipElement()),t=e.attr("class").match(Cn);null!==t&&t.length>0&&e.removeClass(t.join(""))},t._jQueryInterface=function(e){return this.each((function(){var r=i.default(this).data(gn),n="object"==typeof e?e:null;if((r||!/dispose|hide/.test(e))&&(r||(r=new t(this,n),i.default(this).data(gn,r)),"string"==typeof e)){if(void 0===r[e])throw new TypeError('No method named "'+e+'"');r[e]()}}))},s(t,null,[{key:"VERSION",get:function(){return pn}},{key:"Default",get:function(){return _n}},{key:"NAME",get:function(){return hn}},{key:"DATA_KEY",get:function(){return gn}},{key:"Event",get:function(){return In}},{key:"EVENT_KEY",get:function(){return yn}},{key:"DefaultType",get:function(){return An}}]),t}(dn);i.default.fn[hn]=wn._jQueryInterface,i.default.fn[hn].Constructor=wn,i.default.fn[hn].noConflict=function(){return i.default.fn[hn]=mn,wn._jQueryInterface};var Bn="scrollspy",Nn="4.6.1",kn="bs.scrollspy",Ln="."+kn,Dn=".data-api",xn=i.default.fn[Bn],Rn="dropdown-item",Un="active",Pn="activate"+Ln,On="scroll"+Ln,Vn="load"+Ln+Dn,Mn="offset",jn="position",Kn='[data-spy="scroll"]',Fn=".nav, .list-group",qn=".nav-link",Hn=".nav-item",Gn=".list-group-item",Qn=".dropdown",zn=".dropdown-item",Wn=".dropdown-toggle",Xn={offset:10,method:"auto",target:""},Yn={offset:"number",method:"string",target:"(string|element)"},$n=function(){function e(e,t){var r=this;this._element=e,this._scrollElement="BODY"===e.tagName?window:e,this._config=this._getConfig(t),this._selector=this._config.target+" "+qn+","+this._config.target+" "+Gn+","+this._config.target+" "+zn,this._offsets=[],this._targets=[],this._activeTarget=null,this._scrollHeight=0,i.default(this._scrollElement).on(On,(function(e){return r._process(e)})),this.refresh(),this._process()}var t=e.prototype;return t.refresh=function(){var e=this,t=this._scrollElement===this._scrollElement.window?Mn:jn,r="auto"===this._config.method?t:this._config.method,n=r===jn?this._getScrollTop():0;this._offsets=[],this._targets=[],this._scrollHeight=this._getScrollHeight(),[].slice.call(document.querySelectorAll(this._selector)).map((function(e){var t,a=v.getSelectorFromElement(e);if(a&&(t=document.querySelector(a)),t){var o=t.getBoundingClientRect();if(o.width||o.height)return[i.default(t)[r]().top+n,a]}return null})).filter((function(e){return e})).sort((function(e,t){return e[0]-t[0]})).forEach((function(t){e._offsets.push(t[0]),e._targets.push(t[1])}))},t.dispose=function(){i.default.removeData(this._element,kn),i.default(this._scrollElement).off(Ln),this._element=null,this._scrollElement=null,this._config=null,this._selector=null,this._offsets=null,this._targets=null,this._activeTarget=null,this._scrollHeight=null},t._getConfig=function(e){if("string"!=typeof(e=l({},Xn,"object"==typeof e&&e?e:{})).target&&v.isElement(e.target)){var t=i.default(e.target).attr("id");t||(t=v.getUID(Bn),i.default(e.target).attr("id",t)),e.target="#"+t}return v.typeCheckConfig(Bn,e,Yn),e},t._getScrollTop=function(){return this._scrollElement===window?this._scrollElement.pageYOffset:this._scrollElement.scrollTop},t._getScrollHeight=function(){return this._scrollElement.scrollHeight||Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},t._getOffsetHeight=function(){return this._scrollElement===window?window.innerHeight:this._scrollElement.getBoundingClientRect().height},t._process=function(){var e=this._getScrollTop()+this._config.offset,t=this._getScrollHeight(),r=this._config.offset+t-this._getOffsetHeight();if(this._scrollHeight!==t&&this.refresh(),e>=r){var n=this._targets[this._targets.length-1];this._activeTarget!==n&&this._activate(n)}else{if(this._activeTarget&&e0)return this._activeTarget=null,void this._clear();for(var i=this._offsets.length;i--;)this._activeTarget!==this._targets[i]&&e>=this._offsets[i]&&(void 0===this._offsets[i+1]||e{e.exports="object"==typeof self?self.FormData:window.FormData},6569:(e,t,r)=>{var n,i,a;i=[r(9755)],n=function(e){"use strict";var t=/\r?\n/g,r={};r.fileapi=void 0!==e('').get(0).files,r.formdata=void 0!==window.FormData;var n=!!e.fn.prop;function i(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).closest("form").ajaxSubmit(r))}function a(t){var r=t.target,n=e(r);if(!n.is("[type=submit],[type=image]")){var i=n.closest("[type=submit]");if(0===i.length)return;r=i[0]}var a,o=r.form;"image"===(o.clk=r).type&&(void 0!==t.offsetX?(o.clk_x=t.offsetX,o.clk_y=t.offsetY):"function"==typeof e.fn.offset?(a=n.offset(),o.clk_x=t.pageX-a.left,o.clk_y=t.pageY-a.top):(o.clk_x=t.pageX-r.offsetLeft,o.clk_y=t.pageY-r.offsetTop)),setTimeout((function(){o.clk=o.clk_x=o.clk_y=null}),100)}function o(){var t;e.fn.ajaxSubmit.debug&&(t="[jquery.form] "+Array.prototype.join.call(arguments,""),window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t))}e.fn.attr2=function(){if(!n)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t,i,a,s){if(!this.length)return o("ajaxSubmit: skipping submit process - no element selected"),this;var l,u,c,f,d=this;"function"==typeof t?t={success:t}:"string"==typeof t||!1===t&&0',T)).css({position:"absolute",top:"-1000px",left:"-1000px"}),h=f[0],p={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";o("aborting upload... "+r),this.aborted=1;try{h.contentWindow.document.execCommand&&h.contentWindow.document.execCommand("Stop")}catch(t){}f.attr("src",s.iframeSrc),p.error=r,s.error&&s.error.call(s.context,p,r,t),u&&e.event.trigger("ajaxError",[p,s,r]),s.complete&&s.complete.call(s.context,p,r)}},(u=s.global)&&0==e.active++&&e.event.trigger("ajaxStart"),u&&e.event.trigger("ajaxSend",[p,s]),s.beforeSend&&!1===s.beforeSend.call(s.context,p,s))return s.global&&e.active--,b.reject(),b;if(p.aborted)return b.reject(),b;(g=E.clk)&&(y=g.name)&&!g.disabled&&(s.extraData=s.extraData||{},s.extraData[y]=g.value,"image"===g.type&&(s.extraData[y+".x"]=E.clk_x,s.extraData[y+".y"]=E.clk_y));var _=1,A=2;function I(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(e){o("cannot get iframe.contentWindow document: "+e)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){o("cannot get iframe.contentDocument: "+r),t=e.document}return t}var w=e("meta[name=csrf-token]").attr("content"),B=e("meta[name=csrf-param]").attr("content");function N(){var t=d.attr2("target"),r=d.attr2("action"),n=d.attr("enctype")||d.attr("encoding")||"multipart/form-data";E.setAttribute("target",c),l&&!/post/i.test(l)||E.setAttribute("method","POST"),r!==s.url&&E.setAttribute("action",s.url),s.skipEncodingOverride||l&&!/post/i.test(l)||d.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),s.timeout&&(C=setTimeout((function(){v=!0,R(_)}),s.timeout));var i=[];try{if(s.extraData)for(var a in s.extraData)s.extraData.hasOwnProperty(a)&&(e.isPlainObject(s.extraData[a])&&s.extraData[a].hasOwnProperty("name")&&s.extraData[a].hasOwnProperty("value")?i.push(e('',T).val(s.extraData[a].value).appendTo(E)[0]):i.push(e('',T).val(s.extraData[a]).appendTo(E)[0]));s.iframeTarget||f.appendTo(S),h.attachEvent?h.attachEvent("onload",R):h.addEventListener("load",R,!1),setTimeout((function e(){try{var t=I(h).readyState;o("state = "+t),t&&"uninitialized"===t.toLowerCase()&&setTimeout(e,50)}catch(e){o("Server abort: ",e," (",e.name,")"),R(A),C&&clearTimeout(C),C=void 0}}),15);try{E.submit()}catch(t){document.createElement("form").submit.apply(E)}}finally{E.setAttribute("action",r),E.setAttribute("enctype",n),t?E.setAttribute("target",t):d.removeAttr("target"),e(i).remove()}}B&&w&&(s.extraData=s.extraData||{},s.extraData[B]=w),s.forceSync?N():setTimeout(N,10);var k,L,D,x=50;function R(t){if(!p.aborted&&!D){if((L=I(h))||(o("cannot access response document"),t=A),t===_&&p)return p.abort("timeout"),void b.reject(p,"timeout");if(t===A&&p)return p.abort("server abort"),void b.reject(p,"error","server abort");if(L&&L.location.href!==s.iframeSrc||v){h.detachEvent?h.detachEvent("onload",R):h.removeEventListener("load",R,!1);var r,n="success";try{if(v)throw"timeout";var i="xml"===s.dataType||L.XMLDocument||e.isXMLDoc(L);if(o("isXml="+i),!i&&window.opera&&(null===L.body||!L.body.innerHTML)&&--x)return o("requeing onLoad callback, DOM not available"),void setTimeout(R,250);var a=L.body?L.body:L.documentElement;p.responseText=a?a.innerHTML:null,p.responseXML=L.XMLDocument?L.XMLDocument:L,i&&(s.dataType="xml"),p.getResponseHeader=function(e){return{"content-type":s.dataType}[e.toLowerCase()]},a&&(p.status=Number(a.getAttribute("status"))||p.status,p.statusText=a.getAttribute("statusText")||p.statusText);var l,c,d,g=(s.dataType||"").toLowerCase(),y=/(json|script|text)/.test(g);y||s.textarea?(l=L.getElementsByTagName("textarea")[0])?(p.responseText=l.value,p.status=Number(l.getAttribute("status"))||p.status,p.statusText=l.getAttribute("statusText")||p.statusText):y&&(c=L.getElementsByTagName("pre")[0],d=L.getElementsByTagName("body")[0],c?p.responseText=c.textContent?c.textContent:c.innerText:d&&(p.responseText=d.textContent?d.textContent:d.innerText)):"xml"===g&&!p.responseXML&&p.responseText&&(p.responseXML=U(p.responseText));try{k=O(p,g,s)}catch(t){n="parsererror",p.error=r=t||n}}catch(t){o("error caught: ",t),n="error",p.error=r=t||n}p.aborted&&(o("upload aborted"),n=null),p.status&&(n=200<=p.status&&p.status<300||304===p.status?"success":"error"),"success"===n?(s.success&&s.success.call(s.context,k,"success",p),b.resolve(p.responseText,"success",p),u&&e.event.trigger("ajaxSuccess",[p,s])):n&&(void 0===r&&(r=p.statusText),s.error&&s.error.call(s.context,p,n,r),b.reject(p,"error",r),u&&e.event.trigger("ajaxError",[p,s,r])),u&&e.event.trigger("ajaxComplete",[p,s]),u&&!--e.active&&e.event.trigger("ajaxStop"),s.complete&&s.complete.call(s.context,p,n),D=!0,s.timeout&&clearTimeout(C),setTimeout((function(){s.iframeTarget?f.attr("src",s.iframeSrc):f.remove(),p.responseXML=null}),100)}}}var U=e.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!==t.documentElement.nodeName?t:null},P=e.parseJSON||function(e){return window.eval("("+e+")")},O=function(t,r,n){var i=t.getResponseHeader("content-type")||"",a=("xml"===r||!r)&&0<=i.indexOf("xml"),o=a?t.responseXML:t.responseText;return a&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),n&&n.dataFilter&&(o=n.dataFilter(o,r)),"string"==typeof o&&(("json"===r||!r)&&0<=i.indexOf("json")?o=P(o):("script"===r||!r)&&0<=i.indexOf("javascript")&&e.globalEval(o)),o};return b}},e.fn.ajaxForm=function(t,r,n,s){if(("string"==typeof t||!1===t&&00&&t-1 in e)}_.fn=_.prototype={jquery:S,constructor:_,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=_.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return _.each(this,e)},map:function(e){return this.pushStack(_.map(this,(function(t,r){return e.call(t,r,t)})))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(_.grep(this,(function(e,t){return(t+1)%2})))},odd:function(){return this.pushStack(_.grep(this,(function(e,t){return t%2})))},eq:function(e){var t=this.length,r=+e+(e<0?t:0);return this.pushStack(r>=0&&r+~]|[\\x20\\t\\r\\n\\f])[\\x20\\t\\r\\n\\f]*"),G=new RegExp(O+"|>"),Q=new RegExp(j),z=new RegExp("^"+V+"$"),W={ID:new RegExp("^#("+V+")"),CLASS:new RegExp("^\\.("+V+")"),TAG:new RegExp("^("+V+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+j),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^[\\x20\\t\\r\\n\\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)","i")},X=/HTML$/i,Y=/^(?:input|select|textarea|button)$/i,$=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\([^\\r\\n\\f])","g"),re=function(e,t){var r="0x"+e.slice(1)-65536;return t||(r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320))},ne=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"ďż˝":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},ae=function(){d()},oe=Ee((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{x.apply(k=R.call(b.childNodes),b.childNodes),k[b.childNodes.length].nodeType}catch(e){x={apply:k.length?function(e,t){D.apply(e,R.call(t))}:function(e,t){for(var r=e.length,n=0;e[r++]=t[n++];);e.length=r-1}}}function se(e,t,n,i){var a,s,u,c,f,p,m,v=t&&t.ownerDocument,b=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==b&&9!==b&&11!==b)return n;if(!i&&(d(t),t=t||h,g)){if(11!==b&&(f=J.exec(e)))if(a=f[1]){if(9===b){if(!(u=t.getElementById(a)))return n;if(u.id===a)return n.push(u),n}else if(v&&(u=v.getElementById(a))&&C(t,u)&&u.id===a)return n.push(u),n}else{if(f[2])return x.apply(n,t.getElementsByTagName(e)),n;if((a=f[3])&&r.getElementsByClassName&&t.getElementsByClassName)return x.apply(n,t.getElementsByClassName(a)),n}if(r.qsa&&!w[e+" "]&&(!y||!y.test(e))&&(1!==b||"object"!==t.nodeName.toLowerCase())){if(m=e,v=t,1===b&&(G.test(e)||H.test(e))){for((v=ee.test(e)&&me(t.parentNode)||t)===t&&r.scope||((c=t.getAttribute("id"))?c=c.replace(ne,ie):t.setAttribute("id",c=E)),s=(p=o(e)).length;s--;)p[s]=(c?"#"+c:":scope")+" "+Ce(p[s]);m=p.join(",")}try{return x.apply(n,v.querySelectorAll(m)),n}catch(t){w(e,!0)}finally{c===E&&t.removeAttribute("id")}}}return l(e.replace(F,"$1"),t,n,i)}function le(){var e=[];return function t(r,i){return e.push(r+" ")>n.cacheLength&&delete t[e.shift()],t[r+" "]=i}}function ue(e){return e[E]=!0,e}function ce(e){var t=h.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){for(var r=e.split("|"),i=r.length;i--;)n.attrHandle[r[i]]=t}function de(e,t){var r=t&&e,n=r&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(n)return n;if(r)for(;r=r.nextSibling;)if(r===t)return-1;return e?1:-1}function he(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var r=t.nodeName.toLowerCase();return("input"===r||"button"===r)&&t.type===e}}function ge(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&oe(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function ye(e){return ue((function(t){return t=+t,ue((function(r,n){for(var i,a=e([],r.length,t),o=a.length;o--;)r[i=a[o]]&&(r[i]=!(n[i]=r[i]))}))}))}function me(e){return e&&void 0!==e.getElementsByTagName&&e}for(t in r=se.support={},a=se.isXML=function(e){var t=e&&e.namespaceURI,r=e&&(e.ownerDocument||e).documentElement;return!X.test(t||r&&r.nodeName||"HTML")},d=se.setDocument=function(e){var t,i,o=e?e.ownerDocument||e:b;return o!=h&&9===o.nodeType&&o.documentElement?(p=(h=o).documentElement,g=!a(h),b!=h&&(i=h.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",ae,!1):i.attachEvent&&i.attachEvent("onunload",ae)),r.scope=ce((function(e){return p.appendChild(e).appendChild(h.createElement("div")),void 0!==e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),r.attributes=ce((function(e){return e.className="i",!e.getAttribute("className")})),r.getElementsByTagName=ce((function(e){return e.appendChild(h.createComment("")),!e.getElementsByTagName("*").length})),r.getElementsByClassName=Z.test(h.getElementsByClassName),r.getById=ce((function(e){return p.appendChild(e).id=E,!h.getElementsByName||!h.getElementsByName(E).length})),r.getById?(n.filter.ID=function(e){var t=e.replace(te,re);return function(e){return e.getAttribute("id")===t}},n.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var r=t.getElementById(e);return r?[r]:[]}}):(n.filter.ID=function(e){var t=e.replace(te,re);return function(e){var r=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return r&&r.value===t}},n.find.ID=function(e,t){if(void 0!==t.getElementById&&g){var r,n,i,a=t.getElementById(e);if(a){if((r=a.getAttributeNode("id"))&&r.value===e)return[a];for(i=t.getElementsByName(e),n=0;a=i[n++];)if((r=a.getAttributeNode("id"))&&r.value===e)return[a]}return[]}}),n.find.TAG=r.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):r.qsa?t.querySelectorAll(e):void 0}:function(e,t){var r,n=[],i=0,a=t.getElementsByTagName(e);if("*"===e){for(;r=a[i++];)1===r.nodeType&&n.push(r);return n}return a},n.find.CLASS=r.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&g)return t.getElementsByClassName(e)},m=[],y=[],(r.qsa=Z.test(h.querySelectorAll))&&(ce((function(e){var t;p.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|"+P+")"),e.querySelectorAll("[id~="+E+"-]").length||y.push("~="),(t=h.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||y.push("\\[[\\x20\\t\\r\\n\\f]*name[\\x20\\t\\r\\n\\f]*=[\\x20\\t\\r\\n\\f]*(?:''|\"\")"),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+E+"+*").length||y.push(".#.+[+~]"),e.querySelectorAll("\\\f"),y.push("[\\r\\n\\f]")})),ce((function(e){e.innerHTML="";var t=h.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name[\\x20\\t\\r\\n\\f]*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),p.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")}))),(r.matchesSelector=Z.test(v=p.matches||p.webkitMatchesSelector||p.mozMatchesSelector||p.oMatchesSelector||p.msMatchesSelector))&&ce((function(e){r.disconnectedMatch=v.call(e,"*"),v.call(e,"[s!='']:x"),m.push("!=",j)})),y=y.length&&new RegExp(y.join("|")),m=m.length&&new RegExp(m.join("|")),t=Z.test(p.compareDocumentPosition),C=t||Z.test(p.contains)?function(e,t){var r=9===e.nodeType?e.documentElement:e,n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(r.contains?r.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},B=t?function(e,t){if(e===t)return f=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!r.sortDetached&&t.compareDocumentPosition(e)===n?e==h||e.ownerDocument==b&&C(b,e)?-1:t==h||t.ownerDocument==b&&C(b,t)?1:c?U(c,e)-U(c,t):0:4&n?-1:1)}:function(e,t){if(e===t)return f=!0,0;var r,n=0,i=e.parentNode,a=t.parentNode,o=[e],s=[t];if(!i||!a)return e==h?-1:t==h?1:i?-1:a?1:c?U(c,e)-U(c,t):0;if(i===a)return de(e,t);for(r=e;r=r.parentNode;)o.unshift(r);for(r=t;r=r.parentNode;)s.unshift(r);for(;o[n]===s[n];)n++;return n?de(o[n],s[n]):o[n]==b?-1:s[n]==b?1:0},h):h},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(d(e),r.matchesSelector&&g&&!w[t+" "]&&(!m||!m.test(t))&&(!y||!y.test(t)))try{var n=v.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){w(t,!0)}return se(t,h,null,[e]).length>0},se.contains=function(e,t){return(e.ownerDocument||e)!=h&&d(e),C(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=h&&d(e);var i=n.attrHandle[t.toLowerCase()],a=i&&N.call(n.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==a?a:r.attributes||!g?e.getAttribute(t):(a=e.getAttributeNode(t))&&a.specified?a.value:null},se.escape=function(e){return(e+"").replace(ne,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,n=[],i=0,a=0;if(f=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(B),f){for(;t=e[a++];)t===e[a]&&(i=n.push(a));for(;i--;)e.splice(n[i],1)}return c=null,e},i=se.getText=function(e){var t,r="",n=0,a=e.nodeType;if(a){if(1===a||9===a||11===a){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)r+=i(e)}else if(3===a||4===a)return e.nodeValue}else for(;t=e[n++];)r+=i(t);return r},n=se.selectors={cacheLength:50,createPseudo:ue,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,re),e[3]=(e[3]||e[4]||e[5]||"").replace(te,re),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,r=!e[6]&&e[2];return W.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":r&&Q.test(r)&&(t=o(r,!0))&&(t=r.indexOf(")",r.length-t)-r.length)&&(e[0]=e[0].slice(0,t),e[2]=r.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,re).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=_[e+" "];return t||(t=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+e+"("+O+"|$)"))&&_(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,r){return function(n){var i=se.attr(n,e);return null==i?"!="===t:!t||(i+="","="===t?i===r:"!="===t?i!==r:"^="===t?r&&0===i.indexOf(r):"*="===t?r&&i.indexOf(r)>-1:"$="===t?r&&i.slice(-r.length)===r:"~="===t?(" "+i.replace(K," ")+" ").indexOf(r)>-1:"|="===t&&(i===r||i.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,r,n,i){var a="nth"!==e.slice(0,3),o="last"!==e.slice(-4),s="of-type"===t;return 1===n&&0===i?function(e){return!!e.parentNode}:function(t,r,l){var u,c,f,d,h,p,g=a!==o?"nextSibling":"previousSibling",y=t.parentNode,m=s&&t.nodeName.toLowerCase(),v=!l&&!s,C=!1;if(y){if(a){for(;g;){for(d=t;d=d[g];)if(s?d.nodeName.toLowerCase()===m:1===d.nodeType)return!1;p=g="only"===e&&!p&&"nextSibling"}return!0}if(p=[o?y.firstChild:y.lastChild],o&&v){for(C=(h=(u=(c=(f=(d=y)[E]||(d[E]={}))[d.uniqueID]||(f[d.uniqueID]={}))[e]||[])[0]===T&&u[1])&&u[2],d=h&&y.childNodes[h];d=++h&&d&&d[g]||(C=h=0)||p.pop();)if(1===d.nodeType&&++C&&d===t){c[e]=[T,h,C];break}}else if(v&&(C=h=(u=(c=(f=(d=t)[E]||(d[E]={}))[d.uniqueID]||(f[d.uniqueID]={}))[e]||[])[0]===T&&u[1]),!1===C)for(;(d=++h&&d&&d[g]||(C=h=0)||p.pop())&&((s?d.nodeName.toLowerCase()!==m:1!==d.nodeType)||!++C||(v&&((c=(f=d[E]||(d[E]={}))[d.uniqueID]||(f[d.uniqueID]={}))[e]=[T,C]),d!==t)););return(C-=i)===n||C%n==0&&C/n>=0}}},PSEUDO:function(e,t){var r,i=n.pseudos[e]||n.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return i[E]?i(t):i.length>1?(r=[e,e,"",t],n.setFilters.hasOwnProperty(e.toLowerCase())?ue((function(e,r){for(var n,a=i(e,t),o=a.length;o--;)e[n=U(e,a[o])]=!(r[n]=a[o])})):function(e){return i(e,0,r)}):i}},pseudos:{not:ue((function(e){var t=[],r=[],n=s(e.replace(F,"$1"));return n[E]?ue((function(e,t,r,i){for(var a,o=n(e,null,i,[]),s=e.length;s--;)(a=o[s])&&(e[s]=!(t[s]=a))})):function(e,i,a){return t[0]=e,n(t,null,a,r),t[0]=null,!r.pop()}})),has:ue((function(e){return function(t){return se(e,t).length>0}})),contains:ue((function(e){return e=e.replace(te,re),function(t){return(t.textContent||i(t)).indexOf(e)>-1}})),lang:ue((function(e){return z.test(e||"")||se.error("unsupported lang: "+e),e=e.replace(te,re).toLowerCase(),function(t){var r;do{if(r=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(r=r.toLowerCase())===e||0===r.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(t){var r=e.location&&e.location.hash;return r&&r.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:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!n.pseudos.empty(e)},header:function(e){return $.test(e.nodeName)},input:function(e){return Y.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ye((function(){return[0]})),last:ye((function(e,t){return[t-1]})),eq:ye((function(e,t,r){return[r<0?r+t:r]})),even:ye((function(e,t){for(var r=0;rt?t:r;--n>=0;)e.push(n);return e})),gt:ye((function(e,t,r){for(var n=r<0?r+t:r;++n1?function(t,r,n){for(var i=e.length;i--;)if(!e[i](t,r,n))return!1;return!0}:e[0]}function Te(e,t,r,n,i){for(var a,o=[],s=0,l=e.length,u=null!=t;s-1&&(a[u]=!(o[u]=f))}}else m=Te(m===o?m.splice(p,m.length):m),i?i(null,o,m,l):x.apply(o,m)}))}function _e(e){for(var t,r,i,a=e.length,o=n.relative[e[0].type],s=o||n.relative[" "],l=o?1:0,c=Ee((function(e){return e===t}),s,!0),f=Ee((function(e){return U(t,e)>-1}),s,!0),d=[function(e,r,n){var i=!o&&(n||r!==u)||((t=r).nodeType?c(e,r,n):f(e,r,n));return t=null,i}];l1&&be(d),l>1&&Ce(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(F,"$1"),r,l0,i=e.length>0,a=function(a,o,s,l,c){var f,p,y,m=0,v="0",C=a&&[],E=[],b=u,S=a||i&&n.find.TAG("*",c),_=T+=null==b?1:Math.random()||.1,A=S.length;for(c&&(u=o==h||o||c);v!==A&&null!=(f=S[v]);v++){if(i&&f){for(p=0,o||f.ownerDocument==h||(d(f),s=!g);y=e[p++];)if(y(f,o||h,s)){l.push(f);break}c&&(T=_)}r&&((f=!y&&f)&&m--,a&&C.push(f))}if(m+=v,r&&v!==m){for(p=0;y=t[p++];)y(C,E,o,s);if(a){if(m>0)for(;v--;)C[v]||E[v]||(E[v]=L.call(l));E=Te(E)}x.apply(l,E),c&&!a&&E.length>0&&m+t.length>1&&se.uniqueSort(l)}return c&&(T=_,u=b),C};return r?ue(a):a}(a,i)),s.selector=e}return s},l=se.select=function(e,t,r,i){var a,l,u,c,f,d="function"==typeof e&&e,h=!i&&o(e=d.selector||e);if(r=r||[],1===h.length){if((l=h[0]=h[0].slice(0)).length>2&&"ID"===(u=l[0]).type&&9===t.nodeType&&g&&n.relative[l[1].type]){if(!(t=(n.find.ID(u.matches[0].replace(te,re),t)||[])[0]))return r;d&&(t=t.parentNode),e=e.slice(l.shift().value.length)}for(a=W.needsContext.test(e)?0:l.length;a--&&(u=l[a],!n.relative[c=u.type]);)if((f=n.find[c])&&(i=f(u.matches[0].replace(te,re),ee.test(l[0].type)&&me(t.parentNode)||t))){if(l.splice(a,1),!(e=i.length&&Ce(l)))return x.apply(r,i),r;break}}return(d||s(e,h))(i,t,!g,r,!t||ee.test(e)&&me(t.parentNode)||t),r},r.sortStable=E.split("").sort(B).join("")===E,r.detectDuplicates=!!f,d(),r.sortDetached=ce((function(e){return 1&e.compareDocumentPosition(h.createElement("fieldset"))})),ce((function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")}))||fe("type|href|height|width",(function(e,t,r){if(!r)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),r.attributes&&ce((function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||fe("value",(function(e,t,r){if(!r&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),ce((function(e){return null==e.getAttribute("disabled")}))||fe(P,(function(e,t,r){var n;if(!r)return!0===e[t]?t.toLowerCase():(n=e.getAttributeNode(t))&&n.specified?n.value:null})),se}(n);_.find=I,_.expr=I.selectors,_.expr[":"]=_.expr.pseudos,_.uniqueSort=_.unique=I.uniqueSort,_.text=I.getText,_.isXMLDoc=I.isXML,_.contains=I.contains,_.escapeSelector=I.escape;var w=function(e,t,r){for(var n=[],i=void 0!==r;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&_(e).is(r))break;n.push(e)}return n},B=function(e,t){for(var r=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&r.push(e);return r},N=_.expr.match.needsContext;function k(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var L=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,t,r){return m(t)?_.grep(e,(function(e,n){return!!t.call(e,n,e)!==r})):t.nodeType?_.grep(e,(function(e){return e===t!==r})):"string"!=typeof t?_.grep(e,(function(e){return c.call(t,e)>-1!==r})):_.filter(t,e,r)}_.filter=function(e,t,r){var n=t[0];return r&&(e=":not("+e+")"),1===t.length&&1===n.nodeType?_.find.matchesSelector(n,e)?[n]:[]:_.find.matches(e,_.grep(t,(function(e){return 1===e.nodeType})))},_.fn.extend({find:function(e){var t,r,n=this.length,i=this;if("string"!=typeof e)return this.pushStack(_(e).filter((function(){for(t=0;t1?_.uniqueSort(r):r},filter:function(e){return this.pushStack(D(this,e||[],!1))},not:function(e){return this.pushStack(D(this,e||[],!0))},is:function(e){return!!D(this,"string"==typeof e&&N.test(e)?_(e):e||[],!1).length}});var x,R=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(_.fn.init=function(e,t,r){var n,i;if(!e)return this;if(r=r||x,"string"==typeof e){if(!(n="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:R.exec(e))||!n[1]&&t)return!t||t.jquery?(t||r).find(e):this.constructor(t).find(e);if(n[1]){if(t=t instanceof _?t[0]:t,_.merge(this,_.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),L.test(n[1])&&_.isPlainObject(t))for(n in t)m(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return(i=C.getElementById(n[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==r.ready?r.ready(e):e(_):_.makeArray(e,this)}).prototype=_.fn,x=_(C);var U=/^(?:parents|prev(?:Until|All))/,P={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}_.fn.extend({has:function(e){var t=_(e,this),r=t.length;return this.filter((function(){for(var e=0;e-1:1===r.nodeType&&_.find.matchesSelector(r,e))){a.push(r);break}return this.pushStack(a.length>1?_.uniqueSort(a):a)},index:function(e){return e?"string"==typeof e?c.call(_(e),this[0]):c.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(_.uniqueSort(_.merge(this.get(),_(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),_.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return w(e,"parentNode")},parentsUntil:function(e,t,r){return w(e,"parentNode",r)},next:function(e){return O(e,"nextSibling")},prev:function(e){return O(e,"previousSibling")},nextAll:function(e){return w(e,"nextSibling")},prevAll:function(e){return w(e,"previousSibling")},nextUntil:function(e,t,r){return w(e,"nextSibling",r)},prevUntil:function(e,t,r){return w(e,"previousSibling",r)},siblings:function(e){return B((e.parentNode||{}).firstChild,e)},children:function(e){return B(e.firstChild)},contents:function(e){return null!=e.contentDocument&&o(e.contentDocument)?e.contentDocument:(k(e,"template")&&(e=e.content||e),_.merge([],e.childNodes))}},(function(e,t){_.fn[e]=function(r,n){var i=_.map(this,t,r);return"Until"!==e.slice(-5)&&(n=r),n&&"string"==typeof n&&(i=_.filter(n,i)),this.length>1&&(P[e]||_.uniqueSort(i),U.test(e)&&i.reverse()),this.pushStack(i)}}));var V=/[^\x20\t\r\n\f]+/g;function M(e){return e}function j(e){throw e}function K(e,t,r,n){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(r):e&&m(i=e.then)?i.call(e,t,r):t.apply(void 0,[e].slice(n))}catch(e){r.apply(void 0,[e])}}_.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return _.each(e.match(V)||[],(function(e,r){t[r]=!0})),t}(e):_.extend({},e);var t,r,n,i,a=[],o=[],s=-1,l=function(){for(i=i||e.once,n=t=!0;o.length;s=-1)for(r=o.shift();++s-1;)a.splice(r,1),r<=s&&s--})),this},has:function(e){return e?_.inArray(e,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return i=o=[],a=r="",this},disabled:function(){return!a},lock:function(){return i=o=[],r||t||(a=r=""),this},locked:function(){return!!i},fireWith:function(e,r){return i||(r=[e,(r=r||[]).slice?r.slice():r],o.push(r),t||l()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!n}};return u},_.extend({Deferred:function(e){var t=[["notify","progress",_.Callbacks("memory"),_.Callbacks("memory"),2],["resolve","done",_.Callbacks("once memory"),_.Callbacks("once memory"),0,"resolved"],["reject","fail",_.Callbacks("once memory"),_.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return a.done(arguments).fail(arguments),this},catch:function(e){return i.then(null,e)},pipe:function(){var e=arguments;return _.Deferred((function(r){_.each(t,(function(t,n){var i=m(e[n[4]])&&e[n[4]];a[n[1]]((function(){var e=i&&i.apply(this,arguments);e&&m(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[n[0]+"With"](this,i?[e]:arguments)}))})),e=null})).promise()},then:function(e,r,i){var a=0;function o(e,t,r,i){return function(){var s=this,l=arguments,u=function(){var n,u;if(!(e=a&&(r!==j&&(s=void 0,l=[n]),t.rejectWith(s,l))}};e?c():(_.Deferred.getStackHook&&(c.stackTrace=_.Deferred.getStackHook()),n.setTimeout(c))}}return _.Deferred((function(n){t[0][3].add(o(0,n,m(i)?i:M,n.notifyWith)),t[1][3].add(o(0,n,m(e)?e:M)),t[2][3].add(o(0,n,m(r)?r:j))})).promise()},promise:function(e){return null!=e?_.extend(e,i):i}},a={};return _.each(t,(function(e,n){var o=n[2],s=n[5];i[n[1]]=o.add,s&&o.add((function(){r=s}),t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),o.add(n[3].fire),a[n[0]]=function(){return a[n[0]+"With"](this===a?void 0:this,arguments),this},a[n[0]+"With"]=o.fireWith})),i.promise(a),e&&e.call(a,a),a},when:function(e){var t=arguments.length,r=t,n=Array(r),i=s.call(arguments),a=_.Deferred(),o=function(e){return function(r){n[e]=this,i[e]=arguments.length>1?s.call(arguments):r,--t||a.resolveWith(n,i)}};if(t<=1&&(K(e,a.done(o(r)).resolve,a.reject,!t),"pending"===a.state()||m(i[r]&&i[r].then)))return a.then();for(;r--;)K(i[r],o(r),a.reject);return a.promise()}});var F=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;_.Deferred.exceptionHook=function(e,t){n.console&&n.console.warn&&e&&F.test(e.name)&&n.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},_.readyException=function(e){n.setTimeout((function(){throw e}))};var q=_.Deferred();function H(){C.removeEventListener("DOMContentLoaded",H),n.removeEventListener("load",H),_.ready()}_.fn.ready=function(e){return q.then(e).catch((function(e){_.readyException(e)})),this},_.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--_.readyWait:_.isReady)||(_.isReady=!0,!0!==e&&--_.readyWait>0||q.resolveWith(C,[_]))}}),_.ready.then=q.then,"complete"===C.readyState||"loading"!==C.readyState&&!C.documentElement.doScroll?n.setTimeout(_.ready):(C.addEventListener("DOMContentLoaded",H),n.addEventListener("load",H));var G=function(e,t,r,n,i,a,o){var s=0,l=e.length,u=null==r;if("object"===T(r))for(s in i=!0,r)G(e,t,s,r[s],!0,a,o);else if(void 0!==n&&(i=!0,m(n)||(o=!0),u&&(o?(t.call(e,n),t=null):(u=t,t=function(e,t,r){return u.call(_(e),r)})),t))for(;s1,null,!0)},removeData:function(e){return this.each((function(){J.remove(this,e)}))}}),_.extend({queue:function(e,t,r){var n;if(e)return t=(t||"fx")+"queue",n=Z.get(e,t),r&&(!n||Array.isArray(r)?n=Z.access(e,t,_.makeArray(r)):n.push(r)),n||[]},dequeue:function(e,t){t=t||"fx";var r=_.queue(e,t),n=r.length,i=r.shift(),a=_._queueHooks(e,t);"inprogress"===i&&(i=r.shift(),n--),i&&("fx"===t&&r.unshift("inprogress"),delete a.stop,i.call(e,(function(){_.dequeue(e,t)}),a)),!n&&a&&a.empty.fire()},_queueHooks:function(e,t){var r=t+"queueHooks";return Z.get(e,r)||Z.access(e,r,{empty:_.Callbacks("once memory").add((function(){Z.remove(e,[t+"queue",r])}))})}}),_.fn.extend({queue:function(e,t){var r=2;return"string"!=typeof e&&(t=e,e="fx",r--),arguments.length\x20\t\r\n\f]*)/i,ve=/^$|^module$|\/(?:java|ecma)script/i;pe=C.createDocumentFragment().appendChild(C.createElement("div")),(ge=C.createElement("input")).setAttribute("type","radio"),ge.setAttribute("checked","checked"),ge.setAttribute("name","t"),pe.appendChild(ge),y.checkClone=pe.cloneNode(!0).cloneNode(!0).lastChild.checked,pe.innerHTML="",y.noCloneChecked=!!pe.cloneNode(!0).lastChild.defaultValue,pe.innerHTML="",y.option=!!pe.lastChild;var Ce={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Ee(e,t){var r;return r=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&k(e,t)?_.merge([e],r):r}function be(e,t){for(var r=0,n=e.length;r",""]);var Te=/<|&#?\w+;/;function Se(e,t,r,n,i){for(var a,o,s,l,u,c,f=t.createDocumentFragment(),d=[],h=0,p=e.length;h-1)i&&i.push(a);else if(u=se(a),o=Ee(f.appendChild(a),"script"),u&&be(o),r)for(c=0;a=o[c++];)ve.test(a.type||"")&&r.push(a);return f}var _e=/^([^.]*)(?:\.(.+)|)/;function Ae(){return!0}function Ie(){return!1}function we(e,t){return e===function(){try{return C.activeElement}catch(e){}}()==("focus"===t)}function Be(e,t,r,n,i,a){var o,s;if("object"==typeof t){for(s in"string"!=typeof r&&(n=n||r,r=void 0),t)Be(e,s,r,n,t[s],a);return e}if(null==n&&null==i?(i=r,n=r=void 0):null==i&&("string"==typeof r?(i=n,n=void 0):(i=n,n=r,r=void 0)),!1===i)i=Ie;else if(!i)return e;return 1===a&&(o=i,i=function(e){return _().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=_.guid++)),e.each((function(){_.event.add(this,t,i,n,r)}))}function Ne(e,t,r){r?(Z.set(e,t,!1),_.event.add(e,t,{namespace:!1,handler:function(e){var n,i,a=Z.get(this,t);if(1&e.isTrigger&&this[t]){if(a.length)(_.event.special[t]||{}).delegateType&&e.stopPropagation();else if(a=s.call(arguments),Z.set(this,t,a),n=r(this,t),this[t](),a!==(i=Z.get(this,t))||n?Z.set(this,t,!1):i={},a!==i)return e.stopImmediatePropagation(),e.preventDefault(),i&&i.value}else a.length&&(Z.set(this,t,{value:_.event.trigger(_.extend(a[0],_.Event.prototype),a.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Z.get(e,t)&&_.event.add(e,t,Ae)}_.event={global:{},add:function(e,t,r,n,i){var a,o,s,l,u,c,f,d,h,p,g,y=Z.get(e);if(Y(e))for(r.handler&&(r=(a=r).handler,i=a.selector),i&&_.find.matchesSelector(oe,i),r.guid||(r.guid=_.guid++),(l=y.events)||(l=y.events=Object.create(null)),(o=y.handle)||(o=y.handle=function(t){return void 0!==_&&_.event.triggered!==t.type?_.event.dispatch.apply(e,arguments):void 0}),u=(t=(t||"").match(V)||[""]).length;u--;)h=g=(s=_e.exec(t[u])||[])[1],p=(s[2]||"").split(".").sort(),h&&(f=_.event.special[h]||{},h=(i?f.delegateType:f.bindType)||h,f=_.event.special[h]||{},c=_.extend({type:h,origType:g,data:n,handler:r,guid:r.guid,selector:i,needsContext:i&&_.expr.match.needsContext.test(i),namespace:p.join(".")},a),(d=l[h])||((d=l[h]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,n,p,o)||e.addEventListener&&e.addEventListener(h,o)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=r.guid)),i?d.splice(d.delegateCount++,0,c):d.push(c),_.event.global[h]=!0)},remove:function(e,t,r,n,i){var a,o,s,l,u,c,f,d,h,p,g,y=Z.hasData(e)&&Z.get(e);if(y&&(l=y.events)){for(u=(t=(t||"").match(V)||[""]).length;u--;)if(h=g=(s=_e.exec(t[u])||[])[1],p=(s[2]||"").split(".").sort(),h){for(f=_.event.special[h]||{},d=l[h=(n?f.delegateType:f.bindType)||h]||[],s=s[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=a=d.length;a--;)c=d[a],!i&&g!==c.origType||r&&r.guid!==c.guid||s&&!s.test(c.namespace)||n&&n!==c.selector&&("**"!==n||!c.selector)||(d.splice(a,1),c.selector&&d.delegateCount--,f.remove&&f.remove.call(e,c));o&&!d.length&&(f.teardown&&!1!==f.teardown.call(e,p,y.handle)||_.removeEvent(e,h,y.handle),delete l[h])}else for(h in l)_.event.remove(e,h+t[u],r,n,!0);_.isEmptyObject(l)&&Z.remove(e,"handle events")}},dispatch:function(e){var t,r,n,i,a,o,s=new Array(arguments.length),l=_.event.fix(e),u=(Z.get(this,"events")||Object.create(null))[l.type]||[],c=_.event.special[l.type]||{};for(s[0]=l,t=1;t=1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&("click"!==e.type||!0!==u.disabled)){for(a=[],o={},r=0;r-1:_.find(i,this,null,[u]).length),o[i]&&a.push(n);a.length&&s.push({elem:u,handlers:a})}return u=this,l\s*$/g;function xe(e,t){return k(e,"table")&&k(11!==t.nodeType?t:t.firstChild,"tr")&&_(e).children("tbody")[0]||e}function Re(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Ue(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var r,n,i,a,o,s;if(1===t.nodeType){if(Z.hasData(e)&&(s=Z.get(e).events))for(i in Z.remove(t,"handle events"),s)for(r=0,n=s[i].length;r1&&"string"==typeof p&&!y.checkClone&&Le.test(p))return e.each((function(i){var a=e.eq(i);g&&(t[0]=p.call(this,i,a.html())),Ve(a,t,r,n)}));if(d&&(a=(i=Se(t,e[0].ownerDocument,!1,e,n)).firstChild,1===i.childNodes.length&&(i=a),a||n)){for(s=(o=_.map(Ee(i,"script"),Re)).length;f0&&be(o,!l&&Ee(e,"script")),s},cleanData:function(e){for(var t,r,n,i=_.event.special,a=0;void 0!==(r=e[a]);a++)if(Y(r)){if(t=r[Z.expando]){if(t.events)for(n in t.events)i[n]?_.event.remove(r,n):_.removeEvent(r,n,t.handle);r[Z.expando]=void 0}r[J.expando]&&(r[J.expando]=void 0)}}}),_.fn.extend({detach:function(e){return Me(this,e,!0)},remove:function(e){return Me(this,e)},text:function(e){return G(this,(function(e){return void 0===e?_.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Ve(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||xe(this,e).appendChild(e)}))},prepend:function(){return Ve(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=xe(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Ve(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Ve(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(_.cleanData(Ee(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return _.clone(this,e,t)}))},html:function(e){return G(this,(function(e){var t=this[0]||{},r=0,n=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!ke.test(e)&&!Ce[(me.exec(e)||["",""])[1].toLowerCase()]){e=_.htmlPrefilter(e);try{for(;r=0&&(l+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-a-l-s-.5))||0),l}function rt(e,t,r){var n=Ke(e),i=(!y.boxSizingReliable()||r)&&"border-box"===_.css(e,"boxSizing",!1,n),a=i,o=He(e,t,n),s="offset"+t[0].toUpperCase()+t.slice(1);if(je.test(o)){if(!r)return o;o="auto"}return(!y.boxSizingReliable()&&i||!y.reliableTrDimensions()&&k(e,"tr")||"auto"===o||!parseFloat(o)&&"inline"===_.css(e,"display",!1,n))&&e.getClientRects().length&&(i="border-box"===_.css(e,"boxSizing",!1,n),(a=s in e)&&(o=e[s])),(o=parseFloat(o)||0)+tt(e,t,r||(i?"border":"content"),a,n,o)+"px"}function nt(e,t,r,n,i){return new nt.prototype.init(e,t,r,n,i)}_.extend({cssHooks:{opacity:{get:function(e,t){if(t){var r=He(e,"opacity");return""===r?"1":r}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,r,n){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,a,o,s=X(t),l=$e.test(t),u=e.style;if(l||(t=Xe(s)),o=_.cssHooks[t]||_.cssHooks[s],void 0===r)return o&&"get"in o&&void 0!==(i=o.get(e,!1,n))?i:u[t];"string"===(a=typeof r)&&(i=ie.exec(r))&&i[1]&&(r=ce(e,t,i),a="number"),null!=r&&r==r&&("number"!==a||l||(r+=i&&i[3]||(_.cssNumber[s]?"":"px")),y.clearCloneStyle||""!==r||0!==t.indexOf("background")||(u[t]="inherit"),o&&"set"in o&&void 0===(r=o.set(e,r,n))||(l?u.setProperty(t,r):u[t]=r))}},css:function(e,t,r,n){var i,a,o,s=X(t);return $e.test(t)||(t=Xe(s)),(o=_.cssHooks[t]||_.cssHooks[s])&&"get"in o&&(i=o.get(e,!0,r)),void 0===i&&(i=He(e,t,n)),"normal"===i&&t in Je&&(i=Je[t]),""===r||r?(a=parseFloat(i),!0===r||isFinite(a)?a||0:i):i}}),_.each(["height","width"],(function(e,t){_.cssHooks[t]={get:function(e,r,n){if(r)return!Ye.test(_.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?rt(e,t,n):Fe(e,Ze,(function(){return rt(e,t,n)}))},set:function(e,r,n){var i,a=Ke(e),o=!y.scrollboxSize()&&"absolute"===a.position,s=(o||n)&&"border-box"===_.css(e,"boxSizing",!1,a),l=n?tt(e,t,n,s,a):0;return s&&o&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(a[t])-tt(e,t,"border",!1,a)-.5)),l&&(i=ie.exec(r))&&"px"!==(i[3]||"px")&&(e.style[t]=r,r=_.css(e,t)),et(0,r,l)}}})),_.cssHooks.marginLeft=Ge(y.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(He(e,"marginLeft"))||e.getBoundingClientRect().left-Fe(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),_.each({margin:"",padding:"",border:"Width"},(function(e,t){_.cssHooks[e+t]={expand:function(r){for(var n=0,i={},a="string"==typeof r?r.split(" "):[r];n<4;n++)i[e+ae[n]+t]=a[n]||a[n-2]||a[0];return i}},"margin"!==e&&(_.cssHooks[e+t].set=et)})),_.fn.extend({css:function(e,t){return G(this,(function(e,t,r){var n,i,a={},o=0;if(Array.isArray(t)){for(n=Ke(e),i=t.length;o1)}}),_.Tween=nt,nt.prototype={constructor:nt,init:function(e,t,r,n,i,a){this.elem=e,this.prop=r,this.easing=i||_.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=n,this.unit=a||(_.cssNumber[r]?"":"px")},cur:function(){var e=nt.propHooks[this.prop];return e&&e.get?e.get(this):nt.propHooks._default.get(this)},run:function(e){var t,r=nt.propHooks[this.prop];return this.options.duration?this.pos=t=_.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),r&&r.set?r.set(this):nt.propHooks._default.set(this),this}},nt.prototype.init.prototype=nt.prototype,nt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=_.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){_.fx.step[e.prop]?_.fx.step[e.prop](e):1!==e.elem.nodeType||!_.cssHooks[e.prop]&&null==e.elem.style[Xe(e.prop)]?e.elem[e.prop]=e.now:_.style(e.elem,e.prop,e.now+e.unit)}}},nt.propHooks.scrollTop=nt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},_.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},_.fx=nt.prototype.init,_.fx.step={};var it,at,ot=/^(?:toggle|show|hide)$/,st=/queueHooks$/;function lt(){at&&(!1===C.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(lt):n.setTimeout(lt,_.fx.interval),_.fx.tick())}function ut(){return n.setTimeout((function(){it=void 0})),it=Date.now()}function ct(e,t){var r,n=0,i={height:e};for(t=t?1:0;n<4;n+=2-t)i["margin"+(r=ae[n])]=i["padding"+r]=e;return t&&(i.opacity=i.width=e),i}function ft(e,t,r){for(var n,i=(dt.tweeners[t]||[]).concat(dt.tweeners["*"]),a=0,o=i.length;a1)},removeAttr:function(e){return this.each((function(){_.removeAttr(this,e)}))}}),_.extend({attr:function(e,t,r){var n,i,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return void 0===e.getAttribute?_.prop(e,t,r):(1===a&&_.isXMLDoc(e)||(i=_.attrHooks[t.toLowerCase()]||(_.expr.match.bool.test(t)?ht:void 0)),void 0!==r?null===r?void _.removeAttr(e,t):i&&"set"in i&&void 0!==(n=i.set(e,r,t))?n:(e.setAttribute(t,r+""),r):i&&"get"in i&&null!==(n=i.get(e,t))?n:null==(n=_.find.attr(e,t))?void 0:n)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&k(e,"input")){var r=e.value;return e.setAttribute("type",t),r&&(e.value=r),t}}}},removeAttr:function(e,t){var r,n=0,i=t&&t.match(V);if(i&&1===e.nodeType)for(;r=i[n++];)e.removeAttribute(r)}}),ht={set:function(e,t,r){return!1===t?_.removeAttr(e,r):e.setAttribute(r,r),r}},_.each(_.expr.match.bool.source.match(/\w+/g),(function(e,t){var r=pt[t]||_.find.attr;pt[t]=function(e,t,n){var i,a,o=t.toLowerCase();return n||(a=pt[o],pt[o]=i,i=null!=r(e,t,n)?o:null,pt[o]=a),i}}));var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;function mt(e){return(e.match(V)||[]).join(" ")}function vt(e){return e.getAttribute&&e.getAttribute("class")||""}function Ct(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(V)||[]}_.fn.extend({prop:function(e,t){return G(this,_.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[_.propFix[e]||e]}))}}),_.extend({prop:function(e,t,r){var n,i,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return 1===a&&_.isXMLDoc(e)||(t=_.propFix[t]||t,i=_.propHooks[t]),void 0!==r?i&&"set"in i&&void 0!==(n=i.set(e,r,t))?n:e[t]=r:i&&"get"in i&&null!==(n=i.get(e,t))?n:e[t]},propHooks:{tabIndex:{get:function(e){var t=_.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),y.optSelected||(_.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),_.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){_.propFix[this.toLowerCase()]=this})),_.fn.extend({addClass:function(e){var t,r,n,i,a,o,s,l=0;if(m(e))return this.each((function(t){_(this).addClass(e.call(this,t,vt(this)))}));if((t=Ct(e)).length)for(;r=this[l++];)if(i=vt(r),n=1===r.nodeType&&" "+mt(i)+" "){for(o=0;a=t[o++];)n.indexOf(" "+a+" ")<0&&(n+=a+" ");i!==(s=mt(n))&&r.setAttribute("class",s)}return this},removeClass:function(e){var t,r,n,i,a,o,s,l=0;if(m(e))return this.each((function(t){_(this).removeClass(e.call(this,t,vt(this)))}));if(!arguments.length)return this.attr("class","");if((t=Ct(e)).length)for(;r=this[l++];)if(i=vt(r),n=1===r.nodeType&&" "+mt(i)+" "){for(o=0;a=t[o++];)for(;n.indexOf(" "+a+" ")>-1;)n=n.replace(" "+a+" "," ");i!==(s=mt(n))&&r.setAttribute("class",s)}return this},toggleClass:function(e,t){var r=typeof e,n="string"===r||Array.isArray(e);return"boolean"==typeof t&&n?t?this.addClass(e):this.removeClass(e):m(e)?this.each((function(r){_(this).toggleClass(e.call(this,r,vt(this),t),t)})):this.each((function(){var t,i,a,o;if(n)for(i=0,a=_(this),o=Ct(e);t=o[i++];)a.hasClass(t)?a.removeClass(t):a.addClass(t);else void 0!==e&&"boolean"!==r||((t=vt(this))&&Z.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":Z.get(this,"__className__")||""))}))},hasClass:function(e){var t,r,n=0;for(t=" "+e+" ";r=this[n++];)if(1===r.nodeType&&(" "+mt(vt(r))+" ").indexOf(t)>-1)return!0;return!1}});var Et=/\r/g;_.fn.extend({val:function(e){var t,r,n,i=this[0];return arguments.length?(n=m(e),this.each((function(r){var i;1===this.nodeType&&(null==(i=n?e.call(this,r,_(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=_.map(i,(function(e){return null==e?"":e+""}))),(t=_.valHooks[this.type]||_.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))}))):i?(t=_.valHooks[i.type]||_.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(r=t.get(i,"value"))?r:"string"==typeof(r=i.value)?r.replace(Et,""):null==r?"":r:void 0}}),_.extend({valHooks:{option:{get:function(e){var t=_.find.attr(e,"value");return null!=t?t:mt(_.text(e))}},select:{get:function(e){var t,r,n,i=e.options,a=e.selectedIndex,o="select-one"===e.type,s=o?null:[],l=o?a+1:i.length;for(n=a<0?l:o?a:0;n-1)&&(r=!0);return r||(e.selectedIndex=-1),a}}}}),_.each(["radio","checkbox"],(function(){_.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=_.inArray(_(e).val(),t)>-1}},y.checkOn||(_.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})})),y.focusin="onfocusin"in n;var bt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};_.extend(_.event,{trigger:function(e,t,r,i){var a,o,s,l,u,c,f,d,p=[r||C],g=h.call(e,"type")?e.type:e,y=h.call(e,"namespace")?e.namespace.split("."):[];if(o=d=s=r=r||C,3!==r.nodeType&&8!==r.nodeType&&!bt.test(g+_.event.triggered)&&(g.indexOf(".")>-1&&(y=g.split("."),g=y.shift(),y.sort()),u=g.indexOf(":")<0&&"on"+g,(e=e[_.expando]?e:new _.Event(g,"object"==typeof e&&e)).isTrigger=i?2:3,e.namespace=y.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+y.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:_.makeArray(t,[e]),f=_.event.special[g]||{},i||!f.trigger||!1!==f.trigger.apply(r,t))){if(!i&&!f.noBubble&&!v(r)){for(l=f.delegateType||g,bt.test(l+g)||(o=o.parentNode);o;o=o.parentNode)p.push(o),s=o;s===(r.ownerDocument||C)&&p.push(s.defaultView||s.parentWindow||n)}for(a=0;(o=p[a++])&&!e.isPropagationStopped();)d=o,e.type=a>1?l:f.bindType||g,(c=(Z.get(o,"events")||Object.create(null))[e.type]&&Z.get(o,"handle"))&&c.apply(o,t),(c=u&&o[u])&&c.apply&&Y(o)&&(e.result=c.apply(o,t),!1===e.result&&e.preventDefault());return e.type=g,i||e.isDefaultPrevented()||f._default&&!1!==f._default.apply(p.pop(),t)||!Y(r)||u&&m(r[g])&&!v(r)&&((s=r[u])&&(r[u]=null),_.event.triggered=g,e.isPropagationStopped()&&d.addEventListener(g,Tt),r[g](),e.isPropagationStopped()&&d.removeEventListener(g,Tt),_.event.triggered=void 0,s&&(r[u]=s)),e.result}},simulate:function(e,t,r){var n=_.extend(new _.Event,r,{type:e,isSimulated:!0});_.event.trigger(n,null,t)}}),_.fn.extend({trigger:function(e,t){return this.each((function(){_.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var r=this[0];if(r)return _.event.trigger(e,t,r,!0)}}),y.focusin||_.each({focus:"focusin",blur:"focusout"},(function(e,t){var r=function(e){_.event.simulate(t,e.target,_.event.fix(e))};_.event.special[t]={setup:function(){var n=this.ownerDocument||this.document||this,i=Z.access(n,t);i||n.addEventListener(e,r,!0),Z.access(n,t,(i||0)+1)},teardown:function(){var n=this.ownerDocument||this.document||this,i=Z.access(n,t)-1;i?Z.access(n,t,i):(n.removeEventListener(e,r,!0),Z.remove(n,t))}}}));var St=n.location,_t={guid:Date.now()},At=/\?/;_.parseXML=function(e){var t,r;if(!e||"string"!=typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,"text/xml")}catch(e){}return r=t&&t.getElementsByTagName("parsererror")[0],t&&!r||_.error("Invalid XML: "+(r?_.map(r.childNodes,(function(e){return e.textContent})).join("\n"):e)),t};var It=/\[\]$/,wt=/\r?\n/g,Bt=/^(?:submit|button|image|reset|file)$/i,Nt=/^(?:input|select|textarea|keygen)/i;function kt(e,t,r,n){var i;if(Array.isArray(t))_.each(t,(function(t,i){r||It.test(e)?n(e,i):kt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,r,n)}));else if(r||"object"!==T(t))n(e,t);else for(i in t)kt(e+"["+i+"]",t[i],r,n)}_.param=function(e,t){var r,n=[],i=function(e,t){var r=m(t)?t():t;n[n.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==r?"":r)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!_.isPlainObject(e))_.each(e,(function(){i(this.name,this.value)}));else for(r in e)kt(r,e[r],t,i);return n.join("&")},_.fn.extend({serialize:function(){return _.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=_.prop(this,"elements");return e?_.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!_(this).is(":disabled")&&Nt.test(this.nodeName)&&!Bt.test(e)&&(this.checked||!ye.test(e))})).map((function(e,t){var r=_(this).val();return null==r?null:Array.isArray(r)?_.map(r,(function(e){return{name:t.name,value:e.replace(wt,"\r\n")}})):{name:t.name,value:r.replace(wt,"\r\n")}})).get()}});var Lt=/%20/g,Dt=/#.*$/,xt=/([?&])_=[^&]*/,Rt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ut=/^(?:GET|HEAD)$/,Pt=/^\/\//,Ot={},Vt={},Mt="*/".concat("*"),jt=C.createElement("a");function Kt(e){return function(t,r){"string"!=typeof t&&(r=t,t="*");var n,i=0,a=t.toLowerCase().match(V)||[];if(m(r))for(;n=a[i++];)"+"===n[0]?(n=n.slice(1)||"*",(e[n]=e[n]||[]).unshift(r)):(e[n]=e[n]||[]).push(r)}}function Ft(e,t,r,n){var i={},a=e===Vt;function o(s){var l;return i[s]=!0,_.each(e[s]||[],(function(e,s){var u=s(t,r,n);return"string"!=typeof u||a||i[u]?a?!(l=u):void 0:(t.dataTypes.unshift(u),o(u),!1)})),l}return o(t.dataTypes[0])||!i["*"]&&o("*")}function qt(e,t){var r,n,i=_.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((i[r]?e:n||(n={}))[r]=t[r]);return n&&_.extend(!0,e,n),e}jt.href=St.href,_.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:St.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(St.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Mt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":_.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?qt(qt(e,_.ajaxSettings),t):qt(_.ajaxSettings,e)},ajaxPrefilter:Kt(Ot),ajaxTransport:Kt(Vt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,i,a,o,s,l,u,c,f,d,h=_.ajaxSetup({},t),p=h.context||h,g=h.context&&(p.nodeType||p.jquery)?_(p):_.event,y=_.Deferred(),m=_.Callbacks("once memory"),v=h.statusCode||{},E={},b={},T="canceled",S={readyState:0,getResponseHeader:function(e){var t;if(u){if(!o)for(o={};t=Rt.exec(a);)o[t[1].toLowerCase()+" "]=(o[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=o[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return u?a:null},setRequestHeader:function(e,t){return null==u&&(e=b[e.toLowerCase()]=b[e.toLowerCase()]||e,E[e]=t),this},overrideMimeType:function(e){return null==u&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(u)S.always(e[S.status]);else for(t in e)v[t]=[v[t],e[t]];return this},abort:function(e){var t=e||T;return r&&r.abort(t),A(0,t),this}};if(y.promise(S),h.url=((e||h.url||St.href)+"").replace(Pt,St.protocol+"//"),h.type=t.method||t.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(V)||[""],null==h.crossDomain){l=C.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=jt.protocol+"//"+jt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=_.param(h.data,h.traditional)),Ft(Ot,h,t,S),u)return S;for(f in(c=_.event&&h.global)&&0==_.active++&&_.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Ut.test(h.type),i=h.url.replace(Dt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(Lt,"+")):(d=h.url.slice(i.length),h.data&&(h.processData||"string"==typeof h.data)&&(i+=(At.test(i)?"&":"?")+h.data,delete h.data),!1===h.cache&&(i=i.replace(xt,"$1"),d=(At.test(i)?"&":"?")+"_="+_t.guid+++d),h.url=i+d),h.ifModified&&(_.lastModified[i]&&S.setRequestHeader("If-Modified-Since",_.lastModified[i]),_.etag[i]&&S.setRequestHeader("If-None-Match",_.etag[i])),(h.data&&h.hasContent&&!1!==h.contentType||t.contentType)&&S.setRequestHeader("Content-Type",h.contentType),S.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+Mt+"; q=0.01":""):h.accepts["*"]),h.headers)S.setRequestHeader(f,h.headers[f]);if(h.beforeSend&&(!1===h.beforeSend.call(p,S,h)||u))return S.abort();if(T="abort",m.add(h.complete),S.done(h.success),S.fail(h.error),r=Ft(Vt,h,t,S)){if(S.readyState=1,c&&g.trigger("ajaxSend",[S,h]),u)return S;h.async&&h.timeout>0&&(s=n.setTimeout((function(){S.abort("timeout")}),h.timeout));try{u=!1,r.send(E,A)}catch(e){if(u)throw e;A(-1,e)}}else A(-1,"No Transport");function A(e,t,o,l){var f,d,C,E,b,T=t;u||(u=!0,s&&n.clearTimeout(s),r=void 0,a=l||"",S.readyState=e>0?4:0,f=e>=200&&e<300||304===e,o&&(E=function(e,t,r){for(var n,i,a,o,s=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===n&&(n=e.mimeType||t.getResponseHeader("Content-Type"));if(n)for(i in s)if(s[i]&&s[i].test(n)){l.unshift(i);break}if(l[0]in r)a=l[0];else{for(i in r){if(!l[0]||e.converters[i+" "+l[0]]){a=i;break}o||(o=i)}a=a||o}if(a)return a!==l[0]&&l.unshift(a),r[a]}(h,S,o)),!f&&_.inArray("script",h.dataTypes)>-1&&_.inArray("json",h.dataTypes)<0&&(h.converters["text script"]=function(){}),E=function(e,t,r,n){var i,a,o,s,l,u={},c=e.dataTypes.slice();if(c[1])for(o in e.converters)u[o.toLowerCase()]=e.converters[o];for(a=c.shift();a;)if(e.responseFields[a]&&(r[e.responseFields[a]]=t),!l&&n&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=a,a=c.shift())if("*"===a)a=l;else if("*"!==l&&l!==a){if(!(o=u[l+" "+a]||u["* "+a]))for(i in u)if((s=i.split(" "))[1]===a&&(o=u[l+" "+s[0]]||u["* "+s[0]])){!0===o?o=u[i]:!0!==u[i]&&(a=s[0],c.unshift(s[1]));break}if(!0!==o)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(e){return{state:"parsererror",error:o?e:"No conversion from "+l+" to "+a}}}return{state:"success",data:t}}(h,E,S,f),f?(h.ifModified&&((b=S.getResponseHeader("Last-Modified"))&&(_.lastModified[i]=b),(b=S.getResponseHeader("etag"))&&(_.etag[i]=b)),204===e||"HEAD"===h.type?T="nocontent":304===e?T="notmodified":(T=E.state,d=E.data,f=!(C=E.error))):(C=T,!e&&T||(T="error",e<0&&(e=0))),S.status=e,S.statusText=(t||T)+"",f?y.resolveWith(p,[d,T,S]):y.rejectWith(p,[S,T,C]),S.statusCode(v),v=void 0,c&&g.trigger(f?"ajaxSuccess":"ajaxError",[S,h,f?d:C]),m.fireWith(p,[S,T]),c&&(g.trigger("ajaxComplete",[S,h]),--_.active||_.event.trigger("ajaxStop")))}return S},getJSON:function(e,t,r){return _.get(e,t,r,"json")},getScript:function(e,t){return _.get(e,void 0,t,"script")}}),_.each(["get","post"],(function(e,t){_[t]=function(e,r,n,i){return m(r)&&(i=i||n,n=r,r=void 0),_.ajax(_.extend({url:e,type:t,dataType:i,data:r,success:n},_.isPlainObject(e)&&e))}})),_.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")})),_._evalUrl=function(e,t,r){return _.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){_.globalEval(e,t,r)}})},_.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=_(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return m(e)?this.each((function(t){_(this).wrapInner(e.call(this,t))})):this.each((function(){var t=_(this),r=t.contents();r.length?r.wrapAll(e):t.append(e)}))},wrap:function(e){var t=m(e);return this.each((function(r){_(this).wrapAll(t?e.call(this,r):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){_(this).replaceWith(this.childNodes)})),this}}),_.expr.pseudos.hidden=function(e){return!_.expr.pseudos.visible(e)},_.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},_.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(e){}};var Ht={0:200,1223:204},Gt=_.ajaxSettings.xhr();y.cors=!!Gt&&"withCredentials"in Gt,y.ajax=Gt=!!Gt,_.ajaxTransport((function(e){var t,r;if(y.cors||Gt&&!e.crossDomain)return{send:function(i,a){var o,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)s[o]=e.xhrFields[o];for(o in e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest"),i)s.setRequestHeader(o,i[o]);t=function(e){return function(){t&&(t=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?a(0,"error"):a(s.status,s.statusText):a(Ht[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=t(),r=s.onerror=s.ontimeout=t("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&n.setTimeout((function(){t&&r()}))},t=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}})),_.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),_.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return _.globalEval(e),e}}}),_.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),_.ajaxTransport("script",(function(e){var t,r;if(e.crossDomain||e.scriptAttrs)return{send:function(n,i){t=_(" +{% endblock %} + +{% block content %} +
+

Register new Webauthn credential

+ +
+ To register new credential: +
    +
  1. Insert/connect authenticator and verify user presence.
  2. +
  3. Optionaly set comment for the new credential.
  4. +
  5. Submit the registration.
  6. +
+
+ + {{ render_form(form) }} + {# +
+ {{ form.csrf_token }} +
+ +

To be prepared

+
+ {{ b_wtf.bootstrap_field(form.attestation, horizontal=True) }} + {{ b_wtf.bootstrap_field(form.name, horizontal=True) }} + {{ b_wtf.bootstrap_field(form.submit, horizontal=True) }} +
+ #} +
+{% endblock %} diff --git a/lenticular_cloud/template/skelet.html.j2 b/lenticular_cloud/template/skelet.html.j2 index f80e61e..4240241 100644 --- a/lenticular_cloud/template/skelet.html.j2 +++ b/lenticular_cloud/template/skelet.html.j2 @@ -33,7 +33,9 @@ +{% block script %}{% endblock %} diff --git a/lenticular_cloud/views/admin.py b/lenticular_cloud/views/admin.py index 48df526..3b8cb26 100644 --- a/lenticular_cloud/views/admin.py +++ b/lenticular_cloud/views/admin.py @@ -5,6 +5,7 @@ from flask import jsonify from flask.typing import ResponseReturnValue from flask_login import current_user, logout_user from oauthlib.oauth2.rfc6749.errors import TokenExpiredError +from authlib.integrations.base_client.errors import InvalidTokenError from ory_hydra_client.api.admin import list_o_auth_2_clients, get_o_auth_2_client, update_o_auth_2_client, create_o_auth_2_client from ory_hydra_client.models import OAuth2Client, GenericError from typing import Optional @@ -28,7 +29,7 @@ def before_request() -> Optional[ResponseReturnValue]: return redirect_login() if 'groups' not in data or 'admin' not in data['groups']: return 'Not an admin', 403 - except MissingTokenError: + except (MissingTokenError, InvalidTokenError): return redirect_login() return None diff --git a/lenticular_cloud/views/api.py b/lenticular_cloud/views/api.py index a5e5176..4bb6348 100644 --- a/lenticular_cloud/views/api.py +++ b/lenticular_cloud/views/api.py @@ -8,6 +8,7 @@ from flask.typing import ResponseReturnValue from flask import Blueprint, render_template, request, url_for import logging +import httpx from ..model import User from ..auth_providers import LdapAuthProvider @@ -18,20 +19,43 @@ from ory_hydra_client.models import GenericError api_views = Blueprint('api', __name__, url_prefix='/api') +logger = logging.getLogger(__name__) + @api_views.route('/users', methods=['GET']) def user_list() -> ResponseReturnValue: - if 'authorization' not in request.headers: - return '', 403 - token = request.headers['authorization'].replace('Bearer ', '') - token_info = introspect_o_auth_2_token.sync(_client=hydra_service.hydra_client) +# if 'authorization' not in request.headers: +# return '', 403 +# token = request.headers['authorization'].replace('Bearer ', '') +# token_info = introspect_o_auth_2_token.sync(_client=hydra_service.hydra_client) - if token_info is None or isinstance(token_info, GenericError): - return 'internal errror', 500 +# if token_info is None or isinstance(token_info, GenericError): +# return 'internal errror', 500 - if not isinstance(token_info.scope, str) or 'lc_i_userlist' not in token_info.scope.split(' '): - return '', 403 +# if not isinstance(token_info.scope, str) or 'lc_i_userlist' not in token_info.scope.split(' '): +# return '', 403 return jsonify([ {'username': str(user.username), 'email': str(user.email)} for user in User.query_().all()]) + +@api_views.route('/introspect', methods=['POST']) +def introspect() -> ResponseReturnValue: + token = request.form['token'] + logger.error(f'debug token: {token}') + resp = httpx.post("https://hydra.cloud.tux.ac/oauth2/introspect", data={'token':token}) + #if token_info is None or isinstance(token_info, GenericError): + if resp.status_code != 200: + return jsonify({}), 500 + token_info = resp.json() + #token_info = introspect_o_auth_2_token.sync(_client=hydra_service, token=token) + logger.error(f'debug hydra: {token_info}') + + if not token_info['active']: + return jsonify({'active': False}) + token_info['email'] = token_info['ext']['email'] + + logger.error(f'debug: {token_info}') + + return jsonify(token_info) + diff --git a/lenticular_cloud/views/auth.py b/lenticular_cloud/views/auth.py index d41047c..11b11e1 100644 --- a/lenticular_cloud/views/auth.py +++ b/lenticular_cloud/views/auth.py @@ -64,6 +64,7 @@ async def consent() -> ResponseReturnValue: token_data = { 'name': str(user.username), 'preferred_username': str(user.username), + 'username': str(user.username), 'email': str(user.email), 'email_verified': True, 'groups': [group.name for group in user.groups] diff --git a/lenticular_cloud/views/frontend.py b/lenticular_cloud/views/frontend.py index 3d745fe..c05d4f4 100644 --- a/lenticular_cloud/views/frontend.py +++ b/lenticular_cloud/views/frontend.py @@ -175,7 +175,7 @@ def webauthn_list_route() -> ResponseReturnValue: """list registered credentials for current user""" creds = WebauthnCredential.query.all() - return render_template('webauthn_list.html', creds=creds, button_form=ButtonForm()) + return render_template('frontend/webauthn_list.html', creds=creds, button_form=ButtonForm()) @frontend_views.route('/webauthn/delete/', methods=['POST']) @@ -207,19 +207,15 @@ def random_string(length=32) -> str: def webauthn_pkcco_route() -> ResponseReturnValue: """get publicKeyCredentialCreationOptions""" - form = ButtonForm() - if form.validate_on_submit(): - user = User.query.get(current_user.id) - user_handle = random_string() - exclude_credentials = webauthn_credentials(user) - pkcco, state = webauthn.register_begin( - {'id': user_handle.encode('utf-8'), 'name': user.username, 'displayName': user.username}, - exclude_credentials) - session['webauthn_register_user_handle'] = user_handle - session['webauthn_register_state'] = state - return Response(b64encode(cbor.encode(pkcco)).decode('utf-8'), mimetype='text/plain') - - return '', HTTPStatus.BAD_REQUEST + user = User.query.get(current_user.id) + user_handle = random_string() + exclude_credentials = webauthn_credentials(user) + pkcco, state = webauthn.register_begin( + {'id': user_handle.encode('utf-8'), 'name': user.username, 'displayName': user.username}, + exclude_credentials) + session['webauthn_register_user_handle'] = user_handle + session['webauthn_register_state'] = state + return Response(b64encode(cbor.encode(pkcco)).decode('utf-8'), mimetype='text/plain') @frontend_views.route('/webauthn/register', methods=['GET', 'POST']) @@ -248,7 +244,7 @@ def webauthn_register_route() -> ResponseReturnValue: current_app.logger.exception(e) flash('Error during registration.', 'error') - return render_template('webauthn_register.html', form=form) + return render_template('frontend/webauthn_register.html', form=form) @frontend_views.route('/password_change') diff --git a/lenticular_cloud/views/oauth2.py b/lenticular_cloud/views/oauth2.py index dc62593..421a72e 100644 --- a/lenticular_cloud/views/oauth2.py +++ b/lenticular_cloud/views/oauth2.py @@ -9,7 +9,7 @@ from typing import Optional from ..model import User, SecurityUser def fetch_token(name: str) -> Optional[dict]: - token = session['token'] + token = session.get('token', None) if isinstance(token, dict): return token return None diff --git a/package-lock.json b/package-lock.json index e094990..4ee9039 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@fortawesome/fontawesome-free": "*", "bootstrap": "^4.6.1", + "cbor-web": "*", "css-loader": "*", "css-minimizer-webpack-plugin": "*", "file-loader": "*", @@ -450,6 +451,14 @@ "url": "https://opencollective.com/browserslist" } }, + "node_modules/cbor-web": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/cbor-web/-/cbor-web-8.1.0.tgz", + "integrity": "sha512-2hWHHMVrfffgoEmsAUh8vCxHoLa1vgodtC73+C5cSarkJlwTapnqAzcHINlP6Ej0DXuP4OmmJ9LF+JaNM5Lj/g==", + "engines": { + "node": ">=12.19" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -3279,6 +3288,11 @@ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz", "integrity": "sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ==" }, + "cbor-web": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/cbor-web/-/cbor-web-8.1.0.tgz", + "integrity": "sha512-2hWHHMVrfffgoEmsAUh8vCxHoLa1vgodtC73+C5cSarkJlwTapnqAzcHINlP6Ej0DXuP4OmmJ9LF+JaNM5Lj/g==" + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", diff --git a/package.json b/package.json index 4f4fda6..d32b8f4 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "dependencies": { "@fortawesome/fontawesome-free": "*", "bootstrap": "^4.6.1", + "cbor-web": "*", "css-loader": "*", "css-minimizer-webpack-plugin": "*", "file-loader": "*",