Browse Source

Add confirmation modal to irreversible actions

Closes #163.
sh4nks 8 years ago
parent
commit
0f43750549

+ 2 - 2
flaskbb/static/js/scripts.min.js

@@ -3,5 +3,5 @@ for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:f
 r.splice(e,1));for(e=0;e<s;e++)i[e]&&i[e].finish&&i[e].finish.call(this);delete n.finish})}}),dt.each(["toggle","show","hide"],function(t,e){var n=dt.fn[e];dt.fn[e]=function(t,i,o){return null==t||"boolean"==typeof t?n.apply(this,arguments):this.animate(H(e,!0),t,i,o)}}),dt.each({slideDown:H("show"),slideUp:H("hide"),slideToggle:H("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){dt.fn[t]=function(t,n,i){return this.animate(e,t,n,i)}}),dt.timers=[],dt.fx.tick=function(){var t,e=0,n=dt.timers;for(he=dt.now();e<n.length;e++)t=n[e],t()||n[e]!==t||n.splice(e--,1);n.length||dt.fx.stop(),he=void 0},dt.fx.timer=function(t){dt.timers.push(t),t()?dt.fx.start():dt.timers.pop()},dt.fx.interval=13,dt.fx.start=function(){de||(de=t.requestAnimationFrame?t.requestAnimationFrame(R):t.setInterval(dt.fx.tick,dt.fx.interval))},dt.fx.stop=function(){t.cancelAnimationFrame?t.cancelAnimationFrame(de):t.clearInterval(de),de=null},dt.fx.speeds={slow:600,fast:200,_default:400},dt.fn.delay=function(e,n){return e=dt.fx?dt.fx.speeds[e]||e:e,n=n||"fx",this.queue(n,function(n,i){var o=t.setTimeout(n,e);i.stop=function(){t.clearTimeout(o)}})},function(){var t=Z.createElement("input"),e=Z.createElement("select"),n=e.appendChild(Z.createElement("option"));t.type="checkbox",ut.checkOn=""!==t.value,ut.optSelected=n.selected,t=Z.createElement("input"),t.value="t",t.type="radio",ut.radioValue="t"===t.value}();var ge,me=dt.expr.attrHandle;dt.fn.extend({attr:function(t,e){return At(this,dt.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){dt.removeAttr(this,t)})}}),dt.extend({attr:function(t,e,n){var i,o,r=t.nodeType;if(3!==r&&8!==r&&2!==r)return"undefined"==typeof t.getAttribute?dt.prop(t,e,n):(1===r&&dt.isXMLDoc(t)||(o=dt.attrHooks[e.toLowerCase()]||(dt.expr.match.bool.test(e)?ge:void 0)),void 0!==n?null===n?void dt.removeAttr(t,e):o&&"set"in o&&void 0!==(i=o.set(t,n,e))?i:(t.setAttribute(e,n+""),n):o&&"get"in o&&null!==(i=o.get(t,e))?i:(i=dt.find.attr(t,e),null==i?void 0:i))},attrHooks:{type:{set:function(t,e){if(!ut.radioValue&&"radio"===e&&dt.nodeName(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,i=0,o=e&&e.match(Et);if(o&&1===t.nodeType)for(;n=o[i++];)t.removeAttribute(n)}}),ge={set:function(t,e,n){return e===!1?dt.removeAttr(t,n):t.setAttribute(n,n),n}},dt.each(dt.expr.match.bool.source.match(/\w+/g),function(t,e){var n=me[e]||dt.find.attr;me[e]=function(t,e,i){var o,r,s=e.toLowerCase();return i||(r=me[s],me[s]=o,o=null!=n(t,e,i)?s:null,me[s]=r),o}});var ve=/^(?:input|select|textarea|button)$/i,ye=/^(?:a|area)$/i;dt.fn.extend({prop:function(t,e){return At(this,dt.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[dt.propFix[t]||t]})}}),dt.extend({prop:function(t,e,n){var i,o,r=t.nodeType;if(3!==r&&8!==r&&2!==r)return 1===r&&dt.isXMLDoc(t)||(e=dt.propFix[e]||e,o=dt.propHooks[e]),void 0!==n?o&&"set"in o&&void 0!==(i=o.set(t,n,e))?i:t[e]=n:o&&"get"in o&&null!==(i=o.get(t,e))?i:t[e]},propHooks:{tabIndex:{get:function(t){var e=dt.find.attr(t,"tabindex");return e?parseInt(e,10):ve.test(t.nodeName)||ye.test(t.nodeName)&&t.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),ut.optSelected||(dt.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),dt.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){dt.propFix[this.toLowerCase()]=this});var be=/[\t\r\n\f]/g;dt.fn.extend({addClass:function(t){var e,n,i,o,r,s,a,l=0;if(dt.isFunction(t))return this.each(function(e){dt(this).addClass(t.call(this,e,W(this)))});if("string"==typeof t&&t)for(e=t.match(Et)||[];n=this[l++];)if(o=W(n),i=1===n.nodeType&&(" "+o+" ").replace(be," ")){for(s=0;r=e[s++];)i.indexOf(" "+r+" ")<0&&(i+=r+" ");a=dt.trim(i),o!==a&&n.setAttribute("class",a)}return this},removeClass:function(t){var e,n,i,o,r,s,a,l=0;if(dt.isFunction(t))return this.each(function(e){dt(this).removeClass(t.call(this,e,W(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(Et)||[];n=this[l++];)if(o=W(n),i=1===n.nodeType&&(" "+o+" ").replace(be," ")){for(s=0;r=e[s++];)for(;i.indexOf(" "+r+" ")>-1;)i=i.replace(" "+r+" "," ");a=dt.trim(i),o!==a&&n.setAttribute("class",a)}return this},toggleClass:function(t,e){var n=typeof t;return"boolean"==typeof e&&"string"===n?e?this.addClass(t):this.removeClass(t):dt.isFunction(t)?this.each(function(n){dt(this).toggleClass(t.call(this,n,W(this),e),e)}):this.each(function(){var e,i,o,r;if("string"===n)for(i=0,o=dt(this),r=t.match(Et)||[];e=r[i++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&"boolean"!==n||(e=W(this),e&&It.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||t===!1?"":It.get(this,"__className__")||""))})},hasClass:function(t){var e,n,i=0;for(e=" "+t+" ";n=this[i++];)if(1===n.nodeType&&(" "+W(n)+" ").replace(be," ").indexOf(e)>-1)return!0;return!1}});var xe=/\r/g,we=/[\x20\t\r\n\f]+/g;dt.fn.extend({val:function(t){var e,n,i,o=this[0];return arguments.length?(i=dt.isFunction(t),this.each(function(n){var o;1===this.nodeType&&(o=i?t.call(this,n,dt(this).val()):t,null==o?o="":"number"==typeof o?o+="":dt.isArray(o)&&(o=dt.map(o,function(t){return null==t?"":t+""})),e=dt.valHooks[this.type]||dt.valHooks[this.nodeName.toLowerCase()],e&&"set"in e&&void 0!==e.set(this,o,"value")||(this.value=o))})):o?(e=dt.valHooks[o.type]||dt.valHooks[o.nodeName.toLowerCase()],e&&"get"in e&&void 0!==(n=e.get(o,"value"))?n:(n=o.value,"string"==typeof n?n.replace(xe,""):null==n?"":n)):void 0}}),dt.extend({valHooks:{option:{get:function(t){var e=dt.find.attr(t,"value");return null!=e?e:dt.trim(dt.text(t)).replace(we," ")}},select:{get:function(t){for(var e,n,i=t.options,o=t.selectedIndex,r="select-one"===t.type,s=r?null:[],a=r?o+1:i.length,l=o<0?a:r?o:0;l<a;l++)if(n=i[l],(n.selected||l===o)&&!n.disabled&&(!n.parentNode.disabled||!dt.nodeName(n.parentNode,"optgroup"))){if(e=dt(n).val(),r)return e;s.push(e)}return s},set:function(t,e){for(var n,i,o=t.options,r=dt.makeArray(e),s=o.length;s--;)i=o[s],(i.selected=dt.inArray(dt.valHooks.option.get(i),r)>-1)&&(n=!0);return n||(t.selectedIndex=-1),r}}}}),dt.each(["radio","checkbox"],function(){dt.valHooks[this]={set:function(t,e){if(dt.isArray(e))return t.checked=dt.inArray(dt(t).val(),e)>-1}},ut.checkOn||(dt.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var _e=/^(?:focusinfocus|focusoutblur)$/;dt.extend(dt.event,{trigger:function(e,n,i,o){var r,s,a,l,c,u,h,d=[i||Z],p=at.call(e,"type")?e.type:e,f=at.call(e,"namespace")?e.namespace.split("."):[];if(s=a=i=i||Z,3!==i.nodeType&&8!==i.nodeType&&!_e.test(p+dt.event.triggered)&&(p.indexOf(".")>-1&&(f=p.split("."),p=f.shift(),f.sort()),c=p.indexOf(":")<0&&"on"+p,e=e[dt.expando]?e:new dt.Event(p,"object"==typeof e&&e),e.isTrigger=o?2:3,e.namespace=f.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=i),n=null==n?[e]:dt.makeArray(n,[e]),h=dt.event.special[p]||{},o||!h.trigger||h.trigger.apply(i,n)!==!1)){if(!o&&!h.noBubble&&!dt.isWindow(i)){for(l=h.delegateType||p,_e.test(l+p)||(s=s.parentNode);s;s=s.parentNode)d.push(s),a=s;a===(i.ownerDocument||Z)&&d.push(a.defaultView||a.parentWindow||t)}for(r=0;(s=d[r++])&&!e.isPropagationStopped();)e.type=r>1?l:h.bindType||p,u=(It.get(s,"events")||{})[e.type]&&It.get(s,"handle"),u&&u.apply(s,n),u=c&&s[c],u&&u.apply&&jt(s)&&(e.result=u.apply(s,n),e.result===!1&&e.preventDefault());return e.type=p,o||e.isDefaultPrevented()||h._default&&h._default.apply(d.pop(),n)!==!1||!jt(i)||c&&dt.isFunction(i[p])&&!dt.isWindow(i)&&(a=i[c],a&&(i[c]=null),dt.event.triggered=p,i[p](),dt.event.triggered=void 0,a&&(i[c]=a)),e.result}},simulate:function(t,e,n){var i=dt.extend(new dt.Event,n,{type:t,isSimulated:!0});dt.event.trigger(i,null,e)}}),dt.fn.extend({trigger:function(t,e){return this.each(function(){dt.event.trigger(t,e,this)})},triggerHandler:function(t,e){var n=this[0];if(n)return dt.event.trigger(t,e,n,!0)}}),dt.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(t,e){dt.fn[e]=function(t,n){return arguments.length>0?this.on(e,null,t,n):this.trigger(e)}}),dt.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),ut.focusin="onfocusin"in t,ut.focusin||dt.each({focus:"focusin",blur:"focusout"},function(t,e){var n=function(t){dt.event.simulate(e,t.target,dt.event.fix(t))};dt.event.special[e]={setup:function(){var i=this.ownerDocument||this,o=It.access(i,e);o||i.addEventListener(t,n,!0),It.access(i,e,(o||0)+1)},teardown:function(){var i=this.ownerDocument||this,o=It.access(i,e)-1;o?It.access(i,e,o):(i.removeEventListener(t,n,!0),It.remove(i,e))}}});var ke=t.location,Ce=dt.now(),$e=/\?/;dt.parseXML=function(e){var n;if(!e||"string"!=typeof e)return null;try{n=(new t.DOMParser).parseFromString(e,"text/xml")}catch(i){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||dt.error("Invalid XML: "+e),n};var Te=/\[\]$/,Se=/\r?\n/g,Ee=/^(?:submit|button|image|reset|file)$/i,Ne=/^(?:input|select|textarea|keygen)/i;dt.param=function(t,e){var n,i=[],o=function(t,e){var n=dt.isFunction(e)?e():e;i[i.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==n?"":n)};if(dt.isArray(t)||t.jquery&&!dt.isPlainObject(t))dt.each(t,function(){o(this.name,this.value)});else for(n in t)U(n,t[n],e,o);return i.join("&")},dt.fn.extend({serialize:function(){return dt.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=dt.prop(this,"elements");return t?dt.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!dt(this).is(":disabled")&&Ne.test(this.nodeName)&&!Ee.test(t)&&(this.checked||!Mt.test(t))}).map(function(t,e){var n=dt(this).val();return null==n?null:dt.isArray(n)?dt.map(n,function(t){return{name:e.name,value:t.replace(Se,"\r\n")}}):{name:e.name,value:n.replace(Se,"\r\n")}}).get()}});var De=/%20/g,Ae=/#.*$/,je=/([?&])_=[^&]*/,Ie=/^(.*?):[ \t]*([^\r\n]*)$/gm,Oe=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Le=/^(?:GET|HEAD)$/,Pe=/^\/\//,Re={},qe={},He="*/".concat("*"),Fe=Z.createElement("a");Fe.href=ke.href,dt.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ke.href,type:"GET",isLocal:Oe.test(ke.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":He,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":dt.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?V(V(t,dt.ajaxSettings),e):V(dt.ajaxSettings,t)},ajaxPrefilter:K(Re),ajaxTransport:K(qe),ajax:function(e,n){function i(e,n,i,a){var c,d,p,x,w,_=n;u||(u=!0,l&&t.clearTimeout(l),o=void 0,s=a||"",k.readyState=e>0?4:0,c=e>=200&&e<300||304===e,i&&(x=Y(f,k,i)),x=G(f,x,k,c),c?(f.ifModified&&(w=k.getResponseHeader("Last-Modified"),w&&(dt.lastModified[r]=w),w=k.getResponseHeader("etag"),w&&(dt.etag[r]=w)),204===e||"HEAD"===f.type?_="nocontent":304===e?_="notmodified":(_=x.state,d=x.data,p=x.error,c=!p)):(p=_,!e&&_||(_="error",e<0&&(e=0))),k.status=e,k.statusText=(n||_)+"",c?v.resolveWith(g,[d,_,k]):v.rejectWith(g,[k,_,p]),k.statusCode(b),b=void 0,h&&m.trigger(c?"ajaxSuccess":"ajaxError",[k,f,c?d:p]),y.fireWith(g,[k,_]),h&&(m.trigger("ajaxComplete",[k,f]),--dt.active||dt.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=void 0),n=n||{};var o,r,s,a,l,c,u,h,d,p,f=dt.ajaxSetup({},n),g=f.context||f,m=f.context&&(g.nodeType||g.jquery)?dt(g):dt.event,v=dt.Deferred(),y=dt.Callbacks("once memory"),b=f.statusCode||{},x={},w={},_="canceled",k={readyState:0,getResponseHeader:function(t){var e;if(u){if(!a)for(a={};e=Ie.exec(s);)a[e[1].toLowerCase()]=e[2];e=a[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return u?s:null},setRequestHeader:function(t,e){return null==u&&(t=w[t.toLowerCase()]=w[t.toLowerCase()]||t,x[t]=e),this},overrideMimeType:function(t){return null==u&&(f.mimeType=t),this},statusCode:function(t){var e;if(t)if(u)k.always(t[k.status]);else for(e in t)b[e]=[b[e],t[e]];return this},abort:function(t){var e=t||_;return o&&o.abort(e),i(0,e),this}};if(v.promise(k),f.url=((e||f.url||ke.href)+"").replace(Pe,ke.protocol+"//"),f.type=n.method||n.type||f.method||f.type,f.dataTypes=(f.dataType||"*").toLowerCase().match(Et)||[""],null==f.crossDomain){c=Z.createElement("a");try{c.href=f.url,c.href=c.href,f.crossDomain=Fe.protocol+"//"+Fe.host!=c.protocol+"//"+c.host}catch(C){f.crossDomain=!0}}if(f.data&&f.processData&&"string"!=typeof f.data&&(f.data=dt.param(f.data,f.traditional)),Q(Re,f,n,k),u)return k;h=dt.event&&f.global,h&&0===dt.active++&&dt.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!Le.test(f.type),r=f.url.replace(Ae,""),f.hasContent?f.data&&f.processData&&0===(f.contentType||"").indexOf("application/x-www-form-urlencoded")&&(f.data=f.data.replace(De,"+")):(p=f.url.slice(r.length),f.data&&(r+=($e.test(r)?"&":"?")+f.data,delete f.data),f.cache===!1&&(r=r.replace(je,""),p=($e.test(r)?"&":"?")+"_="+Ce++ +p),f.url=r+p),f.ifModified&&(dt.lastModified[r]&&k.setRequestHeader("If-Modified-Since",dt.lastModified[r]),dt.etag[r]&&k.setRequestHeader("If-None-Match",dt.etag[r])),(f.data&&f.hasContent&&f.contentType!==!1||n.contentType)&&k.setRequestHeader("Content-Type",f.contentType),k.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+He+"; q=0.01":""):f.accepts["*"]);for(d in f.headers)k.setRequestHeader(d,f.headers[d]);if(f.beforeSend&&(f.beforeSend.call(g,k,f)===!1||u))return k.abort();if(_="abort",y.add(f.complete),k.done(f.success),k.fail(f.error),o=Q(qe,f,n,k)){if(k.readyState=1,h&&m.trigger("ajaxSend",[k,f]),u)return k;f.async&&f.timeout>0&&(l=t.setTimeout(function(){k.abort("timeout")},f.timeout));try{u=!1,o.send(x,i)}catch(C){if(u)throw C;i(-1,C)}}else i(-1,"No Transport");return k},getJSON:function(t,e,n){return dt.get(t,e,n,"json")},getScript:function(t,e){return dt.get(t,void 0,e,"script")}}),dt.each(["get","post"],function(t,e){dt[e]=function(t,n,i,o){return dt.isFunction(n)&&(o=o||i,i=n,n=void 0),dt.ajax(dt.extend({url:t,type:e,dataType:o,data:n,success:i},dt.isPlainObject(t)&&t))}}),dt._evalUrl=function(t){return dt.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},dt.fn.extend({wrapAll:function(t){var e;return this[0]&&(dt.isFunction(t)&&(t=t.call(this[0])),e=dt(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this},wrapInner:function(t){return dt.isFunction(t)?this.each(function(e){dt(this).wrapInner(t.call(this,e))}):this.each(function(){var e=dt(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)})},wrap:function(t){var e=dt.isFunction(t);return this.each(function(n){dt(this).wrapAll(e?t.call(this,n):t)})},unwrap:function(t){return this.parent(t).not("body").each(function(){dt(this).replaceWith(this.childNodes)}),this}}),dt.expr.pseudos.hidden=function(t){return!dt.expr.pseudos.visible(t)},dt.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},dt.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(e){}};var Be={0:200,1223:204},ze=dt.ajaxSettings.xhr();ut.cors=!!ze&&"withCredentials"in ze,ut.ajax=ze=!!ze,dt.ajaxTransport(function(e){var n,i;if(ut.cors||ze&&!e.crossDomain)return{send:function(o,r){var s,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(s in e.xhrFields)a[s]=e.xhrFields[s];e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");for(s in o)a.setRequestHeader(s,o[s]);n=function(t){return function(){n&&(n=i=a.onload=a.onerror=a.onabort=a.onreadystatechange=null,"abort"===t?a.abort():"error"===t?"number"!=typeof a.status?r(0,"error"):r(a.status,a.statusText):r(Be[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=n(),i=a.onerror=n("error"),void 0!==a.onabort?a.onabort=i:a.onreadystatechange=function(){4===a.readyState&&t.setTimeout(function(){n&&i()})},n=n("abort");try{a.send(e.hasContent&&e.data||null)}catch(l){if(n)throw l}},abort:function(){n&&n()}}}),dt.ajaxPrefilter(function(t){t.crossDomain&&(t.contents.script=!1)}),dt.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return dt.globalEval(t),t}}}),dt.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),dt.ajaxTransport("script",function(t){if(t.crossDomain){var e,n;return{send:function(i,o){e=dt("<script>").prop({charset:t.scriptCharset,src:t.url}).on("load error",n=function(t){e.remove(),n=null,t&&o("error"===t.type?404:200,t.type)}),Z.head.appendChild(e[0])},abort:function(){n&&n()}}}});var Me=[],We=/(=)\?(?=&|$)|\?\?/;dt.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Me.pop()||dt.expando+"_"+Ce++;return this[t]=!0,t}}),dt.ajaxPrefilter("json jsonp",function(e,n,i){var o,r,s,a=e.jsonp!==!1&&(We.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&We.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return o=e.jsonpCallback=dt.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(We,"$1"+o):e.jsonp!==!1&&(e.url+=($e.test(e.url)?"&":"?")+e.jsonp+"="+o),e.converters["script json"]=function(){return s||dt.error(o+" was not called"),s[0]},e.dataTypes[0]="json",r=t[o],t[o]=function(){s=arguments},i.always(function(){void 0===r?dt(t).removeProp(o):t[o]=r,e[o]&&(e.jsonpCallback=n.jsonpCallback,Me.push(o)),s&&dt.isFunction(r)&&r(s[0]),s=r=void 0}),"script"}),ut.createHTMLDocument=function(){var t=Z.implementation.createHTMLDocument("").body;return t.innerHTML="<form></form><form></form>",2===t.childNodes.length}(),dt.parseHTML=function(t,e,n){if("string"!=typeof t)return[];"boolean"==typeof e&&(n=e,e=!1);var i,o,r;return e||(ut.createHTMLDocument?(e=Z.implementation.createHTMLDocument(""),i=e.createElement("base"),i.href=Z.location.href,e.head.appendChild(i)):e=Z),o=wt.exec(t),r=!n&&[],o?[e.createElement(o[1])]:(o=y([t],e,r),r&&r.length&&dt(r).remove(),dt.merge([],o.childNodes))},dt.fn.load=function(t,e,n){var i,o,r,s=this,a=t.indexOf(" ");return a>-1&&(i=dt.trim(t.slice(a)),t=t.slice(0,a)),dt.isFunction(e)?(n=e,e=void 0):e&&"object"==typeof e&&(o="POST"),s.length>0&&dt.ajax({url:t,type:o||"GET",dataType:"html",data:e}).done(function(t){r=arguments,s.html(i?dt("<div>").append(dt.parseHTML(t)).find(i):t)}).always(n&&function(t,e){s.each(function(){n.apply(this,r||[t.responseText,e,t])})}),this},dt.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){dt.fn[e]=function(t){return this.on(e,t)}}),dt.expr.pseudos.animated=function(t){return dt.grep(dt.timers,function(e){return t===e.elem}).length},dt.offset={setOffset:function(t,e,n){var i,o,r,s,a,l,c,u=dt.css(t,"position"),h=dt(t),d={};"static"===u&&(t.style.position="relative"),a=h.offset(),r=dt.css(t,"top"),l=dt.css(t,"left"),c=("absolute"===u||"fixed"===u)&&(r+l).indexOf("auto")>-1,c?(i=h.position(),s=i.top,o=i.left):(s=parseFloat(r)||0,o=parseFloat(l)||0),dt.isFunction(e)&&(e=e.call(t,n,dt.extend({},a))),null!=e.top&&(d.top=e.top-a.top+s),null!=e.left&&(d.left=e.left-a.left+o),"using"in e?e.using.call(t,d):h.css(d)}},dt.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){dt.offset.setOffset(this,t,e)});var e,n,i,o,r=this[0];return r?r.getClientRects().length?(i=r.getBoundingClientRect(),i.width||i.height?(o=r.ownerDocument,n=X(o),e=o.documentElement,{top:i.top+n.pageYOffset-e.clientTop,left:i.left+n.pageXOffset-e.clientLeft}):i):{top:0,left:0}:void 0},position:function(){if(this[0]){var t,e,n=this[0],i={top:0,left:0};return"fixed"===dt.css(n,"position")?e=n.getBoundingClientRect():(t=this.offsetParent(),e=this.offset(),dt.nodeName(t[0],"html")||(i=t.offset()),i={top:i.top+dt.css(t[0],"borderTopWidth",!0),left:i.left+dt.css(t[0],"borderLeftWidth",!0)}),{top:e.top-i.top-dt.css(n,"marginTop",!0),left:e.left-i.left-dt.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent;t&&"static"===dt.css(t,"position");)t=t.offsetParent;return t||Vt})}}),dt.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,e){var n="pageYOffset"===e;dt.fn[t]=function(i){return At(this,function(t,i,o){var r=X(t);return void 0===o?r?r[e]:t[i]:void(r?r.scrollTo(n?r.pageXOffset:o,n?o:r.pageYOffset):t[i]=o)},t,i,arguments.length)}}),dt.each(["top","left"],function(t,e){dt.cssHooks[e]=A(ut.pixelPosition,function(t,n){if(n)return n=D(t,e),oe.test(n)?dt(t).position()[e]+"px":n})}),dt.each({Height:"height",Width:"width"},function(t,e){dt.each({padding:"inner"+t,content:e,"":"outer"+t},function(n,i){dt.fn[i]=function(o,r){var s=arguments.length&&(n||"boolean"!=typeof o),a=n||(o===!0||r===!0?"margin":"border");return At(this,function(e,n,o){var r;return dt.isWindow(e)?0===i.indexOf("outer")?e["inner"+t]:e.document.documentElement["client"+t]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+t],r["scroll"+t],e.body["offset"+t],r["offset"+t],r["client"+t])):void 0===o?dt.css(e,n,a):dt.style(e,n,o,a)},e,s?o:void 0,s)}})}),dt.fn.extend({bind:function(t,e,n){return this.on(t,null,e,n)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,n,i){return this.on(e,t,n,i)},undelegate:function(t,e,n){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",n)}}),dt.parseJSON=JSON.parse,"function"==typeof define&&define.amd&&define("jquery",[],function(){return dt});var Ue=t.jQuery,Ke=t.$;return dt.noConflict=function(e){return t.$===dt&&(t.$=Ke),e&&t.jQuery===dt&&(t.jQuery=Ue),dt},e||(t.jQuery=t.$=dt),dt}),"undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(t){"use strict";var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||e[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(t){"use strict";function e(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in e)if(void 0!==t.style[n])return{end:e[n]};return!1}t.fn.emulateTransitionEnd=function(e){var n=!1,i=this;t(this).one("bsTransitionEnd",function(){n=!0});var o=function(){n||t(i).trigger(t.support.transition.end)};return setTimeout(o,e),this},t(function(){t.support.transition=e(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,delegateType:t.support.transition.end,handle:function(e){if(t(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var n=t(this),o=n.data("bs.alert");o||n.data("bs.alert",o=new i(this)),"string"==typeof e&&o[e].call(n)})}var n='[data-dismiss="alert"]',i=function(e){t(e).on("click",n,this.close)};i.VERSION="3.3.7",i.TRANSITION_DURATION=150,i.prototype.close=function(e){function n(){s.detach().trigger("closed.bs.alert").remove()}var o=t(this),r=o.attr("data-target");r||(r=o.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));var s=t("#"===r?[]:r);e&&e.preventDefault(),s.length||(s=o.closest(".alert")),s.trigger(e=t.Event("close.bs.alert")),e.isDefaultPrevented()||(s.removeClass("in"),t.support.transition&&s.hasClass("fade")?s.one("bsTransitionEnd",n).emulateTransitionEnd(i.TRANSITION_DURATION):n())};var o=t.fn.alert;t.fn.alert=e,t.fn.alert.Constructor=i,t.fn.alert.noConflict=function(){return t.fn.alert=o,this},t(document).on("click.bs.alert.data-api",n,i.prototype.close)}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),o=i.data("bs.button"),r="object"==typeof e&&e;o||i.data("bs.button",o=new n(this,r)),"toggle"==e?o.toggle():e&&o.setState(e)})}var n=function(e,i){this.$element=t(e),this.options=t.extend({},n.DEFAULTS,i),this.isLoading=!1};n.VERSION="3.3.7",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(e){var n="disabled",i=this.$element,o=i.is("input")?"val":"html",r=i.data();e+="Text",null==r.resetText&&i.data("resetText",i[o]()),setTimeout(t.proxy(function(){i[o](null==r[e]?this.options[e]:r[e]),"loadingText"==e?(this.isLoading=!0,i.addClass(n).attr(n,n).prop(n,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(n).removeAttr(n).prop(n,!1))},this),0)},n.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var n=this.$element.find("input");"radio"==n.prop("type")?(n.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==n.prop("type")&&(n.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),n.prop("checked",this.$element.hasClass("active")),t&&n.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var i=t.fn.button;t.fn.button=e,t.fn.button.Constructor=n,t.fn.button.noConflict=function(){return t.fn.button=i,this},t(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(n){var i=t(n.target).closest(".btn");e.call(i,"toggle"),t(n.target).is('input[type="radio"], input[type="checkbox"]')||(n.preventDefault(),i.is("input,button")?i.trigger("focus"):i.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(e){t(e.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(e.type))})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),o=i.data("bs.carousel"),r=t.extend({},n.DEFAULTS,i.data(),"object"==typeof e&&e),s="string"==typeof e?e:r.slide;o||i.data("bs.carousel",o=new n(this,r)),"number"==typeof e?o.to(e):s?o[s]():r.interval&&o.pause().cycle()})}var n=function(e,n){this.$element=t(e),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",t.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",t.proxy(this.pause,this)).on("mouseleave.bs.carousel",t.proxy(this.cycle,this))};n.VERSION="3.3.7",n.TRANSITION_DURATION=600,n.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},n.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},n.prototype.cycle=function(e){return e||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(t.proxy(this.next,this),this.options.interval)),this},n.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},n.prototype.getItemForDirection=function(t,e){var n=this.getItemIndex(e),i="prev"==t&&0===n||"next"==t&&n==this.$items.length-1;if(i&&!this.options.wrap)return e;var o="prev"==t?-1:1,r=(n+o)%this.$items.length;return this.$items.eq(r)},n.prototype.to=function(t){var e=this,n=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):n==t?this.pause().cycle():this.slide(t>n?"next":"prev",this.$items.eq(t))},n.prototype.pause=function(e){return e||(this.paused=!0),this.$element.find(".next, .prev").length&&t.support.transition&&(this.$element.trigger(t.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},n.prototype.next=function(){if(!this.sliding)return this.slide("next")},n.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},n.prototype.slide=function(e,i){var o=this.$element.find(".item.active"),r=i||this.getItemForDirection(e,o),s=this.interval,a="next"==e?"left":"right",l=this;if(r.hasClass("active"))return this.sliding=!1;var c=r[0],u=t.Event("slide.bs.carousel",{relatedTarget:c,direction:a});if(this.$element.trigger(u),!u.isDefaultPrevented()){if(this.sliding=!0,s&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=t(this.$indicators.children()[this.getItemIndex(r)]);h&&h.addClass("active")}var d=t.Event("slid.bs.carousel",{relatedTarget:c,direction:a});return t.support.transition&&this.$element.hasClass("slide")?(r.addClass(e),r[0].offsetWidth,o.addClass(a),r.addClass(a),o.one("bsTransitionEnd",function(){r.removeClass([e,a].join(" ")).addClass("active"),o.removeClass(["active",a].join(" ")),l.sliding=!1,setTimeout(function(){l.$element.trigger(d)},0)}).emulateTransitionEnd(n.TRANSITION_DURATION)):(o.removeClass("active"),r.addClass("active"),this.sliding=!1,this.$element.trigger(d)),s&&this.cycle(),this}};var i=t.fn.carousel;t.fn.carousel=e,t.fn.carousel.Constructor=n,t.fn.carousel.noConflict=function(){return t.fn.carousel=i,this};var o=function(n){var i,o=t(this),r=t(o.attr("data-target")||(i=o.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,""));if(r.hasClass("carousel")){var s=t.extend({},r.data(),o.data()),a=o.attr("data-slide-to");a&&(s.interval=!1),e.call(r,s),a&&r.data("bs.carousel").to(a),n.preventDefault()}};t(document).on("click.bs.carousel.data-api","[data-slide]",o).on("click.bs.carousel.data-api","[data-slide-to]",o),t(window).on("load",function(){t('[data-ride="carousel"]').each(function(){var n=t(this);e.call(n,n.data())})})}(jQuery),+function(t){"use strict";function e(e){var n,i=e.attr("data-target")||(n=e.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"");return t(i)}function n(e){return this.each(function(){var n=t(this),o=n.data("bs.collapse"),r=t.extend({},i.DEFAULTS,n.data(),"object"==typeof e&&e);!o&&r.toggle&&/show|hide/.test(e)&&(r.toggle=!1),o||n.data("bs.collapse",o=new i(this,r)),"string"==typeof e&&o[e]()})}var i=function(e,n){this.$element=t(e),this.options=t.extend({},i.DEFAULTS,n),this.$trigger=t('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};i.VERSION="3.3.7",i.TRANSITION_DURATION=350,i.DEFAULTS={toggle:!0},i.prototype.dimension=function(){var t=this.$element.hasClass("width");return t?"width":"height"},i.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var e,o=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(o&&o.length&&(e=o.data("bs.collapse"),e&&e.transitioning))){var r=t.Event("show.bs.collapse");if(this.$element.trigger(r),!r.isDefaultPrevented()){
 o&&o.length&&(n.call(o,"hide"),e||o.data("bs.collapse",null));var s=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[s](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var a=function(){this.$element.removeClass("collapsing").addClass("collapse in")[s](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!t.support.transition)return a.call(this);var l=t.camelCase(["scroll",s].join("-"));this.$element.one("bsTransitionEnd",t.proxy(a,this)).emulateTransitionEnd(i.TRANSITION_DURATION)[s](this.$element[0][l])}}}},i.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var e=t.Event("hide.bs.collapse");if(this.$element.trigger(e),!e.isDefaultPrevented()){var n=this.dimension();this.$element[n](this.$element[n]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var o=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return t.support.transition?void this.$element[n](0).one("bsTransitionEnd",t.proxy(o,this)).emulateTransitionEnd(i.TRANSITION_DURATION):o.call(this)}}},i.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},i.prototype.getParent=function(){return t(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(t.proxy(function(n,i){var o=t(i);this.addAriaAndCollapsedClass(e(o),o)},this)).end()},i.prototype.addAriaAndCollapsedClass=function(t,e){var n=t.hasClass("in");t.attr("aria-expanded",n),e.toggleClass("collapsed",!n).attr("aria-expanded",n)};var o=t.fn.collapse;t.fn.collapse=n,t.fn.collapse.Constructor=i,t.fn.collapse.noConflict=function(){return t.fn.collapse=o,this},t(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(i){var o=t(this);o.attr("data-target")||i.preventDefault();var r=e(o),s=r.data("bs.collapse"),a=s?"toggle":o.data();n.call(r,a)})}(jQuery),+function(t){"use strict";function e(e){var n=e.attr("data-target");n||(n=e.attr("href"),n=n&&/#[A-Za-z]/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var i=n&&t(n);return i&&i.length?i:e.parent()}function n(n){n&&3===n.which||(t(o).remove(),t(r).each(function(){var i=t(this),o=e(i),r={relatedTarget:this};o.hasClass("open")&&(n&&"click"==n.type&&/input|textarea/i.test(n.target.tagName)&&t.contains(o[0],n.target)||(o.trigger(n=t.Event("hide.bs.dropdown",r)),n.isDefaultPrevented()||(i.attr("aria-expanded","false"),o.removeClass("open").trigger(t.Event("hidden.bs.dropdown",r)))))}))}function i(e){return this.each(function(){var n=t(this),i=n.data("bs.dropdown");i||n.data("bs.dropdown",i=new s(this)),"string"==typeof e&&i[e].call(n)})}var o=".dropdown-backdrop",r='[data-toggle="dropdown"]',s=function(e){t(e).on("click.bs.dropdown",this.toggle)};s.VERSION="3.3.7",s.prototype.toggle=function(i){var o=t(this);if(!o.is(".disabled, :disabled")){var r=e(o),s=r.hasClass("open");if(n(),!s){"ontouchstart"in document.documentElement&&!r.closest(".navbar-nav").length&&t(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(t(this)).on("click",n);var a={relatedTarget:this};if(r.trigger(i=t.Event("show.bs.dropdown",a)),i.isDefaultPrevented())return;o.trigger("focus").attr("aria-expanded","true"),r.toggleClass("open").trigger(t.Event("shown.bs.dropdown",a))}return!1}},s.prototype.keydown=function(n){if(/(38|40|27|32)/.test(n.which)&&!/input|textarea/i.test(n.target.tagName)){var i=t(this);if(n.preventDefault(),n.stopPropagation(),!i.is(".disabled, :disabled")){var o=e(i),s=o.hasClass("open");if(!s&&27!=n.which||s&&27==n.which)return 27==n.which&&o.find(r).trigger("focus"),i.trigger("click");var a=" li:not(.disabled):visible a",l=o.find(".dropdown-menu"+a);if(l.length){var c=l.index(n.target);38==n.which&&c>0&&c--,40==n.which&&c<l.length-1&&c++,~c||(c=0),l.eq(c).trigger("focus")}}}};var a=t.fn.dropdown;t.fn.dropdown=i,t.fn.dropdown.Constructor=s,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=a,this},t(document).on("click.bs.dropdown.data-api",n).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",r,s.prototype.toggle).on("keydown.bs.dropdown.data-api",r,s.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",s.prototype.keydown)}(jQuery),+function(t){"use strict";function e(e,i){return this.each(function(){var o=t(this),r=o.data("bs.modal"),s=t.extend({},n.DEFAULTS,o.data(),"object"==typeof e&&e);r||o.data("bs.modal",r=new n(this,s)),"string"==typeof e?r[e](i):s.show&&r.show(i)})}var n=function(e,n){this.options=n,this.$body=t(document.body),this.$element=t(e),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,t.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};n.VERSION="3.3.7",n.TRANSITION_DURATION=300,n.BACKDROP_TRANSITION_DURATION=150,n.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},n.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},n.prototype.show=function(e){var i=this,o=t.Event("show.bs.modal",{relatedTarget:e});this.$element.trigger(o),this.isShown||o.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',t.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){i.$element.one("mouseup.dismiss.bs.modal",function(e){t(e.target).is(i.$element)&&(i.ignoreBackdropClick=!0)})}),this.backdrop(function(){var o=t.support.transition&&i.$element.hasClass("fade");i.$element.parent().length||i.$element.appendTo(i.$body),i.$element.show().scrollTop(0),i.adjustDialog(),o&&i.$element[0].offsetWidth,i.$element.addClass("in"),i.enforceFocus();var r=t.Event("shown.bs.modal",{relatedTarget:e});o?i.$dialog.one("bsTransitionEnd",function(){i.$element.trigger("focus").trigger(r)}).emulateTransitionEnd(n.TRANSITION_DURATION):i.$element.trigger("focus").trigger(r)}))},n.prototype.hide=function(e){e&&e.preventDefault(),e=t.Event("hide.bs.modal"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),t(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),t.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",t.proxy(this.hideModal,this)).emulateTransitionEnd(n.TRANSITION_DURATION):this.hideModal())},n.prototype.enforceFocus=function(){t(document).off("focusin.bs.modal").on("focusin.bs.modal",t.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},n.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",t.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},n.prototype.resize=function(){this.isShown?t(window).on("resize.bs.modal",t.proxy(this.handleUpdate,this)):t(window).off("resize.bs.modal")},n.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},n.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},n.prototype.backdrop=function(e){var i=this,o=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var r=t.support.transition&&o;if(this.$backdrop=t(document.createElement("div")).addClass("modal-backdrop "+o).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",t.proxy(function(t){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!e)return;r?this.$backdrop.one("bsTransitionEnd",e).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION):e()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var s=function(){i.removeBackdrop(),e&&e()};t.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",s).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION):s()}else e&&e()},n.prototype.handleUpdate=function(){this.adjustDialog()},n.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},n.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},n.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},n.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",t+this.scrollbarWidth)},n.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},n.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var i=t.fn.modal;t.fn.modal=e,t.fn.modal.Constructor=n,t.fn.modal.noConflict=function(){return t.fn.modal=i,this},t(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(n){var i=t(this),o=i.attr("href"),r=t(i.attr("data-target")||o&&o.replace(/.*(?=#[^\s]+$)/,"")),s=r.data("bs.modal")?"toggle":t.extend({remote:!/#/.test(o)&&o},r.data(),i.data());i.is("a")&&n.preventDefault(),r.one("show.bs.modal",function(t){t.isDefaultPrevented()||r.one("hidden.bs.modal",function(){i.is(":visible")&&i.trigger("focus")})}),e.call(r,s,this)})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),o=i.data("bs.tooltip"),r="object"==typeof e&&e;!o&&/destroy|hide/.test(e)||(o||i.data("bs.tooltip",o=new n(this,r)),"string"==typeof e&&o[e]())})}var n=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};n.VERSION="3.3.7",n.TRANSITION_DURATION=150,n.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},n.prototype.init=function(e,n,i){if(this.enabled=!0,this.type=e,this.$element=t(n),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&t(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var o=this.options.trigger.split(" "),r=o.length;r--;){var s=o[r];if("click"==s)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",l="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},n.prototype.getDefaults=function(){return n.DEFAULTS},n.prototype.getOptions=function(e){return e=t.extend({},this.getDefaults(),this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},n.prototype.getDelegateOptions=function(){var e={},n=this.getDefaults();return this._options&&t.each(this._options,function(t,i){n[t]!=i&&(e[t]=i)}),e},n.prototype.enter=function(e){var n=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);return n||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n)),e instanceof t.Event&&(n.inState["focusin"==e.type?"focus":"hover"]=!0),n.tip().hasClass("in")||"in"==n.hoverState?void(n.hoverState="in"):(clearTimeout(n.timeout),n.hoverState="in",n.options.delay&&n.options.delay.show?void(n.timeout=setTimeout(function(){"in"==n.hoverState&&n.show()},n.options.delay.show)):n.show())},n.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},n.prototype.leave=function(e){var n=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(n||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n)),e instanceof t.Event&&(n.inState["focusout"==e.type?"focus":"hover"]=!1),!n.isInStateTrue())return clearTimeout(n.timeout),n.hoverState="out",n.options.delay&&n.options.delay.hide?void(n.timeout=setTimeout(function(){"out"==n.hoverState&&n.hide()},n.options.delay.hide)):n.hide()},n.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var i=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!i)return;var o=this,r=this.tip(),s=this.getUID(this.type);this.setContent(),r.attr("id",s),this.$element.attr("aria-describedby",s),this.options.animation&&r.addClass("fade");var a="function"==typeof this.options.placement?this.options.placement.call(this,r[0],this.$element[0]):this.options.placement,l=/\s?auto?\s?/i,c=l.test(a);c&&(a=a.replace(l,"")||"top"),r.detach().css({top:0,left:0,display:"block"}).addClass(a).data("bs."+this.type,this),this.options.container?r.appendTo(this.options.container):r.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var u=this.getPosition(),h=r[0].offsetWidth,d=r[0].offsetHeight;if(c){var p=a,f=this.getPosition(this.$viewport);a="bottom"==a&&u.bottom+d>f.bottom?"top":"top"==a&&u.top-d<f.top?"bottom":"right"==a&&u.right+h>f.width?"left":"left"==a&&u.left-h<f.left?"right":a,r.removeClass(p).addClass(a)}var g=this.getCalculatedOffset(a,u,h,d);this.applyPlacement(g,a);var m=function(){var t=o.hoverState;o.$element.trigger("shown.bs."+o.type),o.hoverState=null,"out"==t&&o.leave(o)};t.support.transition&&this.$tip.hasClass("fade")?r.one("bsTransitionEnd",m).emulateTransitionEnd(n.TRANSITION_DURATION):m()}},n.prototype.applyPlacement=function(e,n){var i=this.tip(),o=i[0].offsetWidth,r=i[0].offsetHeight,s=parseInt(i.css("margin-top"),10),a=parseInt(i.css("margin-left"),10);isNaN(s)&&(s=0),isNaN(a)&&(a=0),e.top+=s,e.left+=a,t.offset.setOffset(i[0],t.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),i.addClass("in");var l=i[0].offsetWidth,c=i[0].offsetHeight;"top"==n&&c!=r&&(e.top=e.top+r-c);var u=this.getViewportAdjustedDelta(n,e,l,c);u.left?e.left+=u.left:e.top+=u.top;var h=/top|bottom/.test(n),d=h?2*u.left-o+l:2*u.top-r+c,p=h?"offsetWidth":"offsetHeight";i.offset(e),this.replaceArrow(d,i[0][p],h)},n.prototype.replaceArrow=function(t,e,n){this.arrow().css(n?"left":"top",50*(1-t/e)+"%").css(n?"top":"left","")},n.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},n.prototype.hide=function(e){function i(){"in"!=o.hoverState&&r.detach(),o.$element&&o.$element.removeAttr("aria-describedby").trigger("hidden.bs."+o.type),e&&e()}var o=this,r=t(this.$tip),s=t.Event("hide.bs."+this.type);if(this.$element.trigger(s),!s.isDefaultPrevented())return r.removeClass("in"),t.support.transition&&r.hasClass("fade")?r.one("bsTransitionEnd",i).emulateTransitionEnd(n.TRANSITION_DURATION):i(),this.hoverState=null,this},n.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},n.prototype.hasContent=function(){return this.getTitle()},n.prototype.getPosition=function(e){e=e||this.$element;var n=e[0],i="BODY"==n.tagName,o=n.getBoundingClientRect();null==o.width&&(o=t.extend({},o,{width:o.right-o.left,height:o.bottom-o.top}));var r=window.SVGElement&&n instanceof window.SVGElement,s=i?{top:0,left:0}:r?null:e.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop()},l=i?{width:t(window).width(),height:t(window).height()}:null;return t.extend({},o,a,l,s)},n.prototype.getCalculatedOffset=function(t,e,n,i){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-n/2}:"top"==t?{top:e.top-i,left:e.left+e.width/2-n/2}:"left"==t?{top:e.top+e.height/2-i/2,left:e.left-n}:{top:e.top+e.height/2-i/2,left:e.left+e.width}},n.prototype.getViewportAdjustedDelta=function(t,e,n,i){var o={top:0,left:0};if(!this.$viewport)return o;var r=this.options.viewport&&this.options.viewport.padding||0,s=this.getPosition(this.$viewport);if(/right|left/.test(t)){var a=e.top-r-s.scroll,l=e.top+r-s.scroll+i;a<s.top?o.top=s.top-a:l>s.top+s.height&&(o.top=s.top+s.height-l)}else{var c=e.left-r,u=e.left+r+n;c<s.left?o.left=s.left-c:u>s.right&&(o.left=s.left+s.width-u)}return o},n.prototype.getTitle=function(){var t,e=this.$element,n=this.options;return t=e.attr("data-original-title")||("function"==typeof n.title?n.title.call(e[0]):n.title)},n.prototype.getUID=function(t){do t+=~~(1e6*Math.random());while(document.getElementById(t));return t},n.prototype.tip=function(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},n.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},n.prototype.enable=function(){this.enabled=!0},n.prototype.disable=function(){this.enabled=!1},n.prototype.toggleEnabled=function(){this.enabled=!this.enabled},n.prototype.toggle=function(e){var n=this;e&&(n=t(e.currentTarget).data("bs."+this.type),n||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n))),e?(n.inState.click=!n.inState.click,n.isInStateTrue()?n.enter(n):n.leave(n)):n.tip().hasClass("in")?n.leave(n):n.enter(n)},n.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})};var i=t.fn.tooltip;t.fn.tooltip=e,t.fn.tooltip.Constructor=n,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=i,this}}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),o=i.data("bs.popover"),r="object"==typeof e&&e;!o&&/destroy|hide/.test(e)||(o||i.data("bs.popover",o=new n(this,r)),"string"==typeof e&&o[e]())})}var n=function(t,e){this.init("popover",t,e)};if(!t.fn.tooltip)throw new Error("Popover requires tooltip.js");n.VERSION="3.3.7",n.DEFAULTS=t.extend({},t.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),n.prototype=t.extend({},t.fn.tooltip.Constructor.prototype),n.prototype.constructor=n,n.prototype.getDefaults=function(){return n.DEFAULTS},n.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),n=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof n?"html":"append":"text"](n),t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},n.prototype.hasContent=function(){return this.getTitle()||this.getContent()},n.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},n.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var i=t.fn.popover;t.fn.popover=e,t.fn.popover.Constructor=n,t.fn.popover.noConflict=function(){return t.fn.popover=i,this}}(jQuery),+function(t){"use strict";function e(n,i){this.$body=t(document.body),this.$scrollElement=t(t(n).is(document.body)?window:n),this.options=t.extend({},e.DEFAULTS,i),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",t.proxy(this.process,this)),this.refresh(),this.process()}function n(n){return this.each(function(){var i=t(this),o=i.data("bs.scrollspy"),r="object"==typeof n&&n;o||i.data("bs.scrollspy",o=new e(this,r)),"string"==typeof n&&o[n]()})}e.VERSION="3.3.7",e.DEFAULTS={offset:10},e.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},e.prototype.refresh=function(){var e=this,n="offset",i=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),t.isWindow(this.$scrollElement[0])||(n="position",i=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var e=t(this),o=e.data("target")||e.attr("href"),r=/^#./.test(o)&&t(o);return r&&r.length&&r.is(":visible")&&[[r[n]().top+i,o]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){e.offsets.push(this[0]),e.targets.push(this[1])})},e.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,n=this.getScrollHeight(),i=this.options.offset+n-this.$scrollElement.height(),o=this.offsets,r=this.targets,s=this.activeTarget;if(this.scrollHeight!=n&&this.refresh(),e>=i)return s!=(t=r[r.length-1])&&this.activate(t);if(s&&e<o[0])return this.activeTarget=null,this.clear();for(t=o.length;t--;)s!=r[t]&&e>=o[t]&&(void 0===o[t+1]||e<o[t+1])&&this.activate(r[t])},e.prototype.activate=function(e){this.activeTarget=e,this.clear();var n=this.selector+'[data-target="'+e+'"],'+this.selector+'[href="'+e+'"]',i=t(n).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")},e.prototype.clear=function(){t(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var i=t.fn.scrollspy;t.fn.scrollspy=n,t.fn.scrollspy.Constructor=e,t.fn.scrollspy.noConflict=function(){return t.fn.scrollspy=i,this},t(window).on("load.bs.scrollspy.data-api",function(){t('[data-spy="scroll"]').each(function(){var e=t(this);n.call(e,e.data())})})}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),o=i.data("bs.tab");o||i.data("bs.tab",o=new n(this)),"string"==typeof e&&o[e]()})}var n=function(e){this.element=t(e)};n.VERSION="3.3.7",n.TRANSITION_DURATION=150,n.prototype.show=function(){var e=this.element,n=e.closest("ul:not(.dropdown-menu)"),i=e.data("target");if(i||(i=e.attr("href"),i=i&&i.replace(/.*(?=#[^\s]*$)/,"")),!e.parent("li").hasClass("active")){var o=n.find(".active:last a"),r=t.Event("hide.bs.tab",{relatedTarget:e[0]}),s=t.Event("show.bs.tab",{relatedTarget:o[0]});if(o.trigger(r),e.trigger(s),!s.isDefaultPrevented()&&!r.isDefaultPrevented()){var a=t(i);this.activate(e.closest("li"),n),this.activate(a,a.parent(),function(){o.trigger({type:"hidden.bs.tab",relatedTarget:e[0]}),e.trigger({type:"shown.bs.tab",relatedTarget:o[0]})})}}},n.prototype.activate=function(e,i,o){function r(){s.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),e.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),a?(e[0].offsetWidth,e.addClass("in")):e.removeClass("fade"),e.parent(".dropdown-menu").length&&e.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),o&&o()}var s=i.find("> .active"),a=o&&t.support.transition&&(s.length&&s.hasClass("fade")||!!i.find("> .fade").length);s.length&&a?s.one("bsTransitionEnd",r).emulateTransitionEnd(n.TRANSITION_DURATION):r(),s.removeClass("in")};var i=t.fn.tab;t.fn.tab=e,t.fn.tab.Constructor=n,t.fn.tab.noConflict=function(){return t.fn.tab=i,this};var o=function(n){n.preventDefault(),e.call(t(this),"show")};t(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',o).on("click.bs.tab.data-api",'[data-toggle="pill"]',o)}(jQuery),+function(t){"use strict";function e(e){return this.each(function(){var i=t(this),o=i.data("bs.affix"),r="object"==typeof e&&e;o||i.data("bs.affix",o=new n(this,r)),"string"==typeof e&&o[e]()})}var n=function(e,i){this.options=t.extend({},n.DEFAULTS,i),this.$target=t(this.options.target).on("scroll.bs.affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(e),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};n.VERSION="3.3.7",n.RESET="affix affix-top affix-bottom",n.DEFAULTS={offset:0,target:window},n.prototype.getState=function(t,e,n,i){var o=this.$target.scrollTop(),r=this.$element.offset(),s=this.$target.height();if(null!=n&&"top"==this.affixed)return o<n&&"top";if("bottom"==this.affixed)return null!=n?!(o+this.unpin<=r.top)&&"bottom":!(o+s<=t-i)&&"bottom";var a=null==this.affixed,l=a?o:r.top,c=a?s:e;return null!=n&&o<=n?"top":null!=i&&l+c>=t-i&&"bottom"},n.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(n.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},n.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},n.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e=this.$element.height(),i=this.options.offset,o=i.top,r=i.bottom,s=Math.max(t(document).height(),t(document.body).height());"object"!=typeof i&&(r=o=i),"function"==typeof o&&(o=i.top(this.$element)),"function"==typeof r&&(r=i.bottom(this.$element));var a=this.getState(s,e,o,r);if(this.affixed!=a){null!=this.unpin&&this.$element.css("top","");var l="affix"+(a?"-"+a:""),c=t.Event(l+".bs.affix");if(this.$element.trigger(c),c.isDefaultPrevented())return;this.affixed=a,this.unpin="bottom"==a?this.getPinnedOffset():null,this.$element.removeClass(n.RESET).addClass(l).trigger(l.replace("affix","affixed")+".bs.affix")}"bottom"==a&&this.$element.offset({top:s-e-r})}};var i=t.fn.affix;t.fn.affix=e,t.fn.affix.Constructor=n,t.fn.affix.noConflict=function(){return t.fn.affix=i,this},t(window).on("load",function(){t('[data-spy="affix"]').each(function(){var n=t(this),i=n.data();i.offset=i.offset||{},null!=i.offsetBottom&&(i.offset.bottom=i.offsetBottom),null!=i.offsetTop&&(i.offset.top=i.offsetTop),e.call(n,i)})})}(jQuery),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t("object"==typeof exports?require("jquery"):jQuery)}(function(t){"use strict";var e=function(e,n){var i=["autofocus","savable","hideable","width","height","resize","iconlibrary","language","footer","fullscreen","hiddenButtons","disabledButtons"];t.each(i,function(i,o){"undefined"!=typeof t(e).data(o)&&(n="object"==typeof n?n:{},n[o]=t(e).data(o))}),this.$ns="bootstrap-markdown",this.$element=t(e),this.$editable={el:null,type:null,attrKeys:[],attrValues:[],content:null},this.$options=t.extend(!0,{},t.fn.markdown.defaults,n,this.$element.data("options")),this.$oldContent=null,this.$isPreview=!1,this.$isFullscreen=!1,this.$editor=null,this.$textarea=null,this.$handler=[],this.$callback=[],this.$nextTab=[],this.showEditor()};e.prototype={constructor:e,__alterButtons:function(e,n){var i=this.$handler,o="all"==e,r=this;t.each(i,function(t,i){var s=!0;s=!o&&i.indexOf(e)<0,s===!1&&n(r.$editor.find('button[data-handler="'+i+'"]'))})},__buildButtons:function(e,n){var i,o=this.$ns,r=this.$handler,s=this.$callback;for(i=0;i<e.length;i++){var a,l=e[i];for(a=0;a<l.length;a++){var c,u=l[a].data,h=t("<div/>",{"class":"btn-group"});for(c=0;c<u.length;c++){var d,p,f=u[c],g=o+"-"+f.name,m=this.__getIcon(f.icon),v=f.btnText?f.btnText:"",y=f.btnClass?f.btnClass:"btn",b=f.tabIndex?f.tabIndex:"-1",x="undefined"!=typeof f.hotkey?f.hotkey:"",w="undefined"!=typeof jQuery.hotkeys&&""!==x?" ("+x+")":"";d=t("<button></button>"),d.text(" "+this.__localize(v)).addClass("btn-default btn-sm").addClass(y),y.match(/btn\-(primary|success|info|warning|danger|link)/)&&d.removeClass("btn-default"),d.attr({type:"button",title:this.__localize(f.title)+w,tabindex:b,"data-provider":o,"data-handler":g,"data-hotkey":x}),f.toggle===!0&&d.attr("data-toggle","button"),p=t("<span/>"),p.addClass(m),p.prependTo(d),h.append(d),r.push(g),s.push(f.callback)}n.append(h)}}return n},__setListener:function(){var e="undefined"!=typeof this.$textarea.attr("rows"),n=this.$textarea.val().split("\n").length>5?this.$textarea.val().split("\n").length:"5",i=e?this.$textarea.attr("rows"):n;this.$textarea.attr("rows",i),this.$options.resize&&this.$textarea.css("resize",this.$options.resize),this.$textarea.on({focus:t.proxy(this.focus,this),keyup:t.proxy(this.keyup,this),change:t.proxy(this.change,this),select:t.proxy(this.select,this)}),this.eventSupported("keydown")&&this.$textarea.on("keydown",t.proxy(this.keydown,this)),this.eventSupported("keypress")&&this.$textarea.on("keypress",t.proxy(this.keypress,this)),this.$textarea.data("markdown",this)},__handle:function(e){var n=t(e.currentTarget),i=this.$handler,o=this.$callback,r=n.attr("data-handler"),s=i.indexOf(r),a=o[s];t(e.currentTarget).focus(),a(this),this.change(this),r.indexOf("cmdSave")<0&&this.$textarea.focus(),e.preventDefault()},__localize:function(e){var n=t.fn.markdown.messages,i=this.$options.language;return"undefined"!=typeof n&&"undefined"!=typeof n[i]&&"undefined"!=typeof n[i][e]?n[i][e]:e},__getIcon:function(t){return"object"==typeof t?t[this.$options.iconlibrary]:t},setFullscreen:function(e){var n=this.$editor,i=this.$textarea;e===!0?(n.addClass("md-fullscreen-mode"),t("body").addClass("md-nooverflow"),this.$options.onFullscreen(this)):(n.removeClass("md-fullscreen-mode"),t("body").removeClass("md-nooverflow"),1==this.$isPreview&&this.hidePreview().showPreview()),this.$isFullscreen=e,i.focus()},showEditor:function(){var e,n=this,i=this.$ns,o=this.$element,r=(o.css("height"),o.css("width"),this.$editable),s=this.$handler,a=this.$callback,l=this.$options,c=t("<div/>",{"class":"md-editor",click:function(){n.focus()}});if(null===this.$editor){var u=t("<div/>",{"class":"md-header btn-toolbar"}),h=[];if(l.buttons.length>0&&(h=h.concat(l.buttons[0])),l.additionalButtons.length>0&&t.each(l.additionalButtons[0],function(e,n){var i=t.grep(h,function(t,e){return t.name===n.name});i.length>0?i[0].data=i[0].data.concat(n.data):h.push(l.additionalButtons[0][e])}),l.reorderButtonGroups.length>0&&(h=h.filter(function(t){return l.reorderButtonGroups.indexOf(t.name)>-1}).sort(function(t,e){return l.reorderButtonGroups.indexOf(t.name)<l.reorderButtonGroups.indexOf(e.name)?-1:l.reorderButtonGroups.indexOf(t.name)>l.reorderButtonGroups.indexOf(e.name)?1:0})),h.length>0&&(u=this.__buildButtons([h],u)),
 l.fullscreen.enable&&u.append('<div class="md-controls"><a class="md-control md-control-fullscreen" href="#"><span class="'+this.__getIcon(l.fullscreen.icons.fullscreenOn)+'"></span></a></div>').on("click",".md-control-fullscreen",function(t){t.preventDefault(),n.setFullscreen(!0)}),c.append(u),o.is("textarea"))o.before(c),e=o,e.addClass("md-input"),c.append(e);else{var d="function"==typeof toMarkdown?toMarkdown(o.html()):o.html(),p=t.trim(d);e=t("<textarea/>",{"class":"md-input",val:p}),c.append(e),r.el=o,r.type=o.prop("tagName").toLowerCase(),r.content=o.html(),t(o[0].attributes).each(function(){r.attrKeys.push(this.nodeName),r.attrValues.push(this.nodeValue)}),o.replaceWith(c)}var f=t("<div/>",{"class":"md-footer"}),g=!1,m="";if(l.savable){g=!0;var v="cmdSave";s.push(v),a.push(l.onSave),f.append('<button class="btn btn-success" data-provider="'+i+'" data-handler="'+v+'"><i class="icon icon-white icon-ok"></i> '+this.__localize("Save")+"</button>")}if(m="function"==typeof l.footer?l.footer(this):l.footer,""!==t.trim(m)&&(g=!0,f.append(m)),g&&c.append(f),l.width&&"inherit"!==l.width&&(jQuery.isNumeric(l.width)?(c.css("display","table"),e.css("width",l.width+"px")):c.addClass(l.width)),l.height&&"inherit"!==l.height)if(jQuery.isNumeric(l.height)){var y=l.height;u&&(y=Math.max(0,y-u.outerHeight())),f&&(y=Math.max(0,y-f.outerHeight())),e.css("height",y+"px")}else c.addClass(l.height);this.$editor=c,this.$textarea=e,this.$editable=r,this.$oldContent=this.getContent(),this.__setListener(),this.$editor.attr("id",(new Date).getTime()),this.$editor.on("click",'[data-provider="bootstrap-markdown"]',t.proxy(this.__handle,this)),(this.$element.is(":disabled")||this.$element.is("[readonly]"))&&(this.$editor.addClass("md-editor-disabled"),this.disableButtons("all")),this.eventSupported("keydown")&&"object"==typeof jQuery.hotkeys&&u.find('[data-provider="bootstrap-markdown"]').each(function(){var n=t(this),i=n.attr("data-hotkey");""!==i.toLowerCase()&&e.bind("keydown",i,function(){return n.trigger("click"),!1})}),"preview"===l.initialstate?this.showPreview():"fullscreen"===l.initialstate&&l.fullscreen.enable&&this.setFullscreen(!0)}else this.$editor.show();return l.autofocus&&(this.$textarea.focus(),this.$editor.addClass("active")),l.fullscreen.enable&&l.fullscreen!==!1&&(this.$editor.append('<div class="md-fullscreen-controls"><a href="#" class="exit-fullscreen" title="Exit fullscreen"><span class="'+this.__getIcon(l.fullscreen.icons.fullscreenOff)+'"></span></a></div>'),this.$editor.on("click",".exit-fullscreen",function(t){t.preventDefault(),n.setFullscreen(!1)})),this.hideButtons(l.hiddenButtons),this.disableButtons(l.disabledButtons),l.onShow(this),this},parseContent:function(t){var e,t=t||this.$textarea.val();return e=this.$options.parser?this.$options.parser(t):"object"==typeof markdown?markdown.toHTML(t):"function"==typeof marked?marked(t):t},showPreview:function(){var e,n,i=this.$options,o=this.$textarea,r=o.next(),s=t("<div/>",{"class":"md-preview","data-provider":"markdown-preview"});return 1==this.$isPreview?this:(this.$isPreview=!0,this.disableButtons("all").enableButtons("cmdPreview"),n=i.onPreview(this),e="string"==typeof n?n:this.parseContent(),s.html(e),r&&"md-footer"==r.attr("class")?s.insertBefore(r):o.parent().append(s),s.css({width:o.outerWidth()+"px",height:o.outerHeight()+"px"}),this.$options.resize&&s.css("resize",this.$options.resize),o.hide(),s.data("markdown",this),(this.$element.is(":disabled")||this.$element.is("[readonly]"))&&(this.$editor.addClass("md-editor-disabled"),this.disableButtons("all")),this)},hidePreview:function(){this.$isPreview=!1;var t=this.$editor.find('div[data-provider="markdown-preview"]');return t.remove(),this.enableButtons("all"),this.disableButtons(this.$options.disabledButtons),this.$textarea.show(),this.__setListener(),this},isDirty:function(){return this.$oldContent!=this.getContent()},getContent:function(){return this.$textarea.val()},setContent:function(t){return this.$textarea.val(t),this},findSelection:function(t){var e,n=this.getContent();if(e=n.indexOf(t),e>=0&&t.length>0){var i,o=this.getSelection();return this.setSelection(e,e+t.length),i=this.getSelection(),this.setSelection(o.start,o.end),i}return null},getSelection:function(){var t=this.$textarea[0];return("selectionStart"in t&&function(){var e=t.selectionEnd-t.selectionStart;return{start:t.selectionStart,end:t.selectionEnd,length:e,text:t.value.substr(t.selectionStart,e)}}||function(){return null})()},setSelection:function(t,e){var n=this.$textarea[0];return("selectionStart"in n&&function(){n.selectionStart=t,n.selectionEnd=e}||function(){return null})()},replaceSelection:function(t){var e=this.$textarea[0];return("selectionStart"in e&&function(){return e.value=e.value.substr(0,e.selectionStart)+t+e.value.substr(e.selectionEnd,e.value.length),e.selectionStart=e.value.length,this}||function(){return e.value+=t,jQuery(e)})()},getNextTab:function(){if(0===this.$nextTab.length)return null;var t,e=this.$nextTab.shift();return"function"==typeof e?t=e():"object"==typeof e&&e.length>0&&(t=e),t},setNextTab:function(t,e){if("string"==typeof t){var n=this;this.$nextTab.push(function(){return n.findSelection(t)})}else if("number"==typeof t&&"number"==typeof e){var i=this.getSelection();this.setSelection(t,e),this.$nextTab.push(this.getSelection()),this.setSelection(i.start,i.end)}},__parseButtonNameParam:function(t){return"string"==typeof t?t.split(" "):t},enableButtons:function(e){var n=this.__parseButtonNameParam(e),i=this;return t.each(n,function(t,e){i.__alterButtons(n[t],function(t){t.removeAttr("disabled")})}),this},disableButtons:function(e){var n=this.__parseButtonNameParam(e),i=this;return t.each(n,function(t,e){i.__alterButtons(n[t],function(t){t.attr("disabled","disabled")})}),this},hideButtons:function(e){var n=this.__parseButtonNameParam(e),i=this;return t.each(n,function(t,e){i.__alterButtons(n[t],function(t){t.addClass("hidden")})}),this},showButtons:function(e){var n=this.__parseButtonNameParam(e),i=this;return t.each(n,function(t,e){i.__alterButtons(n[t],function(t){t.removeClass("hidden")})}),this},eventSupported:function(t){var e=t in this.$element;return e||(this.$element.setAttribute(t,"return;"),e="function"==typeof this.$element[t]),e},keyup:function(t){var e=!1;switch(t.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:var n;if(n=this.getNextTab(),null!==n){var i=this;setTimeout(function(){i.setSelection(n.start,n.end)},500),e=!0}else{var o=this.getSelection();o.start==o.end&&o.end==this.getContent().length?e=!1:(this.setSelection(this.getContent().length,this.getContent().length),e=!0)}break;case 13:e=!1;break;case 27:this.$isFullscreen&&this.setFullscreen(!1),e=!1;break;default:e=!1}e&&(t.stopPropagation(),t.preventDefault()),this.$options.onChange(this)},change:function(t){return this.$options.onChange(this),this},select:function(t){return this.$options.onSelect(this),this},focus:function(e){var n=this.$options,i=(n.hideable,this.$editor);return i.addClass("active"),t(document).find(".md-editor").each(function(){if(t(this).attr("id")!==i.attr("id")){var e;e=t(this).find("textarea").data("markdown"),null===e&&(e=t(this).find('div[data-provider="markdown-preview"]').data("markdown")),e&&e.blur()}}),n.onFocus(this),this},blur:function(e){var n=this.$options,i=n.hideable,o=this.$editor,r=this.$editable;if(o.hasClass("active")||0===this.$element.parent().length){if(o.removeClass("active"),i)if(null!==r.el){var s=t("<"+r.type+"/>"),a=this.getContent(),l=this.parseContent(a);t(r.attrKeys).each(function(t,e){s.attr(r.attrKeys[t],r.attrValues[t])}),s.html(l),o.replaceWith(s)}else o.hide();n.onBlur(this)}return this}};var n=t.fn.markdown;t.fn.markdown=function(n){return this.each(function(){var i=t(this),o=i.data("markdown"),r="object"==typeof n&&n;o||i.data("markdown",o=new e(this,r))})},t.fn.markdown.messages={},t.fn.markdown.defaults={autofocus:!1,hideable:!1,savable:!1,width:"inherit",height:"inherit",resize:"none",iconlibrary:"glyph",language:"en",initialstate:"editor",parser:null,buttons:[[{name:"groupFont",data:[{name:"cmdBold",hotkey:"Ctrl+B",title:"Bold",icon:{glyph:"glyphicon glyphicon-bold",fa:"fa fa-bold","fa-3":"icon-bold"},callback:function(t){var e,n,i=t.getSelection(),o=t.getContent();e=0===i.length?t.__localize("strong text"):i.text,"**"===o.substr(i.start-2,2)&&"**"===o.substr(i.end,2)?(t.setSelection(i.start-2,i.end+2),t.replaceSelection(e),n=i.start-2):(t.replaceSelection("**"+e+"**"),n=i.start+2),t.setSelection(n,n+e.length)}},{name:"cmdItalic",title:"Italic",hotkey:"Ctrl+I",icon:{glyph:"glyphicon glyphicon-italic",fa:"fa fa-italic","fa-3":"icon-italic"},callback:function(t){var e,n,i=t.getSelection(),o=t.getContent();e=0===i.length?t.__localize("emphasized text"):i.text,"_"===o.substr(i.start-1,1)&&"_"===o.substr(i.end,1)?(t.setSelection(i.start-1,i.end+1),t.replaceSelection(e),n=i.start-1):(t.replaceSelection("_"+e+"_"),n=i.start+1),t.setSelection(n,n+e.length)}},{name:"cmdHeading",title:"Heading",hotkey:"Ctrl+H",icon:{glyph:"glyphicon glyphicon-header",fa:"fa fa-header","fa-3":"icon-font"},callback:function(t){var e,n,i,o,r=t.getSelection(),s=t.getContent();e=0===r.length?t.__localize("heading text"):r.text+"\n",i=4,"### "===s.substr(r.start-i,i)||(i=3,"###"===s.substr(r.start-i,i))?(t.setSelection(r.start-i,r.end),t.replaceSelection(e),n=r.start-i):r.start>0&&(o=s.substr(r.start-1,1),!!o&&"\n"!=o)?(t.replaceSelection("\n\n### "+e),n=r.start+6):(t.replaceSelection("### "+e),n=r.start+4),t.setSelection(n,n+e.length)}}]},{name:"groupLink",data:[{name:"cmdUrl",title:"URL/Link",hotkey:"Ctrl+L",icon:{glyph:"glyphicon glyphicon-link",fa:"fa fa-link","fa-3":"icon-link"},callback:function(e){var n,i,o,r=e.getSelection();e.getContent();n=0===r.length?e.__localize("enter link description here"):r.text,o=prompt(e.__localize("Insert Hyperlink"),"http://");var s=new RegExp("^((http|https)://|(mailto:)|(//))[a-z0-9]","i");if(null!==o&&""!==o&&"http://"!==o&&s.test(o)){var a=t("<div>"+o+"</div>").text();e.replaceSelection("["+n+"]("+a+")"),i=r.start+1,e.setSelection(i,i+n.length)}}},{name:"cmdImage",title:"Image",hotkey:"Ctrl+G",icon:{glyph:"glyphicon glyphicon-picture",fa:"fa fa-picture-o","fa-3":"icon-picture"},callback:function(e){var n,i,o,r=e.getSelection();e.getContent();n=0===r.length?e.__localize("enter image description here"):r.text,o=prompt(e.__localize("Insert Image Hyperlink"),"http://");var s=new RegExp("^((http|https)://|(//))[a-z0-9]","i");if(null!==o&&""!==o&&"http://"!==o&&s.test(o)){var a=t("<div>"+o+"</div>").text();e.replaceSelection("!["+n+"]("+a+' "'+e.__localize("enter image title here")+'")'),i=r.start+2,e.setNextTab(e.__localize("enter image title here")),e.setSelection(i,i+n.length)}}}]},{name:"groupMisc",data:[{name:"cmdList",hotkey:"Ctrl+U",title:"Unordered List",icon:{glyph:"glyphicon glyphicon-list",fa:"fa fa-list","fa-3":"icon-list-ul"},callback:function(e){var n,i,o=e.getSelection();e.getContent();if(0===o.length)n=e.__localize("list text here"),e.replaceSelection("- "+n),i=o.start+2;else if(o.text.indexOf("\n")<0)n=o.text,e.replaceSelection("- "+n),i=o.start+2;else{var r=[];r=o.text.split("\n"),n=r[0],t.each(r,function(t,e){r[t]="- "+e}),e.replaceSelection("\n\n"+r.join("\n")),i=o.start+4}e.setSelection(i,i+n.length)}},{name:"cmdListO",hotkey:"Ctrl+O",title:"Ordered List",icon:{glyph:"glyphicon glyphicon-th-list",fa:"fa fa-list-ol","fa-3":"icon-list-ol"},callback:function(e){var n,i,o=e.getSelection();e.getContent();if(0===o.length)n=e.__localize("list text here"),e.replaceSelection("1. "+n),i=o.start+3;else if(o.text.indexOf("\n")<0)n=o.text,e.replaceSelection("1. "+n),i=o.start+3;else{var r=[];r=o.text.split("\n"),n=r[0],t.each(r,function(t,e){r[t]="1. "+e}),e.replaceSelection("\n\n"+r.join("\n")),i=o.start+5}e.setSelection(i,i+n.length)}},{name:"cmdCode",hotkey:"Ctrl+K",title:"Code",icon:{glyph:"glyphicon glyphicon-asterisk",fa:"fa fa-code","fa-3":"icon-code"},callback:function(t){var e,n,i=t.getSelection(),o=t.getContent();e=0===i.length?t.__localize("code text here"):i.text,"```\n"===o.substr(i.start-4,4)&&"\n```"===o.substr(i.end,4)?(t.setSelection(i.start-4,i.end+4),t.replaceSelection(e),n=i.start-4):"`"===o.substr(i.start-1,1)&&"`"===o.substr(i.end,1)?(t.setSelection(i.start-1,i.end+1),t.replaceSelection(e),n=i.start-1):o.indexOf("\n")>-1?(t.replaceSelection("```\n"+e+"\n```"),n=i.start+4):(t.replaceSelection("`"+e+"`"),n=i.start+1),t.setSelection(n,n+e.length)}},{name:"cmdQuote",hotkey:"Ctrl+Q",title:"Quote",icon:{glyph:"glyphicon glyphicon-comment",fa:"fa fa-quote-left","fa-3":"icon-quote-left"},callback:function(e){var n,i,o=e.getSelection();e.getContent();if(0===o.length)n=e.__localize("quote here"),e.replaceSelection("> "+n),i=o.start+2;else if(o.text.indexOf("\n")<0)n=o.text,e.replaceSelection("> "+n),i=o.start+2;else{var r=[];r=o.text.split("\n"),n=r[0],t.each(r,function(t,e){r[t]="> "+e}),e.replaceSelection("\n\n"+r.join("\n")),i=o.start+4}e.setSelection(i,i+n.length)}}]},{name:"groupUtil",data:[{name:"cmdPreview",toggle:!0,hotkey:"Ctrl+P",title:"Preview",btnText:"Preview",btnClass:"btn btn-primary btn-sm",icon:{glyph:"glyphicon glyphicon-search",fa:"fa fa-search","fa-3":"icon-search"},callback:function(t){var e=t.$isPreview;e===!1?t.showPreview():t.hidePreview()}}]}]],additionalButtons:[],reorderButtonGroups:[],hiddenButtons:[],disabledButtons:[],footer:"",fullscreen:{enable:!0,icons:{fullscreenOn:{fa:"fa fa-expand",glyph:"glyphicon glyphicon-fullscreen","fa-3":"icon-resize-full"},fullscreenOff:{fa:"fa fa-compress",glyph:"glyphicon glyphicon-fullscreen","fa-3":"icon-resize-small"}}},onShow:function(t){},onPreview:function(t){},onSave:function(t){},onBlur:function(t){},onFocus:function(t){},onChange:function(t){},onFullscreen:function(t){},onSelect:function(t){}},t.fn.markdown.Constructor=e,t.fn.markdown.noConflict=function(){return t.fn.markdown=n,this};var i=function(t){var e=t;return e.data("markdown")?void e.data("markdown").showEditor():void e.markdown()},o=function(e){var n=t(document.activeElement);t(document).find(".md-editor").each(function(){var e=t(this),i=n.closest(".md-editor")[0]===this,o=e.find("textarea").data("markdown")||e.find('div[data-provider="markdown-preview"]').data("markdown");o&&!i&&o.blur()})};t(document).on("click.markdown.data-api",'[data-provide="markdown-editable"]',function(e){i(t(this)),e.preventDefault()}).on("click focusin",function(t){o(t)}).ready(function(){t('textarea[data-provide="markdown"]').each(function(){i(t(this))})})}),function(){function t(t){this.tokens=[],this.tokens.links={},this.options=t||c.defaults,this.rules=u.normal,this.options.gfm&&(this.options.tables?this.rules=u.tables:this.rules=u.gfm)}function e(t,e){if(this.options=e||c.defaults,this.links=t,this.rules=h.normal,this.renderer=this.options.renderer||new n,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 n(t){this.options=t||{}}function i(t){this.tokens=[],this.token=null,this.options=t||c.defaults,this.options.renderer=this.options.renderer||new n,this.renderer=this.options.renderer,this.renderer.options=this.options}function o(t,e){return t.replace(e?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function r(t){return t.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(t,e){return e=e.toLowerCase(),"colon"===e?":":"#"===e.charAt(0)?"x"===e.charAt(1)?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""})}function s(t,e){return t=t.source,e=e||"",function n(i,o){return i?(o=o.source||o,o=o.replace(/(^|[^\[])\^/g,"$1"),t=t.replace(i,o),n):new RegExp(t,e)}}function a(){}function l(t){for(var e,n,i=1;i<arguments.length;i++){e=arguments[i];for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}function c(e,n,r){if(r||"function"==typeof n){r||(r=n,n=null),n=l({},c.defaults,n||{});var s,a,u=n.highlight,h=0;try{s=t.lex(e,n)}catch(d){return r(d)}a=s.length;var p=function(t){if(t)return n.highlight=u,r(t);var e;try{e=i.parse(s,n)}catch(o){t=o}return n.highlight=u,t?r(t):r(null,e)};if(!u||u.length<3)return p();if(delete n.highlight,!a)return p();for(;h<s.length;h++)!function(t){return"code"!==t.type?--a||p():u(t.text,t.lang,function(e,n){return e?p(e):null==n||n===t.text?--a||p():(t.text=n,t.escaped=!0,void(--a||p()))})}(s[h])}else try{return n&&(n=l({},c.defaults,n)),i.parse(t.lex(e,n),n)}catch(d){if(d.message+="\nPlease report this to https://github.com/chjj/marked.",(n||c.defaults).silent)return"<p>An error occured:</p><pre>"+o(d.message+"",!0)+"</pre>";throw d}}var u={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]+/};u.bullet=/(?:[*+-]|\d+\.)/,u.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,u.item=s(u.item,"gm")(/bull/g,u.bullet)(),u.list=s(u.list)(/bull/g,u.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+u.def.source+")")(),u.blockquote=s(u.blockquote)("def",u.def)(),u._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",u.html=s(u.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,u._tag)(),u.paragraph=s(u.paragraph)("hr",u.hr)("heading",u.heading)("lheading",u.lheading)("blockquote",u.blockquote)("tag","<"+u._tag)("def",u.def)(),u.normal=l({},u),u.gfm=l({},u.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),u.gfm.paragraph=s(u.paragraph)("(?!","(?!"+u.gfm.fences.source.replace("\\1","\\2")+"|"+u.list.source.replace("\\1","\\3")+"|")(),u.tables=l({},u.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=u,t.lex=function(e,n){var i=new t(n);return i.lex(e)},t.prototype.lex=function(t){return t=t.replace(/\r\n|\r/g,"\n").replace(/\t/g,"    ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(t,!0)},t.prototype.token=function(t,e,n){for(var i,o,r,s,a,l,c,h,d,t=t.replace(/^ +$/gm,"");t;)if((r=this.rules.newline.exec(t))&&(t=t.substring(r[0].length),r[0].length>1&&this.tokens.push({type:"space"})),r=this.rules.code.exec(t))t=t.substring(r[0].length),r=r[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?r:r.replace(/\n+$/,"")});else if(r=this.rules.fences.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"code",lang:r[2],text:r[3]||""});else if(r=this.rules.heading.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"heading",depth:r[1].length,text:r[2]});else if(e&&(r=this.rules.nptable.exec(t))){for(t=t.substring(r[0].length),l={type:"table",header:r[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:r[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:r[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(r=this.rules.lheading.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"heading",depth:"="===r[2]?1:2,text:r[1]});else if(r=this.rules.hr.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"hr"});else if(r=this.rules.blockquote.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"blockquote_start"}),r=r[0].replace(/^ *> ?/gm,""),this.token(r,e,!0),this.tokens.push({type:"blockquote_end"});else if(r=this.rules.list.exec(t)){for(t=t.substring(r[0].length),s=r[2],this.tokens.push({type:"list_start",ordered:s.length>1}),r=r[0].match(this.rules.item),i=!1,d=r.length,h=0;h<d;h++)l=r[h],c=l.length,l=l.replace(/^ *([*+-]|\d+\.) +/,""),~l.indexOf("\n ")&&(c-=l.length,l=this.options.pedantic?l.replace(/^ {1,4}/gm,""):l.replace(new RegExp("^ {1,"+c+"}","gm"),"")),this.options.smartLists&&h!==d-1&&(a=u.bullet.exec(r[h+1])[0],s===a||s.length>1&&a.length>1||(t=r.slice(h+1).join("\n")+t,h=d-1)),o=i||/\n\n(?!\s*$)/.test(l),h!==d-1&&(i="\n"===l.charAt(l.length-1),o||(o=i)),this.tokens.push({type:o?"loose_item_start":"list_item_start"}),this.token(l,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(r=this.rules.html.exec(t))t=t.substring(r[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===r[1]||"script"===r[1]||"style"===r[1]),text:r[0]});else if(!n&&e&&(r=this.rules.def.exec(t)))t=t.substring(r[0].length),this.tokens.links[r[1].toLowerCase()]={href:r[2],title:r[3]};else if(e&&(r=this.rules.table.exec(t))){for(t=t.substring(r[0].length),l={type:"table",header:r[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:r[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:r[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(e&&(r=this.rules.paragraph.exec(t)))t=t.substring(r[0].length),this.tokens.push({type:"paragraph",text:"\n"===r[1].charAt(r[1].length-1)?r[1].slice(0,-1):r[1]});else if(r=this.rules.text.exec(t))t=t.substring(r[0].length),this.tokens.push({type:"text",text:r[0]});else if(t)throw new Error("Infinite loop on byte: "+t.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=s(h.link)("inside",h._inside)("href",h._href)(),h.reflink=s(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:s(h.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:s(h.text)("]|","~]|")("|","|https?://|")()}),h.breaks=l({},h.gfm,{br:s(h.br)("{2,}","*")(),text:s(h.gfm.text)("{2,}","*")()}),e.rules=h,e.output=function(t,n,i){var o=new e(n,i);return o.output(t)},e.prototype.output=function(t){for(var e,n,i,r,s="";t;)if(r=this.rules.escape.exec(t))t=t.substring(r[0].length),s+=r[1];else if(r=this.rules.autolink.exec(t))t=t.substring(r[0].length),"@"===r[2]?(n=":"===r[1].charAt(6)?this.mangle(r[1].substring(7)):this.mangle(r[1]),i=this.mangle("mailto:")+n):(n=o(r[1]),i=n),s+=this.renderer.link(i,null,n);else if(this.inLink||!(r=this.rules.url.exec(t))){if(r=this.rules.tag.exec(t))!this.inLink&&/^<a /i.test(r[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(r[0])&&(this.inLink=!1),t=t.substring(r[0].length),s+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):o(r[0]):r[0];else if(r=this.rules.link.exec(t))t=t.substring(r[0].length),this.inLink=!0,s+=this.outputLink(r,{href:r[2],title:r[3]}),this.inLink=!1;else if((r=this.rules.reflink.exec(t))||(r=this.rules.nolink.exec(t))){if(t=t.substring(r[0].length),e=(r[2]||r[1]).replace(/\s+/g," "),e=this.links[e.toLowerCase()],!e||!e.href){s+=r[0].charAt(0),t=r[0].substring(1)+t;continue}this.inLink=!0,s+=this.outputLink(r,e),this.inLink=!1}else if(r=this.rules.strong.exec(t))t=t.substring(r[0].length),s+=this.renderer.strong(this.output(r[2]||r[1]));else if(r=this.rules.em.exec(t))t=t.substring(r[0].length),s+=this.renderer.em(this.output(r[2]||r[1]));else if(r=this.rules.code.exec(t))t=t.substring(r[0].length),s+=this.renderer.codespan(o(r[2],!0));else if(r=this.rules.br.exec(t))t=t.substring(r[0].length),s+=this.renderer.br();else if(r=this.rules.del.exec(t))t=t.substring(r[0].length),s+=this.renderer.del(this.output(r[1]));else if(r=this.rules.text.exec(t))t=t.substring(r[0].length),s+=this.renderer.text(o(this.smartypants(r[0])));else if(t)throw new Error("Infinite loop on byte: "+t.charCodeAt(0))}else t=t.substring(r[0].length),n=o(r[1]),i=n,s+=this.renderer.link(i,null,n);return s},e.prototype.outputLink=function(t,e){var n=o(e.href),i=e.title?o(e.title):null;return"!"!==t[0].charAt(0)?this.renderer.link(n,i,this.output(t[1])):this.renderer.image(n,i,o(t[1]))},e.prototype.smartypants=function(t){return this.options.smartypants?t.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):t},e.prototype.mangle=function(t){if(!this.options.mangle)return t;for(var e,n="",i=t.length,o=0;o<i;o++)e=t.charCodeAt(o),Math.random()>.5&&(e="x"+e.toString(16)),n+="&#"+e+";";return n},n.prototype.code=function(t,e,n){if(this.options.highlight){var i=this.options.highlight(t,e);null!=i&&i!==t&&(n=!0,t=i)}return e?'<pre><code class="'+this.options.langPrefix+o(e,!0)+'">'+(n?t:o(t,!0))+"\n</code></pre>\n":"<pre><code>"+(n?t:o(t,!0))+"\n</code></pre>"},n.prototype.blockquote=function(t){return"<blockquote>\n"+t+"</blockquote>\n"},n.prototype.html=function(t){return t},n.prototype.heading=function(t,e,n){return"<h"+e+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+t+"</h"+e+">\n"},n.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},n.prototype.list=function(t,e){var n=e?"ol":"ul";return"<"+n+">\n"+t+"</"+n+">\n"},n.prototype.listitem=function(t){return"<li>"+t+"</li>\n"},n.prototype.paragraph=function(t){return"<p>"+t+"</p>\n"},n.prototype.table=function(t,e){return"<table>\n<thead>\n"+t+"</thead>\n<tbody>\n"+e+"</tbody>\n</table>\n"},n.prototype.tablerow=function(t){return"<tr>\n"+t+"</tr>\n"},n.prototype.tablecell=function(t,e){var n=e.header?"th":"td",i=e.align?"<"+n+' style="text-align:'+e.align+'">':"<"+n+">";return i+t+"</"+n+">\n"},n.prototype.strong=function(t){return"<strong>"+t+"</strong>"},n.prototype.em=function(t){return"<em>"+t+"</em>"},n.prototype.codespan=function(t){return"<code>"+t+"</code>"},n.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},n.prototype.del=function(t){return"<del>"+t+"</del>"},n.prototype.link=function(t,e,n){if(this.options.sanitize){try{var i=decodeURIComponent(r(t)).replace(/[^\w:]/g,"").toLowerCase()}catch(o){return""}if(0===i.indexOf("javascript:")||0===i.indexOf("vbscript:"))return""}var s='<a href="'+t+'"';return e&&(s+=' title="'+e+'"'),s+=">"+n+"</a>"},n.prototype.image=function(t,e,n){var i='<img src="'+t+'" alt="'+n+'"';return e&&(i+=' title="'+e+'"'),i+=this.options.xhtml?"/>":">"},n.prototype.text=function(t){return t},i.parse=function(t,e,n){var o=new i(e,n);return o.parse(t)},i.prototype.parse=function(t){this.inline=new e(t.links,this.options,this.renderer),this.tokens=t.reverse();for(var n="";this.next();)n+=this.tok();return n},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var t=this.token.text;"text"===this.peek().type;)t+="\n"+this.next().text;return this.inline.output(t)},i.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 t,e,n,i,o,r="",s="";for(n="",t=0;t<this.token.header.length;t++)i={header:!0,align:this.token.align[t]},n+=this.renderer.tablecell(this.inline.output(this.token.header[t]),{header:!0,align:this.token.align[t]});for(r+=this.renderer.tablerow(n),t=0;t<this.token.cells.length;t++){for(e=this.token.cells[t],n="",o=0;o<e.length;o++)n+=this.renderer.tablecell(this.inline.output(e[o]),{header:!1,align:this.token.align[o]});s+=this.renderer.tablerow(n)}return this.renderer.table(r,s);case"blockquote_start":for(var s="";"blockquote_end"!==this.next().type;)s+=this.tok();return this.renderer.blockquote(s);case"list_start":for(var s="",a=this.token.ordered;"list_end"!==this.next().type;)s+=this.tok();return this.renderer.list(s,a);case"list_item_start":for(var s="";"list_item_end"!==this.next().type;)s+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(s);case"loose_item_start":for(var s="";"list_item_end"!==this.next().type;)s+=this.tok();return this.renderer.listitem(s);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,c.options=c.setOptions=function(t){return l(c.defaults,t),c},c.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 n,xhtml:!1},c.Parser=i,c.parser=i.parse,c.Renderer=n,c.Lexer=t,c.lexer=t.lex,c.InlineLexer=e,c.inlineLexer=e.output,c.parse=c,"undefined"!=typeof module&&"object"==typeof exports?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):this.marked=c}.call(function(){return this||("undefined"!=typeof window?window:global)}()),!function(t){if("function"==typeof define&&define.amd)define(["jquery"],t);else if("object"==typeof module&&module.exports){var e=require("jquery");module.exports=t(e)}else t(jQuery)}(function(t){if("undefined"==typeof t)throw new Error("jQuery.textcomplete requires jQuery");return+function(t){"use strict";var e=function(t){console.warn&&console.warn(t)},n=1;t.fn.textcomplete=function(i,o){var r=Array.prototype.slice.call(arguments);return this.each(function(){var s=this,a=t(this),l=a.data("textComplete");if(l||(o||(o={}),o._oid=n++,l=new t.fn.textcomplete.Completer(this,o),a.data("textComplete",l)),"string"==typeof i){if(!l)return;r.shift(),l[i].apply(l,r),"destroy"===i&&a.removeData("textComplete")}else t.each(i,function(n){t.each(["header","footer","placement","maxCount"],function(t){n[t]&&(l.option[t]=n[t],e(t+"as a strategy param is deprecated. Use option."),delete n[t])})}),l.register(t.fn.textcomplete.Strategy.parse(i,{el:s,$el:a}))})}}(t),+function(t){"use strict";function e(n,i){if(this.$el=t(n),this.id="textcomplete"+o++,this.strategies=[],this.views=[],this.option=t.extend({},e._getDefaults(),i),!(this.$el.is("input[type=text]")||this.$el.is("input[type=search]")||this.$el.is("textarea")||n.isContentEditable||"true"==n.contentEditable))throw new Error("textcomplete must be called on a Textarea or a ContentEditable.");if(n===n.ownerDocument.activeElement)this.initialize();else{var r=this;this.$el.one("focus."+this.id,function(){
-r.initialize()}),this.option.adapter&&"CKEditor"!=this.option.adapter||"undefined"==typeof CKEDITOR||!this.$el.is("textarea")||CKEDITOR.on("instanceReady",function(e){e.editor.once("focus",function(n){r.$el=t(e.editor.editable().$),r.option.adapter||(r.option.adapter=t.fn.textcomplete.CKEditor),r.initialize()})})}}var n=function(t){var e,n;return function(){var i=Array.prototype.slice.call(arguments);if(e)return void(n=i);e=!0;var o=this;i.unshift(function r(){if(n){var i=n;n=void 0,i.unshift(r),t.apply(o,i)}else e=!1}),t.apply(this,i)}},i=function(t){return"[object String]"===Object.prototype.toString.call(t)},o=0;e._getDefaults=function(){return e.DEFAULTS||(e.DEFAULTS={appendTo:t("body"),className:"",dropdownClassName:"dropdown-menu textcomplete-dropdown",maxCount:10,zIndex:"100"}),e.DEFAULTS},t.extend(e.prototype,{id:null,option:null,strategies:null,adapter:null,dropdown:null,$el:null,$iframe:null,initialize:function(){var e=this.$el.get(0);if(this.$el.prop("ownerDocument")!==document&&window.frames.length)for(var n=0;n<window.frames.length;n++)if(this.$el.prop("ownerDocument")===window.frames[n].document){this.$iframe=t(window.frames[n].frameElement);break}this.dropdown=new t.fn.textcomplete.Dropdown(e,this,this.option);var i,o;this.option.adapter?i=this.option.adapter:(o=this.$el.is("textarea")||this.$el.is("input[type=text]")||this.$el.is("input[type=search]")?"number"==typeof e.selectionEnd?"Textarea":"IETextarea":"ContentEditable",i=t.fn.textcomplete[o]),this.adapter=new i(e,this,this.option)},destroy:function(){this.$el.off("."+this.id),this.adapter&&this.adapter.destroy(),this.dropdown&&this.dropdown.destroy(),this.$el=this.adapter=this.dropdown=null},deactivate:function(){this.dropdown&&this.dropdown.deactivate()},trigger:function(t,e){this.dropdown||this.initialize(),null!=t||(t=this.adapter.getTextFromHeadToCaret());var n=this._extractSearchQuery(t);if(n.length){var i=n[1];if(e&&this._term===i&&""!==i)return;this._term=i,this._search.apply(this,n)}else this._term=null,this.dropdown.deactivate()},fire:function(t){var e=Array.prototype.slice.call(arguments,1);return this.$el.trigger(t,e),this},register:function(t){Array.prototype.push.apply(this.strategies,t)},select:function(t,e,n){this._term=null,this.adapter.select(t,e,n),this.fire("change").fire("textComplete:select",t,e),this.adapter.focus()},_clearAtNext:!0,_term:null,_extractSearchQuery:function(e){for(var n=0;n<this.strategies.length;n++){var o=this.strategies[n],r=o.context(e);if(r||""===r){var s=t.isFunction(o.match)?o.match(e):o.match;i(r)&&(e=r);var a=e.match(s);if(a)return[o,a[o.index],a]}}return[]},_search:n(function(t,e,n,i){var o=this;e.search(n,function(i,r){o.dropdown.shown||o.dropdown.activate(),o._clearAtNext&&(o.dropdown.clear(),o._clearAtNext=!1),o.dropdown.setPosition(o.adapter.getCaretPosition()),o.dropdown.render(o._zip(i,e,n)),r||(t(),o._clearAtNext=!0)},i)}),_zip:function(e,n,i){return t.map(e,function(t){return{value:t,strategy:n,term:i}})}}),t.fn.textcomplete.Completer=e}(t),+function(t){"use strict";function e(n,i,r){this.$el=e.createElement(r),this.completer=i,this.id=i.id+"dropdown",this._data=[],this.$inputEl=t(n),this.option=r,r.listPosition&&(this.setPosition=r.listPosition),r.height&&this.$el.height(r.height);var s=this;t.each(["maxCount","placement","footer","header","noResultsMessage","className"],function(t,e){null!=r[e]&&(s[e]=r[e])}),this._bindEvents(n),o[this.id]=this}var n=t(window),i=function(t,e){var n,i,o=e.strategy.idProperty;for(n=0;n<t.length;n++)if(i=t[n],i.strategy===e.strategy)if(o){if(i.value[o]===e.value[o])return!0}else if(i.value===e.value)return!0;return!1},o={};t(document).on("click",function(e){var n=e.originalEvent&&e.originalEvent.keepTextCompleteDropdown;t.each(o,function(t,e){t!==n&&e.deactivate()})});var r={SKIP_DEFAULT:0,KEY_UP:1,KEY_DOWN:2,KEY_ENTER:3,KEY_PAGEUP:4,KEY_PAGEDOWN:5,KEY_ESCAPE:6};t.extend(e,{createElement:function(e){var n=e.appendTo;n instanceof t||(n=t(n));var i=t("<ul></ul>").addClass(e.dropdownClassName).attr("id","textcomplete-dropdown-"+e._oid).css({display:"none",left:0,position:"absolute",zIndex:e.zIndex}).appendTo(n);return i}}),t.extend(e.prototype,{$el:null,$inputEl:null,completer:null,footer:null,header:null,id:null,maxCount:null,placement:"",shown:!1,data:[],className:"",destroy:function(){this.deactivate(),this.$el.off("."+this.id),this.$inputEl.off("."+this.id),this.clear(),this.$el.remove(),this.$el=this.$inputEl=this.completer=null,delete o[this.id]},render:function(e){var n=this._buildContents(e),i=t.map(this.data,function(t){return t.value});if(this.data.length){var o=e[0].strategy;o.id?this.$el.attr("data-strategy",o.id):this.$el.removeAttr("data-strategy"),this._renderHeader(i),this._renderFooter(i),n&&(this._renderContents(n),this._fitToBottom(),this._fitToRight(),this._activateIndexedItem()),this._setScroll()}else this.noResultsMessage?this._renderNoResultsMessage(i):this.shown&&this.deactivate()},setPosition:function(e){var i="absolute";return this.$inputEl.add(this.$inputEl.parents()).each(function(){return"absolute"!==t(this).css("position")&&("fixed"===t(this).css("position")?(e.top-=n.scrollTop(),e.left-=n.scrollLeft(),i="fixed",!1):void 0)}),this.$el.css(this._applyPlacement(e)),this.$el.css({position:i}),this},clear:function(){this.$el.html(""),this.data=[],this._index=0,this._$header=this._$footer=this._$noResultsMessage=null},activate:function(){return this.shown||(this.clear(),this.$el.show(),this.className&&this.$el.addClass(this.className),this.completer.fire("textComplete:show"),this.shown=!0),this},deactivate:function(){return this.shown&&(this.$el.hide(),this.className&&this.$el.removeClass(this.className),this.completer.fire("textComplete:hide"),this.shown=!1),this},isUp:function(t){return 38===t.keyCode||t.ctrlKey&&80===t.keyCode},isDown:function(t){return 40===t.keyCode||t.ctrlKey&&78===t.keyCode},isEnter:function(t){var e=t.ctrlKey||t.altKey||t.metaKey||t.shiftKey;return!e&&(13===t.keyCode||9===t.keyCode||this.option.completeOnSpace===!0&&32===t.keyCode)},isPageup:function(t){return 33===t.keyCode},isPagedown:function(t){return 34===t.keyCode},isEscape:function(t){return 27===t.keyCode},_data:null,_index:null,_$header:null,_$noResultsMessage:null,_$footer:null,_bindEvents:function(){this.$el.on("mousedown."+this.id,".textcomplete-item",t.proxy(this._onClick,this)),this.$el.on("touchstart."+this.id,".textcomplete-item",t.proxy(this._onClick,this)),this.$el.on("mouseover."+this.id,".textcomplete-item",t.proxy(this._onMouseover,this)),this.$inputEl.on("keydown."+this.id,t.proxy(this._onKeydown,this))},_onClick:function(e){var n=t(e.target);e.preventDefault(),e.originalEvent.keepTextCompleteDropdown=this.id,n.hasClass("textcomplete-item")||(n=n.closest(".textcomplete-item"));var i=this.data[parseInt(n.data("index"),10)];this.completer.select(i.value,i.strategy,e);var o=this;setTimeout(function(){o.deactivate(),"touchstart"===e.type&&o.$inputEl.focus()},0)},_onMouseover:function(e){var n=t(e.target);e.preventDefault(),n.hasClass("textcomplete-item")||(n=n.closest(".textcomplete-item")),this._index=parseInt(n.data("index"),10),this._activateIndexedItem()},_onKeydown:function(e){if(this.shown){var n;switch(t.isFunction(this.option.onKeydown)&&(n=this.option.onKeydown(e,r)),null==n&&(n=this._defaultKeydown(e)),n){case r.KEY_UP:e.preventDefault(),this._up();break;case r.KEY_DOWN:e.preventDefault(),this._down();break;case r.KEY_ENTER:e.preventDefault(),this._enter(e);break;case r.KEY_PAGEUP:e.preventDefault(),this._pageup();break;case r.KEY_PAGEDOWN:e.preventDefault(),this._pagedown();break;case r.KEY_ESCAPE:e.preventDefault(),this.deactivate()}}},_defaultKeydown:function(t){return this.isUp(t)?r.KEY_UP:this.isDown(t)?r.KEY_DOWN:this.isEnter(t)?r.KEY_ENTER:this.isPageup(t)?r.KEY_PAGEUP:this.isPagedown(t)?r.KEY_PAGEDOWN:this.isEscape(t)?r.KEY_ESCAPE:void 0},_up:function(){0===this._index?this._index=this.data.length-1:this._index-=1,this._activateIndexedItem(),this._setScroll()},_down:function(){this._index===this.data.length-1?this._index=0:this._index+=1,this._activateIndexedItem(),this._setScroll()},_enter:function(t){var e=this.data[parseInt(this._getActiveElement().data("index"),10)];this.completer.select(e.value,e.strategy,t),this.deactivate()},_pageup:function(){var e=0,n=this._getActiveElement().position().top-this.$el.innerHeight();this.$el.children().each(function(i){return t(this).position().top+t(this).outerHeight()>n?(e=i,!1):void 0}),this._index=e,this._activateIndexedItem(),this._setScroll()},_pagedown:function(){var e=this.data.length-1,n=this._getActiveElement().position().top+this.$el.innerHeight();this.$el.children().each(function(i){return t(this).position().top>n?(e=i,!1):void 0}),this._index=e,this._activateIndexedItem(),this._setScroll()},_activateIndexedItem:function(){this.$el.find(".textcomplete-item.active").removeClass("active"),this._getActiveElement().addClass("active")},_getActiveElement:function(){return this.$el.children(".textcomplete-item:nth("+this._index+")")},_setScroll:function(){var t=this._getActiveElement(),e=t.position().top,n=t.outerHeight(),i=this.$el.innerHeight(),o=this.$el.scrollTop();0===this._index||this._index==this.data.length-1||0>e?this.$el.scrollTop(e+o):e+n>i&&this.$el.scrollTop(e+n+o-i)},_buildContents:function(t){var e,n,o,r="";for(n=0;n<t.length&&this.data.length!==this.maxCount;n++)e=t[n],i(this.data,e)||(o=this.data.length,this.data.push(e),r+='<li class="textcomplete-item" data-index="'+o+'"><a>',r+=e.strategy.template(e.value,e.term),r+="</a></li>");return r},_renderHeader:function(e){if(this.header){this._$header||(this._$header=t('<li class="textcomplete-header"></li>').prependTo(this.$el));var n=t.isFunction(this.header)?this.header(e):this.header;this._$header.html(n)}},_renderFooter:function(e){if(this.footer){this._$footer||(this._$footer=t('<li class="textcomplete-footer"></li>').appendTo(this.$el));var n=t.isFunction(this.footer)?this.footer(e):this.footer;this._$footer.html(n)}},_renderNoResultsMessage:function(e){if(this.noResultsMessage){this._$noResultsMessage||(this._$noResultsMessage=t('<li class="textcomplete-no-results-message"></li>').appendTo(this.$el));var n=t.isFunction(this.noResultsMessage)?this.noResultsMessage(e):this.noResultsMessage;this._$noResultsMessage.html(n)}},_renderContents:function(t){this._$footer?this._$footer.before(t):this.$el.append(t)},_fitToBottom:function(){var t=n.scrollTop()+n.height(),e=this.$el.height();this.$el.position().top+e>t&&(this.completer.$iframe||this.$el.offset({top:t-e}))},_fitToRight:function(){for(var t,e=30,i=this.$el.offset().left,o=this.$el.width(),r=n.width()-e;i+o>r&&(this.$el.offset({left:i-e}),t=this.$el.offset().left,!(t>=i));)i=t},_applyPlacement:function(t){return t.height=Math.min(this.$el.parent().height(),n.height()),-1!==this.placement.indexOf("top")?t={top:"auto",bottom:t.height-t.top+t.lineHeight,left:t.left}:(t.bottom="auto",delete t.lineHeight),-1!==this.placement.indexOf("absleft")?t.left=0:-1!==this.placement.indexOf("absright")&&(t.right=0,t.left="auto"),t}}),t.fn.textcomplete.Dropdown=e,t.extend(t.fn.textcomplete,r)}(t),+function(t){"use strict";function e(e){t.extend(this,e),this.cache&&(this.search=n(this.search))}var n=function(t){var e={};return function(n,i){e[n]?i(e[n]):t.call(this,n,function(t){e[n]=(e[n]||[]).concat(t),i.apply(null,arguments)})}};e.parse=function(n,i){return t.map(n,function(t){var n=new e(t);return n.el=i.el,n.$el=i.$el,n})},t.extend(e.prototype,{match:null,replace:null,search:null,id:null,cache:!1,context:function(){return!0},index:2,template:function(t){return t},idProperty:null}),t.fn.textcomplete.Strategy=e}(t),+function(t){"use strict";function e(){}var n=Date.now||function(){return(new Date).getTime()},i=function(t,e){var i,o,r,s,a,l=function(){var c=n()-s;e>c?i=setTimeout(l,e-c):(i=null,a=t.apply(r,o),r=o=null)};return function(){return r=this,o=arguments,s=n(),i||(i=setTimeout(l,e)),a}};t.extend(e.prototype,{id:null,completer:null,el:null,$el:null,option:null,initialize:function(e,n,o){this.el=e,this.$el=t(e),this.id=n.id+this.constructor.name,this.completer=n,this.option=o,this.option.debounce&&(this._onKeyup=i(this._onKeyup,this.option.debounce)),this._bindEvents()},destroy:function(){this.$el.off("."+this.id),this.$el=this.el=this.completer=null},select:function(){throw new Error("Not implemented")},getCaretPosition:function(){var e=this._getCaretRelativePosition(),n=this.$el.offset(),i=this.option.appendTo;if(i){i instanceof t||(i=t(i));var o=i.offsetParent().offset();n.top-=o.top,n.left-=o.left}return e.top+=n.top,e.left+=n.left,e},focus:function(){this.$el.focus()},_bindEvents:function(){this.$el.on("keyup."+this.id,t.proxy(this._onKeyup,this))},_onKeyup:function(t){this._skipSearch(t)||this.completer.trigger(this.getTextFromHeadToCaret(),!0)},_skipSearch:function(t){switch(t.keyCode){case 9:case 13:case 40:case 38:case 27:return!0}if(t.ctrlKey)switch(t.keyCode){case 78:case 80:return!0}}}),t.fn.textcomplete.Adapter=e}(t),+function(t){"use strict";function e(t,e,n){this.initialize(t,e,n)}t.extend(e.prototype,t.fn.textcomplete.Adapter.prototype,{select:function(e,n,i){var o,r=this.getTextFromHeadToCaret(),s=this.el.value.substring(this.el.selectionEnd),a=n.replace(e,i);"undefined"!=typeof a&&(t.isArray(a)&&(s=a[1]+s,a=a[0]),o=t.isFunction(n.match)?n.match(r):n.match,r=r.replace(o,a),this.$el.val(r+s),this.el.selectionStart=this.el.selectionEnd=r.length)},getTextFromHeadToCaret:function(){return this.el.value.substring(0,this.el.selectionEnd)},_getCaretRelativePosition:function(){var e=t.fn.textcomplete.getCaretCoordinates(this.el,this.el.selectionStart);return{top:e.top+this._calculateLineHeight()-this.$el.scrollTop(),left:e.left-this.$el.scrollLeft(),lineHeight:this._calculateLineHeight()}},_calculateLineHeight:function(){var t=parseInt(this.$el.css("line-height"),10);if(isNaN(t)){var e=this.el.parentNode,n=document.createElement(this.el.nodeName),i=this.el.style;n.setAttribute("style","margin:0px;padding:0px;font-family:"+i.fontFamily+";font-size:"+i.fontSize),n.innerHTML="test",e.appendChild(n),t=n.clientHeight,e.removeChild(n)}return t}}),t.fn.textcomplete.Textarea=e}(t),+function(t){"use strict";function e(e,i,o){this.initialize(e,i,o),t("<span>"+n+"</span>").css({position:"absolute",top:-9999,left:-9999}).insertBefore(e)}var n="吶";t.extend(e.prototype,t.fn.textcomplete.Textarea.prototype,{select:function(e,n,i){var o,r=this.getTextFromHeadToCaret(),s=this.el.value.substring(r.length),a=n.replace(e,i);if("undefined"!=typeof a){t.isArray(a)&&(s=a[1]+s,a=a[0]),o=t.isFunction(n.match)?n.match(r):n.match,r=r.replace(o,a),this.$el.val(r+s),this.el.focus();var l=this.el.createTextRange();l.collapse(!0),l.moveEnd("character",r.length),l.moveStart("character",r.length),l.select()}},getTextFromHeadToCaret:function(){this.el.focus();var t=document.selection.createRange();t.moveStart("character",-this.el.value.length);var e=t.text.split(n);return 1===e.length?e[0]:e[1]}}),t.fn.textcomplete.IETextarea=e}(t),+function(t){"use strict";function e(t,e,n){this.initialize(t,e,n)}t.extend(e.prototype,t.fn.textcomplete.Adapter.prototype,{select:function(e,n,i){var o=this.getTextFromHeadToCaret(),r=this.el.ownerDocument.getSelection(),s=r.getRangeAt(0),a=s.cloneRange();a.selectNodeContents(s.startContainer);var l,c=a.toString(),u=c.substring(s.startOffset),h=n.replace(e,i);if("undefined"!=typeof h){t.isArray(h)&&(u=h[1]+u,h=h[0]),l=t.isFunction(n.match)?n.match(o):n.match,o=o.replace(l,h).replace(/ $/,"&nbsp"),s.selectNodeContents(s.startContainer),s.deleteContents();var d=this.el.ownerDocument.createElement("div");d.innerHTML=o;var p=this.el.ownerDocument.createElement("div");p.innerHTML=u;for(var f,g,m=this.el.ownerDocument.createDocumentFragment();f=d.firstChild;)g=m.appendChild(f);for(;f=p.firstChild;)m.appendChild(f);s.insertNode(m),s.setStartAfter(g),s.collapse(!0),r.removeAllRanges(),r.addRange(s)}},_getCaretRelativePosition:function(){var e=this.el.ownerDocument.getSelection().getRangeAt(0).cloneRange(),n=this.el.ownerDocument.createElement("span");e.insertNode(n),e.selectNodeContents(n),e.deleteContents();var i=t(n),o=i.offset();if(o.left-=this.$el.offset().left,o.top+=i.height()-this.$el.offset().top,o.lineHeight=i.height(),this.completer.$iframe){var r=this.completer.$iframe.offset();o.top+=r.top,o.left+=r.left,o.top-=this.$el.scrollTop()}return i.remove(),o},getTextFromHeadToCaret:function(){var t=this.el.ownerDocument.getSelection().getRangeAt(0),e=t.cloneRange();return e.selectNodeContents(t.startContainer),e.toString().substring(0,t.startOffset)}}),t.fn.textcomplete.ContentEditable=e}(t),+function(t){"use strict";function e(t,e,n){this.initialize(t,e,n)}t.extend(e.prototype,t.fn.textcomplete.ContentEditable.prototype,{_bindEvents:function(){var e=this;CKEDITOR.instances.issue_notes.on("key",function(t){var n=t.data;return e._onKeyup(n),(!e.completer.dropdown.shown||!e._skipSearch(n))&&void 0},null,null,1),this.$el.on("keyup."+this.id,t.proxy(this._onKeyup,this))}}),t.fn.textcomplete.CKEditor=e}(t),function(t){function e(t,e,r){if(!i)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");var s=r&&r.debug||!1;if(s){var a=document.querySelector("#input-textarea-caret-position-mirror-div");a&&a.parentNode.removeChild(a)}var l=document.createElement("div");l.id="input-textarea-caret-position-mirror-div",document.body.appendChild(l);var c=l.style,u=window.getComputedStyle?getComputedStyle(t):t.currentStyle;c.whiteSpace="pre-wrap","INPUT"!==t.nodeName&&(c.wordWrap="break-word"),c.position="absolute",s||(c.visibility="hidden"),n.forEach(function(t){c[t]=u[t]}),o?t.scrollHeight>parseInt(u.height)&&(c.overflowY="scroll"):c.overflow="hidden",l.textContent=t.value.substring(0,e),"INPUT"===t.nodeName&&(l.textContent=l.textContent.replace(/\s/g," "));var h=document.createElement("span");h.textContent=t.value.substring(e)||".",l.appendChild(h);var d={top:h.offsetTop+parseInt(u.borderTopWidth),left:h.offsetLeft+parseInt(u.borderLeftWidth)};return s?h.style.backgroundColor="#aaa":document.body.removeChild(l),d}var n=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],i="undefined"!=typeof window,o=i&&null!=window.mozInnerScreenX;t.fn.textcomplete.getCaretCoordinates=e}(t),t}),marked.setOptions({gfm:!0,tables:!0,breaks:!0,pedantic:!1,sanitize:!0,smartLists:!0,smartypants:!1}),$(".flaskbb-editor").markdown({iconlibrary:"fa",additionalButtons:[[{name:"groupHelp",data:[{name:"cmdHelp",toggle:!1,title:"Help",icon:"fa fa-question",btnClass:"btn btn-success",callback:function(t){$("#editor-help").modal("show")}}]}]]}),$(".flaskbb-editor").textcomplete([{match:/\B:([\-+\w]*)$/,search:function(t,e){e($.map(emojies,function(e){return 0===e.indexOf(t)?e:null}))},template:function(t){return'<img class="emoji" src="/static/emoji/'+t+'.png"></img>'+t},replace:function(t){return":"+t+": "},index:1}],{onKeydown:function(t,e){if(t.ctrlKey&&74===t.keyCode)return e.KEY_ENTER}});var emojies=["+1","-1","100","1234","8ball","a","ab","abc","abcd","accept","aerial_tramway","airplane","alarm_clock","alien","ambulance","anchor","angel","anger","angry","anguished","ant","apple","aquarius","aries","arrow_backward","arrow_double_down","arrow_double_up","arrow_down","arrow_down_small","arrow_forward","arrow_heading_down","arrow_heading_up","arrow_left","arrow_lower_left","arrow_lower_right","arrow_right","arrow_right_hook","arrow_up","arrow_up_down","arrow_up_small","arrow_upper_left","arrow_upper_right","arrows_clockwise","arrows_counterclockwise","art","articulated_lorry","astonished","athletic_shoe","atm","b","baby","baby_bottle","baby_chick","baby_symbol","back","baggage_claim","balloon","ballot_box_with_check","bamboo","banana","bangbang","bank","bar_chart","barber","baseball","basketball","bath","bathtub","battery","bear","bee","beer","beers","beetle","beginner","bell","bento","bicyclist","bike","bikini","bird","birthday","black_circle","black_joker","black_large_square","black_medium_small_square","black_medium_square","black_nib","black_small_square","black_square_button","blossom","blowfish","blue_book","blue_car","blue_heart","blush","boar","boat","bomb","book","bookmark","bookmark_tabs","books","boom","boot","bouquet","bow","bowling","bowtie","boy","bread","bride_with_veil","bridge_at_night","briefcase","broken_heart","bug","bulb","bullettrain_front","bullettrain_side","bus","busstop","bust_in_silhouette","busts_in_silhouette","cactus","cake","calendar","calling","camel","camera","cancer","candy","capital_abcd","capricorn","car","card_index","carousel_horse","cat","cat2","cd","chart","chart_with_downwards_trend","chart_with_upwards_trend","checkered_flag","cherries","cherry_blossom","chestnut","chicken","children_crossing","chocolate_bar","christmas_tree","church","cinema","circus_tent","city_sunrise","city_sunset","cl","clap","clapper","clipboard","clock1","clock10","clock1030","clock11","clock1130","clock12","clock1230","clock130","clock2","clock230","clock3","clock330","clock4","clock430","clock5","clock530","clock6","clock630","clock7","clock730","clock8","clock830","clock9","clock930","closed_book","closed_lock_with_key","closed_umbrella","cloud","clubs","cn","cocktail","coffee","cold_sweat","collision","computer","confetti_ball","confounded","confused","congratulations","construction","construction_worker","convenience_store","cookie","cool","cop","copyright","corn","couple","couple_with_heart","couplekiss","cow","cow2","credit_card","crescent_moon","crocodile","crossed_flags","crown","cry","crying_cat_face","crystal_ball","cupid","curly_loop","currency_exchange","curry","custard","customs","cyclone","dancer","dancers","dango","dart","dash","date","de","deciduous_tree","department_store","diamond_shape_with_a_dot_inside","diamonds","disappointed","disappointed_relieved","dizzy","dizzy_face","do_not_litter","dog","dog2","dollar","dolls","dolphin","door","doughnut","dragon","dragon_face","dress","dromedary_camel","droplet","dvd","e-mail","ear","ear_of_rice","earth_africa","earth_americas","earth_asia","egg","eggplant","eight","eight_pointed_black_star","eight_spoked_asterisk","electric_plug","elephant","email","end","envelope","envelope_with_arrow","es","euro","european_castle","european_post_office","evergreen_tree","exclamation","expressionless","eyeglasses","eyes","facepunch","factory","fallen_leaf","family","fast_forward","fax","fearful","feelsgood","feet","ferris_wheel","file_folder","finnadie","fire","fire_engine","fireworks","first_quarter_moon","first_quarter_moon_with_face","fish","fish_cake","fishing_pole_and_fish","fist","five","flags","flashlight","floppy_disk","flower_playing_cards","flushed","foggy","football","footprints","fork_and_knife","fountain","four","four_leaf_clover","fr","free","fried_shrimp","fries","frog","frowning","fu","fuelpump","full_moon","full_moon_with_face","game_die","gb","gem","gemini","ghost","gift","gift_heart","girl","globe_with_meridians","goat","goberserk","godmode","golf","grapes","green_apple","green_book","green_heart","grey_exclamation","grey_question","grimacing","grin","grinning","guardsman","guitar","gun","haircut","hamburger","hammer","hamster","hand","handbag","hankey","hash","hatched_chick","hatching_chick","headphones","hear_no_evil","heart","heart_decoration","heart_eyes","heart_eyes_cat","heartbeat","heartpulse","hearts","heavy_check_mark","heavy_division_sign","heavy_dollar_sign","heavy_exclamation_mark","heavy_minus_sign","heavy_multiplication_x","heavy_plus_sign","helicopter","herb","hibiscus","high_brightness","high_heel","hocho","honey_pot","honeybee","horse","horse_racing","hospital","hotel","hotsprings","hourglass","hourglass_flowing_sand","house","house_with_garden","hurtrealbad","hushed","ice_cream","icecream","id","ideograph_advantage","imp","inbox_tray","incoming_envelope","information_desk_person","information_source","innocent","interrobang","iphone","it","izakaya_lantern","jack_o_lantern","japan","japanese_castle","japanese_goblin","japanese_ogre","jeans","joy","joy_cat","jp","key","keycap_ten","kimono","kiss","kissing","kissing_cat","kissing_closed_eyes","kissing_heart","kissing_smiling_eyes","koala","koko","kr","lantern","large_blue_circle","large_blue_diamond","large_orange_diamond","last_quarter_moon","last_quarter_moon_with_face","laughing","leaves","ledger","left_luggage","left_right_arrow","leftwards_arrow_with_hook","lemon","leo","leopard","libra","light_rail","link","lips","lipstick","lock","lock_with_ink_pen","lollipop","loop","loudspeaker","love_hotel","love_letter","low_brightness","m","mag","mag_right","mahjong","mailbox","mailbox_closed","mailbox_with_mail","mailbox_with_no_mail","man","man_with_gua_pi_mao","man_with_turban","mans_shoe","maple_leaf","mask","massage","meat_on_bone","mega","melon","memo","mens","metal","metro","microphone","microscope","milky_way","minibus","minidisc","mobile_phone_off","money_with_wings","moneybag","monkey","monkey_face","monorail","moon","mortar_board","mount_fuji","mountain_bicyclist","mountain_cableway","mountain_railway","mouse","mouse2","movie_camera","moyai","muscle","mushroom","musical_keyboard","musical_note","musical_score","mute","nail_care","name_badge","neckbeard","necktie","negative_squared_cross_mark","neutral_face","new","new_moon","new_moon_with_face","newspaper","ng","nine","no_bell","no_bicycles","no_entry","no_entry_sign","no_good","no_mobile_phones","no_mouth","no_pedestrians","no_smoking","non-potable_water","nose","notebook","notebook_with_decorative_cover","notes","nut_and_bolt","o","o2","ocean","octocat","octopus","oden","office","ok","ok_hand","ok_woman","older_man","older_woman","on","oncoming_automobile","oncoming_bus","oncoming_police_car","oncoming_taxi","one","open_book","open_file_folder","open_hands","open_mouth","ophiuchus","orange_book","outbox_tray","ox","package","page_facing_up","page_with_curl","pager","palm_tree","panda_face","paperclip","parking","part_alternation_mark","partly_sunny","passport_control","paw_prints","peach","pear","pencil","pencil2","penguin","pensive","performing_arts","persevere","person_frowning","person_with_blond_hair","person_with_pouting_face","phone","pig","pig2","pig_nose","pill","pineapple","pisces","pizza","point_down","point_left","point_right","point_up","point_up_2","police_car","poodle","poop","post_office","postal_horn","postbox","potable_water","pouch","poultry_leg","pound","pouting_cat","pray","princess","punch","purple_heart","purse","pushpin","put_litter_in_its_place","question","rabbit","rabbit2","racehorse","radio","radio_button","rage","rage1","rage2","rage3","rage4","railway_car","rainbow","raised_hand","raised_hands","raising_hand","ram","ramen","rat","recycle","red_car","red_circle","registered","relaxed","relieved","repeat","repeat_one","restroom","revolving_hearts","rewind","ribbon","rice","rice_ball","rice_cracker","rice_scene","ring","rocket","roller_coaster","rooster","rose","rotating_light","round_pushpin","rowboat","ru","rugby_football","runner","running","running_shirt_with_sash","sa","sagittarius","sailboat","sake","sandal","santa","satellite","satisfied","saxophone","school","school_satchel","scissors","scorpius","scream","scream_cat","scroll","seat","secret","see_no_evil","seedling","seven","shaved_ice","sheep","shell","ship","shipit","shirt","shit","shoe","shower","signal_strength","six","six_pointed_star","ski","skull","sleeping","sleepy","slot_machine","small_blue_diamond","small_orange_diamond","small_red_triangle","small_red_triangle_down","smile","smile_cat","smiley","smiley_cat","smiling_imp","smirk","smirk_cat","smoking","snail","snake","snowboarder","snowflake","snowman","sob","soccer","soon","sos","sound","space_invader","spades","spaghetti","sparkle","sparkler","sparkles","sparkling_heart","speak_no_evil","speaker","speech_balloon","speedboat","squirrel","star","star2","stars","station","statue_of_liberty","steam_locomotive","stew","straight_ruler","strawberry","stuck_out_tongue","stuck_out_tongue_closed_eyes","stuck_out_tongue_winking_eye","sun_with_face","sunflower","sunglasses","sunny","sunrise","sunrise_over_mountains","surfer","sushi","suspect","suspension_railway","sweat","sweat_drops","sweat_smile","sweet_potato","swimmer","symbols","syringe","tada","tanabata_tree","tangerine","taurus","taxi","tea","telephone","telephone_receiver","telescope","tennis","tent","thought_balloon","three","thumbsdown","thumbsup","ticket","tiger","tiger2","tired_face","tm","toilet","tokyo_tower","tomato","tongue","top","tophat","tractor","traffic_light","train","train2","tram","triangular_flag_on_post","triangular_ruler","trident","triumph","trolleybus","trollface","trophy","tropical_drink","tropical_fish","truck","trumpet","tshirt","tulip","turtle","tv","twisted_rightwards_arrows","two","two_hearts","two_men_holding_hands","two_women_holding_hands","u5272","u5408","u55b6","u6307","u6708","u6709","u6e80","u7121","u7533","u7981","u7a7a","uk","umbrella","unamused","underage","unlock","up","us","v","vertical_traffic_light","vhs","vibration_mode","video_camera","video_game","violin","virgo","volcano","vs","walking","waning_crescent_moon","waning_gibbous_moon","warning","watch","water_buffalo","watermelon","wave","wavy_dash","waxing_crescent_moon","waxing_gibbous_moon","wc","weary","wedding","whale","whale2","wheelchair","white_check_mark","white_circle","white_flower","white_large_square","white_medium_small_square","white_medium_square","white_small_square","white_square_button","wind_chime","wine_glass","wink","wolf","woman","womans_clothes","womans_hat","womens","worried","wrench","x","yellow_heart","yen","yum","zap","zero","zzz"],csrftoken=$("meta[name=csrf-token]").attr("content"),show_management_search=function(){var t=$(".management-body"),e=t.find(".search-form");e.slideToggle(function(){"none"!=e.css("display")&&e.find("input").focus()})},flash_message=function(t){var e=$("#flashed-messages"),n='<div class="alert alert-'+t.category+'">';n+="success"==t.category?'<span class="glyphicon glyphicon-ok-sign"></span>&nbsp;':"error"==t.category?'<span class="glyphicon glyphicon-exclamation-sign"></span>&nbsp;':'<span class="glyphicon glyphicon-info-sign"></span>&nbsp;',n+='<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'+t.message+"</div>",e.append(n)},BulkActions=function(){this.execute=function(t,e){var n=$("input.action-checkbox:checked").size(),i={ids:[]};return 0!==n&&($("input.action-checkbox:checked").each(function(t,e){i.ids.push($(e).val())}),!(e&&!confirm(e))&&(send_data(t,i),!1))}},send_data=function(t,e){$.ajax({url:t,method:"POST",data:JSON.stringify(e),dataType:"json",contentType:"application/json",beforeSend:function(t,e){/^(GET|HEAD|OPTIONS|TRACE)$/i.test(e.type)||this.crossDomain||t.setRequestHeader("X-CSRFToken",csrftoken)}}).done(function(t){flash_message(t),$.each(t.data,function(t,e){var n=$("#"+e.type+"-"+e.id);e.reverse?(n.attr("action",e.reverse_url),"ban"==e.type?reverse_html='<span class="fa fa-flag text-success" data-toggle="tooltip" data-placement="top" title="'+e.reverse_name+'"></span>':"unban"==e.type&&(reverse_html='<span class="fa fa-flag text-warning" data-toggle="tooltip" data-placement="top" title="'+e.reverse_name+'"></span>'),n.find("button").html(reverse_html)):n.parents(".action-row").remove()})}).fail(function(t){flash_message(t)})};$(document).ready(function(){$(".action-checkall").change(function(){$("input.action-checkbox").prop("checked",this.checked)}),$(".reply-btn").click(function(t){t.preventDefault();var e=$(this).attr("data-message-id");$.get("/message/message/"+e+"/raw",function(t){
-var e=$(".flaskbb-editor");e.val((e.val()+"\n"+t).trim()+"\n"),e.selectionStart=e.selectionEnd=e.val().length,e[0].scrollTop=e[0].scrollHeight,window.location.href="#content"})}),$(".quote-btn").click(function(t){t.preventDefault();var e=$(this).attr("data-post-id");$.get("/post/"+e+"/raw",function(t){var e=$(".flaskbb-editor");e.val((e.val()+"\n"+t).trim()+"\n"),e.selectionStart=e.selectionEnd=e.val().length,e[0].scrollTop=e[0].scrollHeight,window.location.href="#content"})})});
+r.initialize()}),this.option.adapter&&"CKEditor"!=this.option.adapter||"undefined"==typeof CKEDITOR||!this.$el.is("textarea")||CKEDITOR.on("instanceReady",function(e){e.editor.once("focus",function(n){r.$el=t(e.editor.editable().$),r.option.adapter||(r.option.adapter=t.fn.textcomplete.CKEditor),r.initialize()})})}}var n=function(t){var e,n;return function(){var i=Array.prototype.slice.call(arguments);if(e)return void(n=i);e=!0;var o=this;i.unshift(function r(){if(n){var i=n;n=void 0,i.unshift(r),t.apply(o,i)}else e=!1}),t.apply(this,i)}},i=function(t){return"[object String]"===Object.prototype.toString.call(t)},o=0;e._getDefaults=function(){return e.DEFAULTS||(e.DEFAULTS={appendTo:t("body"),className:"",dropdownClassName:"dropdown-menu textcomplete-dropdown",maxCount:10,zIndex:"100"}),e.DEFAULTS},t.extend(e.prototype,{id:null,option:null,strategies:null,adapter:null,dropdown:null,$el:null,$iframe:null,initialize:function(){var e=this.$el.get(0);if(this.$el.prop("ownerDocument")!==document&&window.frames.length)for(var n=0;n<window.frames.length;n++)if(this.$el.prop("ownerDocument")===window.frames[n].document){this.$iframe=t(window.frames[n].frameElement);break}this.dropdown=new t.fn.textcomplete.Dropdown(e,this,this.option);var i,o;this.option.adapter?i=this.option.adapter:(o=this.$el.is("textarea")||this.$el.is("input[type=text]")||this.$el.is("input[type=search]")?"number"==typeof e.selectionEnd?"Textarea":"IETextarea":"ContentEditable",i=t.fn.textcomplete[o]),this.adapter=new i(e,this,this.option)},destroy:function(){this.$el.off("."+this.id),this.adapter&&this.adapter.destroy(),this.dropdown&&this.dropdown.destroy(),this.$el=this.adapter=this.dropdown=null},deactivate:function(){this.dropdown&&this.dropdown.deactivate()},trigger:function(t,e){this.dropdown||this.initialize(),null!=t||(t=this.adapter.getTextFromHeadToCaret());var n=this._extractSearchQuery(t);if(n.length){var i=n[1];if(e&&this._term===i&&""!==i)return;this._term=i,this._search.apply(this,n)}else this._term=null,this.dropdown.deactivate()},fire:function(t){var e=Array.prototype.slice.call(arguments,1);return this.$el.trigger(t,e),this},register:function(t){Array.prototype.push.apply(this.strategies,t)},select:function(t,e,n){this._term=null,this.adapter.select(t,e,n),this.fire("change").fire("textComplete:select",t,e),this.adapter.focus()},_clearAtNext:!0,_term:null,_extractSearchQuery:function(e){for(var n=0;n<this.strategies.length;n++){var o=this.strategies[n],r=o.context(e);if(r||""===r){var s=t.isFunction(o.match)?o.match(e):o.match;i(r)&&(e=r);var a=e.match(s);if(a)return[o,a[o.index],a]}}return[]},_search:n(function(t,e,n,i){var o=this;e.search(n,function(i,r){o.dropdown.shown||o.dropdown.activate(),o._clearAtNext&&(o.dropdown.clear(),o._clearAtNext=!1),o.dropdown.setPosition(o.adapter.getCaretPosition()),o.dropdown.render(o._zip(i,e,n)),r||(t(),o._clearAtNext=!0)},i)}),_zip:function(e,n,i){return t.map(e,function(t){return{value:t,strategy:n,term:i}})}}),t.fn.textcomplete.Completer=e}(t),+function(t){"use strict";function e(n,i,r){this.$el=e.createElement(r),this.completer=i,this.id=i.id+"dropdown",this._data=[],this.$inputEl=t(n),this.option=r,r.listPosition&&(this.setPosition=r.listPosition),r.height&&this.$el.height(r.height);var s=this;t.each(["maxCount","placement","footer","header","noResultsMessage","className"],function(t,e){null!=r[e]&&(s[e]=r[e])}),this._bindEvents(n),o[this.id]=this}var n=t(window),i=function(t,e){var n,i,o=e.strategy.idProperty;for(n=0;n<t.length;n++)if(i=t[n],i.strategy===e.strategy)if(o){if(i.value[o]===e.value[o])return!0}else if(i.value===e.value)return!0;return!1},o={};t(document).on("click",function(e){var n=e.originalEvent&&e.originalEvent.keepTextCompleteDropdown;t.each(o,function(t,e){t!==n&&e.deactivate()})});var r={SKIP_DEFAULT:0,KEY_UP:1,KEY_DOWN:2,KEY_ENTER:3,KEY_PAGEUP:4,KEY_PAGEDOWN:5,KEY_ESCAPE:6};t.extend(e,{createElement:function(e){var n=e.appendTo;n instanceof t||(n=t(n));var i=t("<ul></ul>").addClass(e.dropdownClassName).attr("id","textcomplete-dropdown-"+e._oid).css({display:"none",left:0,position:"absolute",zIndex:e.zIndex}).appendTo(n);return i}}),t.extend(e.prototype,{$el:null,$inputEl:null,completer:null,footer:null,header:null,id:null,maxCount:null,placement:"",shown:!1,data:[],className:"",destroy:function(){this.deactivate(),this.$el.off("."+this.id),this.$inputEl.off("."+this.id),this.clear(),this.$el.remove(),this.$el=this.$inputEl=this.completer=null,delete o[this.id]},render:function(e){var n=this._buildContents(e),i=t.map(this.data,function(t){return t.value});if(this.data.length){var o=e[0].strategy;o.id?this.$el.attr("data-strategy",o.id):this.$el.removeAttr("data-strategy"),this._renderHeader(i),this._renderFooter(i),n&&(this._renderContents(n),this._fitToBottom(),this._fitToRight(),this._activateIndexedItem()),this._setScroll()}else this.noResultsMessage?this._renderNoResultsMessage(i):this.shown&&this.deactivate()},setPosition:function(e){var i="absolute";return this.$inputEl.add(this.$inputEl.parents()).each(function(){return"absolute"!==t(this).css("position")&&("fixed"===t(this).css("position")?(e.top-=n.scrollTop(),e.left-=n.scrollLeft(),i="fixed",!1):void 0)}),this.$el.css(this._applyPlacement(e)),this.$el.css({position:i}),this},clear:function(){this.$el.html(""),this.data=[],this._index=0,this._$header=this._$footer=this._$noResultsMessage=null},activate:function(){return this.shown||(this.clear(),this.$el.show(),this.className&&this.$el.addClass(this.className),this.completer.fire("textComplete:show"),this.shown=!0),this},deactivate:function(){return this.shown&&(this.$el.hide(),this.className&&this.$el.removeClass(this.className),this.completer.fire("textComplete:hide"),this.shown=!1),this},isUp:function(t){return 38===t.keyCode||t.ctrlKey&&80===t.keyCode},isDown:function(t){return 40===t.keyCode||t.ctrlKey&&78===t.keyCode},isEnter:function(t){var e=t.ctrlKey||t.altKey||t.metaKey||t.shiftKey;return!e&&(13===t.keyCode||9===t.keyCode||this.option.completeOnSpace===!0&&32===t.keyCode)},isPageup:function(t){return 33===t.keyCode},isPagedown:function(t){return 34===t.keyCode},isEscape:function(t){return 27===t.keyCode},_data:null,_index:null,_$header:null,_$noResultsMessage:null,_$footer:null,_bindEvents:function(){this.$el.on("mousedown."+this.id,".textcomplete-item",t.proxy(this._onClick,this)),this.$el.on("touchstart."+this.id,".textcomplete-item",t.proxy(this._onClick,this)),this.$el.on("mouseover."+this.id,".textcomplete-item",t.proxy(this._onMouseover,this)),this.$inputEl.on("keydown."+this.id,t.proxy(this._onKeydown,this))},_onClick:function(e){var n=t(e.target);e.preventDefault(),e.originalEvent.keepTextCompleteDropdown=this.id,n.hasClass("textcomplete-item")||(n=n.closest(".textcomplete-item"));var i=this.data[parseInt(n.data("index"),10)];this.completer.select(i.value,i.strategy,e);var o=this;setTimeout(function(){o.deactivate(),"touchstart"===e.type&&o.$inputEl.focus()},0)},_onMouseover:function(e){var n=t(e.target);e.preventDefault(),n.hasClass("textcomplete-item")||(n=n.closest(".textcomplete-item")),this._index=parseInt(n.data("index"),10),this._activateIndexedItem()},_onKeydown:function(e){if(this.shown){var n;switch(t.isFunction(this.option.onKeydown)&&(n=this.option.onKeydown(e,r)),null==n&&(n=this._defaultKeydown(e)),n){case r.KEY_UP:e.preventDefault(),this._up();break;case r.KEY_DOWN:e.preventDefault(),this._down();break;case r.KEY_ENTER:e.preventDefault(),this._enter(e);break;case r.KEY_PAGEUP:e.preventDefault(),this._pageup();break;case r.KEY_PAGEDOWN:e.preventDefault(),this._pagedown();break;case r.KEY_ESCAPE:e.preventDefault(),this.deactivate()}}},_defaultKeydown:function(t){return this.isUp(t)?r.KEY_UP:this.isDown(t)?r.KEY_DOWN:this.isEnter(t)?r.KEY_ENTER:this.isPageup(t)?r.KEY_PAGEUP:this.isPagedown(t)?r.KEY_PAGEDOWN:this.isEscape(t)?r.KEY_ESCAPE:void 0},_up:function(){0===this._index?this._index=this.data.length-1:this._index-=1,this._activateIndexedItem(),this._setScroll()},_down:function(){this._index===this.data.length-1?this._index=0:this._index+=1,this._activateIndexedItem(),this._setScroll()},_enter:function(t){var e=this.data[parseInt(this._getActiveElement().data("index"),10)];this.completer.select(e.value,e.strategy,t),this.deactivate()},_pageup:function(){var e=0,n=this._getActiveElement().position().top-this.$el.innerHeight();this.$el.children().each(function(i){return t(this).position().top+t(this).outerHeight()>n?(e=i,!1):void 0}),this._index=e,this._activateIndexedItem(),this._setScroll()},_pagedown:function(){var e=this.data.length-1,n=this._getActiveElement().position().top+this.$el.innerHeight();this.$el.children().each(function(i){return t(this).position().top>n?(e=i,!1):void 0}),this._index=e,this._activateIndexedItem(),this._setScroll()},_activateIndexedItem:function(){this.$el.find(".textcomplete-item.active").removeClass("active"),this._getActiveElement().addClass("active")},_getActiveElement:function(){return this.$el.children(".textcomplete-item:nth("+this._index+")")},_setScroll:function(){var t=this._getActiveElement(),e=t.position().top,n=t.outerHeight(),i=this.$el.innerHeight(),o=this.$el.scrollTop();0===this._index||this._index==this.data.length-1||0>e?this.$el.scrollTop(e+o):e+n>i&&this.$el.scrollTop(e+n+o-i)},_buildContents:function(t){var e,n,o,r="";for(n=0;n<t.length&&this.data.length!==this.maxCount;n++)e=t[n],i(this.data,e)||(o=this.data.length,this.data.push(e),r+='<li class="textcomplete-item" data-index="'+o+'"><a>',r+=e.strategy.template(e.value,e.term),r+="</a></li>");return r},_renderHeader:function(e){if(this.header){this._$header||(this._$header=t('<li class="textcomplete-header"></li>').prependTo(this.$el));var n=t.isFunction(this.header)?this.header(e):this.header;this._$header.html(n)}},_renderFooter:function(e){if(this.footer){this._$footer||(this._$footer=t('<li class="textcomplete-footer"></li>').appendTo(this.$el));var n=t.isFunction(this.footer)?this.footer(e):this.footer;this._$footer.html(n)}},_renderNoResultsMessage:function(e){if(this.noResultsMessage){this._$noResultsMessage||(this._$noResultsMessage=t('<li class="textcomplete-no-results-message"></li>').appendTo(this.$el));var n=t.isFunction(this.noResultsMessage)?this.noResultsMessage(e):this.noResultsMessage;this._$noResultsMessage.html(n)}},_renderContents:function(t){this._$footer?this._$footer.before(t):this.$el.append(t)},_fitToBottom:function(){var t=n.scrollTop()+n.height(),e=this.$el.height();this.$el.position().top+e>t&&(this.completer.$iframe||this.$el.offset({top:t-e}))},_fitToRight:function(){for(var t,e=30,i=this.$el.offset().left,o=this.$el.width(),r=n.width()-e;i+o>r&&(this.$el.offset({left:i-e}),t=this.$el.offset().left,!(t>=i));)i=t},_applyPlacement:function(t){return t.height=Math.min(this.$el.parent().height(),n.height()),-1!==this.placement.indexOf("top")?t={top:"auto",bottom:t.height-t.top+t.lineHeight,left:t.left}:(t.bottom="auto",delete t.lineHeight),-1!==this.placement.indexOf("absleft")?t.left=0:-1!==this.placement.indexOf("absright")&&(t.right=0,t.left="auto"),t}}),t.fn.textcomplete.Dropdown=e,t.extend(t.fn.textcomplete,r)}(t),+function(t){"use strict";function e(e){t.extend(this,e),this.cache&&(this.search=n(this.search))}var n=function(t){var e={};return function(n,i){e[n]?i(e[n]):t.call(this,n,function(t){e[n]=(e[n]||[]).concat(t),i.apply(null,arguments)})}};e.parse=function(n,i){return t.map(n,function(t){var n=new e(t);return n.el=i.el,n.$el=i.$el,n})},t.extend(e.prototype,{match:null,replace:null,search:null,id:null,cache:!1,context:function(){return!0},index:2,template:function(t){return t},idProperty:null}),t.fn.textcomplete.Strategy=e}(t),+function(t){"use strict";function e(){}var n=Date.now||function(){return(new Date).getTime()},i=function(t,e){var i,o,r,s,a,l=function(){var c=n()-s;e>c?i=setTimeout(l,e-c):(i=null,a=t.apply(r,o),r=o=null)};return function(){return r=this,o=arguments,s=n(),i||(i=setTimeout(l,e)),a}};t.extend(e.prototype,{id:null,completer:null,el:null,$el:null,option:null,initialize:function(e,n,o){this.el=e,this.$el=t(e),this.id=n.id+this.constructor.name,this.completer=n,this.option=o,this.option.debounce&&(this._onKeyup=i(this._onKeyup,this.option.debounce)),this._bindEvents()},destroy:function(){this.$el.off("."+this.id),this.$el=this.el=this.completer=null},select:function(){throw new Error("Not implemented")},getCaretPosition:function(){var e=this._getCaretRelativePosition(),n=this.$el.offset(),i=this.option.appendTo;if(i){i instanceof t||(i=t(i));var o=i.offsetParent().offset();n.top-=o.top,n.left-=o.left}return e.top+=n.top,e.left+=n.left,e},focus:function(){this.$el.focus()},_bindEvents:function(){this.$el.on("keyup."+this.id,t.proxy(this._onKeyup,this))},_onKeyup:function(t){this._skipSearch(t)||this.completer.trigger(this.getTextFromHeadToCaret(),!0)},_skipSearch:function(t){switch(t.keyCode){case 9:case 13:case 40:case 38:case 27:return!0}if(t.ctrlKey)switch(t.keyCode){case 78:case 80:return!0}}}),t.fn.textcomplete.Adapter=e}(t),+function(t){"use strict";function e(t,e,n){this.initialize(t,e,n)}t.extend(e.prototype,t.fn.textcomplete.Adapter.prototype,{select:function(e,n,i){var o,r=this.getTextFromHeadToCaret(),s=this.el.value.substring(this.el.selectionEnd),a=n.replace(e,i);"undefined"!=typeof a&&(t.isArray(a)&&(s=a[1]+s,a=a[0]),o=t.isFunction(n.match)?n.match(r):n.match,r=r.replace(o,a),this.$el.val(r+s),this.el.selectionStart=this.el.selectionEnd=r.length)},getTextFromHeadToCaret:function(){return this.el.value.substring(0,this.el.selectionEnd)},_getCaretRelativePosition:function(){var e=t.fn.textcomplete.getCaretCoordinates(this.el,this.el.selectionStart);return{top:e.top+this._calculateLineHeight()-this.$el.scrollTop(),left:e.left-this.$el.scrollLeft(),lineHeight:this._calculateLineHeight()}},_calculateLineHeight:function(){var t=parseInt(this.$el.css("line-height"),10);if(isNaN(t)){var e=this.el.parentNode,n=document.createElement(this.el.nodeName),i=this.el.style;n.setAttribute("style","margin:0px;padding:0px;font-family:"+i.fontFamily+";font-size:"+i.fontSize),n.innerHTML="test",e.appendChild(n),t=n.clientHeight,e.removeChild(n)}return t}}),t.fn.textcomplete.Textarea=e}(t),+function(t){"use strict";function e(e,i,o){this.initialize(e,i,o),t("<span>"+n+"</span>").css({position:"absolute",top:-9999,left:-9999}).insertBefore(e)}var n="吶";t.extend(e.prototype,t.fn.textcomplete.Textarea.prototype,{select:function(e,n,i){var o,r=this.getTextFromHeadToCaret(),s=this.el.value.substring(r.length),a=n.replace(e,i);if("undefined"!=typeof a){t.isArray(a)&&(s=a[1]+s,a=a[0]),o=t.isFunction(n.match)?n.match(r):n.match,r=r.replace(o,a),this.$el.val(r+s),this.el.focus();var l=this.el.createTextRange();l.collapse(!0),l.moveEnd("character",r.length),l.moveStart("character",r.length),l.select()}},getTextFromHeadToCaret:function(){this.el.focus();var t=document.selection.createRange();t.moveStart("character",-this.el.value.length);var e=t.text.split(n);return 1===e.length?e[0]:e[1]}}),t.fn.textcomplete.IETextarea=e}(t),+function(t){"use strict";function e(t,e,n){this.initialize(t,e,n)}t.extend(e.prototype,t.fn.textcomplete.Adapter.prototype,{select:function(e,n,i){var o=this.getTextFromHeadToCaret(),r=this.el.ownerDocument.getSelection(),s=r.getRangeAt(0),a=s.cloneRange();a.selectNodeContents(s.startContainer);var l,c=a.toString(),u=c.substring(s.startOffset),h=n.replace(e,i);if("undefined"!=typeof h){t.isArray(h)&&(u=h[1]+u,h=h[0]),l=t.isFunction(n.match)?n.match(o):n.match,o=o.replace(l,h).replace(/ $/,"&nbsp"),s.selectNodeContents(s.startContainer),s.deleteContents();var d=this.el.ownerDocument.createElement("div");d.innerHTML=o;var p=this.el.ownerDocument.createElement("div");p.innerHTML=u;for(var f,g,m=this.el.ownerDocument.createDocumentFragment();f=d.firstChild;)g=m.appendChild(f);for(;f=p.firstChild;)m.appendChild(f);s.insertNode(m),s.setStartAfter(g),s.collapse(!0),r.removeAllRanges(),r.addRange(s)}},_getCaretRelativePosition:function(){var e=this.el.ownerDocument.getSelection().getRangeAt(0).cloneRange(),n=this.el.ownerDocument.createElement("span");e.insertNode(n),e.selectNodeContents(n),e.deleteContents();var i=t(n),o=i.offset();if(o.left-=this.$el.offset().left,o.top+=i.height()-this.$el.offset().top,o.lineHeight=i.height(),this.completer.$iframe){var r=this.completer.$iframe.offset();o.top+=r.top,o.left+=r.left,o.top-=this.$el.scrollTop()}return i.remove(),o},getTextFromHeadToCaret:function(){var t=this.el.ownerDocument.getSelection().getRangeAt(0),e=t.cloneRange();return e.selectNodeContents(t.startContainer),e.toString().substring(0,t.startOffset)}}),t.fn.textcomplete.ContentEditable=e}(t),+function(t){"use strict";function e(t,e,n){this.initialize(t,e,n)}t.extend(e.prototype,t.fn.textcomplete.ContentEditable.prototype,{_bindEvents:function(){var e=this;CKEDITOR.instances.issue_notes.on("key",function(t){var n=t.data;return e._onKeyup(n),(!e.completer.dropdown.shown||!e._skipSearch(n))&&void 0},null,null,1),this.$el.on("keyup."+this.id,t.proxy(this._onKeyup,this))}}),t.fn.textcomplete.CKEditor=e}(t),function(t){function e(t,e,r){if(!i)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");var s=r&&r.debug||!1;if(s){var a=document.querySelector("#input-textarea-caret-position-mirror-div");a&&a.parentNode.removeChild(a)}var l=document.createElement("div");l.id="input-textarea-caret-position-mirror-div",document.body.appendChild(l);var c=l.style,u=window.getComputedStyle?getComputedStyle(t):t.currentStyle;c.whiteSpace="pre-wrap","INPUT"!==t.nodeName&&(c.wordWrap="break-word"),c.position="absolute",s||(c.visibility="hidden"),n.forEach(function(t){c[t]=u[t]}),o?t.scrollHeight>parseInt(u.height)&&(c.overflowY="scroll"):c.overflow="hidden",l.textContent=t.value.substring(0,e),"INPUT"===t.nodeName&&(l.textContent=l.textContent.replace(/\s/g," "));var h=document.createElement("span");h.textContent=t.value.substring(e)||".",l.appendChild(h);var d={top:h.offsetTop+parseInt(u.borderTopWidth),left:h.offsetLeft+parseInt(u.borderLeftWidth)};return s?h.style.backgroundColor="#aaa":document.body.removeChild(l),d}var n=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],i="undefined"!=typeof window,o=i&&null!=window.mozInnerScreenX;t.fn.textcomplete.getCaretCoordinates=e}(t),t}),marked.setOptions({gfm:!0,tables:!0,breaks:!0,pedantic:!1,sanitize:!0,smartLists:!0,smartypants:!1}),$(".flaskbb-editor").markdown({iconlibrary:"fa",additionalButtons:[[{name:"groupHelp",data:[{name:"cmdHelp",toggle:!1,title:"Help",icon:"fa fa-question",btnClass:"btn btn-success",callback:function(t){$("#editor-help").modal("show")}}]}]]}),$(".flaskbb-editor").textcomplete([{match:/\B:([\-+\w]*)$/,search:function(t,e){e($.map(emojies,function(e){return 0===e.indexOf(t)?e:null}))},template:function(t){return'<img class="emoji" src="/static/emoji/'+t+'.png"></img>'+t},replace:function(t){return":"+t+": "},index:1}],{onKeydown:function(t,e){if(t.ctrlKey&&74===t.keyCode)return e.KEY_ENTER}});var emojies=["+1","-1","100","1234","8ball","a","ab","abc","abcd","accept","aerial_tramway","airplane","alarm_clock","alien","ambulance","anchor","angel","anger","angry","anguished","ant","apple","aquarius","aries","arrow_backward","arrow_double_down","arrow_double_up","arrow_down","arrow_down_small","arrow_forward","arrow_heading_down","arrow_heading_up","arrow_left","arrow_lower_left","arrow_lower_right","arrow_right","arrow_right_hook","arrow_up","arrow_up_down","arrow_up_small","arrow_upper_left","arrow_upper_right","arrows_clockwise","arrows_counterclockwise","art","articulated_lorry","astonished","athletic_shoe","atm","b","baby","baby_bottle","baby_chick","baby_symbol","back","baggage_claim","balloon","ballot_box_with_check","bamboo","banana","bangbang","bank","bar_chart","barber","baseball","basketball","bath","bathtub","battery","bear","bee","beer","beers","beetle","beginner","bell","bento","bicyclist","bike","bikini","bird","birthday","black_circle","black_joker","black_large_square","black_medium_small_square","black_medium_square","black_nib","black_small_square","black_square_button","blossom","blowfish","blue_book","blue_car","blue_heart","blush","boar","boat","bomb","book","bookmark","bookmark_tabs","books","boom","boot","bouquet","bow","bowling","bowtie","boy","bread","bride_with_veil","bridge_at_night","briefcase","broken_heart","bug","bulb","bullettrain_front","bullettrain_side","bus","busstop","bust_in_silhouette","busts_in_silhouette","cactus","cake","calendar","calling","camel","camera","cancer","candy","capital_abcd","capricorn","car","card_index","carousel_horse","cat","cat2","cd","chart","chart_with_downwards_trend","chart_with_upwards_trend","checkered_flag","cherries","cherry_blossom","chestnut","chicken","children_crossing","chocolate_bar","christmas_tree","church","cinema","circus_tent","city_sunrise","city_sunset","cl","clap","clapper","clipboard","clock1","clock10","clock1030","clock11","clock1130","clock12","clock1230","clock130","clock2","clock230","clock3","clock330","clock4","clock430","clock5","clock530","clock6","clock630","clock7","clock730","clock8","clock830","clock9","clock930","closed_book","closed_lock_with_key","closed_umbrella","cloud","clubs","cn","cocktail","coffee","cold_sweat","collision","computer","confetti_ball","confounded","confused","congratulations","construction","construction_worker","convenience_store","cookie","cool","cop","copyright","corn","couple","couple_with_heart","couplekiss","cow","cow2","credit_card","crescent_moon","crocodile","crossed_flags","crown","cry","crying_cat_face","crystal_ball","cupid","curly_loop","currency_exchange","curry","custard","customs","cyclone","dancer","dancers","dango","dart","dash","date","de","deciduous_tree","department_store","diamond_shape_with_a_dot_inside","diamonds","disappointed","disappointed_relieved","dizzy","dizzy_face","do_not_litter","dog","dog2","dollar","dolls","dolphin","door","doughnut","dragon","dragon_face","dress","dromedary_camel","droplet","dvd","e-mail","ear","ear_of_rice","earth_africa","earth_americas","earth_asia","egg","eggplant","eight","eight_pointed_black_star","eight_spoked_asterisk","electric_plug","elephant","email","end","envelope","envelope_with_arrow","es","euro","european_castle","european_post_office","evergreen_tree","exclamation","expressionless","eyeglasses","eyes","facepunch","factory","fallen_leaf","family","fast_forward","fax","fearful","feelsgood","feet","ferris_wheel","file_folder","finnadie","fire","fire_engine","fireworks","first_quarter_moon","first_quarter_moon_with_face","fish","fish_cake","fishing_pole_and_fish","fist","five","flags","flashlight","floppy_disk","flower_playing_cards","flushed","foggy","football","footprints","fork_and_knife","fountain","four","four_leaf_clover","fr","free","fried_shrimp","fries","frog","frowning","fu","fuelpump","full_moon","full_moon_with_face","game_die","gb","gem","gemini","ghost","gift","gift_heart","girl","globe_with_meridians","goat","goberserk","godmode","golf","grapes","green_apple","green_book","green_heart","grey_exclamation","grey_question","grimacing","grin","grinning","guardsman","guitar","gun","haircut","hamburger","hammer","hamster","hand","handbag","hankey","hash","hatched_chick","hatching_chick","headphones","hear_no_evil","heart","heart_decoration","heart_eyes","heart_eyes_cat","heartbeat","heartpulse","hearts","heavy_check_mark","heavy_division_sign","heavy_dollar_sign","heavy_exclamation_mark","heavy_minus_sign","heavy_multiplication_x","heavy_plus_sign","helicopter","herb","hibiscus","high_brightness","high_heel","hocho","honey_pot","honeybee","horse","horse_racing","hospital","hotel","hotsprings","hourglass","hourglass_flowing_sand","house","house_with_garden","hurtrealbad","hushed","ice_cream","icecream","id","ideograph_advantage","imp","inbox_tray","incoming_envelope","information_desk_person","information_source","innocent","interrobang","iphone","it","izakaya_lantern","jack_o_lantern","japan","japanese_castle","japanese_goblin","japanese_ogre","jeans","joy","joy_cat","jp","key","keycap_ten","kimono","kiss","kissing","kissing_cat","kissing_closed_eyes","kissing_heart","kissing_smiling_eyes","koala","koko","kr","lantern","large_blue_circle","large_blue_diamond","large_orange_diamond","last_quarter_moon","last_quarter_moon_with_face","laughing","leaves","ledger","left_luggage","left_right_arrow","leftwards_arrow_with_hook","lemon","leo","leopard","libra","light_rail","link","lips","lipstick","lock","lock_with_ink_pen","lollipop","loop","loudspeaker","love_hotel","love_letter","low_brightness","m","mag","mag_right","mahjong","mailbox","mailbox_closed","mailbox_with_mail","mailbox_with_no_mail","man","man_with_gua_pi_mao","man_with_turban","mans_shoe","maple_leaf","mask","massage","meat_on_bone","mega","melon","memo","mens","metal","metro","microphone","microscope","milky_way","minibus","minidisc","mobile_phone_off","money_with_wings","moneybag","monkey","monkey_face","monorail","moon","mortar_board","mount_fuji","mountain_bicyclist","mountain_cableway","mountain_railway","mouse","mouse2","movie_camera","moyai","muscle","mushroom","musical_keyboard","musical_note","musical_score","mute","nail_care","name_badge","neckbeard","necktie","negative_squared_cross_mark","neutral_face","new","new_moon","new_moon_with_face","newspaper","ng","nine","no_bell","no_bicycles","no_entry","no_entry_sign","no_good","no_mobile_phones","no_mouth","no_pedestrians","no_smoking","non-potable_water","nose","notebook","notebook_with_decorative_cover","notes","nut_and_bolt","o","o2","ocean","octocat","octopus","oden","office","ok","ok_hand","ok_woman","older_man","older_woman","on","oncoming_automobile","oncoming_bus","oncoming_police_car","oncoming_taxi","one","open_book","open_file_folder","open_hands","open_mouth","ophiuchus","orange_book","outbox_tray","ox","package","page_facing_up","page_with_curl","pager","palm_tree","panda_face","paperclip","parking","part_alternation_mark","partly_sunny","passport_control","paw_prints","peach","pear","pencil","pencil2","penguin","pensive","performing_arts","persevere","person_frowning","person_with_blond_hair","person_with_pouting_face","phone","pig","pig2","pig_nose","pill","pineapple","pisces","pizza","point_down","point_left","point_right","point_up","point_up_2","police_car","poodle","poop","post_office","postal_horn","postbox","potable_water","pouch","poultry_leg","pound","pouting_cat","pray","princess","punch","purple_heart","purse","pushpin","put_litter_in_its_place","question","rabbit","rabbit2","racehorse","radio","radio_button","rage","rage1","rage2","rage3","rage4","railway_car","rainbow","raised_hand","raised_hands","raising_hand","ram","ramen","rat","recycle","red_car","red_circle","registered","relaxed","relieved","repeat","repeat_one","restroom","revolving_hearts","rewind","ribbon","rice","rice_ball","rice_cracker","rice_scene","ring","rocket","roller_coaster","rooster","rose","rotating_light","round_pushpin","rowboat","ru","rugby_football","runner","running","running_shirt_with_sash","sa","sagittarius","sailboat","sake","sandal","santa","satellite","satisfied","saxophone","school","school_satchel","scissors","scorpius","scream","scream_cat","scroll","seat","secret","see_no_evil","seedling","seven","shaved_ice","sheep","shell","ship","shipit","shirt","shit","shoe","shower","signal_strength","six","six_pointed_star","ski","skull","sleeping","sleepy","slot_machine","small_blue_diamond","small_orange_diamond","small_red_triangle","small_red_triangle_down","smile","smile_cat","smiley","smiley_cat","smiling_imp","smirk","smirk_cat","smoking","snail","snake","snowboarder","snowflake","snowman","sob","soccer","soon","sos","sound","space_invader","spades","spaghetti","sparkle","sparkler","sparkles","sparkling_heart","speak_no_evil","speaker","speech_balloon","speedboat","squirrel","star","star2","stars","station","statue_of_liberty","steam_locomotive","stew","straight_ruler","strawberry","stuck_out_tongue","stuck_out_tongue_closed_eyes","stuck_out_tongue_winking_eye","sun_with_face","sunflower","sunglasses","sunny","sunrise","sunrise_over_mountains","surfer","sushi","suspect","suspension_railway","sweat","sweat_drops","sweat_smile","sweet_potato","swimmer","symbols","syringe","tada","tanabata_tree","tangerine","taurus","taxi","tea","telephone","telephone_receiver","telescope","tennis","tent","thought_balloon","three","thumbsdown","thumbsup","ticket","tiger","tiger2","tired_face","tm","toilet","tokyo_tower","tomato","tongue","top","tophat","tractor","traffic_light","train","train2","tram","triangular_flag_on_post","triangular_ruler","trident","triumph","trolleybus","trollface","trophy","tropical_drink","tropical_fish","truck","trumpet","tshirt","tulip","turtle","tv","twisted_rightwards_arrows","two","two_hearts","two_men_holding_hands","two_women_holding_hands","u5272","u5408","u55b6","u6307","u6708","u6709","u6e80","u7121","u7533","u7981","u7a7a","uk","umbrella","unamused","underage","unlock","up","us","v","vertical_traffic_light","vhs","vibration_mode","video_camera","video_game","violin","virgo","volcano","vs","walking","waning_crescent_moon","waning_gibbous_moon","warning","watch","water_buffalo","watermelon","wave","wavy_dash","waxing_crescent_moon","waxing_gibbous_moon","wc","weary","wedding","whale","whale2","wheelchair","white_check_mark","white_circle","white_flower","white_large_square","white_medium_small_square","white_medium_square","white_small_square","white_square_button","wind_chime","wine_glass","wink","wolf","woman","womans_clothes","womans_hat","womens","worried","wrench","x","yellow_heart","yen","yum","zap","zero","zzz"],csrftoken=$("meta[name=csrf-token]").attr("content"),show_management_search=function(){var t=$(".management-body"),e=t.find(".search-form");e.slideToggle(function(){"none"!=e.css("display")&&e.find("input").focus()})},flash_message=function(t){var e=$("#flashed-messages"),n='<div class="alert alert-'+t.category+'">';n+="success"==t.category?'<span class="glyphicon glyphicon-ok-sign"></span>&nbsp;':"error"==t.category?'<span class="glyphicon glyphicon-exclamation-sign"></span>&nbsp;':'<span class="glyphicon glyphicon-info-sign"></span>&nbsp;',n+='<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'+t.message+"</div>",e.append(n)},BulkActions=function(){this.execute=function(t){var e=$("input.action-checkbox:checked").length,n={ids:[]};return 0!==e&&($("input.action-checkbox:checked").each(function(t,e){n.ids.push($(e).val())}),this.confirm(t,n),!1)},this.confirm=function(t,e){$(".confirmModal").modal({keyboard:!1}).one("click",".confirmBtn",function(){$(".confirmModal").modal("hide"),send_data(t,e)}).on("hidden.bs.modal",function(){$(".confirmBtn").unbind()})}},send_data=function(t,e){$.ajax({url:t,method:"POST",data:JSON.stringify(e),dataType:"json",contentType:"application/json",beforeSend:function(t,e){/^(GET|HEAD|OPTIONS|TRACE)$/i.test(e.type)||this.crossDomain||t.setRequestHeader("X-CSRFToken",csrftoken)}}).done(function(t){flash_message(t),$.each(t.data,function(t,e){var n=$("#"+e.type+"-"+e.id);e.reverse?(n.attr("action",e.reverse_url),"ban"==e.type?reverse_html='<span class="fa fa-flag text-success" data-toggle="tooltip" data-placement="top" title="'+e.reverse_name+'"></span>':"unban"==e.type&&(reverse_html='<span class="fa fa-flag text-warning" data-toggle="tooltip" data-placement="top" title="'+e.reverse_name+'"></span>'),n.find("button").html(reverse_html)):n.parents(".action-row").remove()})}).fail(function(t){flash_message(t)})};$(document).ready(function(){$(".action-checkall").change(function(){
+$("input.action-checkbox").prop("checked",this.checked)}),$(".reply-btn").click(function(t){t.preventDefault();var e=$(this).attr("data-message-id");$.get("/message/message/"+e+"/raw",function(t){var e=$(".flaskbb-editor");e.val((e.val()+"\n"+t).trim()+"\n"),e.selectionStart=e.selectionEnd=e.val().length,e[0].scrollTop=e[0].scrollHeight,window.location.href="#content"})}),$(".quote-btn").click(function(t){t.preventDefault();var e=$(this).attr("data-post-id");$.get("/post/"+e+"/raw",function(t){var e=$(".flaskbb-editor");e.val((e.val()+"\n"+t).trim()+"\n"),e.selectionStart=e.selectionEnd=e.val().length,e[0].scrollTop=e[0].scrollHeight,window.location.href="#content"})}),$('button[name="confirmDialog"]').on("click",function(t){var e=$(this).closest("form");t.preventDefault(),$(".confirmModal").modal({keyboard:!0}).one("click",".confirmBtn",function(){e.trigger("submit")}).on("hidden.bs.modal",function(){$(".confirmBtn").unbind()})})});

