/*!
 * jQuery JavaScript Library v1.11.2
 * http://jquery.com/
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 *
 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2014-12-17T15:27Z
 */

/*!
 * Sizzle CSS Selector Engine v2.2.0-pre
 * http://sizzlejs.com/
 *
 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2014-12-16
 */

//     Underscore.js 1.5.1
//     http://underscorejs.org
//     (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.

/**
 * @license RequireJS text 2.0.13+ Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/text for details
 */

//     (c) 2010-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Backbone may be freely distributed under the MIT license.
//     For all details and documentation:
//     http://backbonejs.org

/*! jQuery UI - v1.11.3 - 2015-02-14
* http://jqueryui.com
* Includes: core.js, widget.js, tabs.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

/*!
 * jQuery UI Core 1.11.3
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/category/ui-core/
 */

/*!
 * jQuery UI Widget 1.11.3
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/jQuery.widget/
 */

/*!
 * jQuery UI Tabs 1.11.3
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/tabs/
 */

/*
Copyright 2012 Igor Vaynberg

Version: 3.5.2 Timestamp: Sat Nov  1 14:43:36 EDT 2014

This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
General Public License version 2 (the "GPL License"). You may choose either license to govern your
use of this software only upon the condition that you accept all of the terms of either the Apache
License or the GPL License.

You may obtain a copy of the Apache License and the GPL License at:

    http://www.apache.org/licenses/LICENSE-2.0
    http://www.gnu.org/licenses/gpl-2.0.html

Unless required by applicable law or agreed to in writing, software distributed under the
Apache License or the GPL License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the Apache License and the GPL License for
the specific language governing permissions and limitations under the Apache License and the GPL License.
*/

/*
 * SimpleModal @VERSION - jQuery Plugin
 * http://simplemodal.com/
 * Copyright (c) 2014 Eric Martin
 * Licensed under MIT and GPL
 * Date:
 */

/*! Magnific Popup - v1.0.0 - 2014-12-12
* http://dimsemenov.com/plugins/magnific-popup/
* Copyright (c) 2014 Dmitry Semenov; */

/*! jQuery UI - v1.11.3 - 2015-02-28
* http://jqueryui.com
* Includes: core.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

/*! jQuery UI - v1.11.1 - 2014-09-17
* http://jqueryui.com
* Includes: widget.js
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */

/*!
 * jQuery UI Widget 1.11.1
 * http://jqueryui.com
 *
 * Copyright 2014 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/jQuery.widget/
 */

/*! jQuery UI - v1.11.3 - 2015-02-28
* http://jqueryui.com
* Includes: progressbar.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

/*!
 * jQuery UI Progressbar 1.11.3
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/progressbar/
 */

/*
 * jQuery Iframe Transport Plugin 1.4
 * https://github.com/blueimp/jQuery-File-Upload
 *
 * Copyright 2011, Sebastian Tschan
 * https://blueimp.net
 *
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/MIT
 */

/*
 * jQuery File Upload Plugin 5.42.1
 * https://github.com/blueimp/jQuery-File-Upload
 *
 * Copyright 2010, Sebastian Tschan
 * https://blueimp.net
 *
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/MIT
 */

/*
 * jQuery File Upload File Processing Plugin 1.3.0
 * https://github.com/blueimp/jQuery-File-Upload
 *
 * Copyright 2012, Sebastian Tschan
 * https://blueimp.net
 *
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/MIT
 */

/*
 * jQuery File Upload Validation Plugin 1.1.2
 * https://github.com/blueimp/jQuery-File-Upload
 *
 * Copyright 2013, Sebastian Tschan
 * https://blueimp.net
 *
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/MIT
 */

/*
 * jQuery File Upload User Interface Plugin 9.6.0
 * https://github.com/blueimp/jQuery-File-Upload
 *
 * Copyright 2010, Sebastian Tschan
 * https://blueimp.net
 *
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/MIT
 */

(function(e,t){typeof module=="object"&&typeof module.exports=="object"?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)})(typeof window!="undefined"?window:this,function(e,t){function g(e){var t=e.length,n=h.type(e);return n==="function"||h.isWindow(e)?!1:e.nodeType===1&&t?!0:n==="array"||t===0||typeof t=="number"&&t>0&&t-1 in e}function S(e,t,n){if(h.isFunction(t))return h.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return h.grep(e,function(e){return e===t!==n});if(typeof t=="string"){if(E.test(t))return h.filter(t,e,n);t=h.filter(t,e)}return h.grep(e,function(e){return h.inArray(e,t)>=0!==n})}function A(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function _(e){var t=M[e]={};return h.each(e.match(O)||[],function(e,n){t[n]=!0}),t}function P(){T.addEventListener?(T.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(T.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))}function H(){if(T.addEventListener||event.type==="load"||T.readyState==="complete")P(),h.ready()}function q(e,t,n){if(n===undefined&&e.nodeType===1){var r="data-"+t.replace(I,"-$1").toLowerCase();n=e.getAttribute(r);if(typeof n=="string"){try{n=n==="true"?!0:n==="false"?!1:n==="null"?null:+n+""===n?+n:F.test(n)?h.parseJSON(n):n}catch(i){}h.data(e,t,n)}else n=undefined}return n}function R(e){var t;for(t in e){if(t==="data"&&h.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function U(e,t,r,i){if(!h.acceptData(e))return;var s,o,u=h.expando,a=e.nodeType,f=a?h.cache:e,l=a?e[u]:e[u]&&u;if((!l||!f[l]||!i&&!f[l].data)&&r===undefined&&typeof t=="string")return;l||(a?l=e[u]=n.pop()||h.guid++:l=u),f[l]||(f[l]=a?{}:{toJSON:h.noop});if(typeof t=="object"||typeof t=="function")i?f[l]=h.extend(f[l],t):f[l].data=h.extend(f[l].data,t);return o=f[l],i||(o.data||(o.data={}),o=o.data),r!==undefined&&(o[h.camelCase(t)]=r),typeof t=="string"?(s=o[t],s==null&&(s=o[h.camelCase(t)])):s=o,s}function z(e,t,n){if(!h.acceptData(e))return;var r,i,s=e.nodeType,o=s?h.cache:e,u=s?e[h.expando]:h.expando;if(!o[u])return;if(t){r=n?o[u]:o[u].data;if(r){h.isArray(t)?t=t.concat(h.map(t,h.camelCase)):t in r?t=[t]:(t=h.camelCase(t),t in r?t=[t]:t=t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!R(r):!h.isEmptyObject(r))return}}if(!n){delete o[u].data;if(!R(o[u]))return}s?h.cleanData([e],!0):l.deleteExpando||o!=o.window?delete o[u]:o[u]=null}function et(){return!0}function tt(){return!1}function nt(){try{return T.activeElement}catch(e){}}function rt(e){var t=it.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function wt(e,t){var n,r,i=0,s=typeof e.getElementsByTagName!==B?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==B?e.querySelectorAll(t||"*"):undefined;if(!s)for(s=[],n=e.childNodes||e;(r=n[i])!=null;i++)!t||h.nodeName(r,t)?s.push(r):h.merge(s,wt(r,t));return t===undefined||t&&h.nodeName(e,t)?h.merge([e],s):s}function Et(e){J.test(e.type)&&(e.defaultChecked=e.checked)}function St(e,t){return h.nodeName(e,"table")&&h.nodeName(t.nodeType!==11?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function xt(e){return e.type=(h.find.attr(e,"type")!==null)+"/"+e.type,e}function Tt(e){var t=vt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Nt(e,t){var n,r=0;for(;(n=e[r])!=null;r++)h._data(n,"globalEval",!t||h._data(t[r],"globalEval"))}function Ct(e,t){if(t.nodeType!==1||!h.hasData(e))return;var n,r,i,s=h._data(e),o=h._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)h.event.add(t,n,u[n][r])}o.data&&(o.data=h.extend({},o.data))}function kt(e,t){var n,r,i;if(t.nodeType!==1)return;n=t.nodeName.toLowerCase();if(!l.noCloneEvent&&t[h.expando]){i=h._data(t);for(r in i.events)h.removeEvent(t,r,i.handle);t.removeAttribute(h.expando)}if(n==="script"&&t.text!==e.text)xt(t).text=e.text,Tt(t);else if(n==="object")t.parentNode&&(t.outerHTML=e.outerHTML),l.html5Clone&&e.innerHTML&&!h.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML);else if(n==="input"&&J.test(e.type))t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value);else if(n==="option")t.defaultSelected=t.selected=e.defaultSelected;else if(n==="input"||n==="textarea")t.defaultValue=e.defaultValue}function Ot(t,n){var r,i=h(n.createElement(t)).appendTo(n.body),s=e.getDefaultComputedStyle&&(r=e.getDefaultComputedStyle(i[0]))?r.display:h.css(i[0],"display");return i.detach(),s}function Mt(e){var t=T,n=At[e];if(!n){n=Ot(e,t);if(n==="none"||!n)Lt=(Lt||h("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=(Lt[0].contentWindow||Lt[0].contentDocument).document,t.write(),t.close(),n=Ot(e,t),Lt.detach();At[e]=n}return n}function jt(e,t){return{get:function(){var n=e();if(n==null)return;if(n){delete this.get;return}return(this.get=t).apply(this,arguments)}}}function Vt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Xt.length;while(i--){t=Xt[i]+n;if(t in e)return t}return r}function $t(e,t){var n,r,i,s=[],o=0,u=e.length;for(;o<u;o++){r=e[o];if(!r.style)continue;s[o]=h._data(r,"olddisplay"),n=r.style.display,t?(!s[o]&&n==="none"&&(r.style.display=""),r.style.display===""&&V(r)&&(s[o]=h._data(r,"olddisplay",Mt(r.nodeName)))):(i=V(r),(n&&n!=="none"||!i)&&h._data(r,"olddisplay",i?n:h.css(r,"display")))}for(o=0;o<u;o++){r=e[o];if(!r.style)continue;if(!t||r.style.display==="none"||r.style.display==="")r.style.display=t?s[o]||"":"none"}return e}function Jt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function Kt(e,t,n,r,i){var s=n===(r?"border":"content")?4:t==="width"?1:0,o=0;for(;s<4;s+=2)n==="margin"&&(o+=h.css(e,n+X[s],!0,i)),r?(n==="content"&&(o-=h.css(e,"padding"+X[s],!0,i)),n!=="margin"&&(o-=h.css(e,"border"+X[s]+"Width",!0,i))):(o+=h.css(e,"padding"+X[s],!0,i),n!=="padding"&&(o+=h.css(e,"border"+X[s]+"Width",!0,i)));return o}function Qt(e,t,n){var r=!0,i=t==="width"?e.offsetWidth:e.offsetHeight,s=Pt(e),o=l.boxSizing&&h.css(e,"boxSizing",!1,s)==="border-box";if(i<=0||i==null){i=Ht(e,t,s);if(i<0||i==null)i=e.style[t];if(Dt.test(i))return i;r=o&&(l.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+Kt(e,t,n||(o?"border":"content"),r,s)+"px"}function Gt(e,t,n,r,i){return new Gt.prototype.init(e,t,n,r,i)}function on(){return setTimeout(function(){Yt=undefined}),Yt=h.now()}function un(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=X[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function an(e,t,n){var r,i=(sn[t]||[]).concat(sn["*"]),s=0,o=i.length;for(;s<o;s++)if(r=i[s].call(n,t,e))return r}function fn(e,t,n){var r,i,s,o,u,a,f,c,p=this,d={},v=e.style,m=e.nodeType&&V(e),g=h._data(e,"fxshow");n.queue||(u=h._queueHooks(e,"fx"),u.unqueued==null&&(u.unqueued=0,a=u.empty.fire,u.empty.fire=function(){u.unqueued||a()}),u.unqueued++,p.always(function(){p.always(function(){u.unqueued--,h.queue(e,"fx").length||u.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[v.overflow,v.overflowX,v.overflowY],f=h.css(e,"display"),c=f==="none"?h._data(e,"olddisplay")||Mt(e.nodeName):f,c==="inline"&&h.css(e,"float")==="none"&&(!l.inlineBlockNeedsLayout||Mt(e.nodeName)==="inline"?v.display="inline-block":v.zoom=1)),n.overflow&&(v.overflow="hidden",l.shrinkWrapBlocks()||p.always(function(){v.overflow=n.overflow[0],v.overflowX=n.overflow[1],v.overflowY=n.overflow[2]}));for(r in t){i=t[r];if(en.exec(i)){delete t[r],s=s||i==="toggle";if(i===(m?"hide":"show")){if(i!=="show"||!g||g[r]===undefined)continue;m=!0}d[r]=g&&g[r]||h.style(e,r)}else f=undefined}if(!h.isEmptyObject(d)){g?"hidden"in g&&(m=g.hidden):g=h._data(e,"fxshow",{}),s&&(g.hidden=!m),m?h(e).show():p.done(function(){h(e).hide()}),p.done(function(){var t;h._removeData(e,"fxshow");for(t in d)h.style(e,t,d[t])});for(r in d)o=an(m?g[r]:0,r,p),r in g||(g[r]=o.start,m&&(o.end=o.start,o.start=r==="width"||r==="height"?1:0))}else(f==="none"?Mt(e.nodeName):f)==="inline"&&(v.display=f)}function ln(e,t){var n,r,i,s,o;for(n in e){r=h.camelCase(n),i=t[r],s=e[n],h.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=h.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function cn(e,t,n){var r,i,s=0,o=rn.length,u=h.Deferred().always(function(){delete a.elem}),a=function(){if(i)return!1;var t=Yt||on(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,s=1-r,o=0,a=f.tweens.length;for(;o<a;o++)f.tweens[o].run(s);return u.notifyWith(e,[f,s,n]),s<1&&a?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:h.extend({},t),opts:h.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Yt||on(),duration:n.duration,tweens:[],createTween:function(t,n){var r=h.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(r),r},stop:function(t){var n=0,r=t?f.tweens.length:0;if(i)return this;i=!0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;ln(l,f.opts.specialEasing);for(;s<o;s++){r=rn[s].call(f,e,l,f.opts);if(r)return r}return h.map(l,an,f),h.isFunction(f.opts.start)&&f.opts.start.call(e,f),h.fx.timer(h.extend(a,{elem:e,anim:f,queue:f.opts.queue})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Fn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i=0,s=t.toLowerCase().match(O)||[];if(h.isFunction(n))while(r=s[i++])r.charAt(0)==="+"?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function In(e,t,n,r){function o(u){var a;return i[u]=!0,h.each(e[u]||[],function(e,u){var f=u(t,n,r);if(typeof f=="string"&&!s&&!i[f])return t.dataTypes.unshift(f),o(f),!1;if(s)return!(a=f)}),a}var i={},s=e===Hn;return o(t.dataTypes[0])||!i["*"]&&o("*")}function qn(e,t){var n,r,i=h.ajaxSettings.flatOptions||{};for(r in t)t[r]!==undefined&&((i[r]?e:n||(n={}))[r]=t[r]);return n&&h.extend(!0,e,n),e}function Rn(e,t,n){var r,i,s,o,u=e.contents,a=e.dataTypes;while(a[0]==="*")a.shift(),i===undefined&&(i=e.mimeType||t.getResponseHeader("Content-Type"));if(i)for(o in u)if(u[o]&&u[o].test(i)){a.unshift(o);break}if(a[0]in n)s=a[0];else{for(o in n){if(!a[0]||e.converters[o+" "+a[0]]){s=o;break}r||(r=o)}s=s||r}if(s)return s!==a[0]&&a.unshift(s),n[s]}function Un(e,t,n,r){var i,s,o,u,a,f={},l=e.dataTypes.slice();if(l[1])for(o in e.converters)f[o.toLowerCase()]=e.converters[o];s=l.shift();while(s){e.responseFields[s]&&(n[e.responseFields[s]]=t),!a&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a=s,s=l.shift();if(s)if(s==="*")s=a;else if(a!=="*"&&a!==s){o=f[a+" "+s]||f["* "+s];if(!o)for(i in f){u=i.split(" ");if(u[1]===s){o=f[a+" "+u[0]]||f["* "+u[0]];if(o){o===!0?o=f[i]:f[i]!==!0&&(s=u[0],l.unshift(u[1]));break}}}if(o!==!0)if(o&&e["throws"])t=o(t);else try{t=o(t)}catch(c){return{state:"parsererror",error:o?c:"No conversion from "+a+" to "+s}}}}return{state:"success",data:t}}function Jn(e,t,n,r){var i;if(h.isArray(t))h.each(t,function(t,i){n||Wn.test(e)?r(e,i):Jn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&h.type(t)==="object")for(i in t)Jn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Yn(){try{return new e.XMLHttpRequest}catch(t){}}function Zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function ir(e){return h.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n=[],r=n.slice,i=n.concat,s=n.push,o=n.indexOf,u={},a=u.toString,f=u.hasOwnProperty,l={},c="1.11.2",h=function(e,t){return new h.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,d=/^-ms-/,v=/-([\da-z])/gi,m=function(e,t){return t.toUpperCase()};h.fn=h.prototype={jquery:c,constructor:h,selector:"",length:0,toArray:function(){return r.call(this)},get:function(e){return e!=null?e<0?this[e+this.length]:this[e]:r.call(this)},pushStack:function(e){var t=h.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return h.each(this,e,t)},map:function(e){return this.pushStack(h.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(r.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:s,sort:n.sort,splice:n.splice},h.extend=h.fn.extend=function(){var e,t,n,r,i,s,o=arguments[0]||{},u=1,a=arguments.length,f=!1;typeof o=="boolean"&&(f=o,o=arguments[u]||{},u++),typeof o!="object"&&!h.isFunction(o)&&(o={}),u===a&&(o=this,u--);for(;u<a;u++)if((i=arguments[u])!=null)for(r in i){e=o[r],n=i[r];if(o===n)continue;f&&n&&(h.isPlainObject(n)||(t=h.isArray(n)))?(t?(t=!1,s=e&&h.isArray(e)?e:[]):s=e&&h.isPlainObject(e)?e:{},o[r]=h.extend(f,s,n)):n!==undefined&&(o[r]=n)}return o},h.extend({expando:"jQuery"+(c+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return h.type(e)==="function"},isArray:Array.isArray||function(e){return h.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!h.isArray(e)&&e-parseFloat(e)+1>=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||h.type(e)!=="object"||e.nodeType||h.isWindow(e))return!1;try{if(e.constructor&&!f.call(e,"constructor")&&!f.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(l.ownLast)for(t in e)return f.call(e,t);for(t in e);return t===undefined||f.call(e,t)},type:function(e){return e==null?e+"":typeof e=="object"||typeof e=="function"?u[a.call(e)]||"object":typeof e},globalEval:function(t){t&&h.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(d,"ms-").replace(v,m)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,s=e.length,o=g(e);if(n)if(o)for(;i<s;i++){r=t.apply(e[i],n);if(r===!1)break}else for(i in e){r=t.apply(e[i],n);if(r===!1)break}else if(o)for(;i<s;i++){r=t.call(e[i],i,e[i]);if(r===!1)break}else for(i in e){r=t.call(e[i],i,e[i]);if(r===!1)break}return e},trim:function(e){return e==null?"":(e+"").replace(p,"")},makeArray:function(e,t){var n=t||[];return e!=null&&(g(Object(e))?h.merge(n,typeof e=="string"?[e]:e):s.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(o)return o.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,t){var n=+t.length,r=0,i=e.length;while(r<n)e[i++]=t[r++];if(n!==n)while(t[r]!==undefined)e[i++]=t[r++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length,u=!n;for(;s<o;s++)r=!t(e[s],s),r!==u&&i.push(e[s]);return i},map:function(e,t,n){var r,s=0,o=e.length,u=g(e),a=[];if(u)for(;s<o;s++)r=t(e[s],s,n),r!=null&&a.push(r);else for(s in e)r=t(e[s],s,n),r!=null&&a.push(r);return i.apply([],a)},guid:1,proxy:function(e,t){var n,i,s;return typeof t=="string"&&(s=e[t],t=e,e=s),h.isFunction(e)?(n=r.call(arguments,2),i=function(){return e.apply(t||this,n.concat(r.call(arguments)))},i.guid=e.guid=e.guid||h.guid++,i):undefined},now:function(){return+(new Date)},support:l}),h.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){u["[object "+t+"]"]=t.toLowerCase()});var y=function(e){function ot(e,t,r,i){var s,u,f,l,c,d,g,y,S,x;(t?t.ownerDocument||t:E)!==p&&h(t),t=t||p,r=r||[],l=t.nodeType;if(typeof e!="string"||!e||l!==1&&l!==9&&l!==11)return r;if(!i&&v){if(l!==11&&(s=Z.exec(e)))if(f=s[1]){if(l===9){u=t.getElementById(f);if(!u||!u.parentNode)return r;if(u.id===f)return r.push(u),r}else if(t.ownerDocument&&(u=t.ownerDocument.getElementById(f))&&b(t,u)&&u.id===f)return r.push(u),r}else{if(s[2])return D.apply(r,t.getElementsByTagName(e)),r;if((f=s[3])&&n.getElementsByClassName)return D.apply(r,t.getElementsByClassName(f)),r}if(n.qsa&&(!m||!m.test(e))){y=g=w,S=t,x=l!==1&&e;if(l===1&&t.nodeName.toLowerCase()!=="object"){d=o(e),(g=t.getAttribute("id"))?y=g.replace(tt,"\\$&"):t.setAttribute("id",y),y="[id='"+y+"'] ",c=d.length;while(c--)d[c]=y+gt(d[c]);S=et.test(e)&&vt(t.parentNode)||t,x=d.join(",")}if(x)try{return D.apply(r,S.querySelectorAll(x)),r}catch(T){}finally{g||t.removeAttribute("id")}}}return a(e.replace(z,"$1"),t,r,i)}function ut(){function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function at(e){return e[w]=!0,e}function ft(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function lt(e,t){var n=e.split("|"),i=e.length;while(i--)r.attrHandle[n[i]]=t}function ct(e,t){var n=t&&e,r=n&&e.nodeType===1&&t.nodeType===1&&(~t.sourceIndex||L)-(~e.sourceIndex||L);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function dt(e){return at(function(t){return t=+t,at(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function vt(e){return e&&typeof e.getElementsByTagName!="undefined"&&e}function mt(){}function gt(e){var t=0,n=e.length,r="";for(;t<n;t++)r+=e[t].value;return r}function yt(e,t,n){var r=t.dir,i=n&&r==="parentNode",s=x++;return t.first?function(t,n,s){while(t=t[r])if(t.nodeType===1||i)return e(t,n,s)}:function(t,n,o){var u,a,f=[S,s];if(o){while(t=t[r])if(t.nodeType===1||i)if(e(t,n,o))return!0}else while(t=t[r])if(t.nodeType===1||i){a=t[w]||(t[w]={});if((u=a[r])&&u[0]===S&&u[1]===s)return f[2]=u[2];a[r]=f;if(f[2]=e(t,n,o))return!0}}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function wt(e,t,n){var r=0,i=t.length;for(;r<i;r++)ot(e,t[r],n);return n}function Et(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function St(e,t,n,r,i,s){return r&&!r[w]&&(r=St(r)),i&&!i[w]&&(i=St(i,s)),at(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||wt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?Et(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=Et(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?H(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=Et(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):D.apply(o,g)})}function xt(e){var t,n,i,s=e.length,o=r.relative[e[0].type],u=o||r.relative[" "],a=o?1:0,l=yt(function(e){return e===t},u,!0),c=yt(function(e){return H(t,e)>-1},u,!0),h=[function(e,n,r){var i=!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r));return t=null,i}];for(;a<s;a++)if(n=r.relative[e[a].type])h=[yt(bt(h),n)];else{n=r.filter[e[a].type].apply(null,e[a].matches);if(n[w]){i=++a;for(;i<s;i++)if(r.relative[e[i].type])break;return St(a>1&&bt(h),a>1&&gt(e.slice(0,a-1).concat({value:e[a-2].type===" "?"*":""})).replace(z,"$1"),n,a<i&&xt(e.slice(a,i)),i<s&&xt(e=e.slice(i)),i<s&&gt(e))}h.push(n)}return bt(h)}function Tt(e,t){var n=t.length>0,i=e.length>0,s=function(s,o,u,a,l){var c,h,d,v=0,m="0",g=s&&[],y=[],b=f,w=s||i&&r.find.TAG("*",l),E=S+=b==null?1:Math.random()||.1,x=w.length;l&&(f=o!==p&&o);for(;m!==x&&(c=w[m])!=null;m++){if(i&&c){h=0;while(d=e[h++])if(d(c,o,u)){a.push(c);break}l&&(S=E)}n&&((c=!d&&c)&&v--,s&&g.push(c))}v+=m;if(n&&m!==v){h=0;while(d=t[h++])d(g,y,o,u);if(s){if(v>0)while(m--)!g[m]&&!y[m]&&(y[m]=M.call(a));y=Et(y)}D.apply(a,y),l&&!s&&y.length>0&&v+t.length>1&&ot.uniqueSort(a)}return l&&(S=E,f=b),g};return n?at(s):s}var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w="sizzle"+1*new Date,E=e.document,S=0,x=0,T=ut(),N=ut(),C=ut(),k=function(e,t){return e===t&&(c=!0),0},L=1<<31,A={}.hasOwnProperty,O=[],M=O.pop,_=O.push,D=O.push,P=O.slice,H=function(e,t){var n=0,r=e.length;for(;n<r;n++)if(e[n]===t)return n;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",j="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",I=F.replace("w","w#"),q="\\["+j+"*("+F+")(?:"+j+"*([*^$|!~]?=)"+j+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+j+"*\\]",R=":("+F+")(?:\\(("+"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|"+"((?:\\\\.|[^\\\\()[\\]]|"+q+")*)|"+".*"+")\\)|)",U=new RegExp(j+"+","g"),z=new RegExp("^"+j+"+|((?:^|[^\\\\])(?:\\\\.)*)"+j+"+$","g"),W=new RegExp("^"+j+"*,"+j+"*"),X=new RegExp("^"+j+"*([>+~]|"+j+")"+j+"*"),V=new RegExp("="+j+"*([^\\]'\"]*?)"+j+"*\\]","g"),$=new RegExp(R),J=new RegExp("^"+I+"$"),K={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+q),PSEUDO:new RegExp("^"+R),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+j+"*(even|odd|(([+-]|)(\\d*)n|)"+j+"*(?:([+-]|)"+j+"*(\\d+)|))"+j+"*\\)|)","i"),bool:new RegExp("^(?:"+B+")$","i"),needsContext:new RegExp("^"+j+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+j+"*((?:-\\d)?\\d*)"+j+"*\\)|)(?=[^-]|$)","i")},Q=/^(?:input|select|textarea|button)$/i,G=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/[+~]/,tt=/'|\\/g,nt=new RegExp("\\\\([\\da-f]{1,6}"+j+"?|("+j+")|.)","ig"),rt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,r&1023|56320)},it=function(){h()};try{D.apply(O=P.call(E.childNodes),E.childNodes),O[E.childNodes.length].nodeType}catch(st){D={apply:O.length?function(e,t){_.apply(e,P.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}n=ot.support={},s=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},h=ot.setDocument=function(e){var t,i,o=e?e.ownerDocument||e:E;if(o===p||o.nodeType!==9||!o.documentElement)return p;p=o,d=o.documentElement,i=o.defaultView,i&&i!==i.top&&(i.addEventListener?i.addEventListener("unload",it,!1):i.attachEvent&&i.attachEvent("onunload",it)),v=!s(o),n.attributes=ft(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ft(function(e){return e.appendChild(o.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Y.test(o.getElementsByClassName),n.getById=ft(function(e){return d.appendChild(e).id=w,!o.getElementsByName||!o.getElementsByName(w).length}),n.getById?(r.find.ID=function(e,t){if(typeof t.getElementById!="undefined"&&v){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},r.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){return e.getAttribute("id")===t}}):(delete r.find.ID,r.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){var n=typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id");return n&&n.value===t}}),r.find.TAG=n.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!="undefined")return t.getElementsByTagName(e);if(n.qsa)return t.querySelectorAll(e)}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if(e==="*"){while(n=s[i++])n.nodeType===1&&r.push(n);return r}return s},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(v)return t.getElementsByClassName(e)},g=[],m=[];if(n.qsa=Y.test(o.querySelectorAll))ft(function(e){d.appendChild(e).innerHTML="<a id='"+w+"'></a>"+"<select id='"+w+"-\f]' msallowcapture=''>"+"<option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+j+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+j+"*(?:value|"+B+")"),e.querySelectorAll("[id~="+w+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+w+"+*").length||m.push(".#.+[+~]")}),ft(function(e){var t=o.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+j+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")});return(n.matchesSelector=Y.test(y=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ft(function(e){n.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),g.push("!=",R)}),m=m.length&&new RegExp(m.join("|")),g=g.length&&new RegExp(g.join("|")),t=Y.test(d.compareDocumentPosition),b=t||Y.test(d.contains)?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!r&&r.nodeType===1&&!!(n.contains?n.contains(r):e.compareDocumentPosition&&e.compareDocumentPosition(r)&16)}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},k=t?function(e,t){if(e===t)return c=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r?r:(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,r&1||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===o||e.ownerDocument===E&&b(E,e)?-1:t===o||t.ownerDocument===E&&b(E,t)?1:l?H(l,e)-H(l,t):0:r&4?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,r=0,i=e.parentNode,s=t.parentNode,u=[e],a=[t];if(!i||!s)return e===o?-1:t===o?1:i?-1:s?1:l?H(l,e)-H(l,t):0;if(i===s)return ct(e,t);n=e;while(n=n.parentNode)u.unshift(n);n=t;while(n=n.parentNode)a.unshift(n);while(u[r]===a[r])r++;return r?ct(u[r],a[r]):u[r]===E?-1:a[r]===E?1:0},o},ot.matches=function(e,t){return ot(e,null,null,t)},ot.matchesSelector=function(e,t){(e.ownerDocument||e)!==p&&h(e),t=t.replace(V,"='$1']");if(n.matchesSelector&&v&&(!g||!g.test(t))&&(!m||!m.test(t)))try{var r=y.call(e,t);if(r||n.disconnectedMatch||e.document&&e.document.nodeType!==11)return r}catch(i){}return ot(t,p,null,[e]).length>0},ot.contains=function(e,t){return(e.ownerDocument||e)!==p&&h(e),b(e,t)},ot.attr=function(e,t){(e.ownerDocument||e)!==p&&h(e);var i=r.attrHandle[t.toLowerCase()],s=i&&A.call(r.attrHandle,t.toLowerCase())?i(e,t,!v):undefined;return s!==undefined?s:n.attributes||!v?e.getAttribute(t):(s=e.getAttributeNode(t))&&s.specified?s.value:null},ot.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ot.uniqueSort=function(e){var t,r=[],i=0,s=0;c=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(k);if(c){while(t=e[s++])t===e[s]&&(i=r.push(s));while(i--)e.splice(r[i],1)}return l=null,e},i=ot.getText=function(e){var t,n="",r=0,s=e.nodeType;if(!s)while(t=e[r++])n+=i(t);else if(s===1||s===9||s===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(s===3||s===4)return e.nodeValue;return n},r=ot.selectors={cacheLength:50,createPseudo:at,match:K,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(nt,rt),e[3]=(e[3]||e[4]||e[5]||"").replace(nt,rt),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1].slice(0,3)==="nth"?(e[3]||ot.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd")),e[5]=+(e[7]+e[8]||e[3]==="odd")):e[3]&&ot.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return K.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&$.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(nt,rt).toLowerCase();return e==="*"?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=new RegExp("(^|"+j+")"+e+"("+j+"|$)"))&&T(e,function(e){return t.test(typeof e.className=="string"&&e.className||typeof e.getAttribute!="undefined"&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);return i==null?t==="!=":t?(i+="",t==="="?i===n:t==="!="?i!==n:t==="^="?n&&i.indexOf(n)===0:t==="*="?n&&i.indexOf(n)>-1:t==="$="?n&&i.slice(-n.length)===n:t==="~="?(" "+i.replace(U," ")+" ").indexOf(n)>-1:t==="|="?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var s=e.slice(0,3)!=="nth",o=e.slice(-4)!=="last",u=t==="of-type";return r===1&&i===0?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u;if(m){if(s){while(v){c=t;while(c=c[v])if(u?c.nodeName.toLowerCase()===g:c.nodeType===1)return!1;d=v=e==="only"&&!d&&"nextSibling"}return!0}d=[o?m.firstChild:m.lastChild];if(o&&y){l=m[w]||(m[w]={}),f=l[e]||[],p=f[0]===S&&f[1],h=f[0]===S&&f[2],c=p&&m.childNodes[p];while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if(c.nodeType===1&&++h&&c===t){l[e]=[S,p,h];break}}else if(y&&(f=(t[w]||(t[w]={}))[e])&&f[0]===S)h=f[1];else while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if((u?c.nodeName.toLowerCase()===g:c.nodeType===1)&&++h){y&&((c[w]||(c[w]={}))[e]=[S,h]);if(c===t)break}return h-=i,h===r||h%r===0&&h/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);return i[w]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var r,s=i(e,t),o=s.length;while(o--)r=H(e,s[o]),e[r]=!(n[r]=s[o])}):function(e){return i(e,0,n)}):i}},pseudos:{not:at(function(e){var t=[],n=[],r=u(e.replace(z,"$1"));return r[w]?at(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),t[0]=null,!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return e=e.replace(nt,rt),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:at(function(e){return J.test(e||"")||ot.error("unsupported lang: "+e),e=e.replace(nt,rt).toLowerCase(),function(t){var n;do if(n=v?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||n.indexOf(e+"-")===0;while((t=t.parentNode)&&t.nodeType===1);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.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:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return G.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},text:function(e){var t;return e.nodeName.toLowerCase()==="input"&&e.type==="text"&&((t=e.getAttribute("type"))==null||t.toLowerCase()==="text")},first:dt(function(){return[0]}),last:dt(function(e,t){return[t-1]}),eq:dt(function(e,t,n){return[n<0?n+t:n]}),even:dt(function(e,t){var n=0;for(;n<t;n+=2)e.push(n);return e}),odd:dt(function(e,t){var n=1;for(;n<t;n+=2)e.push(n);return e}),lt:dt(function(e,t,n){var r=n<0?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:dt(function(e,t,n){var r=n<0?n+t:n;for(;++r<t;)e.push(r);return e})}},r.pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=ht(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pt(t);return mt.prototype=r.filters=r.pseudos,r.setFilters=new mt,o=ot.tokenize=function(e,t){var n,i,s,o,u,a,f,l=N[e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=r.preFilter;while(u){if(!n||(i=W.exec(u)))i&&(u=u.slice(i[0].length)||u),a.push(s=[]);n=!1;if(i=X.exec(u))n=i.shift(),s.push({value:n,type:i[0].replace(z," ")}),u=u.slice(n.length);for(o in r.filter)(i=K[o].exec(u))&&(!f[o]||(i=f[o](i)))&&(n=i.shift(),s.push({value:n,type:o,matches:i}),u=u.slice(n.length));if(!n)break}return t?u.length:u?ot.error(e):N(e,a).slice(0)},u=ot.compile=function(e,t){var n,r=[],i=[],s=C[e+" "];if(!s){t||(t=o(e)),n=t.length;while(n--)s=xt(t[n]),s[w]?r.push(s):i.push(s);s=C(e,Tt(i,r)),s.selector=e}return s},a=ot.select=function(e,t,i,s){var a,f,l,c,h,p=typeof e=="function"&&e,d=!s&&o(e=p.selector||e);i=i||[];if(d.length===1){f=d[0]=d[0].slice(0);if(f.length>2&&(l=f[0]).type==="ID"&&n.getById&&t.nodeType===9&&v&&r.relative[f[1].type]){t=(r.find.ID(l.matches[0].replace(nt,rt),t)||[])[0];if(!t)return i;p&&(t=t.parentNode),e=e.slice(f.shift().value.length)}a=K.needsContext.test(e)?0:f.length;while(a--){l=f[a];if(r.relative[c=l.type])break;if(h=r.find[c])if(s=h(l.matches[0].replace(nt,rt),et.test(f[0].type)&&vt(t.parentNode)||t)){f.splice(a,1),e=s.length&&gt(f);if(!e)return D.apply(i,s),i;break}}}return(p||u(e,d))(s,t,!v,i,et.test(e)&&vt(t.parentNode)||t),i},n.sortStable=w.split("").sort(k).join("")===w,n.detectDuplicates=!!c,h(),n.sortDetached=ft(function(e){return e.compareDocumentPosition(p.createElement("div"))&1}),ft(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild.getAttribute("href")==="#"})||lt("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,t.toLowerCase()==="type"?1:2)}),(!n.attributes||!ft(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),e.firstChild.getAttribute("value")===""}))&&lt("value",function(e,t,n){if(!n&&e.nodeName.toLowerCase()==="input")return e.defaultValue}),ft(function(e){return e.getAttribute("disabled")==null})||lt(B,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),ot}(e);h.find=y,h.expr=y.selectors,h.expr[":"]=h.expr.pseudos,h.unique=y.uniqueSort,h.text=y.getText,h.isXMLDoc=y.isXML,h.contains=y.contains;var b=h.expr.match.needsContext,w=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^.[^:#\[\.,]*$/;h.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),t.length===1&&r.nodeType===1?h.find.matchesSelector(r,e)?[r]:[]:h.find.matches(e,h.grep(t,function(e){return e.nodeType===1}))},h.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if(typeof e!="string")return this.pushStack(h(e).filter(function(){for(t=0;t<i;t++)if(h.contains(r[t],this))return!0}));for(t=0;t<i;t++)h.find(e,r[t],n);return n=this.pushStack(i>1?h.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},filter:function(e){return this.pushStack(S(this,e||[],!1))},not:function(e){return this.pushStack(S(this,e||[],!0))},is:function(e){return!!S(this,typeof e=="string"&&b.test(e)?h(e):e||[],!1).length}});var x,T=e.document,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=h.fn.init=function(e,t){var n,r;if(!e)return this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?n=[null,e,null]:n=N.exec(e);if(n&&(n[1]||!t)){if(n[1]){t=t instanceof h?t[0]:t,h.merge(this,h.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:T,!0));if(w.test(n[1])&&h.isPlainObject(t))for(n in t)h.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}r=T.getElementById(n[2]);if(r&&r.parentNode){if(r.id!==n[2])return x.find(e);this.length=1,this[0]=r}return this.context=T,this.selector=e,this}return!t||t.jquery?(t||x).find(e):this.constructor(t).find(e)}return e.nodeType?(this.context=this[0]=e,this.length=1,this):h.isFunction(e)?typeof x.ready!="undefined"?x.ready(e):e(h):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),h.makeArray(e,this))};C.prototype=h.fn,x=h(T);var k=/^(?:parents|prev(?:Until|All))/,L={children:!0,contents:!0,next:!0,prev:!0};h.extend({dir:function(e,t,n){var r=[],i=e[t];while(i&&i.nodeType!==9&&(n===undefined||i.nodeType!==1||!h(i).is(n)))i.nodeType===1&&r.push(i),i=i[t];return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}}),h.fn.extend({has:function(e){var t,n=h(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(h.contains(this,n[t]))return!0})},closest:function(e,t){var n,r=0,i=this.length,s=[],o=b.test(e)||typeof e!="string"?h(e,t||this.context):0;for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(o?o.index(n)>-1:n.nodeType===1&&h.find.matchesSelector(n,e))){s.push(n);break}return this.pushStack(s.length>1?h.unique(s):s)},index:function(e){return e?typeof e=="string"?h.inArray(this[0],h(e)):h.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(h.unique(h.merge(this.get(),h(e,t))))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),h.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return h.dir(e,"parentNode")},parentsUntil:function(e,t,n){return h.dir(e,"parentNode",n)},next:function(e){return A(e,"nextSibling")},prev:function(e){return A(e,"previousSibling")},nextAll:function(e){return h.dir(e,"nextSibling")},prevAll:function(e){return h.dir(e,"previousSibling")},nextUntil:function(e,t,n){return h.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return h.dir(e,"previousSibling",n)},siblings:function(e){return h.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return h.sibling(e.firstChild)},contents:function(e){return h.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:h.merge([],e.childNodes)}},function(e,t){h.fn[e]=function(n,r){var i=h.map(this,t,n);return e.slice(-5)!=="Until"&&(r=n),r&&typeof r=="string"&&(i=h.filter(r,i)),this.length>1&&(L[e]||(i=h.unique(i)),k.test(e)&&(i=i.reverse())),this.pushStack(i)}});var O=/\S+/g,M={};h.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):h.extend({},e);var t,n,r,i,s,o,u=[],a=!e.once&&[],f=function(c){n=e.memory&&c,r=!0,s=o||0,o=0,i=u.length,t=!0;for(;u&&s<i;s++)if(u[s].apply(c[0],c[1])===!1&&e.stopOnFalse){n=!1;break}t=!1,u&&(a?a.length&&f(a.shift()):n?u=[]:l.disable())},l={add:function(){if(u){var r=u.length;(function s(t){h.each(t,function(t,n){var r=h.type(n);r==="function"?(!e.unique||!l.has(n))&&u.push(n):n&&n.length&&r!=="string"&&s(n)})})(arguments),t?i=u.length:n&&(o=r,f(n))}return this},remove:function(){return u&&h.each(arguments,function(e,n){var r;while((r=h.inArray(n,u,r))>-1)u.splice(r,1),t&&(r<=i&&i--,r<=s&&s--)}),this},has:function(e){return e?h.inArray(e,u)>-1:!!u&&!!u.length},empty:function(){return u=[],i=0,this},disable:function(){return u=a=n=undefined,this},disabled:function(){return!u},lock:function(){return a=undefined,n||l.disable(),this},locked:function(){return!a},fireWith:function(e,n){return u&&(!r||a)&&(n=n||[],n=[e,n.slice?n.slice():n],t?a.push(n):f(n)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l},h.extend({Deferred:function(e){var t=[["resolve","done",h.Callbacks("once memory"),"resolved"],["reject","fail",h.Callbacks("once memory"),"rejected"],["notify","progress",h.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return h.Deferred(function(n){h.each(t,function(t,s){var o=h.isFunction(e[t])&&e[t];i[s[1]](function(){var e=o&&o.apply(this,arguments);e&&h.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s[0]+"With"](this===r?n.promise():this,o?[e]:arguments)})}),e=null}).promise()},promise:function(e){return e!=null?h.extend(e,r):r}},i={};return r.pipe=r.then,h.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=function(){return i[s[0]+"With"](this===i?r:this,arguments),this},i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=r.call(arguments),i=n.length,s=i!==1||e&&h.isFunction(e.promise)?i:0,o=s===1?e:h.Deferred(),u=function(e,t,n){return function(i){t[e]=this,n[e]=arguments.length>1?r.call(arguments):i,n===a?o.notifyWith(t,n):--s||o.resolveWith(t,n)}},a,f,l;if(i>1){a=new Array(i),f=new Array(i),l=new Array(i);for(;t<i;t++)n[t]&&h.isFunction(n[t].promise)?n[t].promise().done(u(t,l,n)).fail(o.reject).progress(u(t,f,a)):--s}return s||o.resolveWith(l,n),o.promise()}});var D;h.fn.ready=function(e){return h.ready.promise().done(e),this},h.extend({isReady:!1,readyWait:1,holdReady:function(e){e?h.readyWait++:h.ready(!0)},ready:function(e){if(e===!0?--h.readyWait:h.isReady)return;if(!T.body)return setTimeout(h.ready);h.isReady=!0;if(e!==!0&&--h.readyWait>0)return;D.resolveWith(T,[h]),h.fn.triggerHandler&&(h(T).triggerHandler("ready"),h(T).off("ready"))}}),h.ready.promise=function(t){if(!D){D=h.Deferred();if(T.readyState==="complete")setTimeout(h.ready);else if(T.addEventListener)T.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{T.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var n=!1;try{n=e.frameElement==null&&T.documentElement}catch(r){}n&&n.doScroll&&function i(){if(!h.isReady){try{n.doScroll("left")}catch(e){return setTimeout(i,50)}P(),h.ready()}}()}}return D.promise(t)};var B=typeof undefined,j;for(j in h(l))break;l.ownLast=j!=="0",l.inlineBlockNeedsLayout=!1,h(function(){var e,t,n,r;n=T.getElementsByTagName("body")[0];if(!n||!n.style)return;t=T.createElement("div"),r=T.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),typeof t.style.zoom!==B&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",l.inlineBlockNeedsLayout=e=t.offsetWidth===3,e&&(n.style.zoom=1)),n.removeChild(r)}),function(){var e=T.createElement("div");if(l.deleteExpando==null){l.deleteExpando=!0;try{delete e.test}catch(t){l.deleteExpando=!1}}e=null}(),h.acceptData=function(e){var t=h.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return n!==1&&n!==9?!1:!t||t!==!0&&e.getAttribute("classid")===t};var F=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,I=/([A-Z])/g;h.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?h.cache[e[h.expando]]:e[h.expando],!!e&&!R(e)},data:function(e,t,n){return U(e,t,n)},removeData:function(e,t){return z(e,t)},_data:function(e,t,n){return U(e,t,n,!0)},_removeData:function(e,t){return z(e,t,!0)}}),h.fn.extend({data:function(e,t){var n,r,i,s=this[0],o=s&&s.attributes;if(e===undefined){if(this.length){i=h.data(s);if(s.nodeType===1&&!h._data(s,"parsedAttrs")){n=o.length;while(n--)o[n]&&(r=o[n].name,r.indexOf("data-")===0&&(r=h.camelCase(r.slice(5)),q(s,r,i[r])));h._data(s,"parsedAttrs",!0)}}return i}return typeof e=="object"?this.each(function(){h.data(this,e)}):arguments.length>1?this.each(function(){h.data(this,e,t)}):s?q(s,e,h.data(s,e)):undefined},removeData:function(e){return this.each(function(){h.removeData(this,e)})}}),h.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=h._data(e,t),n&&(!r||h.isArray(n)?r=h._data(e,t,h.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=h.queue(e,t),r=n.length,i=n.shift(),s=h._queueHooks(e,t),o=function(){h.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return h._data(e,n)||h._data(e,n,{empty:h.Callbacks("once memory").add(function(){h._removeData(e,t+"queue"),h._removeData(e,n)})})}}),h.fn.extend({queue:function(e,t){var n=2;return typeof e!="string"&&(t=e,e="fx",n--),arguments.length<n?h.queue(this[0],e):t===undefined?this:this.each(function(){var n=h.queue(this,e,t);h._queueHooks(this,e),e==="fx"&&n[0]!=="inprogress"&&h.dequeue(this,e)})},dequeue:function(e){return this.each(function(){h.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=h.Deferred(),s=this,o=this.length,u=function(){--r||i.resolveWith(s,[s])};typeof e!="string"&&(t=e,e=undefined),e=e||"fx";while(o--)n=h._data(s[o],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(u));return u(),i.promise(t)}});var W=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,X=["Top","Right","Bottom","Left"],V=function(e,t){return e=t||e,h.css(e,"display")==="none"||!h.contains(e.ownerDocument,e)},$=h.access=function(e,t,n,r,i,s,o){var u=0,a=e.length,f=n==null;if(h.type(n)==="object"){i=!0;for(u in n)h.access(e,t,u,n[u],!0,s,o)}else if(r!==undefined){i=!0,h.isFunction(r)||(o=!0),f&&(o?(t.call(e,r),t=null):(f=t,t=function(e,t,n){return f.call(h(e),n)}));if(t)for(;u<a;u++)t(e[u],n,o?r:r.call(e[u],u,t(e[u],n)))}return i?e:f?t.call(e):a?t(e[0],n):s},J=/^(?:checkbox|radio)$/i;(function(){var e=T.createElement("input"),t=T.createElement("div"),n=T.createDocumentFragment();t.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",l.leadingWhitespace=t.firstChild.nodeType===3,l.tbody=!t.getElementsByTagName("tbody").length,l.htmlSerialize=!!t.getElementsByTagName("link").length,l.html5Clone=T.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",e.type="checkbox",e.checked=!0,n.appendChild(e),l.appendChecked=e.checked,t.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue,n.appendChild(t),t.innerHTML="<input type='radio' checked='checked' name='t'/>",l.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,t.attachEvent&&(t.attachEvent("onclick",function(){l.noCloneEvent=!1}),t.cloneNode(!0).click());if(l.deleteExpando==null){l.deleteExpando=!0;try{delete t.test}catch(r){l.deleteExpando=!1}}})(),function(){var t,n,r=T.createElement("div");for(t in{submit:!0,change:!0,focusin:!0})n="on"+t,(l[t+"Bubbles"]=n in e)||(r.setAttribute(n,"t"),l[t+"Bubbles"]=r.attributes[n].expando===!1);r=null}();var K=/^(?:input|select|textarea)$/i,Q=/^key/,G=/^(?:mouse|pointer|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=/^([^.]*)(?:\.(.+)|)$/;h.event={global:{},add:function(e,t,n,r,i){var s,o,u,a,f,l,c,p,d,v,m,g=h._data(e);if(!g)return;n.handler&&(a=n,n=a.handler,i=a.selector),n.guid||(n.guid=h.guid++),(o=g.events)||(o=g.events={}),(l=g.handle)||(l=g.handle=function(e){return typeof h===B||!!e&&h.event.triggered===e.type?undefined:h.event.dispatch.apply(l.elem,arguments)},l.elem=e),t=(t||"").match(O)||[""],u=t.length;while(u--){s=Z.exec(t[u])||[],d=m=s[1],v=(s[2]||"").split(".").sort();if(!d)continue;f=h.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=h.event.special[d]||{},c=h.extend({type:d,origType:m,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&h.expr.match.needsContext.test(i),namespace:v.join(".")},a);if(!(p=o[d])){p=o[d]=[],p.delegateCount=0;if(!f.setup||f.setup.call(e,r,v,l)===!1)e.addEventListener?e.addEventListener(d,l,!1):e.attachEvent&&e.attachEvent("on"+d,l)}f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),h.event.global[d]=!0}e=null},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,p,d,v,m,g=h.hasData(e)&&h._data(e);if(!g||!(l=g.events))return;t=(t||"").match(O)||[""],f=t.length;while(f--){u=Z.exec(t[f])||[],d=m=u[1],v=(u[2]||"").split(".").sort();if(!d){for(d in l)h.event.remove(e,d+t[f],n,r,!0);continue}c=h.event.special[d]||{},d=(r?c.delegateType:c.bindType)||d,p=l[d]||[],u=u[2]&&new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=s=p.length;while(s--)o=p[s],(i||m===o.origType)&&(!n||n.guid===o.guid)&&(!u||u.test(o.namespace))&&(!r||r===o.selector||r==="**"&&o.selector)&&(p.splice(s,1),o.selector&&p.delegateCount--,c.remove&&c.remove.call(e,o));a&&!p.length&&((!c.teardown||c.teardown.call(e,v,g.handle)===!1)&&h.removeEvent(e,d,g.handle),delete l[d])}h.isEmptyObject(l)&&(delete g.handle,h._removeData(e,"events"))},trigger:function(t,n,r,i){var s,o,u,a,l,c,p,d=[r||T],v=f.call(t,"type")?t.type:t,m=f.call(t,"namespace")?t.namespace.split("."):[];u=c=r=r||T;if(r.nodeType===3||r.nodeType===8)return;if(Y.test(v+h.event.triggered))return;v.indexOf(".")>=0&&(m=v.split("."),v=m.shift(),m.sort()),o=v.indexOf(":")<0&&"on"+v,t=t[h.expando]?t:new h.Event(v,typeof t=="object"&&t),t.isTrigger=i?2:3,t.namespace=m.join("."),t.namespace_re=t.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=undefined,t.target||(t.target=r),n=n==null?[t]:h.makeArray(n,[t]),l=h.event.special[v]||{};if(!i&&l.trigger&&l.trigger.apply(r,n)===!1)return;if(!i&&!l.noBubble&&!h.isWindow(r)){a=l.delegateType||v,Y.test(a+v)||(u=u.parentNode);for(;u;u=u.parentNode)d.push(u),c=u;c===(r.ownerDocument||T)&&d.push(c.defaultView||c.parentWindow||e)}p=0;while((u=d[p++])&&!t.isPropagationStopped())t.type=p>1?a:l.bindType||v,s=(h._data(u,"events")||{})[t.type]&&h._data(u,"handle"),s&&s.apply(u,n),s=o&&u[o],s&&s.apply&&h.acceptData(u)&&(t.result=s.apply(u,n),t.result===!1&&t.preventDefault());t.type=v;if(!i&&!t.isDefaultPrevented()&&(!l._default||l._default.apply(d.pop(),n)===!1)&&h.acceptData(r)&&o&&r[v]&&!h.isWindow(r)){c=r[o],c&&(r[o]=null),h.event.triggered=v;try{r[v]()}catch(g){}h.event.triggered=undefined,c&&(r[o]=c)}return t.result},dispatch:function(e){e=h.event.fix(e);var t,n,i,s,o,u=[],a=r.call(arguments),f=(h._data(this,"events")||{})[e.type]||[],l=h.event.special[e.type]||{};a[0]=e,e.delegateTarget=this;if(l.preDispatch&&l.preDispatch.call(this,e)===!1)return;u=h.event.handlers.call(this,e,f),t=0;while((s=u[t++])&&!e.isPropagationStopped()){e.currentTarget=s.elem,o=0;while((i=s.handlers[o++])&&!e.isImmediatePropagationStopped())if(!e.namespace_re||e.namespace_re.test(i.namespace))e.handleObj=i,e.data=i.data,n=((h.event.special[i.origType]||{}).handle||i.handler).apply(s.elem,a),n!==undefined&&(e.result=n)===!1&&(e.preventDefault(),e.stopPropagation())}return l.postDispatch&&l.postDispatch.call(this,e),e.result},handlers:function(e,t){var n,r,i,s,o=[],u=t.delegateCount,a=e.target;if(u&&a.nodeType&&(!e.button||e.type!=="click"))for(;a!=this;a=a.parentNode||this)if(a.nodeType===1&&(a.disabled!==!0||e.type!=="click")){i=[];for(s=0;s<u;s++)r=t[s],n=r.selector+" ",i[n]===undefined&&(i[n]=r.needsContext?h(n,this).index(a)>=0:h.find(n,this,null,[a]).length),i[n]&&i.push(r);i.length&&o.push({elem:a,handlers:i})}return u<t.length&&o.push({elem:this,handlers:t.slice(u)}),o},fix:function(e){if(e[h.expando])return e;var t,n,r,i=e.type,s=e,o=this.fixHooks[i];o||(this.fixHooks[i]=o=G.test(i)?this.mouseHooks:Q.test(i)?this.keyHooks:{}),r=o.props?this.props.concat(o.props):this.props,e=new h.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=s.srcElement||T),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,o.filter?o.filter(e,s):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button,o=t.fromElement;return e.pageX==null&&t.clientX!=null&&(r=e.target.ownerDocument||T,i=r.documentElement,n=r.body,e.pageX=t.clientX+(i&&i.scrollLeft||n&&n.scrollLeft||0)-(i&&i.clientLeft||n&&n.clientLeft||0),e.pageY=t.clientY+(i&&i.scrollTop||n&&n.scrollTop||0)-(i&&i.clientTop||n&&n.clientTop||0)),!e.relatedTarget&&o&&(e.relatedTarget=o===e.target?t.toElement:o),!e.which&&s!==undefined&&(e.which=s&1?1:s&2?3:s&4?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==nt()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){if(this===nt()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if(h.nodeName(this,"input")&&this.type==="checkbox"&&this.click)return this.click(),!1},_default:function(e){return h.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=h.extend(new h.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?h.event.trigger(i,null,t):h.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},h.removeEvent=T.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===B&&(e[r]=null),e.detachEvent(r,n))},h.Event=function(e,t){if(!(this instanceof h.Event))return new h.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.defaultPrevented===undefined&&e.returnValue===!1?et:tt):this.type=e,t&&h.extend(this,t),this.timeStamp=e&&e.timeStamp||h.now(),this[h.expando]=!0},h.Event.prototype={isDefaultPrevented:tt,isPropagationStopped:tt,isImmediatePropagationStopped:tt,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=et;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=et;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=et,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},h.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){h.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj;if(!i||i!==r&&!h.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),l.submitBubbles||(h.event.special.submit={setup:function(){if(h.nodeName(this,"form"))return!1;h.event.add(this,"click._submit keypress._submit",function(e){var t=e.target,n=h.nodeName(t,"input")||h.nodeName(t,"button")?t.form:undefined;n&&!h._data(n,"submitBubbles")&&(h.event.add(n,"submit._submit",function(e){e._submit_bubble=!0}),h._data(n,"submitBubbles",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&h.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(h.nodeName(this,"form"))return!1;h.event.remove(this,"._submit")}}),l.changeBubbles||(h.event.special.change={setup:function(){if(K.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")h.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),h.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),h.event.simulate("change",this,e,!0)});return!1}h.event.add(this,"beforeactivate._change",function(e){var t=e.target;K.test(t.nodeName)&&!h._data(t,"changeBubbles")&&(h.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&h.event.simulate("change",this.parentNode,e,!0)}),h._data(t,"changeBubbles",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return h.event.remove(this,"._change"),!K.test(this.nodeName)}}),l.focusinBubbles||h.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){h.event.simulate(t,e.target,h.event.fix(e),!0)};h.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=h._data(r,t);i||r.addEventListener(e,n,!0),h._data(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=h._data(r,t)-1;i?h._data(r,t,i):(r.removeEventListener(e,n,!0),h._removeData(r,t))}}}),h.fn.extend({on:function(e,t,n,r,i){var s,o;if(typeof e=="object"){typeof t!="string"&&(n=n||t,t=undefined);for(s in e)this.on(s,t,n,e[s],i);return this}n==null&&r==null?(r=t,n=t=undefined):r==null&&(typeof t=="string"?(r=n,n=undefined):(r=n,n=t,t=undefined));if(r===!1)r=tt;else if(!r)return this;return i===1&&(o=r,r=function(e){return h().off(e),o.apply(this,arguments)},r.guid=o.guid||(o.guid=h.guid++)),this.each(function(){h.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,h(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if(typeof e=="object"){for(i in e)this.off(i,t,e[i]);return this}if(t===!1||typeof t=="function")n=t,t=undefined;return n===!1&&(n=tt),this.each(function(){h.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){h.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return h.event.trigger(e,t,n,!0)}});var it="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",st=/ jQuery\d+="(?:null|\d+)"/g,ot=new RegExp("<(?:"+it+")[\\s/>]","i"),ut=/^\s+/,at=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ft=/<([\w:]+)/,lt=/<tbody/i,ct=/<|&#?\w+;/,ht=/<(?:script|style|link)/i,pt=/checked\s*(?:[^=]|=\s*.checked.)/i,dt=/^$|\/(?:java|ecma)script/i,vt=/^true\/(.*)/,mt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,gt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},yt=rt(T),bt=yt.appendChild(T.createElement("div"));gt.optgroup=gt.option,gt.tbody=gt.tfoot=gt.colgroup=gt.caption=gt.thead,gt.th=gt.td,h.extend({clone:function(e,t,n){var r,i,s,o,u,a=h.contains(e.ownerDocument,e);l.html5Clone||h.isXMLDoc(e)||!ot.test("<"+e.nodeName+">")?s=e.cloneNode(!0):(bt.innerHTML=e.outerHTML,bt.removeChild(s=bt.firstChild));if((!l.noCloneEvent||!l.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!h.isXMLDoc(e)){r=wt(s),u=wt(e);for(o=0;(i=u[o])!=null;++o)r[o]&&kt(i,r[o])}if(t)if(n){u=u||wt(e),r=r||wt(s);for(o=0;(i=u[o])!=null;o++)Ct(i,r[o])}else Ct(e,s);return r=wt(s,"script"),r.length>0&&Nt(r,!a&&wt(e,"script")),r=u=i=null,s},buildFragment:function(e,t,n,r){var i,s,o,u,a,f,c,p=e.length,d=rt(t),v=[],m=0;for(;m<p;m++){s=e[m];if(s||s===0)if(h.type(s)==="object")h.merge(v,s.nodeType?[s]:s);else if(!ct.test(s))v.push(t.createTextNode(s));else{u=u||d.appendChild(t.createElement("div")),a=(ft.exec(s)||["",""])[1].toLowerCase(),c=gt[a]||gt._default,u.innerHTML=c[1]+s.replace(at,"<$1></$2>")+c[2],i=c[0];while(i--)u=u.lastChild;!l.leadingWhitespace&&ut.test(s)&&v.push(t.createTextNode(ut.exec(s)[0]));if(!l.tbody){s=a==="table"&&!lt.test(s)?u.firstChild:c[1]==="<table>"&&!lt.test(s)?u:0,i=s&&s.childNodes.length;while(i--)h.nodeName(f=s.childNodes[i],"tbody")&&!f.childNodes.length&&s.removeChild(f)}h.merge(v,u.childNodes),u.textContent="";while(u.firstChild)u.removeChild(u.firstChild);u=d.lastChild}}u&&d.removeChild(u),l.appendChecked||h.grep(wt(v,"input"),Et),m=0;while(s=v[m++]){if(r&&h.inArray(s,r)!==-1)continue;o=h.contains(s.ownerDocument,s),u=wt(d.appendChild(s),"script"),o&&Nt(u);if(n){i=0;while(s=u[i++])dt.test(s.type||"")&&n.push(s)}}return u=null,d},cleanData:function(e,t){var r,i,s,o,u=0,a=h.expando,f=h.cache,c=l.deleteExpando,p=h.event.special;for(;(r=e[u])!=null;u++)if(t||h.acceptData(r)){s=r[a],o=s&&f[s];if(o){if(o.events)for(i in o.events)p[i]?h.event.remove(r,i):h.removeEvent(r,i,o.handle);f[s]&&(delete f[s],c?delete r[a]:typeof r.removeAttribute!==B?r.removeAttribute(a):r[a]=null,n.push(s))}}}}),h.fn.extend({text:function(e){return $(this,function(e){return e===undefined?h.text(this):this.empty().append((this[0]&&this[0].ownerDocument||T).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=St(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=St(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?h.filter(e,this):this,i=0;for(;(n=r[i])!=null;i++)!t&&n.nodeType===1&&h.cleanData(wt(n)),n.parentNode&&(t&&h.contains(n.ownerDocument,n)&&Nt(wt(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&h.cleanData(wt(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&h.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return h.clone(this,e,t)})},html:function(e){return $(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined)return t.nodeType===1?t.innerHTML.replace(st,""):undefined;if(typeof e=="string"&&!ht.test(e)&&(l.htmlSerialize||!ot.test(e))&&(l.leadingWhitespace||!ut.test(e))&&!gt[(ft.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(at,"<$1></$2>");try{for(;n<r;n++)t=this[n]||{},t.nodeType===1&&(h.cleanData(wt(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];return this.domManip(arguments,function(t){e=this.parentNode,h.cleanData(wt(this)),e&&e.replaceChild(t,this)}),e&&(e.length||e.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t){e=i.apply([],e);var n,r,s,o,u,a,f=0,c=this.length,p=this,d=c-1,v=e[0],m=h.isFunction(v);if(m||c>1&&typeof v=="string"&&!l.checkClone&&pt.test(v))return this.each(function(n){var r=p.eq(n);m&&(e[0]=v.call(this,n,r.html())),r.domManip(e,t)});if(c){a=h.buildFragment(e,this[0].ownerDocument,!1,this),n=a.firstChild,a.childNodes.length===1&&(a=n);if(n){o=h.map(wt(a,"script"),xt),s=o.length;for(;f<c;f++)r=a,f!==d&&(r=h.clone(r,!0,!0),s&&h.merge(o,wt(r,"script"))),t.call(this[f],r,f);if(s){u=o[o.length-1].ownerDocument,h.map(o,Tt);for(f=0;f<s;f++)r=o[f],dt.test(r.type||"")&&!h._data(r,"globalEval")&&h.contains(u,r)&&(r.src?h._evalUrl&&h._evalUrl(r.src):h.globalEval((r.text||r.textContent||r.innerHTML||"").replace(mt,"")))}a=n=null}}return this}}),h.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){h.fn[e]=function(e){var n,r=0,i=[],o=h(e),u=o.length-1;for(;r<=u;r++)n=r===u?this:this.clone(!0),h(o[r])[t](n),s.apply(i,n.get());return this.pushStack(i)}});var Lt,At={};(function(){var e;l.shrinkWrapBlocks=function(){if(e!=null)return e;e=!1;var t,n,r;n=T.getElementsByTagName("body")[0];if(!n||!n.style)return;return t=T.createElement("div"),r=T.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),typeof t.style.zoom!==B&&(t.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",t.appendChild(T.createElement("div")).style.width="5px",e=t.offsetWidth!==3),n.removeChild(r),e}})();var _t=/^margin/,Dt=new RegExp("^("+W+")(?!px)[a-z%]+$","i"),Pt,Ht,Bt=/^(top|right|bottom|left)$/;e.getComputedStyle?(Pt=function(t){return t.ownerDocument.defaultView.opener?t.ownerDocument.defaultView.getComputedStyle(t,null):e.getComputedStyle(t,null)},Ht=function(e,t,n){var r,i,s,o,u=e.style;return n=n||Pt(e),o=n?n.getPropertyValue(t)||n[t]:undefined,n&&(o===""&&!h.contains(e.ownerDocument,e)&&(o=h.style(e,t)),Dt.test(o)&&_t.test(t)&&(r=u.width,i=u.minWidth,s=u.maxWidth,u.minWidth=u.maxWidth=u.width=o,o=n.width,u.width=r,u.minWidth=i,u.maxWidth=s)),o===undefined?o:o+""}):T.documentElement.currentStyle&&(Pt=function(e){return e.currentStyle},Ht=function(e,t,n){var r,i,s,o,u=e.style;return n=n||Pt(e),o=n?n[t]:undefined,o==null&&u&&u[t]&&(o=u[t]),Dt.test(o)&&!Bt.test(t)&&(r=u.left,i=e.runtimeStyle,s=i&&i.left,s&&(i.left=e.currentStyle.left),u.left=t==="fontSize"?"1em":o,o=u.pixelLeft+"px",u.left=r,s&&(i.left=s)),o===undefined?o:o+""||"auto"}),function(){function a(){var t,n,r,a;n=T.getElementsByTagName("body")[0];if(!n||!n.style)return;t=T.createElement("div"),r=T.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),t.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",i=s=!1,u=!0,e.getComputedStyle&&(i=(e.getComputedStyle(t,null)||{}).top!=="1%",s=(e.getComputedStyle(t,null)||{width:"4px"}).width==="4px",a=t.appendChild(T.createElement("div")),a.style.cssText=t.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",a.style.marginRight=a.style.width="0",t.style.width="1px",u=!parseFloat((e.getComputedStyle(a,null)||{}).marginRight),t.removeChild(a)),t.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=t.getElementsByTagName("td"),a[0].style.cssText="margin:0;border:0;padding:0;display:none",o=a[0].offsetHeight===0,o&&(a[0].style.display="",a[1].style.display="none",o=a[0].offsetHeight===0),n.removeChild(r)}var t,n,r,i,s,o,u;t=T.createElement("div"),t.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",r=t.getElementsByTagName("a")[0],n=r&&r.style;if(!n)return;n.cssText="float:left;opacity:.5",l.opacity=n.opacity==="0.5",l.cssFloat=!!n.cssFloat,t.style.backgroundClip="content-box",t.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle=t.style.backgroundClip==="content-box",l.boxSizing=n.boxSizing===""||n.MozBoxSizing===""||n.WebkitBoxSizing==="",h.extend(l,{reliableHiddenOffsets:function(){return o==null&&a(),o},boxSizingReliable:function(){return s==null&&a(),s},pixelPosition:function(){return i==null&&a(),i},reliableMarginRight:function(){return u==null&&a(),u}})}(),h.swap=function(e,t,n,r){var i,s,o={};for(s in t)o[s]=e.style[s],e.style[s]=t[s];i=n.apply(e,r||[]);for(s in t)e.style[s]=o[s];return i};var Ft=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,qt=/^(none|table(?!-c[ea]).+)/,Rt=new RegExp("^("+W+")(.*)$","i"),Ut=new RegExp("^([+-])=("+W+")","i"),zt={position:"absolute",visibility:"hidden",display:"block"},Wt={letterSpacing:"0",fontWeight:"400"},Xt=["Webkit","O","Moz","ms"];h.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Ht(e,"opacity");return n===""?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,n,r){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var i,s,o,u=h.camelCase(t),a=e.style;t=h.cssProps[u]||(h.cssProps[u]=Vt(a,u)),o=h.cssHooks[t]||h.cssHooks[u];if(n===undefined)return o&&"get"in o&&(i=o.get(e,!1,r))!==undefined?i:a[t];s=typeof n,s==="string"&&(i=Ut.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(h.css(e,t)),s="number");if(n==null||n!==n)return;s==="number"&&!h.cssNumber[u]&&(n+="px"),!l.clearCloneStyle&&n===""&&t.indexOf("background")===0&&(a[t]="inherit");if(!o||!("set"in o)||(n=o.set(e,n,r))!==undefined)try{a[t]=n}catch(f){}},css:function(e,t,n,r){var i,s,o,u=h.camelCase(t);return t=h.cssProps[u]||(h.cssProps[u]=Vt(e.style,u)),o=h.cssHooks[t]||h.cssHooks[u],o&&"get"in o&&(s=o.get(e,!0,n)),s===undefined&&(s=Ht(e,t,r)),s==="normal"&&t in Wt&&(s=Wt[t]),n===""||n?(i=parseFloat(s),n===!0||h.isNumeric(i)?i||0:s):s}}),h.each(["height","width"],function(e,t){h.cssHooks[t]={get:function(e,n,r){if(n)return qt.test(h.css(e,"display"))&&e.offsetWidth===0?h.swap(e,zt,function(){return Qt(e,t,r)}):Qt(e,t,r)},set:function(e,n,r){var i=r&&Pt(e);return Jt(e,n,r?Kt(e,t,r,l.boxSizing&&h.css(e,"boxSizing",!1,i)==="border-box",i):0)}}}),l.opacity||(h.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=h.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if((t>=1||t==="")&&h.trim(s.replace(Ft,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(t===""||r&&!r.filter)return}n.filter=Ft.test(s)?s.replace(Ft,i):s+" "+i}}),h.cssHooks.marginRight=jt(l.reliableMarginRight,function(e,t){if(t)return h.swap(e,{display:"inline-block"},Ht,[e,"marginRight"])}),h.each({margin:"",padding:"",border:"Width"},function(e,t){h.cssHooks[e+t]={expand:function(n){var r=0,i={},s=typeof n=="string"?n.split(" "):[n];for(;r<4;r++)i[e+X[r]+t]=s[r]||s[r-2]||s[0];return i}},_t.test(e)||(h.cssHooks[e+t].set=Jt)}),h.fn.extend({css:function(e,t){return $(this,function(e,t,n){var r,i,s={},o=0;if(h.isArray(t)){r=Pt(e),i=t.length;for(;o<i;o++)s[t[o]]=h.css(e,t[o],!1,r);return s}return n!==undefined?h.style(e,t,n):h.css(e,t)},e,t,arguments.length>1)},show:function(){return $t(this,!0)},hide:function(){return $t(this)},toggle:function(e){return typeof e=="boolean"?e?this.show():this.hide():this.each(function(){V(this)?h(this).show():h(this).hide()})}}),h.Tween=Gt,Gt.prototype={constructor:Gt,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(h.cssNumber[n]?"":"px")},cur:function(){var e=Gt.propHooks[this.prop];return e&&e.get?e.get(this):Gt.propHooks._default.get(this)},run:function(e){var t,n=Gt.propHooks[this.prop];return this.options.duration?this.pos=t=h.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),n&&n.set?n.set(this):Gt.propHooks._default.set(this),this}},Gt.prototype.init.prototype=Gt.prototype,Gt.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=h.css(e.elem,e.prop,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){h.fx.step[e.prop]?h.fx.step[e.prop](e):e.elem.style&&(e.elem.style[h.cssProps[e.prop]]!=null||h.cssHooks[e.prop])?h.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Gt.propHooks.scrollTop=Gt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},h.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},h.fx=Gt.prototype.init,h.fx.step={};var Yt,Zt,en=/^(?:toggle|show|hide)$/,tn=new RegExp("^(?:([+-])=|)("+W+")([a-z%]*)$","i"),nn=/queueHooks$/,rn=[fn],sn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=tn.exec(t),s=i&&i[3]||(h.cssNumber[e]?"":"px"),o=(h.cssNumber[e]||s!=="px"&&+r)&&tn.exec(h.css(n.elem,e)),u=1,a=20;if(o&&o[3]!==s){s=s||o[3],i=i||[],o=+r||1;do u=u||".5",o/=u,h.style(n.elem,e,o+s);while(u!==(u=n.cur()/r)&&u!==1&&--a)}return i&&(o=n.start=+o||+r||0,n.unit=s,n.end=i[1]?o+(i[1]+1)*i[2]:+i[2]),n}]};h.Animation=h.extend(cn,{tweener:function(e,t){h.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],sn[n]=sn[n]||[],sn[n].unshift(t)},prefilter:function(e,t){t?rn.unshift(e):rn.push(e)}}),h.speed=function(e,t,n){var r=e&&typeof e=="object"?h.extend({},e):{complete:n||!n&&t||h.isFunction(e)&&e,duration:e,easing:n&&t||t&&!h.isFunction(t)&&t};r.duration=h.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in h.fx.speeds?h.fx.speeds[r.duration]:h.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){h.isFunction(r.old)&&r.old.call(this),r.queue&&h.dequeue(this,r.queue)},r},h.fn.extend({fadeTo:function(e,t,n,r){return this.filter(V).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=h.isEmptyObject(e),s=h.speed(t,n,r),o=function(){var t=cn(this,h.extend({},e),s);(i||h._data(this,"finish"))&&t.stop(!0)};return o.finish=o,i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return typeof e!="string"&&(n=t,t=e,e=undefined),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=e!=null&&e+"queueHooks",s=h.timers,o=h._data(this);if(i)o[i]&&o[i].stop&&r(o[i]);else for(i in o)o[i]&&o[i].stop&&nn.test(i)&&r(o[i]);for(i=s.length;i--;)s[i].elem===this&&(e==null||s[i].queue===e)&&(s[i].anim.stop(n),t=!1,s.splice(i,1));(t||!n)&&h.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=h._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],s=h.timers,o=r?r.length:0;n.finish=!0,h.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0);for(t=s.length;t--;)s[t].elem===this&&s[t].queue===e&&(s[t].anim.stop(!0),s.splice(t,1));for(t=0;t<o;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),h.each(["toggle","show","hide"],function(e,t){var n=h.fn[t];h.fn[t]=function(e,r,i){return e==null||typeof e=="boolean"?n.apply(this,arguments):this.animate(un(t,!0),e,r,i)}}),h.each({slideDown:un("show"),slideUp:un("hide"),slideToggle:un("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){h.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),h.timers=[],h.fx.tick=function(){var e,t=h.timers,n=0;Yt=h.now();for(;n<t.length;n++)e=t[n],!e()&&t[n]===e&&t.splice(n--,1);t.length||h.fx.stop(),Yt=undefined},h.fx.timer=function(e){h.timers.push(e),e()?h.fx.start():h.timers.pop()},h.fx.interval=13,h.fx.start=function(){Zt||(Zt=setInterval(h.fx.tick,h.fx.interval))},h.fx.stop=function(){clearInterval(Zt),Zt=null},h.fx.speeds={slow:600,fast:200,_default:400},h.fn.delay=function(e,t){return e=h.fx?h.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},function(){var e,t,n,r,i;t=T.createElement("div"),t.setAttribute("className","t"),t.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",r=t.getElementsByTagName("a")[0],n=T.createElement("select"),i=n.appendChild(T.createElement("option")),e=t.getElementsByTagName("input")[0],r.style.cssText="top:1px",l.getSetAttribute=t.className!=="t",l.style=/top/.test(r.getAttribute("style")),l.hrefNormalized=r.getAttribute("href")==="/a",l.checkOn=!!e.value,l.optSelected=i.selected,l.enctype=!!T.createElement("form").enctype,n.disabled=!0,l.optDisabled=!i.disabled,e=T.createElement("input"),e.setAttribute("value",""),l.input=e.getAttribute("value")==="",e.value="t",e.setAttribute("type","radio"),l.radioValue=e.value==="t"}();var hn=/\r/g;h.fn.extend({val:function(e){var t,n,r,i=this[0];if(!arguments.length){if(i)return t=h.valHooks[i.type]||h.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,typeof n=="string"?n.replace(hn,""):n==null?"":n);return}return r=h.isFunction(e),this.each(function(n){var i;if(this.nodeType!==1)return;r?i=e.call(this,n,h(this).val()):i=e,i==null?i="":typeof i=="number"?i+="":h.isArray(i)&&(i=h.map(i,function(e){return e==null?"":e+""})),t=h.valHooks[this.type]||h.valHooks[this.nodeName.toLowerCase()];if(!t||!("set"in t)||t.set(this,i,"value")===undefined)this.value=i})}}),h.extend({valHooks:{option:{get:function(e){var t=h.find.attr(e,"value");return t!=null?t:h.trim(h.text(e))}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(l.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!h.nodeName(n.parentNode,"optgroup"))){t=h(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n,r,i=e.options,s=h.makeArray(t),o=i.length;while(o--){r=i[o];if(h.inArray(h.valHooks.option.get(r),s)>=0)try{r.selected=n=!0}catch(u){r.scrollHeight}else r.selected=!1}return n||(e.selectedIndex=-1),i}}}}),h.each(["radio","checkbox"],function(){h.valHooks[this]={set:function(e,t){if(h.isArray(t))return e.checked=h.inArray(h(e).val(),t)>=0}},l.checkOn||(h.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value})});var pn,dn,vn=h.expr.attrHandle,mn=/^(?:checked|selected)$/i,gn=l.getSetAttribute,yn=l.input;h.fn.extend({attr:function(e,t){return $(this,h.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){h.removeAttr(this,e)})}}),h.extend({attr:function(e,t,n){var r,i,s=e.nodeType;if(!e||s===3||s===8||s===2)return;if(typeof e.getAttribute===B)return h.prop(e,t,n);if(s!==1||!h.isXMLDoc(e))t=t.toLowerCase(),r=h.attrHooks[t]||(h.expr.match.bool.test(t)?dn:pn);if(n===undefined)return r&&"get"in r&&(i=r.get(e,t))!==null?i:(i=h.find.attr(e,t),i==null?undefined:i);if(n!==null)return r&&"set"in r&&(i=r.set(e,n,t))!==undefined?i:(e.setAttribute(t,n+""),n);h.removeAttr(e,t)},removeAttr:function(e,t){var n,r,i=0,s=t&&t.match(O);if(s&&e.nodeType===1)while(n=s[i++])r=h.propFix[n]||n,h.expr.match.bool.test(n)?yn&&gn||!mn.test(n)?e[r]=!1:e[h.camelCase("default-"+n)]=e[r]=!1:h.attr(e,n,""),e.removeAttribute(gn?n:r)},attrHooks:{type:{set:function(e,t){if(!l.radioValue&&t==="radio"&&h.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}}}),dn={set:function(e,t,n){return t===!1?h.removeAttr(e,n):yn&&gn||!mn.test(n)?e.setAttribute(!gn&&h.propFix[n]||n,n):e[h.camelCase("default-"+n)]=e[n]=!0,n}},h.each(h.expr.match.bool.source.match(/\w+/g),function(e,t){var n=vn[t]||h.find.attr;vn[t]=yn&&gn||!mn.test(t)?function(e,t,r){var i,s;return r||(s=vn[t],vn[t]=i,i=n(e,t,r)!=null?t.toLowerCase():null,vn[t]=s),i}:function(e,t,n){if(!n)return e[h.camelCase("default-"+t)]?t.toLowerCase():null}});if(!yn||!gn)h.attrHooks.value={set:function(e,t,n){if(!h.nodeName(e,"input"))return pn&&pn.set(e,t,n);e.defaultValue=t}};gn||(pn={set:function(e,t,n){var r=e.getAttributeNode(n);r||e.setAttributeNode(r=e.ownerDocument.createAttribute(n)),r.value=t+="";if(n==="value"||t===e.getAttribute(n))return t}},vn.id=vn.name=vn.coords=function(e,t,n){var r;if(!n)return(r=e.getAttributeNode(t))&&r.value!==""?r.value:null},h.valHooks.button={get:function(e,t){var n=e.getAttributeNode(t);if(n&&n.specified)return n.value},set:pn.set},h.attrHooks.contenteditable={set:function(e,t,n){pn.set(e,t===""?!1:t,n)}},h.each(["width","height"],function(e,t){h.attrHooks[t]={set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}}})),l.style||(h.attrHooks.style={get:function(e){return e.style.cssText||undefined},set:function(e,t){return e.style.cssText=t+""}});var bn=/^(?:input|select|textarea|button|object)$/i,wn=/^(?:a|area)$/i;h.fn.extend({prop:function(e,t){return $(this,h.prop,e,t,arguments.length>1)},removeProp:function(e){return e=h.propFix[e]||e,this.each(function(){try{this[e]=undefined,delete this[e]}catch(t){}})}}),h.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,s,o=e.nodeType;if(!e||o===3||o===8||o===2)return;return s=o!==1||!h.isXMLDoc(e),s&&(t=h.propFix[t]||t,i=h.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&(r=i.get(e,t))!==null?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=h.find.attr(e,"tabindex");return t?parseInt(t,10):bn.test(e.nodeName)||wn.test(e.nodeName)&&e.href?0:-1}}}}),l.hrefNormalized||h.each(["href","src"],function(e,t){h.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),l.optSelected||(h.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),h.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){h.propFix[this.toLowerCase()]=this}),l.enctype||(h.propFix.enctype="encoding");var En=/[\t\r\n\f]/g;h.fn.extend({addClass:function(e){var t,n,r,i,s,o,u=0,a=this.length,f=typeof e=="string"&&e;if(h.isFunction(e))return this.each(function(t){h(this).addClass(e.call(this,t,this.className))});if(f){t=(e||"").match(O)||[];for(;u<a;u++){n=this[u],r=n.nodeType===1&&(n.className?(" "+n.className+" ").replace(En," "):" ");if(r){s=0;while(i=t[s++])r.indexOf(" "+i+" ")<0&&(r+=i+" ");o=h.trim(r),n.className!==o&&(n.className=o)}}}return this},removeClass:function(e){var t,n,r,i,s,o,u=0,a=this.length,f=arguments.length===0||typeof e=="string"&&e;if(h.isFunction(e))return this.each(function(t){h(this).removeClass(e.call(this,t,this.className))});if(f){t=(e||"").match(O)||[];for(;u<a;u++){n=this[u],r=n.nodeType===1&&(n.className?(" "+n.className+" ").replace(En," "):"");if(r){s=0;while(i=t[s++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");o=e?h.trim(r):"",n.className!==o&&(n.className=o)}}}return this},toggleClass:function(e,t){var n=typeof e;return typeof t=="boolean"&&n==="string"?t?this.addClass(e):this.removeClass(e):h.isFunction(e)?this.each(function(n){h(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var t,r=0,i=h(this),s=e.match(O)||[];while(t=s[r++])i.hasClass(t)?i.removeClass(t):i.addClass(t)}else if(n===B||n==="boolean")this.className&&h._data(this,"__className__",this.className),this.className=this.className||e===!1?"":h._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(En," ").indexOf(t)>=0)return!0;return!1}}),h.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){h.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),h.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)}});var Sn=h.now(),xn=/\?/,Tn=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;h.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,r=null,i=h.trim(t+"");return i&&!h.trim(i.replace(Tn,function(e,t,i,s){return n&&t&&(r=0),r===0?e:(n=i||t,r+=!s-!i,"")}))?Function("return "+i)():h.error("Invalid JSON: "+t)},h.parseXML=function(t){var n,r;if(!t||typeof t!="string")return null;try{e.DOMParser?(r=new DOMParser,n=r.parseFromString(t,"text/xml")):(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t))}catch(i){n=undefined}return(!n||!n.documentElement||n.getElementsByTagName("parsererror").length)&&h.error("Invalid XML: "+t),n};var Nn,Cn,kn=/#.*$/,Ln=/([?&])_=[^&]*/,An=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,On=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mn=/^(?:GET|HEAD)$/,_n=/^\/\//,Dn=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Pn={},Hn={},Bn="*/".concat("*");try{Cn=location.href}catch(jn){Cn=T.createElement("a"),Cn.href="",Cn=Cn.href}Nn=Dn.exec(Cn.toLowerCase())||[],h.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Cn,type:"GET",isLocal:On.test(Nn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Bn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":h.parseJSON,"text xml":h.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?qn(qn(e,h.ajaxSettings),t):qn(h.ajaxSettings,e)},ajaxPrefilter:Fn(Pn),ajaxTransport:Fn(Hn),ajax:function(e,t){function x(e,t,n,r){var f,g,y,w,S,x=t;if(b===2)return;b=2,o&&clearTimeout(o),a=undefined,s=r||"",E.readyState=e>0?4:0,f=e>=200&&e<300||e===304,n&&(w=Rn(l,E,n)),w=Un(l,w,E,f);if(f)l.ifModified&&(S=E.getResponseHeader("Last-Modified"),S&&(h.lastModified[i]=S),S=E.getResponseHeader("etag"),S&&(h.etag[i]=S)),e===204||l.type==="HEAD"?x="nocontent":e===304?x="notmodified":(x=w.state,g=w.data,y=w.error,f=!y);else{y=x;if(e||!x)x="error",e<0&&(e=0)}E.status=e,E.statusText=(t||x)+"",f?d.resolveWith(c,[g,x,E]):d.rejectWith(c,[E,x,y]),E.statusCode(m),m=undefined,u&&p.trigger(f?"ajaxSuccess":"ajaxError",[E,l,f?g:y]),v.fireWith(c,[E,x]),u&&(p.trigger("ajaxComplete",[E,l]),--h.active||h.event.trigger("ajaxStop"))}typeof e=="object"&&(t=e,e=undefined),t=t||{};var n,r,i,s,o,u,a,f,l=h.ajaxSetup({},t),c=l.context||l,p=l.context&&(c.nodeType||c.jquery)?h(c):h.event,d=h.Deferred(),v=h.Callbacks("once memory"),m=l.statusCode||{},g={},y={},b=0,w="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(b===2){if(!f){f={};while(t=An.exec(s))f[t[1].toLowerCase()]=t[2]}t=f[e.toLowerCase()]}return t==null?null:t},getAllResponseHeaders:function(){return b===2?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=y[n]=y[n]||e,g[e]=t),this},overrideMimeType:function(e){return b||(l.mimeType=e),this},statusCode:function(e){var t;if(e)if(b<2)for(t in e)m[t]=[m[t],e[t]];else E.always(e[E.status]);return this},abort:function(e){var t=e||w;return a&&a.abort(t),x(0,t),this}};d.promise(E).complete=v.add,E.success=E.done,E.error=E.fail,l.url=((e||l.url||Cn)+"").replace(kn,"").replace(_n,Nn[1]+"//"),l.type=t.method||t.type||l.method||l.type,l.dataTypes=h.trim(l.dataType||"*").toLowerCase().match(O)||[""],l.crossDomain==null&&(n=Dn.exec(l.url.toLowerCase()),l.crossDomain=!(!n||n[1]===Nn[1]&&n[2]===Nn[2]&&(n[3]||(n[1]==="http:"?"80":"443"))===(Nn[3]||(Nn[1]==="http:"?"80":"443")))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=h.param(l.data,l.traditional)),In(Pn,l,t,E);if(b===2)return E;u=h.event&&l.global,u&&h.active++===0&&h.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!Mn.test(l.type),i=l.url,l.hasContent||(l.data&&(i=l.url+=(xn.test(i)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=Ln.test(i)?i.replace(Ln,"$1_="+Sn++):i+(xn.test(i)?"&":"?")+"_="+Sn++)),l.ifModified&&(h.lastModified[i]&&E.setRequestHeader("If-Modified-Since",h.lastModified[i]),h.etag[i]&&E.setRequestHeader("If-None-Match",h.etag[i])),(l.data&&l.hasContent&&l.contentType!==!1||t.contentType)&&E.setRequestHeader("Content-Type",l.contentType),E.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+Bn+"; q=0.01":""):l.accepts["*"]);for(r in l.headers)E.setRequestHeader(r,l.headers[r]);if(!l.beforeSend||l.beforeSend.call(c,E,l)!==!1&&b!==2){w="abort";for(r in{success:1,error:1,complete:1})E[r](l[r]);a=In(Hn,l,t,E);if(!a)x(-1,"No Transport");else{E.readyState=1,u&&p.trigger("ajaxSend",[E,l]),l.async&&l.timeout>0&&(o=setTimeout(function(){E.abort("timeout")},l.timeout));try{b=1,a.send(g,x)}catch(S){if(!(b<2))throw S;x(-1,S)}}return E}return E.abort()},getJSON:function(e,t,n){return h.get(e,t,n,"json")},getScript:function(e,t){return h.get(e,undefined,t,"script")}}),h.each(["get","post"],function(e,t){h[t]=function(e,n,r,i){return h.isFunction(n)&&(i=i||r,r=n,n=undefined),h.ajax({url:e,type:t,dataType:i,data:n,success:r})}}),h._evalUrl=function(e){return h.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},h.fn.extend({wrapAll:function(e){if(h.isFunction(e))return this.each(function(t){h(this).wrapAll(e.call(this,t))});if(this[0]){var t=h(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return h.isFunction(e)?this.each(function(t){h(this).wrapInner(e.call(this,t))}):this.each(function(){var t=h(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=h.isFunction(e);return this.each(function(n){h(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){h.nodeName(this,"body")||h(this).replaceWith(this.childNodes)}).end()}}),h.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||!l.reliableHiddenOffsets()&&(e.style&&e.style.display||h.css(e,"display"))==="none"},h.expr.filters.visible=function(e){return!h.expr.filters.hidden(e)};var zn=/%20/g,Wn=/\[\]$/,Xn=/\r?\n/g,Vn=/^(?:submit|button|image|reset|file)$/i,$n=/^(?:input|select|textarea|keygen)/i;h.param=function(e,t){var n,r=[],i=function(e,t){t=h.isFunction(t)?t():t==null?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};t===undefined&&(t=h.ajaxSettings&&h.ajaxSettings.traditional);if(h.isArray(e)||e.jquery&&!h.isPlainObject(e))h.each(e,function(){i(this.name,this.value)});else for(n in e)Jn(n,e[n],t,i);return r.join("&").replace(zn,"+")},h.fn.extend({serialize:function(){return h.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=h.prop(this,"elements");return e?h.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!h(this).is(":disabled")&&$n.test(this.nodeName)&&!Vn.test(e)&&(this.checked||!J.test(e))}).map(function(e,t){var n=h(this).val();return n==null?null:h.isArray(n)?h.map(n,function(e){return{name:t.name,value:e.replace(Xn,"\r\n")}}):{name:t.name,value:n.replace(Xn,"\r\n")}}).get()}}),h.ajaxSettings.xhr=e.ActiveXObject!==undefined?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Yn()||Zn()}:Yn;var Kn=0,Qn={},Gn=h.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var e in Qn)Qn[e](undefined,!0)}),l.cors=!!Gn&&"withCredentials"in Gn,Gn=l.ajax=!!Gn,Gn&&h.ajaxTransport(function(e){if(!e.crossDomain||l.cors){var t;return{send:function(n,r){var i,s=e.xhr(),o=++Kn;s.open(e.type,e.url,e.async,e.username,e.password);if(e.xhrFields)for(i in e.xhrFields)s[i]=e.xhrFields[i];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),!e.crossDomain&&!n["X-Requested-With"]&&(n["X-Requested-With"]="XMLHttpRequest");for(i in n)n[i]!==undefined&&s.setRequestHeader(i,n[i]+"");s.send(e.hasContent&&e.data||null),t=function(n,i){var u,a,f;if(t&&(i||s.readyState===4)){delete Qn[o],t=undefined,s.onreadystatechange=h.noop;if(i)s.readyState!==4&&s.abort();else{f={},u=s.status,typeof s.responseText=="string"&&(f.text=s.responseText);try{a=s.statusText}catch(l){a=""}!u&&e.isLocal&&!e.crossDomain?u=f.text?200:404:u===1223&&(u=204)}}f&&r(u,a,f,s.getAllResponseHeaders())},e.async?s.readyState===4?setTimeout(t):s.onreadystatechange=Qn[o]=t:t()},abort:function(){t&&t(undefined,!0)}}}}),h.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return h.globalEval(e),e}}}),h.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),h.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=T.head||h("head")[0]||T.documentElement;return{send:function(r,i){t=T.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){if(n||!t.readyState||/loaded|complete/.test(t.readyState))t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||i(200,"success")},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(undefined,!0)}}}});var er=[],tr=/(=)\?(?=&|$)|\?\?/;h.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=er.pop()||h.expando+"_"+Sn++;return this[e]=!0,e}}),h.ajaxPrefilter("json jsonp",function(t,n,r){var i,s,o,u=t.jsonp!==!1&&(tr.test(t.url)?"url":typeof t.data=="string"&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&tr.test(t.data)&&"data");if(u||t.dataTypes[0]==="jsonp")return i=t.jsonpCallback=h.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,u?t[u]=t[u].replace(tr,"$1"+i):t.jsonp!==!1&&(t.url+=(xn.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return o||h.error(i+" was not called"),o[0]},t.dataTypes[0]="json",s=e[i],e[i]=function(){o=arguments},r.always(function(){e[i]=s,t[i]&&(t.jsonpCallback=n.jsonpCallback,er.push(i)),o&&h.isFunction(s)&&s(o[0]),o=s=undefined}),"script"}),h.parseHTML=function(e,t,n){if(!e||typeof e!="string")return null;typeof t=="boolean"&&(n=t,t=!1),t=t||T;var r=w.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=h.buildFragment([e],t,i),i&&i.length&&h(i).remove(),h.merge([],r.childNodes))};var nr=h.fn.load;h.fn.load=function(e,t,n){if(typeof e!="string"&&nr)return nr.apply(this,arguments);var r,i,s,o=this,u=e.indexOf(" ");return u>=0&&(r=h.trim(e.slice(u,e.length)),e=e.slice(0,u)),h.isFunction(t)?(n=t,t=undefined):t&&typeof t=="object"&&(s="POST"),o.length>0&&h.ajax({url:e,type:s,dataType:"html",data:t}).done(function(e){i=arguments,o.html(r?h("<div>").append(h.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){o.each(n,i||[e.responseText,t,e])}),this},h.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){h.fn[t]=function(e){return this.on(t,e)}}),h.expr.filters.animated=function(e){return h.grep(h.timers,function(t){return e===t.elem}).length};var rr=e.document.documentElement;h.offset={setOffset:function(e,t,n){var r,i,s,o,u,a,f,l=h.css(e,"position"),c=h(e),p={};l==="static"&&(e.style.position="relative"),u=c.offset(),s=h.css(e,"top"),a=h.css(e,"left"),f=(l==="absolute"||l==="fixed")&&h.inArray("auto",[s,a])>-1,f?(r=c.position(),o=r.top,i=r.left):(o=parseFloat(s)||0,i=parseFloat(a)||0),h.isFunction(t)&&(t=t.call(e,n,u)),t.top!=null&&(p.top=t.top-u.top+o),t.left!=null&&(p.left=t.left-u.left+i),"using"in t?t.using.call(e,p):c.css(p)}},h.fn.extend({offset:function(e){if(arguments.length)return e===undefined?this:this.each(function(t){h.offset.setOffset(this,e,t)});var t,n,r={top:0,left:0},i=this[0],s=i&&i.ownerDocument;if(!s)return;return t=s.documentElement,h.contains(t,i)?(typeof i.getBoundingClientRect!==B&&(r=i.getBoundingClientRect()),n=ir(s),{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):r},position:function(){if(!this[0])return;var e,t,n={top:0,left:0},r=this[0];return h.css(r,"position")==="fixed"?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),h.nodeName(e[0],"html")||(n=e.offset()),n.top+=h.css(e[0],"borderTopWidth",!0),n.left+=h.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-h.css(r,"marginTop",!0),left:t.left-n.left-h.css(r,"marginLeft",!0)}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||rr;while(e&&!h.nodeName(e,"html")&&h.css(e,"position")==="static")e=e.offsetParent;return e||rr})}}),h.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n=/Y/.test(t);h.fn[e]=function(r){return $(this,function(e,r,i){var s=ir(e);if(i===undefined)return s?t in s?s[t]:s.document.documentElement[r]:e[r];s?s.scrollTo(n?h(s).scrollLeft():i,n?i:h(s).scrollTop()):e[r]=i},e,r,arguments.length,null)}}),h.each(["top","left"],function(e,t){h.cssHooks[t]=jt(l.pixelPosition,function(e,n){if(n)return n=Ht(e,t),Dt.test(n)?h(e).position()[t]+"px":n})}),h.each({Height:"height",Width:"width"},function(e,t){h.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){h.fn[r]=function(r,i){var s=arguments.length&&(n||typeof r!="boolean"),o=n||(r===!0||i===!0?"margin":"border");return $(this,function(t,n,r){var i;return h.isWindow(t)?t.document.documentElement["client"+e]:t.nodeType===9?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):r===undefined?h.css(t,n,o):h.style(t,n,r,o)},t,s?r:undefined,s,null)}})}),h.fn.size=function(){return this.length},h.fn.andSelf=h.fn.addBack,typeof define=="function"&&define.amd&&define("jquery",[],function(){return h});var sr=e.jQuery,or=e.$;return h.noConflict=function(t){return e.$===h&&(e.$=or),t&&e.jQuery===h&&(e.jQuery=sr),h},typeof t===B&&(e.jQuery=e.$=h),h}),function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.5.1";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r.push(t.call(n,e,i,s))}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&r.push(e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?void 0:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t==null?x.identity:t);return T(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};x.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(x.has(e,t)?e[t]:e[t]=[]).push(n)})},x.countBy=function(e,t,n){return L(e,t,n,function(e,t){x.has(e,t)||(e[t]=0),e[t]++})},x.sortedIndex=function(e,t,n,r){n=n==null?x.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return e==null?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,0,t):e[0]},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return t&&x.every(e,x.isArray)?a.apply(n,e):(T(e,function(e){x.isArray(e)||x.isArguments(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n)};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){if(t?!r||o[o.length-1]!==n:!x.contains(o,n))o.push(n),s.push(e[r])}),s},x.union=function(){return x.uniq(x.flatten(arguments,!0))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=x.max(x.pluck(arguments,"length").concat(0)),t=new Array(e);for(var n=0;n<e;n++)t[n]=x.pluck(arguments,""+n);return t},x.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};x.bind=function(e,t){var n,r;if(S&&e.bind===S)return S.apply(e,u.call(arguments,1));if(!x.isFunction(e))throw new TypeError;return n=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=e.prototype;var i=new O;O.prototype=null;var s=e.apply(i,n.concat(u.call(arguments)));return Object(s)===s?s:i}return e.apply(t,n.concat(u.call(arguments)))}},x.partial=function(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);if(t.length===0)throw new Error("bindAll must be passed function names");return T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t,n){var r,i,s,o=null,u=0;n||(n={});var a=function(){u=n.leading===!1?0:new Date,o=null,s=e.apply(r,i)};return function(){var f=new Date;!u&&n.leading===!1&&(u=f);var l=t-(f-u);return r=this,i=arguments,l<=0?(clearTimeout(o),o=null,u=f,s=e.apply(r,i)):!o&&n.trailing!==!1&&(o=setTimeout(a,l)),s}},x.debounce=function(e,t,n){var r,i=null;return function(){var s=this,o=arguments,u=function(){i=null,n||(r=e.apply(s,o))},a=n&&!i;return clearTimeout(i),i=setTimeout(u,t),a&&(r=e.apply(s,o)),r}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&t.push(n);return t},x.values=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push(e[n]);return t},x.pairs=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push([n,e[n]]);return t},x.invert=function(e){var t={};for(var n in e)x.has(e,n)&&(t[e[n]]=n);return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;var o=e.constructor,u=t.constructor;if(o!==u&&!(x.isFunction(o)&&o instanceof o&&x.isFunction(u)&&u instanceof u))return!1;n.push(e),r.push(t);var a=0,l=!0;if(i=="[object Array]"){a=e.length,l=a==t.length;if(l)while(a--)if(!(l=M(e[a],t[a],n,r)))break}else{for(var c in e)if(x.has(e,c)){a++;if(!(l=x.has(t,c)&&M(e[c],t[c],n,r)))break}if(l){for(c in t)if(x.has(t,c)&&!(a--))break;l=!a}}return n.pop(),r.pop(),l};x.isEqual=function(e,t){return M(e,t,[],[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType===1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),typeof /./!="function"&&(x.isFunction=function(e){return typeof e=="function"}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){var r=Array(Math.max(0,e));for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var _={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};_.unescape=x.invert(_.escape);var D={escape:new RegExp("["+x.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(_.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),x.result=function(e,t){if(e==null)return void 0;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(x,e))}})};var P=0;x.uniqueId=function(e){var t=++P+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n","	":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(j,function(e){return"\\"+B[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var F=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("underscore",function(e){return function(){var t,n;return t||e._}}(this)),define("text",["module"],function(e){var t,n,r,i,s,o=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],u=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,a=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,f=typeof location!="undefined"&&location.href,l=f&&location.protocol&&location.protocol.replace(/\:/,""),c=f&&location.hostname,h=f&&(location.port||undefined),p={},d=e.config&&e.config()||{};t={version:"2.0.13+",strip:function(e){if(e){e=e.replace(u,"");var t=e.match(a);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:d.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=o[t];try{e=new ActiveXObject(n)}catch(r){}if(e){o=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,s=e.lastIndexOf("."),o=e.indexOf("./")===0||e.indexOf("../")===0;return s!==-1&&(!o||s>1)?(t=e.substring(0,s),n=e.substring(s+1)):t=e,r=n||t,s=r.indexOf("!"),s!==-1&&(i=r.substring(s+1)==="strip",r=r.substring(0,s),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,d.isBuild&&(p[e]=r),i(r)},load:function(e,n,r,i){if(i&&i.isBuild&&!i.inlineText){r();return}d.isBuild=i&&i.isBuild;var s=t.parseName(e),o=s.moduleName+(s.ext?"."+s.ext:""),u=n.toUrl(o),a=d.useXhr||t.useXhr;if(u.indexOf("empty:")===0){r();return}!f||a(u,l,c,h)?t.get(u,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([o],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(p.hasOwnProperty(n)){var s=t.jsEscape(p[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.ext?"."+o.ext:"",a=o.moduleName+u,f=r.toUrl(o.moduleName+u)+".js";t.load(a,r,function(n){var r=function(e){return i(f,e)};r.asModule=function(e,t){return i.asModule(e,f,t)},t.write(e,a,r,s)},s)}};if(d.env==="node"||!d.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node&&!process.versions["node-webkit"]&&!process.versions["atom-shell"])n=require.nodeRequire("fs"),t.get=function(e,t,r){try{var i=n.readFileSync(e,"utf8");i[0]==="﻿"&&(i=i.substring(1)),t(i)}catch(s){r&&r(s)}};else if(d.env==="xhr"||!d.env&&t.createXhr())t.get=function(e,n,r,i){var s=t.createXhr(),o;s.open("GET",e,!0);if(i)for(o in i)i.hasOwnProperty(o)&&s.setRequestHeader(o.toLowerCase(),i[o]);d.onXhr&&d.onXhr(s,e),s.onreadystatechange=function(t){var i,o;s.readyState===4&&(i=s.status||0,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=s,r&&r(o)):n(s.responseText),d.onXhrComplete&&d.onXhrComplete(s,e))},s.send(null)};else if(d.env==="rhino"||!d.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),r!==null&&n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};else if(d.env==="xpconnect"||!d.env&&typeof Components!="undefined"&&Components.classes&&Components.interfaces)r=Components.classes,i=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),s="@mozilla.org/windows-registry-key;1"in r,t.get=function(e,t){var n,o,u,a={};s&&(e=e.replace(/\//g,"\\")),u=new FileUtils.File(e);try{n=r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream),n.init(u,1,0,!1),o=r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream),o.init(n,"utf-8",n.available(),i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),o.readString(n.available(),a),o.close(),n.close(),t(a.value)}catch(f){throw new Error((u&&u.path||"")+": "+f)}};return t}),define("pinyin-by-unicode",{strChineseFirstPY:"[encoded data, 20902 characters]"}),require.config({shim:{underscore:{exports:"_"},backbone:{deps:["underscore","jquery"],exports:"Backbone"}},paths:{jquery:"lib/jquery","jquery.ui.core":"lib/jquery.ui.core","jquery.ui.widget":"lib/jquery.ui.widget.1.11.1","jquery.ui.progressbar":"lib/jquery.ui.progressbar","jquery.ui.tabs":"lib/jquery.ui.tabs",tmpl:"lib/tmpl.min","jquery.iframe-transport":"lib/jquery.iframe-transport.1.4","jquery.fileupload":"lib/jquery.fileupload.5.42.1","jquery.fileupload-process":"lib/jquery.fileupload.file-processing.1.3.0","jquery.fileupload-validate":"lib/jquery.fileupload.validation.1.1.2","jquery.fileupload-ui":"lib/jquery.fileupload.ui.9.6.0","jquery.magnific-popup":"lib/jquery.magnific-popup",simplemodal:"lib/jquery.simplemodal",jstree:"lib/jstree.1.0",select2:"lib/select2-3.5.2",underscore:"lib/underscore",backbone:"lib/backbone",text:"lib/text"}}),define("common",["jquery","underscore","text","pinyin-by-unicode"],function(e,t,n,r){return{INFO_TIMEOUT:1e4,SUCCESS_TIMEOUT:3e3,ERROR_TIMEOUT:3e3,strChineseFirstPY:r.strChineseFirstPY,getUrl:function(e){var t=app.config.siteRoot;switch(e.name){case"list_lib_dir":return t+"ajax/lib/"+e.repo_id+"/dir/";case"star_file":return t+"ajax/repo/"+e.repo_id+"/file/star/";case"unstar_file":return t+"ajax/repo/"+e.repo_id+"/file/unstar/";case"del_dir":return t+"ajax/repo/"+e.repo_id+"/dir/delete/";case"del_file":return t+"ajax/repo/"+e.repo_id+"/file/delete/";case"rename_dir":return t+"ajax/repo/"+e.repo_id+"/dir/rename/";case"rename_file":return t+"ajax/repo/"+e.repo_id+"/file/rename/";case"mv_dir":return t+"ajax/repo/"+e.repo_id+"/dir/mv/";case"cp_dir":return t+"ajax/repo/"+e.repo_id+"/dir/cp/";case"mv_file":return t+"ajax/repo/"+e.repo_id+"/file/mv/";case"cp_file":return t+"ajax/repo/"+e.repo_id+"/file/cp/";case"lock_or_unlock_file":return t+"api2/repos/"+e.repo_id+"/file/";case"new_dir":return t+"ajax/repo/"+e.repo_id+"/dir/new/";case"new_file":return t+"ajax/repo/"+e.repo_id+"/file/new/";case"del_dirents":return t+"ajax/repo/"+e.repo_id+"/dirents/delete/";case"mv_dirents":return t+"ajax/repo/"+e.repo_id+"/dirents/move/";case"cp_dirents":return t+"ajax/repo/"+e.repo_id+"/dirents/copy/";case"get_file_op_url":return t+"ajax/repo/"+e.repo_id+"/file_op_url/";case"get_file_uploaded_bytes":return t+"ajax/repo/"+e.repo_id+"/get-file-uploaded-bytes/";case"get_dirents":return t+"ajax/repo/"+e.repo_id+"/dirents/";case"repo_del":return t+"ajax/repo/"+e.repo_id+"/remove/";case"sub_repo":return t+"ajax/repo/"+e.repo_id+"/dir/sub_repo/";case"thumbnail_create":return t+"thumbnail/"+e.repo_id+"/create/";case"get_my_unenc_repos":return t+"ajax/my-unenc-repos/";case"unenc_rw_repos":return t+"ajax/unenc-rw-repos/";case"get_cp_progress":return t+"ajax/cp_progress/";case"cancel_cp":return t+"ajax/cancel_cp/";case"ajax_repo_remove_share":return t+"share/ajax/repo_remove_share/";case"get_user_contacts":return t+"ajax/contacts/";case"get_shared_download_link":return t+"share/ajax/get-download-link/";case"delete_shared_download_link":return t+"share/ajax/link/remove/";case"send_shared_download_link":return t+"share/link/send/";case"send_shared_upload_link":return t+"share/upload_link/send/";case"delete_shared_upload_link":return t+"share/ajax/upload_link/remove/";case"get_share_upload_link":return t+"share/ajax/get-upload-link/";case"get_popup_notices":return t+"ajax/get_popup_notices/";case"set_notices_seen":return t+"ajax/set_notices_seen/";case"get_unseen_notices_num":return t+"ajax/unseen-notices-count/";case"set_notice_seen_by_id":return t+"ajax/set_notice_seen_by_id/";case"repo_set_password":return t+"repo/set_password/";case"group_repos":return t+"api2/groups/"+e.group_id+"/repos/";case"group_basic_info":return t+"ajax/group/"+e.group_id+"/basic-info/";case"toggle_group_modules":return t+"ajax/group/"+e.group_id+"/toggle-modules/";case"toggle_personal_modules":return t+"ajax/toggle-personal-modules/";case"ajax_unset_inner_pub_repo":return t+"ajax/unset-inner-pub-repo/"+e.repo_id+"/";case"get_folder_perm_by_path":return t+"ajax/repo/"+e.repo_id+"/get-folder-perm-by-path/";case"set_user_folder_perm":return t+"ajax/repo/"+e.repo_id+"/set-user-folder-perm/";case"set_group_folder_perm":return t+"ajax/repo/"+e.repo_id+"/set-group-folder-perm/";case"get_history_changes":return t+"ajax/repo/"+e.repo_id+"/history/changes/";case"starred_files":return t+"api2/starredfiles/";case"shared_repos":return t+"api2/shared-repos/"+e.repo_id+"/";case"search_user":return t+"api2/search-user/";case"dir_shared_items":return t+"api2/repos/"+e.repo_id+"/dir/shared_items/";case"events":return t+"api2/events/"}},showConfirm:function(t,n,r){var i=e("#confirm-popup"),s=e("#confirm-con"),o=e("#confirm-yes");s.html("<h3>"+t+"</h3><p>"+n+"</p>"),i.modal({appendTo:"#main"}),e("#simplemodal-container").css({height:"auto"}),o.click(r)},closeModal:function(){e.modal.close()},feedback:function(t,n,r){var r=r||5e3;if(e(".messages").length>0)e(".messages").html('<li class="'+n+'">'+t+"</li>");else{var i='<ul class="messages"><li class="'+n+'">'+t+"</li></ul>";e("#main").append(i)}e(".messages").css({left:(e(window).width()-e(".messages").width())/2,top:10}).removeClass("hide"),setTimeout(function(){e(".messages").addClass("hide")},r)},showFormError:function(t,n){e("#"+t+" .error").html(n).removeClass("hide"),e("#simplemodal-container").css({height:"auto"})},ajaxErrorHandler:function(t,n,r){if(t.responseText){var i=e.parseJSON(t.responseText);this.feedback(i.error||i.error_msg,"error")}else this.feedback(gettext("Failed. Please check the network."),"error")},enableButton:function(e){e.removeAttr("disabled").removeClass("btn-disabled")},disableButton:function(e){e.attr("disabled","disabled").addClass("btn-disabled")},setCaretPos:function(e,t){var n;return document.selection?(n=e.createTextRange(),n.move("character",t),n.select()):e.setSelectionRange(t,t)},prepareApiCsrf:function(){Backbone._sync=Backbone.sync,Backbone.sync=function(e,t,n){if(e=="create"||e=="update"||e=="delete"){var r=app.pageOptions.csrfToken;n.beforeSend=function(e){e.setRequestHeader("X-CSRFToken",r)}}return Backbone._sync(e,t,n)}},prepareCSRFToken:function(e,t){function n(e){var t=null;if(document.cookie&&document.cookie!=""){var n=document.cookie.split(";");for(var r=0;r<n.length;r++){var i=jQuery.trim(n[r]);if(i.substring(0,e.length+1)==e+"="){t=decodeURIComponent(i.substring(e.length+1));break}}}return t}!/^http:.*/.test(t.url)&&!/^https:.*/.test(t.url)&&e.setRequestHeader("X-CSRFToken",n("csrftoken"))},ajaxPost:function(t){var n=this,r=t.form,i=t.form_id,s=t.post_url,o=t.post_data,u=t.after_op_success,a,f=r.children('[type="submit"]');this.disableButton(f),t.after_op_error?a=t.after_op_error:a=function(t,r,s){var o;t.responseText?o=e.parseJSON(t.responseText).error:o=gettext("Failed. Please check the network."),n.showFormError(i,o),n.enableButton(f)},e.ajax({url:s,type:"POST",dataType:"json",beforeSend:this.prepareCSRFToken,data:o,success:u,error:a})},ajaxGet:function(t){var n=this,r=t.get_url,i=t.data,s=t.after_op_success,o;t.after_op_error?o=t.after_op_error:o=function(e,t,n){},e.ajax({url:r,cache:!1,dataType:"json",data:i,success:s,error:o})},HTMLescape:function(e){return document.createElement("div").appendChild(document.createTextNode(e)).parentNode.innerHTML},pathJoin:function(e){var t=e[0];for(var n=1;n<e.length;n++)t[t.length-1]=="/"||e[n][0]=="/"?t+=e[n]:t+="/"+e[n];return t},encodePath:function(e){var t=e.split("/"),n=[];for(var r=0,i=t.length;r<i;r++)n.push(encodeURIComponent(t[r]));return n.join("/")},closePopup:function(e,t,n){var r=e.target||event.srcElement;!t.hasClass("hide")&&!t.is(r)&&!t.find("*").is(r)&&!n.is(r)&&!n.find("*").is(r)&&t.addClass("hide")},initAccountPopup:function(){e("#my-info").click(function(){var t=e("#user-info-popup");t.toggleClass("hide");if(!t.hasClass("hide")){var n=e(".loading-tip",t),r=e("#space-traffic");n.show(),r.addClass("hide"),e(".error",t).addClass("hide"),e.ajax({url:r.data("url"),dataType:"json",cache:!1,success:function(e){n.hide(),r.html(e.html).removeClass("hide")},error:function(r,i,s){if(r.responseText){var o=e.parseJSON(r.responseText).error;n.hide(),e(".error",t).length==0?n.after('<p class="error alc">'+o+"</p>"):e(".error",t).removeClass("hide")}}})}});var t=this;e(document).click(function(n){t.closePopup(n,e("#user-info-popup"),e("#my-info"))})},initNoticePopup:function(){var t=this,n=e("#msg-count");if(n.length==0)return!1;var r=document.title;n.data("orig_doc_title",r);var i=function(){e.ajax({url:t.getUrl({name:"get_unseen_notices_num"}),dataType:"json",cache:!1,success:function(t){var i=t.count,s=e(".num",n);s.html(i),i>0?(s.removeClass("hide"),document.title="("+i+")"+r):(s.addClass("hide"),document.title=r)}})};i(),setInterval(i,3e4),e("#notice-icon").click(function(){var n=e("#notice-popup");n.toggleClass("hide");if(!n.hasClass("hide")){e(".con",n).css({"max-height":e(window).height()-e("#header").outerHeight()-e(".hd",n).outerHeight()-3});var r=e(".loading-tip",n),i=e("#notice-list");i.addClass("hide"),r.show(),e(".error",n).addClass("hide"),e.ajax({url:t.getUrl({name:"get_popup_notices"}),dataType:"json",success:function(n){r.hide(),i.html(n.notice_html).removeClass("hide"),e(".unread a",i).click(function(){var n=e(this).parents(".unread").data("id"),r=e(this).attr("href");return e.ajax({url:t.getUrl({name:"set_notice_seen_by_id"})+"?notice_id="+encodeURIComponent(n),type:"POST",dataType:"json",beforeSend:t.prepareCSRFToken,success:function(e){location.href=r},error:function(){location.href=r}}),!1}),e(".detail",i).click(function(){location.href=e(".brief a",e(this).parent()).attr("href")})},error:function(t,i,s){if(t.responseText){var o=e.parseJSON(t.responseText).error;r.hide(),e(".error",n).length==0?r.after('<p class="error alc">'+o+"</p>"):e(".error",n).removeClass("hide")}}})}}),e(window).resize(function(){var t=e("#notice-popup");t.hasClass("hide")||e(".con",t).css({"max-height":e(window).height()-e("#header").outerHeight()-e(".hd",t).outerHeight()-3})}),e("#notice-popup .close").click(function(){e("#notice-popup").addClass("hide"),e("#notice-list .unread").length>0&&e.ajax({url:t.getUrl({name:"set_notices_seen"}),type:"POST",dataType:"json",beforeSend:t.prepareCSRFToken,success:function(){e(".num",n).html(0).addClass("hide"),document.title=r}})}),e(document).click(function(n){t.closePopup(n,e("#notice-popup"),e("#notice-icon"))})},closeTopNoticeBar:function(){if(!app.pageOptions.cur_note)return!1;var t=app.pageOptions.cur_note.id;e("#info-bar").addClass("hide");if(navigator.cookieEnabled){var n=new Date,r=document.cookie.split("; "),i=!1;n.setTime(n.getTime()+12096e5),t+="; expires="+n.toGMTString()+"; path="+app.config.siteRoot;for(var s=0,o=r.length;s<o;s++)if(r[s].split("=")[0]=="info_id"){i=!0,document.cookie="info_id="+r[s].split("=")[1]+t;break}i||(document.cookie="info_id="+t)}},contactInputOptionsForSelect2:function(){var e=this;return{placeholder:gettext("Search users or enter emails"),tags:[],tokenSeparators:[","," "],minimumInputLength:1,formatInputTooShort:gettext("Please enter 1 or more character"),formatNoMatches:gettext("No matches"),formatSearching:gettext("Searching..."),formatAjaxError:gettext("Loading failed"),ajax:{url:e.getUrl({name:"search_user"}),dataType:"json",delay:250,cache:!0,data:function(e){return{q:e}},results:function(e){var t=[],n=e.users;for(var r=0,i=n.length;r<i;r++)t.push({id:n[r].email,text:n[r].name+" "+n[r].email,avatar:n[r].avatar,name:n[r].name});return{results:t}}},formatResult:function(t){if(t.avatar)return t.avatar+'<span class="text ellipsis">'+e.HTMLescape(t.name)+"<br />"+e.HTMLescape(t.id)+"</span>";return},formatSelection:function(t){return e.HTMLescape(t.name||t.id)},escapeMarkup:function(e){return e}}},imageCheck:function(e){if(e.lastIndexOf(".")==-1)return!1;var t=e.substr(e.lastIndexOf(".")+1).toLowerCase(),n=["gif","jpeg","jpg","png","ico","bmp"];return n.indexOf(t)!=-1?!0:!1},compareTwoWord:function(e,t){var n,r,i=e.charCodeAt(0),s=t.charCodeAt(0),o=this.strChineseFirstPY;if(19968<i&&i<40869&&19968<s&&s<40869)n=o.charAt(i-19968).toLowerCase(),r=o.charAt(s-19968).toLowerCase();else{if(19968<i&&i<40869&&!(19968<s&&s<40869))return 1;if(!(19968<i&&i<40869)&&19968<s&&s<40869)return-1;n=e.toLowerCase(),r=t.toLowerCase()}return n>=r?1:-1},fileSizeFormat:function(e,t){var n=1024,r=n*1024,i=r*1024,s=i*1024,t=t||0;return e>=0&&e<n?e+" B":e>=n&&e<r?(e/n).toFixed(t)+" KB":e>=r&&e<i?(e/r).toFixed(t)+" MB":e>=i&&e<s?(e/i).toFixed(t)+" GB":e>=s?(e/s).toFixed(t)+" TB":e+" B"}}}),function(e,t){if(typeof define=="function"&&define.amd)define("backbone",["underscore","jquery","exports"],function(n,r,i){e.Backbone=t(e,i,n,r)});else if(typeof exports!="undefined"){var n=require("underscore");t(e,exports,n)}else e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}(this,function(e,t,n,r){var i=e.Backbone,s=[],o=s.push,u=s.slice,a=s.splice;t.VERSION="1.1.2",t.$=r,t.noConflict=function(){return e.Backbone=i,this},t.emulateHTTP=!1,t.emulateJSON=!1;var f=t.Events={on:function(e,t,n){if(!c(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,r){if(!c(this,"once",e,[t,r])||!t)return this;var i=this,s=n.once(function(){i.off(e,s),t.apply(this,arguments)});return s._callback=t,this.on(e,s,r)},off:function(e,t,r){var i,s,o,u,a,f,l,h;if(!this._events||!c(this,"off",e,[t,r]))return this;if(!e&&!t&&!r)return this._events=void 0,this;u=e?[e]:n.keys(this._events);for(a=0,f=u.length;a<f;a++){e=u[a];if(o=this._events[e]){this._events[e]=i=[];if(t||r)for(l=0,h=o.length;l<h;l++)s=o[l],(t&&t!==s.callback&&t!==s.callback._callback||r&&r!==s.context)&&i.push(s);i.length||delete this._events[e]}}return this},trigger:function(e){if(!this._events)return this;var t=u.call(arguments,1);if(!c(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&h(n,t),r&&h(r,arguments),this},stopListening:function(e,t,r){var i=this._listeningTo;if(!i)return this;var s=!t&&!r;!r&&typeof t=="object"&&(r=this),e&&((i={})[e._listenId]=e);for(var o in i)e=i[o],e.off(t,r,this),(s||n.isEmpty(e._events))&&delete this._listeningTo[o];return this}},l=/\s+/,c=function(e,t,n,r){if(!n)return!0;if(typeof n=="object"){for(var i in n)e[t].apply(e,[i,n[i]].concat(r));return!1}if(l.test(n)){var s=n.split(l);for(var o=0,u=s.length;o<u;o++)e[t].apply(e,[s[o]].concat(r));return!1}return!0},h=function(e,t){var n,r=-1,i=e.length,s=t[0],o=t[1],u=t[2];switch(t.length){case 0:while(++r<i)(n=e[r]).callback.call(n.ctx);return;case 1:while(++r<i)(n=e[r]).callback.call(n.ctx,s);return;case 2:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o);return;case 3:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o,u);return;default:while(++r<i)(n=e[r]).callback.apply(n.ctx,t);return}},p={listenTo:"on",listenToOnce:"once"};n.each(p,function(e,t){f[t]=function(t,r,i){var s=this._listeningTo||(this._listeningTo={}),o=t._listenId||(t._listenId=n.uniqueId("l"));return s[o]=t,!i&&typeof r=="object"&&(i=this),t[e](r,i,this),this}}),f.bind=f.on,f.unbind=f.off,n.extend(t,f);var d=t.Model=function(e,t){var r=e||{};t||(t={}),this.cid=n.uniqueId("c"),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(r=this.parse(r,t)||{}),r=n.defaults({},r,n.result(this,"defaults")),this.set(r,t),this.changed={},this.initialize.apply(this,arguments)};n.extend(d.prototype,f,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return n.clone(this.attributes)},sync:function(){return t.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return n.escape(this.get(e))},has:function(e){return this.get(e)!=null},set:function(e,t,r){var i,s,o,u,a,f,l,c;if(e==null)return this;typeof e=="object"?(s=e,r=t):(s={})[e]=t,r||(r={});if(!this._validate(s,r))return!1;o=r.unset,a=r.silent,u=[],f=this._changing,this._changing=!0,f||(this._previousAttributes=n.clone(this.attributes),this.changed={}),c=this.attributes,l=this._previousAttributes,this.idAttribute in s&&(this.id=s[this.idAttribute]);for(i in s)t=s[i],n.isEqual(c[i],t)||u.push(i),n.isEqual(l[i],t)?delete this.changed[i]:this.changed[i]=t,o?delete c[i]:c[i]=t;if(!a){u.length&&(this._pending=r);for(var h=0,p=u.length;h<p;h++)this.trigger("change:"+u[h],this,c[u[h]],r)}if(f)return this;if(!a)while(this._pending)r=this._pending,this._pending=!1,this.trigger("change",this,r);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,n.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var r in this.attributes)t[r]=void 0;return this.set(t,n.extend({},e,{unset:!0}))},hasChanged:function(e){return e==null?!n.isEmpty(this.changed):n.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?n.clone(this.changed):!1;var t,r=!1,i=this._changing?this._previousAttributes:this.attributes;for(var s in e){if(n.isEqual(i[s],t=e[s]))continue;(r||(r={}))[s]=t}return r},previous:function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},previousAttributes:function(){return n.clone(this._previousAttributes)},fetch:function(e){e=e?n.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=this,r=e.success;return e.success=function(n){if(!t.set(t.parse(n,e),e))return!1;r&&r(t,n,e),t.trigger("sync",t,n,e)},I(this,e),this.sync("read",this,e)},save:function(e,t,r){var i,s,o,u=this.attributes;e==null||typeof e=="object"?(i=e,r=t):(i={})[e]=t,r=n.extend({validate:!0},r);if(i&&!r.wait){if(!this.set(i,r))return!1}else if(!this._validate(i,r))return!1;i&&r.wait&&(this.attributes=n.extend({},u,i)),r.parse===void 0&&(r.parse=!0);var a=this,f=r.success;return r.success=function(e){a.attributes=u;var t=a.parse(e,r);r.wait&&(t=n.extend(i||{},t));if(n.isObject(t)&&!a.set(t,r))return!1;f&&f(a,e,r),a.trigger("sync",a,e,r)},I(this,r),s=this.isNew()?"create":r.patch?"patch":"update",s==="patch"&&(r.attrs=i),o=this.sync(s,this,r),i&&r.wait&&(this.attributes=u),o},destroy:function(e){e=e?n.clone(e):{};var t=this,r=e.success,i=function(){t.trigger("destroy",t,t.collection,e)};e.success=function(n){(e.wait||t.isNew())&&i(),r&&r(t,n,e),t.isNew()||t.trigger("sync",t,n,e)};if(this.isNew())return e.success(),!1;I(this,e);var s=this.sync("delete",this,e);return e.wait||i(),s},url:function(){var e=n.result(this,"urlRoot")||n.result(this.collection,"url")||F();return this.isNew()?e:e.replace(/([^\/])$/,"$1/")+encodeURIComponent(this.id)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(e){return this._validate({},n.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=n.extend({},this.attributes,e);var r=this.validationError=this.validate(e,t)||null;return r?(this.trigger("invalid",this,r,n.extend(t,{validationError:r})),!1):!0}});var v=["keys","values","pairs","invert","pick","omit"];n.each(v,function(e){d.prototype[e]=function(){var t=u.call(arguments);return t.unshift(this.attributes),n[e].apply(n,t)}});var m=t.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),t.comparator!==void 0&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,n.extend({silent:!0},t))},g={add:!0,remove:!0,merge:!0},y={add:!0,remove:!1};n.extend(m.prototype,f,{model:d,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return t.sync.apply(this,arguments)},add:function(e,t){return this.set(e,n.extend({merge:!1},t,y))},remove:function(e,t){var r=!n.isArray(e);e=r?[e]:n.clone(e),t||(t={});var i,s,o,u;for(i=0,s=e.length;i<s;i++){u=e[i]=this.get(e[i]);if(!u)continue;delete this._byId[u.id],delete this._byId[u.cid],o=this.indexOf(u),this.models.splice(o,1),this.length--,t.silent||(t.index=o,u.trigger("remove",u,this,t)),this._removeReference(u,t)}return r?e[0]:e},set:function(e,t){t=n.defaults({},t,g),t.parse&&(e=this.parse(e,t));var r=!n.isArray(e);e=r?e?[e]:[]:n.clone(e);var i,s,o,u,a,f,l,c=t.at,h=this.model,p=this.comparator&&c==null&&t.sort!==!1,v=n.isString(this.comparator)?this.comparator:null,m=[],y=[],b={},w=t.add,E=t.merge,S=t.remove,x=!p&&w&&S?[]:!1;for(i=0,s=e.length;i<s;i++){a=e[i]||{},a instanceof d?o=u=a:o=a[h.prototype.idAttribute||"id"];if(f=this.get(o))S&&(b[f.cid]=!0),E&&(a=a===u?u.attributes:a,t.parse&&(a=f.parse(a,t)),f.set(a,t),p&&!l&&f.hasChanged(v)&&(l=!0)),e[i]=f;else if(w){u=e[i]=this._prepareModel(a,t);if(!u)continue;m.push(u),this._addReference(u,t)}u=f||u,x&&(u.isNew()||!b[u.id])&&x.push(u),b[u.id]=!0}if(S){for(i=0,s=this.length;i<s;++i)b[(u=this.models[i]).cid]||y.push(u);y.length&&this.remove(y,t)}if(m.length||x&&x.length){p&&(l=!0),this.length+=m.length;if(c!=null)for(i=0,s=m.length;i<s;i++)this.models.splice(c+i,0,m[i]);else{x&&(this.models.length=0);var T=x||m;for(i=0,s=T.length;i<s;i++)this.models.push(T[i])}}l&&this.sort({silent:!0});if(!t.silent){for(i=0,s=m.length;i<s;i++)(u=m[i]).trigger("add",u,this,t);(l||x&&x.length)&&this.trigger("sort",this,t)}return r?e[0]:e},reset:function(e,t){t||(t={});for(var r=0,i=this.models.length;r<i;r++)this._removeReference(this.models[r],t);return t.previousModels=this.models,this._reset(),e=this.add(e,n.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,n.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return this.add(e,n.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(){return u.apply(this.models,arguments)},get:function(e){return e==null?void 0:this._byId[e]||this._byId[e.id]||this._byId[e.cid]},at:function(e){return this.models[e]},where:function(e,t){return n.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),n.isString(this.comparator)||this.comparator.length===1?this.models=this.sortBy(this.comparator,this):this.models.sort(n.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return n.invoke(this.models,"get",e)},fetch:function(e){e=e?n.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=e.success,r=this;return e.success=function(n){var i=e.reset?"reset":"set";r[i](n,e),t&&t(r,n,e),r.trigger("sync",r,n,e)},I(this,e),this.sync("read",this,e)},create:function(e,t){t=t?n.clone(t):{};if(!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var r=this,i=t.success;return t.success=function(e,n){t.wait&&r.add(e,t),i&&i(e,n,t)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof d)return e;t=t?n.clone(t):{},t.collection=this;var r=new this.model(e,t);return r.validationError?(this.trigger("invalid",this,r.validationError,t),!1):r},_addReference:function(e,t){this._byId[e.cid]=e,e.id!=null&&(this._byId[e.id]=e),e.collection||(e.collection=this),e.on("all",this._onModelEvent,this)},_removeReference:function(e,t){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if((e==="add"||e==="remove")&&n!==this)return;e==="destroy"&&this.remove(t,r),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],t.id!=null&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments)}});var b=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain","sample"];n.each(b,function(e){m.prototype[e]=function(){var t=u.call(arguments);return t.unshift(this.models),n[e].apply(n,t)}});var w=["groupBy","countBy","sortBy","indexBy"];n.each(w,function(e){m.prototype[e]=function(t,r){var i=n.isFunction(t)?t:function(e){return e.get(t)};return n[e](this.models,i,r)}});var E=t.View=function(e){this.cid=n.uniqueId("view"),e||(e={}),n.extend(this,n.pick(e,x)),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},S=/^(\S+)\s*(.*)$/,x=["model","collection","el","id","attributes","className","tagName","events"];n.extend(E.prototype,f,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,n){return this.$el&&this.undelegateEvents(),this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0],n!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=n.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var r=e[t];n.isFunction(r)||(r=this[e[t]]);if(!r)continue;var i=t.match(S),s=i[1],o=i[2];r=n.bind(r,this),s+=".delegateEvents"+this.cid,o===""?this.$el.on(s,r):this.$el.on(s,o,r)}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_ensureElement:function(){if(!this.el){var e=n.extend({},n.result(this,"attributes"));this.id&&(e.id=n.result(this,"id")),this.className&&(e["class"]=n.result(this,"className"));var r=t.$("<"+n.result(this,"tagName")+">").attr(e);this.setElement(r,!1)}else this.setElement(n.result(this,"el"),!1)}}),t.sync=function(e,r,i){var s=N[e];n.defaults(i||(i={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var o={type:s,dataType:"json"};i.url||(o.url=n.result(r,"url")||F()),i.data==null&&r&&(e==="create"||e==="update"||e==="patch")&&(o.contentType="application/json",o.data=JSON.stringify(i.attrs||r.toJSON(i))),i.emulateJSON&&(o.contentType="application/x-www-form-urlencoded",o.data=o.data?{model:o.data}:{});if(i.emulateHTTP&&(s==="PUT"||s==="DELETE"||s==="PATCH")){o.type="POST",i.emulateJSON&&(o.data._method=s);var u=i.beforeSend;i.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",s);if(u)return u.apply(this,arguments)}}o.type!=="GET"&&!i.emulateJSON&&(o.processData=!1),o.type==="PATCH"&&T&&(o.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var a=i.xhr=t.ajax(n.extend(o,i));return r.trigger("request",r,a,i),a};var T=typeof window!="undefined"&&!!window.ActiveXObject&&(!window.XMLHttpRequest||!(new XMLHttpRequest).dispatchEvent),N={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var C=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},k=/\((.*?)\)/g,L=/(\(\?)?:\w+/g,A=/\*\w+/g,O=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(C.prototype,f,{initialize:function(){},route:function(e,r,i){n.isRegExp(e)||(e=this._routeToRegExp(e)),n.isFunction(r)&&(i=r,r=""),i||(i=this[r]);var s=this;return t.history.route(e,function(n){var o=s._extractParameters(e,n);s.execute(i,o),s.trigger.apply(s,["route:"+r].concat(o)),s.trigger("route",r,o),t.history.trigger("route",s,r,o)}),this},execute:function(e,t){e&&e.apply(this,t)},navigate:function(e,n){return t.history.navigate(e,n),this},_bindRoutes:function(){if(!this.routes)return;this.routes=n.result(this,"routes");var e,t=n.keys(this.routes);while((e=t.pop())!=null)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(O,"\\$&").replace(k,"(?:$1)?").replace(L,function(e,t){return t?e:"([^/?]+)"}).replace(A,"([^?]*?)"),new RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(e,t){var r=e.exec(t).slice(1);return n.map(r,function(e,t){return t===r.length-1?e||null:e?decodeURIComponent(e):null})}});var M=t.History=function(){this.handlers=[],n.bindAll(this,"checkUrl"),typeof window!="undefined"&&(this.location=window.location,this.history=window.history)},_=/^[#\/]|\s+$/g,D=/^\/+|\/+$/g,P=/msie [\w.]+/,H=/\/$/,B=/#.*$/;M.started=!1,n.extend(M.prototype,f,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(e==null)if(this._hasPushState||!this._wantsHashChange||t){e=decodeURI(this.location.pathname+this.location.search);var n=this.root.replace(H,"");e.indexOf(n)||(e=e.slice(n.length))}else e=this.getHash();return e.replace(_,"")},start:function(e){if(M.started)throw new Error("Backbone.history has already been started");M.started=!0,this.options=n.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var r=this.getFragment(),i=document.documentMode,s=P.exec(navigator.userAgent.toLowerCase())&&(!i||i<=7);this.root=("/"+this.root+"/").replace(D,"/");if(s&&this._wantsHashChange){var o=t.$('<iframe src="javascript:0" tabindex="-1">');this.iframe=o.hide().appendTo("body")[0].contentWindow,this.navigate(r)}this._hasPushState?t.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!s?t.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=r;var u=this.location;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot())return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+"#"+this.fragment),!0;this._hasPushState&&this.atRoot()&&u.hash&&(this.fragment=this.getHash().replace(_,""),this.history.replaceState({},document.title,this.root+this.fragment))}if(!this.options.silent)return this.loadUrl()},stop:function(){t.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),M.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t===this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe)));if(t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()},loadUrl:function(e){return e=this.fragment=this.getFragment(e),n.any(this.handlers,function(t){if(t.route.test(e))return t.callback(e),!0})},navigate:function(e,t){if(!M.started)return!1;if(!t||t===!0)t={trigger:!!t};var n=this.root+(e=this.getFragment(e||""));e=e.replace(B,"");if(this.fragment===e)return;this.fragment=e,e===""&&n!=="/"&&(n=n.slice(0,-1));if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}if(t.trigger)return this.loadUrl(e)},_updateHash:function(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),t.history=new M;var j=function(e,t){var r=this,i;e&&n.has(e,"constructor")?i=e.constructor:i=function(){return r.apply(this,arguments)},n.extend(i,r,t);var s=function(){this.constructor=i};return s.prototype=r.prototype,i.prototype=new s,e&&n.extend(i.prototype,e),i.__super__=r.prototype,i};d.extend=m.extend=C.extend=E.extend=M.extend=j;var F=function(){throw new Error('A "url" property or function must be specified')},I=function(e,t){var n=t.error;t.error=function(r){n&&n(e,r,t),e.trigger("error",e,r,t)}};return t}),define("app/models/repo",["underscore","backbone"],function(e,t){var n=t.Model.extend({defaults:{id:null,name:"",desc:"",mtime:0,mtime_relative:"",encrypted:!1,owner:"-",owner_nickname:"-"},parse:function(t){var n=e.clone(t);return n.id=t.id||t.repo_id,n.name=t.name||t.repo_name,n.desc=t.desc||t.repo_desc,n.size_formatted=t.size_formatted||t.repo_size_formatted,n},validate:function(e,t){if(!e.name)return gettext("Name is required");if(e.encrypted){if(!e.passwd1)return gettext("Please enter password");if(!e.passwd2)return gettext("Please enter the password again");if(e.passwd1.length<app.pageOptions.repo_password_min_length)return gettext("Password is too short");if(e.passwd1!=e.passwd2)return gettext("Passwords don't match")}}});return n}),define("app/collections/repos",["underscore","backbone","app/models/repo"],function(e,t,n){var r=t.Collection.extend({model:n,url:app.pageOptions.reposUrl,type:"mine",initialize:function(e){e&&(this.type=e.type?e.type:"mine")},fetch:function(n){return n=n?e.clone(n):{},n.url=this.url+"?type="+this.type,t.Collection.prototype.fetch.call(this,n)},create:function(n,r){return r=r?e.clone(r):{},r.url=this.url+"?from=web",t.Collection.prototype.create.call(this,n,r)}});return r}),function(e){typeof define=="function"&&define.amd?define("jquery.ui.tabs",["jquery"],e):e(jQuery)}(function(e){function t(t,r){var i,s,o,u=t.nodeName.toLowerCase();return"area"===u?(i=t.parentNode,s=i.name,!t.href||!s||i.nodeName.toLowerCase()!=="map"?!1:(o=e("img[usemap='#"+s+"']")[0],!!o&&n(o))):(/^(input|select|textarea|button|object)$/.test(u)?!t.disabled:"a"===u?t.href||r:r)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return e.css(this,"visibility")==="hidden"}).length}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var n=this.css("position"),r=n==="absolute",i=t?/(auto|scroll|hidden)/:/(auto|scroll)/,s=this.parents().filter(function(){var t=e(this);return r&&t.css("position")==="static"?!1:i.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return n==="fixed"||!s.length?e(this[0].ownerDocument||document):s},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(n){return t(n,!isNaN(e.attr(n,"tabindex")))},tabbable:function(n){var r=e.attr(n,"tabindex"),i=isNaN(r);return(i||r>=0)&&t(n,!i)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,n){function o(t,n,i,s){return e.each(r,function(){n-=parseFloat(e.css(t,"padding"+this))||0,i&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var r=n==="Width"?["Left","Right"]:["Top","Bottom"],i=n.toLowerCase(),s={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(t){return t===undefined?s["inner"+n].call(this):this.each(function(){e(this).css(i,o(this,t)+"px")})},e.fn["outer"+n]=function(t,r){return typeof t!="number"?s["outer"+n].call(this,t):this.each(function(){e(this).css(i,o(this,t,!0,r)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(n){return arguments.length?t.call(this,e.camelCase(n)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(n,r){return typeof n=="number"?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),r&&r.call(t)},n)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(t!==undefined)return this.css("zIndex",t);if(this.length){var n=e(this[0]),r,i;while(n.length&&n[0]!==document){r=n.css("position");if(r==="absolute"||r==="relative"||r==="fixed"){i=parseInt(n.css("zIndex"),10);if(!isNaN(i)&&i!==0)return i}n=n.parent()}}return 0}}),e.ui.plugin={add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n,r){var i,s=e.plugins[t];if(!s)return;if(!r&&(!e.element[0].parentNode||e.element[0].parentNode.nodeType===11))return;for(i=0;i<s.length;i++)e.options[s[i][0]]&&s[i][1].apply(e.element,n)}};var r=0,i=Array.prototype.slice;e.cleanData=function(t){return function(n){var r,i,s;for(s=0;(i=n[s])!=null;s++)try{r=e._data(i,"events"),r&&r.remove&&e(i).triggerHandler("remove")}catch(o){}t(n)}}(e.cleanData),e.widget=function(t,n,r){var i,s,o,u,a={},f=t.split(".")[0];return t=t.split(".")[1],i=f+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[f]=e[f]||{},s=e[f][t],o=e[f][t]=function(e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,s,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(r,function(t,r){if(!e.isFunction(r)){a[t]=r;return}a[t]=function(){var e=function(){return n.prototype[t].apply(this,arguments)},i=function(e){return n.prototype[t].apply(this,e)};return function(){var t=this._super,n=this._superApply,s;return this._super=e,this._superApply=i,s=r.apply(this,arguments),this._super=t,this._superApply=n,s}}()}),o.prototype=e.widget.extend(u,{widgetEventPrefix:s?u.widgetEventPrefix||t:t},a,{constructor:o,namespace:f,widgetName:t,widgetFullName:i}),s?(e.each(s._childConstructors,function(t,n){var r=n.prototype;e.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete s._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){var n=i.call(arguments,1),r=0,s=n.length,o,u;for(;r<s;r++)for(o in n[r])u=n[r][o],n[r].hasOwnProperty(o)&&u!==undefined&&(e.isPlainObject(u)?t[o]=e.isPlainObject(t[o])?e.widget.extend({},t[o],u):e.widget.extend({},u):t[o]=u);return t},e.widget.bridge=function(t,n){var r=n.prototype.widgetFullName||t;e.fn[t]=function(s){var o=typeof s=="string",u=i.call(arguments,1),a=this;return o?this.each(function(){var n,i=e.data(this,r);if(s==="instance")return a=i,!1;if(!i)return e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+s+"'");if(!e.isFunction(i[s])||s.charAt(0)==="_")return e.error("no such method '"+s+"' for "+t+" widget instance");n=i[s].apply(i,u);if(n!==i&&n!==undefined)return a=n&&n.jquery?a.pushStack(n.get()):n,!1}):(u.length&&(s=e.widget.extend.apply(null,[s].concat(u))),this.each(function(){var t=e.data(this,r);t?(t.option(s||{}),t._init&&t._init()):e.data(this,r,new n(s,this))})),a}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,n){n=e(n||this.defaultElement||this)[0],this.element=e(n),this.uuid=r++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),n!==this&&(e.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===n&&this.destroy()}}),this.document=e(n.style?n.ownerDocument:n.document||n),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,n){var r=t,i,s,o;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof t=="string"){r={},i=t.split("."),t=i.shift();if(i.length){s=r[t]=e.widget.extend({},this.options[t]);for(o=0;o<i.length-1;o++)s[i[o]]=s[i[o]]||{},s=s[i[o]];t=i.pop();if(arguments.length===1)return s[t]===undefined?null:s[t];s[t]=n}else{if(arguments.length===1)return this.options[t]===undefined?null:this.options[t];r[t]=n}}return this._setOptions(r),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,e==="disabled"&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,n,r){var i,s=this;typeof t!="boolean"&&(r=n,n=t,t=!1),r?(n=i=e(n),this.bindings=this.bindings.add(n)):(r=n,n=this.element,i=this.widget()),e.each(r,function(r,o){function u(){if(!t&&(s.options.disabled===!0||e(this).hasClass("ui-state-disabled")))return;return(typeof o=="string"?s[o]:o).apply(s,arguments)}typeof o!="string"&&(u.guid=o.guid=o.guid||u.guid||e.guid++);var a=r.match(/^([\w:-]*)\s*(.*)$/),f=a[1]+s.eventNamespace,l=a[2];l?i.delegate(l,f,u):n.bind(f,u)})},_off:function(t,n){n=(n||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(n).undelegate(n),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function n(){return(typeof e=="string"?r[e]:e).apply(r,arguments)}var r=this;return setTimeout(n,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,n,r){var i,s,o=this.options[t];r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent;if(s)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(r,i,s){typeof i=="string"&&(i={effect:i});var o,u=i?i===!0||typeof i=="number"?n:i.effect||n:t;i=i||{},typeof i=="number"&&(i={duration:i}),o=!e.isEmptyObject(i),i.complete=s,i.delay&&r.delay(i.delay),o&&e.effects&&e.effects.effect[u]?r[t](i):u!==t&&r[u]?r[u](i.duration,i.easing,s):r.queue(function(n){e(this)[t](),s&&s.call(r[0]),n()})}});var s=e.widget,o=e.widget("ui.tabs",{version:"1.11.3",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var n,r;t=t.cloneNode(!1),n=t.href.replace(e,""),r=location.href.replace(e,"");try{n=decodeURIComponent(n)}catch(i){}try{r=decodeURIComponent(r)}catch(i){}return t.hash.length>1&&n===r}}(),_create:function(){var t=this,n=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",n.collapsible),this._processTabs(),n.active=this._initialActive(),e.isArray(n.disabled)&&(n.disabled=e.unique(n.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.options.active!==!1&&this.anchors.length?this.active=this._findActive(n.active):this.active=e(),this._refresh(),this.active.length&&this.load(n.active)},_initialActive:function(){var t=this.options.active,n=this.options.collapsible,r=location.hash.substring(1);if(t===null){r&&this.tabs.each(function(n,i){if(e(i).attr("aria-controls")===r)return t=n,!1}),t===null&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active")));if(t===null||t===-1)t=this.tabs.length?0:!1}return t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),t===-1&&(t=n?!1:0)),!n&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var n=e(this.document[0].activeElement).closest("li"),r=this.tabs.index(n),i=!0;if(this._handlePageNav(t))return;switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:r++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:i=!1,r--;break;case e.ui.keyCode.END:r=this.anchors.length-1;break;case e.ui.keyCode.HOME:r=0;break;case e.ui.keyCode.SPACE:t.preventDefault(),clearTimeout(this.activating),this._activate(r);return;case e.ui.keyCode.ENTER:t.preventDefault(),clearTimeout(this.activating),this._activate(r===this.options.active?!1:r);return;default:return}t.preventDefault(),clearTimeout(this.activating),r=this._focusNextTab(r,i),!t.ctrlKey&&!t.metaKey&&(n.attr("aria-selected","false"),this.tabs.eq(r).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",r)},this.delay))},_panelKeydown:function(t){if(this._handlePageNav(t))return;t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){if(t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP)return this._activate(this._focusNextTab(this.options.active-1,!1)),!0;if(t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN)return this._activate(this._focusNextTab(this.options.active+1,!0)),!0},_findNextTab:function(t,n){function i(){return t>r&&(t=0),t<0&&(t=r),t}var r=this.tabs.length-1;while(e.inArray(i(),this.options.disabled)!==-1)t=n?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){if(e==="active"){this._activate(t);return}if(e==="disabled"){this._setupDisabled(t);return}this._super(e,t),e==="collapsible"&&(this.element.toggleClass("ui-tabs-collapsible",t),!t&&this.options.active===!1&&this._activate(0)),e==="event"&&this._setupEvents(t),e==="heightStyle"&&this._setupHeightStyle(t)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,n=this.tablist.children(":has(a[href])");t.disabled=e.map(n.filter(".ui-state-disabled"),function(e){return n.index(e)}),this._processTabs(),t.active===!1||!this.anchors.length?(t.active=!1,this.active=e()):this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,n=this.tabs,r=this.anchors,i=this.panels;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(n,r){var i,s,o,u=e(r).uniqueId().attr("id"),a=e(r).closest("li"),f=a.attr("aria-controls");t._isLocal(r)?(i=r.hash,o=i.substring(1),s=t.element.find(t._sanitizeSelector(i))):(o=a.attr("aria-controls")||e({}).uniqueId()[0].id,i="#"+o,s=t.element.find(i),s.length||(s=t._createPanel(o),s.insertAfter(t.panels[n-1]||t.tablist)),s.attr("aria-live","polite")),s.length&&(t.panels=t.panels.add(s)),f&&a.data("ui-tabs-aria-controls",f),a.attr({"aria-controls":o,"aria-labelledby":u}),s.attr("aria-labelledby",u)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),n&&(this._off(n.not(this.tabs)),this._off(r.not(this.anchors)),this._off(i.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var n=0,r;r=this.tabs[n];n++)t===!0||e.inArray(n,t)!==-1?e(r).addClass("ui-state-disabled").attr("aria-disabled","true"):e(r).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var n={};t&&e.each(t.split(" "),function(e,t){n[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,n),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var n,r=this.element.parent();t==="fill"?(n=r.height(),n-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),r=t.css("position");if(r==="absolute"||r==="fixed")return;n-=t.outerHeight(!0)}),this.element.children().not(this.panels).each(function(){n-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,n-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):t==="auto"&&(n=0,this.panels.each(function(){n=Math.max(n,e(this).height("").height())}).height(n))},_eventHandler:function(t){var n=this.options,r=this.active,i=e(t.currentTarget),s=i.closest("li"),o=s[0]===r[0],u=o&&n.collapsible,a=u?e():this._getPanelForTab(s),f=r.length?this._getPanelForTab(r):e(),l={oldTab:r,oldPanel:f,newTab:u?e():s,newPanel:a};t.preventDefault();if(s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||o&&!n.collapsible||this._trigger("beforeActivate",t,l)===!1)return;n.active=u?!1:this.tabs.index(s),this.active=o?e():s,this.xhr&&this.xhr.abort(),!f.length&&!a.length&&e.error("jQuery UI Tabs: Mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,l)},_toggle:function(t,n){function o(){r.running=!1,r._trigger("activate",t,n)}function u(){n.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),i.length&&r.options.show?r._show(i,r.options.show,o):(i.show(),o())}var r=this,i=n.newPanel,s=n.oldPanel;this.running=!0,s.length&&this.options.hide?this._hide(s,this.options.hide,function(){n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),u()}):(n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),s.hide(),u()),s.attr("aria-hidden","true"),n.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?n.oldTab.attr("tabIndex",-1):i.length&&this.tabs.filter(function(){return e(this).attr("tabIndex")===0}).attr("tabIndex",-1),i.attr("aria-hidden","false"),n.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var n,r=this._findActive(t);if(r[0]===this.active[0])return;r.length||(r=this.active),n=r.find(".ui-tabs-anchor")[0],this._eventHandler({target:n,currentTarget:n,preventDefault:e.noop})},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return typeof e=="string"&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),n=t.data("ui-tabs-aria-controls");n?t.attr("aria-controls",n).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),this.options.heightStyle!=="content"&&this.panels.css("height","")},enable:function(t){var n=this.options.disabled;if(n===!1)return;t===undefined?n=!1:(t=this._getIndex(t),e.isArray(n)?n=e.map(n,function(e){return e!==t?e:null}):n=e.map(this.tabs,function(e,n){return n!==t?n:null})),this._setupDisabled(n)},disable:function(t){var n=this.options.disabled;if(n===!0)return;if(t===undefined)n=!0;else{t=this._getIndex(t);if(e.inArray(t,n)!==-1)return;e.isArray(n)?n=e.merge([t],n).sort():n=[t]}this._setupDisabled(n)},load:function(t,n){t=this._getIndex(t);var r=this,i=this.tabs.eq(t),s=i.find(".ui-tabs-anchor"),o=this._getPanelForTab(i),u={tab:i,panel:o};if(this._isLocal(s[0]))return;this.xhr=e.ajax(this._ajaxSettings(s,n,u)),this.xhr&&this.xhr.statusText!=="canceled"&&(i.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){o.html(e),r._trigger("load",n,u)},1)}).complete(function(e,t){setTimeout(function(){t==="abort"&&r.panels.stop(!1,!0),i.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===r.xhr&&delete r.xhr},1)}))},_ajaxSettings:function(t,n,r){var i=this;return{url:t.attr("href"),beforeSend:function(t,s){return i._trigger("beforeLoad",n,e.extend({jqXHR:t,ajaxSettings:s},r))}}},_getPanelForTab:function(t){var n=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+n))}})}),function(e){typeof e.fn.each2=="undefined"&&e.extend(e.fn,{each2:function(t){var n=e([0]),r=-1,i=this.length;while(++r<i&&(n.context=n[0]=this[r])&&t.call(n[0],r,n)!==!1);return this}})}(jQuery),function(e,t){function p(t){var n=e(document.createTextNode(""));t.before(n),n.before(t),n.remove()}function d(e){function t(e){return h[e]||e}return e.replace(/[^\u0000-\u007E]/g,t)}function v(e,t){var n=0,r=t.length;for(;n<r;n+=1)if(g(e,t[n]))return n;return-1}function m(){var t=e(c);t.appendTo(document.body);var n={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight};return t.remove(),n}function g(e,n){return e===n?!0:e===t||n===t?!1:e===null||n===null?!1:e.constructor===String?e+""==n+"":n.constructor===String?n+""==e+"":!1}function y(e,t,n){var r,i,s;if(e===null||e.length<1)return[];r=e.split(t);for(i=0,s=r.length;i<s;i+=1)r[i]=n(r[i]);return r}function b(e){return e.outerWidth(!1)-e.width()}function w(n){var r="keyup-change-value";n.on("keydown",function(){e.data(n,r)===t&&e.data(n,r,n.val())}),n.on("keyup",function(){var i=e.data(n,r);i!==t&&n.val()!==i&&(e.removeData(n,r),n.trigger("keyup-change"))})}function E(n){n.on("mousemove",function(n){var r=u;(r===t||r.x!==n.pageX||r.y!==n.pageY)&&e(n.target).trigger("mousemove-filtered",n)})}function S(e,n,r){r=r||t;var i;return function(){var t=arguments;window.clearTimeout(i),i=window.setTimeout(function(){n.apply(r,t)},e)}}function x(e,t){var n=S(e,function(e){t.trigger("scroll-debounced",e)});t.on("scroll",function(e){v(e.target,t.get())>=0&&n(e)})}function T(e){if(e[0]===document.activeElement)return;window.setTimeout(function(){var t=e[0],n=e.val().length,r;e.focus();var i=t.offsetWidth>0||t.offsetHeight>0;i&&t===document.activeElement&&(t.setSelectionRange?t.setSelectionRange(n,n):t.createTextRange&&(r=t.createTextRange(),r.collapse(!1),r.select()))},0)}function N(t){t=e(t)[0];var n=0,r=0;if("selectionStart"in t)n=t.selectionStart,r=t.selectionEnd-n;else if("selection"in document){t.focus();var i=document.selection.createRange();r=document.selection.createRange().text.length,i.moveStart("character",-t.value.length),n=i.text.length-r}return{offset:n,length:r}}function C(e){e.preventDefault(),e.stopPropagation()}function k(e){e.preventDefault(),e.stopImmediatePropagation()}function L(t){if(!o){var n=t[0].currentStyle||window.getComputedStyle(t[0],null);o=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:n.fontSize,fontFamily:n.fontFamily,fontStyle:n.fontStyle,fontWeight:n.fontWeight,letterSpacing:n.letterSpacing,textTransform:n.textTransform,whiteSpace:"nowrap"}),o.attr("class","select2-sizer"),e(document.body).append(o)}return o.text(t.val()),o.width()}function A(t,n,r){var i,s=[],o;i=e.trim(t.attr("class")),i&&(i=""+i,e(i.split(/\s+/)).each2(function(){this.indexOf("select2-")===0&&s.push(this)})),i=e.trim(n.attr("class")),i&&(i=""+i,e(i.split(/\s+/)).each2(function(){this.indexOf("select2-")!==0&&(o=r(this),o&&s.push(o))})),t.attr("class",s.join(" "))}function O(e,t,n,r){var i=d(e.toUpperCase()).indexOf(d(t.toUpperCase())),s=t.length;if(i<0){n.push(r(e));return}n.push(r(e.substring(0,i))),n.push("<span class='select2-match'>"),n.push(r(e.substring(i,i+s))),n.push("</span>"),n.push(r(e.substring(i+s,e.length)))}function M(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function _(n){var r,i=null,s=n.quietMillis||100,o=n.url,u=this;return function(a){window.clearTimeout(r),r=window.setTimeout(function(){var r=n.data,s=o,f=n.transport||e.fn.select2.ajaxDefaults.transport,l={type:n.type||"GET",cache:n.cache||!1,jsonpCallback:n.jsonpCallback||t,dataType:n.dataType||"json"},c=e.extend({},e.fn.select2.ajaxDefaults.params,l);r=r?r.call(u,a.term,a.page,a.context):null,s=typeof s=="function"?s.call(u,a.term,a.page,a.context):s,i&&typeof i.abort=="function"&&i.abort(),n.params&&(e.isFunction(n.params)?e.extend(c,n.params.call(u)):e.extend(c,n.params)),e.extend(c,{url:s,dataType:n.dataType,data:r,success:function(e){var t=n.results(e,a.page,a);a.callback(t)},error:function(e,t,n){var r={hasError:!0,jqXHR:e,textStatus:t,errorThrown:n};a.callback(r)}}),i=f.call(u,c)},s)}}function D(t){var n=t,r,i,s=function(e){return""+e.text};e.isArray(n)&&(i=n,n={results:i}),e.isFunction(n)===!1&&(i=n,n=function(){return i});var o=n();return o.text&&(s=o.text,e.isFunction(s)||(r=o.text,s=function(e){return e[r]})),function(t){var r=t.term,i={results:[]},o;if(r===""){t.callback(n());return}o=function(n,i){var u,a;n=n[0];if(n.children){u={};for(a in n)n.hasOwnProperty(a)&&(u[a]=n[a]);u.children=[],e(n.children).each2(function(e,t){o(t,u.children)}),(u.children.length||t.matcher(r,s(u),n))&&i.push(u)}else t.matcher(r,s(n),n)&&i.push(n)},e(n().results).each2(function(e,t){o(t,i.results)}),t.callback(i)}}function P(n){var r=e.isFunction(n);return function(i){var s=i.term,o={results:[]},u=r?n(i):n;e.isArray(u)&&(e(u).each(function(){var e=this.text!==t,n=e?this.text:this;(s===""||i.matcher(s,n))&&o.results.push(e?this:{id:this,text:this})}),i.callback(o))}}function H(t,n){if(e.isFunction(t))return!0;if(!t)return!1;if(typeof t=="string")return!0;throw new Error(n+" must be a string, function, or falsy value")}function B(t,n){if(e.isFunction(t)){var r=Array.prototype.slice.call(arguments,2);return t.apply(n,r)}return t}function j(t){var n=0;return e.each(t,function(e,t){t.children?n+=j(t.children):n++}),n}function F(e,n,r,i){var s=e,o=!1,u,a,f,l,c;if(!i.createSearchChoice||!i.tokenSeparators||i.tokenSeparators.length<1)return t;for(;;){a=-1;for(f=0,l=i.tokenSeparators.length;f<l;f++){c=i.tokenSeparators[f],a=e.indexOf(c);if(a>=0)break}if(a<0)break;u=e.substring(0,a),e=e.substring(a+c.length);if(u.length>0){u=i.createSearchChoice.call(this,u,n);if(u!==t&&u!==null&&i.id(u)!==t&&i.id(u)!==null){o=!1;for(f=0,l=n.length;f<l;f++)if(g(i.id(u),i.id(n[f]))){o=!0;break}o||r(u)}}}if(s!==e)return e}function I(){var t=this;e.each(arguments,function(e,n){t[n].remove(),t[n]=null})}function q(t,n){var r=function(){};return r.prototype=new t,r.prototype.constructor=r,r.prototype.parent=t.prototype,r.prototype=e.extend(r.prototype,n),r}if(window.Select2!==t)return;var n,r,i,s,o,u={x:0,y:0},a,f,l={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){e=e.which?e.which:e;switch(e){case l.LEFT:case l.RIGHT:case l.UP:case l.DOWN:return!0}return!1},isControl:function(e){var t=e.which;switch(t){case l.SHIFT:case l.CTRL:case l.ALT:return!0}return e.metaKey?!0:!1},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&e<=123}},c="<div class='select2-measure-scrollbar'></div>",h={"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","Ｂ":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","Ｃ":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","Ｄ":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","Ǳ":"DZ","Ǆ":"DZ","ǲ":"Dz","ǅ":"Dz","Ⓔ":"E","Ｅ":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","Ｆ":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","Ｇ":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","Ｈ":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","Ｉ":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","Ｊ":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","Ｋ":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","Ｌ":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","Ǉ":"LJ","ǈ":"Lj","Ⓜ":"M","Ｍ":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","Ｎ":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","Ǌ":"NJ","ǋ":"Nj","Ⓞ":"O","Ｏ":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","Ｐ":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Ｑ":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","Ｒ":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","Ｓ":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","Ｔ":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","Ｕ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","Ｖ":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};a=e(document),s=function(){var e=1;return function(){return e++}}(),n=q(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(n){var r,i,o=".select2-results";this.opts=n=this.prepareOpts(n),this.id=n.id,n.element.data("select2")!==t&&n.element.data("select2")!==null&&n.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=e(".select2-hidden-accessible"),this.liveRegion.length==0&&(this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body)),this.containerId="s2id_"+(n.element.attr("id")||"autogen"+s()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",n.element.attr("title")),this.body=e(document.body),A(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",n.element.attr("style")),this.container.css(B(n.containerCss,this.opts.element)),this.container.addClass(B(n.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",C),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),A(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(B(n.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",C),this.results=r=this.container.find(o),this.search=i=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",C),E(this.results),this.dropdown.on("mousemove-filtered",o,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",o,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",o,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",o,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(e){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),x(80,this.results),this.dropdown.on("scroll-debounced",o,this.bind(this.loadMoreIfNeeded)),e(this.container).on("change",".select2-input",function(e){e.stopPropagation()}),e(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()}),e.fn.mousewheel&&r.mousewheel(function(e,t,n,i){var s=r.scrollTop();i>0&&s-i<=0?(r.scrollTop(0),C(e)):i<0&&r.get(0).scrollHeight-r.scrollTop()+i<=r.height()&&(r.scrollTop(r.get(0).scrollHeight-r.height()),C(e))}),w(i),i.on("keyup-change input paste",this.bind(this.updateResults)),i.on("focus",function(){i.addClass("select2-focused")}),i.on("blur",function(){i.removeClass("select2-focused")}),this.dropdown.on("mouseup",o,this.bind(function(t){e(t.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(t),this.selectHighlighted(t))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(e){e.stopPropagation()}),this.nextSearchTerm=t,e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),n.maximumInputLength!==null&&this.search.attr("maxlength",n.maximumInputLength);var u=n.element.prop("disabled");u===t&&(u=!1),this.enable(!u);var a=n.element.prop("readonly");a===t&&(a=!1),this.readonly(a),f=f||m(),this.autofocus=n.element.prop("autofocus"),n.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",n.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,n=e.data("select2"),r=this;this.close(),e.length&&e[0].detachEvent&&r._sync&&e.each(function(){r._sync&&this.detachEvent("onpropertychange",r._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,n!==t&&(n.container.remove(),n.liveRegion.remove(),n.dropdown.remove(),e.show().removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show()),I.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){if(e.is("option"))return{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:g(e.attr("locked"),"locked")||g(e.data("locked"),!0)};if(e.is("optgroup"))return{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}},prepareOpts:function(n){var r,i,o,u,a=this;r=n.element,r.get(0).tagName.toLowerCase()==="select"&&(this.select=i=n.element),i&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in n)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),n=e.extend({},{populateResults:function(r,i,o){var u,f=this.opts.id,l=this.liveRegion;u=function(r,i,c){var h,p,d,v,m,g,y,b,w,E;r=n.sortResults(r,i,o);var S=[];for(h=0,p=r.length;h<p;h+=1)d=r[h],m=d.disabled===!0,v=!m&&f(d)!==t,g=d.children&&d.children.length>0,y=e("<li></li>"),y.addClass("select2-results-dept-"+c),y.addClass("select2-result"),y.addClass(v?"select2-result-selectable":"select2-result-unselectable"),m&&y.addClass("select2-disabled"),g&&y.addClass("select2-result-with-children"),y.addClass(a.opts.formatResultCssClass(d)),y.attr("role","presentation"),b=e(document.createElement("div")),b.addClass("select2-result-label"),b.attr("id","select2-result-label-"+s()),b.attr("role","option"),E=n.formatResult(d,b,o,a.opts.escapeMarkup),E!==t&&(b.html(E),y.append(b)),g&&(w=e("<ul></ul>"),w.addClass("select2-result-sub"),u(d.children,w,c+1),y.append(w)),y.data("select2-data",d),S.push(y[0]);i.append(S),l.text(n.formatMatches(r.length))},u(i,r,0)}},e.fn.select2.defaults,n),typeof n.id!="function"&&(o=n.id,n.id=function(e){return e[o]});if(e.isArray(n.element.data("select2Tags"))){if("tags"in n)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+n.element.attr("id");n.tags=n.element.data("select2Tags")}i?(n.query=this.bind(function(e){var n={results:[],more:!1},i=e.term,s,o,u;u=function(t,n){var r;t.is("option")?e.matcher(i,t.text(),t)&&n.push(a.optionToData(t)):t.is("optgroup")&&(r=a.optionToData(t),t.children().each2(function(e,t){u(t,r.children)}),r.children.length>0&&n.push(r))},s=r.children(),this.getPlaceholder()!==t&&s.length>0&&(o=this.getPlaceholderOption(),o&&(s=s.not(o))),s.each2(function(e,t){u(t,n.results)}),e.callback(n)}),n.id=function(e){return e.id}):"query"in n||("ajax"in n?(u=n.element.data("ajax-url"),u&&u.length>0&&(n.ajax.url=u),n.query=_.call(n.element,n.ajax)):"data"in n?n.query=D(n.data):"tags"in n&&(n.query=P(n.tags),n.createSearchChoice===t&&(n.createSearchChoice=function(t){return{id:e.trim(t),text:e.trim(t)}}),n.initSelection===t&&(n.initSelection=function(t,r){var i=[];e(y(t.val(),n.separator,n.transformVal)).each(function(){var t={id:this,text:this},r=n.tags;e.isFunction(r)&&(r=r()),e(r).each(function(){if(g(this.id,t.id))return t=this,!1}),i.push(t)}),r(i)})));if(typeof n.query!="function")throw"query function not defined for Select2 "+n.element.attr("id");if(n.createSearchChoicePosition==="top")n.createSearchChoicePosition=function(e,t){e.unshift(t)};else if(n.createSearchChoicePosition==="bottom")n.createSearchChoicePosition=function(e,t){e.push(t)};else if(typeof n.createSearchChoicePosition!="function")throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return n},monitorSource:function(){var n=this.opts.element,r,i=this;n.on("change.select2",this.bind(function(e){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var e=n.prop("disabled");e===t&&(e=!1),this.enable(!e);var r=n.prop("readonly");r===t&&(r=!1),this.readonly(r),this.container&&(A(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(B(this.opts.containerCssClass,this.opts.element))),this.dropdown&&(A(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(B(this.opts.dropdownCssClass,this.opts.element)))}),n.length&&n[0].attachEvent&&n.each(function(){this.attachEvent("onpropertychange",i._sync)}),r=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,r!==t&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new r(function(t){e.each(t,i._sync)}),this.propertyObserver.observe(n.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(t){var n=e.Event("select2-selecting",{val:this.id(t),object:t,choice:t});return this.opts.element.trigger(n),!n.isDefaultPrevented()},triggerChange:function(t){t=t||{},t=e.extend({},t,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(t),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var e=this._enabled&&!this._readonly,t=!e;return e===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",t),this.close(),this.enabledInterface=e,!0)},enable:function(e){e===t&&(e=!0);if(this._enabled===e)return;this._enabled=e,this.opts.element.prop("disabled",!e),this.enableInterface()},disable:function(){this.enable(!1)},readonly:function(e){e===t&&(e=!1);if(this._readonly===e)return;this._readonly=e,this.opts.element.prop("readonly",e),this.enableInterface()},opened:function(){return this.container?this.container.hasClass("select2-dropdown-open"):!1},positionDropdown:function(){var t=this.dropdown,n=this.container,r=n.offset(),i=n.outerHeight(!1),s=n.outerWidth(!1),o=t.outerHeight(!1),u=e(window),a=u.width(),l=u.height(),c=u.scrollLeft()+a,h=u.scrollTop()+l,p=r.top+i,d=r.left,v=p+o<=h,m=r.top-o>=u.scrollTop(),g=t.outerWidth(!1),y=function(){return d+g<=c},b=function(){return r.left+c+n.outerWidth(!1)>g},w=t.hasClass("select2-drop-above"),E,S,x,T,N;w?(S=!0,!m&&v&&(x=!0,S=!1)):(S=!1,!v&&m&&(x=!0,S=!0)),x&&(t.hide(),r=this.container.offset(),i=this.container.outerHeight(!1),s=this.container.outerWidth(!1),o=t.outerHeight(!1),c=u.scrollLeft()+a,h=u.scrollTop()+l,p=r.top+i,d=r.left,g=t.outerWidth(!1),t.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(N=e(".select2-results",t)[0],t.addClass("select2-drop-auto-width"),t.css("width",""),g=t.outerWidth(!1)+(N.scrollHeight===N.clientHeight?0:f.width),g>s?s=g:g=s,o=t.outerHeight(!1)):this.container.removeClass("select2-drop-auto-width"),this.body.css("position")!=="static"&&(E=this.body.offset(),p-=E.top,d-=E.left),!y()&&b()&&(d=r.left+this.container.outerWidth(!1)-g),T={left:d,width:s},S?(T.top=r.top-o,T.bottom="auto",this.container.addClass("select2-drop-above"),t.addClass("select2-drop-above")):(T.top=p,T.bottom="auto",this.container.removeClass("select2-drop-above"),t.removeClass("select2-drop-above")),T=e.extend(T,B(this.opts.dropdownCss,this.opts.element)),t.css(T)},shouldOpen:function(){var t;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(t=e.Event("select2-opening"),this.opts.element.trigger(t),!t.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),a.on("mousemove.select2Event",function(e){u.x=e.pageX,u.y=e.pageY}),!0):!1},opening:function(){var t=this.containerEventName,n="scroll."+t,r="resize."+t,i="orientationchange."+t,s;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),s=e("#select2-drop-mask"),s.length===0&&(s=e(document.createElement("div")),s.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),s.hide(),s.appendTo(this.body),s.on("mousedown touchstart click",function(t){p(s);var n=e("#select2-drop"),r;n.length>0&&(r=n.data("select2"),r.opts.selectOnBlur&&r.selectHighlighted({noFocus:!0}),r.close(),t.preventDefault(),t.stopPropagation())})),this.dropdown.prev()[0]!==s[0]&&this.dropdown.before(s),e("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),s.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var o=this;this.container.parents().add(window).each(function(){e(this).on(r+" "+n+" "+i,function(e){o.opened()&&o.positionDropdown()})})},close:function(){if(!this.opened())return;var t=this.containerEventName,n="scroll."+t,r="resize."+t,i="orientationchange."+t;this.container.parents().add(window).each(function(){e(this).off(n).off(r).off(i)}),this.clearDropdownAlignmentPreference(),e("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),a.off("mousemove.select2Event"),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(e.Event("select2-close"))},externalSearch:function(e){this.open(),this.search.val(e),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return B(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var t=this.results,n,r,i,s,o,u,a,f;r=this.highlight();if(r<0)return;if(r==0){t.scrollTop(0);return}n=this.findHighlightableChoices().find(".select2-result-label"),i=e(n[r]),f=(i.offset()||{}).top||0,s=f+i.outerHeight(!0),r===n.length-1&&(a=t.find("li.select2-more-results"),a.length>0&&(s=a.offset().top+a.outerHeight(!0))),o=t.offset().top+t.outerHeight(!1),s>o&&t.scrollTop(t.scrollTop()+(s-o)),u=f-t.offset().top,u<0&&i.css("display")!="none"&&t.scrollTop(t.scrollTop()+u)},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(t){var n=this.findHighlightableChoices(),r=this.highlight();while(r>-1&&r<n.length){r+=t;var i=e(n[r]);if(i.hasClass("select2-result-selectable")&&!i.hasClass("select2-disabled")&&!i.hasClass("select2-selected")){this.highlight(r);break}}},highlight:function(t){var n=this.findHighlightableChoices(),r,i;if(arguments.length===0)return v(n.filter(".select2-highlighted")[0],n.get());t>=n.length&&(t=n.length-1),t<0&&(t=0),this.removeHighlight(),r=e(n[t]),r.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",r.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(r.text()),i=r.data("select2-data"),i&&this.opts.element.trigger({type:"select2-highlight",val:this.id(i),choice:i})},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(t){var n=e(t.target).closest(".select2-result-selectable");if(n.length>0&&!n.is(".select2-highlighted")){var r=this.findHighlightableChoices();this.highlight(r.index(n))}else n.length==0&&this.removeHighlight()},loadMoreIfNeeded:function(){var e=this.results,t=e.find("li.select2-more-results"),n,r=this.resultsPage+1,i=this,s=this.search.val(),o=this.context;if(t.length===0)return;n=t.offset().top-e.offset().top-e.height(),n<=this.opts.loadMorePadding&&(t.addClass("select2-active"),this.opts.query({element:this.opts.element,term:s,page:r,context:o,matcher:this.opts.matcher,callback:this.bind(function(n){if(!i.opened())return;i.opts.populateResults.call(this,e,n.results,{term:s,page:r,context:o}),i.postprocessResults(n,!1,!1),n.more===!0?(t.detach().appendTo(e).html(i.opts.escapeMarkup(B(i.opts.formatLoadMore,i.opts.element,r+1))),window.setTimeout(function(){i.loadMoreIfNeeded()},10)):t.remove(),i.positionDropdown(),i.resultsPage=r,i.context=n.context,this.opts.element.trigger({type:"select2-loaded",items:n})})}))},tokenize:function(){},updateResults:function(n){function h(){r.removeClass("select2-active"),u.positionDropdown(),i.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?u.liveRegion.text(i.text()):u.liveRegion.text(u.opts.formatMatches(i.find('.select2-result-selectable:not(".select2-selected")').length))}function p(e){i.html(e),h()}var r=this.search,i=this.results,s=this.opts,o,u=this,a,f=r.val(),l=e.data(this.container,"select2-last-term"),c;if(n!==!0&&l&&g(f,l))return;e.data(this.container,"select2-last-term",f);if(n!==!0&&(this.showSearchInput===!1||!this.opened()))return;c=++this.queryCount;var d=this.getMaximumSelectionSize();if(d>=1){o=this.data();if(e.isArray(o)&&o.length>=d&&H(s.formatSelectionTooBig,"formatSelectionTooBig")){p("<li class='select2-selection-limit'>"+B(s.formatSelectionTooBig,s.element,d)+"</li>");return}}if(r.val().length<s.minimumInputLength){H(s.formatInputTooShort,"formatInputTooShort")?p("<li class='select2-no-results'>"+B(s.formatInputTooShort,s.element,r.val(),s.minimumInputLength)+"</li>"):p(""),n&&this.showSearch&&this.showSearch(!0);return}if(s.maximumInputLength&&r.val().length>s.maximumInputLength){H(s.formatInputTooLong,"formatInputTooLong")?p("<li class='select2-no-results'>"+B(s.formatInputTooLong,s.element,r.val(),s.maximumInputLength)+"</li>"):p("");return}s.formatSearching&&this.findHighlightableChoices().length===0&&p("<li class='select2-searching'>"+B(s.formatSearching,s.element)+"</li>"),r.addClass("select2-active"),this.removeHighlight(),a=this.tokenize(),a!=t&&a!=null&&r.val(a),this.resultsPage=1,s.query({element:s.element,term:r.val(),page:this.resultsPage,context:null,matcher:s.matcher,callback:this.bind(function(o){var a;if(c!=this.queryCount)return;if(!this.opened()){this.search.removeClass("select2-active");return}if(o.hasError!==t&&H(s.formatAjaxError,"formatAjaxError")){p("<li class='select2-ajax-error'>"+B(s.formatAjaxError,s.element,o.jqXHR,o.textStatus,o.errorThrown)+"</li>");return}this.context=o.context===t?null:o.context,this.opts.createSearchChoice&&r.val()!==""&&(a=this.opts.createSearchChoice.call(u,r.val(),o.results),a!==t&&a!==null&&u.id(a)!==t&&u.id(a)!==null&&e(o.results).filter(function(){return g(u.id(this),u.id(a))}).length===0&&this.opts.createSearchChoicePosition(o.results,a));if(o.results.length===0&&H(s.formatNoMatches,"formatNoMatches")){p("<li class='select2-no-results'>"+B(s.formatNoMatches,s.element,r.val())+"</li>");return}i.empty(),u.opts.populateResults.call(this,i,o.results,{term:r.val(),page:this.resultsPage,context:null}),o.more===!0&&H(s.formatLoadMore,"formatLoadMore")&&(i.append("<li class='select2-more-results'>"+s.escapeMarkup(B(s.formatLoadMore,s.element,this.resultsPage))+"</li>"),window.setTimeout(function(){u.loadMoreIfNeeded()},10)),this.postprocessResults(o,n),h(),this.opts.element.trigger({type:"select2-loaded",items:o})})})},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){T(this.search)},selectHighlighted:function(e){if(this._touchMoved){this.clearTouchMoved();return}var t=this.highlight(),n=this.results.find(".select2-highlighted"),r=n.closest(".select2-result").data("select2-data");r?(this.highlight(t),this.onSelect(r,e)):e&&e.noFocus&&this.close()},getPlaceholder:function(){var e;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((e=this.getPlaceholderOption())!==t?e.text():t)},getPlaceholderOption:function(){if(this.select){var n=this.select.children("option").first();if(this.opts.placeholderOption!==t)return this.opts.placeholderOption==="first"&&n||typeof this.opts.placeholderOption=="function"&&this.opts.placeholderOption(this.select);if(e.trim(n.text())===""&&n.val()==="")return n}},initContainerWidth:function(){function n(){var n,r,i,s,o,u;if(this.opts.width==="off")return null;if(this.opts.width==="element")return this.opts.element.outerWidth(!1)===0?"auto":this.opts.element.outerWidth(!1)+"px";if(this.opts.width==="copy"||this.opts.width==="resolve"){n=this.opts.element.attr("style");if(n!==t){r=n.split(";");for(s=0,o=r.length;s<o;s+=1){u=r[s].replace(/\s/g,""),i=u.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i);if(i!==null&&i.length>=1)return i[1]}}return this.opts.width==="resolve"?(n=this.opts.element.css("width"),n.indexOf("%")>0?n:this.opts.element.outerWidth(!1)===0?"auto":this.opts.element.outerWidth(!1)+"px"):null}return e.isFunction(this.opts.width)?this.opts.width():this.opts.width}var r=n.call(this);r!==null&&this.container.css("width",r)}}),r=q(n,{createContainer:function(){var t=e(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>","   <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>","   <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>","   <div class='select2-search'>","       <label for='' class='select2-offscreen'></label>","       <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'","       aria-autocomplete='list' />","   </div>","   <ul class='select2-results' role='listbox'>","   </ul>","</div>"].join(""));return t},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var n,r,i;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),n=this.search.get(0),n.createTextRange?(r=n.createTextRange(),r.collapse(!1),r.select()):n.setSelectionRange&&(i=this.search.val().length,n.setSelectionRange(i,i))),this.search.val()===""&&this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(e.Event("select2-open"))},close:function(){if(!this.opened())return;this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){e("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),I.call(this,"selection","focusser")},initContainer:function(){var t,n=this.container,r=this.dropdown,i=s(),o;this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=t=n.find(".select2-choice"),this.focusser=n.find(".select2-focusser"),t.find(".select2-chosen").attr("id","select2-chosen-"+i),this.focusser.attr("aria-labelledby","select2-chosen-"+i),this.results.attr("id","select2-results-"+i),this.search.attr("aria-owns","select2-results-"+i),this.focusser.attr("id","s2id_autogen"+i),o=e("label[for='"+this.opts.element.attr("id")+"']"),this.opts.element.focus(this.bind(function(){this.focus()})),this.focusser.prev().text(o.text()).attr("for",this.focusser.attr("id"));var u=this.opts.element.attr("title");this.opts.element.attr("title",u||o.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(e("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(e){if(!this.isInterfaceEnabled())return;if(229==e.keyCode)return;if(e.which===l.PAGE_UP||e.which===l.PAGE_DOWN){C(e);return}switch(e.which){case l.UP:case l.DOWN:this.moveHighlight(e.which===l.UP?-1:1),C(e);return;case l.ENTER:this.selectHighlighted(),C(e);return;case l.TAB:this.selectHighlighted({noFocus:!0});return;case l.ESC:this.cancel(e),C(e);return}})),this.search.on("blur",this.bind(function(e){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(e){if(!this.isInterfaceEnabled())return;if(e.which===l.TAB||l.isControl(e)||l.isFunctionKey(e)||e.which===l.ESC)return;if(this.opts.openOnEnter===!1&&e.which===l.ENTER){C(e);return}if(e.which==l.DOWN||e.which==l.UP||e.which==l.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;this.open(),C(e);return}if(e.which==l.DELETE||e.which==l.BACKSPACE){this.opts.allowClear&&this.clear(),C(e);return}})),w(this.focusser),this.focusser.on("keyup-change input",this.bind(function(e){if(this.opts.minimumResultsForSearch>=0){e.stopPropagation();if(this.opened())return;this.open()}})),t.on("mousedown touchstart","abbr",this.bind(function(e){if(!this.isInterfaceEnabled())return;this.clear(),k(e),this.close(),this.selection&&this.selection.focus()})),t.on("mousedown touchstart",this.bind(function(n){p(t),this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),C(n)})),r.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),t.on("focus",this.bind(function(e){C(e)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(e.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.hide(),this.setPlaceholder()},clear:function(t){var n=this.selection.data("select2-data");if(n){var r=e.Event("select2-clearing");this.opts.element.trigger(r);if(r.isDefaultPrevented())return;var i=this.getPlaceholderOption();this.opts.element.val(i?i.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),t!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(n),choice:n}),this.triggerChange({removed:n}))}},initSelection:function(){var e;if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var n=this;this.opts.initSelection.call(null,this.opts.element,function(e){e!==t&&e!==null&&(n.updateSelection(e),n.close(),n.setPlaceholder(),n.nextSearchTerm=n.opts.nextSearchTerm(e,n.search.val()))})}},isPlaceholderOptionSelected:function(){var e;return this.getPlaceholder()===t?!1:(e=this.getPlaceholderOption())!==t&&e.prop("selected")||this.opts.element.val()===""||this.opts.element.val()===t||this.opts.element.val()===null},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),n=this;return t.element.get(0).tagName.toLowerCase()==="select"?t.initSelection=function(e,t){var r=e.find("option").filter(function(){return this.selected&&!this.disabled});t(n.optionToData(r))}:"data"in t&&(t.initSelection=t.initSelection||function(n,r){var i=n.val(),s=null;t.query({matcher:function(e,n,r){var o=g(i,t.id(r));return o&&(s=r),o},callback:e.isFunction(r)?function(){r(s)}:e.noop})}),t},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===t?t:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==t){if(this.select&&this.getPlaceholderOption()===t)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(e)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(e,t,n){var r=0,i=this,s=!0;this.findHighlightableChoices().each2(function(e,t){if(g(i.id(t.data("select2-data")),i.opts.element.val()))return r=e,!1}),n!==!1&&(t===!0&&r>=0?this.highlight(r):this.highlight(0));if(t===!0){var o=this.opts.minimumResultsForSearch;o>=0&&this.showSearch(j(e.results)>=o)}},showSearch:function(t){if(this.showSearchInput===t)return;this.showSearchInput=t,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!t),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!t),e(this.dropdown,this.container).toggleClass("select2-with-searchbox",t)},onSelect:function(e,t){if(!this.triggerSelect(e))return;var n=this.opts.element.val(),r=this.data();this.opts.element.val(this.id(e)),this.updateSelection(e),this.opts.element.trigger({type:"select2-selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.close(),(!t||!t.noFocus)&&this.opts.shouldFocusInput(this)&&this.focusser.focus(),g(n,this.id(e))||this.triggerChange({added:e,removed:r})},updateSelection:function(e){var n=this.selection.find(".select2-chosen"),r,i;this.selection.data("select2-data",e),n.empty(),e!==null&&(r=this.opts.formatSelection(e,n,this.opts.escapeMarkup)),r!==t&&n.append(r),i=this.opts.formatSelectionCssClass(e,n),i!==t&&n.addClass(i),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==t&&this.container.addClass("select2-allowclear")},val:function(){var e,n=!1,r=null,i=this,s=this.data();if(arguments.length===0)return this.opts.element.val();e=arguments[0],arguments.length>1&&(n=arguments[1]);if(this.select)this.select.val(e).find("option").filter(function(){return this.selected}).each2(function(e,t){return r=i.optionToData(t),!1}),this.updateSelection(r),this.setPlaceholder(),n&&this.triggerChange({added:r,removed:s});else{if(!e&&e!==0){this.clear(n);return}if(this.opts.initSelection===t)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(e),this.opts.initSelection(this.opts.element,function(e){i.opts.element.val(e?i.id(e):""),i.updateSelection(e),i.setPlaceholder(),n&&i.triggerChange({added:e,removed:s})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(e){var n,r=!1;if(arguments.length===0)return n=this.selection.data("select2-data"),n==t&&(n=null),n;arguments.length>1&&(r=arguments[1]),e?(n=this.data(),this.opts.element.val(e?this.id(e):""),this.updateSelection(e),r&&this.triggerChange({added:e,removed:n})):this.clear(r)}}),i=q(n,{createContainer:function(){var t=e(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>","  <li class='select2-search-field'>","    <label for='' class='select2-offscreen'></label>","    <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>","  </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>","   <ul class='select2-results'>","   </ul>","</div>"].join(""));return t},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),n=this;return t.element.get(0).tagName.toLowerCase()==="select"?t.initSelection=function(e,t){var r=[];e.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(e,t){r.push(n.optionToData(t))}),t(r)}:"data"in t&&(t.initSelection=t.initSelection||function(n,r){var i=y(n.val(),t.separator,t.transformVal),s=[];t.query({matcher:function(n,r,o){var u=e.grep(i,function(e){return g(e,t.id(o))}).length;return u&&s.push(o),u},callback:e.isFunction(r)?function(){var e=[];for(var n=0;n<i.length;n++){var o=i[n];for(var u=0;u<s.length;u++){var a=s[u];if(g(o,t.id(a))){e.push(a),s.splice(u,1);break}}}r(e)}:e.noop})}),t},selectChoice:function(e){var t=this.container.find(".select2-search-choice-focus");if(!t.length||!e||e[0]!=t[0])t.length&&this.opts.element.trigger("choice-deselected",t),t.removeClass("select2-search-choice-focus"),e&&e.length&&(this.close(),e.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",e))},destroy:function(){e("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),I.call(this,"searchContainer","selection")},initContainer:function(){var t=".select2-choices",n;this.searchContainer=this.container.find(".select2-search-field"),this.selection=n=this.container.find(t);var r=this;this.selection.on("click",".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)",function(t){r.search[0].focus(),r.selectChoice(e(this))}),this.search.attr("id","s2id_autogen"+s()),this.search.prev().text(e("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.opts.element.focus(this.bind(function(){this.focus()})),this.search.on("input paste",this.bind(function(){if(this.search.attr("placeholder")&&this.search.val().length==0)return;if(!this.isInterfaceEnabled())return;this.opened()||this.open()})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(e){if(!this.isInterfaceEnabled())return;++this.keydowns;var t=n.find(".select2-search-choice-focus"),r=t.prev(".select2-search-choice:not(.select2-locked)"),i=t.next(".select2-search-choice:not(.select2-locked)"),s=N(this.search);if(!(!t.length||e.which!=l.LEFT&&e.which!=l.RIGHT&&e.which!=l.BACKSPACE&&e.which!=l.DELETE&&e.which!=l.ENTER)){var o=t;e.which==l.LEFT&&r.length?o=r:e.which==l.RIGHT?o=i.length?i:null:e.which===l.BACKSPACE?this.unselect(t.first())&&(this.search.width(10),o=r.length?r:i):e.which==l.DELETE?this.unselect(t.first())&&(this.search.width(10),o=i.length?i:null):e.which==l.ENTER&&(o=null),this.selectChoice(o),C(e),(!o||!o.length)&&this.open();return}if((e.which===l.BACKSPACE&&this.keydowns==1||e.which==l.LEFT)&&s.offset==0&&!s.length){this.selectChoice(n.find(".select2-search-choice:not(.select2-locked)").last()),C(e);return}this.selectChoice(null);if(this.opened())switch(e.which){case l.UP:case l.DOWN:this.moveHighlight(e.which===l.UP?-1:1),C(e);return;case l.ENTER:this.selectHighlighted(),C(e);return;case l.TAB:this.selectHighlighted({noFocus:!0}),this.close();return;case l.ESC:this.cancel(e),C(e);return}if(e.which===l.TAB||l.isControl(e)||l.isFunctionKey(e)||e.which===l.BACKSPACE||e.which===l.ESC)return;if(e.which===l.ENTER){if(this.opts.openOnEnter===!1)return;if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return}this.open(),(e.which===l.PAGE_UP||e.which===l.PAGE_DOWN)&&C(e),e.which===l.ENTER&&C(e)})),this.search.on("keyup",this.bind(function(e){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(t){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),t.stopImmediatePropagation(),this.opts.element.trigger(e.Event("select2-blur"))})),this.container.on("click",t,this.bind(function(t){if(!this.isInterfaceEnabled())return;if(e(t.target).closest(".select2-search-choice").length>0)return;this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.open(),this.focusSearch(),t.preventDefault()})),this.container.on("focus",t,this.bind(function(){if(!this.isInterfaceEnabled())return;this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder()})),this.initContainerWidth(),this.opts.element.hide(),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){var e;this.opts.element.val()===""&&this.opts.element.text()===""&&(this.updateSelection([]),this.close(),this.clearSearch());if(this.select||this.opts.element.val()!==""){var n=this;this.opts.initSelection.call(null,this.opts.element,function(e){e!==t&&e!==null&&(n.updateSelection(e),n.close(),n.clearSearch())})}},clearSearch:function(){var e=this.getPlaceholder(),n=this.getMaxSearchWidth();e!==t&&this.getVal().length===0&&this.search.hasClass("select2-focused")===!1?(this.search.val(e).addClass("select2-default"),this.search.width(n>0?n:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),this.search.val()===""&&this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(e.Event("select2-open"))},close:function(){if(!this.opened())return;this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(t){var n=[],r=[],i=this;e(t).each(function(){v(i.id(this),n)<0&&(n.push(i.id(this)),r.push(this))}),t=r,this.selection.find(".select2-search-choice").remove(),e(t).each(function(){i.addSelectedChoice(this)}),i.postprocessResults()},tokenize:function(){var e=this.search.val();e=this.opts.tokenizer.call(this,e,this.data(),this.bind(this.onSelect),this.opts),e!=null&&e!=t&&(this.search.val(e),e.length>0&&this.open())},onSelect:function(e,n){if(!this.triggerSelect(e)||e.text==="")return;this.addSelectedChoice(e),this.opts.element.trigger({type:"selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.clearSearch(),this.updateResults(),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(e,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:e}),(!n||!n.noFocus)&&this.focusSearch()},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(n){var r=!n.locked,i=e("<li class='select2-search-choice'>    <div></div>    <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),s=e("<li class='select2-search-choice select2-locked'><div></div></li>"),o=r?i:s,u=this.id(n),a=this.getVal(),f,l;f=this.opts.formatSelection(n,o.find("div"),this.opts.escapeMarkup),f!=t&&o.find("div").replaceWith(e("<div></div>").html(f)),l=this.opts.formatSelectionCssClass(n,o.find("div")),l!=t&&o.addClass(l),r&&o.find(".select2-search-choice-close").on("mousedown",C).on("click dblclick",this.bind(function(t){if(!this.isInterfaceEnabled())return;this.unselect(e(t.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),C(t),this.close(),this.focusSearch()})).on("focus",this.bind(function(){if(!this.isInterfaceEnabled())return;this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active")})),o.data("select2-data",n),o.insertBefore(this.searchContainer),a.push(u),this.setVal(a)},unselect:function(t){var n=this.getVal(),r,i;t=t.closest(".select2-search-choice");if(t.length===0)throw"Invalid argument: "+t+". Must be .select2-search-choice";r=t.data("select2-data");if(!r)return;var s=e.Event("select2-removing");s.val=this.id(r),s.choice=r,this.opts.element.trigger(s);if(s.isDefaultPrevented())return!1;while((i=v(this.id(r),n))>=0)n.splice(i,1),this.setVal(n),this.select&&this.postprocessResults();return t.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(r),choice:r}),this.triggerChange({removed:r}),!0},postprocessResults:function(e,t,n){var r=this.getVal(),i=this.results.find(".select2-result"),s=this.results.find(".select2-result-with-children"),o=this;i.each2(function(e,t){var n=o.id(t.data("select2-data"));v(n,r)>=0&&(t.addClass("select2-selected"),t.find(".select2-result-selectable").addClass("select2-selected"))}),s.each2(function(e,t){!t.is(".select2-result-selectable")&&t.find(".select2-result-selectable:not(.select2-selected)").length===0&&t.addClass("select2-selected")}),this.highlight()==-1&&n!==!1&&this.opts.closeOnSelect===!0&&o.highlight(0),!this.opts.createSearchChoice&&!i.filter(".select2-result:not(.select2-selected)").length>0&&(!e||e&&!e.more&&this.results.find(".select2-no-results").length===0)&&H(o.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+B(o.opts.formatNoMatches,o.opts.element,o.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-b(this.search)},resizeSearch:function(){var e,t,n,r,i,s=b(this.search);e=L(this.search)+10,t=this.search.offset().left,n=this.selection.width(),r=this.selection.offset().left,i=n-(t-r)-s,i<e&&(i=n-s),i<40&&(i=n-s),i<=0&&(i=e),this.search.width(Math.floor(i))},getVal:function(){var e;return this.select?(e=this.select.val(),e===null?[]:e):(e=this.opts.element.val(),y(e,this.opts.separator,this.opts.transformVal))},setVal:function(t){var n;this.select?this.select.val(t):(n=[],e(t).each(function(){v(this,n)<0&&n.push(this)}),this.opts.element.val(n.length===0?"":n.join(this.opts.separator)))},buildChangeDetails:function(e,t){var t=t.slice(0),e=e.slice(0);for(var n=0;n<t.length;n++)for(var r=0;r<e.length;r++)g(this.opts.id(t[n]),this.opts.id(e[r]))&&(t.splice(n,1),n>0&&n--,e.splice(r,1),r--);return{added:t,removed:e}},val:function(n,r){var i,s=this;if(arguments.length===0)return this.getVal();i=this.data(),i.length||(i=[]);if(!n&&n!==0){this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),r&&this.triggerChange({added:this.data(),removed:i});return}this.setVal(n);if(this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),r&&this.triggerChange(this.buildChangeDetails(i,this.data()));else{if(this.opts.initSelection===t)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(t){var n=e.map(t,s.id);s.setVal(n),s.updateSelection(t),s.clearSearch(),r&&s.triggerChange(s.buildChangeDetails(i,s.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var t=[],n=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){t.push(n.opts.id(e(this).data("select2-data")))}),this.setVal(t),this.triggerChange()},data:function(t,n){var r=this,i,s;if(arguments.length===0)return this.selection.children(".select2-search-choice").map(function(){return e(this).data("select2-data")}).get();s=this.data(),t||(t=[]),i=e.map(t,function(e){return r.opts.id(e)}),this.setVal(i),this.updateSelection(t),this.clearSearch(),n&&this.triggerChange(this.buildChangeDetails(s,this.data()))}}),e.fn.select2=function(){var n=Array.prototype.slice.call(arguments,0),r,i,s,o,u,a=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],f=["opened","isFocused","container","dropdown"],l=["val","data"],c={search:"externalSearch"};return this.each(function(){if(n.length===0||typeof n[0]=="object")r=n.length===0?{}:e.extend({},n[0]),r.element=e(this),r.element.get(0).tagName.toLowerCase()==="select"?u=r.element.prop("multiple"):(u=r.multiple||!1,"tags"in r&&(r.multiple=u=!0)),i=u?new window.Select2["class"].multi:new window.Select2["class"].single,i.init(r);else{if(typeof n[0]!="string")throw"Invalid arguments to select2 plugin: "+n;if(v(n[0],a)<0)throw"Unknown method: "+n[0];o=t,i=e(this).data("select2");if(i===t)return;s=n[0],s==="container"?o=i.container:s==="dropdown"?o=i.dropdown:(c[s]&&(s=c[s]),o=i[s].apply(i,n.slice(1)));if(v(n[0],f)>=0||v(n[0],l)>=0&&n.length==1)return!1}}),o===t?this:o},e.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,n,r){var i=[];return O(this.text(e),n.term,i,r),i.join("")},transformVal:function(t){return e.trim(t)},formatSelection:function(e,n,r){return e?r(this.text(e)):t},sortResults:function(e,t,n){return e},formatResultCssClass:function(e){return e.css},formatSelectionCssClass:function(e,n){return t},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(e){return e==t?null:e.id},text:function(t){return t&&this.data&&this.data.text?e.isFunction(this.data.text)?this.data.text(t):t[this.data.text]:t.text},matcher:function(e,t){return d(""+t).toUpperCase().indexOf(d(""+e).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:F,escapeMarkup:M,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(e){return e},adaptDropdownCssClass:function(e){return null},nextSearchTerm:function(e,n){return t},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(e){var t="ontouchstart"in window||navigator.msMaxTouchPoints>0;return t?e.opts.minimumResultsForSearch<0?!1:!0:!0}},e.fn.select2.locales=[],e.fn.select2.locales.en={formatMatches:function(e){return e===1?"One result is available, press enter to select it.":e+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatAjaxError:function(e,t,n){return"Loading failed"},formatInputTooShort:function(e,t){var n=t-e.length;return"Please enter "+n+" or more character"+(n==1?"":"s")},formatInputTooLong:function(e,t){var n=e.length-t;return"Please delete "+n+" character"+(n==1?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(e==1?"":"s")},formatLoadMore:function(e){return"Loading more results…"},formatSearching:function(){return"Searching…"}},e.extend(e.fn.select2.defaults,e.fn.select2.locales.en),e.fn.select2.ajaxDefaults={transport:e.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:_,local:D,tags:P},util:{debounce:S,markMatch:O,escapeMarkup:M,stripDiacritics:d},"class":{"abstract":n,single:r,multi:i}}}(jQuery),define("select2",function(){}),define("app/views/folder-share-item",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({tagName:"tr",template:t.template(e("#folder-perm-item-tmpl").html()),initialize:function(e){this.item_data=e.item_data,this.repo_id=e.repo_id,this.path=e.path,this.render()},render:function(){return this.$el.html(this.template(this.item_data)),this},events:{mouseenter:"showOpIcons",mouseleave:"hideOpIcons","click .perm-edit-icon":"editIconClick","change .perm-toggle-select":"editPerm","click .delete-icon":"del"},showOpIcons:function(){this.$el.find(".op-icon").removeClass("vh")},hideOpIcons:function(){this.$el.find(".op-icon").addClass("vh")},editIconClick:function(t){e(t.currentTarget).closest("td").find(".perm").addClass("hide").end().find(".perm-toggle-select").removeClass("hide")},editPerm:function(t){var n=this,i=this.item_data,s=r.getUrl({name:"dir_shared_items",repo_id:this.repo_id})+"?p="+encodeURIComponent(this.path);i.for_user?s+="&share_type=user&username="+encodeURIComponent(i.user):s+="&share_type=group&group_id="+encodeURIComponent(i.group_id);var o=e(t.currentTarget).val();e.ajax({url:s,dataType:"json",method:"POST",beforeSend:r.prepareCSRFToken,data:{permission:o},success:function(){i.perm=o,n.render()},error:function(t){var n;t.responseText?n=gettext("Edit failed"):n=gettext("Failed. Please check the network."),i.for_user?e("#dir-user-share .error").html(n).removeClass("hide"):e("#dir-group-group .error").html(n).removeClass("hide")}})},del:function(){var t=this,n=this.item_data,i=r.getUrl({name:"dir_shared_items",repo_id:this.repo_id})+"?p="+encodeURIComponent(this.path);n.for_user?i+="&share_type=user&username="+encodeURIComponent(n.user):i+="&share_type=group&group_id="+encodeURIComponent(n.group_id),e.ajax({url:i,dataType:"json",method:"DELETE",beforeSend:r.prepareCSRFToken,success:function(){t.remove()},error:function(t){var r;t.responseText?r=gettext("Delete failed"):r=gettext("Failed. Please check the network."),n.for_user?e("#dir-user-share .error").html(r).removeClass("hide"):e("#dir-group-group .error").html(r).removeClass("hide")}})}});return i}),define("app/views/share",["jquery","underscore","backbone","common","jquery.ui.tabs","select2","app/views/folder-share-item"],function(e,t,n,r,i,s,o){var u=n.View.extend({tagName:"div",id:"share-popup",template:t.template(e("#share-popup-tmpl").html()),initialize:function(t){this.is_repo_owner=t.is_repo_owner,this.is_virtual=t.is_virtual,this.user_perm=t.user_perm,this.repo_id=t.repo_id,this.repo_encrypted=t.repo_encrypted,this.dirent_path=t.dirent_path,this.obj_name=t.obj_name,this.is_dir=t.is_dir,this.render(),this.$el.modal({appendTo:"#main",focus:!1,containerCss:{padding:0}}),e("#simplemodal-container").css({width:"auto",height:"auto"}),this.$("#share-tabs").tabs(),this.repo_encrypted||this.downloadLinkPanelInit();if(this.is_dir){this.user_perm=="rw"&&!this.repo_encrypted&&this.uploadLinkPanelInit();if(!this.is_virtual&&this.is_repo_owner){this.dirUserSharePanelInit(),this.dirGroupSharePanelInit();var n=this;e(document).on("click",function(e){var t=e.target||event.srcElement;n.$(".perm-edit-icon, .perm-toggle-select").is(t)||(n.$(".perm").removeClass("hide"),n.$(".perm-toggle-select").addClass("hide"))})}}},render:function(){return this.$el.html(this.template({title:gettext("Share {placeholder}").replace("{placeholder}",'<span class="op-target ellipsis ellipsis-op-target" title="'+r.HTMLescape(this.obj_name)+'">'+r.HTMLescape(this.obj_name)+"</span>"),is_dir:this.is_dir,is_repo_owner:this.is_repo_owner,is_virtual:this.is_virtual,user_perm:this.user_perm,repo_id:this.repo_id,repo_encrypted:this.repo_encrypted})),this},events:{"mouseenter .checkbox-label":"highlightCheckbox","mouseleave .checkbox-label":"rmHighlightCheckbox","click .checkbox-orig":"clickCheckbox","submit #generate-download-link-form":"generateDownloadLink","click #send-download-link":"showDownloadLinkSendForm","submit #send-download-link-form":"sendDownloadLink","click #cancel-share-download-link":"cancelShareDownloadLink","click #delete-download-link":"deleteDownloadLink","click #generate-download-link-form .generate-random-password":"generateRandomDownloadPassword","click #generate-download-link-form .show-or-hide-password":"showOrHideDownloadPassword","submit #generate-upload-link-form":"generateUploadLink","click #send-upload-link":"showUploadLinkSendForm","submit #send-upload-link-form":"sendUploadLink","click #cancel-share-upload-link":"cancelShareUploadLink","click #delete-upload-link":"deleteUploadLink","click #generate-upload-link-form .generate-random-password":"generateRandomUploadPassword","click #generate-upload-link-form .show-or-hide-password":"showOrHideUploadPassword","click #add-dir-user-share-item .submit":"dirUserShare","click #add-dir-group-share-item .submit":"dirGroupShare"},highlightCheckbox:function(t){e(t.currentTarget).addClass("hl")},rmHighlightCheckbox:function(t){e(t.currentTarget).removeClass("hl")},clickCheckbox:function(t){var n=t.currentTarget;e(n).parent().toggleClass("checkbox-checked"),e(n).closest(".checkbox-label").next().toggleClass("hide")},downloadLinkPanelInit:function(){var e=this,t=function(t){e.$(".loading-tip").hide(),t.download_link?(e.download_link=t.download_link,e.download_link_token=t.token,e.$("#download-link").html(t.download_link),e.$("#direct-dl-link").html(t.download_link+"?raw=1"),t.is_expired&&(e.$("#send-download-link").addClass("hide"),e.$("#download-link, #direct-dl-link").append(' <span class="error">('+gettext("Expired")+")</span>")),e.$("#download-link-operations").removeClass("hide")):e.$("#generate-download-link-form").removeClass("hide")};r.ajaxGet({get_url:r.getUrl({name:"get_shared_download_link"}),data:{repo_id:this.repo_id,p:this.dirent_path,type:this.is_dir?"d":"f"},after_op_success:t})},generateRandomPassword:function(t){var n=app.pageOptions.share_link_password_min_length,r="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789";for(var s=0;s<n;s++)r+=i.charAt(Math.floor(Math.random()*i.length));e("input[name=password], input[name=password_again]",t).attr("type","text").val(r),e(".show-or-hide-password",t).attr("title",gettext("Hide")).removeClass("icon-eye").addClass("icon-eye-slash")},generateRandomDownloadPassword:function(){this.generateRandomPassword(e("#generate-download-link-form"))},showOrHidePassword:function(t){var n=e(".show-or-hide-password",t),r=e("input[name=password], input[name=password_again]",t);n.toggleClass("icon-eye icon-eye-slash"),n.hasClass("icon-eye")?(n.attr("title",gettext("Show")),r.attr("type","password")):(n.attr("title",gettext("Hide")),r.attr("type","text"))},showOrHideDownloadPassword:function(){this.showOrHidePassword(e("#generate-download-link-form"))},generateLink:function(t){var n=t.link_type,i=t.form,s=i.attr("id"),o=e('[name="use_passwd"]',i),u=o.prop("checked");if(n=="download")var a=e('[name="set_expiration"]',i),f=a.prop("checked");var l={};if(u){var c=e('[name="password"]',i),h=e('[name="password_again"]',i),p=e.trim(c.val()),d=e.trim(h.val());if(!p)return r.showFormError(s,gettext("Please enter password")),!1;if(p.length<app.pageOptions.share_link_password_min_length)return r.showFormError(s,gettext("Password is too short")),!1;if(!d)return r.showFormError(s,gettext("Please enter the password again")),!1;if(p!=d)return r.showFormError(s,gettext("Passwords don't match")),!1;l.use_passwd=1,l.passwd=p}else l.use_passwd=0;if(f){var v=e('[name="expire_days"]',i),m=e.trim(v.val());if(!m)return r.showFormError(s,gettext("Please enter days.")),!1;if(Math.floor(m)!=m||!e.isNumeric(m))return r.showFormError(s,gettext("Please enter valid days")),!1;l.expire_days=m}e(".error",i).addClass("hide").html("");var g=e('[type="submit"]',i);r.disableButton(g),e.extend(l,{repo_id:this.repo_id,p:this.dirent_path}),n=="download"&&e.extend(l,{type:this.is_dir?"d":"f"});var y=this,b=function(e){i.addClass("hide"),r.enableButton(g),u&&(o.prop("checked",!1).parent().removeClass("checkbox-checked").end().closest(".checkbox-label").next().addClass("hide"),c.val(""),h.val("")),f&&(a.prop("checked",!1).parent().removeClass("checkbox-checked").end().closest(".checkbox-label").next().addClass("hide"),v.val("")),n=="download"?(y.$("#download-link").html(e.download_link),y.$("#direct-dl-link").html(e.download_link+"?raw=1"),y.download_link=e.download_link,y.download_link_token=e.token,y.$("#download-link-operations").removeClass("hide")):(y.$("#upload-link").html(e.upload_link),y.upload_link=e.upload_link,y.upload_link_token=e.token,y.$("#upload-link-operations").removeClass("hide"))};r.ajaxPost({form:i,post_url:t.post_url,post_data:l,after_op_success:b,form_id:s})},generateDownloadLink:function(){return this.generateLink({link_type:"download",form:this.$("#generate-download-link-form"),post_url:r.getUrl({name:"get_shared_download_link"})}),!1},showDownloadLinkSendForm:function(){this.$("#send-download-link, #delete-download-link").addClass("hide"),this.$("#send-download-link-form").removeClass("hide")},sendLink:function(t){var n=t.form,i=n.attr("id"),s=e.trim(e('[name="email"]',n).val()),o=e('textarea[name="extra_msg"]',n).val();if(!s)return r.showFormError(i,gettext("Please input at least an email.")),!1;var u=e('[type="submit"]',n),a=e(".sending-tip",n);r.disableButton(u),a.removeClass("hide");var f={email:s,extra_msg:o};e.extend(f,t.other_post_data);var l=function(t){e.modal.close();var n=gettext("Successfully sent to {placeholder}").replace("{placeholder}",r.HTMLescape(t.send_success.join(", ")));r.feedback(n,"success"),t.send_failed.length>0&&(n+="<br />"+gettext("Failed to send to {placeholder}").replace("{placeholder}",r.HTMLescape(t.send_failed.join(", "))),r.feedback(n,"info"))},c=function(t){a.addClass("hide"),r.enableButton(u);var n;t.responseText?n=e.parseJSON(t.responseText).error:n=gettext("Failed. Please check the network."),r.showFormError(i,n),r.enableButton(u)};r.ajaxPost({form:n,post_url:t.post_url,post_data:f,after_op_success:l,after_op_error:c,form_id:i})},sendDownloadLink:function(){return this.sendLink({form:this.$("#send-download-link-form"),other_post_data:{file_shared_link:this.download_link,file_shared_name:this.obj_name,file_shared_type:this.is_dir?"d":"f"},post_url:r.getUrl({name:"send_shared_download_link"})}),!1},cancelShareDownloadLink:function(){this.$("#send-download-link, #delete-download-link").removeClass("hide"),this.$("#send-download-link-form").addClass("hide")},deleteDownloadLink:function(){var t=this;e.ajax({url:r.getUrl({name:"delete_shared_download_link"}),type:"POST",data:{t:this.download_link_token},beforeSend:r.prepareCSRFToken,dataType:"json",success:function(e){t.$("#generate-download-link-form").removeClass("hide"),t.$("#download-link-operations").addClass("hide")}})},uploadLinkPanelInit:function(){var e=this,t=function(t){t.upload_link?(e.upload_link_token=t.token,e.upload_link=t.upload_link,e.$("#upload-link").html(t.upload_link),e.$("#upload-link-operations").removeClass("hide")):e.$("#generate-upload-link-form").removeClass("hide")};r.ajaxGet({get_url:r.getUrl({name:"get_share_upload_link"}),data:{repo_id:this.repo_id,p:this.dirent_path},after_op_success:t})},generateRandomUploadPassword:function(){this.generateRandomPassword(e("#generate-upload-link-form"))},showOrHideUploadPassword:function(){this.showOrHidePassword(e("#generate-upload-link-form"))},generateUploadLink:function(e){return this.generateLink({link_type:"upload",form:this.$("#generate-upload-link-form"),post_url:r.getUrl({name:"get_share_upload_link"})}),!1},showUploadLinkSendForm:function(){this.$("#send-upload-link, #delete-upload-link").addClass("hide"),this.$("#send-upload-link-form").removeClass("hide")},sendUploadLink:function(){return this.sendLink({form:this.$("#send-upload-link-form"),other_post_data:{shared_upload_link:this.upload_link},post_url:r.getUrl({name:"send_shared_upload_link"})}),!1},cancelShareUploadLink:function(){this.$("#send-upload-link, #delete-upload-link").removeClass("hide"),this.$("#send-upload-link-form").addClass("hide")},deleteUploadLink:function(){var t=this;e.ajax({url:r.getUrl({name:"delete_shared_upload_link"}),type:"POST",data:{t:this.upload_link_token},beforeSend:r.prepareCSRFToken,dataType:"json",success:function(e){t.$("#generate-upload-link-form").removeClass("hide"),t.$("#upload-link-operations").addClass("hide")}})},dirUserSharePanelInit:function(){var t=this.$("#dir-user-share");e('[name="emails"]',t).select2(e.extend({width:"297px"},r.contactInputOptionsForSelect2()));var n=e("#add-dir-user-share-item"),i=this.repo_id,s=this.dirent_path;r.ajaxGet({get_url:r.getUrl({name:"dir_shared_items",repo_id:i}),data:{p:s,share_type:"user"},after_op_success:function(t){e(t).each(function(e,t){var r=new o({repo_id:i,path:s,item_data:{user:t.user_info.name,user_name:t.user_info.nickname,perm:t.permission,for_user:!0}});n.after(r.el)})}}),t.removeClass("hide"),this.$(".loading-tip").hide()},dirGroupSharePanelInit:function(){var t=this.$("#dir-group-share"),n=app.pageOptions.groups||[],i="";for(var s=0,u=n.length;s<u;s++)i+='<option value="'+n[s].id+'" data-index="'+s+'">'+n[s].name+"</option>";e('[name="groups"]',t).html(i).select2({placeholder:gettext("Select groups"),width:"297px",escapeMarkup:function(e){return e}});var a=e("#add-dir-group-share-item"),f=this.repo_id,l=this.dirent_path;r.ajaxGet({get_url:r.getUrl({name:"dir_shared_items",repo_id:f}),data:{p:l,share_type:"group"},after_op_success:function(t){e(t).each(function(e,t){var n=new o({repo_id:f,path:l,item_data:{group_id:t.group_info.id,group_name:t.group_info.name,perm:t.permission,for_user:!1}});a.after(n.el)})}}),t.removeClass("hide"),this.$(".loading-tip").hide()},dirUserShare:function(){var t=e("#dir-user-share"),n=this.$("#add-dir-user-share-item"),i=e('[name="emails"]',n),s=i.val();if(!s)return!1;var u=e("#add-dir-user-share-item"),a=this.repo_id,f=this.dirent_path,l=e('[name="permission"]',n).val();e.ajax({url:r.getUrl({name:"dir_shared_items",repo_id:a})+"?p="+encodeURIComponent(f),dataType:"json",method:"PUT",beforeSend:r.prepareCSRFToken,traditional:!0,data:{share_type:"user",username:s.split(","),permission:l},success:function(n){e(n.success).each(function(e,t){var n=new o({repo_id:a,path:f,item_data:{user:t.user_info.name,user_name:t.user_info.nickname,perm:t.permission,for_user:!0}});u.after(n.el)}),i.select2("val","");if(n.failed.length>0){var s=gettext("Failed to share to {placeholder}").replace("{placeholder}",r.HTMLescape(n.failed.join(", ")));e(".error",t).html(s).removeClass("hide")}},error:function(n){var r;if(n.responseText){var i=e.parseJSON(n.responseText);r=i.error||i.error_msg}else r=gettext("Failed. Please check the network.");e(".error",t).html(r).removeClass("hide")}})},dirGroupShare:function(){var t=e("#dir-group-share"),n=this.$("#add-dir-group-share-item"),i=e('[name="groups"]',n),s=i.val();if(!s)return!1;var u=e("#add-dir-group-share-item"),a=this.repo_id,f=this.dirent_path,l=e('[name="permission"]',n).val();e.ajax({url:r.getUrl({name:"dir_shared_items",repo_id:a})+"?p="+encodeURIComponent(f),dataType:"json",method:"PUT",beforeSend:r.prepareCSRFToken,traditional:!0,data:{share_type:"group",group_id:s,permission:l},success:function(t){e(t.success).each(function(e,t){var n=new o({repo_id:a,path:f,item_data:{group_id:t.group_info.id,group_name:t.group_info.name,perm:t.permission,for_user:!1}});u.after(n.el)}),i.select2("val","")},error:function(n){var r;if(n.responseText){var i=e.parseJSON(n.responseText);r=i.error||i.error_msg}else r=gettext("Failed. Please check the network.");e(".error",t).html(r).removeClass("hide")}})}});return u}),define("app/views/repo",["jquery","underscore","backbone","common","app/views/share"],function(e,t,n,r,i){var s=n.View.extend({tagName:"tr",template:t.template(e("#repo-tmpl").html()),repoDelConfirmTemplate:t.template(e("#repo-del-confirm-template").html()),events:{mouseenter:"highlight",mouseleave:"rmHighlight","click .repo-delete-btn":"del","click .repo-share-btn":"share"},initialize:function(){},render:function(){return this.$el.html(this.template(this.model.toJSON())),this},highlight:function(){e("#my-own-repos .repo-del-confirm").length==0&&this.$el.addClass("hl").find(".op-icon").removeClass("vh")},rmHighlight:function(){e("#my-own-repos .repo-del-confirm").length==0&&this.$el.removeClass("hl").find(".op-icon").addClass("vh")},del:function(){var t=this.$(".repo-delete-btn"),n=this.$(".op-container").css({position:"relative"}),i=gettext("Really want to delete {lib_name}?").replace("{lib_name}",'<span class="op-target">'+r.HTMLescape(this.model.get("name"))+"</span>"),s=e(this.repoDelConfirmTemplate({content:i})).appendTo(n).css({left:t.position().left,top:t.position().top+t.height()+2,width:180}),o=this;e(".no",s).click(function(){s.addClass("hide").remove(),o.rmHighlight()}),e(".yes",s).click(function(){e.ajax({url:r.getUrl({name:"repo_del",repo_id:o.model.get("id")}),type:"POST",dataType:"json",beforeSend:r.prepareCSRFToken,success:function(e){o.remove(),r.feedback(gettext("Delete succeeded."),"success")},error:function(t){s.addClass("hide").remove(),o.rmHighlight();var n;t.responseText?n=e.parseJSON(t.responseText).error:n=gettext("Failed. Please check the network."),r.feedback(n,"error")}})})},share:function(){var e={is_repo_owner:!0,is_virtual:this.model.get("virtual"),user_perm:"rw",repo_id:this.model.get("id"),repo_encrypted:this.model.get("encrypted"),is_dir:!0,dirent_path:"/",obj_name:this.model.get("name")};new i(e)}});return s}),function(e){typeof define=="function"&&define.amd?define("simplemodal",["jquery"],e):e(jQuery)}(function(e){var t=[],n=e(document),r=navigator.userAgent.toLowerCase(),i=e(window),s=[],o={ieQuirks:null,msie:/msie/.test(r)&&!/opera/.test(r),opera:/opera/.test(r)};o.ie6=o.msie&&/msie 6./.test(r)&&typeof window.XMLHttpRequest!="object",o.ie7=o.msie&&/msie 7.0/.test(r),o.boxModel=document.compatMode==="CSS1Compat",e.modal=function(t,n){return e.modal.impl.init(t,n)},e.modal.close=function(){e.modal.impl.close()},e.modal.focus=function(t){e.modal.impl.focus(t)},e.modal.setContainerDimensions=function(){e.modal.impl.setContainerDimensions()},e.modal.setPosition=function(){e.modal.impl.setPosition()},e.modal.update=function(t,n){e.modal.impl.update(t,n)},e.fn.modal=function(t){return e.modal.impl.init(this,t)},e.modal.defaults={appendTo:"body",focus:!0,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:!1,autoPosition:!0,zIndex:1e3,close:!0,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:"simplemodal-close",escClose:!0,overlayClose:!1,fixed:!0,position:null,persist:!1,modal:!0,onOpen:null,onShow:null,onClose:null},e.modal.impl={d:{},init:function(t,n){var r=this;if(r.d.data)return!1;o.ieQuirks=o.msie&&!o.boxModel,r.o=e.extend({},e.modal.defaults,n),r.zIndex=r.o.zIndex,r.occb=!1;if(typeof t=="object")t=t instanceof e?t:e(t),r.d.placeholder=!1,t.parent().parent().size()>0&&(t.before(e("<span></span>").attr("id","simplemodal-placeholder").css({display:"none"})),r.d.placeholder=!0,r.display=t.css("display"),r.o.persist||(r.d.orig=t.clone(!0)));else{if(typeof t!="string"&&typeof t!="number")return alert("SimpleModal Error: Unsupported data type: "+typeof t),r;t=e("<div></div>").html(t)}return r.create(t),t=null,r.open(),e.isFunction(r.o.onShow)&&r.o.onShow.apply(r,[r.d]),r},create:function(n){var r=this;r.getDimensions(),r.o.modal&&o.ie6&&(r.d.iframe=e('<iframe src="javascript:false;"></iframe>').css(e.extend(r.o.iframeCss,{display:"none",opacity:0,position:"fixed",height:s[0],width:s[1],zIndex:r.o.zIndex,top:0,left:0})).appendTo(r.o.appendTo)),r.d.overlay=e("<div></div>").attr("id",r.o.overlayId).addClass("simplemodal-overlay").css(e.extend(r.o.overlayCss,{display:"none",opacity:r.o.opacity/100,height:r.o.modal?t[0]:0,width:r.o.modal?t[1]:0,position:"fixed",left:0,top:0,zIndex:r.o.zIndex+1})).appendTo(r.o.appendTo),r.d.container=e("<div></div>").attr("id",r.o.containerId).addClass("simplemodal-container").css(e.extend({position:r.o.fixed?"fixed":"absolute"},r.o.containerCss,{display:"none",zIndex:r.o.zIndex+2})).append(r.o.close&&r.o.closeHTML?e(r.o.closeHTML).addClass(r.o.closeClass):"").appendTo(r.o.appendTo),r.d.wrap=e("<div></div>").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(r.d.container),r.d.data=n.attr("id",n.attr("id")||r.o.dataId).addClass("simplemodal-data").css(e.extend(r.o.dataCss,{display:"none"})).appendTo("body"),n=null,r.setContainerDimensions(),r.d.data.appendTo(r.d.wrap),(o.ie6||o.ieQuirks)&&r.fixIE()},bindEvents:function(){var r=this;e("."+r.o.closeClass).bind("click.simplemodal",function(e){e.preventDefault(),r.close()}),r.o.modal&&r.o.close&&r.o.overlayClose&&r.d.overlay.bind("click.simplemodal",function(e){e.preventDefault(),r.close()}),n.bind("keydown.simplemodal",function(e){r.o.modal&&e.keyCode===9?r.watchTab(e):r.o.close&&r.o.escClose&&e.keyCode===27&&(e.preventDefault(),r.close())}),i.bind("resize.simplemodal orientationchange.simplemodal",function(){r.getDimensions(),r.o.autoResize?r.setContainerDimensions():r.o.autoPosition&&r.setPosition(),o.ie6||o.ieQuirks?r.fixIE():r.o.modal&&(r.d.iframe&&r.d.iframe.css({height:s[0],width:s[1]}),r.d.overlay.css({height:t[0],width:t[1]}))})},unbindEvents:function(){e("."+this.o.closeClass).unbind("click.simplemodal"),n.unbind("keydown.simplemodal"),i.unbind(".simplemodal"),this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var t=this,n=t.o.position;e.each([t.d.iframe||null,t.o.modal?t.d.overlay:null,t.d.container.css("position")==="fixed"?t.d.container:null],function(e,t){if(t){var r="document.body.clientHeight",i="document.body.clientWidth",s="document.body.scrollHeight",o="document.body.scrollLeft",u="document.body.scrollTop",a="document.body.scrollWidth",f="document.documentElement.clientHeight",l="document.documentElement.clientWidth",c="document.documentElement.scrollLeft",h="document.documentElement.scrollTop",d=t[0].style;d.position="absolute";if(e<2)d.removeExpression("height"),d.removeExpression("width"),d.setExpression("height",""+s+" > "+r+" ? "+s+" : "+r+' + "px"'),d.setExpression("width",""+a+" > "+i+" ? "+a+" : "+i+' + "px"');else{var v,m;if(n&&n.constructor===Array){var g=n[0]?typeof n[0]=="number"?n[0].toString():n[0].replace(/px/,""):t.css("top").replace(/px/,"");v=g.indexOf("%")===-1?g+" + (t = "+h+" ? "+h+" : "+u+') + "px"':parseInt(g.replace(/%/,""))+" * (("+f+" || "+r+") / 100) + (t = "+h+" ? "+h+" : "+u+') + "px"';if(n[1]){var y=typeof n[1]=="number"?n[1].toString():n[1].replace(/px/,"");m=y.indexOf("%")===-1?y+" + (t = "+c+" ? "+c+" : "+o+') + "px"':parseInt(y.replace(/%/,""))+" * (("+l+" || "+i+") / 100) + (t = "+c+" ? "+c+" : "+o+') + "px"'}}else v="("+f+" || "+r+") / 2 - (this.offsetHeight / 2) + (t = "+h+" ? "+h+" : "+u+') + "px"',m="("+l+" || "+i+") / 2 - (this.offsetWidth / 2) + (t = "+c+" ? "+c+" : "+o+') + "px"';d.removeExpression("top"),d.removeExpression("left"),d.setExpression("top",v),d.setExpression("left",m)}}})},focus:function(t){var n=this,r=t&&e.inArray(t,["first","last"])!==-1?t:"first",i=e(":input:enabled:visible:"+r,n.d.wrap);setTimeout(function(){i.length>0?i.focus():n.d.wrap.focus()},10)},getDimensions:function(){var e=this,r=typeof window.innerHeight=="undefined"?i.height():window.innerHeight;t=[n.height(),n.width()],s=[r,i.width()]},getVal:function(e,t){return e?typeof e=="number"?e:e==="auto"?0:e.indexOf("%")>0?parseInt(e.replace(/%/,""))/100*(t==="h"?s[0]:s[1]):parseInt(e.replace(/px/,"")):null},update:function(e,t){var n=this;if(!n.d.data)return!1;n.d.origHeight=n.getVal(e,"h"),n.d.origWidth=n.getVal(t,"w"),n.d.data.hide(),e&&n.d.container.css("height",e),t&&n.d.container.css("width",t),n.setContainerDimensions(),n.d.data.show(),n.o.focus&&n.focus(),n.unbindEvents(),n.bindEvents()},setContainerDimensions:function(){var e=this,t=o.ie6||o.ie7,n=e.d.origHeight?e.d.origHeight:o.opera?e.d.container.height():e.getVal(t?e.d.container[0].currentStyle.height:e.d.container.css("height"),"h"),r=e.d.origWidth?e.d.origWidth:o.opera?e.d.container.width():e.getVal(t?e.d.container[0].currentStyle.width:e.d.container.css("width"),"w"),i=e.d.data.outerHeight(!0),u=e.d.data.outerWidth(!0);e.d.origHeight=e.d.origHeight||n,e.d.origWidth=e.d.origWidth||r;var a=e.o.maxHeight?e.getVal(e.o.maxHeight,"h"):null,f=e.o.maxWidth?e.getVal(e.o.maxWidth,"w"):null,l=a&&a<s[0]?a:s[0],c=f&&f<s[1]?f:s[1],h=e.o.minHeight?e.getVal(e.o.minHeight,"h"):"auto";n?n=e.o.autoResize&&n>l?l:n<h?h:n:i?i>l?n=l:e.o.minHeight&&h!=="auto"&&i<h?n=h:n=i:n=h;var p=e.o.minWidth?e.getVal(e.o.minWidth,"w"):"auto";r?r=e.o.autoResize&&r>c?c:r<p?p:r:u?u>c?r=c:e.o.minWidth&&p!=="auto"&&u<p?r=p:r=u:r=p,e.d.container.css({height:n,width:r}),e.d.wrap.css({overflow:i>n||u>r?"auto":"visible"}),e.o.autoPosition&&e.setPosition()},setPosition:function(){var e=this,t,n,r=s[0]/2-e.d.container.outerHeight(!0)/2,o=s[1]/2-e.d.container.outerWidth(!0)/2,u=e.d.container.css("position")!=="fixed"?i.scrollTop():0;e.o.position&&Object.prototype.toString.call(e.o.position)==="[object Array]"?(t=u+(e.o.position[0]||r),n=e.o.position[1]||o):(t=u+r,n=o),e.d.container.css({left:n,top:t})},watchTab:function(t){var n=this;if(e(t.target).parents(".simplemodal-container").length>0){n.inputs=e(":input:enabled:visible:first, :input:enabled:visible:last",n.d.data[0]);if(!t.shiftKey&&t.target===n.inputs[n.inputs.length-1]||t.shiftKey&&t.target===n.inputs[0]||n.inputs.length===0){t.preventDefault();var r=t.shiftKey?"last":"first";n.focus(r)}}else t.preventDefault(),n.focus()},open:function(){var t=this;t.d.iframe&&t.d.iframe.show(),e.isFunction(t.o.onOpen)?t.o.onOpen.apply(t,[t.d]):(t.d.overlay.show(),t.d.container.show(),t.d.data.show()),t.o.focus&&t.focus(),t.bindEvents()},close:function(){var t=this;if(!t.d.data)return!1;t.unbindEvents();if(e.isFunction(t.o.onClose)&&!t.occb)t.occb=!0,t.o.onClose.apply(t,[t.d]);else{if(t.d.placeholder){var n=e("#simplemodal-placeholder");t.o.persist?n.replaceWith(t.d.data.removeClass("simplemodal-data").css("display",t.display)):(t.d.data.hide().remove(),n.replaceWith(t.d.orig))}else t.d.data.hide().remove();t.d.container.hide().remove(),t.d.overlay.hide(),t.d.iframe&&t.d.iframe.hide().remove(),t.d.overlay.remove(),t.d={}}}}}),define("app/views/add-repo",["jquery","simplemodal","underscore","backbone","common"],function(e,t,n,r,i){var s=r.View.extend({tagName:"div",template:n.template(e("#create-repo-tmpl").html()),initialize:function(t){this.repos=t,this.render(),this.$el.modal(),e("#simplemodal-container").css({height:"auto"}),this.listenTo(t,"invalid",this.displayValidationErrors)},render:function(){return this.$el.html(this.template(this.templateData())),this},templateData:function(){return{showSharePerm:!1}},events:{submit:"addRepo","click #encrypt-switch":"togglePasswdInput"},newAttributes:function(){return{name:e.trim(e("input[name=repo_name]",this.$el).val()),encrypted:e("#encrypt-switch").prop("checked"),passwd1:e("input[name=passwd]",this.$el).val(),passwd2:e("input[name=passwd_again]",this.$el).val(),passwd:e("input[name=passwd]",this.$el).val()}},displayValidationErrors:function(e,t,n){this.$(".error").html(t).show(),i.enableButton(this.$('[type="submit"]'))},addRepo:function(e){e.preventDefault(),i.disableButton(this.$('[type="submit"]'));var t=this.repos;t.create(this.newAttributes(),{wait:!0,validate:!0,prepend:!0,success:function(){t.length==1&&t.reset(t.models)},error:function(e,t,n){i.feedback("Error","error",i.ERROR_TIMEOUT)},complete:function(){i.closeModal()}})},togglePasswdInput:function(t){var n=e("#encrypt-switch"),r=this.$('input[type="password"]');n.parent().toggleClass("checkbox-checked"),n.prop("checked")?r.attr("disabled",!1).removeClass("input-disabled"):r.attr("disabled",!0).addClass("input-disabled")}});return s}),define("app/views/myhome-repos",["jquery","underscore","backbone","common","app/collections/repos","app/views/repo","app/views/add-repo"],function(e,t,n,r,i,s,o){var u=n.View.extend({el:e("#repo-tabs"),reposHdTemplate:t.template(e("#my-repos-hd-tmpl").html()),events:{"click .repo-create":"createRepo","click #my-own-repos .by-name":"sortByName","click #my-own-repos .by-time":"sortByTime"},initialize:function(t){this.$tabs=e("#repo-tabs"),this.$table=this.$("#my-own-repos table"),this.$tableHead=e("thead",this.$table),this.$tableBody=e("tbody",this.$table),this.$loadingTip=e(".loading-tip",this.$tabs),this.$emptyTip=e("#my-own-repos .empty-tips"),this.$repoCreateBtn=this.$(".repo-create"),this.repos=new i,this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset)},addOne:function(e,t,n){var r=new s({model:e});n.prepend?this.$tableBody.prepend(r.render().el):this.$tableBody.append(r.render().el)},renderReposHd:function(){this.$tableHead.html(this.reposHdTemplate())},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.repos.length?(this.$emptyTip.hide(),this.renderReposHd(),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.$table.show()):(this.$table.hide(),this.$emptyTip.show()),app.pageOptions.guide_enabled&&(e("#guide-for-new").modal({appendTo:"#main",focus:!1}),app.pageOptions.guide_enabled=!1)},showMyRepos:function(){this.$tabs.show(),e("#mylib-tab").parent().addClass("ui-state-active"),this.$table.hide();var t=this.$loadingTip;t.show();var n=this;this.repos.fetch({cache:!1,reset:!0,success:function(e,t,n){},error:function(e,r,i){t.hide();var s=n.$(".error"),o;r.responseText?r["status"]==401||r["status"]==403?o=gettext("Permission error"):o=gettext("Error"):o=gettext("Please check the network."),s.html(o).show()}})},show:function(){this.$repoCreateBtn.show(),this.showMyRepos()},hide:function(){this.$repoCreateBtn.hide(),this.$el.hide(),this.$table.hide(),this.$emptyTip.hide(),e("#mylib-tab",this.$tabs).parent().removeClass("ui-state-active")},createRepo:function(){new o(this.repos)},sortByName:function(){e(".by-time .sort-icon").hide();var t=this.repos,n=e(".by-name .sort-icon",this.$table);t.comparator=function(e,t){var i=r.compareTwoWord(e.get("name"),t.get("name"));return n.hasClass("icon-caret-up")?-i:i},t.sort(),this.$tableBody.empty(),t.each(this.addOne,this),n.toggleClass("icon-caret-up icon-caret-down").show(),t.comparator=null},sortByTime:function(){e(".by-name .sort-icon").hide();var t=this.repos,n=e(".by-time .sort-icon",this.$table);t.comparator=function(e,t){return n.hasClass("icon-caret-down")?e.get("mtime")<t.get("mtime")?1:-1:e.get("mtime")<t.get("mtime")?-1:1},t.sort(),this.$tableBody.empty(),t.each(this.addOne,this),n.toggleClass("icon-caret-up icon-caret-down").show(),t.comparator=null}});return u}),function(){if(jQuery&&jQuery.jstree)return;var e=!1,t=!1,n=!1;(function(r){r.vakata={},r.vakata.css={get_css:function(e,t,n){e=e.toLowerCase();var r=n.cssRules||n.rules,i=0;do{if(r.length&&i>r.length+5)return!1;if(r[i].selectorText&&r[i].selectorText.toLowerCase()==e)return t===!0?(n.removeRule&&n.removeRule(i),n.deleteRule&&n.deleteRule(i),!0):r[i]}while(r[++i]);return!1},add_css:function(e,t){return r.jstree.css.get_css(e,!1,t)?!1:(t.insertRule?t.insertRule(e+" { }",0):t.addRule(e,null,0),r.vakata.css.get_css(e))},remove_css:function(e,t){return r.vakata.css.get_css(e,!0,t)},add_sheet:function(e){var t=!1,n=!0;if(e.str)return e.title&&(t=r("style[id='"+e.title+"-stylesheet']")[0]),t?n=!1:(t=document.createElement("style"),t.setAttribute("type","text/css"),e.title&&t.setAttribute("id",e.title+"-stylesheet")),t.styleSheet?n?(document.getElementsByTagName("head")[0].appendChild(t),t.styleSheet.cssText=e.str):t.styleSheet.cssText=t.styleSheet.cssText+" "+e.str:(t.appendChild(document.createTextNode(e.str)),document.getElementsByTagName("head")[0].appendChild(t)),t.sheet||t.styleSheet;if(e.url){if(!document.createStyleSheet)return t=document.createElement("link"),t.rel="stylesheet",t.type="text/css",t.media="all",t.href=e.url,document.getElementsByTagName("head")[0].appendChild(t),t.styleSheet;try{t=document.createStyleSheet(e.url)}catch(i){}}}};var i=[],s=-1,o={},u={};r.fn.jstree=function(e){var t=typeof e=="string",n=Array.prototype.slice.call(arguments,1),s=this;if(t){if(e.substring(0,1)=="_")return s;this.each(function(){var t=i[r.data(this,"jstree-instance-id")],o=t&&r.isFunction(t[e])?t[e].apply(t,n):t;if(typeof o!="undefined"&&(e.indexOf("is_")===0||o!==!0&&o!==!1))return s=o,!1})}else this.each(function(){var t=r.data(this,"jstree-instance-id"),s=[],u=e?r.extend({},!0,e):{},a=r(this),f=!1,l=[];s=s.concat(n),a.data("jstree")&&s.push(a.data("jstree")),u=s.length?r.extend.apply(null,[!0,u].concat(s)):u,typeof t!="undefined"&&i[t]&&i[t].destroy(),t=parseInt(i.push({}),10)-1,r.data(this,"jstree-instance-id",t),u.plugins=r.isArray(u.plugins)?u.plugins:r.jstree.defaults.plugins.slice(),u.plugins.unshift("core"),u.plugins=u.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(","),f=r.extend(!0,{},r.jstree.defaults,u),f.plugins=u.plugins,r.each(o,function(e,t){r.inArray(e,f.plugins)===-1?(f[e]=null,delete f[e]):l.push(e)}),f.plugins=l,i[t]=new r.jstree._instance(t,r(this).addClass("jstree jstree-"+t),f),r.each(i[t]._get_settings().plugins,function(e,n){i[t].data[n]={}}),r.each(i[t]._get_settings().plugins,function(e,n){o[n]&&o[n].__init.apply(i[t])}),setTimeout(function(){i[t].init()},0)});return s},r.jstree={defaults:{plugins:[]},_focused:function(){return i[s]||null},_reference:function(e){if(i[e])return i[e];var t=r(e);return!t.length&&typeof e=="string"&&(t=r("#"+e)),t.length?i[t.closest(".jstree").data("jstree-instance-id")]||null:null},_instance:function(e,t,n){this.data={core:{}},this.get_settings=function(){return r.extend(!0,{},n)},this._get_settings=function(){return n},this.get_index=function(){return e},this.get_container=function(){return t},this.get_container_ul=function(){return t.children("ul:eq(0)")},this._set_settings=function(e){n=r.extend(!0,{},n,e)}},_fn:{},plugin:function(e,t){t=r.extend({},{__init:r.noop,__destroy:r.noop,_fn:{},defaults:!1},t),o[e]=t,r.jstree.defaults[e]=t.defaults,r.each(t._fn,function(t,n){n.plugin=e,n.old=r.jstree._fn[t],r.jstree._fn[t]=function(){var e,i=n,s=Array.prototype.slice.call(arguments),o=new r.Event("before.jstree"),u=!1;if(this.data.core.locked===!0&&t!=="unlock"&&t!=="is_locked")return;do{if(i&&i.plugin&&r.inArray(i.plugin,this._get_settings().plugins)!==-1)break;i=i.old}while(i);if(!i)return;if(t.indexOf("_")===0)e=i.apply(this,s);else{e=this.get_container().triggerHandler(o,{func:t,inst:this,args:s,plugin:i.plugin});if(e===!1)return;typeof e!="undefined"&&(s=e),e=i.apply(r.extend({},this,{__callback:function(e){this.get_container().triggerHandler(t+".jstree",{inst:this,args:s,rslt:e,rlbk:u})},__rollback:function(){return u=this.get_rollback(),u},__call_old:function(e){return i.old.apply(this,e?Array.prototype.slice.call(arguments,1):s)}}),s)}return e},r.jstree._fn[t].old=n.old,r.jstree._fn[t].plugin=e})},rollback:function(e){e&&(r.isArray(e)||(e=[e]),r.each(e,function(e,t){i[t.i].set_rollback(t.h,t.d)}))}},r.jstree._fn=r.jstree._instance.prototype={},r(function(){var i=navigator.userAgent.toLowerCase(),s=(i.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],o=".jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } .jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } .jstree-rtl li { margin-left:0; margin-right:18px; } .jstree > ul > li { margin-left:0px; } .jstree-rtl > ul > li { margin-right:0px; } .jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } .jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } .jstree a:focus { outline: none; } .jstree a > ins { height:16px; width:16px; } .jstree a > .jstree-icon { margin-right:3px; } .jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } ";if(/msie/.test(i)&&parseInt(s,10)==6){e=!0;try{document.execCommand("BackgroundImageCache",!1,!0)}catch(u){}o+=".jstree li { height:18px; margin-left:0; margin-right:0; } .jstree li li { margin-left:18px; } .jstree-rtl li li { margin-left:0px; margin-right:18px; } li.jstree-open ul { display:block; } li.jstree-closed ul { display:none !important; } .jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } .jstree li a ins { height:16px; width:16px; margin-right:3px; } .jstree-rtl li a ins { margin-right:0px; margin-left:3px; } "}/msie/.test(i)&&parseInt(s,10)==7&&(t=!0,o+=".jstree li a { border-width:0 !important; padding:0px 2px !important; } "),!/compatible/.test(i)&&/mozilla/.test(i)&&parseFloat(s,10)<1.9&&(n=!0,o+=".jstree ins { display:-moz-inline-box; } .jstree li { line-height:12px; } .jstree a { display:-moz-inline-box; } .jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } "),r.vakata.css.add_sheet({str:o,title:"jstree"})}),r.jstree.plugin("core",{__init:function(){this.data.core.locked=!1,this.data.core.to_open=this.get_settings().core.initially_open,this.data.core.to_load=this.get_settings().core.initially_load},defaults:{html_titles:!1,animation:500,initially_open:[],initially_load:[],open_parents:!0,notify_plugins:!0,rtl:!1,load_open:!1,strings:{loading:"Loading ...",new_node:"New node",multiple_selection:"Multiple selection"}},_fn:{init:function(){this.set_focus(),this._get_settings().core.rtl&&this.get_container().addClass("jstree-rtl").css("direction","rtl"),this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins>&#160;</ins><a class='jstree-loading' href='#'><ins class='jstree-icon'>&#160;</ins>"+this._get_string("loading")+"</a></li></ul>"),this.data.core.li_height=this.get_container_ul().find("li.jstree-closed, li.jstree-leaf").eq(0).height()||18,this.get_container().delegate("li > ins","click.jstree",r.proxy(function(e){var t=r(e.target);t.is("ins")&&e.pageY-t.offset().top<this.data.core.li_height&&this.toggle_node(t)},this)).bind("mousedown.jstree",r.proxy(function(){this.set_focus()},this)).bind("dblclick.jstree",function(e){var t;if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){t=window.getSelection();try{t.removeAllRanges(),t.collapse()}catch(n){}}}),this._get_settings().core.notify_plugins&&this.get_container().bind("load_node.jstree",r.proxy(function(e,t){var n=this._get_node(t.rslt.obj),i=this;n===-1&&(n=this.get_container_ul());if(!n.length)return;n.find("li").each(function(){var e=r(this);e.data("jstree")&&r.each(e.data("jstree"),function(t,n){i.data[t]&&r.isFunction(i["_"+t+"_notify"])&&i["_"+t+"_notify"].call(i,e,n)})})},this)),this._get_settings().core.load_open&&this.get_container().bind("load_node.jstree",r.proxy(function(e,t){var n=this._get_node(t.rslt.obj),i=this;n===-1&&(n=this.get_container_ul());if(!n.length)return;n.find("li.jstree-open:not(:has(ul))").each(function(){i.load_node(this,r.noop,r.noop)})},this)),this.__callback(),this.load_node(-1,function(){this.loaded(),this.reload_nodes()})},destroy:function(){var e,t=this.get_index(),n=this._get_settings(),u=this;r.each(n.plugins,function(e,t){try{o[t].__destroy.apply(u)}catch(n){}}),this.__callback();if(this.is_focused())for(e in i)if(i.hasOwnProperty(e)&&e!=t){i[e].set_focus();break}t===s&&(s=-1),this.get_container().unbind(".jstree").undelegate(".jstree").removeData("jstree-instance-id").find("[class^='jstree']").andSelf().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/ig,"")}),r(document).unbind(".jstree-"+t).undelegate(".jstree-"+t),i[t]=null,delete i[t]},_core_notify:function(e,t){t.opened&&this.open_node(e,!1,!0)},lock:function(){this.data.core.locked=!0,this.get_container().children("ul").addClass("jstree-locked").css("opacity","0.7"),this.__callback({})},unlock:function(){this.data.core.locked=!1,this.get_container().children("ul").removeClass("jstree-locked").css("opacity","1"),this.__callback({})},is_locked:function(){return this.data.core.locked},save_opened:function(){var e=this;this.data.core.to_open=[],this.get_container_ul().find("li.jstree-open").each(function(){this.id&&e.data.core.to_open.push("#"+this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"))}),this.__callback(e.data.core.to_open)},save_loaded:function(){},reload_nodes:function(e){var t=this,n=!0,i=[],s=[];e||(this.data.core.reopen=!1,this.data.core.refreshing=!0,this.data.core.to_open=r.map(r.makeArray(this.data.core.to_open),function(e){return"#"+e.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),this.data.core.to_load=r.map(r.makeArray(this.data.core.to_load),function(e){return"#"+e.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),this.data.core.to_open.length&&(this.data.core.to_load=this.data.core.to_load.concat(this.data.core.to_open))),this.data.core.to_load.length&&(r.each(this.data.core.to_load,function(e,t){if(t=="#")return!0;r(t).length?i.push(t):s.push(t)}),i.length&&(this.data.core.to_load=s,r.each(i,function(e,r){t._is_loaded(r)||(t.load_node(r,function(){t.reload_nodes(!0)},function(){t.reload_nodes(!0)}),n=!1)}))),this.data.core.to_open.length&&r.each(this.data.core.to_open,function(e,n){t.open_node(n,!1,!0)}),n&&(this.data.core.reopen&&clearTimeout(this.data.core.reopen),this.data.core.reopen=setTimeout(function(){t.__callback({},t)},50),this.data.core.refreshing=!1,this.reopen())},reopen:function(){var e=this;this.data.core.to_open.length&&r.each(this.data.core.to_open,function(t,n){e.open_node(n,!1,!0)}),this.__callback({})},refresh:function(e){var t=this;this.save_opened(),e||(e=-1),e=this._get_node(e),e||(e=-1),e!==-1?e.children("UL").remove():this.get_container_ul().empty(),this.load_node(e,function(){t.__callback({obj:e}),t.reload_nodes()})},loaded:function(){this.__callback()},set_focus:function(){if(this.is_focused())return;var e=r.jstree._focused();e&&e.unset_focus(),this.get_container().addClass("jstree-focused"),s=this.get_index(),this.__callback()},is_focused:function(){return s==this.get_index()},unset_focus:function(){this.is_focused()&&(this.get_container().removeClass("jstree-focused"),s=-1),this.__callback()},_get_node:function(e){var t=r(e,this.get_container());return t.is(".jstree")||e==-1?-1:(t=t.closest("li",this.get_container()),t.length?t:!1)},_get_next:function(e,t){return e=this._get_node(e),e===-1?this.get_container().find("> ul > li:first-child"):e.length?t?e.nextAll("li").size()>0?e.nextAll("li:eq(0)"):!1:e.hasClass("jstree-open")?e.find("li:eq(0)"):e.nextAll("li").size()>0?e.nextAll("li:eq(0)"):e.parentsUntil(".jstree","li").next("li").eq(0):!1},_get_prev:function(e,t){e=this._get_node(e);if(e===-1)return this.get_container().find("> ul > li:last-child");if(!e.length)return!1;if(t)return e.prevAll("li").length>0?e.prevAll("li:eq(0)"):!1;if(e.prev("li").length){e=e.prev("li").eq(0);while(e.hasClass("jstree-open"))e=e.children("ul:eq(0)").children("li:last");return e}var n=e.parentsUntil(".jstree","li:eq(0)");return n.length?n:!1},_get_parent:function(e){e=this._get_node(e);if(e==-1||!e.length)return!1;var t=e.parentsUntil(".jstree","li:eq(0)");return t.length?t:-1},_get_children:function(e){return e=this._get_node(e),e===-1?this.get_container().children("ul:eq(0)").children("li"):e.length?e.children("ul:eq(0)").children("li"):!1},get_path:function(e,t){var n=[],r=this;return e=this._get_node(e),e===-1||!e||!e.length?!1:(e.parentsUntil(".jstree","li").each(function(){n.push(t?this.id:r.get_text(this))}),n.reverse(),n.push(t?e.attr("id"):this.get_text(e)),n)},_get_string:function(e){return this._get_settings().core.strings[e]||e},is_open:function(e){return e=this._get_node(e),e&&e!==-1&&e.hasClass("jstree-open")},is_closed:function(e){return e=this._get_node(e),e&&e!==-1&&e.hasClass("jstree-closed")},is_leaf:function(e){return e=this._get_node(e),e&&e!==-1&&e.hasClass("jstree-leaf")},correct_state:function(e){e=this._get_node(e);if(!e||e===-1)return!1;e.removeClass("jstree-closed jstree-open").addClass("jstree-leaf").children("ul").remove(),this.__callback({obj:e})},open_node:function(t,n,r){t=this._get_node(t);if(!t.length)return!1;if(!t.hasClass("jstree-closed"))return n&&n.call(),!1;var i=r||e?0:this._get_settings().core.animation,s=this;this._is_loaded(t)?(this._get_settings().core.open_parents&&t.parentsUntil(".jstree",".jstree-closed").each(function(){s.open_node(this,!1,!0)}),i&&t.children("ul").css("display","none"),t.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading"),i?t.children("ul").stop(!0,!0).slideDown(i,function(){this.style.display="",s.after_open(t)}):s.after_open(t),this.__callback({obj:t}),n&&n.call()):(t.children("a").addClass("jstree-loading"),this.load_node(t,function(){s.open_node(t,n,r)},n))},after_open:function(e){this.__callback({obj:e})},close_node:function(t,n){t=this._get_node(t);var r=n||e?0:this._get_settings().core.animation,i=this;if(!t.length||!t.hasClass("jstree-open"))return!1;r&&t.children("ul").attr("style","display:block !important"),t.removeClass("jstree-open").addClass("jstree-closed"),r?t.children("ul").stop(!0,!0).slideUp(r,function(){this.style.display="",i.after_close(t)}):i.after_close(t),this.__callback({obj:t})},after_close:function(e){this.__callback({obj:e})},toggle_node:function(e){e=this._get_node(e);if(e.hasClass("jstree-closed"))return this.open_node(e);if(e.hasClass("jstree-open"))return this.close_node(e)},open_all:function(e,t,n){e=e?this._get_node(e):-1;if(!e||e===-1)e=this.get_container_ul();n?e=e.find("li.jstree-closed"):(n=e,e.is(".jstree-closed")?e=e.find("li.jstree-closed").andSelf():e=e.find("li.jstree-closed"));var r=this;e.each(function(){var e=this;r._is_loaded(this)?r.open_node(this,!1,!t):r.open_node(this,function(){r.open_all(e,t,n)},!t)}),n.find("li.jstree-closed").length===0&&this.__callback({obj:n})},close_all:function(e,t){var n=this;e=e?this._get_node(e):this.get_container();if(!e||e===-1)e=this.get_container_ul();e.find("li.jstree-open").andSelf().each(function(){n.close_node(this,!t)}),this.__callback({obj:e})},clean_node:function(e){e=e&&e!=-1?r(e):this.get_container_ul(),e=e.is("li")?e.find("li").andSelf():e.find("li"),e.removeClass("jstree-last").filter("li:last-child").addClass("jstree-last").end().filter(":has(li)").not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed"),e.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove(),this.__callback({obj:e})},get_rollback:function(){return this.__callback(),{i:this.get_index(),h:this.get_container().children("ul").clone(!0),d:this.data}},set_rollback:function(e,t){this.get_container().empty().append(e),this.data=t,this.__callback()},load_node:function(e,t,n){this.__callback({obj:e})},_is_loaded:function(e){return!0},create_node:function(e,t,n,i,s){e=this._get_node(e),t=typeof t=="undefined"?"last":t;var o=r("<li />"),u=this._get_settings().core,a;if(e!==-1&&!e.length)return!1;if(!s&&!this._is_loaded(e))return this.load_node(e,function(){this.create_node(e,t,n,i,!0)}),!1;this.__rollback(),typeof n=="string"&&(n={data:n}),n||(n={}),n.attr&&o.attr(n.attr),n.metadata&&o.data(n.metadata),n.state&&o.addClass("jstree-"+n.state),n.data||(n.data=this._get_string("new_node")),r.isArray(n.data)||(a=n.data,n.data=[],n.data.push(a)),r.each(n.data,function(e,t){a=r("<a />"),r.isFunction(t)&&(t=t.call(this,n)),typeof t=="string"?a.attr("href","#")[u.html_titles?"html":"text"](t):(t.attr||(t.attr={}),t.attr.href||(t.attr.href="#"),a.attr(t.attr)[u.html_titles?"html":"text"](t.title),t.language&&a.addClass(t.language)),a.prepend("<ins class='jstree-icon'>&#160;</ins>"),t.icon&&(t.icon.indexOf("/")===-1?a.children("ins").addClass(t.icon):a.children("ins").css("background","url('"+t.icon+"') center center no-repeat")),o.append(a)}),o.prepend("<ins class='jstree-icon'>&#160;</ins>"),e===-1&&(e=this.get_container(),t==="before"&&(t="first"),t==="after"&&(t="last"));switch(t){case"before":e.before(o),a=this._get_parent(e);break;case"after":e.after(o),a=this._get_parent(e);break;case"inside":case"first":e.children("ul").length||e.append("<ul />"),e.children("ul").prepend(o),a=e;break;case"last":e.children("ul").length||e.append("<ul />"),e.children("ul").append(o),a=e;break;default:e.children("ul").length||e.append("<ul />"),t||(t=0),a=e.children("ul").children("li").eq(t),a.length?a.before(o):e.children("ul").append(o),a=e}if(a===-1||a.get(0)===this.get_container().get(0))a=-1;return this.clean_node(a),this.__callback({obj:o,parent:a}),i&&i.call(this,o),o},get_text:function(e){e=this._get_node(e);if(!e.length)return!1;var t=this._get_settings().core.html_titles;return e=e.children("a:eq(0)"),t?(e=e.clone(),e.children("INS").remove(),e.html()):(e=e.contents().filter(function(){return this.nodeType==3})[0],e.nodeValue)},set_text:function(e,t){e=this._get_node(e);if(!e.length)return!1;e=e.children("a:eq(0)");if(this._get_settings().core.html_titles){var n=e.children("INS").clone();return e.html(t).prepend(n),this.__callback({obj:e,name:t}),!0}return e=e.contents().filter(function(){return this.nodeType==3})[0],this.__callback({obj:e,name:t}),e.nodeValue=t},rename_node:function(e,t){e=this._get_node(e),this.__rollback(),e&&e.length&&this.set_text.apply(this,Array.prototype.slice.call(arguments))&&this.__callback({obj:e,name:t})},delete_node:function(e){e=this._get_node(e);if(!e.length)return!1;this.__rollback();var t=this._get_parent(e),n=r([]),i=this;return e.each(function(){n=n.add(i._get_prev(this))}),e=e.detach(),t!==-1&&t.find("> ul > li").length===0&&t.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"),this.clean_node(t),this.__callback({obj:e,prev:n,parent:t}),e},prepare_move:function(e,t,n,i,s){var o={};o.ot=r.jstree._reference(e)||this,o.o=o.ot._get_node(e),o.r=t===-1?-1:this._get_node(t),o.p=typeof n=="undefined"||n===!1?"last":n;if(!s&&u.o&&u.o[0]===o.o[0]&&u.r[0]===o.r[0]&&u.p===o.p){this.__callback(u),i&&i.call(this,u);return}o.ot=r.jstree._reference(o.o)||this,o.rt=r.jstree._reference(o.r)||this;if(o.r===-1||!o.r){o.cr=-1;switch(o.p){case"first":case"before":case"inside":o.cp=0;break;case"after":case"last":o.cp=o.rt.get_container().find(" > ul > li").length;break;default:o.cp=o.p}}else{if(!/^(before|after)$/.test(o.p)&&!this._is_loaded(o.r))return this.load_node(o.r,function(){this.prepare_move(e,t,n,i,!0)});switch(o.p){case"before":o.cp=o.r.index(),o.cr=o.rt._get_parent(o.r);break;case"after":o.cp=o.r.index()+1,o.cr=o.rt._get_parent(o.r);break;case"inside":case"first":o.cp=0,o.cr=o.r;break;case"last":o.cp=o.r.find(" > ul > li").length,o.cr=o.r;break;default:o.cp=o.p,o.cr=o.r}}o.np=o.cr==-1?o.rt.get_container():o.cr,o.op=o.ot._get_parent(o.o),o.cop=o.o.index(),o.op===-1&&(o.op=o.ot?o.ot.get_container():this.get_container()),!/^(before|after)$/.test(o.p)&&o.op&&o.np&&o.op[0]===o.np[0]&&o.o.index()<o.cp&&o.cp++,o.or=o.np.find(" > ul > li:nth-child("+(o.cp+1)+")"),u=o,this.__callback(u),i&&i.call(this,u)},check_move:function(){var e=u,t=!0,n=e.r===-1?this.get_container():e.r;return!e||!e.o||e.or[0]===e.o[0]?!1:e.op&&e.np&&e.op[0]===e.np[0]&&e.cp-1===e.o.index()?!1:(e.o.each(function(){if(n.parentsUntil(".jstree","li").andSelf().index(this)!==-1)return t=!1,!1}),t)},move_node:function(e,t,n,i,s,o){if(!s)return this.prepare_move(e,t,n,function(e){this.move_node(e,!1,!1,i,!0,o)});i&&(u.cy=!0);if(!o&&!this.check_move())return!1;this.__rollback();var a=!1;i?(a=e.o.clone(!0),a.find("*[id]").andSelf().each(function(){this.id&&(this.id="copy_"+this.id)})):a=e.o,e.or.length?e.or.before(a):(e.np.children("ul").length||r("<ul />").appendTo(e.np),e.np.children("ul:eq(0)").append(a));try{e.ot.clean_node(e.op),e.rt.clean_node(e.np),e.op.find("> ul > li").length||e.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove()}catch(f){}return i&&(u.cy=!0,u.oc=a),this.__callback(u),u},_get_move:function(){return u}}})})(jQuery),function(e){var t,n,r;e(function(){/msie/.test(navigator.userAgent.toLowerCase())?(n=e('<textarea cols="10" rows="2"></textarea>').css({position:"absolute",top:-1e3,left:0}).appendTo("body"),r=e('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({position:"absolute",top:-1e3,left:0}).appendTo("body"),t=n.width()-r.width(),n.add(r).remove()):(n=e("<div />").css({width:100,height:100,overflow:"auto",position:"absolute",top:-1e3,left:0}).prependTo("body").append("<div />").find("div").css({width:"100%",height:200}),t=100-n.width(),n.parent().remove())}),e.jstree.plugin("ui",{__init:function(){this.data.ui.selected=e(),this.data.ui.last_selected=!1,this.data.ui.hovered=null,this.data.ui.to_select=this.get_settings().ui.initially_select,this.get_container().delegate("a","click.jstree",e.proxy(function(t){t.preventDefault(),t.currentTarget.blur(),e(t.currentTarget).hasClass("jstree-loading")||this.select_node(t.currentTarget,!0,t)},this)).delegate("a","mouseenter.jstree",e.proxy(function(t){e(t.currentTarget).hasClass("jstree-loading")||this.hover_node(t.target)},this)).delegate("a","mouseleave.jstree",e.proxy(function(t){e(t.currentTarget).hasClass("jstree-loading")||this.dehover_node(t.target)},this)).bind("reopen.jstree",e.proxy(function(){this.reselect()},this)).bind("get_rollback.jstree",e.proxy(function(){this.dehover_node(),this.save_selected()},this)).bind("set_rollback.jstree",e.proxy(function(){this.reselect()},this)).bind("close_node.jstree",e.proxy(function(t,n){var r=this._get_settings().ui,i=this._get_node(n.rslt.obj),s=i&&i.length?i.children("ul").find("a.jstree-clicked"):e(),o=this;if(r.selected_parent_close===!1||!s.length)return;s.each(function(){o.deselect_node(this),r.selected_parent_close==="select_parent"&&o.select_node(i)})},this)).bind("delete_node.jstree",e.proxy(function(e,t){var n=this._get_settings().ui.select_prev_on_delete,r=this._get_node(t.rslt.obj),i=r&&r.length?r.find("a.jstree-clicked"):[],s=this;i.each(function(){s.deselect_node(this)}),n&&i.length&&t.rslt.prev.each(function(){if(this.parentNode)return s.select_node(this),!1})},this)).bind("move_node.jstree",e.proxy(function(e,t){t.rslt.cy&&t.rslt.oc.find("a.jstree-clicked").removeClass("jstree-clicked")},this))},defaults:{select_limit:-1,select_multiple_modifier:"ctrl",select_range_modifier:"shift",selected_parent_close:"select_parent",selected_parent_open:!0,select_prev_on_delete:!0,disable_selecting_children:!1,initially_select:[]},_fn:{_get_node:function(t,n){if(typeof t=="undefined"||t===null)return n?this.data.ui.selected:this.data.ui.last_selected;var r=e(t,this.get_container());return r.is(".jstree")||t==-1?-1:(r=r.closest("li",this.get_container()),r.length?r:!1)},_ui_notify:function(e,t){t.selected&&this.select_node(e,!1)},save_selected:function(){var e=this;this.data.ui.to_select=[],this.data.ui.selected.each(function(){this.id&&e.data.ui.to_select.push("#"+this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:"))}),this.__callback(this.data.ui.to_select)},reselect:function(){var t=this,n=this.data.ui.to_select;n=e.map(e.makeArray(n),function(e){return"#"+e.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),e.each(n,function(e,n){n&&n!=="#"&&t.select_node(n)}),this.data.ui.selected=this.data.ui.selected.filter(function(){return this.parentNode}),this.__callback()},refresh:function(e){return this.save_selected(),this.__call_old()},hover_node:function(e){e=this._get_node(e);if(!e.length)return!1;e.hasClass("jstree-hovered")||this.dehover_node(),this.data.ui.hovered=e.children("a").addClass("jstree-hovered").parent(),this._fix_scroll(e),this.__callback({obj:e})},dehover_node:function(){var e=this.data.ui.hovered,t;if(!e||!e.length)return!1;t=e.children("a").removeClass("jstree-hovered").parent(),this.data.ui.hovered[0]===t[0]&&(this.data.ui.hovered=null),this.__callback({obj:e})},select_node:function(e,t,n){e=this._get_node(e);if(e==-1||!e||!e.length)return!1;var r=this._get_settings().ui,i=r.select_multiple_modifier=="on"||r.select_multiple_modifier!==!1&&n&&n[r.select_multiple_modifier+"Key"],s=r.select_range_modifier!==!1&&n&&n[r.select_range_modifier+"Key"]&&this.data.ui.last_selected&&this.data.ui.last_selected[0]!==e[0]&&this.data.ui.last_selected.parent()[0]===e.parent()[0],o=this.is_selected(e),u=!0,a=this;if(t){if(r.disable_selecting_children&&i&&(e.parentsUntil(".jstree","li").children("a.jstree-clicked").length||e.children("ul").find("a.jstree-clicked:eq(0)").length))return!1;u=!1;switch(!0){case s:this.data.ui.last_selected.addClass("jstree-last-selected"),e=e[e.index()<this.data.ui.last_selected.index()?"nextUntil":"prevUntil"](".jstree-last-selected").andSelf(),r.select_limit==-1||e.length<r.select_limit?(this.data.ui.last_selected.removeClass("jstree-last-selected"),this.data.ui.selected.each(function(){this!==a.data.ui.last_selected[0]&&a.deselect_node(this)}),o=!1,u=!0):u=!1;break;case o&&!i:this.deselect_all(),o=!1,u=!0;break;case!o&&!i:if(r.select_limit==-1||r.select_limit>0)this.deselect_all(),u=!0;break;case o&&i:this.deselect_node(e);break;case!o&&i:if(r.select_limit==-1||this.data.ui.selected.length+1<=r.select_limit)u=!0}}u&&!o&&(s||(this.data.ui.last_selected=e),e.children("a").addClass("jstree-clicked"),r.selected_parent_open&&e.parents(".jstree-closed").each(function(){a.open_node(this,!1,!0)}),this.data.ui.selected=this.data.ui.selected.add(e),this._fix_scroll(e.eq(0)),this.__callback({obj:e,e:n}))},_fix_scroll:function(e){var n=this.get_container()[0],r;if(n.scrollHeight>n.offsetHeight){e=this._get_node(e);if(!e||e===-1||!e.length||!e.is(":visible"))return;r=e.offset().top-this.get_container().offset().top,r<0&&(n.scrollTop=n.scrollTop+r-1),r+this.data.core.li_height+(n.scrollWidth>n.offsetWidth?t:0)>n.offsetHeight&&(n.scrollTop=n.scrollTop+(r-n.offsetHeight+this.data.core.li_height+1+(n.scrollWidth>n.offsetWidth?t:0)))}},deselect_node:function(e){e=this._get_node(e);if(!e.length)return!1;this.is_selected(e)&&(e.children("a").removeClass("jstree-clicked"),this.data.ui.selected=this.data.ui.selected.not(e),this.data.ui.last_selected.get(0)===e.get(0)&&(this.data.ui.last_selected=this.data.ui.selected.eq(0)),this.__callback({obj:e}))},toggle_select:function(e){e=this._get_node(e);if(!e.length)return!1;this.is_selected(e)?this.deselect_node(e):this.select_node(e)},is_selected:function(e){return this.data.ui.selected.index(this._get_node(e))>=0},get_selected:function(t){return t?e(t).find("a.jstree-clicked").parent():this.data.ui.selected},deselect_all:function(t){var n=t?e(t).find("a.jstree-clicked").parent():this.get_container().find("a.jstree-clicked").parent();n.children("a.jstree-clicked").removeClass("jstree-clicked"),this.data.ui.selected=e([]),this.data.ui.last_selected=!1,this.__callback({obj:n})}}}),e.jstree.defaults.plugins.push("ui")}(jQuery),function(e){var t=[];e.jstree._themes=!1,e.jstree.plugin("themes",{__init:function(){this.get_container().bind("init.jstree",e.proxy(function(){var e=this._get_settings().themes;this.data.themes.dots=e.dots,this.data.themes.icons=e.icons,this.set_theme(e.theme,e.url)},this)).bind("loaded.jstree",e.proxy(function(){this.data.themes.dots?this.show_dots():this.hide_dots(),this.data.themes.icons?this.show_icons():this.hide_icons()},this))},defaults:{theme:"default",url:!1,dots:!0,icons:!0},_fn:{set_theme:function(n,r){if(!n)return!1;r||(r=e.jstree._themes+n+"/style.css"),e.inArray(r,t)==-1&&(e.vakata.css.add_sheet({url:r}),t.push(r)),this.data.themes.theme!=n&&(this.get_container().removeClass("jstree-"+this.data.themes.theme),this.data.themes.theme=n),this.get_container().addClass("jstree-"+n),this.data.themes.dots?this.show_dots():this.hide_dots(),this.data.themes.icons?this.show_icons():this.hide_icons(),this.__callback()},get_theme:function(){return this.data.themes.theme},show_dots:function(){this.data.themes.dots=!0,this.get_container().children("ul").removeClass("jstree-no-dots")},hide_dots:function(){this.data.themes.dots=!1,this.get_container().children("ul").addClass("jstree-no-dots")},toggle_dots:function(){this.data.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this.data.themes.icons=!0,this.get_container().children("ul").removeClass("jstree-no-icons")},hide_icons:function(){this.data.themes.icons=!1,this.get_container().children("ul").addClass("jstree-no-icons")},toggle_icons:function(){this.data.themes.icons?this.hide_icons():this.show_icons()}}}),e(function(){e.jstree._themes===!1&&e("script").each(function(){if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/))return e.jstree._themes=this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/,"")+"themes/",!1}),e.jstree._themes===!1&&(e.jstree._themes="themes/")}),e.jstree.defaults.plugins.push("themes")}(jQuery),function(e){e.jstree.plugin("json_data",{__init:function(){var e=this._get_settings().json_data;e.progressive_unload&&this.get_container().bind("after_close.jstree",function(e,t){t.rslt.obj.children("ul").remove()})},defaults:{data:!1,ajax:!1,correct_state:!0,progressive_render:!1,progressive_unload:!1},_fn:{load_node:function(e,t,n){var r=this;this.load_node_json(e,function(){r.__callback({obj:r._get_node(e)}),t.call(this)},n)},_is_loaded:function(t){var n=this._get_settings().json_data;return t=this._get_node(t),t==-1||!t||!n.ajax&&!n.progressive_render&&!e.isFunction(n.data)||t.is(".jstree-open, .jstree-leaf")||t.children("ul").children("li").length>0},refresh:function(t){t=this._get_node(t);var n=this._get_settings().json_data;return t&&t!==-1&&n.progressive_unload&&(e.isFunction(n.data)||!!n.ajax)&&t.removeData("jstree-children"),this.__call_old()},load_node_json:function(t,n,r){var i=this.get_settings().json_data,s,o=function(){},u=function(){};t=this._get_node(t);if(t&&t!==-1&&(i.progressive_render||i.progressive_unload)&&!t.is(".jstree-open, .jstree-leaf")&&t.children("ul").children("li").length===0&&t.data("jstree-children")){s=this._parse_json(t.data("jstree-children"),t),s&&(t.append(s),i.progressive_unload||t.removeData("jstree-children")),this.clean_node(t),n&&n.call(this);return}if(t&&t!==-1){if(t.data("jstree-is-loading"))return;t.data("jstree-is-loading",!0)}switch(!0){case!i.data&&!i.ajax:throw"Neither data nor ajax settings supplied.";case e.isFunction(i.data):i.data.call(this,t,e.proxy(function(e){e=this._parse_json(e,t),e?(t===-1||!t?this.get_container().children("ul").empty().append(e.children()):(t.append(e).children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree-is-loading")),this.clean_node(t),n&&n.call(this)):(t===-1||!t?i.correct_state&&this.get_container().children("ul").empty():(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree-is-loading"),i.correct_state&&this.correct_state(t)),r&&r.call(this))},this));break;case!!i.data&&!i.ajax||!!i.data&&!!i.ajax&&(!t||t===-1):if(!t||t==-1)s=this._parse_json(i.data,t),s?(this.get_container().children("ul").empty().append(s.children()),this.clean_node()):i.correct_state&&this.get_container().children("ul").empty();n&&n.call(this);break;case!i.data&&!!i.ajax||!!i.data&&!!i.ajax&&t&&t!==-1:o=function(e,n,s){var o=this.get_settings().json_data.ajax.error;o&&o.call(this,e,n,s),t!=-1&&t.length?(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree-is-loading"),n==="success"&&i.correct_state&&this.correct_state(t)):n==="success"&&i.correct_state&&this.get_container().children("ul").empty(),r&&r.call(this)},u=function(r,s,u){var a=this.get_settings().json_data.ajax.success;a&&(r=a.call(this,r,s,u)||r);if(r===""||r&&r.toString&&r.toString().replace(/^[\s\n]+$/,"")===""||!e.isArray(r)&&!e.isPlainObject(r))return o.call(this,u,s,"");r=this._parse_json(r,t),r?(t===-1||!t?this.get_container().children("ul").empty().append(r.children()):(t.append(r).children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree-is-loading")),this.clean_node(t),n&&n.call(this)):t===-1||!t?i.correct_state&&(this.get_container().children("ul").empty(),n&&n.call(this)):(t.children("a.jstree-loading").removeClass("jstree-loading"),t.removeData("jstree-is-loading"),i.correct_state&&(this.correct_state(t),n&&n.call(this)))},i.ajax.context=this,i.ajax.error=o,i.ajax.success=u,i.ajax.dataType||(i.ajax.dataType="json"),e.isFunction(i.ajax.url)&&(i.ajax.url=i.ajax.url.call(this,t)),e.isFunction(i.ajax.data)&&(i.ajax.data=i.ajax.data.call(this,t)),e.ajax(i.ajax)}},_parse_json:function(t,n,r){var i=!1,s=this._get_settings(),o=s.json_data,u=s.core.html_titles,a,f,l,c,h;if(!t)return i;o.progressive_unload&&n&&n!==-1&&n.data("jstree-children",i);if(e.isArray(t)){i=e();if(!t.length)return!1;for(f=0,l=t.length;f<l;f++)a=this._parse_json(t[f],n,!0),a.length&&(i=i.add(a))}else{typeof t=="string"&&(t={data:t});if(!t.data&&t.data!=="")return i;i=e("<li />"),t.attr&&i.attr(t.attr),t.metadata&&i.data(t.metadata),t.state&&i.addClass("jstree-"+t.state),e.isArray(t.data)||(a=t.data,t.data=[],t.data.push(a)),e.each(t.data,function(n,r){a=e("<a />"),e.isFunction(r)&&(r=r.call(this,t)),typeof r=="string"?a.attr("href","#")[u?"html":"text"](r):(r.attr||(r.attr={}),r.attr.href||(r.attr.href="#"),a.attr(r.attr)[u?"html":"text"](r.title),r.language&&a.addClass(r.language)),a.prepend("<ins class='jstree-icon'>&#160;</ins>"),!r.icon&&t.icon&&(r.icon=t.icon),r.icon&&(r.icon.indexOf("/")===-1?a.children("ins").addClass(r.icon):a.children("ins").css("background","url('"+r.icon+"') center center no-repeat")),i.append(a)}),i.prepend("<ins class='jstree-icon'>&#160;</ins>"),t.children&&(o.progressive_render&&t.state!=="open"?i.addClass("jstree-closed").data("jstree-children",t.children):(o.progressive_unload&&i.data("jstree-children",t.children),e.isArray(t.children)&&t.children.length&&(a=this._parse_json(t.children,n,!0),a.length&&(h=e("<ul />"),h.append(a),i.append(h)))))}return r||(c=e("<ul />"),c.append(i),i=c),i},get_json:function(t,n,r,i){var s=[],o=this._get_settings(),u=this,a,f,l,c,h,p;t=this._get_node(t);if(!t||t===-1)t=this.get_container().find("> ul > li");return n=e.isArray(n)?n:["id","class"],!i&&this.data.types&&n.push(o.types.type_attr),r=e.isArray(r)?r:[],t.each(function(){l=e(this),a={data:[]},n.length&&(a.attr={}),e.each(n,function(e,t){f=l.attr(t),f&&f.length&&f.replace(/jstree[^ ]*/ig,"").length&&(a.attr[t]=(" "+f).replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,""))}),l.hasClass("jstree-open")&&(a.state="open"),l.hasClass("jstree-closed")&&(a.state="closed"),l.data()&&(a.metadata=l.data()),c=l.children("a"),c.each(function(){h=e(this),r.length||e.inArray("languages",o.plugins)!==-1||h.children("ins").get(0).style.backgroundImage.length||h.children("ins").get(0).className&&h.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").length?(p=!1,e.inArray("languages",o.plugins)!==-1&&e.isArray(o.languages)&&o.languages.length&&e.each(o.languages,function(e,t){if(h.hasClass(t))return p=t,!1}),f={attr:{},title:u.get_text(h,p)},e.each(r,function(e,t){f.attr[t]=(" "+(h.attr(t)||"")).replace(/ jstree[^ ]*/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")}),e.inArray("languages",o.plugins)!==-1&&e.isArray(o.languages)&&o.languages.length&&e.each(o.languages,function(e,t){if(h.hasClass(t))return f.language=t,!0}),h.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/^\s+$/ig,"").length&&(f.icon=h.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,"").replace(/\s+$/ig," ").replace(/^ /,"").replace(/ $/,"")),h.children("ins").get(0).style.backgroundImage.length&&(f.icon=h.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")",""))):f=u.get_text(h),c.length>1?a.data.push(f):a.data=f}),l=l.find("> ul > li"),l.length&&(a.children=u.get_json(l,n,r,!0)),s.push(a)}),s}}})}(jQuery),function(e){e.jstree.plugin("checkbox",{__init:function(){this.data.checkbox.noui=this._get_settings().checkbox.override_ui,this.data.ui&&this.data.checkbox.noui&&(this.select_node=this.deselect_node=this.deselect_all=e.noop,this.get_selected=this.get_checked),this.get_container().bind("open_node.jstree create_node.jstree clean_node.jstree refresh.jstree",e.proxy(function(e,t){this._prepare_checkboxes(t.rslt.obj)},this)).bind("loaded.jstree",e.proxy(function(e){this._prepare_checkboxes()},this)).delegate(this.data.ui&&this.data.checkbox.noui?"a":"ins.jstree-checkbox","click.jstree",e.proxy(function(e){e.preventDefault(),this._get_node(e.target).hasClass("jstree-checked")?this.uncheck_node(e.target):this.check_node(e.target);if(!this.data.ui||!this.data.checkbox.noui)return e.stopImmediatePropagation(),!1;this.save_selected(),this.data.cookies&&this.save_cookie("select_node")},this))},defaults:{override_ui:!1,two_state:!1,real_checkboxes:!1,checked_parent_open:!0,real_checkboxes_names:function(e){return["check_"+(e[0].id||Math.ceil(Math.random()*1e4)),1]}},__destroy:function(){this.get_container().find("input.jstree-real-checkbox").removeClass("jstree-real-checkbox").end().find("ins.jstree-checkbox").remove()},_fn:{_checkbox_notify:function(e,t){t.checked&&this.check_node(e,!1)},_prepare_checkboxes:function(t){t=!t||t==-1?this.get_container().find("> ul > li"):this._get_node(t);if(t===!1)return;var n,r=this,i,s=this._get_settings().checkbox.two_state,o=this._get_settings().checkbox.real_checkboxes,u=this._get_settings().checkbox.real_checkboxes_names;t.each(function(){i=e(this),n=i.is("li")&&(i.hasClass("jstree-checked")||o&&i.children(":checked").length)?"jstree-checked":"jstree-unchecked",i.find("li").andSelf().each(function(){var t=e(this),i;t.children("a"+(r.data.languages?"":":eq(0)")).not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(s?"jstree-unchecked":n),o&&(t.children(":checkbox").length?t.children(":checkbox").addClass("jstree-real-checkbox"):(i=u.call(r,t),t.prepend("<input type='checkbox' class='jstree-real-checkbox' id='"+i[0]+"' name='"+i[0]+"' value='"+i[1]+"' />")),n==="jstree-checked"&&t.children(":checkbox").attr("checked","checked")),n==="jstree-checked"&&!s&&t.find("li").addClass("jstree-checked")})}),s||(t.length===1&&t.is("li")&&this._repair_state(t),t.is("li")?t.each(function(){r._repair_state(this)}):t.find("> ul > li").each(function(){r._repair_state(this)}),t.find(".jstree-checked").parent().parent().each(function(){r._repair_state(this)}))},change_state:function(t,n){t=this._get_node(t);var r=!1,i=this._get_settings().checkbox.real_checkboxes;if(!t||t===-1)return!1;n=n===!1||n===!0?n:t.hasClass("jstree-checked");if(this._get_settings().checkbox.two_state)n?(t.removeClass("jstree-checked").addClass("jstree-unchecked"),i&&t.children(":checkbox").removeAttr("checked")):(t.removeClass("jstree-unchecked").addClass("jstree-checked"),i&&t.children(":checkbox").attr("checked","checked"));else{if(n){r=t.find("li").andSelf();if(!r.filter(".jstree-checked, .jstree-undetermined").length)return!1;r.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"),i&&r.children(":checkbox").removeAttr("checked")}else{r=t.find("li").andSelf();if(!r.filter(".jstree-unchecked, .jstree-undetermined").length)return!1;r.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked"),i&&r.children(":checkbox").attr("checked","checked"),this.data.ui&&(this.data.ui.last_selected=t),this.data.checkbox.last_selected=t}t.parentsUntil(".jstree","li").each(function(){var t=e(this);if(n){if(t.children("ul").children("li.jstree-checked, li.jstree-undetermined").length)return t.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"),i&&t.parentsUntil(".jstree","li").andSelf().children(":checkbox").removeAttr("checked"),!1;t.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"),i&&t.children(":checkbox").removeAttr("checked")}else{if(t.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length)return t.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"),i&&t.parentsUntil(".jstree","li").andSelf().children(":checkbox").removeAttr("checked"),!1;t.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked"),i&&t.children(":checkbox").attr("checked","checked")}})}return this.data.ui&&this.data.checkbox.noui&&(this.data.ui.selected=this.get_checked()),this.__callback(t),!0},check_node:function(e){if(this.change_state(e,!1)){e=this._get_node(e);if(this._get_settings().checkbox.checked_parent_open){var t=this;e.parents(".jstree-closed").each(function(){t.open_node(this,!1,!0)})}this.__callback({obj:e})}},uncheck_node:function(e){this.change_state(e,!0)&&this.__callback({obj:this._get_node(e)})},check_all:function(){var e=this,t=this._get_settings().checkbox.two_state?this.get_container_ul().find("li"):this.get_container_ul().children("li");t.each(function(){e.change_state(this,!1)}),this.__callback()},uncheck_all:function(){var e=this,t=this._get_settings().checkbox.two_state?this.get_container_ul().find("li"):this.get_container_ul().children("li");t.each(function(){e.change_state(this,!0)}),this.__callback()},is_checked:function(e){return e=this._get_node(e),e.length?e.is(".jstree-checked"):!1},get_checked:function(e,t){return e=!e||e===-1?this.get_container():this._get_node(e),t||this._get_settings().checkbox.two_state?e.find(".jstree-checked"):e.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked")},get_unchecked:function(e,t){return e=!e||e===-1?this.get_container():this._get_node(e),t||this._get_settings().checkbox.two_state?e.find(".jstree-unchecked"):e.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked")},show_checkboxes:function(){this.get_container().children("ul").removeClass("jstree-no-checkboxes")},hide_checkboxes:function(){this.get_container().children("ul").addClass("jstree-no-checkboxes")},_repair_state:function(e){e=this._get_node(e);if(!e.length)return;var t=this._get_settings().checkbox.real_checkboxes,n=e.find("> ul > .jstree-checked").length,r=e.find("> ul > .jstree-undetermined").length,i=e.find("> ul > li").length;i===0?e.hasClass("jstree-undetermined")&&this.change_state(e,!1):n===0&&r===0?this.change_state(e,!0):n===i?this.change_state(e,!1):(e.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined"),t&&e.parentsUntil(".jstree","li").andSelf().children(":checkbox").removeAttr("checked"))},reselect:function(){if(this.data.ui&&this.data.checkbox.noui){var t=this,n=this.data.ui.to_select;n=e.map(e.makeArray(n),function(e){return"#"+e.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")}),this.deselect_all(),e.each(n,function(e,n){t.check_node(n)}),this.__callback()}else this.__call_old()},save_loaded:function(){var e=this;this.data.core.to_load=[],this.get_container_ul().find("li.jstree-closed.jstree-undetermined").each(function(){this.id&&e.data.core.to_load.push("#"+this.id)})}}}),e(function(){var t=".jstree .jstree-real-checkbox { display:none; } ";e.vakata.css.add_sheet({str:t,title:"jstree"})})}(jQuery),function(t){t.jstree.plugin("types",{__init:function(){var n=this._get_settings().types;this.data.types.attach_to=[],this.get_container().bind("init.jstree",t.proxy(function(){var e=n.types,r=n.type_attr,i="",o=this;t.each(e,function(e,n){t.each(n,function(e,t){/^(max_depth|max_children|icon|valid_children)$/.test(e)||o.data.types.attach_to.push(e)});if(!n.icon)return!0;if(n.icon.image||n.icon.position)e=="default"?i+=".jstree-"+o.get_index()+" a > .jstree-icon { ":i+=".jstree-"+o.get_index()+" li["+r+'="'+e+'"] > a > .jstree-icon { ',n.icon.image&&(i+=" background-image:url("+n.icon.image+"); "),n.icon.position?i+=" background-position:"+n.icon.position+"; ":i+=" background-position:0 0; ",i+="} "}),i!==""&&t.vakata.css.add_sheet({str:i,title:"jstree-types"})},this)).bind("before.jstree",t.proxy(function(e,n){var r,i,s=this._get_settings().types.use_data?this._get_node(n.args[0]):!1,o=s&&s!==-1&&s.length?s.data("jstree"):!1;if(o&&o.types&&o.types[n.func]===!1)return e.stopImmediatePropagation(),!1;if(t.inArray(n.func,this.data.types.attach_to)!==-1){if(!n.args[0]||!n.args[0].tagName&&!n.args[0].jquery)return;r=this._get_settings().types.types,i=this._get_type(n.args[0]);if((r[i]&&typeof r[i][n.func]!="undefined"||r["default"]&&typeof r["default"][n.func]!="undefined")&&this._check(n.func,n.args[0])===!1)return e.stopImmediatePropagation(),!1}},this)),e&&this.get_container().bind("load_node.jstree set_type.jstree",t.proxy(function(e,n){var r=n&&n.rslt&&n.rslt.obj&&n.rslt.obj!==-1?this._get_node(n.rslt.obj).parent():this.get_container_ul(),i=!1,s=this._get_settings().types;t.each(s.types,function(e,t){t.icon&&(t.icon.image||t.icon.position)&&(i=e==="default"?r.find("li > a > .jstree-icon"):r.find("li["+s.type_attr+"='"+e+"'] > a > .jstree-icon"),t.icon.image&&i.css("backgroundImage","url("+t.icon.image+")"),i.css("backgroundPosition",t.icon.position||"0 0"))})},this))},defaults:{max_children:-1,max_depth:-1,valid_children:"all",use_data:!1,type_attr:"rel",types:{"default":{max_children:-1,max_depth:-1,valid_children:"all"}}},_fn:{_types_notify:function(e,t){t.type&&this._get_settings().types.use_data&&this.set_type(t.type,e)},_get_type:function(e){return e=this._get_node(e),!e||!e.length?!1:e.attr(this._get_settings().types.type_attr)||"default"},set_type:function(e,t){t=this._get_node(t);var n=!t.length||!e?!1:t.attr(this._get_settings().types.type_attr,e);return n&&this.__callback({obj:t,type:e}),n},_check:function(e,n,r){n=this._get_node(n);var i=!1,s=this._get_type(n),o=0,u=this,a=this._get_settings().types,f=!1;if(n===-1){if(!a[e])return;i=a[e]}else{if(s===!1)return;f=a.use_data?n.data("jstree"):!1,f&&f.types&&typeof f.types[e]!="undefined"?i=f.types[e]:!a.types[s]||typeof a.types[s][e]=="undefined"?!!a.types["default"]&&typeof a.types["default"][e]!="undefined"&&(i=a.types["default"][e]):i=a.types[s][e]}return t.isFunction(i)&&(i=i.call(this,n)),e==="max_depth"&&n!==-1&&r!==!1&&a.max_depth!==-2&&i!==0&&n.children("a:eq(0)").parentsUntil(".jstree","li").each(function(t){if(a.max_depth!==-1&&a.max_depth-(t+1)<=0)return i=0,!1;o=t===0?i:u._check(e,this,!1);if(o!==-1&&o-(t+1)<=0)return i=0,!1;o>=0&&(o-(t+1)<i||i<0)&&(i=o-(t+1)),a.max_depth>=0&&(a.max_depth-(t+1)<i||i<0)&&(i=a.max_depth-(t+1))}),i},check_move:function(){if(!this.__call_old())return!1;var e=this._get_move(),n=e.rt._get_settings().types,r=e.rt._check("max_children",e.cr),i=e.rt._check("max_depth",e.cr),s=e.rt._check("valid_children",e.cr),o=0,u=1,a;if(s==="none")return!1;if(t.isArray(s)&&e.ot&&e.ot._get_type){e.o.each(function(){if(t.inArray(e.ot._get_type(this),s)===-1)return u=!1,!1});if(u===!1)return!1}if(n.max_children!==-2&&r!==-1){o=e.cr===-1?this.get_container().find("> ul > li").not(e.o).length:e.cr.find("> ul > li").not(e.o).length;if(o+e.o.length>r)return!1}if(n.max_depth!==-2&&i!==-1){u=0;if(i===0)return!1;if(typeof e.o.d=="undefined"){a=e.o;while(a.length>0)a=a.find("> ul > li"),u++;e.o.d=u}if(i-e.o.d<0)return!1}return!0},create_node:function(e,n,r,i,s,o){if(!o&&(s||this._is_loaded(e))){var u=typeof n=="string"&&n.match(/^before|after$/i)&&e!==-1?this._get_parent(e):this._get_node(e),a=this._get_settings().types,f=this._check("max_children",u),l=this._check("max_depth",u),c=this._check("valid_children",u),h;typeof r=="string"&&(r={data:r}),r||(r={});if(c==="none")return!1;if(t.isArray(c))if(!r.attr||!r.attr[a.type_attr])r.attr||(r.attr={}),r.attr[a.type_attr]=c[0];else if(t.inArray(r.attr[a.type_attr],c)===-1)return!1;if(a.max_children!==-2&&f!==-1){h=u===-1?this.get_container().find("> ul > li").length:u.find("> ul > li").length;if(h+1>f)return!1}if(a.max_depth!==-2&&l!==-1&&l-1<0)return!1}return this.__call_old(!0,e,n,r,i,s,o)}}})}(jQuery)}(),define("jstree",function(){}),define("file-tree",["jquery","jstree","underscore","backbone","common"],function(t,n,r,i,s){t.jstree._themes=app.config.mediaUrl+"js/themes/";var o={options:{},formatRepoData:function(e){var t=[],n;for(var r=0,i=e.length;r<i;r++)n={data:e[r].name,attr:{repo_id:e[r].id,root_node:!0},state:"closed"},t.push(n);return t},renderFileTree:function(n,r,i){var s=i||{};n.delegate(".jstree-closed","dblclick",function(e){n.jstree("open_node",t(this)),t(this).find("a").removeClass("jstree-clicked")}).bind("select_node.jstree",function(e,n){t(".jstree-clicked").removeClass("jstree-clicked")}).jstree({json_data:{data:r,ajax:{url:function(t){var n=this.get_path(t),r;if(n.length==1)n="/",r=t.attr("repo_id");else{var i=t.parents("[root_node=true]");r=i.attr("repo_id"),n.shift(),n="/"+n.join("/")+"/"}return app.config.siteRoot+"ajax/repo/"+r+"/dirents/?path="+e(n)},success:function(e){var t=[],n,r;for(var i=0,s=e.length;i<s;i++)n=e[i],n.type=="dir"?r={data:n.name,attr:{type:n.type},state:"closed"}:r={data:n.name,attr:{type:n.type}},t.push(r);return t}}},core:{animation:100},themes:{theme:"classic"},checkbox:{two_state:s.two_state,real_checkboxes:!0,real_checkboxes_names:function(e){var t=this.get_path(e),n,r;return t.length==1?(r="/",n=e.attr("repo_id")):(t.shift(),n=e.parents("[root_node=true]").attr("repo_id"),e.attr("type")=="dir"?r="/"+t.join("/")+"/":r="/"+t.join("/")),["selected",n+r]}},plugins:["themes","json_data","ui","checkbox"]})},renderDirTree:function(e,n,r){e.delegate(".jstree-closed","dblclick",function(n){e.jstree("open_node",t(this)),t(this).find("a").removeClass("jstree-clicked")}).bind("before.jstree",function(e,r){r.func==="select_node"&&t(".jstree-clicked",n).removeClass("jstree-clicked")}).bind("select_node.jstree",function(e,r){var i,s,o=r.inst.get_path(r.rslt.obj);o.length==1?(i="/",s=r.rslt.obj.attr("repo_id")):(s=r.rslt.obj.parents("[root_node=true]").attr("repo_id"),o.shift(),i="/"+o.join("/")+"/"),t('input[name="dst_repo"]',n).val(s),t('input[name="dst_path"]',n).val(i)}).jstree({json_data:{data:r,ajax:{url:function(e){var t=this.get_path(e),n;return t.length==1?(t="/",n=e.attr("repo_id")):(n=e.parents("[root_node=true]").attr("repo_id"),t.shift(),t="/"+t.join("/")+"/"),app.config.siteRoot+"ajax/repo/"+n+"/dirents/?dir_only=true&path="+encodeURIComponent(t)},success:function(e){var t=[],n,r;for(var i=0,s=e.length;i<s;i++)n=e[i],n.has_subdir?r={data:n.name,attr:{type:n.type},state:"closed"}:r={data:n.name,attr:{type:n.type}},t.push(r);return t}}},core:{animation:100},plugins:["themes","json_data","ui"]})},renderTreeForPath:function(e){var n=t("#mv-form"),r=t("#current-repo-dirs"),i=r.prev(),o=e.repo_name,u=e.repo_id,a=e.path;a!="/"&&(a+="/");var f=this;t.ajax({url:s.getUrl({name:"get_dirents",repo_id:e.repo_id})+"?path="+encodeURIComponent(a)+"&dir_only=true&all_dir=true",cache:!1,dataType:"json",success:function(e){var s=[],l={data:o,attr:{repo_id:u,root_node:!0},state:"open"},c=a.split("/");c.pop();var h=e.length,p=[];for(var d=h-1;d>-1;d--){p[d]=[];if(d==h-1)for(var v=0,m=e[d].length;v<m;v++)p[d].push({data:e[d][v],state:"closed"});else for(var v=0,m=e[d].length;v<m;v++)e[d][v]==c[d+1]?p[d].push({data:e[d][v],state:"open",children:p[d+1]}):p[d].push({data:e[d][v],state:"closed"})}p[0].length>0&&t.extend(l,{children:p[0]}),s.push(l),i.hide(),f.renderDirTree(r,n,s),r.removeClass("hide")},error:function(){var e=[{data:o,attr:{repo_id:u,root_node:!0},state:"closed"}];i.hide(),f.renderDirTree(r,n,e),r.removeClass("hide")}})},prepareOtherReposTree:function(e){var n=this;t("#mv-dir-list #other-repos .hd").click(function(){var r=t("span",t(this)),i=t("#mv-form"),o=t(this).next(),u=t("#mv-dir-list #other-repos #other-repos-dirs");r.hasClass("icon-caret-right")?(r.attr("class","icon-caret-down"),o.show(),t.ajax({url:s.getUrl({name:"unenc_rw_repos"}),cache:!1,dataType:"json",success:function(t){var r=[],s=e.cur_repo_id;for(var a=0,f=t.length;a<f;a++)t[a].id!=s&&r.push({data:t[a].name,attr:{repo_id:t[a].id,root_node:!0},state:"closed"});o.hide(),n.renderDirTree(u,i,r),u.removeClass("hide")}})):(r.attr("class","icon-caret-right"),u.addClass("hide"))})}};return o}),define("app/views/sub-lib",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({tagName:"tr",template:t.template(e("#sub-lib-tmpl").html()),repoDelConfirmTemplate:t.template(e("#repo-del-confirm-template").html()),events:{mouseenter:"highlight",mouseleave:"rmHighlight","click .repo-delete-btn":"del"},initialize:function(){},render:function(){return this.$el.html(this.template(this.model.toJSON())),this},highlight:function(){e("#my-sub-repos .repo-del-confirm").length==0&&this.$el.addClass("hl").find(".op-icon").removeClass("vh")},rmHighlight:function(){e("#my-sub-repos .repo-del-confirm").length==0&&this.$el.removeClass("hl").find(".op-icon").addClass("vh")},del:function(){var t=this.$(".repo-delete-btn"),n=this.$(".op-container").css({position:"relative"}),i=gettext("Really want to delete {lib_name}?").replace("{lib_name}",'<span class="op-target">'+r.HTMLescape(this.model.get("name"))+"</span>"),s=e(this.repoDelConfirmTemplate({content:i})).appendTo(n).css({left:t.position().left,top:t.position().top+t.height()+2,width:180}),o=this;e(".no",s).click(function(){s.addClass("hide").remove(),o.rmHighlight()}),e(".yes",s).click(function(){e.ajax({url:r.getUrl({name:"repo_del",repo_id:o.model.get("id")}),type:"POST",dataType:"json",beforeSend:r.prepareCSRFToken,success:function(e){o.remove(),r.feedback(gettext("Delete succeeded."),"success")},error:function(t){s.addClass("hide").remove(),o.rmHighlight();var n;t.responseText?n=e.parseJSON(t.responseText).error:n=gettext("Failed. Please check the network."),r.feedback(n,"error")}})})}});return i}),define("app/views/myhome-sub-repos",["jquery","underscore","backbone","common","file-tree","app/collections/repos","app/views/sub-lib","app/views/add-repo"],function(e,t,n,r,i,s,o,u){var a=n.View.extend({el:e("#repo-tabs"),events:{"click #sub-lib-create":"createRepo"},initialize:function(t){this.$tabs=e("#repo-tabs"),this.$table=this.$("#my-sub-repos table"),this.$tableHead=e("thead",this.$table),this.$tableBody=e("tbody",this.$table),this.$loadingTip=e(".loading-tip",this.$tabs),this.$emptyTip=e("#my-sub-repos .empty-tips"),this.repos=new s({type:"sub"}),this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset)},addOne:function(e,t,n){var r=new o({model:e});n.prepend?this.$tableBody.prepend(r.render().el):this.$tableBody.append(r.render().el)},reset:function(){this.$(".error").hide(),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.repos.length?(this.$emptyTip.hide(),this.$table.show()):(this.$emptyTip.show(),this.$table.hide()),this.$loadingTip.hide()},showSubRepos:function(){this.$tabs.show(),e("#sublib-tab").parent().addClass("ui-state-active"),this.$table.hide();var t=this.$loadingTip;t.show();var n=this;this.repos.fetch({reset:!0,success:function(e,t,n){},error:function(e,r,i){t.hide();var s=n.$(".error"),o;r.responseText?r["status"]==401||r["status"]==403?o=gettext("Permission error"):o=gettext("Error"):o=gettext("Please check the network."),s.html(o).show()}})},show:function(){e("#sub-lib-create").show(),this.showSubRepos()},hide:function(){e("#sub-lib-create").hide(),this.$el.hide(),this.$table.hide(),this.$emptyTip.hide(),e("#sublib-tab",this.$tabs).parent().removeClass("ui-state-active")},createRepo:function(){var t=this,n=e("#sublib-create-form"),s=e(".dir-tree-cont",n);n.modal(),e.ajax({url:r.getUrl({name:"get_my_unenc_repos"}),cache:!1,dataType:"json",success:function(e){var t=i.formatRepoData(e);t.length>0?i.renderDirTree(s,n,t):s.html('<p class="error">'+gettext("You don't have any library at present.")+"</p>")},error:function(t,n,r){var i;t.responseText?i=e.parseJSON(t.responseText).error:i=gettext("Failed. Please check the network."),s.html('<p class="error">'+i+"</p>")}}),e(".submit",n).click(function(){var i=e('[name="dst_repo"]',n).val(),s=e('[name="dst_path"]',n).val();return!s||s=="/"?(e(".error",n).html(gettext("Please choose a directory")).removeClass("hide"),!1):(s=s.substr(0,s.length-1),e.ajax({url:r.getUrl({name:"sub_repo",repo_id:i})+"?p="+encodeURIComponent(s),dataType:"json",success:function(n){e.modal.close();var r={id:n.sub_repo_id,name:n.name,origin_repo_id:i,origin_path:s,abbrev_origin_path:n.abbrev_origin_path,mtime:(new Date).getTime()/1e3,mtime_relative:gettext("Just now")};t.repos.length>0?t.repos.add(r,{prepend:!0}):t.repos.reset([r])},error:function(t,r,i){var s;t.responseText?s=jQuery.parseJSON(t.responseText).error:s=gettext("Failed. Please check the network."),e(".error",n).html(s).removeClass("hide")}}),!1)})}});return a}),define("app/views/shared-repo",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({tagName:"tr",template:t.template(e("#shared-repo-tmpl").html()),events:{mouseenter:"showAction",mouseleave:"hideAction","click .unshare-btn":"removeShare"},initialize:function(){},removeShare:function(t){var n=this,i=function(t){r.feedback(gettext("Success"),"success",r.SUCCESS_TIMOUT),n.$el.remove(),n.collection.remove(n.model,{silent:!0}),n.collection.length==0&&(e("#repos-shared-to-me table").hide(),e("#repos-shared-to-me .empty-tips").show())};e.ajax({url:r.getUrl({name:"ajax_repo_remove_share"}),type:"POST",beforeSend:r.prepareCSRFToken,data:{repo_id:this.model.get("id"),from:this.model.get("owner"),share_type:this.model.get("share_type")},dataType:"json",success:i})},render:function(){return this.$el.html(this.template(this.model.toJSON())),this},showAction:function(){this.$el.addClass("hl"),this.$el.find(".op-icon").removeClass("vh")},hideAction:function(){this.$el.removeClass("hl"),this.$el.find(".op-icon").addClass("vh")}});return i}),define("app/views/myhome-shared-repos",["jquery","underscore","backbone","common","app/collections/repos","app/views/shared-repo"],function(e,t,n,r,i,s){var o=n.View.extend({el:e("#repo-tabs"),reposHdTemplate:t.template(e("#shared-repos-hd-tmpl").html()),initialize:function(t){this.$tabs=e("#repo-tabs"),this.$table=e("#repos-shared-to-me table"),this.$tableHead=e("thead",this.$table),this.$tableBody=e("tbody",this.$table),this.$loadingTip=e(".loading-tip",this.$tabs),this.$emptyTip=e("#repos-shared-to-me .empty-tips"),this.repos=new i({type:"shared"}),this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset)},addOne:function(e,t,n){var r=new s({model:e,collection:this.repos});n.prepend?this.$tableBody.prepend(r.render().el):this.$tableBody.append(r.render().el)},renderReposHd:function(){this.$tableHead.html(this.reposHdTemplate())},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.repos.length?(this.$emptyTip.hide(),this.renderReposHd(),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.$table.show()):(this.$emptyTip.show(),this.$table.hide())},showSharedRepos:function(){this.$tabs.show(),e("#shared-lib-tab").parent().addClass("ui-state-active"),this.$table.hide();var t=this.$loadingTip;t.show();var n=this;this.repos.fetch({reset:!0,success:function(e,t,n){},error:function(e,r,i){t.hide();var s=n.$(".error"),o;r.responseText?r["status"]==401||r["status"]==403?o=gettext("Permission error"):o=gettext("Error"):o=gettext("Please check the network."),s.html(o).show()}})},show:function(){this.showSharedRepos()},hide:function(){this.$el.hide(),this.$table.hide(),this.$emptyTip.hide(),e("#shared-lib-tab",this.$tabs).parent().removeClass("ui-state-active")},events:{"click #repos-shared-to-me .by-name":"sortByName","click #repos-shared-to-me .by-time":"sortByTime"},sortByName:function(){e(".by-time .sort-icon",this.$table).hide();var t=this.repos,n=e(".by-name .sort-icon",this.$table);t.comparator=function(e,t){var i=r.compareTwoWord(e.get("name"),t.get("name"));return n.hasClass("icon-caret-up")?-i:i},t.sort(),this.$tableBody.empty(),t.each(this.addOne,this),n.toggleClass("icon-caret-up icon-caret-down").show(),t.comparator=null},sortByTime:function(){e(".by-name .sort-icon",this.$table).hide();var t=this.repos,n=e(".by-time .sort-icon",this.$table);t.comparator=function(e,t){return n.hasClass("icon-caret-down")?e.get("mtime")<t.get("mtime")?1:-1:e.get("mtime")<t.get("mtime")?-1:1},t.sort(),this.$tableBody.empty(),t.each(this.addOne,this),n.toggleClass("icon-caret-up icon-caret-down").show(),t.comparator=null}});return o}),function(e){typeof define=="function"&&define.amd?define("jquery.magnific-popup",["jquery"],e):typeof exports=="object"?e(require("jquery")):e(window.jQuery||window.Zepto)}(function(e){var t="Close",n="BeforeClose",r="AfterClose",i="BeforeAppend",s="MarkupParse",o="Open",u="Change",a="mfp",f="."+a,l="mfp-ready",c="mfp-removing",h="mfp-prevent-close",p,d=function(){},v=!!window.jQuery,m,g=e(window),y,b,w,E,S,x=function(e,t){p.ev.on(a+e+f,t)},T=function(t,n,r,i){var s=document.createElement("div");return s.className="mfp-"+t,r&&(s.innerHTML=r),i?n&&n.appendChild(s):(s=e(s),n&&s.appendTo(n)),s},N=function(t,n){p.ev.triggerHandler(a+t,n),p.st.callbacks&&(t=t.charAt(0).toLowerCase()+t.slice(1),p.st.callbacks[t]&&p.st.callbacks[t].apply(p,e.isArray(n)?n:[n]))},C=function(t){if(t!==S||!p.currTemplate.closeBtn)p.currTemplate.closeBtn=e(p.st.closeMarkup.replace("%title%",p.st.tClose)),S=t;return p.currTemplate.closeBtn},k=function(){e.magnificPopup.instance||(p=new d,p.init(),e.magnificPopup.instance=p)},L=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(e.transition!==undefined)return!0;while(t.length)if(t.pop()+"Transition"in e)return!0;return!1};d.prototype={constructor:d,init:function(){var t=navigator.appVersion;p.isIE7=t.indexOf("MSIE 7.")!==-1,p.isIE8=t.indexOf("MSIE 8.")!==-1,p.isLowIE=p.isIE7||p.isIE8,p.isAndroid=/android/gi.test(t),p.isIOS=/iphone|ipad|ipod/gi.test(t),p.supportsTransition=L(),p.probablyMobile=p.isAndroid||p.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),b=e(document),p.popupsCache={}},open:function(t){y||(y=e(document.body));var n;if(t.isObj===!1){p.items=t.items.toArray(),p.index=0;var r=t.items,i;for(n=0;n<r.length;n++){i=r[n],i.parsed&&(i=i.el[0]);if(i===t.el[0]){p.index=n;break}}}else p.items=e.isArray(t.items)?t.items:[t.items],p.index=t.index||0;if(p.isOpen){p.updateItemHTML();return}p.types=[],E="",t.mainEl&&t.mainEl.length?p.ev=t.mainEl.eq(0):p.ev=b,t.key?(p.popupsCache[t.key]||(p.popupsCache[t.key]={}),p.currTemplate=p.popupsCache[t.key]):p.currTemplate={},p.st=e.extend(!0,{},e.magnificPopup.defaults,t),p.fixedContentPos=p.st.fixedContentPos==="auto"?!p.probablyMobile:p.st.fixedContentPos,p.st.modal&&(p.st.closeOnContentClick=!1,p.st.closeOnBgClick=!1,p.st.showCloseBtn=!1,p.st.enableEscapeKey=!1),p.bgOverlay||(p.bgOverlay=T("bg").on("click"+f,function(){p.close()}),p.wrap=T("wrap").attr("tabindex",-1).on("click"+f,function(e){p._checkIfClose(e.target)&&p.close()}),p.container=T("container",p.wrap)),p.contentContainer=T("content"),p.st.preloader&&(p.preloader=T("preloader",p.container,p.st.tLoading));var u=e.magnificPopup.modules;for(n=0;n<u.length;n++){var a=u[n];a=a.charAt(0).toUpperCase()+a.slice(1),p["init"+a].call(p)}N("BeforeOpen"),p.st.showCloseBtn&&(p.st.closeBtnInside?(x(s,function(e,t,n,r){n.close_replaceWith=C(r.type)}),E+=" mfp-close-btn-in"):p.wrap.append(C())),p.st.alignTop&&(E+=" mfp-align-top"),p.fixedContentPos?p.wrap.css({overflow:p.st.overflowY,overflowX:"hidden",overflowY:p.st.overflowY}):p.wrap.css({top:g.scrollTop(),position:"absolute"}),(p.st.fixedBgPos===!1||p.st.fixedBgPos==="auto"&&!p.fixedContentPos)&&p.bgOverlay.css({height:b.height(),position:"absolute"}),p.st.enableEscapeKey&&b.on("keyup"+f,function(e){e.keyCode===27&&p.close()}),g.on("resize"+f,function(){p.updateSize()}),p.st.closeOnContentClick||(E+=" mfp-auto-cursor"),E&&p.wrap.addClass(E);var c=p.wH=g.height(),h={};if(p.fixedContentPos&&p._hasScrollBar(c)){var d=p._getScrollbarSize();d&&(h.marginRight=d)}p.fixedContentPos&&(p.isIE7?e("body, html").css("overflow","hidden"):h.overflow="hidden");var v=p.st.mainClass;return p.isIE7&&(v+=" mfp-ie7"),v&&p._addClassToMFP(v),p.updateItemHTML(),N("BuildControls"),e("html").css(h),p.bgOverlay.add(p.wrap).prependTo(p.st.prependTo||y),p._lastFocusedEl=document.activeElement,setTimeout(function(){p.content?(p._addClassToMFP(l),p._setFocus()):p.bgOverlay.addClass(l),b.on("focusin"+f,p._onFocusIn)},16),p.isOpen=!0,p.updateSize(c),N(o),t},close:function(){if(!p.isOpen)return;N(n),p.isOpen=!1,p.st.removalDelay&&!p.isLowIE&&p.supportsTransition?(p._addClassToMFP(c),setTimeout(function(){p._close()},p.st.removalDelay)):p._close()},_close:function(){N(t);var n=c+" "+l+" ";p.bgOverlay.detach(),p.wrap.detach(),p.container.empty(),p.st.mainClass&&(n+=p.st.mainClass+" "),p._removeClassFromMFP(n);if(p.fixedContentPos){var i={marginRight:""};p.isIE7?e("body, html").css("overflow",""):i.overflow="",e("html").css(i)}b.off("keyup"+f+" focusin"+f),p.ev.off(f),p.wrap.attr("class","mfp-wrap").removeAttr("style"),p.bgOverlay.attr("class","mfp-bg"),p.container.attr("class","mfp-container"),p.st.showCloseBtn&&(!p.st.closeBtnInside||p.currTemplate[p.currItem.type]===!0)&&p.currTemplate.closeBtn&&p.currTemplate.closeBtn.detach(),p._lastFocusedEl&&e(p._lastFocusedEl).focus(),p.currItem=null,p.content=null,p.currTemplate=null,p.prevHeight=0,N(r)},updateSize:function(e){if(p.isIOS){var t=document.documentElement.clientWidth/window.innerWidth,n=window.innerHeight*t;p.wrap.css("height",n),p.wH=n}else p.wH=e||g.height();p.fixedContentPos||p.wrap.css("height",p.wH),N("Resize")},updateItemHTML:function(){var t=p.items[p.index];p.contentContainer.detach(),p.content&&p.content.detach(),t.parsed||(t=p.parseEl(p.index));var n=t.type;N("BeforeChange",[p.currItem?p.currItem.type:"",n]),p.currItem=t;if(!p.currTemplate[n]){var r=p.st[n]?p.st[n].markup:!1;N("FirstMarkupParse",r),r?p.currTemplate[n]=e(r):p.currTemplate[n]=!0}w&&w!==t.type&&p.container.removeClass("mfp-"+w+"-holder");var i=p["get"+n.charAt(0).toUpperCase()+n.slice(1)](t,p.currTemplate[n]);p.appendContent(i,n),t.preloaded=!0,N(u,t),w=t.type,p.container.prepend(p.contentContainer),N("AfterChange")},appendContent:function(e,t){p.content=e,e?p.st.showCloseBtn&&p.st.closeBtnInside&&p.currTemplate[t]===!0?p.content.find(".mfp-close").length||p.content.append(C()):p.content=e:p.content="",N(i),p.container.addClass("mfp-"+t+"-holder"),p.contentContainer.append(p.content)},parseEl:function(t){var n=p.items[t],r;n.tagName?n={el:e(n)}:(r=n.type,n={data:n,src:n.src});if(n.el){var i=p.types;for(var s=0;s<i.length;s++)if(n.el.hasClass("mfp-"+i[s])){r=i[s];break}n.src=n.el.attr("data-mfp-src"),n.src||(n.src=n.el.attr("href"))}return n.type=r||p.st.type||"inline",n.index=t,n.parsed=!0,p.items[t]=n,N("ElementParse",n),p.items[t]},addGroup:function(e,t){var n=function(n){n.mfpEl=this,p._openClick(n,e,t)};t||(t={});var r="click.magnificPopup";t.mainEl=e,t.items?(t.isObj=!0,e.off(r).on(r,n)):(t.isObj=!1,t.delegate?e.off(r).on(r,t.delegate,n):(t.items=e,e.off(r).on(r,n)))},_openClick:function(t,n,r){var i=r.midClick!==undefined?r.midClick:e.magnificPopup.defaults.midClick;if(!i&&(t.which===2||t.ctrlKey||t.metaKey))return;var s=r.disableOn!==undefined?r.disableOn:e.magnificPopup.defaults.disableOn;if(s)if(e.isFunction(s)){if(!s.call(p))return!0}else if(g.width()<s)return!0;t.type&&(t.preventDefault(),p.isOpen&&t.stopPropagation()),r.el=e(t.mfpEl),r.delegate&&(r.items=n.find(r.delegate)),p.open(r)},updateStatus:function(e,t){if(p.preloader){m!==e&&p.container.removeClass("mfp-s-"+m),!t&&e==="loading"&&(t=p.st.tLoading);var n={status:e,text:t};N("UpdateStatus",n),e=n.status,t=n.text,p.preloader.html(t),p.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),p.container.addClass("mfp-s-"+e),m=e}},_checkIfClose:function(t){if(e(t).hasClass(h))return;var n=p.st.closeOnContentClick,r=p.st.closeOnBgClick;if(n&&r)return!0;if(!p.content||e(t).hasClass("mfp-close")||p.preloader&&t===p.preloader[0])return!0;if(t!==p.content[0]&&!e.contains(p.content[0],t)){if(r&&e.contains(document,t))return!0}else if(n)return!0;return!1},_addClassToMFP:function(e){p.bgOverlay.addClass(e),p.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),p.wrap.removeClass(e)},_hasScrollBar:function(e){return(p.isIE7?b.height():document.body.scrollHeight)>(e||g.height())},_setFocus:function(){(p.st.focus?p.content.find(p.st.focus).eq(0):p.wrap).focus()},_onFocusIn:function(t){if(t.target!==p.wrap[0]&&!e.contains(p.wrap[0],t.target))return p._setFocus(),!1},_parseMarkup:function(t,n,r){var i;r.data&&(n=e.extend(r.data,n)),N(s,[t,n,r]),e.each(n,function(e,n){if(n===undefined||n===!1)return!0;i=e.split("_");if(i.length>1){var r=t.find(f+"-"+i[0]);if(r.length>0){var s=i[1];s==="replaceWith"?r[0]!==n[0]&&r.replaceWith(n):s==="img"?r.is("img")?r.attr("src",n):r.replaceWith('<img src="'+n+'" class="'+r.attr("class")+'" />'):r.attr(i[1],n)}}else t.find(f+"-"+e).html(n)})},_getScrollbarSize:function(){if(p.scrollbarSize===undefined){var e=document.createElement("div");e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),p.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return p.scrollbarSize}},e.magnificPopup={instance:null,proto:d.prototype,modules:[],open:function(t,n){return k(),t?t=e.extend(!0,{},t):t={},t.isObj=!0,t.index=n||0,this.instance.open(t)},close:function(){return e.magnificPopup.instance&&e.magnificPopup.instance.close()},registerModule:function(t,n){n.options&&(e.magnificPopup.defaults[t]=n.options),e.extend(this.proto,n.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&times;</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopup=function(t){k();var n=e(this);if(typeof t=="string")if(t==="open"){var r,i=v?n.data("magnificPopup"):n[0].magnificPopup,s=parseInt(arguments[1],10)||0;i.items?r=i.items[s]:(r=n,i.delegate&&(r=r.find(i.delegate)),r=r.eq(s)),p._openClick({mfpEl:r},n,i)}else p.isOpen&&p[t].apply(p,Array.prototype.slice.call(arguments,1));else t=e.extend(!0,{},t),v?n.data("magnificPopup",t):n[0].magnificPopup=t,p.addGroup(n,t);return n};var A="inline",O,M,_,D=function(){_&&(M.after(_.addClass(O)).detach(),_=null)};e.magnificPopup.registerModule(A,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){p.types.push(A),x(t+"."+A,function(){D()})},getInline:function(t,n){D();if(t.src){var r=p.st.inline,i=e(t.src);if(i.length){var s=i[0].parentNode;s&&s.tagName&&(M||(O=r.hiddenClass,M=T(O),O="mfp-"+O),_=i.after(M).detach().removeClass(O)),p.updateStatus("ready")}else p.updateStatus("error",r.tNotFound),i=e("<div>");return t.inlineElement=i,i}return p.updateStatus("ready"),p._parseMarkup(n,{},t),n}}});var P="ajax",H,B=function(){H&&y.removeClass(H)},j=function(){B(),p.req&&p.req.abort()};e.magnificPopup.registerModule(P,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){p.types.push(P),H=p.st.ajax.cursor,x(t+"."+P,j),x("BeforeChange."+P,j)},getAjax:function(t){H&&y.addClass(H),p.updateStatus("loading");var n=e.extend({url:t.src,success:function(n,r,i){var s={data:n,xhr:i};N("ParseAjax",s),p.appendContent(e(s.data),P),t.finished=!0,B(),p._setFocus(),setTimeout(function(){p.wrap.addClass(l)},16),p.updateStatus("ready"),N("AjaxContentAdded")},error:function(){B(),t.finished=t.loadError=!0,p.updateStatus("error",p.st.ajax.tError.replace("%url%",t.src))}},p.st.ajax.settings);return p.req=e.ajax(n),""}}});var F,I=function(t){if(t.data&&t.data.title!==undefined)return t.data.title;var n=p.st.image.titleSrc;if(n){if(e.isFunction(n))return n.call(p,t);if(t.el)return t.el.attr(n)||""}return""};e.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var e=p.st.image,n=".image";p.types.push("image"),x(o+n,function(){p.currItem.type==="image"&&e.cursor&&y.addClass(e.cursor)}),x(t+n,function(){e.cursor&&y.removeClass(e.cursor),g.off("resize"+f)}),x("Resize"+n,p.resizeImage),p.isLowIE&&x("AfterChange",p.resizeImage)},resizeImage:function(){var e=p.currItem;if(!e||!e.img)return;if(p.st.image.verticalFit){var t=0;p.isLowIE&&(t=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",p.wH-t)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,F&&clearInterval(F),e.isCheckingImgSize=!1,N("ImageHasSize",e),e.imgHidden&&(p.content&&p.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var t=0,n=e.img[0],r=function(i){F&&clearInterval(F),F=setInterval(function(){if(n.naturalWidth>0){p._onImageHasSize(e);return}t>200&&clearInterval(F),t++,t===3?r(10):t===40?r(50):t===100&&r(500)},i)};r(1)},getImage:function(t,n){var r=0,i=function(){t&&(t.img[0].complete?(t.img.off(".mfploader"),t===p.currItem&&(p._onImageHasSize(t),p.updateStatus("ready")),t.hasSize=!0,t.loaded=!0,N("ImageLoadComplete")):(r++,r<200?setTimeout(i,100):s()))},s=function(){t&&(t.img.off(".mfploader"),t===p.currItem&&(p._onImageHasSize(t),p.updateStatus("error",o.tError.replace("%url%",t.src))),t.hasSize=!0,t.loaded=!0,t.loadError=!0)},o=p.st.image,u=n.find(".mfp-img");if(u.length){var a=document.createElement("img");a.className="mfp-img",t.el&&t.el.find("img").length&&(a.alt=t.el.find("img").attr("alt")),t.img=e(a).on("load.mfploader",i).on("error.mfploader",s),a.src=t.src,u.is("img")&&(t.img=t.img.clone()),a=t.img[0],a.naturalWidth>0?t.hasSize=!0:a.width||(t.hasSize=!1)}return p._parseMarkup(n,{title:I(t),img_replaceWith:t.img},t),p.resizeImage(),t.hasSize?(F&&clearInterval(F),t.loadError?(n.addClass("mfp-loading"),p.updateStatus("error",o.tError.replace("%url%",t.src))):(n.removeClass("mfp-loading"),p.updateStatus("ready")),n):(p.updateStatus("loading"),t.loading=!0,t.hasSize||(t.imgHidden=!0,n.addClass("mfp-loading"),p.findImageSize(t)),n)}}});var q,R=function(){return q===undefined&&(q=document.createElement("p").style.MozTransform!==undefined),q};e.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(e){return e.is("img")?e:e.find("img")}},proto:{initZoom:function(){var e=p.st.zoom,r=".zoom",i;if(!e.enabled||!p.supportsTransition)return;var s=e.duration,o=function(t){var n=t.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),r="all "+e.duration/1e3+"s "+e.easing,i={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},s="transition";return i["-webkit-"+s]=i["-moz-"+s]=i["-o-"+s]=i[s]=r,n.css(i),n},u=function(){p.content.css("visibility","visible")},a,f;x("BuildControls"+r,function(){if(p._allowZoom()){clearTimeout(a),p.content.css("visibility","hidden"),i=p._getItemToZoom();if(!i){u();return}f=o(i),f.css(p._getOffset()),p.wrap.append(f),a=setTimeout(function(){f.css(p._getOffset(!0)),a=setTimeout(function(){u(),setTimeout(function(){f.remove(),i=f=null,N("ZoomAnimationEnded")},16)},s)},16)}}),x(n+r,function(){if(p._allowZoom()){clearTimeout(a),p.st.removalDelay=s;if(!i){i=p._getItemToZoom();if(!i)return;f=o(i)}f.css(p._getOffset(!0)),p.wrap.append(f),p.content.css("visibility","hidden"),setTimeout(function(){f.css(p._getOffset())},16)}}),x(t+r,function(){p._allowZoom()&&(u(),f&&f.remove(),i=null)})},_allowZoom:function(){return p.currItem.type==="image"},_getItemToZoom:function(){return p.currItem.hasSize?p.currItem.img:!1},_getOffset:function(t){var n;t?n=p.currItem.img:n=p.st.zoom.opener(p.currItem.el||p.currItem);var r=n.offset(),i=parseInt(n.css("padding-top"),10),s=parseInt(n.css("padding-bottom"),10);r.top-=e(window).scrollTop()-i;var o={width:n.width(),height:(v?n.innerHeight():n[0].offsetHeight)-s-i};return R()?o["-moz-transform"]=o.transform="translate("+r.left+"px,"+r.top+"px)":(o.left=r.left,o.top=r.top),o}}});var U="iframe",z="//about:blank",W=function(e){if(p.currTemplate[U]){var t=p.currTemplate[U].find("iframe");t.length&&(e||(t[0].src=z),p.isIE8&&t.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(U,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){p.types.push(U),x("BeforeChange",function(e,t,n){t!==n&&(t===U?W():n===U&&W(!0))}),x(t+"."+U,function(){W()})},getIframe:function(t,n){var r=t.src,i=p.st.iframe;e.each(i.patterns,function(){if(r.indexOf(this.index)>-1)return this.id&&(typeof this.id=="string"?r=r.substr(r.lastIndexOf(this.id)+this.id.length,r.length):r=this.id.call(this,r)),r=this.src.replace("%id%",r),!1});var s={};return i.srcAction&&(s[i.srcAction]=r),p._parseMarkup(n,s,t),p.updateStatus("ready"),n}}});var X=function(e){var t=p.items.length;return e>t-1?e-t:e<0?t+e:e},V=function(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=p.st.gallery,r=".mfp-gallery",i=Boolean(e.fn.mfpFastClick);p.direction=!0;if(!n||!n.enabled)return!1;E+=" mfp-gallery",x(o+r,function(){n.navigateByImgClick&&p.wrap.on("click"+r,".mfp-img",function(){if(p.items.length>1)return p.next(),!1}),b.on("keydown"+r,function(e){e.keyCode===37?p.prev():e.keyCode===39&&p.next()})}),x("UpdateStatus"+r,function(e,t){t.text&&(t.text=V(t.text,p.currItem.index,p.items.length))}),x(s+r,function(e,t,r,i){var s=p.items.length;r.counter=s>1?V(n.tCounter,i.index,s):""}),x("BuildControls"+r,function(){if(p.items.length>1&&n.arrows&&!p.arrowLeft){var t=n.arrowMarkup,r=p.arrowLeft=e(t.replace(/%title%/gi,n.tPrev).replace(/%dir%/gi,"left")).addClass(h),s=p.arrowRight=e(t.replace(/%title%/gi,n.tNext).replace(/%dir%/gi,"right")).addClass(h),o=i?"mfpFastClick":"click";r[o](function(){p.prev()}),s[o](function(){p.next()}),p.isIE7&&(T("b",r[0],!1,!0),T("a",r[0],!1,!0),T("b",s[0],!1,!0),T("a",s[0],!1,!0)),p.container.append(r.add(s))}}),x(u+r,function(){p._preloadTimeout&&clearTimeout(p._preloadTimeout),p._preloadTimeout=setTimeout(function(){p.preloadNearbyImages(),p._preloadTimeout=null},16)}),x(t+r,function(){b.off(r),p.wrap.off("click"+r),p.arrowLeft&&i&&p.arrowLeft.add(p.arrowRight).destroyMfpFastClick(),p.arrowRight=p.arrowLeft=null})},next:function(){p.direction=!0,p.index=X(p.index+1),p.updateItemHTML()},prev:function(){p.direction=!1,p.index=X(p.index-1),p.updateItemHTML()},goTo:function(e){p.direction=e>=p.index,p.index=e,p.updateItemHTML()},preloadNearbyImages:function(){var e=p.st.gallery.preload,t=Math.min(e[0],p.items.length),n=Math.min(e[1],p.items.length),r;for(r=1;r<=(p.direction?n:t);r++)p._preloadItem(p.index+r);for(r=1;r<=(p.direction?t:n);r++)p._preloadItem(p.index-r)},_preloadItem:function(t){t=X(t);if(p.items[t].preloaded)return;var n=p.items[t];n.parsed||(n=p.parseEl(t)),N("LazyLoad",n),n.type==="image"&&(n.img=e('<img class="mfp-img" />').on("load.mfploader",function(){n.hasSize=!0}).on("error.mfploader",function(){n.hasSize=!0,n.loadError=!0,N("LazyLoadError",n)}).attr("src",n.src)),n.preloaded=!0}}});var $="retina";e.magnificPopup.registerModule($,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=p.st.retina,t=e.ratio;t=isNaN(t)?t():t,t>1&&(x("ImageHasSize."+$,function(e,n){n.img.css({"max-width":n.img[0].naturalWidth/t,width:"100%"})}),x("ElementParse."+$,function(n,r){r.src=e.replaceSrc(r,t)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,r=function(){g.off("touchmove"+s+" touchend"+s)},i="mfpFastClick",s="."+i;e.fn.mfpFastClick=function(i){return e(this).each(function(){var o=e(this),u;if(n){var a,f,l,c,h,p;o.on("touchstart"+s,function(e){c=!1,p=1,h=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],f=h.clientX,l=h.clientY,g.on("touchmove"+s,function(e){h=e.originalEvent?e.originalEvent.touches:e.touches,p=h.length,h=h[0];if(Math.abs(h.clientX-f)>10||Math.abs(h.clientY-l)>10)c=!0,r()}).on("touchend"+s,function(e){r();if(c||p>1)return;u=!0,e.preventDefault(),clearTimeout(a),a=setTimeout(function(){u=!1},t),i()})})}o.on("click"+s,function(){u||i()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+s+" click"+s),n&&g.off("touchmove"+s+" touchend"+s)}}(),k()}),define("app/views/starred-file-item",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({tagName:"tr",template:t.template(e("#starred-file-item-tmpl").html()),events:{mouseenter:"showAction",mouseleave:"hideAction","click .unstar":"removeShare"},initialize:function(){},render:function(){var e=this.model.toJSON();return e.is_img=r.imageCheck(e.file_name),e.encoded_path=r.encodePath(e.path),this.$el.html(this.template(e)),this},removeShare:function(){var t=this,n=this.model.get("repo_id"),i=this.model.get("file_name"),s=this.model.get("path");e.ajax({url:r.getUrl({name:"starred_files"})+"?p="+encodeURIComponent(s)+"&repo_id="+encodeURIComponent(n),type:"DELETE",beforeSend:r.prepareCSRFToken,success:function(){t.remove(),r.feedback(gettext("Successfully unstared {placeholder}").replace("{placeholder}",r.HTMLescape(i)),"success")},error:function(e){r.ajaxErrorHandler(e)}})},showAction:function(){this.$el.addClass("hl"),this.$el.find(".op-icon").removeClass("vh")},hideAction:function(){this.$el.removeClass("hl"),this.$el.find(".op-icon").addClass("vh")}});return i}),define("app/models/starred-file",["underscore","backbone"],function(e,t){var n=t.Model.extend({});return n}),define("app/collections/starred-files",["underscore","backbone","common","app/models/starred-file"],function(e,t,n,r){var i=t.Collection.extend({model:r,url:function(){return n.getUrl({name:"starred_files"})}});return i}),define("app/views/starred-file",["jquery","underscore","backbone","common","jquery.magnific-popup","app/views/starred-file-item","app/collections/starred-files"],function(e,t,n,r,i,s,o){var u=n.View.extend({el:e("#starred-file"),initialize:function(){this.$table=this.$("table"),this.$tableBody=this.$("tbody"),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips"),this.starredFiles=new o,this.listenTo(this.starredFiles,"reset",this.reset),this.$el.magnificPopup({type:"image",delegate:".img-name-link",tClose:gettext("Close (Esc)"),tLoading:gettext("Loading..."),gallery:{enabled:!0,tPrev:gettext("Previous (Left arrow key)"),tNext:gettext("Next (Right arrow key)"),tCounter:gettext("%curr% of %total%")},image:{titleSrc:function(e){var t=e.el,n=t[0].innerHTML,r='<a href="'+t.attr("href")+'" target="_blank">'+gettext("Open in New Tab")+"</a>";return n+"<br />"+r},tError:gettext('<a href="%url%" target="_blank">The image</a> could not be loaded.')}})},addOne:function(e){var t=new s({model:e});this.$tableBody.append(t.render().el)},reset:function(){this.$tableBody.empty(),this.$loadingTip.hide(),this.starredFiles.each(this.addOne,this),this.starredFiles.length?(this.$emptyTip.hide(),this.$table.show()):(this.$emptyTip.show(),this.$table.hide())},hide:function(){this.$el.hide()},show:function(){this.$el.show(),this.$table.hide(),this.$loadingTip.show(),this.starredFiles.fetch({reset:!0})}});return u}),define("app/models/activity",["underscore","backbone"],function(e,t){var n=t.Model.extend({});return n}),define("app/collections/activities",["underscore","backbone","common","app/models/activity"],function(e,t,n,r){var i=t.Collection.extend({model:r,url:function(){return n.getUrl({name:"events"})}});return i}),define("app/views/details",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({id:"ls-ch",template:t.template(e("#details-popup-tmpl").html()),detailItemTemplate:t.template(e("#detail-item-tmpl").html()),initialize:function(t){this.repo_id=t.repo_id,this.cmmt_id=t.cmmt_id,this.$el.html(this.template()).modal({autoResize:!0}),e("#simplemodal-container").css({width:"auto",height:"auto"}),this.getDetails()},getDetails:function(){var t=this;r.ajaxGet({get_url:r.getUrl({name:"get_history_changes",repo_id:this.repo_id}),data:{commit_id:this.cmmt_id},after_op_success:function(n){t.$(".loading-tip").hide(),t.$(".commit-time").html(n.date_time);var i=function(e){t.$el.append(t.detailItemTemplate({details_title:e.title,details:e.content}))};n["new"].length>0&&i({title:gettext("New files"),content:n["new"]}),n.removed.length>0&&i({title:gettext("Deleted files"),content:n.removed}),n.renamed.length>0&&i({title:gettext("Renamed or Moved files"),content:n.renamed}),n.modified.length>0&&i({title:gettext("Modified files"),content:n.modified}),n.newdir.length>0&&i({title:gettext("New directories"),content:n.newdir}),n.deldir.length>0&&i({title:gettext("Deleted directories"),content:n.deldir}),n.cmt_desc&&t.$el.append("<p>"+r.HTMLescape(n.cmt_desc)+"</p>"),e(window).resize()},after_op_error:function(n){var r;n.responseText?r=e.parseJSON(n.responseText).error:r=gettext("Failed. Please check the network."),t.$el.html('<p class="error">'+r+"</p>"),setTimeout(function(){e.modal.close()},2500)}})}});return i}),define("app/views/activity-item",["jquery","underscore","backbone","common","app/views/details"],function(e,t,n,r,i){var s=n.View.extend({tagName:"li",className:"event-item",template:t.template(e("#activity-item-tmpl").html()),events:{"click .lsch":"showDetails"},initialize:function(e){this.activity=e},showDetails:function(){var e={repo_id:this.activity.repo_id,cmmt_id:this.activity.commit_id};new i(e)},render:function(){return this.$el.html(this.template({activity:this.activity})),this}});return s}),define("app/views/activities",["jquery","underscore","backbone","common","app/collections/activities","app/views/activity-item"],function(e,t,n,r,i,s){var o=n.View.extend({el:e("#activities"),activityGroupHdTemplate:t.template(e("#activity-group-hd-tmpl").html()),activityGroupBdTemplate:t.template(e("#activity-group-bd-tmpl").html()),initialize:function(){this.activities=new i,this.$activitiesBody=this.$("#activities-body"),this.$activitiesMore=this.$("#activities-more"),this.$loadingTip=this.$(".loading-tip"),this.moreOffset=0},events:{"click #activities-more":"getMoreActivities"},getMoreActivities:function(){var e=this;this.$loadingTip.show(),this.$activitiesMore.hide(),this.activities.fetch({remove:!1,data:{start:e.moreOffset},success:function(){e.render()}})},render:function(){var n=this.activities.toJSON(),r=n.length,i=n[r-1].more,o=[];this.$loadingTip.hide(),this.$activitiesMore.hide(),this.moreOffset=n[r-1].more_offset,this.$activitiesBody.empty().show();for(var u=0;u<r;u++)o=o.concat(n[u].events);var a=t.groupBy(o,"date"),f,l;for(var c in a)f=e(this.activityGroupHdTemplate({date:c})),l=e(this.activityGroupBdTemplate()),t.each(a[c],function(e){var t=new s(e);l.append(t.render().el)}),this.$activitiesBody.append(f).append(l);i&&this.$activitiesMore.show()},hide:function(){this.$el.hide()},show:function(){this.$el.show(),this.$activitiesBody.hide(),this.$activitiesMore.hide(),this.$loadingTip.show();var e=this;this.activities.fetch({data:{start:0},success:function(){e.render()}})}});return o}),define("app/views/myhome-side-nav",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({el:"#myhome-side-nav",template:t.template(e("#myhome-side-nav-tmpl").html()),enableModTemplate:t.template(e("#myhome-mods-enable-form-tmpl").html()),initialize:function(){this.default_cur_tab="libs",this.data={cur_tab:this.default_cur_tab,mods_enabled:app.pageOptions.user_mods_enabled,can_add_repo:app.pageOptions.can_add_repo,events_enabled:app.pageOptions.events_enabled},this.render()},render:function(){return this.$el.html(this.template(this.data)),this},events:{"click #myhome-enable-mods":"enableMods"},enableMods:function(){var t=app.pageOptions.user_mods_enabled,n=e(this.enableModTemplate({mods_available:app.pageOptions.user_mods_available,mods_enabled:t}));n.modal(),e("#simplemodal-container").css("height","auto"),e(".checkbox-orig",n).click(function(){e(this).parent().toggleClass("checkbox-checked")});var i=e('[name="personal_wiki"]'),s=i.prop("checked"),o=this;n.submit(function(){var u=i.prop("checked");return u==s?!1:(r.ajaxPost({form:n,form_id:n.attr("id"),post_url:r.getUrl({name:"toggle_personal_modules"}),post_data:{personal_wiki:u},after_op_success:function(){if(u)t.push("personal wiki");else{var n=t.indexOf("personal wiki");n>-1&&t.splice(n,1)}e.modal.close(),o.render()}}),!1)})},show:function(e){e&&e.cur_tab?(this.data.cur_tab=e.cur_tab,this.render()):this.data.cur_tab!=this.default_cur_tab&&(this.data.cur_tab=this.default_cur_tab,this.render()),this.$el.show()},hide:function(){this.$el.hide()}});return i}),define("app/views/myhome",["jquery","underscore","backbone","common","app/views/myhome-repos","app/views/myhome-sub-repos","app/views/myhome-shared-repos","app/views/starred-file","app/views/activities","app/views/myhome-side-nav"],function(e,t,n,r,i,s,o,u,a,f){var l=n.View.extend({el:"#main",initialize:function(t){this.sideNavView=new f,this.reposView=new i,this.subReposView=new s,this.sharedReposView=new o,this.starredFileView=new u,this.activitiesView=new a,this.dirView=t.dirView,this.currentView=this.reposView,e("#initial-loading-view").hide()},showMyRepos:function(){this.sideNavView.show(),this.currentView.hide(),this.reposView.show(),this.currentView=this.reposView},showMySubRepos:function(){this.sideNavView.show(),this.currentView.hide(),this.subReposView.show(),this.currentView=this.subReposView},showSharedRepos:function(){this.sideNavView.show(),this.currentView.hide(),this.sharedReposView.show(),this.currentView=this.sharedReposView},showStarredFile:function(){this.sideNavView.show({cur_tab:"starred"}),this.currentView.hide(),this.starredFileView.show(),this.currentView=this.starredFileView},showActivities:function(){this.sideNavView.show({cur_tab:"activities"}),this.currentView.hide(),this.activitiesView.show(),this.currentView=this.activitiesView},showDir:function(e,t,n){this.sideNavView.show();var n=n||"/";this.currentView.hide(),this.dirView.showDir(e,t,n),this.currentView=this.dirView},hide:function(){this.currentView.hide(),this.sideNavView.hide()}});return l}),define("app/models/group-repo",["underscore","backbone","app/models/repo"],function(e,t,n){var r=n.extend({defaults:{permission:"r"}});return e.extend(r.prototype.defaults,n.prototype.defaults),r}),define("app/collections/group-repos",["underscore","backbone","common","app/models/group-repo"],function(e,t,n,r){var i=t.Collection.extend({model:r,comparator:0/0,url:function(){return n.getUrl({name:"group_repos",group_id:this.group_id})},parse:function(e){return this.is_staff=e.is_staff,e.repos},setGroupID:function(e){this.group_id=e}});return i}),define("app/views/group-repo",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({tagName:"tr",template:t.template(e("#group-repo-tmpl").html()),events:{mouseenter:"highlight",mouseleave:"rmHighlight","click .cancel-share":"unshare"},initialize:function(e){this.group_id=e.group_id,this.is_staff=e.is_staff,this.listenTo(this.model,"destroy",this.remove)},render:function(){var t=this.model.toJSON();return e.extend(t,{group_id:this.group_id,is_staff:this.is_staff}),this.$el.html(this.template(t)),this},highlight:function(){this.$el.addClass("hl").find(".op-icon").removeClass("vh")},rmHighlight:function(){this.$el.removeClass("hl").find(".op-icon").addClass("vh")},unshare:function(){var t=this.model.get("name");this.model.destroy({wait:!0,success:function(){var e=gettext("Successfully unshared {placeholder}").replace("{placeholder}",'<span class="op-target">'+r.HTMLescape(t)+"</span>");r.feedback(e,"success",r.SUCCESS_TIMOUT)},error:function(t,n){var i;n.responseText?i=e.parseJSON(n.responseText).error_msg:i=gettext("Failed. Please check the network."),r.feedback(i,"error")}})}});return i}),define("app/views/add-group-repo",["jquery","simplemodal","underscore","backbone","common","app/views/add-repo"],function(e,t,n,r,i,s){var o=s.extend({templateData:function(){return{showSharePerm:!0}},newAttributes:function(){var t=s.prototype.newAttributes.apply(this);return n.extend(t,{permission:e("select[name=permission]",this.$el).val()})}});return o}),define("app/views/group-side-nav",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({el:"#group-side-nav",template:t.template(e("#group-side-nav-tmpl").html()),enableModTemplate:t.template(e("#group-mods-enable-form-tmpl").html()),initialize:function(){},render:function(t){this.group_id=t;var n=this;e.ajax({url:r.getUrl({name:"group_basic_info",group_id:this.group_id}),cache:!1,dataType:"json",success:function(e){n.$el.html(n.template(e)),n.mods_available=e.mods_available,n.mods_enabled=e.mods_enabled},error:function(t){var r;t.responseText?r=e.parseJSON(t.responseText).error:r=gettext("Please check the network."),n.$el.html('<p class="error">'+r+"</p>")}})},events:{"click #enable-mods":"enableMods"},enableMods:function(){var t=e(this.enableModTemplate({mods_available:this.mods_available,mods_enabled:this.mods_enabled}));t.modal(),e("#simplemodal-container").css("height","auto"),e(".checkbox-orig",t).click(function(){e(this).parent().toggleClass("checkbox-checked")});var n=e('[name="group_wiki"]'),i=n.prop("checked"),s=this;t.submit(function(){var o=n.prop("checked");return o==i?!1:(r.ajaxPost({form:t,form_id:t.attr("id"),post_url:r.getUrl({name:"toggle_group_modules",group_id:s.group_id}),post_data:{group_wiki:o},after_op_success:function(){e.modal.close(),s.render(s.group_id)}}),!1)})},show:function(){this.$el.show()},hide:function(){this.$el.hide()}});return i}),define("app/views/group",["jquery","underscore","backbone","common","app/collections/group-repos","app/views/group-repo","app/views/add-group-repo","app/views/group-side-nav"],function(e,t,n,r,i,s,o,u){var a=n.View.extend({el:"#group-repo-tabs",reposHdTemplate:t.template(e("#shared-repos-hd-tmpl").html()),events:{"click .repo-create":"createRepo","click .by-name":"sortByName","click .by-time":"sortByTime"},initialize:function(e){this.$tabs=this.$el,this.$table=this.$("table"),this.$tableHead=this.$("thead"),this.$tableBody=this.$("tbody"),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips"),this.sideNavView=new u,this.repos=new i,this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset),this.dirView=e.dirView},addOne:function(e,t,n){var r=new s({model:e,group_id:this.group_id,is_staff:this.repos.is_staff});n.prepend?this.$tableBody.prepend(r.render().el):this.$tableBody.append(r.render().el)},renderReposHd:function(){this.$tableHead.html(this.reposHdTemplate())},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.repos.length?(this.$emptyTip.hide(),this.renderReposHd(),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.$table.show()):(this.$emptyTip.show(),this.$table.hide())},showSideNav:function(){var e=this.sideNavView;if(e.group_id&&e.group_id==this.group_id){e.show();return}e.render(this.group_id),e.show()},showRepoList:function(e){this.group_id=e,this.showSideNav(),this.dirView.hide(),this.$emptyTip.hide(),this.$tabs.show(),this.$table.hide();var t=this.$loadingTip;t.show();var n=this;this.repos.setGroupID(e),this.repos.fetch({cache:!1,reset:!0,data:{from:"web"},success:function(e,t,n){},error:function(e,r,i){t.hide();var s=n.$(".error"),o;r.responseText?r["status"]==401||r["status"]==403?o=gettext("Permission error"):o=gettext("Error"):o=gettext("Please check the network."),s.html(o).show()}})},hideRepoList:function(){this.$tabs.hide()},showDir:function(e,t,n){this.group_id=e,this.showSideNav(),this.hideRepoList(),this.dirView.showDir("group/"+this.group_id,t,n)},createRepo:function(){new o(this.repos)},sortByName:function(){this.$(".by-time .sort-icon").hide();var e=this.repos,t=this.$(".by-name .sort-icon");e.comparator=function(e,n){var i=r.compareTwoWord(e.get("name"),n.get("name"));return t.hasClass("icon-caret-up")?-i:i},e.sort(),this.$tableBody.empty(),e.each(this.addOne,this),t.toggleClass("icon-caret-up icon-caret-down").show(),e.comparator=null},sortByTime:function(){this.$(".by-name .sort-icon").hide();var e=this.repos,t=this.$(".by-time .sort-icon");e.comparator=function(e,n){return t.hasClass("icon-caret-down")?e.get("mtime")<n.get("mtime")?1:-1:e.get("mtime")<n.get("mtime")?-1:1},e.sort(),this.$tableBody.empty(),e.each(this.addOne,this),t.toggleClass("icon-caret-up icon-caret-down").show(),e.comparator=null},hide:function(){this.sideNavView.hide(),this.hideRepoList(),this.dirView.hide(),this.$emptyTip.hide()}});return a}),define("app/models/pub-repo",["underscore","backbone","app/models/repo"],function(e,t,n){var r=n.extend({defaults:{permission:"r"}});return e.extend(r.prototype.defaults,n.prototype.defaults),r}),define("app/collections/pub-repos",["underscore","backbone","app/models/pub-repo"],function(e,t,n){var r=t.Collection.extend({model:n,url:app.pageOptions.pubReposUrl,comparator:0/0});return r}),define("app/views/organization-repo",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({tagName:"tr",template:t.template(e("#organization-repo-tmpl").html()),initialize:function(){},render:function(){return this.$el.html(this.template(this.model.toJSON())),this},events:{mouseenter:"highlight",mouseleave:"rmHighlight","click .cancel-share":"removeShare"},highlight:function(){this.$el.addClass("hl").find(".op-icon").removeClass("vh")},rmHighlight:function(){this.$el.removeClass("hl").find(".op-icon").addClass("vh")},removeShare:function(){var t=this.$el,n=this.model.get("name");e.ajax({url:r.getUrl({name:"ajax_unset_inner_pub_repo",repo_id:this.model.get("id")}),type:"POST",data:{permission:this.model.get("permission")},beforeSend:r.prepareCSRFToken,dataType:"json",success:function(){t.remove();var e=gettext("Successfully unshared {placeholder}").replace("{placeholder}",'<span class="op-target">'+r.HTMLescape(n)+"</span>");r.feedback(e,"success",r.SUCCESS_TIMOUT)},error:function(e){r.ajaxErrorHandler(e)}})}});return i}),define("app/views/create-pub-repo",["jquery","simplemodal","underscore","backbone","common","app/views/add-repo"],function(e,t,n,r,i,s){var o=s.extend({templateData:function(){return{showSharePerm:!0}},newAttributes:function(){var t=s.prototype.newAttributes.apply(this);return n.extend(t,{permission:e("select[name=permission]",this.$el).val()})}});return o}),define("app/views/add-pubrepo-item",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({tagName:"tr",template:t.template(e("#add-pubrepo-item-tmpl").html()),events:{"click .select":"select","change .share-permission-select":"selectPerm"},initialize:function(){},selectPerm:function(t){var n=e(t.currentTarget).val();this.model.set({pub_perm:n},{silent:!0})},select:function(){var e=this.$(".checkbox");e.toggleClass("checkbox-checked"),e.hasClass("checkbox-checked")?this.model.set({selected:!0},{silent:!0}):this.model.set({selected:!1},{silent:!0})},render:function(){return this.$el.html(this.template(this.model.toJSON())),this}});return i}),define("app/views/add-pub-repo",["jquery","simplemodal","underscore","backbone","common","app/collections/repos","app/views/add-pubrepo-item"],function(e,t,n,r,i,s,o){var u=r.View.extend({id:"add-pubrepo-popup",template:n.template(e("#add-pubrepo-popup-tmpl").html()),initialize:function(t){this.$el.html(this.template()).modal({}),e("#simplemodal-container").css({width:"auto",height:"auto"}),this.$table=this.$("table"),this.$loadingTip=this.$(".loading-tip"),this.myRepos=new s,this.pubRepos=t,this.listenTo(this.myRepos,"reset",this.reset),this.myRepos.fetch({reset:!0})},events:{"click .submit":"submit"},submit:function(){var t=this.myRepos.where({selected:!0}),r=this,s=[];n.each(t,function(t){var n=t.id,r="rw";t.has("pub_perm")&&(r=t.get("pub_perm")),s.push(e.ajax({url:i.getUrl({name:"shared_repos",repo_id:n})+"?share_type=public&permission="+r,type:"PUT",beforeSend:i.prepareCSRFToken,dataType:"json",error:function(e,t,n){i.ajaxErrorHandler(e,t,n)}}))});var o=e.when.apply(e,s);o.done(function(){e.modal.close(),r.pubRepos.fetch({reset:!0})})},addOne:function(e){var t=new o({model:e});this.$table.append(t.render().el)},reset:function(){this.$loadingTip.hide(),this.$table.show(),this.myRepos.each(this.addOne,this)}});return u}),define("app/views/organization",["jquery","underscore","backbone","common","app/collections/pub-repos","app/views/organization-repo","app/views/create-pub-repo","app/views/add-pub-repo"],function(e,t,n,r,i,s,o,u){var a=n.View.extend({el:"#main",reposHdTemplate:t.template(e("#shared-repos-hd-tmpl").html()),initialize:function(t){this.$sideNav=e("#org-side-nav"),this.$reposDiv=e("#organization-repos"),this.$table=e("#organization-repos table"),this.$tableHead=e("thead",this.$table),this.$tableBody=e("tbody",this.$table),this.$loadingTip=e("#organization-repos .loading-tip"),this.$emptyTip=e("#organization-repos .empty-tips"),this.repos=new i,this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset),this.dirView=t.dirView;var n=e("#add-pub-lib"),s=e("#add-pub-lib-menu");n.click(function(){s.toggleClass("hide"),s.css({top:n.position().top+n.outerHeight(),right:10})}),e(".item",s).hover(function(){e(this).css({background:"#f3f3f3"})},function(){e(this).css({background:"transparent"})}),e(document).click(function(e){r.closePopup(e,s,n)})},events:{"click #organization-repos .share-existing":"addRepo","click #organization-repos .create-new":"createRepo","click #organization-repos .by-name":"sortByName","click #organization-repos .by-time":"sortByTime"},createRepo:function(){new o(this.repos)},addRepo:function(){new u(this.repos)},addOne:function(e,t,n){var r=new s({model:e,collection:this.repos});n.prepend?this.$tableBody.prepend(r.render().el):this.$tableBody.append(r.render().el)},renderReposHd:function(){this.$tableHead.html(this.reposHdTemplate())},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.repos.length?(this.$emptyTip.hide(),this.renderReposHd(),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.$table.show()):(this.$table.hide(),this.$emptyTip.show())},showRepoList:function(){this.$sideNav.show(),this.dirView.hide(),this.$reposDiv.show();var e=this.$loadingTip;e.show();var t=this;this.repos.fetch({cache:!1,reset:!0,success:function(e,t,n){},error:function(n,r,i){e.hide();var s=t.$(".error"),o;r.responseText?r["status"]==401||r["status"]==403?o=gettext("Permission error"):o=gettext("Error"):o=gettext("Please check the network."),s.html(o).show()}})},hideRepoList:function(){this.$reposDiv.hide()},showDir:function(e,t){this.$sideNav.show();var t=t||"/";this.hideRepoList(),this.dirView.showDir("org",e,t)},sortByName:function(){e(".by-time .sort-icon",this.$table).hide();var t=this.repos,n=e(".by-name .sort-icon",this.$table);t.comparator=function(e,t){var i=r.compareTwoWord(e.get("name"),t.get("name"));return n.hasClass("icon-caret-up")?-i:i},t.sort(),this.$tableBody.empty(),t.each(this.addOne,this),n.toggleClass("icon-caret-up icon-caret-down").show(),t.comparator=null},sortByTime:function(){e(".by-name .sort-icon",this.$table).hide();var t=this.repos,n=e(".by-time .sort-icon",this.$table);t.comparator=function(e,t){return n.hasClass("icon-caret-down")?e.get("mtime")<t.get("mtime")?1:-1:e.get("mtime")<t.get("mtime")?-1:1},t.sort(),this.$tableBody.empty(),t.each(this.addOne,this),n.toggleClass("icon-caret-up icon-caret-down").show(),t.comparator=null},hide:function(){this.$sideNav.hide(),this.hideRepoList(),this.$emptyTip.hide(),this.dirView.hide()}});return a}),function(e){typeof define=="function"&&define.amd?define("jquery.ui.core",["jquery"],e):e(jQuery)}(function(e){function t(t,r){var i,s,o,u=t.nodeName.toLowerCase();return"area"===u?(i=t.parentNode,s=i.name,!t.href||!s||i.nodeName.toLowerCase()!=="map"?!1:(o=e("img[usemap='#"+s+"']")[0],!!o&&n(o))):(/^(input|select|textarea|button|object)$/.test(u)?!t.disabled:"a"===u?t.href||r:r)&&n(t)}function n(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return e.css(this,"visibility")==="hidden"}).length}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var n=this.css("position"),r=n==="absolute",i=t?/(auto|scroll|hidden)/:/(auto|scroll)/,s=this.parents().filter(function(){var t=e(this);return r&&t.css("position")==="static"?!1:i.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return n==="fixed"||!s.length?e(this[0].ownerDocument||document):s},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(n){return t(n,!isNaN(e.attr(n,"tabindex")))},tabbable:function(n){var r=e.attr(n,"tabindex"),i=isNaN(r);return(i||r>=0)&&t(n,!i)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,n){function o(t,n,i,s){return e.each(r,function(){n-=parseFloat(e.css(t,"padding"+this))||0,i&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var r=n==="Width"?["Left","Right"]:["Top","Bottom"],i=n.toLowerCase(),s={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+n]=function(t){return t===undefined?s["inner"+n].call(this):this.each(function(){e(this).css(i,o(this,t)+"px")})},e.fn["outer"+n]=function(t,r){return typeof t!="number"?s["outer"+n].call(this,t):this.each(function(){e(this).css(i,o(this,t,!0,r)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(n){return arguments.length?t.call(this,e.camelCase(n)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(n,r){return typeof n=="number"?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),r&&r.call(t)},n)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(t!==undefined)return this.css("zIndex",t);if(this.length){var n=e(this[0]),r,i;while(n.length&&n[0]!==document){r=n.css("position");if(r==="absolute"||r==="relative"||r==="fixed"){i=parseInt(n.css("zIndex"),10);if(!isNaN(i)&&i!==0)return i}n=n.parent()}}return 0}}),e.ui.plugin={add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n,r){var i,s=e.plugins[t];if(!s)return;if(!r&&(!e.element[0].parentNode||e.element[0].parentNode.nodeType===11))return;for(i=0;i<s.length;i++)e.options[s[i][0]]&&s[i][1].apply(e.element,n)}}}),function(e){typeof define=="function"&&define.amd?define("jquery.ui.widget",["jquery"],e):e(jQuery)}(function(e){var t=0,n=Array.prototype.slice;e.cleanData=function(t){return function(n){var r,i,s;for(s=0;(i=n[s])!=null;s++)try{r=e._data(i,"events"),r&&r.remove&&e(i).triggerHandler("remove")}catch(o){}t(n)}}(e.cleanData),e.widget=function(t,n,r){var i,s,o,u,a={},f=t.split(".")[0];return t=t.split(".")[1],i=f+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[f]=e[f]||{},s=e[f][t],o=e[f][t]=function(e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,s,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(r,function(t,r){if(!e.isFunction(r)){a[t]=r;return}a[t]=function(){var e=function(){return n.prototype[t].apply(this,arguments)},i=function(e){return n.prototype[t].apply(this,e)};return function(){var t=this._super,n=this._superApply,s;return this._super=e,this._superApply=i,s=r.apply(this,arguments),this._super=t,this._superApply=n,s}}()}),o.prototype=e.widget.extend(u,{widgetEventPrefix:s?u.widgetEventPrefix||t:t},a,{constructor:o,namespace:f,widgetName:t,widgetFullName:i}),s?(e.each(s._childConstructors,function(t,n){var r=n.prototype;e.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete s._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){var r=n.call(arguments,1),i=0,s=r.length,o,u;for(;i<s;i++)for(o in r[i])u=r[i][o],r[i].hasOwnProperty(o)&&u!==undefined&&(e.isPlainObject(u)?t[o]=e.isPlainObject(t[o])?e.widget.extend({},t[o],u):e.widget.extend({},u):t[o]=u);return t},e.widget.bridge=function(t,r){var i=r.prototype.widgetFullName||t;e.fn[t]=function(s){var o=typeof s=="string",u=n.call(arguments,1),a=this;return s=!o&&u.length?e.widget.extend.apply(null,[s].concat(u)):s,o?this.each(function(){var n,r=e.data(this,i);if(s==="instance")return a=r,!1;if(!r)return e.error("cannot call methods on "+t+" prior to initialization; attempted to call method '"+s+"'");if(!e.isFunction(r[s])||s.charAt(0)==="_")return e.error("no such method '"+s+"' for "+t+" widget instance");n=r[s].apply(r,u);if(n!==r&&n!==undefined)return a=n&&n.jquery?a.pushStack(n.get()):n,!1}):this.each(function(){var t=e.data(this,i);t?(t.option(s||{}),t._init&&t._init()):e.data(this,i,new r(s,this))}),a}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(n,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=t++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),n),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===r&&this.destroy()}}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,n){var r=t,i,s,o;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof t=="string"){r={},i=t.split("."),t=i.shift();if(i.length){s=r[t]=e.widget.extend({},this.options[t]);for(o=0;o<i.length-1;o++)s[i[o]]=s[i[o]]||{},s=s[i[o]];t=i.pop();if(arguments.length===1)return s[t]===undefined?null:s[t];s[t]=n}else{if(arguments.length===1)return this.options[t]===undefined?null:this.options[t];r[t]=n}}return this._setOptions(r),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,e==="disabled"&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,n,r){var i,s=this;typeof t!="boolean"&&(r=n,n=t,t=!1),r?(n=i=e(n),this.bindings=this.bindings.add(n)):(r=n,n=this.element,i=this.widget()),e.each(r,function(r,o){function u(){if(!t&&(s.options.disabled===!0||e(this).hasClass("ui-state-disabled")))return;return(typeof o=="string"?s[o]:o).apply(s,arguments)}typeof o!="string"&&(u.guid=o.guid=o.guid||u.guid||e.guid++);var a=r.match(/^([\w:-]*)\s*(.*)$/),f=a[1]+s.eventNamespace,l=a[2];l?i.delegate(l,f,u):n.bind(f,u)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function n(){return(typeof e=="string"?r[e]:e).apply(r,arguments)}var r=this;return setTimeout(n,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,n,r){var i,s,o=this.options[t];r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent;if(s)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(r,i,s){typeof i=="string"&&(i={effect:i});var o,u=i?i===!0||typeof i=="number"?n:i.effect||n:t;i=i||{},typeof i=="number"&&(i={duration:i}),o=!e.isEmptyObject(i),i.complete=s,i.delay&&r.delay(i.delay),o&&e.effects&&e.effects.effect[u]?r[t](i):u!==t&&r[u]?r[u](i.duration,i.easing,s):r.queue(function(n){e(this)[t](),s&&s.call(r[0]),n()})}});var r=e.widget}),function(e){typeof define=="function"&&define.amd?define("jquery.ui.progressbar",["jquery","jquery.ui.core","jquery.ui.widget"],e):e(jQuery)}(function(e){var t=e.widget("ui.progressbar",{version:"1.11.3",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){if(e===undefined)return this.options.value;this.options.value=this._constrainedValue(e),this._refreshValue()},_constrainedValue:function(e){return e===undefined&&(e=this.options.value),this.indeterminate=e===!1,typeof e!="number"&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){e==="max"&&(t=Math.max(this.min,t)),e==="disabled"&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,n=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(n.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}})}),define("app/models/dirent",["underscore","backbone"],function(e,t){var n=t.Model.extend({});return n}),define("app/collections/dirents",["underscore","backbone","common","app/models/dirent"],function(e,t,n,r){var i=t.Collection.extend({model:r,url:function(){return n.getUrl({name:"list_lib_dir",repo_id:this.repo_id})},initialize:function(){},parse:function(e){return this.repo_name=e.repo_name,this.user_perm=e.user_perm,this.encrypted=e.encrypted,this.is_repo_owner=e.is_repo_owner,this.is_virtual=e.is_virtual,this.dirent_more=e.dirent_more,this.more_start=e.more_start,e.dirent_list},setPath:function(e,t,n){this.category=e,this.repo_id=t,this.path=n}});return i}),define("app/views/folder-perm-item",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({tagName:"tr",template:t.template(e("#folder-perm-item-tmpl").html()),initialize:function(e){this.item_data=e.item_data,this.repo_id=e.repo_id,this.path=e.path,this.render()},render:function(){return this.$el.html(this.template(this.item_data)),this},events:{mouseenter:"showPermOpIcons",mouseleave:"hidePermOpIcons","click .perm-edit-icon":"editIconClick","change .perm-toggle-select":"editPerm","click .delete-icon":"deletePerm"},showPermOpIcons:function(){this.$el.find(".op-icon").removeClass("vh")},hidePermOpIcons:function(){this.$el.find(".op-icon").addClass("vh")},editIconClick:function(t){e(t.currentTarget).closest("td").find(".perm").addClass("hide").end().find(".perm-toggle-select").removeClass("hide")},editPerm:function(t){var n=this,i=e(t.currentTarget).val(),s={perm:i,path:this.path,type:"modify"},o=this.item_data.for_user;o?e.extend(s,{user:this.item_data.user}):e.extend(s,{group_id:this.item_data.group_id}),e.ajax({url:r.getUrl({name:o?"set_user_folder_perm":"set_group_folder_perm",repo_id:this.repo_id}),type:"POST",dataType:"json",cache:!1,beforeSend:r.prepareCSRFToken,data:s,success:function(){n.item_data.perm=i,n.render()},error:function(t){var n;t.responseText?n=e.parseJSON(t.responseText).error:n=gettext("Failed. Please check the network."),o?e("#user-folder-perm .error").html(n).removeClass("hide"):e("#group-folder-perm .error").html(n).removeClass("hide")}})},deletePerm:function(){var t=this,n={perm:this.item_data.perm,path:this.path,type:"delete"},i=this.item_data.for_user;i?e.extend(n,{user:this.item_data.user}):e.extend(n,{group_id:this.item_data.group_id}),e.ajax({url:r.getUrl({name:i?"set_user_folder_perm":"set_group_folder_perm",repo_id:this.repo_id}),type:"POST",dataType:"json",cache:!1,beforeSend:r.prepareCSRFToken,data:n,success:function(){t.remove()},error:function(t){var n;t.responseText?n=e.parseJSON(t.responseText).error:n=gettext("Failed. Please check the network."),i?e("#user-folder-perm .error").html(n).removeClass("hide"):e("#group-folder-perm .error").html(n).removeClass("hide")}})}});return i}),define("app/views/folder-perm",["jquery","underscore","backbone","common","jquery.ui.tabs","select2","app/views/folder-perm-item"],function(e,t,n,r,i,s,o){var u=n.View.extend({tagName:"div",id:"folder-perm-popup",template:t.template(e("#folder-perm-popup-tmpl").html()),initialize:function(t){this.repo_id=t.repo_id,this.obj_name=t.obj_name,this.dir_path=t.dir_path,this.path=r.pathJoin([this.dir_path,this.obj_name]),this.render(),this.$el.modal({appendTo:"#main",focus:!1,containerCss:{padding:0}}),e("#simplemodal-container").css({width:"auto",height:"auto"}),this.$("#folder-perm-tabs").tabs(),this.panelsInit();var n=this;e(document).on("click",function(e){var t=e.target||event.srcElement;n.$(".perm-edit-icon, .perm-toggle-select").is(t)||(n.$(".perm").removeClass("hide"),n.$(".perm-toggle-select").addClass("hide"))})},render:function(){return this.$el.html(this.template({title:gettext("Set {placeholder}'s permission").replace("{placeholder}",'<span class="op-target ellipsis ellipsis-op-target" title="'+r.HTMLescape(this.obj_name)+'">'+r.HTMLescape(this.obj_name)+"</span>")})),this},panelsInit:function(){this.$add_user_perm=this.$("#add-user-folder-perm"),this.$add_group_perm=this.$("#add-group-folder-perm");var t=this,n=this.$add_user_perm,i=this.$add_group_perm;r.ajaxGet({get_url:r.getUrl({name:"get_folder_perm_by_path",repo_id:this.repo_id}),data:{path:this.path},after_op_success:function(r){e(r.user_perms).each(function(r,i){var s=new o({repo_id:t.repo_id,path:t.path,item_data:e.extend(i,{for_user:!0})});n.after(s.el)}),e(r.group_perms).each(function(n,r){var s=new o({repo_id:t.repo_id,path:t.path,item_data:e.extend(r,{for_user:!1})});i.after(s.el)})}}),e('[name="email"]',n).select2(r.contactInputOptionsForSelect2());var s=app.pageOptions.groups||[],u="";for(var a=0,f=s.length;a<f;a++)u+='<option value="'+s[a].id+'" data-index="'+a+'">'+s[a].name+"</option>";e('[name="group"]',i).html(u).select2({placeholder:gettext("Select groups"),escapeMarkup:function(e){return e}})},events:{"click #add-user-folder-perm .submit":"addUserFolderPerm","click #add-group-folder-perm .submit":"addGroupFolderPerm"},addUserFolderPerm:function(){var t=this,n=this.$add_user_perm,i=e('[name="email"]',n).val();if(!i)return!1;var s=e('[name="permission"]',n).val();r.ajaxPost({form:n,form_id:n.attr("id"),post_url:r.getUrl({name:"set_user_folder_perm",repo_id:this.repo_id}),post_data:{path:this.path,type:"add",user:i,perm:s},after_op_success:function(r){e(r.success).each(function(e,r){var u=new o({repo_id:t.repo_id,path:t.path,item_data:{user:i,user_name:r.user_name,perm:s,for_user:!0}});n.after(u.el)}),e('[name="email"]',n).select2("val",""),e("#user-folder-perm .error").addClass("hide")},after_op_error:function(t){var n;t.responseText?n=e.parseJSON(t.responseText).error:n=gettext("Failed. Please check the network."),e("#user-folder-perm .error").html(n).removeClass("hide")}})},addGroupFolderPerm:function(){var t=this,n=this.$add_group_perm,i=e('[name="group"]',n).val().join(",");if(!i)return!1;var s=e('[name="permission"]',n).val();r.ajaxPost({form:n,form_id:n.attr("id"),post_url:r.getUrl({name:"set_group_folder_perm",repo_id:this.repo_id}),post_data:{path:this.path,type:"add",group_id:i,perm:s},after_op_success:function(r){e(r.success).each(function(r,i){var u=new o({repo_id:t.repo_id,path:t.path,item_data:{for_user:!1,perm:s,group_id:i.group_id,group_name:i.group_name}});n.after(u.el),e("#group-folder-perm .error").addClass("hide")}),e('[name="group"]',n).select2("val","")},after_op_error:function(t){var n;t.responseText?n=e.parseJSON(t.responseText).error:n=gettext("Failed. Please check the network."),e("#group-folder-perm .error").html(n).removeClass("hide")}})}});return u}),define("app/views/dirent",["jquery","underscore","backbone","common","file-tree","app/views/share","app/views/folder-perm"],function(e,t,n,r,i,s,o){app=app||{},app.globalState=app.globalState||{};var u=n.View.extend({tagName:"tr",template:t.template(e("#dirent-tmpl").html()),renameTemplate:t.template(e("#rename-form-template").html()),mvcpTemplate:t.template(e("#mvcp-form-template").html()),mvProgressTemplate:t.template(e("#mv-progress-popup-template").html()),initialize:function(e){this.dirView=e.dirView,this.dir=this.dirView.dir,this.listenTo(this.model,"change",this.render),this.listenTo(this.model,"remove",this.remove)},render:function(){var e=this.dir,t=r.pathJoin([e.path,this.model.get("obj_name")]),n=app.pageOptions.is_pro;return this.$el.html(this.template({dirent:this.model.attributes,dirent_path:t,encoded_path:r.encodePath(t),category:e.category,repo_id:e.repo_id,is_repo_owner:e.is_repo_owner,can_generate_shared_link:app.pageOptions.can_generate_shared_link,is_pro:n,repo_encrypted:e.encrypted})),this.$(".file-locked-icon").attr("title",gettext("locked by {placeholder}").replace("{placeholder}",this.model.get("lock_owner_name"))),this},events:{mouseenter:"highlight",mouseleave:"rmHighlight","click .select":"select","click .file-star":"starFile","click .dir-link":"visitDir","click .more-op-icon":"togglePopup","click .share":"share","click .delete":"del","click .rename":"rename","click .mv":"mvcp","click .cp":"mvcp","click .set-folder-permission":"setFolderPerm","click .lock-file":"lockFile","click .unlock-file":"unlockFile"},highlight:function(){app.globalState.noFileOpPopup&&this.$el.addClass("hl").find(".repo-file-op").removeClass("vh")},rmHighlight:function(){app.globalState.noFileOpPopup&&this.$el.removeClass("hl").find(".repo-file-op").addClass("vh")},select:function(){var e=this.$(".checkbox");e.toggleClass("checkbox-checked"),e.hasClass("checkbox-checked")?this.model.set({selected:!0},{silent:!0}):this.model.set({selected:!1},{silent:!0});var t=this.dirView,n=t.$("#multi-dirents-op"),r=t.$("th .checkbox"),i=t.$("tr:gt(0) .checkbox-checked").length;i>0?n.css({display:"inline"}):n.hide(),i==t.$("tr:gt(0)").length?r.addClass("checkbox-checked"):r.removeClass("checkbox-checked")},starFile:function(){var t=this,n=this.dirView.dir,i=this.model.get("starred"),s={repo_id:n.repo_id};s.name=i?"unstar_file":"star_file";var o=r.pathJoin([n.path,this.model.get("obj_name")]),u=r.getUrl(s)+"?file="+encodeURIComponent(o);e.ajax({url:u,dataType:"json",cache:!1,success:function(){i?t.model.set({starred:!1}):t.model.set({starred:!0})},error:function(e){r.ajaxErrorHandler(e)}})},visitDir:function(){this.$(".dirent-icon img").attr({src:app.config.mediaUrl+"img/loading-icon.gif",alt:""}),this.dirView.dir.reset();var e=this.$(".dir-link").attr("href");return app.router.navigate(e,{trigger:!0}),!1},togglePopup:function(){var t=this.$(".more-op-icon"),n=this.$(".hidden-op");n.hasClass("hide")?(n.css({left:t.position().left}),t.offset().top+n.height()<=e("#main").offset().top+e("#main").height()?n.css("top",t.position().top+t.height()+3):n.css("bottom",t.parent().outerHeight()-t.position().top+3),n.removeClass("hide"),app.globalState.noFileOpPopup=!1,app.globalState.popup_tr=t.parents("tr")):(n.addClass("hide"),app.globalState.noFileOpPopup=!0,app.globalState.popup_tr="")},share:function(){var e=this.dir,t=this.model.get("obj_name"),n=r.pathJoin([e.path,t]),i={is_repo_owner:e.is_repo_owner,is_virtual:e.is_virtual,user_perm:this.model.get("perm"),repo_id:e.repo_id,repo_encrypted:!1,is_dir:this.model.get("is_dir")?!0:!1,dirent_path:n,obj_name:t};return new s(i),!1},del:function(){var t=this.model.get("obj_name"),n=this.dir,i={repo_id:n.repo_id,name:this.model.get("is_dir")?"del_dir":"del_file"},s=this.model;return e.ajax({url:r.getUrl(i)+"?parent_dir="+encodeURIComponent(n.path)+"&name="+encodeURIComponent(t),type:"POST",dataType:"json",beforeSend:r.prepareCSRFToken,success:function(e){n.remove(s),app.globalState.noFileOpPopup=!0;var i=gettext("Successfully deleted %(name)s").replace("%(name)s",r.HTMLescape(t));r.feedback(i,"success")},error:function(e){r.ajaxErrorHandler(e)}}),!1},rename:function(){var t=this.model.get("is_dir"),n=t?gettext("Rename Directory"):gettext("Rename File"),i=this.model.get("obj_name"),s=e(this.renameTemplate({form_title:n,dirent_name:i}));s.modal({focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"});var o=e(".detail",s);o.html(o.html().replace("%(name)s",'<span class="op-target ellipsis ellipsis-op-target" title="'+r.HTMLescape(i)+'">'+r.HTMLescape(i)+"</span>"));var u=s.attr("id"),a=this,f=this.dirView.dir;return s.submit(function(){var n=e.trim(e('[name="newname"]',s).val());if(!n)return r.showFormError(u,gettext("It is required.")),!1;if(n==i)return r.showFormError(u,gettext("You have not renamed it.")),!1;var o={oldname:i,newname:n},l=r.getUrl({name:t?"rename_dir":"rename_file",repo_id:f.repo_id})+"?parent_dir="+encodeURIComponent(f.path),c=function(n){var r={obj_name:n.newname,last_modified:(new Date).getTime()/1e3,last_update:gettext("Just now"),sharelink:"",sharetoken:""};t||e.extend(r,{starred:!1}),e.modal.close(),a.model.set(r)};return r.ajaxPost({form:s,post_url:l,post_data:o,after_op_success:c,form_id:u}),!1}),!1},mvcp:function(t){var n=this.dir,s=t.target||t.srcElement,o=e(s).hasClass("mv")?"mv":"cp",u=this.model.get("obj_name"),a=this.model.get("is_dir")?"dir":"file",f=o=="mv"?gettext("Move {placeholder} to:"):gettext("Copy {placeholder} to:");f=f.replace("{placeholder}",'<span class="op-target ellipsis ellipsis-op-target" title="'+r.HTMLescape(u)+'">'+r.HTMLescape(u)+"</span>");var l=e(this.mvcpTemplate({form_title:f,op_type:o,obj_type:a,obj_name:u,show_other_repos:!n.encrypted}));l.modal({appendTo:"#main",autoResize:!0,focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"}),i.renderTreeForPath({repo_name:n.repo_name,repo_id:n.repo_id,path:n.path}),n.encrypted||i.prepareOtherReposTree({cur_repo_id:n.repo_id});var c=this.$el,h=this;return l.submit(function(){var t=e(this),i=t.attr("id"),s=n.path,o=n.repo_id,u=e('[name="dst_repo"]',t).val(),a=e('[name="dst_path"]',t).val(),f=e('[name="op"]',t).val(),l=e('[name="obj_name"]',t).val(),p=e('[name="obj_type"]',t).val();if(!e.trim(u)||!e.trim(a))return e(".error",t).removeClass("hide"),!1;if(u==o&&(a==s||p=="dir"&&a==s+l+"/"))return e(".error",t).html(gettext("Invalid destination path")).removeClass("hide"),!1;var d={repo_id:o};p=="dir"?d.name=f=="mv"?"mv_dir":"cp_dir":d.name=f=="mv"?"mv_file":"cp_file";var v=r.getUrl(d)+"?path="+encodeURIComponent(s)+"&obj_name="+encodeURIComponent(l),m={dst_repo:u,dst_path:a},g=function(t){e.modal.close();var n=t.msg;if(!t.task_id)f=="mv"&&c.remove(),r.feedback(n,"success");else{var i=e(h.mvProgressTemplate()),s=e("#mv-details",i),o=e("#cancel-mv",i),u=e("#mv-other-info",i);o.removeClass("hide"),setTimeout(function(){i.modal({containerCss:{width:300,height:150,paddingTop:50},focus:!1});var t=f=="mv"?gettext("Moving %(name)s"):gettext("Copying %(name)s");s.html(t.replace("%(name)s",r.HTMLescape(l))).removeClass("vh"),e("#mv-progress").progressbar(),a()},100);var a=function(){e.ajax({url:r.getUrl({name:"get_cp_progress"})+"?task_id="+encodeURIComponent(t.task_id),dataType:"json",success:function(t){var i=e(".ui-progressbar-value",e("#mv-progress"));if(!t.failed&&!t.canceled&&!t.successful)t["done"]==t["total"]?(i.css("width","100%"),s.addClass("vh"),o.addClass("hide"),u.html(gettext("Saving...")).removeClass("hide")):i.css("width",parseInt(t.done/t.total*100,10)+"%"),i.show(),setTimeout(a,1e3);else if(t.successful)e.modal.close(),f=="mv"&&c.remove(),r.feedback(n,"success");else{s.addClass("vh");var l=t.failed?gettext("Failed."):gettext("Canceled.");u.html(l).removeClass("hide"),o.addClass("hide"),setTimeout(function(){e.modal.close()},1e3)}},error:function(t,n,r){var i;t.responseText?i=e.parseJSON(t.responseText).error:i=gettext("Failed. Please check the network."),s.addClass("vh"),u.html(i).removeClass("hide"),o.addClass("hide"),setTimeout(function(){e.modal.close()},1e3)}})};o.click(function(){r.disableButton(o),e.ajax({url:r.getUrl({name:"cancel_cp"})+"?task_id="+encodeURIComponent(t.task_id),dataType:"json",success:function(t){s.addClass("vh"),u.html(gettext("Canceled.")).removeClass("hide"),o.addClass("hide"),setTimeout(function(){e.modal.close()},1e3)},error:function(t,n,i){var s;t.responseText?s=e.parseJSON(t.responseText).error:s=gettext("Failed. Please check the network."),u.html(s).removeClass("hide"),r.enableButton(o)}})})}};return r.ajaxPost({form:t,post_url:v,post_data:m,after_op_success:g,form_id:i}),!1}),!1},setFolderPerm:function(){var e={obj_name:this.model.get("obj_name"),dir_path:this.dir.path,repo_id:this.dir.repo_id};return new o(e),!1},lockOrUnlockFile:function(t){var n=this.dir,i=r.pathJoin([n.path,this.model.get("obj_name")]),s=t.after_success;e.ajax({url:r.getUrl({name:"lock_or_unlock_file",repo_id:n.repo_id}),type:"PUT",dataType:"json",data:{operation:t.op,p:i},cache:!1,beforeSend:r.prepareCSRFToken,success:function(){s()},error:function(e){r.ajaxErrorHandler(e)}})},lockFile:function(){var e=this;return this.lockOrUnlockFile({op:"lock",after_success:function(){e.model.set({is_locked:!0,locked_by_me:!0,lock_owner_name:app.pageOptions.name}),app.globalState.noFileOpPopup=!0,e.$el.removeClass("hl")}}),!1},unlockFile:function(){var e=this;return this.lockOrUnlockFile({op:"unlock",after_success:function(){e.model.set({is_locked:!1}),app.globalState.noFileOpPopup=!0,e.$el.removeClass("hl")}}),!1}});return u}),function(e){var t=function(e,n){var r=/[^\w\-\.:]/.test(e)?new Function(t.arg+",tmpl","var _e=tmpl.encode"+t.helper+",_s='"+e.replace(t.regexp,t.func)+"';return _s;"):t.cache[e]=t.cache[e]||t(t.load(e));return n?r(n,t):function(e){return r(e,t)}};t.cache={},t.load=function(e){return document.getElementById(e).innerHTML},t.regexp=/([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g,t.func=function(e,t,n,r,i,s){if(t)return{"\n":"\\n","\r":"\\r","	":"\\t"," ":" "}[e]||"\\"+e;if(n)return n==="="?"'+_e("+r+")+'":"'+("+r+"||'')+'";if(i)return"';";if(s)return"_s+='"},t.encReg=/[<>&"'\x00]/g,t.encMap={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;","'":"&#39;"},t.encode=function(e){return String(e||"").replace(t.encReg,function(e){return t.encMap[e]||""})},t.arg="o",t.helper=",print=function(s,e){_s+=e&&(s||'')||_e(s);},include=function(s,d){_s+=tmpl(s,d);}",typeof define=="function"&&define.amd?define("tmpl",[],function(){return t}):e.tmpl=t}(this),function(e){typeof define=="function"&&define.amd?define("jquery.iframe-transport",["jquery"],e):e(window.jQuery)}(function(e){var t=0;e.ajaxTransport("iframe",function(n){if(n.async&&(n.type==="POST"||n.type==="GET")){var r,i;return{send:function(s,o){r=e('<form style="display:none;"></form>'),i=e('<iframe src="javascript:false;" name="iframe-transport-'+(t+=1)+'"></iframe>').bind("load",function(){var t,s=e.isArray(n.paramName)?n.paramName:[n.paramName];i.unbind("load").bind("load",function(){var t;try{t=i.contents();if(!t.length||!t[0].firstChild)throw new Error}catch(n){t=undefined}o(200,"success",{iframe:t}),e('<iframe src="javascript:false;"></iframe>').appendTo(r),r.remove()}),r.prop("target",i.prop("name")).prop("action",n.url).prop("method",n.type),n.formData&&e.each(n.formData,function(t,n){e('<input type="hidden"/>').prop("name",n.name).val(n.value).appendTo(r)}),n.fileInput&&n.fileInput.length&&n.type==="POST"&&(t=n.fileInput.clone(),n.fileInput.after(function(e){return t[e]}),n.paramName&&n.fileInput.each(function(t){e(this).prop("name",s[t]||n.paramName)}),r.append(n.fileInput).prop("enctype","multipart/form-data").prop("encoding","multipart/form-data")),r.submit(),t&&t.length&&n.fileInput.each(function(n,r){var i=e(t[n]);e(r).prop("name",i.prop("name")),i.replaceWith(r)})}),r.append(i).appendTo(document.body)},abort:function(){i&&i.unbind("load").prop("src","javascript".concat(":false;")),r&&r.remove()}}}}),e.ajaxSetup({converters:{"iframe text":function(t){return e(t[0].body).text()},"iframe json":function(t){return e.parseJSON(e(t[0].body).text())},"iframe html":function(t){return e(t[0].body).html()},"iframe script":function(t){return e.globalEval(e(t[0].body).text())}}})}),function(e){typeof define=="function"&&define.amd?define("jquery.fileupload",["jquery","jquery.ui.widget"],e):e(window.jQuery)}(function(e){function t(t){var n=t==="dragover";return function(r){r.dataTransfer=r.originalEvent&&r.originalEvent.dataTransfer;var i=r.dataTransfer;i&&e.inArray("Files",i.types)!==-1&&this._trigger(t,e.Event(t,{delegatedEvent:r}))!==!1&&(r.preventDefault(),n&&(i.dropEffect="copy"))}}e.support.fileInput=!(new RegExp("(Android (1\\.[0156]|2\\.[01]))|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)|(w(eb)?OSBrowser)|(webOS)|(Kindle/(1\\.0|2\\.[05]|3\\.0))")).test(window.navigator.userAgent)&&!e('<input type="file">').prop("disabled"),e.support.xhrFileUpload=!!window.ProgressEvent&&!!window.FileReader,e.support.xhrFormDataFileUpload=!!window.FormData,e.support.blobSlice=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice),e.widget("blueimp.fileupload",{options:{dropZone:e(document),pasteZone:undefined,fileInput:undefined,replaceFileInput:!0,paramName:undefined,singleFileUploads:!0,limitMultiFileUploads:undefined,limitMultiFileUploadSize:undefined,limitMultiFileUploadSizeOverhead:512,sequentialUploads:!1,limitConcurrentUploads:undefined,forceIframeTransport:!1,redirect:undefined,redirectParamName:undefined,postMessage:undefined,multipart:!0,maxChunkSize:undefined,uploadedBytes:undefined,recalculateProgress:!0,progressInterval:100,bitrateInterval:500,autoUpload:!0,messages:{uploadedBytes:"Uploaded bytes exceed file size"},i18n:function(t,n){return t=this.messages[t]||t.toString(),n&&e.each(n,function(e,n){t=t.replace("{"+e+"}",n)}),t},formData:function(e){return e.serializeArray()},add:function(t,n){if(t.isDefaultPrevented())return!1;(n.autoUpload||n.autoUpload!==!1&&e(this).fileupload("option","autoUpload"))&&n.process().done(function(){n.submit()})},processData:!1,contentType:!1,cache:!1},_specialOptions:["fileInput","dropZone","pasteZone","multipart","forceIframeTransport"],_blobSlice:e.support.blobSlice&&function(){var e=this.slice||this.webkitSlice||this.mozSlice;return e.apply(this,arguments)},_BitrateTimer:function(){this.timestamp=Date.now?Date.now():(new Date).getTime(),this.loaded=0,this.bitrate=0,this.getBitrate=function(e,t,n){var r=e-this.timestamp;if(!this.bitrate||!n||r>n)this.bitrate=(t-this.loaded)*(1e3/r)*8,this.loaded=t,this.timestamp=e;return this.bitrate}},_isXHRUpload:function(t){return!t.forceIframeTransport&&(!t.multipart&&e.support.xhrFileUpload||e.support.xhrFormDataFileUpload)},_getFormData:function(t){var n;return e.type(t.formData)==="function"?t.formData(t.form):e.isArray(t.formData)?t.formData:e.type(t.formData)==="object"?(n=[],e.each(t.formData,function(e,t){n.push({name:e,value:t})}),n):[]},_getTotal:function(t){var n=0;return e.each(t,function(e,t){n+=t.size||1}),n},_initProgressObject:function(t){var n={loaded:0,total:0,bitrate:0};t._progress?e.extend(t._progress,n):t._progress=n},_initResponseObject:function(e){var t;if(e._response)for(t in e._response)e._response.hasOwnProperty(t)&&delete e._response[t];else e._response={}},_onProgress:function(t,n){if(t.lengthComputable){var r=Date.now?Date.now():(new Date).getTime(),i;if(n._time&&n.progressInterval&&r-n._time<n.progressInterval&&t.loaded!==t.total)return;n._time=r,i=Math.floor(t.loaded/t.total*(n.chunkSize||n._progress.total))+(n.uploadedBytes||0),this._progress.loaded+=i-n._progress.loaded,this._progress.bitrate=this._bitrateTimer.getBitrate(r,this._progress.loaded,n.bitrateInterval),n._progress.loaded=n.loaded=i,n._progress.bitrate=n.bitrate=n._bitrateTimer.getBitrate(r,i,n.bitrateInterval),this._trigger("progress",e.Event("progress",{delegatedEvent:t}),n),this._trigger("progressall",e.Event("progressall",{delegatedEvent:t}),this._progress)}},_initProgressListener:function(t){var n=this,r=t.xhr?t.xhr():e.ajaxSettings.xhr();r.upload&&(e(r.upload).bind("progress",function(e){var r=e.originalEvent;e.lengthComputable=r.lengthComputable,e.loaded=r.loaded,e.total=r.total,n._onProgress(e,t)}),t.xhr=function(){return r})},_isInstanceOf:function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},_initXHRData:function(t){var n=this,r,i=t.files[0],s=t.multipart||!e.support.xhrFileUpload,o=e.type(t.paramName)==="array"?t.paramName[0]:t.paramName;t.headers=e.extend({},t.headers),t.contentRange&&(t.headers["Content-Range"]=t.contentRange);if(!s||t.blob||!this._isInstanceOf("File",i))t.headers["Content-Disposition"]='attachment; filename="'+encodeURI(i.name)+'"';s?e.support.xhrFormDataFileUpload&&(t.postMessage?(r=this._getFormData(t),t.blob?r.push({name:o,value:t.blob}):e.each(t.files,function(n,i){r.push({name:e.type(t.paramName)==="array"&&t.paramName[n]||o,value:i})})):(n._isInstanceOf("FormData",t.formData)?r=t.formData:(r=new FormData,e.each(this._getFormData(t),function(e,t){r.append(t.name,t.value)})),t.blob?r.append(o,t.blob,i.name):e.each(t.files,function(i,s){(n._isInstanceOf("File",s)||n._isInstanceOf("Blob",s))&&r.append(e.type(t.paramName)==="array"&&t.paramName[i]||o,s,s.uploadName||s.name)})),t.data=r):(t.contentType=i.type||"application/octet-stream",t.data=t.blob||i),t.blob=null},_initIframeSettings:function(t){var n=e("<a></a>").prop("href",t.url).prop("host");t.dataType="iframe "+(t.dataType||""),t.formData=this._getFormData(t),t.redirect&&n&&n!==location.host&&t.formData.push({name:t.redirectParamName||"redirect",value:t.redirect})},_initDataSettings:function(e){this._isXHRUpload(e)?(this._chunkedUpload(e,!0)||(e.data||this._initXHRData(e),this._initProgressListener(e)),e.postMessage&&(e.dataType="postmessage "+(e.dataType||""))):this._initIframeSettings(e)},_getParamName:function(t){var n=e(t.fileInput),r=t.paramName;return r?e.isArray(r)||(r=[r]):(r=[],n.each(function(){var t=e(this),n=t.prop("name")||"files[]",i=(t.prop("files")||[1]).length;while(i)r.push(n),i-=1}),r.length||(r=[n.prop("name")||"files[]"])),r},_initFormSettings:function(t){if(!t.form||!t.form.length)t.form=e(t.fileInput.prop("form")),t.form.length||(t.form=e(this.options.fileInput.prop("form")));t.paramName=this._getParamName(t),t.url||(t.url=t.form.prop("action")||location.href),t.type=(t.type||e.type(t.form.prop("method"))==="string"&&t.form.prop("method")||"").toUpperCase(),t.type!=="POST"&&t.type!=="PUT"&&t.type!=="PATCH"&&(t.type="POST"),t.formAcceptCharset||(t.formAcceptCharset=t.form.attr("accept-charset"))},_getAJAXSettings:function(t){var n=e.extend({},this.options,t);return this._initFormSettings(n),this._initDataSettings(n),n},_getDeferredState:function(e){return e.state?e.state():e.isResolved()?"resolved":e.isRejected()?"rejected":"pending"},_enhancePromise:function(e){return e.success=e.done,e.error=e.fail,e.complete=e.always,e},_getXHRPromise:function(t,n,r){var i=e.Deferred(),s=i.promise();return n=n||this.options.context||s,t===!0?i.resolveWith(n,r):t===!1&&i.rejectWith(n,r),s.abort=i.promise,this._enhancePromise(s)},_addConvenienceMethods:function(t,n){var r=this,i=function(t){return e.Deferred().resolveWith(r,t).promise()};n.process=function(t,s){if(t||s)n._processQueue=this._processQueue=(this._processQueue||i([this])).pipe(function(){return n.errorThrown?e.Deferred().rejectWith(r,[n]).promise():i(arguments)}).pipe(t,s);return this._processQueue||i([this])},n.submit=function(){return this.state()!=="pending"&&(n.jqXHR=this.jqXHR=r._trigger("submit",e.Event("submit",{delegatedEvent:t}),this)!==!1&&r._onSend(t,this)),this.jqXHR||r._getXHRPromise()},n.abort=function(){return this.jqXHR?this.jqXHR.abort():(this.errorThrown="abort",r._trigger("fail",null,this),r._getXHRPromise(!1))},n.state=function(){if(this.jqXHR)return r._getDeferredState(this.jqXHR);if(this._processQueue)return r._getDeferredState(this._processQueue)},n.processing=function(){return!this.jqXHR&&this._processQueue&&r._getDeferredState(this._processQueue)==="pending"},n.progress=function(){return this._progress},n.response=function(){return this._response}},_getUploadedBytes:function(e){var t=e.getResponseHeader("Range"),n=t&&t.split("-"),r=n&&n.length>1&&parseInt(n[1],10);return r&&r+1},_chunkedUpload:function(t,n){t.uploadedBytes=t.uploadedBytes||0;var r=this,i=t.files[0],s=i.size,o=t.uploadedBytes,u=t.maxChunkSize||s,a=this._blobSlice,f=e.Deferred(),l=f.promise(),c,h;return!(this._isXHRUpload(t)&&a&&(o||u<s))||t.data?!1:n?!0:o>=s?(i.error=t.i18n("uploadedBytes"),this._getXHRPromise(!1,t.context,[null,"error",i.error])):(h=function(){var n=e.extend({},t),l=n._progress.loaded;n.blob=a.call(i,o,o+u,i.type),n.chunkSize=n.blob.size,n.contentRange="bytes "+o+"-"+(o+n.chunkSize-1)+"/"+s,r._initXHRData(n),r._initProgressListener(n),c=(r._trigger("chunksend",null,n)!==!1&&e.ajax(n)||r._getXHRPromise(!1,n.context)).done(function(i,u,a){o=r._getUploadedBytes(a)||o+n.chunkSize,l+n.chunkSize-n._progress.loaded&&r._onProgress(e.Event("progress",{lengthComputable:!0,loaded:o-n.uploadedBytes,total:o-n.uploadedBytes}),n),t.uploadedBytes=n.uploadedBytes=o,n.result=i,n.textStatus=u,n.jqXHR=a,r._trigger("chunkdone",null,n),r._trigger("chunkalways",null,n),o<s?h():f.resolveWith(n.context,[i,u,a])}).fail(function(e,t,i){n.jqXHR=e,n.textStatus=t,n.errorThrown=i,r._trigger("chunkfail",null,n),r._trigger("chunkalways",null,n),f.rejectWith(n.context,[e,t,i])})},this._enhancePromise(l),l.abort=function(){return c.abort()},h(),l)},_beforeSend:function(e,t){this._active===0&&(this._trigger("start"),this._bitrateTimer=new this._BitrateTimer,this._progress.loaded=this._progress.total=0,this._progress.bitrate=0),this._initResponseObject(t),this._initProgressObject(t),t._progress.loaded=t.loaded=t.uploadedBytes||0,t._progress.total=t.total=this._getTotal(t.files)||1,t._progress.bitrate=t.bitrate=0,this._active+=1,this._progress.loaded+=t.loaded,this._progress.total+=t.total},_onDone:function(t,n,r,i){var s=i._progress.total,o=i._response;i._progress.loaded<s&&this._onProgress(e.Event("progress",{lengthComputable:!0,loaded:s,total:s}),i),o.result=i.result=t,o.textStatus=i.textStatus=n,o.jqXHR=i.jqXHR=r,this._trigger("done",null,i)},_onFail:function(e,t,n,r){var i=r._response;r.recalculateProgress&&(this._progress.loaded-=r._progress.loaded,this._progress.total-=r._progress.total),i.jqXHR=r.jqXHR=e,i.textStatus=r.textStatus=t,i.errorThrown=r.errorThrown=n,this._trigger("fail",null,r)},_onAlways:function(e,t,n,r){this._trigger("always",null,r)},_onSend:function(t,n){n.submit||this._addConvenienceMethods(t,n);var r=this,i,s,o,u,a=r._getAJAXSettings(n),f=function(){return r._sending+=1,a._bitrateTimer=new r._BitrateTimer,i=i||((s||r._trigger("send",e.Event("send",{delegatedEvent:t}),a)===!1)&&r._getXHRPromise(!1,a.context,s)||r._chunkedUpload(a)||e.ajax(a)).done(function(e,t,n){r._onDone(e,t,n,a)}).fail(function(e,t,n){r._onFail(e,t,n,a)}).always(function(e,t,n){r._onAlways(e,t,n,a),r._sending-=1,r._active-=1;if(a.limitConcurrentUploads&&a.limitConcurrentUploads>r._sending){var i=r._slots.shift();while(i){if(r._getDeferredState(i)==="pending"){i.resolve();break}i=r._slots.shift()}}r._active===0&&r._trigger("stop")}),i};return this._beforeSend(t,a),this.options.sequentialUploads||this.options.limitConcurrentUploads&&this.options.limitConcurrentUploads<=this._sending?(this.options.limitConcurrentUploads>1?(o=e.Deferred(),this._slots.push(o),u=o.pipe(f)):(this._sequence=this._sequence.pipe(f,f),u=this._sequence),u.abort=function(){return s=[undefined,"abort","abort"],i?i.abort():(o&&o.rejectWith(a.context,s),f())},this._enhancePromise(u)):f()},_onAdd:function(t,n){var r=this,i=!0,s=e.extend({},this.options,n),o=n.files,u=o.length,a=s.limitMultiFileUploads,f=s.limitMultiFileUploadSize,l=s.limitMultiFileUploadSizeOverhead,c=0,h=this._getParamName(s),p,d,v,m,g=0;f&&(!u||o[0].size===undefined)&&(f=undefined);if(!(s.singleFileUploads||a||f)||!this._isXHRUpload(s))v=[o],p=[h];else if(!s.singleFileUploads&&!f&&a){v=[],p=[];for(m=0;m<u;m+=a)v.push(o.slice(m,m+a)),d=h.slice(m,m+a),d.length||(d=h),p.push(d)}else if(!s.singleFileUploads&&f){v=[],p=[];for(m=0;m<u;m+=1){c+=o[m].size+l;if(m+1===u||c+o[m+1].size+l>f||a&&m+1-g>=a)v.push(o.slice(g,m+1)),d=h.slice(g,m+1),d.length||(d=h),p.push(d),g=m+1,c=0}}else p=h;return n.originalFiles=o,e.each(v||o,function(s,o){var u=e.extend({},n);return u.files=v?o:[o],u.paramName=p[s],r._initResponseObject(u),r._initProgressObject(u),r._addConvenienceMethods(t,u),i=r._trigger("add",e.Event("add",{delegatedEvent:t}),u),i}),i},_replaceFileInput:function(t){var n=t.fileInput,r=n.clone(!0);t.fileInputClone=r,e("<form></form>").append(r)[0].reset(),n.after(r).detach(),e.cleanData(n.unbind("remove")),this.options.fileInput=this.options.fileInput.map(function(e,t){return t===n[0]?r[0]:t}),n[0]===this.element[0]&&(this.element=r)},_handleFileTreeEntry:function(t,n){var r=this,i=e.Deferred(),s=function(e){e&&!e.entry&&(e.entry=t),i.resolve([e])},o=function(e){r._handleFileTreeEntries(e,n+t.name+"/").done(function(e){i.resolve(e)}).fail(s)},u=function(){a.readEntries(function(e){e.length?(f=f.concat(e),u()):o(f)},s)},a,f=[];return n=n||"",t.isFile?t._file?(t._file.relativePath=n,i.resolve(t._file)):t.file(function(e){e.relativePath=n,i.resolve(e)},s):t.isDirectory?(a=t.createReader(),u()):i.resolve([]),i.promise()},_handleFileTreeEntries:function(t,n){var r=this;return e.when.apply(e,e.map(t,function(e){return r._handleFileTreeEntry(e,n)})).pipe(function(){return Array.prototype.concat.apply([],arguments)})},_getDroppedFiles:function(t){t=t||{};var n=t.items;return n&&n.length&&(n[0].webkitGetAsEntry||n[0].getAsEntry)?this._handleFileTreeEntries(e.map(n,function(e){var t;return e.webkitGetAsEntry?(t=e.webkitGetAsEntry(),t&&(t._file=e.getAsFile()),t):e.getAsEntry()})):e.Deferred().resolve(e.makeArray(t.files)).promise()},_getSingleFileInputFiles:function(t){t=e(t);var n=t.prop("webkitEntries")||t.prop("entries"),r,i;if(n&&n.length)return this._handleFileTreeEntries(n);r=e.makeArray(t.prop("files"));if(!r.length){i=t.prop("value");if(!i)return e.Deferred().resolve([]).promise();r=[{name:i.replace(/^.*\\/,"")}]}else r[0].name===undefined&&r[0].fileName&&e.each(r,function(e,t){t.name=t.fileName,t.size=t.fileSize});return e.Deferred().resolve(r).promise()},_getFileInputFiles:function(t){return t instanceof e&&t.length!==1?e.when.apply(e,e.map(t,this._getSingleFileInputFiles)).pipe(function(){return Array.prototype.concat.apply([],arguments)}):this._getSingleFileInputFiles(t)},_onChange:function(t){var n=this,r={fileInput:e(t.target),form:e(t.target.form)};this._getFileInputFiles(r.fileInput).always(function(i){r.files=i,n.options.replaceFileInput&&n._replaceFileInput(r),n._trigger("change",e.Event("change",{delegatedEvent:t}),r)!==!1&&n._onAdd(t,r)})},_onPaste:function(t){var n=t.originalEvent&&t.originalEvent.clipboardData&&t.originalEvent.clipboardData.items,r={files:[]};n&&n.length&&(e.each(n,function(e,t){var n=t.getAsFile&&t.getAsFile();n&&r.files.push(n)}),this._trigger("paste",e.Event("paste",{delegatedEvent:t}),r)!==!1&&this._onAdd(t,r))},_onDrop:function(t){t.dataTransfer=t.originalEvent&&t.originalEvent.dataTransfer;var n=this,r=t.dataTransfer,i={};r&&r.files&&r.files.length&&(t.preventDefault(),this._getDroppedFiles(r).always(function(r){i.files=r,n._trigger("drop",e.Event("drop",{delegatedEvent:t}),i)!==!1&&n._onAdd(t,i)}))},_onDragOver:t("dragover"),_onDragEnter:t("dragenter"),_onDragLeave:t("dragleave"),_initEventHandlers:function(){this._isXHRUpload(this.options)&&(this._on(this.options.dropZone,{dragover:this._onDragOver,drop:this._onDrop,dragenter:this._onDragEnter,dragleave:this._onDragLeave}),this._on(this.options.pasteZone,{paste:this._onPaste})),e.support.fileInput&&this._on(this.options.fileInput,{change:this._onChange})},_destroyEventHandlers:function(){this._off(this.options.dropZone,"dragenter dragleave dragover drop"),this._off(this.options.pasteZone,"paste"),this._off(this.options.fileInput,"change")},_setOption:function(t,n){var r=e.inArray(t,this._specialOptions)!==-1;r&&this._destroyEventHandlers(),this._super(t,n),r&&(this._initSpecialOptions(),this._initEventHandlers())},_initSpecialOptions:function(){var t=this.options;t.fileInput===undefined?t.fileInput=this.element.is('input[type="file"]')?this.element:this.element.find('input[type="file"]'):t.fileInput instanceof e||(t.fileInput=e(t.fileInput)),t.dropZone instanceof e||(t.dropZone=e(t.dropZone)),t.pasteZone instanceof e||(t.pasteZone=e(t.pasteZone))},_getRegExp:function(e){var t=e.split("/"),n=t.pop();return t.shift(),new RegExp(t.join("/"),n)},_isRegExpOption:function(t,n){return t!=="url"&&e.type(n)==="string"&&/^\/.*\/[igm]{0,3}$/.test(n)},_initDataAttributes:function(){var t=this,n=this.options,r=e(this.element[0].cloneNode(!1)),i=r.data();r.remove(),e.each(i,function(e,i){var s="data-"+e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();r.attr(s)&&(t._isRegExpOption(e,i)&&(i=t._getRegExp(i)),n[e]=i)})},_create:function(){this._initDataAttributes(),this._initSpecialOptions(),this._slots=[],this._sequence=this._getXHRPromise(!0),this._sending=this._active=0,this._initProgressObject(this),this._initEventHandlers()},active:function(){return this._active},progress:function(){return this._progress},add:function(t){var n=this;if(!t||this.options.disabled)return;t.fileInput&&!t.files?this._getFileInputFiles(t.fileInput).always(function(e){t.files=e,n._onAdd(null,t)}):(t.files=e.makeArray(t.files),this._onAdd(null,t))},send:function(t){if(t&&!this.options.disabled){if(t.fileInput&&!t.files){var n=this,r=e.Deferred(),i=r.promise(),s,o;return i.abort=function(){return o=!0,s?s.abort():(r.reject(null,"abort","abort"),i)},this._getFileInputFiles(t.fileInput).always(function(e){if(o)return;if(!e.length){r.reject();return}t.files=e,s=n._onSend(null,t),s.then(function(e,t,n){r.resolve(e,t,n)},function(e,t,n){r.reject(e,t,n)})}),this._enhancePromise(i)}t.files=e.makeArray(t.files);if(t.files.length)return this._onSend(null,t)}return this._getXHRPromise(!1,t&&t.context)}})}),function(e){typeof define=="function"&&define.amd?define("jquery.fileupload-process",["jquery","jquery.fileupload"],e):e(window.jQuery)}(function(e){var t=e.blueimp.fileupload.prototype.options.add;e.widget("blueimp.fileupload",e.blueimp.fileupload,{options:{processQueue:[],add:function(n,r){var i=e(this);r.process(function(){return i.fileupload("process",r)}),t.call(this,n,r)}},processActions:{},_processFile:function(t,n){var r=this,i=e.Deferred().resolveWith(r,[t]),s=i.promise();return this._trigger("process",null,t),e.each(t.processQueue,function(t,i){var o=function(t){return n.errorThrown?e.Deferred().rejectWith(r,[n]).promise():r.processActions[i.action].call(r,t,i)};s=s.pipe(o,i.always&&o)}),s.done(function(){r._trigger("processdone",null,t),r._trigger("processalways",null,t)}).fail(function(){r._trigger("processfail",null,t),r._trigger("processalways",null,t)}),s},_transformProcessQueue:function(t){var n=[];e.each(t.processQueue,function(){var r={},i=this.action,s=this.prefix===!0?i:this.prefix;e.each(this,function(n,i){e.type(i)==="string"&&i.charAt(0)==="@"?r[n]=t[i.slice(1)||(s?s+n.charAt(0).toUpperCase()+n.slice(1):n)]:r[n]=i}),n.push(r)}),t.processQueue=n},processing:function(){return this._processing},process:function(t){var n=this,r=e.extend({},this.options,t);return r.processQueue&&r.processQueue.length&&(this._transformProcessQueue(r),this._processing===0&&this._trigger("processstart"),e.each(t.files,function(i){var s=i?e.extend({},r):r,o=function(){return t.errorThrown?e.Deferred().rejectWith(n,[t]).promise():n._processFile(s,t)};s.index=i,n._processing+=1,n._processingQueue=n._processingQueue.pipe(o,o).always(function(){n._processing-=1,n._processing===0&&n._trigger("processstop")})})),this._processingQueue},_create:function(){this._super(),this._processing=0,this._processingQueue=e.Deferred().resolveWith(this).promise()}})}),function(e){typeof define=="function"&&define.amd?define("jquery.fileupload-validate",["jquery","jquery.fileupload-process"],e):e(window.jQuery)}(function(e){e.blueimp.fileupload.prototype.options.processQueue.push({action:"validate",always:!0,acceptFileTypes:"@",maxFileSize:"@",minFileSize:"@",maxNumberOfFiles:"@",disabled:"@disableValidation"}),e.widget("blueimp.fileupload",e.blueimp.fileupload,{options:{getNumberOfFiles:e.noop,messages:{maxNumberOfFiles:"Maximum number of files exceeded",acceptFileTypes:"File type not allowed",maxFileSize:"File is too large",minFileSize:"File is too small"}},processActions:{validate:function(t,n){if(n.disabled)return t;var r=e.Deferred(),i=this.options,s=t.files[t.index],o;if(n.minFileSize||n.maxFileSize)o=s.size;return e.type(n.maxNumberOfFiles)==="number"&&(i.getNumberOfFiles()||0)+t.files.length>n.maxNumberOfFiles?s.error=i.i18n("maxNumberOfFiles"):n.acceptFileTypes&&!n.acceptFileTypes.test(s.type)&&!n.acceptFileTypes.test(s.name)?s.error=i.i18n("acceptFileTypes"):o>n.maxFileSize?s.error=i.i18n("maxFileSize"):e.type(o)==="number"&&o<n.minFileSize?s.error=i.i18n("minFileSize"):delete s.error,s.error||t.files.error?(t.files.error=!0,r.rejectWith(this,[t])):r.resolveWith(this,[t]),r.promise()}}})}),function(e){typeof define=="function"&&define.amd?define("jquery.fileupload-ui",["jquery","tmpl","jquery.iframe-transport","jquery.fileupload-validate"],e):e(window.jQuery,window.tmpl)}(function(e,t){e.blueimp.fileupload.prototype._specialOptions.push("filesContainer","uploadTemplateId","downloadTemplateId"),e.widget("blueimp.fileupload",e.blueimp.fileupload,{options:{autoUpload:!1,uploadTemplateId:"template-upload",downloadTemplateId:"template-download",filesContainer:undefined,prependFiles:!1,dataType:"json",messages:{unknownError:"Unknown error"},getNumberOfFiles:function(){return this.filesContainer.children().not(".processing").length},getFilesFromResponse:function(t){return t.result&&e.isArray(t.result.files)?t.result.files:[]},add:function(t,n){if(t.isDefaultPrevented())return!1;var r=e(this),i=r.data("blueimp-fileupload")||r.data("fileupload"),s=i.options;n.context=i._renderUpload(n.files).data("data",n).addClass("processing"),s.filesContainer[s.prependFiles?"prepend":"append"](n.context),i._forceReflow(n.context),i._transition(n.context),n.process(function(){return r.fileupload("process",n)}).always(function(){n.context.each(function(t){e(this).find(".size").text(i._formatFileSize(n.files[t].size))}).removeClass("processing"),i._renderPreviews(n)}).done(function(){n.context.find(".start").prop("disabled",!1),i._trigger("added",t,n)!==!1&&(s.autoUpload||n.autoUpload)&&n.autoUpload!==!1&&n.submit()}).fail(function(){n.files.error&&n.context.each(function(t){var r=n.files[t].error;r&&e(this).find(".error").text(r)})})},send:function(t,n){if(t.isDefaultPrevented())return!1;var r=e(this).data("blueimp-fileupload")||e(this).data("fileupload");return n.context&&n.dataType&&n.dataType.substr(0,6)==="iframe"&&n.context.find(".progress").addClass(!e.support.transition&&"progress-animated").attr("aria-valuenow",100).children().first().css("width","100%"),r._trigger("sent",t,n)},done:function(t,n){if(t.isDefaultPrevented())return!1;var r=e(this).data("blueimp-fileupload")||e(this).data("fileupload"),i=n.getFilesFromResponse||r.options.getFilesFromResponse,s=i(n),o,u;n.context?n.context.each(function(i){var a=s[i]||{error:"Empty file upload result"};u=r._addFinishedDeferreds(),r._transition(e(this)).done(function(){var i=e(this);o=r._renderDownload([a]).replaceAll(i),r._forceReflow(o),r._transition(o).done(function(){n.context=e(this),r._trigger("completed",t,n),r._trigger("finished",t,n),u.resolve()})})}):(o=r._renderDownload(s)[r.options.prependFiles?"prependTo":"appendTo"](r.options.filesContainer),r._forceReflow(o),u=r._addFinishedDeferreds(),r._transition(o).done(function(){n.context=e(this),r._trigger("completed",t,n),r._trigger("finished",t,n),u.resolve()}))},fail:function(t,n){if(t.isDefaultPrevented())return!1;var r=e(this).data("blueimp-fileupload")||e(this).data("fileupload"),i,s;n.context?n.context.each(function(o){var u=n.files[o];n.errorThrown!=="abort"?u.error=u.error||n.errorThrown||n.i18n("unknownError"):u.canceled=!0,s=r._addFinishedDeferreds(),r._transition(e(this)).done(function(){var o=e(this);i=r._renderDownload([u]).replaceAll(o),r._forceReflow(i),r._transition(i).done(function(){n.context=e(this),r._trigger("failed",t,n),r._trigger("finished",t,n),s.resolve()})})}):n.errorThrown!=="abort"?(n.context=r._renderUpload(n.files)[r.options.prependFiles?"prependTo":"appendTo"](r.options.filesContainer).data("data",n),r._forceReflow(n.context),s=r._addFinishedDeferreds(),r._transition(n.context).done(function(){n.context=e(this),r._trigger("failed",t,n),r._trigger("finished",t,n),s.resolve()})):(r._trigger("failed",t,n),r._trigger("finished",t,n),r._addFinishedDeferreds().resolve())},progress:function(t,n){if(t.isDefaultPrevented())return!1;var r=Math.floor(n.loaded/n.total*100);n.context&&n.context.each(function(){e(this).find(".progress").attr("aria-valuenow",r).children().first().css("width",r+"%")})},progressall:function(t,n){if(t.isDefaultPrevented())return!1;var r=e(this),i=Math.floor(n.loaded/n.total*100),s=r.find(".fileupload-progress"),o=s.find(".progress-extended");o.length&&o.html((r.data("blueimp-fileupload")||r.data("fileupload"))._renderExtendedProgress(n)),s.find(".progress").attr("aria-valuenow",i).children().first().css("width",i+"%")},start:function(t){if(t.isDefaultPrevented())return!1;var n=e(this).data("blueimp-fileupload")||e(this).data("fileupload");n._resetFinishedDeferreds(),n._transition(e(this).find(".fileupload-progress")).done(function(){n._trigger("started",t)})},stop:function(t){if(t.isDefaultPrevented())return!1;var n=e(this).data("blueimp-fileupload")||e(this).data("fileupload"),r=n._addFinishedDeferreds();e.when.apply(e,n._getFinishedDeferreds()).done(function(){n._trigger("stopped",t)}),n._transition(e(this).find(".fileupload-progress")).done(function(){e(this).find(".progress").attr("aria-valuenow","0").children().first().css("width","0%"),e(this).find(".progress-extended").html("&nbsp;"),r.resolve()})},processstart:function(t){if(t.isDefaultPrevented())return!1;e(this).addClass("fileupload-processing")},processstop:function(t){if(t.isDefaultPrevented())return!1;e(this).removeClass("fileupload-processing")},destroy:function(t,n){if(t.isDefaultPrevented())return!1;var r=e(this).data("blueimp-fileupload")||e(this).data("fileupload"),i=function(){r._transition(n.context).done(function(){e(this).remove(),r._trigger("destroyed",t,n)})};n.url?(n.dataType=n.dataType||r.options.dataType,e.ajax(n).done(i).fail(function(){r._trigger("destroyfailed",t,n)})):i()}},_resetFinishedDeferreds:function(){this._finishedUploads=[]},_addFinishedDeferreds:function(t){return t||(t=e.Deferred()),this._finishedUploads.push(t),t},_getFinishedDeferreds:function(){return this._finishedUploads},_enableDragToDesktop:function(){var t=e(this),n=t.prop("href"),r=t.prop("download"),i="application/octet-stream";t.bind("dragstart",function(e){try{e.originalEvent.dataTransfer.setData("DownloadURL",[i,r,n].join(":"))}catch(t){}})},_formatFileSize:function(e){return typeof e!="number"?"":e>=1e9?(e/1e9).toFixed(2)+" GB":e>=1e6?(e/1e6).toFixed(2)+" MB":(e/1e3).toFixed(2)+" KB"},_formatBitrate:function(e){return typeof e!="number"?"":(e/=8,e>=1e9?(e/1e9).toFixed(2)+" GB/s":e>=1e6?(e/1e6).toFixed(2)+" MB/s":e>=1e3?(e/1e3).toFixed(2)+" KB/s":e.toFixed(2)+" B/s")},_formatTime:function(e){var t=new Date(e*1e3),n=Math.floor(e/86400);return n=n?n+"d ":"",n+("0"+t.getUTCHours()).slice(-2)+":"+("0"+t.getUTCMinutes()).slice(-2)+":"+("0"+t.getUTCSeconds()).slice(-2)},_formatPercentage:function(e){return(e*100).toFixed(2)+" %"},_renderExtendedProgress:function(e){return this._formatBitrate(e.bitrate)+" | "+this._formatTime((e.total-e.loaded)*8/e.bitrate)+" | "+this._formatPercentage(e.loaded/e.total)+" | "+this._formatFileSize(e.loaded)+" / "+this._formatFileSize(e.total)},_renderTemplate:function(t,n){if(!t)return e();var r=t({files:n,formatFileSize:this._formatFileSize,options:this.options});return r instanceof e?r:e(this.options.templatesContainer).html(r).children()},_renderPreviews:function(t){t.context.find(".preview").each(function(n,r){e(r).append(t.files[n].preview)})},_renderUpload:function(e){return this._renderTemplate(this.options.uploadTemplate,e)},_renderDownload:function(e){return this._renderTemplate(this.options.downloadTemplate,e).find("a[download]").each(this._enableDragToDesktop).end()},_startHandler:function(t){t.preventDefault();var n=e(t.currentTarget),r=n.closest(".template-upload"),i=r.data("data");n.prop("disabled",!0),i&&i.submit&&i.submit()},_cancelHandler:function(t){t.preventDefault();var n=e(t.currentTarget).closest(".template-upload,.template-download"),r=n.data("data")||{};r.context=r.context||n,r.abort?r.abort():(r.errorThrown="abort",this._trigger("fail",t,r))},_deleteHandler:function(t){t.preventDefault();var n=e(t.currentTarget);this._trigger("destroy",t,e.extend({context:n.closest(".template-download"),type:"DELETE"},n.data()))},_forceReflow:function(t){return e.support.transition&&t.length&&t[0].offsetWidth},_transition:function(t){var n=e.Deferred();return e.support.transition&&t.hasClass("fade")&&t.is(":visible")?t.bind(e.support.transition.end,function(r){r.target===t[0]&&(t.unbind(e.support.transition.end),n.resolveWith(t))}).toggleClass("in"):(t.toggleClass("in"),n.resolveWith(t)),n},_initButtonBarEventHandlers:function(){var t=this.element.find(".fileupload-buttonbar"),n=this.options.filesContainer;this._on(t.find(".start"),{click:function(e){e.preventDefault(),n.find(".start").click()}}),this._on(t.find(".cancel"),{click:function(e){e.preventDefault(),n.find(".cancel").click()}}),this._on(t.find(".delete"),{click:function(e){e.preventDefault(),n.find(".toggle:checked").closest(".template-download").find(".delete").click(),t.find(".toggle").prop("checked",!1)}}),this._on(t.find(".toggle"),{change:function(t){n.find(".toggle").prop("checked",e(t.currentTarget).is(":checked"))}})},_destroyButtonBarEventHandlers:function(){this._off(this.element.find(".fileupload-buttonbar").find(".start, .cancel, .delete"),"click"),this._off(this.element.find(".fileupload-buttonbar .toggle"),"change.")},_initEventHandlers:function(){this._super(),this._on(this.options.filesContainer,{"click .start":this._startHandler,"click .cancel":this._cancelHandler,"click .delete":this._deleteHandler}),this._initButtonBarEventHandlers()},_destroyEventHandlers:function(){this._destroyButtonBarEventHandlers(),this._off(this.options.filesContainer,"click"),this._super()},_enableFileInputButton:function(){this.element.find(".fileinput-button input").prop("disabled",!1).parent().removeClass("disabled")},_disableFileInputButton:function(){this.element.find(".fileinput-button input").prop("disabled",!0).parent().addClass("disabled")},_initTemplates:function(){var e=this.options;e.templatesContainer=this.document[0].createElement(e.filesContainer.prop("nodeName")),t&&(e.uploadTemplateId&&(e.uploadTemplate=t(e.uploadTemplateId)),e.downloadTemplateId&&(e.downloadTemplate=t(e.downloadTemplateId)))},_initFilesContainer:function(){var t=this.options;t.filesContainer===undefined?t.filesContainer=this.element.find(".files"):t.filesContainer instanceof e||(t.filesContainer=e(t.filesContainer))},_initSpecialOptions:function(){this._super(),this._initFilesContainer(),this._initTemplates()},_create:function(){this._super(),this._resetFinishedDeferreds(),e.support.fileInput||this._disableFileInputButton()},enable:function(){var e=!1;this.options.disabled&&(e=!0),this._super(),e&&(this.element.find("input, button").prop("disabled",!1),this._enableFileInputButton())},disable:function(){this.options.disabled||(this.element.find("input, button").prop("disabled",!0),this._disableFileInputButton()),this._super()}})}),define("app/views/fileupload",["common","backbone","jquery.fileupload-ui"],function(e,t,n){window.locale={fileupload:{errors:{maxFileSize:gettext("File is too big"),minFileSize:gettext("File is too small"),acceptFileTypes:gettext("Filetype not allowed"),maxNumberOfFiles:gettext("Max number of files exceeded"),uploadedBytes:gettext("Uploaded bytes exceed file size"),emptyResult:gettext("Empty file upload result")},error:gettext("Error"),uploaded:gettext("uploaded"),canceled:gettext("canceled"),start:gettext("Start"),cancel:gettext("Cancel"),destroy:gettext("Delete")}};var r=t.View.extend({el:$("#upload-file-dialog"),fileupdateConfirmTemplate:_.template($("#fileupdate-confirm-template").html()),initialize:function(t){var n=this.dirView=t.dirView,r=n.dir,i=this.$el.addClass("fixed-upload-file-dialog");this.popup_height="200px";var s=$(".status",i),o=$(".total-progress",i),u=$(".fileupload-buttonbar .cancel",i),a=$(".close",i),f=$(".saving-tip",i),l={uploading:gettext("File Uploading..."),complete:gettext("File Upload complete"),canceled:gettext("File Upload canceled"),failed:gettext("File Upload failed")},c=[],h=[],p=app.pageOptions.enable_upload_folder,d=app.pageOptions.enable_resumable_fileupload,v=[],m=[],g=this;i.fileupload({paramName:"file",getFilesFromResponse:function(e){if(e.result)return e.result},autoUpload:!0,maxNumberOfFiles:500,sequentialUploads:!0}).bind("fileuploadadd",function(e,t){if(!n.$el.is(":visible"))return!1;if(r.user_perm&&r.user_perm!="rw")return!1;i.removeClass("hide"),u.removeClass("hide"),a.addClass("hide");var s=r.path;i.fileupload("option",{formData:{parent_dir:s=="/"?s:s+"/"},maxChunkSize:undefined,uploadedBytes:undefined});if(!p)return;var o=n.$("#upload-menu");o.hasClass("hide")||o.find(".item").removeAttr("style").end().addClass("hide");var f=t.files[0];if(f.name=="."){t.files.shift();return}f.webkitRelativePath&&(f.relative_path=f.webkitRelativePath),f.relativePath&&(f.relative_path=f.relativePath+f.name)}).bind("fileuploadstart",function(){s.html(l.uploading)}).bind("fileuploadsubmit",function(t,n){if(n.files.length==0)return!1;var s=n.files[0];if(s.error)return!1;var o=function(){$.ajax({url:e.getUrl({name:"get_file_op_url",repo_id:r.repo_id}),data:{op_type:"upload",path:r.path},cache:!1,dataType:"json",success:function(t){if(p&&s.relative_path){var o=s.relative_path,u=o.substring(0,o.lastIndexOf("/")+1),a=i.fileupload("option","formData");a.relative_path=u,i.fileupload("option",{formData:a}),n.url=t.url,n.jqXHR=i.fileupload("send",n)}else{var f=1048576;d&&s.size&&s.size>f?(i.fileupload("option","maxChunkSize",f),$.ajax({url:e.getUrl({name:"get_file_uploaded_bytes",repo_id:r.repo_id}),data:{parent_dir:r.path,file_name:s.name},cache:!1,dataType:"json",success:function(e){i.fileupload("option","uploadedBytes",e.uploadedBytes),n.url=t.url,n.jqXHR=i.fileupload("send",n)}})):(n.url=t.url,n.jqXHR=i.fileupload("send",n))}},error:function(){s.error=gettext("Failed to get upload url")}})};if(s.relative_path||n.originalFiles.length>1)return o(),!1;var u=function(){$.ajax({url:e.getUrl({name:"get_file_op_url",repo_id:r.repo_id}),data:{op_type:"update",path:r.path},cache:!1,dataType:"json",success:function(e){var t=i.fileupload("option","formData");t.target_file=t.parent_dir+s.name,i.fileupload("option","formData",t),s.to_update=!0,n.url=e.url,n.jqXHR=i.fileupload("send",n)},error:function(){s.error=gettext("Failed to get update url")}})},a=r.where({is_file:!0}),f=[];$(a).each(function(){f.push(this.get("obj_name"))});if(f.indexOf(s.name)!=-1){var l=gettext("Replace file {filename}?").replace("{filename}",'<span class="op-target">'+e.HTMLescape(s.name)+"</span>"),c=$(g.fileupdateConfirmTemplate({title:l}));c.modal({onClose:function(){$.modal.close(),s.choose_to_update?u():s.choose_to_upload?o():(n.jqXHR=i.fileupload("send",n),n.jqXHR.abort())}}),$("#simplemodal-container").css({height:"auto"}),$(".yes",c).click(function(){var t=r.findWhere({obj_name:s.name});t.get("is_locked")?t.get("locked_by_me")?(s.choose_to_update=!0,$.modal.close()):($(".error",c).html(gettext("File is locked")).removeClass("hide"),e.disableButton($(this))):(s.choose_to_update=!0,$.modal.close())}),$(".no",c).click(function(){s.choose_to_upload=!0,$.modal.close()})}else o();return!1}).bind("fileuploadprogressall",function(e,t){o.html(parseInt(t.loaded/t.total*100,10)+"% "+'<span style="font-size:14px;color:#555;">('+$(this).data("blueimp-fileupload")._formatBitrate(t.bitrate)+")</span>").removeClass("hide"),t.loaded>0&&t.loaded==t.total&&f.show()}).bind("fileuploaddone",function(e,t){if(t.textStatus!="success")return;var n=t.files[0],i=n.relative_path,s=t.result[0];s.uploaded=!0,i&&(s.relative_path=i.substring(0,i.lastIndexOf("/")+1)+s.name);var o=r.path;o=o=="/"?o:o+"/";if(t.formData.parent_dir!=o)return;if(!i){n.to_update?h.push(s):c.push(s);return}if(!p)return;var u=i.substring(0,i.indexOf("/")),a=r.where({is_dir:!0,obj_name:u});a.length>0?m.indexOf(u)==-1&&m.push(u):v.indexOf(u)==-1&&v.push(u)}).bind("fileuploadstop",function(){u.addClass("hide"),a.removeClass("hide");var t=r.path;t=t=="/"?t:t+"/";if(i.fileupload("option","formData").parent_dir!=t)return;var s=parseInt((new Date).getTime()/1e3);c.length>0&&($(c).each(function(t,i){var o=r.add({is_file:!0,is_img:e.imageCheck(i.name),obj_name:i.name,last_modified:s,file_size:e.fileSizeFormat(i.size,1),obj_id:i.id,file_icon:"file.png",perm:"rw",last_update:gettext("Just now"),starred:!1},{silent:!0});n.addNewFile(o)}),c=[]),v.length>0&&($(v).each(function(e,i){var o=r.add({is_dir:!0,obj_name:i,perm:"rw",last_modified:s,last_update:gettext("Just now"),p_dpath:t+i},{silent:!0});n.addNewDir(o)}),v=[]),m.length>0&&($(m).each(function(e,t){var n=r.where({is_dir:!0,obj_name:t});n[0].set({last_modified:s,last_update:gettext("Just now")})}),m=[]),h.length>0&&($(h).each(function(t,n){var i=r.where({is_file:!0,obj_name:n.name});i[0].set({obj_id:n.id,file_size:e.fileSizeFormat(n.size,1),last_modified:s,last_update:gettext("Just now")})}),h=[])}).bind("fileuploadcompleted",function(){$(".files .cancel",i).length==0&&(f.hide(),o.addClass("hide"),s.html(l.complete))}).bind("fileuploadfailed",function(e,t){$(".files .cancel",i).length==0&&(u.addClass("hide"),a.removeClass("hide"),o.addClass("hide"),f.hide(),t.errorThrown=="abort"?s.html(l.canceled):s.html(l.failed))});var y=app.pageOptions.max_upload_file_size;y&&i.fileupload("option","maxFileSize",y),i.fileupload("option","redirect",window.location.href.replace(/\/repo\/[-a-z0-9]{36}\/.*/,app.config.mediaUrl+"cors/result.html?%s")),$(document).click(function(e){var t=e.target||event.srcElement,r=function(e,n){!e.hasClass("hide")&&!e.is(t)&&!e.find("*").is(t)&&!n.is(t)&&!n.find("*").is(t)&&e.addClass("hide")};r(n.$("#upload-menu"),n.$("#upload-file"))})},events:{"click .fold-switch":"foldAndUnfoldPopup","click .close":"closePopup"},foldAndUnfoldPopup:function(){var e=this.$el,t=parseInt(this.popup_height),n=$(".fileupload-buttonbar, .table",e);e.height()==t?(e.height($(".hd",e).outerHeight(!0)),n.addClass("hide")):(e.height(t),n.removeClass("hide"))},closePopup:function(){var e=this.$el;e.addClass("hide"),$(".files",e).empty()},setFileInput:function(){var e=this.dirView,t=e.dir,n=this.$el;t.user_perm&&t.user_perm=="rw"&&n.fileupload("option","fileInput",e.$("#upload-file input"));if(!app.pageOptions.enable_upload_folder)return;var r=e.$("#upload-file"),i=e.$("#upload-menu");t.user_perm&&t.user_perm=="rw"&&"webkitdirectory"in $('input[type="file"]',r)[0]&&(r.find("input").remove().end().addClass("cspt"),$(".item",i).click(function(){n.fileupload("option","fileInput",$('input[type="file"]',$(this)))}).hover(function(){$(this).css({background:"#f3f3f3"})},function(){$(this).css({background:"transparent"})}),r.click(function(){i.toggleClass("hide"),i.css({left:r.position().left,top:parseInt(e.$(".repo-op").css("padding-top"))+r.outerHeight(!0)})}))}});return r}),define("app/views/dir",["jquery","jquery.ui.progressbar","jquery.magnific-popup","simplemodal","underscore","backbone","common","file-tree","app/collections/dirents","app/views/dirent","app/views/fileupload","app/views/share"],function(e,t,n,r,i,s,o,u,a,f,l,c){var h=s.View.extend({el:e("#dir-view"),path_bar_template:i.template(e("#dir-path-bar-tmpl").html()),dir_op_bar_template:i.template(e("#dir-op-bar-tmpl").html()),dirents_hd_template:i.template(e("#dirents-hd-tmpl").html()),newDirTemplate:i.template(e("#add-new-dir-form-template").html()),newFileTemplate:i.template(e("#add-new-file-form-template").html()),mvcpTemplate:i.template(e("#mvcp-form-template").html()),mvProgressTemplate:i.template(e("#mv-progress-popup-template").html()),initialize:function(t){this.$dirent_list=this.$(".repo-file-list tbody"),this.$path_bar=this.$(".path"),this.$dir_op_bar=this.$(".repo-op"),this.dir=new a,this.listenTo(this.dir,"add",this.addOne),this.listenTo(this.dir,"reset",this.reset),this.fileUploadView=new l({dirView:this}),this.$el.magnificPopup({type:"image",delegate:".img-name-link",tClose:gettext("Close (Esc)"),tLoading:gettext("Loading..."),gallery:{enabled:!0,tPrev:gettext("Previous (Left arrow key)"),tNext:gettext("Next (Right arrow key)"),tCounter:gettext("%curr% of %total%")},image:{titleSrc:function(e){var t=e.el,n=t[0].innerHTML,r='<a href="'+t.attr("href")+'" target="_blank">'+gettext("Open in New Tab")+"</a>";return n+"<br />"+r},tError:gettext('<a href="%url%" target="_blank">The image</a> could not be loaded.')}});var n=this;e(window).scroll(function(){e(n.el).is(":visible")&&n.onWindowScroll()}),app.globalState.noFileOpPopup=!0,e(document).click(function(t){var n=t.target||event.srcElement,r=e(".hidden-op");!app.globalState.noFileOpPopup&&!e(".more-op-icon, .hidden-op").is(n)&&!r.find("*").is(n)&&(r.addClass("hide"),app.globalState.noFileOpPopup=!0,app.globalState.popup_tr.find("*").is(n)||(app.globalState.popup_tr.removeClass("hl").find(".repo-file-op").addClass("vh"),e(".repo-file-list tr:gt(0)").each(function(){e(this).find("*").is(n)&&e(this).addClass("hl").find(".repo-file-op").removeClass("vh")})))})},showDir:function(t,n,r){this.$el.show(),this.$dirent_list.empty();var i=this.$(".loading-tip").show(),s=this.dir;s.setPath(t,n,r);var u=this;s.fetch({cache:!1,reset:!0,data:{p:r},success:function(e,t,n){s.last_start=0,(t.dirent_list.length==0||!t.dirent_more)&&i.hide()},error:function(s,a,f){i.hide();var l=u.$(".repo-file-list-topbar, .repo-file-list").hide(),c=u.$(".error"),h,p=!1;a.responseText?a.responseJSON.lib_need_decrypt?p=!0:h=a.responseJSON.error:h=gettext("Please check the network."),h&&c.html(h).show();if(p){var d=e(e("#repo-decrypt-form-template").html()),v=!1;d.modal({containerCss:{padding:"1px"},onClose:function(){e.modal.close(),l.show(),v||app.router.navigate(t+"/",{trigger:!0})}}),e("#simplemodal-container").css({height:"auto"}),d.submit(function(){var i=e.trim(e('[name="password"]',d).val());return i?(o.ajaxPost({form:d,form_id:d.attr("id"),post_url:o.getUrl({name:"repo_set_password"}),post_data:{repo_id:n,password:i,username:app.pageOptions.username},after_op_success:function(){v=!0,e.modal.close(),u.showDir(t,n,r)}}),!1):(e(".error",d).html(gettext("Password is required.")).removeClass("hide"),!1)})}}})},hide:function(){this.$el.hide()},addOne:function(e){var t=new f({model:e,dirView:this});this.$dirent_list.append(t.render().el)},reset:function(){this.dir.each(this.addOne,this),this.renderPath(),this.renderDirOpBar(),this.renderDirentsHd(),this.fileUploadView.setFileInput(),this.getImageThumbnail()},getImageThumbnail:function(){if(!app.pageOptions.enable_thumbnail||this.dir.encrypted)return!1;var t=this.dir.filter(function(e){return e.get("is_img")&&!e.get("encoded_thumbnail_src")});if(t.length==0)return;var n=t.length,r=this.dir.repo_id,i=this.dir.path,s=this,u=function(a){var f=t[a],l=o.pathJoin([i,f.get("obj_name")]);e.ajax({url:o.getUrl({name:"thumbnail_create",repo_id:r}),data:{path:l},cache:!1,dataType:"json",success:function(e){f.set({encoded_thumbnail_src:e.encoded_thumbnail_src})},complete:function(){a<n-1&&s.dir.repo_id==r&&s.dir.path==i&&u(++a)}})};u(0)},renderPath:function(){var t=this.dir,n=t.path,r="my",i=t.category.split("/")[0];i=="org"?r="org":i=="group"?r="group":i=="common"&&(r="common");var s={path:n,repo_name:t.repo_name,category:t.category,context:r},u=n.substr(1).split("/"),a=o.encodePath(n.substr(1)).split("/");n!="/"&&e.extend(s,{path_list:u,path_list_encoded:a,repo_id:t.repo_id}),this.$path_bar.html(this.path_bar_template(s))},renderDirOpBar:function(){var t=this.dir;this.$dir_op_bar.html(e.trim(this.dir_op_bar_template({user_perm:t.user_perm,encrypted:t.encrypted,path:t.path,repo_id:t.repo_id,site_root:app.pageOptions.site_root,is_repo_owner:t.is_repo_owner,is_virtual:t.is_virtual,can_generate_shared_link:app.pageOptions.can_generate_shared_link,enable_upload_folder:app.pageOptions.enable_upload_folder})))},renderDirentsHd:function(){this.$("thead").html(this.dirents_hd_template())},events:{"click .path-link":"visitDir","click #upload-file":"uploadFile","click #add-new-dir":"newDir","click #add-new-file":"newFile","click #share-cur-dir":"share","click th.select":"select","click #mv-dirents":"mv","click #cp-dirents":"cp","click #del-dirents":"del","click .by-name":"sortByName","click .by-time":"sortByTime"},newDir:function(){var t=e(this.newDirTemplate()),n=t.attr("id"),r=this.dir,i=this;t.modal({appendTo:"#main"}),e("#simplemodal-container").css({height:"auto"}),t.submit(function(){var s=e.trim(e('input[name="name"]',t).val());if(!s)return o.showFormError(n,gettext("It is required.")),!1;var u={dirent_name:s},a=o.getUrl({name:"new_dir",repo_id:r.repo_id})+"?parent_dir="+encodeURIComponent(r.path),f=function(t){e.modal.close();var n=r.add({is_dir:!0,obj_name:t.name,perm:"rw",last_modified:(new Date).getTime()/1e3,last_update:gettext("Just now"),p_dpath:t.p_dpath},{silent:!0});i.addNewDir(n)};return o.ajaxPost({form:t,post_url:a,post_data:u,after_op_success:f,form_id:n}),!1})},newFile:function(){var t=e(this.newFileTemplate()),n=t.attr("id"),r=t.find('input[name="name"]'),i=this.dir,s=this;t.modal({appendTo:"#main",focus:!1,containerCss:{padding:"20px 25px"}}),e("#simplemodal-container").css({height:"auto"}),e(".set-file-type",t).click(function(){r.val("."+e(this).data("filetype")),o.setCaretPos(r[0],0),r.focus()}),t.submit(function(){var u=e.trim(r.val());if(!u)return o.showFormError(n,gettext("It is required.")),!1;if(u.lastIndexOf(".")!=-1&&u.substr(0,u.lastIndexOf(".")).length==0)return o.showFormError(n,gettext("Only an extension there, please input a name.")),!1;var a={dirent_name:u},f=o.getUrl({name:"new_file",repo_id:i.repo_id})+"?parent_dir="+encodeURIComponent(i.path),l=function(t){e.modal.close();var n=i.add({is_file:!0,is_img:o.imageCheck(t.name),obj_name:t.name,file_size:o.fileSizeFormat(0),obj_id:"0000000000000000000000000000000000000000",file_icon:"file.png",starred:!1,perm:"rw",last_modified:(new Date).getTime()/1e3,last_update:gettext("Just now")},{silent:!0});s.addNewFile(n)};return o.ajaxPost({form:t,post_url:f,post_data:a,after_op_success:l,form_id:n}),!1})},addNewFile:function(t){var n=this,r=this.dir,i=new f({model:t,dirView:n}),s=i.render().el;if(e("tr",n.$dirent_list).length==0)n.$dirent_list.append(s);else{var o=r.where({is_dir:!0});o.length==0?n.$dirent_list.prepend(s):e(e("tr",n.$dirent_list)[o.length-1]).after(s)}},addNewDir:function(e){var t=this,n=new f({model:e,dirView:t});t.$dirent_list.prepend(n.render().el)},share:function(){var e=this.dir,t=e.path,n={is_repo_owner:e.is_repo_owner,is_virtual:e.is_virtual,user_perm:e.user_perm,repo_id:e.repo_id,is_dir:!0,dirent_path:t,obj_name:t=="/"?e.repo_name:t.substr(t.lastIndexOf("/")+1)};new c(n)},sortByName:function(){this.$(".by-time .sort-icon").hide();var e=this.dir,t=this.$(".by-name .sort-icon");e.comparator=function(e,n){if(e.get("is_dir")&&n.get("is_file"))return-1;if(e.get("is_file")&&n.get("is_dir"))return 1;var r=o.compareTwoWord(e.get("obj_name"),n.get("obj_name"));return t.hasClass("icon-caret-up")?-r:r},e.sort(),this.$dirent_list.empty(),e.each(this.addOne,this),t.toggleClass("icon-caret-up icon-caret-down").show(),e.comparator=null},sortByTime:function(){this.$(".by-name .sort-icon").hide();var e=this.dir,t=this.$(".by-time .sort-icon");e.comparator=function(e,n){return e.get("is_dir")&&n.get("is_file")?-1:e.get("is_file")&&n.get("is_dir")?1:t.hasClass("icon-caret-down")?e.get("last_modified")<n.get("last_modified")?1:-1:e.get("last_modified")<n.get("last_modified")?-1:1},e.sort(),this.$dirent_list.empty(),e.each(this.addOne,this),t.toggleClass("icon-caret-up icon-caret-down").show(),e.comparator=null},select:function(){var e=this.$("th .checkbox");e.toggleClass("checkbox-checked");var t=this.dir,n=this.$(".checkbox"),r=this.$("#multi-dirents-op");e.hasClass("checkbox-checked")?(n.addClass("checkbox-checked"),t.each(function(e){e.set({selected:!0},{silent:!0})}),r.css({display:"inline"})):(n.removeClass("checkbox-checked"),t.each(function(e){e.set({selected:!1},{silent:!0})}),r.hide())},del:function(){var t=this.dir,n=this,r=function(){e("#confirm-popup").append('<p style="color:red;">'+gettext("Processing...")+"</p>");var r=t.where({selected:!0}),i=[];e(r).each(function(){i.push(this.get("obj_name"))}),e.ajax({url:o.getUrl({name:"del_dirents",repo_id:t.repo_id})+"?parent_dir="+encodeURIComponent(t.path),type:"POST",dataType:"json",beforeSend:o.prepareCSRFToken,traditional:!0,data:{dirents_names:i},success:function(s){var u=s.deleted.length,a=s.undeleted.length,f,l;u>0&&(u==i.length?(t.remove(r),n.$("th .checkbox").removeClass("checkbox-checked"),n.$("#multi-dirents-op").hide()):e(r).each(function(){s["deleted"].indexOf(this.get("obj_name"))!=-1&&t.remove(this)}),u==1?f=gettext("Successfully deleted %(name)s."):u==2?f=gettext("Successfully deleted %(name)s and 1 other item."):f=gettext("Successfully deleted %(name)s and %(amount)s other items."),f=f.replace("%(name)s",o.HTMLescape(s.deleted[0])).replace("%(amount)s",u-1),o.feedback(f,"success")),a>0&&(a==1?l=gettext("Failed to delete %(name)s."):a==2?l=gettext("Failed to delete %(name)s and 1 other item."):l=gettext("Failed to delete %(name)s and %(amount)s other items."),l=l.replace("%(name)s",o.HTMLescape(s.undeleted[0])).replace("%(amount)s",a-1),o.feedback(l,"error")),e.modal.close()},error:function(t,n,r){e.modal.close(),o.ajaxErrorHandler(t,n,r)}})};o.showConfirm(gettext("Delete Items"),gettext("Are you sure you want to delete these selected items?"),r)},mv:function(){this.mvcp({op:"mv"})},cp:function(){this.mvcp({op:"cp"})},mvcp:function(t){var n=this.dir,r=t.op,i=r=="mv"?gettext("Move selected item(s) to:"):gettext("Copy selected item(s) to:"),s=e(this.mvcpTemplate({form_title:i,op_type:r,obj_type:"",obj_name:"",show_other_repos:!n.encrypted}));s.modal({appendTo:"#main",autoResize:!0,focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"}),u.renderTreeForPath({repo_name:n.repo_name,repo_id:n.repo_id,path:n.path}),n.encrypted||u.prepareOtherReposTree({cur_repo_id:n.repo_id});var a=this,f=this.dir,l=f.where({is_dir:!0,selected:!0}),c=f.where({is_file:!0,selected:!0}),h=[],p=[];e(l).each(function(){h.push(this.get("obj_name"))}),e(c).each(function(){p.push(this.get("obj_name"))}),s.submit(function(){var t=e('[name="dst_repo"]',s).val(),n=e('[name="dst_path"]',s).val(),i,u=f.path,d={repo_id:f.repo_id};if(!e.trim(t)||!e.trim(n))return e(".error",s).removeClass("hide"),!1;if(t==f.repo_id&&n==u)return e(".error",s).html(gettext("Invalid destination path")).removeClass("hide"),!1;o.disableButton(e('[type="submit"]',s)),s.append('<p style="color:red;">'+gettext("Processing...")+"</p>");if(t==f.repo_id)d.name=r=="mv"?"mv_dirents":"cp_dirents",e.ajax({url:o.getUrl(d)+"?parent_dir="+encodeURIComponent(u),type:"POST",dataType:"json",beforeSend:o.prepareCSRFToken,traditional:!0,data:{file_names:p,dir_names:h,dst_repo:t,dst_path:n},success:function(t){var n=t.success.length,i,s,u=t.url;e.modal.close(),n>0&&(r=="mv"?(n==c.length+l.length?(f.remove(l),f.remove(c),a.$("th .checkbox").removeClass("checkbox-checked"),a.$("#multi-dirents-op").hide()):(e(l).each(function(){this.get("obj_name")in t.success&&f.remove(this)}),e(c).each(function(){this.get("obj_name")in t.success&&f.remove(this)})),n==1?i=gettext("Successfully moved %(name)s."):n==2?i=gettext("Successfully moved %(name)s and 1 other item."):i=gettext("Successfully moved %(name)s and %(amount)s other items.")):n==1?i=gettext("Successfully copied %(name)s."):n==2?i=gettext("Successfully copied %(name)s and 1 other item."):i=gettext("Successfully copied %(name)s and %(amount)s other items."),i=i.replace("%(name)s",o.HTMLescape(t.success[0])).replace("%(amount)s",n-1),o.feedback(i,"success")),t.failed.length>0&&(r=="mv"?t.failed.length>1?s=gettext("Internal error. Failed to move %(name)s and %(amount)s other item(s)."):s=gettext("Internal error. Failed to move %(name)s."):t.failed.length>1?s=gettext("Internal error. Failed to copy %(name)s and %(amount)s other item(s)."):s=gettext("Internal error. Failed to copy %(name)s."),s=s.replace("%(name)s",o.HTMLescape(t.failed[0])).replace("%(amount)s",t.failed.length-1),o.feedback(s,"error"))},error:function(t,n,r){e.modal.close(),o.ajaxErrorHandler(t,n,r)}});else{var v=f.where({selected:!0}),m=0,g=e(a.mvProgressTemplate()),y=e("#mv-details",g),b=e("#cancel-mv",g),w=e("#mv-other-info",g),E=function(){var i=v[m],a=i.get("is_dir")?"dir":"file",l=i.get("obj_name"),c,h;r=="mv"?d.name=a=="dir"?"mv_dir":"mv_file":d.name=a=="dir"?"cp_dir":"cp_file",c=o.getUrl(d)+"?path="+encodeURIComponent(u)+"&obj_name="+encodeURIComponent(l),h={dst_repo:t,dst_path:n};var p=function(t){var n=r=="mv"?gettext("Moving file %(index)s of %(total)s"):gettext("Copying file %(index)s of %(total)s");y.html(n.replace("%(index)s",m+1).replace("%(total)s",v.length)).removeClass("vh"),b.removeClass("hide");var s=function(){var n=t.task_id;b.data("task_id",n),e.ajax({url:o.getUrl({name:"get_cp_progress"})+"?task_id="+encodeURIComponent(n),dataType:"json",success:function(t){var n=e(".ui-progressbar-value",e("#mv-progress"));if(!t.failed&&!t.canceled&&!t.successful)setTimeout(s,1e3);else if(t.successful)n.css("width",parseInt((m+1)/v.length*100,10)+"%").show(),r=="mv"&&f.remove(i),S();else if(t.failed){var u=r=="mv"?gettext("Failed to move %(name)s"):gettext("Failed to copy %(name)s");b.after('<p class="error">'+u.replace("%(name)s",o.HTMLescape(l))+"</p>"),x()}},error:function(t,n,r){var i;t.responseText?i=e.parseJSON(t.responseText).error:i=gettext("Failed. Please check the network."),b.after('<p class="error">'+i+"</p>"),x()}})};m==0?(e.modal.close(),setTimeout(function(){g.modal({containerCss:{width:300,height:150,paddingTop:50},focus:!1}),e("#mv-progress").progressbar(),s()},100)):s()};o.ajaxPost({form:s,post_url:c,post_data:h,after_op_success:p,form_id:s.attr("id")})},S=function(){m==v.length-1?setTimeout(function(){e.modal.close()},500):E(++m)},x=function(){setTimeout(function(){e.modal.close()},500)};E(),b.click(function(){o.disableButton(b);var t=e(this).data("task_id");e.ajax({url:o.getUrl({name:"cancel_cp"})+"?task_id="+encodeURIComponent(t),dataType:"json",success:function(e){w.html(gettext("Canceled.")).removeClass("hide"),b.addClass("hide"),x()},error:function(t,n,r){var i;t.responseText?i=e.parseJSON(t.responseText).error:i=gettext("Failed. Please check the network."),w.html(i).removeClass("hide"),o.enableButton(b)}})})}return!1})},onWindowScroll:function(){var t=this.dir,n=t.more_start;if(t.dirent_more&&e(window).scrollTop()+e(window).height()>e(document).height()-e("#footer").outerHeight(!0)&&n!=t.last_start){var r=this.$(".loading-tip"),i=this;t.last_start=n,t.fetch({cache:!1,remove:!1,data:{p:t.path,start:t.more_start},success:function(e,t,n){t.dirent_more||r.hide(),i.getImageThumbnail()},error:function(e,t,n){r.hide(),o.ajaxErrorHandler(e,t,n)}})}var s=this.$dir_op_bar,u=this.$path_bar,a=this.$(".repo-file-list"),f=u.offset().top+u.outerHeight(!0),l={position:"fixed",top:0,left:u.offset().left,"z-index":12};e(window).scrollTop()>=f?(a.css({"margin-top":s.outerHeight(!0)}),s.outerWidth(this.$el.width()).css(l)):(a.css({"margin-top":0}),s.removeAttr("style"))}});return h}),define("app/views/top-group-nav",["jquery","underscore","backbone","common"],function(e,t,n,r){var i=n.View.extend({el:".nav .nav-item-group",popupTemplate:t.template(e("#top-group-nav-tmpl").html()),initialize:function(){var t=e(this.popupTemplate({groups:app.pageOptions.top_nav_groups}));this.$el.append(t),t.css({right:(e("#top-nav-grp").outerWidth()-t.outerWidth())/6*5}),this.popup=t},events:{mouseenter:"showPopup",mouseleave:"hidePopup","mouseenter #top-nav-grp-list .item":"highlightGroupItem","mouseleave #top-nav-grp-list .item":"rmHighlightGroupItem","click #top-nav-grp-list .item":"visitGroup"},showPopup:function(e){this.popup.removeClass("hide")},hidePopup:function(e){this.popup.addClass("hide")},highlightGroupItem:function(t){e(t.currentTarget).addClass("hl").children(".a").removeClass("vh")},rmHighlightGroupItem:function(t){e(t.currentTarget).removeClass("hl").children(".a").addClass("vh")},visitGroup:function(t){this.hidePopup(t),location.href=e(t.currentTarget).attr("data-url")}});return i}),define("app/router",["jquery","backbone","common","app/views/myhome","app/views/group","app/views/organization","app/views/dir","app/views/top-group-nav"],function(e,t,n,r,i,s,o,u){var a=t.Router.extend({routes:{"":"showRepos","my-libs/":"showMyRepos","my-libs/lib/:repo_id(/*path)":"showMyRepoDir","my-sub-libs/":"showMySubRepos","my-sub-libs/lib/:repo_id(/*path)":"showMySubRepoDir","shared-libs/":"showSharedRepos","shared-libs/lib/:repo_id(/*path)":"showSharedRepoDir","group/:group_id/":"showGroupRepos","group/:group_id/lib/:repo_id(/*path)":"showGroupRepoDir","org/":"showOrgRepos","org/lib/:repo_id(/*path)":"showOrgRepoDir","common/lib/:repo_id(/*path)":"showCommonDir","starred/":"showStarredFile","activities/":"showActivities","*actions":"showRepos"},initialize:function(){n.prepareApiCsrf(),n.initAccountPopup(),n.initNoticePopup(),this.dirView=new o,this.myHomeView=new r({dirView:this.dirView}),this.groupView=new i({dirView:this.dirView}),this.orgView=new s({dirView:this.dirView}),this.currentView=this.myHomeView,app.pageOptions.top_nav_groups.length>0&&(this.topGroupNavView=new u),e("#info-bar .close").click(n.closeTopNoticeBar),e("#top-browser-tip .close").click(function(){e("#top-browser-tip").addClass("hide")})},switchCurrentView:function(e){this.currentView!=e&&(this.currentView.hide(),this.currentView=e)},showRepos:function(){this.switchCurrentView(this.myHomeView),app.pageOptions.can_add_repo?this.myHomeView.showMyRepos():this.myHomeView.showSharedRepos()},showMyRepos:function(){this.switchCurrentView(this.myHomeView),this.myHomeView.showMyRepos()},showMySubRepos:function(){this.switchCurrentView(this.myHomeView),this.myHomeView.showMySubRepos()},showSharedRepos:function(){this.switchCurrentView(this.myHomeView),this.myHomeView.showSharedRepos()},showStarredFile:function(){this.switchCurrentView(this.myHomeView),this.myHomeView.showStarredFile()},showActivities:function(){this.switchCurrentView(this.myHomeView),this.myHomeView.showActivities()},showMyRepoDir:function(e,t){t?t="/"+t:t="/",this.switchCurrentView(this.myHomeView),this.myHomeView.showDir("my-libs",e,t)},showCommonDir:function(e,t){t?t="/"+t:t="/",this.switchCurrentView(this.myHomeView),this.myHomeView.showDir("common",e,t)},showMySubRepoDir:function(e,t){t?t="/"+t:t="/",this.switchCurrentView(this.myHomeView),this.myHomeView.showDir("my-sub-libs",e,t)},showSharedRepoDir:function(e,t){t?t="/"+t:t="/",this.switchCurrentView(this.myHomeView),this.myHomeView.showDir("shared-libs",e,t)},showGroupRepos:function(e){this.switchCurrentView(this.groupView),this.groupView.showRepoList(e)},showGroupRepoDir:function(e,t,n){n?n="/"+n:n="/",this.switchCurrentView(this.groupView),this.groupView.showDir(e,t,n)},showOrgRepos:function(){this.switchCurrentView(this.orgView),this.orgView.showRepoList()},showOrgRepoDir:function(e,t){t?t="/"+t:t="/",this.switchCurrentView(this.orgView),this.orgView.showDir(e,t)}});return a}),define("app/main",["app/router"],function(e){app.router=new e,Backbone.history.start()}),require(["./common"],function(e){require(["app/main"])}),define("main",function(){});