diff --git a/browser_app/confirm-modal.js b/browser_app/confirm-modal.js index b540bea..2e2b73f 100644 --- a/browser_app/confirm-modal.js +++ b/browser_app/confirm-modal.js @@ -3,10 +3,29 @@ const $ = document.querySelector.bind(document) const _ = document.getElementById -export class ConfirmDialog { +export class Dialog { + template(){ + return ` + `; + } + + constructor(title, message) { + this._div = (new DOMParser().parseFromString(this.template(), 'text/html')).body.firstChild; this._div.querySelector('.modal-body').innerHTML = message; } @@ -18,21 +37,16 @@ export class ConfirmDialog { }); this._div.querySelectorAll('.close').forEach(function (o){ - o.onclick=self.cancel.bind(self); + o.onclick=self.close.bind(self); }); - this._div.querySelector('.process').onclick = () => { - self._close(); - self._resolve(); - }; - $('.messages-box').appendChild(this._div); return this._promise } - cancel() { + close() { this._close() - this._reject('canceled by user'); + this._resolve(); } _close() { @@ -43,3 +57,38 @@ export class ConfirmDialog { +export class ConfirmDialog extends Dialog { + template(){ + return ` + `; + } + + show(){ + this._div.querySelector('.process').onclick = () => { + self._close(); + self._resolve(); + }; + return super.show() + } + + close() { + this._close() + this._reject('canceled by user'); + } +} diff --git a/browser_app/index.js b/browser_app/index.js index 298c900..c0cae34 100644 --- a/browser_app/index.js +++ b/browser_app/index.js @@ -1,7 +1,7 @@ import 'jquery'; import 'bootstrap'; import 'jquery-form' -import {ConfirmDialog} from './confirm-modal.js'; +import {ConfirmDialog, Dialog} from './confirm-modal.js'; jQuery = window.$ = window.jQuery = require('jquery'); var forge = require('node-forge'); @@ -39,6 +39,7 @@ function randBase32() { } window.ConfirmDialog = ConfirmDialog; +window.Dialog = Dialog; window.$(document).ready(function () { $('#sidebarCollapse').onclick = function () { @@ -58,7 +59,7 @@ window.totp = { input_secret.value = secret; } - form.querySelector('#name').on('change',window.totp.generate_qrcode); + form.querySelector('#name').onchange=window.totp.generate_qrcode; window.totp.generate_qrcode(); }, generate_qrcode: function(){ @@ -68,7 +69,13 @@ window.totp = { var issuer = 'Lenticular%20Cloud'; var svg_container = $('#svg-container') var svg = new QRCode(`otpauth://totp/${issuer}:${name}?secret=${secret}&issuer=${issuer}`).svg(); - svg_container.html(svg); + var svg_xml =new DOMParser().parseFromString(svg,'text/xml') + if(svg_container.childNodes.length > 0) { + svg_container.childNodes[0].replaceWith(svg_xml.childNodes[0]) + } else { + svg_container.appendChild(svg_xml.childNodes[0]); + } + // .innerHtml=svg; } } @@ -80,15 +87,30 @@ window.fido2 = { window.password_change= { init: function(){ var form = $('form'); - SimpleFormSubmit.submitForm(form.action, form) - .then(response =>{ - }); + form.onsubmit = function () { + SimpleFormSubmit.submitForm(form.action, form) + .then(response =>{ + response.json().then(function(data) { + if (data.errors) { + var msg =''; + new Dialog('Password change Error', `Error Happend: ${msg}`).show() + } else { + new Dialog('Password changed', 'Password changed successfully!').show(); + } + }); + }); + return false; + } } } window.oauth2_token = { revoke: function(href, id){ - var dialog = new ConfirmDialog(`Are you sure to revoke all tokens from client "${id}"?`); + var dialog = new ConfirmDialog('Revoke client tokens', `Are you sure to revoke all tokens from client "${id}"?`); dialog.show().then(()=>{ fetch(href, { method: 'DELETE' @@ -151,7 +173,7 @@ window.client_cert = { }); }, revoke_certificate: function(href, id){ - var dialog = new ConfirmDialog(`Are you sure to revoke the certificate with the fingerprint ${id}?`); + var dialog = new ConfirmDialog('Revoke client certificate', `Are you sure to revoke the certificate with the fingerprint ${id}?`); dialog.show().then(()=>{ fetch(href, { method: 'DELETE' diff --git a/lenticular_cloud/app.py b/lenticular_cloud/app.py index b4617ad..48e42ac 100644 --- a/lenticular_cloud/app.py +++ b/lenticular_cloud/app.py @@ -40,7 +40,7 @@ def init_app(name=None): model.ldap_conn = app.ldap_conn model.base_dn = app.config['LDAP_BASE_DN'] - from .model_db import db + from .model import db db.init_app(app) with app.app_context(): db.create_all() diff --git a/lenticular_cloud/auth_providers.py b/lenticular_cloud/auth_providers.py index 35e819c..9e5accc 100644 --- a/lenticular_cloud/auth_providers.py +++ b/lenticular_cloud/auth_providers.py @@ -1,9 +1,14 @@ from flask import current_app from .form.auth import PasswordForm, TotpForm, Fido2Form -from ldap3 import Server, Connection +from ldap3 import Server, Connection, HASHED_SALTED_SHA256 from ldap3.core.exceptions import LDAPException +from .model import User +import logging + + +logger = logging.getLogger(__name__) + -import pyotp class AuthProvider: @@ -31,8 +36,9 @@ class LdapAuthProvider(AuthProvider): return PasswordForm(prefix='password') @staticmethod - def check_auth(user, form): - return LdapAuthProvider.check_auth_internal(user, form.data['password']) + def check_auth(user: User, form): + return LdapAuthProvider.check_auth_internal( + user, form.data['password']) @staticmethod def check_auth_internal(user, password): diff --git a/lenticular_cloud/form/frontend.py b/lenticular_cloud/form/frontend.py index 328348c..c5c6997 100644 --- a/lenticular_cloud/form/frontend.py +++ b/lenticular_cloud/form/frontend.py @@ -35,9 +35,9 @@ class TOTPDeleteForm(FlaskForm): class PasswordChangeForm(FlaskForm): - old_password = PasswordField(gettext('Old Password'), validators=[DataRequired()]) - password = PasswordField(gettext('New Password'), validators=[DataRequired()]) - password_repeat = PasswordField(gettext('Repeat Password'), validators=[DataRequired(),EqualTo('password')]) + password_old = PasswordField(gettext('Old Password'), validators=[DataRequired()]) + password_new = PasswordField(gettext('New Password'), validators=[DataRequired()]) + password_repeat = PasswordField(gettext('Repeat Password'), validators=[DataRequired(),EqualTo('password_new')]) submit = SubmitField(gettext('Change Password')) class OidcAuthenticationConfirm(FlaskForm): diff --git a/lenticular_cloud/model.py b/lenticular_cloud/model.py index 50968bb..b1e2571 100644 --- a/lenticular_cloud/model.py +++ b/lenticular_cloud/model.py @@ -1,8 +1,9 @@ from flask import current_app from ldap3_orm import AttrDef, EntryBase as _EntryBase, ObjectDef, EntryType from ldap3_orm import Reader -from ldap3 import Entry +from ldap3 import Entry, HASHED_SALTED_SHA256 from ldap3.utils.conv import escape_filter_chars +from ldap3.utils.hashed import hashed from flask_login import UserMixin from ldap3.core.exceptions import LDAPSessionTerminatedByServerError from cryptography.hazmat.primitives import hashes @@ -12,10 +13,21 @@ from datetime import datetime from dateutil import tz import pyotp import json +import logging +import crypt +from flask_sqlalchemy import SQLAlchemy, orm +from datetime import datetime +import uuid +import pyotp + +logger = logging.getLogger(__name__) ldap_conn = None # type: Connection base_dn = '' +db = SQLAlchemy() # type: SQLAlchemy + + class SecurityUser(UserMixin): @@ -35,16 +47,18 @@ class LambdaStr: return self.lam() -class EntryBase(object): +class EntryBase(db.Model): + __abstract__ = True # for sqlalchemy + _type = None # will get replaced by the local type _query_object = None # will get replaced by the local type _base_dn = LambdaStr(lambda: base_dn) - def __init__(self, ldap_object=None, **kwargs): - if ldap_object is None: - self._ldap_object = self.get_type()(**kwargs) - else: - self._ldap_object = ldap_object +# def __init__(self, ldap_object=None, **kwargs): +# if ldap_object is None: +# self._ldap_object = self.get_type()(**kwargs) +# else: +# self._ldap_object = ldap_object def __str__(self): return str(self._ldap_object) @@ -64,14 +78,17 @@ class EntryBase(object): return cls._type def commit(self): + self._ldap_object.entry_commit_changes() + + def add(self): print(self._ldap_object.entry_attributes_as_dict) ret = ldap_conn.add( self.dn, self.object_classes, self._ldap_object.entry_attributes_as_dict) - print(ret) + logger.debug(ret) pass @classmethod - def query(cls): + def query_(cls): if cls._query_object is None: cls._query_object = cls._query(cls) return cls._query_object @@ -188,77 +205,26 @@ class Certificate(object): return f'Certificate(cn={self._cn}, ca_name={self._ca_name}, not_valid_before={self.not_valid_before}, not_valid_after={self.not_valid_after})' -class Totp(object): - - def __init__(self, name, secret, created_at=datetime.now()): - self._secret = secret - self._name = name - self._created_at = created_at - - @property - def name(self): - return self._name - - @property - def created_at(self): - return self._created_at - - def verify(self, token: str): - totp = pyotp.TOTP(self._secret) - return totp.verify(token) - - def to_dict(self): - return { - 'secret': self._secret, - 'name': self._name, - 'created_at': int(self._created_at.timestamp())} - - @staticmethod - def from_dict(data): - return Totp( - name=data['name'], - secret=data['secret'], - created_at=datetime.fromtimestamp(data['created_at'])) - - -class TotpList(MutableSequence): - def __init__(self, ldap_attr): - super().__init__() - self._ldap_attr = ldap_attr - - def __getitem__(self, ii): - return Totp.from_dict(json.loads(self._ldap_attr[ii])) - - def __setitem__(self, ii, val: Totp): - self._ldap_attr[ii] = json.dumps(val.to_dict()).encode() - - def __len__(self): - return len(self._ldap_attr) - - def __delitem__(self, ii): - del self._ldap_attr[ii] - - def delete(self, totp_name): - for i in range(len(self)): - if self[i].name == totp_name: - self._ldap_attr.delete(self._ldap_attr[i]) - - def insert(self, ii, val): - self.append(val) - - def append(self, val): - self._ldap_attr.add(json.dumps(val.to_dict()).encode()) +def generate_uuid(): + return str(uuid.uuid4()) class User(EntryBase): + id = db.Column( + db.String(length=36), primary_key=True, default=generate_uuid) + username = db.Column( + db.String, unique=True) + + totps = db.relationship('Totp', back_populates='user') + dn = "uid={uid},{base_dn}" base_dn = "ou=users,{_base_dn}" object_classes = ["top", "inetOrgPerson", "LenticularUser"] - def __init__(self, ldap_object=None, **kwargs): - super().__init__(ldap_object, **kwargs) - self._totp_list = TotpList(ldap_object.totpSecret) + def __init__(self,**kwargs): + self._ldap_object = None + super(db.Model).__init__(**kwargs) @property def is_authenticated(self): @@ -269,24 +235,11 @@ class User(EntryBase): def make_writeable(self): self._ldap_object = self._ldap_object.entry_writable() - self._totp_list = TotpList(self._ldap_object.totpSecret) @property def entry_dn(self): return self._ldap_object.entry_dn - @property - def username(self): - return self._ldap_object.uid - - @username.setter - def username(self, value): - self._ldap_object.uid = value - - @property - def userPassword(self): - return self._ldap_object.userPassword - @property def fullname(self): return self._ldap_object.fullname @@ -315,14 +268,24 @@ class User(EntryBase): def gpg_public_key(self): return self._ldap_object.gpgPublicKey - @property - def totps(self): - return self._totp_list + def change_password(self, password_new: str): + self.make_writeable() + password_hashed = crypt.crypt(password_new) + self._ldap_object.userPassword = ('{CRYPT}' + password_hashed).encode() + self.commit() class _query(EntryBase._query): def _mapping(self, ldap_object): - return User(ldap_object=ldap_object) + user = User.query.filter(User.username == str(ldap_object.uid)).first() + if user is None: + # migration time + user = User() + user.username = str(ldap_object.uid) + db.session.add(user) + db.session.commit() + user._ldap_object = ldap_object + return user def by_username(self, username) -> 'User': result = self._query('(uid={username:s})'.format(username=escape_filter_chars(username))) @@ -333,7 +296,23 @@ class User(EntryBase): +class Totp(db.Model): + id = db.Column(db.Integer, primary_key=True) + secret = db.Column(db.String, nullable=False) + name = db.Column(db.String, nullable=False) + created_at = db.Column(db.DateTime, default=datetime.now, nullable=False) + + user_id = db.Column( + db.String(length=36), + db.ForeignKey(User.id), nullable=False) + user = db.relationship(User) + + def verify(self, token: str): + totp = pyotp.TOTP(self.secret) + return totp.verify(token) + class Group(EntryBase): + __abstract__ = True # for sqlalchemy, disable for now dn = "cn={cn},{base_dn}" base_dn = "ou=Users,{_base_dn}" object_classes = ["top"] diff --git a/lenticular_cloud/model_db.py b/lenticular_cloud/model_db.py index fe96434..f53b428 100644 --- a/lenticular_cloud/model_db.py +++ b/lenticular_cloud/model_db.py @@ -1,5 +1,7 @@ from flask_sqlalchemy import SQLAlchemy, orm +from datetime import datetime import uuid +import pyotp db = SQLAlchemy() # type: SQLAlchemy @@ -8,39 +10,26 @@ def generate_uuid(): return str(uuid.uuid4()) -class OAuth(db.Model): - token = db.Column(db.Text, primary_key=True) - provider = db.Column(db.Text) - provider_username = db.Column(db.Text) - - class User(db.Model): - id = db.Column(db.String(length=36), primary_key=True, default=generate_uuid) - username = db.Column(db.String, unique=True) + id = db.Column( + db.String(length=36), primary_key=True, default=generate_uuid) + username = db.Column( + db.String, unique=True) + + totps = db.relationship('Totp', back_populates='user') -class Client(db.Model): - key = db.Column(db.Text, primary_key=True) - value = db.Column(db.Text) - - -class AuthzCode(db.Model): - key = db.Column(db.Text, primary_key=True) - value = db.Column(db.Text) - - -class AccessToken(db.Model): - key = db.Column(db.Text, primary_key=True) - value = db.Column(db.Text) - - -class RefreshToken(db.Model): - key = db.Column(db.Text, primary_key=True) - value = db.Column(db.Text) - - -class SubjectIdentifier(db.Model): - key = db.Column(db.Text, primary_key=True) - value = db.Column(db.Text) +class Totp(object): + id = db.Column(db.Integer, primary_key=True) + secret = db.Column(db.String, nullable=False) + name = db.Column(db.String, nullable=False) + created_at = db.Column(db.DateTime, default=datetime.now, nullable=False) + user_id = db.Column( + db.Integer, + db.ForeignKey(User.id), nullable=False) + user = db.relationship(User) + def verify(self, token: str): + totp = pyotp.TOTP(self._secret) + return totp.verify(token) diff --git a/lenticular_cloud/views/api.py b/lenticular_cloud/views/api.py index d8f60ba..3e00f85 100644 --- a/lenticular_cloud/views/api.py +++ b/lenticular_cloud/views/api.py @@ -11,7 +11,6 @@ import logging import requests from ..model import User -from ..model_db import User as DbUser from ..auth_providers import LdapAuthProvider @@ -19,11 +18,15 @@ api_views = Blueprint('api', __name__, url_prefix='/api') @api_views.route('/userinfo', methods=['GET', 'POST']) def userinfo(): + if 'authorization' not in request.headers: + return 'not token found', 400 token = request.headers['authorization'].replace('Bearer ', '') token_info = current_app.hydra_api.introspect_o_auth2_token(token=token) + if not token_info.active: + return 'token not valid', 403 - user_db = DbUser.query.get(token_info.sub) - user = User.query().by_username(user_db.username) + user_db = User.query.get(token_info.sub) + user = User.query_().by_username(user_db.username) public_url = current_app.config.get('HYDRA_PUBLIC_URL') r = requests.get( @@ -50,5 +53,6 @@ def user_list(): if '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()]) + return jsonify([ + {'username': str(user.username), 'email': str(user.email)} + for user in User.query_().all()]) diff --git a/lenticular_cloud/views/auth.py b/lenticular_cloud/views/auth.py index f458459..65cdfff 100644 --- a/lenticular_cloud/views/auth.py +++ b/lenticular_cloud/views/auth.py @@ -14,8 +14,7 @@ from urllib.parse import urlparse from base64 import b64decode, b64encode import http -from ..model import User, SecurityUser -from ..model_db import db, User as DbUser +from ..model import db, User, SecurityUser from ..form.auth import ConsentForm, LoginForm from ..auth_providers import AUTH_PROVIDER_LIST @@ -29,7 +28,7 @@ def consent(): # DUMMPY ONLY form = ConsentForm() - remember_for = 60*60*24*7 # remember for 7 days + remember_for = 60*60*24*30 # remember for 7 days consent_request = current_app.hydra_api.get_consent_request( request.args['consent_challenge']) @@ -42,7 +41,7 @@ def consent(): 'grant_scope': requested_scope, 'grant_access_token_audience': requested_audiences, 'remember': form.data['remember'], -# 'remember_for': remember_for, + 'remember_for': remember_for, }) return redirect(resp.redirect_to) return render_template( @@ -65,7 +64,7 @@ def login(): return redirect(resp.redirect_to) form = LoginForm() if form.validate_on_submit(): - user = User.query().by_username(form.data['name']) + user = User.query_().by_username(form.data['name']) if user: session['username'] = str(user.username) else: @@ -83,7 +82,7 @@ def login_auth(): if 'username' not in session: return redirect(url_for('auth.login')) auth_forms = {} - user = User.query().by_username(session['username']) + user = User.query_().by_username(session['username']) for auth_provider in AUTH_PROVIDER_LIST: form = auth_provider.get_form() if auth_provider.get_name() not in session['auth_providers'] and\ @@ -95,31 +94,18 @@ def login_auth(): if len(session['auth_providers']) >= 2: remember_me = True - db_user = DbUser.query.filter(DbUser.username == session['username']).one_or_none() - if db_user is None: - db_user = DbUser(username=session['username']) - db.session.add(db_user) - db.session.commit() +# if db_user is None: +# db_user = User(username=session['username']) +# db.session.add(db_user) +# db.session.commit() - subject = db_user.id + subject = user.id resp = current_app.hydra_api.accept_login_request( login_challenge, body={ 'subject': subject, 'remember': remember_me}) return redirect(resp.redirect_to) - - login_user(SecurityUser(session['username'])) - # TODO use this var - _next = None - try: - _next_url = urlparse(b64decode(request.args.get('next')).decode()) - _host_url = urlparse(request.url) - if _next_url.scheme == _host_url.scheme and _next_url.netloc == _host_url.netloc : - _next = _next_url.geturl() - except TypeError: - _next = None - return redirect(_next or url_for('frontend.index')) return render_template('auth/login_auth.html.j2', forms=auth_forms) @@ -128,7 +114,7 @@ def logout(): logout_challenge = request.args.get('logout_challenge') logout_request = current_app.hydra_api.get_logout_request(logout_challenge) resp = current_app.hydra_api.accept_logout_request(logout_challenge) - logout_user() + # TODO confirm return redirect(resp.redirect_to) diff --git a/lenticular_cloud/views/frontend.py b/lenticular_cloud/views/frontend.py index 0bf3b34..e68dd8d 100644 --- a/lenticular_cloud/views/frontend.py +++ b/lenticular_cloud/views/frontend.py @@ -1,46 +1,47 @@ from urllib.parse import urlencode, parse_qs -import flask from flask import Blueprint, redirect -from flask import current_app, session -from flask import jsonify, send_file -from flask.helpers import make_response -from flask.templating import render_template -from oic.oic.message import TokenErrorResponse, UserInfoErrorResponse, EndSessionRequest - -from pyop.access_token import AccessToken, BearerTokenError -from pyop.exceptions import InvalidAuthenticationRequest, InvalidAccessToken, InvalidClientAuthentication, OAuthError, \ - InvalidSubjectIdentifier, InvalidClientRegistrationRequest -from pyop.util import should_fragment_encode - -from flask import Blueprint, render_template, request, url_for, flash -from flask_login import login_required, login_user, logout_user, current_user +from flask import current_app +from flask import jsonify +from flask import render_template, url_for, flash +from flask_login import login_user, logout_user, current_user from werkzeug.utils import redirect import logging from datetime import timedelta -import pyotp -from base64 import b64decode, b64encode +from base64 import b64decode from flask_dance.consumer import oauth_authorized -from sqlalchemy.orm.exc import NoResultFound from flask_dance.consumer import OAuth2ConsumerBlueprint +from oauthlib.oauth2.rfc6749.errors import TokenExpiredError -from ..model import User, SecurityUser, Totp -from ..model_db import OAuth, db, User as DbUser -from ..form.frontend import ClientCertForm, TOTPForm, TOTPDeleteForm, PasswordChangeForm -from ..auth_providers import AUTH_PROVIDER_LIST - +from ..model import db, User, SecurityUser, Totp +from ..form.frontend import ClientCertForm, TOTPForm, \ + TOTPDeleteForm, PasswordChangeForm +from ..auth_providers import LdapAuthProvider frontend_views = Blueprint('frontend', __name__, url_prefix='') +logger = logging.getLogger(__name__) + + +def before_request(): + try: + resp = current_app.oauth.session.get('/userinfo') + if not current_user.is_authenticated: + return redirect(url_for('oauth.login')) + except TokenExpiredError: + return redirect(url_for('oauth.login')) + + +frontend_views.before_request(before_request) def init_login_manager(app): @app.login_manager.user_loader def user_loader(username): - return User.query().by_username(username) + return User.query_().by_username(username) @app.login_manager.request_loader - def request_loader(request): + def request_loader(_request): pass @app.login_manager.unauthorized_handler @@ -75,25 +76,9 @@ def init_login_manager(app): oauth_info = resp.json() - db_user = DbUser.query.get(str(oauth_info["sub"])) - oauth_username = db_user.username + db_user = User.query.get(str(oauth_info["sub"])) - # Find this OAuth token in the database, or create it - query = OAuth.query.filter_by( - provider=blueprint.name, - provider_username=oauth_username, - ) - try: - oauth = query.one() - except NoResultFound: - oauth = OAuth( - provider=blueprint.name, - provider_username=oauth_username, - token=token, - ) - - - login_user(SecurityUser(oauth.provider_username)) + login_user(SecurityUser(db_user.username)) #flash("Successfully signed in with GitHub.") # Since we're manually creating the OAuth model in the database, @@ -106,27 +91,29 @@ def init_login_manager(app): @frontend_views.route('/logout') def logout(): logout_user() - return redirect(f'{current_app.config["HYDRA_PUBLIC_URL"]}/oauth2/sessions/logout') + return redirect( + f'{current_app.config["HYDRA_PUBLIC_URL"]}/oauth2/sessions/logout') @frontend_views.route('/', methods=['GET']) -@login_required def index(): return render_template('frontend/index.html.j2') @frontend_views.route('/client_cert') -@login_required def client_cert(): client_certs = {} for service in current_app.lenticular_services.values(): - client_certs[str(service.name)] = current_app.pki.get_client_certs(current_user, service) + client_certs[str(service.name)] = \ + current_app.pki.get_client_certs(current_user, service) - return render_template('frontend/client_cert.html.j2', services=current_app.lenticular_services, client_certs=client_certs) + return render_template( + 'frontend/client_cert.html.j2', + services=current_app.lenticular_services, + client_certs=client_certs) @frontend_views.route('/client_cert//') -@login_required def get_client_cert(service_name, serial_number): service = current_app.lenticular_services[service_name] cert = current_app.pki.get_client_cert( @@ -137,8 +124,8 @@ def get_client_cert(service_name, serial_number): }) -@frontend_views.route('/client_cert//', methods=['DELETE']) -@login_required +@frontend_views.route( + '/client_cert//', methods=['DELETE']) def revoke_client_cert(service_name, serial_number): service = current_app.lenticular_services[service_name] cert = current_app.pki.get_client_cert( @@ -150,7 +137,6 @@ def revoke_client_cert(service_name, serial_number): @frontend_views.route( '/client_cert//new', methods=['GET', 'POST']) -@login_required def client_cert_new(service_name): service = current_app.lenticular_services[service_name] form = ClientCertForm() @@ -180,23 +166,20 @@ def client_cert_new(service_name): @frontend_views.route('/totp') -@login_required def totp(): delete_form = TOTPDeleteForm() return render_template('frontend/totp.html.j2', delete_form=delete_form) @frontend_views.route('/totp/new', methods=['GET', 'POST']) -@login_required def totp_new(): form = TOTPForm() if form.validate_on_submit(): totp = Totp(name=form.data['name'], secret=form.data['secret']) if totp.verify(form.data['token']): - current_user.make_writeable() current_user.totps.append(totp) - current_user._ldap_object.entry_commit_changes() + db.session.commit() return jsonify({ 'status': 'ok'}) else: @@ -208,47 +191,55 @@ def totp_new(): return render_template('frontend/totp_new.html.j2', form=form) -@frontend_views.route('/totp//delete', methods=['GET','POST']) -@login_required +@frontend_views.route('/totp//delete', methods=['GET', 'POST']) def totp_delete(totp_name): - current_user.make_writeable() - current_user.totps.delete(totp_name) - current_user._ldap_object.entry_commit_changes() + totp = Totp.query.filter(Totp.name == totp_name).first() + db.session.delete(totp) + db.session.commit() return jsonify({ 'status': 'ok'}) - @frontend_views.route('/password_change') -@login_required def password_change(): - form = PasswordChangeForm() return render_template('frontend/password_change.html.j2', form=form) @frontend_views.route('/password_change', methods=['POST']) -@login_required def password_change_post(): form = PasswordChangeForm() if form.validate(): - return jsonify({}) + password_old = str(form.data['password_old']) + password_new = str(form.data['password_new']) + if not LdapAuthProvider.check_auth_internal( + current_user, password_old): + return jsonify( + {'errors': {'password_old': 'Old Password is invalid'}}) + resp = current_user.change_password(password_new) + if resp: + print(current_user) + return jsonify({}) + else: + return jsonify({'errors': {'internal': 'internal server errror'}}) return jsonify({'errors': form.errors}) @frontend_views.route('/oauth2_token') -@login_required def oauth2_tokens(): subject = current_app.oauth.session.get('/userinfo').json()['sub'] consent_sessions = current_app.hydra_api.list_subject_consent_sessions( subject) - return render_template('frontend/oauth2_tokens.html.j2', consent_sessions=consent_sessions) + print(consent_sessions) + return render_template( + 'frontend/oauth2_tokens.html.j2', + consent_sessions=consent_sessions) + @frontend_views.route('/oauth2_token/', methods=['DELETE']) -@login_required def oauth2_token_revoke(client_id: str): subject = current_app.oauth.session.get('/userinfo').json()['sub'] current_app.hydra_api.revoke_consent_sessions( diff --git a/static/main.js b/static/main.js index c67bdd8..1232499 100644 --- a/static/main.js +++ b/static/main.js @@ -1,3 +1,3 @@ /*! For license information please see main.js.LICENSE.txt */ -!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=40)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t,n,i,a,o){var s=r(0),u=r(51),l=e.exports=s.util=s.util||{};function c(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function f(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(l.isArrayBuffer(e)||l.isArrayBufferView(e))if(void 0!==a&&e instanceof a)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(i=Date.now(),s(e)):(r.push(e),1===r.length&&o.setAttribute("a",a=!a))}}l.nextTick=l.setImmediate}(),l.isNodejs=void 0!==t&&t.versions&&t.versions.node,l.globalScope=l.isNodejs?i:"undefined"==typeof self?window:self,l.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},l.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},l.isArrayBufferView=function(e){return e&&l.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},l.ByteBuffer=f,l.ByteStringBuffer=f;l.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},l.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},l.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},l.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},l.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},l.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},l.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(l.encodeUtf8(e))},l.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},l.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},l.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},l.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},l.ByteStringBuffer.prototype.putInt=function(e,t){c(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},l.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},l.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},l.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},l.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},l.ByteStringBuffer.prototype.copy=function(){var e=l.createBuffer(this.data);return e.read=this.read,e},l.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},l.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},l.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},l.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},l.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},l.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},l.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},l.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},l.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},l.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},l.DataBuffer.prototype.putInt=function(e,t){c(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},l.DataBuffer.prototype.putSignedInt=function(e,t){return c(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},l.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},l.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},l.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},l.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},l.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},l.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},l.DataBuffer.prototype.copy=function(){return new l.DataBuffer(this)},l.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},l.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},l.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},l.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},l.xorBytes=function(e,t,r){for(var n="",i="",a="",o=0,s=0;r>0;--r,++o)i=e.charCodeAt(o)^t.charCodeAt(o),s>=10&&(n+=a,a="",s=0),a+=String.fromCharCode(i),++s;return n+=a},l.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";l.encode64=function(e,t){for(var r,n,i,a="",o="",s=0;s>2),a+=h.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=h.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":h.charAt(63&i)),t&&a.length>t&&(o+=a.substr(0,t)+"\r\n",a=a.substr(t));return o+=a},l.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,a="",o=0;o>4),64!==n&&(a+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(a+=String.fromCharCode((3&n)<<6|i)));return a},l.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},l.decodeUtf8=function(e){return decodeURIComponent(escape(e))},l.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:u.encode,decode:u.decode}},l.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},l.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,a=0;a>2),a+=h.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=h.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":h.charAt(63&i)),t&&a.length>t&&(o+=a.substr(0,t)+"\r\n",a=a.substr(t));return o+=a},l.binary.base64.decode=function(e,t,r){var n,i,a,o,s=t;s||(s=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,l=r=r||0;u>4,64!==a&&(s[l++]=(15&i)<<4|a>>2,64!==o&&(s[l++]=(3&a)<<6|o));return t?l-r:s.subarray(0,l)},l.binary.base58.encode=function(e,t){return l.binary.baseN.encode(e,d,t)},l.binary.base58.decode=function(e,t){return l.binary.baseN.decode(e,d,t)},l.text={utf8:{},utf16:{}},l.text.utf8.encode=function(e,t,r){e=l.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,a=0;a0?(i=r[n].substring(0,o),a=r[n].substring(o+1)):(i=r[n],a=null),i in t||(t[i]=[]),i in Object.prototype||null===a||t[i].push(unescape(a))}return t};return void 0===e?(null===T&&(T="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=T):t=r(e),t},l.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var i=t.split("/");return i.length>0&&""===i[0]&&i.shift(),{pathString:t,queryString:r,path:i,query:""===r?{}:l.getQueryVariables(r)}},l.makeRequest=function(e){var t=l.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},l.makeLink=function(e,t,r){e=o.isArray(e)?e.join("/"):e;var n=o.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},l.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,i=t.length;n0&&a.push(r),o=n.lastIndex;var s=t[0][1];switch(s){case"s":case"o":i");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(e.substring(o)),a.join("")},l.formatNumber=function(e,t,r,n){var i=e,a=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,s=void 0===n?".":n,u=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(a),10)+"",c=l.length>3?l.length%3:0;return u+(c?l.substr(0,c)+s:"")+l.substr(c).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?o+Math.abs(i-l).toFixed(a).slice(2):"")},l.formatSize=function(e){return e=e>=1073741824?l.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?l.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?l.formatNumber(e/1024,0)+" KiB":l.formatNumber(e,0)+" bytes"},l.bytesFromIP=function(e){return-1!==e.indexOf(".")?l.bytesFromIPv4(e):-1!==e.indexOf(":")?l.bytesFromIPv6(e):null},l.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=l.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:s,end:s})}t.push(a)}if(r.length>0){var u=r[n];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},l.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in l&&!e.update)return t(null,l.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return l.cores=navigator.hardwareConcurrency,t(null,l.cores);if("undefined"==typeof Worker)return l.cores=1,t(null,l.cores);if("undefined"==typeof Blob)return l.cores=2,t(null,l.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()s.st&&i.sti.st&&s.stt){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,a,o){if(n.util.isArray(a)){for(var s=[],u=0;ur){if(o.strict){var d=new Error("Too few bytes to read ASN.1 value.");throw d.available=t.length(),d.remaining=r,d.requested=p,d}p=r}var g=32==(32&u);if(g)if(f=[],void 0===p)for(;;){if(a(t,r,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),r-=2;break}s=t.length(),f.push(e(t,r,n+1,o)),r-=s-t.length()}else for(;p>0;)s=t.length(),f.push(e(t,p,n+1,o)),r-=s-t.length(),p-=s-t.length();void 0===f&&l===i.Class.UNIVERSAL&&c===i.Type.BITSTRING&&(h=t.bytes(p));if(void 0===f&&o.decodeBitStrings&&l===i.Class.UNIVERSAL&&c===i.Type.BITSTRING&&p>1){var y=t.read,m=r,v=0;if(c===i.Type.BITSTRING&&(a(t,r,1),v=t.getByte(),r--),0===v)try{s=t.length();var E={verbose:o.verbose,strict:!0,decodeBitStrings:!0},C=e(t,r,n+1,E),b=s-t.length();r-=b,c==i.Type.BITSTRING&&b++;var T=C.tagClass;b!==p||T!==i.Class.UNIVERSAL&&T!==i.Class.CONTEXT_SPECIFIC||(f=[C])}catch(e){}void 0===f&&(t.read=y,r=m)}if(void 0===f){if(void 0===p){if(o.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=r}if(c===i.Type.BMPSTRING)for(f="";p>0;p-=2)a(t,r,2),f+=String.fromCharCode(t.getInt16()),r-=2;else f=t.getBytes(p)}var S=void 0===h?null:{bitStringContents:h};return i.create(l,c,g,f,S)}(e,e.length(),0,t)},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,a=n.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=i.equals(e,e.original))),o)a.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:a.putByte(0);for(var s=0;s1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?a.putBytes(e.value.substr(1)):a.putBytes(e.value);if(t.putByte(r),a.length()<=127)t.putByte(127&a.length());else{var u=a.length(),l="";do{l+=String.fromCharCode(255&u),u>>>=8}while(u>0);t.putByte(128|l.length);for(s=l.length-1;s>=0;--s)t.putByte(l.charCodeAt(s))}return t.putBuffer(a),t},i.oidToDer=function(e){var t,r,i,a,o=e.split("."),s=n.util.createBuffer();s.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var u=2;u>>=7,t||(a|=128),r.push(a),t=!1}while(i>0);for(var l=r.length-1;l>=0;--l)s.putByte(r[l])}return s},i.derToOid=function(e){var t;"string"==typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)i<<=7,128&(r=e.getByte())?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),a=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=0;if(e.length>11){var u=e.charAt(10),l=10;"+"!==u&&"-"!==u&&(s=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(a,o,s,0),l&&("+"===(u=e.charAt(l))||"-"===u)){var c=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);c*=6e4,"+"===u?t.setTime(+t-c):t.setTime(+t+c)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),s=parseInt(e.substr(12,2),10),u=0,l=0,c=!1;"Z"===e.charAt(e.length-1)&&(c=!0);var f=e.length-5,h=e.charAt(f);"+"!==h&&"-"!==h||(l=60*parseInt(e.substr(f+1,2),10)+parseInt(e.substr(f+4,2),10),l*=6e4,"+"===h&&(l*=-1),c=!0);return"."===e.charAt(14)&&(u=1e3*parseFloat(e.substr(14),10)),c?(t.setUTCFullYear(r,n,i),t.setUTCHours(a,o,s,u),t.setTime(+t+l)):(t.setFullYear(r,n,i),t.setHours(a,o,s,u)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"==typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,a){var o=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)a&&(e.tagClass!==t.tagClass&&a.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&a.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(o=!0,t.value&&n.util.isArray(t.value))for(var s=0,u=0;o&&u0&&(a+="\n");for(var s="",u=0;u1?a+="0x"+n.util.bytesToHex(e.value.slice(1)):a+="(none)",e.value.length>0){var h=e.value.charCodeAt(0);1==h?a+=" (1 unused bit shown)":h>1&&(a+=" ("+h+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(o.test(e.value)||(a+="("+e.value+") "),a+="0x"+n.util.bytesToHex(e.value)):e.type===i.Type.UTF8?a+=n.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?a+=e.value:o.test(e.value)?a+="0x"+n.util.bytesToHex(e.value):0===e.value.length?a+="[null]":a+=e.value}return a}},function(e,t,r){(function(t){var n=r(0);r(6),r(30),r(31),r(1),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),a=n.util.createBuffer();function o(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),a.putInt32(i[0]),a.putInt32(i[1]),a.putInt32(i[2]),a.putInt32(i[3]),a.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var s=o(),u=null,l=n.util.globalScope,c=l.crypto||l.msCrypto;if(c&&c.getRandomValues&&(u=function(e){return c.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!u){if("undefined"==typeof window||window.document,s.collectInt(+new Date,32),"undefined"!=typeof navigator){var f="";for(var h in navigator)try{"string"==typeof navigator[h]&&(f+=navigator[h])}catch(e){}s.collect(f),f=null}t&&(t().mousemove((function(e){s.collectInt(e.clientX,16),s.collectInt(e.clientY,16)})),t().keypress((function(e){s.collectInt(e.charCode,8)})))}if(n.random)for(var h in s)n.random[h]=s[h];else n.random=s;n.random.createInstance=o,e.exports=n.random}(void 0!==t?t:null)}).call(this,r(5))},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){var n;!function(t,r){"use strict";"object"==typeof e.exports?e.exports=t.document?r(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return r(e)}:r(t)}("undefined"!=typeof window?window:this,(function(r,i){"use strict";var a=[],o=Object.getPrototypeOf,s=a.slice,u=a.flat?function(e){return a.flat.call(e)}:function(e){return a.concat.apply([],e)},l=a.push,c=a.indexOf,f={},h=f.toString,p=f.hasOwnProperty,d=p.toString,g=d.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},v=function(e){return null!=e&&e===e.window},E=r.document,C={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,r){var n,i,a=(r=r||E).createElement("script");if(a.text=e,t)for(n in C)(i=t[n]||t.getAttribute&&t.getAttribute(n))&&a.setAttribute(n,i);r.head.appendChild(a).parentNode.removeChild(a)}function T(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?f[h.call(e)]||"object":typeof e}var S=function(e,t){return new S.fn.init(e,t)};function A(e){var t=!!e&&"length"in e&&e.length,r=T(e);return!m(e)&&!v(e)&&("array"===r||0===t||"number"==typeof t&&t>0&&t-1 in e)}S.fn=S.prototype={jquery:"3.5.0",constructor:S,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=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(e){return this.pushStack(S.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(S.grep(this,(function(e,t){return(t+1)%2})))},odd:function(){return this.pushStack(S.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+~]|"+U+")"+U+"*"),G=new RegExp(U+"|>"),W=new RegExp(j),Q=new RegExp("^"+M+"$"),z={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+V),PSEUDO:new RegExp("^"+j),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+U+"*(even|odd|(([+-]|)(\\d*)n|)"+U+"*(?:([+-]|)"+U+"*(\\d+)|))"+U+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+U+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+U+"*((?:-\\d)?\\d*)"+U+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,X=/^(?: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}"+U+"?|\\\\([^\\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(){h()},oe=Ce((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{R.apply(k=x.call(b.childNodes),b.childNodes),k[b.childNodes.length].nodeType}catch(e){R={apply:k.length?function(e,t){L.apply(e,x.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,l,c,f,d,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&&(h(t),t=t||p,g)){if(11!==b&&(f=J.exec(e)))if(a=f[1]){if(9===b){if(!(l=t.getElementById(a)))return n;if(l.id===a)return n.push(l),n}else if(v&&(l=v.getElementById(a))&&E(t,l)&&l.id===a)return n.push(l),n}else{if(f[2])return R.apply(n,t.getElementsByTagName(e)),n;if((a=f[3])&&r.getElementsByClassName&&t.getElementsByClassName)return R.apply(n,t.getElementsByClassName(a)),n}if(r.qsa&&!I[e+" "]&&(!y||!y.test(e))&&(1!==b||"object"!==t.nodeName.toLowerCase())){if(m=e,v=t,1===b&&(G.test(e)||q.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=C)),s=(d=o(e)).length;s--;)d[s]=(c?"#"+c:":scope")+" "+Ee(d[s]);m=d.join(",")}try{return R.apply(n,v.querySelectorAll(m)),n}catch(t){I(e,!0)}finally{c===C&&t.removeAttribute("id")}}}return u(e.replace(F,"$1"),t,n,i)}function ue(){var e=[];return function t(r,i){return e.push(r+" ")>n.cacheLength&&delete t[e.shift()],t[r+" "]=i}}function le(e){return e[C]=!0,e}function ce(e){var t=p.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 he(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 pe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function de(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 le((function(t){return t=+t,le((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.namespaceURI,r=(e.ownerDocument||e).documentElement;return!Y.test(t||r&&r.nodeName||"HTML")},h=se.setDocument=function(e){var t,i,o=e?e.ownerDocument||e:b;return o!=p&&9===o.nodeType&&o.documentElement?(d=(p=o).documentElement,g=!a(p),b!=p&&(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",ae,!1):i.attachEvent&&i.attachEvent("onunload",ae)),r.scope=ce((function(e){return d.appendChild(e).appendChild(p.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(p.createComment("")),!e.getElementsByTagName("*").length})),r.getElementsByClassName=Z.test(p.getElementsByClassName),r.getById=ce((function(e){return d.appendChild(e).id=C,!p.getElementsByName||!p.getElementsByName(C).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(p.querySelectorAll))&&(ce((function(e){var t;d.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+U+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+U+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+C+"-]").length||y.push("~="),(t=p.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||y.push("\\["+U+"*name"+U+"*="+U+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+C+"+*").length||y.push(".#.+[+~]"),e.querySelectorAll("\\\f"),y.push("[\\r\\n\\f]")})),ce((function(e){e.innerHTML="";var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+U+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),d.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")}))),(r.matchesSelector=Z.test(v=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.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(d.compareDocumentPosition),E=t||Z.test(d.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==p||e.ownerDocument==b&&E(b,e)?-1:t==p||t.ownerDocument==b&&E(b,t)?1:c?O(c,e)-O(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==p?-1:t==p?1:i?-1:a?1:c?O(c,e)-O(c,t):0;if(i===a)return he(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?he(o[n],s[n]):o[n]==b?-1:s[n]==b?1:0},p):p},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(h(e),r.matchesSelector&&g&&!I[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){I(t,!0)}return se(t,p,null,[e]).length>0},se.contains=function(e,t){return(e.ownerDocument||e)!=p&&h(e),E(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=p&&h(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:le,match:z,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 z.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":r&&W.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=A[e+" "];return t||(t=new RegExp("(^|"+U+")"+e+"("+U+"|$)"))&&A(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,u){var l,c,f,h,p,d,g=a!==o?"nextSibling":"previousSibling",y=t.parentNode,m=s&&t.nodeName.toLowerCase(),v=!u&&!s,E=!1;if(y){if(a){for(;g;){for(h=t;h=h[g];)if(s?h.nodeName.toLowerCase()===m:1===h.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[o?y.firstChild:y.lastChild],o&&v){for(E=(p=(l=(c=(f=(h=y)[C]||(h[C]={}))[h.uniqueID]||(f[h.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],h=p&&y.childNodes[p];h=++p&&h&&h[g]||(E=p=0)||d.pop();)if(1===h.nodeType&&++E&&h===t){c[e]=[T,p,E];break}}else if(v&&(E=p=(l=(c=(f=(h=t)[C]||(h[C]={}))[h.uniqueID]||(f[h.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===E)for(;(h=++p&&h&&h[g]||(E=p=0)||d.pop())&&((s?h.nodeName.toLowerCase()!==m:1!==h.nodeType)||!++E||(v&&((c=(f=h[C]||(h[C]={}))[h.uniqueID]||(f[h.uniqueID]={}))[e]=[T,E]),h!==t)););return(E-=i)===n||E%n==0&&E/n>=0}}},PSEUDO:function(e,t){var r,i=n.pseudos[e]||n.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return i[C]?i(t):i.length>1?(r=[e,e,"",t],n.setFilters.hasOwnProperty(e.toLowerCase())?le((function(e,r){for(var n,a=i(e,t),o=a.length;o--;)e[n=O(e,a[o])]=!(r[n]=a[o])})):function(e){return i(e,0,r)}):i}},pseudos:{not:le((function(e){var t=[],r=[],n=s(e.replace(F,"$1"));return n[C]?le((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:le((function(e){return function(t){return se(e,t).length>0}})),contains:le((function(e){return e=e.replace(te,re),function(t){return(t.textContent||i(t)).indexOf(e)>-1}})),lang:le((function(e){return Q.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===d},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.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 X.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,u=e.length,l=null!=t;s-1&&(a[l]=!(o[l]=f))}}else m=Te(m===o?m.splice(d,m.length):m),i?i(null,o,m,u):R.apply(o,m)}))}function Ae(e){for(var t,r,i,a=e.length,o=n.relative[e[0].type],s=o||n.relative[" "],u=o?1:0,c=Ce((function(e){return e===t}),s,!0),f=Ce((function(e){return O(t,e)>-1}),s,!0),h=[function(e,r,n){var i=!o&&(n||r!==l)||((t=r).nodeType?c(e,r,n):f(e,r,n));return t=null,i}];u1&&be(h),u>1&&Ee(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(F,"$1"),r,u0,i=e.length>0,a=function(a,o,s,u,c){var f,d,y,m=0,v="0",E=a&&[],C=[],b=l,S=a||i&&n.find.TAG("*",c),A=T+=null==b?1:Math.random()||.1,_=S.length;for(c&&(l=o==p||o||c);v!==_&&null!=(f=S[v]);v++){if(i&&f){for(d=0,o||f.ownerDocument==p||(h(f),s=!g);y=e[d++];)if(y(f,o||p,s)){u.push(f);break}c&&(T=A)}r&&((f=!y&&f)&&m--,a&&E.push(f))}if(m+=v,r&&v!==m){for(d=0;y=t[d++];)y(E,C,o,s);if(a){if(m>0)for(;v--;)E[v]||C[v]||(C[v]=D.call(u));C=Te(C)}R.apply(u,C),c&&!a&&C.length>0&&m+t.length>1&&se.uniqueSort(u)}return c&&(T=A,l=b),E};return r?le(a):a}(a,i))).selector=e}return s},u=se.select=function(e,t,r,i){var a,u,l,c,f,h="function"==typeof e&&e,p=!i&&o(e=h.selector||e);if(r=r||[],1===p.length){if((u=p[0]=p[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&n.relative[u[1].type]){if(!(t=(n.find.ID(l.matches[0].replace(te,re),t)||[])[0]))return r;h&&(t=t.parentNode),e=e.slice(u.shift().value.length)}for(a=z.needsContext.test(e)?0:u.length;a--&&(l=u[a],!n.relative[c=l.type]);)if((f=n.find[c])&&(i=f(l.matches[0].replace(te,re),ee.test(u[0].type)&&me(t.parentNode)||t))){if(u.splice(a,1),!(e=i.length&&Ee(u)))return R.apply(r,i),r;break}}return(h||s(e,p))(i,t,!g,r,!t||ee.test(e)&&me(t.parentNode)||t),r},r.sortStable=C.split("").sort(B).join("")===C,r.detectDuplicates=!!f,h(),r.sortDetached=ce((function(e){return 1&e.compareDocumentPosition(p.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}(r);S.find=_,S.expr=_.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=_.uniqueSort,S.text=_.getText,S.isXMLDoc=_.isXML,S.contains=_.contains,S.escapeSelector=_.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&&S(e).is(r))break;n.push(e)}return n},I=function(e,t){for(var r=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&r.push(e);return r},B=S.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var k=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,t,r){return m(t)?S.grep(e,(function(e,n){return!!t.call(e,n,e)!==r})):t.nodeType?S.grep(e,(function(e){return e===t!==r})):"string"!=typeof t?S.grep(e,(function(e){return c.call(t,e)>-1!==r})):S.filter(t,e,r)}S.filter=function(e,t,r){var n=t[0];return r&&(e=":not("+e+")"),1===t.length&&1===n.nodeType?S.find.matchesSelector(n,e)?[n]:[]:S.find.matches(e,S.grep(t,(function(e){return 1===e.nodeType})))},S.fn.extend({find:function(e){var t,r,n=this.length,i=this;if("string"!=typeof e)return this.pushStack(S(e).filter((function(){for(t=0;t1?S.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&&B.test(e)?S(e):e||[],!1).length}});var L,R=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,r){var n,i;if(!e)return this;if(r=r||L,"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 S?t[0]:t,S.merge(this,S.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),k.test(n[1])&&S.isPlainObject(t))for(n in t)m(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return(i=E.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(S):S.makeArray(e,this)}).prototype=S.fn,L=S(E);var x=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}S.fn.extend({has:function(e){var t=S(e,this),r=t.length;return this.filter((function(){for(var e=0;e-1:1===r.nodeType&&S.find.matchesSelector(r,e))){a.push(r);break}return this.pushStack(a.length>1?S.uniqueSort(a):a)},index:function(e){return e?"string"==typeof e?c.call(S(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(S.uniqueSort(S.merge(this.get(),S(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),S.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 P(e,"nextSibling")},prev:function(e){return P(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 I((e.parentNode||{}).firstChild,e)},children:function(e){return I(e.firstChild)},contents:function(e){return null!=e.contentDocument&&o(e.contentDocument)?e.contentDocument:(N(e,"template")&&(e=e.content||e),S.merge([],e.childNodes))}},(function(e,t){S.fn[e]=function(r,n){var i=S.map(this,t,r);return"Until"!==e.slice(-5)&&(n=r),n&&"string"==typeof n&&(i=S.filter(n,i)),this.length>1&&(O[e]||S.uniqueSort(i),x.test(e)&&i.reverse()),this.pushStack(i)}}));var U=/[^\x20\t\r\n\f]+/g;function M(e){return e}function V(e){throw e}function j(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])}}S.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return S.each(e.match(U)||[],(function(e,r){t[r]=!0})),t}(e):S.extend({},e);var t,r,n,i,a=[],o=[],s=-1,u=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?S.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||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!n}};return l},S.extend({Deferred:function(e){var t=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.Callbacks("once memory"),1,"rejected"]],n="pending",i={state:function(){return n},always:function(){return a.done(arguments).fail(arguments),this},catch:function(e){return i.then(null,e)},pipe:function(){var e=arguments;return S.Deferred((function(r){S.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,n,i){var a=0;function o(e,t,n,i){return function(){var s=this,u=arguments,l=function(){var r,l;if(!(e=a&&(n!==V&&(s=void 0,u=[r]),t.rejectWith(s,u))}};e?c():(S.Deferred.getStackHook&&(c.stackTrace=S.Deferred.getStackHook()),r.setTimeout(c))}}return S.Deferred((function(r){t[0][3].add(o(0,r,m(i)?i:M,r.notifyWith)),t[1][3].add(o(0,r,m(e)?e:M)),t[2][3].add(o(0,r,m(n)?n:V))})).promise()},promise:function(e){return null!=e?S.extend(e,i):i}},a={};return S.each(t,(function(e,r){var o=r[2],s=r[5];i[r[1]]=o.add,s&&o.add((function(){n=s}),t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),o.add(r[3].fire),a[r[0]]=function(){return a[r[0]+"With"](this===a?void 0:this,arguments),this},a[r[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=S.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&&(j(e,a.done(o(r)).resolve,a.reject,!t),"pending"===a.state()||m(i[r]&&i[r].then)))return a.then();for(;r--;)j(i[r],o(r),a.reject);return a.promise()}});var K=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(e,t){r.console&&r.console.warn&&e&&K.test(e.name)&&r.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},S.readyException=function(e){r.setTimeout((function(){throw e}))};var F=S.Deferred();function H(){E.removeEventListener("DOMContentLoaded",H),r.removeEventListener("load",H),S.ready()}S.fn.ready=function(e){return F.then(e).catch((function(e){S.readyException(e)})),this},S.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--S.readyWait:S.isReady)||(S.isReady=!0,!0!==e&&--S.readyWait>0||F.resolveWith(E,[S]))}}),S.ready.then=F.then,"complete"===E.readyState||"loading"!==E.readyState&&!E.documentElement.doScroll?r.setTimeout(S.ready):(E.addEventListener("DOMContentLoaded",H),r.addEventListener("load",H));var q=function(e,t,r,n,i,a,o){var s=0,u=e.length,l=null==r;if("object"===T(r))for(s in i=!0,r)q(e,t,s,r[s],!0,a,o);else if(void 0!==n&&(i=!0,m(n)||(o=!0),l&&(o?(t.call(e,n),t=null):(l=t,t=function(e,t,r){return l.call(S(e),r)})),t))for(;s1,null,!0)},removeData:function(e){return this.each((function(){Z.remove(this,e)}))}}),S.extend({queue:function(e,t,r){var n;if(e)return t=(t||"fx")+"queue",n=$.get(e,t),r&&(!n||Array.isArray(r)?n=$.access(e,t,S.makeArray(r)):n.push(r)),n||[]},dequeue:function(e,t){t=t||"fx";var r=S.queue(e,t),n=r.length,i=r.shift(),a=S._queueHooks(e,t);"inprogress"===i&&(i=r.shift(),n--),i&&("fx"===t&&r.unshift("inprogress"),delete a.stop,i.call(e,(function(){S.dequeue(e,t)}),a)),!n&&a&&a.empty.fire()},_queueHooks:function(e,t){var r=t+"queueHooks";return $.get(e,r)||$.access(e,r,{empty:S.Callbacks("once memory").add((function(){$.remove(e,[t+"queue",r])}))})}}),S.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,me=/^$|^module$|\/(?:java|ecma)script/i;pe=E.createDocumentFragment().appendChild(E.createElement("div")),(de=E.createElement("input")).setAttribute("type","radio"),de.setAttribute("checked","checked"),de.setAttribute("name","t"),pe.appendChild(de),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 ve={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&&N(e,t)?S.merge([e],r):r}function Ce(e,t){for(var r=0,n=e.length;r",""]);var be=/<|&#?\w+;/;function Te(e,t,r,n,i){for(var a,o,s,u,l,c,f=t.createDocumentFragment(),h=[],p=0,d=e.length;p-1)i&&i.push(a);else if(l=oe(a),o=Ee(f.appendChild(a),"script"),l&&Ce(o),r)for(c=0;a=o[c++];)me.test(a.type||"")&&r.push(a);return f}var Se=/^key/,Ae=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,_e=/^([^.]*)(?:\.(.+)|)/;function we(){return!0}function Ie(){return!1}function Be(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ne(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)Ne(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 S().off(e),o.apply(this,arguments)}).guid=o.guid||(o.guid=S.guid++)),e.each((function(){S.event.add(this,t,i,n,r)}))}function ke(e,t,r){r?($.set(e,t,!1),S.event.add(e,t,{namespace:!1,handler:function(e){var n,i,a=$.get(this,t);if(1&e.isTrigger&&this[t]){if(a.length)(S.event.special[t]||{}).delegateType&&e.stopPropagation();else if(a=s.call(arguments),$.set(this,t,a),n=r(this,t),this[t](),a!==(i=$.get(this,t))||n?$.set(this,t,!1):i={},a!==i)return e.stopImmediatePropagation(),e.preventDefault(),i.value}else a.length&&($.set(this,t,{value:S.event.trigger(S.extend(a[0],S.Event.prototype),a.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===$.get(e,t)&&S.event.add(e,t,we)}S.event={global:{},add:function(e,t,r,n,i){var a,o,s,u,l,c,f,h,p,d,g,y=$.get(e);if(Y(e))for(r.handler&&(r=(a=r).handler,i=a.selector),i&&S.find.matchesSelector(ae,i),r.guid||(r.guid=S.guid++),(u=y.events)||(u=y.events=Object.create(null)),(o=y.handle)||(o=y.handle=function(t){return void 0!==S&&S.event.triggered!==t.type?S.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(U)||[""]).length;l--;)p=g=(s=_e.exec(t[l])||[])[1],d=(s[2]||"").split(".").sort(),p&&(f=S.event.special[p]||{},p=(i?f.delegateType:f.bindType)||p,f=S.event.special[p]||{},c=S.extend({type:p,origType:g,data:n,handler:r,guid:r.guid,selector:i,needsContext:i&&S.expr.match.needsContext.test(i),namespace:d.join(".")},a),(h=u[p])||((h=u[p]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,n,d,o)||e.addEventListener&&e.addEventListener(p,o)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=r.guid)),i?h.splice(h.delegateCount++,0,c):h.push(c),S.event.global[p]=!0)},remove:function(e,t,r,n,i){var a,o,s,u,l,c,f,h,p,d,g,y=$.hasData(e)&&$.get(e);if(y&&(u=y.events)){for(l=(t=(t||"").match(U)||[""]).length;l--;)if(p=g=(s=_e.exec(t[l])||[])[1],d=(s[2]||"").split(".").sort(),p){for(f=S.event.special[p]||{},h=u[p=(n?f.delegateType:f.bindType)||p]||[],s=s[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=a=h.length;a--;)c=h[a],!i&&g!==c.origType||r&&r.guid!==c.guid||s&&!s.test(c.namespace)||n&&n!==c.selector&&("**"!==n||!c.selector)||(h.splice(a,1),c.selector&&h.delegateCount--,f.remove&&f.remove.call(e,c));o&&!h.length&&(f.teardown&&!1!==f.teardown.call(e,d,y.handle)||S.removeEvent(e,p,y.handle),delete u[p])}else for(p in u)S.event.remove(e,p+t[l],r,n,!0);S.isEmptyObject(u)&&$.remove(e,"handle events")}},dispatch:function(e){var t,r,n,i,a,o,s=new Array(arguments.length),u=S.event.fix(e),l=($.get(this,"events")||Object.create(null))[u.type]||[],c=S.event.special[u.type]||{};for(s[0]=u,t=1;t=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(a=[],o={},r=0;r-1:S.find(i,this,null,[l]).length),o[i]&&a.push(n);a.length&&s.push({elem:l,handlers:a})}return l=this,u\s*$/g;function xe(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Oe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Pe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Ue(e,t){var r,n,i,a,o,s;if(1===t.nodeType){if($.hasData(e)&&(s=$.get(e).events))for(i in $.remove(t,"handle events"),s)for(r=0,n=s[i].length;r1&&"string"==typeof d&&!y.checkClone&&Le.test(d))return e.each((function(i){var a=e.eq(i);g&&(t[0]=d.call(this,i,a.html())),Ve(a,t,r,n)}));if(h&&(a=(i=Te(t,e[0].ownerDocument,!1,e,n)).firstChild,1===i.childNodes.length&&(i=a),a||n)){for(s=(o=S.map(Ee(i,"script"),Oe)).length;f0&&Ce(o,!u&&Ee(e,"script")),s},cleanData:function(e){for(var t,r,n,i=S.event.special,a=0;void 0!==(r=e[a]);a++)if(Y(r)){if(t=r[$.expando]){if(t.events)for(n in t.events)i[n]?S.event.remove(r,n):S.removeEvent(r,n,t.handle);r[$.expando]=void 0}r[Z.expando]&&(r[Z.expando]=void 0)}}}),S.fn.extend({detach:function(e){return je(this,e,!0)},remove:function(e){return je(this,e)},text:function(e){return q(this,(function(e){return void 0===e?S.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&&(S.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 S.clone(this,e,t)}))},html:function(e){return q(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&&!De.test(e)&&!ve[(ye.exec(e)||["",""])[1].toLowerCase()]){e=S.htmlPrefilter(e);try{for(;r3,ae.removeChild(e)),s}}))}();var Qe=["Webkit","Moz","ms"],ze=E.createElement("div").style,Ye={};function Xe(e){var t=S.cssProps[e]||Ye[e];return t||(e in ze?e:Ye[e]=function(e){for(var t=e[0].toUpperCase()+e.slice(1),r=Qe.length;r--;)if((e=Qe[r]+t)in ze)return e}(e)||e)}var $e=/^(none|table(?!-c[ea]).+)/,Ze=/^--/,Je={position:"absolute",visibility:"hidden",display:"block"},et={letterSpacing:"0",fontWeight:"400"};function tt(e,t,r){var n=ne.exec(t);return n?Math.max(0,n[2]-(r||0))+(n[3]||"px"):t}function rt(e,t,r,n,i,a){var o="width"===t?1:0,s=0,u=0;if(r===(n?"border":"content"))return 0;for(;o<4;o+=2)"margin"===r&&(u+=S.css(e,r+ie[o],!0,i)),n?("content"===r&&(u-=S.css(e,"padding"+ie[o],!0,i)),"margin"!==r&&(u-=S.css(e,"border"+ie[o]+"Width",!0,i))):(u+=S.css(e,"padding"+ie[o],!0,i),"padding"!==r?u+=S.css(e,"border"+ie[o]+"Width",!0,i):s+=S.css(e,"border"+ie[o]+"Width",!0,i));return!n&&a>=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-a-u-s-.5))||0),u}function nt(e,t,r){var n=Fe(e),i=(!y.boxSizingReliable()||r)&&"border-box"===S.css(e,"boxSizing",!1,n),a=i,o=Ge(e,t,n),s="offset"+t[0].toUpperCase()+t.slice(1);if(Ke.test(o)){if(!r)return o;o="auto"}return(!y.boxSizingReliable()&&i||!y.reliableTrDimensions()&&N(e,"tr")||"auto"===o||!parseFloat(o)&&"inline"===S.css(e,"display",!1,n))&&e.getClientRects().length&&(i="border-box"===S.css(e,"boxSizing",!1,n),(a=s in e)&&(o=e[s])),(o=parseFloat(o)||0)+rt(e,t,r||(i?"border":"content"),a,n,o)+"px"}function it(e,t,r,n,i){return new it.prototype.init(e,t,r,n,i)}S.extend({cssHooks:{opacity:{get:function(e,t){if(t){var r=Ge(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=z(t),u=Ze.test(t),l=e.style;if(u||(t=Xe(s)),o=S.cssHooks[t]||S.cssHooks[s],void 0===r)return o&&"get"in o&&void 0!==(i=o.get(e,!1,n))?i:l[t];"string"===(a=typeof r)&&(i=ne.exec(r))&&i[1]&&(r=le(e,t,i),a="number"),null!=r&&r==r&&("number"!==a||u||(r+=i&&i[3]||(S.cssNumber[s]?"":"px")),y.clearCloneStyle||""!==r||0!==t.indexOf("background")||(l[t]="inherit"),o&&"set"in o&&void 0===(r=o.set(e,r,n))||(u?l.setProperty(t,r):l[t]=r))}},css:function(e,t,r,n){var i,a,o,s=z(t);return Ze.test(t)||(t=Xe(s)),(o=S.cssHooks[t]||S.cssHooks[s])&&"get"in o&&(i=o.get(e,!0,r)),void 0===i&&(i=Ge(e,t,n)),"normal"===i&&t in et&&(i=et[t]),""===r||r?(a=parseFloat(i),!0===r||isFinite(a)?a||0:i):i}}),S.each(["height","width"],(function(e,t){S.cssHooks[t]={get:function(e,r,n){if(r)return!$e.test(S.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?nt(e,t,n):He(e,Je,(function(){return nt(e,t,n)}))},set:function(e,r,n){var i,a=Fe(e),o=!y.scrollboxSize()&&"absolute"===a.position,s=(o||n)&&"border-box"===S.css(e,"boxSizing",!1,a),u=n?rt(e,t,n,s,a):0;return s&&o&&(u-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(a[t])-rt(e,t,"border",!1,a)-.5)),u&&(i=ne.exec(r))&&"px"!==(i[3]||"px")&&(e.style[t]=r,r=S.css(e,t)),tt(0,r,u)}}})),S.cssHooks.marginLeft=We(y.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(Ge(e,"marginLeft"))||e.getBoundingClientRect().left-He(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),S.each({margin:"",padding:"",border:"Width"},(function(e,t){S.cssHooks[e+t]={expand:function(r){for(var n=0,i={},a="string"==typeof r?r.split(" "):[r];n<4;n++)i[e+ie[n]+t]=a[n]||a[n-2]||a[0];return i}},"margin"!==e&&(S.cssHooks[e+t].set=tt)})),S.fn.extend({css:function(e,t){return q(this,(function(e,t,r){var n,i,a={},o=0;if(Array.isArray(t)){for(n=Fe(e),i=t.length;o1)}}),S.Tween=it,it.prototype={constructor:it,init:function(e,t,r,n,i,a){this.elem=e,this.prop=r,this.easing=i||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=n,this.unit=a||(S.cssNumber[r]?"":"px")},cur:function(){var e=it.propHooks[this.prop];return e&&e.get?e.get(this):it.propHooks._default.get(this)},run:function(e){var t,r=it.propHooks[this.prop];return this.options.duration?this.pos=t=S.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):it.propHooks._default.set(this),this}},it.prototype.init.prototype=it.prototype,it.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=S.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){S.fx.step[e.prop]?S.fx.step[e.prop](e):1!==e.elem.nodeType||!S.cssHooks[e.prop]&&null==e.elem.style[Xe(e.prop)]?e.elem[e.prop]=e.now:S.style(e.elem,e.prop,e.now+e.unit)}}},it.propHooks.scrollTop=it.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},S.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},S.fx=it.prototype.init,S.fx.step={};var at,ot,st=/^(?:toggle|show|hide)$/,ut=/queueHooks$/;function lt(){ot&&(!1===E.hidden&&r.requestAnimationFrame?r.requestAnimationFrame(lt):r.setTimeout(lt,S.fx.interval),S.fx.tick())}function ct(){return r.setTimeout((function(){at=void 0})),at=Date.now()}function ft(e,t){var r,n=0,i={height:e};for(t=t?1:0;n<4;n+=2-t)i["margin"+(r=ie[n])]=i["padding"+r]=e;return t&&(i.opacity=i.width=e),i}function ht(e,t,r){for(var n,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),a=0,o=i.length;a1)},removeAttr:function(e){return this.each((function(){S.removeAttr(this,e)}))}}),S.extend({attr:function(e,t,r){var n,i,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return void 0===e.getAttribute?S.prop(e,t,r):(1===a&&S.isXMLDoc(e)||(i=S.attrHooks[t.toLowerCase()]||(S.expr.match.bool.test(t)?dt:void 0)),void 0!==r?null===r?void S.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=S.find.attr(e,t))?void 0:n)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&N(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(U);if(i&&1===e.nodeType)for(;r=i[n++];)e.removeAttribute(r)}}),dt={set:function(e,t,r){return!1===t?S.removeAttr(e,r):e.setAttribute(r,r),r}},S.each(S.expr.match.bool.source.match(/\w+/g),(function(e,t){var r=gt[t]||S.find.attr;gt[t]=function(e,t,n){var i,a,o=t.toLowerCase();return n||(a=gt[o],gt[o]=i,i=null!=r(e,t,n)?o:null,gt[o]=a),i}}));var yt=/^(?:input|select|textarea|button)$/i,mt=/^(?:a|area)$/i;function vt(e){return(e.match(U)||[]).join(" ")}function Et(e){return e.getAttribute&&e.getAttribute("class")||""}function Ct(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(U)||[]}S.fn.extend({prop:function(e,t){return q(this,S.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[S.propFix[e]||e]}))}}),S.extend({prop:function(e,t,r){var n,i,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return 1===a&&S.isXMLDoc(e)||(t=S.propFix[t]||t,i=S.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=S.find.attr(e,"tabindex");return t?parseInt(t,10):yt.test(e.nodeName)||mt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),y.optSelected||(S.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)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){S.propFix[this.toLowerCase()]=this})),S.fn.extend({addClass:function(e){var t,r,n,i,a,o,s,u=0;if(m(e))return this.each((function(t){S(this).addClass(e.call(this,t,Et(this)))}));if((t=Ct(e)).length)for(;r=this[u++];)if(i=Et(r),n=1===r.nodeType&&" "+vt(i)+" "){for(o=0;a=t[o++];)n.indexOf(" "+a+" ")<0&&(n+=a+" ");i!==(s=vt(n))&&r.setAttribute("class",s)}return this},removeClass:function(e){var t,r,n,i,a,o,s,u=0;if(m(e))return this.each((function(t){S(this).removeClass(e.call(this,t,Et(this)))}));if(!arguments.length)return this.attr("class","");if((t=Ct(e)).length)for(;r=this[u++];)if(i=Et(r),n=1===r.nodeType&&" "+vt(i)+" "){for(o=0;a=t[o++];)for(;n.indexOf(" "+a+" ")>-1;)n=n.replace(" "+a+" "," ");i!==(s=vt(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){S(this).toggleClass(e.call(this,r,Et(this),t),t)})):this.each((function(){var t,i,a,o;if(n)for(i=0,a=S(this),o=Ct(e);t=o[i++];)a.hasClass(t)?a.removeClass(t):a.addClass(t);else void 0!==e&&"boolean"!==r||((t=Et(this))&&$.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":$.get(this,"__className__")||""))}))},hasClass:function(e){var t,r,n=0;for(t=" "+e+" ";r=this[n++];)if(1===r.nodeType&&(" "+vt(Et(r))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;S.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,S(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=S.map(i,(function(e){return null==e?"":e+""}))),(t=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))}))):i?(t=S.valHooks[i.type]||S.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(r=t.get(i,"value"))?r:"string"==typeof(r=i.value)?r.replace(bt,""):null==r?"":r:void 0}}),S.extend({valHooks:{option:{get:function(e){var t=S.find.attr(e,"value");return null!=t?t:vt(S.text(e))}},select:{get:function(e){var t,r,n,i=e.options,a=e.selectedIndex,o="select-one"===e.type,s=o?null:[],u=o?a+1:i.length;for(n=a<0?u:o?a:0;n-1)&&(r=!0);return r||(e.selectedIndex=-1),a}}}}),S.each(["radio","checkbox"],(function(){S.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=S.inArray(S(e).val(),t)>-1}},y.checkOn||(S.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})})),y.focusin="onfocusin"in r;var Tt=/^(?:focusinfocus|focusoutblur)$/,St=function(e){e.stopPropagation()};S.extend(S.event,{trigger:function(e,t,n,i){var a,o,s,u,l,c,f,h,d=[n||E],g=p.call(e,"type")?e.type:e,y=p.call(e,"namespace")?e.namespace.split("."):[];if(o=h=s=n=n||E,3!==n.nodeType&&8!==n.nodeType&&!Tt.test(g+S.event.triggered)&&(g.indexOf(".")>-1&&(y=g.split("."),g=y.shift(),y.sort()),l=g.indexOf(":")<0&&"on"+g,(e=e[S.expando]?e:new S.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=n),t=null==t?[e]:S.makeArray(t,[e]),f=S.event.special[g]||{},i||!f.trigger||!1!==f.trigger.apply(n,t))){if(!i&&!f.noBubble&&!v(n)){for(u=f.delegateType||g,Tt.test(u+g)||(o=o.parentNode);o;o=o.parentNode)d.push(o),s=o;s===(n.ownerDocument||E)&&d.push(s.defaultView||s.parentWindow||r)}for(a=0;(o=d[a++])&&!e.isPropagationStopped();)h=o,e.type=a>1?u:f.bindType||g,(c=($.get(o,"events")||Object.create(null))[e.type]&&$.get(o,"handle"))&&c.apply(o,t),(c=l&&o[l])&&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(d.pop(),t)||!Y(n)||l&&m(n[g])&&!v(n)&&((s=n[l])&&(n[l]=null),S.event.triggered=g,e.isPropagationStopped()&&h.addEventListener(g,St),n[g](),e.isPropagationStopped()&&h.removeEventListener(g,St),S.event.triggered=void 0,s&&(n[l]=s)),e.result}},simulate:function(e,t,r){var n=S.extend(new S.Event,r,{type:e,isSimulated:!0});S.event.trigger(n,null,t)}}),S.fn.extend({trigger:function(e,t){return this.each((function(){S.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var r=this[0];if(r)return S.event.trigger(e,t,r,!0)}}),y.focusin||S.each({focus:"focusin",blur:"focusout"},(function(e,t){var r=function(e){S.event.simulate(t,e.target,S.event.fix(e))};S.event.special[t]={setup:function(){var n=this.ownerDocument||this.document||this,i=$.access(n,t);i||n.addEventListener(e,r,!0),$.access(n,t,(i||0)+1)},teardown:function(){var n=this.ownerDocument||this.document||this,i=$.access(n,t)-1;i?$.access(n,t,i):(n.removeEventListener(e,r,!0),$.remove(n,t))}}}));var At=r.location,_t={guid:Date.now()},wt=/\?/;S.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new r.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||S.error("Invalid XML: "+e),t};var It=/\[\]$/,Bt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,kt=/^(?:input|select|textarea|keygen)/i;function Dt(e,t,r,n){var i;if(Array.isArray(t))S.each(t,(function(t,i){r||It.test(e)?n(e,i):Dt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,r,n)}));else if(r||"object"!==T(t))n(e,t);else for(i in t)Dt(e+"["+i+"]",t[i],r,n)}S.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&&!S.isPlainObject(e))S.each(e,(function(){i(this.name,this.value)}));else for(r in e)Dt(r,e[r],t,i);return n.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=S.prop(this,"elements");return e?S.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!S(this).is(":disabled")&&kt.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!ge.test(e))})).map((function(e,t){var r=S(this).val();return null==r?null:Array.isArray(r)?S.map(r,(function(e){return{name:t.name,value:e.replace(Bt,"\r\n")}})):{name:t.name,value:r.replace(Bt,"\r\n")}})).get()}});var Lt=/%20/g,Rt=/#.*$/,xt=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:GET|HEAD)$/,Ut=/^\/\//,Mt={},Vt={},jt="*/".concat("*"),Kt=E.createElement("a");function Ft(e){return function(t,r){"string"!=typeof t&&(r=t,t="*");var n,i=0,a=t.toLowerCase().match(U)||[];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 Ht(e,t,r,n){var i={},a=e===Vt;function o(s){var u;return i[s]=!0,S.each(e[s]||[],(function(e,s){var l=s(t,r,n);return"string"!=typeof l||a||i[l]?a?!(u=l):void 0:(t.dataTypes.unshift(l),o(l),!1)})),u}return o(t.dataTypes[0])||!i["*"]&&o("*")}function qt(e,t){var r,n,i=S.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((i[r]?e:n||(n={}))[r]=t[r]);return n&&S.extend(!0,e,n),e}Kt.href=At.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:At.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(At.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":jt,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":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?qt(qt(e,S.ajaxSettings),t):qt(S.ajaxSettings,e)},ajaxPrefilter:Ft(Mt),ajaxTransport:Ft(Vt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n,i,a,o,s,u,l,c,f,h,p=S.ajaxSetup({},t),d=p.context||p,g=p.context&&(d.nodeType||d.jquery)?S(d):S.event,y=S.Deferred(),m=S.Callbacks("once memory"),v=p.statusCode||{},C={},b={},T="canceled",A={readyState:0,getResponseHeader:function(e){var t;if(l){if(!o)for(o={};t=Ot.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 l?a:null},setRequestHeader:function(e,t){return null==l&&(e=b[e.toLowerCase()]=b[e.toLowerCase()]||e,C[e]=t),this},overrideMimeType:function(e){return null==l&&(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(l)A.always(e[A.status]);else for(t in e)v[t]=[v[t],e[t]];return this},abort:function(e){var t=e||T;return n&&n.abort(t),_(0,t),this}};if(y.promise(A),p.url=((e||p.url||At.href)+"").replace(Ut,At.protocol+"//"),p.type=t.method||t.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(U)||[""],null==p.crossDomain){u=E.createElement("a");try{u.href=p.url,u.href=u.href,p.crossDomain=Kt.protocol+"//"+Kt.host!=u.protocol+"//"+u.host}catch(e){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=S.param(p.data,p.traditional)),Ht(Mt,p,t,A),l)return A;for(f in(c=S.event&&p.global)&&0==S.active++&&S.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Pt.test(p.type),i=p.url.replace(Rt,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace(Lt,"+")):(h=p.url.slice(i.length),p.data&&(p.processData||"string"==typeof p.data)&&(i+=(wt.test(i)?"&":"?")+p.data,delete p.data),!1===p.cache&&(i=i.replace(xt,"$1"),h=(wt.test(i)?"&":"?")+"_="+_t.guid+++h),p.url=i+h),p.ifModified&&(S.lastModified[i]&&A.setRequestHeader("If-Modified-Since",S.lastModified[i]),S.etag[i]&&A.setRequestHeader("If-None-Match",S.etag[i])),(p.data&&p.hasContent&&!1!==p.contentType||t.contentType)&&A.setRequestHeader("Content-Type",p.contentType),A.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+jt+"; q=0.01":""):p.accepts["*"]),p.headers)A.setRequestHeader(f,p.headers[f]);if(p.beforeSend&&(!1===p.beforeSend.call(d,A,p)||l))return A.abort();if(T="abort",m.add(p.complete),A.done(p.success),A.fail(p.error),n=Ht(Vt,p,t,A)){if(A.readyState=1,c&&g.trigger("ajaxSend",[A,p]),l)return A;p.async&&p.timeout>0&&(s=r.setTimeout((function(){A.abort("timeout")}),p.timeout));try{l=!1,n.send(C,_)}catch(e){if(l)throw e;_(-1,e)}}else _(-1,"No Transport");function _(e,t,o,u){var f,h,E,C,b,T=t;l||(l=!0,s&&r.clearTimeout(s),n=void 0,a=u||"",A.readyState=e>0?4:0,f=e>=200&&e<300||304===e,o&&(C=function(e,t,r){for(var n,i,a,o,s=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===n&&(n=e.mimeType||t.getResponseHeader("Content-Type"));if(n)for(i in s)if(s[i]&&s[i].test(n)){u.unshift(i);break}if(u[0]in r)a=u[0];else{for(i in r){if(!u[0]||e.converters[i+" "+u[0]]){a=i;break}o||(o=i)}a=a||o}if(a)return a!==u[0]&&u.unshift(a),r[a]}(p,A,o)),!f&&S.inArray("script",p.dataTypes)>-1&&(p.converters["text script"]=function(){}),C=function(e,t,r,n){var i,a,o,s,u,l={},c=e.dataTypes.slice();if(c[1])for(o in e.converters)l[o.toLowerCase()]=e.converters[o];for(a=c.shift();a;)if(e.responseFields[a]&&(r[e.responseFields[a]]=t),!u&&n&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=a,a=c.shift())if("*"===a)a=u;else if("*"!==u&&u!==a){if(!(o=l[u+" "+a]||l["* "+a]))for(i in l)if((s=i.split(" "))[1]===a&&(o=l[u+" "+s[0]]||l["* "+s[0]])){!0===o?o=l[i]:!0!==l[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 "+u+" to "+a}}}return{state:"success",data:t}}(p,C,A,f),f?(p.ifModified&&((b=A.getResponseHeader("Last-Modified"))&&(S.lastModified[i]=b),(b=A.getResponseHeader("etag"))&&(S.etag[i]=b)),204===e||"HEAD"===p.type?T="nocontent":304===e?T="notmodified":(T=C.state,h=C.data,f=!(E=C.error))):(E=T,!e&&T||(T="error",e<0&&(e=0))),A.status=e,A.statusText=(t||T)+"",f?y.resolveWith(d,[h,T,A]):y.rejectWith(d,[A,T,E]),A.statusCode(v),v=void 0,c&&g.trigger(f?"ajaxSuccess":"ajaxError",[A,p,f?h:E]),m.fireWith(d,[A,T]),c&&(g.trigger("ajaxComplete",[A,p]),--S.active||S.event.trigger("ajaxStop")))}return A},getJSON:function(e,t,r){return S.get(e,t,r,"json")},getScript:function(e,t){return S.get(e,void 0,t,"script")}}),S.each(["get","post"],(function(e,t){S[t]=function(e,r,n,i){return m(r)&&(i=i||n,n=r,r=void 0),S.ajax(S.extend({url:e,type:t,dataType:i,data:r,success:n},S.isPlainObject(e)&&e))}})),S.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")})),S._evalUrl=function(e,t,r){return S.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){S.globalEval(e,t,r)}})},S.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=S(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){S(this).wrapInner(e.call(this,t))})):this.each((function(){var t=S(this),r=t.contents();r.length?r.wrapAll(e):t.append(e)}))},wrap:function(e){var t=m(e);return this.each((function(r){S(this).wrapAll(t?e.call(this,r):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){S(this).replaceWith(this.childNodes)})),this}}),S.expr.pseudos.hidden=function(e){return!S.expr.pseudos.visible(e)},S.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new r.XMLHttpRequest}catch(e){}};var Gt={0:200,1223:204},Wt=S.ajaxSettings.xhr();y.cors=!!Wt&&"withCredentials"in Wt,y.ajax=Wt=!!Wt,S.ajaxTransport((function(e){var t,n;if(y.cors||Wt&&!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=n=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(Gt[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(),n=s.onerror=s.ontimeout=t("error"),void 0!==s.onabort?s.onabort=n:s.onreadystatechange=function(){4===s.readyState&&r.setTimeout((function(){t&&n()}))},t=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}})),S.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),S.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 S.globalEval(e),e}}}),S.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),S.ajaxTransport("script",(function(e){var t,r;if(e.crossDomain||e.scriptAttrs)return{send:function(n,i){t=S("