+ 17 - 0
flaskbb/templates/confirm_dialog.html

@@ -0,0 +1,17 @@
+<div class="modal fade confirmModal">
+    <div class="modal-dialog">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
+                <h4 class="modal-title" id="confirmModalLabel">{% trans %}Are you sure?{% endtrans %}</h4>
+            </div>
+            <div class="modal-body">
+                <p>{% trans %}Are you sure that you want to perform this action? This action is irreversible.{% endtrans %}</p>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-default" data-dismiss="modal">{% trans %}Cancel{% endtrans %}</button>
+                <button type="button" class="btn btn-danger btn-ok confirmBtn">{% trans %}Yes{% endtrans %}</button>
+            </div>
+        </div>
+    </div>
+</div>

+ 3 - 2
flaskbb/templates/forum/topic.html

@@ -114,7 +114,7 @@
                                 {% if current_user|delete_topic(topic) %}
                                 <form class="inline-form" method="post" action="{{ url_for('forum.delete_topic', topic_id=topic.id, slug=topic.slug) }}">
                                     <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
-                                    <button class="btn btn-icon icon-delete" data-toggle="tooltip" data-placement="top" title="Delete this topic"></button>
+                                    <button class="btn btn-icon icon-delete" name="confirmDialog" data-toggle="tooltip" data-placement="top" title="Delete this topic"></button>
                                 </form>
                                 {% endif %}
                             {% else %}
