/*!
 * 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
 */

//! license : MIT

/*!
 * JavaScript Cookie v2.1.0
 * https://github.com/js-cookie/js-cookie
 *
 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
 * Released under the MIT license
 */

//     (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

/*! jsTree - v3.3.2 - 2016-08-15 - (MIT) */

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

/**
 * marked - a markdown parser
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 */

/*! 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 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 - 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/
 */

/*! 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-14
* http://jqueryui.com
* Includes: core.js, widget.js, tabs.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */

/*!
 * 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.
*/

/*
 * jQuery File Upload Plugin
 * 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 Processing Plugin
 * 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
 * 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
 * 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){"object"==typeof module&&"object"==typeof module.exports?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)}("undefined"!=typeof window?window:this,function(e,t){function i(e){var t=e.length,i=re.type(e);return"function"!==i&&!re.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===i||0===t||"number"==typeof t&&t>0&&t-1 in e))}function n(e,t,i){if(re.isFunction(t))return re.grep(e,function(e,n){return!!t.call(e,n,e)!==i});if(t.nodeType)return re.grep(e,function(e){return e===t!==i});if("string"==typeof t){if(ue.test(t))return re.filter(t,e,i);t=re.filter(t,e)}return re.grep(e,function(e){return re.inArray(e,t)>=0!==i})}function r(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function s(e){var t=we[e]={};return re.each(e.match(ye)||[],function(e,i){t[i]=!0}),t}function o(){fe.addEventListener?(fe.removeEventListener("DOMContentLoaded",a,!1),e.removeEventListener("load",a,!1)):(fe.detachEvent("onreadystatechange",a),e.detachEvent("onload",a))}function a(){(fe.addEventListener||"load"===event.type||"complete"===fe.readyState)&&(o(),re.ready())}function l(e,t,i){if(void 0===i&&1===e.nodeType){var n="data-"+t.replace(Ye,"-$1").toLowerCase();if(i=e.getAttribute(n),"string"==typeof i){try{i="true"===i||"false"!==i&&("null"===i?null:+i+""===i?+i:Se.test(i)?re.parseJSON(i):i)}catch(e){}re.data(e,t,i)}else i=void 0}return i}function d(e){var t;for(t in e)if(("data"!==t||!re.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,i,n){if(re.acceptData(e)){var r,s,o=re.expando,a=e.nodeType,l=a?re.cache:e,d=a?e[o]:e[o]&&o;if(d&&l[d]&&(n||l[d].data)||void 0!==i||"string"!=typeof t)return d||(d=a?e[o]=I.pop()||re.guid++:o),l[d]||(l[d]=a?{}:{toJSON:re.noop}),"object"!=typeof t&&"function"!=typeof t||(n?l[d]=re.extend(l[d],t):l[d].data=re.extend(l[d].data,t)),s=l[d],n||(s.data||(s.data={}),s=s.data),void 0!==i&&(s[re.camelCase(t)]=i),"string"==typeof t?(r=s[t],null==r&&(r=s[re.camelCase(t)])):r=s,r}}function h(e,t,i){if(re.acceptData(e)){var n,r,s=e.nodeType,o=s?re.cache:e,a=s?e[re.expando]:re.expando;if(o[a]){if(t&&(n=i?o[a]:o[a].data)){re.isArray(t)?t=t.concat(re.map(t,re.camelCase)):t in n?t=[t]:(t=re.camelCase(t),t=t in n?[t]:t.split(" ")),r=t.length;for(;r--;)delete n[t[r]];if(i?!d(n):!re.isEmptyObject(n))return}(i||(delete o[a].data,d(o[a])))&&(s?re.cleanData([e],!0):ie.deleteExpando||o!=o.window?delete o[a]:o[a]=null)}}}function u(){return!0}function p(){return!1}function f(){try{return fe.activeElement}catch(e){}}function m(e){var t=Xe.split("|"),i=e.createDocumentFragment();if(i.createElement)for(;t.length;)i.createElement(t.pop());return i}function g(e,t){var i,n,r=0,s=typeof e.getElementsByTagName!==xe?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==xe?e.querySelectorAll(t||"*"):void 0;if(!s)for(s=[],i=e.childNodes||e;null!=(n=i[r]);r++)!t||re.nodeName(n,t)?s.push(n):re.merge(s,g(n,t));return void 0===t||t&&re.nodeName(e,t)?re.merge([e],s):s}function _(e){De.test(e.type)&&(e.defaultChecked=e.checked)}function v(e,t){return re.nodeName(e,"table")&&re.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function y(e){return e.type=(null!==re.find.attr(e,"type"))+"/"+e.type,e}function w(e){var t=Ge.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function b(e,t){for(var i,n=0;null!=(i=e[n]);n++)re._data(i,"globalEval",!t||re._data(t[n],"globalEval"))}function T(e,t){if(1===t.nodeType&&re.hasData(e)){var i,n,r,s=re._data(e),o=re._data(t,s),a=s.events;if(a){delete o.handle,o.events={};for(i in a)for(n=0,r=a[i].length;n<r;n++)re.event.add(t,i,a[i][n])}o.data&&(o.data=re.extend({},o.data))}}function x(e,t){var i,n,r;if(1===t.nodeType){if(i=t.nodeName.toLowerCase(),!ie.noCloneEvent&&t[re.expando]){r=re._data(t);for(n in r.events)re.removeEvent(t,n,r.handle);t.removeAttribute(re.expando)}"script"===i&&t.text!==e.text?(y(t).text=e.text,w(t)):"object"===i?(t.parentNode&&(t.outerHTML=e.outerHTML),ie.html5Clone&&e.innerHTML&&!re.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===i&&De.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===i?t.defaultSelected=t.selected=e.defaultSelected:"input"!==i&&"textarea"!==i||(t.defaultValue=e.defaultValue)}}function S(t,i){var n,r=re(i.createElement(t)).appendTo(i.body),s=e.getDefaultComputedStyle&&(n=e.getDefaultComputedStyle(r[0]))?n.display:re.css(r[0],"display");return r.detach(),s}function Y(e){var t=fe,i=Ve[e];return i||(i=S(e,t),"none"!==i&&i||(qe=(qe||re("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=(qe[0].contentWindow||qe[0].contentDocument).document,t.write(),t.close(),i=S(e,t),qe.detach()),Ve[e]=i),i}function k(e,t){return{get:function(){var i=e();if(null!=i)return i?void delete this.get:(this.get=t).apply(this,arguments)}}}function C(e,t){if(t in e)return t;for(var i=t.charAt(0).toUpperCase()+t.slice(1),n=t,r=ut.length;r--;)if(t=ut[r]+i,t in e)return t;return n}function L(e,t){for(var i,n,r,s=[],o=0,a=e.length;o<a;o++)n=e[o],n.style&&(s[o]=re._data(n,"olddisplay"),i=n.style.display,t?(s[o]||"none"!==i||(n.style.display=""),""===n.style.display&&Le(n)&&(s[o]=re._data(n,"olddisplay",Y(n.nodeName)))):(r=Le(n),(i&&"none"!==i||!r)&&re._data(n,"olddisplay",r?i:re.css(n,"display"))));for(o=0;o<a;o++)n=e[o],n.style&&(t&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=t?s[o]||"":"none"));return e}function M(e,t,i){var n=lt.exec(t);return n?Math.max(0,n[1]-(i||0))+(n[2]||"px"):t}function D(e,t,i,n,r){for(var s=i===(n?"border":"content")?4:"width"===t?1:0,o=0;s<4;s+=2)"margin"===i&&(o+=re.css(e,i+Ce[s],!0,r)),n?("content"===i&&(o-=re.css(e,"padding"+Ce[s],!0,r)),"margin"!==i&&(o-=re.css(e,"border"+Ce[s]+"Width",!0,r))):(o+=re.css(e,"padding"+Ce[s],!0,r),"padding"!==i&&(o+=re.css(e,"border"+Ce[s]+"Width",!0,r)));return o}function Z(e,t,i){var n=!0,r="width"===t?e.offsetWidth:e.offsetHeight,s=et(e),o=ie.boxSizing&&"border-box"===re.css(e,"boxSizing",!1,s);if(r<=0||null==r){if(r=tt(e,t,s),(r<0||null==r)&&(r=e.style[t]),nt.test(r))return r;n=o&&(ie.boxSizingReliable()||r===e.style[t]),r=parseFloat(r)||0}return r+D(e,t,i||(o?"border":"content"),n,s)+"px"}function H(e,t,i,n,r){return new H.prototype.init(e,t,i,n,r)}function j(){return setTimeout(function(){pt=void 0}),pt=re.now()}function P(e,t){var i,n={height:e},r=0;for(t=t?1:0;r<4;r+=2-t)i=Ce[r],n["margin"+i]=n["padding"+i]=e;return t&&(n.opacity=n.width=e),n}function J(e,t,i){for(var n,r=(yt[t]||[]).concat(yt["*"]),s=0,o=r.length;s<o;s++)if(n=r[s].call(i,t,e))return n}function X(e,t,i){var n,r,s,o,a,l,d,c,h=this,u={},p=e.style,f=e.nodeType&&Le(e),m=re._data(e,"fxshow");i.queue||(a=re._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,l=a.empty.fire,a.empty.fire=function(){a.unqueued||l()}),a.unqueued++,h.always(function(){h.always(function(){a.unqueued--,re.queue(e,"fx").length||a.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(i.overflow=[p.overflow,p.overflowX,p.overflowY],d=re.css(e,"display"),c="none"===d?re._data(e,"olddisplay")||Y(e.nodeName):d,"inline"===c&&"none"===re.css(e,"float")&&(ie.inlineBlockNeedsLayout&&"inline"!==Y(e.nodeName)?p.zoom=1:p.display="inline-block")),i.overflow&&(p.overflow="hidden",ie.shrinkWrapBlocks()||h.always(function(){p.overflow=i.overflow[0],p.overflowX=i.overflow[1],p.overflowY=i.overflow[2]}));for(n in t)if(r=t[n],mt.exec(r)){if(delete t[n],s=s||"toggle"===r,r===(f?"hide":"show")){if("show"!==r||!m||void 0===m[n])continue;f=!0}u[n]=m&&m[n]||re.style(e,n)}else d=void 0;if(re.isEmptyObject(u))"inline"===("none"===d?Y(e.nodeName):d)&&(p.display=d);else{m?"hidden"in m&&(f=m.hidden):m=re._data(e,"fxshow",{}),s&&(m.hidden=!f),f?re(e).show():h.done(function(){re(e).hide()}),h.done(function(){var t;re._removeData(e,"fxshow");for(t in u)re.style(e,t,u[t])});for(n in u)o=J(f?m[n]:0,n,h),n in m||(m[n]=o.start,f&&(o.end=o.start,o.start="width"===n||"height"===n?1:0))}}function F(e,t){var i,n,r,s,o;for(i in e)if(n=re.camelCase(i),r=t[n],s=e[i],re.isArray(s)&&(r=s[1],s=e[i]=s[0]),i!==n&&(e[n]=s,delete e[i]),o=re.cssHooks[n],o&&"expand"in o){s=o.expand(s),delete e[n];for(i in s)i in e||(e[i]=s[i],t[i]=r)}else t[n]=r}function N(e,t,i){var n,r,s=0,o=vt.length,a=re.Deferred().always(function(){delete l.elem}),l=function(){if(r)return!1;for(var t=pt||j(),i=Math.max(0,d.startTime+d.duration-t),n=i/d.duration||0,s=1-n,o=0,l=d.tweens.length;o<l;o++)d.tweens[o].run(s);return a.notifyWith(e,[d,s,i]),s<1&&l?i:(a.resolveWith(e,[d]),!1)},d=a.promise({elem:e,props:re.extend({},t),opts:re.extend(!0,{specialEasing:{}},i),originalProperties:t,originalOptions:i,startTime:pt||j(),duration:i.duration,tweens:[],createTween:function(t,i){var n=re.Tween(e,d.opts,t,i,d.opts.specialEasing[t]||d.opts.easing);return d.tweens.push(n),n},stop:function(t){var i=0,n=t?d.tweens.length:0;if(r)return this;for(r=!0;i<n;i++)d.tweens[i].run(1);return t?a.resolveWith(e,[d,t]):a.rejectWith(e,[d,t]),this}}),c=d.props;for(F(c,d.opts.specialEasing);s<o;s++)if(n=vt[s].call(d,e,c,d.opts))return n;return re.map(c,J,d),re.isFunction(d.opts.start)&&d.opts.start.call(e,d),re.fx.timer(re.extend(l,{elem:e,anim:d,queue:d.opts.queue})),d.progress(d.opts.progress).done(d.opts.done,d.opts.complete).fail(d.opts.fail).always(d.opts.always)}function $(e){return function(t,i){"string"!=typeof t&&(i=t,t="*");var n,r=0,s=t.toLowerCase().match(ye)||[];if(re.isFunction(i))for(;n=s[r++];)"+"===n.charAt(0)?(n=n.slice(1)||"*",(e[n]=e[n]||[]).unshift(i)):(e[n]=e[n]||[]).push(i)}}function B(e,t,i,n){function r(a){var l;return s[a]=!0,re.each(e[a]||[],function(e,a){var d=a(t,i,n);return"string"!=typeof d||o||s[d]?o?!(l=d):void 0:(t.dataTypes.unshift(d),r(d),!1)}),l}var s={},o=e===Ot;return r(t.dataTypes[0])||!s["*"]&&r("*")}function E(e,t){var i,n,r=re.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((r[n]?e:i||(i={}))[n]=t[n]);return i&&re.extend(!0,e,i),e}function Q(e,t,i){for(var n,r,s,o,a=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(o in a)if(a[o]&&a[o].test(r)){l.unshift(o);break}if(l[0]in i)s=l[0];else{for(o in i){if(!l[0]||e.converters[o+" "+l[0]]){s=o;break}n||(n=o)}s=s||n}if(s)return s!==l[0]&&l.unshift(s),i[s]}function O(e,t,i,n){var r,s,o,a,l,d={},c=e.dataTypes.slice();if(c[1])for(o in e.converters)d[o.toLowerCase()]=e.converters[o];for(s=c.shift();s;)if(e.responseFields[s]&&(i[e.responseFields[s]]=t),!l&&n&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=s,s=c.shift())if("*"===s)s=l;else if("*"!==l&&l!==s){if(o=d[l+" "+s]||d["* "+s],!o)for(r in d)if(a=r.split(" "),a[1]===s&&(o=d[l+" "+a[0]]||d["* "+a[0]])){o===!0?o=d[r]:d[r]!==!0&&(s=a[0],c.unshift(a[1]));break}if(o!==!0)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(e){return{state:"parsererror",error:o?e:"No conversion from "+l+" to "+s}}}return{state:"success",data:t}}function W(e,t,i,n){var r;if(re.isArray(t))re.each(t,function(t,r){i||At.test(e)?n(e,r):W(e+"["+("object"==typeof r?t:"")+"]",r,i,n)});else if(i||"object"!==re.type(t))n(e,t);else for(r in t)W(e+"["+r+"]",t[r],i,n)}function R(){try{return new e.XMLHttpRequest}catch(e){}}function A(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}function G(e){return re.isWindow(e)?e:9===e.nodeType&&(e.defaultView||e.parentWindow)}var I=[],K=I.slice,U=I.concat,z=I.push,q=I.indexOf,V={},ee=V.toString,te=V.hasOwnProperty,ie={},ne="1.11.2",re=function(e,t){return new re.fn.init(e,t)},se=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,oe=/^-ms-/,ae=/-([\da-z])/gi,le=function(e,t){return t.toUpperCase()};re.fn=re.prototype={jquery:ne,constructor:re,selector:"",length:0,toArray:function(){return K.call(this)},get:function(e){return null!=e?e<0?this[e+this.length]:this[e]:K.call(this)},pushStack:function(e){var t=re.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return re.each(this,e,t)},map:function(e){return this.pushStack(re.map(this,function(t,i){return e.call(t,i,t)}))},slice:function(){return this.pushStack(K.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,i=+e+(e<0?t:0);return this.pushStack(i>=0&&i<t?[this[i]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:z,sort:I.sort,splice:I.splice},re.extend=re.fn.extend=function(){var e,t,i,n,r,s,o=arguments[0]||{},a=1,l=arguments.length,d=!1;for("boolean"==typeof o&&(d=o,o=arguments[a]||{},a++),"object"==typeof o||re.isFunction(o)||(o={}),a===l&&(o=this,a--);a<l;a++)if(null!=(r=arguments[a]))for(n in r)e=o[n],i=r[n],o!==i&&(d&&i&&(re.isPlainObject(i)||(t=re.isArray(i)))?(t?(t=!1,s=e&&re.isArray(e)?e:[]):s=e&&re.isPlainObject(e)?e:{},o[n]=re.extend(d,s,i)):void 0!==i&&(o[n]=i));return o},re.extend({expando:"jQuery"+(ne+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===re.type(e)},isArray:Array.isArray||function(e){return"array"===re.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!re.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||"object"!==re.type(e)||e.nodeType||re.isWindow(e))return!1;try{if(e.constructor&&!te.call(e,"constructor")&&!te.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}if(ie.ownLast)for(t in e)return te.call(e,t);for(t in e);return void 0===t||te.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?V[ee.call(e)]||"object":typeof e},globalEval:function(t){t&&re.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(oe,"ms-").replace(ae,le)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,s=0,o=e.length,a=i(e);if(n){if(a)for(;s<o&&(r=t.apply(e[s],n),r!==!1);s++);else for(s in e)if(r=t.apply(e[s],n),r===!1)break}else if(a)for(;s<o&&(r=t.call(e[s],s,e[s]),r!==!1);s++);else for(s in e)if(r=t.call(e[s],s,e[s]),r===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(se,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(i(Object(e))?re.merge(n,"string"==typeof e?[e]:e):z.call(n,e)),n},inArray:function(e,t,i){var n;if(t){if(q)return q.call(t,e,i);for(n=t.length,i=i?i<0?Math.max(0,n+i):i:0;i<n;i++)if(i in t&&t[i]===e)return i}return-1},merge:function(e,t){for(var i=+t.length,n=0,r=e.length;n<i;)e[r++]=t[n++];if(i!==i)for(;void 0!==t[n];)e[r++]=t[n++];return e.length=r,e},grep:function(e,t,i){for(var n,r=[],s=0,o=e.length,a=!i;s<o;s++)n=!t(e[s],s),n!==a&&r.push(e[s]);return r},map:function(e,t,n){var r,s=0,o=e.length,a=i(e),l=[];if(a)for(;s<o;s++)r=t(e[s],s,n),null!=r&&l.push(r);else for(s in e)r=t(e[s],s,n),null!=r&&l.push(r);return U.apply([],l)},guid:1,proxy:function(e,t){var i,n,r;if("string"==typeof t&&(r=e[t],t=e,e=r),re.isFunction(e))return i=K.call(arguments,2),n=function(){return e.apply(t||this,i.concat(K.call(arguments)))},n.guid=e.guid=e.guid||re.guid++,n},now:function(){return+new Date},support:ie}),re.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){V["[object "+t+"]"]=t.toLowerCase()});var de=function(e){function t(e,t,i,n){var r,s,o,a,l,d,h,p,f,m;if((t?t.ownerDocument||t:B)!==H&&Z(t),t=t||H,i=i||[],a=t.nodeType,"string"!=typeof e||!e||1!==a&&9!==a&&11!==a)return i;if(!n&&P){if(11!==a&&(r=ve.exec(e)))if(o=r[1]){if(9===a){if(s=t.getElementById(o),!s||!s.parentNode)return i;if(s.id===o)return i.push(s),i}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(o))&&N(t,s)&&s.id===o)return i.push(s),i}else{if(r[2])return q.apply(i,t.getElementsByTagName(e)),i;if((o=r[3])&&b.getElementsByClassName)return q.apply(i,t.getElementsByClassName(o)),i}if(b.qsa&&(!J||!J.test(e))){if(p=h=$,f=t,m=1!==a&&e,1===a&&"object"!==t.nodeName.toLowerCase()){for(d=Y(e),(h=t.getAttribute("id"))?p=h.replace(we,"\\$&"):t.setAttribute("id",p),p="[id='"+p+"'] ",l=d.length;l--;)d[l]=p+u(d[l]);f=ye.test(e)&&c(t.parentNode)||t,m=d.join(",")}if(m)try{return q.apply(i,f.querySelectorAll(m)),i}catch(e){}finally{h||t.removeAttribute("id")}}}return C(e.replace(le,"$1"),t,i,n)}function i(){function e(i,n){return t.push(i+" ")>T.cacheLength&&delete e[t.shift()],e[i+" "]=n}var t=[];return e}function n(e){return e[$]=!0,e}function r(e){var t=H.createElement("div");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function s(e,t){for(var i=e.split("|"),n=e.length;n--;)T.attrHandle[i[n]]=t}function o(e,t){var i=t&&e,n=i&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||G)-(~e.sourceIndex||G);if(n)return n;if(i)for(;i=i.nextSibling;)if(i===t)return-1;return e?1:-1}function a(e){return function(t){var i=t.nodeName.toLowerCase();return"input"===i&&t.type===e}}function l(e){return function(t){var i=t.nodeName.toLowerCase();return("input"===i||"button"===i)&&t.type===e}}function d(e){return n(function(t){return t=+t,n(function(i,n){for(var r,s=e([],i.length,t),o=s.length;o--;)i[r=s[o]]&&(i[r]=!(n[r]=i[r]))})})}function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function h(){}function u(e){for(var t=0,i=e.length,n="";t<i;t++)n+=e[t].value;return n}function p(e,t,i){var n=t.dir,r=i&&"parentNode"===n,s=Q++;return t.first?function(t,i,s){for(;t=t[n];)if(1===t.nodeType||r)return e(t,i,s)}:function(t,i,o){var a,l,d=[E,s];if(o){for(;t=t[n];)if((1===t.nodeType||r)&&e(t,i,o))return!0}else for(;t=t[n];)if(1===t.nodeType||r){if(l=t[$]||(t[$]={}),(a=l[n])&&a[0]===E&&a[1]===s)return d[2]=a[2];if(l[n]=d,d[2]=e(t,i,o))return!0}}}function f(e){return e.length>1?function(t,i,n){for(var r=e.length;r--;)if(!e[r](t,i,n))return!1;return!0}:e[0]}function m(e,i,n){for(var r=0,s=i.length;r<s;r++)t(e,i[r],n);return n}function g(e,t,i,n,r){for(var s,o=[],a=0,l=e.length,d=null!=t;a<l;a++)(s=e[a])&&(i&&!i(s,n,r)||(o.push(s),d&&t.push(a)));return o}function _(e,t,i,r,s,o){return r&&!r[$]&&(r=_(r)),s&&!s[$]&&(s=_(s,o)),n(function(n,o,a,l){var d,c,h,u=[],p=[],f=o.length,_=n||m(t||"*",a.nodeType?[a]:a,[]),v=!e||!n&&t?_:g(_,u,e,a,l),y=i?s||(n?e:f||r)?[]:o:v;if(i&&i(v,y,a,l),r)for(d=g(y,p),r(d,[],a,l),c=d.length;c--;)(h=d[c])&&(y[p[c]]=!(v[p[c]]=h));if(n){if(s||e){if(s){for(d=[],c=y.length;c--;)(h=y[c])&&d.push(v[c]=h);s(null,y=[],d,l)}for(c=y.length;c--;)(h=y[c])&&(d=s?ee(n,h):u[c])>-1&&(n[d]=!(o[d]=h))}}else y=g(y===o?y.splice(f,y.length):y),s?s(null,o,y,l):q.apply(o,y)})}function v(e){for(var t,i,n,r=e.length,s=T.relative[e[0].type],o=s||T.relative[" "],a=s?1:0,l=p(function(e){return e===t},o,!0),d=p(function(e){return ee(t,e)>-1},o,!0),c=[function(e,i,n){var r=!s&&(n||i!==L)||((t=i).nodeType?l(e,i,n):d(e,i,n));return t=null,r}];a<r;a++)if(i=T.relative[e[a].type])c=[p(f(c),i)];else{if(i=T.filter[e[a].type].apply(null,e[a].matches),i[$]){for(n=++a;n<r&&!T.relative[e[n].type];n++);return _(a>1&&f(c),a>1&&u(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(le,"$1"),i,a<n&&v(e.slice(a,n)),n<r&&v(e=e.slice(n)),n<r&&u(e))}c.push(i)}return f(c)}function y(e,i){var r=i.length>0,s=e.length>0,o=function(n,o,a,l,d){var c,h,u,p=0,f="0",m=n&&[],_=[],v=L,y=n||s&&T.find.TAG("*",d),w=E+=null==v?1:Math.random()||.1,b=y.length;for(d&&(L=o!==H&&o);f!==b&&null!=(c=y[f]);f++){if(s&&c){for(h=0;u=e[h++];)if(u(c,o,a)){l.push(c);break}d&&(E=w)}r&&((c=!u&&c)&&p--,n&&m.push(c))}if(p+=f,r&&f!==p){for(h=0;u=i[h++];)u(m,_,o,a);if(n){if(p>0)for(;f--;)m[f]||_[f]||(_[f]=U.call(l));_=g(_)}q.apply(l,_),d&&!n&&_.length>0&&p+i.length>1&&t.uniqueSort(l)}return d&&(E=w,L=v),m};return r?n(o):o}var w,b,T,x,S,Y,k,C,L,M,D,Z,H,j,P,J,X,F,N,$="sizzle"+1*new Date,B=e.document,E=0,Q=0,O=i(),W=i(),R=i(),A=function(e,t){return e===t&&(D=!0),0},G=1<<31,I={}.hasOwnProperty,K=[],U=K.pop,z=K.push,q=K.push,V=K.slice,ee=function(e,t){for(var i=0,n=e.length;i<n;i++)if(e[i]===t)return i;return-1},te="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ie="[\\x20\\t\\r\\n\\f]",ne="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",re=ne.replace("w","w#"),se="\\["+ie+"*("+ne+")(?:"+ie+"*([*^$|!~]?=)"+ie+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+re+"))|)"+ie+"*\\]",oe=":("+ne+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+se+")*)|.*)\\)|)",ae=new RegExp(ie+"+","g"),le=new RegExp("^"+ie+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ie+"+$","g"),de=new RegExp("^"+ie+"*,"+ie+"*"),ce=new RegExp("^"+ie+"*([>+~]|"+ie+")"+ie+"*"),he=new RegExp("="+ie+"*([^\\]'\"]*?)"+ie+"*\\]","g"),ue=new RegExp(oe),pe=new RegExp("^"+re+"$"),fe={ID:new RegExp("^#("+ne+")"),CLASS:new RegExp("^\\.("+ne+")"),TAG:new RegExp("^("+ne.replace("w","w*")+")"),ATTR:new RegExp("^"+se),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ie+"*(even|odd|(([+-]|)(\\d*)n|)"+ie+"*(?:([+-]|)"+ie+"*(\\d+)|))"+ie+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ie+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ie+"*((?:-\\d)?\\d*)"+ie+"*\\)|)(?=[^-]|$)","i")},me=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,_e=/^[^{]+\{\s*\[native \w/,ve=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ye=/[+~]/,we=/'|\\/g,be=new RegExp("\\\\([\\da-f]{1,6}"+ie+"?|("+ie+")|.)","ig"),Te=function(e,t,i){var n="0x"+t-65536;return n!==n||i?t:n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320)},xe=function(){Z()};try{q.apply(K=V.call(B.childNodes),B.childNodes),K[B.childNodes.length].nodeType}catch(e){q={apply:K.length?function(e,t){z.apply(e,V.call(t))}:function(e,t){for(var i=e.length,n=0;e[i++]=t[n++];);e.length=i-1}}}b=t.support={},S=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},Z=t.setDocument=function(e){var t,i,n=e?e.ownerDocument||e:B;return n!==H&&9===n.nodeType&&n.documentElement?(H=n,j=n.documentElement,i=n.defaultView,i&&i!==i.top&&(i.addEventListener?i.addEventListener("unload",xe,!1):i.attachEvent&&i.attachEvent("onunload",xe)),P=!S(n),b.attributes=r(function(e){return e.className="i",!e.getAttribute("className")}),b.getElementsByTagName=r(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),b.getElementsByClassName=_e.test(n.getElementsByClassName),b.getById=r(function(e){return j.appendChild(e).id=$,!n.getElementsByName||!n.getElementsByName($).length}),b.getById?(T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&P){var i=t.getElementById(e);return i&&i.parentNode?[i]:[]}},T.filter.ID=function(e){var t=e.replace(be,Te);return function(e){return e.getAttribute("id")===t}}):(delete T.find.ID,T.filter.ID=function(e){var t=e.replace(be,Te);return function(e){var i="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return i&&i.value===t}}),T.find.TAG=b.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):b.qsa?t.querySelectorAll(e):void 0}:function(e,t){var i,n=[],r=0,s=t.getElementsByTagName(e);if("*"===e){for(;i=s[r++];)1===i.nodeType&&n.push(i);return n}return s},T.find.CLASS=b.getElementsByClassName&&function(e,t){if(P)return t.getElementsByClassName(e)},X=[],J=[],(b.qsa=_e.test(n.querySelectorAll))&&(r(function(e){j.appendChild(e).innerHTML="<a id='"+$+"'></a><select id='"+$+"-\f]' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&J.push("[*^$]="+ie+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||J.push("\\["+ie+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+$+"-]").length||J.push("~="),e.querySelectorAll(":checked").length||J.push(":checked"),e.querySelectorAll("a#"+$+"+*").length||J.push(".#.+[+~]")}),r(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&J.push("name"+ie+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||J.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),J.push(",.*:")})),(b.matchesSelector=_e.test(F=j.matches||j.webkitMatchesSelector||j.mozMatchesSelector||j.oMatchesSelector||j.msMatchesSelector))&&r(function(e){b.disconnectedMatch=F.call(e,"div"),F.call(e,"[s!='']:x"),X.push("!=",oe)}),J=J.length&&new RegExp(J.join("|")),X=X.length&&new RegExp(X.join("|")),t=_e.test(j.compareDocumentPosition),N=t||_e.test(j.contains)?function(e,t){var i=9===e.nodeType?e.documentElement:e,n=t&&t.parentNode;return e===n||!(!n||1!==n.nodeType||!(i.contains?i.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},A=t?function(e,t){if(e===t)return D=!0,0;var i=!e.compareDocumentPosition-!t.compareDocumentPosition;return i?i:(i=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&i||!b.sortDetached&&t.compareDocumentPosition(e)===i?e===n||e.ownerDocument===B&&N(B,e)?-1:t===n||t.ownerDocument===B&&N(B,t)?1:M?ee(M,e)-ee(M,t):0:4&i?-1:1)}:function(e,t){if(e===t)return D=!0,0;var i,r=0,s=e.parentNode,a=t.parentNode,l=[e],d=[t];if(!s||!a)return e===n?-1:t===n?1:s?-1:a?1:M?ee(M,e)-ee(M,t):0;if(s===a)return o(e,t);for(i=e;i=i.parentNode;)l.unshift(i);for(i=t;i=i.parentNode;)d.unshift(i);for(;l[r]===d[r];)r++;return r?o(l[r],d[r]):l[r]===B?-1:d[r]===B?1:0},n):H},t.matches=function(e,i){return t(e,null,null,i)},t.matchesSelector=function(e,i){if((e.ownerDocument||e)!==H&&Z(e),i=i.replace(he,"='$1']"),b.matchesSelector&&P&&(!X||!X.test(i))&&(!J||!J.test(i)))try{var n=F.call(e,i);if(n||b.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){}return t(i,H,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==H&&Z(e),N(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==H&&Z(e);var i=T.attrHandle[t.toLowerCase()],n=i&&I.call(T.attrHandle,t.toLowerCase())?i(e,t,!P):void 0;return void 0!==n?n:b.attributes||!P?e.getAttribute(t):(n=e.getAttributeNode(t))&&n.specified?n.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,i=[],n=0,r=0;if(D=!b.detectDuplicates,M=!b.sortStable&&e.slice(0),e.sort(A),D){for(;t=e[r++];)t===e[r]&&(n=i.push(r));for(;n--;)e.splice(i[n],1)}return M=null,e},x=t.getText=function(e){var t,i="",n=0,r=e.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)i+=x(e)}else if(3===r||4===r)return e.nodeValue}else for(;t=e[n++];)i+=x(t);return i},T=t.selectors={cacheLength:50,createPseudo:n,match:fe,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(be,Te),e[3]=(e[3]||e[4]||e[5]||"").replace(be,Te),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,i=!e[6]&&e[2];return fe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":i&&ue.test(i)&&(t=Y(i,!0))&&(t=i.indexOf(")",i.length-t)-i.length)&&(e[0]=e[0].slice(0,t),e[2]=i.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(be,Te).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=O[e+" "];return t||(t=new RegExp("(^|"+ie+")"+e+"("+ie+"|$)"))&&O(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,i,n){return function(r){var s=t.attr(r,e);return null==s?"!="===i:!i||(s+="","="===i?s===n:"!="===i?s!==n:"^="===i?n&&0===s.indexOf(n):"*="===i?n&&s.indexOf(n)>-1:"$="===i?n&&s.slice(-n.length)===n:"~="===i?(" "+s.replace(ae," ")+" ").indexOf(n)>-1:"|="===i&&(s===n||s.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,i,n,r){var s="nth"!==e.slice(0,3),o="last"!==e.slice(-4),a="of-type"===t;return 1===n&&0===r?function(e){return!!e.parentNode}:function(t,i,l){var d,c,h,u,p,f,m=s!==o?"nextSibling":"previousSibling",g=t.parentNode,_=a&&t.nodeName.toLowerCase(),v=!l&&!a;if(g){if(s){for(;m;){for(h=t;h=h[m];)if(a?h.nodeName.toLowerCase()===_:1===h.nodeType)return!1;f=m="only"===e&&!f&&"nextSibling"}return!0}if(f=[o?g.firstChild:g.lastChild],o&&v){for(c=g[$]||(g[$]={}),d=c[e]||[],p=d[0]===E&&d[1],u=d[0]===E&&d[2],h=p&&g.childNodes[p];h=++p&&h&&h[m]||(u=p=0)||f.pop();)if(1===h.nodeType&&++u&&h===t){c[e]=[E,p,u];break}}else if(v&&(d=(t[$]||(t[$]={}))[e])&&d[0]===E)u=d[1];else for(;(h=++p&&h&&h[m]||(u=p=0)||f.pop())&&((a?h.nodeName.toLowerCase()!==_:1!==h.nodeType)||!++u||(v&&((h[$]||(h[$]={}))[e]=[E,u]),h!==t)););return u-=r,u===n||u%n===0&&u/n>=0}}},PSEUDO:function(e,i){var r,s=T.pseudos[e]||T.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return s[$]?s(i):s.length>1?(r=[e,e,"",i],T.setFilters.hasOwnProperty(e.toLowerCase())?n(function(e,t){for(var n,r=s(e,i),o=r.length;o--;)n=ee(e,r[o]),e[n]=!(t[n]=r[o])}):function(e){return s(e,0,r)}):s}},pseudos:{not:n(function(e){var t=[],i=[],r=k(e.replace(le,"$1"));return r[$]?n(function(e,t,i,n){for(var s,o=r(e,null,n,[]),a=e.length;a--;)(s=o[a])&&(e[a]=!(t[a]=s))}):function(e,n,s){return t[0]=e,r(t,null,s,i),t[0]=null,!i.pop()}}),has:n(function(e){return function(i){return t(e,i).length>0}}),contains:n(function(e){return e=e.replace(be,Te),function(t){return(t.textContent||t.innerText||x(t)).indexOf(e)>-1}}),lang:n(function(e){return pe.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(be,Te).toLowerCase(),function(t){var i;do if(i=P?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return i=i.toLowerCase(),i===e||0===i.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var i=e.location&&e.location.hash;return i&&i.slice(1)===t.id},root:function(e){return e===j},focus:function(e){return e===H.activeElement&&(!H.hasFocus||H.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"input"===t&&!!e.checked||"option"===t&&!!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!T.pseudos.empty(e)},header:function(e){return ge.test(e.nodeName)},input:function(e){return me.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:d(function(){return[0]}),last:d(function(e,t){return[t-1]}),eq:d(function(e,t,i){return[i<0?i+t:i]}),even:d(function(e,t){for(var i=0;i<t;i+=2)e.push(i);return e}),odd:d(function(e,t){for(var i=1;i<t;i+=2)e.push(i);return e}),lt:d(function(e,t,i){for(var n=i<0?i+t:i;--n>=0;)e.push(n);return e}),gt:d(function(e,t,i){for(var n=i<0?i+t:i;++n<t;)e.push(n);return e})}},T.pseudos.nth=T.pseudos.eq;for(w in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})T.pseudos[w]=a(w);for(w in{submit:!0,reset:!0})T.pseudos[w]=l(w);return h.prototype=T.filters=T.pseudos,T.setFilters=new h,Y=t.tokenize=function(e,i){var n,r,s,o,a,l,d,c=W[e+" "];if(c)return i?0:c.slice(0);for(a=e,l=[],d=T.preFilter;a;){n&&!(r=de.exec(a))||(r&&(a=a.slice(r[0].length)||a),l.push(s=[])),n=!1,(r=ce.exec(a))&&(n=r.shift(),s.push({value:n,type:r[0].replace(le," ")}),a=a.slice(n.length));for(o in T.filter)!(r=fe[o].exec(a))||d[o]&&!(r=d[o](r))||(n=r.shift(),
s.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return i?a.length:a?t.error(e):W(e,l).slice(0)},k=t.compile=function(e,t){var i,n=[],r=[],s=R[e+" "];if(!s){for(t||(t=Y(e)),i=t.length;i--;)s=v(t[i]),s[$]?n.push(s):r.push(s);s=R(e,y(r,n)),s.selector=e}return s},C=t.select=function(e,t,i,n){var r,s,o,a,l,d="function"==typeof e&&e,h=!n&&Y(e=d.selector||e);if(i=i||[],1===h.length){if(s=h[0]=h[0].slice(0),s.length>2&&"ID"===(o=s[0]).type&&b.getById&&9===t.nodeType&&P&&T.relative[s[1].type]){if(t=(T.find.ID(o.matches[0].replace(be,Te),t)||[])[0],!t)return i;d&&(t=t.parentNode),e=e.slice(s.shift().value.length)}for(r=fe.needsContext.test(e)?0:s.length;r--&&(o=s[r],!T.relative[a=o.type]);)if((l=T.find[a])&&(n=l(o.matches[0].replace(be,Te),ye.test(s[0].type)&&c(t.parentNode)||t))){if(s.splice(r,1),e=n.length&&u(s),!e)return q.apply(i,n),i;break}}return(d||k(e,h))(n,t,!P,i,ye.test(e)&&c(t.parentNode)||t),i},b.sortStable=$.split("").sort(A).join("")===$,b.detectDuplicates=!!D,Z(),b.sortDetached=r(function(e){return 1&e.compareDocumentPosition(H.createElement("div"))}),r(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||s("type|href|height|width",function(e,t,i){if(!i)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),b.attributes&&r(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||s("value",function(e,t,i){if(!i&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),r(function(e){return null==e.getAttribute("disabled")})||s(te,function(e,t,i){var n;if(!i)return e[t]===!0?t.toLowerCase():(n=e.getAttributeNode(t))&&n.specified?n.value:null}),t}(e);re.find=de,re.expr=de.selectors,re.expr[":"]=re.expr.pseudos,re.unique=de.uniqueSort,re.text=de.getText,re.isXMLDoc=de.isXML,re.contains=de.contains;var ce=re.expr.match.needsContext,he=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,ue=/^.[^:#\[\.,]*$/;re.filter=function(e,t,i){var n=t[0];return i&&(e=":not("+e+")"),1===t.length&&1===n.nodeType?re.find.matchesSelector(n,e)?[n]:[]:re.find.matches(e,re.grep(t,function(e){return 1===e.nodeType}))},re.fn.extend({find:function(e){var t,i=[],n=this,r=n.length;if("string"!=typeof e)return this.pushStack(re(e).filter(function(){for(t=0;t<r;t++)if(re.contains(n[t],this))return!0}));for(t=0;t<r;t++)re.find(e,n[t],i);return i=this.pushStack(r>1?re.unique(i):i),i.selector=this.selector?this.selector+" "+e:e,i},filter:function(e){return this.pushStack(n(this,e||[],!1))},not:function(e){return this.pushStack(n(this,e||[],!0))},is:function(e){return!!n(this,"string"==typeof e&&ce.test(e)?re(e):e||[],!1).length}});var pe,fe=e.document,me=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ge=re.fn.init=function(e,t){var i,n;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:me.exec(e),!i||!i[1]&&t)return!t||t.jquery?(t||pe).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof re?t[0]:t,re.merge(this,re.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:fe,!0)),he.test(i[1])&&re.isPlainObject(t))for(i in t)re.isFunction(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}if(n=fe.getElementById(i[2]),n&&n.parentNode){if(n.id!==i[2])return pe.find(e);this.length=1,this[0]=n}return this.context=fe,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):re.isFunction(e)?"undefined"!=typeof pe.ready?pe.ready(e):e(re):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),re.makeArray(e,this))};ge.prototype=re.fn,pe=re(fe);var _e=/^(?:parents|prev(?:Until|All))/,ve={children:!0,contents:!0,next:!0,prev:!0};re.extend({dir:function(e,t,i){for(var n=[],r=e[t];r&&9!==r.nodeType&&(void 0===i||1!==r.nodeType||!re(r).is(i));)1===r.nodeType&&n.push(r),r=r[t];return n},sibling:function(e,t){for(var i=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&i.push(e);return i}}),re.fn.extend({has:function(e){var t,i=re(e,this),n=i.length;return this.filter(function(){for(t=0;t<n;t++)if(re.contains(this,i[t]))return!0})},closest:function(e,t){for(var i,n=0,r=this.length,s=[],o=ce.test(e)||"string"!=typeof e?re(e,t||this.context):0;n<r;n++)for(i=this[n];i&&i!==t;i=i.parentNode)if(i.nodeType<11&&(o?o.index(i)>-1:1===i.nodeType&&re.find.matchesSelector(i,e))){s.push(i);break}return this.pushStack(s.length>1?re.unique(s):s)},index:function(e){return e?"string"==typeof e?re.inArray(this[0],re(e)):re.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(re.unique(re.merge(this.get(),re(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),re.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return re.dir(e,"parentNode")},parentsUntil:function(e,t,i){return re.dir(e,"parentNode",i)},next:function(e){return r(e,"nextSibling")},prev:function(e){return r(e,"previousSibling")},nextAll:function(e){return re.dir(e,"nextSibling")},prevAll:function(e){return re.dir(e,"previousSibling")},nextUntil:function(e,t,i){return re.dir(e,"nextSibling",i)},prevUntil:function(e,t,i){return re.dir(e,"previousSibling",i)},siblings:function(e){return re.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return re.sibling(e.firstChild)},contents:function(e){return re.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:re.merge([],e.childNodes)}},function(e,t){re.fn[e]=function(i,n){var r=re.map(this,t,i);return"Until"!==e.slice(-5)&&(n=i),n&&"string"==typeof n&&(r=re.filter(n,r)),this.length>1&&(ve[e]||(r=re.unique(r)),_e.test(e)&&(r=r.reverse())),this.pushStack(r)}});var ye=/\S+/g,we={};re.Callbacks=function(e){e="string"==typeof e?we[e]||s(e):re.extend({},e);var t,i,n,r,o,a,l=[],d=!e.once&&[],c=function(s){for(i=e.memory&&s,n=!0,o=a||0,a=0,r=l.length,t=!0;l&&o<r;o++)if(l[o].apply(s[0],s[1])===!1&&e.stopOnFalse){i=!1;break}t=!1,l&&(d?d.length&&c(d.shift()):i?l=[]:h.disable())},h={add:function(){if(l){var n=l.length;!function t(i){re.each(i,function(i,n){var r=re.type(n);"function"===r?e.unique&&h.has(n)||l.push(n):n&&n.length&&"string"!==r&&t(n)})}(arguments),t?r=l.length:i&&(a=n,c(i))}return this},remove:function(){return l&&re.each(arguments,function(e,i){for(var n;(n=re.inArray(i,l,n))>-1;)l.splice(n,1),t&&(n<=r&&r--,n<=o&&o--)}),this},has:function(e){return e?re.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],r=0,this},disable:function(){return l=d=i=void 0,this},disabled:function(){return!l},lock:function(){return d=void 0,i||h.disable(),this},locked:function(){return!d},fireWith:function(e,i){return!l||n&&!d||(i=i||[],i=[e,i.slice?i.slice():i],t?d.push(i):c(i)),this},fire:function(){return h.fireWith(this,arguments),this},fired:function(){return!!n}};return h},re.extend({Deferred:function(e){var t=[["resolve","done",re.Callbacks("once memory"),"resolved"],["reject","fail",re.Callbacks("once memory"),"rejected"],["notify","progress",re.Callbacks("memory")]],i="pending",n={state:function(){return i},always:function(){return r.done(arguments).fail(arguments),this},then:function(){var e=arguments;return re.Deferred(function(i){re.each(t,function(t,s){var o=re.isFunction(e[t])&&e[t];r[s[1]](function(){var e=o&&o.apply(this,arguments);e&&re.isFunction(e.promise)?e.promise().done(i.resolve).fail(i.reject).progress(i.notify):i[s[0]+"With"](this===n?i.promise():this,o?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?re.extend(e,n):n}},r={};return n.pipe=n.then,re.each(t,function(e,s){var o=s[2],a=s[3];n[s[1]]=o.add,a&&o.add(function(){i=a},t[1^e][2].disable,t[2][2].lock),r[s[0]]=function(){return r[s[0]+"With"](this===r?n:this,arguments),this},r[s[0]+"With"]=o.fireWith}),n.promise(r),e&&e.call(r,r),r},when:function(e){var t,i,n,r=0,s=K.call(arguments),o=s.length,a=1!==o||e&&re.isFunction(e.promise)?o:0,l=1===a?e:re.Deferred(),d=function(e,i,n){return function(r){i[e]=this,n[e]=arguments.length>1?K.call(arguments):r,n===t?l.notifyWith(i,n):--a||l.resolveWith(i,n)}};if(o>1)for(t=new Array(o),i=new Array(o),n=new Array(o);r<o;r++)s[r]&&re.isFunction(s[r].promise)?s[r].promise().done(d(r,n,s)).fail(l.reject).progress(d(r,i,t)):--a;return a||l.resolveWith(n,s),l.promise()}});var be;re.fn.ready=function(e){return re.ready.promise().done(e),this},re.extend({isReady:!1,readyWait:1,holdReady:function(e){e?re.readyWait++:re.ready(!0)},ready:function(e){if(e===!0?!--re.readyWait:!re.isReady){if(!fe.body)return setTimeout(re.ready);re.isReady=!0,e!==!0&&--re.readyWait>0||(be.resolveWith(fe,[re]),re.fn.triggerHandler&&(re(fe).triggerHandler("ready"),re(fe).off("ready")))}}}),re.ready.promise=function(t){if(!be)if(be=re.Deferred(),"complete"===fe.readyState)setTimeout(re.ready);else if(fe.addEventListener)fe.addEventListener("DOMContentLoaded",a,!1),e.addEventListener("load",a,!1);else{fe.attachEvent("onreadystatechange",a),e.attachEvent("onload",a);var i=!1;try{i=null==e.frameElement&&fe.documentElement}catch(e){}i&&i.doScroll&&!function e(){if(!re.isReady){try{i.doScroll("left")}catch(t){return setTimeout(e,50)}o(),re.ready()}}()}return be.promise(t)};var Te,xe="undefined";for(Te in re(ie))break;ie.ownLast="0"!==Te,ie.inlineBlockNeedsLayout=!1,re(function(){var e,t,i,n;i=fe.getElementsByTagName("body")[0],i&&i.style&&(t=fe.createElement("div"),n=fe.createElement("div"),n.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",i.appendChild(n).appendChild(t),typeof t.style.zoom!==xe&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",ie.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(i.style.zoom=1)),i.removeChild(n))}),function(){var e=fe.createElement("div");if(null==ie.deleteExpando){ie.deleteExpando=!0;try{delete e.test}catch(e){ie.deleteExpando=!1}}e=null}(),re.acceptData=function(e){var t=re.noData[(e.nodeName+" ").toLowerCase()],i=+e.nodeType||1;return(1===i||9===i)&&(!t||t!==!0&&e.getAttribute("classid")===t)};var Se=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Ye=/([A-Z])/g;re.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?re.cache[e[re.expando]]:e[re.expando],!!e&&!d(e)},data:function(e,t,i){return c(e,t,i)},removeData:function(e,t){return h(e,t)},_data:function(e,t,i){return c(e,t,i,!0)},_removeData:function(e,t){return h(e,t,!0)}}),re.fn.extend({data:function(e,t){var i,n,r,s=this[0],o=s&&s.attributes;if(void 0===e){if(this.length&&(r=re.data(s),1===s.nodeType&&!re._data(s,"parsedAttrs"))){for(i=o.length;i--;)o[i]&&(n=o[i].name,0===n.indexOf("data-")&&(n=re.camelCase(n.slice(5)),l(s,n,r[n])));re._data(s,"parsedAttrs",!0)}return r}return"object"==typeof e?this.each(function(){re.data(this,e)}):arguments.length>1?this.each(function(){re.data(this,e,t)}):s?l(s,e,re.data(s,e)):void 0},removeData:function(e){return this.each(function(){re.removeData(this,e)})}}),re.extend({queue:function(e,t,i){var n;if(e)return t=(t||"fx")+"queue",n=re._data(e,t),i&&(!n||re.isArray(i)?n=re._data(e,t,re.makeArray(i)):n.push(i)),n||[]},dequeue:function(e,t){t=t||"fx";var i=re.queue(e,t),n=i.length,r=i.shift(),s=re._queueHooks(e,t),o=function(){re.dequeue(e,t)};"inprogress"===r&&(r=i.shift(),n--),r&&("fx"===t&&i.unshift("inprogress"),delete s.stop,r.call(e,o,s)),!n&&s&&s.empty.fire()},_queueHooks:function(e,t){var i=t+"queueHooks";return re._data(e,i)||re._data(e,i,{empty:re.Callbacks("once memory").add(function(){re._removeData(e,t+"queue"),re._removeData(e,i)})})}}),re.fn.extend({queue:function(e,t){var i=2;return"string"!=typeof e&&(t=e,e="fx",i--),arguments.length<i?re.queue(this[0],e):void 0===t?this:this.each(function(){var i=re.queue(this,e,t);re._queueHooks(this,e),"fx"===e&&"inprogress"!==i[0]&&re.dequeue(this,e)})},dequeue:function(e){return this.each(function(){re.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var i,n=1,r=re.Deferred(),s=this,o=this.length,a=function(){--n||r.resolveWith(s,[s])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";o--;)i=re._data(s[o],e+"queueHooks"),i&&i.empty&&(n++,i.empty.add(a));return a(),r.promise(t)}});var ke=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Ce=["Top","Right","Bottom","Left"],Le=function(e,t){return e=t||e,"none"===re.css(e,"display")||!re.contains(e.ownerDocument,e)},Me=re.access=function(e,t,i,n,r,s,o){var a=0,l=e.length,d=null==i;if("object"===re.type(i)){r=!0;for(a in i)re.access(e,t,a,i[a],!0,s,o)}else if(void 0!==n&&(r=!0,re.isFunction(n)||(o=!0),d&&(o?(t.call(e,n),t=null):(d=t,t=function(e,t,i){return d.call(re(e),i)})),t))for(;a<l;a++)t(e[a],i,o?n:n.call(e[a],a,t(e[a],i)));return r?e:d?t.call(e):l?t(e[0],i):s},De=/^(?:checkbox|radio)$/i;!function(){var e=fe.createElement("input"),t=fe.createElement("div"),i=fe.createDocumentFragment();if(t.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",ie.leadingWhitespace=3===t.firstChild.nodeType,ie.tbody=!t.getElementsByTagName("tbody").length,ie.htmlSerialize=!!t.getElementsByTagName("link").length,ie.html5Clone="<:nav></:nav>"!==fe.createElement("nav").cloneNode(!0).outerHTML,e.type="checkbox",e.checked=!0,i.appendChild(e),ie.appendChecked=e.checked,t.innerHTML="<textarea>x</textarea>",ie.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue,i.appendChild(t),t.innerHTML="<input type='radio' checked='checked' name='t'/>",ie.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,ie.noCloneEvent=!0,t.attachEvent&&(t.attachEvent("onclick",function(){ie.noCloneEvent=!1}),t.cloneNode(!0).click()),null==ie.deleteExpando){ie.deleteExpando=!0;try{delete t.test}catch(e){ie.deleteExpando=!1}}}(),function(){var t,i,n=fe.createElement("div");for(t in{submit:!0,change:!0,focusin:!0})i="on"+t,(ie[t+"Bubbles"]=i in e)||(n.setAttribute(i,"t"),ie[t+"Bubbles"]=n.attributes[i].expando===!1);n=null}();var Ze=/^(?:input|select|textarea)$/i,He=/^key/,je=/^(?:mouse|pointer|contextmenu)|click/,Pe=/^(?:focusinfocus|focusoutblur)$/,Je=/^([^.]*)(?:\.(.+)|)$/;re.event={global:{},add:function(e,t,i,n,r){var s,o,a,l,d,c,h,u,p,f,m,g=re._data(e);if(g){for(i.handler&&(l=i,i=l.handler,r=l.selector),i.guid||(i.guid=re.guid++),(o=g.events)||(o=g.events={}),(c=g.handle)||(c=g.handle=function(e){return typeof re===xe||e&&re.event.triggered===e.type?void 0:re.event.dispatch.apply(c.elem,arguments)},c.elem=e),t=(t||"").match(ye)||[""],a=t.length;a--;)s=Je.exec(t[a])||[],p=m=s[1],f=(s[2]||"").split(".").sort(),p&&(d=re.event.special[p]||{},p=(r?d.delegateType:d.bindType)||p,d=re.event.special[p]||{},h=re.extend({type:p,origType:m,data:n,handler:i,guid:i.guid,selector:r,needsContext:r&&re.expr.match.needsContext.test(r),namespace:f.join(".")},l),(u=o[p])||(u=o[p]=[],u.delegateCount=0,d.setup&&d.setup.call(e,n,f,c)!==!1||(e.addEventListener?e.addEventListener(p,c,!1):e.attachEvent&&e.attachEvent("on"+p,c))),d.add&&(d.add.call(e,h),h.handler.guid||(h.handler.guid=i.guid)),r?u.splice(u.delegateCount++,0,h):u.push(h),re.event.global[p]=!0);e=null}},remove:function(e,t,i,n,r){var s,o,a,l,d,c,h,u,p,f,m,g=re.hasData(e)&&re._data(e);if(g&&(c=g.events)){for(t=(t||"").match(ye)||[""],d=t.length;d--;)if(a=Je.exec(t[d])||[],p=m=a[1],f=(a[2]||"").split(".").sort(),p){for(h=re.event.special[p]||{},p=(n?h.delegateType:h.bindType)||p,u=c[p]||[],a=a[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=s=u.length;s--;)o=u[s],!r&&m!==o.origType||i&&i.guid!==o.guid||a&&!a.test(o.namespace)||n&&n!==o.selector&&("**"!==n||!o.selector)||(u.splice(s,1),o.selector&&u.delegateCount--,h.remove&&h.remove.call(e,o));l&&!u.length&&(h.teardown&&h.teardown.call(e,f,g.handle)!==!1||re.removeEvent(e,p,g.handle),delete c[p])}else for(p in c)re.event.remove(e,p+t[d],i,n,!0);re.isEmptyObject(c)&&(delete g.handle,re._removeData(e,"events"))}},trigger:function(t,i,n,r){var s,o,a,l,d,c,h,u=[n||fe],p=te.call(t,"type")?t.type:t,f=te.call(t,"namespace")?t.namespace.split("."):[];if(a=c=n=n||fe,3!==n.nodeType&&8!==n.nodeType&&!Pe.test(p+re.event.triggered)&&(p.indexOf(".")>=0&&(f=p.split("."),p=f.shift(),f.sort()),o=p.indexOf(":")<0&&"on"+p,t=t[re.expando]?t:new re.Event(p,"object"==typeof t&&t),t.isTrigger=r?2:3,t.namespace=f.join("."),t.namespace_re=t.namespace?new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=n),i=null==i?[t]:re.makeArray(i,[t]),d=re.event.special[p]||{},r||!d.trigger||d.trigger.apply(n,i)!==!1)){if(!r&&!d.noBubble&&!re.isWindow(n)){for(l=d.delegateType||p,Pe.test(l+p)||(a=a.parentNode);a;a=a.parentNode)u.push(a),c=a;c===(n.ownerDocument||fe)&&u.push(c.defaultView||c.parentWindow||e)}for(h=0;(a=u[h++])&&!t.isPropagationStopped();)t.type=h>1?l:d.bindType||p,s=(re._data(a,"events")||{})[t.type]&&re._data(a,"handle"),s&&s.apply(a,i),s=o&&a[o],s&&s.apply&&re.acceptData(a)&&(t.result=s.apply(a,i),t.result===!1&&t.preventDefault());if(t.type=p,!r&&!t.isDefaultPrevented()&&(!d._default||d._default.apply(u.pop(),i)===!1)&&re.acceptData(n)&&o&&n[p]&&!re.isWindow(n)){c=n[o],c&&(n[o]=null),re.event.triggered=p;try{n[p]()}catch(e){}re.event.triggered=void 0,c&&(n[o]=c)}return t.result}},dispatch:function(e){e=re.event.fix(e);var t,i,n,r,s,o=[],a=K.call(arguments),l=(re._data(this,"events")||{})[e.type]||[],d=re.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!d.preDispatch||d.preDispatch.call(this,e)!==!1){for(o=re.event.handlers.call(this,e,l),t=0;(r=o[t++])&&!e.isPropagationStopped();)for(e.currentTarget=r.elem,s=0;(n=r.handlers[s++])&&!e.isImmediatePropagationStopped();)e.namespace_re&&!e.namespace_re.test(n.namespace)||(e.handleObj=n,e.data=n.data,i=((re.event.special[n.origType]||{}).handle||n.handler).apply(r.elem,a),void 0!==i&&(e.result=i)===!1&&(e.preventDefault(),e.stopPropagation()));return d.postDispatch&&d.postDispatch.call(this,e),e.result}},handlers:function(e,t){var i,n,r,s,o=[],a=t.delegateCount,l=e.target;if(a&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(r=[],s=0;s<a;s++)n=t[s],i=n.selector+" ",void 0===r[i]&&(r[i]=n.needsContext?re(i,this).index(l)>=0:re.find(i,this,null,[l]).length),r[i]&&r.push(n);r.length&&o.push({elem:l,handlers:r})}return a<t.length&&o.push({elem:this,handlers:t.slice(a)}),o},fix:function(e){if(e[re.expando])return e;var t,i,n,r=e.type,s=e,o=this.fixHooks[r];for(o||(this.fixHooks[r]=o=je.test(r)?this.mouseHooks:He.test(r)?this.keyHooks:{}),n=o.props?this.props.concat(o.props):this.props,e=new re.Event(s),t=n.length;t--;)i=n[t],e[i]=s[i];return e.target||(e.target=s.srcElement||fe),3===e.target.nodeType&&(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 null==e.which&&(e.which=null!=t.charCode?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 i,n,r,s=t.button,o=t.fromElement;return null==e.pageX&&null!=t.clientX&&(n=e.target.ownerDocument||fe,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),!e.relatedTarget&&o&&(e.relatedTarget=o===e.target?t.toElement:o),e.which||void 0===s||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==f()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){if(this===f()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if(re.nodeName(this,"input")&&"checkbox"===this.type&&this.click)return this.click(),!1},_default:function(e){return re.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,i,n){var r=re.extend(new re.Event,i,{type:e,isSimulated:!0,originalEvent:{}});n?re.event.trigger(r,null,t):re.event.dispatch.call(t,r),r.isDefaultPrevented()&&i.preventDefault()}},re.removeEvent=fe.removeEventListener?function(e,t,i){e.removeEventListener&&e.removeEventListener(t,i,!1)}:function(e,t,i){var n="on"+t;e.detachEvent&&(typeof e[n]===xe&&(e[n]=null),e.detachEvent(n,i))},re.Event=function(e,t){return this instanceof re.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?u:p):this.type=e,t&&re.extend(this,t),this.timeStamp=e&&e.timeStamp||re.now(),void(this[re.expando]=!0)):new re.Event(e,t)},re.Event.prototype={isDefaultPrevented:p,isPropagationStopped:p,isImmediatePropagationStopped:p,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=u,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=u,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=u,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},re.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){re.event.special[e]={delegateType:t,bindType:t,handle:function(e){var i,n=this,r=e.relatedTarget,s=e.handleObj;return r&&(r===n||re.contains(n,r))||(e.type=s.origType,i=s.handler.apply(this,arguments),e.type=t),i}}}),ie.submitBubbles||(re.event.special.submit={setup:function(){return!re.nodeName(this,"form")&&void re.event.add(this,"click._submit keypress._submit",function(e){var t=e.target,i=re.nodeName(t,"input")||re.nodeName(t,"button")?t.form:void 0;i&&!re._data(i,"submitBubbles")&&(re.event.add(i,"submit._submit",function(e){e._submit_bubble=!0}),re._data(i,"submitBubbles",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&re.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return!re.nodeName(this,"form")&&void re.event.remove(this,"._submit")}}),ie.changeBubbles||(re.event.special.change={setup:function(){return Ze.test(this.nodeName)?("checkbox"!==this.type&&"radio"!==this.type||(re.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),re.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),re.event.simulate("change",this,e,!0)})),!1):void re.event.add(this,"beforeactivate._change",function(e){var t=e.target;Ze.test(t.nodeName)&&!re._data(t,"changeBubbles")&&(re.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||re.event.simulate("change",this.parentNode,e,!0)}),re._data(t,"changeBubbles",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||"radio"!==t.type&&"checkbox"!==t.type)return e.handleObj.handler.apply(this,arguments)},teardown:function(){return re.event.remove(this,"._change"),!Ze.test(this.nodeName)}}),ie.focusinBubbles||re.each({focus:"focusin",blur:"focusout"},function(e,t){var i=function(e){re.event.simulate(t,e.target,re.event.fix(e),!0)};re.event.special[t]={setup:function(){var n=this.ownerDocument||this,r=re._data(n,t);r||n.addEventListener(e,i,!0),re._data(n,t,(r||0)+1)},teardown:function(){var n=this.ownerDocument||this,r=re._data(n,t)-1;r?re._data(n,t,r):(n.removeEventListener(e,i,!0),re._removeData(n,t))}}}),re.fn.extend({on:function(e,t,i,n,r){var s,o;if("object"==typeof e){"string"!=typeof t&&(i=i||t,t=void 0);for(s in e)this.on(s,t,i,e[s],r);return this}if(null==i&&null==n?(n=t,i=t=void 0):null==n&&("string"==typeof t?(n=i,i=void 0):(n=i,i=t,t=void 0)),n===!1)n=p;else if(!n)return this;return 1===r&&(o=n,n=function(e){return re().off(e),o.apply(this,arguments)},n.guid=o.guid||(o.guid=re.guid++)),this.each(function(){re.event.add(this,e,n,i,t)})},one:function(e,t,i,n){return this.on(e,t,i,n,1)},off:function(e,t,i){var n,r;if(e&&e.preventDefault&&e.handleObj)return n=e.handleObj,re(e.delegateTarget).off(n.namespace?n.origType+"."+n.namespace:n.origType,n.selector,n.handler),this;if("object"==typeof e){for(r in e)this.off(r,t,e[r]);return this}return t!==!1&&"function"!=typeof t||(i=t,t=void 0),i===!1&&(i=p),this.each(function(){re.event.remove(this,e,i,t)})},trigger:function(e,t){return this.each(function(){re.event.trigger(e,t,this)})},triggerHandler:function(e,t){var i=this[0];if(i)return re.event.trigger(e,t,i,!0)}});var Xe="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Fe=/ jQuery\d+="(?:null|\d+)"/g,Ne=new RegExp("<(?:"+Xe+")[\\s/>]","i"),$e=/^\s+/,Be=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Ee=/<([\w:]+)/,Qe=/<tbody/i,Oe=/<|&#?\w+;/,We=/<(?:script|style|link)/i,Re=/checked\s*(?:[^=]|=\s*.checked.)/i,Ae=/^$|\/(?:java|ecma)script/i,Ge=/^true\/(.*)/,Ie=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Ke={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:ie.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Ue=m(fe),ze=Ue.appendChild(fe.createElement("div"));Ke.optgroup=Ke.option,Ke.tbody=Ke.tfoot=Ke.colgroup=Ke.caption=Ke.thead,Ke.th=Ke.td,re.extend({clone:function(e,t,i){var n,r,s,o,a,l=re.contains(e.ownerDocument,e);if(ie.html5Clone||re.isXMLDoc(e)||!Ne.test("<"+e.nodeName+">")?s=e.cloneNode(!0):(ze.innerHTML=e.outerHTML,ze.removeChild(s=ze.firstChild)),!(ie.noCloneEvent&&ie.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||re.isXMLDoc(e)))for(n=g(s),a=g(e),o=0;null!=(r=a[o]);++o)n[o]&&x(r,n[o]);if(t)if(i)for(a=a||g(e),n=n||g(s),o=0;null!=(r=a[o]);o++)T(r,n[o]);else T(e,s);return n=g(s,"script"),n.length>0&&b(n,!l&&g(e,"script")),n=a=r=null,s},buildFragment:function(e,t,i,n){for(var r,s,o,a,l,d,c,h=e.length,u=m(t),p=[],f=0;f<h;f++)if(s=e[f],s||0===s)if("object"===re.type(s))re.merge(p,s.nodeType?[s]:s);else if(Oe.test(s)){for(a=a||u.appendChild(t.createElement("div")),l=(Ee.exec(s)||["",""])[1].toLowerCase(),c=Ke[l]||Ke._default,a.innerHTML=c[1]+s.replace(Be,"<$1></$2>")+c[2],r=c[0];r--;)a=a.lastChild;if(!ie.leadingWhitespace&&$e.test(s)&&p.push(t.createTextNode($e.exec(s)[0])),!ie.tbody)for(s="table"!==l||Qe.test(s)?"<table>"!==c[1]||Qe.test(s)?0:a:a.firstChild,r=s&&s.childNodes.length;r--;)re.nodeName(d=s.childNodes[r],"tbody")&&!d.childNodes.length&&s.removeChild(d);for(re.merge(p,a.childNodes),a.textContent="";a.firstChild;)a.removeChild(a.firstChild);a=u.lastChild}else p.push(t.createTextNode(s));for(a&&u.removeChild(a),ie.appendChecked||re.grep(g(p,"input"),_),f=0;s=p[f++];)if((!n||re.inArray(s,n)===-1)&&(o=re.contains(s.ownerDocument,s),a=g(u.appendChild(s),"script"),o&&b(a),i))for(r=0;s=a[r++];)Ae.test(s.type||"")&&i.push(s);return a=null,u},cleanData:function(e,t){for(var i,n,r,s,o=0,a=re.expando,l=re.cache,d=ie.deleteExpando,c=re.event.special;null!=(i=e[o]);o++)if((t||re.acceptData(i))&&(r=i[a],s=r&&l[r])){if(s.events)for(n in s.events)c[n]?re.event.remove(i,n):re.removeEvent(i,n,s.handle);l[r]&&(delete l[r],d?delete i[a]:typeof i.removeAttribute!==xe?i.removeAttribute(a):i[a]=null,I.push(r))}}}),re.fn.extend({text:function(e){return Me(this,function(e){return void 0===e?re.text(this):this.empty().append((this[0]&&this[0].ownerDocument||fe).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=v(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=v(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){for(var i,n=e?re.filter(e,this):this,r=0;null!=(i=n[r]);r++)t||1!==i.nodeType||re.cleanData(g(i)),i.parentNode&&(t&&re.contains(i.ownerDocument,i)&&b(g(i,"script")),i.parentNode.removeChild(i));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&re.cleanData(g(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&re.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return re.clone(this,e,t)})},html:function(e){return Me(this,function(e){var t=this[0]||{},i=0,n=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(Fe,""):void 0;if("string"==typeof e&&!We.test(e)&&(ie.htmlSerialize||!Ne.test(e))&&(ie.leadingWhitespace||!$e.test(e))&&!Ke[(Ee.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(Be,"<$1></$2>");try{for(;i<n;i++)t=this[i]||{},1===t.nodeType&&(re.cleanData(g(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];return this.domManip(arguments,function(t){e=this.parentNode,re.cleanData(g(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=U.apply([],e);var i,n,r,s,o,a,l=0,d=this.length,c=this,h=d-1,u=e[0],p=re.isFunction(u);if(p||d>1&&"string"==typeof u&&!ie.checkClone&&Re.test(u))return this.each(function(i){var n=c.eq(i);p&&(e[0]=u.call(this,i,n.html())),n.domManip(e,t)});if(d&&(a=re.buildFragment(e,this[0].ownerDocument,!1,this),i=a.firstChild,1===a.childNodes.length&&(a=i),i)){for(s=re.map(g(a,"script"),y),r=s.length;l<d;l++)n=a,l!==h&&(n=re.clone(n,!0,!0),r&&re.merge(s,g(n,"script"))),t.call(this[l],n,l);if(r)for(o=s[s.length-1].ownerDocument,re.map(s,w),l=0;l<r;l++)n=s[l],Ae.test(n.type||"")&&!re._data(n,"globalEval")&&re.contains(o,n)&&(n.src?re._evalUrl&&re._evalUrl(n.src):re.globalEval((n.text||n.textContent||n.innerHTML||"").replace(Ie,"")));a=i=null}return this}}),re.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){re.fn[e]=function(e){for(var i,n=0,r=[],s=re(e),o=s.length-1;n<=o;n++)i=n===o?this:this.clone(!0),re(s[n])[t](i),z.apply(r,i.get());return this.pushStack(r)}});var qe,Ve={};!function(){var e;ie.shrinkWrapBlocks=function(){if(null!=e)return e;e=!1;var t,i,n;return i=fe.getElementsByTagName("body")[0],i&&i.style?(t=fe.createElement("div"),n=fe.createElement("div"),n.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",i.appendChild(n).appendChild(t),typeof t.style.zoom!==xe&&(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(fe.createElement("div")).style.width="5px",e=3!==t.offsetWidth),i.removeChild(n),e):void 0}}();var et,tt,it=/^margin/,nt=new RegExp("^("+ke+")(?!px)[a-z%]+$","i"),rt=/^(top|right|bottom|left)$/;e.getComputedStyle?(et=function(t){return t.ownerDocument.defaultView.opener?t.ownerDocument.defaultView.getComputedStyle(t,null):e.getComputedStyle(t,null)},tt=function(e,t,i){var n,r,s,o,a=e.style;return i=i||et(e),o=i?i.getPropertyValue(t)||i[t]:void 0,i&&(""!==o||re.contains(e.ownerDocument,e)||(o=re.style(e,t)),nt.test(o)&&it.test(t)&&(n=a.width,r=a.minWidth,s=a.maxWidth,a.minWidth=a.maxWidth=a.width=o,
o=i.width,a.width=n,a.minWidth=r,a.maxWidth=s)),void 0===o?o:o+""}):fe.documentElement.currentStyle&&(et=function(e){return e.currentStyle},tt=function(e,t,i){var n,r,s,o,a=e.style;return i=i||et(e),o=i?i[t]:void 0,null==o&&a&&a[t]&&(o=a[t]),nt.test(o)&&!rt.test(t)&&(n=a.left,r=e.runtimeStyle,s=r&&r.left,s&&(r.left=e.currentStyle.left),a.left="fontSize"===t?"1em":o,o=a.pixelLeft+"px",a.left=n,s&&(r.left=s)),void 0===o?o:o+""||"auto"}),function(){function t(){var t,i,n,r;i=fe.getElementsByTagName("body")[0],i&&i.style&&(t=fe.createElement("div"),n=fe.createElement("div"),n.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",i.appendChild(n).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",s=o=!1,l=!0,e.getComputedStyle&&(s="1%"!==(e.getComputedStyle(t,null)||{}).top,o="4px"===(e.getComputedStyle(t,null)||{width:"4px"}).width,r=t.appendChild(fe.createElement("div")),r.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",r.style.marginRight=r.style.width="0",t.style.width="1px",l=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight),t.removeChild(r)),t.innerHTML="<table><tr><td></td><td>t</td></tr></table>",r=t.getElementsByTagName("td"),r[0].style.cssText="margin:0;border:0;padding:0;display:none",a=0===r[0].offsetHeight,a&&(r[0].style.display="",r[1].style.display="none",a=0===r[0].offsetHeight),i.removeChild(n))}var i,n,r,s,o,a,l;i=fe.createElement("div"),i.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",r=i.getElementsByTagName("a")[0],n=r&&r.style,n&&(n.cssText="float:left;opacity:.5",ie.opacity="0.5"===n.opacity,ie.cssFloat=!!n.cssFloat,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",ie.clearCloneStyle="content-box"===i.style.backgroundClip,ie.boxSizing=""===n.boxSizing||""===n.MozBoxSizing||""===n.WebkitBoxSizing,re.extend(ie,{reliableHiddenOffsets:function(){return null==a&&t(),a},boxSizingReliable:function(){return null==o&&t(),o},pixelPosition:function(){return null==s&&t(),s},reliableMarginRight:function(){return null==l&&t(),l}}))}(),re.swap=function(e,t,i,n){var r,s,o={};for(s in t)o[s]=e.style[s],e.style[s]=t[s];r=i.apply(e,n||[]);for(s in t)e.style[s]=o[s];return r};var st=/alpha\([^)]*\)/i,ot=/opacity\s*=\s*([^)]*)/,at=/^(none|table(?!-c[ea]).+)/,lt=new RegExp("^("+ke+")(.*)$","i"),dt=new RegExp("^([+-])=("+ke+")","i"),ct={position:"absolute",visibility:"hidden",display:"block"},ht={letterSpacing:"0",fontWeight:"400"},ut=["Webkit","O","Moz","ms"];re.extend({cssHooks:{opacity:{get:function(e,t){if(t){var i=tt(e,"opacity");return""===i?"1":i}}}},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:ie.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,i,n){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var r,s,o,a=re.camelCase(t),l=e.style;if(t=re.cssProps[a]||(re.cssProps[a]=C(l,a)),o=re.cssHooks[t]||re.cssHooks[a],void 0===i)return o&&"get"in o&&void 0!==(r=o.get(e,!1,n))?r:l[t];if(s=typeof i,"string"===s&&(r=dt.exec(i))&&(i=(r[1]+1)*r[2]+parseFloat(re.css(e,t)),s="number"),null!=i&&i===i&&("number"!==s||re.cssNumber[a]||(i+="px"),ie.clearCloneStyle||""!==i||0!==t.indexOf("background")||(l[t]="inherit"),!(o&&"set"in o&&void 0===(i=o.set(e,i,n)))))try{l[t]=i}catch(e){}}},css:function(e,t,i,n){var r,s,o,a=re.camelCase(t);return t=re.cssProps[a]||(re.cssProps[a]=C(e.style,a)),o=re.cssHooks[t]||re.cssHooks[a],o&&"get"in o&&(s=o.get(e,!0,i)),void 0===s&&(s=tt(e,t,n)),"normal"===s&&t in ht&&(s=ht[t]),""===i||i?(r=parseFloat(s),i===!0||re.isNumeric(r)?r||0:s):s}}),re.each(["height","width"],function(e,t){re.cssHooks[t]={get:function(e,i,n){if(i)return at.test(re.css(e,"display"))&&0===e.offsetWidth?re.swap(e,ct,function(){return Z(e,t,n)}):Z(e,t,n)},set:function(e,i,n){var r=n&&et(e);return M(e,i,n?D(e,t,n,ie.boxSizing&&"border-box"===re.css(e,"boxSizing",!1,r),r):0)}}}),ie.opacity||(re.cssHooks.opacity={get:function(e,t){return ot.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var i=e.style,n=e.currentStyle,r=re.isNumeric(t)?"alpha(opacity="+100*t+")":"",s=n&&n.filter||i.filter||"";i.zoom=1,(t>=1||""===t)&&""===re.trim(s.replace(st,""))&&i.removeAttribute&&(i.removeAttribute("filter"),""===t||n&&!n.filter)||(i.filter=st.test(s)?s.replace(st,r):s+" "+r)}}),re.cssHooks.marginRight=k(ie.reliableMarginRight,function(e,t){if(t)return re.swap(e,{display:"inline-block"},tt,[e,"marginRight"])}),re.each({margin:"",padding:"",border:"Width"},function(e,t){re.cssHooks[e+t]={expand:function(i){for(var n=0,r={},s="string"==typeof i?i.split(" "):[i];n<4;n++)r[e+Ce[n]+t]=s[n]||s[n-2]||s[0];return r}},it.test(e)||(re.cssHooks[e+t].set=M)}),re.fn.extend({css:function(e,t){return Me(this,function(e,t,i){var n,r,s={},o=0;if(re.isArray(t)){for(n=et(e),r=t.length;o<r;o++)s[t[o]]=re.css(e,t[o],!1,n);return s}return void 0!==i?re.style(e,t,i):re.css(e,t)},e,t,arguments.length>1)},show:function(){return L(this,!0)},hide:function(){return L(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Le(this)?re(this).show():re(this).hide()})}}),re.Tween=H,H.prototype={constructor:H,init:function(e,t,i,n,r,s){this.elem=e,this.prop=i,this.easing=r||"swing",this.options=t,this.start=this.now=this.cur(),this.end=n,this.unit=s||(re.cssNumber[i]?"":"px")},cur:function(){var e=H.propHooks[this.prop];return e&&e.get?e.get(this):H.propHooks._default.get(this)},run:function(e){var t,i=H.propHooks[this.prop];return this.options.duration?this.pos=t=re.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),i&&i.set?i.set(this):H.propHooks._default.set(this),this}},H.prototype.init.prototype=H.prototype,H.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=re.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){re.fx.step[e.prop]?re.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[re.cssProps[e.prop]]||re.cssHooks[e.prop])?re.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},H.propHooks.scrollTop=H.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},re.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},re.fx=H.prototype.init,re.fx.step={};var pt,ft,mt=/^(?:toggle|show|hide)$/,gt=new RegExp("^(?:([+-])=|)("+ke+")([a-z%]*)$","i"),_t=/queueHooks$/,vt=[X],yt={"*":[function(e,t){var i=this.createTween(e,t),n=i.cur(),r=gt.exec(t),s=r&&r[3]||(re.cssNumber[e]?"":"px"),o=(re.cssNumber[e]||"px"!==s&&+n)&&gt.exec(re.css(i.elem,e)),a=1,l=20;if(o&&o[3]!==s){s=s||o[3],r=r||[],o=+n||1;do a=a||".5",o/=a,re.style(i.elem,e,o+s);while(a!==(a=i.cur()/n)&&1!==a&&--l)}return r&&(o=i.start=+o||+n||0,i.unit=s,i.end=r[1]?o+(r[1]+1)*r[2]:+r[2]),i}]};re.Animation=re.extend(N,{tweener:function(e,t){re.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var i,n=0,r=e.length;n<r;n++)i=e[n],yt[i]=yt[i]||[],yt[i].unshift(t)},prefilter:function(e,t){t?vt.unshift(e):vt.push(e)}}),re.speed=function(e,t,i){var n=e&&"object"==typeof e?re.extend({},e):{complete:i||!i&&t||re.isFunction(e)&&e,duration:e,easing:i&&t||t&&!re.isFunction(t)&&t};return n.duration=re.fx.off?0:"number"==typeof n.duration?n.duration:n.duration in re.fx.speeds?re.fx.speeds[n.duration]:re.fx.speeds._default,null!=n.queue&&n.queue!==!0||(n.queue="fx"),n.old=n.complete,n.complete=function(){re.isFunction(n.old)&&n.old.call(this),n.queue&&re.dequeue(this,n.queue)},n},re.fn.extend({fadeTo:function(e,t,i,n){return this.filter(Le).css("opacity",0).show().end().animate({opacity:t},e,i,n)},animate:function(e,t,i,n){var r=re.isEmptyObject(e),s=re.speed(t,i,n),o=function(){var t=N(this,re.extend({},e),s);(r||re._data(this,"finish"))&&t.stop(!0)};return o.finish=o,r||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,t,i){var n=function(e){var t=e.stop;delete e.stop,t(i)};return"string"!=typeof e&&(i=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,r=null!=e&&e+"queueHooks",s=re.timers,o=re._data(this);if(r)o[r]&&o[r].stop&&n(o[r]);else for(r in o)o[r]&&o[r].stop&&_t.test(r)&&n(o[r]);for(r=s.length;r--;)s[r].elem!==this||null!=e&&s[r].queue!==e||(s[r].anim.stop(i),t=!1,s.splice(r,1));!t&&i||re.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,i=re._data(this),n=i[e+"queue"],r=i[e+"queueHooks"],s=re.timers,o=n?n.length:0;for(i.finish=!0,re.queue(this,e,[]),r&&r.stop&&r.stop.call(this,!0),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++)n[t]&&n[t].finish&&n[t].finish.call(this);delete i.finish})}}),re.each(["toggle","show","hide"],function(e,t){var i=re.fn[t];re.fn[t]=function(e,n,r){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(P(t,!0),e,n,r)}}),re.each({slideDown:P("show"),slideUp:P("hide"),slideToggle:P("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){re.fn[e]=function(e,i,n){return this.animate(t,e,i,n)}}),re.timers=[],re.fx.tick=function(){var e,t=re.timers,i=0;for(pt=re.now();i<t.length;i++)e=t[i],e()||t[i]!==e||t.splice(i--,1);t.length||re.fx.stop(),pt=void 0},re.fx.timer=function(e){re.timers.push(e),e()?re.fx.start():re.timers.pop()},re.fx.interval=13,re.fx.start=function(){ft||(ft=setInterval(re.fx.tick,re.fx.interval))},re.fx.stop=function(){clearInterval(ft),ft=null},re.fx.speeds={slow:600,fast:200,_default:400},re.fn.delay=function(e,t){return e=re.fx?re.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,i){var n=setTimeout(t,e);i.stop=function(){clearTimeout(n)}})},function(){var e,t,i,n,r;t=fe.createElement("div"),t.setAttribute("className","t"),t.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=t.getElementsByTagName("a")[0],i=fe.createElement("select"),r=i.appendChild(fe.createElement("option")),e=t.getElementsByTagName("input")[0],n.style.cssText="top:1px",ie.getSetAttribute="t"!==t.className,ie.style=/top/.test(n.getAttribute("style")),ie.hrefNormalized="/a"===n.getAttribute("href"),ie.checkOn=!!e.value,ie.optSelected=r.selected,ie.enctype=!!fe.createElement("form").enctype,i.disabled=!0,ie.optDisabled=!r.disabled,e=fe.createElement("input"),e.setAttribute("value",""),ie.input=""===e.getAttribute("value"),e.value="t",e.setAttribute("type","radio"),ie.radioValue="t"===e.value}();var wt=/\r/g;re.fn.extend({val:function(e){var t,i,n,r=this[0];{if(arguments.length)return n=re.isFunction(e),this.each(function(i){var r;1===this.nodeType&&(r=n?e.call(this,i,re(this).val()):e,null==r?r="":"number"==typeof r?r+="":re.isArray(r)&&(r=re.map(r,function(e){return null==e?"":e+""})),t=re.valHooks[this.type]||re.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,r,"value")||(this.value=r))});if(r)return t=re.valHooks[r.type]||re.valHooks[r.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(i=t.get(r,"value"))?i:(i=r.value,"string"==typeof i?i.replace(wt,""):null==i?"":i)}}}),re.extend({valHooks:{option:{get:function(e){var t=re.find.attr(e,"value");return null!=t?t:re.trim(re.text(e))}},select:{get:function(e){for(var t,i,n=e.options,r=e.selectedIndex,s="select-one"===e.type||r<0,o=s?null:[],a=s?r+1:n.length,l=r<0?a:s?r:0;l<a;l++)if(i=n[l],(i.selected||l===r)&&(ie.optDisabled?!i.disabled:null===i.getAttribute("disabled"))&&(!i.parentNode.disabled||!re.nodeName(i.parentNode,"optgroup"))){if(t=re(i).val(),s)return t;o.push(t)}return o},set:function(e,t){for(var i,n,r=e.options,s=re.makeArray(t),o=r.length;o--;)if(n=r[o],re.inArray(re.valHooks.option.get(n),s)>=0)try{n.selected=i=!0}catch(e){n.scrollHeight}else n.selected=!1;return i||(e.selectedIndex=-1),r}}}}),re.each(["radio","checkbox"],function(){re.valHooks[this]={set:function(e,t){if(re.isArray(t))return e.checked=re.inArray(re(e).val(),t)>=0}},ie.checkOn||(re.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var bt,Tt,xt=re.expr.attrHandle,St=/^(?:checked|selected)$/i,Yt=ie.getSetAttribute,kt=ie.input;re.fn.extend({attr:function(e,t){return Me(this,re.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){re.removeAttr(this,e)})}}),re.extend({attr:function(e,t,i){var n,r,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===xe?re.prop(e,t,i):(1===s&&re.isXMLDoc(e)||(t=t.toLowerCase(),n=re.attrHooks[t]||(re.expr.match.bool.test(t)?Tt:bt)),void 0===i?n&&"get"in n&&null!==(r=n.get(e,t))?r:(r=re.find.attr(e,t),null==r?void 0:r):null!==i?n&&"set"in n&&void 0!==(r=n.set(e,i,t))?r:(e.setAttribute(t,i+""),i):void re.removeAttr(e,t))},removeAttr:function(e,t){var i,n,r=0,s=t&&t.match(ye);if(s&&1===e.nodeType)for(;i=s[r++];)n=re.propFix[i]||i,re.expr.match.bool.test(i)?kt&&Yt||!St.test(i)?e[n]=!1:e[re.camelCase("default-"+i)]=e[n]=!1:re.attr(e,i,""),e.removeAttribute(Yt?i:n)},attrHooks:{type:{set:function(e,t){if(!ie.radioValue&&"radio"===t&&re.nodeName(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}}}}),Tt={set:function(e,t,i){return t===!1?re.removeAttr(e,i):kt&&Yt||!St.test(i)?e.setAttribute(!Yt&&re.propFix[i]||i,i):e[re.camelCase("default-"+i)]=e[i]=!0,i}},re.each(re.expr.match.bool.source.match(/\w+/g),function(e,t){var i=xt[t]||re.find.attr;xt[t]=kt&&Yt||!St.test(t)?function(e,t,n){var r,s;return n||(s=xt[t],xt[t]=r,r=null!=i(e,t,n)?t.toLowerCase():null,xt[t]=s),r}:function(e,t,i){if(!i)return e[re.camelCase("default-"+t)]?t.toLowerCase():null}}),kt&&Yt||(re.attrHooks.value={set:function(e,t,i){return re.nodeName(e,"input")?void(e.defaultValue=t):bt&&bt.set(e,t,i)}}),Yt||(bt={set:function(e,t,i){var n=e.getAttributeNode(i);if(n||e.setAttributeNode(n=e.ownerDocument.createAttribute(i)),n.value=t+="","value"===i||t===e.getAttribute(i))return t}},xt.id=xt.name=xt.coords=function(e,t,i){var n;if(!i)return(n=e.getAttributeNode(t))&&""!==n.value?n.value:null},re.valHooks.button={get:function(e,t){var i=e.getAttributeNode(t);if(i&&i.specified)return i.value},set:bt.set},re.attrHooks.contenteditable={set:function(e,t,i){bt.set(e,""!==t&&t,i)}},re.each(["width","height"],function(e,t){re.attrHooks[t]={set:function(e,i){if(""===i)return e.setAttribute(t,"auto"),i}}})),ie.style||(re.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var Ct=/^(?:input|select|textarea|button|object)$/i,Lt=/^(?:a|area)$/i;re.fn.extend({prop:function(e,t){return Me(this,re.prop,e,t,arguments.length>1)},removeProp:function(e){return e=re.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e]}catch(e){}})}}),re.extend({propFix:{for:"htmlFor",class:"className"},prop:function(e,t,i){var n,r,s,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return s=1!==o||!re.isXMLDoc(e),s&&(t=re.propFix[t]||t,r=re.propHooks[t]),void 0!==i?r&&"set"in r&&void 0!==(n=r.set(e,i,t))?n:e[t]=i:r&&"get"in r&&null!==(n=r.get(e,t))?n:e[t]},propHooks:{tabIndex:{get:function(e){var t=re.find.attr(e,"tabindex");return t?parseInt(t,10):Ct.test(e.nodeName)||Lt.test(e.nodeName)&&e.href?0:-1}}}}),ie.hrefNormalized||re.each(["href","src"],function(e,t){re.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),ie.optSelected||(re.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),re.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){re.propFix[this.toLowerCase()]=this}),ie.enctype||(re.propFix.enctype="encoding");var Mt=/[\t\r\n\f]/g;re.fn.extend({addClass:function(e){var t,i,n,r,s,o,a=0,l=this.length,d="string"==typeof e&&e;if(re.isFunction(e))return this.each(function(t){re(this).addClass(e.call(this,t,this.className))});if(d)for(t=(e||"").match(ye)||[];a<l;a++)if(i=this[a],n=1===i.nodeType&&(i.className?(" "+i.className+" ").replace(Mt," "):" ")){for(s=0;r=t[s++];)n.indexOf(" "+r+" ")<0&&(n+=r+" ");o=re.trim(n),i.className!==o&&(i.className=o)}return this},removeClass:function(e){var t,i,n,r,s,o,a=0,l=this.length,d=0===arguments.length||"string"==typeof e&&e;if(re.isFunction(e))return this.each(function(t){re(this).removeClass(e.call(this,t,this.className))});if(d)for(t=(e||"").match(ye)||[];a<l;a++)if(i=this[a],n=1===i.nodeType&&(i.className?(" "+i.className+" ").replace(Mt," "):"")){for(s=0;r=t[s++];)for(;n.indexOf(" "+r+" ")>=0;)n=n.replace(" "+r+" "," ");o=e?re.trim(n):"",i.className!==o&&(i.className=o)}return this},toggleClass:function(e,t){var i=typeof e;return"boolean"==typeof t&&"string"===i?t?this.addClass(e):this.removeClass(e):re.isFunction(e)?this.each(function(i){re(this).toggleClass(e.call(this,i,this.className,t),t)}):this.each(function(){if("string"===i)for(var t,n=0,r=re(this),s=e.match(ye)||[];t=s[n++];)r.hasClass(t)?r.removeClass(t):r.addClass(t);else i!==xe&&"boolean"!==i||(this.className&&re._data(this,"__className__",this.className),this.className=this.className||e===!1?"":re._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",i=0,n=this.length;i<n;i++)if(1===this[i].nodeType&&(" "+this[i].className+" ").replace(Mt," ").indexOf(t)>=0)return!0;return!1}}),re.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){re.fn[t]=function(e,i){return arguments.length>0?this.on(t,null,e,i):this.trigger(t)}}),re.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,i){return this.on(e,null,t,i)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,i,n){return this.on(t,e,i,n)},undelegate:function(e,t,i){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",i)}});var Dt=re.now(),Zt=/\?/,Ht=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;re.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var i,n=null,r=re.trim(t+"");return r&&!re.trim(r.replace(Ht,function(e,t,r,s){return i&&t&&(n=0),0===n?e:(i=r||t,n+=!s-!r,"")}))?Function("return "+r)():re.error("Invalid JSON: "+t)},re.parseXML=function(t){var i,n;if(!t||"string"!=typeof t)return null;try{e.DOMParser?(n=new DOMParser,i=n.parseFromString(t,"text/xml")):(i=new ActiveXObject("Microsoft.XMLDOM"),i.async="false",i.loadXML(t))}catch(e){i=void 0}return i&&i.documentElement&&!i.getElementsByTagName("parsererror").length||re.error("Invalid XML: "+t),i};var jt,Pt,Jt=/#.*$/,Xt=/([?&])_=[^&]*/,Ft=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,$t=/^(?:GET|HEAD)$/,Bt=/^\/\//,Et=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Qt={},Ot={},Wt="*/".concat("*");try{Pt=location.href}catch(e){Pt=fe.createElement("a"),Pt.href="",Pt=Pt.href}jt=Et.exec(Pt.toLowerCase())||[],re.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Pt,type:"GET",isLocal:Nt.test(jt[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Wt,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":re.parseJSON,"text xml":re.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?E(E(e,re.ajaxSettings),t):E(re.ajaxSettings,e)},ajaxPrefilter:$(Qt),ajaxTransport:$(Ot),ajax:function(e,t){function i(e,t,i,n){var r,c,_,v,w,T=t;2!==y&&(y=2,a&&clearTimeout(a),d=void 0,o=n||"",b.readyState=e>0?4:0,r=e>=200&&e<300||304===e,i&&(v=Q(h,b,i)),v=O(h,v,b,r),r?(h.ifModified&&(w=b.getResponseHeader("Last-Modified"),w&&(re.lastModified[s]=w),w=b.getResponseHeader("etag"),w&&(re.etag[s]=w)),204===e||"HEAD"===h.type?T="nocontent":304===e?T="notmodified":(T=v.state,c=v.data,_=v.error,r=!_)):(_=T,!e&&T||(T="error",e<0&&(e=0))),b.status=e,b.statusText=(t||T)+"",r?f.resolveWith(u,[c,T,b]):f.rejectWith(u,[b,T,_]),b.statusCode(g),g=void 0,l&&p.trigger(r?"ajaxSuccess":"ajaxError",[b,h,r?c:_]),m.fireWith(u,[b,T]),l&&(p.trigger("ajaxComplete",[b,h]),--re.active||re.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var n,r,s,o,a,l,d,c,h=re.ajaxSetup({},t),u=h.context||h,p=h.context&&(u.nodeType||u.jquery)?re(u):re.event,f=re.Deferred(),m=re.Callbacks("once memory"),g=h.statusCode||{},_={},v={},y=0,w="canceled",b={readyState:0,getResponseHeader:function(e){var t;if(2===y){if(!c)for(c={};t=Ft.exec(o);)c[t[1].toLowerCase()]=t[2];t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===y?o:null},setRequestHeader:function(e,t){var i=e.toLowerCase();return y||(e=v[i]=v[i]||e,_[e]=t),this},overrideMimeType:function(e){return y||(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(y<2)for(t in e)g[t]=[g[t],e[t]];else b.always(e[b.status]);return this},abort:function(e){var t=e||w;return d&&d.abort(t),i(0,t),this}};if(f.promise(b).complete=m.add,b.success=b.done,b.error=b.fail,h.url=((e||h.url||Pt)+"").replace(Jt,"").replace(Bt,jt[1]+"//"),h.type=t.method||t.type||h.method||h.type,h.dataTypes=re.trim(h.dataType||"*").toLowerCase().match(ye)||[""],null==h.crossDomain&&(n=Et.exec(h.url.toLowerCase()),h.crossDomain=!(!n||n[1]===jt[1]&&n[2]===jt[2]&&(n[3]||("http:"===n[1]?"80":"443"))===(jt[3]||("http:"===jt[1]?"80":"443")))),h.data&&h.processData&&"string"!=typeof h.data&&(h.data=re.param(h.data,h.traditional)),B(Qt,h,t,b),2===y)return b;l=re.event&&h.global,l&&0===re.active++&&re.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!$t.test(h.type),s=h.url,h.hasContent||(h.data&&(s=h.url+=(Zt.test(s)?"&":"?")+h.data,delete h.data),h.cache===!1&&(h.url=Xt.test(s)?s.replace(Xt,"$1_="+Dt++):s+(Zt.test(s)?"&":"?")+"_="+Dt++)),h.ifModified&&(re.lastModified[s]&&b.setRequestHeader("If-Modified-Since",re.lastModified[s]),re.etag[s]&&b.setRequestHeader("If-None-Match",re.etag[s])),(h.data&&h.hasContent&&h.contentType!==!1||t.contentType)&&b.setRequestHeader("Content-Type",h.contentType),b.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+Wt+"; q=0.01":""):h.accepts["*"]);for(r in h.headers)b.setRequestHeader(r,h.headers[r]);if(h.beforeSend&&(h.beforeSend.call(u,b,h)===!1||2===y))return b.abort();w="abort";for(r in{success:1,error:1,complete:1})b[r](h[r]);if(d=B(Ot,h,t,b)){b.readyState=1,l&&p.trigger("ajaxSend",[b,h]),h.async&&h.timeout>0&&(a=setTimeout(function(){b.abort("timeout")},h.timeout));try{y=1,d.send(_,i)}catch(e){if(!(y<2))throw e;i(-1,e)}}else i(-1,"No Transport");return b},getJSON:function(e,t,i){return re.get(e,t,i,"json")},getScript:function(e,t){return re.get(e,void 0,t,"script")}}),re.each(["get","post"],function(e,t){re[t]=function(e,i,n,r){return re.isFunction(i)&&(r=r||n,n=i,i=void 0),re.ajax({url:e,type:t,dataType:r,data:i,success:n})}}),re._evalUrl=function(e){return re.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,throws:!0})},re.fn.extend({wrapAll:function(e){if(re.isFunction(e))return this.each(function(t){re(this).wrapAll(e.call(this,t))});if(this[0]){var t=re(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return re.isFunction(e)?this.each(function(t){re(this).wrapInner(e.call(this,t))}):this.each(function(){var t=re(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)})},wrap:function(e){var t=re.isFunction(e);return this.each(function(i){re(this).wrapAll(t?e.call(this,i):e)})},unwrap:function(){return this.parent().each(function(){re.nodeName(this,"body")||re(this).replaceWith(this.childNodes)}).end()}}),re.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||!ie.reliableHiddenOffsets()&&"none"===(e.style&&e.style.display||re.css(e,"display"))},re.expr.filters.visible=function(e){return!re.expr.filters.hidden(e)};var Rt=/%20/g,At=/\[\]$/,Gt=/\r?\n/g,It=/^(?:submit|button|image|reset|file)$/i,Kt=/^(?:input|select|textarea|keygen)/i;re.param=function(e,t){var i,n=[],r=function(e,t){t=re.isFunction(t)?t():null==t?"":t,n[n.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=re.ajaxSettings&&re.ajaxSettings.traditional),re.isArray(e)||e.jquery&&!re.isPlainObject(e))re.each(e,function(){r(this.name,this.value)});else for(i in e)W(i,e[i],t,r);return n.join("&").replace(Rt,"+")},re.fn.extend({serialize:function(){return re.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=re.prop(this,"elements");return e?re.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!re(this).is(":disabled")&&Kt.test(this.nodeName)&&!It.test(e)&&(this.checked||!De.test(e))}).map(function(e,t){var i=re(this).val();return null==i?null:re.isArray(i)?re.map(i,function(e){return{name:t.name,value:e.replace(Gt,"\r\n")}}):{name:t.name,value:i.replace(Gt,"\r\n")}}).get()}}),re.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&R()||A()}:R;var Ut=0,zt={},qt=re.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var e in zt)zt[e](void 0,!0)}),ie.cors=!!qt&&"withCredentials"in qt,qt=ie.ajax=!!qt,qt&&re.ajaxTransport(function(e){if(!e.crossDomain||ie.cors){var t;return{send:function(i,n){var r,s=e.xhr(),o=++Ut;if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(r in e.xhrFields)s[r]=e.xhrFields[r];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(r in i)void 0!==i[r]&&s.setRequestHeader(r,i[r]+"");s.send(e.hasContent&&e.data||null),t=function(i,r){var a,l,d;if(t&&(r||4===s.readyState))if(delete zt[o],t=void 0,s.onreadystatechange=re.noop,r)4!==s.readyState&&s.abort();else{d={},a=s.status,"string"==typeof s.responseText&&(d.text=s.responseText);try{l=s.statusText}catch(e){l=""}a||!e.isLocal||e.crossDomain?1223===a&&(a=204):a=d.text?200:404}d&&n(a,l,d,s.getAllResponseHeaders())},e.async?4===s.readyState?setTimeout(t):s.onreadystatechange=zt[o]=t:t()},abort:function(){t&&t(void 0,!0)}}}}),re.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return re.globalEval(e),e}}}),re.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),re.ajaxTransport("script",function(e){if(e.crossDomain){var t,i=fe.head||re("head")[0]||fe.documentElement;return{send:function(n,r){t=fe.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,i){(i||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,i||r(200,"success"))},i.insertBefore(t,i.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var Vt=[],ei=/(=)\?(?=&|$)|\?\?/;re.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Vt.pop()||re.expando+"_"+Dt++;return this[e]=!0,e}}),re.ajaxPrefilter("json jsonp",function(t,i,n){var r,s,o,a=t.jsonp!==!1&&(ei.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&ei.test(t.data)&&"data");if(a||"jsonp"===t.dataTypes[0])return r=t.jsonpCallback=re.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a?t[a]=t[a].replace(ei,"$1"+r):t.jsonp!==!1&&(t.url+=(Zt.test(t.url)?"&":"?")+t.jsonp+"="+r),t.converters["script json"]=function(){return o||re.error(r+" was not called"),o[0]},t.dataTypes[0]="json",s=e[r],e[r]=function(){o=arguments},n.always(function(){e[r]=s,t[r]&&(t.jsonpCallback=i.jsonpCallback,Vt.push(r)),o&&re.isFunction(s)&&s(o[0]),o=s=void 0}),"script"}),re.parseHTML=function(e,t,i){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(i=t,t=!1),t=t||fe;var n=he.exec(e),r=!i&&[];return n?[t.createElement(n[1])]:(n=re.buildFragment([e],t,r),r&&r.length&&re(r).remove(),re.merge([],n.childNodes))};var ti=re.fn.load;re.fn.load=function(e,t,i){if("string"!=typeof e&&ti)return ti.apply(this,arguments);var n,r,s,o=this,a=e.indexOf(" ");return a>=0&&(n=re.trim(e.slice(a,e.length)),e=e.slice(0,a)),re.isFunction(t)?(i=t,t=void 0):t&&"object"==typeof t&&(s="POST"),o.length>0&&re.ajax({url:e,type:s,dataType:"html",data:t}).done(function(e){r=arguments,o.html(n?re("<div>").append(re.parseHTML(e)).find(n):e)}).complete(i&&function(e,t){o.each(i,r||[e.responseText,t,e])}),this},re.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){re.fn[t]=function(e){return this.on(t,e)}}),re.expr.filters.animated=function(e){return re.grep(re.timers,function(t){return e===t.elem}).length};var ii=e.document.documentElement;re.offset={setOffset:function(e,t,i){var n,r,s,o,a,l,d,c=re.css(e,"position"),h=re(e),u={};"static"===c&&(e.style.position="relative"),a=h.offset(),s=re.css(e,"top"),l=re.css(e,"left"),d=("absolute"===c||"fixed"===c)&&re.inArray("auto",[s,l])>-1,d?(n=h.position(),o=n.top,r=n.left):(o=parseFloat(s)||0,r=parseFloat(l)||0),re.isFunction(t)&&(t=t.call(e,i,a)),null!=t.top&&(u.top=t.top-a.top+o),null!=t.left&&(u.left=t.left-a.left+r),"using"in t?t.using.call(e,u):h.css(u)}},re.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){re.offset.setOffset(this,e,t)});var t,i,n={top:0,left:0},r=this[0],s=r&&r.ownerDocument;if(s)return t=s.documentElement,re.contains(t,r)?(typeof r.getBoundingClientRect!==xe&&(n=r.getBoundingClientRect()),i=G(s),{top:n.top+(i.pageYOffset||t.scrollTop)-(t.clientTop||0),left:n.left+(i.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):n},position:function(){if(this[0]){var e,t,i={top:0,left:0},n=this[0];return"fixed"===re.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),re.nodeName(e[0],"html")||(i=e.offset()),i.top+=re.css(e[0],"borderTopWidth",!0),i.left+=re.css(e[0],"borderLeftWidth",!0)),{top:t.top-i.top-re.css(n,"marginTop",!0),left:t.left-i.left-re.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||ii;e&&!re.nodeName(e,"html")&&"static"===re.css(e,"position");)e=e.offsetParent;return e||ii})}}),re.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var i=/Y/.test(t);re.fn[e]=function(n){return Me(this,function(e,n,r){var s=G(e);return void 0===r?s?t in s?s[t]:s.document.documentElement[n]:e[n]:void(s?s.scrollTo(i?re(s).scrollLeft():r,i?r:re(s).scrollTop()):e[n]=r)},e,n,arguments.length,null)}}),re.each(["top","left"],function(e,t){re.cssHooks[t]=k(ie.pixelPosition,function(e,i){if(i)return i=tt(e,t),nt.test(i)?re(e).position()[t]+"px":i})}),re.each({Height:"height",Width:"width"},function(e,t){re.each({padding:"inner"+e,content:t,"":"outer"+e},function(i,n){re.fn[n]=function(n,r){var s=arguments.length&&(i||"boolean"!=typeof n),o=i||(n===!0||r===!0?"margin":"border");return Me(this,function(t,i,n){var r;return re.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(r=t.documentElement,
Math.max(t.body["scroll"+e],r["scroll"+e],t.body["offset"+e],r["offset"+e],r["client"+e])):void 0===n?re.css(t,i,o):re.style(t,i,n,o)},t,s?n:void 0,s,null)}})}),re.fn.size=function(){return this.length},re.fn.andSelf=re.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return re});var ni=e.jQuery,ri=e.$;return re.noConflict=function(t){return e.$===re&&(e.$=ri),t&&e.jQuery===re&&(e.jQuery=ni),re},typeof t===xe&&(e.jQuery=e.$=re),re}),function(){var e=this,t=e._,i={},n=Array.prototype,r=Object.prototype,s=Function.prototype,o=n.push,a=n.slice,l=n.concat,d=r.toString,c=r.hasOwnProperty,h=n.forEach,u=n.map,p=n.reduce,f=n.reduceRight,m=n.filter,g=n.every,_=n.some,v=n.indexOf,y=n.lastIndexOf,w=Array.isArray,b=Object.keys,T=s.bind,x=function(e){return e instanceof x?e:this instanceof x?void(this._wrapped=e):new x(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.5.1";var S=x.each=x.forEach=function(e,t,n){if(null!=e)if(h&&e.forEach===h)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,s=e.length;r<s;r++)if(t.call(n,e[r],r,e)===i)return}else for(var o in e)if(x.has(e,o)&&t.call(n,e[o],o,e)===i)return};x.map=x.collect=function(e,t,i){var n=[];return null==e?n:u&&e.map===u?e.map(t,i):(S(e,function(e,r,s){n.push(t.call(i,e,r,s))}),n)};var Y="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,i,n){var r=arguments.length>2;if(null==e&&(e=[]),p&&e.reduce===p)return n&&(t=x.bind(t,n)),r?e.reduce(t,i):e.reduce(t);if(S(e,function(e,s,o){r?i=t.call(n,i,e,s,o):(i=e,r=!0)}),!r)throw new TypeError(Y);return i},x.reduceRight=x.foldr=function(e,t,i,n){var r=arguments.length>2;if(null==e&&(e=[]),f&&e.reduceRight===f)return n&&(t=x.bind(t,n)),r?e.reduceRight(t,i):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}if(S(e,function(a,l,d){l=o?o[--s]:--s,r?i=t.call(n,i,e[l],l,d):(i=e[l],r=!0)}),!r)throw new TypeError(Y);return i},x.find=x.detect=function(e,t,i){var n;return k(e,function(e,r,s){if(t.call(i,e,r,s))return n=e,!0}),n},x.filter=x.select=function(e,t,i){var n=[];return null==e?n:m&&e.filter===m?e.filter(t,i):(S(e,function(e,r,s){t.call(i,e,r,s)&&n.push(e)}),n)},x.reject=function(e,t,i){return x.filter(e,function(e,n,r){return!t.call(i,e,n,r)},i)},x.every=x.all=function(e,t,n){t||(t=x.identity);var r=!0;return null==e?r:g&&e.every===g?e.every(t,n):(S(e,function(e,s,o){if(!(r=r&&t.call(n,e,s,o)))return i}),!!r)};var k=x.some=x.any=function(e,t,n){t||(t=x.identity);var r=!1;return null==e?r:_&&e.some===_?e.some(t,n):(S(e,function(e,s,o){if(r||(r=t.call(n,e,s,o)))return i}),!!r)};x.contains=x.include=function(e,t){return null!=e&&(v&&e.indexOf===v?e.indexOf(t)!=-1:k(e,function(e){return e===t}))},x.invoke=function(e,t){var i=a.call(arguments,2),n=x.isFunction(t);return x.map(e,function(e){return(n?t:e[t]).apply(e,i)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,i){return x.isEmpty(t)?i?void 0:[]:x[i?"find":"filter"](e,function(e){for(var i in t)if(t[i]!==e[i])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,i){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-(1/0);var n={computed:-(1/0),value:-(1/0)};return S(e,function(e,r,s){var o=t?t.call(i,e,r,s):e;o>n.computed&&(n={value:e,computed:o})}),n.value},x.min=function(e,t,i){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return 1/0;var n={computed:1/0,value:1/0};return S(e,function(e,r,s){var o=t?t.call(i,e,r,s):e;o<n.computed&&(n={value:e,computed:o})}),n.value},x.shuffle=function(e){var t,i=0,n=[];return S(e,function(e){t=x.random(i++),n[i-1]=n[t],n[t]=e}),n};var C=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,i){var n=C(t);return x.pluck(x.map(e,function(e,t,r){return{value:e,index:t,criteria:n.call(i,e,t,r)}}).sort(function(e,t){var i=e.criteria,n=t.criteria;if(i!==n){if(i>n||void 0===i)return 1;if(i<n||void 0===n)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,i,n){var r={},s=C(null==t?x.identity:t);return S(e,function(t,o){var a=s.call(i,t,o,e);n(r,a,t)}),r};x.groupBy=function(e,t,i){return L(e,t,i,function(e,t,i){(x.has(e,t)?e[t]:e[t]=[]).push(i)})},x.countBy=function(e,t,i){return L(e,t,i,function(e,t){x.has(e,t)||(e[t]=0),e[t]++})},x.sortedIndex=function(e,t,i,n){i=null==i?x.identity:C(i);for(var r=i.call(n,t),s=0,o=e.length;s<o;){var a=s+o>>>1;i.call(n,e[a])<r?s=a+1:o=a}return s},x.toArray=function(e){return e?x.isArray(e)?a.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return null==e?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,i){if(null!=e)return null==t||i?e[0]:a.call(e,0,t)},x.initial=function(e,t,i){return a.call(e,0,e.length-(null==t||i?1:t))},x.last=function(e,t,i){if(null!=e)return null==t||i?e[e.length-1]:a.call(e,Math.max(e.length-t,0))},x.rest=x.tail=x.drop=function(e,t,i){return a.call(e,null==t||i?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var M=function(e,t,i){return t&&x.every(e,x.isArray)?l.apply(i,e):(S(e,function(e){x.isArray(e)||x.isArguments(e)?t?o.apply(i,e):M(e,t,i):i.push(e)}),i)};x.flatten=function(e,t){return M(e,t,[])},x.without=function(e){return x.difference(e,a.call(arguments,1))},x.uniq=x.unique=function(e,t,i,n){x.isFunction(t)&&(n=i,i=t,t=!1);var r=i?x.map(e,i,n):e,s=[],o=[];return S(r,function(i,n){(t?n&&o[o.length-1]===i:x.contains(o,i))||(o.push(i),s.push(e[n]))}),s},x.union=function(){return x.uniq(x.flatten(arguments,!0))},x.intersection=function(e){var t=a.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=l.apply(n,a.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){for(var e=x.max(x.pluck(arguments,"length").concat(0)),t=new Array(e),i=0;i<e;i++)t[i]=x.pluck(arguments,""+i);return t},x.object=function(e,t){if(null==e)return{};for(var i={},n=0,r=e.length;n<r;n++)t?i[e[n]]=t[n]:i[e[n][0]]=e[n][1];return i},x.indexOf=function(e,t,i){if(null==e)return-1;var n=0,r=e.length;if(i){if("number"!=typeof i)return n=x.sortedIndex(e,t),e[n]===t?n:-1;n=i<0?Math.max(0,r+i):i}if(v&&e.indexOf===v)return e.indexOf(t,i);for(;n<r;n++)if(e[n]===t)return n;return-1},x.lastIndexOf=function(e,t,i){if(null==e)return-1;var n=null!=i;if(y&&e.lastIndexOf===y)return n?e.lastIndexOf(t,i):e.lastIndexOf(t);for(var r=n?i:e.length;r--;)if(e[r]===t)return r;return-1},x.range=function(e,t,i){arguments.length<=1&&(t=e||0,e=0),i=arguments[2]||1;for(var n=Math.max(Math.ceil((t-e)/i),0),r=0,s=new Array(n);r<n;)s[r++]=e,e+=i;return s};var D=function(){};x.bind=function(e,t){var i,n;if(T&&e.bind===T)return T.apply(e,a.call(arguments,1));if(!x.isFunction(e))throw new TypeError;return i=a.call(arguments,2),n=function(){if(!(this instanceof n))return e.apply(t,i.concat(a.call(arguments)));D.prototype=e.prototype;var r=new D;D.prototype=null;var s=e.apply(r,i.concat(a.call(arguments)));return Object(s)===s?s:r}},x.partial=function(e){var t=a.call(arguments,1);return function(){return e.apply(this,t.concat(a.call(arguments)))}},x.bindAll=function(e){var t=a.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return S(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var i={};return t||(t=x.identity),function(){var n=t.apply(this,arguments);return x.has(i,n)?i[n]:i[n]=e.apply(this,arguments)}},x.delay=function(e,t){var i=a.call(arguments,2);return setTimeout(function(){return e.apply(null,i)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(a.call(arguments,1)))},x.throttle=function(e,t,i){var n,r,s,o=null,a=0;i||(i={});var l=function(){a=i.leading===!1?0:new Date,o=null,s=e.apply(n,r)};return function(){var d=new Date;a||i.leading!==!1||(a=d);var c=t-(d-a);return n=this,r=arguments,c<=0?(clearTimeout(o),o=null,a=d,s=e.apply(n,r)):o||i.trailing===!1||(o=setTimeout(l,c)),s}},x.debounce=function(e,t,i){var n,r=null;return function(){var s=this,o=arguments,a=function(){r=null,i||(n=e.apply(s,o))},l=i&&!r;return clearTimeout(r),r=setTimeout(a,t),l&&(n=e.apply(s,o)),n}},x.once=function(e){var t,i=!1;return function(){return i?t:(i=!0,t=e.apply(this,arguments),e=null,t)}},x.wrap=function(e,t){return function(){var i=[e];return o.apply(i,arguments),t.apply(this,i)}},x.compose=function(){var e=arguments;return function(){for(var t=arguments,i=e.length-1;i>=0;i--)t=[e[i].apply(this,t)];return t[0]}},x.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},x.keys=b||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var i in e)x.has(e,i)&&t.push(i);return t},x.values=function(e){var t=[];for(var i in e)x.has(e,i)&&t.push(e[i]);return t},x.pairs=function(e){var t=[];for(var i in e)x.has(e,i)&&t.push([i,e[i]]);return t},x.invert=function(e){var t={};for(var i in e)x.has(e,i)&&(t[e[i]]=i);return t},x.functions=x.methods=function(e){var t=[];for(var i in e)x.isFunction(e[i])&&t.push(i);return t.sort()},x.extend=function(e){return S(a.call(arguments,1),function(t){if(t)for(var i in t)e[i]=t[i]}),e},x.pick=function(e){var t={},i=l.apply(n,a.call(arguments,1));return S(i,function(i){i in e&&(t[i]=e[i])}),t},x.omit=function(e){var t={},i=l.apply(n,a.call(arguments,1));for(var r in e)x.contains(i,r)||(t[r]=e[r]);return t},x.defaults=function(e){return S(a.call(arguments,1),function(t){if(t)for(var i in t)void 0===e[i]&&(e[i]=t[i])}),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 Z=function(e,t,i,n){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var r=d.call(e);if(r!=d.call(t))return!1;switch(r){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:0==e?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("object"!=typeof e||"object"!=typeof t)return!1;for(var s=i.length;s--;)if(i[s]==e)return n[s]==t;var o=e.constructor,a=t.constructor;if(o!==a&&!(x.isFunction(o)&&o instanceof o&&x.isFunction(a)&&a instanceof a))return!1;i.push(e),n.push(t);var l=0,c=!0;if("[object Array]"==r){if(l=e.length,c=l==t.length)for(;l--&&(c=Z(e[l],t[l],i,n)););}else{for(var h in e)if(x.has(e,h)&&(l++,!(c=x.has(t,h)&&Z(e[h],t[h],i,n))))break;if(c){for(h in t)if(x.has(t,h)&&!l--)break;c=!l}}return i.pop(),n.pop(),c};x.isEqual=function(e,t){return Z(e,t,[],[])},x.isEmpty=function(e){if(null==e)return!0;if(x.isArray(e)||x.isString(e))return 0===e.length;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!(!e||1!==e.nodeType)},x.isArray=w||function(e){return"[object Array]"==d.call(e)},x.isObject=function(e){return e===Object(e)},S(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return d.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!(!e||!x.has(e,"callee"))}),"function"!=typeof/./&&(x.isFunction=function(e){return"function"==typeof e}),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||"[object Boolean]"==d.call(e)},x.isNull=function(e){return null===e},x.isUndefined=function(e){return void 0===e},x.has=function(e,t){return c.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,i){for(var n=Array(Math.max(0,e)),r=0;r<e;r++)n[r]=t.call(i,r);return n},x.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var H={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};H.unescape=x.invert(H.escape);var j={escape:new RegExp("["+x.keys(H.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(H.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return null==t?"":(""+t).replace(j[e],function(t){return H[e][t]})}}),x.result=function(e,t){if(null!=e){var i=e[t];return x.isFunction(i)?i.call(e):i}},x.mixin=function(e){S(x.functions(e),function(t){var i=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),N.call(this,i.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 J=/(.)^/,X={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},F=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,i){var n;i=x.defaults({},i,x.templateSettings);var r=new RegExp([(i.escape||J).source,(i.interpolate||J).source,(i.evaluate||J).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(r,function(t,i,n,r,a){return o+=e.slice(s,a).replace(F,function(e){return"\\"+X[e]}),i&&(o+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'"),n&&(o+="'+\n((__t=("+n+"))==null?'':__t)+\n'"),r&&(o+="';\n"+r+"\n__p+='"),s=a+t.length,t}),o+="';\n",i.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{n=new Function(i.variable||"obj","_",o)}catch(e){throw e.source=o,e}if(t)return n(t,x);var a=function(e){return n.call(this,e,x)};return a.source="function("+(i.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var N=function(e){return this._chain?x(e).chain():e};x.mixin(x),S(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=n[e];x.prototype[e]=function(){var i=this._wrapped;return t.apply(i,arguments),"shift"!=e&&"splice"!=e||0!==i.length||delete i[0],N.call(this,i)}}),S(["concat","join","slice"],function(e){var t=n[e];x.prototype[e]=function(){return N.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;return t||e._}}(this)),define("text",["module"],function(e){"use strict";var t,i,n,r,s,o=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],a=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,l=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,d="undefined"!=typeof location&&location.href,c=d&&location.protocol&&location.protocol.replace(/\:/,""),h=d&&location.hostname,u=d&&(location.port||void 0),p={},f=e.config&&e.config()||{};return t={version:"2.0.13+",strip:function(e){if(e){e=e.replace(a,"");var t=e.match(l);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:f.createXhr||function(){var e,t,i;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof ActiveXObject)for(t=0;t<3;t+=1){i=o[t];try{e=new ActiveXObject(i)}catch(e){}if(e){o=[i];break}}return e},parseName:function(e){var t,i,n,r=!1,s=e.lastIndexOf("."),o=0===e.indexOf("./")||0===e.indexOf("../");return s!==-1&&(!o||s>1)?(t=e.substring(0,s),i=e.substring(s+1)):t=e,n=i||t,s=n.indexOf("!"),s!==-1&&(r="strip"===n.substring(s+1),n=n.substring(0,s),i?i=n:t=n),{moduleName:t,ext:i,strip:r}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,i,n,r){var s,o,a,l=t.xdRegExp.exec(e);return!l||(s=l[2],o=l[3],o=o.split(":"),a=o[1],o=o[0],!(s&&s!==i||o&&o.toLowerCase()!==n.toLowerCase()||(a||o)&&a!==r))},finishLoad:function(e,i,n,r){n=i?t.strip(n):n,f.isBuild&&(p[e]=n),r(n)},load:function(e,i,n,r){if(r&&r.isBuild&&!r.inlineText)return void n();f.isBuild=r&&r.isBuild;var s=t.parseName(e),o=s.moduleName+(s.ext?"."+s.ext:""),a=i.toUrl(o),l=f.useXhr||t.useXhr;return 0===a.indexOf("empty:")?void n():void(!d||l(a,c,h,u)?t.get(a,function(i){t.finishLoad(e,s.strip,i,n)},function(e){n.error&&n.error(e)}):i([o],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,n)}))},write:function(e,i,n,r){if(p.hasOwnProperty(i)){var s=t.jsEscape(p[i]);n.asModule(e+"!"+i,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,i,n,r,s){var o=t.parseName(i),a=o.ext?"."+o.ext:"",l=o.moduleName+a,d=n.toUrl(o.moduleName+a)+".js";t.load(l,n,function(i){var n=function(e){return r(d,e)};n.asModule=function(e,t){return r.asModule(e,d,t)},t.write(e,l,n,s)},s)}},"node"===f.env||!f.env&&"undefined"!=typeof process&&process.versions&&process.versions.node&&!process.versions["node-webkit"]&&!process.versions["atom-shell"]?(i=require.nodeRequire("fs"),t.get=function(e,t,n){try{var r=i.readFileSync(e,"utf8");"\ufeff"===r[0]&&(r=r.substring(1)),t(r)}catch(e){n&&n(e)}}):"xhr"===f.env||!f.env&&t.createXhr()?t.get=function(e,i,n,r){var s,o=t.createXhr();if(o.open("GET",e,!0),r)for(s in r)r.hasOwnProperty(s)&&o.setRequestHeader(s.toLowerCase(),r[s]);f.onXhr&&f.onXhr(o,e),o.onreadystatechange=function(t){var r,s;4===o.readyState&&(r=o.status||0,r>399&&r<600?(s=new Error(e+" HTTP status: "+r),s.xhr=o,n&&n(s)):i(o.responseText),f.onXhrComplete&&f.onXhrComplete(o,e))},o.send(null)}:"rhino"===f.env||!f.env&&"undefined"!=typeof Packages&&"undefined"!=typeof java?t.get=function(e,t){var i,n,r="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),a=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),r)),l="";try{for(i=new java.lang.StringBuffer,n=a.readLine(),n&&n.length()&&65279===n.charAt(0)&&(n=n.substring(1)),null!==n&&i.append(n);null!==(n=a.readLine());)i.append(o),i.append(n);l=String(i.toString())}finally{a.close()}t(l)}:("xpconnect"===f.env||!f.env&&"undefined"!=typeof Components&&Components.classes&&Components.interfaces)&&(n=Components.classes,r=Components.interfaces,Components.utils.import("resource://gre/modules/FileUtils.jsm"),s="@mozilla.org/windows-registry-key;1"in n,t.get=function(e,t){var i,o,a,l={};s&&(e=e.replace(/\//g,"\\")),a=new FileUtils.File(e);try{i=n["@mozilla.org/network/file-input-stream;1"].createInstance(r.nsIFileInputStream),i.init(a,1,0,!1),o=n["@mozilla.org/intl/converter-input-stream;1"].createInstance(r.nsIConverterInputStream),o.init(i,"utf-8",i.available(),r.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),o.readString(i.available(),l),o.close(),i.close(),t(l.value)}catch(e){throw new Error((a&&a.path||"")+": "+e)}}),t}),define("pinyin-by-unicode",{strChineseFirstPY:" "
}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("moment",t):e.moment=t()}(this,function(){"use strict";function e(){return vn.apply(null,arguments)}function t(e){vn=e}function i(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function n(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function r(e,t){var i,n=[];for(i=0;i<e.length;++i)n.push(t(e[i],i));return n}function s(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e,t){for(var i in t)s(t,i)&&(e[i]=t[i]);return s(t,"toString")&&(e.toString=t.toString),s(t,"valueOf")&&(e.valueOf=t.valueOf),e}function a(e,t,i,n){return Pe(e,t,i,n,!0).utc()}function l(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function d(e){return null==e._pf&&(e._pf=l()),e._pf}function c(e){if(null==e._isValid){var t=d(e);e._isValid=!(isNaN(e._d.getTime())||!(t.overflow<0)||t.empty||t.invalidMonth||t.invalidWeekday||t.nullInput||t.invalidFormat||t.userInvalidated),e._strict&&(e._isValid=e._isValid&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour)}return e._isValid}function h(e){var t=a(NaN);return null!=e?o(d(t),e):d(t).userInvalidated=!0,t}function u(e){return void 0===e}function p(e,t){var i,n,r;if(u(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),u(t._i)||(e._i=t._i),u(t._f)||(e._f=t._f),u(t._l)||(e._l=t._l),u(t._strict)||(e._strict=t._strict),u(t._tzm)||(e._tzm=t._tzm),u(t._isUTC)||(e._isUTC=t._isUTC),u(t._offset)||(e._offset=t._offset),u(t._pf)||(e._pf=d(t)),u(t._locale)||(e._locale=t._locale),yn.length>0)for(i in yn)n=yn[i],r=t[n],u(r)||(e[n]=r);return e}function f(t){p(this,t),this._d=new Date(null!=t._d?t._d.getTime():NaN),wn===!1&&(wn=!0,e.updateOffset(this),wn=!1)}function m(e){return e instanceof f||null!=e&&null!=e._isAMomentObject}function g(e){return e<0?Math.ceil(e):Math.floor(e)}function _(e){var t=+e,i=0;return 0!==t&&isFinite(t)&&(i=g(t)),i}function v(e,t,i){var n,r=Math.min(e.length,t.length),s=Math.abs(e.length-t.length),o=0;for(n=0;n<r;n++)(i&&e[n]!==t[n]||!i&&_(e[n])!==_(t[n]))&&o++;return o+s}function y(t){e.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+t)}function w(e,t){var i=!0;return o(function(){return i&&(y(e+"\nArguments: "+Array.prototype.slice.call(arguments).join(", ")+"\n"+(new Error).stack),i=!1),t.apply(this,arguments)},t)}function b(e,t){bn[e]||(y(t),bn[e]=!0)}function T(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function x(e){return"[object Object]"===Object.prototype.toString.call(e)}function S(e){var t,i;for(i in e)t=e[i],T(t)?this[i]=t:this["_"+i]=t;this._config=e,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function Y(e,t){var i,n=o({},e);for(i in t)s(t,i)&&(x(e[i])&&x(t[i])?(n[i]={},o(n[i],e[i]),o(n[i],t[i])):null!=t[i]?n[i]=t[i]:delete n[i]);return n}function k(e){null!=e&&this.set(e)}function C(e){return e?e.toLowerCase().replace("_","-"):e}function L(e){for(var t,i,n,r,s=0;s<e.length;){for(r=C(e[s]).split("-"),t=r.length,i=C(e[s+1]),i=i?i.split("-"):null;t>0;){if(n=M(r.slice(0,t).join("-")))return n;if(i&&i.length>=t&&v(r,i,!0)>=t-1)break;t--}s++}return null}function M(e){var t=null;if(!xn[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=Tn._abbr,require("./locale/"+e),D(t)}catch(e){}return xn[e]}function D(e,t){var i;return e&&(i=u(t)?j(e):Z(e,t),i&&(Tn=i)),Tn._abbr}function Z(e,t){return null!==t?(t.abbr=e,null!=xn[e]?(b("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale"),t=Y(xn[e]._config,t)):null!=t.parentLocale&&(null!=xn[t.parentLocale]?t=Y(xn[t.parentLocale]._config,t):b("parentLocaleUndefined","specified parentLocale is not defined yet")),xn[e]=new k(t),D(e),xn[e]):(delete xn[e],null)}function H(e,t){if(null!=t){var i;null!=xn[e]&&(t=Y(xn[e]._config,t)),i=new k(t),i.parentLocale=xn[e],xn[e]=i,D(e)}else null!=xn[e]&&(null!=xn[e].parentLocale?xn[e]=xn[e].parentLocale:null!=xn[e]&&delete xn[e]);return xn[e]}function j(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Tn;if(!i(e)){if(t=M(e))return t;e=[e]}return L(e)}function P(){return Object.keys(xn)}function J(e,t){var i=e.toLowerCase();Sn[i]=Sn[i+"s"]=Sn[t]=e}function X(e){return"string"==typeof e?Sn[e]||Sn[e.toLowerCase()]:void 0}function F(e){var t,i,n={};for(i in e)s(e,i)&&(t=X(i),t&&(n[t]=e[i]));return n}function N(t,i){return function(n){return null!=n?(B(this,t,n),e.updateOffset(this,i),this):$(this,t)}}function $(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function B(e,t,i){e.isValid()&&e._d["set"+(e._isUTC?"UTC":"")+t](i)}function E(e,t){var i;if("object"==typeof e)for(i in e)this.set(i,e[i]);else if(e=X(e),T(this[e]))return this[e](t);return this}function Q(e,t,i){var n=""+Math.abs(e),r=t-n.length,s=e>=0;return(s?i?"+":"":"-")+Math.pow(10,Math.max(0,r)).toString().substr(1)+n}function O(e,t,i,n){var r=n;"string"==typeof n&&(r=function(){return this[n]()}),e&&(Ln[e]=r),t&&(Ln[t[0]]=function(){return Q(r.apply(this,arguments),t[1],t[2])}),i&&(Ln[i]=function(){return this.localeData().ordinal(r.apply(this,arguments),e)})}function W(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function R(e){var t,i,n=e.match(Yn);for(t=0,i=n.length;t<i;t++)Ln[n[t]]?n[t]=Ln[n[t]]:n[t]=W(n[t]);return function(r){var s="";for(t=0;t<i;t++)s+=n[t]instanceof Function?n[t].call(r,e):n[t];return s}}function A(e,t){return e.isValid()?(t=G(t,e.localeData()),Cn[t]=Cn[t]||R(t),Cn[t](e)):e.localeData().invalidDate()}function G(e,t){function i(e){return t.longDateFormat(e)||e}var n=5;for(kn.lastIndex=0;n>=0&&kn.test(e);)e=e.replace(kn,i),kn.lastIndex=0,n-=1;return e}function I(e,t,i){An[e]=T(t)?t:function(e,n){return e&&i?i:t}}function K(e,t){return s(An,e)?An[e](t._strict,t._locale):new RegExp(U(e))}function U(e){return z(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,i,n,r){return t||i||n||r}))}function z(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function q(e,t){var i,n=t;for("string"==typeof e&&(e=[e]),"number"==typeof t&&(n=function(e,i){i[t]=_(e)}),i=0;i<e.length;i++)Gn[e[i]]=n}function V(e,t){q(e,function(e,i,n,r){n._w=n._w||{},t(e,n._w,n,r)})}function ee(e,t,i){null!=t&&s(Gn,e)&&Gn[e](t,i._a,i,e)}function te(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function ie(e,t){return i(this._months)?this._months[e.month()]:this._months[nr.test(t)?"format":"standalone"][e.month()]}function ne(e,t){return i(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[nr.test(t)?"format":"standalone"][e.month()]}function re(e,t,i){var n,r,s;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),n=0;n<12;n++){if(r=a([2e3,n]),i&&!this._longMonthsParse[n]&&(this._longMonthsParse[n]=new RegExp("^"+this.months(r,"").replace(".","")+"$","i"),this._shortMonthsParse[n]=new RegExp("^"+this.monthsShort(r,"").replace(".","")+"$","i")),i||this._monthsParse[n]||(s="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[n]=new RegExp(s.replace(".",""),"i")),i&&"MMMM"===t&&this._longMonthsParse[n].test(e))return n;if(i&&"MMM"===t&&this._shortMonthsParse[n].test(e))return n;if(!i&&this._monthsParse[n].test(e))return n}}function se(e,t){var i;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=_(t);else if(t=e.localeData().monthsParse(t),"number"!=typeof t)return e;return i=Math.min(e.date(),te(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,i),e}function oe(t){return null!=t?(se(this,t),e.updateOffset(this,!0),this):$(this,"Month")}function ae(){return te(this.year(),this.month())}function le(e){return this._monthsParseExact?(s(this,"_monthsRegex")||ce.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex}function de(e){return this._monthsParseExact?(s(this,"_monthsRegex")||ce.call(this),e?this._monthsStrictRegex:this._monthsRegex):this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex}function ce(){function e(e,t){return t.length-e.length}var t,i,n=[],r=[],s=[];for(t=0;t<12;t++)i=a([2e3,t]),n.push(this.monthsShort(i,"")),r.push(this.months(i,"")),s.push(this.months(i,"")),s.push(this.monthsShort(i,""));for(n.sort(e),r.sort(e),s.sort(e),t=0;t<12;t++)n[t]=z(n[t]),r[t]=z(r[t]),s[t]=z(s[t]);this._monthsRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+r.join("|")+")$","i"),this._monthsShortStrictRegex=new RegExp("^("+n.join("|")+")$","i")}function he(e){var t,i=e._a;return i&&d(e).overflow===-2&&(t=i[Kn]<0||i[Kn]>11?Kn:i[Un]<1||i[Un]>te(i[In],i[Kn])?Un:i[zn]<0||i[zn]>24||24===i[zn]&&(0!==i[qn]||0!==i[Vn]||0!==i[er])?zn:i[qn]<0||i[qn]>59?qn:i[Vn]<0||i[Vn]>59?Vn:i[er]<0||i[er]>999?er:-1,d(e)._overflowDayOfYear&&(t<In||t>Un)&&(t=Un),d(e)._overflowWeeks&&t===-1&&(t=tr),d(e)._overflowWeekday&&t===-1&&(t=ir),d(e).overflow=t),e}function ue(e){var t,i,n,r,s,o,a=e._i,l=lr.exec(a)||dr.exec(a);if(l){for(d(e).iso=!0,t=0,i=hr.length;t<i;t++)if(hr[t][1].exec(l[1])){r=hr[t][0],n=hr[t][2]!==!1;break}if(null==r)return void(e._isValid=!1);if(l[3]){for(t=0,i=ur.length;t<i;t++)if(ur[t][1].exec(l[3])){s=(l[2]||" ")+ur[t][0];break}if(null==s)return void(e._isValid=!1)}if(!n&&null!=s)return void(e._isValid=!1);if(l[4]){if(!cr.exec(l[4]))return void(e._isValid=!1);o="Z"}e._f=r+(s||"")+(o||""),Ce(e)}else e._isValid=!1}function pe(t){var i=pr.exec(t._i);return null!==i?void(t._d=new Date(+i[1])):(ue(t),void(t._isValid===!1&&(delete t._isValid,e.createFromInputFallback(t))))}function fe(e,t,i,n,r,s,o){var a=new Date(e,t,i,n,r,s,o);return e<100&&e>=0&&isFinite(a.getFullYear())&&a.setFullYear(e),a}function me(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&e>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function ge(e){return _e(e)?366:365}function _e(e){return e%4===0&&e%100!==0||e%400===0}function ve(){return _e(this.year())}function ye(e,t,i){var n=7+t-i,r=(7+me(e,0,n).getUTCDay()-t)%7;return-r+n-1}function we(e,t,i,n,r){var s,o,a=(7+i-n)%7,l=ye(e,n,r),d=1+7*(t-1)+a+l;return d<=0?(s=e-1,o=ge(s)+d):d>ge(e)?(s=e+1,o=d-ge(e)):(s=e,o=d),{year:s,dayOfYear:o}}function be(e,t,i){var n,r,s=ye(e.year(),t,i),o=Math.floor((e.dayOfYear()-s-1)/7)+1;return o<1?(r=e.year()-1,n=o+Te(r,t,i)):o>Te(e.year(),t,i)?(n=o-Te(e.year(),t,i),r=e.year()+1):(r=e.year(),n=o),{week:n,year:r}}function Te(e,t,i){var n=ye(e,t,i),r=ye(e+1,t,i);return(ge(e)-n+r)/7}function xe(e,t,i){return null!=e?e:null!=t?t:i}function Se(t){var i=new Date(e.now());return t._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()]}function Ye(e){var t,i,n,r,s=[];if(!e._d){for(n=Se(e),e._w&&null==e._a[Un]&&null==e._a[Kn]&&ke(e),e._dayOfYear&&(r=xe(e._a[In],n[In]),e._dayOfYear>ge(r)&&(d(e)._overflowDayOfYear=!0),i=me(r,0,e._dayOfYear),e._a[Kn]=i.getUTCMonth(),e._a[Un]=i.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=s[t]=n[t];for(;t<7;t++)e._a[t]=s[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[zn]&&0===e._a[qn]&&0===e._a[Vn]&&0===e._a[er]&&(e._nextDay=!0,e._a[zn]=0),e._d=(e._useUTC?me:fe).apply(null,s),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[zn]=24)}}function ke(e){var t,i,n,r,s,o,a,l;t=e._w,null!=t.GG||null!=t.W||null!=t.E?(s=1,o=4,i=xe(t.GG,e._a[In],be(Je(),1,4).year),n=xe(t.W,1),r=xe(t.E,1),(r<1||r>7)&&(l=!0)):(s=e._locale._week.dow,o=e._locale._week.doy,i=xe(t.gg,e._a[In],be(Je(),s,o).year),n=xe(t.w,1),null!=t.d?(r=t.d,(r<0||r>6)&&(l=!0)):null!=t.e?(r=t.e+s,(t.e<0||t.e>6)&&(l=!0)):r=s),n<1||n>Te(i,s,o)?d(e)._overflowWeeks=!0:null!=l?d(e)._overflowWeekday=!0:(a=we(i,n,r,s,o),e._a[In]=a.year,e._dayOfYear=a.dayOfYear)}function Ce(t){if(t._f===e.ISO_8601)return void ue(t);t._a=[],d(t).empty=!0;var i,n,r,s,o,a=""+t._i,l=a.length,c=0;for(r=G(t._f,t._locale).match(Yn)||[],i=0;i<r.length;i++)s=r[i],n=(a.match(K(s,t))||[])[0],n&&(o=a.substr(0,a.indexOf(n)),o.length>0&&d(t).unusedInput.push(o),a=a.slice(a.indexOf(n)+n.length),c+=n.length),Ln[s]?(n?d(t).empty=!1:d(t).unusedTokens.push(s),ee(s,n,t)):t._strict&&!n&&d(t).unusedTokens.push(s);d(t).charsLeftOver=l-c,a.length>0&&d(t).unusedInput.push(a),d(t).bigHour===!0&&t._a[zn]<=12&&t._a[zn]>0&&(d(t).bigHour=void 0),t._a[zn]=Le(t._locale,t._a[zn],t._meridiem),Ye(t),he(t)}function Le(e,t,i){var n;return null==i?t:null!=e.meridiemHour?e.meridiemHour(t,i):null!=e.isPM?(n=e.isPM(i),n&&t<12&&(t+=12),n||12!==t||(t=0),t):t}function Me(e){var t,i,n,r,s;if(0===e._f.length)return d(e).invalidFormat=!0,void(e._d=new Date(NaN));for(r=0;r<e._f.length;r++)s=0,t=p({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[r],Ce(t),c(t)&&(s+=d(t).charsLeftOver,s+=10*d(t).unusedTokens.length,d(t).score=s,(null==n||s<n)&&(n=s,i=t));o(e,i||t)}function De(e){if(!e._d){var t=F(e._i);e._a=r([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),Ye(e)}}function Ze(e){var t=new f(he(He(e)));return t._nextDay&&(t.add(1,"d"),t._nextDay=void 0),t}function He(e){var t=e._i,r=e._f;return e._locale=e._locale||j(e._l),null===t||void 0===r&&""===t?h({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),m(t)?new f(he(t)):(i(r)?Me(e):r?Ce(e):n(t)?e._d=t:je(e),c(e)||(e._d=null),e))}function je(t){var s=t._i;void 0===s?t._d=new Date(e.now()):n(s)?t._d=new Date(+s):"string"==typeof s?pe(t):i(s)?(t._a=r(s.slice(0),function(e){return parseInt(e,10)}),Ye(t)):"object"==typeof s?De(t):"number"==typeof s?t._d=new Date(s):e.createFromInputFallback(t)}function Pe(e,t,i,n,r){var s={};return"boolean"==typeof i&&(n=i,i=void 0),s._isAMomentObject=!0,s._useUTC=s._isUTC=r,s._l=i,s._i=e,s._f=t,s._strict=n,Ze(s)}function Je(e,t,i,n){return Pe(e,t,i,n,!1)}function Xe(e,t){var n,r;if(1===t.length&&i(t[0])&&(t=t[0]),!t.length)return Je();for(n=t[0],r=1;r<t.length;++r)t[r].isValid()&&!t[r][e](n)||(n=t[r]);return n}function Fe(){var e=[].slice.call(arguments,0);return Xe("isBefore",e)}function Ne(){var e=[].slice.call(arguments,0);return Xe("isAfter",e)}function $e(e){var t=F(e),i=t.year||0,n=t.quarter||0,r=t.month||0,s=t.week||0,o=t.day||0,a=t.hour||0,l=t.minute||0,d=t.second||0,c=t.millisecond||0;this._milliseconds=+c+1e3*d+6e4*l+36e5*a,this._days=+o+7*s,this._months=+r+3*n+12*i,this._data={},this._locale=j(),this._bubble()}function Be(e){return e instanceof $e}function Ee(e,t){O(e,0,0,function(){var e=this.utcOffset(),i="+";return e<0&&(e=-e,i="-"),i+Q(~~(e/60),2)+t+Q(~~e%60,2)})}function Qe(e,t){var i=(t||"").match(e)||[],n=i[i.length-1]||[],r=(n+"").match(vr)||["-",0,0],s=+(60*r[1])+_(r[2]);return"+"===r[0]?s:-s}function Oe(t,i){var r,s;return i._isUTC?(r=i.clone(),s=(m(t)||n(t)?+t:+Je(t))-+r,r._d.setTime(+r._d+s),e.updateOffset(r,!1),r):Je(t).local()}function We(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Re(t,i){var n,r=this._offset||0;return this.isValid()?null!=t?("string"==typeof t?t=Qe(On,t):Math.abs(t)<16&&(t=60*t),!this._isUTC&&i&&(n=We(this)),this._offset=t,this._isUTC=!0,null!=n&&this.add(n,"m"),r!==t&&(!i||this._changeInProgress?lt(this,it(t-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,e.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?r:We(this):null!=t?this:NaN}function Ae(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}function Ge(e){return this.utcOffset(0,e)}function Ie(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(We(this),"m")),this}function Ke(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Qe(Qn,this._i)),this}function Ue(e){return!!this.isValid()&&(e=e?Je(e).utcOffset():0,(this.utcOffset()-e)%60===0)}function ze(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function qe(){if(!u(this._isDSTShifted))return this._isDSTShifted;var e={};if(p(e,this),e=He(e),e._a){var t=e._isUTC?a(e._a):Je(e._a);this._isDSTShifted=this.isValid()&&v(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Ve(){return!!this.isValid()&&!this._isUTC}function et(){return!!this.isValid()&&this._isUTC}function tt(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function it(e,t){var i,n,r,o=e,a=null;return Be(e)?o={ms:e._milliseconds,d:e._days,M:e._months}:"number"==typeof e?(o={},t?o[t]=e:o.milliseconds=e):(a=yr.exec(e))?(i="-"===a[1]?-1:1,o={y:0,d:_(a[Un])*i,h:_(a[zn])*i,m:_(a[qn])*i,s:_(a[Vn])*i,ms:_(a[er])*i}):(a=wr.exec(e))?(i="-"===a[1]?-1:1,o={y:nt(a[2],i),M:nt(a[3],i),w:nt(a[4],i),d:nt(a[5],i),h:nt(a[6],i),m:nt(a[7],i),s:nt(a[8],i)}):null==o?o={}:"object"==typeof o&&("from"in o||"to"in o)&&(r=st(Je(o.from),Je(o.to)),o={},o.ms=r.milliseconds,o.M=r.months),n=new $e(o),Be(e)&&s(e,"_locale")&&(n._locale=e._locale),n}function nt(e,t){var i=e&&parseFloat(e.replace(",","."));return(isNaN(i)?0:i)*t}function rt(e,t){var i={milliseconds:0,months:0};return i.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(i.months,"M").isAfter(t)&&--i.months,i.milliseconds=+t-+e.clone().add(i.months,"M"),i}function st(e,t){var i;return e.isValid()&&t.isValid()?(t=Oe(t,e),e.isBefore(t)?i=rt(e,t):(i=rt(t,e),i.milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0}}function ot(e){return e<0?Math.round(-1*e)*-1:Math.round(e)}function at(e,t){return function(i,n){var r,s;return null===n||isNaN(+n)||(b(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period)."),s=i,i=n,n=s),i="string"==typeof i?+i:i,r=it(i,n),lt(this,r,e),this}}function lt(t,i,n,r){var s=i._milliseconds,o=ot(i._days),a=ot(i._months);t.isValid()&&(r=null==r||r,s&&t._d.setTime(+t._d+s*n),o&&B(t,"Date",$(t,"Date")+o*n),a&&se(t,$(t,"Month")+a*n),r&&e.updateOffset(t,o||a))}function dt(e,t){var i=e||Je(),n=Oe(i,this).startOf("day"),r=this.diff(n,"days",!0),s=r<-6?"sameElse":r<-1?"lastWeek":r<0?"lastDay":r<1?"sameDay":r<2?"nextDay":r<7?"nextWeek":"sameElse",o=t&&(T(t[s])?t[s]():t[s]);return this.format(o||this.localeData().calendar(s,this,Je(i)))}function ct(){return new f(this)}function ht(e,t){var i=m(e)?e:Je(e);return!(!this.isValid()||!i.isValid())&&(t=X(u(t)?"millisecond":t),"millisecond"===t?+this>+i:+i<+this.clone().startOf(t))}function ut(e,t){var i=m(e)?e:Je(e);return!(!this.isValid()||!i.isValid())&&(t=X(u(t)?"millisecond":t),"millisecond"===t?+this<+i:+this.clone().endOf(t)<+i)}function pt(e,t,i){return this.isAfter(e,i)&&this.isBefore(t,i)}function ft(e,t){var i,n=m(e)?e:Je(e);return!(!this.isValid()||!n.isValid())&&(t=X(t||"millisecond"),"millisecond"===t?+this===+n:(i=+n,+this.clone().startOf(t)<=i&&i<=+this.clone().endOf(t)))}function mt(e,t){return this.isSame(e,t)||this.isAfter(e,t)}function gt(e,t){return this.isSame(e,t)||this.isBefore(e,t)}function _t(e,t,i){var n,r,s,o;return this.isValid()?(n=Oe(e,this),n.isValid()?(r=6e4*(n.utcOffset()-this.utcOffset()),t=X(t),"year"===t||"month"===t||"quarter"===t?(o=vt(this,n),"quarter"===t?o/=3:"year"===t&&(o/=12)):(s=this-n,o="second"===t?s/1e3:"minute"===t?s/6e4:"hour"===t?s/36e5:"day"===t?(s-r)/864e5:"week"===t?(s-r)/6048e5:s),i?o:g(o)):NaN):NaN}function vt(e,t){var i,n,r=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(r,"months");return t-s<0?(i=e.clone().add(r-1,"months"),n=(t-s)/(s-i)):(i=e.clone().add(r+1,"months"),n=(t-s)/(i-s)),-(r+n)}function yt(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function wt(){var e=this.clone().utc();return 0<e.year()&&e.year()<=9999?T(Date.prototype.toISOString)?this.toDate().toISOString():A(e,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):A(e,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function bt(t){var i=A(this,t||e.defaultFormat);return this.localeData().postformat(i)}function Tt(e,t){return this.isValid()&&(m(e)&&e.isValid()||Je(e).isValid())?it({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function xt(e){return this.from(Je(),e)}function St(e,t){return this.isValid()&&(m(e)&&e.isValid()||Je(e).isValid())?it({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function Yt(e){return this.to(Je(),e)}function kt(e){var t;return void 0===e?this._locale._abbr:(t=j(e),null!=t&&(this._locale=t),this)}function Ct(){return this._locale}function Lt(e){switch(e=X(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this}function Mt(e){return e=X(e),void 0===e||"millisecond"===e?this:this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms")}function Dt(){return+this._d-6e4*(this._offset||0)}function Zt(){return Math.floor(+this/1e3)}function Ht(){return this._offset?new Date(+this):this._d}function jt(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function Pt(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function Jt(){return this.isValid()?this.toISOString():null}function Xt(){return c(this)}function Ft(){return o({},d(this))}function Nt(){return d(this).overflow}function $t(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Bt(e,t){O(0,[e,e.length],0,t)}function Et(e){return Rt.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Qt(e){return Rt.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)}function Ot(){return Te(this.year(),1,4)}function Wt(){var e=this.localeData()._week;return Te(this.year(),e.dow,e.doy)}function Rt(e,t,i,n,r){var s;return null==e?be(this,n,r).year:(s=Te(e,n,r),t>s&&(t=s),At.call(this,e,t,i,n,r))}function At(e,t,i,n,r){var s=we(e,t,i,n,r),o=me(s.year,0,s.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}function Gt(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)}function It(e){return be(e,this._week.dow,this._week.doy).week}function Kt(){return this._week.dow}function Ut(){return this._week.doy}function zt(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")}function qt(e){var t=be(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")}function Vt(e,t){return"string"!=typeof e?e:isNaN(e)?(e=t.weekdaysParse(e),"number"==typeof e?e:null):parseInt(e,10)}function ei(e,t){return i(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][e.day()]}function ti(e){return this._weekdaysShort[e.day()]}function ii(e){return this._weekdaysMin[e.day()]}function ni(e,t,i){var n,r,s;for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),n=0;n<7;n++){if(r=Je([2e3,1]).day(n),i&&!this._fullWeekdaysParse[n]&&(this._fullWeekdaysParse[n]=new RegExp("^"+this.weekdays(r,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[n]=new RegExp("^"+this.weekdaysShort(r,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[n]=new RegExp("^"+this.weekdaysMin(r,"").replace(".",".?")+"$","i")),this._weekdaysParse[n]||(s="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[n]=new RegExp(s.replace(".",""),"i")),i&&"dddd"===t&&this._fullWeekdaysParse[n].test(e))return n;if(i&&"ddd"===t&&this._shortWeekdaysParse[n].test(e))return n;if(i&&"dd"===t&&this._minWeekdaysParse[n].test(e))return n;if(!i&&this._weekdaysParse[n].test(e))return n}}function ri(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=Vt(e,this.localeData()),this.add(e-t,"d")):t}function si(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")}function oi(e){return this.isValid()?null==e?this.day()||7:this.day(this.day()%7?e:e-7):null!=e?this:NaN}function ai(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")}function li(){return this.hours()%12||12}function di(e,t){O(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function ci(e,t){return t._meridiemParse}function hi(e){return"p"===(e+"").toLowerCase().charAt(0)}function ui(e,t,i){return e>11?i?"pm":"PM":i?"am":"AM"}function pi(e,t){t[er]=_(1e3*("0."+e))}function fi(){return this._isUTC?"UTC":""}function mi(){return this._isUTC?"Coordinated Universal Time":""}function gi(e){return Je(1e3*e)}function _i(){return Je.apply(null,arguments).parseZone()}function vi(e,t,i){var n=this._calendar[e];return T(n)?n.call(t,i):n}function yi(e){var t=this._longDateFormat[e],i=this._longDateFormat[e.toUpperCase()];return t||!i?t:(this._longDateFormat[e]=i.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])}function wi(){return this._invalidDate}function bi(e){return this._ordinal.replace("%d",e)}function Ti(e){return e}function xi(e,t,i,n){var r=this._relativeTime[i];return T(r)?r(e,t,i,n):r.replace(/%d/i,e)}function Si(e,t){var i=this._relativeTime[e>0?"future":"past"];return T(i)?i(t):i.replace(/%s/i,t)}function Yi(e,t,i,n){var r=j(),s=a().set(n,t);return r[i](s,e)}function ki(e,t,i,n,r){if("number"==typeof e&&(t=e,e=void 0),e=e||"",null!=t)return Yi(e,t,i,r);var s,o=[];for(s=0;s<n;s++)o[s]=Yi(e,s,i,r);return o}function Ci(e,t){return ki(e,t,"months",12,"month")}function Li(e,t){return ki(e,t,"monthsShort",12,"month")}function Mi(e,t){return ki(e,t,"weekdays",7,"day")}function Di(e,t){return ki(e,t,"weekdaysShort",7,"day")}function Zi(e,t){return ki(e,t,"weekdaysMin",7,"day")}function Hi(){var e=this._data;return this._milliseconds=Wr(this._milliseconds),this._days=Wr(this._days),this._months=Wr(this._months),e.milliseconds=Wr(e.milliseconds),e.seconds=Wr(e.seconds),e.minutes=Wr(e.minutes),e.hours=Wr(e.hours),e.months=Wr(e.months),e.years=Wr(e.years),this}function ji(e,t,i,n){var r=it(t,i);return e._milliseconds+=n*r._milliseconds,e._days+=n*r._days,e._months+=n*r._months,e._bubble()}function Pi(e,t){return ji(this,e,t,1)}function Ji(e,t){return ji(this,e,t,-1)}function Xi(e){return e<0?Math.floor(e):Math.ceil(e)}function Fi(){var e,t,i,n,r,s=this._milliseconds,o=this._days,a=this._months,l=this._data;return s>=0&&o>=0&&a>=0||s<=0&&o<=0&&a<=0||(s+=864e5*Xi($i(a)+o),o=0,a=0),l.milliseconds=s%1e3,e=g(s/1e3),l.seconds=e%60,t=g(e/60),l.minutes=t%60,i=g(t/60),l.hours=i%24,o+=g(i/24),r=g(Ni(o)),a+=r,o-=Xi($i(r)),n=g(a/12),a%=12,l.days=o,l.months=a,l.years=n,this}function Ni(e){return 4800*e/146097}function $i(e){return 146097*e/4800}function Bi(e){var t,i,n=this._milliseconds;if(e=X(e),"month"===e||"year"===e)return t=this._days+n/864e5,i=this._months+Ni(t),"month"===e?i:i/12;switch(t=this._days+Math.round($i(this._months)),e){case"week":return t/7+n/6048e5;case"day":return t+n/864e5;case"hour":return 24*t+n/36e5;case"minute":return 1440*t+n/6e4;case"second":return 86400*t+n/1e3;case"millisecond":return Math.floor(864e5*t)+n;default:throw new Error("Unknown unit "+e)}}function Ei(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*_(this._months/12)}function Qi(e){return function(){return this.as(e)}}function Oi(e){return e=X(e),this[e+"s"]()}function Wi(e){return function(){return this._data[e]}}function Ri(){return g(this.days()/7)}function Ai(e,t,i,n,r){return r.relativeTime(t||1,!!i,e,n)}function Gi(e,t,i){var n=it(e).abs(),r=os(n.as("s")),s=os(n.as("m")),o=os(n.as("h")),a=os(n.as("d")),l=os(n.as("M")),d=os(n.as("y")),c=r<as.s&&["s",r]||s<=1&&["m"]||s<as.m&&["mm",s]||o<=1&&["h"]||o<as.h&&["hh",o]||a<=1&&["d"]||a<as.d&&["dd",a]||l<=1&&["M"]||l<as.M&&["MM",l]||d<=1&&["y"]||["yy",d];return c[2]=t,c[3]=+e>0,c[4]=i,Ai.apply(null,c)}function Ii(e,t){return void 0!==as[e]&&(void 0===t?as[e]:(as[e]=t,!0))}function Ki(e){var t=this.localeData(),i=Gi(this,!e,t);return e&&(i=t.pastFuture(+this,i)),t.postformat(i)}function Ui(){var e,t,i,n=ls(this._milliseconds)/1e3,r=ls(this._days),s=ls(this._months);e=g(n/60),t=g(e/60),n%=60,e%=60,i=g(s/12),s%=12;var o=i,a=s,l=r,d=t,c=e,h=n,u=this.asSeconds();return u?(u<0?"-":"")+"P"+(o?o+"Y":"")+(a?a+"M":"")+(l?l+"D":"")+(d||c||h?"T":"")+(d?d+"H":"")+(c?c+"M":"")+(h?h+"S":""):"P0D"}function zi(e,t,i,n){var r={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?r[i][0]:r[i][1]}function qi(e,t,i,n){var r=e;switch(i){case"s":return n||t?"néhány másodperc":"néhány másodperce";case"m":return"egy"+(n||t?" perc":" perce");case"mm":return r+(n||t?" perc":" perce");case"h":return"egy"+(n||t?" óra":" órája");case"hh":return r+(n||t?" óra":" órája");case"d":return"egy"+(n||t?" nap":" napja");case"dd":return r+(n||t?" nap":" napja");case"M":return"egy"+(n||t?" hónap":" hónapja");case"MM":return r+(n||t?" hónap":" hónapja");case"y":return"egy"+(n||t?" év":" éve");case"yy":return r+(n||t?" év":" éve")}return""}function Vi(e){return(e?"":"[múlt] ")+"["+ps[this.day()]+"] LT[-kor]"}function en(e){return e%100===11||e%10!==1}function tn(e,t,i,n){var r=e+" ";switch(i){case"s":return t||n?"nokkrar sekúndur":"nokkrum sekúndum";case"m":return t?"mínúta":"mínútu";case"mm":return en(e)?r+(t||n?"mínútur":"mínútum"):t?r+"mínúta":r+"mínútu";case"hh":return en(e)?r+(t||n?"klukkustundir":"klukkustundum"):r+"klukkustund";case"d":return t?"dagur":n?"dag":"degi";case"dd":return en(e)?t?r+"dagar":r+(n?"daga":"dögum"):t?r+"dagur":r+(n?"dag":"degi");case"M":return t?"mánuður":n?"mánuð":"mánuði";case"MM":return en(e)?t?r+"mánuðir":r+(n?"mánuði":"mánuðum"):t?r+"mánuður":r+(n?"mánuð":"mánuði");case"y":return t||n?"ár":"ári";case"yy":return en(e)?r+(t||n?"ár":"árum"):r+(t||n?"ár":"ári")}}function nn(e,t,i){return i?t%10===1&&11!==t?e[2]:e[3]:t%10===1&&11!==t?e[0]:e[1]}function rn(e,t,i){return e+" "+nn(fs[i],e,t)}function sn(e,t,i){return nn(fs[i],e,t)}function on(e,t){return t?"dažas sekundes":"dažām sekundēm"}function an(e){return e%10<5&&e%10>1&&~~(e/10)%10!==1}function ln(e,t,i){var n=e+" ";switch(i){case"m":return t?"minuta":"minutę";case"mm":return n+(an(e)?"minuty":"minut");case"h":return t?"godzina":"godzinę";case"hh":return n+(an(e)?"godziny":"godzin");case"MM":return n+(an(e)?"miesiące":"miesięcy");case"yy":return n+(an(e)?"lata":"lat")}}function dn(e,t){var i=e.split("_");return t%10===1&&t%100!==11?i[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?i[1]:i[2]}function cn(e,t,i){var n={mm:t?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",MM:"месяц_месяца_месяцев",yy:"год_года_лет"};return"m"===i?t?"минута":"минуту":e+" "+dn(n[i],+e)}function hn(e){return e>1&&e<5}function un(e,t,i,n){var r=e+" ";switch(i){case"s":return t||n?"pár sekúnd":"pár sekundami";case"m":return t?"minúta":n?"minútu":"minútou";case"mm":return t||n?r+(hn(e)?"minúty":"minút"):r+"minútami";case"h":return t?"hodina":n?"hodinu":"hodinou";case"hh":return t||n?r+(hn(e)?"hodiny":"hodín"):r+"hodinami";case"d":return t||n?"deň":"dňom";case"dd":return t||n?r+(hn(e)?"dni":"dní"):r+"dňami";case"M":return t||n?"mesiac":"mesiacom";case"MM":return t||n?r+(hn(e)?"mesiace":"mesiacov"):r+"mesiacmi";case"y":return t||n?"rok":"rokom";
case"yy":return t||n?r+(hn(e)?"roky":"rokov"):r+"rokmi"}}function pn(e,t,i,n){var r=e+" ";switch(i){case"s":return t||n?"nekaj sekund":"nekaj sekundami";case"m":return t?"ena minuta":"eno minuto";case"mm":return r+=1===e?t?"minuta":"minuto":2===e?t||n?"minuti":"minutama":e<5?t||n?"minute":"minutami":t||n?"minut":"minutami";case"h":return t?"ena ura":"eno uro";case"hh":return r+=1===e?t?"ura":"uro":2===e?t||n?"uri":"urama":e<5?t||n?"ure":"urami":t||n?"ur":"urami";case"d":return t||n?"en dan":"enim dnem";case"dd":return r+=1===e?t||n?"dan":"dnem":2===e?t||n?"dni":"dnevoma":t||n?"dni":"dnevi";case"M":return t||n?"en mesec":"enim mesecem";case"MM":return r+=1===e?t||n?"mesec":"mesecem":2===e?t||n?"meseca":"mesecema":e<5?t||n?"mesece":"meseci":t||n?"mesecev":"meseci";case"y":return t||n?"eno leto":"enim letom";case"yy":return r+=1===e?t||n?"leto":"letom":2===e?t||n?"leti":"letoma":e<5?t||n?"leta":"leti":t||n?"let":"leti"}}function fn(e,t){var i=e.split("_");return t%10===1&&t%100!==11?i[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?i[1]:i[2]}function mn(e,t,i){var n={mm:t?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:t?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"};return"m"===i?t?"хвилина":"хвилину":"h"===i?t?"година":"годину":e+" "+fn(n[i],+e)}function gn(e,t){var i={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")},n=/(\[[ВвУу]\]) ?dddd/.test(t)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(t)?"genitive":"nominative";return i[n][e.day()]}function _n(e){return function(){return e+"о"+(11===this.hours()?"б":"")+"] LT"}}var vn,yn=e.momentProperties=[],wn=!1,bn={};e.suppressDeprecationWarnings=!1;var Tn,xn={},Sn={},Yn=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,kn=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Cn={},Ln={},Mn=/\d/,Dn=/\d\d/,Zn=/\d{3}/,Hn=/\d{4}/,jn=/[+-]?\d{6}/,Pn=/\d\d?/,Jn=/\d\d\d\d?/,Xn=/\d\d\d\d\d\d?/,Fn=/\d{1,3}/,Nn=/\d{1,4}/,$n=/[+-]?\d{1,6}/,Bn=/\d+/,En=/[+-]?\d+/,Qn=/Z|[+-]\d\d:?\d\d/gi,On=/Z|[+-]\d\d(?::?\d\d)?/gi,Wn=/[+-]?\d+(\.\d{1,3})?/,Rn=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,An={},Gn={},In=0,Kn=1,Un=2,zn=3,qn=4,Vn=5,er=6,tr=7,ir=8;O("M",["MM",2],"Mo",function(){return this.month()+1}),O("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),O("MMMM",0,0,function(e){return this.localeData().months(this,e)}),J("month","M"),I("M",Pn),I("MM",Pn,Dn),I("MMM",function(e,t){return t.monthsShortRegex(e)}),I("MMMM",function(e,t){return t.monthsRegex(e)}),q(["M","MM"],function(e,t){t[Kn]=_(e)-1}),q(["MMM","MMMM"],function(e,t,i,n){var r=i._locale.monthsParse(e,n,i._strict);null!=r?t[Kn]=r:d(i).invalidMonth=e});var nr=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/,rr="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),sr="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),or=Rn,ar=Rn,lr=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,dr=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/,cr=/Z|[+-]\d\d(?::?\d\d)?/,hr=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],ur=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pr=/^\/?Date\((\-?\d+)/i;e.createFromInputFallback=w("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),O("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),O(0,["YY",2],0,function(){return this.year()%100}),O(0,["YYYY",4],0,"year"),O(0,["YYYYY",5],0,"year"),O(0,["YYYYYY",6,!0],0,"year"),J("year","y"),I("Y",En),I("YY",Pn,Dn),I("YYYY",Nn,Hn),I("YYYYY",$n,jn),I("YYYYYY",$n,jn),q(["YYYYY","YYYYYY"],In),q("YYYY",function(t,i){i[In]=2===t.length?e.parseTwoDigitYear(t):_(t)}),q("YY",function(t,i){i[In]=e.parseTwoDigitYear(t)}),q("Y",function(e,t){t[In]=parseInt(e,10)}),e.parseTwoDigitYear=function(e){return _(e)+(_(e)>68?1900:2e3)};var fr=N("FullYear",!1);e.ISO_8601=function(){};var mr=w("moment().min is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var e=Je.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:h()}),gr=w("moment().max is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var e=Je.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:h()}),_r=function(){return Date.now?Date.now():+new Date};Ee("Z",":"),Ee("ZZ",""),I("Z",On),I("ZZ",On),q(["Z","ZZ"],function(e,t,i){i._useUTC=!0,i._tzm=Qe(On,e)});var vr=/([\+\-]|\d\d)/gi;e.updateOffset=function(){};var yr=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?\d*)?$/,wr=/^(-)?P(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)W)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?$/;it.fn=$e.prototype;var br=at(1,"add"),Tr=at(-1,"subtract");e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var xr=w("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});O(0,["gg",2],0,function(){return this.weekYear()%100}),O(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Bt("gggg","weekYear"),Bt("ggggg","weekYear"),Bt("GGGG","isoWeekYear"),Bt("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),I("G",En),I("g",En),I("GG",Pn,Dn),I("gg",Pn,Dn),I("GGGG",Nn,Hn),I("gggg",Nn,Hn),I("GGGGG",$n,jn),I("ggggg",$n,jn),V(["gggg","ggggg","GGGG","GGGGG"],function(e,t,i,n){t[n.substr(0,2)]=_(e)}),V(["gg","GG"],function(t,i,n,r){i[r]=e.parseTwoDigitYear(t)}),O("Q",0,"Qo","quarter"),J("quarter","Q"),I("Q",Mn),q("Q",function(e,t){t[Kn]=3*(_(e)-1)}),O("w",["ww",2],"wo","week"),O("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),I("w",Pn),I("ww",Pn,Dn),I("W",Pn),I("WW",Pn,Dn),V(["w","ww","W","WW"],function(e,t,i,n){t[n.substr(0,1)]=_(e)});var Sr={dow:0,doy:6};O("D",["DD",2],"Do","date"),J("date","D"),I("D",Pn),I("DD",Pn,Dn),I("Do",function(e,t){return e?t._ordinalParse:t._ordinalParseLenient}),q(["D","DD"],Un),q("Do",function(e,t){t[Un]=_(e.match(Pn)[0],10)});var Yr=N("Date",!0);O("d",0,"do","day"),O("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),O("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),O("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),O("e",0,0,"weekday"),O("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),I("d",Pn),I("e",Pn),I("E",Pn),I("dd",Rn),I("ddd",Rn),I("dddd",Rn),V(["dd","ddd","dddd"],function(e,t,i,n){var r=i._locale.weekdaysParse(e,n,i._strict);null!=r?t.d=r:d(i).invalidWeekday=e}),V(["d","e","E"],function(e,t,i,n){t[n]=_(e)});var kr="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Cr="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Lr="Su_Mo_Tu_We_Th_Fr_Sa".split("_");O("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),I("DDD",Fn),I("DDDD",Zn),q(["DDD","DDDD"],function(e,t,i){i._dayOfYear=_(e)}),O("H",["HH",2],0,"hour"),O("h",["hh",2],0,li),O("hmm",0,0,function(){return""+li.apply(this)+Q(this.minutes(),2)}),O("hmmss",0,0,function(){return""+li.apply(this)+Q(this.minutes(),2)+Q(this.seconds(),2)}),O("Hmm",0,0,function(){return""+this.hours()+Q(this.minutes(),2)}),O("Hmmss",0,0,function(){return""+this.hours()+Q(this.minutes(),2)+Q(this.seconds(),2)}),di("a",!0),di("A",!1),J("hour","h"),I("a",ci),I("A",ci),I("H",Pn),I("h",Pn),I("HH",Pn,Dn),I("hh",Pn,Dn),I("hmm",Jn),I("hmmss",Xn),I("Hmm",Jn),I("Hmmss",Xn),q(["H","HH"],zn),q(["a","A"],function(e,t,i){i._isPm=i._locale.isPM(e),i._meridiem=e}),q(["h","hh"],function(e,t,i){t[zn]=_(e),d(i).bigHour=!0}),q("hmm",function(e,t,i){var n=e.length-2;t[zn]=_(e.substr(0,n)),t[qn]=_(e.substr(n)),d(i).bigHour=!0}),q("hmmss",function(e,t,i){var n=e.length-4,r=e.length-2;t[zn]=_(e.substr(0,n)),t[qn]=_(e.substr(n,2)),t[Vn]=_(e.substr(r)),d(i).bigHour=!0}),q("Hmm",function(e,t,i){var n=e.length-2;t[zn]=_(e.substr(0,n)),t[qn]=_(e.substr(n))}),q("Hmmss",function(e,t,i){var n=e.length-4,r=e.length-2;t[zn]=_(e.substr(0,n)),t[qn]=_(e.substr(n,2)),t[Vn]=_(e.substr(r))});var Mr=/[ap]\.?m?\.?/i,Dr=N("Hours",!0);O("m",["mm",2],0,"minute"),J("minute","m"),I("m",Pn),I("mm",Pn,Dn),q(["m","mm"],qn);var Zr=N("Minutes",!1);O("s",["ss",2],0,"second"),J("second","s"),I("s",Pn),I("ss",Pn,Dn),q(["s","ss"],Vn);var Hr=N("Seconds",!1);O("S",0,0,function(){return~~(this.millisecond()/100)}),O(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),O(0,["SSS",3],0,"millisecond"),O(0,["SSSS",4],0,function(){return 10*this.millisecond()}),O(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),O(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),O(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),O(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),O(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),I("S",Fn,Mn),I("SS",Fn,Dn),I("SSS",Fn,Zn);var jr;for(jr="SSSS";jr.length<=9;jr+="S")I(jr,Bn);for(jr="S";jr.length<=9;jr+="S")q(jr,pi);var Pr=N("Milliseconds",!1);O("z",0,0,"zoneAbbr"),O("zz",0,0,"zoneName");var Jr=f.prototype;Jr.add=br,Jr.calendar=dt,Jr.clone=ct,Jr.diff=_t,Jr.endOf=Mt,Jr.format=bt,Jr.from=Tt,Jr.fromNow=xt,Jr.to=St,Jr.toNow=Yt,Jr.get=E,Jr.invalidAt=Nt,Jr.isAfter=ht,Jr.isBefore=ut,Jr.isBetween=pt,Jr.isSame=ft,Jr.isSameOrAfter=mt,Jr.isSameOrBefore=gt,Jr.isValid=Xt,Jr.lang=xr,Jr.locale=kt,Jr.localeData=Ct,Jr.max=gr,Jr.min=mr,Jr.parsingFlags=Ft,Jr.set=E,Jr.startOf=Lt,Jr.subtract=Tr,Jr.toArray=jt,Jr.toObject=Pt,Jr.toDate=Ht,Jr.toISOString=wt,Jr.toJSON=Jt,Jr.toString=yt,Jr.unix=Zt,Jr.valueOf=Dt,Jr.creationData=$t,Jr.year=fr,Jr.isLeapYear=ve,Jr.weekYear=Et,Jr.isoWeekYear=Qt,Jr.quarter=Jr.quarters=Gt,Jr.month=oe,Jr.daysInMonth=ae,Jr.week=Jr.weeks=zt,Jr.isoWeek=Jr.isoWeeks=qt,Jr.weeksInYear=Wt,Jr.isoWeeksInYear=Ot,Jr.date=Yr,Jr.day=Jr.days=ri,Jr.weekday=si,Jr.isoWeekday=oi,Jr.dayOfYear=ai,Jr.hour=Jr.hours=Dr,Jr.minute=Jr.minutes=Zr,Jr.second=Jr.seconds=Hr,Jr.millisecond=Jr.milliseconds=Pr,Jr.utcOffset=Re,Jr.utc=Ge,Jr.local=Ie,Jr.parseZone=Ke,Jr.hasAlignedHourOffset=Ue,Jr.isDST=ze,Jr.isDSTShifted=qe,Jr.isLocal=Ve,Jr.isUtcOffset=et,Jr.isUtc=tt,Jr.isUTC=tt,Jr.zoneAbbr=fi,Jr.zoneName=mi,Jr.dates=w("dates accessor is deprecated. Use date instead.",Yr),Jr.months=w("months accessor is deprecated. Use month instead",oe),Jr.years=w("years accessor is deprecated. Use year instead",fr),Jr.zone=w("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",Ae);var Xr=Jr,Fr={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Nr={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},$r="Invalid date",Br="%d",Er=/\d{1,2}/,Qr={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Or=k.prototype;Or._calendar=Fr,Or.calendar=vi,Or._longDateFormat=Nr,Or.longDateFormat=yi,Or._invalidDate=$r,Or.invalidDate=wi,Or._ordinal=Br,Or.ordinal=bi,Or._ordinalParse=Er,Or.preparse=Ti,Or.postformat=Ti,Or._relativeTime=Qr,Or.relativeTime=xi,Or.pastFuture=Si,Or.set=S,Or.months=ie,Or._months=rr,Or.monthsShort=ne,Or._monthsShort=sr,Or.monthsParse=re,Or._monthsRegex=ar,Or.monthsRegex=de,Or._monthsShortRegex=or,Or.monthsShortRegex=le,Or.week=It,Or._week=Sr,Or.firstDayOfYear=Ut,Or.firstDayOfWeek=Kt,Or.weekdays=ei,Or._weekdays=kr,Or.weekdaysMin=ii,Or._weekdaysMin=Lr,Or.weekdaysShort=ti,Or._weekdaysShort=Cr,Or.weekdaysParse=ni,Or.isPM=hi,Or._meridiemParse=Mr,Or.meridiem=ui,D("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,i=1===_(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+i}}),e.lang=w("moment.lang is deprecated. Use moment.locale instead.",D),e.langData=w("moment.langData is deprecated. Use moment.localeData instead.",j);var Wr=Math.abs,Rr=Qi("ms"),Ar=Qi("s"),Gr=Qi("m"),Ir=Qi("h"),Kr=Qi("d"),Ur=Qi("w"),zr=Qi("M"),qr=Qi("y"),Vr=Wi("milliseconds"),es=Wi("seconds"),ts=Wi("minutes"),is=Wi("hours"),ns=Wi("days"),rs=Wi("months"),ss=Wi("years"),os=Math.round,as={s:45,m:45,h:22,d:26,M:11},ls=Math.abs,ds=$e.prototype;ds.abs=Hi,ds.add=Pi,ds.subtract=Ji,ds.as=Bi,ds.asMilliseconds=Rr,ds.asSeconds=Ar,ds.asMinutes=Gr,ds.asHours=Ir,ds.asDays=Kr,ds.asWeeks=Ur,ds.asMonths=zr,ds.asYears=qr,ds.valueOf=Ei,ds._bubble=Fi,ds.get=Oi,ds.milliseconds=Vr,ds.seconds=es,ds.minutes=ts,ds.hours=is,ds.days=ns,ds.weeks=Ri,ds.months=rs,ds.years=ss,ds.humanize=Ki,ds.toISOString=Ui,ds.toString=Ui,ds.toJSON=Ui,ds.locale=kt,ds.localeData=Ct,ds.toIsoString=w("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Ui),ds.lang=xr,O("X",0,0,"unix"),O("x",0,0,"valueOf"),I("x",En),I("X",Wn),q("X",function(e,t,i){i._d=new Date(1e3*parseFloat(e,10))}),q("x",function(e,t,i){i._d=new Date(_(e))}),e.version="2.12.0",t(Je),e.fn=Xr,e.min=Fe,e.max=Ne,e.now=_r,e.utc=a,e.unix=gi,e.months=Ci,e.isDate=n,e.locale=D,e.invalid=h,e.duration=it,e.isMoment=m,e.weekdays=Mi,e.parseZone=_i,e.localeData=j,e.isDuration=Be,e.monthsShort=Li,e.weekdaysMin=Zi,e.defineLocale=Z,e.updateLocale=H,e.locales=P,e.weekdaysShort=Di,e.normalizeUnits=X,e.relativeTimeThreshold=Ii,e.prototype=Xr;var cs=e,hs=(cs.defineLocale("ca",{months:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),monthsShort:"gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.".split("_"),weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"Dg_Dl_Dt_Dc_Dj_Dv_Ds".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd D MMMM YYYY H:mm"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"fa %s",s:"uns segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},ordinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(e,t){var i=1===e?"r":2===e?"n":3===e?"r":4===e?"t":"è";return"w"!==t&&"W"!==t||(i="a"),e+i},week:{dow:1,doy:4}}),cs.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:zi,mm:"%d Minuten",h:zi,hh:"%d Stunden",d:zi,dd:zi,M:zi,MM:zi,y:zi,yy:zi},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),cs.defineLocale("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10,i=1===~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+i},week:{dow:1,doy:4}}),"ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_")),us="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),ps=(cs.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,t){return/-MMM-/.test(t)?us[e.month()]:hs[e.month()]},weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),cs.defineLocale("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinalParse:/\d{1,2}(er|)/,ordinal:function(e){return e+(1===e?"er":"")},week:{dow:1,doy:4}}),cs.defineLocale("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY HH:mm",LLLL:"dddd, D [ב]MMMM YYYY HH:mm",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(e){return 2===e?"שעתיים":e+" שעות"},d:"יום",dd:function(e){return 2===e?"יומיים":e+" ימים"},M:"חודש",MM:function(e){return 2===e?"חודשיים":e+" חודשים"},y:"שנה",yy:function(e){return 2===e?"שנתיים":e%10===0&&10!==e?e+" שנה":e+" שנים"}},meridiemParse:/אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,isPM:function(e){return/^(אחה"צ|אחרי הצהריים|בערב)$/.test(e)},meridiem:function(e,t,i){return e<5?"לפנות בוקר":e<10?"בבוקר":e<12?i?'לפנה"צ':"לפני הצהריים":e<18?i?'אחה"צ':"אחרי הצהריים":"בערב"}}),"vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ")),fs=(cs.defineLocale("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec".split("_"),weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"},meridiemParse:/de|du/i,isPM:function(e){return"u"===e.charAt(1).toLowerCase()},meridiem:function(e,t,i){return e<12?i===!0?"de":"DE":i===!0?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return Vi.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return Vi.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:qi,m:qi,mm:qi,h:qi,hh:qi,d:qi,dd:qi,M:qi,MM:qi,y:qi,yy:qi},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),cs.defineLocale("is",{months:"janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),weekdays:"sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),weekdaysShort:"sun_mán_þri_mið_fim_fös_lau".split("_"),weekdaysMin:"Su_Má_Þr_Mi_Fi_Fö_La".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd, D. MMMM YYYY [kl.] H:mm"},calendar:{sameDay:"[í dag kl.] LT",nextDay:"[á morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[í gær kl.] LT",lastWeek:"[síðasta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s síðan",s:tn,m:tn,mm:tn,h:"klukkustund",hh:tn,d:tn,dd:tn,M:tn,MM:tn,y:tn,yy:tn},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),cs.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato".split("_"),weekdaysShort:"Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),weekdaysMin:"Do_Lu_Ma_Me_Gi_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:function(){switch(this.day()){case 0:return"[la scorsa] dddd [alle] LT";default:return"[lo scorso] dddd [alle] LT"}},sameElse:"L"},relativeTime:{future:function(e){return(/^[0-9].+$/.test(e)?"tra":"in")+" "+e},past:"%s fa",s:"alcuni secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),cs.defineLocale("ja",{months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"Ah時m分",LTS:"Ah時m分s秒",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah時m分",LLLL:"YYYY年M月D日Ah時m分 dddd"},meridiemParse:/午前|午後/i,isPM:function(e){return"午後"===e},meridiem:function(e,t,i){return e<12?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:"[来週]dddd LT",lastDay:"[昨日] LT",lastWeek:"[前週]dddd LT",sameElse:"L"},ordinalParse:/\d{1,2}日/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}}),cs.defineLocale("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h시 m분",LTS:"A h시 m분 s초",L:"YYYY.MM.DD",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h시 m분",LLLL:"YYYY년 MMMM D일 dddd A h시 m분"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇초",ss:"%d초",m:"일분",mm:"%d분",h:"한시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한달",MM:"%d달",y:"일년",yy:"%d년"},ordinalParse:/\d{1,2}일/,ordinal:"%d일",meridiemParse:/오전|오후/,isPM:function(e){return"오후"===e},meridiem:function(e,t,i){return e<12?"오전":"오후"}}),{m:"minūtes_minūtēm_minūte_minūtes".split("_"),mm:"minūtes_minūtēm_minūte_minūtes".split("_"),h:"stundas_stundām_stunda_stundas".split("_"),hh:"stundas_stundām_stunda_stundas".split("_"),d:"dienas_dienām_diena_dienas".split("_"),dd:"dienas_dienām_diena_dienas".split("_"),M:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),MM:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),y:"gada_gadiem_gads_gadi".split("_"),yy:"gada_gadiem_gads_gadi".split("_")}),ms=(cs.defineLocale("lv",{months:"janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),weekdays:"svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY.",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, HH:mm",LLLL:"YYYY. [gada] D. MMMM, dddd, HH:mm"},calendar:{sameDay:"[Šodien pulksten] LT",nextDay:"[Rīt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pagājušā] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"pēc %s",past:"pirms %s",s:on,m:sn,mm:rn,h:sn,hh:rn,d:sn,dd:rn,M:sn,MM:rn,y:sn,yy:rn},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),"jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_")),gs="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),_s=(cs.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(e,t){return/-MMM-/.test(t)?gs[e.month()]:ms[e.month()]},weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"Zo_Ma_Di_Wo_Do_Vr_Za".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},ordinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}}),"styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_")),vs="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),ys=(cs.defineLocale("pl",{months:function(e,t){return""===t?"("+vs[e.month()]+"|"+_s[e.month()]+")":/D MMMM/.test(t)?vs[e.month()]:_s[e.month()]},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"nie_pon_wt_śr_czw_pt_sb".split("_"),weekdaysMin:"Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:"[W] dddd [o] LT",lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",m:ln,mm:ln,h:ln,hh:ln,d:"1 dzień",dd:"%d dni",M:"miesiąc",MM:ln,y:"rok",yy:ln},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),cs.defineLocale("pt-br",{months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Dom_2ª_3ª_4ª_5ª_6ª_Sáb".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrás",s:"poucos segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinalParse:/\d{1,2}º/,ordinal:"%dº"}),[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[й|я]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i]),ws=(cs.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв_фев_мар_апр_мая_июня_июля_авг_сен_окт_ноя_дек".split("_"),standalone:"янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:ys,longMonthsParse:ys,shortMonthsParse:ys,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сегодня в] LT",
nextDay:"[Завтра в] LT",lastDay:"[Вчера в] LT",nextWeek:function(e){if(e.week()===this.week())return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT";switch(this.day()){case 0:return"[В следующее] dddd [в] LT";case 1:case 2:case 4:return"[В следующий] dddd [в] LT";case 3:case 5:case 6:return"[В следующую] dddd [в] LT"}},lastWeek:function(e){if(e.week()===this.week())return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT";switch(this.day()){case 0:return"[В прошлое] dddd [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",m:cn,mm:cn,h:"час",hh:cn,d:"день",dd:cn,M:"месяц",MM:cn,y:"год",yy:cn},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(e){return/^(дня|вечера)$/.test(e)},meridiem:function(e,t,i){return e<4?"ночи":e<12?"утра":e<17?"дня":"вечера"},ordinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":return e+"-й";case"D":return e+"-го";case"w":case"W":return e+"-я";default:return e}},week:{dow:1,doy:7}}),"január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_")),bs="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_"),Ts=(cs.defineLocale("sk",{months:ws,monthsShort:bs,weekdays:"nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_št_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_št_pi_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeľu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo štvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[včera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulú nedeľu o] LT";case 1:case 2:return"[minulý] dddd [o] LT";case 3:return"[minulú stredu o] LT";case 4:case 5:return"[minulý] dddd [o] LT";case 6:return"[minulú sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:un,m:un,mm:un,h:un,hh:un,d:un,dd:un,M:un,MM:un,y:un,yy:un},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}}),cs.defineLocale("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),weekdays:"nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._čet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_če_pe_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[včeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:return"[prejšnjo] [nedeljo] [ob] LT";case 3:return"[prejšnjo] [sredo] [ob] LT";case 6:return"[prejšnjo] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[prejšnji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"čez %s",past:"pred %s",s:pn,m:pn,mm:pn,h:pn,hh:pn,d:pn,dd:pn,M:pn,MM:pn,y:pn,yy:pn},ordinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}}),cs.defineLocale("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"[På] dddd LT",lastWeek:"[I] dddd[s] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},ordinalParse:/\d{1,2}(e|a)/,ordinal:function(e){var t=e%10,i=1===~~(e%100/10)?"e":1===t?"a":2===t?"a":"e";return e+i},week:{dow:1,doy:4}}),cs.defineLocale("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา".split("_"),weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),longDateFormat:{LT:"H นาฬิกา m นาที",LTS:"H นาฬิกา m นาที s วินาที",L:"YYYY/MM/DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา H นาฬิกา m นาที",LLLL:"วันddddที่ D MMMM YYYY เวลา H นาฬิกา m นาที"},meridiemParse:/ก่อนเที่ยง|หลังเที่ยง/,isPM:function(e){return"หลังเที่ยง"===e},meridiem:function(e,t,i){return e<12?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}}),{1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"}),xs=(cs.defineLocale("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pts_Sal_Çar_Per_Cum_Cts".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[haftaya] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen hafta] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinalParse:/\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/,ordinal:function(e){if(0===e)return e+"'ıncı";var t=e%10,i=e%100-t,n=e>=100?100:null;return e+(Ts[t]||Ts[i]||Ts[n])},week:{dow:1,doy:7}}),cs.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:gn,weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., HH:mm",LLLL:"dddd, D MMMM YYYY р., HH:mm"},calendar:{sameDay:_n("[Сьогодні "),nextDay:_n("[Завтра "),lastDay:_n("[Вчора "),nextWeek:_n("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return _n("[Минулої] dddd [").call(this);case 1:case 2:case 4:return _n("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",m:mn,mm:mn,h:"годину",hh:mn,d:"день",dd:mn,M:"місяць",MM:mn,y:"рік",yy:mn},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(e){return/^(дня|вечора)$/.test(e)},meridiem:function(e,t,i){return e<4?"ночі":e<12?"ранку":e<17?"дня":"вечора"},ordinalParse:/\d{1,2}-(й|го)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":case"w":case"W":return e+"-й";case"D":return e+"-го";default:return e}},week:{dow:1,doy:7}}),cs.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"Ah点mm分",LTS:"Ah点m分s秒",L:"YYYY-MM-DD",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日Ah点mm分",LLLL:"YYYY年MMMD日ddddAh点mm分",l:"YYYY-MM-DD",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日Ah点mm分",llll:"YYYY年MMMD日ddddAh点mm分"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"下午"===t||"晚上"===t?e+12:e>=11?e:e+12},meridiem:function(e,t,i){var n=100*e+t;return n<600?"凌晨":n<900?"早上":n<1130?"上午":n<1230?"中午":n<1800?"下午":"晚上"},calendar:{sameDay:function(){return 0===this.minutes()?"[今天]Ah[点整]":"[今天]LT"},nextDay:function(){return 0===this.minutes()?"[明天]Ah[点整]":"[明天]LT"},lastDay:function(){return 0===this.minutes()?"[昨天]Ah[点整]":"[昨天]LT"},nextWeek:function(){var e,t;return e=cs().startOf("week"),t=this.unix()-e.unix()>=604800?"[下]":"[本]",0===this.minutes()?t+"dddAh点整":t+"dddAh点mm"},lastWeek:function(){var e,t;return e=cs().startOf("week"),t=this.unix()<e.unix()?"[上]":"[本]",0===this.minutes()?t+"dddAh点整":t+"dddAh点mm"},sameElse:"LL"},ordinalParse:/\d{1,2}(日|月|周)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"周";default:return e}},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},week:{dow:1,doy:4}}),cs.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"Ah點mm分",LTS:"Ah點m分s秒",L:"YYYY年MMMD日",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日Ah點mm分",LLLL:"YYYY年MMMD日ddddAh點mm分",l:"YYYY年MMMD日",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日Ah點mm分",llll:"YYYY年MMMD日ddddAh點mm分"},meridiemParse:/早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,i){var n=100*e+t;return n<900?"早上":n<1130?"上午":n<1230?"中午":n<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},ordinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",m:"一分鐘",mm:"%d分鐘",h:"一小時",hh:"%d小時",d:"一天",dd:"%d天",M:"一個月",MM:"%d個月",y:"一年",yy:"%d年"}}),cs);return xs.locale("en"),xs}),function(e){if("function"==typeof define&&define.amd)define("js.cookie",e);else if("object"==typeof exports)module.exports=e();else{var t=window.Cookies,i=window.Cookies=e();i.noConflict=function(){return window.Cookies=t,i}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var i=arguments[e];for(var n in i)t[n]=i[n]}return t}function t(i){function n(t,r,s){var o;if(arguments.length>1){if(s=e({path:"/"},n.defaults,s),"number"==typeof s.expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*s.expires),s.expires=a}try{o=JSON.stringify(r),/^[\{\[]/.test(o)&&(r=o)}catch(e){}return r=i.write?i.write(r,t):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)),t=t.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),t=t.replace(/[\(\)]/g,escape),document.cookie=[t,"=",r,s.expires&&"; expires="+s.expires.toUTCString(),s.path&&"; path="+s.path,s.domain&&"; domain="+s.domain,s.secure?"; secure":""].join("")}t||(o={});for(var l=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,c=0;c<l.length;c++){var h=l[c].split("="),u=h[0].replace(d,decodeURIComponent),p=h.slice(1).join("=");'"'===p.charAt(0)&&(p=p.slice(1,-1));try{if(p=i.read?i.read(p,u):i(p,u)||p.replace(d,decodeURIComponent),this.json)try{p=JSON.parse(p)}catch(e){}if(t===u){o=p;break}t||(o[u]=p)}catch(e){}}return o}return n.get=n.set=n,n.getJSON=function(){return n.apply({json:!0},[].slice.call(arguments))},n.defaults={},n.remove=function(t,i){n(t,"",e(i,{expires:-1}))},n.withConverter=t,n}return t(function(){})}),require.config({shim:{underscore:{exports:"_"},backbone:{deps:["underscore","jquery"],exports:"Backbone"},"backbone.paginator":{deps:["backbone"],exports:"BackbonePaginator"}},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","jquery.fileupload":"lib/jquery.fileupload","jquery.fileupload-process":"lib/jquery.fileupload-process","jquery.fileupload-validate":"lib/jquery.fileupload-validate","jquery.fileupload-ui":"lib/jquery.fileupload-ui","jquery.magnific-popup":"lib/jquery.magnific-popup","js.cookie":"lib/js.cookie",simplemodal:"lib/jquery.simplemodal",jstree:"lib/jstree.min",select2:"lib/select2-3.5.2",moment:"lib/moment-with-locales",marked:"lib/marked.min",underscore:"lib/underscore",backbone:"lib/backbone","backbone.paginator":"lib/backbone.paginator",text:"lib/text"}}),define("common",["jquery","underscore","text","pinyin-by-unicode","moment","js.cookie"],function(e,t,i,n,r,s){return{INFO_TIMEOUT:1e4,SUCCESS_TIMEOUT:3e3,ERROR_TIMEOUT:3e3,strChineseFirstPY:n.strChineseFirstPY,getUrl:function(e){var t=app.config.siteRoot,i=app.config.fileServerRoot;switch(e.name){case"list_lib_dir":return t+"ajax/lib/"+e.repo_id+"/dir/";case"del_dir":return t+"api/v2.1/repos/"+e.repo_id+"/dir/";case"del_file":return t+"api/v2.1/repos/"+e.repo_id+"/file/";case"download_dir_zip_url":return i+"zip/"+e.zip_token;case"zip_task":return t+"api/v2.1/repos/"+e.repo_id+"/zip-task/";case"query_zip_progress":return t+"api/v2.1/query-zip-progress/";case"copy_move_task":return t+"api/v2.1/copy-move-task/";case"query_copy_move_progress":return t+"api/v2.1/query-copy-move-progress/";case"rename_dir":return t+"api/v2.1/repos/"+e.repo_id+"/dir/";case"rename_file":return t+"api/v2.1/repos/"+e.repo_id+"/file/";case"lock_or_unlock_file":return t+"api/v2.1/repos/"+e.repo_id+"/file/";case"new_dir":return t+"api/v2.1/repos/"+e.repo_id+"/dir/";case"new_file":return t+"api/v2.1/repos/"+e.repo_id+"/file/";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_dirents":return t+"ajax/repo/"+e.repo_id+"/dirents/";case"dir-details":return t+"api/v2.1/repos/"+e.repo_id+"/dir/detail/";case"tags":return t+"api/v2.1/repos/"+e.repo_id+"/tags/";case"file-comments":return t+"api2/repos/"+e.repo_id+"/file/comments/";case"repos":return t+"api2/repos/";case"deleted_repos":return t+"api/v2.1/deleted-repos/";case"pub_repos":return t+"api2/repos/public/";case"unenc_rw_repos":return t+"ajax/unenc-rw-repos/";case"api_v2.1_repo_set_password":return t+"api/v2.1/repos/"+e.repo_id+"/set-password/";case"get_history_changes":return t+"ajax/repo/"+e.repo_id+"/history/changes/";case"beshared_repo":return t+"api2/beshared-repos/"+e.repo_id+"/";case"dir_shared_items":return t+"api2/repos/"+e.repo_id+"/dir/shared_items/";case"shared_repos":return t+"api2/shared-repos/"+e.repo_id+"/";case"repo":return t+"api2/repos/"+e.repo_id+"/";case"repo_v2.1":return t+"api/v2.1/repos/"+e.repo_id+"/";case"repo_owner":return t+"api2/repos/"+e.repo_id+"/owner/";case"repo_history_limit":return t+"api2/repos/"+e.repo_id+"/history-limit/";case"repo_shared_download_links":return t+"api2/repos/"+e.repo_id+"/download-shared-links/";case"repo_shared_download_link":return t+"api2/repos/"+e.repo_id+"/download-shared-links/"+e.token+"/";case"repo_shared_upload_links":return t+"api2/repos/"+e.repo_id+"/upload-shared-links/";case"repo_shared_upload_link":return t+"api2/repos/"+e.repo_id+"/upload-shared-links/"+e.token+"/";case"repo_user_folder_perm":return t+"api2/repos/"+e.repo_id+"/user-folder-perm/";case"repo_group_folder_perm":return t+"api2/repos/"+e.repo_id+"/group-folder-perm/";case"repo_upload_link":return t+"api2/repos/"+e.repo_id+"/upload-link/";case"repo_update_link":return t+"api2/repos/"+e.repo_id+"/update-link/";case"repo_file_uploaded_bytes":return t+"api/v2.1/repos/"+e.repo_id+"/file-uploaded-bytes/";case"repo_labels":return t+"api/v2.1/revision-tags/tagged-items/";case"user_repo_labels":return t+"api/v2.1/revision-tags/tag-names/";case"share_admin_repos":return t+"api/v2.1/shared-repos/";case"share_admin_repo":return t+"api/v2.1/shared-repos/"+e.repo_id+"/";case"share_admin_folders":return t+"api/v2.1/shared-folders/";case"share_admin_share_links":return t+"api/v2.1/share-links/";case"share_admin_share_link":return t+"api/v2.1/share-links/"+e.token+"/";case"share_admin_upload_links":return t+"api/v2.1/upload-links/";case"share_admin_upload_link":return t+"api/v2.1/upload-links/"+e.token+"/";case"send_shared_download_link":return t+"share/link/send/";case"send_shared_upload_link":return t+"share/upload_link/send/";case"groups":return t+"api/v2.1/groups/";case"shareable_groups":return t+"api/v2.1/shareable-groups/";case"search_group":return t+"api/v2.1/search-group/";case"group":return t+"api/v2.1/groups/"+e.group_id+"/";case"group_members":return t+"api/v2.1/groups/"+e.group_id+"/members/";case"group_member":return t+"api/v2.1/groups/"+e.group_id+"/members/"+e.email+"/";case"group_member_bulk":return t+"api/v2.1/groups/"+e.group_id+"/members/bulk/";case"group_import_members":return t+"ajax/group/"+e.group_id+"/members/import/";case"group_repos":return t+"api2/groups/"+e.group_id+"/repos/";case"group_discussions":return t+"api2/groups/"+e.group_id+"/discussions/";case"group_discussion":return t+"api2/groups/"+e.group_id+"/discussions/"+e.discussion_id+"/";case"thumbnail_create":return t+"thumbnail/"+e.repo_id+"/create/";case"thumbnail_get":return t+"thumbnail/"+e.repo_id+"/"+e.size+e.path;case"view_raw_file":return t+"repo/"+e.repo_id+"/raw"+e.path;case"get_popup_notices":return t+"ajax/get_popup_notices/";case"notifications":return t+"api/v2.1/notifications/";case"notification":return t+"api/v2.1/notification/";case"user_enabled_modules":return t+"api/v2.1/user-enabled-modules/";case"starred_files":return t+"api2/starredfiles/";case"events":return t+"api2/events/";case"devices":return t+"api2/devices/";case"invitations":return t+"api/v2.1/invitations/";case"invitations_batch":return t+"api/v2.1/invitations/batch/";case"invitation":return t+"api/v2.1/invitations/"+e.token+"/";case"search_user":return t+"api2/search-user/";case"user_profile":return t+"profile/"+e.username+"/";case"space_and_traffic":return t+"ajax/space_and_traffic/";case"sysinfo":return t+"api/v2.1/admin/sysinfo/";case"admin-devices":return t+"api/v2.1/admin/devices/";case"admin-device-errors":return t+"api/v2.1/admin/device-errors/";case"admin-device-trusted-ip":return t+"api/v2.1/admin/device-trusted-ip/";case"admin-libraries":return t+"api/v2.1/admin/libraries/";case"admin-library":return t+"api/v2.1/admin/libraries/"+e.repo_id+"/";case"admin-library-history-limit":return t+"api/v2.1/admin/libraries/"+e.repo_id+"/history-limit/";case"admin-library-dirents":return t+"api/v2.1/admin/libraries/"+e.repo_id+"/dirents/";case"admin-groups":return t+"api/v2.1/admin/groups/";case"admin-group":return t+"api/v2.1/admin/groups/"+e.group_id+"/";case"admin-group-libraries":return t+"api/v2.1/admin/groups/"+e.group_id+"/libraries/";case"admin-group-library":return t+"api/v2.1/admin/groups/"+e.group_id+"/libraries/"+e.repo_id+"/";case"admin-group-members":return t+"api/v2.1/admin/groups/"+e.group_id+"/members/";case"admin-group-member":return t+"api/v2.1/admin/groups/"+e.group_id+"/members/"+e.email+"/";case"admin-system-library":return t+"api/v2.1/admin/system-library/";case"admin-system-library-upload-link":return t+"api/v2.1/admin/system-library/upload-link/";case"admin-trash-libraries":return t+"api/v2.1/admin/trash-libraries/";case"admin-trash-library":return t+"api/v2.1/admin/trash-libraries/"+e.repo_id+"/";case"admin_shares":return t+"api/v2.1/admin/shares/";case"sys_group_admin_export_excel":return t+"sys/groupadmin/export-excel/";case"admin-operation-logs":return t+"api/v2.1/admin/admin-logs/";case"admin-login-logs":return t+"api/v2.1/admin/admin-login-logs/";case"license":return t+"api/v2.1/admin/license/"}},FILEEXT_ICON_MAP:{md:"txt.png",txt:"txt.png",pdf:"pdf.png",doc:"word.png",docx:"word.png",odt:"word.png",fodt:"word.png",ppt:"ppt.png",pptx:"ppt.png",odp:"ppt.png",fodp:"ppt.png",xls:"excel.png",xlsx:"excel.png",ods:"excel.png",fods:"excel.png",mp4:"video.png",ogv:"video.png",webm:"video.png",mov:"video.png",flv:"video.png",wmv:"video.png",rmvb:"video.png",mp3:"music.png",oga:"music.png",ogg:"music.png",flac:"music.png",aac:"music.png",ac3:"music.png",wma:"music.png",jpg:"pic.png",jpeg:"pic.png",png:"pic.png",svg:"pic.png",gif:"pic.png",bmp:"pic.png",ico:"pic.png",default:"file.png"},getFileIconUrl:function(e,i){i=i>24?192:24;var n;return e.lastIndexOf(".")==-1?app.config.mediaUrl+"img/file/"+i+"/"+this.FILEEXT_ICON_MAP.default:(n=e.substr(e.lastIndexOf(".")+1).toLowerCase(),t.has(this.FILEEXT_ICON_MAP,n)?app.config.mediaUrl+"img/file/"+i+"/"+this.FILEEXT_ICON_MAP[n]:app.config.mediaUrl+"img/file/"+i+"/"+this.FILEEXT_ICON_MAP.default)},getDirIconUrl:function(e,t){return t>24?e?app.config.mediaUrl+"img/folder-read-only-192.png":app.config.mediaUrl+"img/folder-192.png":e?app.config.mediaUrl+"img/folder-read-only-24.png":app.config.mediaUrl+"img/folder-24.png"},getLibIconUrl:function(e,t,i){var n="lib.png";e&&(n="lib-encrypted.png"),t&&(n="lib-readonly.png");var r=i||256;return app.config.mediaUrl+"img/lib/"+r+"/"+n},getLibIconTitle:function(e,t){return e?gettext("Encrypted library"):t?gettext("Read-Only library"):gettext("Read-Write library")},isHiDPI:function(){var e=window.devicePixelRatio?window.devicePixelRatio:1;return e>1},showConfirm:function(t,i,n){var r=e("#confirm-popup"),s=e("#confirm-con"),o=e("#confirm-yes");s.html("<h3>"+t+"</h3><p>"+i+"</p>"),r.modal({appendTo:"#main"}),e("#simplemodal-container").css({height:"auto"}),o.click(n)},confirm_with_extra_option_template:t.template(e("#confirm-dialog-with-extra-option-tmpl").html()),showConfirmWithExtraOption:function(t,i,n,r){var s=e("#confirm-popup"),o=e("#confirm-con"),a=e("#confirm-yes"),l=this.confirm_with_extra_option_template({is_pro:app.pageOptions.is_pro,title:t,content:i,extraOption:n});o.html(l),s.modal({appendTo:"#main"}),e("#simplemodal-container").css({height:"auto"}),a.click(function(){var t="on"===e("#confirm-extra-option:checked").val();r(t)})},closeModal:function(){e.modal.close()},feedback:function(t,i,n){var r,s,o,a=this,n=n||5e3,l="15px",d="";"string"==typeof t?o=e('<li class="'+i+'">'+this.HTMLescape(t)+"</li>"):(e(t).each(function(e,t){d+='<li class="'+t.type+'">'+a.HTMLescape(t.msg)+"</li>"}),o=e(d)),e(".messages").length>0?r=e(".messages").html(o):(r=e('<ul class="messages"></ul>').html(o),e("#main").append(r)),s="-"+(r.outerHeight()+parseInt(l))+"px",r.css({left:(e(window).width()-r.width())/2,top:s}),setTimeout(function(){r.css({top:l})},10),setTimeout(function(){r.css({top:s})},n)},showFormError:function(t,i){e("#"+t+" .error").html(i).removeClass("hide"),e("#simplemodal-container").css({height:"auto"})},ajaxErrorHandler:function(t,i,n){if(t.responseText){var r=e.parseJSON(t.responseText);this.feedback(r.error||r.error_msg||r.detail,"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 i;return document.selection?(i=e.createTextRange(),i.move("character",t),i.select()):e.setSelectionRange(t,t)},prepareApiCsrf:function(){Backbone._sync=Backbone.sync,Backbone.sync=function(e,t,i){if("create"==e||"update"==e||"delete"==e){var n=app.pageOptions.csrfToken;i.beforeSend=function(e){e.setRequestHeader("X-CSRFToken",n)}}return Backbone._sync(e,t,i)}},prepareCSRFToken:function(e,t){function i(e){var t=null;if(document.cookie&&""!=document.cookie)for(var i=document.cookie.split(";"),n=0;n<i.length;n++){var r=jQuery.trim(i[n]);if(r.substring(0,e.length+1)==e+"="){t=decodeURIComponent(r.substring(e.length+1));break}}return t}/^http:.*/.test(t.url)||/^https:.*/.test(t.url)||e.setRequestHeader("X-CSRFToken",i("csrftoken"))},ajaxPost:function(t){var i,n=this,r=t.form,s=t.form_id,o=t.post_url,a=t.post_data,l=t.after_op_success,d=r.children('[type="submit"]');this.disableButton(d),i=t.after_op_error?t.after_op_error:function(t,i,r){var o;o=t.responseText?e.parseJSON(t.responseText).error||e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),n.showFormError(s,o),n.enableButton(d)},e.ajax({url:o,type:"POST",dataType:"json",beforeSend:this.prepareCSRFToken,data:a,success:l,error:i})},ajaxGet:function(t){var i,n=t.get_url,r=t.data,s=t.after_op_success;i=t.after_op_error?t.after_op_error:function(e,t,i){},e.ajax({url:n,cache:!1,dataType:"json",data:r,success:s,error:i})},HTMLescape:function(e){return document.createElement("div").appendChild(document.createTextNode(e)).parentNode.innerHTML},pathJoin:function(e){for(var t=e[0],i=1;i<e.length;i++)t+="/"==t[t.length-1]||"/"==e[i][0]?e[i]:"/"+e[i];return t},encodePath:function(e){for(var t=e.split("/"),i=[],n=0,r=t.length;n<r;n++)i.push(encodeURIComponent(t[n]));return i.join("/")},initLocale:function(){var e;e="en"==app.pageOptions.language_code?"en-gb":"es-ar"==app.pageOptions.language_code||"es-mx"==app.pageOptions.language_code?"es":app.pageOptions.language_code,r.locale(e)},getRelativeTimeStr:function(e){var t=new Date;return e-t>0?gettext("Just now"):e.fromNow()},closeTopNoticeBar:function(){if(!app.pageOptions.cur_note)return!1;var t=app.pageOptions.cur_note.id;if(e("#info-bar").addClass("hide"),navigator.cookieEnabled){var i=new Date,n=document.cookie.split("; "),r=!1;i.setTime(i.getTime()+12096e5),t+="; expires="+i.toGMTString()+"; path="+app.config.siteRoot;for(var s=0,o=n.length;s<o;s++)if("info_id"==n[s].split("=")[0]){r=!0,document.cookie="info_id="+n[s].split("=")[1]+t;break}r||(document.cookie="info_id="+t)}},contactInputOptionsForSelect2:function(){var t=this;return{placeholder:gettext("Search users or enter emails and press Enter"),tags:[],minimumInputLength:1,formatInputTooShort:gettext("Please enter 1 or more character"),formatNoMatches:gettext("No matches"),formatSearching:gettext("Searching..."),formatAjaxError:gettext("Loading failed"),ajax:{url:t.getUrl({name:"search_user"}),dataType:"json",delay:250,cache:!0,data:function(e){return{q:e}},results:function(e){for(var t=[],i=e.users,n=0,r=i.length;n<r;n++)t.push({id:i[n].email,text:i[n].name+" "+i[n].contact_email,avatar_url:i[n].avatar_url,contact_email:i[n].contact_email,name:i[n].name});return{results:t}}},formatResult:function(e){return e.avatar_url?'<img src="'+e.avatar_url+'" width="32" height="32" class="avatar"><span class="text ellipsis">'+t.HTMLescape(e.name)+"<br />"+t.HTMLescape(e.contact_email)+"</span>":void 0},formatSelection:function(e){return t.HTMLescape(e.name||e.id)},createSearchChoice:function(t){return{id:e.trim(t)}},escapeMarkup:function(e){return e}}},groupInputOptionsForSelect2:function(){var e=this;return{placeholder:gettext("Search groups"),tags:[],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_group"}),dataType:"json",delay:250,cache:!0,data:function(e){return{q:e}},results:function(e){for(var t=[],i=e,n=0,r=i.length;n<r;n++)t.push({id:i[n].id,text:i[n].name,name:i[n].name});return{results:t}}},formatResult:function(t){return t.name?'<span class="text ellipsis">'+e.HTMLescape(t.name)+"</span>":void 0},formatSelection:function(t){return e.HTMLescape(t.name)},escapeMarkup:function(e){return e}}},imageCheck:function(e){if(e.lastIndexOf(".")==-1)return!1;var t=e.substr(e.lastIndexOf(".")+1).toLowerCase(),i=["gif","jpeg","jpg","png","ico","bmp"];return i.indexOf(t)!=-1},videoCheck:function(e){if(e.lastIndexOf(".")==-1)return!1;var t=e.substr(e.lastIndexOf(".")+1).toLowerCase(),i=["mp4","ogv","webm","mov"];return i.indexOf(t)!=-1},compareTwoWord:function(e,t){var i,n,r=e.charCodeAt(0),s=t.charCodeAt(0),o=this.strChineseFirstPY;return 19968<r&&r<40869&&19968<s&&s<40869?(i=o.charAt(r-19968).toLowerCase(),n=o.charAt(s-19968).toLowerCase(),i>=n?1:-1):19968<r&&r<40869&&!(19968<s&&s<40869)?1:!(19968<r&&r<40869)&&19968<s&&s<40869?-1:(i=e.toLowerCase(),n=t.toLowerCase(),this.compareStrWithNumbersIn(i,n))},compareStrWithNumbersIn:function(e,t){var i,n,r,s=/\d+|\D+/g,o=/\d/,a=e.match(s),l=t.match(s),d=Math.min(a.length,l.length);if(a&&l&&(i=o.test(a[0]))==o.test(l[0]))for(var c=0;c<d;c++){if(n=a[c],r=l[c],i&&(n=parseInt(n,10),r=parseInt(r,10)),n!=r)return n<r?-1:1;i=!i}return(e>=t)-(e<=t)},toggleSortByNameMode:function(){"name_up"==app.pageOptions.sort_mode?(s.set("sort_mode","name_down"),app.pageOptions.sort_mode="name_down"):(s.set("sort_mode","name_up"),app.pageOptions.sort_mode="name_up")},toggleSortByTimeMode:function(){"time_down"==app.pageOptions.sort_mode?(s.set("sort_mode","time_up"),app.pageOptions.sort_mode="time_up"):(s.set("sort_mode","time_down"),app.pageOptions.sort_mode="time_down")},updateSortIconByMode:function(t){var i=app.pageOptions.sort_mode,n=t.context,r=e(".by-name .sort-icon",n),s=e(".by-time .sort-icon",n);switch(r.hide(),s.hide(),i){case"name_down":r.removeClass("icon-caret-up").addClass("icon-caret-down").show();break;case"name_up":r.removeClass("icon-caret-down").addClass("icon-caret-up").show();break;case"time_down":s.removeClass("icon-caret-up").addClass("icon-caret-down").show();break;case"time_up":s.removeClass("icon-caret-down").addClass("icon-caret-up").show();break;default:r.removeClass("icon-caret-down").addClass("icon-caret-up").show()}},sortLibs:function(e){var t=this,i=app.pageOptions.sort_mode,n=e.libs;switch(i){case"name_up":n.comparator=function(e,i){if(!e.get("name"))return 1;if(!i.get("name"))return-1;var n=t.compareTwoWord(e.get("name"),i.get("name"));return n};break;case"name_down":n.comparator=function(e,i){if(!e.get("name"))return-1;if(!i.get("name"))return 1;var n=t.compareTwoWord(e.get("name"),i.get("name"));return-n};break;case"time_up":n.comparator=function(e,t){return e.get("mtime")<t.get("mtime")?-1:1};break;case"time_down":n.comparator=function(e,t){return e.get("mtime")<t.get("mtime")?1:-1}}n.sort()},fileSizeFormat:function(e,t){var i=1024,n=1024*i,r=1024*n,s=1024*r,t=t||0;return e>=0&&e<i?e+" B":e>=i&&e<n?(e/i).toFixed(t)+" KB":e>=n&&e<r?(e/n).toFixed(t)+" MB":e>=r&&e<s?(e/r).toFixed(t)+" GB":e>=s?(e/s).toFixed(t)+" TB":e+" B"},quotaSizeFormat:function(e,t){var i=1e3,n=1e3*i,r=1e3*n,s=1e3*r,t=t||0;return e>=0&&e<i?e+" B":e>=i&&e<n?(e/i).toFixed(t)+" KB":e>=n&&e<r?(e/n).toFixed(t)+" MB":e>=r&&e<s?(e/r).toFixed(t)+" GB":e>=s?(e/s).toFixed(t)+" TB":e+" B"},groupId2Name:function(e){for(var t,i=app.pageOptions.groups,n=0,r=i.length;n<r;n++)if(e==i[n].id){t=i[n].name;break}return t},setCaretPosition:function(e,t){var i;return document.selection?(i=e.createTextRange(),i.move("character",t),i.select()):e.setSelectionRange(t,t)},zipDownload:function(t,i,n){var r,s,o=this,a=gettext("Packaging..."),l=e("<p></p>"),d=function(){
e.ajax({url:o.getUrl({name:"query_zip_progress"})+"?token="+s,dataType:"json",cache:!1,success:function(t){var i=0==t.total?"100%":(t.zipped/t.total*100).toFixed(0)+"%";l.html(a+" "+i),t.total==t.zipped&&(setTimeout(function(){e.modal.close()},500),clearInterval(r),location.href=o.getUrl({name:"download_dir_zip_url",zip_token:s}))},error:function(e){o.ajaxErrorHandler(e),clearInterval(r)}})};e.ajax({url:o.getUrl({name:"zip_task",repo_id:t}),data:{parent_dir:i,dirents:n},traditional:!0,dataType:"json",success:function(t){s=t.zip_token,l.html(a).modal(),e("#simplemodal-container").css({width:"auto"}),d(),r=setInterval(d,1e3)},error:function(e){o.ajaxErrorHandler(e)}})}}}),function(e,t){if("function"==typeof define&&define.amd)define("backbone",["underscore","jquery","exports"],function(i,n,r){e.Backbone=t(e,r,i,n)});else if("undefined"!=typeof exports){var i=require("underscore");t(e,exports,i)}else e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}(this,function(e,t,i,n){var r=e.Backbone,s=[],o=(s.push,s.slice);s.splice;t.VERSION="1.1.2",t.$=n,t.noConflict=function(){return e.Backbone=r,this},t.emulateHTTP=!1,t.emulateJSON=!1;var a=t.Events={on:function(e,t,i){if(!d(this,"on",e,[t,i])||!t)return this;this._events||(this._events={});var n=this._events[e]||(this._events[e]=[]);return n.push({callback:t,context:i,ctx:i||this}),this},once:function(e,t,n){if(!d(this,"once",e,[t,n])||!t)return this;var r=this,s=i.once(function(){r.off(e,s),t.apply(this,arguments)});return s._callback=t,this.on(e,s,n)},off:function(e,t,n){var r,s,o,a,l,c,h,u;if(!this._events||!d(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events=void 0,this;for(a=e?[e]:i.keys(this._events),l=0,c=a.length;l<c;l++)if(e=a[l],o=this._events[e]){if(this._events[e]=r=[],t||n)for(h=0,u=o.length;h<u;h++)s=o[h],(t&&t!==s.callback&&t!==s.callback._callback||n&&n!==s.context)&&r.push(s);r.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=o.call(arguments,1);if(!d(this,"trigger",e,t))return this;var i=this._events[e],n=this._events.all;return i&&c(i,t),n&&c(n,arguments),this},stopListening:function(e,t,n){var r=this._listeningTo;if(!r)return this;var s=!t&&!n;n||"object"!=typeof t||(n=this),e&&((r={})[e._listenId]=e);for(var o in r)e=r[o],e.off(t,n,this),(s||i.isEmpty(e._events))&&delete this._listeningTo[o];return this}},l=/\s+/,d=function(e,t,i,n){if(!i)return!0;if("object"==typeof i){for(var r in i)e[t].apply(e,[r,i[r]].concat(n));return!1}if(l.test(i)){for(var s=i.split(l),o=0,a=s.length;o<a;o++)e[t].apply(e,[s[o]].concat(n));return!1}return!0},c=function(e,t){var i,n=-1,r=e.length,s=t[0],o=t[1],a=t[2];switch(t.length){case 0:for(;++n<r;)(i=e[n]).callback.call(i.ctx);return;case 1:for(;++n<r;)(i=e[n]).callback.call(i.ctx,s);return;case 2:for(;++n<r;)(i=e[n]).callback.call(i.ctx,s,o);return;case 3:for(;++n<r;)(i=e[n]).callback.call(i.ctx,s,o,a);return;default:for(;++n<r;)(i=e[n]).callback.apply(i.ctx,t);return}},h={listenTo:"on",listenToOnce:"once"};i.each(h,function(e,t){a[t]=function(t,n,r){var s=this._listeningTo||(this._listeningTo={}),o=t._listenId||(t._listenId=i.uniqueId("l"));return s[o]=t,r||"object"!=typeof n||(r=this),t[e](n,r,this),this}}),a.bind=a.on,a.unbind=a.off,i.extend(t,a);var u=t.Model=function(e,t){var n=e||{};t||(t={}),this.cid=i.uniqueId("c"),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(n=this.parse(n,t)||{}),n=i.defaults({},n,i.result(this,"defaults")),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)};i.extend(u.prototype,a,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return i.clone(this.attributes)},sync:function(){return t.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return i.escape(this.get(e))},has:function(e){return null!=this.get(e)},set:function(e,t,n){var r,s,o,a,l,d,c,h;if(null==e)return this;if("object"==typeof e?(s=e,n=t):(s={})[e]=t,n||(n={}),!this._validate(s,n))return!1;o=n.unset,l=n.silent,a=[],d=this._changing,this._changing=!0,d||(this._previousAttributes=i.clone(this.attributes),this.changed={}),h=this.attributes,c=this._previousAttributes,this.idAttribute in s&&(this.id=s[this.idAttribute]);for(r in s)t=s[r],i.isEqual(h[r],t)||a.push(r),i.isEqual(c[r],t)?delete this.changed[r]:this.changed[r]=t,o?delete h[r]:h[r]=t;if(!l){a.length&&(this._pending=n);for(var u=0,p=a.length;u<p;u++)this.trigger("change:"+a[u],this,h[a[u]],n)}if(d)return this;if(!l)for(;this._pending;)n=this._pending,this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,i.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var n in this.attributes)t[n]=void 0;return this.set(t,i.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!i.isEmpty(this.changed):i.has(this.changed,e)},changedAttributes:function(e){if(!e)return!!this.hasChanged()&&i.clone(this.changed);var t,n=!1,r=this._changing?this._previousAttributes:this.attributes;for(var s in e)i.isEqual(r[s],t=e[s])||((n||(n={}))[s]=t);return n},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(e){e=e?i.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=this,n=e.success;return e.success=function(i){return!!t.set(t.parse(i,e),e)&&(n&&n(t,i,e),void t.trigger("sync",t,i,e))},F(this,e),this.sync("read",this,e)},save:function(e,t,n){var r,s,o,a=this.attributes;if(null==e||"object"==typeof e?(r=e,n=t):(r={})[e]=t,n=i.extend({validate:!0},n),r&&!n.wait){if(!this.set(r,n))return!1}else if(!this._validate(r,n))return!1;r&&n.wait&&(this.attributes=i.extend({},a,r)),void 0===n.parse&&(n.parse=!0);var l=this,d=n.success;return n.success=function(e){l.attributes=a;var t=l.parse(e,n);return n.wait&&(t=i.extend(r||{},t)),!(i.isObject(t)&&!l.set(t,n))&&(d&&d(l,e,n),void l.trigger("sync",l,e,n))},F(this,n),s=this.isNew()?"create":n.patch?"patch":"update","patch"===s&&(n.attrs=r),o=this.sync(s,this,n),r&&n.wait&&(this.attributes=a),o},destroy:function(e){e=e?i.clone(e):{};var t=this,n=e.success,r=function(){t.trigger("destroy",t,t.collection,e)};if(e.success=function(i){(e.wait||t.isNew())&&r(),n&&n(t,i,e),t.isNew()||t.trigger("sync",t,i,e)},this.isNew())return e.success(),!1;F(this,e);var s=this.sync("delete",this,e);return e.wait||r(),s},url:function(){var e=i.result(this,"urlRoot")||i.result(this.collection,"url")||X();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({},i.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=i.extend({},this.attributes,e);var n=this.validationError=this.validate(e,t)||null;return!n||(this.trigger("invalid",this,n,i.extend(t,{validationError:n})),!1)}});var p=["keys","values","pairs","invert","pick","omit"];i.each(p,function(e){u.prototype[e]=function(){var t=o.call(arguments);return t.unshift(this.attributes),i[e].apply(i,t)}});var f=t.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,i.extend({silent:!0},t))},m={add:!0,remove:!0,merge:!0},g={add:!0,remove:!1};i.extend(f.prototype,a,{model:u,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,i.extend({merge:!1},t,g))},remove:function(e,t){var n=!i.isArray(e);e=n?[e]:i.clone(e),t||(t={});var r,s,o,a;for(r=0,s=e.length;r<s;r++)a=e[r]=this.get(e[r]),a&&(delete this._byId[a.id],delete this._byId[a.cid],o=this.indexOf(a),this.models.splice(o,1),this.length--,t.silent||(t.index=o,a.trigger("remove",a,this,t)),this._removeReference(a,t));return n?e[0]:e},set:function(e,t){t=i.defaults({},t,m),t.parse&&(e=this.parse(e,t));var n=!i.isArray(e);e=n?e?[e]:[]:i.clone(e);var r,s,o,a,l,d,c,h=t.at,p=this.model,f=this.comparator&&null==h&&t.sort!==!1,g=i.isString(this.comparator)?this.comparator:null,_=[],v=[],y={},w=t.add,b=t.merge,T=t.remove,x=!(f||!w||!T)&&[];for(r=0,s=e.length;r<s;r++){if(l=e[r]||{},o=l instanceof u?a=l:l[p.prototype.idAttribute||"id"],d=this.get(o))T&&(y[d.cid]=!0),b&&(l=l===a?a.attributes:l,t.parse&&(l=d.parse(l,t)),d.set(l,t),f&&!c&&d.hasChanged(g)&&(c=!0)),e[r]=d;else if(w){if(a=e[r]=this._prepareModel(l,t),!a)continue;_.push(a),this._addReference(a,t)}a=d||a,!x||!a.isNew()&&y[a.id]||x.push(a),y[a.id]=!0}if(T){for(r=0,s=this.length;r<s;++r)y[(a=this.models[r]).cid]||v.push(a);v.length&&this.remove(v,t)}if(_.length||x&&x.length)if(f&&(c=!0),this.length+=_.length,null!=h)for(r=0,s=_.length;r<s;r++)this.models.splice(h+r,0,_[r]);else{x&&(this.models.length=0);var S=x||_;for(r=0,s=S.length;r<s;r++)this.models.push(S[r])}if(c&&this.sort({silent:!0}),!t.silent){for(r=0,s=_.length;r<s;r++)(a=_[r]).trigger("add",a,this,t);(c||x&&x.length)&&this.trigger("sort",this,t)}return n?e[0]:e},reset:function(e,t){t||(t={});for(var n=0,r=this.models.length;n<r;n++)this._removeReference(this.models[n],t);return t.previousModels=this.models,this._reset(),e=this.add(e,i.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,i.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,i.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(){return o.apply(this.models,arguments)},get:function(e){if(null!=e)return this._byId[e]||this._byId[e.id]||this._byId[e.cid]},at:function(e){return this.models[e]},where:function(e,t){return i.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var i in e)if(e[i]!==t.get(i))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={}),i.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(i.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return i.invoke(this.models,"get",e)},fetch:function(e){e=e?i.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=e.success,n=this;return e.success=function(i){var r=e.reset?"reset":"set";n[r](i,e),t&&t(n,i,e),n.trigger("sync",n,i,e)},F(this,e),this.sync("read",this,e)},create:function(e,t){if(t=t?i.clone(t):{},!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var n=this,r=t.success;return t.success=function(e,i){t.wait&&n.add(e,t),r&&r(e,i,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 u)return e;t=t?i.clone(t):{},t.collection=this;var n=new this.model(e,t);return n.validationError?(this.trigger("invalid",this,n.validationError,t),!1):n},_addReference:function(e,t){this._byId[e.cid]=e,null!=e.id&&(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,i,n){("add"!==e&&"remove"!==e||i===this)&&("destroy"===e&&this.remove(t,n),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],null!=t.id&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments))}});var _=["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"];i.each(_,function(e){f.prototype[e]=function(){var t=o.call(arguments);return t.unshift(this.models),i[e].apply(i,t)}});var v=["groupBy","countBy","sortBy","indexBy"];i.each(v,function(e){f.prototype[e]=function(t,n){var r=i.isFunction(t)?t:function(e){return e.get(t)};return i[e](this.models,r,n)}});var y=t.View=function(e){this.cid=i.uniqueId("view"),e||(e={}),i.extend(this,i.pick(e,b)),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},w=/^(\S+)\s*(.*)$/,b=["model","collection","el","id","attributes","className","tagName","events"];i.extend(y.prototype,a,{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,i){return this.$el&&this.undelegateEvents(),this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0],i!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=i.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var n=e[t];if(i.isFunction(n)||(n=this[e[t]]),n){var r=t.match(w),s=r[1],o=r[2];n=i.bind(n,this),s+=".delegateEvents"+this.cid,""===o?this.$el.on(s,n):this.$el.on(s,o,n)}}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_ensureElement:function(){if(this.el)this.setElement(i.result(this,"el"),!1);else{var e=i.extend({},i.result(this,"attributes"));this.id&&(e.id=i.result(this,"id")),this.className&&(e.class=i.result(this,"className"));var n=t.$("<"+i.result(this,"tagName")+">").attr(e);this.setElement(n,!1)}}}),t.sync=function(e,n,r){var s=x[e];i.defaults(r||(r={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var o={type:s,dataType:"json"};if(r.url||(o.url=i.result(n,"url")||X()),null!=r.data||!n||"create"!==e&&"update"!==e&&"patch"!==e||(o.contentType="application/json",o.data=JSON.stringify(r.attrs||n.toJSON(r))),r.emulateJSON&&(o.contentType="application/x-www-form-urlencoded",o.data=o.data?{model:o.data}:{}),r.emulateHTTP&&("PUT"===s||"DELETE"===s||"PATCH"===s)){o.type="POST",r.emulateJSON&&(o.data._method=s);var a=r.beforeSend;r.beforeSend=function(e){if(e.setRequestHeader("X-HTTP-Method-Override",s),a)return a.apply(this,arguments)}}"GET"===o.type||r.emulateJSON||(o.processData=!1),"PATCH"===o.type&&T&&(o.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var l=r.xhr=t.ajax(i.extend(o,r));return n.trigger("request",n,l,r),l};var T=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent),x={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var S=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},Y=/\((.*?)\)/g,k=/(\(\?)?:\w+/g,C=/\*\w+/g,L=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend(S.prototype,a,{initialize:function(){},route:function(e,n,r){i.isRegExp(e)||(e=this._routeToRegExp(e)),i.isFunction(n)&&(r=n,n=""),r||(r=this[n]);var s=this;return t.history.route(e,function(i){var o=s._extractParameters(e,i);s.execute(r,o),s.trigger.apply(s,["route:"+n].concat(o)),s.trigger("route",n,o),t.history.trigger("route",s,n,o)}),this},execute:function(e,t){e&&e.apply(this,t)},navigate:function(e,i){return t.history.navigate(e,i),this},_bindRoutes:function(){if(this.routes){this.routes=i.result(this,"routes");for(var e,t=i.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(L,"\\$&").replace(Y,"(?:$1)?").replace(k,function(e,t){return t?e:"([^/?]+)"}).replace(C,"([^?]*?)"),new RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(e,t){var n=e.exec(t).slice(1);return i.map(n,function(e,t){return t===n.length-1?e||null:e?decodeURIComponent(e):null})}});var M=t.History=function(){this.handlers=[],i.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},D=/^[#\/]|\s+$/g,Z=/^\/+|\/+$/g,H=/msie [\w.]+/,j=/\/$/,P=/#.*$/;M.started=!1,i.extend(M.prototype,a,{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(null==e)if(this._hasPushState||!this._wantsHashChange||t){e=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(j,"");e.indexOf(i)||(e=e.slice(i.length))}else e=this.getHash();return e.replace(D,"")},start:function(e){if(M.started)throw new Error("Backbone.history has already been started");M.started=!0,this.options=i.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 n=this.getFragment(),r=document.documentMode,s=H.exec(navigator.userAgent.toLowerCase())&&(!r||r<=7);if(this.root=("/"+this.root+"/").replace(Z,"/"),s&&this._wantsHashChange){var o=t.$('<iframe src="javascript:0" tabindex="-1">');this.iframe=o.hide().appendTo("body")[0].contentWindow,this.navigate(n)}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=n;var a=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()&&a.hash&&(this.fragment=this.getHash().replace(D,""),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();return t===this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe))),t!==this.fragment&&(this.iframe&&this.navigate(t),void this.loadUrl())},loadUrl:function(e){return e=this.fragment=this.getFragment(e),i.any(this.handlers,function(t){if(t.route.test(e))return t.callback(e),!0})},navigate:function(e,t){if(!M.started)return!1;t&&t!==!0||(t={trigger:!!t});var i=this.root+(e=this.getFragment(e||""));if(e=e.replace(P,""),this.fragment!==e){if(this.fragment=e,""===e&&"/"!==i&&(i=i.slice(0,-1)),this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,i);else{if(!this._wantsHashChange)return this.location.assign(i);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))}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,i){if(i){var n=e.href.replace(/(javascript:|#).*$/,"");e.replace(n+"#"+t)}else e.hash="#"+t}}),t.history=new M;var J=function(e,t){var n,r=this;n=e&&i.has(e,"constructor")?e.constructor:function(){return r.apply(this,arguments)},i.extend(n,r,t);var s=function(){this.constructor=n};return s.prototype=r.prototype,n.prototype=new s,e&&i.extend(n.prototype,e),n.__super__=r.prototype,n};u.extend=f.extend=S.extend=y.extend=M.extend=J;var X=function(){throw new Error('A "url" property or function must be specified')},F=function(e,t){var i=t.error;t.error=function(n){i&&i(e,n,t),e.trigger("error",e,n,t)}};return t}),define("app/views/side-nav",["jquery","underscore","backbone","common","js.cookie"],function(e,t,i,n,r){"use strict";var s=i.View.extend({el:"#side-nav",template:t.template(e("#side-nav-tmpl").html()),enableModTemplate:t.template(e("#myhome-mods-enable-form-tmpl").html()),initialize:function(){this.default_cur_tab="mine",this.group_expanded=!1,r.get("group_expanded")&&"true"==r.get("group_expanded")&&(this.group_expanded=!0),this.data={cur_tab:this.default_cur_tab,show_group_list:this.group_expanded,groups:app.pageOptions.groups,mods_enabled:app.pageOptions.user_mods_enabled,can_add_repo:app.pageOptions.can_add_repo,can_generate_share_link:app.pageOptions.can_generate_share_link,can_generate_upload_link:app.pageOptions.can_generate_upload_link};var t=this;e("#js-toggle-side-nav").click(function(){return t.show(),!1}),e(window).resize(function(){e(window).width()>=768&&t.show()})},render:function(){return this.$el.html(this.template(this.data)),this},events:{"click #group-nav a:first":"toggleGroupList","click #share-admin-nav a:first":"toggleShareAdminList","click #enable-mods":"enableMods","click .js-close-side-nav":"closeNav","click li > a":"visitLink","click .js-about":"showAbout","touchstart .side-nav-con":"conTouchStart"},conTouchStart:function(){this.$(".side-nav-con").css({overflow:"auto"})},toggleGroupList:function(){var t=e("#group-nav .toggle-icon");return t.toggleClass("icon-caret-left icon-caret-down"),e("#group-nav .grp-list").slideToggle(),t.hasClass("icon-caret-down")?(r.set("group_expanded","true"),this.data.show_group_list=!0):(r.set("group_expanded","false"),this.data.show_group_list=!1),!1},toggleShareAdminList:function(){var t=e("#share-admin-nav");return e(".toggle-icon",t).toggleClass("icon-caret-left icon-caret-down"),e("ul",t).slideToggle(250),!1},enableMods:function(){var t=app.pageOptions.user_mods_enabled,i=e(this.enableModTemplate({mods_available:app.pageOptions.user_mods_available,mods_enabled:t}));i.modal({focus:!1}),e("#simplemodal-container").css("height","auto"),e(".checkbox-orig",i).click(function(){e(this).parent().toggleClass("checkbox-checked")});var r=e('[name="personal_wiki"]'),s=r.prop("checked"),o=this;return i.submit(function(){var a=r.prop("checked");if(a==s)return!1;var l=i.children('[type="submit"]');return n.disableButton(l),e.ajax({url:n.getUrl({name:"user_enabled_modules"}),type:a?"POST":"DELETE",cache:!1,dataType:"json",beforeSend:n.prepareCSRFToken,success:function(){if(a)t.push("personal wiki");else{var i=t.indexOf("personal wiki");i>-1&&t.splice(i,1)}e.modal.close(),o.render()},error:function(e){n.ajaxErrorHandler(e)}}),!1}),!1},setCurTab:function(t,i){if(this.data.cur_tab=t||this.default_cur_tab,i&&e.extend(this.data,i),this.$clickedTab)this.$(".tab-cur").removeClass("tab-cur"),this.$clickedTab.addClass("tab-cur"),this.$clickedTab=null;else{this.render();var n=this.$(".tab-cur").offset().top,r=e(window).height()-this.$(".side-nav-footer").outerHeight(!0);n>r&&this.$(".side-nav-con").css({overflow:"auto"}).scrollTop(n-r+this.$(".tab-cur").outerHeight(!0)+10).removeAttr("style")}},updateGroups:function(){var t=this;e.ajax({url:n.getUrl({name:"groups"}),type:"GET",dataType:"json",cache:!1,success:function(e){for(var i=[],r=0,s=e.length;r<s;r++)i.push({id:e[r].id,name:e[r].name});i.sort(function(e,t){return n.compareTwoWord(e.name,t.name)}),app.pageOptions.groups=i,t.data.groups=i,t.render()},error:function(){}})},show:function(){this.$el.css({left:"0px"})},hide:function(){this.$el.css({left:"-300px"})},closeNav:function(){return this.hide(),!1},visitLink:function(t){return"#"!==e(t.target).attr("href")&&(this.$clickedTab=e(t.target).parent()),e(window).width()<768&&"#"!==e(t.target).attr("href")&&this.hide(),!0},showAbout:function(){var e=this.$(".about-content");return e.modal(),!1}});return s}),define("app/models/repo",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Model.extend({defaults:{id:null,name:"",desc:"",mtime:0,mtime_relative:"",encrypted:!1,owner:"-",owner_nickname:"-",storage_name:"-",permission:"rw"},parse:function(t){var i=e.clone(t);return i.id=t.id||t.repo_id,i.storage_name=t.storage_name,i.name=t.name||t.repo_name,i.desc=t.desc||t.repo_desc,i.size_formatted=t.size_formatted||t.repo_size_formatted,i},validate:function(e,t){if(!e.name)return gettext("Name is required");if(e.name.indexOf("/")!=-1)return gettext("Name should not include '/'.");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")}},getIconUrl:function(e){var t=this.get("encrypted"),n="r"==this.get("permission");return i.getLibIconUrl(t,n,e)},getIconTitle:function(){var e="";return e=this.get("encrypted")?gettext("Encrypted library"):"rw"==this.get("permission")?gettext("Read-Write library"):gettext("Read-Only library")}});return n}),define("app/collections/repos",["underscore","backbone","common","app/models/repo"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,type:"mine",url:function(){return i.getUrl({name:"repos"})},initialize:function(e){e&&(this.type=e.type?e.type:"mine")},fetch:function(i){return i=i?e.clone(i):{},i.url=this.url()+"?type="+this.type,t.Collection.prototype.fetch.call(this,i)},create:function(i,n){return n=n?e.clone(n):{},n.url=this.url()+"?from=web",t.Collection.prototype.create.call(this,i,n)}});return r}),define("app/views/folder-share-item",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.View.extend({tagName:"tr",template:t.template(e("#folder-perm-item-tmpl").html()),initialize:function(t){void 0===t.item_data.show_folder_path&&e.extend(t.item_data,{show_folder_path:!1}),this.item_data=t.item_data,this.repo_id=t.repo_id,this.path=t.path,this.show_admin=!1,app.pageOptions.is_pro&&"/"==this.path&&(this.show_admin=!0),this.render()},render:function(){return this.$el.html(this.template(e.extend({},this.item_data,{show_admin:this.show_admin}))),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){return e(t.currentTarget).closest("td").find(".perm").addClass("hide").end().find(".perm-toggle-select").removeClass("hide"),!1},editPerm:function(t){var i=this,r=this.item_data,s=n.getUrl({name:"dir_shared_items",repo_id:this.repo_id})+"?p="+encodeURIComponent(this.path);s+=r.for_user?"&share_type=user&username="+encodeURIComponent(r.user_email):"&share_type=group&group_id="+encodeURIComponent(r.group_id);var o=e(t.currentTarget).val();e.ajax({url:s,dataType:"json",method:"POST",beforeSend:n.prepareCSRFToken,data:{permission:o},success:function(){"admin"==o?(r.is_admin=!0,r.permission="rw"):(r.permission=o,r.is_admin=!1),i.render()},error:function(t){var i;i=t.responseText?gettext("Edit failed"):gettext("Failed. Please check the network."),r.for_user?e("#dir-user-share .error").html(i).removeClass("hide"):e("#dir-group-share .error").html(i).removeClass("hide")}})},del:function(){var t=this,i=this.item_data,r=n.getUrl({name:"dir_shared_items",repo_id:this.repo_id})+"?p="+encodeURIComponent(this.path);return r+=i.for_user?"&share_type=user&username="+encodeURIComponent(i.user_email):"&share_type=group&group_id="+encodeURIComponent(i.group_id),e.ajax({url:r,dataType:"json",method:"DELETE",beforeSend:n.prepareCSRFToken,success:function(){t.remove()},error:function(t){var n;n=t.responseText?gettext("Delete failed"):gettext("Failed. Please check the network."),i.for_user?e("#dir-user-share .error").html(n).removeClass("hide"):e("#dir-group-share .error").html(n).removeClass("hide")}}),!1}});return r}),define("app/views/share",["jquery","underscore","backbone","common","app/views/folder-share-item"],function(e,t,i,n,r){"use strict";var s=i.View.extend({tagName:"div",id:"share-popup",template:t.template(e("#share-popup-tmpl").html()),initialize:function(t){if(this.is_repo_owner=t.is_repo_owner,this.is_admin=t.is_admin,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(),e(window).width()>=768?(this.$el.modal({focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"})):this.$el.css({width:e(window).width()-50,height:e(window).height()-50,overflow:"auto"}).modal({focus:!1}),this.$("#share-tabs").tabs(),!this.repo_encrypted&&app.pageOptions.can_generate_share_link&&this.downloadLinkPanelInit(),this.is_dir&&("rw"==this.user_perm&&!this.repo_encrypted&&app.pageOptions.can_generate_upload_link&&this.uploadLinkPanelInit(),!this.is_virtual&&(this.is_repo_owner||this.is_admin))){this.dirUserSharePanelInit(),this.dirGroupSharePanelInit();var i=this;e(document).on("click",function(e){var t=e.target||event.srcElement;i.$(".perm-edit-icon, .perm-toggle-select").is(t)||(i.$(".perm").removeClass("hide"),i.$(".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="'+n.HTMLescape(this.obj_name)+'">'+n.HTMLescape(this.obj_name)+"</span>"),is_dir:this.is_dir,is_repo_owner:this.is_repo_owner,is_admin:this.is_admin,is_virtual:this.is_virtual,user_perm:this.user_perm,repo_id:this.repo_id,can_generate_share_link:app.pageOptions.can_generate_share_link,can_generate_upload_link:app.pageOptions.can_generate_upload_link,repo_encrypted:this.repo_encrypted,dirent_path:this.dirent_path})),this},events:{'click [type="checkbox"]':"clickCheckbox","click .shared-link":"clickToSelect","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","keydown #generate-download-link-form .generate-random-password":"generateRandomDownloadPassword","click #generate-download-link-form .show-or-hide-password":"showOrHideDownloadPassword","keydown #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","keydown #generate-upload-link-form .generate-random-password":"generateRandomUploadPassword","click #generate-upload-link-form .show-or-hide-password":"showOrHideUploadPassword","keydown #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"},clickCheckbox:function(t){var i=e(t.currentTarget);i.closest(".checkbox-label").next("div").toggleClass("hide")},clickToSelect:function(t){e(t.currentTarget).select()},renderDownloadLink:function(t){var i=t.link,n=i+"?dl=1",r=this.$("#download-link"),s=this.$("#direct-dl-link"),o=e("span",r),a=e("input",r),l=e("span",s),d=e("input",s);this.download_link=i,this.download_link_token=t.token,o.html(i),t.permissions.can_download?(s.show().prev("dt").show(),l.html(n)):s.hide().prev("dt").hide(),t.is_expired&&(this.$("#send-download-link").addClass("hide"),this.$("#download-link, #direct-dl-link").append(' <span class="error">('+gettext("Expired")+")</span>")),this.$("#download-link-operations").removeClass("hide"),
a.val(i).css({width:o.width()+2}).show(),o.hide(),d.val(n).css({width:l.width()+2}).show(),l.hide()},renderUploadLink:function(t){var i=t.link;this.upload_link=i,this.upload_link_token=t.token;var n=this.$("#upload-link"),r=e("input",n);r.val(i).attr({size:i.length}).show(),this.$("#upload-link-operations").removeClass("hide")},downloadLinkPanelInit:function(){var t=e("#download-link-share"),i=this.$(".loading-tip"),r=this;e.ajax({url:n.getUrl({name:"share_admin_share_links"}),data:{repo_id:this.repo_id,path:this.dirent_path},cache:!1,dataType:"json",success:function(e){if(1==e.length){var t=e[0];r.renderDownloadLink(t)}else r.$("#generate-download-link-form").removeClass("hide")},error:function(i,n,r){var s;s=i.responseText?403==i.status?gettext("Permission error"):i.responseJSON.error_msg?i.responseJSON.error_msg:gettext("Error"):gettext("Please check the network."),e(".error",t).html(s).show()},complete:function(){i.hide()}})},generateRandomPassword:function(t,i){if("keydown"!=t.type||32==t.which){for(var n=app.pageOptions.share_link_password_min_length,r="",s="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz0123456789",o=0;o<n;o++)r+=s.charAt(Math.floor(Math.random()*s.length));e("input[name=password], input[name=password_again]",i).attr("type","text").val(r),e(".show-or-hide-password",i).attr("title",gettext("Hide")).attr("aria-label",gettext("Hide")).removeClass("icon-eye").addClass("icon-eye-slash")}},generateRandomDownloadPassword:function(t){this.generateRandomPassword(t,e("#generate-download-link-form"))},showOrHidePassword:function(t,i){if("keydown"!=t.type||32==t.which){var n=e(".show-or-hide-password",i),r=e("input[name=password], input[name=password_again]",i);n.toggleClass("icon-eye icon-eye-slash"),n.hasClass("icon-eye")?(n.attr("title",gettext("Show")),n.attr("aria-label",gettext("Show")),r.attr("type","password")):(n.attr("title",gettext("Hide")),n.attr("aria-label",gettext("Hide")),r.attr("type","text"))}},showOrHideDownloadPassword:function(t){this.showOrHidePassword(t,e("#generate-download-link-form"))},generateLink:function(t){var i=t.link_type,r=t.form,s=r.attr("id"),o=e('[name="use_passwd"]',r),a=o.prop("checked");if("download"==i){var l=e('[name="set_expiration"]',r),d=l.prop("checked");if(app.pageOptions.is_pro)var c=e('[name="preview_only"]',r),h=c.prop("checked")}var u={};if(a){var p=e('[name="password"]',r),f=e('[name="password_again"]',r),m=e.trim(p.val()),g=e.trim(f.val());if(!m)return n.showFormError(s,gettext("Please enter password")),!1;if(m.length<app.pageOptions.share_link_password_min_length)return n.showFormError(s,gettext("Password is too short")),!1;if(!g)return n.showFormError(s,gettext("Please enter the password again")),!1;if(m!=g)return n.showFormError(s,gettext("Passwords don't match")),!1;u.password=m}if("download"==i&&d){var _=e('[name="expire_days"]',r),v=e.trim(_.val());if(!v)return n.showFormError(s,gettext("Please enter days.")),!1;if(Math.floor(v)!=v||!e.isNumeric(v))return n.showFormError(s,gettext("Please enter valid days")),!1;u.expire_days=v}"download"==i&&h&&(u.permissions=JSON.stringify({can_preview:!0,can_download:!1})),e(".error",r).addClass("hide").html("");var y=e('[type="submit"]',r);n.disableButton(y),e.extend(u,{repo_id:this.repo_id,path:this.dirent_path});var w=this,b=function(e){r.addClass("hide"),n.enableButton(y),a&&(o.prop("checked",!1).parent().removeClass("checkbox-checked").end().closest(".checkbox-label").next().addClass("hide"),p.val(""),f.val("")),"download"==i&&d&&(l.prop("checked",!1).parent().removeClass("checkbox-checked").end().closest(".checkbox-label").next().addClass("hide"),_.val("")),"download"==i&&h&&c.prop("checked",!1),"download"==i?w.renderDownloadLink(e):w.renderUploadLink(e)};n.ajaxPost({form:r,post_url:t.post_url,post_data:u,after_op_success:b,form_id:s})},generateDownloadLink:function(){return this.generateLink({link_type:"download",form:this.$("#generate-download-link-form"),post_url:n.getUrl({name:"share_admin_share_links"})}),!1},showDownloadLinkSendForm:function(){this.$("#send-download-link, #delete-download-link").addClass("hide"),this.$("#send-download-link-form").removeClass("hide")},sendLink:function(t){var i=t.form,r=i.attr("id"),s=e.trim(e('[name="email"]',i).val()),o=e('textarea[name="extra_msg"]',i).val();if(!s)return n.showFormError(r,gettext("Please input at least an email.")),!1;var a=e('[type="submit"]',i),l=e(".sending-tip",i);n.disableButton(a),l.removeClass("hide");var d={email:s,extra_msg:o};e.extend(d,t.other_post_data);var c=function(t){e.modal.close();var i=gettext("Successfully sent to {placeholder}").replace("{placeholder}",t.send_success.join(", "));n.feedback(i,"success"),t.send_failed.length>0&&(i+="<br />"+gettext("Failed to send to {placeholder}").replace("{placeholder}",t.send_failed.join(", ")),n.feedback(i,"info"))},h=function(t){l.addClass("hide"),n.enableButton(a);var i;i=t.responseText?e.parseJSON(t.responseText).error:gettext("Failed. Please check the network."),n.showFormError(r,i),n.enableButton(a)};n.ajaxPost({form:i,post_url:t.post_url,post_data:d,after_op_success:c,after_op_error:h,form_id:r})},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:n.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:n.getUrl({name:"share_admin_share_link",token:this.download_link_token}),type:"DELETE",cache:!1,beforeSend:n.prepareCSRFToken,dataType:"json",success:function(e){t.$("#generate-download-link-form").removeClass("hide"),t.$("#download-link-operations").addClass("hide")}})},uploadLinkPanelInit:function(){var t=e("#dir-upload-link-share"),i=this.$(".loading-tip").show(),r=this;e.ajax({url:n.getUrl({name:"share_admin_upload_links"}),data:{repo_id:this.repo_id,path:this.dirent_path},cache:!1,dataType:"json",success:function(i){if(1==i.length){var n=i[0];r.renderUploadLink(n)}else r.$("#generate-upload-link-form").removeClass("hide");e(".tip",t).show()},error:function(i,n,r){var s;s=i.responseText?403==i.status?gettext("Permission error"):i.responseJSON.error_msg?i.responseJSON.error_msg:gettext("Error"):gettext("Please check the network."),e(".error",t).html(s).show()},complete:function(){i.hide()}})},generateRandomUploadPassword:function(t){this.generateRandomPassword(t,e("#generate-upload-link-form"))},showOrHideUploadPassword:function(t){this.showOrHidePassword(t,e("#generate-upload-link-form"))},generateUploadLink:function(){return this.generateLink({link_type:"upload",form:this.$("#generate-upload-link-form"),post_url:n.getUrl({name:"share_admin_upload_links"})}),!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:n.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:n.getUrl({name:"share_admin_upload_link",token:this.upload_link_token}),type:"DELETE",cache:!1,beforeSend:n.prepareCSRFToken,dataType:"json",success:function(e){t.$("#generate-upload-link-form").removeClass("hide"),t.$("#upload-link-operations").addClass("hide")}})},dirUserSharePanelInit:function(){var t=this.$(".loading-tip").show(),i=this.$("#dir-user-share"),s=e("table",i),o=e("#add-dir-user-share-item"),a=this.repo_id,l=this.dirent_path;e.ajax({url:n.getUrl({name:"dir_shared_items",repo_id:a}),data:{p:l,share_type:"user"},cache:!1,dataType:"json",success:function(t){e(t).each(function(e,t){var i=new r({repo_id:a,path:l,item_data:{user_email:t.user_info.name,user_name:t.user_info.nickname,permission:t.permission,is_admin:t.is_admin,for_user:!0}});o.after(i.el)}),e('[name="emails"]',o).select2(e.extend({},n.contactInputOptionsForSelect2())),s.removeClass("hide")},error:function(t,n,r){var s;s=t.responseText?403==t.status?gettext("Permission error"):t.responseJSON.error_msg?t.responseJSON.error_msg:gettext("Error"):gettext("Please check the network."),e(".error",i).html(s).show()},complete:function(){t.hide()}})},dirGroupSharePanelInit:function(){var t=this.$(".loading-tip").show(),i=this.$("#dir-group-share"),s=e("table",i),o=e("#add-dir-group-share-item"),a=this.repo_id,l=this.dirent_path;e.ajax({url:n.getUrl({name:"dir_shared_items",repo_id:a}),data:{p:l,share_type:"group"},cache:!1,dataType:"json",success:function(t){e(t).each(function(e,t){var i=new r({repo_id:a,path:l,item_data:{group_id:t.group_info.id,group_name:t.group_info.name,permission:t.permission,is_admin:t.is_admin,for_user:!1}});o.after(i.el)});var d=[],c=function(){for(var t="",i=0,n=d.length;i<n;i++)t+='<option value="'+d[i].id+'" data-index="'+i+'">'+d[i].name+"</option>";e('[name="groups"]',o).html(t).select2({placeholder:gettext("Select groups"),escapeMarkup:function(e){return e}})};app.pageOptions.enable_share_to_all_groups?e.ajax({url:n.getUrl({name:"shareable_groups"}),type:"GET",dataType:"json",cache:!1,success:function(e){for(var t=0,i=e.length;t<i;t++)d.push({id:e[t].id,name:e[t].name});d.sort(function(e,t){return n.compareTwoWord(e.name,t.name)})},error:function(t,n,r){var s,o=gettext("Failed to fetch groups:");s=t.responseText?403==t.status?gettext("Permission error"):t.responseJSON.error_msg?t.responseJSON.error_msg:gettext("Error"):gettext("Please check the network."),e(".error",i).html(o+" "+s).show()},complete:function(){c(),s.removeClass("hide")}}):(d=app.pageOptions.groups||[],c(),s.removeClass("hide"))},error:function(t,n,r){var s;s=t.responseText?403==t.status?gettext("Permission error"):t.responseJSON.error_msg?t.responseJSON.error_msg:gettext("Error"):gettext("Please check the network."),e(".error",i).html(s).show()},complete:function(){t.hide()}})},dirUserShare:function(){var t=e("#dir-user-share"),i=this.$("#add-dir-user-share-item"),s=e('[name="emails"]',i),o=s.val();if(!o)return!1;var a=e("#add-dir-user-share-item"),l=this.repo_id,d=this.dirent_path,c=e('[name="permission"]',i),h=c.val(),u=e(".error",t),p=e('[type="submit"]',i);n.disableButton(p),e.ajax({url:n.getUrl({name:"dir_shared_items",repo_id:l})+"?p="+encodeURIComponent(d),dataType:"json",method:"PUT",beforeSend:n.prepareCSRFToken,traditional:!0,data:{share_type:"user",username:o.split(","),permission:h},success:function(t){if(t.success.length>0&&(e(t.success).each(function(e,t){var i=new r({repo_id:l,path:d,item_data:{user_email:t.user_info.name,user_name:t.user_info.nickname,permission:t.permission,is_admin:t.is_admin,for_user:!0}});a.after(i.el)}),s.select2("val",""),e("option",c).removeAttr("selected"),e('[value="rw"]',c).attr("selected","selected"),u.addClass("hide")),t.failed.length>0){var i="";e(t.failed).each(function(e,t){i+=n.HTMLescape(t.email)+": "+t.error_msg+"<br />"}),u.html(i).removeClass("hide")}},error:function(t){var i;if(t.responseText){var n=e.parseJSON(t.responseText);i=n.error||n.error_msg}else i=gettext("Failed. Please check the network.");u.html(i).removeClass("hide")},complete:function(){n.enableButton(p)}})},dirGroupShare:function(){var t=e("#dir-group-share"),i=this.$("#add-dir-group-share-item"),s=e('[name="groups"]',i),o=s.val();if(!o)return!1;var a=e("#add-dir-group-share-item"),l=this.repo_id,d=this.dirent_path,c=e('[name="permission"]',i),h=c.val(),u=e(".error",t),p=e('[type="submit"]',i);n.disableButton(p),e.ajax({url:n.getUrl({name:"dir_shared_items",repo_id:l})+"?p="+encodeURIComponent(d),dataType:"json",method:"PUT",beforeSend:n.prepareCSRFToken,traditional:!0,data:{share_type:"group",group_id:o,permission:h},success:function(t){if(t.success.length>0&&(e(t.success).each(function(e,t){var i=new r({repo_id:l,path:d,item_data:{group_id:t.group_info.id,group_name:t.group_info.name,permission:t.permission,is_admin:t.is_admin,for_user:!1}});a.after(i.el)}),s.select2("val",""),e("option",c).removeAttr("selected"),e('[value="rw"]',c).attr("selected","selected"),u.addClass("hide")),t.failed.length>0){var i="";e(t.failed).each(function(e,t){i+=n.HTMLescape(t.group_name)+": "+t.error_msg+"<br />"}),u.html(i).removeClass("hide")}},error:function(t){var i;if(t.responseText){var n=e.parseJSON(t.responseText);i=n.error||n.error_msg}else i=gettext("Failed. Please check the network.");u.html(i).removeClass("hide")},complete:function(){n.enableButton(p)}})}});return s}),define("app/views/dialogs/repo-change-password",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.View.extend({template:t.template(e("#repo-change-password-form-tmpl").html()),initialize:function(t){this.repo_name=t.repo_name,this.repo_id=t.repo_id,this.render(),this.$(".op-target").css({"max-width":280}),this.$el.modal(),e("#simplemodal-container").css({height:"auto"})},render:function(){var e=this.repo_name;return this.$el.html(this.template({title:gettext("Change Password of Library {placeholder}").replace("{placeholder}",'<span class="op-target ellipsis ellipsis-op-target" title="'+n.HTMLescape(e)+'">'+n.HTMLescape(e)+"</span>")})),this},events:{"submit form":"formSubmit"},formSubmit:function(){var t=this.$("form"),i=this.$(".error"),r=e.trim(e('input[name="old_passwd"]',t).val()),s=e.trim(e('input[name="new_passwd"]',t).val()),o=e.trim(e('input[name="new_passwd_again"]',t).val());if(!r)return i.html(gettext("Please enter the old password")).removeClass("hide"),!1;if(!s)return i.html(gettext("Please enter a new password")).removeClass("hide"),!1;if(s.length<app.pageOptions.repo_password_min_length)return i.html(gettext("New password is too short")).removeClass("hide"),!1;if(!o)return i.html(gettext("Please enter the new password again")).removeClass("hide"),!1;if(s!=o)return i.html(gettext("New passwords don't match")).removeClass("hide"),!1;var a=this.$('[type="submit"]');return n.disableButton(a),e.ajax({url:n.getUrl({name:"api_v2.1_repo_set_password",repo_id:this.repo_id}),type:"PUT",dataType:"json",beforeSend:n.prepareCSRFToken,data:{old_password:r,new_password:s},success:function(){e.modal.close(),n.feedback(gettext("Successfully changed library password."),"success")},error:function(t){var r;r=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),i.html(r).show(),n.enableButton(a)}}),!1}});return r}),define("app/views/dialogs/repo-history-settings",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.View.extend({template:t.template(e("#history-settings-dialog-tmpl").html()),initialize:function(t){this.repo_name=t.repo_name,this.repo_id=t.repo_id,this.url_name=t.url_name,this.render(),this.$(".op-target").css({"max-width":280}),this.$el.modal(),e("#simplemodal-container").css({height:"auto"}),this.$loadingTip=this.$(".loading-tip"),this.$error=this.$(".error"),this.$form=this.$("form"),this.$radios=this.$("input:radio[name=history]"),this.$days_input=this.$("input:text[name=days]"),this.$submit=this.$("[type=submit]"),this.renderHistorySettings()},render:function(){var e=this.repo_name;return this.$el.html(this.template({title:gettext("{placeholder} History Setting").replace("{placeholder}",'<span class="op-target ellipsis ellipsis-op-target" title="'+n.HTMLescape(e)+'">'+n.HTMLescape(e)+"</span>"),default_history_limit:30})),this},renderHistorySettings:function(){var t=this;e.ajax({url:n.getUrl({name:this.url_name,repo_id:this.repo_id}),type:"get",dataType:"json",success:function(e){t.$loadingTip.hide(),e.keep_days<=-1?t.$radios.filter("[value=full_history]").prop("checked",!0):0==e.keep_days?t.$radios.filter("[value=no_history]").prop("checked",!0):(t.$radios.filter("[value=partial_history]").prop("checked",!0),t.$days_input.prop("disabled",!1).removeClass("input-disabled"),t.$days_input.attr("value",e.keep_days)),t.$radios.filter(":checked").focus(),app.pageOptions.enable_repo_history_setting||(t.$(".history-settings-notice").removeClass("hide"),t.$radios.prop("disabled",!0),t.$days_input.prop("disabled",!0).addClass("input-disabled"),t.$submit.prop("disabled",!0).addClass("btn-disabled"))},error:function(i){var n;n=i.responseText?e.parseJSON(i.responseText).error_msg:gettext("Failed. Please check the network."),t.$error.html(n).show()}})},events:{'change [name="history"]':"changeHistorySetting","submit form":"formSubmit"},changeHistorySetting:function(t){var i=e(t.currentTarget).val(),n=this.$days_input;"full_history"==i||"no_history"==i?n.prop("disabled",!0).addClass("input-disabled"):n.prop("disabled",!1).removeClass("input-disabled")},formSubmit:function(){var t,i=this.$radios.filter(":checked").val(),r=this;return t="partial_history"==i?this.$days_input.val():"full_history"==i?-1:0,this.$submit.prop("disabled",!0),e.ajax({url:n.getUrl({name:this.url_name,repo_id:this.repo_id}),type:"put",dataType:"json",beforeSend:n.prepareCSRFToken,data:{keep_days:t},success:function(){e.modal.close(),n.feedback(gettext("Successfully set library history."),"success")},error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),r.$error.html(i).show(),n.enableButton(r.$submit)}}),!1}});return r}),define("app/collections/repo-shared-download-links",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Collection.extend({initialize:function(e){this.repo_id=e.repo_id},url:function(){return i.getUrl({name:"repo_shared_download_links",repo_id:this.repo_id})}});return n}),define("app/collections/repo-shared-upload-links",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Collection.extend({initialize:function(e){this.repo_id=e.repo_id},url:function(){return i.getUrl({name:"repo_shared_upload_links",repo_id:this.repo_id})}});return n}),define("app/views/repo-shared-link",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.View.extend({tagName:"tr",template:t.template(e("#repo-shared-link-tmpl").html()),events:{mouseenter:"highlight",mouseleave:"rmHighlight","click .rm-link":"removeLink"},initialize:function(t){this.data={},e.extend(this.data,t)},render:function(){var t={},i=this.model.get("path"),r=i,s="";e.extend(t,this.model.attributes),"upload"==this.data.link_type&&e.extend(t,{share_type:"d"});var o,a=n.isHiDPI()?48:24;return"d"==t.share_type?(r=i.substring(0,i.length-1),o=n.getDirIconUrl(!1,a)):(s=n.fileSizeFormat(this.model.get("size"),1),o=n.getFileIconUrl(this.model.get("name"),a)),e.extend(t,{repo_id:this.data.repo_id,icon_url:o,formattedSize:s,encoded_path:n.encodePath(r)}),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")},removeLink:function(){var t=n.getUrl({name:"download"==this.data.link_type?"repo_shared_download_link":"repo_shared_upload_link",repo_id:this.data.repo_id,token:this.model.get("token")}),i=this;return e.ajax({url:t,type:"delete",dataType:"json",beforeSend:n.prepareCSRFToken,success:function(){i.remove()},error:function(t){var n;n=t.responseText?e.parseJSON(response.responseText).error_msg:gettext("Please check the network."),i.data.$error.html(n).show()}}),!1}});return r}),define("app/views/dialogs/repo-share-link-admin",["jquery","underscore","backbone","common","app/collections/repo-shared-download-links","app/collections/repo-shared-upload-links","app/views/repo-shared-link"],function(e,t,i,n,r,s,o){"use strict";var a=i.View.extend({tagName:"div",id:"repo-share-link-admin-dialog",template:t.template(e("#repo-shared-links-admin-dialog-tmpl").html()),initialize:function(t){this.repo_name=t.repo_name,this.repo_id=t.repo_id,this.render(),this.$(".op-target").css({"max-width":280}),e(window).width()>=768?(this.$el.modal({focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"})):this.$el.css({width:e(window).width()-50,height:e(window).height()-50,overflow:"auto"}).modal({focus:!1}),this.$(".js-tabs").tabs();var i=new r({repo_id:this.repo_id});i.link_type="download",this.$downloadLinksPanel=this.$("#js-download-links");var n=new s({repo_id:this.repo_id});n.link_type="upload",this.$uploadLinksPanel=this.$("#js-upload-links"),app.pageOptions.can_generate_share_link&&this.renderLinksPanel({links:i,$panel:this.$downloadLinksPanel}),app.pageOptions.can_generate_upload_link&&this.renderLinksPanel({links:n,$panel:this.$uploadLinksPanel})},render:function(){return this.$el.html(this.template({can_generate_share_link:app.pageOptions.can_generate_share_link,can_generate_upload_link:app.pageOptions.can_generate_upload_link,title:gettext("{placeholder} Share Links").replace("{placeholder}",'<span class="op-target ellipsis ellipsis-op-target" title="'+n.HTMLescape(this.repo_name)+'">'+n.HTMLescape(this.repo_name)+"</span>")})),this},renderLinksPanel:function(t){var i=t.links,n=t.$panel,r=e(".loading-tip",n),s=e(".error",n);this.listenTo(i,"add",this.addLink),i.fetch({cache:!1,success:function(e,t,i){r.hide()},error:function(t,i,n){r.hide();var o;o=i.responseText?401==i.status||403==i.status?gettext("Permission error"):e.parseJSON(i.responseText).error_msg:gettext("Please check the network."),s.html(o).show()}})},addLink:function(t,i,n){var r=i.link_type,s="download"==r?this.$downloadLinksPanel:this.$uploadLinksPanel,a=new o({model:t,repo_id:this.repo_id,link_type:r,$error:e(".error",s)});e("tbody",s).append(a.render().el)}});return a}),!function(e){"use strict";"function"==typeof define&&define.amd?define("jstree",["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e,t){"use strict";if(!e.jstree){var i,n,r=0,s=!1,o=!1,a=!1,l=[],d=e("script:last").attr("src"),c=window.document,h=c.createElement("LI");h.setAttribute("role","treeitem"),i=c.createElement("I"),i.className="jstree-icon jstree-ocl",i.setAttribute("role","presentation"),h.appendChild(i),i=c.createElement("A"),i.className="jstree-anchor",i.setAttribute("href","#"),i.setAttribute("tabindex","-1"),n=c.createElement("I"),n.className="jstree-icon jstree-themeicon",n.setAttribute("role","presentation"),i.appendChild(n),h.appendChild(i),i=n=null,e.jstree={version:"3.3.2",defaults:{plugins:[]},plugins:{},path:d&&-1!==d.indexOf("/")?d.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},e.jstree.create=function(t,i){var n=new e.jstree.core(++r),s=i;return i=e.extend(!0,{},e.jstree.defaults,i),s&&s.plugins&&(i.plugins=s.plugins),e.each(i.plugins,function(e,t){"core"!==e&&(n=n.plugin(t,i[t]))}),e(t).data("jstree",n),n.init(t,i),n},e.jstree.destroy=function(){e(".jstree:jstree").jstree("destroy"),e(c).off(".jstree")},e.jstree.core=function(e){this._id=e,this._cnt=0,this._wrk=null,this._data={core:{themes:{name:!1,dots:!1,icons:!1},selected:[],last_error:{},working:!1,worker_queue:[],focused:null}}},e.jstree.reference=function(t){var i=null,n=null;if(!t||!t.id||t.tagName&&t.nodeType||(t=t.id),!n||!n.length)try{n=e(t)}catch(e){}if(!n||!n.length)try{n=e("#"+t.replace(e.jstree.idregex,"\\$&"))}catch(e){}return n&&n.length&&(n=n.closest(".jstree")).length&&(n=n.data("jstree"))?i=n:e(".jstree").each(function(){var n=e(this).data("jstree");return n&&n._model.data[t]?(i=n,!1):void 0}),i},e.fn.jstree=function(i){var n="string"==typeof i,r=Array.prototype.slice.call(arguments,1),s=null;return!(i===!0&&!this.length)&&(this.each(function(){var o=e.jstree.reference(this),a=n&&o?o[i]:null;return s=n&&a?a.apply(o,r):null,o||n||i!==t&&!e.isPlainObject(i)||e.jstree.create(this,i),(o&&!n||i===!0)&&(s=o||!1),(null===s||s===t)&&void 0}),null!==s&&s!==t?s:this)},e.expr.pseudos.jstree=e.expr.createPseudo(function(i){return function(i){return e(i).hasClass("jstree")&&e(i).data("jstree")!==t}}),e.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:e.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0},e.jstree.core.prototype={plugin:function(t,i){var n=e.jstree.plugins[t];return n?(this._data[t]={},n.prototype=this,new n(i,this)):this},init:function(t,i){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[e.jstree.root]={id:e.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=e(t).addClass("jstree jstree-"+this._id),this.settings=i,this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.settings.core.multiple&&this.element.attr("aria-multiselectable",!0),this.element.attr("tabindex")||this.element.attr("tabindex","0"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html("<ul class='jstree-container-ul jstree-children' role='group'><li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading"),this._data.core.li_height=this.get_container_ul().children("li").first().height()||24,this.trigger("loading"),this.load_node(e.jstree.root)},destroy:function(e){if(this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(e){}e||this.element.empty(),this.teardown()},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){var t="",i=null,n=0;this.element.on("dblclick.jstree",function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;if(c.selection&&c.selection.empty)c.selection.empty();else if(window.getSelection){var t=window.getSelection();try{t.removeAllRanges(),t.collapse()}catch(e){}}}).on("mousedown.jstree",e.proxy(function(e){e.target===this.element[0]&&(e.preventDefault(),n=+new Date)},this)).on("mousedown.jstree",".jstree-ocl",function(e){e.preventDefault()}).on("click.jstree",".jstree-ocl",e.proxy(function(e){this.toggle_node(e.target)},this)).on("dblclick.jstree",".jstree-anchor",e.proxy(function(e){return!(!e.target.tagName||"input"!==e.target.tagName.toLowerCase())||void(this.settings.core.dblclick_toggle&&this.toggle_node(e.target))},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){t.preventDefault(),t.currentTarget!==c.activeElement&&e(t.currentTarget).focus(),this.activate_node(t.currentTarget,t)},this)).on("keydown.jstree",".jstree-anchor",e.proxy(function(t){if(t.target.tagName&&"input"===t.target.tagName.toLowerCase())return!0;if(32!==t.which&&13!==t.which&&(t.shiftKey||t.ctrlKey||t.altKey||t.metaKey))return!0;var i=null;switch(this._data.core.rtl&&(37===t.which?t.which=39:39===t.which&&(t.which=37)),t.which){case 32:t.ctrlKey&&(t.type="click",e(t.currentTarget).trigger(t));break;case 13:t.type="click",e(t.currentTarget).trigger(t);break;case 37:t.preventDefault(),this.is_open(t.currentTarget)?this.close_node(t.currentTarget):(i=this.get_parent(t.currentTarget),i&&i.id!==e.jstree.root&&this.get_node(i,!0).children(".jstree-anchor").focus());break;case 38:t.preventDefault(),i=this.get_prev_dom(t.currentTarget),i&&i.length&&i.children(".jstree-anchor").focus();break;case 39:t.preventDefault(),this.is_closed(t.currentTarget)?this.open_node(t.currentTarget,function(e){this.get_node(e,!0).children(".jstree-anchor").focus()}):this.is_open(t.currentTarget)&&(i=this.get_node(t.currentTarget,!0).children(".jstree-children")[0],i&&e(this._firstChild(i)).children(".jstree-anchor").focus());break;case 40:t.preventDefault(),i=this.get_next_dom(t.currentTarget),i&&i.length&&i.children(".jstree-anchor").focus();break;case 106:this.open_all();break;case 36:t.preventDefault(),i=this._firstChild(this.get_container_ul()[0]),i&&e(i).children(".jstree-anchor").filter(":visible").focus();break;case 35:t.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus();break;case 113:t.preventDefault(),this.edit(t.currentTarget)}},this)).on("load_node.jstree",e.proxy(function(t,i){i.status&&(i.node.id!==e.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(e.proxy(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var t,i,n=[];for(t=0,i=this._data.core.selected.length;i>t;t++)n=n.concat(this._model.data[this._data.core.selected[t]].parents);for(n=e.vakata.array_unique(n),t=0,i=n.length;i>t;t++)this.open_node(n[t],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}},this),0))},this)).on("keypress.jstree",e.proxy(function(n){if(n.target.tagName&&"input"===n.target.tagName.toLowerCase())return!0;i&&clearTimeout(i),i=setTimeout(function(){t=""},500);var r=String.fromCharCode(n.which).toLowerCase(),s=this.element.find(".jstree-anchor").filter(":visible"),o=s.index(c.activeElement)||0,a=!1;if(t+=r,t.length>1){if(s.slice(o).each(e.proxy(function(i,n){return 0===e(n).text().toLowerCase().indexOf(t)?(e(n).focus(),a=!0,!1):void 0},this)),a)return;if(s.slice(0,o).each(e.proxy(function(i,n){return 0===e(n).text().toLowerCase().indexOf(t)?(e(n).focus(),a=!0,!1):void 0},this)),a)return}if(new RegExp("^"+r.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(t)){if(s.slice(o+1).each(e.proxy(function(t,i){return e(i).text().toLowerCase().charAt(0)===r?(e(i).focus(),a=!0,!1):void 0},this)),a)return;if(s.slice(0,o+1).each(e.proxy(function(t,i){return e(i).text().toLowerCase().charAt(0)===r?(e(i).focus(),a=!0,!1):void 0},this)),a)return}},this)).on("init.jstree",e.proxy(function(){var e=this.settings.core.themes;this._data.core.themes.dots=e.dots,this._data.core.themes.stripes=e.stripes,this._data.core.themes.icons=e.icons,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)},this)).on("loading.jstree",e.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"]()},this)).on("blur.jstree",".jstree-anchor",e.proxy(function(t){this._data.core.focused=null,e(t.currentTarget).filter(".jstree-hovered").mouseleave(),this.element.attr("tabindex","0")},this)).on("focus.jstree",".jstree-anchor",e.proxy(function(t){var i=this.get_node(t.currentTarget);i&&i.id&&(this._data.core.focused=i.id),this.element.find(".jstree-hovered").not(t.currentTarget).mouseleave(),e(t.currentTarget).mouseenter(),this.element.attr("tabindex","-1")},this)).on("focus.jstree",e.proxy(function(){if(+new Date-n>500&&!this._data.core.focused){n=0;var e=this.get_node(this.element.attr("aria-activedescendant"),!0);e&&e.find("> .jstree-anchor").focus()}},this)).on("mouseenter.jstree",".jstree-anchor",e.proxy(function(e){
this.hover_node(e.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),e(c).off(".jstree-"+this._id)},trigger:function(e,t){t||(t={}),t.instance=this,this.element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(t){var i=this.settings.core.strings;return e.isFunction(i)?i.call(this,t):i&&i[t]?i[t]:t},_firstChild:function(e){for(e=e?e.firstChild:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_nextSibling:function(e){for(e=e?e.nextSibling:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_previousSibling:function(e){for(e=e?e.previousSibling:null;null!==e&&1!==e.nodeType;)e=e.previousSibling;return e},get_node:function(t,i){t&&t.id&&(t=t.id);var n;try{if(this._model.data[t])t=this._model.data[t];else if("string"==typeof t&&this._model.data[t.replace(/^#/,"")])t=this._model.data[t.replace(/^#/,"")];else if("string"==typeof t&&(n=e("#"+t.replace(e.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[n.closest(".jstree-node").attr("id")])t=this._model.data[n.closest(".jstree-node").attr("id")];else if((n=e(t,this.element)).length&&this._model.data[n.closest(".jstree-node").attr("id")])t=this._model.data[n.closest(".jstree-node").attr("id")];else{if(!(n=e(t,this.element)).length||!n.hasClass("jstree"))return!1;t=this._model.data[e.jstree.root]}return i&&(t=t.id===e.jstree.root?this.element:e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)),t}catch(e){return!1}},get_path:function(t,i,n){if(t=t.parents?t:this.get_node(t),!t||t.id===e.jstree.root||!t.parents)return!1;var r,s,o=[];for(o.push(n?t.id:t.text),r=0,s=t.parents.length;s>r;r++)o.push(n?t.parents[r]:this.get_text(t.parents[r]));return o=o.reverse().slice(1),i?o.join(i):o},get_next_dom:function(t,i){var n;if(t=this.get_node(t,!0),t[0]===this.element[0]){for(n=this._firstChild(this.get_container_ul()[0]);n&&0===n.offsetHeight;)n=this._nextSibling(n);return!!n&&e(n)}if(!t||!t.length)return!1;if(i){n=t[0];do n=this._nextSibling(n);while(n&&0===n.offsetHeight);return!!n&&e(n)}if(t.hasClass("jstree-open")){for(n=this._firstChild(t.children(".jstree-children")[0]);n&&0===n.offsetHeight;)n=this._nextSibling(n);if(null!==n)return e(n)}n=t[0];do n=this._nextSibling(n);while(n&&0===n.offsetHeight);return null!==n?e(n):t.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(t,i){var n;if(t=this.get_node(t,!0),t[0]===this.element[0]){for(n=this.get_container_ul()[0].lastChild;n&&0===n.offsetHeight;)n=this._previousSibling(n);return!!n&&e(n)}if(!t||!t.length)return!1;if(i){n=t[0];do n=this._previousSibling(n);while(n&&0===n.offsetHeight);return!!n&&e(n)}n=t[0];do n=this._previousSibling(n);while(n&&0===n.offsetHeight);if(null!==n){for(t=e(n);t.hasClass("jstree-open");)t=t.children(".jstree-children").first().children(".jstree-node:visible:last");return t}return n=t[0].parentNode.parentNode,!(!n||!n.className||-1===n.className.indexOf("jstree-node"))&&e(n)},get_parent:function(t){return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&t.parent},get_children_dom:function(e){return e=this.get_node(e,!0),e[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):!(!e||!e.length)&&e.children(".jstree-children").children(".jstree-node")},is_parent:function(e){return e=this.get_node(e),e&&(e.state.loaded===!1||e.children.length>0)},is_loaded:function(e){return e=this.get_node(e),e&&e.state.loaded},is_loading:function(e){return e=this.get_node(e),e&&e.state&&e.state.loading},is_open:function(e){return e=this.get_node(e),e&&e.state.opened},is_closed:function(e){return e=this.get_node(e),e&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(t,i){var n,r,s,o,a;if(e.isArray(t))return this._load_nodes(t.slice(),i),!0;if(t=this.get_node(t),!t)return i&&i.call(this,t,!1),!1;if(t.state.loaded){for(t.state.loaded=!1,s=0,o=t.parents.length;o>s;s++)this._model.data[t.parents[s]].children_d=e.vakata.array_filter(this._model.data[t.parents[s]].children_d,function(i){return-1===e.inArray(i,t.children_d)});for(n=0,r=t.children_d.length;r>n;n++)this._model.data[t.children_d[n]].state.selected&&(a=!0),delete this._model.data[t.children_d[n]];a&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,function(i){return-1===e.inArray(i,t.children_d)})),t.children=[],t.children_d=[],a&&this.trigger("changed",{action:"load_node",node:t,selected:this._data.core.selected})}return t.state.failed=!1,t.state.loading=!0,this.get_node(t,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(t,e.proxy(function(e){t=this._model.data[t.id],t.state.loading=!1,t.state.loaded=e,t.state.failed=!t.state.loaded;var n=this.get_node(t,!0),r=0,s=0,o=this._model.data,a=!1;for(r=0,s=t.children.length;s>r;r++)if(o[t.children[r]]&&!o[t.children[r]].state.hidden){a=!0;break}t.state.loaded&&n&&n.length&&(n.removeClass("jstree-closed jstree-open jstree-leaf"),a?"#"!==t.id&&n.addClass(t.state.opened?"jstree-open":"jstree-closed"):n.addClass("jstree-leaf")),n.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:t,status:e}),i&&i.call(this,t,e)},this)),!0},_load_nodes:function(e,t,i,n){var r,s,o=!0,a=function(){this._load_nodes(e,t,!0)},l=this._model.data,d=[];for(r=0,s=e.length;s>r;r++)l[e[r]]&&(!l[e[r]].state.loaded&&!l[e[r]].state.failed||!i&&n)&&(this.is_loading(e[r])||this.load_node(e[r],a),o=!1);if(o){for(r=0,s=e.length;s>r;r++)l[e[r]]&&l[e[r]].state.loaded&&d.push(e[r]);t&&!t.done&&(t.call(this,d),t.done=!0)}},load_all:function(t,i){if(t||(t=e.jstree.root),t=this.get_node(t),!t)return!1;var n,r,s=[],o=this._model.data,a=o[t.id].children_d;for(t.state&&!t.state.loaded&&s.push(t.id),n=0,r=a.length;r>n;n++)o[a[n]]&&o[a[n]].state&&!o[a[n]].state.loaded&&s.push(a[n]);s.length?this._load_nodes(s,function(){this.load_all(t,i)}):(i&&i.call(this,t),this.trigger("load_all",{node:t}))},_load_node:function(t,i){var n,r=this.settings.core.data,s=function(){return 3!==this.nodeType&&8!==this.nodeType};return r?e.isFunction(r)?r.call(this,t,e.proxy(function(n){n===!1?i.call(this,!1):this["string"==typeof n?"_append_html_data":"_append_json_data"](t,"string"==typeof n?e(e.parseHTML(n)).filter(s):n,function(e){i.call(this,e)})},this)):"object"==typeof r?r.url?(r=e.extend(!0,{},r),e.isFunction(r.url)&&(r.url=r.url.call(this,t)),e.isFunction(r.data)&&(r.data=r.data.call(this,t)),e.ajax(r).done(e.proxy(function(n,r,o){var a=o.getResponseHeader("Content-Type");return a&&-1!==a.indexOf("json")||"object"==typeof n?this._append_json_data(t,n,function(e){i.call(this,e)}):a&&-1!==a.indexOf("html")||"string"==typeof n?this._append_html_data(t,e(e.parseHTML(n)).filter(s),function(e){i.call(this,e)}):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:o})},this.settings.core.error.call(this,this._data.core.last_error),i.call(this,!1))},this)).fail(e.proxy(function(e){i.call(this,!1),this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:e})},this.settings.core.error.call(this,this._data.core.last_error)},this))):(n=e.isArray(r)||e.isPlainObject(r)?JSON.parse(JSON.stringify(r)):r,t.id===e.jstree.root?this._append_json_data(t,n,function(e){i.call(this,e)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),i.call(this,!1))):"string"==typeof r?t.id===e.jstree.root?this._append_html_data(t,e(e.parseHTML(r)).filter(s),function(e){i.call(this,e)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),i.call(this,!1)):i.call(this,!1):t.id===e.jstree.root?this._append_html_data(t,this._data.core.original_container_html.clone(!0),function(e){i.call(this,e)}):i.call(this,!1)},_node_changed:function(e){e=this.get_node(e),e&&this._model.changed.push(e.id)},_append_html_data:function(t,i,n){t=this.get_node(t),t.children=[],t.children_d=[];var r,s,o,a=i.is("ul")?i.children():i,l=t.id,d=[],c=[],h=this._model.data,u=h[l],p=this._data.core.selected.length;for(a.each(e.proxy(function(t,i){r=this._parse_model_from_html(e(i),l,u.parents.concat()),r&&(d.push(r),c.push(r),h[r].children_d.length&&(c=c.concat(h[r].children_d)))},this)),u.children=d,u.children_d=c,s=0,o=u.parents.length;o>s;s++)h[u.parents[s]].children_d=h[u.parents[s]].children_d.concat(c);this.trigger("model",{nodes:c,parent:l}),l!==e.jstree.root?(this._node_changed(l),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==p&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),n.call(this,!0)},_append_json_data:function(t,i,n,r){if(null!==this.element){t=this.get_node(t),t.children=[],t.children_d=[],i.d&&(i=i.d,"string"==typeof i&&(i=JSON.parse(i))),e.isArray(i)||(i=[i]);var s=null,o={df:this._model.default_state,dat:i,par:t.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},a=function(e,t){e.data&&(e=e.data);var i,n,r,s,o=e.dat,a=e.par,l=[],d=[],c=[],h=e.df,u=e.t_id,p=e.t_cnt,f=e.m,m=f[a],g=e.sel,_=function(e,i,n){n=n?n.concat():[],i&&n.unshift(i);var r,s,o,a,l=e.id.toString(),d={id:l,text:e.text||"",icon:e.icon===t||e.icon,parent:i,parents:n,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(r in h)h.hasOwnProperty(r)&&(d.state[r]=h[r]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(d.icon=e.data.jstree.icon),(d.icon===t||null===d.icon||""===d.icon)&&(d.icon=!0),e&&e.data&&(d.data=e.data,e.data.jstree))for(r in e.data.jstree)e.data.jstree.hasOwnProperty(r)&&(d.state[r]=e.data.jstree[r]);if(e&&"object"==typeof e.state)for(r in e.state)e.state.hasOwnProperty(r)&&(d.state[r]=e.state[r]);if(e&&"object"==typeof e.li_attr)for(r in e.li_attr)e.li_attr.hasOwnProperty(r)&&(d.li_attr[r]=e.li_attr[r]);if(d.li_attr.id||(d.li_attr.id=l),e&&"object"==typeof e.a_attr)for(r in e.a_attr)e.a_attr.hasOwnProperty(r)&&(d.a_attr[r]=e.a_attr[r]);for(e&&e.children&&e.children===!0&&(d.state.loaded=!1,d.children=[],d.children_d=[]),f[d.id]=d,r=0,s=d.children.length;s>r;r++)o=_(f[d.children[r]],d.id,n),a=f[o],d.children_d.push(o),a.children_d.length&&(d.children_d=d.children_d.concat(a.children_d));return delete e.data,delete e.children,f[d.id].original=e,d.state.selected&&c.push(d.id),d.id},v=function(e,i,n){n=n?n.concat():[],i&&n.unshift(i);var r,s,o,a,l,d=!1;do d="j"+u+"_"+ ++p;while(f[d]);l={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:i,parents:n,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(r in h)h.hasOwnProperty(r)&&(l.state[r]=h[r]);if(e&&e.id&&(l.id=e.id.toString()),e&&e.text&&(l.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(l.icon=e.data.jstree.icon),(l.icon===t||null===l.icon||""===l.icon)&&(l.icon=!0),e&&e.data&&(l.data=e.data,e.data.jstree))for(r in e.data.jstree)e.data.jstree.hasOwnProperty(r)&&(l.state[r]=e.data.jstree[r]);if(e&&"object"==typeof e.state)for(r in e.state)e.state.hasOwnProperty(r)&&(l.state[r]=e.state[r]);if(e&&"object"==typeof e.li_attr)for(r in e.li_attr)e.li_attr.hasOwnProperty(r)&&(l.li_attr[r]=e.li_attr[r]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=d),l.li_attr.id||(l.li_attr.id=l.id),e&&"object"==typeof e.a_attr)for(r in e.a_attr)e.a_attr.hasOwnProperty(r)&&(l.a_attr[r]=e.a_attr[r]);if(e&&e.children&&e.children.length){for(r=0,s=e.children.length;s>r;r++)o=v(e.children[r],l.id,n),a=f[o],l.children.push(o),a.children_d.length&&(l.children_d=l.children_d.concat(a.children_d));l.children_d=l.children_d.concat(l.children)}return e&&e.children&&e.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete e.data,delete e.children,l.original=e,f[l.id]=l,l.state.selected&&c.push(l.id),l.id};if(o.length&&o[0].id!==t&&o[0].parent!==t){for(n=0,r=o.length;r>n;n++)o[n].children||(o[n].children=[]),f[o[n].id.toString()]=o[n];for(n=0,r=o.length;r>n;n++)f[o[n].parent.toString()].children.push(o[n].id.toString()),m.children_d.push(o[n].id.toString());for(n=0,r=m.children.length;r>n;n++)i=_(f[m.children[n]],a,m.parents.concat()),d.push(i),f[i].children_d.length&&(d=d.concat(f[i].children_d));for(n=0,r=m.parents.length;r>n;n++)f[m.parents[n]].children_d=f[m.parents[n]].children_d.concat(d);s={cnt:p,mod:f,sel:g,par:a,dpc:d,add:c}}else{for(n=0,r=o.length;r>n;n++)i=v(o[n],a,m.parents.concat()),i&&(l.push(i),d.push(i),f[i].children_d.length&&(d=d.concat(f[i].children_d)));for(m.children=l,m.children_d=d,n=0,r=m.parents.length;r>n;n++)f[m.parents[n]].children_d=f[m.parents[n]].children_d.concat(d);s={cnt:p,mod:f,sel:g,par:a,dpc:d,add:c}}return"undefined"!=typeof window&&"undefined"!=typeof window.document?s:void postMessage(s)},l=function(t,i){if(null!==this.element){this._cnt=t.cnt;var r,s=this._model.data;for(r in s)s.hasOwnProperty(r)&&s[r].state&&s[r].state.loading&&t.mod[r]&&(t.mod[r].state.loading=!0);if(this._model.data=t.mod,i){var o,a=t.add,l=t.sel,d=this._data.core.selected.slice();if(s=this._model.data,l.length!==d.length||e.vakata.array_unique(l.concat(d)).length!==l.length){for(r=0,o=l.length;o>r;r++)-1===e.inArray(l[r],a)&&-1===e.inArray(l[r],d)&&(s[l[r]].state.selected=!1);for(r=0,o=d.length;o>r;r++)-1===e.inArray(d[r],l)&&(s[d[r]].state.selected=!0)}}t.add.length&&(this._data.core.selected=this._data.core.selected.concat(t.add)),this.trigger("model",{nodes:t.dpc,parent:t.par}),t.par!==e.jstree.root?(this._node_changed(t.par),this.redraw()):this.redraw(!0),t.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),n.call(this,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+a.toString()],{type:"text/javascript"}))),!this._data.core.working||r?(this._data.core.working=!0,s=new window.Worker(this._wrk),s.onmessage=e.proxy(function(e){l.call(this,e.data,!0);try{s.terminate(),s=null}catch(e){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1},this),o.par?s.postMessage(o):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([t,i,n,!0])}catch(e){l.call(this,a(o),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else l.call(this,a(o),!1)}},_parse_model_from_html:function(i,n,r){r=r?[].concat(r):[],n&&r.unshift(n);var s,o,a,l,d,c=this._model.data,h={id:!1,text:!1,icon:!0,parent:n,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(a in this._model.default_state)this._model.default_state.hasOwnProperty(a)&&(h.state[a]=this._model.default_state[a]);if(l=e.vakata.attributes(i,!0),e.each(l,function(t,i){return i=e.trim(i),!i.length||(h.li_attr[t]=i,void("id"===t&&(h.id=i.toString())))}),l=i.children("a").first(),l.length&&(l=e.vakata.attributes(l,!0),e.each(l,function(t,i){i=e.trim(i),i.length&&(h.a_attr[t]=i)})),l=i.children("a").first().length?i.children("a").first().clone():i.clone(),l.children("ins, i, ul").remove(),l=l.html(),l=e("<div />").html(l),h.text=this.settings.core.force_text?l.text():l.html(),l=i.data(),h.data=l?e.extend(!0,{},l):null,h.state.opened=i.hasClass("jstree-open"),h.state.selected=i.children("a").hasClass("jstree-clicked"),h.state.disabled=i.children("a").hasClass("jstree-disabled"),h.data&&h.data.jstree)for(a in h.data.jstree)h.data.jstree.hasOwnProperty(a)&&(h.state[a]=h.data.jstree[a]);l=i.children("a").children(".jstree-themeicon"),l.length&&(h.icon=!l.hasClass("jstree-themeicon-hidden")&&l.attr("rel")),h.state.icon!==t&&(h.icon=h.state.icon),(h.icon===t||null===h.icon||""===h.icon)&&(h.icon=!0),l=i.children("ul").children("li");do d="j"+this._id+"_"+ ++this._cnt;while(c[d]);return h.id=h.li_attr.id?h.li_attr.id.toString():d,l.length?(l.each(e.proxy(function(t,i){s=this._parse_model_from_html(e(i),h.id,r),o=this._model.data[s],h.children.push(s),o.children_d.length&&(h.children_d=h.children_d.concat(o.children_d))},this)),h.children_d=h.children_d.concat(h.children)):i.hasClass("jstree-closed")&&(h.state.loaded=!1),h.li_attr.class&&(h.li_attr.class=h.li_attr.class.replace("jstree-closed","").replace("jstree-open","")),h.a_attr.class&&(h.a_attr.class=h.a_attr.class.replace("jstree-clicked","").replace("jstree-disabled","")),c[h.id]=h,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_flat_json:function(e,i,n){n=n?n.concat():[],i&&n.unshift(i);var r,s,o,a,l=e.id.toString(),d=this._model.data,c=this._model.default_state,h={id:l,text:e.text||"",icon:e.icon===t||e.icon,parent:i,parents:n,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(r in c)c.hasOwnProperty(r)&&(h.state[r]=c[r]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(h.icon=e.data.jstree.icon),(h.icon===t||null===h.icon||""===h.icon)&&(h.icon=!0),e&&e.data&&(h.data=e.data,e.data.jstree))for(r in e.data.jstree)e.data.jstree.hasOwnProperty(r)&&(h.state[r]=e.data.jstree[r]);if(e&&"object"==typeof e.state)for(r in e.state)e.state.hasOwnProperty(r)&&(h.state[r]=e.state[r]);if(e&&"object"==typeof e.li_attr)for(r in e.li_attr)e.li_attr.hasOwnProperty(r)&&(h.li_attr[r]=e.li_attr[r]);if(h.li_attr.id||(h.li_attr.id=l),e&&"object"==typeof e.a_attr)for(r in e.a_attr)e.a_attr.hasOwnProperty(r)&&(h.a_attr[r]=e.a_attr[r]);for(e&&e.children&&e.children===!0&&(h.state.loaded=!1,h.children=[],h.children_d=[]),d[h.id]=h,r=0,s=h.children.length;s>r;r++)o=this._parse_model_from_flat_json(d[h.children[r]],h.id,n),a=d[o],h.children_d.push(o),a.children_d.length&&(h.children_d=h.children_d.concat(a.children_d));return delete e.data,delete e.children,d[h.id].original=e,h.state.selected&&this._data.core.selected.push(h.id),h.id},_parse_model_from_json:function(e,i,n){n=n?n.concat():[],i&&n.unshift(i);var r,s,o,a,l,d=!1,c=this._model.data,h=this._model.default_state;do d="j"+this._id+"_"+ ++this._cnt;while(c[d]);l={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===t||e.icon,parent:i,parents:n,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(r in h)h.hasOwnProperty(r)&&(l.state[r]=h[r]);if(e&&e.id&&(l.id=e.id.toString()),e&&e.text&&(l.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(l.icon=e.data.jstree.icon),(l.icon===t||null===l.icon||""===l.icon)&&(l.icon=!0),e&&e.data&&(l.data=e.data,e.data.jstree))for(r in e.data.jstree)e.data.jstree.hasOwnProperty(r)&&(l.state[r]=e.data.jstree[r]);if(e&&"object"==typeof e.state)for(r in e.state)e.state.hasOwnProperty(r)&&(l.state[r]=e.state[r]);if(e&&"object"==typeof e.li_attr)for(r in e.li_attr)e.li_attr.hasOwnProperty(r)&&(l.li_attr[r]=e.li_attr[r]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=d),l.li_attr.id||(l.li_attr.id=l.id),e&&"object"==typeof e.a_attr)for(r in e.a_attr)e.a_attr.hasOwnProperty(r)&&(l.a_attr[r]=e.a_attr[r]);if(e&&e.children&&e.children.length){for(r=0,s=e.children.length;s>r;r++)o=this._parse_model_from_json(e.children[r],l.id,n),a=c[o],l.children.push(o),a.children_d.length&&(l.children_d=l.children_d.concat(a.children_d));l.children_d=l.children_d.concat(l.children)}return e&&e.children&&e.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete e.data,delete e.children,l.original=e,c[l.id]=l,l.state.selected&&this._data.core.selected.push(l.id),l.id},_redraw:function(){var t,i,n,r=this._model.force_full_redraw?this._model.data[e.jstree.root].children.concat([]):this._model.changed.concat([]),s=c.createElement("UL"),o=this._data.core.focused;for(i=0,n=r.length;n>i;i++)t=this.redraw_node(r[i],!0,this._model.force_full_redraw),t&&this._model.force_full_redraw&&s.appendChild(t);this._model.force_full_redraw&&(s.className=this.get_container_ul()[0].className,s.setAttribute("role","group"),this.element.empty().append(s)),null!==o&&(t=this.get_node(o,!0),t&&t.length&&t.children(".jstree-anchor")[0]!==c.activeElement?t.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:r})},redraw:function(e){e&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(t){var i=this.get_node(t),n=!1,r=!1,s=!1,o=c;if(!i)return!1;if(i.id===e.jstree.root)return this.redraw(!0);if(t=this.get_node(t,!0),!t||!t.length)return!1;if(t.children(".jstree-children").remove(),t=t[0],i.children.length&&i.state.loaded){for(s=o.createElement("UL"),s.setAttribute("role","group"),s.className="jstree-children",n=0,r=i.children.length;r>n;n++)s.appendChild(this.redraw_node(i.children[n],!0,!0));t.appendChild(s)}},redraw_node:function(t,i,n,r){var s=this.get_node(t),o=!1,a=!1,l=!1,d=!1,u=!1,p=!1,f="",m=c,g=this._model.data,_=!1,v=null,y=0,w=0,b=!1,T=!1;if(!s)return!1;if(s.id===e.jstree.root)return this.redraw(!0);if(i=i||0===s.children.length,t=c.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(s.id[0])?"\\3"+s.id[0]+" "+s.id.substr(1).replace(e.jstree.idregex,"\\$&"):s.id.replace(e.jstree.idregex,"\\$&"))):c.getElementById(s.id))t=e(t),n||(o=t.parent().parent()[0],o===this.element[0]&&(o=null),a=t.index()),i||!s.children.length||t.children(".jstree-children").length||(i=!0),i||(l=t.children(".jstree-children")[0]),_=t.children(".jstree-anchor")[0]===c.activeElement,t.remove();else if(i=!0,!n){if(o=s.parent!==e.jstree.root?e("#"+s.parent.replace(e.jstree.idregex,"\\$&"),this.element)[0]:null,!(null===o||o&&g[s.parent].state.opened))return!1;a=e.inArray(s.id,null===o?g[e.jstree.root].children:g[s.parent].children)}t=h.cloneNode(!0),f="jstree-node ";for(d in s.li_attr)if(s.li_attr.hasOwnProperty(d)){if("id"===d)continue;"class"!==d?t.setAttribute(d,s.li_attr[d]):f+=s.li_attr[d]}for(s.a_attr.id||(s.a_attr.id=s.id+"_anchor"),t.setAttribute("aria-selected",!!s.state.selected),t.setAttribute("aria-level",s.parents.length),t.setAttribute("aria-labelledby",s.a_attr.id),s.state.disabled&&t.setAttribute("aria-disabled",!0),d=0,u=s.children.length;u>d;d++)if(!g[s.children[d]].state.hidden){b=!0;break}if(null!==s.parent&&g[s.parent]&&!s.state.hidden&&(d=e.inArray(s.id,g[s.parent].children),T=s.id,-1!==d))for(d++,u=g[s.parent].children.length;u>d&&(g[g[s.parent].children[d]].state.hidden||(T=g[s.parent].children[d]),T===s.id);d++);s.state.hidden&&(f+=" jstree-hidden"),s.state.loaded&&!b?f+=" jstree-leaf":(f+=s.state.opened&&s.state.loaded?" jstree-open":" jstree-closed",t.setAttribute("aria-expanded",s.state.opened&&s.state.loaded)),T===s.id&&(f+=" jstree-last"),t.id=s.id,t.className=f,f=(s.state.selected?" jstree-clicked":"")+(s.state.disabled?" jstree-disabled":"");for(u in s.a_attr)if(s.a_attr.hasOwnProperty(u)){if("href"===u&&"#"===s.a_attr[u])continue;"class"!==u?t.childNodes[1].setAttribute(u,s.a_attr[u]):f+=" "+s.a_attr[u]}if(f.length&&(t.childNodes[1].className="jstree-anchor "+f),(s.icon&&s.icon!==!0||s.icon===!1)&&(s.icon===!1?t.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===s.icon.indexOf("/")&&-1===s.icon.indexOf(".")?t.childNodes[1].childNodes[0].className+=" "+s.icon+" jstree-themeicon-custom":(t.childNodes[1].childNodes[0].style.backgroundImage='url("'+s.icon+'")',t.childNodes[1].childNodes[0].style.backgroundPosition="center center",t.childNodes[1].childNodes[0].style.backgroundSize="auto",t.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?t.childNodes[1].appendChild(m.createTextNode(s.text)):t.childNodes[1].innerHTML+=s.text,i&&s.children.length&&(s.state.opened||r)&&s.state.loaded){for(p=m.createElement("UL"),p.setAttribute("role","group"),p.className="jstree-children",d=0,u=s.children.length;u>d;d++)p.appendChild(this.redraw_node(s.children[d],i,!0));t.appendChild(p)}if(l&&t.appendChild(l),!n){for(o||(o=this.element[0]),d=0,u=o.childNodes.length;u>d;d++)if(o.childNodes[d]&&o.childNodes[d].className&&-1!==o.childNodes[d].className.indexOf("jstree-children")){v=o.childNodes[d];break}v||(v=m.createElement("UL"),v.setAttribute("role","group"),v.className="jstree-children",o.appendChild(v)),o=v,a<o.childNodes.length?o.insertBefore(t,o.childNodes[a]):o.appendChild(t),_&&(y=this.element[0].scrollTop,w=this.element[0].scrollLeft,t.childNodes[1].focus(),this.element[0].scrollTop=y,this.element[0].scrollLeft=w)}return s.state.opened&&!s.state.loaded&&(s.state.opened=!1,setTimeout(e.proxy(function(){this.open_node(s.id,!1,0)},this),0)),t},open_node:function(i,n,r){var s,o,a,l;if(e.isArray(i)){for(i=i.slice(),s=0,o=i.length;o>s;s++)this.open_node(i[s],n,r);return!0}return i=this.get_node(i),!(!i||i.id===e.jstree.root)&&(r=r===t?this.settings.core.animation:r,this.is_closed(i)?this.is_loaded(i)?(a=this.get_node(i,!0),l=this,a.length&&(r&&a.children(".jstree-children").length&&a.children(".jstree-children").stop(!0,!0),i.children.length&&!this._firstChild(a.children(".jstree-children")[0])&&this.draw_children(i),r?(this.trigger("before_open",{node:i}),a.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-children").stop(!0,!0).slideDown(r,function(){this.style.display="",l.element&&l.trigger("after_open",{node:i})})):(this.trigger("before_open",{node:i}),a[0].className=a[0].className.replace("jstree-closed","jstree-open"),a[0].setAttribute("aria-expanded",!0))),i.state.opened=!0,n&&n.call(this,i,!0),a.length||this.trigger("before_open",{node:i}),this.trigger("open_node",{node:i}),r&&a.length||this.trigger("after_open",{node:i}),!0):this.is_loading(i)?setTimeout(e.proxy(function(){this.open_node(i,n,r)},this),500):void this.load_node(i,function(e,t){return t?this.open_node(e,n,r):!!n&&n.call(this,e,!1)}):(n&&n.call(this,i,!1),!1))},_open_to:function(t){if(t=this.get_node(t),!t||t.id===e.jstree.root)return!1;var i,n,r=t.parents;for(i=0,n=r.length;n>i;i+=1)i!==e.jstree.root&&this.open_node(r[i],!1,0);return e("#"+t.id.replace(e.jstree.idregex,"\\$&"),this.element)},close_node:function(i,n){var r,s,o,a;if(e.isArray(i)){for(i=i.slice(),r=0,s=i.length;s>r;r++)this.close_node(i[r],n);return!0}return i=this.get_node(i),!(!i||i.id===e.jstree.root)&&(!this.is_closed(i)&&(n=n===t?this.settings.core.animation:n,o=this,a=this.get_node(i,!0),i.state.opened=!1,this.trigger("close_node",{node:i}),void(a.length?n?a.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children(".jstree-children").stop(!0,!0).slideUp(n,function(){this.style.display="",a.children(".jstree-children").remove(),o.element&&o.trigger("after_close",{node:i})}):(a[0].className=a[0].className.replace("jstree-open","jstree-closed"),a.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:i})):this.trigger("after_close",{node:i}))))},toggle_node:function(t){var i,n;if(e.isArray(t)){for(t=t.slice(),i=0,n=t.length;n>i;i++)this.toggle_node(t[i]);return!0}return this.is_closed(t)?this.open_node(t):this.is_open(t)?this.close_node(t):void 0},open_all:function(t,i,n){if(t||(t=e.jstree.root),t=this.get_node(t),!t)return!1;var r,s,o,a=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0);if(!a.length){for(r=0,s=t.children_d.length;s>r;r++)this.is_closed(this._model.data[t.children_d[r]])&&(this._model.data[t.children_d[r]].state.opened=!0);return this.trigger("open_all",{node:t})}n=n||a,o=this,a=this.is_closed(t)?a.find(".jstree-closed").addBack():a.find(".jstree-closed"),a.each(function(){o.open_node(this,function(e,t){t&&this.is_parent(e)&&this.open_all(e,i,n)},i||0)}),0===n.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(n)})},close_all:function(t,i){if(t||(t=e.jstree.root),t=this.get_node(t),!t)return!1;var n,r,s=t.id===e.jstree.root?this.get_container_ul():this.get_node(t,!0),o=this;for(s.length&&(s=this.is_open(t)?s.find(".jstree-open").addBack():s.find(".jstree-open"),e(s.get().reverse()).each(function(){o.close_node(this,i||0)})),n=0,r=t.children_d.length;r>n;n++)this._model.data[t.children_d[n]].state.opened=!1;this.trigger("close_all",{node:t})},is_disabled:function(e){return e=this.get_node(e),e&&e.state&&e.state.disabled},enable_node:function(t){var i,n;if(e.isArray(t)){for(t=t.slice(),i=0,n=t.length;n>i;i++)this.enable_node(t[i]);return!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&(t.state.disabled=!1,this.get_node(t,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),void this.trigger("enable_node",{node:t}))},disable_node:function(t){var i,n;if(e.isArray(t)){for(t=t.slice(),i=0,n=t.length;n>i;i++)this.disable_node(t[i]);return!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&(t.state.disabled=!0,this.get_node(t,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),void this.trigger("disable_node",{node:t}))},is_hidden:function(e){return e=this.get_node(e),e.state.hidden===!0},hide_node:function(t,i){var n,r;if(e.isArray(t)){for(t=t.slice(),n=0,r=t.length;r>n;n++)this.hide_node(t[n],!0);return i||this.redraw(),!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&void(t.state.hidden||(t.state.hidden=!0,this._node_changed(t.parent),i||this.redraw(),this.trigger("hide_node",{node:t})))},show_node:function(t,i){var n,r;if(e.isArray(t)){for(t=t.slice(),n=0,r=t.length;r>n;n++)this.show_node(t[n],!0);return i||this.redraw(),!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&void(t.state.hidden&&(t.state.hidden=!1,this._node_changed(t.parent),i||this.redraw(),this.trigger("show_node",{node:t})))},hide_all:function(t){var i,n=this._model.data,r=[];for(i in n)n.hasOwnProperty(i)&&i!==e.jstree.root&&!n[i].state.hidden&&(n[i].state.hidden=!0,r.push(i));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("hide_all",{nodes:r}),r},show_all:function(t){var i,n=this._model.data,r=[];for(i in n)n.hasOwnProperty(i)&&i!==e.jstree.root&&n[i].state.hidden&&(n[i].state.hidden=!1,r.push(i));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("show_all",{nodes:r}),r},activate_node:function(e,i){if(this.is_disabled(e))return!1;if(i&&"object"==typeof i||(i={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==t?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(i.metaKey||i.ctrlKey||i.shiftKey)&&(!i.shiftKey||this._data.core.last_clicked&&this.get_parent(e)&&this.get_parent(e)===this._data.core.last_clicked.parent))if(i.shiftKey){var n,r,s=this.get_node(e).id,o=this._data.core.last_clicked.id,a=this.get_node(this._data.core.last_clicked.parent).children,l=!1;for(n=0,r=a.length;r>n;n+=1)a[n]===s&&(l=!l),a[n]===o&&(l=!l),this.is_disabled(a[n])||!l&&a[n]!==s&&a[n]!==o?this.deselect_node(a[n],!0,i):this.is_hidden(a[n])||this.select_node(a[n],!0,!1,i);this.trigger("changed",{
action:"select_node",node:this.get_node(e),selected:this._data.core.selected,event:i})}else this.is_selected(e)?this.deselect_node(e,!1,i):this.select_node(e,!1,!1,i);else!this.settings.core.multiple&&(i.metaKey||i.ctrlKey||i.shiftKey)&&this.is_selected(e)?this.deselect_node(e,!1,i):(this.deselect_all(!0),this.select_node(e,!1,!1,i),this._data.core.last_clicked=this.get_node(e));this.trigger("activate_node",{node:this.get_node(e),event:i})},hover_node:function(e){if(e=this.get_node(e,!0),!e||!e.length||e.children(".jstree-hovered").length)return!1;var t=this.element.find(".jstree-hovered"),i=this.element;t&&t.length&&this.dehover_node(t),e.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(e)}),setTimeout(function(){i.attr("aria-activedescendant",e[0].id)},0)},dehover_node:function(e){return e=this.get_node(e,!0),!!(e&&e.length&&e.children(".jstree-hovered").length)&&(e.children(".jstree-anchor").removeClass("jstree-hovered"),void this.trigger("dehover_node",{node:this.get_node(e)}))},select_node:function(t,i,n,r){var s,o,a;if(e.isArray(t)){for(t=t.slice(),o=0,a=t.length;a>o;o++)this.select_node(t[o],i,n,r);return!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&(s=this.get_node(t,!0),void(t.state.selected||(t.state.selected=!0,this._data.core.selected.push(t.id),n||(s=this._open_to(t)),s&&s.length&&s.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:t,selected:this._data.core.selected,event:r}),i||this.trigger("changed",{action:"select_node",node:t,selected:this._data.core.selected,event:r}))))},deselect_node:function(t,i,n){var r,s,o;if(e.isArray(t)){for(t=t.slice(),r=0,s=t.length;s>r;r++)this.deselect_node(t[r],i,n);return!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&(o=this.get_node(t,!0),void(t.state.selected&&(t.state.selected=!1,this._data.core.selected=e.vakata.array_remove_item(this._data.core.selected,t.id),o.length&&o.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:t,selected:this._data.core.selected,event:n}),i||this.trigger("changed",{action:"deselect_node",node:t,selected:this._data.core.selected,event:n}))))},select_all:function(t){var i,n,r=this._data.core.selected.concat([]);for(this._data.core.selected=this._model.data[e.jstree.root].children_d.concat(),i=0,n=this._data.core.selected.length;n>i;i++)this._model.data[this._data.core.selected[i]]&&(this._model.data[this._data.core.selected[i]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),t||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:r})},deselect_all:function(e){var t,i,n=this._data.core.selected.concat([]);for(t=0,i=this._data.core.selected.length;i>t;t++)this._model.data[this._data.core.selected[t]]&&(this._model.data[this._data.core.selected[t]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").parent().attr("aria-selected",!1),this.trigger("deselect_all",{selected:this._data.core.selected,node:n}),e||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:n})},is_selected:function(t){return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&t.state.selected},get_selected:function(t){return t?e.map(this._data.core.selected,e.proxy(function(e){return this.get_node(e)},this)):this._data.core.selected.slice()},get_top_selected:function(t){var i,n,r,s,o=this.get_selected(!0),a={};for(i=0,n=o.length;n>i;i++)a[o[i].id]=o[i];for(i=0,n=o.length;n>i;i++)for(r=0,s=o[i].children_d.length;s>r;r++)a[o[i].children_d[r]]&&delete a[o[i].children_d[r]];o=[];for(i in a)a.hasOwnProperty(i)&&o.push(i);return t?e.map(o,e.proxy(function(e){return this.get_node(e)},this)):o},get_bottom_selected:function(t){var i,n,r=this.get_selected(!0),s=[];for(i=0,n=r.length;n>i;i++)r[i].children.length||s.push(r[i].id);return t?e.map(s,e.proxy(function(e){return this.get_node(e)},this)):s},get_state:function(){var t,i={core:{open:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}};for(t in this._model.data)this._model.data.hasOwnProperty(t)&&t!==e.jstree.root&&(this._model.data[t].state.opened&&i.core.open.push(t),this._model.data[t].state.selected&&i.core.selected.push(t));return i},set_state:function(i,n){if(i){if(i.core){var r,s;if(i.core.open)return e.isArray(i.core.open)&&i.core.open.length?this._load_nodes(i.core.open,function(e){this.open_node(e,!1,0),delete i.core.open,this.set_state(i,n)}):(delete i.core.open,this.set_state(i,n)),!1;if(i.core.scroll)return i.core.scroll&&i.core.scroll.left!==t&&this.element.scrollLeft(i.core.scroll.left),i.core.scroll&&i.core.scroll.top!==t&&this.element.scrollTop(i.core.scroll.top),delete i.core.scroll,this.set_state(i,n),!1;if(i.core.selected)return r=this,this.deselect_all(),e.each(i.core.selected,function(e,t){r.select_node(t,!1,!0)}),delete i.core.selected,this.set_state(i,n),!1;for(s in i)i.hasOwnProperty(s)&&"core"!==s&&-1===e.inArray(s,this.settings.plugins)&&delete i[s];if(e.isEmptyObject(i.core))return delete i.core,this.set_state(i,n),!1}return!e.isEmptyObject(i)||(i=null,n&&n.call(this),this.trigger("set_state"),!1)}return!1},refresh:function(t,i){this._data.core.state=i===!0?{}:this.get_state(),i&&e.isFunction(i)&&(this._data.core.state=i.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[e.jstree.root]={id:e.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null;var n=this.get_container_ul()[0].className;t||(this.element.html("<ul class='"+n+"' role='group'><li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(e.jstree.root,function(t,i){i&&(this.get_container_ul()[0].className=n,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(e.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")})),this._data.core.state=null})},refresh_node:function(t){if(t=this.get_node(t),!t||t.id===e.jstree.root)return!1;var i=[],n=[],r=this._data.core.selected.concat([]);n.push(t.id),t.state.opened===!0&&i.push(t.id),this.get_node(t,!0).find(".jstree-open").each(function(){n.push(this.id),i.push(this.id)}),this._load_nodes(n,e.proxy(function(e){this.open_node(i,!1,0),this.select_node(r),this.trigger("refresh_node",{node:t,nodes:e})},this),!1,!0)},set_id:function(t,i){if(t=this.get_node(t),!t||t.id===e.jstree.root)return!1;var n,r,s=this._model.data,o=t.id;for(i=i.toString(),s[t.parent].children[e.inArray(t.id,s[t.parent].children)]=i,n=0,r=t.parents.length;r>n;n++)s[t.parents[n]].children_d[e.inArray(t.id,s[t.parents[n]].children_d)]=i;for(n=0,r=t.children.length;r>n;n++)s[t.children[n]].parent=i;for(n=0,r=t.children_d.length;r>n;n++)s[t.children_d[n]].parents[e.inArray(t.id,s[t.children_d[n]].parents)]=i;return n=e.inArray(t.id,this._data.core.selected),-1!==n&&(this._data.core.selected[n]=i),n=this.get_node(t.id,!0),n&&(n.attr("id",i),this.element.attr("aria-activedescendant")===t.id&&this.element.attr("aria-activedescendant",i)),delete s[t.id],t.id=i,t.li_attr.id=i,s[i]=t,this.trigger("set_id",{node:t,new:t.id,old:o}),!0},get_text:function(t){return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&t.text},set_text:function(t,i){var n,r;if(e.isArray(t)){for(t=t.slice(),n=0,r=t.length;r>n;n++)this.set_text(t[n],i);return!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&(t.text=i,this.get_node(t,!0).length&&this.redraw_node(t.id),this.trigger("set_text",{obj:t,text:i}),!0)},get_json:function(t,i,n){if(t=this.get_node(t||e.jstree.root),!t)return!1;i&&i.flat&&!n&&(n=[]);var r,s,o={id:t.id,text:t.text,icon:this.get_icon(t),li_attr:e.extend(!0,{},t.li_attr),a_attr:e.extend(!0,{},t.a_attr),state:{},data:(!i||!i.no_data)&&e.extend(!0,{},t.data)};if(i&&i.flat?o.parent=t.parent:o.children=[],i&&i.no_state)delete o.state;else for(r in t.state)t.state.hasOwnProperty(r)&&(o.state[r]=t.state[r]);if(i&&i.no_li_attr&&delete o.li_attr,i&&i.no_a_attr&&delete o.a_attr,i&&i.no_id&&(delete o.id,o.li_attr&&o.li_attr.id&&delete o.li_attr.id,o.a_attr&&o.a_attr.id&&delete o.a_attr.id),i&&i.flat&&t.id!==e.jstree.root&&n.push(o),!i||!i.no_children)for(r=0,s=t.children.length;s>r;r++)i&&i.flat?this.get_json(t.children[r],i,n):o.children.push(this.get_json(t.children[r],i));return i&&i.flat?n:t.id===e.jstree.root?o.children:o},create_node:function(i,n,r,s,o){if(null===i&&(i=e.jstree.root),i=this.get_node(i),!i)return!1;if(r=r===t?"last":r,!r.toString().match(/^(before|after)$/)&&!o&&!this.is_loaded(i))return this.load_node(i,function(){this.create_node(i,n,r,s,!0)});n||(n={text:this.get_string("New node")}),"string"==typeof n&&(n={text:n}),n.text===t&&(n.text=this.get_string("New node"));var a,l,d,c;switch(i.id===e.jstree.root&&("before"===r&&(r="first"),"after"===r&&(r="last")),r){case"before":a=this.get_node(i.parent),r=e.inArray(i.id,a.children),i=a;break;case"after":a=this.get_node(i.parent),r=e.inArray(i.id,a.children)+1,i=a;break;case"inside":case"first":r=0;break;case"last":r=i.children.length;break;default:r||(r=0)}if(r>i.children.length&&(r=i.children.length),n.id||(n.id=!0),!this.check("create_node",n,i,r))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(n.id===!0&&delete n.id,n=this._parse_model_from_json(n,i.id,i.parents.concat()),!n)return!1;for(a=this.get_node(n),l=[],l.push(n),l=l.concat(a.children_d),this.trigger("model",{nodes:l,parent:i.id}),i.children_d=i.children_d.concat(l),d=0,c=i.parents.length;c>d;d++)this._model.data[i.parents[d]].children_d=this._model.data[i.parents[d]].children_d.concat(l);for(n=a,a=[],d=0,c=i.children.length;c>d;d++)a[d>=r?d+1:d]=i.children[d];return a[r]=n.id,i.children=a,this.redraw_node(i,!0),s&&s.call(this,this.get_node(n)),this.trigger("create_node",{node:this.get_node(n),parent:i.id,position:r}),n.id},rename_node:function(t,i){var n,r,s;if(e.isArray(t)){for(t=t.slice(),n=0,r=t.length;r>n;n++)this.rename_node(t[n],i);return!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&(s=t.text,this.check("rename_node",t,this.get_parent(t),i)?(this.set_text(t,i),this.trigger("rename_node",{node:t,text:i,old:s}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1))},delete_node:function(t){var i,n,r,s,o,a,l,d,c,h,u,p;if(e.isArray(t)){for(t=t.slice(),i=0,n=t.length;n>i;i++)this.delete_node(t[i]);return!0}if(t=this.get_node(t),!t||t.id===e.jstree.root)return!1;if(r=this.get_node(t.parent),s=e.inArray(t.id,r.children),h=!1,!this.check("delete_node",t,r,s))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==s&&(r.children=e.vakata.array_remove(r.children,s)),o=t.children_d.concat([]),o.push(t.id),a=0,l=t.parents.length;l>a;a++)this._model.data[t.parents[a]].children_d=e.vakata.array_filter(this._model.data[t.parents[a]].children_d,function(t){return-1===e.inArray(t,o)});for(d=0,c=o.length;c>d;d++)if(this._model.data[o[d]].state.selected){h=!0;break}for(h&&(this._data.core.selected=e.vakata.array_filter(this._data.core.selected,function(t){return-1===e.inArray(t,o)})),this.trigger("delete_node",{node:t,parent:r.id}),h&&this.trigger("changed",{action:"delete_node",node:t,selected:this._data.core.selected,parent:r.id}),d=0,c=o.length;c>d;d++)delete this._model.data[o[d]];return-1!==e.inArray(this._data.core.focused,o)&&(this._data.core.focused=null,u=this.element[0].scrollTop,p=this.element[0].scrollLeft,r.id===e.jstree.root?this._model.data[e.jstree.root].children[0]&&this.get_node(this._model.data[e.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(r,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=u,this.element[0].scrollLeft=p),this.redraw_node(r,!0),!0},check:function(t,i,n,r,s){i=i&&i.id?i:this.get_node(i),n=n&&n.id?n:this.get_node(n);var o=t.match(/^move_node|copy_node|create_node$/i)?n:i,a=this.settings.core.check_callback;return"move_node"!==t&&"copy_node"!==t||s&&s.is_multi||i.id!==n.id&&("move_node"!==t||e.inArray(i.id,n.children)!==r)&&-1===e.inArray(n.id,i.children_d)?(o&&o.data&&(o=o.data),o&&o.functions&&(o.functions[t]===!1||o.functions[t]===!0)?(o.functions[t]===!1&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+t,data:JSON.stringify({chk:t,pos:r,obj:!(!i||!i.id)&&i.id,par:!(!n||!n.id)&&n.id})}),o.functions[t]):!(a===!1||e.isFunction(a)&&a.call(this,t,i,n,r,s)===!1||a&&a[t]===!1)||(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+t,data:JSON.stringify({chk:t,pos:r,obj:!(!i||!i.id)&&i.id,par:!(!n||!n.id)&&n.id})},!1)):(this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:t,pos:r,obj:!(!i||!i.id)&&i.id,par:!(!n||!n.id)&&n.id})},!1)},last_error:function(){return this._data.core.last_error},move_node:function(i,n,r,s,o,a,l){var d,c,h,u,p,f,m,g,_,v,y,w,b,T;if(n=this.get_node(n),r=r===t?0:r,!n)return!1;if(!r.toString().match(/^(before|after)$/)&&!o&&!this.is_loaded(n))return this.load_node(n,function(){this.move_node(i,n,r,s,!0,!1,l)});if(e.isArray(i)){if(1!==i.length){for(d=0,c=i.length;c>d;d++)(_=this.move_node(i[d],n,r,s,o,!1,l))&&(n=_,r="after");return this.redraw(),!0}i=i[0]}if(i=i&&i.id?i:this.get_node(i),!i||i.id===e.jstree.root)return!1;if(h=(i.parent||e.jstree.root).toString(),p=r.toString().match(/^(before|after)$/)&&n.id!==e.jstree.root?this.get_node(n.parent):n,f=l?l:this._model.data[i.id]?this:e.jstree.reference(i.id),m=!f||!f._id||this._id!==f._id,u=f&&f._id&&h&&f._model.data[h]&&f._model.data[h].children?e.inArray(i.id,f._model.data[h].children):-1,f&&f._id&&(i=f._model.data[i.id]),m)return!!(_=this.copy_node(i,n,r,s,o,!1,l))&&(f&&f.delete_node(i),_);switch(n.id===e.jstree.root&&("before"===r&&(r="first"),"after"===r&&(r="last")),r){case"before":r=e.inArray(n.id,p.children);break;case"after":r=e.inArray(n.id,p.children)+1;break;case"inside":case"first":r=0;break;case"last":r=p.children.length;break;default:r||(r=0)}if(r>p.children.length&&(r=p.children.length),!this.check("move_node",i,p,r,{core:!0,origin:l,is_multi:f&&f._id&&f._id!==this._id,is_foreign:!f||!f._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(i.parent===p.id){for(g=p.children.concat(),_=e.inArray(i.id,g),-1!==_&&(g=e.vakata.array_remove(g,_),r>_&&r--),_=[],v=0,y=g.length;y>v;v++)_[v>=r?v+1:v]=g[v];_[r]=i.id,p.children=_,this._node_changed(p.id),this.redraw(p.id===e.jstree.root)}else{for(_=i.children_d.concat(),_.push(i.id),v=0,y=i.parents.length;y>v;v++){for(g=[],T=f._model.data[i.parents[v]].children_d,w=0,b=T.length;b>w;w++)-1===e.inArray(T[w],_)&&g.push(T[w]);f._model.data[i.parents[v]].children_d=g}for(f._model.data[h].children=e.vakata.array_remove_item(f._model.data[h].children,i.id),v=0,y=p.parents.length;y>v;v++)this._model.data[p.parents[v]].children_d=this._model.data[p.parents[v]].children_d.concat(_);for(g=[],v=0,y=p.children.length;y>v;v++)g[v>=r?v+1:v]=p.children[v];for(g[r]=i.id,p.children=g,p.children_d.push(i.id),p.children_d=p.children_d.concat(i.children_d),i.parent=p.id,_=p.parents.concat(),_.unshift(p.id),T=i.parents.length,i.parents=_,_=_.concat(),v=0,y=i.children_d.length;y>v;v++)this._model.data[i.children_d[v]].parents=this._model.data[i.children_d[v]].parents.slice(0,-1*T),Array.prototype.push.apply(this._model.data[i.children_d[v]].parents,_);(h===e.jstree.root||p.id===e.jstree.root)&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(h),this._node_changed(p.id)),a||this.redraw()}return s&&s.call(this,i,p,r),this.trigger("move_node",{node:i,parent:p.id,position:r,old_parent:h,old_position:u,is_multi:f&&f._id&&f._id!==this._id,is_foreign:!f||!f._id,old_instance:f,new_instance:this}),i.id},copy_node:function(i,n,r,s,o,a,l){var d,c,h,u,p,f,m,g,_,v,y;if(n=this.get_node(n),r=r===t?0:r,!n)return!1;if(!r.toString().match(/^(before|after)$/)&&!o&&!this.is_loaded(n))return this.load_node(n,function(){this.copy_node(i,n,r,s,!0,!1,l)});if(e.isArray(i)){if(1!==i.length){for(d=0,c=i.length;c>d;d++)(u=this.copy_node(i[d],n,r,s,o,!0,l))&&(n=u,r="after");return this.redraw(),!0}i=i[0]}if(i=i&&i.id?i:this.get_node(i),!i||i.id===e.jstree.root)return!1;switch(g=(i.parent||e.jstree.root).toString(),_=r.toString().match(/^(before|after)$/)&&n.id!==e.jstree.root?this.get_node(n.parent):n,v=l?l:this._model.data[i.id]?this:e.jstree.reference(i.id),y=!v||!v._id||this._id!==v._id,v&&v._id&&(i=v._model.data[i.id]),n.id===e.jstree.root&&("before"===r&&(r="first"),"after"===r&&(r="last")),r){case"before":r=e.inArray(n.id,_.children);break;case"after":r=e.inArray(n.id,_.children)+1;break;case"inside":case"first":r=0;break;case"last":r=_.children.length;break;default:r||(r=0)}if(r>_.children.length&&(r=_.children.length),!this.check("copy_node",i,_,r,{core:!0,origin:l,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(m=v?v.get_json(i,{no_id:!0,no_data:!0,no_state:!0}):i,!m)return!1;if(m.id===!0&&delete m.id,m=this._parse_model_from_json(m,_.id,_.parents.concat()),!m)return!1;for(u=this.get_node(m),i&&i.state&&i.state.loaded===!1&&(u.state.loaded=!1),h=[],h.push(m),h=h.concat(u.children_d),this.trigger("model",{nodes:h,parent:_.id}),p=0,f=_.parents.length;f>p;p++)this._model.data[_.parents[p]].children_d=this._model.data[_.parents[p]].children_d.concat(h);for(h=[],p=0,f=_.children.length;f>p;p++)h[p>=r?p+1:p]=_.children[p];return h[r]=u.id,_.children=h,_.children_d.push(u.id),_.children_d=_.children_d.concat(u.children_d),_.id===e.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(_.id),a||this.redraw(_.id===e.jstree.root),s&&s.call(this,u,_,r),this.trigger("copy_node",{node:u,original:i,parent:_.id,position:r,old_parent:g,old_position:v&&v._id&&g&&v._model.data[g]&&v._model.data[g].children?e.inArray(i.id,v._model.data[g].children):-1,is_multi:v&&v._id&&v._id!==this._id,is_foreign:!v||!v._id,old_instance:v,new_instance:this}),u.id},cut:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1;var i,n,r,l=[];for(n=0,r=t.length;r>n;n++)i=this.get_node(t[n]),i&&i.id&&i.id!==e.jstree.root&&l.push(i);return!!l.length&&(s=l,a=this,o="move_node",void this.trigger("cut",{node:t}))},copy:function(t){if(t||(t=this._data.core.selected.concat()),e.isArray(t)||(t=[t]),!t.length)return!1;var i,n,r,l=[];for(n=0,r=t.length;r>n;n++)i=this.get_node(t[n]),i&&i.id&&i.id!==e.jstree.root&&l.push(i);return!!l.length&&(s=l,a=this,o="copy_node",void this.trigger("copy",{node:t}))},get_buffer:function(){return{mode:o,node:s,inst:a}},can_paste:function(){return o!==!1&&s!==!1},paste:function(e,t){return e=this.get_node(e),!!(e&&o&&o.match(/^(copy_node|move_node)$/)&&s)&&(this[o](s,e,t,!1,!1,!1,a)&&this.trigger("paste",{parent:e.id,node:s,mode:o}),s=!1,o=!1,void(a=!1))},clear_buffer:function(){s=!1,o=!1,a=!1,this.trigger("clear_buffer")},edit:function(t,i,n){var r,s,o,a,l,d,h,u,p,f=!1;return!!(t=this.get_node(t))&&(this.settings.core.check_callback===!1?(this._data.core.last_error={error:"check",plugin:"core",id:"core_07",reason:"Could not edit node because of check_callback"},this.settings.core.error.call(this,this._data.core.last_error),!1):(p=t,i="string"==typeof i?i:t.text,this.set_text(t,""),t=this._open_to(t),p.text=i,r=this._data.core.rtl,s=this.element.width(),this._data.core.focused=p.id,o=t.children(".jstree-anchor").focus(),a=e("<span>"),l=i,d=e("<div />",{css:{position:"absolute",top:"-200px",left:r?"0px":"-1000px",visibility:"hidden"}}).appendTo("body"),h=e("<input />",{value:l,class:"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:e.proxy(function(i){i.stopImmediatePropagation(),i.preventDefault();var r,s=a.children(".jstree-rename-input"),c=s.val(),u=this.settings.core.force_text;""===c&&(c=l),d.remove(),a.replaceWith(o),a.remove(),l=u?l:e("<div></div>").append(e.parseHTML(l)).html(),this.set_text(t,l),r=!!this.rename_node(t,u?e("<div></div>").text(c).text():e("<div></div>").append(e.parseHTML(c)).html()),r||this.set_text(t,l),this._data.core.focused=p.id,setTimeout(e.proxy(function(){var e=this.get_node(p.id,!0);e.length&&(this._data.core.focused=p.id,e.children(".jstree-anchor").focus())},this),0),n&&n.call(this,p,r,f),h=null},this),keydown:function(e){var t=e.which;27===t&&(f=!0,this.value=l),(27===t||13===t||37===t||38===t||39===t||40===t||32===t)&&e.stopImmediatePropagation(),(27===t||13===t)&&(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){h.width(Math.min(d.text("pW"+this.value).width(),s))},keypress:function(e){return 13!==e.which&&void 0}}),u={fontFamily:o.css("fontFamily")||"",fontSize:o.css("fontSize")||"",fontWeight:o.css("fontWeight")||"",fontStyle:o.css("fontStyle")||"",fontStretch:o.css("fontStretch")||"",fontVariant:o.css("fontVariant")||"",letterSpacing:o.css("letterSpacing")||"",wordSpacing:o.css("wordSpacing")||""},a.attr("class",o.attr("class")).append(o.contents().clone()).append(h),o.replaceWith(a),d.css(u),h.css(u).width(Math.min(d.text("pW"+h[0].value).width(),s))[0].select(),void e(c).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(t){h&&t.target!==h&&e(h).blur()})))},set_theme:function(t,i){if(!t)return!1;if(i===!0){var n=this.settings.core.themes.dir;n||(n=e.jstree.path+"/themes"),i=n+"/"+t+"/style.css"}i&&-1===e.inArray(i,l)&&(e("head").append('<link rel="stylesheet" href="'+i+'" type="text/css" />'),l.push(i)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=t,this.element.addClass("jstree-"+t),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+t+"-responsive"),this.trigger("set_theme",{theme:t})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(e){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=e,e&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},set_icon:function(i,n){var r,s,o,a;if(e.isArray(i)){for(i=i.slice(),r=0,s=i.length;s>r;r++)this.set_icon(i[r],n);return!0}return i=this.get_node(i),!(!i||i.id===e.jstree.root)&&(a=i.icon,i.icon=n===!0||null===n||n===t||""===n||n,o=this.get_node(i,!0).children(".jstree-anchor").children(".jstree-themeicon"),n===!1?this.hide_icon(i):n===!0||null===n||n===t||""===n?(o.removeClass("jstree-themeicon-custom "+a).css("background","").removeAttr("rel"),a===!1&&this.show_icon(i)):-1===n.indexOf("/")&&-1===n.indexOf(".")?(o.removeClass(a).css("background",""),o.addClass(n+" jstree-themeicon-custom").attr("rel",n),a===!1&&this.show_icon(i)):(o.removeClass(a).css("background",""),o.addClass("jstree-themeicon-custom").css("background","url('"+n+"') center center no-repeat").attr("rel",n),a===!1&&this.show_icon(i)),!0)},get_icon:function(t){return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&t.icon},hide_icon:function(t){var i,n;if(e.isArray(t)){for(t=t.slice(),i=0,n=t.length;n>i;i++)this.hide_icon(t[i]);return!0}return t=this.get_node(t),!(!t||t===e.jstree.root)&&(t.icon=!1,this.get_node(t,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0)},show_icon:function(t){var i,n,r;if(e.isArray(t)){for(t=t.slice(),i=0,n=t.length;n>i;i++)this.show_icon(t[i]);return!0}return t=this.get_node(t),!(!t||t===e.jstree.root)&&(r=this.get_node(t,!0),t.icon=!r.length||r.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"),t.icon||(t.icon=!0),r.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0)}},e.vakata={},e.vakata.attributes=function(t,i){t=e(t)[0];var n=i?{}:[];return t&&t.attributes&&e.each(t.attributes,function(t,r){-1===e.inArray(r.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==r.value&&""!==e.trim(r.value)&&(i?n[r.name]=r.value:n.push(r.name))}),n},e.vakata.array_unique=function(e){var i,n,r=[],s={};for(i=0,n=e.length;n>i;i++)s[e[i]]===t&&(r.push(e[i]),s[e[i]]=!0);return r},e.vakata.array_remove=function(e,t){return e.splice(t,1),e},e.vakata.array_remove_item=function(t,i){var n=e.inArray(i,t);return-1!==n?e.vakata.array_remove(t,n):t},e.vakata.array_filter=function(e,t,i,n,r){if(e.filter)return e.filter(t,i);n=[];for(r in e)~~r+""==r+""&&r>=0&&t.call(i,e[r],+r,e)&&n.push(e[r]);return n},e.jstree.plugins.changed=function(e,t){var i=[];this.trigger=function(e,n){var r,s;if(n||(n={}),"changed"===e.replace(".jstree","")){n.changed={selected:[],deselected:[]};var o={};for(r=0,s=i.length;s>r;r++)o[i[r]]=1;for(r=0,s=n.selected.length;s>r;r++)o[n.selected[r]]?o[n.selected[r]]=2:n.changed.selected.push(n.selected[r]);for(r=0,s=i.length;s>r;r++)1===o[i[r]]&&n.changed.deselected.push(i[r]);i=n.selected.slice()}t.trigger.call(this,e,n)},this.refresh=function(e,n){return i=[],t.refresh.apply(this,arguments)}};var u=c.createElement("I");u.className="jstree-icon jstree-checkbox",u.setAttribute("role","presentation"),e.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0},e.jstree.plugins.checkbox=function(i,n){this.bind=function(){n.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",e.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")},this)).on("loading.jstree",e.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",e.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)},this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",e.proxy(function(e,t){var i,n,r=this._model.data,s=(r[t.parent],t.nodes);for(i=0,n=s.length;n>i;i++)r[s[i]].state.checked=r[s[i]].state.checked||r[s[i]].original&&r[s[i]].original.state&&r[s[i]].original.state.checked,r[s[i]].state.checked&&this._data.checkbox.selected.push(s[i])},this)),(-1!==this.settings.checkbox.cascade.indexOf("up")||-1!==this.settings.checkbox.cascade.indexOf("down"))&&this.element.on("model.jstree",e.proxy(function(t,i){var n,r,s,o,a,l,d=this._model.data,c=d[i.parent],h=i.nodes,u=[],p=this.settings.checkbox.cascade,f=this.settings.checkbox.tie_selection;if(-1!==p.indexOf("down"))if(c.state[f?"selected":"checked"]){for(r=0,s=h.length;s>r;r++)d[h[r]].state[f?"selected":"checked"]=!0;this._data[f?"core":"checkbox"].selected=this._data[f?"core":"checkbox"].selected.concat(h)}else for(r=0,s=h.length;s>r;r++)if(d[h[r]].state[f?"selected":"checked"]){for(o=0,a=d[h[r]].children_d.length;a>o;o++)d[d[h[r]].children_d[o]].state[f?"selected":"checked"]=!0;this._data[f?"core":"checkbox"].selected=this._data[f?"core":"checkbox"].selected.concat(d[h[r]].children_d)}if(-1!==p.indexOf("up")){for(r=0,s=c.children_d.length;s>r;r++)d[c.children_d[r]].children.length||u.push(d[c.children_d[r]].parent);for(u=e.vakata.array_unique(u),o=0,a=u.length;a>o;o++)for(c=d[u[o]];c&&c.id!==e.jstree.root;){for(n=0,r=0,s=c.children.length;s>r;r++)n+=d[c.children[r]].state[f?"selected":"checked"];if(n!==s)break;c.state[f?"selected":"checked"]=!0,this._data[f?"core":"checkbox"].selected.push(c.id),l=this.get_node(c,!0),l&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(f?"jstree-clicked":"jstree-checked"),c=this.get_node(c.parent)}}this._data[f?"core":"checkbox"].selected=e.vakata.array_unique(this._data[f?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",e.proxy(function(t,i){var n,r,s,o,a=i.node,l=this._model.data,d=this.get_node(a.parent),c=this.get_node(a,!0),h=this.settings.checkbox.cascade,u=this.settings.checkbox.tie_selection,p={},f=this._data[u?"core":"checkbox"].selected;for(n=0,r=f.length;r>n;n++)p[f[n]]=!0;if(-1!==h.indexOf("down"))for(n=0,r=a.children_d.length;r>n;n++)p[a.children_d[n]]=!0,o=l[a.children_d[n]],o.state[u?"selected":"checked"]=!0,o&&o.original&&o.original.state&&o.original.state.undetermined&&(o.original.state.undetermined=!1);if(-1!==h.indexOf("up"))for(;d&&d.id!==e.jstree.root;){for(s=0,n=0,r=d.children.length;r>n;n++)s+=l[d.children[n]].state[u?"selected":"checked"];if(s!==r)break;d.state[u?"selected":"checked"]=!0,p[d.id]=!0,o=this.get_node(d,!0),o&&o.length&&o.attr("aria-selected",!0).children(".jstree-anchor").addClass(u?"jstree-clicked":"jstree-checked"),d=this.get_node(d.parent)}f=[];for(n in p)p.hasOwnProperty(n)&&f.push(n);this._data[u?"core":"checkbox"].selected=f,-1!==h.indexOf("down")&&c.length&&c.find(".jstree-anchor").addClass(u?"jstree-clicked":"jstree-checked").parent().attr("aria-selected",!0)},this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",e.proxy(function(t,i){var n,r,s,o=this.get_node(e.jstree.root),a=this._model.data;for(n=0,r=o.children_d.length;r>n;n++)s=a[o.children_d[n]],s&&s.original&&s.original.state&&s.original.state.undetermined&&(s.original.state.undetermined=!1)},this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",e.proxy(function(t,i){var n,r,s,o=i.node,a=this.get_node(o,!0),l=this.settings.checkbox.cascade,d=this.settings.checkbox.tie_selection,c=this._data[d?"core":"checkbox"].selected,h={};if(o&&o.original&&o.original.state&&o.original.state.undetermined&&(o.original.state.undetermined=!1),-1!==l.indexOf("down"))for(n=0,r=o.children_d.length;r>n;n++)s=this._model.data[o.children_d[n]],
s.state[d?"selected":"checked"]=!1,s&&s.original&&s.original.state&&s.original.state.undetermined&&(s.original.state.undetermined=!1);if(-1!==l.indexOf("up"))for(n=0,r=o.parents.length;r>n;n++)s=this._model.data[o.parents[n]],s.state[d?"selected":"checked"]=!1,s&&s.original&&s.original.state&&s.original.state.undetermined&&(s.original.state.undetermined=!1),s=this.get_node(o.parents[n],!0),s&&s.length&&s.attr("aria-selected",!1).children(".jstree-anchor").removeClass(d?"jstree-clicked":"jstree-checked");for(h={},n=0,r=c.length;r>n;n++)-1!==l.indexOf("down")&&-1!==e.inArray(c[n],o.children_d)||-1!==l.indexOf("up")&&-1!==e.inArray(c[n],o.parents)||(h[c[n]]=!0);c=[];for(n in h)h.hasOwnProperty(n)&&c.push(n);this._data[d?"core":"checkbox"].selected=c,-1!==l.indexOf("down")&&a.length&&a.find(".jstree-anchor").removeClass(d?"jstree-clicked":"jstree-checked").parent().attr("aria-selected",!1)},this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",e.proxy(function(t,i){for(var n,r,s,o,a=this.get_node(i.parent),l=this._model.data,d=this.settings.checkbox.tie_selection;a&&a.id!==e.jstree.root&&!a.state[d?"selected":"checked"];){for(s=0,n=0,r=a.children.length;r>n;n++)s+=l[a.children[n]].state[d?"selected":"checked"];if(!(r>0&&s===r))break;a.state[d?"selected":"checked"]=!0,this._data[d?"core":"checkbox"].selected.push(a.id),o=this.get_node(a,!0),o&&o.length&&o.attr("aria-selected",!0).children(".jstree-anchor").addClass(d?"jstree-clicked":"jstree-checked"),a=this.get_node(a.parent)}},this)).on("move_node.jstree",e.proxy(function(t,i){var n,r,s,o,a,l=i.is_multi,d=i.old_parent,c=this.get_node(i.parent),h=this._model.data,u=this.settings.checkbox.tie_selection;if(!l)for(n=this.get_node(d);n&&n.id!==e.jstree.root&&!n.state[u?"selected":"checked"];){for(r=0,s=0,o=n.children.length;o>s;s++)r+=h[n.children[s]].state[u?"selected":"checked"];if(!(o>0&&r===o))break;n.state[u?"selected":"checked"]=!0,this._data[u?"core":"checkbox"].selected.push(n.id),a=this.get_node(n,!0),a&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass(u?"jstree-clicked":"jstree-checked"),n=this.get_node(n.parent)}for(n=c;n&&n.id!==e.jstree.root;){for(r=0,s=0,o=n.children.length;o>s;s++)r+=h[n.children[s]].state[u?"selected":"checked"];if(r===o)n.state[u?"selected":"checked"]||(n.state[u?"selected":"checked"]=!0,this._data[u?"core":"checkbox"].selected.push(n.id),a=this.get_node(n,!0),a&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass(u?"jstree-clicked":"jstree-checked"));else{if(!n.state[u?"selected":"checked"])break;n.state[u?"selected":"checked"]=!1,this._data[u?"core":"checkbox"].selected=e.vakata.array_remove_item(this._data[u?"core":"checkbox"].selected,n.id),a=this.get_node(n,!0),a&&a.length&&a.attr("aria-selected",!1).children(".jstree-anchor").removeClass(u?"jstree-clicked":"jstree-checked")}n=this.get_node(n.parent)}},this))},this._undetermined=function(){if(null!==this.element){var i,n,r,s,o={},a=this._model.data,l=this.settings.checkbox.tie_selection,d=this._data[l?"core":"checkbox"].selected,c=[],h=this;for(i=0,n=d.length;n>i;i++)if(a[d[i]]&&a[d[i]].parents)for(r=0,s=a[d[i]].parents.length;s>r&&o[a[d[i]].parents[r]]===t;r++)a[d[i]].parents[r]!==e.jstree.root&&(o[a[d[i]].parents[r]]=!0,c.push(a[d[i]].parents[r]));for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var l,d=h.get_node(this);if(d.state.loaded){for(i=0,n=d.children_d.length;n>i;i++)if(l=a[d.children_d[i]],!l.state.loaded&&l.original&&l.original.state&&l.original.state.undetermined&&l.original.state.undetermined===!0)for(o[l.id]===t&&l.id!==e.jstree.root&&(o[l.id]=!0,c.push(l.id)),r=0,s=l.parents.length;s>r;r++)o[l.parents[r]]===t&&l.parents[r]!==e.jstree.root&&(o[l.parents[r]]=!0,c.push(l.parents[r]))}else if(d.original&&d.original.state&&d.original.state.undetermined&&d.original.state.undetermined===!0)for(o[d.id]===t&&d.id!==e.jstree.root&&(o[d.id]=!0,c.push(d.id)),r=0,s=d.parents.length;s>r;r++)o[d.parents[r]]===t&&d.parents[r]!==e.jstree.root&&(o[d.parents[r]]=!0,c.push(d.parents[r]))}),this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),i=0,n=c.length;n>i;i++)a[c[i]].state[l?"selected":"checked"]||(d=this.get_node(c[i],!0),d&&d.length&&d.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined"))}},this.redraw_node=function(t,i,r,s){if(t=n.redraw_node.apply(this,arguments)){var o,a,l=null,d=null;for(o=0,a=t.childNodes.length;a>o;o++)if(t.childNodes[o]&&t.childNodes[o].className&&-1!==t.childNodes[o].className.indexOf("jstree-anchor")){l=t.childNodes[o];break}l&&(!this.settings.checkbox.tie_selection&&this._model.data[t.id].state.checked&&(l.className+=" jstree-checked"),d=u.cloneNode(!1),this._model.data[t.id].state.checkbox_disabled&&(d.className+=" jstree-checkbox-disabled"),l.insertBefore(d,l.childNodes[0]))}return r||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(e.proxy(this._undetermined,this),50)),t},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(t){t=this.get_node(t);var i,n,r=this.settings.checkbox.cascade,s=this.settings.checkbox.tie_selection,o=this._data[s?"core":"checkbox"].selected,a=this._model.data;if(!t||t.state[s?"selected":"checked"]===!0||-1===r.indexOf("undetermined")||-1===r.indexOf("down")&&-1===r.indexOf("up"))return!1;if(!t.state.loaded&&t.original.state.undetermined===!0)return!0;for(i=0,n=t.children_d.length;n>i;i++)if(-1!==e.inArray(t.children_d[i],o)||!a[t.children_d[i]].state.loaded&&a[t.children_d[i]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(t){var i,n,r;if(e.isArray(t)){for(t=t.slice(),i=0,n=t.length;n>i;i++)this.disable_checkbox(t[i]);return!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&(r=this.get_node(t,!0),void(t.state.checkbox_disabled||(t.state.checkbox_disabled=!0,r&&r.length&&r.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:t}))))},this.enable_checkbox=function(t){var i,n,r;if(e.isArray(t)){for(t=t.slice(),i=0,n=t.length;n>i;i++)this.enable_checkbox(t[i]);return!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&(r=this.get_node(t,!0),void(t.state.checkbox_disabled&&(t.state.checkbox_disabled=!1,r&&r.length&&r.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:t}))))},this.activate_node=function(t,i){return!e(i.target).hasClass("jstree-checkbox-disabled")&&(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||e(i.target).hasClass("jstree-checkbox"))&&(i.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!e(i.target).hasClass("jstree-checkbox")?n.activate_node.call(this,t,i):!this.is_disabled(t)&&(this.is_checked(t)?this.uncheck_node(t,i):this.check_node(t,i),void this.trigger("activate_node",{node:this.get_node(t)})))},this.check_node=function(t,i){if(this.settings.checkbox.tie_selection)return this.select_node(t,!1,!0,i);var n,r,s;if(e.isArray(t)){for(t=t.slice(),r=0,s=t.length;s>r;r++)this.check_node(t[r],i);return!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&(n=this.get_node(t,!0),void(t.state.checked||(t.state.checked=!0,this._data.checkbox.selected.push(t.id),n&&n.length&&n.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:t,selected:this._data.checkbox.selected,event:i}))))},this.uncheck_node=function(t,i){if(this.settings.checkbox.tie_selection)return this.deselect_node(t,!1,i);var n,r,s;if(e.isArray(t)){for(t=t.slice(),n=0,r=t.length;r>n;n++)this.uncheck_node(t[n],i);return!0}return t=this.get_node(t),!(!t||t.id===e.jstree.root)&&(s=this.get_node(t,!0),void(t.state.checked&&(t.state.checked=!1,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,t.id),s.length&&s.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:t,selected:this._data.checkbox.selected,event:i}))))},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var t,i;this._data.checkbox.selected.concat([]);for(this._data.checkbox.selected=this._model.data[e.jstree.root].children_d.concat(),t=0,i=this._data.checkbox.selected.length;i>t;t++)this._model.data[this._data.checkbox.selected[t]]&&(this._model.data[this._data.checkbox.selected[t]].state.checked=!0);this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();var e,t,i=this._data.checkbox.selected.concat([]);for(e=0,t=this._data.checkbox.selected.length;t>e;e++)this._model.data[this._data.checkbox.selected[e]]&&(this._model.data[this._data.checkbox.selected[e]].state.checked=!1);this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:i})},this.is_checked=function(t){return this.settings.checkbox.tie_selection?this.is_selected(t):(t=this.get_node(t),!(!t||t.id===e.jstree.root)&&t.state.checked)},this.get_checked=function(t){return this.settings.checkbox.tie_selection?this.get_selected(t):t?e.map(this._data.checkbox.selected,e.proxy(function(e){return this.get_node(e)},this)):this._data.checkbox.selected},this.get_top_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_top_selected(t);var i,n,r,s,o=this.get_checked(!0),a={};for(i=0,n=o.length;n>i;i++)a[o[i].id]=o[i];for(i=0,n=o.length;n>i;i++)for(r=0,s=o[i].children_d.length;s>r;r++)a[o[i].children_d[r]]&&delete a[o[i].children_d[r]];o=[];for(i in a)a.hasOwnProperty(i)&&o.push(i);return t?e.map(o,e.proxy(function(e){return this.get_node(e)},this)):o},this.get_bottom_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(t);var i,n,r=this.get_checked(!0),s=[];for(i=0,n=r.length;n>i;i++)r[i].children.length||s.push(r[i].id);return t?e.map(s,e.proxy(function(e){return this.get_node(e)},this)):s},this.load_node=function(t,i){var r,s,o,a;if(!e.isArray(t)&&!this.settings.checkbox.tie_selection&&(a=this.get_node(t),a&&a.state.loaded))for(r=0,s=a.children_d.length;s>r;r++)this._model.data[a.children_d[r]].state.checked&&(o=!0,this._data.checkbox.selected=e.vakata.array_remove_item(this._data.checkbox.selected,a.children_d[r]));return n.load_node.apply(this,arguments)},this.get_state=function(){var e=n.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection?e:(e.checkbox=this._data.checkbox.selected.slice(),e)},this.set_state=function(t,i){var r=n.set_state.apply(this,arguments);if(r&&t.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all();var s=this;e.each(t.checkbox,function(e,t){s.check_node(t)})}return delete t.checkbox,this.set_state(t,i),!1}return r},this.refresh=function(e,t){return this.settings.checkbox.tie_selection||(this._data.checkbox.selected=[]),n.refresh.apply(this,arguments)}},e.jstree.defaults.conditionalselect=function(){return!0},e.jstree.plugins.conditionalselect=function(e,t){this.activate_node=function(e,i){this.settings.conditionalselect.call(this,this.get_node(e),i)&&t.activate_node.call(this,e,i)}},e.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(t,i){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(t){var i=e.jstree.reference(t.reference),n=i.get_node(t.reference);i.create_node(n,{},"last",function(e){setTimeout(function(){i.edit(e)},0)})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(t){var i=e.jstree.reference(t.reference),n=i.get_node(t.reference);i.edit(n)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(t){var i=e.jstree.reference(t.reference),n=i.get_node(t.reference);i.is_selected(n)?i.delete_node(i.get_selected()):i.delete_node(n)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(t){var i=e.jstree.reference(t.reference),n=i.get_node(t.reference);i.is_selected(n)?i.cut(i.get_top_selected()):i.cut(n)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(t){var i=e.jstree.reference(t.reference),n=i.get_node(t.reference);i.is_selected(n)?i.copy(i.get_top_selected()):i.copy(n)}},paste:{separator_before:!1,icon:!1,_disabled:function(t){return!e.jstree.reference(t.reference).can_paste()},separator_after:!1,label:"Paste",action:function(t){var i=e.jstree.reference(t.reference),n=i.get_node(t.reference);i.paste(n)}}}}}}},e.jstree.plugins.contextmenu=function(i,n){this.bind=function(){n.bind.call(this);var t,i,r=0,s=null;this.element.on("contextmenu.jstree",".jstree-anchor",e.proxy(function(e,t){"input"!==e.target.tagName.toLowerCase()&&(e.preventDefault(),r=e.ctrlKey?+new Date:0,(t||s)&&(r=+new Date+1e4),s&&clearTimeout(s),this.is_loading(e.currentTarget)||this.show_contextmenu(e.currentTarget,e.pageX,e.pageY,e))},this)).on("click.jstree",".jstree-anchor",e.proxy(function(t){this._data.contextmenu.visible&&(!r||+new Date-r>250)&&e.vakata.context.hide(),r=0},this)).on("touchstart.jstree",".jstree-anchor",function(n){n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(t=n.originalEvent.changedTouches[0].clientX,i=n.originalEvent.changedTouches[0].clientY,s=setTimeout(function(){e(n.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(e){s&&e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches[0]&&(Math.abs(t-e.originalEvent.changedTouches[0].clientX)>50||Math.abs(i-e.originalEvent.changedTouches[0].clientY)>50)&&clearTimeout(s)}).on("touchend.vakata.jstree",function(e){s&&clearTimeout(s)}),e(c).on("context_hide.vakata.jstree",e.proxy(function(t,i){this._data.contextmenu.visible=!1,e(i.reference).removeClass("jstree-context")},this))},this.teardown=function(){this._data.contextmenu.visible&&e.vakata.context.hide(),n.teardown.call(this)},this.show_contextmenu=function(i,n,r,s){if(i=this.get_node(i),!i||i.id===e.jstree.root)return!1;var o=this.settings.contextmenu,a=this.get_node(i,!0),l=a.children(".jstree-anchor"),d=!1,c=!1;(o.show_at_node||n===t||r===t)&&(d=l.offset(),n=d.left,r=d.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(i)&&this.activate_node(i,s),c=o.items,e.isFunction(c)&&(c=c.call(this,i,e.proxy(function(e){this._show_contextmenu(i,n,r,e)},this))),e.isPlainObject(c)&&this._show_contextmenu(i,n,r,c)},this._show_contextmenu=function(t,i,n,r){var s=this.get_node(t,!0),o=s.children(".jstree-anchor");e(c).one("context_show.vakata.jstree",e.proxy(function(t,i){var n="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";e(i.element).addClass(n),o.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,e.vakata.context.show(o,{x:i,y:n},r),this.trigger("show_contextmenu",{node:t,x:i,y:n})}},function(e){var t=!1,i={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};e.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(t){e(c).triggerHandler("context_"+t+".vakata",{reference:i.reference,element:i.element,position:{x:i.position_x,y:i.position_y}})},_execute:function(t){return t=i.items[t],!(!t||t._disabled&&(!e.isFunction(t._disabled)||t._disabled({item:t,reference:i.reference,element:i.element}))||!t.action)&&t.action.call(null,{item:t,reference:i.reference,element:i.element,position:{x:i.position_x,y:i.position_y}})},_parse:function(t,n){if(!t)return!1;n||(i.html="",i.items=[]);var r,s="",o=!1;return n&&(s+="<ul>"),e.each(t,function(t,n){return!n||(i.items.push(n),!o&&n.separator_before&&(s+="<li class='vakata-context-separator'><a href='#' "+(e.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>"),o=!1,s+="<li class='"+(n._class||"")+(n._disabled===!0||e.isFunction(n._disabled)&&n._disabled({item:n,reference:i.reference,element:i.element})?" vakata-contextmenu-disabled ":"")+"' "+(n.shortcut?" data-shortcut='"+n.shortcut+"' ":"")+">",s+="<a href='#' rel='"+(i.items.length-1)+"' "+(n.title?"title='"+n.title+"'":"")+">",e.vakata.context.settings.icons&&(s+="<i ",n.icon&&(s+=-1!==n.icon.indexOf("/")||-1!==n.icon.indexOf(".")?" style='background:url(\""+n.icon+"\") center center no-repeat' ":" class='"+n.icon+"' "),s+="></i><span class='vakata-contextmenu-sep'>&#160;</span>"),s+=(e.isFunction(n.label)?n.label({item:t,reference:i.reference,element:i.element}):n.label)+(n.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+n.shortcut+'">'+(n.shortcut_label||"")+"</span>":"")+"</a>",n.submenu&&(r=e.vakata.context._parse(n.submenu,!0),r&&(s+=r)),s+="</li>",void(n.separator_after&&(s+="<li class='vakata-context-separator'><a href='#' "+(e.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>",o=!0)))}),s=s.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""),n&&(s+="</ul>"),n||(i.html=s,e.vakata.context._trigger("parse")),s.length>10&&s},_show_submenu:function(i){if(i=e(i),i.length&&i.children("ul").length){var n=i.children("ul"),r=i.offset().left,s=r+i.outerWidth(),o=i.offset().top,a=n.width(),l=n.height(),d=e(window).width()+e(window).scrollLeft(),c=e(window).height()+e(window).scrollTop();t?i[s-(a+10+i.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):i[s+a>d&&r>d-s?"addClass":"removeClass"]("vakata-context-right"),o+l+10>c&&n.css("bottom","-1px"),i.hasClass("vakata-context-right")?a>r&&n.css("margin-right",r-a):a>d-s&&n.css("margin-left",d-s-a),n.show()}},show:function(n,r,s){var o,a,l,d,c,h,u,p,f=!0;switch(i.element&&i.element.length&&i.element.width(""),f){case!r&&!n:return!1;case!!r&&!!n:i.reference=n,i.position_x=r.x,i.position_y=r.y;break;case!r&&!!n:i.reference=n,o=n.offset(),i.position_x=o.left+n.outerHeight(),i.position_y=o.top;break;case!!r&&!n:i.position_x=r.x,i.position_y=r.y}n&&!s&&e(n).data("vakata_contextmenu")&&(s=e(n).data("vakata_contextmenu")),e.vakata.context._parse(s)&&i.element.html(i.html),i.items.length&&(i.element.appendTo("body"),a=i.element,l=i.position_x,d=i.position_y,c=a.width(),h=a.height(),u=e(window).width()+e(window).scrollLeft(),p=e(window).height()+e(window).scrollTop(),t&&(l-=a.outerWidth()-e(n).outerWidth(),l<e(window).scrollLeft()+20&&(l=e(window).scrollLeft()+20)),l+c+20>u&&(l=u-(c+20)),d+h+20>p&&(d=p-(h+20)),i.element.css({left:l,top:d}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),i.is_visible=!0,e.vakata.context._trigger("show"))},hide:function(){i.is_visible&&(i.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),i.is_visible=!1,e.vakata.context._trigger("hide"))}},e(function(){t="rtl"===e("body").css("direction");var n=!1;i.element=e("<ul class='vakata-context'></ul>"),i.element.on("mouseenter","li",function(t){t.stopImmediatePropagation(),e.contains(this,t.relatedTarget)||(n&&clearTimeout(n),i.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),e(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),e.vakata.context._show_submenu(this))}).on("mouseleave","li",function(t){e.contains(this,t.relatedTarget)||e(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(t){e(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),e.vakata.context.settings.hide_onmouseleave&&(n=setTimeout(function(t){return function(){e.vakata.context.hide()}}(this),e.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(t){t.preventDefault(),e(this).blur().parent().hasClass("vakata-context-disabled")||e.vakata.context._execute(e(this).attr("rel"))===!1||e.vakata.context.hide()}).on("keydown","a",function(t){var n=null;switch(t.which){case 13:case 32:t.type="mouseup",t.preventDefault(),e(t.currentTarget).trigger(t);break;case 37:i.is_visible&&(i.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 38:i.is_visible&&(n=i.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),n.length||(n=i.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),n.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 39:i.is_visible&&(i.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 40:i.is_visible&&(n=i.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),n.length||(n=i.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),n.addClass("vakata-context-hover").children("a").focus(),t.stopImmediatePropagation(),t.preventDefault());break;case 27:e.vakata.context.hide(),t.preventDefault()}}).on("keydown",function(e){e.preventDefault();var t=i.element.find(".vakata-contextmenu-shortcut-"+e.which).parent();t.parent().not(".vakata-context-disabled")&&t.click()}),e(c).on("mousedown.vakata.jstree",function(t){i.is_visible&&!e.contains(i.element[0],t.target)&&e.vakata.context.hide()}).on("context_show.vakata.jstree",function(e,n){i.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),t&&i.element.addClass("vakata-context-rtl").css("direction","rtl"),i.element.find("ul").hide().end()})})}(e),e.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0,drag_selection:!0,touch:!0,large_drop_target:!1,large_drag_target:!1,use_html5:!1};var p,f;e.jstree.plugins.dnd=function(t,i){this.init=function(e,t){i.init.call(this,e,t),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in c.createElement("span")},this.bind=function(){i.bind.call(this),this.element.on(this.settings.dnd.use_html5?"dragstart.jstree":"mousedown.jstree touchstart.jstree",this.settings.dnd.large_drag_target?".jstree-node":".jstree-anchor",e.proxy(function(t){if(this.settings.dnd.large_drag_target&&e(t.target).closest(".jstree-node")[0]!==t.currentTarget)return!0;if("touchstart"===t.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var i=this.get_node(t.target),n=this.is_selected(i)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,r=n>1?n+" "+this.get_string("nodes"):this.get_text(t.currentTarget);if(this.settings.core.force_text&&(r=e.vakata.html.escape(r)),i&&i.id&&i.id!==e.jstree.root&&(1===t.which||"touchstart"===t.type||"dragstart"===t.type)&&(this.settings.dnd.is_draggable===!0||e.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,n>1?this.get_top_selected(!0):[i],t))){if(p={jstree:!0,origin:this,obj:this.get_node(i,!0),nodes:n>1?this.get_top_selected():[i.id]},f=t.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),e.vakata.dnd.start(t,p,'<div id="jstree-dnd" class="jstree-'+this.get_theme()+" jstree-"+this.get_theme()+"-"+this.get_theme_variant()+" "+(this.settings.core.themes.responsive?" jstree-dnd-responsive":"")+'"><i class="jstree-icon jstree-er"></i>'+r+'<ins class="jstree-copy" style="display:none;">+</ins></div>');e.vakata.dnd._trigger("start",t,{helper:e(),element:f,data:p})}},this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",function(t){return t.preventDefault(),e.vakata.dnd._trigger("move",t,{helper:e(),element:f,data:p}),!1}).on("drop.jstree",e.proxy(function(t){return t.preventDefault(),e.vakata.dnd._trigger("stop",t,{helper:e(),element:f,data:p}),!1},this))},this.redraw_node=function(e,t,n,r){if(e=i.redraw_node.apply(this,arguments),e&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)e.setAttribute("draggable",!0);else{var s,o,a=null;for(s=0,o=e.childNodes.length;o>s;s++)if(e.childNodes[s]&&e.childNodes[s].className&&-1!==e.childNodes[s].className.indexOf("jstree-anchor")){a=e.childNodes[s];break}a&&a.setAttribute("draggable",!0)}return e}},e(function(){var i=!1,n=!1,r=!1,s=!1,o=e('<div id="jstree-marker">&#160;</div>').hide();e(c).on("dnd_start.vakata.jstree",function(e,t){i=!1,r=!1,t&&t.data&&t.data.jstree&&o.appendTo("body")}).on("dnd_move.vakata.jstree",function(a,l){if(s&&(l.event&&"dragover"===l.event.type&&l.event.target===r.target||clearTimeout(s)),l&&l.data&&l.data.jstree&&(!l.event.target.id||"jstree-marker"!==l.event.target.id)){r=l.event;var d,c,h,u,p,f,m,g,_,v,y,w,b,T,x,S,Y=e.jstree.reference(l.event.target),k=!1,C=!1,L=!1;if(Y&&Y._data&&Y._data.dnd)if(o.attr("class","jstree-"+Y.get_theme()+(Y.settings.core.themes.responsive?" jstree-dnd-responsive":"")),x=l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey)),l.helper.children().attr("class","jstree-"+Y.get_theme()+" jstree-"+Y.get_theme()+"-"+Y.get_theme_variant()+" "+(Y.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[x?"show":"hide"](),l.event.target!==Y.element[0]&&l.event.target!==Y.get_container_ul()[0]||0!==Y.get_container_ul().children().length){if(k=Y.settings.dnd.large_drop_target?e(l.event.target).closest(".jstree-node").children(".jstree-anchor"):e(l.event.target).closest(".jstree-anchor"),k&&k.length&&k.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(C=k.offset(),L=(l.event.pageY!==t?l.event.pageY:l.event.originalEvent.pageY)-C.top,h=k.outerHeight(),f=h/3>L?["b","i","a"]:L>h-h/3?["a","i","b"]:L>h/2?["i","a","b"]:["i","b","a"],e.each(f,function(t,r){switch(r){case"b":d=C.left-6,c=C.top,u=Y.get_parent(k),p=k.parent().index();break;case"i":b=Y.settings.dnd.inside_pos,T=Y.get_node(k.parent()),d=C.left-2,c=C.top+h/2+1,u=T.id,p="first"===b?0:"last"===b?T.children.length:Math.min(b,T.children.length);break;case"a":d=C.left-6,c=C.top+h,u=Y.get_parent(k),p=k.parent().index()+1}for(m=!0,g=0,_=l.data.nodes.length;_>g;g++)if(v=l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey))?"copy_node":"move_node",y=p,"move_node"===v&&"a"===r&&l.data.origin&&l.data.origin===Y&&u===Y.get_parent(l.data.nodes[g])&&(w=Y.get_node(u),y>e.inArray(l.data.nodes[g],w.children)&&(y-=1)),m=m&&(Y&&Y.settings&&Y.settings.dnd&&Y.settings.dnd.check_while_dragging===!1||Y.check(v,l.data.origin&&l.data.origin!==Y?l.data.origin.get_node(l.data.nodes[g]):l.data.nodes[g],u,y,{dnd:!0,ref:Y.get_node(k.parent()),pos:r,origin:l.data.origin,is_multi:l.data.origin&&l.data.origin!==Y,is_foreign:!l.data.origin})),!m){Y&&Y.last_error&&(n=Y.last_error());break}return"i"===r&&k.parent().is(".jstree-closed")&&Y.settings.dnd.open_timeout&&(s=setTimeout(function(e,t){return function(){e.open_node(t)}}(Y,k),Y.settings.dnd.open_timeout)),m?(S=Y.get_node(u,!0),S.hasClass(".jstree-dnd-parent")||(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),S.addClass("jstree-dnd-parent")),i={ins:Y,par:u,pos:"i"!==r||"last"!==b||0!==p||Y.is_loaded(T)?p:"last"},o.css({left:d+"px",top:c+"px"}).show(),l.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),l.event.originalEvent&&l.event.originalEvent.dataTransfer&&(l.event.originalEvent.dataTransfer.dropEffect=x?"copy":"move"),n={},f=!0,!1):void 0}),f===!0))return}else{for(m=!0,g=0,_=l.data.nodes.length;_>g&&(m=m&&Y.check(l.data.origin&&(l.data.origin.settings.dnd.always_copy||l.data.origin.settings.dnd.copy&&(l.event.metaKey||l.event.ctrlKey))?"copy_node":"move_node",l.data.origin&&l.data.origin!==Y?l.data.origin.get_node(l.data.nodes[g]):l.data.nodes[g],e.jstree.root,"last",{dnd:!0,ref:Y.get_node(e.jstree.root),pos:"i",origin:l.data.origin,is_multi:l.data.origin&&l.data.origin!==Y,is_foreign:!l.data.origin}),m);g++);if(m)return i={ins:Y,par:e.jstree.root,pos:"last"},o.hide(),l.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(l.event.originalEvent&&l.event.originalEvent.dataTransfer&&(l.event.originalEvent.dataTransfer.dropEffect=x?"copy":"move"))}e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),i=!1,l.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),l.event.originalEvent&&l.event.originalEvent.dataTransfer&&(l.event.originalEvent.dataTransfer.dropEffect="none"),o.hide()}}).on("dnd_scroll.vakata.jstree",function(e,t){t&&t.data&&t.data.jstree&&(o.hide(),i=!1,r=!1,t.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(t,a){if(e(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),s&&clearTimeout(s),a&&a.data&&a.data.jstree){o.hide().detach();var l,d,c=[];if(i){for(l=0,d=a.data.nodes.length;d>l;l++)c[l]=a.data.origin?a.data.origin.get_node(a.data.nodes[l]):a.data.nodes[l];i.ins[a.data.origin&&(a.data.origin.settings.dnd.always_copy||a.data.origin.settings.dnd.copy&&(a.event.metaKey||a.event.ctrlKey))?"copy_node":"move_node"](c,i.par,i.pos,!1,!1,!1,a.data.origin)}else l=e(a.event.target).closest(".jstree"),l.length&&n&&n.error&&"check"===n.error&&(l=l.jstree(!0),l&&l.settings.core.error.call(this,n));r=!1,i=!1}}).on("keyup.jstree keydown.jstree",function(t,a){a=e.vakata.dnd._get(),a&&a.data&&a.data.jstree&&("keyup"===t.type&&27===t.which?(s&&clearTimeout(s),i=!1,n=!1,r=!1,s=!1,o.hide().detach(),e.vakata.dnd._clean()):(a.helper.find(".jstree-copy").first()[a.data.origin&&(a.data.origin.settings.dnd.always_copy||a.data.origin.settings.dnd.copy&&(t.metaKey||t.ctrlKey))?"show":"hide"](),r&&(r.metaKey=t.metaKey,r.ctrlKey=t.ctrlKey,e.vakata.dnd._trigger("move",r))))})}),function(e){e.vakata.html={div:e("<div />"),escape:function(t){return e.vakata.html.div.text(t).html()},strip:function(t){return e.vakata.html.div.empty().append(e.parseHTML(t)).text()}};var i={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1};e.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:50},_trigger:function(i,n,r){r===t&&(r=e.vakata.dnd._get()),r.event=n,e(c).triggerHandler("dnd_"+i+".vakata",r)},_get:function(){return{data:i.data,element:i.element,helper:i.helper}},_clean:function(){i.helper&&i.helper.remove(),i.scroll_i&&(clearInterval(i.scroll_i),i.scroll_i=!1),i={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},e(c).off("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(c).off("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop)},_scroll:function(t){if(!i.scroll_e||!i.scroll_l&&!i.scroll_t)return i.scroll_i&&(clearInterval(i.scroll_i),
i.scroll_i=!1),!1;if(!i.scroll_i)return i.scroll_i=setInterval(e.vakata.dnd._scroll,100),!1;if(t===!0)return!1;var n=i.scroll_e.scrollTop(),r=i.scroll_e.scrollLeft();i.scroll_e.scrollTop(n+i.scroll_t*e.vakata.dnd.settings.scroll_speed),i.scroll_e.scrollLeft(r+i.scroll_l*e.vakata.dnd.settings.scroll_speed),(n!==i.scroll_e.scrollTop()||r!==i.scroll_e.scrollLeft())&&e.vakata.dnd._trigger("scroll",i.scroll_e)},start:function(t,n,r){"touchstart"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=c.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),i.is_drag&&e.vakata.dnd.stop({});try{t.currentTarget.unselectable="on",t.currentTarget.onselectstart=function(){return!1},t.currentTarget.style&&(t.currentTarget.style.touchAction="none",t.currentTarget.style.msTouchAction="none",t.currentTarget.style.MozUserSelect="none")}catch(e){}return i.init_x=t.pageX,i.init_y=t.pageY,i.data=n,i.is_down=!0,i.element=t.currentTarget,i.target=t.target,i.is_touch="touchstart"===t.type,r!==!1&&(i.helper=e("<div id='vakata-dnd'></div>").html(r).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(c).on("mousemove.vakata.jstree touchmove.vakata.jstree",e.vakata.dnd.drag),e(c).on("mouseup.vakata.jstree touchend.vakata.jstree",e.vakata.dnd.stop),!1},drag:function(t){if("touchmove"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=c.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),i.is_down){if(!i.is_drag){if(!(Math.abs(t.pageX-i.init_x)>(i.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)||Math.abs(t.pageY-i.init_y)>(i.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)))return;i.helper&&(i.helper.appendTo("body"),i.helper_w=i.helper.outerWidth()),i.is_drag=!0,e(i.target).one("click.vakata",!1),e.vakata.dnd._trigger("start",t)}var n=!1,r=!1,s=!1,o=!1,a=!1,l=!1,d=!1,h=!1,u=!1,p=!1;return i.scroll_t=0,i.scroll_l=0,i.scroll_e=!1,e(e(t.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var n=e(this),r=n.offset();return this.scrollHeight>this.offsetHeight&&(r.top+n.height()-t.pageY<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=1),t.pageY-r.top<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=-1)),this.scrollWidth>this.offsetWidth&&(r.left+n.width()-t.pageX<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=1),t.pageX-r.left<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=-1)),i.scroll_t||i.scroll_l?(i.scroll_e=e(this),!1):void 0}),i.scroll_e||(n=e(c),r=e(window),s=n.height(),o=r.height(),a=n.width(),l=r.width(),d=n.scrollTop(),h=n.scrollLeft(),s>o&&t.pageY-d<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=-1),s>o&&o-(t.pageY-d)<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=1),a>l&&t.pageX-h<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=-1),a>l&&l-(t.pageX-h)<e.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=1),(i.scroll_t||i.scroll_l)&&(i.scroll_e=n)),i.scroll_e&&e.vakata.dnd._scroll(!0),i.helper&&(u=parseInt(t.pageY+e.vakata.dnd.settings.helper_top,10),p=parseInt(t.pageX+e.vakata.dnd.settings.helper_left,10),s&&u+25>s&&(u=s-50),a&&p+i.helper_w>a&&(p=a-(i.helper_w+2)),i.helper.css({left:p+"px",top:u+"px"})),e.vakata.dnd._trigger("move",t),!1}},stop:function(t){if("touchend"===t.type&&t.originalEvent&&t.originalEvent.changedTouches&&t.originalEvent.changedTouches[0]&&(t.pageX=t.originalEvent.changedTouches[0].pageX,t.pageY=t.originalEvent.changedTouches[0].pageY,t.target=c.elementFromPoint(t.originalEvent.changedTouches[0].pageX-window.pageXOffset,t.originalEvent.changedTouches[0].pageY-window.pageYOffset)),i.is_drag)t.target!==i.target&&e(i.target).off("click.vakata"),e.vakata.dnd._trigger("stop",t);else if("touchend"===t.type&&t.target===i.target){var n=setTimeout(function(){e(t.target).click()},100);e(t.target).one("click",function(){n&&clearTimeout(n)})}return e.vakata.dnd._clean(),!1}}}(e),e.jstree.defaults.massload=null,e.jstree.plugins.massload=function(t,i){this.init=function(e,t){this._data.massload={},i.init.call(this,e,t)},this._load_nodes=function(t,n,r,s){var o,a,l,d=this.settings.massload,c=(JSON.stringify(t),[]),h=this._model.data;if(!r){for(o=0,a=t.length;a>o;o++)(!h[t[o]]||!h[t[o]].state.loaded&&!h[t[o]].state.failed||s)&&(c.push(t[o]),l=this.get_node(t[o],!0),l&&l.length&&l.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},c.length){if(e.isFunction(d))return d.call(this,c,e.proxy(function(e){var o,a;if(e)for(o in e)e.hasOwnProperty(o)&&(this._data.massload[o]=e[o]);for(o=0,a=t.length;a>o;o++)l=this.get_node(t[o],!0),l&&l.length&&l.removeClass("jstree-loading").attr("aria-busy",!1);i._load_nodes.call(this,t,n,r,s)},this));if("object"==typeof d&&d&&d.url)return d=e.extend(!0,{},d),e.isFunction(d.url)&&(d.url=d.url.call(this,c)),e.isFunction(d.data)&&(d.data=d.data.call(this,c)),e.ajax(d).done(e.proxy(function(e,o,a){var d,c;if(e)for(d in e)e.hasOwnProperty(d)&&(this._data.massload[d]=e[d]);for(d=0,c=t.length;c>d;d++)l=this.get_node(t[d],!0),l&&l.length&&l.removeClass("jstree-loading").attr("aria-busy",!1);i._load_nodes.call(this,t,n,r,s)},this)).fail(e.proxy(function(e){i._load_nodes.call(this,t,n,r,s)},this))}}return i._load_nodes.call(this,t,n,r,s)},this._load_node=function(t,n){var r,s=this._data.massload[t.id],o=null;return s?(o=this["string"==typeof s?"_append_html_data":"_append_json_data"](t,"string"==typeof s?e(e.parseHTML(s)).filter(function(){return 3!==this.nodeType}):s,function(e){n.call(this,e)}),r=this.get_node(t.id,!0),r&&r.length&&r.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[t.id],o):i._load_node.call(this,t,n)}},e.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},e.jstree.plugins.search=function(i,n){this.bind=function(){n.bind.call(this),this._data.search.str="",this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",e.proxy(function(t,i){if(this._data.search.som&&i.res.length){var n,r,s,o,a=this._model.data,l=[];for(n=0,r=i.res.length;r>n;n++)if(a[i.res[n]]&&!a[i.res[n]].state.hidden&&(l.push(i.res[n]),l=l.concat(a[i.res[n]].parents),this._data.search.smc))for(s=0,o=a[i.res[n]].children_d.length;o>s;s++)a[a[i.res[n]].children_d[s]]&&!a[a[i.res[n]].children_d[s]].state.hidden&&l.push(a[i.res[n]].children_d[s]);l=e.vakata.array_remove_item(e.vakata.array_unique(l),e.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(l,!0),this.redraw(!0)}},this)).on("clear_search.jstree",e.proxy(function(e,t){this._data.search.som&&t.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))},this))},this.search=function(i,n,r,s,o,a){if(i===!1||""===e.trim(i.toString()))return this.clear_search();s=this.get_node(s),s=s&&s.id?s.id:null,i=i.toString();var l,d,c=this.settings.search,h=!!c.ajax&&c.ajax,u=this._model.data,p=null,f=[],m=[];if(this._data.search.res.length&&!o&&this.clear_search(),r===t&&(r=c.show_only_matches),a===t&&(a=c.show_only_matches_children),!n&&h!==!1)return e.isFunction(h)?h.call(this,i,e.proxy(function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],function(){this.search(i,!0,r,s,o)})},this),s):(h=e.extend({},h),h.data||(h.data={}),h.data.str=i,s&&(h.data.inside=s),e.ajax(h).fail(e.proxy(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(h)},this.settings.core.error.call(this,this._data.core.last_error)},this)).done(e.proxy(function(t){t&&t.d&&(t=t.d),this._load_nodes(e.isArray(t)?e.vakata.array_unique(t):[],function(){this.search(i,!0,r,s,o)})},this)));if(o||(this._data.search.str=i,this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=r,this._data.search.smc=a),p=new e.vakata.search(i,!0,{caseSensitive:c.case_sensitive,fuzzy:c.fuzzy}),e.each(u[s?s:e.jstree.root].children_d,function(e,t){var n=u[t];n.text&&!n.state.hidden&&(!c.search_leaves_only||n.state.loaded&&0===n.children.length)&&(c.search_callback&&c.search_callback.call(this,i,n)||!c.search_callback&&p.search(n.text).isMatch)&&(f.push(t),m=m.concat(n.parents))}),f.length){for(m=e.vakata.array_unique(m),l=0,d=m.length;d>l;l++)m[l]!==e.jstree.root&&u[m[l]]&&this.open_node(m[l],null,0)===!0&&this._data.search.opn.push(m[l]);o?(this._data.search.dom=this._data.search.dom.add(e(this.element[0].querySelectorAll("#"+e.map(f,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=e.vakata.array_unique(this._data.search.res.concat(f))):(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(f,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=f),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:i,res:this._data.search.res,show_only_matches:r})},this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.res.length&&(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(this._data.search.res,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=e()},this.redraw_node=function(t,i,r,s){if(t=n.redraw_node.apply(this,arguments),t&&-1!==e.inArray(t.id,this._data.search.res)){var o,a,l=null;for(o=0,a=t.childNodes.length;a>o;o++)if(t.childNodes[o]&&t.childNodes[o].className&&-1!==t.childNodes[o].className.indexOf("jstree-anchor")){l=t.childNodes[o];break}l&&(l.className+=" jstree-search")}return t}},function(e){e.vakata.search=function(t,i,n){n=n||{},n=e.extend({},e.vakata.search.defaults,n),n.fuzzy!==!1&&(n.fuzzy=!0),t=n.caseSensitive?t:t.toLowerCase();var r,s,o,a,l=n.location,d=n.distance,c=n.threshold,h=t.length;return h>32&&(n.fuzzy=!1),n.fuzzy&&(r=1<<h-1,s=function(){var e={},i=0;for(i=0;h>i;i++)e[t.charAt(i)]=0;for(i=0;h>i;i++)e[t.charAt(i)]|=1<<h-i-1;return e}(),o=function(e,t){var i=e/h,n=Math.abs(l-t);return d?i+n/d:n?1:i}),a=function(e){if(e=n.caseSensitive?e:e.toLowerCase(),t===e||-1!==e.indexOf(t))return{isMatch:!0,score:0};if(!n.fuzzy)return{isMatch:!1,score:1};var i,a,d,u,p,f,m,g,_,v=e.length,y=c,w=e.indexOf(t,l),b=h+v,T=1,x=[];for(-1!==w&&(y=Math.min(o(0,w),y),w=e.lastIndexOf(t,l+h),-1!==w&&(y=Math.min(o(0,w),y))),w=-1,i=0;h>i;i++){for(d=0,u=b;u>d;)o(i,l+u)<=y?d=u:b=u,u=Math.floor((b-d)/2+d);for(b=u,f=Math.max(1,l-u+1),m=Math.min(l+u,v)+h,g=new Array(m+2),g[m+1]=(1<<i)-1,a=m;a>=f;a--)if(_=s[e.charAt(a-1)],0===i?g[a]=(g[a+1]<<1|1)&_:g[a]=(g[a+1]<<1|1)&_|((p[a+1]|p[a])<<1|1)|p[a+1],g[a]&r&&(T=o(i,a-1),y>=T)){if(y=T,w=a-1,x.push(w),!(w>l))break;f=Math.max(1,2*l-w)}if(o(i+1,l)>y)break;p=g}return{isMatch:w>=0,score:T}},i===!0?{search:a}:a(i)},e.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1}}(e),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,i){this.bind=function(){i.bind.call(this),this.element.on("model.jstree",e.proxy(function(e,t){this.sort(t.parent,!0)},this)).on("rename_node.jstree create_node.jstree",e.proxy(function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",e.proxy(function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)},this))},this.sort=function(t,i){var n,r;if(t=this.get_node(t),t&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),i))for(n=0,r=t.children_d.length;r>n;n++)this.sort(t.children_d[n],!1)}};var m=!1;e.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1},e.jstree.plugins.state=function(t,i){this.bind=function(){i.bind.call(this);var t=e.proxy(function(){this.element.on(this.settings.state.events,e.proxy(function(){m&&clearTimeout(m),m=setTimeout(e.proxy(function(){this.save_state()},this),100)},this)),this.trigger("state_ready")},this);this.element.on("ready.jstree",e.proxy(function(e,i){this.element.one("restore_state.jstree",t),this.restore_state()||t()},this))},this.save_state=function(){var t={state:this.get_state(),ttl:this.settings.state.ttl,sec:+new Date};e.vakata.storage.set(this.settings.state.key,JSON.stringify(t))},this.restore_state=function(){var t=e.vakata.storage.get(this.settings.state.key);if(t)try{t=JSON.parse(t)}catch(e){return!1}return!(t&&t.ttl&&t.sec&&+new Date-t.sec>t.ttl)&&(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),!!t&&(this.element.one("set_state.jstree",function(i,n){n.instance.trigger("restore_state",{state:e.extend(!0,{},t)})}),this.set_state(t),!0))},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(e),e.jstree.defaults.types={default:{}},e.jstree.defaults.types[e.jstree.root]={},e.jstree.plugins.types=function(i,n){this.init=function(i,r){var s,o;if(r&&r.types&&r.types.default)for(s in r.types)if("default"!==s&&s!==e.jstree.root&&r.types.hasOwnProperty(s))for(o in r.types.default)r.types.default.hasOwnProperty(o)&&r.types[s][o]===t&&(r.types[s][o]=r.types.default[o]);n.init.call(this,i,r),this._model.data[e.jstree.root].type=e.jstree.root},this.refresh=function(t,i){n.refresh.call(this,t,i),this._model.data[e.jstree.root].type=e.jstree.root},this.bind=function(){this.element.on("model.jstree",e.proxy(function(i,n){var r,s,o,a=this._model.data,l=n.nodes,d=this.settings.types,c="default";for(r=0,s=l.length;s>r;r++){if(c="default",a[l[r]].original&&a[l[r]].original.type&&d[a[l[r]].original.type]&&(c=a[l[r]].original.type),a[l[r]].data&&a[l[r]].data.jstree&&a[l[r]].data.jstree.type&&d[a[l[r]].data.jstree.type]&&(c=a[l[r]].data.jstree.type),a[l[r]].type=c,a[l[r]].icon===!0&&d[c].icon!==t&&(a[l[r]].icon=d[c].icon),d[c].li_attr!==t&&"object"==typeof d[c].li_attr)for(o in d[c].li_attr)if(d[c].li_attr.hasOwnProperty(o)){if("id"===o)continue;a[l[r]].li_attr[o]===t?a[l[r]].li_attr[o]=d[c].li_attr[o]:"class"===o&&(a[l[r]].li_attr.class=d[c].li_attr.class+" "+a[l[r]].li_attr.class)}if(d[c].a_attr!==t&&"object"==typeof d[c].a_attr)for(o in d[c].a_attr)if(d[c].a_attr.hasOwnProperty(o)){if("id"===o)continue;a[l[r]].a_attr[o]===t?a[l[r]].a_attr[o]=d[c].a_attr[o]:"href"===o&&"#"===a[l[r]].a_attr[o]?a[l[r]].a_attr.href=d[c].a_attr.href:"class"===o&&(a[l[r]].a_attr.class=d[c].a_attr.class+" "+a[l[r]].a_attr.class)}}a[e.jstree.root].type=e.jstree.root},this)),n.bind.call(this)},this.get_json=function(t,i,r){var s,o,a=this._model.data,l=i?e.extend(!0,{},i,{no_id:!1}):{},d=n.get_json.call(this,t,l,r);if(d===!1)return!1;if(e.isArray(d))for(s=0,o=d.length;o>s;s++)d[s].type=d[s].id&&a[d[s].id]&&a[d[s].id].type?a[d[s].id].type:"default",i&&i.no_id&&(delete d[s].id,d[s].li_attr&&d[s].li_attr.id&&delete d[s].li_attr.id,d[s].a_attr&&d[s].a_attr.id&&delete d[s].a_attr.id);else d.type=d.id&&a[d.id]&&a[d.id].type?a[d.id].type:"default",i&&i.no_id&&(d=this._delete_ids(d));return d},this._delete_ids=function(t){if(e.isArray(t)){for(var i=0,n=t.length;n>i;i++)t[i]=this._delete_ids(t[i]);return t}return delete t.id,t.li_attr&&t.li_attr.id&&delete t.li_attr.id,t.a_attr&&t.a_attr.id&&delete t.a_attr.id,t.children&&e.isArray(t.children)&&(t.children=this._delete_ids(t.children)),t},this.check=function(i,r,s,o,a){if(n.check.call(this,i,r,s,o,a)===!1)return!1;r=r&&r.id?r:this.get_node(r),s=s&&s.id?s:this.get_node(s);var l,d,c,h,u=r&&r.id?a&&a.origin?a.origin:e.jstree.reference(r.id):null;switch(u=u&&u._model&&u._model.data?u._model.data:null,i){case"create_node":case"move_node":case"copy_node":if("move_node"!==i||-1===e.inArray(r.id,s.children)){if(l=this.get_rules(s),l.max_children!==t&&-1!==l.max_children&&l.max_children===s.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+i,data:JSON.stringify({chk:i,pos:o,obj:!(!r||!r.id)&&r.id,par:!(!s||!s.id)&&s.id})},!1;if(l.valid_children!==t&&-1!==l.valid_children&&-1===e.inArray(r.type||"default",l.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+i,data:JSON.stringify({chk:i,pos:o,obj:!(!r||!r.id)&&r.id,par:!(!s||!s.id)&&s.id})},!1;if(u&&r.children_d&&r.parents){for(d=0,c=0,h=r.children_d.length;h>c;c++)d=Math.max(d,u[r.children_d[c]].parents.length);d=d-r.parents.length+1}(0>=d||d===t)&&(d=1);do{if(l.max_depth!==t&&-1!==l.max_depth&&l.max_depth<d)return this._data.core.last_error={error:"check",plugin:"types",id:"types_03",reason:"max_depth prevents function: "+i,data:JSON.stringify({chk:i,pos:o,obj:!(!r||!r.id)&&r.id,par:!(!s||!s.id)&&s.id})},!1;s=this.get_node(s.parent),l=this.get_rules(s),d++}while(s)}}return!0},this.get_rules=function(e){if(e=this.get_node(e),!e)return!1;var i=this.get_type(e,!0);return i.max_depth===t&&(i.max_depth=-1),i.max_children===t&&(i.max_children=-1),i.valid_children===t&&(i.valid_children=-1),i},this.get_type=function(t,i){return t=this.get_node(t),!!t&&(i?e.extend({type:t.type},this.settings.types[t.type]):t.type)},this.set_type=function(i,n){var r,s,o,a,l,d,c,h,u=this._model.data;if(e.isArray(i)){for(i=i.slice(),s=0,o=i.length;o>s;s++)this.set_type(i[s],n);return!0}if(r=this.settings.types,i=this.get_node(i),!r[n]||!i)return!1;if(c=this.get_node(i,!0),c&&c.length&&(h=c.children(".jstree-anchor")),a=i.type,l=this.get_icon(i),i.type=n,(l===!0||r[a]&&r[a].icon!==t&&l===r[a].icon)&&this.set_icon(i,r[n].icon===t||r[n].icon),r[a].li_attr!==t&&"object"==typeof r[a].li_attr)for(d in r[a].li_attr)if(r[a].li_attr.hasOwnProperty(d)){if("id"===d)continue;"class"===d?(u[i.id].li_attr.class=(u[i.id].li_attr.class||"").replace(r[a].li_attr[d],""),c&&c.removeClass(r[a].li_attr[d])):u[i.id].li_attr[d]===r[a].li_attr[d]&&(u[i.id].li_attr[d]=null,c&&c.removeAttr(d))}if(r[a].a_attr!==t&&"object"==typeof r[a].a_attr)for(d in r[a].a_attr)if(r[a].a_attr.hasOwnProperty(d)){if("id"===d)continue;"class"===d?(u[i.id].a_attr.class=(u[i.id].a_attr.class||"").replace(r[a].a_attr[d],""),h&&h.removeClass(r[a].a_attr[d])):u[i.id].a_attr[d]===r[a].a_attr[d]&&("href"===d?(u[i.id].a_attr[d]="#",h&&h.attr("href","#")):(delete u[i.id].a_attr[d],h&&h.removeAttr(d)))}if(r[n].li_attr!==t&&"object"==typeof r[n].li_attr)for(d in r[n].li_attr)if(r[n].li_attr.hasOwnProperty(d)){if("id"===d)continue;u[i.id].li_attr[d]===t?(u[i.id].li_attr[d]=r[n].li_attr[d],c&&("class"===d?c.addClass(r[n].li_attr[d]):c.attr(d,r[n].li_attr[d]))):"class"===d&&(u[i.id].li_attr.class=r[n].li_attr[d]+" "+u[i.id].li_attr.class,c&&c.addClass(r[n].li_attr[d]))}if(r[n].a_attr!==t&&"object"==typeof r[n].a_attr)for(d in r[n].a_attr)if(r[n].a_attr.hasOwnProperty(d)){if("id"===d)continue;u[i.id].a_attr[d]===t?(u[i.id].a_attr[d]=r[n].a_attr[d],h&&("class"===d?h.addClass(r[n].a_attr[d]):h.attr(d,r[n].a_attr[d]))):"href"===d&&"#"===u[i.id].a_attr[d]?(u[i.id].a_attr.href=r[n].a_attr.href,h&&h.attr("href",r[n].a_attr.href)):"class"===d&&(u[i.id].a_attr.class=r[n].a_attr.class+" "+u[i.id].a_attr.class,h&&h.addClass(r[n].a_attr[d]))}return!0}},e.jstree.defaults.unique={case_sensitive:!1,duplicate:function(e,t){return e+" ("+t+")"}},e.jstree.plugins.unique=function(i,n){this.check=function(t,i,r,s,o){if(n.check.call(this,t,i,r,s,o)===!1)return!1;if(i=i&&i.id?i:this.get_node(i),r=r&&r.id?r:this.get_node(r),!r||!r.children)return!0;var a,l,d="rename_node"===t?s:i.text,c=[],h=this.settings.unique.case_sensitive,u=this._model.data;for(a=0,l=r.children.length;l>a;a++)c.push(h?u[r.children[a]].text:u[r.children[a]].text.toLowerCase());switch(h||(d=d.toLowerCase()),t){case"delete_node":return!0;case"rename_node":return a=-1===e.inArray(d,c)||i.text&&i.text[h?"toString":"toLowerCase"]()===d,a||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+d+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:s,obj:!(!i||!i.id)&&i.id,par:!(!r||!r.id)&&r.id})}),a;case"create_node":return a=-1===e.inArray(d,c),a||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+d+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:s,obj:!(!i||!i.id)&&i.id,par:!(!r||!r.id)&&r.id})}),a;case"copy_node":return a=-1===e.inArray(d,c),a||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+d+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:s,obj:!(!i||!i.id)&&i.id,par:!(!r||!r.id)&&r.id})}),a;case"move_node":return a=i.parent===r.id&&(!o||!o.is_multi)||-1===e.inArray(d,c),a||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+d+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:s,obj:!(!i||!i.id)&&i.id,par:!(!r||!r.id)&&r.id})}),a}return!0},this.create_node=function(i,r,s,o,a){if(!r||r.text===t){if(null===i&&(i=e.jstree.root),i=this.get_node(i),!i)return n.create_node.call(this,i,r,s,o,a);if(s=s===t?"last":s,!s.toString().match(/^(before|after)$/)&&!a&&!this.is_loaded(i))return n.create_node.call(this,i,r,s,o,a);r||(r={});var l,d,c,h,u,p=this._model.data,f=this.settings.unique.case_sensitive,m=this.settings.unique.duplicate;for(d=l=this.get_string("New node"),c=[],h=0,u=i.children.length;u>h;h++)c.push(f?p[i.children[h]].text:p[i.children[h]].text.toLowerCase());for(h=1;-1!==e.inArray(f?d:d.toLowerCase(),c);)d=m.call(this,l,++h).toString();r.text=d}return n.create_node.call(this,i,r,s,o,a)}};var g=c.createElement("DIV");if(g.setAttribute("unselectable","on"),g.setAttribute("role","presentation"),g.className="jstree-wholerow",g.innerHTML="&#160;",e.jstree.plugins.wholerow=function(t,i){this.bind=function(){i.bind.call(this),this.element.on("ready.jstree set_state.jstree",e.proxy(function(){this.hide_dots()},this)).on("init.jstree loading.jstree ready.jstree",e.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",e.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",e.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var i,n,r=!1;for(i=0,n=t.selected.length;n>i;i++)r=this.get_node(t.selected[i],!0),r&&r.length&&r.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",e.proxy(function(e,t){this.get_node(t.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",e.proxy(function(e,t){"hover_node"===e.type&&this.is_disabled(t.node)||this.get_node(t.node,!0).children(".jstree-wholerow")["hover_node"===e.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",e.proxy(function(t){if(this._data.contextmenu){t.preventDefault();var i=e.Event("contextmenu",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,pageX:t.pageX,pageY:t.pageY});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(i)}},this)).on("click.jstree",".jstree-wholerow",function(t){t.stopImmediatePropagation();var i=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(i).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",e.proxy(function(t){t.stopImmediatePropagation();var i=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(i).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy(function(e){return e.stopImmediatePropagation(),this.is_disabled(e.currentTarget)||this.hover_node(e.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),i.teardown.call(this)},this.redraw_node=function(t,n,r,s){if(t=i.redraw_node.apply(this,arguments)){var o=g.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(o.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===t.id&&(o.className+=" jstree-wholerow-hovered"),t.insertBefore(o,t.childNodes[0])}return t}},c.registerElement&&Object&&Object.create){var _=Object.create(HTMLElement.prototype);_.createdCallback=function(){var t,i={core:{},plugins:[]};for(t in e.jstree.plugins)e.jstree.plugins.hasOwnProperty(t)&&this.attributes[t]&&(i.plugins.push(t),this.getAttribute(t)&&JSON.parse(this.getAttribute(t))&&(i[t]=JSON.parse(this.getAttribute(t))));for(t in e.jstree.defaults.core)e.jstree.defaults.core.hasOwnProperty(t)&&this.attributes[t]&&(i.core[t]=JSON.parse(this.getAttribute(t))||this.getAttribute(t));e(this).jstree(i)};try{c.registerElement("vakata-jstree",{prototype:_})}catch(e){}}}}),define("file-tree",["jquery","jstree","underscore","backbone","common"],function(e,t,i,n,r){"use strict";var s={renderFileTree:function(){},renderDirTree:function(t,i,n){t.jstree({core:{data:function(i,s){if("#"==i.id)s(n);else{var o,a=i.data.path;o=1==i.parents.length?i.data.repo_id:t.jstree("get_node",i.parents[i.parents.length-2]).data.repo_id,e.ajax({url:r.getUrl({name:"get_dirents",repo_id:o})+"?path="+encodeURIComponent(a)+"&dir_only=true",cache:!1,dataType:"json",success:function(e){if(e.length)for(var t=0,n=e.length;t<n;t++)i.children.push({text:r.HTMLescape(e[t].name),data:{path:a+e[t].name+"/"},children:!0})},complete:function(){s(i.children)}})}},multiple:!1,animation:100}}).on("select_node.jstree",function(n,r){var s,o=r.node;s=1==o.parents.length?o.data.repo_id:t.jstree("get_node",o.parents[o.parents.length-2]).data.repo_id,e('input[name="dst_repo"]',i).val(s),e('input[name="dst_path"]',i).val(o.data.path)})},renderTreeForPath:function(t){var i=this,n=t.$form,s=t.$container,o=t.repo_name,a=t.repo_id,l=t.path;"/"!=l&&(l+="/");var d=[],c={text:r.HTMLescape(o),data:{repo_id:a,path:"/"},children:[],state:{opened:!0}};d.push(c),e.ajax({url:r.getUrl({name:"get_dirents",repo_id:a})+"?path="+encodeURIComponent(l)+"&dir_only=true&all_dir=true",cache:!1,dataType:"json",success:function(t){if(t.length)for(var i,n,s=[],o=0,a=t.length;o<a;o++)if(n=t[o].parent_dir+t[o].name+"/",i={text:r.HTMLescape(t[o].name),data:{path:n}},0==l.indexOf(n)?(e.extend(i,{children:[],state:{opened:!0}}),s.push(i)):e.extend(i,{children:!0}),"/"==t[o].parent_dir)c.children.push(i);else for(var d=0,h=s.length;d<h;d++)if(t[o].parent_dir==s[d].data.path){s[d].children.push(i);break}},complete:function(){i.renderDirTree(s,n,d)}})},prepareOtherReposTree:function(t){var i=this;e("#other-repos .hd").click(function(){var n=e("span",e(this)),s=e("#mv-form"),o=e(this).next(),a=e("#other-repos-dirs");n.hasClass("icon-caret-right")?(n.attr("class","icon-caret-down"),o.show(),e.ajax({url:r.getUrl({name:"unenc_rw_repos"}),cache:!1,dataType:"json",success:function(e){for(var n=[],o=t.cur_repo_id,l=0,d=e.length;l<d;l++)e[l].id!=o&&n.push({text:r.HTMLescape(e[l].name),data:{repo_id:e[l].id,path:"/"},children:!0});i.renderDirTree(a,s,n),a.removeClass("hide")},complete:function(){o.hide()}})):(n.attr("class","icon-caret-right"),a.addClass("hide"))})}};return s}),define("app/collections/repo-user-folder-perm",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Collection.extend({initialize:function(e){this.repo_id=e.repo_id},url:function(){return i.getUrl({name:"repo_user_folder_perm",repo_id:this.repo_id})}});return n}),define("app/collections/repo-group-folder-perm",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Collection.extend({initialize:function(e){this.repo_id=e.repo_id},url:function(){return i.getUrl({name:"repo_group_folder_perm",repo_id:this.repo_id})}});return n}),define("app/views/repo-folder-perm-item",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.View.extend({tagName:"tr",template:t.template(e("#folder-perm-item-tmpl").html()),initialize:function(t){void 0===t.item_data.show_folder_path&&e.extend(t.item_data,{show_folder_path:!1}),this.data={show_admin:!1},e.extend(this.data,t.item_data),this.render()},render:function(){return this.$el.html(this.template(this.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){return e(t.currentTarget).closest("td").find(".perm").addClass("hide").end().find(".perm-toggle-select").removeClass("hide"),!1},editPerm:function(t){var i=this,r=e(t.currentTarget).val(),s={permission:r,folder_path:this.data.folder_path},o=this.data.for_user;o?e.extend(s,{user_email:this.data.user_email}):e.extend(s,{group_id:this.data.group_id}),e.ajax({url:n.getUrl({name:o?"repo_user_folder_perm":"repo_group_folder_perm",repo_id:this.data.repo_id}),type:"PUT",dataType:"json",cache:!1,beforeSend:n.prepareCSRFToken,data:s,success:function(){i.data.permission=r,i.render()},error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error:gettext("Failed. Please check the network."),o?e("#user-folder-perm .error").html(i).removeClass("hide"):e("#group-folder-perm .error").html(i).removeClass("hide")}})},deletePerm:function(){var t=this,i={permission:this.data.permission,folder_path:this.data.folder_path},r=this.data.for_user;return r?e.extend(i,{user_email:this.data.user_email}):e.extend(i,{group_id:this.data.group_id}),e.ajax({url:n.getUrl({name:r?"repo_user_folder_perm":"repo_group_folder_perm",repo_id:this.data.repo_id}),type:"DELETE",dataType:"json",cache:!1,beforeSend:n.prepareCSRFToken,data:i,success:function(){t.remove()},error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error:gettext("Failed. Please check the network."),r?e("#user-folder-perm .error").html(i).removeClass("hide"):e("#group-folder-perm .error").html(i).removeClass("hide")}}),!1}});return r}),define("app/views/dialogs/repo-folder-perm-admin",["jquery","underscore","backbone","common","file-tree","app/collections/repo-user-folder-perm","app/collections/repo-group-folder-perm","app/views/repo-folder-perm-item"],function(e,t,i,n,r,s,o,a){
"use strict";var l=i.View.extend({id:"repo-folder-perm-popup",template:t.template(e("#repo-folder-perm-admin-dialog-tmpl").html()),initialize:function(t){this.repo_name=t.repo_name,this.repo_id=t.repo_id,this.render(),this.$(".op-target").css({"max-width":280}),e(window).width()<768&&this.$el.css({width:e(window).width()-50,height:e(window).height()-50,overflow:"auto"}),this.$el.modal({focus:!1,onClose:function(){e(document).off("click",n),e.modal.close()}}),e(window).width()>=768&&e("#simplemodal-container").css({width:"auto",height:"auto"}),this.$(".js-tabs").tabs(),this.userPerm=new s({repo_id:this.repo_id}),this.userPerm.perm_type="user",this.$userPermPanel=this.$("#js-repo-user-folder-perm .js-folder-perm-content"),this.groupPerm=new o({repo_id:this.repo_id}),this.groupPerm.perm_type="group",this.$groupPermPanel=this.$("#js-repo-group-folder-perm .js-folder-perm-content"),this.renderPanel({collection:this.userPerm,$panel:this.$userPermPanel}),this.renderPanel({collection:this.groupPerm,$panel:this.$groupPermPanel});var i=this,n=function(e){var t=e.target||event.srcElement,n=i.$(".perm-toggle-select:visible"),r=n.parent();!n.length||n.is(t)||n.find("*").is(t)||r.find(".edit-icon").is(t)||(n.hide(),r.find(".cur-perm, .edit-icon").show())};e(document).click(n)},render:function(){return this.$el.html(this.template({title:gettext("{placeholder} Folder Permission").replace("{placeholder}",'<span class="op-target ellipsis ellipsis-op-target" title="'+n.HTMLescape(this.repo_name)+'">'+n.HTMLescape(this.repo_name)+"</span>")})),this},renderPanel:function(t){var i=t.collection,r=t.$panel,s=e(".loading-tip",r),o=e(".error",r);if("user"==i.perm_type)e('[name="emails"]',r).select2(e.extend(n.contactInputOptionsForSelect2(),{placeholder:gettext("Search user or enter email and press Enter")}));else{for(var a=app.pageOptions.groups||[],l="",d=0,c=a.length;d<c;d++)l+='<option value="'+a[d].id+'" data-index="'+d+'">'+a[d].name+"</option>";e('[name="groups"]',r).html(l).select2({placeholder:gettext("Select a group"),maximumSelectionSize:1,formatSelectionTooBig:gettext("You can only select 1 item"),escapeMarkup:function(e){return e}})}this.listenTo(i,"add",this.addItem),i.fetch({cache:!1,success:function(e,t,i){s.hide()},error:function(t,i,n){s.hide();var r;r=i.responseText?401==i.status||403==i.status?gettext("Permission error"):e.parseJSON(i.responseText).error_msg:gettext("Please check the network."),o.html(r).show()}})},addItem:function(t,i,r){var s=i.perm_type,o="user"==s?this.$userPermPanel:this.$groupPermPanel,l="user"==s,d=n.encodePath(t.get("folder_path")),c=new a({item_data:e.extend(t.toJSON(),{for_user:l,show_folder_path:!0,encoded_path:d})});r.prepend?e('[name="folder_path"]',o).closest("tr").after(c.render().el):e("tbody",o).append(c.render().el)},events:{"click .js-add-folder":"showFolderSelectForm","click .js-folder-select-submit":"addFolder","click .js-folder-select-cancel":"cancelFolderSelect","click .js-user-perm-add-submit":"addPerm","click .js-group-perm-add-submit":"addPerm"},showFolderSelectForm:function(t){var i=e(t.currentTarget),n=i.closest(".js-folder-perm-content").slideUp(),s=e(".js-folder-select-form",n.parent()).slideDown(),o=e(".js-jtree-container",s);e.jstree.reference(o)||r.renderTreeForPath({$form:s,$container:o,repo_id:this.repo_id,repo_name:this.repo_name,path:"/"})},addFolder:function(t){var i=e(t.currentTarget),n=i.closest("form"),r=e("[name=dst_path]",n),s=r.val(),o=e(".error",n);if(!s)return o.html(gettext("Please click and choose a directory.")).removeClass("hide"),!1;n.slideUp(),e.jstree.reference(e(".js-jtree-container",n)).deselect_all(),e("[name=dst_path]",n).val(""),o.hide();var a=e(".js-folder-perm-content",n.parent()).slideDown();return e("[name=folder_path]",a).val(s),!1},cancelFolderSelect:function(t){var i=e(t.currentTarget),n=i.closest("form").slideUp();e(".js-folder-perm-content",n.parent()).slideDown();var r=e.jstree.reference(e(".js-jtree-container",n));r.get_selected().length>0&&r.deselect_all()},addPerm:function(t){var i,r,s,o,l,d=e(t.currentTarget);if(d.hasClass("js-user-perm-add-submit")){l=!0,i=this.$userPermPanel,s=n.getUrl({name:"repo_user_folder_perm",repo_id:this.repo_id});var r=e('[name="emails"]',i),c=r.val();if(!c)return!1;o={user_email:c.split(",")}}else{l=!1,i=this.$groupPermPanel,s=n.getUrl({name:"repo_group_folder_perm",repo_id:this.repo_id});var r=e('[name="groups"]',i),h=r.val().join(",");if(!h)return!1;o={group_id:h.split(",")}}var u=e('[name="folder_path"]',i),p=e('[name="permission"]',i),f=p.val(),m=u.val();if(!f||!m)return!1;e.extend(o,{folder_path:m,permission:f});var g=e(".error",i);n.disableButton(d),e.ajax({url:s,dataType:"json",method:"POST",beforeSend:n.prepareCSRFToken,traditional:!0,data:o,success:function(t){if(t.success.length>0&&(e(t.success).each(function(t,r){var s=n.encodePath(r.folder_path),o=new a({item_data:e.extend(r,{for_user:l,show_folder_path:!0,encoded_path:s})});e('[name="folder_path"]',i).closest("tr").after(o.el)}),r.select2("val",""),u.val(""),e('[value="rw"]',p).attr("selected","selected"),e('[value="r"]',p).removeAttr("selected"),g.addClass("hide")),t.failed.length>0){var s="";e(t.failed).each(function(e,t){s+=n.HTMLescape(t.user_email||t.group_id)+": "+n.HTMLescape(t.error_msg)+"<br />"}),g.html(s).removeClass("hide")}},error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),g.html(i).removeClass("hide")},complete:function(){n.enableButton(d)}})}});return l}),define("app/views/widgets/hl-item-view",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.View.extend({tagName:"tr",hiddenOperationClass:".op-icon",initialize:function(e){this.$el.on("mouseenter",t.bind(this.highlight,this)),this.$el.on("mouseleave",t.bind(this.rmHighlight,this)),this.$el.on("focus","*",t.bind(this.focus,this))},focus:function(){if(app.ui.currentDropdown||app.ui.freezeItemHightlight)return!0;if(app.ui.currentHighlightedItem){if(app.ui.currentHighlightedItem==this)return!0;app.ui.currentHighlightedItem.rmHighlight()}return this.highlight(),!0},highlight:function(){app.ui.currentDropdown||app.ui.freezeItemHightlight||(app.ui.currentHighlightedItem=this,this.$el.addClass("hl").find(this.hiddenOperationClass).removeClass("vh"))},rmHighlight:function(){app.ui.currentDropdown||app.ui.freezeItemHightlight||(app.ui.currentHighlightedItem=null,this.$el.removeClass("hl"),e(window).width()>=768&&this.$el.find(this.hiddenOperationClass).addClass("vh"))}});return r}),define("app/views/widgets/dropdown",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";e(document).click(function(e){var t=app.ui.currentDropdown,i=e.target||event.srcElement;return!t||(t.$(".sf-dropdown-menu").is(i)||t.$(".sf-dropdown-menu").find("*").is(i)||(t.hide(),app.ui.currentHighlightedItem&&app.ui.currentHighlightedItem.rmHighlight()),!0)}),e(document).keydown(function(e){if(27==e.keyCode){var t=app.ui.currentDropdown;t&&(t.hide(),app.ui.currentHighlightedItem&&app.ui.currentHighlightedItem.rmHighlight())}});var r=i.View.extend({defaultOptions:{left:"0px"},initialize:function(e){this.$el.on("click",".sf-dropdown-toggle",t.bind(this.toggleDropdown,this)),this.$el.on("keydown",t.bind(this.handleKeydown,this)),this.options={},t.extend(this.options,this.defaultOptions,e)},hide:function(){app.ui.currentDropdown=null,this.$(".sf-dropdown-menu").addClass("hide").removeAttr("style")},show:function(){var t=this.$(".sf-dropdown-toggle"),i=this.$(".sf-dropdown-menu");app.ui.currentDropdown=this,void 0!=this.options.right?i.css("right",this.options.right):i.css("left",this.options.left),t.offset().top+t.outerHeight(!0)+i.outerHeight(!0)>e(window).scrollTop()+e(window).height()&&i.css({bottom:t.outerHeight(!0)+4}),this.$(".sf-dropdown-menu").removeClass("hide")},toggleDropdown:function(){return app.ui.currentDropdown&&app.ui.currentDropdown!=this&&app.ui.currentDropdown.hide(),this.$(".sf-dropdown-menu").is(":hidden")?this.show():this.hide(),!1},handleKeydown:function(t){if(/(38|40)/.test(t.which)){t.preventDefault(),t.stopPropagation();var i=e.makeArray(this.$el.find("li a"));if(i.length){var n=i.indexOf(t.target);38===t.which&&n>0&&n--,40===t.which&&n<i.length-1&&n++,i[n].focus()}}}});return r}),define("app/views/repo",["jquery","underscore","backbone","common","app/views/share","app/views/dialogs/repo-change-password","app/views/dialogs/repo-history-settings","app/views/dialogs/repo-share-link-admin","app/views/dialogs/repo-folder-perm-admin","app/views/widgets/hl-item-view","app/views/widgets/dropdown"],function(e,t,i,n,r,s,o,a,l,d,c){"use strict";var h=d.extend({tagName:"tr",template:t.template(e("#repo-tmpl").html()),mobileTemplate:t.template(e("#repo-mobile-tmpl").html()),renameTemplate:t.template(e("#repo-rename-form-template").html()),transferTemplate:t.template(e("#repo-transfer-form-tmpl").html()),addLabelTemplate:t.template(e("#add-lib-label-form-tmpl").html()),events:{click:"clickItem","click td:lt(2)":"visitRepo","click .repo-delete-btn":"del","click .repo-share-btn":"share","click .js-repo-rename":"rename","click .js-repo-transfer":"transfer","click .js-repo-change-password":"changePassword","click .js-popup-history-setting":"popupHistorySetting","click .js-popup-share-link-admin":"popupShareLinkAdmin","click .js-popup-folder-perm-admin":"popupFolderPermAdmin","click .js-repo-details":"viewDetails","click .js-add-label":"addLabel"},initialize:function(e){d.prototype.initialize.call(this),this.myReposView=e.myReposView,this.listenTo(this.model,"change",this.render)},render:function(){var i,r=this.model.toJSON(),s=n.isHiDPI()?48:24,o=this.model.getIconUrl(s),a={};return e(window).width()>=768?i=this.template:(i=this.mobileTemplate,a={right:0}),t.extend(r,{icon_url:o,icon_title:this.model.getIconTitle(),can_generate_share_link:app.pageOptions.can_generate_share_link,can_generate_upload_link:app.pageOptions.can_generate_upload_link}),this.$el.html(i(r)),this.dropdown=new c(e.extend({el:this.$(".sf-dropdown")},a)),this},clickItem:function(t){var i=t.target||event.srcElement;this.$("td").is(i)&&"0px"==e("#repo-details").css("right")&&this.viewDetails()},visitRepo:function(){e(window).width()<768&&(location.href=this.$(".repo-name-span a").attr("href"))},del:function(){var t=this,i=this.model.get("name"),r=gettext("Delete Library"),s=gettext("Are you sure you want to delete %s ?").replace("%s",'<span class="op-target ellipsis ellipsis-op-target">'+n.HTMLescape(i)+"</span>"),o=function(){e.ajax({url:n.getUrl({name:"repo",repo_id:t.model.get("id")}),type:"DELETE",cache:!1,dataType:"json",beforeSend:n.prepareCSRFToken,success:function(){t.$el.remove(),n.feedback(gettext("Successfully deleted."),"success")},error:function(e,t,i){n.ajaxErrorHandler(e,t,i)},complete:function(){e.modal.close()}})};return n.showConfirm(r,s,o),this.togglePopup(),!1},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")};return new r(e),!1},togglePopup:function(){this.dropdown.hide()},rename:function(){var t=this.model.get("name"),i=e(this.renameTemplate({repo_name:t})),r=this.$(".repo-name-span"),s=this.$(".repo-op-td"),o=r.closest("td");o.attr("colspan",2).css({width:r.width()+s.outerWidth(),height:r.height()}).append(i),s.hide(),r.hide(),e('[name="newname"]',i).select(),this.togglePopup(),app.ui.freezeItemHightlight=!0;var a=function(){return app.ui.freezeItemHightlight=!1,i.remove(),s.show(),r.show(),o.attr("colspan",1).css({width:r.width()}),!1};e(".cancel",i).click(a);var l=(i.attr("id"),this);return i.submit(function(){var r,s=e.trim(e('[name="newname"]',i).val());if(!s)return r=gettext("It is required."),n.feedback(r,"error"),!1;if(s.indexOf("/")!=-1)return r=gettext("Name should not include '/'."),n.feedback(r,"error"),!1;if(s==t)return a(),!1;var o={repo_name:s},d=n.getUrl({name:"repo",repo_id:l.model.get("id")})+"?op=rename",c=function(e){app.ui.freezeItemHightlight=!1,l.model.set({name:s})},h=function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error||e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),n.feedback(i,"error"),n.enableButton(u)},u=e('[type="submit"]',i);return n.disableButton(u),e.ajax({url:d,type:"POST",dataType:"json",beforeSend:n.prepareCSRFToken,data:o,success:c,error:h}),!1}),!1},transfer:function(){var t=this;this.togglePopup();var i=this.model.get("name"),r=e(this.transferTemplate({title:gettext("Transfer Library {library_name} To").replace("{library_name}",'<span class="op-target ellipsis ellipsis-op-target" title="'+n.HTMLescape(i)+'">'+n.HTMLescape(i)+"</span>")}));return r.modal({focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"}),e('[name="email"]',r).select2(e.extend(n.contactInputOptionsForSelect2(),{width:"280px",maximumSelectionSize:1,placeholder:gettext("Search user or enter email and press Enter"),formatSelectionTooBig:gettext("You cannot select any more choices")})),r.submit(function(){var i=e.trim(e('[name="email"]',e(this)).val());if(!i)return!1;if(i==t.model.get("owner"))return!1;var s=e('[type="submit"]',e(this));return n.disableButton(s),e.ajax({url:n.getUrl({name:"repo_owner",repo_id:t.model.get("id")}),type:"put",dataType:"json",beforeSend:n.prepareCSRFToken,data:{owner:i},success:function(){e.modal.close(),t.remove(),n.feedback(gettext("Successfully transferred the library."),"success")},error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),e(".error",r).html(i).show(),n.enableButton(s)}}),!1}),!1},popupHistorySetting:function(){var e={repo_name:this.model.get("name"),repo_id:this.model.get("id"),url_name:"repo_history_limit"};return this.togglePopup(),new o(e),!1},popupShareLinkAdmin:function(){var e={repo_name:this.model.get("name"),repo_id:this.model.get("id")};return this.togglePopup(),new a(e),!1},popupFolderPermAdmin:function(){var e={repo_name:this.model.get("name"),repo_id:this.model.get("id")};return this.togglePopup(),new l(e),!1},changePassword:function(){var e={repo_name:this.model.get("name"),repo_id:this.model.get("id")};return this.togglePopup(),new s(e),!1},viewDetails:function(){var t=this.model.toJSON(),i=n.isHiDPI()?48:24,r=e.extend({},t,{icon_url:this.model.getIconUrl(i),big_icon_url:this.model.getIconUrl()}),s=this.myReposView.repoDetailsView;return s.show(r),e.ajax({url:n.getUrl({name:"repo_v2.1",repo_id:this.model.get("id")}),cache:!1,dataType:"json",success:function(e){s.update({file_count:e.file_count})},error:function(){s.update({error:!0})}}),this.togglePopup(),!1},addLabel:function(){var t=this;this.togglePopup();var i=e(this.addLabelTemplate()),r=e('<div><span class="loading-icon loading-tip"></span></div>');return r.modal({focus:!1,minWidth:280}),e("#simplemodal-container").css({height:"auto"}),e.ajax({url:n.getUrl({name:"user_repo_labels"}),cache:!1,dataType:"json",success:function(t){for(var n=[],r=0,s=t.length;r<s;r++)n.push({id:t[r],text:t[r]});e("#simplemodal-data").html(i),e('[name="labels"]',i).select2({tags:n})},error:function(t){var i;if(t.responseText){var n=e.parseJSON(t.responseText);i=n.error_msg||n.detail}else i=gettext("Failed. Please check the network.");e("#simplemodal-data").html('<p class="error">'+i+"</p>")}}),i.submit(function(){var r=e('[name="labels"]',i),s=r.select2("val"),o=e(".error",i),a=e('[type="submit"]',i);return 0==s.length?(o.html(gettext("It is required.")).show(),!1):(n.disableButton(a),e.ajax({url:n.getUrl({name:"repo_labels"}),type:"POST",cache:!1,dataType:"json",beforeSend:n.prepareCSRFToken,data:{repo_id:t.model.get("id"),tag_names:s.join(",")},success:function(){var i=gettext("Successfully added label(s) for library {placeholder}").replace("{placeholder}",t.model.get("name"));e.modal.close(),n.feedback(i,"success")},error:function(t){var i;if(t.responseText){var r=e.parseJSON(t.responseText);i=r.error_msg||r.detail}else i=gettext("Failed. Please check the network.");o.html(i).show(),n.enableButton(a)}}),!1)}),!1}});return h}),function(e){"function"==typeof define&&define.amd?define("simplemodal",["jquery"],e):e(jQuery)}(function(e){var t=[],i=e(document),n=navigator.userAgent.toLowerCase(),r=e(window),s=[],o={ieQuirks:null,msie:/msie/.test(n)&&!/opera/.test(n),opera:/opera/.test(n)};o.ie6=o.msie&&/msie 6./.test(n)&&"object"!=typeof window.XMLHttpRequest,o.ie7=o.msie&&/msie 7.0/.test(n),o.boxModel="CSS1Compat"===document.compatMode;var a;e.modal=function(t,i){return e.modal.impl.init(t,i)},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,i){e.modal.impl.update(t,i)},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,i){var n=this;if(n.d.data)return!1;if(o.ieQuirks=o.msie&&!o.boxModel,n.o=e.extend({},e.modal.defaults,i),n.zIndex=n.o.zIndex,n.occb=!1,"object"==typeof t)t=t instanceof e?t:e(t),n.d.placeholder=!1,t.parent().parent().size()>0&&(t.before(e("<span></span>").attr("id","simplemodal-placeholder").css({display:"none"})),n.d.placeholder=!0,n.display=t.css("display"),n.o.persist||(n.d.orig=t.clone(!0)));else{if("string"!=typeof t&&"number"!=typeof t)return alert("SimpleModal Error: Unsupported data type: "+typeof t),n;t=e("<div></div>").html(t)}return n.create(t),t=null,n.open(),e.isFunction(n.o.onShow)&&n.o.onShow.apply(n,[n.d]),n},create:function(i){var n=this;n.getDimensions(),n.o.modal&&o.ie6&&(n.d.iframe=e('<iframe src="javascript:false;"></iframe>').css(e.extend(n.o.iframeCss,{display:"none",opacity:0,position:"fixed",height:s[0],width:s[1],zIndex:n.o.zIndex,top:0,left:0})).appendTo(n.o.appendTo)),n.d.overlay=e("<div></div>").attr("id",n.o.overlayId).attr("tabIndex",-1).addClass("simplemodal-overlay").css(e.extend(n.o.overlayCss,{display:"none",opacity:n.o.opacity/100,height:n.o.modal?t[0]:0,width:n.o.modal?t[1]:0,position:"fixed",left:0,top:0,zIndex:n.o.zIndex+1})).appendTo(n.o.appendTo),n.d.container=e('<div role="dialog" aria-labelledby="dialogTitle" aria-describedby="dialogDiscription"></div>').attr("id",n.o.containerId).addClass("simplemodal-container").css(e.extend({position:n.o.fixed?"fixed":"absolute"},n.o.containerCss,{display:"none",zIndex:n.o.zIndex+2})).append(n.o.close&&n.o.closeHTML?e(n.o.closeHTML).addClass(n.o.closeClass):"").appendTo(n.o.appendTo),n.d.wrap=e('<div role="document"></div>').addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(n.d.container),n.d.data=i.attr("id",i.attr("id")||n.o.dataId).addClass("simplemodal-data").css(e.extend(n.o.dataCss,{display:"none"})).appendTo("body"),i=null,n.setContainerDimensions(),n.d.data.appendTo(n.d.wrap),(o.ie6||o.ieQuirks)&&n.fixIE()},bindEvents:function(){var n=this;e("."+n.o.closeClass).bind("click.simplemodal",function(e){e.preventDefault(),n.close()}),n.o.modal&&n.o.close&&n.o.overlayClose&&n.d.overlay.bind("click.simplemodal",function(e){e.preventDefault(),n.close()}),i.bind("keydown.simplemodal",function(e){n.o.modal&&9===e.keyCode?n.watchTab(e):n.o.close&&n.o.escClose&&27===e.keyCode&&(e.preventDefault(),n.close())}),r.bind("resize.simplemodal orientationchange.simplemodal",function(){n.getDimensions(),n.o.autoResize?n.setContainerDimensions():n.o.autoPosition&&n.setPosition(),o.ie6||o.ieQuirks?n.fixIE():n.o.modal&&(n.d.iframe&&n.d.iframe.css({height:s[0],width:s[1]}),n.d.overlay.css({height:t[0],width:t[1]}))})},unbindEvents:function(){e("."+this.o.closeClass).unbind("click.simplemodal"),i.unbind("keydown.simplemodal"),r.unbind(".simplemodal"),this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var t=this,i=t.o.position;e.each([t.d.iframe||null,t.o.modal?t.d.overlay:null,"fixed"===t.d.container.css("position")?t.d.container:null],function(e,t){if(t){var n="document.body.clientHeight",r="document.body.clientWidth",s="document.body.scrollHeight",o="document.body.scrollLeft",a="document.body.scrollTop",l="document.body.scrollWidth",d="document.documentElement.clientHeight",c="document.documentElement.clientWidth",h="document.documentElement.scrollLeft",u="document.documentElement.scrollTop",p=t[0].style;if(p.position="absolute",e<2)p.removeExpression("height"),p.removeExpression("width"),p.setExpression("height",""+s+" > "+n+" ? "+s+" : "+n+' + "px"'),p.setExpression("width",""+l+" > "+r+" ? "+l+" : "+r+' + "px"');else{var f,m;if(i&&i.constructor===Array){var g=i[0]?"number"==typeof i[0]?i[0].toString():i[0].replace(/px/,""):t.css("top").replace(/px/,"");if(f=g.indexOf("%")===-1?g+" + (t = "+u+" ? "+u+" : "+a+') + "px"':parseInt(g.replace(/%/,""))+" * (("+d+" || "+n+") / 100) + (t = "+u+" ? "+u+" : "+a+') + "px"',i[1]){var _="number"==typeof i[1]?i[1].toString():i[1].replace(/px/,"");m=_.indexOf("%")===-1?_+" + (t = "+h+" ? "+h+" : "+o+') + "px"':parseInt(_.replace(/%/,""))+" * (("+c+" || "+r+") / 100) + (t = "+h+" ? "+h+" : "+o+') + "px"'}}else f="("+d+" || "+n+") / 2 - (this.offsetHeight / 2) + (t = "+u+" ? "+u+" : "+a+') + "px"',m="("+c+" || "+r+") / 2 - (this.offsetWidth / 2) + (t = "+h+" ? "+h+" : "+o+') + "px"';p.removeExpression("top"),p.removeExpression("left"),p.setExpression("top",f),p.setExpression("left",m)}}})},focus:function(t){var i=this,n=t&&e.inArray(t,["first","last"])!==-1?t:"first",r=e(":input:enabled:visible:"+n,i.d.wrap);setTimeout(function(){r.length>0?r.focus():i.d.wrap.focus()},10)},getDimensions:function(){var e="undefined"==typeof window.innerHeight?r.height():window.innerHeight;t=[i.height(),i.width()],s=[e,r.width()]},getVal:function(e,t){return e?"number"==typeof e?e:"auto"===e?0:e.indexOf("%")>0?parseInt(e.replace(/%/,""))/100*("h"===t?s[0]:s[1]):parseInt(e.replace(/px/,"")):null},update:function(e,t){var i=this;return!!i.d.data&&(i.d.origHeight=i.getVal(e,"h"),i.d.origWidth=i.getVal(t,"w"),i.d.data.hide(),e&&i.d.container.css("height",e),t&&i.d.container.css("width",t),i.setContainerDimensions(),i.d.data.show(),i.o.focus&&i.focus(),i.unbindEvents(),void i.bindEvents())},setContainerDimensions:function(){var e=this,t=o.ie6||o.ie7,i=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"),n=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"),r=e.d.data.outerHeight(!0),a=e.d.data.outerWidth(!0);e.d.origHeight=e.d.origHeight||i,e.d.origWidth=e.d.origWidth||n;var l=e.o.maxHeight?e.getVal(e.o.maxHeight,"h"):null,d=e.o.maxWidth?e.getVal(e.o.maxWidth,"w"):null,c=l&&l<s[0]?l:s[0],h=d&&d<s[1]?d:s[1],u=e.o.minHeight?e.getVal(e.o.minHeight,"h"):"auto";i=i?e.o.autoResize&&i>c?c:i<u?u:i:r?r>c?c:e.o.minHeight&&"auto"!==u&&r<u?u:r:u;var p=e.o.minWidth?e.getVal(e.o.minWidth,"w"):"auto";n=n?e.o.autoResize&&n>h?h:n<p?p:n:a?a>h?h:e.o.minWidth&&"auto"!==p&&a<p?p:a:p,e.d.container.css({height:i,width:n}),e.d.wrap.css({overflow:r>i||a>n?"auto":"visible"}),e.o.autoPosition&&e.setPosition()},setPosition:function(){var e,t,i=this,n=s[0]/2-i.d.container.outerHeight(!0)/2,o=s[1]/2-i.d.container.outerWidth(!0)/2,a="fixed"!==i.d.container.css("position")?r.scrollTop():0;i.o.position&&"[object Array]"===Object.prototype.toString.call(i.o.position)?(e=a+(i.o.position[0]||n),t=i.o.position[1]||o):(e=a+n,t=o),i.d.container.css({left:t,top:e})},watchTab:function(t){var i=this;if(e(t.target).parents(".simplemodal-container").length>0){if(i.inputs=e(":input:enabled:visible:first, :input:enabled:visible:last",i.d.data[0]),!t.shiftKey&&t.target===i.inputs[i.inputs.length-1]||t.shiftKey&&t.target===i.inputs[0]||0===i.inputs.length){t.preventDefault();var n=t.shiftKey?"last":"first";i.focus(n)}}else t.preventDefault(),i.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()),a=document.activeElement,t.o.focus&&t.focus(),t.bindEvents()},close:function(){var t=this;if(!t.d.data)return!1;if(a&&a.focus(),t.unbindEvents(),e.isFunction(t.o.onClose)&&!t.occb)t.occb=!0,t.o.onClose.apply(t,[t.d]);else{if(t.d.placeholder){var i=e("#simplemodal-placeholder");t.o.persist?i.replaceWith(t.d.data.removeClass("simplemodal-data").css("display",t.display)):(t.d.data.hide().remove(),i.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,i,n,r){"use strict";var s=n.View.extend({tagName:"div",template:i.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,enable_encrypted_library:app.pageOptions.enable_encrypted_library,library_templates:app.pageOptions.library_templates}},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(),library_template:e('[name="library_template"]',this.$el).val(),storage_id:e('[name="storage"]',this.$el).val()}},displayValidationErrors:function(e,t,i){this.$(".error").html(t).show(),r.enableButton(this.$('[type="submit"]'))},addRepo:function(e){e.preventDefault(),r.disableButton(this.$('[type="submit"]'));var t=this.repos;t.create(this.newAttributes(),{wait:!0,validate:!0,prepend:!0,success:function(){1==t.length&&t.reset(t.models)},error:function(e,t,i){r.feedback("Error","error",r.ERROR_TIMEOUT)},complete:function(){r.closeModal()}})},togglePasswdInput:function(t){var i=e("#encrypt-switch"),n=this.$('input[type="password"]');i.prop("checked")?n.attr("disabled",!1).removeClass("input-disabled"):n.attr("disabled",!0).addClass("input-disabled")}});return s}),define("app/views/repo-details",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.View.extend({id:"repo-details",className:"details-panel right-side-panel",template:t.template(e("#repo-details-tmpl").html()),initialize:function(){e("#main").append(this.$el);var t=this;e(document).keydown(function(e){27==e.which&&t.hide()}),e(window).resize(function(){t.setConMaxHeight()})},events:{"click .js-close":"close"},render:function(){this.$el.html(this.template(this.data))},update:function(e){e.error?this.$("#file-count").html('<span class="error">'+gettext("Error")+"</span>"):this.$("#file-count").html(e.file_count)},setConMaxHeight:function(){this.$(".right-side-panel-con").css({height:e(window).height()-this.$(".right-side-panel-hd").outerHeight(!0)})},hide:function(){this.$el.css({right:"-320px"})},close:function(){return this.hide(),!1},show:function(e){this.data=e,this.render(),this.$el.css({right:"0px"}),this.setConMaxHeight()}});return r}),define("app/views/myhome-repos",["jquery","underscore","backbone","common","app/collections/repos","app/views/repo","app/views/add-repo","app/views/repo-details","app/views/widgets/dropdown"],function(e,t,i,n,r,s,o,a,l){"use strict";var d=i.View.extend({id:"my-own-repos",template:t.template(e("#my-own-repos-tmpl").html()),reposHdTemplate:t.template(e("#my-repos-hd-tmpl").html()),mobileReposHdTemplate:t.template(e("#my-repos-hd-mobile-tmpl").html()),events:{"click .repo-create":"createRepo","click .by-name":"sortByName","click .by-time":"sortByTime","click #my-libs-more-op a":"closeDropdown"},initialize:function(e){this.repos=new r,this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset),this.repoDetailsView=new a,this.render(),this.more_op_dropdown=new l({el:this.$("#my-libs-more-op"),right:0})},addOne:function(e,t,i){var n=new s({model:e,myReposView:this});i.prepend?this.$tableBody.prepend(n.render().el):this.$tableBody.append(n.render().el)},renderReposHd:function(){var t=e(window).width()>=768?this.reposHdTemplate:this.mobileReposHdTemplate;this.$tableHead.html(t())},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.repos.length?(this.$emptyTip.hide(),this.renderReposHd(),this.$tableBody.empty(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),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}),e("#simplemodal-container").css({height:"auto"}),app.pageOptions.guide_enabled=!1)},showMyRepos:function(){this.$table.hide(),this.$loadingTip.show();var e=this;this.repos.fetch({cache:!1,reset:!0,success:function(e,t,i){},error:function(t,i,n){e.$loadingTip.hide();var r,s=e.$(".error");r=i.responseText?401==i.status||403==i.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),s.html(r).show()}})},render:function(){return this.$el.html(this.template()),this.$table=this.$("table"),this.$tableHead=e("thead",this.$table),this.$tableBody=e("tbody",this.$table),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips"),this.$repoCreateBtn=this.$(".repo-create"),this},show:function(){e("#right-panel").html(this.$el),this.showMyRepos()},hide:function(){this.$el.detach(),this.repoDetailsView.hide()},createRepo:function(){new o(this.repos)},sortByName:function(){return n.toggleSortByNameMode(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.repos.comparator=null,!1},sortByTime:function(){return n.toggleSortByTimeMode(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.repos.comparator=null,!1},closeDropdown:function(){this.more_op_dropdown.hide()}});return d}),define("app/models/deleted-repo",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Model.extend({getIconUrl:function(e){var t=this.get("encrypted"),n=!1;return i.getLibIconUrl(t,n,e)},getIconTitle:function(){var e="";return e=this.get("encrypted")?gettext("Encrypted library"):gettext("Read-Write library")}});return n}),define("app/collections/deleted-repos",["underscore","backbone","common","app/models/deleted-repo"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,url:function(){return i.getUrl({name:"deleted_repos"})}});return r}),define("app/views/deleted-repo",["jquery","underscore","backbone","common","moment","app/views/widgets/hl-item-view"],function(e,t,i,n,r,s){"use strict";var o=s.extend({tagName:"tr",template:t.template(e("#deleted-repo-tmpl").html()),mobileTemplate:t.template(e("#deleted-repo-mobile-tmpl").html()),events:{"click .restore":"restoreRepo"},initialize:function(){s.prototype.initialize.call(this)},render:function(){var i,s=this.model.toJSON(),o=n.isHiDPI()?48:24,a=this.model.getIconUrl(o),l=r(this.model.get("del_time"));return i=e(window).width()>=768?this.template:this.mobileTemplate,t.extend(s,{
icon_url:a,icon_title:this.model.getIconTitle(),time:l.format("LLLL"),time_from_now:n.getRelativeTimeStr(l)}),this.$el.html(i(s)),this},restoreRepo:function(){var t=this;return e.ajax({url:n.getUrl({name:"deleted_repos"}),type:"POST",data:{repo_id:this.model.get("repo_id")},beforeSend:n.prepareCSRFToken,success:function(){t.remove();var e=gettext("Successfully restored library {placeholder}").replace("{placeholder}",t.model.get("repo_name"));n.feedback(e,"success")},error:function(e){n.ajaxErrorHandler(e)}}),!1}});return o}),define("app/views/my-deleted-repos",["jquery","underscore","backbone","common","app/collections/deleted-repos","app/views/deleted-repo"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({id:"my-deleted-repos",template:t.template(e("#my-deleted-repos-tmpl").html()),reposHdTemplate:t.template(e("#my-deleted-repos-hd-tmpl").html()),mobileReposHdTemplate:t.template(e("#my-deleted-repos-hd-mobile-tmpl").html()),events:{},initialize:function(e){this.repos=new r,this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset),this.render()},render:function(){return this.$el.html(this.template()),this.$table=this.$("table"),this.$tableHead=e("thead",this.$table),this.$tableBody=e("tbody",this.$table),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips"),this},addOne:function(e,t,i){var n=new s({model:e});this.$tableBody.append(n.render().el)},renderReposHd:function(){var t=e(window).width()>=768?this.reposHdTemplate:this.mobileReposHdTemplate;this.$tableHead.html(t())},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())},showRepos:function(){this.$table.hide(),this.$loadingTip.show();var e=this;this.repos.fetch({cache:!1,reset:!0,success:function(e,t,i){},error:function(t,i,n){e.$loadingTip.hide();var r,s=e.$(".error");r=i.responseText?401==i.status||403==i.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),s.html(r).show()}})},show:function(){e("#right-panel").html(this.$el),this.showRepos()},hide:function(){this.$el.detach()}});return o}),define("app/views/shared-repo",["jquery","underscore","backbone","common","app/views/widgets/hl-item-view","app/views/share"],function(e,t,i,n,r,s){"use strict";var o=r.extend({tagName:"tr",template:t.template(e("#shared-repo-tmpl").html()),mobileTemplate:t.template(e("#shared-repo-mobile-tmpl").html()),events:{"click .repo-share-btn":"share","click .unshare-btn":"removeShare"},initialize:function(){r.prototype.initialize.call(this)},share:function(){var e={is_repo_owner:!1,is_admin:!0,is_virtual:!1,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")};return new s(e),!1},removeShare:function(t){var i=this,r=function(t){n.feedback(gettext("Success"),"success",n.SUCCESS_TIMOUT),i.$el.remove(),i.collection.remove(i.model,{silent:!0}),0==i.collection.length&&(e("#repos-shared-to-me table").hide(),e("#repos-shared-to-me .empty-tips").show())};return e.ajax({url:n.getUrl({name:"beshared_repo",repo_id:this.model.get("id")})+"?share_type=personal&from="+encodeURIComponent(this.model.get("owner")),type:"DELETE",beforeSend:n.prepareCSRFToken,dataType:"json",success:r}),!1},render:function(){var i=this.model.toJSON(),r=n.isHiDPI()?48:24,s=this.model.getIconUrl(r),o=e(window).width()>=768?this.template:this.mobileTemplate;return t.extend(i,{icon_url:s,icon_title:this.model.getIconTitle()}),this.$el.html(o(i)),this}});return o}),define("app/views/myhome-shared-repos",["jquery","underscore","backbone","common","app/collections/repos","app/views/shared-repo"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({id:"repos-shared-to-me",template:t.template(e("#repos-shared-to-me-tmpl").html()),reposHdTemplate:t.template(e("#shared-repos-hd-tmpl").html()),mobileReposHdTemplate:t.template(e("#shared-repos-hd-mobile-tmpl").html()),initialize:function(e){this.repos=new r({type:"shared"}),this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset),this.render()},addOne:function(e,t,i){var n=new s({model:e,collection:this.repos});i.prepend?this.$tableBody.prepend(n.render().el):this.$tableBody.append(n.render().el)},renderReposHd:function(){var t=e(window).width()>=768?this.reposHdTemplate:this.mobileReposHdTemplate;this.$tableHead.html(t())},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.repos.length?(this.$emptyTip.hide(),this.renderReposHd(),this.$tableBody.empty(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),this.repos.each(this.addOne,this),this.$table.show()):(this.$emptyTip.show(),this.$table.hide())},showSharedRepos:function(){this.$el.show(),this.$table.hide();var e=this.$loadingTip;e.show();var t=this;this.repos.fetch({reset:!0,success:function(e,t,i){},error:function(i,n,r){e.hide();var s,o=t.$(".error");s=n.responseText?401==n.status||403==n.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),o.html(s).show()}})},render:function(){return this.$el.html(this.template()),this.$table=this.$("table"),this.$tableHead=this.$("thead"),this.$tableBody=this.$("tbody"),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips"),this},show:function(){e("#right-panel").html(this.$el),this.showSharedRepos()},hide:function(){this.$el.detach()},events:{"click .by-name":"sortByName","click .by-time":"sortByTime"},sortByName:function(){return n.toggleSortByNameMode(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.repos.comparator=null,!1},sortByTime:function(){return n.toggleSortByTimeMode(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.repos.comparator=null,!1}});return o}),define("app/models/group",["underscore","backbone"],function(e,t){"use strict";var i=t.Model.extend({});return i}),define("app/collections/groups",["underscore","backbone","common","app/models/group"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,comparator:function(e,t){return i.compareTwoWord(e.get("name"),t.get("name"))},url:function(){return i.getUrl({name:"groups"})}});return r}),define("app/models/group-repo",["underscore","backbone","app/models/repo"],function(e,t,i){"use strict";var n=i.extend({defaults:{permission:"r"}});return e.extend(n.prototype.defaults,i.prototype.defaults),n}),define("app/collections/group-repos",["underscore","backbone","common","app/models/group-repo"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,comparator:NaN,url:function(){return i.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 r}),define("app/views/group-repo",["jquery","underscore","backbone","common","app/views/widgets/hl-item-view","app/views/share"],function(e,t,i,n,r,s){"use strict";var o=r.extend({tagName:"tr",template:t.template(e("#group-repo-tmpl").html()),mobileTemplate:t.template(e("#group-repo-mobile-tmpl").html()),events:{"click .cancel-share":"unshare","click .repo-share-btn":"share"},initialize:function(e){r.prototype.initialize.call(this),this.group_id=e.group_id,this.is_staff=e.is_staff,this.show_repo_owner=e.show_repo_owner,this.listenTo(this.model,"destroy",this.remove)},render:function(){var t=this.model.toJSON(),i=n.isHiDPI()?48:24,r=this.model.getIconUrl(i),s=e(window).width()>=768?this.template:this.mobileTemplate;return e.extend(t,{group_id:this.group_id,is_staff:this.is_staff,is_repo_owner:app.pageOptions.username==this.model.get("owner"),owner_name:this.model.get("owner_nickname")||this.model.get("owner_name"),show_repo_owner:this.show_repo_owner,icon_url:r,icon_title:this.model.getIconTitle()}),this.$el.html(s(t)),this},share:function(){var e={is_repo_owner:app.pageOptions.username==this.model.get("owner"),is_virtual:!1,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")};return app.pageOptions.is_pro&&(e.is_admin=this.model.get("is_admin")),new s(e),!1},unshare:function(){this.model.get("name");return this.model.destroy({wait:!0,success:function(){var e=gettext("Successfully unshared 1 item.");n.feedback(e,"success",n.SUCCESS_TIMOUT)},error:function(t,i){var r;r=i.responseText?e.parseJSON(i.responseText).error_msg:gettext("Failed. Please check the network."),n.feedback(r,"error")}}),!1}});return o}),define("app/views/group-item",["jquery","underscore","backbone","common","app/collections/group-repos","app/views/group-repo","app/models/group-repo"],function(e,t,i,n,r,s,o){"use strict";var a=i.View.extend({template:t.template(e("#group-item-tmpl").html()),mobileTemplate:t.template(e("#group-item-mobile-tmpl").html()),events:{},initialize:function(){},render:function(){var t=e(window).width()>=768?this.template:this.mobileTemplate;this.$el.html(t(this.model.attributes));var i=this.model.get("repos");return i.length&&this.renderRepoList(i),this},renderRepoList:function(t){t.sort(function(e,t){return n.compareTwoWord(e.name,t.name)});var i=this.model.get("id"),a=e.inArray(app.pageOptions.username,this.model.get("admins"))!=-1,l=this.$("tbody"),d=new r;d.setGroupID(i),e(t).each(function(e,t){var n=new s({model:new o(t,{collection:d}),group_id:i,is_staff:a,show_repo_owner:!1});l.append(n.render().el)})}});return a}),define("app/views/groups",["jquery","underscore","backbone","common","app/collections/groups","app/views/group-item"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({id:"groups",template:t.template(e("#groups-tmpl").html()),initialize:function(e){this.groups=new r,this.listenTo(this.groups,"add",this.addOne),this.listenTo(this.groups,"reset",this.reset),this.render()},events:{"click #add-group":"addGroup"},addOne:function(e,t,i){var n=new s({model:e});i.prepend?this.$groupList.prepend(n.render().el):this.$groupList.append(n.render().el)},reset:function(){this.$error.hide(),this.$loadingTip.hide(),this.groups.length?(this.$emptyTip.hide(),this.$groupList.empty(),this.groups.each(this.addOne,this),this.$groupList.show()):(this.$emptyTip.show(),this.$groupList.hide())},render:function(){this.$el.html(this.template()),this.$loadingTip=this.$(".loading-tip"),this.$groupList=this.$("#group-list"),this.$emptyTip=this.$(".empty-tips"),this.$error=this.$(".error")},showGroups:function(){this.$groupList.hide(),this.$emptyTip.hide(),this.$loadingTip.show();var e=this;this.groups.fetch({cache:!1,data:{with_repos:1},reset:!0,success:function(e,t,i){},error:function(t,i,n){e.$loadingTip.hide();var r;r=i.responseText?401==i.status||403==i.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),e.$error.html(r).show()}})},show:function(){e("#right-panel").html(this.$el),this.showGroups()},hide:function(){this.$el.detach()},addGroup:function(){var t=e("#group-add-form");t.modal(),e("#simplemodal-container").css({height:"auto"});var i=this.groups,r=this;t.submit(function(){var s=e.trim(e('[name="group_name"]',t).val()),o=e(".error",t),a=e('[type="submit"]',t);return s?(o.hide(),n.disableButton(a),i.create({name:s,repos:[]},{wait:!0,validate:!0,prepend:!0,success:function(){1==i.length&&r.reset(),app.ui.sideNavView.updateGroups(),n.closeModal()},error:function(e,t,i){var r;r=t.responseText?t.responseJSON.error_msg:gettext("Please check the network."),o.html(r).show(),n.enableButton(a)}}),!1):(o.html(gettext("It is required.")).show(),!1)})}});return o}),define("app/views/add-group-repo",["jquery","simplemodal","underscore","backbone","common","app/views/add-repo"],function(e,t,i,n,r,s){"use strict";var o=s.extend({templateData:function(){return{showSharePerm:!0,enable_encrypted_library:app.pageOptions.enable_encrypted_library,storages:app.pageOptions.storages,library_templates:app.pageOptions.library_templates}},newAttributes:function(){var t=s.prototype.newAttributes.apply(this);return i.extend(t,{permission:e("select[name=permission]",this.$el).val()})}});return o}),define("app/collections/group-members",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Collection.extend({setGroupId:function(e){this.group_id=e},url:function(){return i.getUrl({name:"group_members",group_id:this.group_id})}});return n}),define("app/views/group-member",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.View.extend({tagName:"li",className:"user-item cspt ovhd",template:t.template(e("#group-member-tmpl").html()),events:{mouseenter:"highlight",mouseleave:"rmHighlight",click:"visitMemberProfile"},initialize:function(e){this.is_owner=e.is_owner},render:function(){var t={is_owner:this.is_owner};return e.extend(t,this.model.attributes),this.$el.html(this.template(t)),this},highlight:function(){this.$el.addClass("hl")},rmHighlight:function(){this.$el.removeClass("hl")},visitMemberProfile:function(){location.href=n.getUrl({name:"user_profile",username:encodeURIComponent(this.model.get("email"))})}});return r}),define("app/views/widgets/popover",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";e(document).click(function(e){var t=app.ui.currentPopover,i=e.target||event.srcElement;return!t||(t.$el.is(i)||t.$el.find("*").is(i)||t.hide(),!0)}),e(document).keydown(function(e){if(27==e.keyCode){var t=app.ui.currentPopover;t&&t.hide()}}),e(window).resize(function(){var e=app.ui.currentPopover;return!e||void e.setConMaxHeight()});var r=i.View.extend({initialize:function(e){this.$el.on("click",".js-close",t.bind(this.hide,this))},setConMaxHeight:function(){this.$(".sf-popover-con").css({"max-height":e(window).height()-this.$el.offset().top-this.$(".sf-popover-hd").outerHeight(!0)-2})},hide:function(){return app.ui.currentPopover=null,this.$el.detach(),!1},show:function(){app.ui.currentPopover=this,this.showContent(),this.setConMaxHeight()},toggle:function(){return app.ui.currentPopover?app.ui.currentPopover!=this?(app.ui.currentPopover.hide(),this.show()):this.hide():this.show(),!1}});return r}),define("app/views/group-members",["jquery","underscore","backbone","common","app/collections/group-members","app/views/group-member","app/views/widgets/popover"],function(e,t,i,n,r,s,o){"use strict";var a=o.extend({id:"group-members",className:"sf-popover",template:t.template(e("#group-members-tmpl").html()),initialize:function(e){o.prototype.initialize.call(this),this.groupView=e.groupView,this.collection=new r,this.listenTo(this.collection,"add",this.addOne),this.listenTo(this.collection,"reset",this.reset),this.render()},events:{},addOne:function(e,t,i){var n=!1;e.get("email")===this.groupView.group.owner&&(n=!0);var r=new s({is_owner:n,model:e});this.$listContainer.append(r.render().el)},reset:function(){this.$error.hide(),this.$loadingTip.hide(),this.$listContainer.empty(),this.collection.each(this.addOne,this),this.$listContainer.show()},render:function(){this.$el.html(this.template()),this.$loadingTip=this.$(".loading-tip"),this.$listContainer=this.$("#group-member-list"),this.$error=this.$(".error")},showContent:function(){this.$listContainer.hide(),this.$loadingTip.show();var t=this;this.collection.setGroupId(this.groupView.group.id),this.collection.fetch({cache:!1,reset:!0,data:{avatar_size:64},success:function(e,t,i){},error:function(e,i,n){t.$loadingTip.hide();var r;r=i.responseText?401==i.status||403==i.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),t.$error.html(r).show()}}),e("#group-members-icon").after(this.$el)}});return a}),define("app/models/group-discussion",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Model.extend({});return n}),define("app/collections/group-discussions",["underscore","backbone","common","app/models/group-discussion"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,setGroupId:function(e){this.group_id=e},url:function(){return i.getUrl({name:"group_discussions",group_id:this.group_id})},parse:function(e){return this.current_page=e.current_page,this.page_num=e.page_num,e.msgs}});return r}),function(){function e(e){this.tokens=[],this.tokens.links={},this.options=e||d.defaults,this.rules=c.normal,this.options.gfm&&(this.options.tables?this.rules=c.tables:this.rules=c.gfm)}function t(e,t){if(this.options=t||d.defaults,this.links=e,this.rules=h.normal,this.renderer=this.options.renderer||new i,this.renderer.options=this.options,!this.links)throw new Error("Tokens array requires a `links` property.");this.options.gfm?this.options.breaks?this.rules=h.breaks:this.rules=h.gfm:this.options.pedantic&&(this.rules=h.pedantic)}function i(e){this.options=e||{}}function n(e){this.tokens=[],this.token=null,this.options=e||d.defaults,this.options.renderer=this.options.renderer||new i,this.renderer=this.options.renderer,this.renderer.options=this.options}function r(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function s(e){return e.replace(/&([#\w]+);/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function o(e,t){return e=e.source,t=t||"",function i(n,r){return n?(r=r.source||r,r=r.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(n,r),i):new RegExp(e,t)}}function a(){}function l(e){for(var t,i,n=1;n<arguments.length;n++){t=arguments[n];for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}function d(t,i,s){if(s||"function"==typeof i){s||(s=i,i=null),i=l({},d.defaults,i||{});var o,a,c=i.highlight,h=0;try{o=e.lex(t,i)}catch(e){return s(e)}a=o.length;var u=function(e){if(e)return i.highlight=c,s(e);var t;try{t=n.parse(o,i)}catch(t){e=t}return i.highlight=c,e?s(e):s(null,t)};if(!c||c.length<3)return u();if(delete i.highlight,!a)return u();for(;h<o.length;h++)!function(e){return"code"!==e.type?--a||u():c(e.text,e.lang,function(t,i){return t?u(t):null==i||i===e.text?--a||u():(e.text=i,e.escaped=!0,void(--a||u()))})}(o[h])}else try{return i&&(i=l({},d.defaults,i)),n.parse(e.lex(t,i),i)}catch(e){if(e.message+="\nPlease report this to https://github.com/chjj/marked.",(i||d.defaults).silent)return"<p>An error occured:</p><pre>"+r(e.message+"",!0)+"</pre>";throw e}}var c={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:a,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:a,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:a,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};c.bullet=/(?:[*+-]|\d+\.)/,c.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,c.item=o(c.item,"gm")(/bull/g,c.bullet)(),c.list=o(c.list)(/bull/g,c.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+c.def.source+")")(),c.blockquote=o(c.blockquote)("def",c.def)(),c._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",c.html=o(c.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,c._tag)(),c.paragraph=o(c.paragraph)("hr",c.hr)("heading",c.heading)("lheading",c.lheading)("blockquote",c.blockquote)("tag","<"+c._tag)("def",c.def)(),c.normal=l({},c),c.gfm=l({},c.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),c.gfm.paragraph=o(c.paragraph)("(?!","(?!"+c.gfm.fences.source.replace("\\1","\\2")+"|"+c.list.source.replace("\\1","\\3")+"|")(),c.tables=l({},c.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),e.rules=c,e.lex=function(t,i){var n=new e(i);return n.lex(t)},e.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g,"    ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},e.prototype.token=function(e,t,i){for(var n,r,s,o,a,l,d,h,u,e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.newline.exec(e))&&(e=e.substring(s[0].length),s[0].length>1&&this.tokens.push({type:"space"})),s=this.rules.code.exec(e))e=e.substring(s[0].length),s=s[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?s:s.replace(/\n+$/,"")});else if(s=this.rules.fences.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"code",lang:s[2],text:s[3]||""});else if(s=this.rules.heading.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"heading",depth:s[1].length,text:s[2]});else if(t&&(s=this.rules.nptable.exec(e))){for(e=e.substring(s[0].length),l={type:"table",header:s[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3].replace(/\n$/,"").split("\n")},h=0;h<l.align.length;h++)/^ *-+: *$/.test(l.align[h])?l.align[h]="right":/^ *:-+: *$/.test(l.align[h])?l.align[h]="center":/^ *:-+ *$/.test(l.align[h])?l.align[h]="left":l.align[h]=null;for(h=0;h<l.cells.length;h++)l.cells[h]=l.cells[h].split(/ *\| */);this.tokens.push(l)}else if(s=this.rules.lheading.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"heading",depth:"="===s[2]?1:2,text:s[1]});else if(s=this.rules.hr.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"hr"});else if(s=this.rules.blockquote.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"blockquote_start"}),s=s[0].replace(/^ *> ?/gm,""),this.token(s,t,!0),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),o=s[2],this.tokens.push({type:"list_start",ordered:o.length>1}),s=s[0].match(this.rules.item),n=!1,u=s.length,h=0;h<u;h++)l=s[h],d=l.length,l=l.replace(/^ *([*+-]|\d+\.) +/,""),~l.indexOf("\n ")&&(d-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+d+"}","gm"),"")),this.options.smartLists&&h!==u-1&&(a=c.bullet.exec(s[h+1])[0],o===a||o.length>1&&a.length>1||(e=s.slice(h+1).join("\n")+e,h=u-1)),r=n||/\n\n(?!\s*$)/.test(l),h!==u-1&&(n="\n"===l.charAt(l.length-1),r||(r=n)),this.tokens.push({type:r?"loose_item_start":"list_item_start"}),this.token(l,!1,i),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(s=this.rules.html.exec(e))e=e.substring(s[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===s[1]||"script"===s[1]||"style"===s[1]),text:s[0]});else if(!i&&t&&(s=this.rules.def.exec(e)))e=e.substring(s[0].length),this.tokens.links[s[1].toLowerCase()]={href:s[2],title:s[3]};else if(t&&(s=this.rules.table.exec(e))){for(e=e.substring(s[0].length),l={type:"table",header:s[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:s[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:s[3].replace(/(?: *\| *)?\n$/,"").split("\n")},h=0;h<l.align.length;h++)/^ *-+: *$/.test(l.align[h])?l.align[h]="right":/^ *:-+: *$/.test(l.align[h])?l.align[h]="center":/^ *:-+ *$/.test(l.align[h])?l.align[h]="left":l.align[h]=null;for(h=0;h<l.cells.length;h++)l.cells[h]=l.cells[h].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(l)}else if(t&&(s=this.rules.paragraph.exec(e)))e=e.substring(s[0].length),this.tokens.push({type:"paragraph",text:"\n"===s[1].charAt(s[1].length-1)?s[1].slice(0,-1):s[1]});else if(s=this.rules.text.exec(e))e=e.substring(s[0].length),this.tokens.push({type:"text",text:s[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var h={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:a,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:a,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};h._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,h._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,h.link=o(h.link)("inside",h._inside)("href",h._href)(),h.reflink=o(h.reflink)("inside",h._inside)(),h.normal=l({},h),h.pedantic=l({},h.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),h.gfm=l({},h.normal,{escape:o(h.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:o(h.text)("]|","~]|")("|","|https?://|")()}),h.breaks=l({},h.gfm,{br:o(h.br)("{2,}","*")(),text:o(h.gfm.text)("{2,}","*")()}),t.rules=h,t.output=function(e,i,n){var r=new t(i,n);return r.output(e)},t.prototype.output=function(e){for(var t,i,n,s,o="";e;)if(s=this.rules.escape.exec(e))e=e.substring(s[0].length),o+=s[1];else if(s=this.rules.autolink.exec(e))e=e.substring(s[0].length),"@"===s[2]?(i=":"===s[1].charAt(6)?this.mangle(s[1].substring(7)):this.mangle(s[1]),n=this.mangle("mailto:")+i):(i=r(s[1]),n=i),o+=this.renderer.link(n,null,i);else if(this.inLink||!(s=this.rules.url.exec(e))){if(s=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(s[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(s[0])&&(this.inLink=!1),e=e.substring(s[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(s[0]):r(s[0]):s[0];else if(s=this.rules.link.exec(e))e=e.substring(s[0].length),this.inLink=!0,o+=this.outputLink(s,{href:s[2],title:s[3]}),this.inLink=!1;else if((s=this.rules.reflink.exec(e))||(s=this.rules.nolink.exec(e))){if(e=e.substring(s[0].length),t=(s[2]||s[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){o+=s[0].charAt(0),e=s[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(s,t),this.inLink=!1}else if(s=this.rules.strong.exec(e))e=e.substring(s[0].length),o+=this.renderer.strong(this.output(s[2]||s[1]));else if(s=this.rules.em.exec(e))e=e.substring(s[0].length),o+=this.renderer.em(this.output(s[2]||s[1]));else if(s=this.rules.code.exec(e))e=e.substring(s[0].length),o+=this.renderer.codespan(r(s[2],!0));else if(s=this.rules.br.exec(e))e=e.substring(s[0].length),o+=this.renderer.br();else if(s=this.rules.del.exec(e))e=e.substring(s[0].length),o+=this.renderer.del(this.output(s[1]));else if(s=this.rules.text.exec(e))e=e.substring(s[0].length),o+=this.renderer.text(r(this.smartypants(s[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(s[0].length),i=r(s[1]),n=i,o+=this.renderer.link(n,null,i);return o},t.prototype.outputLink=function(e,t){var i=r(t.href),n=t.title?r(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(i,n,this.output(e[1])):this.renderer.image(i,n,r(e[1]))},t.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},t.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,i="",n=e.length,r=0;r<n;r++)t=e.charCodeAt(r),Math.random()>.5&&(t="x"+t.toString(16)),i+="&#"+t+";";return i},i.prototype.code=function(e,t,i){if(this.options.highlight){var n=this.options.highlight(e,t);null!=n&&n!==e&&(i=!0,e=n)}return t?'<pre><code class="'+this.options.langPrefix+r(t,!0)+'">'+(i?e:r(e,!0))+"\n</code></pre>\n":"<pre><code>"+(i?e:r(e,!0))+"\n</code></pre>"},i.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},i.prototype.html=function(e){return e},i.prototype.heading=function(e,t,i){return"<h"+t+' id="'+this.options.headerPrefix+i.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},i.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},i.prototype.list=function(e,t){var i=t?"ol":"ul";return"<"+i+">\n"+e+"</"+i+">\n"},i.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},i.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},i.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},i.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},i.prototype.tablecell=function(e,t){var i=t.header?"th":"td",n=t.align?"<"+i+' style="text-align:'+t.align+'">':"<"+i+">";return n+e+"</"+i+">\n"},i.prototype.strong=function(e){return"<strong>"+e+"</strong>"},i.prototype.em=function(e){return"<em>"+e+"</em>"},i.prototype.codespan=function(e){return"<code>"+e+"</code>"},i.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},i.prototype.del=function(e){return"<del>"+e+"</del>"},i.prototype.link=function(e,t,i){if(this.options.sanitize){try{var n=decodeURIComponent(s(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(0===n.indexOf("javascript:")||0===n.indexOf("vbscript:"))return""}var r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+i+"</a>"},i.prototype.image=function(e,t,i){var n='<img src="'+e+'" alt="'+i+'"';return t&&(n+=' title="'+t+'"'),n+=this.options.xhtml?"/>":">"},i.prototype.text=function(e){return e},n.parse=function(e,t,i){var r=new n(t,i);return r.parse(e)},n.prototype.parse=function(e){this.inline=new t(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var i="";this.next();)i+=this.tok();return i},n.prototype.next=function(){return this.token=this.tokens.pop()},n.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},n.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},n.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,i,n,r,s="",o="";for(i="",e=0;e<this.token.header.length;e++)n={header:!0,align:this.token.align[e]},i+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(s+=this.renderer.tablerow(i),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],i="",r=0;r<t.length;r++)i+=this.renderer.tablecell(this.inline.output(t[r]),{header:!1,align:this.token.align[r]});o+=this.renderer.tablerow(i)}return this.renderer.table(s,o);case"blockquote_start":for(var o="";"blockquote_end"!==this.next().type;)o+=this.tok();return this.renderer.blockquote(o);case"list_start":for(var o="",a=this.token.ordered;"list_end"!==this.next().type;)o+=this.tok();return this.renderer.list(o,a);case"list_item_start":for(var o="";"list_item_end"!==this.next().type;)o+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(o);case"loose_item_start":for(var o="";"list_item_end"!==this.next().type;)o+=this.tok();return this.renderer.listitem(o);case"html":var l=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(l);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},a.exec=a,d.options=d.setOptions=function(e){return l(d.defaults,e),d},d.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,
langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new i,xhtml:!1},d.Parser=n,d.parser=n.parse,d.Renderer=i,d.Lexer=e,d.lexer=e.lex,d.InlineLexer=t,d.inlineLexer=t.output,d.parse=d,"undefined"!=typeof module&&"object"==typeof exports?module.exports=d:"function"==typeof define&&define.amd?define("marked",[],function(){return d}):this.marked=d}.call(function(){return this||("undefined"!=typeof window?window:global)}()),define("app/views/group-discussion",["jquery","underscore","backbone","common","marked","moment"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({tagName:"li",className:"msg ovhd",template:t.template(e("#group-discussion-tmpl").html()),events:{mouseenter:"highlight",mouseleave:"rmHighlight","focus *":"focusItem","click .js-del-msg":"delMessage","click .js-reply-msg":"reply"},initialize:function(e){this.listenTo(this.model,"destroy",this.remove),this.parentView=e.parentView,this.is_group_owner=e.is_group_owner,this.is_group_admin=e.is_group_admin},render:function(){var e=this.model.attributes,i=s(e.created_at),o=!1;(this.is_group_owner||this.is_group_admin||this.model.get("user_email")==app.pageOptions.username)&&(o=!0);var a=n.getUrl({name:"user_profile",username:encodeURIComponent(e.user_email)});return t.extend(e,{content_marked:r(e.content,{breaks:!0,sanitize:!0}),time:i.format("LLLL"),time_from_now:n.getRelativeTimeStr(i),can_delete_msg:o,user_profile_url:a}),this.$el.html(this.template(e)),this},highlight:function(){this.$el.addClass("hl"),this.$(".msg-ops").removeClass("vh")},rmHighlight:function(){this.$el.removeClass("hl"),this.$(".msg-ops").addClass("vh")},focusItem:function(){e(".msg.hl",this.$el.parent()).removeClass("hl").find(".msg-ops").addClass("vh"),this.highlight()},reply:function(){return this.parentView.replyTo(this.model.get("user_name")),!1},delMessage:function(){return this.model.destroy({wait:!0,success:function(){},error:function(t,i){var r;r=i.responseText?e.parseJSON(i.responseText).error_msg:gettext("Failed. Please check the network."),n.feedback(r,"error")}}),!1}});return o}),define("app/views/group-discussions",["jquery","underscore","backbone","common","app/collections/group-discussions","app/views/group-discussion"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({id:"group-discussions",className:"right-side-panel",template:t.template(e("#group-discussions-tmpl").html()),initialize:function(t){this.groupView=t.groupView,this.collection=new r,this.listenTo(this.collection,"add",this.addOne),this.listenTo(this.collection,"reset",this.reset),this.render(),e("#main").append(this.$el),app.ui.groupDiscussions=this;var i=this;e(document).keydown(function(e){27==e.which&&i.hide()}),e(window).resize(function(){i.setConMaxHeight()})},events:{"click .js-close":"close","click .js-load-more":"loadMore","submit form":"formSubmit"},addOne:function(e,t,i){var n=new s({model:e,is_group_owner:this.is_group_owner,is_group_admin:this.is_group_admin,parentView:this});i.prepend?this.$listContainer.append(n.render().el):this.$listContainer.prepend(n.render().el)},reset:function(){this.$error.hide(),this.$loadingTip.hide(),this.$listContainer.empty(),this.collection.length?(this.$emptyTip.hide(),this.collection.each(this.addOne,this),this.$listContainer.show(),this.collection.current_page<this.collection.page_num?this.$loadMore.show():this.$loadMore.hide(),this.scrollConToBottom()):(this.$emptyTip.show(),this.$listContainer.hide(),this.$loadMore.hide())},render:function(){this.$el.html(this.template()),this.$loadingTip=this.$(".loading-tip"),this.$listContainer=this.$("#group-discussion-list"),this.$emptyTip=this.$(".no-discussion-tip"),this.$error=this.$(".error"),this.$loadMore=this.$(".js-load-more")},showContent:function(){this.$listContainer.hide(),this.$loadingTip.show();var t=this;this.is_group_owner=!1,this.is_group_admin=!1,app.pageOptions.username==this.groupView.group.owner?this.is_group_owner=!0:e.inArray(app.pageOptions.username,this.groupView.group.admins)!=-1&&(this.is_group_admin=!0),this.collection.setGroupId(this.groupView.group.id),this.collection.fetch({cache:!1,reset:!0,data:{avatar_size:64},success:function(e,t,i){},error:function(e,i,n){t.$loadingTip.hide();var r;r=i.responseText?401==i.status||403==i.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),t.$error.html(r).show()}}),this.$(".msg-input").focus(),app.router.navigate("group/"+this.groupView.group.id+"/discussions/")},setConMaxHeight:function(){this.$(".group-discussions-con").css({height:e(window).height()-this.$el.offset().top-this.$(".group-discussions-hd").outerHeight(!0)-this.$(".group-discussions-footer").outerHeight(!0)})},hide:function(){this.$el.css({right:"-400px"})},close:function(){return app.router.navigate("group/"+this.groupView.group.id+"/"),this.hide(),!1},toggle:function(){return this.show(),!1},show:function(){this.showContent(),this.$el.css({right:"0px"}),this.setConMaxHeight()},replyTo:function(e){var t="@"+e+" ",i=this.$('[name="message"]').val(t);n.setCaretPosition(i[0],t.length),i.focus()},loadMore:function(){var t=this;this.$loadMore.hide(),this.$loadingTip.show(),this.collection.fetch({cache:!1,remove:!1,data:{avatar_size:64,page:this.collection.current_page+1},success:function(i,n,r){var s=0;t.$(".msg:lt("+n.msgs.length+")").each(function(){s+=e(this).outerHeight(!0)}),t.$(".group-discussions-con").scrollTop(s-50)},error:function(e,i,n){var r;r=i.responseText?401==i.status||403==i.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),t.$error.html(r).show()},complete:function(){t.$loadingTip.hide(),t.collection.current_page<t.collection.page_num?t.$loadMore.show():t.$loadMore.hide()}})},formSubmit:function(){var t=this,i=e.trim(this.$('[name="message"]').val());return!!i&&(this.collection.create({content:i,avatar_size:64},{wait:!0,validate:!0,prepend:!0,success:function(){t.$('[name="message"]').val(""),1==t.collection.length?t.collection.reset(t.collection.models):t.scrollConToBottom()},error:function(e,i,n){var r;r=i.responseText?i.responseJSON.error_msg:gettext("Please check the network."),t.$error.html(r).show()}}),!1)},scrollConToBottom:function(){var e=this.$(".group-discussions-con");e.scrollTop(e[0].scrollHeight-e[0].clientHeight)}});return o}),define("app/views/group-manage-member",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.View.extend({tagName:"tr",template:t.template(e("#group-manage-member-tmpl").html()),events:{mouseenter:"highlight",mouseleave:"rmHighlight","click .role-edit-icon":"showEdit","change .role-edit":"editRole","click .rm":"rmMember"},initialize:function(e){this.group_id=e.group_id,this.is_owner=e.is_owner,this.$errorContainer=e.errorContainer,this.listenTo(this.model,"change",this.render)},render:function(){return this.$el.html(this.template(e.extend(this.model.attributes,{is_owner:this.is_owner,username:app.pageOptions.username}))),this},highlight:function(){this.$el.addClass("hl").find(".op-icon").removeClass("vh")},rmHighlight:function(){this.$el.removeClass("hl").find(".op-icon").addClass("vh")},showEdit:function(){this.$(".cur-role, .role-edit-icon").hide(),this.$(".role-edit").show()},editRole:function(){var t=this,i=this.$('[name="role"]').val(),r=1==i;e.ajax({url:n.getUrl({name:"group_member",group_id:this.group_id,email:encodeURIComponent(this.model.get("email"))}),type:"put",dataType:"json",beforeSend:n.prepareCSRFToken,data:{is_admin:r},success:function(){t.model.set({is_admin:r})},error:function(i){var n;n=i.responseText?e.parseJSON(i.responseText).error_msg:gettext("Failed. Please check the network."),t.$errorContainer.html(n).show()}})},rmMember:function(){var t=this;e.ajax({url:n.getUrl({name:"group_member",group_id:this.group_id,email:encodeURIComponent(this.model.get("email"))}),type:"delete",dataType:"json",beforeSend:n.prepareCSRFToken,success:function(){t.remove()},error:function(i){var n;n=i.responseText?e.parseJSON(i.responseText).error_msg:gettext("Failed. Please check the network."),t.$errorContainer.html(n).show()}})}});return r}),define("app/views/group-manage-members",["jquery","underscore","backbone","common","app/collections/group-members","app/views/group-manage-member"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({template:t.template(e("#group-manage-members-tmpl").html()),initialize:function(t){this.group_id=t.group_id,this.group_name=t.group_name,this.is_owner=t.is_owner,this.render(),this.$(".op-target").css({"max-width":270}),this.$el.modal({appendTo:"#main",focus:!1,containerCss:{width:560},onClose:function(){e(document).off("click",s),e.modal.close()}}),this.$modalContainer=e("#simplemodal-container").css({height:"auto"}),this.$('[name="user_name"]').select2(e.extend({width:"320px"},n.contactInputOptionsForSelect2())),this.collection=new r,this.listenTo(this.collection,"add",this.addOne),this.renderMemberList(),this.setConMaxHeight(),this.$loadingTip=this.$(".loading-tip"),this.$listContainer=this.$("tbody"),this.$error=this.$(".error");var i=this;e(window).resize(function(){i.setConMaxHeight()});var s=function(e){var t=e.target||event.srcElement,n=i.$(".role-edit:visible"),r=n.parent();!n.length||n.is(t)||n.find("*").is(t)||r.find(".role-edit-icon").is(t)||(n.hide(),r.find(".cur-role, .role-edit-icon").show())};e(document).click(s)},render:function(){var e=gettext("{placeholder} Members").replace("{placeholder}",'<span class="op-target ellipsis ellipsis-op-target" title="'+n.HTMLescape(this.group_name)+'">'+n.HTMLescape(this.group_name)+"</span>");return this.$el.html(this.template({title:e,is_owner:this.is_owner})),this},events:{"submit form":"formSubmit"},addOne:function(e,t,i){var n=new s({model:e,group_id:this.group_id,is_owner:this.is_owner,errorContainer:this.$error});i.prepend?this.$listContainer.prepend(n.render().el):this.$listContainer.append(n.render().el)},renderMemberList:function(){var e=this;this.collection.setGroupId(this.group_id),this.collection.fetch({cache:!1,data:{avatar_size:40},success:function(t,i,n){e.$loadingTip.hide()},error:function(t,i,n){e.$loadingTip.hide();var r;r=i.responseText?401==i.status||403==i.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),e.$error.html(r).show()}})},formSubmit:function(){var t=this,i=this.$('[name="user_name"]'),r=e.trim(i.val());if(!r)return!1;var s=r.split(",");return 1==s.length?this.collection.create({email:r},{wait:!0,validate:!0,prepend:!0,success:function(){i.select2("val","")},error:function(e,n,r){i.select2("val","");var s;s=n.responseText?n.responseJSON.error_msg:gettext("Please check the network."),t.$error.html(s).show()}}):e.ajax({url:n.getUrl({name:"group_member_bulk",group_id:t.group_id}),type:"post",dataType:"json",beforeSend:n.prepareCSRFToken,data:{emails:r},success:function(r){i.select2("val",""),r.success.length>0&&t.collection.add(r.success,{prepend:!0});var s="";r.failed.length>0&&(e(r.failed).each(function(e,t){s+=n.HTMLescape(t.email)+": "+n.HTMLescape(t.error_msg)+"<br />"}),t.$error.html(s).show())},error:function(e){var i;i=e.responseText?gettext("Error"):gettext("Failed. Please check the network."),t.$error.html(i).show()}}),!1},setConMaxHeight:function(){var t=this.$modalContainer;this.$(".members").css({"max-height":e(window).height()-parseInt(t.css("top"))-parseInt(t.css("padding-top"))-parseInt(t.css("padding-bottom"))-this.$("h3").outerHeight(!0)-this.$("form").outerHeight(!0)-20,overflow:"auto"})}});return o}),define("app/views/group-settings",["jquery","underscore","backbone","common","app/views/group-manage-members","app/views/widgets/popover"],function(e,t,i,n,r,s){"use strict";var o=s.extend({id:"group-settings",className:"sf-popover",template:t.template(e("#group-settings-tmpl").html()),contentTemplate:t.template(e("#group-settings-content-tmpl").html()),renameTemplate:t.template(e("#group-rename-form-tmpl").html()),transferTemplate:t.template(e("#group-transfer-form-tmpl").html()),importMembersTemplate:t.template(e("#group-import-members-form-tmpl").html()),initialize:function(e){s.prototype.initialize.call(this),this.groupView=e.groupView,this.render()},events:{"mouseenter .group-setting-item":"highlightItem","mouseleave .group-setting-item":"rmHighlightItem","click .group-setting-item":"manageGroup"},render:function(){this.$el.html(this.template())},showContent:function(){this.$listContainer=this.$(".sf-popover-con"),this.is_owner=!1,this.is_admin=!1,app.pageOptions.username==this.groupView.group.owner?this.is_owner=!0:e.inArray(app.pageOptions.username,this.groupView.group.admins)!=-1&&(this.is_admin=!0),this.$listContainer.html(this.contentTemplate({is_owner:this.is_owner,is_admin:this.is_admin,wiki_enabled:this.groupView.group.wiki_enabled})),e("#group-settings-icon").after(this.$el)},highlightItem:function(t){e(t.currentTarget).addClass("hl")},rmHighlightItem:function(t){e(t.currentTarget).removeClass("hl")},manageGroup:function(t){switch(e(t.currentTarget).data("op")){case"rename":this.rename();break;case"transfer":this.transfer();break;case"add-wiki":this.toggleWiki("on");break;case"remove-wiki":this.toggleWiki("off");break;case"import-members":this.importMembers();break;case"manage-members":this.manageMembers();break;case"dismiss":this.dismiss();break;case"leave":this.leave()}return this.hide(),!1},rename:function(){var t=this,i=e(this.renameTemplate());i.modal(),e("#simplemodal-container").css({width:"auto",height:"auto"}),i.submit(function(){var r=e.trim(e('[name="new_name"]',e(this)).val());if(!r||r==t.groupView.group.name)return!1;var s=e('[type="submit"]',e(this));return n.disableButton(s),e.ajax({url:n.getUrl({name:"group",group_id:t.groupView.group.id}),type:"put",dataType:"json",beforeSend:n.prepareCSRFToken,data:{name:r},success:function(){e.modal.close(),app.ui.sideNavView.updateGroups(),t.groupView.renderGroupTop()},error:function(t){var r;r=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),e(".error",i).html(r).show(),n.enableButton(s)}}),!1})},transfer:function(){var t=this,i=e(this.transferTemplate());i.modal({focus:!1,minWidth:268}),e("#simplemodal-container").css({width:"auto",height:"auto"}),e('[name="email"]',i).select2(e.extend(n.contactInputOptionsForSelect2(),{width:"268px",maximumSelectionSize:1,placeholder:gettext("Search user or enter email and press Enter"),formatSelectionTooBig:gettext("You cannot select any more choices")})),i.submit(function(){var r=e.trim(e('[name="email"]',e(this)).val());if(!r)return!1;if(r==t.groupView.group.owner)return!1;var s=e('[type="submit"]',e(this));return n.disableButton(s),e.ajax({url:n.getUrl({name:"group",group_id:t.groupView.group.id}),type:"put",dataType:"json",beforeSend:n.prepareCSRFToken,data:{owner:r},success:function(i){t.groupView.group=i,n.feedback(gettext("Successfully transferred the group. You are now a normal member of the group."),"success"),e.modal.close()},error:function(t){var r;r=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),e(".error",i).html(r).show(),n.enableButton(s)}}),!1})},toggleWiki:function(t){var i,r=this;i="on"==t?"true":"false",e.ajax({url:n.getUrl({name:"group",group_id:r.groupView.group.id}),type:"put",dataType:"json",beforeSend:n.prepareCSRFToken,data:{wiki_enabled:i},success:function(){r.hide(),r.groupView.renderGroupTop()},error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),n.feedback(i,"error"),r.hide()}})},importMembers:function(){var t=this,i=e(this.importMembersTemplate());i.modal({focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"}),i.submit(function(){var r=e("[name=file]",i)[0],s=e(".error",i);if(!r.files.length)return s.html(gettext("Please choose a CSV file")).removeClass("hide"),!1;var o=e('[type="submit"]',e(this));n.disableButton(o);var a=r.files[0],l=new FormData;return l.append("file",a),e.ajax({url:n.getUrl({name:"group_import_members",group_id:t.groupView.group.id}),type:"post",dataType:"json",data:l,processData:!1,contentType:!1,beforeSend:n.prepareCSRFToken,success:function(t){if(t.failed.length>0){var i="";e(t.failed).each(function(e,t){i+=n.HTMLescape(t.email)+": "+n.HTMLescape(t.error_msg)+"<br />"}),s.html(i).removeClass("hide"),n.enableButton(o)}else e.modal.close(),n.feedback(gettext("Successfully imported."),"success")},error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error:gettext("Failed. Please check the network."),s.html(i).removeClass("hide"),n.enableButton(o)}}),!1})},manageMembers:function(){new r({group_id:this.groupView.group.id,group_name:this.groupView.group.name,is_owner:this.is_owner})},dismiss:function(){var t=this,i=gettext("Dismiss Group"),r=gettext("Really want to dismiss this group?"),s=function(){e.ajax({url:n.getUrl({name:"group",group_id:t.groupView.group.id}),type:"delete",dataType:"json",beforeSend:n.prepareCSRFToken,success:function(){app.ui.sideNavView.updateGroups(),app.router.navigate("groups/",{trigger:!0})},error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),n.feedback(i,"error")},complete:function(){e.modal.close()}})};n.showConfirm(i,r,s)},leave:function(){var t=this,i=gettext("Quit Group"),r=gettext("Are you sure you want to quit this group?"),s=function(){e.ajax({url:n.getUrl({name:"group_member",group_id:t.groupView.group.id,email:encodeURIComponent(app.pageOptions.username)}),type:"delete",dataType:"json",beforeSend:n.prepareCSRFToken,success:function(){app.ui.sideNavView.updateGroups(),app.router.navigate("groups/",{trigger:!0})},error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),n.feedback(error_msg,"error")},complete:function(){e.modal.close()}})};n.showConfirm(i,r,s)}});return o}),define("app/views/group",["jquery","underscore","backbone","common","app/collections/group-repos","app/views/group-repo","app/views/add-group-repo","app/views/group-members","app/views/group-discussions","app/views/group-settings"],function(e,t,i,n,r,s,o,a,l,d){"use strict";var c=i.View.extend({id:"group",template:t.template(e("#group-tmpl").html()),groupTopTemplate:t.template(e("#group-top-tmpl").html()),reposHdTemplate:t.template(e("#shared-repos-hd-tmpl").html()),mobileReposHdTemplate:t.template(e("#shared-repos-hd-mobile-tmpl").html()),events:{"click #group-settings-icon":"toggleSettingsPanel","click #group-members-icon":"toggleMembersPanel","click #group-discussions-icon":"toggleDiscussionsPanel","click .repo-create":"createRepo","click .by-name":"sortByName","click .by-time":"sortByTime"},initialize:function(e){this.group={},this.repos=new r,this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset),this.settingsView=new d({groupView:this}),this.membersView=new a({groupView:this}),this.discussionsView=new l({groupView:this}),this.render()},addOne:function(e,t,i){var n=new s({model:e,group_id:this.group_id,show_repo_owner:!0,is_staff:this.repos.is_staff});i.prepend?this.$tableBody.prepend(n.render().el):this.$tableBody.append(n.render().el)},renderReposHd:function(){var t=e(window).width()>=768?this.reposHdTemplate:this.mobileReposHdTemplate;this.$tableHead.html(t())},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.repos.length?(this.$emptyTip.hide(),this.renderReposHd(),this.$tableBody.empty(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),this.repos.each(this.addOne,this),this.$table.show()):(this.$emptyTip.show(),this.$table.hide())},renderGroupTop:function(t){var i=this,r=e("#group-top");e.ajax({url:n.getUrl({name:"group",group_id:this.group_id}),cache:!1,dataType:"json",success:function(e){i.group=e,r.html(i.groupTopTemplate(e)),t&&t.showDiscussions&&i.showDiscussions()},error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Please check the network."),r.html('<p class="error">'+i+"</p>")}})},showRepoList:function(e,t){this.group_id=e,this.$emptyTip.hide(),this.renderGroupTop(t),this.$table.hide();var i=this.$loadingTip;i.show();var n=this;this.repos.setGroupID(e),this.repos.fetch({cache:!1,reset:!0,data:{from:"web"},success:function(e,t,i){},error:function(e,t,r){i.hide();var s,o=n.$(".error");s=t.responseText?401==t.status||403==t.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),o.html(s).show()}})},render:function(){this.$el.html(this.template()),this.$table=this.$("table"),this.$tableHead=this.$("thead"),this.$tableBody=this.$("tbody"),this.$loadingTip=this.$("#group-repos .loading-tip"),this.$emptyTip=this.$("#group-repos .empty-tips"),this.attached=!1},show:function(t,i){this.attached||(e("#right-panel").html(this.$el),this.attached=!0),this.showRepoList(t,i)},hide:function(){this.attached=!1,this.$el.detach()},createRepo:function(){new o(this.repos)},sortByName:function(){return n.toggleSortByNameMode(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.repos.comparator=null,!1},sortByTime:function(){return n.toggleSortByTimeMode(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.repos.comparator=null,!1},toggleSettingsPanel:function(){return this.settingsView.toggle()},toggleMembersPanel:function(){return this.membersView.toggle()},showDiscussions:function(){return this.discussionsView.show()},toggleDiscussionsPanel:function(){return this.discussionsView.toggle()}});return c}),define("app/models/pub-repo",["underscore","backbone","app/models/repo"],function(e,t,i){"use strict";var n=i.extend({defaults:{permission:"r"}});return e.extend(n.prototype.defaults,i.prototype.defaults),n}),define("app/collections/pub-repos",["underscore","backbone","common","app/models/pub-repo"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,comparator:NaN,url:function(){return i.getUrl({name:"pub_repos"})}});return r}),define("app/views/organization-repo",["jquery","underscore","backbone","common","app/views/widgets/hl-item-view"],function(e,t,i,n,r){"use strict";var s=r.extend({tagName:"tr",template:t.template(e("#organization-repo-tmpl").html()),mobileTemplate:t.template(e("#organization-repo-mobile-tmpl").html()),initialize:function(){r.prototype.initialize.call(this)},render:function(){var i=this.model.toJSON(),r=n.isHiDPI()?48:24,s=this.model.getIconUrl(r),o=e(window).width()>=768?this.template:this.mobileTemplate;return t.extend(i,{icon_url:s,icon_title:this.model.getIconTitle()}),this.$el.html(o(i)),this},events:{"click .cancel-share":"removeShare"},removeShare:function(){var t=this.$el;this.model.get("name");return e.ajax({url:n.getUrl({name:"shared_repos",repo_id:this.model.get("id")})+"?share_type=public",type:"DELETE",beforeSend:n.prepareCSRFToken,dataType:"json",success:function(){t.remove();var e=gettext("Successfully unshared 1 item.");n.feedback(e,"success",n.SUCCESS_TIMOUT)},error:function(e){n.ajaxErrorHandler(e)}}),!1}});return s}),define("app/views/create-pub-repo",["jquery","simplemodal","underscore","backbone","common","app/views/add-repo"],function(e,t,i,n,r,s){"use strict";var o=s.extend({templateData:function(){return{showSharePerm:!0,enable_encrypted_library:app.pageOptions.enable_encrypted_library,storages:app.pageOptions.storages,library_templates:app.pageOptions.library_templates}},newAttributes:function(){var t=s.prototype.newAttributes.apply(this);return i.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,i,n){"use strict";var r=i.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 i=e(t.currentTarget).val();this.model.set({pub_perm:i},{silent:!0})},select:function(){var e=this.$("[type=checkbox]");e.prop("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 r}),define("app/views/add-pub-repo",["jquery","simplemodal","underscore","backbone","common","app/collections/repos","app/views/add-pubrepo-item"],function(e,t,i,n,r,s,o){"use strict";var a=n.View.extend({id:"add-pubrepo-popup",template:i.template(e("#add-pubrepo-popup-tmpl").html()),initialize:function(t){this.$el.html(this.template()).modal({focus:!1}),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}),n=this,s=[];i.each(t,function(t){var i=t.id,n="rw";t.has("pub_perm")&&(n=t.get("pub_perm")),s.push(e.ajax({url:r.getUrl({name:"shared_repos",repo_id:i})+"?share_type=public&permission="+n,type:"PUT",beforeSend:r.prepareCSRFToken,dataType:"json",error:function(e,t,i){r.ajaxErrorHandler(e,t,i)}}))});var o=e.when.apply(e,s);o.done(function(){e.modal.close(),n.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 a}),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","app/views/widgets/dropdown"],function(e,t,i,n,r,s,o,a,l){"use strict";var d=i.View.extend({id:"organization",template:t.template(e("#organization-repos-tmpl").html()),reposHdTemplate:t.template(e("#shared-repos-hd-tmpl").html()),mobileReposHdTemplate:t.template(e("#shared-repos-hd-mobile-tmpl").html()),initialize:function(e){this.repos=new r,this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset),this.render()},render:function(){this.$el.html(this.template()),this.$table=this.$("table"),this.$tableHead=e("thead",this.$table),this.$tableBody=e("tbody",this.$table),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips"),this.dropdown=new l({el:this.$(".js-add-pub-lib-dropdown"),right:"0px"})},show:function(){e("#right-panel").html(this.$el),this.showRepoList()},hide:function(){this.$el.detach()},events:{"click .share-existing":"addRepo","click .create-new":"createRepo","click .by-name":"sortByName","click .by-time":"sortByTime"},createRepo:function(){return new o(this.repos),this.dropdown.hide(),!1},addRepo:function(){return new a(this.repos),this.dropdown.hide(),!1},addOne:function(e,t,i){var n=new s({model:e,collection:this.repos});i.prepend?this.$tableBody.prepend(n.render().el):this.$tableBody.append(n.render().el)},renderReposHd:function(){var t=e(window).width()>=768?this.reposHdTemplate:this.mobileReposHdTemplate;this.$tableHead.html(t())},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.repos.length?(this.$emptyTip.hide(),this.renderReposHd(),this.$tableBody.empty(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),this.repos.each(this.addOne,this),this.$table.show()):(this.$table.hide(),this.$emptyTip.show())},showRepoList:function(){var e=this.$loadingTip;e.show();var t=this;this.repos.fetch({cache:!1,reset:!0,success:function(e,t,i){},error:function(i,n,r){e.hide();var s,o=t.$(".error");s=n.responseText?401==n.status||403==n.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),o.html(s).show()}})},sortByName:function(){return n.toggleSortByNameMode(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.repos.comparator=null,!1},sortByTime:function(){return n.toggleSortByTimeMode(),n.updateSortIconByMode({context:this.$el}),n.sortLibs({libs:this.repos}),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.repos.comparator=null,!1}});return d}),function(e){"function"==typeof define&&define.amd?define("jquery.ui.core",["jquery"],e):e(jQuery)}(function(e){function t(t,n){var r,s,o,a=t.nodeName.toLowerCase();return"area"===a?(r=t.parentNode,s=r.name,!(!t.href||!s||"map"!==r.nodeName.toLowerCase())&&(o=e("img[usemap='#"+s+"']")[0],!!o&&i(o))):(/^(input|select|textarea|button|object)$/.test(a)?!t.disabled:"a"===a?t.href||n:n)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).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 i=this.css("position"),n="absolute"===i,r=t?/(auto|scroll|hidden)/:/(auto|scroll)/,s=this.parents().filter(function(){var t=e(this);return(!n||"static"!==t.css("position"))&&r.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&s.length?s:e(this[0].ownerDocument||document)},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(i){return!!e.data(i,t)}}):function(t,i,n){return!!e.data(t,n[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var n=e.attr(i,"tabindex"),r=isNaN(n);return(r||n>=0)&&t(i,!r)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function n(t,i,n,s){return e.each(r,function(){i-=parseFloat(e.css(t,"padding"+this))||0,n&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var r="Width"===i?["Left","Right"]:["Top","Bottom"],s=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(s,n(this,t)+"px")})},e.fn["outer"+i]=function(t,r){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(s,n(this,t,!0,r)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?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(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,n){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),n&&n.call(t)},i)}):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(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,n,r=e(this[0]);r.length&&r[0]!==document;){if(i=r.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(n=parseInt(r.css("zIndex"),10),!isNaN(n)&&0!==n))return n;r=r.parent()}return 0}}),e.ui.plugin={add:function(t,i,n){var r,s=e.ui[t].prototype;for(r in n)s.plugins[r]=s.plugins[r]||[],s.plugins[r].push([i,n[r]])},call:function(e,t,i,n){var r,s=e.plugins[t];if(s&&(n||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(r=0;r<s.length;r++)e.options[s[r][0]]&&s[r][1].apply(e.element,i);
}}}),function(e){"function"==typeof define&&define.amd?define("jquery.ui.widget",["jquery"],e):e(jQuery)}(function(e){var t=0,i=Array.prototype.slice;e.cleanData=function(t){return function(i){var n,r,s;for(s=0;null!=(r=i[s]);s++)try{n=e._data(r,"events"),n&&n.remove&&e(r).triggerHandler("remove")}catch(e){}t(i)}}(e.cleanData),e.widget=function(t,i,n){var r,s,o,a,l={},d=t.split(".")[0];return t=t.split(".")[1],r=d+"-"+t,n||(n=i,i=e.Widget),e.expr[":"][r.toLowerCase()]=function(t){return!!e.data(t,r)},e[d]=e[d]||{},s=e[d][t],o=e[d][t]=function(e,t){return this._createWidget?void(arguments.length&&this._createWidget(e,t)):new o(e,t)},e.extend(o,s,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),a=new i,a.options=e.widget.extend({},a.options),e.each(n,function(t,n){return e.isFunction(n)?void(l[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},r=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,s=this._superApply;return this._super=e,this._superApply=r,t=n.apply(this,arguments),this._super=i,this._superApply=s,t}}()):void(l[t]=n)}),o.prototype=e.widget.extend(a,{widgetEventPrefix:s?a.widgetEventPrefix||t:t},l,{constructor:o,namespace:d,widgetName:t,widgetFullName:r}),s?(e.each(s._childConstructors,function(t,i){var n=i.prototype;e.widget(n.namespace+"."+n.widgetName,o,i._proto)}),delete s._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var n,r,s=i.call(arguments,1),o=0,a=s.length;o<a;o++)for(n in s[o])r=s[o][n],s[o].hasOwnProperty(n)&&void 0!==r&&(e.isPlainObject(r)?t[n]=e.isPlainObject(t[n])?e.widget.extend({},t[n],r):e.widget.extend({},r):t[n]=r);return t},e.widget.bridge=function(t,n){var r=n.prototype.widgetFullName||t;e.fn[t]=function(s){var o="string"==typeof s,a=i.call(arguments,1),l=this;return s=!o&&a.length?e.widget.extend.apply(null,[s].concat(a)):s,o?this.each(function(){var i,n=e.data(this,r);return"instance"===s?(l=n,!1):n?e.isFunction(n[s])&&"_"!==s.charAt(0)?(i=n[s].apply(n,a),i!==n&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+s+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; attempted to call method '"+s+"'")}):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))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(i,n){n=e(n||this.defaultElement||this)[0],this.element=e(n),this.uuid=t++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),i),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._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,i){var n,r,s,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},n=t.split("."),t=n.shift(),n.length){for(r=o[t]=e.widget.extend({},this.options[t]),s=0;s<n.length-1;s++)r[n[s]]=r[n[s]]||{},r=r[n[s]];if(t=n.pop(),1===arguments.length)return void 0===r[t]?null:r[t];r[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),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,"disabled"===e&&(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,i,n){var r,s=this;"boolean"!=typeof t&&(n=i,i=t,t=!1),n?(i=r=e(i),this.bindings=this.bindings.add(i)):(n=i,i=this.element,r=this.widget()),e.each(n,function(n,o){function a(){if(t||s.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled"))return("string"==typeof o?s[o]:o).apply(s,arguments)}"string"!=typeof o&&(a.guid=o.guid=o.guid||a.guid||e.guid++);var l=n.match(/^([\w:-]*)\s*(.*)$/),d=l[1]+s.eventNamespace,c=l[2];c?r.delegate(c,d,a):i.bind(d,a)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?n[e]:e).apply(n,arguments)}var n=this;return setTimeout(i,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,i,n){var r,s,o=this.options[t];if(n=n||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],s=i.originalEvent)for(r in s)r in i||(i[r]=s[r]);return this.element.trigger(i,n),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(n))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(n,r,s){"string"==typeof r&&(r={effect:r});var o,a=r?r===!0||"number"==typeof r?i:r.effect||i:t;r=r||{},"number"==typeof r&&(r={duration:r}),o=!e.isEmptyObject(r),r.complete=s,r.delay&&n.delay(r.delay),o&&e.effects&&e.effects.effect[a]?n[t](r):a!==t&&n[a]?n[a](r.duration,r.easing,s):n.queue(function(i){e(this)[t](),s&&s.call(n[0]),i()})}});e.widget}),function(e){"function"==typeof define&&define.amd?define("jquery.ui.progressbar",["jquery","jquery.ui.core","jquery.ui.widget"],e):e(jQuery)}(function(e){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){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),void this._refreshValue())},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),!this.indeterminate&&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){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&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,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.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")}})}),function(e){"function"==typeof define&&define.amd?define("jquery.magnific-popup",["jquery"],e):e("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(e){var t,i,n,r,s,o,a,l="Close",d="BeforeClose",c="AfterClose",h="BeforeAppend",u="MarkupParse",p="Open",f="Change",m="mfp",g="."+m,_="mfp-ready",v="mfp-removing",y="mfp-prevent-close",w=function(){},b=!!window.jQuery,T=e(window),x=function(e,i){t.ev.on(m+e+g,i)},S=function(t,i,n,r){var s=document.createElement("div");return s.className="mfp-"+t,n&&(s.innerHTML=n),r?i&&i.appendChild(s):(s=e(s),i&&s.appendTo(i)),s},Y=function(i,n){t.ev.triggerHandler(m+i,n),t.st.callbacks&&(i=i.charAt(0).toLowerCase()+i.slice(1),t.st.callbacks[i]&&t.st.callbacks[i].apply(t,e.isArray(n)?n:[n]))},k=function(i){return i===a&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=e(t.st.closeMarkup.replace("%title%",t.st.tClose)),a=i),t.currTemplate.closeBtn},C=function(){e.magnificPopup.instance||(t=new w,t.init(),e.magnificPopup.instance=t)},L=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1};w.prototype={constructor:w,init:function(){var i=navigator.appVersion;t.isIE7=i.indexOf("MSIE 7.")!==-1,t.isIE8=i.indexOf("MSIE 8.")!==-1,t.isLowIE=t.isIE7||t.isIE8,t.isAndroid=/android/gi.test(i),t.isIOS=/iphone|ipad|ipod/gi.test(i),t.supportsTransition=L(),t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),r=e(document),t.popupsCache={}},open:function(i){n||(n=e(document.body));var s;if(i.isObj===!1){t.items=i.items.toArray(),t.index=0;var a,l=i.items;for(s=0;s<l.length;s++)if(a=l[s],a.parsed&&(a=a.el[0]),a===i.el[0]){t.index=s;break}}else t.items=e.isArray(i.items)?i.items:[i.items],t.index=i.index||0;if(t.isOpen)return void t.updateItemHTML();t.types=[],o="",i.mainEl&&i.mainEl.length?t.ev=i.mainEl.eq(0):t.ev=r,i.key?(t.popupsCache[i.key]||(t.popupsCache[i.key]={}),t.currTemplate=t.popupsCache[i.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopup.defaults,i),t.fixedContentPos="auto"===t.st.fixedContentPos?!t.probablyMobile:t.st.fixedContentPos,t.st.modal&&(t.st.closeOnContentClick=!1,t.st.closeOnBgClick=!1,t.st.showCloseBtn=!1,t.st.enableEscapeKey=!1),t.bgOverlay||(t.bgOverlay=S("bg").on("click"+g,function(){t.close()}),t.wrap=S("wrap").attr("tabindex",-1).on("click"+g,function(e){t._checkIfClose(e.target)&&t.close()}),t.container=S("container",t.wrap)),t.contentContainer=S("content"),t.st.preloader&&(t.preloader=S("preloader",t.container,t.st.tLoading));var d=e.magnificPopup.modules;for(s=0;s<d.length;s++){var c=d[s];c=c.charAt(0).toUpperCase()+c.slice(1),t["init"+c].call(t)}Y("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(x(u,function(e,t,i,n){i.close_replaceWith=k(n.type)}),o+=" mfp-close-btn-in"):t.wrap.append(k())),t.st.alignTop&&(o+=" mfp-align-top"),t.fixedContentPos?t.wrap.css({overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}):t.wrap.css({top:T.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:r.height(),position:"absolute"}),t.st.enableEscapeKey&&r.on("keyup"+g,function(e){27===e.keyCode&&t.close()}),T.on("resize"+g,function(){t.updateSize()}),t.st.closeOnContentClick||(o+=" mfp-auto-cursor"),o&&t.wrap.addClass(o);var h=t.wH=T.height(),f={};if(t.fixedContentPos&&t._hasScrollBar(h)){var m=t._getScrollbarSize();m&&(f.marginRight=m)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):f.overflow="hidden");var v=t.st.mainClass;return t.isIE7&&(v+=" mfp-ie7"),v&&t._addClassToMFP(v),t.updateItemHTML(),Y("BuildControls"),e("html").css(f),t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo||n),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(_),t._setFocus()):t.bgOverlay.addClass(_),r.on("focusin"+g,t._onFocusIn)},16),t.isOpen=!0,t.updateSize(h),Y(p),i},close:function(){t.isOpen&&(Y(d),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(v),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){Y(l);var i=v+" "+_+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(i+=t.st.mainClass+" "),t._removeClassFromMFP(i),t.fixedContentPos){var n={marginRight:""};t.isIE7?e("body, html").css("overflow",""):n.overflow="",e("html").css(n)}r.off("keyup"+g+" focusin"+g),t.ev.off(g),t.wrap.attr("class","mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","mfp-bg"),t.container.attr("class","mfp-container"),!t.st.showCloseBtn||t.st.closeBtnInside&&t.currTemplate[t.currItem.type]!==!0||t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach(),t._lastFocusedEl&&e(t._lastFocusedEl).focus(),t.currItem=null,t.content=null,t.currTemplate=null,t.prevHeight=0,Y(c)},updateSize:function(e){if(t.isIOS){var i=document.documentElement.clientWidth/window.innerWidth,n=window.innerHeight*i;t.wrap.css("height",n),t.wH=n}else t.wH=e||T.height();t.fixedContentPos||t.wrap.css("height",t.wH),Y("Resize")},updateItemHTML:function(){var i=t.items[t.index];t.contentContainer.detach(),t.content&&t.content.detach(),i.parsed||(i=t.parseEl(t.index));var n=i.type;if(Y("BeforeChange",[t.currItem?t.currItem.type:"",n]),t.currItem=i,!t.currTemplate[n]){var r=!!t.st[n]&&t.st[n].markup;Y("FirstMarkupParse",r),r?t.currTemplate[n]=e(r):t.currTemplate[n]=!0}s&&s!==i.type&&t.container.removeClass("mfp-"+s+"-holder");var o=t["get"+n.charAt(0).toUpperCase()+n.slice(1)](i,t.currTemplate[n]);t.appendContent(o,n),i.preloaded=!0,Y(f,i),s=i.type,t.container.prepend(t.contentContainer),Y("AfterChange")},appendContent:function(e,i){t.content=e,e?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[i]===!0?t.content.find(".mfp-close").length||t.content.append(k()):t.content=e:t.content="",Y(h),t.container.addClass("mfp-"+i+"-holder"),t.contentContainer.append(t.content)},parseEl:function(i){var n,r=t.items[i];if(r.tagName?r={el:e(r)}:(n=r.type,r={data:r,src:r.src}),r.el){for(var s=t.types,o=0;o<s.length;o++)if(r.el.hasClass("mfp-"+s[o])){n=s[o];break}r.src=r.el.attr("data-mfp-src"),r.src||(r.src=r.el.attr("href"))}return r.type=n||t.st.type||"inline",r.index=i,r.parsed=!0,t.items[i]=r,Y("ElementParse",r),t.items[i]},addGroup:function(e,i){var n=function(n){n.mfpEl=this,t._openClick(n,e,i)};i||(i={});var r="click.magnificPopup";i.mainEl=e,i.items?(i.isObj=!0,e.off(r).on(r,n)):(i.isObj=!1,i.delegate?e.off(r).on(r,i.delegate,n):(i.items=e,e.off(r).on(r,n)))},_openClick:function(i,n,r){var s=void 0!==r.midClick?r.midClick:e.magnificPopup.defaults.midClick;if(s||2!==i.which&&!i.ctrlKey&&!i.metaKey){var o=void 0!==r.disableOn?r.disableOn:e.magnificPopup.defaults.disableOn;if(o)if(e.isFunction(o)){if(!o.call(t))return!0}else if(T.width()<o)return!0;i.type&&(i.preventDefault(),t.isOpen&&i.stopPropagation()),r.el=e(i.mfpEl),r.delegate&&(r.items=n.find(r.delegate)),t.open(r)}},updateStatus:function(e,n){if(t.preloader){i!==e&&t.container.removeClass("mfp-s-"+i),n||"loading"!==e||(n=t.st.tLoading);var r={status:e,text:n};Y("UpdateStatus",r),e=r.status,n=r.text,t.preloader.html(n),t.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),t.container.addClass("mfp-s-"+e),i=e}},_checkIfClose:function(i){if(!e(i).hasClass(y)){var n=t.st.closeOnContentClick,r=t.st.closeOnBgClick;if(n&&r)return!0;if(!t.content||e(i).hasClass("mfp-close")||t.preloader&&i===t.preloader[0])return!0;if(i===t.content[0]||e.contains(t.content[0],i)){if(n)return!0}else if(r&&e.contains(document,i))return!0;return!1}},_addClassToMFP:function(e){t.bgOverlay.addClass(e),t.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),t.wrap.removeClass(e)},_hasScrollBar:function(e){return(t.isIE7?r.height():document.body.scrollHeight)>(e||T.height())},_setFocus:function(){(t.st.focus?t.content.find(t.st.focus).eq(0):t.wrap).focus()},_onFocusIn:function(i){if(i.target!==t.wrap[0]&&!e.contains(t.wrap[0],i.target))return t._setFocus(),!1},_parseMarkup:function(t,i,n){var r;n.data&&(i=e.extend(n.data,i)),Y(u,[t,i,n]),e.each(i,function(e,i){if(void 0===i||i===!1)return!0;if(r=e.split("_"),r.length>1){var n=t.find(g+"-"+r[0]);if(n.length>0){var s=r[1];"replaceWith"===s?n[0]!==i[0]&&n.replaceWith(i):"img"===s?n.is("img")?n.attr("src",i):n.replaceWith('<img src="'+i+'" class="'+n.attr("class")+'" />'):n.attr(r[1],i)}}else t.find(g+"-"+e).html(i)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopup={instance:null,proto:w.prototype,modules:[],open:function(t,i){return C(),t=t?e.extend(!0,{},t):{},t.isObj=!0,t.index=i||0,this.instance.open(t)},close:function(){return e.magnificPopup.instance&&e.magnificPopup.instance.close()},registerModule:function(t,i){i.options&&(e.magnificPopup.defaults[t]=i.options),e.extend(this.proto,i.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(i){C();var n=e(this);if("string"==typeof i)if("open"===i){var r,s=b?n.data("magnificPopup"):n[0].magnificPopup,o=parseInt(arguments[1],10)||0;s.items?r=s.items[o]:(r=n,s.delegate&&(r=r.find(s.delegate)),r=r.eq(o)),t._openClick({mfpEl:r},n,s)}else t.isOpen&&t[i].apply(t,Array.prototype.slice.call(arguments,1));else i=e.extend(!0,{},i),b?n.data("magnificPopup",i):n[0].magnificPopup=i,t.addGroup(n,i);return n};var M,D,Z,H="inline",j=function(){Z&&(D.after(Z.addClass(M)).detach(),Z=null)};e.magnificPopup.registerModule(H,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(H),x(l+"."+H,function(){j()})},getInline:function(i,n){if(j(),i.src){var r=t.st.inline,s=e(i.src);if(s.length){var o=s[0].parentNode;o&&o.tagName&&(D||(M=r.hiddenClass,D=S(M),M="mfp-"+M),Z=s.after(D).detach().removeClass(M)),t.updateStatus("ready")}else t.updateStatus("error",r.tNotFound),s=e("<div>");return i.inlineElement=s,s}return t.updateStatus("ready"),t._parseMarkup(n,{},i),n}}});var P,J="ajax",X=function(){P&&n.removeClass(P)},F=function(){X(),t.req&&t.req.abort()};e.magnificPopup.registerModule(J,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){t.types.push(J),P=t.st.ajax.cursor,x(l+"."+J,F),x("BeforeChange."+J,F)},getAjax:function(i){P&&n.addClass(P),t.updateStatus("loading");var r=e.extend({url:i.src,success:function(n,r,s){var o={data:n,xhr:s};Y("ParseAjax",o),t.appendContent(e(o.data),J),i.finished=!0,X(),t._setFocus(),setTimeout(function(){t.wrap.addClass(_)},16),t.updateStatus("ready"),Y("AjaxContentAdded")},error:function(){X(),i.finished=i.loadError=!0,t.updateStatus("error",t.st.ajax.tError.replace("%url%",i.src))}},t.st.ajax.settings);return t.req=e.ajax(r),""}}});var N,$=function(i){if(i.data&&void 0!==i.data.title)return i.data.title;var n=t.st.image.titleSrc;if(n){if(e.isFunction(n))return n.call(t,i);if(i.el)return i.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=t.st.image,i=".image";t.types.push("image"),x(p+i,function(){"image"===t.currItem.type&&e.cursor&&n.addClass(e.cursor)}),x(l+i,function(){e.cursor&&n.removeClass(e.cursor),T.off("resize"+g)}),x("Resize"+i,t.resizeImage),t.isLowIE&&x("AfterChange",t.resizeImage)},resizeImage:function(){var e=t.currItem;if(e&&e.img&&t.st.image.verticalFit){var i=0;t.isLowIE&&(i=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",t.wH-i)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,N&&clearInterval(N),e.isCheckingImgSize=!1,Y("ImageHasSize",e),e.imgHidden&&(t.content&&t.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var i=0,n=e.img[0],r=function(s){N&&clearInterval(N),N=setInterval(function(){return n.naturalWidth>0?void t._onImageHasSize(e):(i>200&&clearInterval(N),i++,void(3===i?r(10):40===i?r(50):100===i&&r(500)))},s)};r(1)},getImage:function(i,n){var r=0,s=function(){i&&(i.img[0].complete?(i.img.off(".mfploader"),i===t.currItem&&(t._onImageHasSize(i),t.updateStatus("ready")),i.hasSize=!0,i.loaded=!0,Y("ImageLoadComplete")):(r++,r<200?setTimeout(s,100):o()))},o=function(){i&&(i.img.off(".mfploader"),i===t.currItem&&(t._onImageHasSize(i),t.updateStatus("error",a.tError.replace("%url%",i.src))),i.hasSize=!0,i.loaded=!0,i.loadError=!0)},a=t.st.image,l=n.find(".mfp-img");if(l.length){var d=document.createElement("img");d.className="mfp-img",i.el&&i.el.find("img").length&&(d.alt=i.el.find("img").attr("alt")),i.img=e(d).on("load.mfploader",s).on("error.mfploader",o),d.src=i.src,l.is("img")&&(i.img=i.img.clone()),d=i.img[0],d.naturalWidth>0?i.hasSize=!0:d.width||(i.hasSize=!1)}return t._parseMarkup(n,{title:$(i),img_replaceWith:i.img},i),t.resizeImage(),i.hasSize?(N&&clearInterval(N),i.loadError?(n.addClass("mfp-loading"),t.updateStatus("error",a.tError.replace("%url%",i.src))):(n.removeClass("mfp-loading"),t.updateStatus("ready")),n):(t.updateStatus("loading"),i.loading=!0,i.hasSize||(i.imgHidden=!0,n.addClass("mfp-loading"),t.findImageSize(i)),n)}}});var B,E=function(){return void 0===B&&(B=void 0!==document.createElement("p").style.MozTransform),B};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,i=t.st.zoom,n=".zoom";if(i.enabled&&t.supportsTransition){var r,s,o=i.duration,a=function(e){var t=e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),n="all "+i.duration/1e3+"s "+i.easing,r={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},s="transition";return r["-webkit-"+s]=r["-moz-"+s]=r["-o-"+s]=r[s]=n,t.css(r),t},c=function(){t.content.css("visibility","visible")};x("BuildControls"+n,function(){if(t._allowZoom()){if(clearTimeout(r),t.content.css("visibility","hidden"),e=t._getItemToZoom(),!e)return void c();s=a(e),s.css(t._getOffset()),t.wrap.append(s),r=setTimeout(function(){s.css(t._getOffset(!0)),r=setTimeout(function(){c(),setTimeout(function(){s.remove(),e=s=null,Y("ZoomAnimationEnded")},16)},o)},16)}}),x(d+n,function(){if(t._allowZoom()){if(clearTimeout(r),t.st.removalDelay=o,!e){if(e=t._getItemToZoom(),!e)return;s=a(e)}s.css(t._getOffset(!0)),t.wrap.append(s),t.content.css("visibility","hidden"),setTimeout(function(){s.css(t._getOffset())},16)}}),x(l+n,function(){t._allowZoom()&&(c(),s&&s.remove(),e=null)})}},_allowZoom:function(){return"image"===t.currItem.type},_getItemToZoom:function(){return!!t.currItem.hasSize&&t.currItem.img},_getOffset:function(i){var n;n=i?t.currItem.img:t.st.zoom.opener(t.currItem.el||t.currItem);var r=n.offset(),s=parseInt(n.css("padding-top"),10),o=parseInt(n.css("padding-bottom"),10);r.top-=e(window).scrollTop()-s;var a={width:n.width(),height:(b?n.innerHeight():n[0].offsetHeight)-o-s};return E()?a["-moz-transform"]=a.transform="translate("+r.left+"px,"+r.top+"px)":(a.left=r.left,a.top=r.top),a}}});var Q="iframe",O="//about:blank",W=function(e){if(t.currTemplate[Q]){var i=t.currTemplate[Q].find("iframe");i.length&&(e||(i[0].src=O),t.isIE8&&i.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(Q,{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(){t.types.push(Q),x("BeforeChange",function(e,t,i){t!==i&&(t===Q?W():i===Q&&W(!0))}),x(l+"."+Q,function(){W()})},getIframe:function(i,n){var r=i.src,s=t.st.iframe;e.each(s.patterns,function(){if(r.indexOf(this.index)>-1)return this.id&&(r="string"==typeof this.id?r.substr(r.lastIndexOf(this.id)+this.id.length,r.length):this.id.call(this,r)),r=this.src.replace("%id%",r),!1});var o={};return s.srcAction&&(o[s.srcAction]=r),t._parseMarkup(n,o,i),t.updateStatus("ready"),n}}});var R=function(e){var i=t.items.length;return e>i-1?e-i:e<0?i+e:e},A=function(e,t,i){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,i)};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 i=t.st.gallery,n=".mfp-gallery",s=Boolean(e.fn.mfpFastClick);return t.direction=!0,!(!i||!i.enabled)&&(o+=" mfp-gallery",x(p+n,function(){i.navigateByImgClick&&t.wrap.on("click"+n,".mfp-img",function(){if(t.items.length>1)return t.next(),!1}),r.on("keydown"+n,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),x("UpdateStatus"+n,function(e,i){i.text&&(i.text=A(i.text,t.currItem.index,t.items.length))}),x(u+n,function(e,n,r,s){var o=t.items.length;r.counter=o>1?A(i.tCounter,s.index,o):""}),x("BuildControls"+n,function(){if(t.items.length>1&&i.arrows&&!t.arrowLeft){var n=i.arrowMarkup,r=t.arrowLeft=e(n.replace(/%title%/gi,i.tPrev).replace(/%dir%/gi,"left")).addClass(y),o=t.arrowRight=e(n.replace(/%title%/gi,i.tNext).replace(/%dir%/gi,"right")).addClass(y),a=s?"mfpFastClick":"click";r[a](function(){t.prev()}),o[a](function(){t.next()}),t.isIE7&&(S("b",r[0],!1,!0),S("a",r[0],!1,!0),S("b",o[0],!1,!0),S("a",o[0],!1,!0)),t.container.append(r.add(o))}}),x(f+n,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),void x(l+n,function(){r.off(n),t.wrap.off("click"+n),t.arrowLeft&&s&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}))},next:function(){t.direction=!0,t.index=R(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=R(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,i=t.st.gallery.preload,n=Math.min(i[0],t.items.length),r=Math.min(i[1],t.items.length);for(e=1;e<=(t.direction?r:n);e++)t._preloadItem(t.index+e);for(e=1;e<=(t.direction?n:r);e++)t._preloadItem(t.index-e)},_preloadItem:function(i){if(i=R(i),!t.items[i].preloaded){var n=t.items[i];n.parsed||(n=t.parseEl(i)),Y("LazyLoad",n),"image"===n.type&&(n.img=e('<img class="mfp-img" />').on("load.mfploader",function(){n.hasSize=!0}).on("error.mfploader",function(){n.hasSize=!0,n.loadError=!0,Y("LazyLoadError",n)}).attr("src",n.src)),n.preloaded=!0}}}});var G="retina";e.magnificPopup.registerModule(G,{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=t.st.retina,i=e.ratio;i=isNaN(i)?i():i,i>1&&(x("ImageHasSize."+G,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/i,width:"100%"})}),x("ElementParse."+G,function(t,n){n.src=e.replaceSrc(n,i)}))}}}}),function(){var t=1e3,i="ontouchstart"in window,n=function(){T.off("touchmove"+s+" touchend"+s)},r="mfpFastClick",s="."+r;e.fn.mfpFastClick=function(r){return e(this).each(function(){var o,a=e(this);if(i){var l,d,c,h,u,p;a.on("touchstart"+s,function(e){h=!1,p=1,u=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],d=u.clientX,c=u.clientY,T.on("touchmove"+s,function(e){u=e.originalEvent?e.originalEvent.touches:e.touches,p=u.length,u=u[0],(Math.abs(u.clientX-d)>10||Math.abs(u.clientY-c)>10)&&(h=!0,n())}).on("touchend"+s,function(e){n(),h||p>1||(o=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){o=!1},t),r())})})}a.on("click"+s,function(){o||r()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+s+" click"+s),i&&T.off("touchmove"+s+" touchend"+s)}}(),C()}),define("app/models/dirent",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.Model.extend({getPath:function(){return n.pathJoin([this.collection.path,this.get("obj_name")])},getIconUrl:function(e){if(this.get("is_dir")){var t="r"==this.get("perm");return n.getDirIconUrl(t,e)}return n.getFileIconUrl(this.get("obj_name"),e)},getWebUrl:function(){var e=this.collection,t=this.getPath();return this.get("is_dir")?e.category?"#"+e.category+"/lib/"+e.repo_id+n.encodePath(t):"#lib/"+e.repo_id+n.encodePath(t):app.config.siteRoot+"lib/"+e.repo_id+"/file"+n.encodePath(t)},getDownloadUrl:function(){var e=this.collection,t=this.getPath();return this.get("is_dir")?app.config.siteRoot+"repo/download_dir/"+e.repo_id+"/?p="+n.encodePath(t):app.config.siteRoot+"lib/"+e.repo_id+"/file"+n.encodePath(t)+"?dl=1"},deleteFromServer:function(t){var i=this.collection,r=this.getPath(),s=this,o={repo_id:i.repo_id,name:this.get("is_dir")?"del_dir":"del_file"};e.ajax({url:n.getUrl(o)+"?p="+encodeURIComponent(r),type:"DELETE",dataType:"json",beforeSend:n.prepareCSRFToken,success:function(e){i.remove(s),t.success&&t.success(e)},error:function(e){t.error&&t.error(e)}})},rename:function(t){var i=this.collection,r=this,s={repo_id:i.repo_id,name:this.get("is_dir")?"rename_dir":"rename_file"},o={operation:"rename",newname:t.newname};e.ajax({url:n.getUrl(s)+"?p="+encodeURIComponent(this.getPath()),type:"POST",dataType:"json",beforeSend:n.prepareCSRFToken,data:o,success:function(i){var n={obj_name:i.obj_name,last_modified:(new Date).getTime()/1e3,last_update:gettext("Just now")};r.get("is_dir")||e.extend(n,{starred:!1}),r.set(n),t.success&&t.success(i)},error:function(e){t.error&&t.error(e)}})},lockOrUnlockFile:function(t){var i=this.collection,r=this.getPath();e.ajax({url:n.getUrl({name:"lock_or_unlock_file",repo_id:i.repo_id})+"?p="+encodeURIComponent(r),type:"PUT",dataType:"json",data:{operation:t.op,p:r},cache:!1,beforeSend:n.prepareCSRFToken,success:function(){t.success()},error:function(e){t.error(e)}})},lockFile:function(e){var t=this;return this.lockOrUnlockFile({op:"lock",success:function(){t.set({is_locked:!0,locked_by_me:!0,
lock_owner_name:app.pageOptions.name}),e.success&&e.success()},error:function(t){e.error&&e.error(t)}}),!1},unlockFile:function(e){var t=this;return this.lockOrUnlockFile({op:"unlock",success:function(){t.set({is_locked:!1}),e.success&&e.success()},error:function(t){e.error&&e.error(t)}}),!1}});return r}),define("app/collections/dirents",["underscore","backbone","common","app/models/dirent"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,url:function(){return i.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.no_quota=e.no_quota,this.encrypted=e.encrypted,this.is_repo_owner=e.is_repo_owner,this.is_virtual=e.is_virtual,this.has_been_shared_out=e.has_been_shared_out,this.dirent_more=e.dirent_more,this.more_start=e.more_start,this.is_admin=e.is_admin,e.dirent_list},setPath:function(e,t,i){this.category=e,this.repo_id=t,this.path=i}});return r}),define("app/views/dialogs/dirent-mvcp",["jquery","underscore","backbone","common","file-tree"],function(e,t,i,n,r){"use strict";var s=i.View.extend({mvcpTemplate:t.template(e("#mvcp-form-template").html()),mvProgressTemplate:t.template(e("#mv-progress-popup-template").html()),initialize:function(t){this.dirent=t.dirent,this.dir=t.dir,this.op_type=t.op_type,this.dirView=t.dirView,this.imgIndex=t.imgIndex,this.show_cur_repo="rw"==this.dirent.get("perm"),this.render(),this.$el.modal({appendTo:"#main",autoResize:!0,focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"}),this.show_cur_repo&&r.renderTreeForPath({$form:this.$el,$container:this.$("#current-repo-dirs"),repo_name:this.dir.repo_name,repo_id:this.dir.repo_id,path:this.dir.path}),this.dir.encrypted||r.prepareOtherReposTree({cur_repo_id:this.dir.repo_id}),this.$error=this.$(".error"),this.$form=this.$("form")},render:function(){var e=this.dir,t=this.dirent.get("obj_name"),i=this.dirent.get("is_dir")?"dir":"file",r="mv"==this.op_type?gettext("Move {placeholder} to:"):gettext("Copy {placeholder} to:");return r=r.replace("{placeholder}",'<span class="op-target ellipsis ellipsis-op-target" title="'+n.HTMLescape(t)+'">'+n.HTMLescape(t)+"</span>"),this.$el.html(this.mvcpTemplate({form_title:r,op_type:this.op_type,obj_type:i,obj_name:t,show_cur_repo:this.show_cur_repo,show_other_repos:!e.encrypted})),this},removeImgItem:function(){this.dirent.get("is_img")&&this.dirView.updateMagnificPopupOptions({op:"delete-item",index:this.imgIndex})},events:{"submit form":"formSubmit"},_showProgress:function(t,i){var r=this,s=this.op_type,o=this.dirent.get("obj_name"),a=e(r.mvProgressTemplate()),l=e("#mv-details",a),d=e("#cancel-mv",a),c=e("#mv-other-info",a);d.removeClass("hide"),setTimeout(function(){a.modal({containerCss:{width:300,height:150,paddingTop:50},focus:!1});var t="mv"==r.op_type?gettext("Moving %(name)s"):gettext("Copying %(name)s");l.html(t.replace("%(name)s",n.HTMLescape(o))).removeClass("vh"),e("#mv-progress").progressbar(),h()},100);var h=function(){e.ajax({url:n.getUrl({name:"query_copy_move_progress"})+"?task_id="+encodeURIComponent(i),dataType:"json",success:function(i){var o=e(".ui-progressbar-value",e("#mv-progress"));if(i.failed||i.canceled||i.successful)if(i.successful)e.modal.close(),"mv"==s&&(r.dir.remove(r.dirent),r.removeImgItem()),n.feedback(t,"success");else{l.addClass("vh");var a=i.failed?gettext("Failed."):gettext("Canceled.");c.html(a).removeClass("hide"),d.addClass("hide"),setTimeout(function(){e.modal.close()},1e3)}else i.done==i.total?(o.css("width","100%"),l.addClass("vh"),d.addClass("hide"),c.html(gettext("Saving...")).removeClass("hide")):o.css("width",parseInt(i.done/i.total*100,10)+"%"),o.show(),setTimeout(h,1e3)},error:function(t,i,n){var r;r=t.responseText?e.parseJSON(t.responseText).error:gettext("Failed. Please check the network."),l.addClass("vh"),c.html(r).removeClass("hide"),d.addClass("hide"),setTimeout(function(){e.modal.close()},1e3)}})};d.click(function(){n.disableButton(d),e.ajax({url:n.getUrl({name:"copy_move_task"}),type:"DELETE",dataType:"json",beforeSend:n.prepareCSRFToken,data:{task_id:i},success:function(t){l.addClass("vh"),c.html(gettext("Canceled.")).removeClass("hide"),d.addClass("hide"),setTimeout(function(){e.modal.close()},1e3)},error:function(t,i,r){var s;s=t.responseText?e.parseJSON(t.responseText).error:gettext("Failed. Please check the network."),c.html(s).removeClass("hide"),n.enableButton(d)}})})},formSubmit:function(){var t=this,i=this.dir.path,r=this.dir.repo_id,s=this.dirent.get("obj_name"),o=this.dirent.get("is_dir")?"dir":"file",a=e('[name="dst_repo"]',this.$form).val(),l=e('[name="dst_path"]',this.$form).val();if(!e.trim(a)||!e.trim(l))return e(".error",form).removeClass("hide"),!1;if(a==r&&(l==i||"dir"==o&&l==i+s+"/"))return this.$error.html(gettext("Invalid destination path")).removeClass("hide"),!1;var d=n.getUrl({name:"copy_move_task"}),c={src_repo_id:r,src_parent_dir:i,src_dirent_name:s,dst_repo_id:a,dst_parent_dir:l,operation:"mv"==this.op_type?"move":"copy",dirent_type:o},h=function(i){e.modal.close();var r;r="mv"==t.op_type?gettext("Successfully moved %(name)s").replace("%(name)s",s):gettext("Successfully copied %(name)s").replace("%(name)s",s),i.task_id?t._showProgress(r,i.task_id):("mv"==t.op_type&&(t.dir.remove(t.dirent),t.removeImgItem()),n.feedback(r,"success"))};return n.ajaxPost({form:this.$form,post_url:d,post_data:c,after_op_success:h,form_id:this.$form.attr("id")}),!1}});return s}),function(e){"function"==typeof define&&define.amd?define("jquery.ui.tabs",["jquery"],e):e(jQuery)}(function(e){function t(t,n){var r,s,o,a=t.nodeName.toLowerCase();return"area"===a?(r=t.parentNode,s=r.name,!(!t.href||!s||"map"!==r.nodeName.toLowerCase())&&(o=e("img[usemap='#"+s+"']")[0],!!o&&i(o))):(/^(input|select|textarea|button|object)$/.test(a)?!t.disabled:"a"===a?t.href||n:n)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).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 i=this.css("position"),n="absolute"===i,r=t?/(auto|scroll|hidden)/:/(auto|scroll)/,s=this.parents().filter(function(){var t=e(this);return(!n||"static"!==t.css("position"))&&r.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&s.length?s:e(this[0].ownerDocument||document)},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(i){return!!e.data(i,t)}}):function(t,i,n){return!!e.data(t,n[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var n=e.attr(i,"tabindex"),r=isNaN(n);return(r||n>=0)&&t(i,!r)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function n(t,i,n,s){return e.each(r,function(){i-=parseFloat(e.css(t,"padding"+this))||0,n&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var r="Width"===i?["Left","Right"]:["Top","Bottom"],s=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(s,n(this,t)+"px")})},e.fn["outer"+i]=function(t,r){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(s,n(this,t,!0,r)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?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(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,n){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),n&&n.call(t)},i)}):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(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,n,r=e(this[0]);r.length&&r[0]!==document;){if(i=r.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(n=parseInt(r.css("zIndex"),10),!isNaN(n)&&0!==n))return n;r=r.parent()}return 0}}),e.ui.plugin={add:function(t,i,n){var r,s=e.ui[t].prototype;for(r in n)s.plugins[r]=s.plugins[r]||[],s.plugins[r].push([i,n[r]])},call:function(e,t,i,n){var r,s=e.plugins[t];if(s&&(n||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(r=0;r<s.length;r++)e.options[s[r][0]]&&s[r][1].apply(e.element,i)}};var n=0,r=Array.prototype.slice;e.cleanData=function(t){return function(i){var n,r,s;for(s=0;null!=(r=i[s]);s++)try{n=e._data(r,"events"),n&&n.remove&&e(r).triggerHandler("remove")}catch(e){}t(i)}}(e.cleanData),e.widget=function(t,i,n){var r,s,o,a,l={},d=t.split(".")[0];return t=t.split(".")[1],r=d+"-"+t,n||(n=i,i=e.Widget),e.expr[":"][r.toLowerCase()]=function(t){return!!e.data(t,r)},e[d]=e[d]||{},s=e[d][t],o=e[d][t]=function(e,t){return this._createWidget?void(arguments.length&&this._createWidget(e,t)):new o(e,t)},e.extend(o,s,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),a=new i,a.options=e.widget.extend({},a.options),e.each(n,function(t,n){return e.isFunction(n)?void(l[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},r=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,s=this._superApply;return this._super=e,this._superApply=r,t=n.apply(this,arguments),this._super=i,this._superApply=s,t}}()):void(l[t]=n)}),o.prototype=e.widget.extend(a,{widgetEventPrefix:s?a.widgetEventPrefix||t:t},l,{constructor:o,namespace:d,widgetName:t,widgetFullName:r}),s?(e.each(s._childConstructors,function(t,i){var n=i.prototype;e.widget(n.namespace+"."+n.widgetName,o,i._proto)}),delete s._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,n,s=r.call(arguments,1),o=0,a=s.length;o<a;o++)for(i in s[o])n=s[o][i],s[o].hasOwnProperty(i)&&void 0!==n&&(e.isPlainObject(n)?t[i]=e.isPlainObject(t[i])?e.widget.extend({},t[i],n):e.widget.extend({},n):t[i]=n);return t},e.widget.bridge=function(t,i){var n=i.prototype.widgetFullName||t;e.fn[t]=function(s){var o="string"==typeof s,a=r.call(arguments,1),l=this;return o?this.each(function(){var i,r=e.data(this,n);return"instance"===s?(l=r,!1):r?e.isFunction(r[s])&&"_"!==s.charAt(0)?(i=r[s].apply(r,a),i!==r&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+s+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; attempted to call method '"+s+"'")}):(a.length&&(s=e.widget.extend.apply(null,[s].concat(a))),this.each(function(){var t=e.data(this,n);t?(t.option(s||{}),t._init&&t._init()):e.data(this,n,new i(s,this))})),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),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,i){var n,r,s,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},n=t.split("."),t=n.shift(),n.length){for(r=o[t]=e.widget.extend({},this.options[t]),s=0;s<n.length-1;s++)r[n[s]]=r[n[s]]||{},r=r[n[s]];if(t=n.pop(),1===arguments.length)return void 0===r[t]?null:r[t];r[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),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,"disabled"===e&&(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,i,n){var r,s=this;"boolean"!=typeof t&&(n=i,i=t,t=!1),n?(i=r=e(i),this.bindings=this.bindings.add(i)):(n=i,i=this.element,r=this.widget()),e.each(n,function(n,o){function a(){if(t||s.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled"))return("string"==typeof o?s[o]:o).apply(s,arguments)}"string"!=typeof o&&(a.guid=o.guid=o.guid||a.guid||e.guid++);var l=n.match(/^([\w:-]*)\s*(.*)$/),d=l[1]+s.eventNamespace,c=l[2];c?r.delegate(c,d,a):i.bind(d,a)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),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 i(){return("string"==typeof e?n[e]:e).apply(n,arguments)}var n=this;return setTimeout(i,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,i,n){var r,s,o=this.options[t];if(n=n||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],s=i.originalEvent)for(r in s)r in i||(i[r]=s[r]);return this.element.trigger(i,n),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(n))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(n,r,s){"string"==typeof r&&(r={effect:r});var o,a=r?r===!0||"number"==typeof r?i:r.effect||i:t;r=r||{},"number"==typeof r&&(r={duration:r}),o=!e.isEmptyObject(r),r.complete=s,r.delay&&n.delay(r.delay),o&&e.effects&&e.effects.effect[a]?n[t](r):a!==t&&n[a]?n[a](r.duration,r.easing,s):n.queue(function(i){e(this)[t](),s&&s.call(n[0]),i()})}});e.widget,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 i,n;t=t.cloneNode(!1),i=t.href.replace(e,""),n=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(e){}try{n=decodeURIComponent(n)}catch(e){}return t.hash.length>1&&i===n}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.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(i.active):this.active=e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,n=location.hash.substring(1);return null===t&&(n&&this.tabs.each(function(i,r){if(e(r).attr("aria-controls")===n)return t=i,!1}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),null!==t&&t!==-1||(t=!!this.tabs.length&&0)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),t===-1&&(t=!i&&0)),!i&&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 i=e(this.document[0].activeElement).closest("li"),n=this.tabs.index(i),r=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:n++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:r=!1,n--;break;case e.ui.keyCode.END:n=this.anchors.length-1;break;case e.ui.keyCode.HOME:n=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),void this._activate(n);case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),void this._activate(n!==this.options.active&&n);default:return}t.preventDefault(),clearTimeout(this.activating),n=this._focusNextTab(n,r),t.ctrlKey||t.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(n).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",n)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function n(){return t>r&&(t=0),t<0&&(t=r),t}for(var r=this.tabs.length-1;e.inArray(n(),this.options.disabled)!==-1;)t=i?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){return"active"===e?void this._activate(t):"disabled"===e?void this._setupDisabled(t):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),void("heightStyle"===e&&this._setupHeightStyle(t)))},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?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):(t.active=!1,this.active=e()),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,i=this.tabs,n=this.anchors,r=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(i,n){var r,s,o,a=e(n).uniqueId().attr("id"),l=e(n).closest("li"),d=l.attr("aria-controls");t._isLocal(n)?(r=n.hash,o=r.substring(1),s=t.element.find(t._sanitizeSelector(r))):(o=l.attr("aria-controls")||e({}).uniqueId()[0].id,r="#"+o,s=t.element.find(r),s.length||(s=t._createPanel(o),s.insertAfter(t.panels[i-1]||t.tablist)),s.attr("aria-live","polite")),s.length&&(t.panels=t.panels.add(s)),d&&l.data("ui-tabs-aria-controls",d),l.attr({"aria-controls":o,"aria-labelledby":a}),s.attr("aria-labelledby",a)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),i&&(this._off(i.not(this.tabs)),this._off(n.not(this.anchors)),this._off(r.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 i,n=0;i=this.tabs[n];n++)t===!0||e.inArray(n,t)!==-1?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[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,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,n=this.element.parent();"fill"===t?(i=n.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),n=t.css("position");"absolute"!==n&&"fixed"!==n&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,n=this.active,r=e(t.currentTarget),s=r.closest("li"),o=s[0]===n[0],a=o&&i.collapsible,l=a?e():this._getPanelForTab(s),d=n.length?this._getPanelForTab(n):e(),c={oldTab:n,oldPanel:d,newTab:a?e():s,newPanel:l};t.preventDefault(),s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",t,c)===!1||(i.active=!a&&this.tabs.index(s),this.active=o?e():s,this.xhr&&this.xhr.abort(),d.length||l.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),l.length&&this.load(this.tabs.index(s),t),this._toggle(t,c))},_toggle:function(t,i){function n(){s.running=!1,s._trigger("activate",t,i)}function r(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&s.options.show?s._show(o,s.options.show,n):(o.show(),n())}var s=this,o=i.newPanel,a=i.oldPanel;this.running=!0,a.length&&this.options.hide?this._hide(a,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),a.hide(),r()),a.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&a.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,n=this._findActive(t);n[0]!==this.active[0]&&(n.length||(n=this.active),i=n.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(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),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),e.inArray(t,i)!==-1)return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var n=this,r=this.tabs.eq(t),s=r.find(".ui-tabs-anchor"),o=this._getPanelForTab(r),a={tab:r,panel:o};this._isLocal(s[0])||(this.xhr=e.ajax(this._ajaxSettings(s,i,a)),this.xhr&&"canceled"!==this.xhr.statusText&&(r.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){o.html(e),n._trigger("load",i,a)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&n.panels.stop(!1,!0),r.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===n.xhr&&delete n.xhr},1)})))},_ajaxSettings:function(t,i,n){var r=this;return{url:t.attr("href"),beforeSend:function(t,s){return r._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:s},n))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}})}),function(e){"undefined"==typeof e.fn.each2&&e.extend(e.fn,{each2:function(t){for(var i=e([0]),n=-1,r=this.length;++n<r&&(i.context=i[0]=this[n])&&t.call(i[0],n,i)!==!1;);return this}})}(jQuery),function(e,t){"use strict";function i(t){var i=e(document.createTextNode(""));t.before(i),i.before(t),i.remove()}function n(e){function t(e){return B[e]||e}return e.replace(/[^\u0000-\u007E]/g,t)}function r(e,t){for(var i=0,n=t.length;i<n;i+=1)if(o(e,t[i]))return i;return-1}function s(){var t=e($);t.appendTo(document.body);var i={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight};return t.remove(),i}function o(e,i){return e===i||e!==t&&i!==t&&(null!==e&&null!==i&&(e.constructor===String?e+""==i+"":i.constructor===String&&i+""==e+""))}function a(e,t,i){var n,r,s;if(null===e||e.length<1)return[];for(n=e.split(t),r=0,s=n.length;r<s;r+=1)n[r]=i(n[r]);return n}function l(e){return e.outerWidth(!1)-e.width()}function d(i){var n="keyup-change-value";i.on("keydown",function(){e.data(i,n)===t&&e.data(i,n,i.val())}),i.on("keyup",function(){var r=e.data(i,n);r!==t&&i.val()!==r&&(e.removeData(i,n),i.trigger("keyup-change"))})}function c(i){i.on("mousemove",function(i){var n=F;n!==t&&n.x===i.pageX&&n.y===i.pageY||e(i.target).trigger("mousemove-filtered",i)})}function h(e,i,n){n=n||t;var r;return function(){var t=arguments;window.clearTimeout(r),r=window.setTimeout(function(){i.apply(n,t)},e)}}function u(e,t){var i=h(e,function(e){t.trigger("scroll-debounced",e)});t.on("scroll",function(e){r(e.target,t.get())>=0&&i(e)})}function p(e){e[0]!==document.activeElement&&window.setTimeout(function(){var t,i=e[0],n=e.val().length;e.focus();var r=i.offsetWidth>0||i.offsetHeight>0;r&&i===document.activeElement&&(i.setSelectionRange?i.setSelectionRange(n,n):i.createTextRange&&(t=i.createTextRange(),t.collapse(!1),t.select()))},0)}function f(t){t=e(t)[0];var i=0,n=0;if("selectionStart"in t)i=t.selectionStart,n=t.selectionEnd-i;else if("selection"in document){t.focus();var r=document.selection.createRange();n=document.selection.createRange().text.length,r.moveStart("character",-t.value.length),i=r.text.length-n}return{offset:i,length:n}}function m(e){e.preventDefault(),e.stopPropagation()}function g(e){e.preventDefault(),e.stopImmediatePropagation()}function _(t){if(!P){var i=t[0].currentStyle||window.getComputedStyle(t[0],null);P=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:i.fontSize,fontFamily:i.fontFamily,fontStyle:i.fontStyle,fontWeight:i.fontWeight,letterSpacing:i.letterSpacing,textTransform:i.textTransform,whiteSpace:"nowrap"}),P.attr("class","select2-sizer"),e(document.body).append(P)}return P.text(t.val()),P.width()}function v(t,i,n){var r,s,o=[];r=e.trim(t.attr("class")),r&&(r=""+r,e(r.split(/\s+/)).each2(function(){0===this.indexOf("select2-")&&o.push(this)})),r=e.trim(i.attr("class")),r&&(r=""+r,e(r.split(/\s+/)).each2(function(){0!==this.indexOf("select2-")&&(s=n(this),s&&o.push(s))})),t.attr("class",o.join(" "))}function y(e,t,i,r){var s=n(e.toUpperCase()).indexOf(n(t.toUpperCase())),o=t.length;return s<0?void i.push(r(e)):(i.push(r(e.substring(0,s))),i.push("<span class='select2-match'>"),i.push(r(e.substring(s,s+o))),i.push("</span>"),void i.push(r(e.substring(s+o,e.length))))}function w(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function b(i){var n,r=null,s=i.quietMillis||100,o=i.url,a=this;return function(l){window.clearTimeout(n),n=window.setTimeout(function(){var n=i.data,s=o,d=i.transport||e.fn.select2.ajaxDefaults.transport,c={type:i.type||"GET",cache:i.cache||!1,jsonpCallback:i.jsonpCallback||t,dataType:i.dataType||"json"},h=e.extend({},e.fn.select2.ajaxDefaults.params,c);n=n?n.call(a,l.term,l.page,l.context):null,s="function"==typeof s?s.call(a,l.term,l.page,l.context):s,r&&"function"==typeof r.abort&&r.abort(),i.params&&(e.isFunction(i.params)?e.extend(h,i.params.call(a)):e.extend(h,i.params)),e.extend(h,{url:s,dataType:i.dataType,data:n,success:function(e){var t=i.results(e,l.page,l);l.callback(t)},error:function(e,t,i){var n={hasError:!0,jqXHR:e,textStatus:t,errorThrown:i};l.callback(n)}}),r=d.call(a,h)},s)}}function T(t){var i,n,r=t,s=function(e){return""+e.text};e.isArray(r)&&(n=r,r={results:n}),e.isFunction(r)===!1&&(n=r,
r=function(){return n});var o=r();return o.text&&(s=o.text,e.isFunction(s)||(i=o.text,s=function(e){return e[i]})),function(t){var i,n=t.term,o={results:[]};return""===n?void t.callback(r()):(i=function(r,o){var a,l;if(r=r[0],r.children){a={};for(l in r)r.hasOwnProperty(l)&&(a[l]=r[l]);a.children=[],e(r.children).each2(function(e,t){i(t,a.children)}),(a.children.length||t.matcher(n,s(a),r))&&o.push(a)}else t.matcher(n,s(r),r)&&o.push(r)},e(r().results).each2(function(e,t){i(t,o.results)}),void t.callback(o))}}function x(i){var n=e.isFunction(i);return function(r){var s=r.term,o={results:[]},a=n?i(r):i;e.isArray(a)&&(e(a).each(function(){var e=this.text!==t,i=e?this.text:this;(""===s||r.matcher(s,i))&&o.results.push(e?this:{id:this,text:this})}),r.callback(o))}}function S(t,i){if(e.isFunction(t))return!0;if(!t)return!1;if("string"==typeof t)return!0;throw new Error(i+" must be a string, function, or falsy value")}function Y(t,i){if(e.isFunction(t)){var n=Array.prototype.slice.call(arguments,2);return t.apply(i,n)}return t}function k(t){var i=0;return e.each(t,function(e,t){t.children?i+=k(t.children):i++}),i}function C(e,i,n,r){var s,a,l,d,c,h=e,u=!1;if(!r.createSearchChoice||!r.tokenSeparators||r.tokenSeparators.length<1)return t;for(;;){for(a=-1,l=0,d=r.tokenSeparators.length;l<d&&(c=r.tokenSeparators[l],a=e.indexOf(c),!(a>=0));l++);if(a<0)break;if(s=e.substring(0,a),e=e.substring(a+c.length),s.length>0&&(s=r.createSearchChoice.call(this,s,i),s!==t&&null!==s&&r.id(s)!==t&&null!==r.id(s))){for(u=!1,l=0,d=i.length;l<d;l++)if(o(r.id(s),r.id(i[l]))){u=!0;break}u||n(s)}}return h!==e?e:void 0}function L(){var t=this;e.each(arguments,function(e,i){t[i].remove(),t[i]=null})}function M(t,i){var n=function(){};return n.prototype=new t,n.prototype.constructor=n,n.prototype.parent=t.prototype,n.prototype=e.extend(n.prototype,i),n}if(window.Select2===t){var D,Z,H,j,P,J,X,F={x:0,y:0},N={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){switch(e=e.which?e.which:e){case N.LEFT:case N.RIGHT:case N.UP:case N.DOWN:return!0}return!1},isControl:function(e){var t=e.which;switch(t){case N.SHIFT:case N.CTRL:case N.ALT:return!0}return!!e.metaKey},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&e<=123}},$="<div class='select2-measure-scrollbar'></div>",B={"Ⓐ":"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","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};J=e(document),j=function(){var e=1;return function(){return e++}}(),D=M(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(i){var n,r,o=".select2-results";this.opts=i=this.prepareOpts(i),this.id=i.id,i.element.data("select2")!==t&&null!==i.element.data("select2")&&i.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=e(".select2-hidden-accessible"),0==this.liveRegion.length&&(this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body)),this.containerId="s2id_"+(i.element.attr("id")||"autogen"+j()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",i.element.attr("title")),this.body=e(document.body),v(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",i.element.attr("style")),this.container.css(Y(i.containerCss,this.opts.element)),this.container.addClass(Y(i.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",m),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),v(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(Y(i.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",m),this.results=n=this.container.find(o),this.search=r=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",m),c(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())})),u(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&&n.mousewheel(function(e,t,i,r){var s=n.scrollTop();r>0&&s-r<=0?(n.scrollTop(0),m(e)):r<0&&n.get(0).scrollHeight-n.scrollTop()+r<=n.height()&&(n.scrollTop(n.get(0).scrollHeight-n.height()),m(e))}),d(r),r.on("keyup-change input paste",this.bind(this.updateResults)),r.on("focus",function(){r.addClass("select2-focused")}),r.on("blur",function(){r.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()),null!==i.maximumInputLength&&this.search.attr("maxlength",i.maximumInputLength);var a=i.element.prop("disabled");a===t&&(a=!1),this.enable(!a);var l=i.element.prop("readonly");l===t&&(l=!1),this.readonly(l),X=X||s(),this.autofocus=i.element.prop("autofocus"),i.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",i.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,i=e.data("select2"),n=this;this.close(),e.length&&e[0].detachEvent&&n._sync&&e.each(function(){n._sync&&this.detachEvent("onpropertychange",n._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,i!==t&&(i.container.remove(),i.liveRegion.remove(),i.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()),L.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:o(e.attr("locked"),"locked")||o(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(i){var n,r,s,l,d=this;if(n=i.element,"select"===n.get(0).tagName.toLowerCase()&&(this.select=r=i.element),r&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in i)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),i=e.extend({},{populateResults:function(n,r,s){var o,a=this.opts.id,l=this.liveRegion;(o=function(n,r,c){var h,u,p,f,m,g,_,v,y,w;n=i.sortResults(n,r,s);var b=[];for(h=0,u=n.length;h<u;h+=1)p=n[h],m=p.disabled===!0,f=!m&&a(p)!==t,g=p.children&&p.children.length>0,_=e("<li></li>"),_.addClass("select2-results-dept-"+c),_.addClass("select2-result"),_.addClass(f?"select2-result-selectable":"select2-result-unselectable"),m&&_.addClass("select2-disabled"),g&&_.addClass("select2-result-with-children"),_.addClass(d.opts.formatResultCssClass(p)),_.attr("role","presentation"),v=e(document.createElement("div")),v.addClass("select2-result-label"),v.attr("id","select2-result-label-"+j()),v.attr("role","option"),w=i.formatResult(p,v,s,d.opts.escapeMarkup),w!==t&&(v.html(w),_.append(v)),g&&(y=e("<ul></ul>"),y.addClass("select2-result-sub"),o(p.children,y,c+1),_.append(y)),_.data("select2-data",p),b.push(_[0]);r.append(b),l.text(i.formatMatches(n.length))})(r,n,0)}},e.fn.select2.defaults,i),"function"!=typeof i.id&&(s=i.id,i.id=function(e){return e[s]}),e.isArray(i.element.data("select2Tags"))){if("tags"in i)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+i.element.attr("id");i.tags=i.element.data("select2Tags")}if(r?(i.query=this.bind(function(e){var i,r,s,o={results:[],more:!1},a=e.term;s=function(t,i){var n;t.is("option")?e.matcher(a,t.text(),t)&&i.push(d.optionToData(t)):t.is("optgroup")&&(n=d.optionToData(t),t.children().each2(function(e,t){s(t,n.children)}),n.children.length>0&&i.push(n))},i=n.children(),this.getPlaceholder()!==t&&i.length>0&&(r=this.getPlaceholderOption(),r&&(i=i.not(r))),i.each2(function(e,t){s(t,o.results)}),e.callback(o)}),i.id=function(e){return e.id}):"query"in i||("ajax"in i?(l=i.element.data("ajax-url"),l&&l.length>0&&(i.ajax.url=l),i.query=b.call(i.element,i.ajax)):"data"in i?i.query=T(i.data):"tags"in i&&(i.query=x(i.tags),i.createSearchChoice===t&&(i.createSearchChoice=function(t){return{id:e.trim(t),text:e.trim(t)}}),i.initSelection===t&&(i.initSelection=function(t,n){var r=[];e(a(t.val(),i.separator,i.transformVal)).each(function(){var t={id:this,text:this},n=i.tags;e.isFunction(n)&&(n=n()),e(n).each(function(){if(o(this.id,t.id))return t=this,!1}),r.push(t)}),n(r)}))),"function"!=typeof i.query)throw"query function not defined for Select2 "+i.element.attr("id");if("top"===i.createSearchChoicePosition)i.createSearchChoicePosition=function(e,t){e.unshift(t)};else if("bottom"===i.createSearchChoicePosition)i.createSearchChoicePosition=function(e,t){e.push(t)};else if("function"!=typeof i.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return i},monitorSource:function(){var i,n=this.opts.element,r=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 i=n.prop("readonly");i===t&&(i=!1),this.readonly(i),this.container&&(v(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(Y(this.opts.containerCssClass,this.opts.element))),this.dropdown&&(v(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(Y(this.opts.dropdownCssClass,this.opts.element)))}),n.length&&n[0].attachEvent&&n.each(function(){this.attachEvent("onpropertychange",r._sync)}),i=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,i!==t&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new i(function(t){e.each(t,r._sync)}),this.propertyObserver.observe(n.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(t){var i=e.Event("select2-selecting",{val:this.id(t),object:t,choice:t});return this.opts.element.trigger(i),!i.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&&(this.container.toggleClass("select2-container-disabled",t),this.close(),this.enabledInterface=e,!0)},enable:function(e){e===t&&(e=!0),this._enabled!==e&&(this._enabled=e,this.opts.element.prop("disabled",!e),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(e){e===t&&(e=!1),this._readonly!==e&&(this._readonly=e,this.opts.element.prop("readonly",e),this.enableInterface())},opened:function(){return!!this.container&&this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var t,i,n,r,s,o=this.dropdown,a=this.container,l=a.offset(),d=a.outerHeight(!1),c=a.outerWidth(!1),h=o.outerHeight(!1),u=e(window),p=u.width(),f=u.height(),m=u.scrollLeft()+p,g=u.scrollTop()+f,_=l.top+d,v=l.left,y=_+h<=g,w=l.top-h>=u.scrollTop(),b=o.outerWidth(!1),T=function(){return v+b<=m},x=function(){return l.left+m+a.outerWidth(!1)>b},S=o.hasClass("select2-drop-above");S?(i=!0,!w&&y&&(n=!0,i=!1)):(i=!1,!y&&w&&(n=!0,i=!0)),n&&(o.hide(),l=this.container.offset(),d=this.container.outerHeight(!1),c=this.container.outerWidth(!1),h=o.outerHeight(!1),m=u.scrollLeft()+p,g=u.scrollTop()+f,_=l.top+d,v=l.left,b=o.outerWidth(!1),o.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(s=e(".select2-results",o)[0],o.addClass("select2-drop-auto-width"),o.css("width",""),b=o.outerWidth(!1)+(s.scrollHeight===s.clientHeight?0:X.width),b>c?c=b:b=c,h=o.outerHeight(!1)):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(t=this.body.offset(),_-=t.top,v-=t.left),!T()&&x()&&(v=l.left+this.container.outerWidth(!1)-b),r={left:v,width:c},i?(r.top=l.top-h,r.bottom="auto",this.container.addClass("select2-drop-above"),o.addClass("select2-drop-above")):(r.top=_,r.bottom="auto",this.container.removeClass("select2-drop-above"),o.removeClass("select2-drop-above")),r=e.extend(r,Y(this.opts.dropdownCss,this.opts.element)),o.css(r)},shouldOpen:function(){var t;return!this.opened()&&(this._enabled!==!1&&this._readonly!==!0&&(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(),J.on("mousemove.select2Event",function(e){F.x=e.pageX,F.y=e.pageY}),!0)},opening:function(){var t,n=this.containerEventName,r="scroll."+n,s="resize."+n,o="orientationchange."+n;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),t=e("#select2-drop-mask"),0===t.length&&(t=e(document.createElement("div")),t.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),t.hide(),t.appendTo(this.body),t.on("mousedown touchstart click",function(n){i(t);var r,s=e("#select2-drop");s.length>0&&(r=s.data("select2"),r.opts.selectOnBlur&&r.selectHighlighted({noFocus:!0}),r.close(),n.preventDefault(),n.stopPropagation())})),this.dropdown.prev()[0]!==t[0]&&this.dropdown.before(t),e("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),t.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var a=this;this.container.parents().add(window).each(function(){e(this).on(s+" "+r+" "+o,function(e){a.opened()&&a.positionDropdown()})})},close:function(){if(this.opened()){var t=this.containerEventName,i="scroll."+t,n="resize."+t,r="orientationchange."+t;this.container.parents().add(window).each(function(){e(this).off(i).off(n).off(r)}),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(),J.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 Y(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var t,i,n,r,s,o,a,l,d=this.results;if(i=this.highlight(),!(i<0)){if(0==i)return void d.scrollTop(0);t=this.findHighlightableChoices().find(".select2-result-label"),n=e(t[i]),l=(n.offset()||{}).top||0,r=l+n.outerHeight(!0),i===t.length-1&&(a=d.find("li.select2-more-results"),a.length>0&&(r=a.offset().top+a.outerHeight(!0))),s=d.offset().top+d.outerHeight(!1),r>s&&d.scrollTop(d.scrollTop()+(r-s)),o=l-d.offset().top,o<0&&"none"!=n.css("display")&&d.scrollTop(d.scrollTop()+o)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(t){for(var i=this.findHighlightableChoices(),n=this.highlight();n>-1&&n<i.length;){n+=t;var r=e(i[n]);if(r.hasClass("select2-result-selectable")&&!r.hasClass("select2-disabled")&&!r.hasClass("select2-selected")){this.highlight(n);break}}},highlight:function(t){var i,n,s=this.findHighlightableChoices();return 0===arguments.length?r(s.filter(".select2-highlighted")[0],s.get()):(t>=s.length&&(t=s.length-1),t<0&&(t=0),this.removeHighlight(),i=e(s[t]),i.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",i.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(i.text()),n=i.data("select2-data"),void(n&&this.opts.element.trigger({type:"select2-highlight",val:this.id(n),choice:n})))},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 i=e(t.target).closest(".select2-result-selectable");if(i.length>0&&!i.is(".select2-highlighted")){var n=this.findHighlightableChoices();this.highlight(n.index(i))}else 0==i.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var e,t=this.results,i=t.find("li.select2-more-results"),n=this.resultsPage+1,r=this,s=this.search.val(),o=this.context;0!==i.length&&(e=i.offset().top-t.offset().top-t.height(),e<=this.opts.loadMorePadding&&(i.addClass("select2-active"),this.opts.query({element:this.opts.element,term:s,page:n,context:o,matcher:this.opts.matcher,callback:this.bind(function(e){r.opened()&&(r.opts.populateResults.call(this,t,e.results,{term:s,page:n,context:o}),r.postprocessResults(e,!1,!1),e.more===!0?(i.detach().appendTo(t).html(r.opts.escapeMarkup(Y(r.opts.formatLoadMore,r.opts.element,n+1))),window.setTimeout(function(){r.loadMoreIfNeeded()},10)):i.remove(),r.positionDropdown(),r.resultsPage=n,r.context=e.context,this.opts.element.trigger({type:"select2-loaded",items:e}))})})))},tokenize:function(){},updateResults:function(i){function n(){d.removeClass("select2-active"),u.positionDropdown(),c.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?u.liveRegion.text(c.text()):u.liveRegion.text(u.opts.formatMatches(c.find('.select2-result-selectable:not(".select2-selected")').length))}function r(e){c.html(e),n()}var s,a,l,d=this.search,c=this.results,h=this.opts,u=this,p=d.val(),f=e.data(this.container,"select2-last-term");if((i===!0||!f||!o(p,f))&&(e.data(this.container,"select2-last-term",p),i===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var m=this.getMaximumSelectionSize();if(m>=1&&(s=this.data(),e.isArray(s)&&s.length>=m&&S(h.formatSelectionTooBig,"formatSelectionTooBig")))return void r("<li class='select2-selection-limit'>"+Y(h.formatSelectionTooBig,h.element,m)+"</li>");if(d.val().length<h.minimumInputLength)return r(S(h.formatInputTooShort,"formatInputTooShort")?"<li class='select2-no-results'>"+Y(h.formatInputTooShort,h.element,d.val(),h.minimumInputLength)+"</li>":""),void(i&&this.showSearch&&this.showSearch(!0));if(h.maximumInputLength&&d.val().length>h.maximumInputLength)return void r(S(h.formatInputTooLong,"formatInputTooLong")?"<li class='select2-no-results'>"+Y(h.formatInputTooLong,h.element,d.val(),h.maximumInputLength)+"</li>":"");h.formatSearching&&0===this.findHighlightableChoices().length&&r("<li class='select2-searching'>"+Y(h.formatSearching,h.element)+"</li>"),d.addClass("select2-active"),this.removeHighlight(),a=this.tokenize(),a!=t&&null!=a&&d.val(a),this.resultsPage=1,h.query({element:h.element,term:d.val(),page:this.resultsPage,context:null,matcher:h.matcher,callback:this.bind(function(s){var a;if(l==this.queryCount){if(!this.opened())return void this.search.removeClass("select2-active");if(s.hasError!==t&&S(h.formatAjaxError,"formatAjaxError"))return void r("<li class='select2-ajax-error'>"+Y(h.formatAjaxError,h.element,s.jqXHR,s.textStatus,s.errorThrown)+"</li>");if(this.context=s.context===t?null:s.context,this.opts.createSearchChoice&&""!==d.val()&&(a=this.opts.createSearchChoice.call(u,d.val(),s.results),a!==t&&null!==a&&u.id(a)!==t&&null!==u.id(a)&&0===e(s.results).filter(function(){return o(u.id(this),u.id(a))}).length&&this.opts.createSearchChoicePosition(s.results,a)),0===s.results.length&&S(h.formatNoMatches,"formatNoMatches"))return void r("<li class='select2-no-results'>"+Y(h.formatNoMatches,h.element,d.val())+"</li>");c.empty(),u.opts.populateResults.call(this,c,s.results,{term:d.val(),page:this.resultsPage,context:null}),s.more===!0&&S(h.formatLoadMore,"formatLoadMore")&&(c.append("<li class='select2-more-results'>"+h.escapeMarkup(Y(h.formatLoadMore,h.element,this.resultsPage))+"</li>"),window.setTimeout(function(){u.loadMoreIfNeeded()},10)),this.postprocessResults(s,i),n(),this.opts.element.trigger({type:"select2-loaded",items:s})}})})}},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(){p(this.search)},selectHighlighted:function(e){if(this._touchMoved)return void this.clearTouchMoved();var t=this.highlight(),i=this.results.find(".select2-highlighted"),n=i.closest(".select2-result").data("select2-data");n?(this.highlight(t),this.onSelect(n,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 i=this.select.children("option").first();if(this.opts.placeholderOption!==t)return"first"===this.opts.placeholderOption&&i||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===e.trim(i.text())&&""===i.val())return i}},initContainerWidth:function(){function i(){var i,n,r,s,o,a;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(i=this.opts.element.attr("style"),i!==t)for(n=i.split(";"),s=0,o=n.length;s<o;s+=1)if(a=n[s].replace(/\s/g,""),r=a.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==r&&r.length>=1)return r[1];return"resolve"===this.opts.width?(i=this.opts.element.css("width"),i.indexOf("%")>0?i:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return e.isFunction(this.opts.width)?this.opts.width():this.opts.width}var n=i.call(this);null!==n&&this.container.css("width",n)}}),Z=M(D,{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 i,n,r;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(),i=this.search.get(0),i.createTextRange?(n=i.createTextRange(),n.collapse(!1),n.select()):i.setSelectionRange&&(r=this.search.val().length,i.setSelectionRange(r,r))),""===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(){this.opened()&&(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),L.call(this,"selection","focusser")},initContainer:function(){var t,n,r=this.container,s=this.dropdown,o=j();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=t=r.find(".select2-choice"),this.focusser=r.find(".select2-focusser"),t.find(".select2-chosen").attr("id","select2-chosen-"+o),this.focusser.attr("aria-labelledby","select2-chosen-"+o),this.results.attr("id","select2-results-"+o),this.search.attr("aria-owns","select2-results-"+o),this.focusser.attr("id","s2id_autogen"+o),n=e("label[for='"+this.opts.element.attr("id")+"']"),this.opts.element.focus(this.bind(function(){this.focus()})),this.focusser.prev().text(n.text()).attr("for",this.focusser.attr("id"));var a=this.opts.element.attr("title");this.opts.element.attr("title",a||n.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()&&229!=e.keyCode){if(e.which===N.PAGE_UP||e.which===N.PAGE_DOWN)return void m(e);switch(e.which){case N.UP:case N.DOWN:return this.moveHighlight(e.which===N.UP?-1:1),void m(e);case N.ENTER:return this.selectHighlighted(),void m(e);case N.TAB:return void this.selectHighlighted({noFocus:!0});case N.ESC:return this.cancel(e),void m(e)}}})),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()&&e.which!==N.TAB&&!N.isControl(e)&&!N.isFunctionKey(e)&&e.which!==N.ESC){if(this.opts.openOnEnter===!1&&e.which===N.ENTER)return void m(e);if(e.which==N.DOWN||e.which==N.UP||e.which==N.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;return this.open(),void m(e)}return e.which==N.DELETE||e.which==N.BACKSPACE?(this.opts.allowClear&&this.clear(),void m(e)):void 0}})),d(this.focusser),this.focusser.on("keyup-change input",this.bind(function(e){if(this.opts.minimumResultsForSearch>=0){if(e.stopPropagation(),this.opened())return;this.open()}})),t.on("mousedown touchstart","abbr",this.bind(function(e){this.isInterfaceEnabled()&&(this.clear(),g(e),this.close(),this.selection&&this.selection.focus())})),t.on("mousedown touchstart",this.bind(function(n){i(t),this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),m(n)})),s.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),t.on("focus",this.bind(function(e){m(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 i=this.selection.data("select2-data");if(i){var n=e.Event("select2-clearing");if(this.opts.element.trigger(n),n.isDefaultPrevented())return;var r=this.getPlaceholderOption();this.opts.element.val(r?r.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(i),choice:i}),this.triggerChange({removed:i}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var e=this;this.opts.initSelection.call(null,this.opts.element,function(i){i!==t&&null!==i&&(e.updateSelection(i),e.close(),e.setPlaceholder(),e.nextSearchTerm=e.opts.nextSearchTerm(i,e.search.val()))})}},isPlaceholderOptionSelected:function(){var e;return this.getPlaceholder()!==t&&((e=this.getPlaceholderOption())!==t&&e.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===t||null===this.opts.element.val())},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(e,t){var n=e.find("option").filter(function(){return this.selected&&!this.disabled});t(i.optionToData(n))}:"data"in t&&(t.initSelection=t.initSelection||function(i,n){var r=i.val(),s=null;t.query({matcher:function(e,i,n){var a=o(r,t.id(n));return a&&(s=n),a},callback:e.isFunction(n)?function(){n(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,i){var n=0,r=this;if(this.findHighlightableChoices().each2(function(e,t){if(o(r.id(t.data("select2-data")),r.opts.element.val()))return n=e,!1}),i!==!1&&(t===!0&&n>=0?this.highlight(n):this.highlight(0)),t===!0){var s=this.opts.minimumResultsForSearch;s>=0&&this.showSearch(k(e.results)>=s)}},showSearch:function(t){this.showSearchInput!==t&&(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)){var i=this.opts.element.val(),n=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(),o(i,this.id(e))||this.triggerChange({added:e,removed:n})}},updateSelection:function(e){var i,n,r=this.selection.find(".select2-chosen");this.selection.data("select2-data",e),r.empty(),null!==e&&(i=this.opts.formatSelection(e,r,this.opts.escapeMarkup)),i!==t&&r.append(i),n=this.opts.formatSelectionCssClass(e,r),n!==t&&r.addClass(n),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==t&&this.container.addClass("select2-allowclear")},val:function(){var e,i=!1,n=null,r=this,s=this.data();if(0===arguments.length)return this.opts.element.val();if(e=arguments[0],arguments.length>1&&(i=arguments[1]),this.select)this.select.val(e).find("option").filter(function(){return this.selected}).each2(function(e,t){return n=r.optionToData(t),!1}),this.updateSelection(n),this.setPlaceholder(),i&&this.triggerChange({added:n,removed:s});else{if(!e&&0!==e)return void this.clear(i);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){r.opts.element.val(e?r.id(e):""),r.updateSelection(e),r.setPlaceholder(),i&&r.triggerChange({added:e,removed:s})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(e){var i,n=!1;return 0===arguments.length?(i=this.selection.data("select2-data"),i==t&&(i=null),i):(arguments.length>1&&(n=arguments[1]),void(e?(i=this.data(),this.opts.element.val(e?this.id(e):""),this.updateSelection(e),n&&this.triggerChange({added:e,removed:i})):this.clear(n)))}}),H=M(D,{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),i=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(e,t){var n=[];e.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(e,t){n.push(i.optionToData(t))}),t(n)}:"data"in t&&(t.initSelection=t.initSelection||function(i,n){var r=a(i.val(),t.separator,t.transformVal),s=[];t.query({matcher:function(i,n,a){var l=e.grep(r,function(e){return o(e,t.id(a))}).length;return l&&s.push(a),l},callback:e.isFunction(n)?function(){for(var e=[],i=0;i<r.length;i++)for(var a=r[i],l=0;l<s.length;l++){var d=s[l];if(o(a,t.id(d))){e.push(d),s.splice(l,1);break}}n(e)}:e.noop})}),t},selectChoice:function(e){var t=this.container.find(".select2-search-choice-focus");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),L.call(this,"searchContainer","selection")},initContainer:function(){var t,i=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=t=this.container.find(i);var n=this;this.selection.on("click",".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)",function(t){n.search[0].focus(),n.selectChoice(e(this))}),this.search.attr("id","s2id_autogen"+j()),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(){this.search.attr("placeholder")&&0==this.search.val().length||this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()){++this.keydowns;var i=t.find(".select2-search-choice-focus"),n=i.prev(".select2-search-choice:not(.select2-locked)"),r=i.next(".select2-search-choice:not(.select2-locked)"),s=f(this.search);if(i.length&&(e.which==N.LEFT||e.which==N.RIGHT||e.which==N.BACKSPACE||e.which==N.DELETE||e.which==N.ENTER)){var o=i;return e.which==N.LEFT&&n.length?o=n:e.which==N.RIGHT?o=r.length?r:null:e.which===N.BACKSPACE?this.unselect(i.first())&&(this.search.width(10),o=n.length?n:r):e.which==N.DELETE?this.unselect(i.first())&&(this.search.width(10),o=r.length?r:null):e.which==N.ENTER&&(o=null),this.selectChoice(o),m(e),void(o&&o.length||this.open())}if((e.which===N.BACKSPACE&&1==this.keydowns||e.which==N.LEFT)&&0==s.offset&&!s.length)return this.selectChoice(t.find(".select2-search-choice:not(.select2-locked)").last()),void m(e);if(this.selectChoice(null),this.opened())switch(e.which){case N.UP:case N.DOWN:return this.moveHighlight(e.which===N.UP?-1:1),void m(e);case N.ENTER:return this.selectHighlighted(),void m(e);case N.TAB:return this.selectHighlighted({noFocus:!0}),void this.close();case N.ESC:return this.cancel(e),void m(e)}if(e.which!==N.TAB&&!N.isControl(e)&&!N.isFunctionKey(e)&&e.which!==N.BACKSPACE&&e.which!==N.ESC){if(e.which===N.ENTER){if(this.opts.openOnEnter===!1)return;if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return}this.open(),e.which!==N.PAGE_UP&&e.which!==N.PAGE_DOWN||m(e),e.which===N.ENTER&&m(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",i,this.bind(function(t){this.isInterfaceEnabled()&&(e(t.target).closest(".select2-search-choice").length>0||(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",i,this.bind(function(){this.isInterfaceEnabled()&&(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(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var e=this;this.opts.initSelection.call(null,this.opts.element,function(i){i!==t&&null!==i&&(e.updateSelection(i),e.close(),e.clearSearch())})}},clearSearch:function(){var e=this.getPlaceholder(),i=this.getMaxSearchWidth();e!==t&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(e).addClass("select2-default"),this.search.width(i>0?i: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(){this.opened()&&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 i=[],n=[],s=this;e(t).each(function(){r(s.id(this),i)<0&&(i.push(s.id(this)),n.push(this))}),t=n,this.selection.find(".select2-search-choice").remove(),e(t).each(function(){s.addSelectedChoice(this)}),s.postprocessResults()},tokenize:function(){var e=this.search.val();e=this.opts.tokenizer.call(this,e,this.data(),this.bind(this.onSelect),this.opts),null!=e&&e!=t&&(this.search.val(e),e.length>0&&this.open())},onSelect:function(e,i){this.triggerSelect(e)&&""!==e.text&&(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}),i&&i.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(i){var n,r,s=!i.locked,o=e("<li class='select2-search-choice'>    <div></div>    <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),a=e("<li class='select2-search-choice select2-locked'><div></div></li>"),l=s?o:a,d=this.id(i),c=this.getVal();n=this.opts.formatSelection(i,l.find("div"),this.opts.escapeMarkup),n!=t&&l.find("div").replaceWith(e("<div></div>").html(n)),r=this.opts.formatSelectionCssClass(i,l.find("div")),r!=t&&l.addClass(r),s&&l.find(".select2-search-choice-close").on("mousedown",m).on("click dblclick",this.bind(function(t){this.isInterfaceEnabled()&&(this.unselect(e(t.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),m(t),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),l.data("select2-data",i),l.insertBefore(this.searchContainer),c.push(d),this.setVal(c)},unselect:function(t){var i,n,s=this.getVal();if(t=t.closest(".select2-search-choice"),0===t.length)throw"Invalid argument: "+t+". Must be .select2-search-choice";if(i=t.data("select2-data")){var o=e.Event("select2-removing");if(o.val=this.id(i),o.choice=i,this.opts.element.trigger(o),o.isDefaultPrevented())return!1;for(;(n=r(this.id(i),s))>=0;)s.splice(n,1),this.setVal(s),this.select&&this.postprocessResults();return t.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(i),choice:i}),this.triggerChange({removed:i}),!0}},postprocessResults:function(e,t,i){var n=this.getVal(),s=this.results.find(".select2-result"),o=this.results.find(".select2-result-with-children"),a=this;s.each2(function(e,t){var i=a.id(t.data("select2-data"));r(i,n)>=0&&(t.addClass("select2-selected"),t.find(".select2-result-selectable").addClass("select2-selected"))}),o.each2(function(e,t){t.is(".select2-result-selectable")||0!==t.find(".select2-result-selectable:not(.select2-selected)").length||t.addClass("select2-selected")}),this.highlight()==-1&&i!==!1&&this.opts.closeOnSelect===!0&&a.highlight(0),!this.opts.createSearchChoice&&!s.filter(".select2-result:not(.select2-selected)").length>0&&(!e||e&&!e.more&&0===this.results.find(".select2-no-results").length)&&S(a.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+Y(a.opts.formatNoMatches,a.opts.element,a.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-l(this.search)},resizeSearch:function(){var e,t,i,n,r,s=l(this.search);e=_(this.search)+10,t=this.search.offset().left,i=this.selection.width(),n=this.selection.offset().left,r=i-(t-n)-s,r<e&&(r=i-s),r<40&&(r=i-s),r<=0&&(r=e),this.search.width(Math.floor(r))},getVal:function(){var e;return this.select?(e=this.select.val(),null===e?[]:e):(e=this.opts.element.val(),a(e,this.opts.separator,this.opts.transformVal))},setVal:function(t){var i;this.select?this.select.val(t):(i=[],e(t).each(function(){r(this,i)<0&&i.push(this)}),this.opts.element.val(0===i.length?"":i.join(this.opts.separator)))},buildChangeDetails:function(e,t){for(var t=t.slice(0),e=e.slice(0),i=0;i<t.length;i++)for(var n=0;n<e.length;n++)o(this.opts.id(t[i]),this.opts.id(e[n]))&&(t.splice(i,1),i>0&&i--,e.splice(n,1),n--);return{added:t,removed:e}},val:function(i,n){var r,s=this;if(0===arguments.length)return this.getVal();if(r=this.data(),r.length||(r=[]),!i&&0!==i)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),void(n&&this.triggerChange({added:this.data(),removed:r}));if(this.setVal(i),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),n&&this.triggerChange(this.buildChangeDetails(r,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 i=e.map(t,s.id);s.setVal(i),s.updateSelection(t),s.clearSearch(),n&&s.triggerChange(s.buildChangeDetails(r,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=[],i=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){t.push(i.opts.id(e(this).data("select2-data")))}),this.setVal(t),this.triggerChange()},data:function(t,i){var n,r,s=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return e(this).data("select2-data")}).get():(r=this.data(),t||(t=[]),n=e.map(t,function(e){return s.opts.id(e)}),this.setVal(n),this.updateSelection(t),this.clearSearch(),i&&this.triggerChange(this.buildChangeDetails(r,this.data())),void 0)}}),e.fn.select2=function(){var i,n,s,o,a,l=Array.prototype.slice.call(arguments,0),d=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],c=["opened","isFocused","container","dropdown"],h=["val","data"],u={search:"externalSearch"};return this.each(function(){if(0===l.length||"object"==typeof l[0])i=0===l.length?{}:e.extend({},l[0]),i.element=e(this),"select"===i.element.get(0).tagName.toLowerCase()?a=i.element.prop("multiple"):(a=i.multiple||!1,"tags"in i&&(i.multiple=a=!0)),n=a?new window.Select2.class.multi:new window.Select2.class.single,n.init(i);else{if("string"!=typeof l[0])throw"Invalid arguments to select2 plugin: "+l;if(r(l[0],d)<0)throw"Unknown method: "+l[0];if(o=t,n=e(this).data("select2"),n===t)return;if(s=l[0],"container"===s?o=n.container:"dropdown"===s?o=n.dropdown:(u[s]&&(s=u[s]),o=n[s].apply(n,l.slice(1))),r(l[0],c)>=0||r(l[0],h)>=0&&1==l.length)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,i,n){var r=[];return y(this.text(e),i.term,r,n),r.join("")},transformVal:function(t){return e.trim(t)},formatSelection:function(e,i,n){return e?n(this.text(e)):t},sortResults:function(e,t,i){return e},formatResultCssClass:function(e){return e.css},formatSelectionCssClass:function(e,i){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 n(""+t).toUpperCase().indexOf(n(""+e).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:C,escapeMarkup:w,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(e){return e},adaptDropdownCssClass:function(e){return null},nextSearchTerm:function(e,i){return t},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(e){var t="ontouchstart"in window||navigator.msMaxTouchPoints>0;return!t||!(e.opts.minimumResultsForSearch<0)}},e.fn.select2.locales=[],e.fn.select2.locales.en={formatMatches:function(e){return 1===e?"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,i){return"Loading failed"},formatInputTooShort:function(e,t){var i=t-e.length;return"Please enter "+i+" or more character"+(1==i?"":"s")},formatInputTooLong:function(e,t){var i=e.length-t;return"Please delete "+i+" character"+(1==i?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(1==e?"":"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:b,local:T,tags:x},util:{debounce:h,markMatch:y,escapeMarkup:w,stripDiacritics:n},class:{abstract:D,single:Z,multi:H}}}}(jQuery),define("select2",function(){}),define("app/views/folder-perm",["jquery","underscore","backbone","common","jquery.ui.tabs","select2","app/views/repo-folder-perm-item"],function(e,t,i,n,r,s,o){"use strict";var a=i.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=n.pathJoin([this.dir_path,this.obj_name]),this.render(),e(window).width()<768&&this.$el.css({width:e(window).width()-50,height:e(window).height()-50,overflow:"auto"}),this.$el.modal({appendTo:"#main",focus:!1}),e(window).width()>=768&&e("#simplemodal-container").css({width:"auto",height:"auto"}),this.$("#folder-perm-tabs").tabs(),this.panelsInit(),this.$add_user_perm=this.$("#add-user-folder-perm"),this.$add_group_perm=this.$("#add-group-folder-perm");var i=this;e(document).on("click",function(e){var t=e.target||event.srcElement;i.$(".perm-edit-icon, .perm-toggle-select").is(t)||(i.$(".perm").removeClass("hide"),i.$(".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="'+n.HTMLescape(this.obj_name)+'">'+n.HTMLescape(this.obj_name)+"</span>")})),this},panelsInit:function(){var t=this;n.ajaxGet({get_url:n.getUrl({name:"repo_user_folder_perm",repo_id:this.repo_id}),data:{folder_path:this.path},after_op_success:function(i){e(i).each(function(i,n){var r=new o({item_data:e.extend(n,{for_user:!0})});t.$add_user_perm.after(r.el)})}}),n.ajaxGet({get_url:n.getUrl({name:"repo_group_folder_perm",repo_id:this.repo_id}),data:{folder_path:this.path},after_op_success:function(i){e(i).each(function(i,n){var r=new o({item_data:e.extend(n,{for_user:!1})});t.$add_group_perm.after(r.el)})}}),e('[name="email"]',this.$add_user_perm).select2(n.contactInputOptionsForSelect2());for(var i=app.pageOptions.groups||[],r="",s=0,a=i.length;s<a;s++)r+='<option value="'+i[s].id+'" data-index="'+s+'">'+i[s].name+"</option>";e('[name="group"]',this.$add_group_perm).html(r).select2({placeholder:gettext("Select groups"),escapeMarkup:function(e){return e}})},events:{"click #add-user-folder-perm .submit":"addFolderPerm","click #add-group-folder-perm .submit":"addFolderPerm"},addFolderPerm:function(t){var i,r,s,a,l;if("add-user-folder-perm"==e(t.currentTarget).closest("tr").attr("id")){i=this.$add_user_perm,r=e("#user-folder-perm .error"),s=n.getUrl({name:"repo_user_folder_perm",repo_id:this.repo_id});var d=e('[name="email"]',i),c=d.val(),h=e('[name="permission"]',i).val();if(!c||!h)return!1;a={folder_path:this.path,user_email:c.split(","),permission:h},l={for_user:!0}}else{i=this.$add_group_perm,r=e("#group-folder-perm .error"),s=n.getUrl({name:"repo_group_folder_perm",repo_id:this.repo_id});var d=e('[name="group"]',i),u=d.val().join(","),h=e('[name="permission"]',i).val();if(!u||!h)return!1;a={folder_path:this.path,group_id:u.split(","),permission:h},l={for_user:!1}}var p=i.children('[type="submit"]');n.disableButton(p),e.ajax({url:s,dataType:"json",method:"POST",beforeSend:n.prepareCSRFToken,traditional:!0,data:a,success:function(t){if(t.success.length>0&&(e(t.success).each(function(t,n){var r=new o({item_data:e.extend(n,l)});i.closest("tr").after(r.el)}),d.select2("val",""),r.addClass("hide")),t.failed.length>0){var s="";e(t.failed).each(function(e,t){s+=n.HTMLescape(t.user_email||t.group_id)+": "+n.HTMLescape(t.error_msg)+"<br />"}),r.html(s).removeClass("hide")}},error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),r.html(i).removeClass("hide")}})}});return a}),define("app/views/dirent",["jquery","underscore","backbone","common","file-tree","app/views/share","app/views/dialogs/dirent-mvcp","app/views/folder-perm","app/views/widgets/hl-item-view","app/views/widgets/dropdown"],function(e,t,i,n,r,s,o,a,l,d){"use strict";var c=l.extend({tagName:"tr",attributes:{draggable:"true"},fileTemplate:t.template(e("#dirent-file-tmpl").html()),fileMobileTemplate:t.template(e("#dirent-file-mobile-tmpl").html()),dirTemplate:t.template(e("#dirent-dir-tmpl").html()),dirMobileTemplate:t.template(e("#dirent-dir-mobile-tmpl").html()),renameTemplate:t.template(e("#rename-form-template").html()),initialize:function(e){l.prototype.initialize.call(this),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 t,i=this.dir,r=n.pathJoin([i.path,this.model.get("obj_name")]),s=app.pageOptions.is_pro,o=app.pageOptions.file_audit_enabled,a=n.isHiDPI()?48:24;return t=this.model.get("is_dir")?e(window).width()<768?this.dirMobileTemplate:this.dirTemplate:e(window).width()<768?this.fileMobileTemplate:this.fileTemplate,this.$el.html(t({dirent:this.model.attributes,dirent_path:r,encoded_path:n.encodePath(r),icon_url:this.model.getIconUrl(a),url:this.model.getWebUrl(),download_url:this.model.getDownloadUrl(),category:i.category,repo_id:i.repo_id,is_repo_owner:i.is_repo_owner,is_virtual:i.is_virtual,has_been_shared_out:i.has_been_shared_out,can_generate_share_link:app.pageOptions.can_generate_share_link,can_generate_upload_link:app.pageOptions.can_generate_upload_link,is_pro:s,file_audit_enabled:o,repo_encrypted:i.encrypted})),this.$(".file-locked-icon").attr("title",gettext("locked by {placeholder}").replace("{placeholder}",this.model.get("lock_owner_name"))),this.dropdown=new d({el:this.$(".sf-dropdown"),right:"0"}),this.$(".img-name-link").magnificPopup(this.dirView.magnificPopupOptions),this},events:{click:"clickItem","click .select":"select","click .file-star":"starFile","click .dirent-name":"visitDirent","click .img-name-link":"viewImageWithPopup",dragstart:"itemDragstart",dragover:"itemDragover",dragenter:"itemDragenter",dragleave:"itemDragleave",drop:"itemDrop","click .download-dir":"downloadDir","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","click .view-details":"viewDetails","click .file-comment":"viewFileComments","click .open-via-client":"open_via_client"},_hideMenu:function(){this.dropdown.hide()},clickItem:function(t){var i=t.target||event.srcElement;this.$("td").is(i)&&("0px"==e("#dirent-details").css("right")&&this.viewDetails(),this.model.get("is_file")&&"0px"==e("#file-comments").css("right")&&this.viewFileComments())},select:function(){var t=this.$("[type=checkbox]");t.prop("checked")?this.model.set({selected:!0},{silent:!0}):this.model.set({selected:!1},{silent:!0});var i=this.dirView,n=i.$("#multi-dirents-op"),r=i.$("th [type=checkbox]"),s=0;i.$("tr:gt(0) [type=checkbox]").each(function(){e(this).prop("checked")&&(s+=1)});var o=i.$("#cur-dir-ops");s>0?(n.css({display:"inline-block"}),o.hide()):(n.hide(),o.show()),i.updateDirOpBarUI(),s==i.$("tr:gt(0)").length?r.prop("checked",!0):r.prop("checked",!1);
},itemDragstart:function(e){if("rw"!=this.model.get("perm"))return!1;var t=e.originalEvent;t.dataTransfer.setData("text/cid",this.model.cid),t.dataTransfer.setData("text/is_dir",this.model.get("is_dir")),t.dataTransfer.setData("text/plain",this.model.get("obj_name")),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(this.$(".dirent-icon img")[0],0,0)},itemDragover:function(e){var t=e.originalEvent;if(t.preventDefault(),!t.dataTransfer.types.length||t.dataTransfer.types.indexOf("text/cid")!=-1)return"rw"==this.model.get("perm")&&(!!this.model.get("is_dir")&&void(t.dataTransfer.dropEffect="move"))},itemDragenter:function(e){var t=e.originalEvent;if(t.preventDefault(),!t.dataTransfer.types.length||t.dataTransfer.types.indexOf("text/cid")!=-1)return"rw"==this.model.get("perm")&&(!!this.model.get("is_dir")&&void this.$el.css({"background-color":"#f8f8f8"}))},itemDragleave:function(e){var t=e.originalEvent;if(t.preventDefault(),!t.dataTransfer.types.length||t.dataTransfer.types.indexOf("text/cid")!=-1)return"rw"==this.model.get("perm")&&(!!this.model.get("is_dir")&&void this.$el.removeAttr("style"))},itemDrop:function(t){var i=t.originalEvent;if(i.preventDefault(),!i.dataTransfer.types.length||i.dataTransfer.types.indexOf("text/cid")!=-1){if("rw"!=this.model.get("perm"))return!1;if(!this.model.get("is_dir"))return!1;this.$el.removeAttr("style");var r=i.dataTransfer.getData("text/cid"),s=i.dataTransfer.getData("text/is_dir"),o=i.dataTransfer.getData("text/plain");if("true"==s&&o==this.model.get("obj_name"))return!1;var a=this.dir,l=a.repo_id,d=a.path,c=n.pathJoin([d,this.model.get("obj_name")]);e.ajax({url:n.getUrl({name:"copy_move_task"}),type:"post",cache:!1,dataType:"json",data:{src_repo_id:l,src_parent_dir:d,src_dirent_name:o,dst_repo_id:l,dst_parent_dir:c,operation:"move",dirent_type:"true"==s?"dir":"file"},beforeSend:n.prepareCSRFToken,success:function(){var e=gettext("Successfully moved %(name)s").replace("%(name)s",o);n.feedback(e,"success"),a.remove(r)},error:function(t){t.responseText?n.feedback(e.parseJSON(t.responseText).error||e.parseJSON(t.responseText).error_msg,"error"):n.feedback(gettext("Please check the network."),"error")}})}},downloadDir:function(){var e=this.dirView.dir,t=this.model.get("obj_name");return n.zipDownload(e.repo_id,e.path,t),!1},starFile:function(){var t=this,i=this.dirView.dir,r=this.model.get("starred"),s=n.pathJoin([i.path,this.model.get("obj_name")]);return r?e.ajax({url:n.getUrl({name:"starred_files"})+"?repo_id="+i.repo_id+"&p="+encodeURIComponent(s),type:"DELETE",cache:!1,dataType:"json",beforeSend:n.prepareCSRFToken,success:function(){t.model.set({starred:!1})},error:function(e){n.ajaxErrorHandler(e)}}):e.ajax({url:n.getUrl({name:"starred_files"}),type:"POST",cache:!1,dataType:"json",beforeSend:n.prepareCSRFToken,data:{repo_id:i.repo_id,p:s},success:function(){t.model.set({starred:!0})},error:function(e){n.ajaxErrorHandler(e)}}),!1},visitDirent:function(){e(window).width()<768&&!this.model.get("is_img")&&(location.href=this.$(".dirent-name a").attr("href"))},viewImageWithPopup:function(){var t=e(".img-name-link",this.dirView.$dirent_list).index(this.$(".img-name-link"));e.magnificPopup.open(this.dirView.magnificPopupOptions,t)},share:function(){var e=this.dir,t=this.model.get("obj_name"),i=n.pathJoin([e.path,t]),r={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"),dirent_path:i,obj_name:t};return app.pageOptions.is_pro&&(r.is_admin=e.is_admin),new s(r),this._hideMenu(),!1},del:function(){var t=this;if(this.model.get("is_img"))var i=e(".img-name-link",this.dirView.$dirent_list).index(this.$(".img-name-link"));var r=this.model.get("obj_name");return this.model.deleteFromServer({success:function(e){var s=gettext("Successfully deleted %(name)s").replace("%(name)s",r);n.feedback(s,"success"),t._hideMenu(),t.model.get("is_img")&&t.dirView.updateMagnificPopupOptions({op:"delete-item",index:i})},error:function(e){n.ajaxErrorHandler(e)}}),!1},rename:function(){var t=this,i=this.model.get("obj_name"),r=e(this.renameTemplate({dirent_name:i})),s=this.$(".dirent-name"),o=this.$(".dirent-op"),a=s.closest("td");a.attr("colspan",2).css({width:s.width()+o.outerWidth(),height:s.height()}).append(r),o.hide(),s.hide(),this.$el.attr("draggable",!1);var l=e('[name="newname"]',r),d=i.lastIndexOf(".");this.model.get("is_dir")||d==-1?l.select():(l[0].focus(),l[0].setSelectionRange(0,d)),this._hideMenu(),app.ui.freezeItemHightlight=!0;var c=function(i){if(app.ui.freezeItemHightlight=!1,app.ui.currentHighlightedItem&&app.ui.currentHighlightedItem.rmHighlight(),t.$el.attr("draggable",!0),t.model.get("is_img")){var n=e(".img-name-link",t.dirView.$dirent_list).index(t.$(".img-name-link"));t.dirView.updateMagnificPopupOptions({op:"update-item",index:n,model:t.model})}},h=function(){return app.ui.freezeItemHightlight=!1,app.ui.currentHighlightedItem&&app.ui.currentHighlightedItem.rmHighlight(),r.remove(),o.show(),s.show(),a.attr("colspan",1).css({width:s.width()}),t.$el.attr("draggable",!0),!1};e(".cancel",r).click(h);var t=this;return r.submit(function(){var s,o=e.trim(e('[name="newname"]',r).val());if(!o)return s=gettext("It is required."),n.feedback(s,"error"),!1;if(o.indexOf("/")!=-1)return s=gettext("Name should not include '/'."),n.feedback(s,"error"),!1;if(o==i)return h(),!1;var a=e('[type="submit"]',r);n.disableButton(a);var l=function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),n.feedback(i,"error"),n.enableButton(a)};return t.model.rename({newname:o,success:c,error:l}),!1}),!1},mvcp:function(t){var i=e(t.currentTarget).hasClass("mv")?"mv":"cp",n={dir:this.dir,dirent:this.model,op_type:i};if(this.model.get("is_img")&&"mv"==i){var r=e(".img-name-link",this.dirView.$dirent_list).index(this.$(".img-name-link"));e.extend(n,{dirView:this.dirView,imgIndex:r})}return this._hideMenu(),new o(n),!1},setFolderPerm:function(){var e={obj_name:this.model.get("obj_name"),dir_path:this.dir.path,repo_id:this.dir.repo_id};return this._hideMenu(),new a(e),!1},lockFile:function(){var e=this;return this._hideMenu(),this.model.lockFile({success:function(){e.$el.removeClass("hl")},error:function(e){n.ajaxErrorHandler(e)}}),!1},unlockFile:function(){var e=this;return this._hideMenu(),this.model.unlockFile({success:function(){e.$el.removeClass("hl")},error:function(e){n.ajaxErrorHandler(e)}}),!1},viewDetails:function(){var t=this,i=n.isHiDPI()?48:24,r={repo_id:this.dir.repo_id,dir_path:this.dir.path,icon_url:this.model.getIconUrl(i),big_icon_url:this.model.getIconUrl(192),dirent:this.model.attributes,thumbnail_url:"",path:this.dir.repo_name+this.dir.path};app.pageOptions.enable_thumbnail&&!this.dir.encrypted&&(this.model.get("is_img")||this.model.get("is_video"))&&(r.thumbnail_url=n.getUrl({name:"thumbnail_get",repo_id:this.dir.repo_id,path:n.encodePath(n.pathJoin([this.dir.path,this.model.get("obj_name")])),size:1024}));var s=this.dirView.direntDetailsView;return s.show(r),"rw"==this.model.get("perm")&&(this.getTags=function(){e.ajax({url:n.getUrl({name:"tags",repo_id:this.dir.repo_id}),cache:!1,data:{path:n.pathJoin([this.dir.path,this.model.get("obj_name")]),is_dir:!!this.model.get("is_dir")},dataType:"json",success:function(e){s.updateTags(e)},error:function(t){var i;if(t.responseText){var n=e.parseJSON(t.responseText);i=n.error_msg||n.detail}else i=gettext("Failed. Please check the network.");s.updateTags({error_msg:i})}})},this.model.get("is_file")&&this.getTags()),this.model.get("is_dir")&&e.ajax({url:n.getUrl({name:"dir-details",repo_id:this.dir.repo_id}),cache:!1,data:{path:n.pathJoin([this.dir.path,this.model.get("obj_name")])},dataType:"json",success:function(e){s.update({dir_count:e.dir_count,file_count:e.file_count,size:n.fileSizeFormat(e.size,1)}),"rw"==t.model.get("perm")&&t.getTags()},error:function(t){var i;if(t.responseText){var n=e.parseJSON(t.responseText);i=n.error_msg||n.detail}else i=gettext("Failed. Please check the network.");s.update({error_msg:i})}}),this._hideMenu(),!1},viewFileComments:function(){var e=n.isHiDPI()?48:24;return this.dirView.fileCommentsView.show({is_repo_owner:this.dir.is_repo_owner,repo_id:this.dir.repo_id,path:n.pathJoin([this.dir.path,this.model.get("obj_name")]),icon_url:this.model.getIconUrl(e),file_name:this.model.get("obj_name")}),this._hideMenu(),!1},open_via_client:function(){return this._hideMenu(),!0}});return c}),define("app/views/dialogs/dirent-rename",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.View.extend({template:t.template(e("#dirent-rename-dialog-template").html()),initialize:function(t){this.dirent=t.dirent,this.dir=t.dir,this.dirView=t.dirView,this.imgIndex=t.imgIndex,this.render(),this.$el.modal({appendTo:"#main",focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"});var i=this.$('[name="newname"]'),n=this.dirent.get("obj_name").lastIndexOf(".");this.dirent.get("is_dir")||n==-1?i.select():(i[0].focus(),i[0].setSelectionRange(0,n)),this.$error=this.$(".error"),this.$form=this.$("form")},render:function(){var e=this.dirent.get("is_dir")?gettext("Rename Folder"):gettext("Rename File");return this.$el.html(this.template({form_title:e,dirent_name:this.dirent.get("obj_name")})),this},events:{"submit form":"formSubmit"},formSubmit:function(){var t,i=this,r=e.trim(this.$('[name="newname"]').val());if(!r)return t=gettext("It is required."),this.$error.html(t).removeClass("hide"),!1;if(r.indexOf("/")!=-1)return t=gettext("Name should not include '/'."),this.$error.html(t).removeClass("hide"),!1;if(r==this.dirent.get("obj_name"))return e.modal.close(),!1;var s=this.$('[type="submit"]');return n.disableButton(s),this.dirent.rename({newname:r,success:function(){e.modal.close(),i.dirent.get("is_img")&&i.dirView.updateMagnificPopupOptions({op:"update-item",index:i.imgIndex,model:i.dirent})},error:function(t,r,o){var a;a=t.responseText?e.parseJSON(t.responseText).error:gettext("Failed. Please check the network."),i.$error.html(a).removeClass("hide"),n.enableButton(s)}}),!1}});return r}),define("app/views/dirent-grid",["jquery","underscore","backbone","common","file-tree","app/views/share","app/views/folder-perm","app/views/dialogs/dirent-mvcp","app/views/dialogs/dirent-rename"],function(e,t,i,n,r,s,o,a,l){"use strict";app=app||{},app.globalState=app.globalState||{};var d=i.View.extend({tagName:"li",className:"grid-item",dirTemplate:t.template(e("#grid-view-dir-item-tmpl").html()),dirOpTemplate:t.template(e("#grid-view-dir-op-tmpl").html()),fileTemplate:t.template(e("#grid-view-file-item-tmpl").html()),fileOpTemplate:t.template(e("#grid-view-file-op-tmpl").html()),renameTemplate:t.template(e("#dirent-rename-dialog-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,t=this.dir,i=this.model.getPath();return e=this.model.get("is_dir")?this.dirTemplate:this.fileTemplate,this.$el.html(e({dirent:this.model.attributes,dirent_path:i,icon_url:this.model.getIconUrl(192),url:this.model.getWebUrl(),category:t.category,repo_id:t.repo_id,is_repo_owner:t.is_repo_owner,is_pro:app.pageOptions.is_pro,repo_encrypted:t.encrypted})),this.$(".file-locked-icon").attr("title",gettext("locked by {placeholder}").replace("{placeholder}",this.model.get("lock_owner_name"))),this.$el.attr("title",this.model.get("obj_name")),this.model.get("is_img")&&(this.$(".img-link, .text-link").magnificPopup(this.dirView.magnificPopupOptions),this.$el.addClass("img-grid-item")),this},events:{mouseenter:"highlight",mouseleave:"rmHighlight",click:"closeMenu","click .img-link":"viewImageWithPopup","click .text-link":"viewImageWithPopup",contextmenu:"showPopupMenu"},highlight:function(){this.$(".img-link").addClass("hl"),this.$(".text-link").addClass("hl")},rmHighlight:function(){this.$(".img-link").removeClass("hl"),this.$(".text-link").removeClass("hl")},showPopupMenu:function(i){e(".grid-item-op",this.dirView.$dirent_grid).remove();var n,r=this.dir;n=this.model.get("is_dir")?this.dirOpTemplate:this.fileOpTemplate,this.$(".img-link").addClass("hl"),this.$(".text-link").addClass("hl");var s=n({dirent:this.model.attributes,dirent_path:this.model.getPath(),download_url:this.model.getDownloadUrl(),category:r.category,repo_id:r.repo_id,is_repo_owner:r.is_repo_owner,can_generate_share_link:app.pageOptions.can_generate_share_link,can_generate_upload_link:app.pageOptions.can_generate_upload_link,is_pro:app.pageOptions.is_pro,file_audit_enabled:app.pageOptions.file_audit_enabled,repo_encrypted:r.encrypted});this.$el.append(s);var o=this.$el.offset();return this.$(".grid-item-op").css({position:"absolute",left:i.pageX-o.left,top:i.pageY-o.top}),this.$(".download-dir").on("click",t.bind(this.download,this)),this.$(".delete").on("click",t.bind(this.del,this)),this.$(".share").on("click",t.bind(this.share,this)),this.$(".mv").on("click",t.bind(this.mvcp,this)),this.$(".cp").on("click",t.bind(this.mvcp,this)),this.$(".rename").on("click",t.bind(this.rename,this)),this.$(".open-via-client").on("click",t.bind(this.open_via_client,this)),this.$(".lock-file").on("click",t.bind(this.lockFile,this)),this.$(".unlock-file").on("click",t.bind(this.unlockFile,this)),this.$(".view-details").on("click",t.bind(this.viewDetails,this)),this.$(".file-comment").on("click",t.bind(this.viewFileComments,this)),this.$(".set-folder-permission").on("click",t.bind(this.setFolderPerm,this)),!1},viewImageWithPopup:function(){if(this.model.get("is_img")){var t=e(".img-grid-item",this.dirView.$dirent_grid).index(this.$el);e.magnificPopup.open(this.dirView.magnificPopupOptions,t)}},closeMenu:function(){this.$(".grid-item-op").remove()},download:function(){this.closeMenu();var e=this.dir,t=this.model.get("obj_name");return n.zipDownload(e.repo_id,e.path,t),!1},del:function(){var t=this;if(this.model.get("is_img"))var i=e(".img-grid-item",this.dirView.$dirent_grid).index(this.$el);this.closeMenu();var r=this.model.get("obj_name");return this.model.deleteFromServer({success:function(e){var s=gettext("Successfully deleted %(name)s").replace("%(name)s",r);n.feedback(s,"success"),t.model.get("is_img")&&t.dirView.updateMagnificPopupOptions({op:"delete-item",index:i})},error:function(e){n.ajaxErrorHandler(e)}}),!1},share:function(){var e=this.dir,t=this.model.get("obj_name"),i=this.model.getPath(),n={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"),dirent_path:i,obj_name:t};return app.pageOptions.is_pro&&(n.is_admin=e.is_admin),new s(n),this.closeMenu(),!1},mvcp:function(t){var i=e(t.currentTarget).hasClass("mv")?"mv":"cp",n={dir:this.dir,dirent:this.model,op_type:i};if(this.model.get("is_img")&&"mv"==i){var r=e(".img-grid-item",this.dirView.$dirent_grid).index(this.$el);e.extend(n,{dirView:this.dirView,imgIndex:r})}return new a(n),this.closeMenu(),!1},rename:function(){this.closeMenu();var t={dir:this.dir,dirent:this.model};if(this.model.get("is_img")){var i=e(".img-grid-item",this.dirView.$dirent_grid).index(this.$el);e.extend(t,{dirView:this.dirView,imgIndex:i})}return new l(t),!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},lockFile:function(){return this.closeMenu(),this.model.lockFile({success:function(){},error:function(e){n.ajaxErrorHandler(e)}}),!1},unlockFile:function(){return this.closeMenu(),this.model.unlockFile({success:function(){},error:function(e){n.ajaxErrorHandler(e)}}),!1},viewDetails:function(){var t=this,i=n.isHiDPI()?48:24,r={repo_id:this.dir.repo_id,dir_path:this.dir.path,icon_url:this.model.getIconUrl(i),big_icon_url:this.model.getIconUrl(192),dirent:this.model.attributes,thumbnail_url:"",path:this.dir.repo_name+this.dir.path};app.pageOptions.enable_thumbnail&&!this.dir.encrypted&&(this.model.get("is_img")||this.model.get("is_video"))&&(r.thumbnail_url=n.getUrl({name:"thumbnail_get",repo_id:this.dir.repo_id,path:n.encodePath(n.pathJoin([this.dir.path,this.model.get("obj_name")])),size:1024}));var s=this.dirView.direntDetailsView;return s.show(r),"rw"==this.model.get("perm")&&(this.getTags=function(){e.ajax({url:n.getUrl({name:"tags",repo_id:this.dir.repo_id}),cache:!1,data:{path:n.pathJoin([this.dir.path,this.model.get("obj_name")]),is_dir:!!this.model.get("is_dir")},dataType:"json",success:function(e){s.updateTags(e)},error:function(t){var i;if(t.responseText){var n=e.parseJSON(t.responseText);i=n.error_msg||n.detail}else i=gettext("Failed. Please check the network.");s.updateTags({error_msg:i})}})},this.model.get("is_file")&&this.getTags()),this.model.get("is_dir")&&e.ajax({url:n.getUrl({name:"dir-details",repo_id:this.dir.repo_id}),cache:!1,data:{path:n.pathJoin([this.dir.path,this.model.get("obj_name")])},dataType:"json",success:function(e){s.update({dir_count:e.dir_count,file_count:e.file_count,size:n.fileSizeFormat(e.size,1)}),"rw"==t.model.get("perm")&&t.getTags()},error:function(t){var i;if(t.responseText){var n=e.parseJSON(t.responseText);i=n.error_msg||n.detail}else i=gettext("Failed. Please check the network.");s.update({error_msg:i})}}),this.closeMenu(),!1},viewFileComments:function(){var e=n.isHiDPI()?48:24;return this.dirView.fileCommentsView.show({is_repo_owner:this.dir.is_repo_owner,repo_id:this.dir.repo_id,path:n.pathJoin([this.dir.path,this.model.get("obj_name")]),icon_url:this.model.getIconUrl(e),file_name:this.model.get("obj_name")}),this.closeMenu(),!1},open_via_client:function(){return this.closeMenu(),!0}});return d}),define("app/views/dirent-details",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.View.extend({id:"dirent-details",className:"details-panel right-side-panel",template:t.template(e("#dirent-details-tmpl").html()),initialize:function(){e("#main").append(this.$el);var t=this;e(document).keydown(function(e){27==e.which&&t.hide()}),e(window).resize(function(){t.setConMaxHeight()})},events:{"click .js-close":"close","click .tags-edit-icon":"switchToEditTags","click .tags-submit-btn":"submitTags"},render:function(){this.$el.html(this.template(this.data));var e=this;this.$(".details-panel-img-container img").load(function(){e.showImg()}),this.$(".thumbnail").on("error",function(){e.getBigIcon()})},update:function(t){var i=this.$(".details-panel-text-info-container");e(".loading-tip",i).hide(),t.error_msg?e(".error",i).html(t.error_msg).show():(this.$(".dir-folder-counts").html(t.dir_count),this.$(".dir-file-counts").html(t.file_count),this.$(".dir-size").html(t.size),e("table",i).show())},updateTags:function(t){var i=this.$(".tags-container");if(e(".loading-icon",i).hide(),t.error_msg)e(".error",i).html(t.error_msg).show();else{for(var r=t.tags,s="",o=[],a=0,l=r.length;a<l;a++)s+='<li class="cur-tag fleft">'+n.HTMLescape(r[a].name)+"</li>",o.push({id:r[a].name,text:r[a].name});this.s2_tags=o,e(".cur-tags",i).html(s).show(),e(".tags-edit-icon",i).show()}},switchToEditTags:function(){this.$(".cur-tags, .tags-edit-icon").hide(),this.$(".tags-submit-btn").show();var e=this.$("input.tags-input"),t=this.$(".tags-input.select2-container");return t.length?(e.select2("data",this.s2_tags),t.show()):e.show().select2({tags:[],formatNoMatches:gettext("No matches")}).select2("data",this.s2_tags),!1},submitTags:function(){for(var t,i=this,r=this.$(".tags-input"),s=r.select2("val"),o=this.$(".tags-submit-btn"),a=this.$(".tags-container .error"),l=0,d=s.length;l<d;l++)if(s[l].indexOf(",")!=-1){t=gettext("Tag should not include ','.");break}return t?(a.html(t).show(),!1):(n.disableButton(o),void e.ajax({url:n.getUrl({name:"tags",repo_id:this.data.repo_id}),type:"PUT",cache:!1,dataType:"json",beforeSend:n.prepareCSRFToken,data:{path:n.pathJoin([this.data.dir_path,this.data.dirent.obj_name]),is_dir:!!this.data.dirent.is_dir,names:s.join(",")},success:function(e){for(var t=e.tags,r="",s=[],a=0,l=t.length;a<l;a++)r+='<li class="cur-tag fleft">'+n.HTMLescape(t[a].name)+"</li>",s.push({id:t[a].name,text:t[a].name});i.s2_tags=s,i.$(".tags-input").hide(),o.hide(),i.$(".cur-tags").html(r).show(),i.$(".tags-edit-icon").show()},error:function(t){var i;if(t.responseText){var n=e.parseJSON(t.responseText);i=n.error_msg||n.detail}else i=gettext("Failed. Please check the network.");a.html(i).show()},complete:function(){n.enableButton(o)}}))},setConMaxHeight:function(){this.$(".right-side-panel-con").css({height:e(window).height()-this.$(".right-side-panel-hd").outerHeight(!0)})},hide:function(){this.$el.css({right:"-320px"})},close:function(){return this.hide(),!1},show:function(e){this.data=e,this.render(),this.$el.css({right:"0px"}),this.setConMaxHeight()},showImg:function(){var t=this.$(".details-panel-img-container");e(".loading-icon",t).hide(),e("img",t).show()},getBigIcon:function(){this.$(".thumbnail").attr({src:this.data.big_icon_url,width:96}).removeClass("thumbnail")}});return r}),function(e){"use strict";var t=function(e,i){var n=/[^\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 i?n(i,t):function(e){return n(e,t)}};t.cache={},t.load=function(e){return document.getElementById(e).innerHTML},t.regexp=/([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g,t.func=function(e,t,i,n,r,s){return t?{"\n":"\\n","\r":"\\r","\t":"\\t"," ":" "}[e]||"\\"+e:i?"="===i?"'+_e("+n+")+'":"'+("+n+"||'')+'":r?"';":s?"_s+='":void 0},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);}","function"==typeof define&&define.amd?define("tmpl",[],function(){return t}):e.tmpl=t}(this),function(e){"use strict";"function"==typeof define&&define.amd?define("jquery.fileupload",["jquery","jquery.ui.widget"],e):"object"==typeof exports?e(require("jquery"),require("./vendor/jquery.ui.widget")):e(window.jQuery)}(function(e){"use strict";function t(t){var i="dragover"===t;return function(n){n.dataTransfer=n.originalEvent&&n.originalEvent.dataTransfer;var r=n.dataTransfer;r&&e.inArray("Files",r.types)!==-1&&this._trigger(t,e.Event(t,{delegatedEvent:n}))!==!1&&(n.preventDefault(),i&&(r.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:void 0,fileInput:void 0,replaceFileInput:!0,paramName:void 0,singleFileUploads:!0,limitMultiFileUploads:void 0,limitMultiFileUploadSize:void 0,limitMultiFileUploadSizeOverhead:512,sequentialUploads:!1,limitConcurrentUploads:void 0,forceIframeTransport:!1,redirect:void 0,redirectParamName:void 0,postMessage:void 0,multipart:!0,maxChunkSize:void 0,uploadedBytes:void 0,recalculateProgress:!0,progressInterval:100,bitrateInterval:500,autoUpload:!0,messages:{uploadedBytes:"Uploaded bytes exceed file size"},i18n:function(t,i){return t=this.messages[t]||t.toString(),i&&e.each(i,function(e,i){t=t.replace("{"+e+"}",i)}),t},formData:function(e){return e.serializeArray()},add:function(t,i){return!t.isDefaultPrevented()&&void((i.autoUpload||i.autoUpload!==!1&&e(this).fileupload("option","autoUpload"))&&i.process().done(function(){i.submit()}))},processData:!1,contentType:!1,cache:!1,timeout:0},_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,i){var n=e-this.timestamp;return(!this.bitrate||!i||n>i)&&(this.bitrate=(t-this.loaded)*(1e3/n)*8,this.loaded=t,this.timestamp=e),this.bitrate}},_isXHRUpload:function(t){return!t.forceIframeTransport&&(!t.multipart&&e.support.xhrFileUpload||e.support.xhrFormDataFileUpload)},_getFormData:function(t){var i;return"function"===e.type(t.formData)?t.formData(t.form):e.isArray(t.formData)?t.formData:"object"===e.type(t.formData)?(i=[],e.each(t.formData,function(e,t){i.push({name:e,value:t})}),i):[]},_getTotal:function(t){var i=0;return e.each(t,function(e,t){i+=t.size||1}),i},_initProgressObject:function(t){var i={loaded:0,total:0,bitrate:0};t._progress?e.extend(t._progress,i):t._progress=i},_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,i){if(t.lengthComputable){var n,r=Date.now?Date.now():(new Date).getTime();if(i._time&&i.progressInterval&&r-i._time<i.progressInterval&&t.loaded!==t.total)return;i._time=r,n=Math.floor(t.loaded/t.total*(i.chunkSize||i._progress.total))+(i.uploadedBytes||0),this._progress.loaded+=n-i._progress.loaded,this._progress.bitrate=this._bitrateTimer.getBitrate(r,this._progress.loaded,i.bitrateInterval),i._progress.loaded=i.loaded=n,i._progress.bitrate=i.bitrate=i._bitrateTimer.getBitrate(r,n,i.bitrateInterval),this._trigger("progress",e.Event("progress",{delegatedEvent:t}),i),this._trigger("progressall",e.Event("progressall",{delegatedEvent:t}),this._progress)}},_initProgressListener:function(t){var i=this,n=t.xhr?t.xhr():e.ajaxSettings.xhr();n.upload&&(e(n.upload).bind("progress",function(e){var n=e.originalEvent;e.lengthComputable=n.lengthComputable,e.loaded=n.loaded,e.total=n.total,i._onProgress(e,t)}),t.xhr=function(){return n})},_isInstanceOf:function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},_initXHRData:function(t){var i,n=this,r=t.files[0],s=t.multipart||!e.support.xhrFileUpload,o="array"===e.type(t.paramName)?t.paramName[0]:t.paramName;t.headers=e.extend({},t.headers),t.contentRange&&(t.headers["Content-Range"]=t.contentRange),s&&!t.blob&&this._isInstanceOf("File",r)||(t.headers["Content-Disposition"]='attachment; filename="'+encodeURI(r.name)+'"'),s?e.support.xhrFormDataFileUpload&&(t.postMessage?(i=this._getFormData(t),t.blob?i.push({name:o,value:t.blob}):e.each(t.files,function(n,r){i.push({name:"array"===e.type(t.paramName)&&t.paramName[n]||o,value:r})})):(n._isInstanceOf("FormData",t.formData)?i=t.formData:(i=new FormData,e.each(this._getFormData(t),function(e,t){i.append(t.name,t.value)})),t.blob?i.append(o,t.blob,r.name):e.each(t.files,function(r,s){(n._isInstanceOf("File",s)||n._isInstanceOf("Blob",s))&&i.append("array"===e.type(t.paramName)&&t.paramName[r]||o,s,s.uploadName||s.name)})),t.data=i):(t.contentType=r.type||"application/octet-stream",t.data=t.blob||r),t.blob=null},_initIframeSettings:function(t){var i=e("<a></a>").prop("href",t.url).prop("host");t.dataType="iframe "+(t.dataType||""),t.formData=this._getFormData(t),t.redirect&&i&&i!==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 i=e(t.fileInput),n=t.paramName;return n?e.isArray(n)||(n=[n]):(n=[],i.each(function(){for(var t=e(this),i=t.prop("name")||"files[]",r=(t.prop("files")||[1]).length;r;)n.push(i),r-=1}),n.length||(n=[i.prop("name")||"files[]"])),n},_initFormSettings:function(t){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||"string"===e.type(t.form.prop("method"))&&t.form.prop("method")||"").toUpperCase(),"POST"!==t.type&&"PUT"!==t.type&&"PATCH"!==t.type&&(t.type="POST"),t.formAcceptCharset||(t.formAcceptCharset=t.form.attr("accept-charset"))},_getAJAXSettings:function(t){var i=e.extend({},this.options,t);return this._initFormSettings(i),this._initDataSettings(i),i},_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,i,n){var r=e.Deferred(),s=r.promise();return i=i||this.options.context||s,t===!0?r.resolveWith(i,n):t===!1&&r.rejectWith(i,n),s.abort=r.promise,this._enhancePromise(s)},_addConvenienceMethods:function(t,i){var n=this,r=function(t){return e.Deferred().resolveWith(n,t).promise()};i.process=function(t,s){return(t||s)&&(i._processQueue=this._processQueue=(this._processQueue||r([this])).then(function(){return i.errorThrown?e.Deferred().rejectWith(n,[i]).promise():r(arguments)}).then(t,s)),this._processQueue||r([this])},i.submit=function(){return"pending"!==this.state()&&(i.jqXHR=this.jqXHR=n._trigger("submit",e.Event("submit",{delegatedEvent:t}),this)!==!1&&n._onSend(t,this)),this.jqXHR||n._getXHRPromise()},i.abort=function(){return this.jqXHR?this.jqXHR.abort():(this.errorThrown="abort",n._trigger("fail",null,this),n._getXHRPromise(!1))},i.state=function(){return this.jqXHR?n._getDeferredState(this.jqXHR):this._processQueue?n._getDeferredState(this._processQueue):void 0},i.processing=function(){return!this.jqXHR&&this._processQueue&&"pending"===n._getDeferredState(this._processQueue)},i.progress=function(){return this._progress},i.response=function(){return this._response}},_getUploadedBytes:function(e){var t=e.getResponseHeader("Range"),i=t&&t.split("-"),n=i&&i.length>1&&parseInt(i[1],10);return n&&n+1},_chunkedUpload:function(t,i){t.uploadedBytes=t.uploadedBytes||0;var n,r,s=this,o=t.files[0],a=o.size,l=t.uploadedBytes,d=t.maxChunkSize||a,c=this._blobSlice,h=e.Deferred(),u=h.promise();return!(!(this._isXHRUpload(t)&&c&&(l||d<a))||t.data)&&(!!i||(l>=a?(o.error=t.i18n("uploadedBytes"),this._getXHRPromise(!1,t.context,[null,"error",o.error])):(r=function(){var i=e.extend({},t),u=i._progress.loaded;i.blob=c.call(o,l,l+d,o.type),i.chunkSize=i.blob.size,i.contentRange="bytes "+l+"-"+(l+i.chunkSize-1)+"/"+a,s._initXHRData(i),s._initProgressListener(i),n=(s._trigger("chunksend",null,i)!==!1&&e.ajax(i)||s._getXHRPromise(!1,i.context)).done(function(n,o,d){l=s._getUploadedBytes(d)||l+i.chunkSize,u+i.chunkSize-i._progress.loaded&&s._onProgress(e.Event("progress",{lengthComputable:!0,loaded:l-i.uploadedBytes,total:l-i.uploadedBytes}),i),t.uploadedBytes=i.uploadedBytes=l,i.result=n,i.textStatus=o,i.jqXHR=d,s._trigger("chunkdone",null,i),s._trigger("chunkalways",null,i),l<a?r():h.resolveWith(i.context,[n,o,d])}).fail(function(e,t,n){i.jqXHR=e,i.textStatus=t,i.errorThrown=n,s._trigger("chunkfail",null,i),s._trigger("chunkalways",null,i),h.rejectWith(i.context,[e,t,n])})},this._enhancePromise(u),u.abort=function(){return n.abort()},r(),u)))},_beforeSend:function(e,t){0===this._active&&(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,i,n,r){var s=r._progress.total,o=r._response;r._progress.loaded<s&&this._onProgress(e.Event("progress",{
lengthComputable:!0,loaded:s,total:s}),r),o.result=r.result=t,o.textStatus=r.textStatus=i,o.jqXHR=r.jqXHR=n,this._trigger("done",null,r)},_onFail:function(e,t,i,n){var r=n._response;n.recalculateProgress&&(this._progress.loaded-=n._progress.loaded,this._progress.total-=n._progress.total),r.jqXHR=n.jqXHR=e,r.textStatus=n.textStatus=t,r.errorThrown=n.errorThrown=i,this._trigger("fail",null,n)},_onAlways:function(e,t,i,n){this._trigger("always",null,n)},_onSend:function(t,i){i.submit||this._addConvenienceMethods(t,i);var n,r,s,o,a=this,l=a._getAJAXSettings(i),d=function(){return a._sending+=1,l._bitrateTimer=new a._BitrateTimer,n=n||((r||a._trigger("send",e.Event("send",{delegatedEvent:t}),l)===!1)&&a._getXHRPromise(!1,l.context,r)||a._chunkedUpload(l)||e.ajax(l)).done(function(e,t,i){a._onDone(e,t,i,l)}).fail(function(e,t,i){a._onFail(e,t,i,l)}).always(function(e,t,i){if(a._onAlways(e,t,i,l),a._sending-=1,a._active-=1,l.limitConcurrentUploads&&l.limitConcurrentUploads>a._sending)for(var n=a._slots.shift();n;){if("pending"===a._getDeferredState(n)){n.resolve();break}n=a._slots.shift()}0===a._active&&a._trigger("stop")})};return this._beforeSend(t,l),this.options.sequentialUploads||this.options.limitConcurrentUploads&&this.options.limitConcurrentUploads<=this._sending?(this.options.limitConcurrentUploads>1?(s=e.Deferred(),this._slots.push(s),o=s.then(d)):(this._sequence=this._sequence.then(d,d),o=this._sequence),o.abort=function(){return r=[void 0,"abort","abort"],n?n.abort():(s&&s.rejectWith(l.context,r),d())},this._enhancePromise(o)):d()},_onAdd:function(t,i){var n,r,s,o,a=this,l=!0,d=e.extend({},this.options,i),c=i.files,h=c.length,u=d.limitMultiFileUploads,p=d.limitMultiFileUploadSize,f=d.limitMultiFileUploadSizeOverhead,m=0,g=this._getParamName(d),_=0;if(!h)return!1;if(p&&void 0===c[0].size&&(p=void 0),(d.singleFileUploads||u||p)&&this._isXHRUpload(d))if(d.singleFileUploads||p||!u)if(!d.singleFileUploads&&p)for(s=[],n=[],o=0;o<h;o+=1)m+=c[o].size+f,(o+1===h||m+c[o+1].size+f>p||u&&o+1-_>=u)&&(s.push(c.slice(_,o+1)),r=g.slice(_,o+1),r.length||(r=g),n.push(r),_=o+1,m=0);else n=g;else for(s=[],n=[],o=0;o<h;o+=u)s.push(c.slice(o,o+u)),r=g.slice(o,o+u),r.length||(r=g),n.push(r);else s=[c],n=[g];return i.originalFiles=c,e.each(s||c,function(r,o){var d=e.extend({},i);return d.files=s?o:[o],d.paramName=n[r],a._initResponseObject(d),a._initProgressObject(d),a._addConvenienceMethods(t,d),l=a._trigger("add",e.Event("add",{delegatedEvent:t}),d)}),l},_replaceFileInput:function(t){var i=t.fileInput,n=i.clone(!0),r=i.is(document.activeElement);t.fileInputClone=n,e("<form></form>").append(n)[0].reset(),i.after(n).detach(),r&&n.focus(),e.cleanData(i.unbind("remove")),this.options.fileInput=this.options.fileInput.map(function(e,t){return t===i[0]?n[0]:t}),i[0]===this.element[0]&&(this.element=n)},_handleFileTreeEntry:function(t,i){var n,r=this,s=e.Deferred(),o=function(e){e&&!e.entry&&(e.entry=t),s.resolve([e])},a=function(e){r._handleFileTreeEntries(e,i+t.name+"/").done(function(e){s.resolve(e)}).fail(o)},l=function(){n.readEntries(function(e){e.length?(d=d.concat(e),l()):a(d)},o)},d=[];return i=i||"",t.isFile?t._file?(t._file.relativePath=i,s.resolve(t._file)):t.file(function(e){e.relativePath=i,s.resolve(e)},o):t.isDirectory?(n=t.createReader(),l()):s.resolve([]),s.promise()},_handleFileTreeEntries:function(t,i){var n=this;return e.when.apply(e,e.map(t,function(e){return n._handleFileTreeEntry(e,i)})).then(function(){return Array.prototype.concat.apply([],arguments)})},_getDroppedFiles:function(t){t=t||{};var i=t.items;return i&&i.length&&(i[0].webkitGetAsEntry||i[0].getAsEntry)?this._handleFileTreeEntries(e.map(i,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 i,n,r=t.prop("webkitEntries")||t.prop("entries");if(r&&r.length)return this._handleFileTreeEntries(r);if(i=e.makeArray(t.prop("files")),i.length)void 0===i[0].name&&i[0].fileName&&e.each(i,function(e,t){t.name=t.fileName,t.size=t.fileSize});else{if(n=t.prop("value"),!n)return e.Deferred().resolve([]).promise();i=[{name:n.replace(/^.*\\/,"")}]}return e.Deferred().resolve(i).promise()},_getFileInputFiles:function(t){return t instanceof e&&1!==t.length?e.when.apply(e,e.map(t,this._getSingleFileInputFiles)).then(function(){return Array.prototype.concat.apply([],arguments)}):this._getSingleFileInputFiles(t)},_onChange:function(t){var i=this,n={fileInput:e(t.target),form:e(t.target.form)};this._getFileInputFiles(n.fileInput).always(function(r){n.files=r,i.options.replaceFileInput&&i._replaceFileInput(n),i._trigger("change",e.Event("change",{delegatedEvent:t}),n)!==!1&&i._onAdd(t,n)})},_onPaste:function(t){var i=t.originalEvent&&t.originalEvent.clipboardData&&t.originalEvent.clipboardData.items,n={files:[]};i&&i.length&&(e.each(i,function(e,t){var i=t.getAsFile&&t.getAsFile();i&&n.files.push(i)}),this._trigger("paste",e.Event("paste",{delegatedEvent:t}),n)!==!1&&this._onAdd(t,n))},_onDrop:function(t){t.dataTransfer=t.originalEvent&&t.originalEvent.dataTransfer;var i=this,n=t.dataTransfer,r={};n&&n.files&&n.files.length&&(t.preventDefault(),this._getDroppedFiles(n).always(function(n){r.files=n,i._trigger("drop",e.Event("drop",{delegatedEvent:t}),r)!==!1&&i._onAdd(t,r)}))},_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,i){var n=e.inArray(t,this._specialOptions)!==-1;n&&this._destroyEventHandlers(),this._super(t,i),n&&(this._initSpecialOptions(),this._initEventHandlers())},_initSpecialOptions:function(){var t=this.options;void 0===t.fileInput?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("/"),i=t.pop();return t.shift(),new RegExp(t.join("/"),i)},_isRegExpOption:function(t,i){return"url"!==t&&"string"===e.type(i)&&/^\/.*\/[igm]{0,3}$/.test(i)},_initDataAttributes:function(){var t=this,i=this.options,n=this.element.data();e.each(this.element[0].attributes,function(e,r){var s,o=r.name.toLowerCase();/^data-/.test(o)&&(o=o.slice(5).replace(/-[a-z]/g,function(e){return e.charAt(1).toUpperCase()}),s=n[o],t._isRegExpOption(o,s)&&(s=t._getRegExp(s)),i[o]=s)})},_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 i=this;t&&!this.options.disabled&&(t.fileInput&&!t.files?this._getFileInputFiles(t.fileInput).always(function(e){t.files=e,i._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 i,n,r=this,s=e.Deferred(),o=s.promise();return o.abort=function(){return n=!0,i?i.abort():(s.reject(null,"abort","abort"),o)},this._getFileInputFiles(t.fileInput).always(function(e){if(!n){if(!e.length)return void s.reject();t.files=e,i=r._onSend(null,t),i.then(function(e,t,i){s.resolve(e,t,i)},function(e,t,i){s.reject(e,t,i)})}}),this._enhancePromise(o)}if(t.files=e.makeArray(t.files),t.files.length)return this._onSend(null,t)}return this._getXHRPromise(!1,t&&t.context)}})}),function(e){"use strict";"function"==typeof define&&define.amd?define("jquery.fileupload-process",["jquery","./jquery.fileupload"],e):e("object"==typeof exports?require("jquery"):window.jQuery)}(function(e){"use strict";var t=e.blueimp.fileupload.prototype.options.add;e.widget("blueimp.fileupload",e.blueimp.fileupload,{options:{processQueue:[],add:function(i,n){var r=e(this);n.process(function(){return r.fileupload("process",n)}),t.call(this,i,n)}},processActions:{},_processFile:function(t,i){var n=this,r=e.Deferred().resolveWith(n,[t]),s=r.promise();return this._trigger("process",null,t),e.each(t.processQueue,function(t,r){var o=function(t){return i.errorThrown?e.Deferred().rejectWith(n,[i]).promise():n.processActions[r.action].call(n,t,r)};s=s.then(o,r.always&&o)}),s.done(function(){n._trigger("processdone",null,t),n._trigger("processalways",null,t)}).fail(function(){n._trigger("processfail",null,t),n._trigger("processalways",null,t)}),s},_transformProcessQueue:function(t){var i=[];e.each(t.processQueue,function(){var n={},r=this.action,s=this.prefix===!0?r:this.prefix;e.each(this,function(i,r){"string"===e.type(r)&&"@"===r.charAt(0)?n[i]=t[r.slice(1)||(s?s+i.charAt(0).toUpperCase()+i.slice(1):i)]:n[i]=r}),i.push(n)}),t.processQueue=i},processing:function(){return this._processing},process:function(t){var i=this,n=e.extend({},this.options,t);return n.processQueue&&n.processQueue.length&&(this._transformProcessQueue(n),0===this._processing&&this._trigger("processstart"),e.each(t.files,function(r){var s=r?e.extend({},n):n,o=function(){return t.errorThrown?e.Deferred().rejectWith(i,[t]).promise():i._processFile(s,t)};s.index=r,i._processing+=1,i._processingQueue=i._processingQueue.then(o,o).always(function(){i._processing-=1,0===i._processing&&i._trigger("processstop")})})),this._processingQueue},_create:function(){this._super(),this._processing=0,this._processingQueue=e.Deferred().resolveWith(this).promise()}})}),function(e){"use strict";"function"==typeof define&&define.amd?define("jquery.fileupload-validate",["jquery","./jquery.fileupload-process"],e):e("object"==typeof exports?require("jquery"):window.jQuery)}(function(e){"use strict";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,i){if(i.disabled)return t;var n,r=e.Deferred(),s=this.options,o=t.files[t.index];return(i.minFileSize||i.maxFileSize)&&(n=o.size),"number"===e.type(i.maxNumberOfFiles)&&(s.getNumberOfFiles()||0)+t.files.length>i.maxNumberOfFiles?o.error=s.i18n("maxNumberOfFiles"):!i.acceptFileTypes||i.acceptFileTypes.test(o.type)||i.acceptFileTypes.test(o.name)?n>i.maxFileSize?o.error=s.i18n("maxFileSize"):"number"===e.type(n)&&n<i.minFileSize?o.error=s.i18n("minFileSize"):delete o.error:o.error=s.i18n("acceptFileTypes"),o.error||t.files.error?(t.files.error=!0,r.rejectWith(this,[t])):r.resolveWith(this,[t]),r.promise()}}})}),function(e){"use strict";"function"==typeof define&&define.amd?define("jquery.fileupload-ui",["jquery","tmpl","./jquery.fileupload-validate"],e):"object"==typeof exports?e(require("jquery"),require("tmpl")):e(window.jQuery,window.tmpl)}(function(e,t){"use strict";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:void 0,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,i){if(t.isDefaultPrevented())return!1;var n=e(this),r=n.data("blueimp-fileupload")||n.data("fileupload"),s=r.options;i.context=r._renderUpload(i.files).data("data",i).addClass("processing"),s.filesContainer[s.prependFiles?"prepend":"append"](i.context),r._forceReflow(i.context),r._transition(i.context),i.process(function(){return n.fileupload("process",i)}).always(function(){i.context.each(function(t){e(this).find(".size").text(r._formatFileSize(i.files[t].size))}).removeClass("processing"),r._renderPreviews(i)}).done(function(){i.context.find(".start").prop("disabled",!1),r._trigger("added",t,i)!==!1&&(s.autoUpload||i.autoUpload)&&i.autoUpload!==!1&&i.submit()}).fail(function(){i.files.error&&i.context.each(function(t){var n=i.files[t].error;n&&e(this).find(".error").text(n)})})},send:function(t,i){if(t.isDefaultPrevented())return!1;var n=e(this).data("blueimp-fileupload")||e(this).data("fileupload");return i.context&&i.dataType&&"iframe"===i.dataType.substr(0,6)&&i.context.find(".progress").addClass(!e.support.transition&&"progress-animated").attr("aria-valuenow",100).children().first().css("width","100%"),n._trigger("sent",t,i)},done:function(t,i){if(t.isDefaultPrevented())return!1;var n,r,s=e(this).data("blueimp-fileupload")||e(this).data("fileupload"),o=i.getFilesFromResponse||s.options.getFilesFromResponse,a=o(i);i.context?i.context.each(function(o){var l=a[o]||{error:"Empty file upload result"};r=s._addFinishedDeferreds(),s._transition(e(this)).done(function(){var o=e(this);n=s._renderDownload([l]).replaceAll(o),s._forceReflow(n),s._transition(n).done(function(){i.context=e(this),s._trigger("completed",t,i),s._trigger("finished",t,i),r.resolve()})})}):(n=s._renderDownload(a)[s.options.prependFiles?"prependTo":"appendTo"](s.options.filesContainer),s._forceReflow(n),r=s._addFinishedDeferreds(),s._transition(n).done(function(){i.context=e(this),s._trigger("completed",t,i),s._trigger("finished",t,i),r.resolve()}))},fail:function(t,i){if(t.isDefaultPrevented())return!1;var n,r,s=e(this).data("blueimp-fileupload")||e(this).data("fileupload");i.context?i.context.each(function(o){if("abort"!==i.errorThrown){var a=i.files[o];a.error=a.error||i.errorThrown||i.i18n("unknownError"),r=s._addFinishedDeferreds(),s._transition(e(this)).done(function(){var o=e(this);n=s._renderDownload([a]).replaceAll(o),s._forceReflow(n),s._transition(n).done(function(){i.context=e(this),s._trigger("failed",t,i),s._trigger("finished",t,i),r.resolve()})})}else r=s._addFinishedDeferreds(),s._transition(e(this)).done(function(){e(this).remove(),s._trigger("failed",t,i),s._trigger("finished",t,i),r.resolve()})}):"abort"!==i.errorThrown?(i.context=s._renderUpload(i.files)[s.options.prependFiles?"prependTo":"appendTo"](s.options.filesContainer).data("data",i),s._forceReflow(i.context),r=s._addFinishedDeferreds(),s._transition(i.context).done(function(){i.context=e(this),s._trigger("failed",t,i),s._trigger("finished",t,i),r.resolve()})):(s._trigger("failed",t,i),s._trigger("finished",t,i),s._addFinishedDeferreds().resolve())},progress:function(t,i){if(t.isDefaultPrevented())return!1;var n=Math.floor(i.loaded/i.total*100);i.context&&i.context.each(function(){e(this).find(".progress").attr("aria-valuenow",n).children().first().css("width",n+"%")})},progressall:function(t,i){if(t.isDefaultPrevented())return!1;var n=e(this),r=Math.floor(i.loaded/i.total*100),s=n.find(".fileupload-progress"),o=s.find(".progress-extended");o.length&&o.html((n.data("blueimp-fileupload")||n.data("fileupload"))._renderExtendedProgress(i)),s.find(".progress").attr("aria-valuenow",r).children().first().css("width",r+"%")},start:function(t){if(t.isDefaultPrevented())return!1;var i=e(this).data("blueimp-fileupload")||e(this).data("fileupload");i._resetFinishedDeferreds(),i._transition(e(this).find(".fileupload-progress")).done(function(){i._trigger("started",t)})},stop:function(t){if(t.isDefaultPrevented())return!1;var i=e(this).data("blueimp-fileupload")||e(this).data("fileupload"),n=i._addFinishedDeferreds();e.when.apply(e,i._getFinishedDeferreds()).done(function(){i._trigger("stopped",t)}),i._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;"),n.resolve()})},processstart:function(t){return!t.isDefaultPrevented()&&void e(this).addClass("fileupload-processing")},processstop:function(t){return!t.isDefaultPrevented()&&void e(this).removeClass("fileupload-processing")},destroy:function(t,i){if(t.isDefaultPrevented())return!1;var n=e(this).data("blueimp-fileupload")||e(this).data("fileupload"),r=function(){n._transition(i.context).done(function(){e(this).remove(),n._trigger("destroyed",t,i)})};i.url?(i.dataType=i.dataType||n.options.dataType,e.ajax(i).done(r).fail(function(){n._trigger("destroyfailed",t,i)})):r()}},_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),i=t.prop("href"),n=t.prop("download"),r="application/octet-stream";t.bind("dragstart",function(e){try{e.originalEvent.dataTransfer.setData("DownloadURL",[r,n,i].join(":"))}catch(e){}})},_formatFileSize:function(e){return"number"!=typeof e?"":e>=1e9?(e/1e9).toFixed(2)+" GB":e>=1e6?(e/1e6).toFixed(2)+" MB":(e/1e3).toFixed(2)+" KB"},_formatBitrate:function(e){return"number"!=typeof e?"":e>=1e9?(e/1e9).toFixed(2)+" Gbit/s":e>=1e6?(e/1e6).toFixed(2)+" Mbit/s":e>=1e3?(e/1e3).toFixed(2)+" kbit/s":e.toFixed(2)+" bit/s"},_formatTime:function(e){var t=new Date(1e3*e),i=Math.floor(e/86400);return i=i?i+"d ":"",i+("0"+t.getUTCHours()).slice(-2)+":"+("0"+t.getUTCMinutes()).slice(-2)+":"+("0"+t.getUTCSeconds()).slice(-2)},_formatPercentage:function(e){return(100*e).toFixed(2)+" %"},_renderExtendedProgress:function(e){return this._formatBitrate(e.bitrate)+" | "+this._formatTime(8*(e.total-e.loaded)/e.bitrate)+" | "+this._formatPercentage(e.loaded/e.total)+" | "+this._formatFileSize(e.loaded)+" / "+this._formatFileSize(e.total)},_renderTemplate:function(t,i){if(!t)return e();var n=t({files:i,formatFileSize:this._formatFileSize,options:this.options});return n instanceof e?n:e(this.options.templatesContainer).html(n).children()},_renderPreviews:function(t){t.context.find(".preview").each(function(i,n){e(n).append(t.files[i].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 i=e(t.currentTarget),n=i.closest(".template-upload"),r=n.data("data");i.prop("disabled",!0),r&&r.submit&&r.submit()},_cancelHandler:function(t){t.preventDefault();var i=e(t.currentTarget).closest(".template-upload,.template-download"),n=i.data("data")||{};n.context=n.context||i,n.abort?n.abort():(n.errorThrown="abort",this._trigger("fail",t,n))},_deleteHandler:function(t){t.preventDefault();var i=e(t.currentTarget);this._trigger("destroy",t,e.extend({context:i.closest(".template-download"),type:"DELETE"},i.data()))},_forceReflow:function(t){return e.support.transition&&t.length&&t[0].offsetWidth},_transition:function(t){var i=e.Deferred();return e.support.transition&&t.hasClass("fade")&&t.is(":visible")?t.bind(e.support.transition.end,function(n){n.target===t[0]&&(t.unbind(e.support.transition.end),i.resolveWith(t))}).toggleClass("in"):(t.toggleClass("in"),i.resolveWith(t)),i},_initButtonBarEventHandlers:function(){var t=this.element.find(".fileupload-buttonbar"),i=this.options.filesContainer;this._on(t.find(".start"),{click:function(e){e.preventDefault(),i.find(".start").click()}}),this._on(t.find(".cancel"),{click:function(e){e.preventDefault(),i.find(".cancel").click()}}),this._on(t.find(".delete"),{click:function(e){e.preventDefault(),i.find(".toggle:checked").closest(".template-download").find(".delete").click(),t.find(".toggle").prop("checked",!1)}}),this._on(t.find(".toggle"),{change:function(t){i.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;void 0===t.filesContainer?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,i){window.locale={fileupload:{errors:{maxFileSize:gettext("File is too big"),minFileSize:gettext("File is too small"),acceptFileTypes:gettext("Filetype not allowed"),maxNumberOfFiles:gettext("Maximum 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 n=t.View.extend({el:$("#upload-file-dialog"),fileupdateConfirmTemplate:_.template($("#fileupdate-confirm-template").html()),initialize:function(t){var i=this.dirView=t.dirView,n=i.dir,r=this.$el.addClass("fixed-upload-file-dialog");this.popup_height="200px";var s=$(".status",r),o=$(".total-progress",r),a=$(".fileupload-buttonbar .cancel",r),l=$(".sf-close",r),d=$(".saving-tip",r),c={uploading:gettext("File Uploading..."),complete:gettext("File Upload complete"),canceled:gettext("File Upload canceled"),failed:gettext("File Upload failed")},h=[],u=[],p=app.pageOptions.enable_upload_folder,f=app.pageOptions.enable_resumable_fileupload,m=[],g=[],_=function(e){var t;return"number"!=typeof e?"":(t=e/8,t>=1e9?(t/1e9).toFixed(2)+" GB/s":t>=1e6?(t/1e6).toFixed(2)+" MB/s":t>=1e3?(t/1e3).toFixed(2)+" kB/s":t.toFixed(2)+" B/s")},v=this;r.fileupload({paramName:"file",getFilesFromResponse:function(e){if(e.result)return e.result},autoUpload:!0,maxNumberOfFiles:app.pageOptions.max_number_of_files_for_fileupload,sequentialUploads:!0}).bind("fileuploadadd",function(e,t){if(!i.$el.is(":visible"))return!1;if(n.user_perm&&"rw"!=n.user_perm)return!1;r.removeClass("hide"),a.removeClass("hide"),l.addClass("hide"),r.height(parseInt(v.popup_height)),$(".fileupload-buttonbar, table",r).removeClass("hide");var s=n.path;if(r.fileupload("option",{formData:{parent_dir:"/"==s?s:s+"/"},maxChunkSize:void 0,uploadedBytes:void 0}),p){var o=i.$("#upload-menu");o.hasClass("hide")||o.addClass("hide");var d=t.files[0];return"."==d.name?void t.files.shift():void(t.fileInput?d.webkitRelativePath&&(d.relative_path=d.webkitRelativePath):d.relativePath&&(d.relative_path=d.relativePath+d.name))}}).bind("fileuploadstart",function(){s.html(c.uploading)}).bind("fileuploadsubmit",function(t,i){if(0==i.files.length)return!1;var s=i.files[0];if(s.error)return!1;var o=function(){var t,o;n.is_system_library?(t=e.getUrl({name:"admin-system-library-upload-link",repo_id:n.repo_id}),o={from:"web",path:n.path}):(t=e.getUrl({name:"repo_upload_link",repo_id:n.repo_id}),o={from:"web",p:n.path}),$.ajax({url:t,data:o,cache:!1,dataType:"json",success:function(t){if(n.is_system_library&&(t=t.upload_link),p&&s.relative_path){var o=s.relative_path,a=o.substring(0,o.lastIndexOf("/")+1),l=r.fileupload("option","formData");l.relative_path=a,r.fileupload("option",{formData:l}),i.url=t,i.jqXHR=r.fileupload("send",i)}else{var d=1048576;f&&s.size&&s.size>d?(r.fileupload("option","maxChunkSize",d),$.ajax({url:e.getUrl({name:"repo_file_uploaded_bytes",repo_id:n.repo_id}),data:{parent_dir:n.path,file_name:s.name},cache:!1,dataType:"json",success:function(e){r.fileupload("option","uploadedBytes",e.uploadedBytes),i.url=t,i.jqXHR=r.fileupload("send",i)}})):(i.url=t,i.jqXHR=r.fileupload("send",i))}},error:function(){s.error=gettext("Failed to get upload url")}})};if(s.relative_path||i.originalFiles.length>1)return o(),!1;var a=function(){$.ajax({url:e.getUrl({name:"repo_update_link",repo_id:n.repo_id}),data:{from:"web",p:n.path},cache:!1,dataType:"json",success:function(e){var t=r.fileupload("option","formData");t.target_file=t.parent_dir+s.name,r.fileupload("option","formData",t),s.to_update=!0,i.url=e,i.jqXHR=r.fileupload("send",i)},error:function(){s.error=gettext("Failed to get update url")}})},l=n.where({is_file:!0}),d=[];if($(l).each(function(){d.push(this.get("obj_name"))}),n.is_system_library||d.indexOf(s.name)==-1)o();else{var c=gettext("Replace file {filename}?").replace("{filename}",'<span class="op-target">'+e.HTMLescape(s.name)+"</span>"),h=$(v.fileupdateConfirmTemplate({title:c}));h.modal({onClose:function(){$.modal.close(),s.choose_to_update?a():s.choose_to_upload?o():(i.jqXHR=r.fileupload("send",i),i.jqXHR.abort())}}),$("#simplemodal-container").css({width:"auto",height:"auto"}),$(".yes",h).click(function(){var t=n.findWhere({obj_name:s.name});t.get("is_locked")?t.get("locked_by_me")?(s.choose_to_update=!0,$.modal.close()):($(".error",h).html(gettext("File is locked")).removeClass("hide"),e.disableButton($(this))):(s.choose_to_update=!0,$.modal.close())}),$(".no",h).click(function(){s.choose_to_upload=!0,$.modal.close()})}return!1}).bind("fileuploadprogressall",function(e,t){o.html(parseInt(t.loaded/t.total*100,10)+'% <span style="font-size:14px;color:#555;">('+_(t.bitrate)+")</span>").removeClass("hide"),t.loaded>0&&t.loaded==t.total&&d.show()}).bind("fileuploaddone",function(e,t){if("success"==t.textStatus){var i=t.files[0],r=i.relative_path,s=t.result[0];s.uploaded=!0,r&&(s.relative_path=r.substring(0,r.lastIndexOf("/")+1)+s.name);var o=n.path;if(o="/"==o?o:o+"/",t.formData.parent_dir==o){if(!r)return void(i.to_update?u.push(s):h.push(s));if(p){var a=r.substring(0,r.indexOf("/")),l=n.where({is_dir:!0,obj_name:a});l.length>0?g.indexOf(a)==-1&&g.push(a):m.indexOf(a)==-1&&m.push(a)}}}}).bind("fileuploadstop",function(){a.addClass("hide"),l.removeClass("hide");var t=n.path;if(t="/"==t?t:t+"/",r.fileupload("option","formData").parent_dir==t){var s=parseInt((new Date).getTime()/1e3);h.length>0&&($(h).each(function(t,r){var o=n.add({is_file:!0,is_img:e.imageCheck(r.name),obj_name:r.name,last_modified:s,file_size:e.fileSizeFormat(r.size,1),obj_id:r.id,file_icon:"file.png",perm:"rw",last_update:gettext("Just now"),starred:!1},{silent:!0});i.addNewFile(o)}),h=[]),m.length>0&&($(m).each(function(e,r){var o=n.add({is_dir:!0,obj_name:r,perm:"rw",last_modified:s,last_update:gettext("Just now"),p_dpath:t+r},{silent:!0});i.addNewDir(o)}),m=[]),g.length>0&&($(g).each(function(e,t){var i=n.where({is_dir:!0,obj_name:t});i[0].set({last_modified:s,last_update:gettext("Just now")})}),g=[]),u.length>0&&($(u).each(function(t,i){var r=n.where({is_file:!0,obj_name:i.name});r[0].set({obj_id:i.id,file_size:e.fileSizeFormat(i.size,1),last_modified:s,last_update:gettext("Just now")})}),u=[])}}).bind("fileuploadfail",function(e,t){var i=t.files[0];!i.error&&t.jqXHR&&t.jqXHR.responseJSON&&t.jqXHR.responseJSON.error&&(i.error=t.jqXHR.responseJSON.error)}).bind("fileuploadcompleted",function(){0==$(".files .cancel",r).length&&(d.hide(),o.addClass("hide"),s.html(c.complete))}).bind("fileuploadfailed",function(e,t){0==$(".files .cancel",r).length&&(a.addClass("hide"),l.removeClass("hide"),o.addClass("hide"),d.hide(),"abort"==t.errorThrown?s.html(c.canceled):s.html(c.failed))});var y=app.pageOptions.max_upload_file_size;y&&r.fileupload("option","maxFileSize",y),r.fileupload("option","redirect",window.location.href.replace(/\/repo\/[-a-z0-9]{36}\/.*/,app.config.mediaUrl+"cors/result.html?%s"))},events:{"click .fold-switch":"foldAndUnfoldPopup","click .sf-close":"closePopup"},foldAndUnfoldPopup:function(){var e=this.$el,t=parseInt(this.popup_height),i=$(".fileupload-buttonbar, table",e);e.height()==t?(e.height($(".hd",e).outerHeight(!0)),i.addClass("hide")):(e.height(t),i.removeClass("hide"))},closePopup:function(){var e=this.$el;e.addClass("hide"),$(".files",e).empty()}});return n}),define("app/collections/file-comments",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Collection.extend({url:function(){return i.getUrl({name:"file-comments",repo_id:this.repo_id})},parse:function(e){return e.comments},setData:function(e){this.repo_id=e}});return n}),define("app/views/file-comment",["jquery","underscore","backbone","common","marked","moment"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({tagName:"li",className:"msg ovhd",template:t.template(e("#file-comment-tmpl").html()),initialize:function(e){this.listenTo(this.model,"destroy",this.remove),this.is_repo_owner=e.is_repo_owner,this.parentView=e.parentView},events:{mouseenter:"highlight",mouseleave:"rmHighlight","click .js-del-msg":"delMsg","click .js-reply-msg":"reply"},highlight:function(){this.$el.addClass("hl"),this.$(".msg-ops").removeClass("vh")},rmHighlight:function(){this.$el.removeClass("hl"),this.$(".msg-ops").addClass("vh")},delMsg:function(){return this.model.destroy({wait:!0,success:function(){},error:function(t,i){var r;r=i.responseText?e.parseJSON(i.responseText).error_msg:gettext("Failed. Please check the network."),n.feedback(r,"error")}}),!1},reply:function(){return this.parentView.replyTo(this.model.get("user_name")),!1},render:function(){var t=this.model.get("user_email"),i=!1;(this.is_repo_owner||t==app.pageOptions.username)&&(i=!0);var o=n.getUrl({name:"user_profile",username:encodeURIComponent(t)}),a=this.model.attributes,l=s(a.created_at),d=e.extend({},a,{content_marked:r(a.comment,{breaks:!0,sanitize:!0}),time:l.format("LLLL"),time_from_now:n.getRelativeTimeStr(l),can_delete_msg:i,user_profile_url:o});return this.$el.html(this.template(d)),this}});return o}),define("app/views/file-comments",["jquery","underscore","backbone","common","app/collections/file-comments","app/views/file-comment"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({id:"file-comments",className:"right-side-panel",template:t.template(e("#file-comment-panel-tmpl").html()),initialize:function(){e("#main").append(this.$el),this.collection=new r,this.listenTo(this.collection,"add",this.addOne),this.listenTo(this.collection,"reset",this.reset);var t=this;e(document).keydown(function(e){27==e.which&&t.hide()}),e(window).resize(function(){
t.setConHeight()})},events:{"click .js-close":"close","submit .msg-form":"formSubmit"},close:function(){return this.hide(),!1},render:function(t){this.$el.html(this.template(t)),this.$listContainer=e(".file-discussion-list",this.$el),this.$emptyTip=e(".no-discussion-tip",this.$el),this.$loadingTip=e(".loading-tip",this.$el),this.$conError=e(".file-discussions-con .error",this.$el),this.$msgInput=e('[name="message"]',this.$el)},show:function(e){this.is_repo_owner=e.is_repo_owner,this.repo_id=e.repo_id,this.path=e.path,this.collection.setData(this.repo_id),this.render({icon_url:e.icon_url,file_name:e.file_name}),this.$el.css({right:0}),this.setConHeight(),this.getContent()},hide:function(){this.$el.css({right:"-400px"}),this.$el.empty()},reset:function(){this.$conError.hide(),this.$loadingTip.hide(),this.$listContainer.empty(),this.collection.length?(this.$emptyTip.hide(),this.collection.each(this.addOne,this),this.$listContainer.show(),this.scrollConToBottom()):(this.$emptyTip.show(),this.$listContainer.hide())},getContent:function(){var t=this;this.collection.fetch({cache:!1,data:{p:this.path,avatar_size:64},reset:!0,success:function(){},error:function(i,n,r){t.$loadingTip.hide();var s;s=n.responseText?401==n.status||403==n.status?gettext("Permission error"):e.parseJSON(n.responseText).error_msg:gettext("Please check the network."),t.$conError.html(s).show()}})},formSubmit:function(){var t=this,i=e(".msg-form .error",this.$el),r=e('[type="submit"]',this.$el),s=e.trim(this.$msgInput.val());return!!s&&(i.hide(),n.disableButton(r),e.ajax({url:n.getUrl({name:"file-comments",repo_id:this.repo_id})+"?p="+encodeURIComponent(this.path)+"&avatar_size=64",type:"POST",cache:!1,dataType:"json",beforeSend:n.prepareCSRFToken,data:{comment:s},success:function(e){t.$msgInput.val(""),t.collection.add(e),t.$emptyTip.is(":visible")&&(t.$emptyTip.hide(),t.$listContainer.show()),t.scrollConToBottom()},error:function(t){var n;n=t.responseText?e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),i.html(n).show()},complete:function(){n.enableButton(r)}}),!1)},addOne:function(e){var t=new s({model:e,is_repo_owner:this.is_repo_owner,parentView:this});this.$listContainer.append(t.render().el)},setConHeight:function(){e(".file-discussions-con",this.$el).css({"max-height":e(window).height()-this.$el.offset().top-e(".file-discussions-hd",this.$el).outerHeight(!0)-e(".file-discussions-footer",this.$el).outerHeight(!0)})},scrollConToBottom:function(){var e=this.$(".file-discussions-con");e.scrollTop(e[0].scrollHeight-e[0].clientHeight)},replyTo:function(e){var t="@"+e+" ",i=this.$msgInput.val(t);n.setCaretPos(i[0],t.length),i.focus()}});return o}),define("app/views/dir",["jquery","jquery.ui.progressbar","jquery.magnific-popup","simplemodal","underscore","backbone","common","file-tree","js.cookie","app/collections/dirents","app/views/dirent","app/views/dirent-grid","app/views/dirent-details","app/views/fileupload","app/views/share","app/views/file-comments","app/views/widgets/dropdown"],function(e,t,i,n,r,s,o,a,l,d,c,h,u,p,f,m,g){"use strict";var _=s.View.extend({id:"dir-view",template:r.template(e("#dir-view-tmpl").html()),path_bar_template:r.template(e("#dir-path-bar-tmpl").html()),dir_op_bar_template:r.template(e("#dir-op-bar-tmpl").html()),dirents_hd_template:r.template(e("#dirents-hd-tmpl").html()),dirents_hd_mobile_template:r.template(e("#dirents-hd-mobile-tmpl").html()),top_search_form_template:r.template(e("#top-search-form-tmpl").html()),newDirTemplate:r.template(e("#add-new-dir-form-template").html()),newFileTemplate:r.template(e("#add-new-file-form-template").html()),mvcpTemplate:r.template(e("#mvcp-form-template").html()),mvProgressTemplate:r.template(e("#mv-progress-popup-template").html()),initialize:function(t){var i=l.get("view_mode");"grid"==i?this.view_mode="grid":this.view_mode="list",this.contextOptions={},this.magnificPopupOptions={type:"image",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=o.HTMLescape(e.data.name),i='<a href="'+e.data.url+'" target="_blank">'+gettext("Open in New Tab")+"</a>";return t+"<br />"+i},tError:gettext('<a href="%url%" target="_blank">The image</a> could not be loaded.')}},this.dir=new d,this.listenTo(this.dir,"add",this.addOne),this.listenTo(this.dir,"reset",this.reset),this.fileUploadView=new p({dirView:this}),this.direntDetailsView=new u,this.fileCommentsView=new m,this.render();var n=this;e(window).scroll(function(){e(n.el).is(":visible")&&n.onWindowScroll()}),e(window).resize(function(){n.updateDirOpBarUI()}),e(document).click(function(t){var i=t.target||event.srcElement,n=e("#rename-form");if(n.length&&!n.find("*").is(i)){n.closest("tr");e(".cancel",n).click()}}),e(document).click(function(t){var i=t.target||event.srcElement,n=e(".grid-item-op");!(n.length>0)||n.is(i)||n.find("*").is(i)||n.closest(".grid-item").is(i)||n.closest(".grid-item").find("*").is(i)||n.remove()})},render:function(){this.$el.html(this.template()),this.attached=!1,this.$dirent_list=this.$(".repo-file-list"),this.$dirent_grid=this.$(".grid-view"),this.$dirent_list_body=this.$(".repo-file-list tbody"),this.$loading_tip=this.$(".loading-tip"),this.$error=this.$(".error"),this.$el_con=this.$(".repo-file-list-topbar, .js-dir-content"),this.$path_bar=this.$(".path-bar"),this.$dir_op_bar=this.$(".repo-op")},showDir:function(t,i,n,r){e("#top-search-form").html(this.top_search_form_template({search_repo_id:i})),this.contextOptions=r,this.attached||(this.attached=!0,e("#right-panel").html(this.$el)),this.dir.setPath(t,i,n),this.dir.dirent_more=!1,this.renderDir()},hide:function(){e("#top-search-form").html(this.top_search_form_template({search_repo_id:""})),this.$el.detach(),this.attached=!1,this.direntDetailsView.hide(),this.fileCommentsView.hide(),this.fileUploadView.closePopup()},addOne:function(e){var t;"list"==this.view_mode?(t=new c({model:e,dirView:this}),this.$dirent_list_body.append(t.render().el)):(t=new h({model:e,dirView:this}),this.$dirent_grid.append(t.render().el))},reset:function(){this.direntDetailsView.hide(),this.fileCommentsView.hide(),this.renderPath(),this.renderDirOpBar(),this.$el_con.show(),this.setFileInput(),this.$(".js-dir-content").removeAttr("style"),"list"==this.view_mode&&this.renderDirentsHd(),this.$dirent_grid.empty(),this.$dirent_list_body.empty(),"list"==this.view_mode?(this.$dirent_list.show(),this.$dirent_grid.hide()):(this.$dirent_list.hide(),this.$dirent_grid.show()),o.updateSortIconByMode({context:this.$el}),this.sortDirents(),this.dir.last_start=0,this.dir.limit=100,this.render_dirents_slice(this.dir.last_start,this.dir.limit),this.updateDirOpBarUI(),this.getThumbnail()},updateDirOpBarUI:function(){var t;e(window).width()>500?(t=this.$(".repo-op").width()-parseInt(this.$(".repo-op-misc").css("margin-left"))-5,t-=e("#multi-dirents-op").is(":visible")?e("#multi-dirents-op").width():e("#cur-dir-ops").width(),this.$(".repo-op-misc").css({width:t})):this.$(".repo-op-misc").removeAttr("style")},updateMagnificPopupOptions:function(t){var i=this.dir.repo_id,n=this.dir.path,r=!0;app.pageOptions.enable_thumbnail&&!this.dir.encrypted||(r=!1);var s=function(t){var s,a=t.get("obj_name"),l=o.pathJoin([n,a]),d={repo_id:i,path:o.encodePath(l)},c=a.substr(a.lastIndexOf(".")+1).toLowerCase(),h="gif"==c;s=r&&!h?o.getUrl(e.extend(d,{name:"thumbnail_get",size:app.pageOptions.thumbnail_size_for_original})):o.getUrl(e.extend(d,{name:"view_raw_file"}));var u={name:a,url:t.getWebUrl(),src:s};return u},a=this,l=function(){var t=a.dir.where({is_img:!0}),i=[];e(t).each(function(e,t){var n=s(t);i.push(n)}),a.magnificPopupOptions.items=i},d=function(e){var t=s(e);a.magnificPopupOptions.items.unshift(t)},c=function(e,t){var i=s(t);a.magnificPopupOptions.items[e]=i},h=function(e){a.magnificPopupOptions.items.splice(e,1)},u=t?t.op:"get-items";switch(u){case"get-items":l();break;case"add-new-item":d(t.model);break;case"update-item":c(t.index,t.model);break;case"delete-item":h(t.index)}},setFileInput:function(){var t=this.dir;if(t.user_perm&&"rw"==t.user_perm&&!t.no_quota){var i=this.fileUploadView.$el;app.pageOptions.enable_upload_folder?"webkitdirectory"in e("#basic-upload-input")[0]?(this.$("#basic-upload").remove(),this.$("#advanced-upload").show(),this.upload_dropdown=new g({el:this.$("#advanced-upload")}),i.fileupload("option",{fileInput:this.$('#advanced-upload input[type="file"]'),replaceFileInput:navigator.userAgent.indexOf("Firefox")==-1})):(this.$("#advanced-upload").remove(),i.fileupload("option","fileInput",this.$("#basic-upload-input"))):i.fileupload("option","fileInput",this.$("#basic-upload-input"))}},getThumbnail: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("is_video"))&&!e.get("encoded_thumbnail_src")});if(0!=t.length){var i=t.length,n=this.dir.repo_id,r=this.dir.path,s=this,a=app.pageOptions.thumbnail_default_size;"grid"==this.view_mode&&(a=app.pageOptions.thumbnail_size_for_grid);var l=function(d){var c=t[d],h=o.pathJoin([r,c.get("obj_name")]);e.ajax({url:o.getUrl({name:"thumbnail_create",repo_id:n}),data:{path:h,size:a},cache:!1,dataType:"json",success:function(e){c.set({encoded_thumbnail_src:e.encoded_thumbnail_src})},complete:function(){d<i-1&&s.dir.repo_id==n&&s.dir.path==r&&l(++d)}})};l(0)}},_showLibDecryptDialog:function(){var t=this,i=e(e("#repo-decrypt-form-template").html()),n=!1;i.modal({containerCss:{padding:"1px"},onClose:function(){e.modal.close(),t.$el_con.show(),n||app.router.navigate(t.dir.category+"/",{trigger:!0})}}),e("#simplemodal-container").css({height:"auto"}),i.submit(function(){var r=e.trim(e('[name="password"]',i).val());return r?(o.ajaxPost({form:i,form_id:i.attr("id"),post_url:o.getUrl({name:"api_v2.1_repo_set_password",repo_id:t.dir.repo_id}),post_data:{password:r},after_op_success:function(){n=!0,e.modal.close(),t.renderDir()}}),!1):(e(".error",i).html(gettext("Password is required.")).removeClass("hide"),!1)})},renderDir:function(){this.$loading_tip.show(),this.$error.hide(),this.$el_con.hide();var e=this,t=app.pageOptions.thumbnail_default_size;"grid"==this.view_mode&&(t=app.pageOptions.thumbnail_size_for_grid);var i=this.dir;i.fetch({cache:!1,reset:!0,data:{p:i.path,thumbnail_size:t},success:function(){e.$loading_tip.hide()},error:function(t,i,n){e.$loading_tip.hide(),e.$el_con.hide();var r;if(i.responseText){if(i.responseJSON.lib_need_decrypt)return void e._showLibDecryptDialog();r=i.responseJSON.error}else r=gettext("Please check the network.");e.$error.html(r).show()}})},renderPath:function(){var t=this.dir,i=t.path,n="my",r=t.category.split("/")[0];"org"==r?n="org":"group"==r?n="group":"common"==r&&(n="common");var s={path:i,repo_name:t.repo_name,category:t.category,context:n};e.extend(s,this.contextOptions);var a=i.substr(1).split("/"),l=o.encodePath(i.substr(1)).split("/");"/"!=i&&e.extend(s,{path_list:a,path_list_encoded:l,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,no_quota:t.no_quota,encrypted:t.encrypted,mode:this.view_mode,path:t.path,repo_id:t.repo_id,site_root:app.pageOptions.site_root,is_repo_owner:t.is_repo_owner,can_generate_share_link:app.pageOptions.can_generate_share_link,can_generate_upload_link:app.pageOptions.can_generate_upload_link,enable_upload_folder:app.pageOptions.enable_upload_folder}))).removeAttr("style"),"rw"==t.user_perm&&(this.new_dropdown=new g({el:this.$("#add-new")}))},renderDirentsHd:function(){var t=e(window).width()<768?this.dirents_hd_mobile_template:this.dirents_hd_template;this.$("thead").html(t())},render_dirents_slice:function(e,t){var i=this.dir;r.each(i.slice(e,e+t),this.addOne,this),i.length>e+t?(i.dirent_more=!0,i.last_start=e+t):i.dirent_more=!1},events:{"click #add-new li a":"closeNewDropdown","click #add-new-dir":"newDir","click #add-new-file":"newCommonFile","click #add-new-md-file":"newMdFile","click #add-new-excel-file":"newExcelFile","click #add-new-ppt-file":"newPPTFile","click #add-new-word-file":"newWordFile","click #share-cur-dir":"share","click #js-switch-grid-view":"switchToGridView","click #js-switch-list-view":"switchToListView","click th.select":"select","click #mv-dirents":"mv","click #cp-dirents":"cp","click #del-dirents":"del","click #download-dirents":"download","click .by-name":"sortByName","click .by-time":"sortByTime","click .basic-upload-btn":"uploadFile","click .advanced-upload-file":"advancedUploadFile","click .advanced-upload-folder":"advancedUploadFolder"},uploadFile:function(){this.$("#basic-upload-input").trigger("click")},advancedUploadFile:function(){return this.$("#advanced-upload-file-input").trigger("click"),!1},advancedUploadFolder:function(){return this.$("#advanced-upload-folder-input").trigger("click"),!1},closeNewDropdown:function(){this.new_dropdown.hide()},newDir:function(){var t=e(this.newDirTemplate()),i=t.attr("id"),n=this.dir,r=this;return 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(i,gettext("It is required.")),!1;if(s.indexOf("/")!=-1)return o.showFormError(i,gettext("Name should not include '/'.")),!1;var a={operation:"mkdir"},l=o.getUrl({name:"new_dir",repo_id:n.repo_id})+"?p="+encodeURIComponent(o.pathJoin([n.path,s])),d=function(t){e.modal.close();var i=n.add({is_dir:!0,obj_name:t.obj_name,perm:"rw",last_modified:(new Date).getTime()/1e3,last_update:gettext("Just now"),p_dpath:o.pathJoin([n.path,t.obj_name])},{silent:!0});r.addNewDir(i)};return o.ajaxPost({form:t,post_url:l,post_data:a,after_op_success:d,form_id:i}),!1}),!1},newFile:function(t){var i=e(this.newFileTemplate(t)),n=i.attr("id"),r=e('input[name="name"]',i),s=this.dir,a=this;i.modal({appendTo:"#main",focus:!1,containerCss:{padding:"20px 25px"}}),e("#simplemodal-container").css({height:"auto"}),o.setCaretPos(r[0],0),r.focus(),i.submit(function(){var t=e.trim(r.val());if(!t)return o.showFormError(n,gettext("It is required.")),!1;if(t.indexOf("/")!=-1)return o.showFormError(n,gettext("Name should not include '/'.")),!1;if(t.lastIndexOf(".")!=-1&&0==t.substr(0,t.lastIndexOf(".")).length)return o.showFormError(n,gettext("Only an extension there, please input a name.")),!1;var l={operation:"create"},d=o.getUrl({name:"new_file",repo_id:s.repo_id})+"?p="+encodeURIComponent(o.pathJoin([s.path,t])),c=function(t){e.modal.close();var i=s.add({is_file:!0,is_img:o.imageCheck(t.obj_name),obj_name:t.obj_name,file_size:o.fileSizeFormat(t.size),obj_id:t.obj_id,file_icon:"file.png",starred:!1,perm:"rw",last_modified:(new Date).getTime()/1e3,last_update:gettext("Just now")},{silent:!0});a.addNewFile(i)};return o.ajaxPost({form:i,post_url:d,post_data:l,after_op_success:c,form_id:n}),!1})},newCommonFile:function(){return this.newFile({title:gettext("New File"),initial_file_name:""}),!1},newMdFile:function(){return this.newFile({title:gettext("New Markdown File"),initial_file_name:".md"}),!1},newExcelFile:function(){return this.newFile({title:gettext("New Excel File"),initial_file_name:".xlsx"}),!1},newPPTFile:function(){return this.newFile({title:gettext("New PowerPoint File"),initial_file_name:".pptx"}),!1},newWordFile:function(){return this.newFile({title:gettext("New Word File"),initial_file_name:".docx"}),!1},addNewFile:function(t){var i=this,n=this.dir;if("list"==this.view_mode){var r=new c({model:t,dirView:i}),s=r.render().el;if(0==e("tr",i.$dirent_list_body).length)i.$dirent_list_body.append(s);else{var o=n.where({is_dir:!0});0==o.length?i.$dirent_list_body.prepend(s):e(e("tr",i.$dirent_list_body)[o.length-1]).after(s)}}else{var a=new h({model:t,dirView:i}),l=a.render().el;if(0==e(".grid-item",i.$dirent_grid).length)i.$dirent_grid.append(l);else{var o=n.where({is_dir:!0});0==o.length?i.$dirent_grid.prepend(l):e(e(".grid-item",i.$dirent_grid)[o.length-1]).after(l)}}t.get("is_img")&&this.updateMagnificPopupOptions({op:"add-new-item",model:t})},addNewDir:function(e){var t=this;if("list"==this.view_mode){var i=new c({model:e,dirView:t});t.$dirent_list_body.prepend(i.render().el)}else{var n=new h({model:e,dirView:t});t.$dirent_grid.prepend(n.render().el)}},share:function(){var e=this.dir,t=e.path,i={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)};app.pageOptions.is_pro&&(i.is_admin=e.is_admin),new f(i)},switchToGridView:function(){return"grid"!=this.view_mode&&(this.view_mode="grid",l.set("view_mode","grid"),this.renderDir(),!1)},switchToListView:function(){return"list"!=this.view_mode&&(this.view_mode="list",l.set("view_mode","list"),this.renderDir(),!1)},sortDirents:function(){var e=app.pageOptions.sort_mode;switch(e){case"name_up":this.dir.comparator=function(e,t){if(e.get("is_dir")&&t.get("is_file"))return-1;if(e.get("is_file")&&t.get("is_dir"))return 1;var i=o.compareTwoWord(e.get("obj_name"),t.get("obj_name"));return i};break;case"name_down":this.dir.comparator=function(e,t){if(e.get("is_dir")&&t.get("is_file"))return-1;if(e.get("is_file")&&t.get("is_dir"))return 1;var i=o.compareTwoWord(e.get("obj_name"),t.get("obj_name"));return-i};break;case"time_up":this.dir.comparator=function(e,t){return e.get("is_dir")&&t.get("is_file")?-1:e.get("is_file")&&t.get("is_dir")?1:e.get("last_modified")<t.get("last_modified")?-1:1};break;case"time_down":this.dir.comparator=function(e,t){return e.get("is_dir")&&t.get("is_file")?-1:e.get("is_file")&&t.get("is_dir")?1:e.get("last_modified")<t.get("last_modified")?1:-1}}this.dir.sort(),this.updateMagnificPopupOptions()},sortByName:function(){return o.toggleSortByNameMode(),o.updateSortIconByMode({context:this.$el}),this.sortDirents(),this.$dirent_list_body.empty(),this.render_dirents_slice(0,this.dir.limit),this.dir.comparator=null,!1},sortByTime:function(){return o.toggleSortByTimeMode(),o.updateSortIconByMode({context:this.$el}),this.sortDirents(),this.$dirent_list_body.empty(),this.render_dirents_slice(0,this.dir.limit),this.dir.comparator=null,!1},select:function(){var e=this.$("th [type=checkbox]"),t=this.dir,i=this.$("[type=checkbox]"),n=this.$("#multi-dirents-op"),r=this.$("#cur-dir-ops");e.prop("checked")?(i.prop("checked",!0),t.each(function(e){e.set({selected:!0},{silent:!0})}),n.css({display:"inline-block"}),r.hide()):(i.prop("checked",!1),t.each(function(e){e.set({selected:!1},{silent:!0})}),n.hide(),r.show()),this.updateDirOpBarUI()},download:function(){var t=this.dir,i=t.where({selected:!0}),n=[];return 1==i.length&&i[0].get("is_file")?void(location.href=i[0].getDownloadUrl()):(e(i).each(function(){n.push(this.get("obj_name"))}),void o.zipDownload(t.repo_id,t.path,n))},del:function(){var t=this.dir,i=this,n=function(){e("#confirm-popup").append('<p style="color:red;">'+gettext("Processing...")+"</p>");var n=t.where({selected:!0}),r=[];e(n).each(function(){r.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:r},success:function(s){var a,l,d=s.deleted.length,c=s.undeleted.length;d>0&&(d==r.length?(t.remove(n),i.$("th [type=checkbox]").prop("checked",!1),i.$("#multi-dirents-op").hide(),i.$("#cur-dir-ops").show(),i.updateDirOpBarUI()):e(n).each(function(){s.deleted.indexOf(this.get("obj_name"))!=-1&&t.remove(this)}),a=1==d?gettext("Successfully deleted %(name)s."):2==d?gettext("Successfully deleted %(name)s and 1 other item."):gettext("Successfully deleted %(name)s and %(amount)s other items."),a=a.replace("%(name)s",s.deleted[0]).replace("%(amount)s",d-1),o.feedback(a,"success"),i.updateMagnificPopupOptions()),c>0&&(l=1==c?gettext("Failed to delete %(name)s."):2==c?gettext("Failed to delete %(name)s and 1 other item."):gettext("Failed to delete %(name)s and %(amount)s other items."),l=l.replace("%(name)s",s.undeleted[0]).replace("%(amount)s",c-1),o.feedback(l,"error")),e.modal.close()},error:function(t,i,n){e.modal.close(),o.ajaxErrorHandler(t,i,n)}})};o.showConfirm(gettext("Delete Items"),gettext("Are you sure you want to delete these selected items?"),n)},mv:function(){this.mvcp({op:"mv"})},cp:function(){this.mvcp({op:"cp"})},mvcp:function(t){var i=this.dir,n=t.op,r="mv"==n?gettext("Move selected item(s) to:"):gettext("Copy selected item(s) to:"),s=!0;"r"==i.user_perm&&(s=!1);var l=e(this.mvcpTemplate({form_title:r,op_type:n,obj_type:"",obj_name:"",show_cur_repo:s,show_other_repos:!i.encrypted}));l.modal({appendTo:"#main",autoResize:!0,focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"}),s&&a.renderTreeForPath({$form:l,$container:e("#current-repo-dirs"),repo_name:i.repo_name,repo_id:i.repo_id,path:i.path}),i.encrypted||a.prepareOtherReposTree({cur_repo_id:i.repo_id});var d=this,c=this.dir,h=c.where({is_dir:!0,selected:!0}),u=c.where({is_file:!0,selected:!0}),p=[],f=[];e(h).each(function(){p.push(this.get("obj_name"))}),e(u).each(function(){f.push(this.get("obj_name"))}),l.submit(function(){var t=e('[name="dst_repo"]',l).val(),i=e('[name="dst_path"]',l).val(),r=c.path,s={repo_id:c.repo_id};if(!e.trim(t)||!e.trim(i))return e(".error",l).removeClass("hide"),!1;if(t==c.repo_id&&i==r)return e(".error",l).html(gettext("Invalid destination path")).removeClass("hide"),!1;if(o.disableButton(e('[type="submit"]',l)),l.append('<p style="color:red;">'+gettext("Processing...")+"</p>"),t==c.repo_id)s.name="mv"==n?"mv_dirents":"cp_dirents",e.ajax({url:o.getUrl(s)+"?parent_dir="+encodeURIComponent(r),type:"POST",dataType:"json",beforeSend:o.prepareCSRFToken,traditional:!0,data:{file_names:f,dir_names:p,dst_repo:t,dst_path:i},success:function(t){var i,r,s=t.success.length;t.url;e.modal.close(),s>0&&("mv"==n?(s==u.length+h.length?(c.remove(h),c.remove(u),d.$("th .checkbox").removeClass("checkbox-checked"),d.$("#multi-dirents-op").hide(),d.$("#cur-dir-ops").show(),d.updateDirOpBarUI()):(e(h).each(function(){t.success.indexOf(this.get("obj_name"))!=-1&&c.remove(this)}),e(u).each(function(){t.success.indexOf(this.get("obj_name"))!=-1&&c.remove(this)})),i=1==s?gettext("Successfully moved %(name)s."):2==s?gettext("Successfully moved %(name)s and 1 other item."):gettext("Successfully moved %(name)s and %(amount)s other items."),d.updateMagnificPopupOptions()):i=1==s?gettext("Successfully copied %(name)s."):2==s?gettext("Successfully copied %(name)s and 1 other item."):gettext("Successfully copied %(name)s and %(amount)s other items."),i=i.replace("%(name)s",t.success[0]).replace("%(amount)s",s-1),o.feedback(i,"success")),t.failed.length>0&&(r="mv"==n?t.failed.length>1?gettext("Internal error. Failed to move %(name)s and %(amount)s other item(s)."):gettext("Internal error. Failed to move %(name)s."):t.failed.length>1?gettext("Internal error. Failed to copy %(name)s and %(amount)s other item(s)."):gettext("Internal error. Failed to copy %(name)s."),r=r.replace("%(name)s",t.failed[0]).replace("%(amount)s",t.failed.length-1),o.feedback(r,"error"))},error:function(t,i,n){e.modal.close(),o.ajaxErrorHandler(t,i,n)}});else{var a,m=c.where({selected:!0}),g=0,_=0,v=e(d.mvProgressTemplate()),y=e("#mv-details",v),w=e("#cancel-mv",v),b=e("#mv-other-info",v),T=function(){var s,d,h=m[g],u=h.get("is_dir")?"dir":"file",p=h.get("obj_name");s=o.getUrl({name:"copy_move_task"}),d={src_repo_id:c.repo_id,src_parent_dir:r,src_dirent_name:p,dst_repo_id:t,dst_parent_dir:i,operation:"mv"==n?"move":"copy",dirent_type:u};var f=function(t){var i="mv"==n?gettext("Moving file %(index)s of %(total)s"):gettext("Copying file %(index)s of %(total)s");y.html(i.replace("%(index)s",g+1).replace("%(total)s",m.length)).removeClass("vh"),w.removeClass("hide");var r=function(){var i=t.task_id;w.data("task_id",i),e.ajax({url:o.getUrl({name:"query_copy_move_progress"})+"?task_id="+encodeURIComponent(i),dataType:"json",success:function(t){var i=e(".ui-progressbar-value",e("#mv-progress"));if(t.failed||t.canceled||t.successful){if(t.successful)i.css("width",parseInt((g+1)/m.length*100,10)+"%").show(),"mv"==n&&c.remove(h),_+=1,1==_&&(a=p),x();else if(t.failed){var s="mv"==n?gettext("Failed to move %(name)s"):gettext("Failed to copy %(name)s");w.after('<p class="error">'+s.replace("%(name)s",o.HTMLescape(p))+"</p>"),S()}}else setTimeout(r,1e3)},error:function(t,i,n){var r;r=t.responseText?e.parseJSON(t.responseText).error:gettext("Failed. Please check the network."),w.after('<p class="error">'+r+"</p>"),S()}})};0==g?(e.modal.close(),setTimeout(function(){v.modal({containerCss:{width:300,height:150,paddingTop:50},focus:!1}),e("#mv-progress").progressbar(),r()},100)):r()};e.ajax({url:s,type:"POST",dataType:"json",beforeSend:o.prepareCSRFToken,data:d,success:f,error:function(t){var i;i=t.responseText?e.parseJSON(t.responseText).error||e.parseJSON(t.responseText).error_msg:gettext("Failed. Please check the network."),l.is(":visible")?e(".error",l).html(i).show():(w.after('<p class="error">'+i+"</p>"),w.hide())}})},x=function(){if(g==m.length-1){if(setTimeout(function(){e.modal.close()},500),"mv"==n&&d.updateMagnificPopupOptions(),_>0){var t;t="mv"==n?1==_?gettext("Successfully moved %(name)s."):2==_?gettext("Successfully moved %(name)s and 1 other item."):gettext("Successfully moved %(name)s and %(amount)s other items."):1==_?gettext("Successfully copied %(name)s."):2==_?gettext("Successfully copied %(name)s and 1 other item."):gettext("Successfully copied %(name)s and %(amount)s other items."),t=t.replace("%(name)s",a).replace("%(amount)s",_-1),setTimeout(function(){o.feedback(t,"success")},600)}}else T(++g)},S=function(){setTimeout(function(){e.modal.close()},500),"mv"==n&&d.updateMagnificPopupOptions()};T(),w.click(function(){o.disableButton(w);var t=e(this).data("task_id");e.ajax({url:o.getUrl({name:"copy_move_task"}),type:"DELETE",dataType:"json",beforeSend:o.prepareCSRFToken,data:{task_id:t},success:function(e){b.html(gettext("Canceled.")).removeClass("hide"),w.addClass("hide"),S()},error:function(t,i,n){var r;r=t.responseText?e.parseJSON(t.responseText).error:gettext("Failed. Please check the network."),b.html(r).removeClass("hide"),o.enableButton(w)}})})}return!1})},onWindowScroll:function(){this.dir.dirent_more&&e(window).scrollTop()+e(window).height()==e(document).height()&&(this.render_dirents_slice(this.dir.last_start,this.dir.limit),this.getThumbnail());var t=this.$dir_op_bar,i=this.$path_bar,n=this.$(".js-dir-content"),r=i.offset().top+i.outerHeight(!0),s={position:"fixed",top:0,left:i.offset().left,"background-color":e("#header").css("background-color"),"z-index":12};r&&(e(window).scrollTop()>=r?(n.css({"margin-top":t.outerHeight(!0)}),t.outerWidth(this.$el.width()).css(s)):(n.css({"margin-top":0}),t.removeAttr("style")))}});return _}),define("app/views/starred-file-item",["jquery","underscore","backbone","common","app/views/widgets/hl-item-view"],function(e,t,i,n,r){"use strict";var s=r.extend({tagName:"tr",template:t.template(e("#starred-file-item-tmpl").html()),mobileTemplate:t.template(e("#starred-file-item-mobile-tmpl").html()),events:{"click .unstar":"removeShare"},initialize:function(){r.prototype.initialize.call(this),this.listenTo(this.model,"change",this.render)},render:function(){var t=this.model.toJSON(),i=n.isHiDPI()?48:24;t.file_icon_url=n.getFileIconUrl(t.file_name,i),t.is_img=n.imageCheck(t.file_name),t.encoded_path=n.encodePath(t.path),t.encoded_thumbnail_src=this.model.get("encoded_thumbnail_src")||"";var r=e(window).width()>=768?this.template:this.mobileTemplate;if(this.$el.html(r(t)),t.is_img){var s=this.model.get("file_name"),o=s.substr(s.lastIndexOf(".")+1).toLowerCase(),a="gif"==o;app.pageOptions.enable_thumbnail&&!a&&this.$(".img-name-link").attr("data-mfp-src",n.getUrl({name:"thumbnail_get",repo_id:t.repo_id,size:app.pageOptions.thumbnail_size_for_original,path:t.encoded_path}))}return this},removeShare:function(){var t=this,i=this.model.get("repo_id"),r=this.model.get("file_name"),s=this.model.get("path");return e.ajax({url:n.getUrl({name:"starred_files"})+"?p="+encodeURIComponent(s)+"&repo_id="+encodeURIComponent(i),type:"DELETE",beforeSend:n.prepareCSRFToken,success:function(){t.remove(),n.feedback(gettext("Successfully unstared {placeholder}").replace("{placeholder}",r),"success")},error:function(e){n.ajaxErrorHandler(e)}}),!1}});return s}),define("app/models/starred-file",["underscore","backbone"],function(e,t){"use strict";var i=t.Model.extend({});return i}),define("app/collections/starred-files",["underscore","backbone","common","app/models/starred-file"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,url:function(){return i.getUrl({name:"starred_files"})}});return r}),define("app/views/starred-file",["jquery","underscore","backbone","common","jquery.magnific-popup","app/views/starred-file-item","app/collections/starred-files"],function(e,t,i,n,r,s,o){"use strict";var a=i.View.extend({id:"starred-file",template:t.template(e("#starred-file-tmpl").html()),theadTemplate:t.template(e("#starred-file-thead-tmpl").html()),initialize:function(){this.starredFiles=new o,this.listenTo(this.starredFiles,"reset",this.reset),this.render()},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.length?(this.$emptyTip.hide(),this.renderThead(),this.starredFiles.each(this.addOne,this),this.$table.show(),this.getThumbnail()):(this.$emptyTip.show(),this.$table.hide())},getThumbnail:function(){if(!app.pageOptions.enable_thumbnail)return!1;var t=this.starredFiles.filter(function(e){return n.imageCheck(e.get("file_name"))||n.videoCheck(e.get("file_name"))});if(0!=t.length){var i=t.length,r=app.pageOptions.thumbnail_default_size,s=function(o){var a=t[o];e.ajax({url:n.getUrl({name:"thumbnail_create",repo_id:a.get("repo_id")}),data:{path:a.get("path"),size:r},cache:!1,dataType:"json",success:function(e){a.set({encoded_thumbnail_src:e.encoded_thumbnail_src})},complete:function(){o<i-1&&s(++o)}})};s(0)}},showStarredFiles:function(){this.$table.hide(),this.$loadingTip.show(),this.starredFiles.fetch({reset:!0})},render:function(){this.$el.html(this.template()),this.$table=this.$("table"),this.$tableBody=this.$("tbody"),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips"),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,i=t[0].innerHTML,n='<a href="'+t.attr("href")+'" target="_blank">'+gettext("Open in New Tab")+"</a>";return i+"<br />"+n},tError:gettext('<a href="%url%" target="_blank">The image</a> could not be loaded.')}})},renderThead:function(){this.$("thead").html(this.theadTemplate())},show:function(){e("#right-panel").html(this.$el),this.showStarredFiles()},hide:function(){this.$el.detach()}});return a}),define("app/models/activity",["underscore","backbone"],function(e,t){"use strict";var i=t.Model.extend({});return i}),define("app/collections/activities",["underscore","backbone","common","app/models/activity"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,url:function(){return i.getUrl({name:"events"})}});return r}),define("app/views/details",["jquery","underscore","backbone","common"],function(e,t,i,n){"use strict";var r=i.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;n.ajaxGet({get_url:n.getUrl({name:"get_history_changes",repo_id:this.repo_id}),data:{commit_id:this.cmmt_id},after_op_success:function(i){t.$(".loading-tip").hide(),t.$(".commit-time").html(i.date_time);var r=function(e){t.$el.append(t.detailItemTemplate({details_title:e.title,details:e.content}))};i.new.length>0&&r({title:gettext("New files"),content:i.new}),i.removed.length>0&&r({title:gettext("Deleted files"),content:i.removed}),i.renamed.length>0&&r({title:gettext("Renamed or Moved files"),content:i.renamed}),i.modified.length>0&&r({title:gettext("Modified files"),content:i.modified}),i.newdir.length>0&&r({title:gettext("New directories"),content:i.newdir}),i.deldir.length>0&&r({title:gettext("Deleted directories"),content:i.deldir}),i.cmt_desc&&t.$el.append("<p>"+n.HTMLescape(i.cmt_desc)+"</p>"),e(window).resize()},after_op_error:function(i){var n;n=i.responseText?e.parseJSON(i.responseText).error:gettext("Failed. Please check the network."),t.$el.html('<p class="error">'+n+"</p>"),setTimeout(function(){e.modal.close()},2500)}})}});return r}),define("app/views/activity-item",["jquery","underscore","backbone","common","app/views/details"],function(e,t,i,n,r){"use strict";var s=i.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 r(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,i,n,r,s){"use strict";var o=i.View.extend({id:"activities",template:t.template(e("#activities-tmpl").html()),activityGroupHdTemplate:t.template(e("#activity-group-hd-tmpl").html()),activityGroupBdTemplate:t.template(e("#activity-group-bd-tmpl").html()),initialize:function(){this.activities=new r,this.moreOffset=0,this.render()},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.renderActivities()}})},renderActivities:function(){var i=this.activities.toJSON(),n=i.length,r=i[n-1].more,o=[];this.$loadingTip.hide(),this.$activitiesMore.hide(),this.moreOffset=i[n-1].more_offset,this.$activitiesBody.empty().show();for(var a=0;a<n;a++)o=o.concat(i[a].events);var l,d,c=t.groupBy(o,"date");for(var h in c)l=e(this.activityGroupHdTemplate({date:h})),d=e(this.activityGroupBdTemplate()),t.each(c[h],function(e){var t=new s(e);d.append(t.render().el)}),this.$activitiesBody.append(l).append(d);r&&this.$activitiesMore.show()},showActivities:function(){this.$activitiesBody.hide(),this.$activitiesMore.hide(),this.$loadingTip.show();var e=this;this.activities.fetch({data:{start:0},success:function(){e.renderActivities()}})},render:function(){this.$el.html(this.template()),this.$activitiesBody=this.$("#activities-body"),this.$activitiesMore=this.$("#activities-more"),this.$loadingTip=this.$(".loading-tip")},show:function(){e("#right-panel").html(this.$el),this.showActivities()},hide:function(){this.$el.detach()}});return o}),define("app/views/device",["jquery","underscore","backbone","common","moment","app/views/widgets/hl-item-view"],function(e,t,i,n,r,s){"use strict";var o=s.extend({tagName:"tr",template:t.template(e("#device-item-tmpl").html()),events:{"click .unlink-device":"unlinkDeviceWithConfirm"},initialize:function(){s.prototype.initialize.call(this)},render:function(){var e=this.model.toJSON(),t=r(e.last_accessed);return e.time=t.format("LLLL"),e.time_from_now=n.getRelativeTimeStr(t),this.$el.html(this.template(e)),this},unlinkDeviceWithConfirm:function(){var t=this,i=this.model.get("is_desktop_client"),r=this.model.get("device_name");if(!i)return t.model.unlink({wipe_device:!0,success:function(){t.remove();var e=gettext("Successfully unlink %(name)s.").replace("%(name)s",r);n.feedback(e,"success")},error:function(e){n.ajaxErrorHandler(e)}}),!1;var s=gettext("Unlink device"),o=gettext("Are you sure you want to unlink this device?"),a=gettext("Delete files from this device the next time it comes online."),l=function(i){return t.model.unlink({wipe_device:i,success:function(){t.remove();var e=gettext("Successfully unlink %(name)s.").replace("%(name)s",r);n.feedback(e,"success")},error:function(e){n.ajaxErrorHandler(e)},complete:function(){e.modal.close()}}),!1};n.showConfirmWithExtraOption(s,o,a,l)}});return o}),define("app/models/device",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Model.extend({unlink:function(e){var t={platform:this.get("platform"),device_id:this.get("device_id")};e.wipe_device&&(t.wipe_device="true"),$.ajax({url:i.getUrl({name:"devices"}),type:"DELETE",dataType:"json",beforeSend:i.prepareCSRFToken,data:t,success:function(){e.success&&e.success()},error:function(t){e.error&&e.error(t)},complete:function(t){e.complete&&e.complete(t)}})}});return n}),define("app/collections/devices",["underscore","backbone","common","app/models/device"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,url:function(){return i.getUrl({name:"devices"})}});return r}),define("app/views/devices",["jquery","underscore","backbone","common","app/views/device","app/collections/devices"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({id:"devices",template:t.template(e("#devices-tmpl").html()),initialize:function(){this.devices=new s,this.listenTo(this.devices,"reset",this.reset),this.render()},addOne:function(e){var t=new r({model:e});this.$tableBody.append(t.render().el)},reset:function(){this.$tableBody.empty(),this.$loadingTip.hide(),this.devices.each(this.addOne,this),this.devices.length?(this.$emptyTip.hide(),this.$table.show()):(this.$emptyTip.show(),this.$table.hide())},render:function(){return this.$el.html(this.template()),this.$table=this.$("table"),this.$tableBody=this.$("tbody"),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips"),this},show:function(){e("#right-panel").html(this.$el),this.devices.fetch({reset:!0})},hide:function(){this.$el.detach()}});return o}),define("app/views/invitation",["jquery","underscore","backbone","common","moment","app/views/widgets/hl-item-view"],function(e,t,i,n,r,s){"use strict";var o=s.extend({tagName:"tr",template:t.template(e("#invitation-item-tmpl").html()),initialize:function(){s.prototype.initialize.call(this)},events:{"click .rm-invitation":"removeInvitation"},removeInvitation:function(){var t=this;return e.ajax({url:n.getUrl({name:"invitation",token:this.model.get("token")}),type:"DELETE",cache:!1,beforeSend:n.prepareCSRFToken,success:function(){t.remove(),n.feedback(gettext("Successfully deleted 1 item."),"success")},error:function(e){n.ajaxErrorHandler(e)}}),!1},render:function(){var e=this.model.toJSON(),t=r(e.invite_time),i=r(e.expire_time);return e.invite_time_format=t.format("LLLL"),e.expire_time_format=i.format("LLLL"),e.invite_time_from_now=t.format("YYYY-MM-DD"),e.expire_time_from_now=i.format("YYYY-MM-DD"),this.$el.html(this.template(e)),this}});return o}),define("app/models/invitation",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Model.extend({});return n}),define("app/collections/invitations",["underscore","backbone","common","app/models/invitation"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,url:function(){return i.getUrl({name:"invitations"})}});return r}),define("app/views/invitations",["jquery","underscore","backbone","common","app/views/invitation","app/collections/invitations"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({id:"invitations",template:t.template(e("#invitations-tmpl").html()),inviteFormTemplate:t.template(e("#invitation-form-tmpl").html()),initialize:function(){this.collection=new s,this.listenTo(this.collection,"add",this.addOne),this.listenTo(this.collection,"reset",this.reset),this.render()},render:function(){this.$el.html(this.template()),this.$loadingTip=this.$(".loading-tip"),this.$table=this.$("table"),this.$tableBody=e("tbody",this.$table),this.$emptyTip=this.$(".empty-tips"),this.$error=this.$(".error")},events:{"click #invite-people":"invitePeople"},invitePeople:function(){var t=this,i=e(this.inviteFormTemplate());i.attr("id");i.modal({appendTo:"#main"}),e("#simplemodal-container").css({height:"auto"}),i.submit(function(){var r,s=e.trim(e('input[name="accepter"]',i).val()),o=[],a=e(".error",i),l=e('[type="submit"]',i),d=e(".loading-icon",i);if(!s)return a.html(gettext("It is required.")).show(),!1;s=s.split(",");for(var c=0,h=s.length;c<h;c++)r=e.trim(s[c]),r&&o.push(r);return!!o.length&&(a.hide(),n.disableButton(l),d.show(),e.ajax({url:n.getUrl({name:"invitations_batch"}),type:"POST",cache:!1,data:{type:"guest",accepter:o},traditional:!0,beforeSend:n.prepareCSRFToken,success:function(i){var r=[];if(i.success.length){var s;t.collection.add(i.success,{prepend:!0}),t.collection.length==i.success.length&&t.reset(),s=1==i.success.length?gettext("Successfully invited %(email).").replace("%(email)",i.success[0].accepter):gettext("Successfully invited %(email) and %(num) other people.").replace("%(email)",i.success[0].accepter).replace("%(num)",i.success.length-1),r.push({msg:s,type:"success"})}i.failed.length&&e(i.failed).each(function(e,t){var i=t.email+": "+t.error_msg;r.push({msg:i,type:"error"})}),r.length&&n.feedback(r),e.modal.close()},error:function(e){var t;t=e.responseText?e.responseJSON.error_msg||e.responseJSON.detail:gettext("Please check the network."),a.html(t).show(),n.enableButton(l)},complete:function(){d.hide()}}),!1)})},addOne:function(e,t,i){var n=new r({model:e});i.prepend?this.$tableBody.prepend(n.render().el):this.$tableBody.append(n.render().el)},initPage:function(){this.$loadingTip.show(),this.$table.hide(),this.$tableBody.empty(),this.$emptyTip.hide(),this.$error.hide()},reset:function(){this.$error.hide(),this.collection.length?(this.$tableBody.empty(),this.collection.each(this.addOne,this),this.$emptyTip.hide(),this.$table.show()):(this.$emptyTip.show(),this.$table.hide())},show:function(){this.attached||(this.attached=!0,e("#right-panel").html(this.$el)),this.showContent()},showContent:function(){var t=this;this.initPage(),this.collection.fetch({cache:!1,reset:!0,error:function(i,n,r){var s;s=n.responseText?401==n.status||403==n.status?gettext("Permission error"):e.parseJSON(n.responseText).error_msg:gettext("Failed. Please check the network."),t.$error.html(s).show()},complete:function(){t.$loadingTip.hide()}})},hide:function(){this.$el.detach(),this.attached=!1}});return o}),define("app/models/share-admin-repo",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Model.extend({getWebUrl:function(){return"#common/lib/"+this.get("repo_id")+"/"},getIconUrl:function(e){var t="r"==this.get("share_permission");return i.getLibIconUrl(!1,t,e)},getIconTitle:function(){var e="";return e="rw"==this.get("share_permission")?gettext("Read-Write"):gettext("Read-Only")}});return n}),define("app/collections/share-admin-repos",["underscore","backbone","common","app/models/share-admin-repo"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,url:function(){return i.getUrl({name:"share_admin_repos"})}});return r}),define("app/views/share-admin-repo",["jquery","underscore","backbone","common","app/views/widgets/hl-item-view"],function(e,t,i,n,r){"use strict";var s=r.extend({tagName:"tr",template:t.template(e("#share-admin-repo-tmpl").html()),events:{"click .perm-edit-icon":"showPermSelect","change .perm-select":"updatePermission","click .unshare":"removeShare"},initialize:function(e){r.prototype.initialize.call(this),this.listenTo(this.model,"change",this.render)},showPermSelect:function(){return this.$el.closest("table").find(".perm-select").hide().end().find(".cur-perm, .perm-edit-icon").show(),this.$(".cur-perm, .perm-edit-icon").hide(),this.$(".perm-select").show(),!1},updatePermission:function(){var t=this,i=n.getUrl({name:"share_admin_repo",repo_id:this.model.get("repo_id")}),r=this.model.get("share_type"),s=this.$(".perm-select").val(),o={share_type:r,permission:s};"personal"==r?o.user=this.model.get("user_email"):"group"==r&&(o.group_id=this.model.get("group_id")),e.ajax({url:i,method:"PUT",cache:!1,dataType:"json",data:o,beforeSend:n.prepareCSRFToken,success:function(){"admin"==s?t.model.set({share_permission:"rw",is_admin:!0}):t.model.set({share_permission:s,is_admin:!1}),n.feedback(gettext("Successfully modified permission"),"success")},error:function(e){n.ajaxErrorHandler(e)}})},removeShare:function(){var t=this,i=this.model.get("share_type"),r=n.getUrl({name:"share_admin_repo",repo_id:this.model.get("repo_id")});return"personal"==i?r+="?share_type=personal&user="+encodeURIComponent(this.model.get("user_email")):"group"==i?r+="?share_type=group&group_id="+this.model.get("group_id"):"public"==i&&(r+="?share_type=public"),e.ajax({url:r,type:"DELETE",beforeSend:n.prepareCSRFToken,success:function(){t.remove(),n.feedback(gettext("Successfully deleted 1 item"),"success")},error:function(e){n.ajaxErrorHandler(e)}}),!1},render:function(){var e=this.model.toJSON(),i=n.isHiDPI()?48:24,r=this.model.getIconUrl(i),s=this.model.get("share_type");return this.show_admin=!1,app.pageOptions.is_pro&&"public"!=s&&(this.show_admin=!0),t.extend(e,{icon_url:r,icon_title:this.model.getIconTitle(),url:this.model.getWebUrl(),name:this.model.get("repo_name"),show_admin:this.show_admin}),this.$el.html(this.template(e)),this}});return s}),define("app/views/share-admin-repos",["jquery","underscore","backbone","common","app/collections/share-admin-repos","app/views/share-admin-repo"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({id:"share-admin-repos",template:t.template(e("#share-admin-repos-tmpl").html()),initialize:function(){this.repos=new r,this.listenTo(this.repos,"add",this.addOne),this.listenTo(this.repos,"reset",this.reset),this.render();var t=this;e(document).click(function(e){var i=e.target||event.srcElement,n=t.$(".perm-select:visible");n.length&&!n.is(i)&&(n.hide(),n.closest("tr").find(".cur-perm, .perm-edit-icon").show())})},events:{"click .by-name":"sortByName"},sortByName:function(){var e=this.repos,t=this.$sortIcon;return t.hasClass("icon-caret-up")?e.comparator=function(e,t){var i=n.compareTwoWord(e.get("repo_name"),t.get("repo_name"));return-i}:e.comparator=function(e,t){var i=n.compareTwoWord(e.get("repo_name"),t.get("repo_name"));return i},e.sort(),this.$tableBody.empty(),e.each(this.addOne,this),t.toggleClass("icon-caret-up icon-caret-down").show(),e.comparator=null,!1},render:function(){this.$el.html(this.template()),this.$table=this.$("table"),this.$sortIcon=e(".by-name .sort-icon",this.$table),this.$tableBody=e("tbody",this.$table),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips")},hide:function(){this.$el.detach(),this.attached=!1},show:function(){this.attached||(this.attached=!0,e("#right-panel").html(this.$el)),this.showContent()},showContent:function(){var e=this;this.initPage(),this.repos.fetch({cache:!1,reset:!0,error:function(t,i,n){e.$loadingTip.hide();var r,s=e.$(".error");r=i.responseText?401==i.status||403==i.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),s.html(r).show()}})},initPage:function(){this.$table.hide(),this.$sortIcon.attr("class","sort-icon icon-caret-down").hide(),this.$tableBody.empty(),this.$loadingTip.show(),this.$emptyTip.hide(),this.$(".error").hide()},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.repos.length?(this.$emptyTip.hide(),this.$tableBody.empty(),this.repos.each(this.addOne,this),this.$table.show()):(this.$table.hide(),this.$emptyTip.show())},addOne:function(e){var t=new s({model:e});this.$tableBody.append(t.render().el)}});return o}),define("app/models/share-admin-folder",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Model.extend({getWebUrl:function(){var e=this.get("path"),t=this.get("repo_id");return"#my-libs/lib/"+t+i.encodePath(e)},getIconUrl:function(e){var t="r"==this.get("share_permission");return i.getDirIconUrl(t,e)},getIconTitle:function(){var e="";return e="rw"==this.get("share_permission")?gettext("Read-Write"):gettext("Read-Only")}});return n}),define("app/collections/share-admin-folders",["underscore","backbone","common","app/models/share-admin-folder"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,url:function(){return i.getUrl({name:"share_admin_folders"})}});return r}),define("app/views/share-admin-folder",["jquery","underscore","backbone","common","app/views/widgets/hl-item-view"],function(e,t,i,n,r){"use strict";var s=r.extend({tagName:"tr",template:t.template(e("#share-admin-folder-tmpl").html()),events:{"click .perm-edit-icon":"showPermSelect","change .perm-select":"updatePermission","click .unshare":"removeShare"},initialize:function(e){r.prototype.initialize.call(this),this.listenTo(this.model,"change",this.render)},showPermSelect:function(){return this.$el.closest("table").find(".perm-select").hide().end().find(".cur-perm, .perm-edit-icon").show(),this.$(".cur-perm, .perm-edit-icon").hide(),this.$(".perm-select").show(),!1},updatePermission:function(){var t=this,i=this.model.get("share_type"),r=this.$(".perm-select").val(),s=n.getUrl({name:"dir_shared_items",repo_id:this.model.get("repo_id")})+"?p="+encodeURIComponent(this.model.get("path"));"personal"==i?s+="&share_type=user&username="+encodeURIComponent(this.model.get("user_email")):"group"==i&&(s+="&share_type=group&group_id="+this.model.get("group_id")),e.ajax({url:s,method:"POST",dataType:"json",beforeSend:n.prepareCSRFToken,data:{permission:r},success:function(){t.model.set({share_permission:r}),n.feedback(gettext("Successfully modified permission"),"success")},error:function(e){n.ajaxErrorHandler(e)}})},removeShare:function(){var t=this,i=this.model.get("share_type"),r=n.getUrl({name:"dir_shared_items",repo_id:this.model.get("repo_id")})+"?p="+n.encodePath(this.model.get("path"));return"personal"==i?r+="&share_type=user&username="+n.encodePath(this.model.get("user_email")):"group"==i&&(r+="&share_type=group&group_id="+this.model.get("group_id")),e.ajax({url:r,type:"DELETE",beforeSend:n.prepareCSRFToken,success:function(){t.remove(),n.feedback(gettext("Successfully deleted 1 item"),"success")},error:function(e){n.ajaxErrorHandler(e)}}),!1},render:function(){var e=this.model.toJSON(),i=n.isHiDPI()?96:24,r=this.model.getIconUrl(i);return t.extend(e,{icon_url:r,icon_title:this.model.getIconTitle(),url:this.model.getWebUrl(),name:this.model.get("folder_name")}),this.$el.html(this.template(e)),this}});return s}),define("app/views/share-admin-folders",["jquery","underscore","backbone","common","app/collections/share-admin-folders","app/views/share-admin-folder"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({id:"share-admin-folders",template:t.template(e("#share-admin-folders-tmpl").html()),initialize:function(){this.folders=new r,this.listenTo(this.folders,"add",this.addOne),this.listenTo(this.folders,"reset",this.reset),this.render();var t=this;e(document).click(function(e){var i=e.target||event.srcElement,n=t.$(".perm-select:visible");n.length&&!n.is(i)&&(n.hide(),n.closest("tr").find(".cur-perm, .perm-edit-icon").show())})},events:{"click .by-name":"sortByName"},sortByName:function(){var e=this.folders,t=this.$sortIcon;return t.hasClass("icon-caret-up")?e.comparator=function(e,t){var i=n.compareTwoWord(e.get("folder_name"),t.get("folder_name"));return-i}:e.comparator=function(e,t){var i=n.compareTwoWord(e.get("folder_name"),t.get("folder_name"));return i},e.sort(),this.$tableBody.empty(),e.each(this.addOne,this),t.toggleClass("icon-caret-up icon-caret-down").show(),e.comparator=null,!1},render:function(){this.$el.html(this.template()),this.$table=this.$("table"),this.$sortIcon=e(".by-name .sort-icon",this.$table),this.$tableBody=e("tbody",this.$table),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips")},hide:function(){this.$el.detach(),this.attached=!1},show:function(){this.attached||(this.attached=!0,e("#right-panel").html(this.$el)),this.showContent()},showContent:function(){this.initPage(),this.folders.fetch({cache:!1,reset:!0,error:function(e,t,i){_this.$loadingTip.hide();var n,r=_this.$(".error");n=t.responseText?401==t.status||403==t.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),r.html(n).show()}})},initPage:function(){this.$table.hide(),this.$sortIcon.attr("class","sort-icon icon-caret-down").hide(),this.$tableBody.empty(),this.$loadingTip.show(),this.$emptyTip.hide(),this.$(".error").hide()},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.folders.length?(this.$emptyTip.hide(),this.$tableBody.empty(),this.folders.each(this.addOne,this),this.$table.show()):(this.$table.hide(),this.$emptyTip.show())},addOne:function(e){var t=new s({model:e});this.$tableBody.append(t.render().el)}});return o}),define("app/models/share-admin-share-link",["underscore","backbone","common","moment"],function(e,t,i,n){"use strict";var r=t.Model.extend({parse:function(t){var i=e.clone(t),r=t.expire_date;return r?i.expire_date_timestamp=n(r).format("X"):i.expire_date_timestamp=0,i},getIconUrl:function(e){return this.get("is_dir")?i.getDirIconUrl(!1,e):i.getFileIconUrl(this.get("obj_name"),e)},getWebUrl:function(){var e=this.get("repo_id"),t=this.get("path");return this.get("is_dir")?"#common/lib/"+e+i.encodePath(t):app.config.siteRoot+"lib/"+e+"/file"+i.encodePath(t)}});return r}),define("app/collections/share-admin-share-links",["underscore","backbone","common","app/models/share-admin-share-link"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,url:function(){return i.getUrl({name:"share_admin_share_links"})}});return r}),define("app/views/share-admin-share-link",["jquery","underscore","backbone","common","moment","app/views/widgets/hl-item-view"],function(e,t,i,n,r,s){"use strict";var o=s.extend({tagName:"tr",template:t.template(e("#share-admin-download-link-tmpl").html()),linkPopupTemplate:t.template(e("#share-admin-link-popup-tmpl").html()),events:{"click .rm-link":"removeLink","click .view-link":"viewLink"},initialize:function(e){s.prototype.initialize.call(this)},viewLink:function(){var t=e(this.linkPopupTemplate({link:this.model.get("link")}));t.modal({focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"});var i=e("p",t),n=e("input",t);return n.css({width:i.width()+2}),i.hide(),n.show(),n.click(function(){e(this).select()}),!1},removeLink:function(){var t=this;return e.ajax({url:n.getUrl({name:"share_admin_share_link",token:this.model.get("token")}),type:"DELETE",beforeSend:n.prepareCSRFToken,success:function(){t.remove(),n.feedback(gettext("Successfully deleted 1 item"),"success")},error:function(e){n.ajaxErrorHandler(e)}}),!1},render:function(){var e=this.model.toJSON(),i=n.isHiDPI()?96:24,s=this.model.getIconUrl(i);return t.extend(e,{icon_url:s,dirent_url:this.model.getWebUrl(),time:e.expire_date?r(e.expire_date).format("YYYY-MM-DD"):""}),this.$el.html(this.template(e)),this}});return o}),define("app/views/share-admin-share-links",["jquery","underscore","backbone","common","app/collections/share-admin-share-links","app/views/share-admin-share-link"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({id:"share-admin-download-links",template:t.template(e("#share-admin-download-links-tmpl").html()),initialize:function(){this.links=new r,this.listenTo(this.links,"add",this.addOne),this.listenTo(this.links,"reset",this.reset),this.render()},events:{"click .by-name":"sortByName","click .by-time":"sortByTime"},initialSort:function(e,t){var i=e.get("is_dir"),n=t.get("is_dir");return i&&!n?-1:!i&&n?1:0},sortByName:function(){var e=this,t=this.links,i=this.$sortByNameIcon;return this.$sortByTimeIcon.hide(),i.hasClass("icon-caret-up")?t.comparator=function(t,i){var r=e.initialSort(t,i);if(0!=r)return r;var s=n.compareTwoWord(t.get("obj_name"),i.get("obj_name"));return-s}:t.comparator=function(t,i){var r=e.initialSort(t,i);if(0!=r)return r;var s=n.compareTwoWord(t.get("obj_name"),i.get("obj_name"));return s},t.sort(),this.$tableBody.empty(),t.each(this.addOne,this),i.toggleClass("icon-caret-up icon-caret-down").show(),t.comparator=null,!1},sortByTime:function(){var e=this,t=this.links,i=this.$sortByTimeIcon;return this.$sortByNameIcon.hide(),i.hasClass("icon-caret-down")?t.comparator=function(t,i){var n=e.initialSort(t,i);return 0!=n?n:t.get("expire_date_timestamp")<i.get("expire_date_timestamp")?1:-1}:t.comparator=function(t,i){var n=e.initialSort(t,i);return 0!=n?n:t.get("expire_date_timestamp")<i.get("expire_date_timestamp")?-1:1},t.sort(),this.$tableBody.empty(),t.each(this.addOne,this),i.toggleClass("icon-caret-up icon-caret-down").show(),t.comparator=null,!1},render:function(){this.$el.html(this.template({can_generate_upload_link:app.pageOptions.can_generate_upload_link})),this.$table=this.$("table"),this.$sortByNameIcon=this.$(".by-name .sort-icon"),this.$sortByTimeIcon=this.$(".by-time .sort-icon"),this.$tableBody=e("tbody",this.$table),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips")},hide:function(){this.$el.detach(),this.attached=!1},show:function(){this.attached||(this.attached=!0,e("#right-panel").html(this.$el)),this.showContent()},showContent:function(){var e=this;this.initPage(),this.links.fetch({cache:!1,reset:!0,error:function(t,i,n){e.$loadingTip.hide();var r,s=e.$(".error");r=i.responseText?401==i.status||403==i.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),s.html(r).show()}})},initPage:function(){this.$table.hide(),this.$sortByNameIcon.attr("class","sort-icon icon-caret-up").show(),this.$sortByTimeIcon.attr("class","sort-icon icon-caret-down").hide(),this.$tableBody.empty(),this.$loadingTip.show(),this.$emptyTip.hide(),this.$(".error").hide()},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.links.length?(this.$emptyTip.hide(),this.$tableBody.empty(),this.links.each(this.addOne,this),this.$table.show()):(this.$emptyTip.show(),this.$table.hide())},addOne:function(e){var t=new s({model:e});this.$tableBody.append(t.render().el)}});return o}),define("app/models/share-admin-upload-link",["underscore","backbone","common"],function(e,t,i){"use strict";var n=t.Model.extend({getIconUrl:function(e){return i.getDirIconUrl(!1,e)},getWebUrl:function(){var e=this.get("repo_id"),t=this.get("path");return"#common/lib/"+e+i.encodePath(t)}});return n}),define("app/collections/share-admin-upload-links",["underscore","backbone","common","app/models/share-admin-upload-link"],function(e,t,i,n){"use strict";var r=t.Collection.extend({model:n,url:function(){return i.getUrl({name:"share_admin_upload_links"})}});return r}),define("app/views/share-admin-upload-link",["jquery","underscore","backbone","common","app/views/widgets/hl-item-view"],function(e,t,i,n,r){"use strict";var s=r.extend({tagName:"tr",template:t.template(e("#share-admin-upload-link-tmpl").html()),linkPopupTemplate:t.template(e("#share-admin-link-popup-tmpl").html()),events:{"click .rm-link":"removeLink","click .view-link":"viewLink"},initialize:function(e){r.prototype.initialize.call(this)},viewLink:function(){var t=e(this.linkPopupTemplate({link:this.model.get("link")}));t.modal({focus:!1}),e("#simplemodal-container").css({width:"auto",height:"auto"});var i=e("p",t),n=e("input",t);return n.css({width:i.width()+2}),i.hide(),n.show(),n.click(function(){e(this).select()}),!1},removeLink:function(){var t=this;return e.ajax({url:n.getUrl({name:"share_admin_upload_link",token:this.model.get("token")}),type:"DELETE",beforeSend:n.prepareCSRFToken,success:function(){t.remove(),n.feedback(gettext("Successfully deleted 1 item"),"success")},error:function(e){n.ajaxErrorHandler(e)}}),!1},render:function(){var e=this.model.toJSON(),i=n.isHiDPI()?96:24,r=this.model.getIconUrl(i);return t.extend(e,{icon_url:r,dirent_url:this.model.getWebUrl()}),this.$el.html(this.template(e)),this}});return s}),define("app/views/share-admin-upload-links",["jquery","underscore","backbone","common","app/collections/share-admin-upload-links","app/views/share-admin-upload-link"],function(e,t,i,n,r,s){"use strict";var o=i.View.extend({id:"share-admin-upload-links",template:t.template(e("#share-admin-upload-links-tmpl").html()),initialize:function(){this.links=new r,this.listenTo(this.links,"add",this.addOne),this.listenTo(this.links,"reset",this.reset),this.render()},render:function(){this.$el.html(this.template({can_generate_share_link:app.pageOptions.can_generate_share_link})),this.$table=this.$("table"),this.$tableBody=e("tbody",this.$table),this.$loadingTip=this.$(".loading-tip"),this.$emptyTip=this.$(".empty-tips")},hide:function(){this.$el.detach(),this.attached=!1},show:function(){this.attached||(this.attached=!0,e("#right-panel").html(this.$el)),this.showContent()},showContent:function(){var e=this;this.initPage(),this.links.fetch({cache:!1,reset:!0,error:function(t,i,n){e.$loadingTip.hide();var r,s=e.$(".error");r=i.responseText?401==i.status||403==i.status?gettext("Permission error"):gettext("Error"):gettext("Please check the network."),s.html(r).show()}})},initPage:function(){this.$table.hide(),this.$tableBody.empty(),this.$loadingTip.show(),this.$emptyTip.hide(),this.$(".error").hide()},reset:function(){this.$(".error").hide(),this.$loadingTip.hide(),this.links.length?(this.$emptyTip.hide(),this.$tableBody.empty(),this.links.each(this.addOne,this),this.$table.show()):(this.$emptyTip.show(),this.$table.hide())},addOne:function(e){var t=new s({model:e});this.$tableBody.append(t.render().el)}});return o}),define("app/views/notifications",["jquery","underscore","backbone","common","app/views/widgets/popover"],function(e,t,i,n,r){"use strict";var s=r.extend({id:"notice-popover",className:"sf-popover",template:t.template(e("#notice-popover-tmpl").html()),initialize:function(t){r.prototype.initialize.call(this),this.render(),this.$loadingTip=this.$(".loading-tip"),this.$error=this.$(".error"),this.$noticeList=this.$(".notice-list"),this.$notifications=e("#notifications"),this.$num=e(".num",this.$notifications),this.orig_doc_title=document.title;var i=this,s=function(){e.ajax({url:n.getUrl({name:"notifications"}),dataType:"json",cache:!1,success:function(t){var n=t.unseen_count,r=i.$num;r.html(n),n>0?(r.removeClass("hide"),document.title="("+n+")"+i.orig_doc_title):(r.addClass("hide"),document.title=i.orig_doc_title);var s=e("#network-top-notice");s.is(":visible")&&s.remove()},error:function(t){var i;t.responseText?401==t.status&&(clearInterval(o),i=e('<p class="top-bar fixed-top-bar">'+gettext("You have logged out.")+'<span class="top-bar-click">'+gettext("Log in")+"</span></p>"),e("#wrapper").prepend(i)):0==e("#network-top-notice").length&&(i=e('<p class="top-bar fixed-top-bar" id="network-top-notice">'+gettext("Please check the network.")+'<span class="top-bar-click">'+gettext("Refresh")+"</span></p>"),e("#wrapper").prepend(i)),e(".top-bar-click",i).click(function(){location.reload(!0)})}})};s();var o=setInterval(s,1e3*(app.pageOptions.unread_notifications_request_interval||180));e("#notice-icon").click(function(){return i.toggle(),!1})},render:function(){return this.$el.html(this.template()),this},events:{"click .detail":"viewDetail","click .unread a":"visitUnread"},viewDetail:function(t){var i=e(t.currentTarget);location.href=e(".brief a",i.parent()).attr("href")},visitUnread:function(t){var i=e(t.currentTarget),r=i.closest(".unread").data("id"),s=i.attr("href");return e.ajax({url:n.getUrl({name:"notification"}),type:"PUT",dataType:"json",data:{notice_id:r},beforeSend:n.prepareCSRFToken,
success:function(e){location.href=s,i.closest(".unread").removeClass("unread").addClass("read")},error:function(){location.href=s}}),!1},hide:function(){var t=this;return app.ui.currentPopover=null,this.$el.detach(),this.$(".unread").length>0&&e.ajax({url:n.getUrl({name:"notifications"}),type:"PUT",dataType:"json",beforeSend:n.prepareCSRFToken,success:function(){t.$num.html(0).addClass("hide"),document.title=t.orig_doc_title}}),!1},showContent:function(){var t=this;this.$noticeList.addClass("hide"),this.$error.hide(),this.$loadingTip.show(),e.ajax({url:n.getUrl({name:"get_popup_notices"}),dataType:"json",success:function(e){t.$loadingTip.hide(),t.$noticeList.html(e.notice_html).show()},error:function(i,n,r){t.$loadingTip.hide();var s;s=i.responseText?e.parseJSON(i.responseText).error:gettext("Please check the network."),t.$error.html(s).show()}}),this.$notifications.append(this.$el)}});return s}),define("app/views/account",["jquery","underscore","backbone","common","app/views/widgets/popover"],function(e,t,i,n,r){"use strict";var s=r.extend({id:"user-info-popup",className:"sf-popover account-popup",template:t.template(e("#user-info-popup-tmpl").html()),initialize:function(t){r.prototype.initialize.call(this),this.render(),this.$loadingTip=this.$(".loading-tip"),this.$error=this.$(".error"),this.$space=this.$("#space-traffic"),this.$account=e("#account");var i=this;e("#my-info").click(function(){return i.toggle(),!1})},render:function(){return this.$el.html(this.template()),this},showContent:function(){var t=this;this.$error.hide(),this.$loadingTip.show(),this.$space.addClass("hide"),e.ajax({url:n.getUrl({name:"space_and_traffic"}),dataType:"json",cache:!1,success:function(e){t.$loadingTip.hide(),t.$space.html(e.html).removeClass("hide")},error:function(i,n,r){t.$loadingTip.hide();var s;s=i.responseText?e.parseJSON(i.responseText).error:gettext("Please check the network."),t.$error.html(s).show()}}),this.$account.append(this.$el)}});return s}),define("app/router",["jquery","backbone","common","js.cookie","app/views/side-nav","app/views/myhome-repos","app/views/my-deleted-repos","app/views/myhome-shared-repos","app/views/groups","app/views/group","app/views/organization","app/views/dir","app/views/starred-file","app/views/activities","app/views/devices","app/views/invitations","app/views/share-admin-repos","app/views/share-admin-folders","app/views/share-admin-share-links","app/views/share-admin-upload-links","app/views/notifications","app/views/account"],function(e,t,i,n,r,s,o,a,l,d,c,h,u,p,f,m,g,_,v,y,w,b){"use strict";var T=t.Router.extend({routes:{"":"showRepos","my-libs/":"showMyRepos","my-libs/deleted/":"showMyDeletedRepos","my-libs/lib/:repo_id(/*path)":"showMyRepoDir","shared-libs/":"showSharedRepos","shared-libs/lib/:repo_id(/*path)":"showSharedRepoDir","groups/":"showGroups","group/:group_id/":"showGroup","group/:group_id/lib/:repo_id(/*path)":"showGroupRepoDir","group/:group_id/discussions/":"showGroupDiscussions","org/":"showOrgRepos","org/lib/:repo_id(/*path)":"showOrgRepoDir","common/lib/:repo_id(/*path)":"showCommonDir","starred/":"showStarredFile","activities/":"showActivities","devices/":"showDevices","invitations/":"showInvitations","share-admin-libs/":"showShareAdminRepos","share-admin-folders/":"showShareAdminFolders","share-admin-share-links/":"showShareAdminShareLinks","share-admin-upload-links/":"showShareAdminUploadLinks","*actions":"showRepos"},initialize:function(){e(".initial-loading").hide(),e(".main-content").show(),i.prepareApiCsrf(),i.initLocale(),this.sideNavView=new r,app.ui.sideNavView=this.sideNavView,this.dirView=new h,this.myReposView=new s,this.myDeletedReposView=new o,this.sharedReposView=new a,this.orgView=new c,this.groupView=new d,this.groupsView=new l,this.starredFileView=new u,this.devicesView=new f,this.invitationsView=new m,this.activitiesView=new p,this.shareAdminReposView=new g,this.shareAdminFoldersView=new _,this.shareAdminShareLinksView=new v,this.shareAdminUploadLinksView=new y,app.ui.notificationsView=this.notificationsView=new w,app.ui.accountView=this.accountView=new b,app.pageOptions.sort_mode=n.get("sort_mode")||"name_up",this.currentView=this.myReposView;var t=this,T=e(window).width();e(window).resize(function(){var i=e(window).width();t.currentView.reset&&(T<768&&i>=768||T>=768&&i<768)&&t.currentView.reset(),T=i}),e(window).resize(function(){var t=e("#share-popup, #repo-share-link-admin-dialog, #repo-folder-perm-popup, #folder-perm-popup");t.is(":visible")&&(e(window).width()<768?(t.css({width:e(window).width()-50,height:e(window).height()-50,overflow:"auto"}),e.modal.update(e(window).height()-50,e(window).width()-50)):(t.removeAttr("style"),e("#simplemodal-container").css({width:"auto",height:"auto"})))}),e("#info-bar .close").click(i.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),app.ui.groupDiscussions&&app.ui.groupDiscussions.hide()},showRepos:function(){app.pageOptions.can_add_repo?this.showMyRepos():this.showSharedRepos()},showMyRepos:function(){this.switchCurrentView(this.myReposView),this.myReposView.show(),this.sideNavView.setCurTab("mine")},showMyDeletedRepos:function(){this.switchCurrentView(this.myDeletedReposView),this.myDeletedReposView.show(),this.sideNavView.setCurTab("mine")},showSharedRepos:function(){this.switchCurrentView(this.sharedReposView),this.sharedReposView.show(),this.sideNavView.setCurTab("shared")},showMyRepoDir:function(e,t){t=t?"/"+t:"/",this.switchCurrentView(this.dirView),this.dirView.showDir("my-libs",e,t),this.sideNavView.setCurTab("mine")},showCommonDir:function(e,t){t=t?"/"+t:"/",this.switchCurrentView(this.dirView),this.dirView.showDir("common",e,t),this.sideNavView.setCurTab("mine")},showSharedRepoDir:function(e,t){t=t?"/"+t:"/",this.switchCurrentView(this.dirView),this.dirView.showDir("shared-libs",e,t),this.sideNavView.setCurTab("shared")},showGroups:function(){this.switchCurrentView(this.groupsView),this.groupsView.show(),this.sideNavView.setCurTab("group",{cur_group_tab:"groups",cur_group_id:""})},showGroup:function(e,t){this.switchCurrentView(this.groupView),this.groupView.show(e,t),this.sideNavView.setCurTab("group",{cur_group_tab:"",cur_group_id:e})},showGroupRepoDir:function(e,t,n){n=n?"/"+n:"/";var r=i.groupId2Name(e);r?(this.switchCurrentView(this.dirView),this.dirView.showDir("group/"+e,t,n,{group_name:r}),this.sideNavView.setCurTab("group",{cur_group_tab:"",cur_group_id:e})):(i.feedback("Group {group_id} not found".replace("{group_id}",e),"error"),app.router.navigate("",{trigger:!0}))},showGroupDiscussions:function(e){this.showGroup(e,{showDiscussions:!0})},showOrgRepos:function(){this.switchCurrentView(this.orgView),this.orgView.show(),this.sideNavView.setCurTab("org")},showOrgRepoDir:function(e,t){t=t?"/"+t:"/",this.switchCurrentView(this.dirView),this.dirView.showDir("org",e,t),this.sideNavView.setCurTab("org")},showStarredFile:function(){this.switchCurrentView(this.starredFileView),this.starredFileView.show(),this.sideNavView.setCurTab("starred")},showActivities:function(){this.switchCurrentView(this.activitiesView),this.activitiesView.show(),this.sideNavView.setCurTab("activities")},showDevices:function(){this.switchCurrentView(this.devicesView),this.devicesView.show(),this.sideNavView.setCurTab("devices")},showInvitations:function(){this.switchCurrentView(this.invitationsView),this.invitationsView.show(),this.sideNavView.setCurTab("invitations")},showShareAdminRepos:function(){this.switchCurrentView(this.shareAdminReposView),this.shareAdminReposView.show(),this.sideNavView.setCurTab("share-admin-repos")},showShareAdminFolders:function(){this.switchCurrentView(this.shareAdminFoldersView),this.shareAdminFoldersView.show(),this.sideNavView.setCurTab("share-admin-folders")},showShareAdminShareLinks:function(){this.switchCurrentView(this.shareAdminShareLinksView),this.shareAdminShareLinksView.show(),this.sideNavView.setCurTab("share-admin-links")},showShareAdminUploadLinks:function(){this.switchCurrentView(this.shareAdminUploadLinksView),this.shareAdminUploadLinksView.show(),this.sideNavView.setCurTab("share-admin-links")}});return T}),define("app/main",["app/router"],function(e){app.router=new e,Backbone.history.start()}),require(["./common"],function(e){require(["app/main"])}),define("main",function(){});