@@ -122,7 +122,7 @@
                             <!-- Delete Post -->
                                 <form class="inline-form" method="post" action="{{ url_for('forum.delete_post', post_id=post.id) }}">
                                     <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
-                                    <button  class="btn btn-icon icon-delete" data-toggle="tooltip" data-placement="top" title="Delete this post"></button>
+                                    <button  class="btn btn-icon icon-delete" name="confirmDialog" data-toggle="tooltip" data-placement="top" title="Delete this post"></button>
                                 </form>
                                 {% endif %}
 
@@ -165,6 +165,7 @@
     {% endif %}
 
 </div>
+{% include theme('confirm_dialog.html') %}
 {% endblock %}
 
 {% block scripts %}

+ 6 - 5
flaskbb/templates/management/banned_users.html

@@ -67,13 +67,13 @@
                     {% if current_user|can_ban_user %}
                         <div class="btn-group">
                             <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
-                                <span class="fa fa-cog"></span> {% trans %}Actions{% endtrans %}
+                                <span class="fa fa-fw fa-cog"></span> {% trans %}Actions{% endtrans %}
                             </button>
                             <ul class="dropdown-menu slidedown">
                                 <li>
-                                    <a href="javascript:void(0)" onclick="return bulk_actions.execute('{{ url_for('management.unban_user') }}', '{% trans %}Are you sure you want to unban these Users?{% endtrans %}')">
-                                        <span class="fa fa-flag text-success"></span> {% trans %}Unban selected Users{% endtrans %}
-                                    </a>
+                                    <button class="btn btn-link" onclick="return bulk_actions.execute('{{ url_for('management.unban_user') }}')">
+                                        <span class="fa fa-fw fa-flag text-success"></span> {% trans %}Unban selected Users{% endtrans %}
+                                    </button>
                                 </li>
                             </ul>
                         </div>
@@ -92,7 +92,7 @@
                         <form class="inline-form" id="unban-{{user.id}}" method="post" action="{{ url_for('management.unban_user', user_id = user.id) }}">
                             <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
 
-                            <button class="btn btn-icon">
+                            <button class="btn btn-icon" name="confirmDialog">
                                 <span class="fa fa-flag text-success" data-toggle="tooltip" data-placement="top" title="{% trans %}Unban{% endtrans %}"></span>
                             </button>
                         </form>
@@ -112,6 +112,7 @@
         </div>
     </div>
 </div>
+{% include theme('confirm_dialog.html') %}
 {% endblock %}
 
 {% block scripts %}

+ 8 - 4
flaskbb/templates/management/forums.html

@@ -23,7 +23,6 @@
     </div>
 </div>
 
-
 <div class="col-md-9 settings-col with-left-border">
     <div class="panel settings-panel">
         <div class="panel-heading settings-head">
@@ -48,7 +47,7 @@
                                     </a>
                                     <form class="inline-form" method="post" action="{{ url_for('management.delete_category', category_id=category.id) }}">
                                         <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
-                                        <button class="btn btn-xs btn-danger">
+                                        <button class="btn btn-xs btn-danger" name="confirmDialog">
                                             <span class="fa fa-trash"></span> {% trans %}Delete Category{% endtrans %}
                                         </button>
                                     </form>
@@ -102,7 +101,9 @@
 
                                     <form class="inline-form" method="post" action="{{ url_for('management.delete_forum', forum_id=forum.id) }}">
                                         <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
-                                        <button class="btn btn-sm btn-danger"><span class="fa fa-trash"></span> {% trans %}Delete Link{% endtrans %}</button>
+                                        <button class="btn btn-sm btn-danger" name="confirmDialog">
+                                            <span class="fa fa-trash"></span> {% trans %}Delete Link{% endtrans %}
+                                        </button>
                                     </form>
                                 </div>
                             </div>
@@ -156,7 +157,9 @@
 
                                     <form class="inline-form" method="post" action="{{ url_for('management.delete_forum', forum_id=forum.id) }}">
                                         <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
-                                        <button class="btn btn-sm btn-danger"><span class="fa fa-trash"></span> {% trans %}Delete Forum{% endtrans %}</button>
+                                        <button class="btn btn-sm btn-danger" name="confirmDialog">
+                                            <span class="fa fa-trash"></span> {% trans %}Delete Forum{% endtrans %}
+                                        </button>
                                     </form>
                                 </div>
                             </div>
@@ -172,4 +175,5 @@
         </div>
     </div>
 </div>
+{% include theme('confirm_dialog.html') %}
 {% endblock %}

+ 6 - 5
flaskbb/templates/management/groups.html

@@ -36,13 +36,13 @@
                     <div class="col-md-2 col-sm-2 col-xs-5">
                         <div class="btn-group">
                             <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
-                                <span class="fa fa-cog"></span> {% trans %}Actions{% endtrans %}
+                                <span class="fa fa-fw fa-cog"></span> {% trans %}Actions{% endtrans %}
                             </button>
                             <ul class="dropdown-menu slidedown">
                                 <li>
-                                    <a href="javascript:void(0)" onclick="return bulk_actions.execute('{{ url_for('management.delete_group') }}', '{% trans %}Are you sure you want to delete these Groups?{% endtrans %}')">
-                                        <span class="fa fa-trash text-danger"></span> {% trans %}Delete selected Groups{% endtrans %}
-                                    </a>
+                                    <button class="btn btn-link" onclick="return bulk_actions.execute('{{ url_for('management.delete_group') }}')">
+                                        <span class="fa fa-fw fa-trash text-danger"></span> {% trans %}Delete selected Groups{% endtrans %}
+                                    </button>
                                 </li>
                             </ul>
                         </div>
@@ -60,7 +60,7 @@
                         </a>
                         <form class="inline-form" id="delete-{{group.id}}" method="post" action="{{ url_for('management.delete_group', group_id=group.id) }}">
                             <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
-                            <button class="btn btn-icon">
+                            <button class="btn btn-icon" name="confirmDialog">
                                 <span class="fa fa-trash text-danger" data-toggle="tooltip" data-placement="top" title="{% trans %}Delete{% endtrans %}"></span>
                             </button>
                         </form>
@@ -78,6 +78,7 @@
         </div>
     </div>
 </div>
+{% include theme('confirm_dialog.html') %}
 {% endblock %}
 
 {% block scripts %}

+ 6 - 5
flaskbb/templates/management/unread_reports.html

@@ -42,13 +42,13 @@
                     <div class="col-md-2 col-sm-2 col-xs-2">
                         <div class="btn-group">
                             <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
-                                <span class="fa fa-cog"></span> {% trans %}Actions{% endtrans %}
+                                <span class="fa fa-fw fa-cog"></span> {% trans %}Actions{% endtrans %}
                             </button>
                             <ul class="dropdown-menu slidedown">
                                 <li>
-                                    <a href="javascript:void(0)" onclick="return bulk_actions.execute('{{ url_for('management.report_markread') }}', '{% trans %}Are you sure you want to mark these Reports as read?{% endtrans %}')">
-                                        <span class="fa fa-flag-o text-primary"></span> {% trans %}Mark as Read{% endtrans %}
-                                    </a>
+                                    <button class="btn btn-link" onclick="return bulk_actions.execute('{{ url_for('management.report_markread') }}')">
+                                        <span class="fa fa-fw fa-flag-o text-primary"></span> {% trans %}Mark as Read{% endtrans %}
+                                    </button>
                                 </li>
                             </ul>
                         </div>
@@ -65,7 +65,7 @@
                     <div class="col-md-2 col-sm-2 col-xs-2">
                         <form class="inline-form" id="read-{{report.id}}" method="post" action="{{ url_for('management.report_markread', report_id=report.id) }}">
                             <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
-                            <button class="btn btn-icon">
+                            <button class="btn btn-icon" name="confirmDialog">
                                 <span class="fa fa-flag-o text-primary" data-toggle="tooltip" data-placement="top" title="{% trans %}Mark as Read{% endtrans %}"></span>
                             </button>
                         </form>
@@ -83,6 +83,7 @@
         </div>
     </div>
 </div>
+{% include theme('confirm_dialog.html') %}
 {% endblock %}
 
 {% block scripts %}

+ 14 - 13
flaskbb/templates/management/users.html

@@ -66,25 +66,25 @@
                     <div class="col-md-2 col-sm-2 col-xs-2">
                         <div class="btn-group">
                             <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
-                                <span class="fa fa-cog"></span> {% trans %}Actions{% endtrans %}
+                                <span class="fa fa-fw fa-cog"></span> {% trans %}Actions{% endtrans %}
                             </button>
                             <ul class="dropdown-menu slidedown">
                                 <li>
-                                    <a href="javascript:void(0)" onclick="return bulk_actions.execute('{{ url_for('management.ban_user') }}', '{% trans %}Are you sure you want to ban these Users?{% endtrans %}')">
-                                        <span class="fa fa-flag text-warning"></span> {% trans %}Ban selected Users{% endtrans %}
-                                    </a>
+                                    <button class="btn btn-link" onclick="return bulk_actions.execute('{{ url_for('management.ban_user') }}')">
+                                        <span class="fa fa-fw fa-flag text-warning"></span> {% trans %}Ban selected Users{% endtrans %}
+                                    </button>
                                 </li>
 
                                 <li>
-                                    <a href="javascript:void(0)" onclick="return bulk_actions.execute('{{ url_for('management.unban_user') }}', '{% trans %}Are you sure you want to unban these Users?{% endtrans %}')">
-                                        <span class="fa fa-flag text-success"></span> {% trans %}Unban selected Users{% endtrans %}
-                                    </a>
+                                    <button class="btn btn-link" onclick="return bulk_actions.execute('{{ url_for('management.unban_user') }}')">
+                                        <span class="fa fa-fw fa-flag text-success"></span> {% trans %}Unban selected Users{% endtrans %}
+                                    </button>
                                 </li>
 
                                 <li>
-                                    <a href="javascript:void(0)" onclick="return bulk_actions.execute('{{ url_for('management.delete_user') }}', '{% trans %}Are you sure you want to delete these Users?{% endtrans %}')">
-                                        <span class="fa fa-trash text-danger"></span> {% trans %}Delete selected Users{% endtrans %}
-                                    </a>
+                                    <button class="btn btn-link" onclick="return bulk_actions.execute('{{ url_for('management.delete_user') }}')">
+                                        <span class="fa fa-fw fa-trash text-danger"></span> {% trans %}Delete selected Users{% endtrans %}
+                                    </button>
                                 </li>
                             </ul>
                         </div>
@@ -108,7 +108,7 @@
                         <form class="inline-form" id="ban-{{user.id}}" method="post" action="{{ url_for('management.ban_user', user_id = user.id) }}">
                             <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
 
-                            <button class="btn btn-icon">
+                            <button class="btn btn-icon" name="confirmDialog">
                                 <span class="fa fa-flag text-warning" data-toggle="tooltip" data-placement="top" title="{% trans %}Ban{% endtrans %}"></span>
                             </button>
                         </form>
@@ -118,7 +118,7 @@
                         <form class="inline-form" id="unban-{{user.id}}" method="post" action="{{ url_for('management.unban_user', user_id = user.id) }}">
                             <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
 
-                            <button class="btn btn-icon">
+                            <button class="btn btn-icon" name="confirmDialog">
                                 <span class="fa fa-flag text-success" data-toggle="tooltip" data-placement="top" title="{% trans %}Unban{% endtrans %}"></span>
                             </button>
                         </form>
@@ -128,7 +128,7 @@
                         <form class="inline-form" id="delete-{{user.id}}" method="post" action="{{ url_for('management.delete_user', user_id = user.id) }}">
                             <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
 
-                            <button class="btn btn-icon">
+                            <button class="btn btn-icon" name="confirmDialog">
                                 <span class="fa fa-trash text-danger" data-toggle="tooltip" data-placement="top" title="{% trans %}Delete{% endtrans %}"></span>
                             </button>
                         </form>
@@ -149,6 +149,7 @@
         </div>
     </div>
 </div>
+{% include theme('confirm_dialog.html') %}
 {% endblock %}
 
 {% block scripts %}

+ 31 - 11
flaskbb/themes/aurora/src/js/flaskbb.js

@@ -38,8 +38,8 @@ var flash_message = function(message) {
 };
 
 var BulkActions = function() {
-    this.execute = function(url, confirm_message) {
-        var selected = $('input.action-checkbox:checked').size();
+    this.execute = function(endpoint) {
+        var selected = $('input.action-checkbox:checked').length;
         var data = {"ids": []};
 
         // don't do anything if nothing is selected
@@ -51,17 +51,21 @@ var BulkActions = function() {
             data.ids.push($(v).val());
         });
 
-        // http://stackoverflow.com/questions/784929/what-is-the-not-not-operator-in-javascript
-        if(!!confirm_message) {
-            if(!confirm(confirm_message)) {
-                return false;
-            }
-        }
-
-        send_data(url, data);
-
+        this.confirm(endpoint, data);
         return false;
     };
+
+    this.confirm = function(endpoint, data) {
+        $('.confirmModal').modal({ keyboard: false })
+            .one('click', '.confirmBtn', function() {
+                $('.confirmModal').modal('hide');
+                send_data(endpoint, data);
+            })
+            .on('hidden.bs.modal', function() {
+                $('.confirmBtn').unbind();
+            }
+        );
+    };
 };
 
 var send_data = function(endpoint_url, data) {
@@ -122,6 +126,7 @@ $(document).ready(function () {
             window.location.href = '#content';
         });
     });
+
     // Reply to post
     $('.quote-btn').click(function (event) {
         event.preventDefault();
@@ -135,4 +140,19 @@ $(document).ready(function () {
             window.location.href = '#content';
         });
     });
+
+    // Triggers the confirm dialog
+    $('button[name="confirmDialog"]').on('click', function(e){
+        var $form = $(this).closest('form');
+        e.preventDefault();
+        $('.confirmModal').modal({ keyboard: true })
+            .one('click', '.confirmBtn', function() {
+                $form.trigger('submit'); // submit the form
+            })
+            // .one() is NOT a typo of .on()
+            .on('hidden.bs.modal', function () {
+                $('.confirmBtn').unbind();
+            }
+        );
+    });
 });