65 lines
615 KiB
JavaScript
65 lines
615 KiB
JavaScript
/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */
|
||
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(S.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},S.extend=S.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:y}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),D=function(e,t){return e===t&&(l=!0),0},j={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",F=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",B=new RegExp(M+"+","g"),$=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="<a id='"+S+"'></a><select id='"+S+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0<se(t,C,null,[e]).length},se.contains=function(e,t){return(e.ownerDocument||e)!=C&&T(e),y(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=C&&T(e);var n=b.attrHandle[t.toLowerCase()],r=n&&j.call(b.attrHandle,t.toLowerCase())?n(e,t,!E):void 0;return void 0!==r?r:d.attributes||!E?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,n=[],r=0,i=0;if(l=!d.detectDuplicates,u=!d.sortStable&&e.slice(0),e.sort(D),l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return u=null,e},o=se.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else while(t=e[r++])n+=o(t);return n},(b=se.selectors={cacheLength:50,createPseudo:le,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(B," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(h,e,t,g,v){var y="nth"!==h.slice(0,3),m="last"!==h.slice(-4),x="of-type"===e;return 1===g&&0===v?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u,l=y!==m?"nextSibling":"previousSibling",c=e.parentNode,f=x&&e.nodeName.toLowerCase(),p=!n&&!x,d=!1;if(c){if(y){while(l){a=e;while(a=a[l])if(x?a.nodeName.toLowerCase()===f:1===a.nodeType)return!1;u=l="only"===h&&!u&&"nextSibling"}return!0}if(u=[m?c.firstChild:c.lastChild],m&&p){d=(s=(r=(i=(o=(a=c)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1])&&r[2],a=s&&c.childNodes[s];while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if(1===a.nodeType&&++d&&a===e){i[h]=[k,s,d];break}}else if(p&&(d=s=(r=(i=(o=(a=e)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1]),!1===d)while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if((x?a.nodeName.toLowerCase()===f:1===a.nodeType)&&++d&&(p&&((i=(o=a[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]=[k,d]),a===e))break;return(d-=v)===g||d%g==0&&0<=d/g}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?le(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=P(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:le(function(e){var r=[],i=[],s=f(e.replace($,"$1"));return s[S]?le(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:le(function(t){return function(e){return 0<se(t,e).length}}),contains:le(function(t){return t=t.replace(te,ne),function(e){return-1<(e.textContent||o(e)).indexOf(t)}}),lang:le(function(n){return V.test(n||"")||se.error("unsupported lang: "+n),n=n.replace(te,ne).toLowerCase(),function(e){var t;do{if(t=E?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===a},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve(function(){return[0]}),last:ve(function(e,t){return[t-1]}),eq:ve(function(e,t,n){return[n<0?n+t:n]}),even:ve(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:ve(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:ve(function(e,t,n){for(var r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:ve(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e);function me(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function be(s,e,t){var u=e.dir,l=e.next,c=l||u,f=t&&"parentNode"===c,p=r++;return e.first?function(e,t,n){while(e=e[u])if(1===e.nodeType||f)return s(e,t,n);return!1}:function(e,t,n){var r,i,o,a=[k,p];if(n){while(e=e[u])if((1===e.nodeType||f)&&s(e,t,n))return!0}else while(e=e[u])if(1===e.nodeType||f)if(i=(o=e[S]||(e[S]={}))[e.uniqueID]||(o[e.uniqueID]={}),l&&l===e.nodeName.toLowerCase())e=e[u]||e;else{if((r=i[c])&&r[0]===k&&r[1]===p)return a[2]=r[2];if((i[c]=a)[2]=s(e,t,n))return!0}return!1}}function we(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Te(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Ce(d,h,g,v,y,e){return v&&!v[S]&&(v=Ce(v)),y&&!y[S]&&(y=Ce(y,e)),le(function(e,t,n,r){var i,o,a,s=[],u=[],l=t.length,c=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:Te(c,s,d,n,r),p=g?y||(e?d:l||v)?[]:t:f;if(g&&g(f,p,n,r),v){i=Te(p,u),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(p[u[o]]=!(f[u[o]]=a))}if(e){if(y||d){if(y){i=[],o=p.length;while(o--)(a=p[o])&&i.push(f[o]=a);y(null,p=[],i,r)}o=p.length;while(o--)(a=p[o])&&-1<(i=y?P(e,a):s[o])&&(e[i]=!(t[i]=a))}}else p=Te(p===t?p.splice(l,p.length):p),y?y(null,t,p,r):H.apply(t,p)})}function Ee(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=be(function(e){return e===i},a,!0),l=be(function(e){return-1<P(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!==w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[be(we(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return Ce(1<s&&we(c),1<s&&xe(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace($,"$1"),t,s<n&&Ee(e.slice(s,n)),n<r&&Ee(e=e.slice(n)),n<r&&xe(e))}c.push(t)}return we(c)}return me.prototype=b.filters=b.pseudos,b.setFilters=new me,h=se.tokenize=function(e,t){var n,r,i,o,a,s,u,l=x[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=_.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace($," ")}),a=a.slice(n.length)),b.filter)!(r=G[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?se.error(e):x(e,s).slice(0)},f=se.compile=function(e,t){var n,v,y,m,x,r,i=[],o=[],a=A[e+" "];if(!a){t||(t=h(e)),n=t.length;while(n--)(a=Ee(t[n]))[S]?i.push(a):o.push(a);(a=A(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=k+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==C||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==C||(T(o),n=!E);while(s=v[a++])if(s(o,t||C,n)){r.push(o);break}i&&(k=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=q.call(r));f=Te(f)}H.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&se.uniqueSort(r)}return i&&(k=h,w=p),c},m?le(r):r))).selector=e}return a},g=se.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&h(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&E&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(te,ne),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=G.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(te,ne),ee.test(o[0].type)&&ye(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return H.apply(n,r),n;break}}}return(l||f(e,c))(r,t,!E,n,!t||ee.test(e)&&ye(t.parentNode)||t),n},d.sortStable=S.split("").sort(D).join("")===S,d.detectDuplicates=!!l,T(),d.sortDetached=ce(function(e){return 1&e.compareDocumentPosition(C.createElement("fieldset"))}),ce(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||fe("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),d.attributes&&ce(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||fe("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ce(function(e){return null==e.getAttribute("disabled")})||fe(R,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),se}(C);S.find=d,S.expr=d.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=d.uniqueSort,S.text=d.getText,S.isXMLDoc=d.isXML,S.contains=d.contains,S.escapeSelector=d.escape;var h=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&S(e).is(n))break;r.push(e)}return r},T=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},k=S.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var N=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1<i.call(n,e)!==r}):S.filter(n,e,r)}S.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?S.find.matchesSelector(r,e)?[r]:[]:S.find.matches(e,S.grep(t,function(e){return 1===e.nodeType}))},S.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(S(e).filter(function(){for(t=0;t<r;t++)if(S.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)S.find(e,i[t],n);return 1<r?S.uniqueSort(n):n},filter:function(e){return this.pushStack(D(this,e||[],!1))},not:function(e){return this.pushStack(D(this,e||[],!0))},is:function(e){return!!D(this,"string"==typeof e&&k.test(e)?S(e):e||[],!1).length}});var j,q=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(S.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&S(e);if(!k.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&S.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?S.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?i.call(S(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),S.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return h(e,"parentNode")},parentsUntil:function(e,t,n){return h(e,"parentNode",n)},next:function(e){return O(e,"nextSibling")},prev:function(e){return O(e,"previousSibling")},nextAll:function(e){return h(e,"nextSibling")},prevAll:function(e){return h(e,"previousSibling")},nextUntil:function(e,t,n){return h(e,"nextSibling",n)},prevUntil:function(e,t,n){return h(e,"previousSibling",n)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(A(e,"template")&&(e=e.content||e),S.merge([],e.childNodes))}},function(r,i){S.fn[r]=function(e,t){var n=S.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=S.filter(t,n)),1<this.length&&(H[r]||S.uniqueSort(n),L.test(r)&&n.reverse()),this.pushStack(n)}});var P=/[^\x20\t\r\n\f]+/g;function R(e){return e}function M(e){throw e}function I(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}S.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},S.each(e.match(P)||[],function(e,t){n[t]=!0}),n):S.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){S.each(e,function(e,t){m(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==w(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return S.each(arguments,function(e,t){var n;while(-1<(n=S.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<S.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},S.extend({Deferred:function(e){var o=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return S.Deferred(function(r){S.each(o,function(e,t){var n=m(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&m(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,m(t)?s?t.call(e,l(u,o,R,s),l(u,o,M,s)):(u++,t.call(e,l(u,o,R,s),l(u,o,M,s),l(u,o,R,o.notifyWith))):(a!==R&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){S.Deferred.exceptionHook&&S.Deferred.exceptionHook(e,t.stackTrace),u<=i+1&&(a!==M&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(S.Deferred.getStackHook&&(t.stackTrace=S.Deferred.getStackHook()),C.setTimeout(t))}}return S.Deferred(function(e){o[0][3].add(l(0,e,m(r)?r:R,e.notifyWith)),o[1][3].add(l(0,e,m(t)?t:R)),o[2][3].add(l(0,e,m(n)?n:M))}).promise()},promise:function(e){return null!=e?S.extend(e,a):a}},s={};return S.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=s.call(arguments),o=S.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?s.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(I(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||m(i[t]&&i[t].then)))return o.then();while(t--)I(i[t],a(t),o.reject);return o.promise()}});var W=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(e,t){C.console&&C.console.warn&&e&&W.test(e.name)&&C.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},S.readyException=function(e){C.setTimeout(function(){throw e})};var F=S.Deferred();function B(){E.removeEventListener("DOMContentLoaded",B),C.removeEventListener("load",B),S.ready()}S.fn.ready=function(e){return F.then(e)["catch"](function(e){S.readyException(e)}),this},S.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--S.readyWait:S.isReady)||(S.isReady=!0)!==e&&0<--S.readyWait||F.resolveWith(E,[S])}}),S.ready.then=F.then,"complete"===E.readyState||"loading"!==E.readyState&&!E.documentElement.doScroll?C.setTimeout(S.ready):(E.addEventListener("DOMContentLoaded",B),C.addEventListener("load",B));var $=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===w(n))for(s in i=!0,n)$(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(S(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},_=/^-ms-/,z=/-([a-z])/g;function U(e,t){return t.toUpperCase()}function X(e){return e.replace(_,"ms-").replace(z,U)}var V=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function G(){this.expando=S.expando+G.uid++}G.uid=1,G.prototype={cache:function(e){var t=e[this.expando];return t||(t={},V(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[X(t)]=n;else for(r in t)i[X(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][X(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(X):(t=X(t))in r?[t]:t.match(P)||[]).length;while(n--)delete r[t[n]]}(void 0===t||S.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!S.isEmptyObject(t)}};var Y=new G,Q=new G,J=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,K=/[A-Z]/g;function Z(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(K,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:J.test(i)?JSON.parse(i):i)}catch(e){}Q.set(e,t,n)}else n=void 0;return n}S.extend({hasData:function(e){return Q.hasData(e)||Y.hasData(e)},data:function(e,t,n){return Q.access(e,t,n)},removeData:function(e,t){Q.remove(e,t)},_data:function(e,t,n){return Y.access(e,t,n)},_removeData:function(e,t){Y.remove(e,t)}}),S.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=Q.get(o),1===o.nodeType&&!Y.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=X(r.slice(5)),Z(o,r,i[r]));Y.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){Q.set(this,n)}):$(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=Q.get(o,n))?t:void 0!==(t=Z(o,n))?t:void 0;this.each(function(){Q.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){Q.remove(this,e)})}}),S.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Y.get(e,t),n&&(!r||Array.isArray(n)?r=Y.access(e,t,S.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=S.queue(e,t),r=n.length,i=n.shift(),o=S._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){S.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y.get(e,n)||Y.access(e,n,{empty:S.Callbacks("once memory").add(function(){Y.remove(e,[t+"queue",n])})})}}),S.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?S.queue(this[0],t):void 0===n?this:this.each(function(){var e=S.queue(this,t,n);S._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&S.dequeue(this,t)})},dequeue:function(e){return this.each(function(){S.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=S.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=Y.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var ee=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,te=new RegExp("^(?:([+-])=|)("+ee+")([a-z%]*)$","i"),ne=["Top","Right","Bottom","Left"],re=E.documentElement,ie=function(e){return S.contains(e.ownerDocument,e)},oe={composed:!0};re.getRootNode&&(ie=function(e){return S.contains(e.ownerDocument,e)||e.getRootNode(oe)===e.ownerDocument});var ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&ie(e)&&"none"===S.css(e,"display")};function se(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return S.css(e,t,"")},u=s(),l=n&&n[3]||(S.cssNumber[t]?"":"px"),c=e.nodeType&&(S.cssNumber[t]||"px"!==l&&+u)&&te.exec(S.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)S.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,S.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ue={};function le(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=Y.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ae(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ue[s])||(o=a.body.appendChild(a.createElement(s)),u=S.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ue[s]=u)))):"none"!==n&&(l[c]="none",Y.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}S.fn.extend({show:function(){return le(this,!0)},hide:function(){return le(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?S(this).show():S(this).hide()})}});var ce,fe,pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="<textarea>x</textarea>",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="<option></option>",y.option=!!ce.lastChild;var ge={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n<r;n++)Y.set(e[n],"globalEval",!t||Y.get(t[n],"globalEval"))}ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,y.option||(ge.optgroup=ge.option=[1,"<select multiple='multiple'>","</select>"]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===w(o))S.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+S.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;S.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<S.inArray(o,r))i&&i.push(o);else if(l=ie(o),a=ve(f.appendChild(o),"script"),l&&ye(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}var be=/^key/,we=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Te=/^([^.]*)(?:\.(.+)|)/;function Ce(){return!0}function Ee(){return!1}function Se(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function ke(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)ke(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Ee;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each(function(){S.event.add(this,t,i,r,n)})}function Ae(e,i,o){o?(Y.set(e,i,!1),S.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Y.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(S.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Y.set(this,i,r),t=o(this,i),this[i](),r!==(n=Y.get(this,i))||t?Y.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Y.set(this,i,{value:S.event.trigger(S.extend(r[0],S.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Y.get(e,i)&&S.event.add(e,i,Ce)}S.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.get(t);if(V(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&S.find.matchesSelector(re,i),n.guid||(n.guid=S.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(P)||[""]).length;while(l--)d=g=(s=Te.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=S.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=S.event.special[d]||{},c=S.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&S.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),S.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.hasData(e)&&Y.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(P)||[""]).length;while(l--)if(d=g=(s=Te.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=S.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||S.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)S.event.remove(e,d+t[l],n,r,!0);S.isEmptyObject(u)&&Y.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=S.event.fix(e),l=(Y.get(this,"events")||Object.create(null))[u.type]||[],c=S.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=S.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((S.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<S(i,this).index(l):S.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(S.Event.prototype,t,{enumerable:!0,configurable:!0,get:m(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[S.expando]?e:new S.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ae(t,"click",Ce),!1},trigger:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ae(t,"click"),!0},_default:function(e){var t=e.target;return pe.test(t.type)&&t.click&&A(t,"input")&&Y.get(t,"click")||A(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},S.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},S.Event=function(e,t){if(!(this instanceof S.Event))return new S.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ce:Ee,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&S.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[S.expando]=!0},S.Event.prototype={constructor:S.Event,isDefaultPrevented:Ee,isPropagationStopped:Ee,isImmediatePropagationStopped:Ee,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ce,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ce,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ce,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},S.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&be.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&we.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},S.event.addProp),S.each({focus:"focusin",blur:"focusout"},function(e,t){S.event.special[e]={setup:function(){return Ae(this,e,Se),!1},trigger:function(){return Ae(this,e),!0},delegateType:t}}),S.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){S.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||S.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),S.fn.extend({on:function(e,t,n,r){return ke(this,e,t,n,r)},one:function(e,t,n,r){return ke(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,S(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Ee),this.each(function(){S.event.remove(this,e,n,t)})}});var Ne=/<script|<style|<link/i,De=/checked\s*(?:[^=]|=\s*.checked.)/i,je=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)S.event.add(t,i,s[i][n]);Q.hasData(e)&&(o=Q.access(e),a=S.extend({},o),Q.set(t,a))}}function Pe(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=m(d);if(h||1<f&&"string"==typeof d&&!y.checkClone&&De.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),Pe(t,r,i,o)});if(f&&(t=(e=xe(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=S.map(ve(e,"script"),Le)).length;c<f;c++)u=e,c!==p&&(u=S.clone(u,!0,!0),s&&S.merge(a,ve(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,S.map(a,He),c=0;c<s;c++)u=a[c],he.test(u.type||"")&&!Y.access(u,"globalEval")&&S.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?S._evalUrl&&!u.noModule&&S._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):b(u.textContent.replace(je,""),u,l))}return n}function Re(e,t,n){for(var r,i=t?S.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||S.cleanData(ve(r)),r.parentNode&&(n&&ie(r)&&ye(ve(r,"script")),r.parentNode.removeChild(r));return e}S.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=ie(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&pe.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||ve(e),a=a||ve(c),r=0,i=o.length;r<i;r++)Oe(o[r],a[r]);else Oe(e,c);return 0<(a=ve(c,"script")).length&&ye(a,!f&&ve(e,"script")),c},cleanData:function(e){for(var t,n,r,i=S.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)i[r]?S.event.remove(n,r):S.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),S.fn.extend({detach:function(e){return Re(this,e,!0)},remove:function(e){return Re(this,e)},text:function(e){return $(this,function(e){return void 0===e?S.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Pe(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||qe(this,e).appendChild(e)})},prepend:function(){return Pe(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=qe(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Pe(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Pe(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(S.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return S.clone(this,e,t)})},html:function(e){return $(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ne.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=S.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(S.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return Pe(this,arguments,function(e){var t=this.parentNode;S.inArray(this,n)<0&&(S.cleanData(ve(this)),t&&t.replaceChild(e,this))},n)}}),S.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){S.fn[e]=function(e){for(var t,n=[],r=S(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),S(r[o])[a](t),u.apply(n,t.get());return this.pushStack(n)}});var Me=new RegExp("^("+ee+")(?!px)[a-z%]+$","i"),Ie=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=C),t.getComputedStyle(e)},We=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Fe=new RegExp(ne.join("|"),"i");function Be(e,t,n){var r,i,o,a,s=e.style;return(n=n||Ie(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||ie(e)||(a=S.style(e,t)),!y.pixelBoxStyles()&&Me.test(a)&&Fe.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function $e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",re.appendChild(u).appendChild(l);var e=C.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),re.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=E.createElement("div"),l=E.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===l.style.backgroundClip,S.extend(y,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=E.createElement("table"),t=E.createElement("tr"),n=E.createElement("div"),e.style.cssText="position:absolute;left:-11111px",t.style.height="1px",n.style.height="9px",re.appendChild(e).appendChild(t).appendChild(n),r=C.getComputedStyle(t),a=3<parseInt(r.height),re.removeChild(e)),a}}))}();var _e=["Webkit","Moz","ms"],ze=E.createElement("div").style,Ue={};function Xe(e){var t=S.cssProps[e]||Ue[e];return t||(e in ze?e:Ue[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=_e.length;while(n--)if((e=_e[n]+t)in ze)return e}(e)||e)}var Ve=/^(none|table(?!-c[ea]).+)/,Ge=/^--/,Ye={position:"absolute",visibility:"hidden",display:"block"},Qe={letterSpacing:"0",fontWeight:"400"};function Je(e,t,n){var r=te.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ke(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=S.css(e,n+ne[a],!0,i)),r?("content"===n&&(u-=S.css(e,"padding"+ne[a],!0,i)),"margin"!==n&&(u-=S.css(e,"border"+ne[a]+"Width",!0,i))):(u+=S.css(e,"padding"+ne[a],!0,i),"padding"!==n?u+=S.css(e,"border"+ne[a]+"Width",!0,i):s+=S.css(e,"border"+ne[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u}function Ze(e,t,n){var r=Ie(e),i=(!y.boxSizingReliable()||n)&&"border-box"===S.css(e,"boxSizing",!1,r),o=i,a=Be(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Me.test(a)){if(!n)return a;a="auto"}return(!y.boxSizingReliable()&&i||!y.reliableTrDimensions()&&A(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===S.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===S.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+Ke(e,t,n||(i?"border":"content"),o,r,a)+"px"}function et(e,t,n,r,i){return new et.prototype.init(e,t,n,r,i)}S.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Be(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=X(t),u=Ge.test(t),l=e.style;if(u||(t=Xe(s)),a=S.cssHooks[t]||S.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=te.exec(n))&&i[1]&&(n=se(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(S.cssNumber[s]?"":"px")),y.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=X(t);return Ge.test(t)||(t=Xe(s)),(a=S.cssHooks[t]||S.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Be(e,t,r)),"normal"===i&&t in Qe&&(i=Qe[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),S.each(["height","width"],function(e,u){S.cssHooks[u]={get:function(e,t,n){if(t)return!Ve.test(S.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?Ze(e,u,n):We(e,Ye,function(){return Ze(e,u,n)})},set:function(e,t,n){var r,i=Ie(e),o=!y.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===S.css(e,"boxSizing",!1,i),s=n?Ke(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-Ke(e,u,"border",!1,i)-.5)),s&&(r=te.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=S.css(e,u)),Je(0,t,s)}}}),S.cssHooks.marginLeft=$e(y.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Be(e,"marginLeft"))||e.getBoundingClientRect().left-We(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),S.each({margin:"",padding:"",border:"Width"},function(i,o){S.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+ne[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(S.cssHooks[i+o].set=Je)}),S.fn.extend({css:function(e,t){return $(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Ie(e),i=t.length;a<i;a++)o[t[a]]=S.css(e,t[a],!1,r);return o}return void 0!==n?S.style(e,t,n):S.css(e,t)},e,t,1<arguments.length)}}),((S.Tween=et).prototype={constructor:et,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(S.cssNumber[n]?"":"px")},cur:function(){var e=et.propHooks[this.prop];return e&&e.get?e.get(this):et.propHooks._default.get(this)},run:function(e){var t,n=et.propHooks[this.prop];return this.options.duration?this.pos=t=S.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):et.propHooks._default.set(this),this}}).init.prototype=et.prototype,(et.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=S.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){S.fx.step[e.prop]?S.fx.step[e.prop](e):1!==e.elem.nodeType||!S.cssHooks[e.prop]&&null==e.elem.style[Xe(e.prop)]?e.elem[e.prop]=e.now:S.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=et.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},S.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},S.fx=et.prototype.init,S.fx.step={};var tt,nt,rt,it,ot=/^(?:toggle|show|hide)$/,at=/queueHooks$/;function st(){nt&&(!1===E.hidden&&C.requestAnimationFrame?C.requestAnimationFrame(st):C.setTimeout(st,S.fx.interval),S.fx.tick())}function ut(){return C.setTimeout(function(){tt=void 0}),tt=Date.now()}function lt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ne[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function ct(e,t,n){for(var r,i=(ft.tweeners[t]||[]).concat(ft.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ft(o,e,t){var n,a,r=0,i=ft.prefilters.length,s=S.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=tt||ut(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:S.extend({},e),opts:S.extend(!0,{specialEasing:{},easing:S.easing._default},t),originalProperties:e,originalOptions:t,startTime:tt||ut(),duration:t.duration,tweens:[],createTween:function(e,t){var n=S.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=X(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=S.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=ft.prefilters[r].call(l,o,c,l.opts))return m(n.stop)&&(S._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return S.map(c,ct,l),m(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),S.fx.timer(S.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}S.Animation=S.extend(ft,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=["*"]):e=e.match(P);for(var n,r=0,i=e.length;r<i;r++)n=e[r],ft.tweeners[n]=ft.tweeners[n]||[],ft.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),v=Y.get(e,"fxshow");for(r in n.queue||(null==(a=S._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,S.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],ot.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||S.style(e,r)}if((u=!S.isEmptyObject(t))||!S.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=Y.get(e,"display")),"none"===(c=S.css(e,"display"))&&(l?c=l:(le([e],!0),l=e.style.display||l,c=S.css(e,"display"),le([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===S.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=Y.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&le([e],!0),p.done(function(){for(r in g||le([e]),Y.remove(e,"fxshow"),d)S.style(e,r,d[r])})),u=ct(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?ft.prefilters.unshift(e):ft.prefilters.push(e)}}),S.speed=function(e,t,n){var r=e&&"object"==typeof e?S.extend({},e):{complete:n||!n&&t||m(e)&&e,duration:e,easing:n&&t||t&&!m(t)&&t};return S.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in S.fx.speeds?r.duration=S.fx.speeds[r.duration]:r.duration=S.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){m(r.old)&&r.old.call(this),r.queue&&S.dequeue(this,r.queue)},r},S.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=S.isEmptyObject(t),o=S.speed(e,n,r),a=function(){var e=ft(this,S.extend({},t),o);(i||Y.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=S.timers,r=Y.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&at.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||S.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=Y.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=S.timers,o=n?n.length:0;for(t.finish=!0,S.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),S.each(["toggle","show","hide"],function(e,r){var i=S.fn[r];S.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(lt(r,!0),e,t,n)}}),S.each({slideDown:lt("show"),slideUp:lt("hide"),slideToggle:lt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){S.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),S.timers=[],S.fx.tick=function(){var e,t=0,n=S.timers;for(tt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||S.fx.stop(),tt=void 0},S.fx.timer=function(e){S.timers.push(e),S.fx.start()},S.fx.interval=13,S.fx.start=function(){nt||(nt=!0,st())},S.fx.stop=function(){nt=null},S.fx.speeds={slow:600,fast:200,_default:400},S.fn.delay=function(r,e){return r=S.fx&&S.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=C.setTimeout(e,r);t.stop=function(){C.clearTimeout(n)}})},rt=E.createElement("input"),it=E.createElement("select").appendChild(E.createElement("option")),rt.type="checkbox",y.checkOn=""!==rt.value,y.optSelected=it.selected,(rt=E.createElement("input")).value="t",rt.type="radio",y.radioValue="t"===rt.value;var pt,dt=S.expr.attrHandle;S.fn.extend({attr:function(e,t){return $(this,S.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){S.removeAttr(this,e)})}}),S.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?S.prop(e,t,n):(1===o&&S.isXMLDoc(e)||(i=S.attrHooks[t.toLowerCase()]||(S.expr.match.bool.test(t)?pt:void 0)),void 0!==n?null===n?void S.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=S.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&A(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(P);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),pt={set:function(e,t,n){return!1===t?S.removeAttr(e,n):e.setAttribute(n,n),n}},S.each(S.expr.match.bool.source.match(/\w+/g),function(e,t){var a=dt[t]||S.find.attr;dt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=dt[o],dt[o]=r,r=null!=a(e,t,n)?o:null,dt[o]=i),r}});var ht=/^(?:input|select|textarea|button)$/i,gt=/^(?:a|area)$/i;function vt(e){return(e.match(P)||[]).join(" ")}function yt(e){return e.getAttribute&&e.getAttribute("class")||""}function mt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(P)||[]}S.fn.extend({prop:function(e,t){return $(this,S.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[S.propFix[e]||e]})}}),S.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&S.isXMLDoc(e)||(t=S.propFix[t]||t,i=S.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=S.find.attr(e,"tabindex");return t?parseInt(t,10):ht.test(e.nodeName)||gt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),y.optSelected||(S.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){S.propFix[this.toLowerCase()]=this}),S.fn.extend({addClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).addClass(t.call(this,e,yt(this)))});if((e=mt(t)).length)while(n=this[u++])if(i=yt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=e[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).removeClass(t.call(this,e,yt(this)))});if(!arguments.length)return this.attr("class","");if((e=mt(t)).length)while(n=this[u++])if(i=yt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=e[a++])while(-1<r.indexOf(" "+o+" "))r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(i,t){var o=typeof i,a="string"===o||Array.isArray(i);return"boolean"==typeof t&&a?t?this.addClass(i):this.removeClass(i):m(i)?this.each(function(e){S(this).toggleClass(i.call(this,e,yt(this),t),t)}):this.each(function(){var e,t,n,r;if(a){t=0,n=S(this),r=mt(i);while(e=r[t++])n.hasClass(e)?n.removeClass(e):n.addClass(e)}else void 0!==i&&"boolean"!==o||((e=yt(this))&&Y.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===i?"":Y.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+vt(yt(n))+" ").indexOf(t))return!0;return!1}});var xt=/\r/g;S.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=m(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,S(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=S.map(t,function(e){return null==e?"":e+""})),(r=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=S.valHooks[t.type]||S.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(xt,""):null==e?"":e:void 0}}),S.extend({valHooks:{option:{get:function(e){var t=S.find.attr(e,"value");return null!=t?t:vt(S.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,"optgroup"))){if(t=S(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=S.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<S.inArray(S.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),S.each(["radio","checkbox"],function(){S.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<S.inArray(S(e).val(),t)}},y.checkOn||(S.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),y.focusin="onfocusin"in C;var bt=/^(?:focusinfocus|focusoutblur)$/,wt=function(e){e.stopPropagation()};S.extend(S.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||E],d=v.call(e,"type")?e.type:e,h=v.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||E,3!==n.nodeType&&8!==n.nodeType&&!bt.test(d+S.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[S.expando]?e:new S.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:S.makeArray(t,[e]),c=S.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!x(n)){for(s=c.delegateType||d,bt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||E)&&p.push(a.defaultView||a.parentWindow||C)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(Y.get(o,"events")||Object.create(null))[e.type]&&Y.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&V(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!V(n)||u&&m(n[d])&&!x(n)&&((a=n[u])&&(n[u]=null),S.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,wt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,wt),S.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=S.extend(new S.Event,n,{type:e,isSimulated:!0});S.event.trigger(r,null,t)}}),S.fn.extend({trigger:function(e,t){return this.each(function(){S.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return S.event.trigger(e,t,n,!0)}}),y.focusin||S.each({focus:"focusin",blur:"focusout"},function(n,r){var i=function(e){S.event.simulate(r,e.target,S.event.fix(e))};S.event.special[r]={setup:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r);t||e.addEventListener(n,i,!0),Y.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r)-1;t?Y.access(e,r,t):(e.removeEventListener(n,i,!0),Y.remove(e,r))}}});var Tt=C.location,Ct={guid:Date.now()},Et=/\?/;S.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new C.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||S.error("Invalid XML: "+e),t};var St=/\[\]$/,kt=/\r?\n/g,At=/^(?:submit|button|image|reset|file)$/i,Nt=/^(?:input|select|textarea|keygen)/i;function Dt(n,e,r,i){var t;if(Array.isArray(e))S.each(e,function(e,t){r||St.test(n)?i(n,t):Dt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==w(e))i(n,e);else for(t in e)Dt(n+"["+t+"]",e[t],r,i)}S.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!S.isPlainObject(e))S.each(e,function(){i(this.name,this.value)});else for(n in e)Dt(n,e[n],t,i);return r.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=S.prop(this,"elements");return e?S.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!S(this).is(":disabled")&&Nt.test(this.nodeName)&&!At.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=S(this).val();return null==n?null:Array.isArray(n)?S.map(n,function(e){return{name:t.name,value:e.replace(kt,"\r\n")}}):{name:t.name,value:n.replace(kt,"\r\n")}}).get()}});var jt=/%20/g,qt=/#.*$/,Lt=/([?&])_=[^&]*/,Ht=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ot=/^(?:GET|HEAD)$/,Pt=/^\/\//,Rt={},Mt={},It="*/".concat("*"),Wt=E.createElement("a");function Ft(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(P)||[];if(m(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Bt(t,i,o,a){var s={},u=t===Mt;function l(e){var r;return s[e]=!0,S.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function $t(e,t){var n,r,i=S.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&S.extend(!0,e,r),e}Wt.href=Tt.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Tt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Tt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":It,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?$t($t(e,S.ajaxSettings),t):$t(S.ajaxSettings,e)},ajaxPrefilter:Ft(Rt),ajaxTransport:Ft(Mt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=S.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?S(y):S.event,x=S.Deferred(),b=S.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Ht.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Tt.href)+"").replace(Pt,Tt.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(P)||[""],null==v.crossDomain){r=E.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Wt.protocol+"//"+Wt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=S.param(v.data,v.traditional)),Bt(Rt,v,t,T),h)return T;for(i in(g=S.event&&v.global)&&0==S.active++&&S.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Ot.test(v.type),f=v.url.replace(qt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(jt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(Et.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(Lt,"$1"),o=(Et.test(f)?"&":"?")+"_="+Ct.guid+++o),v.url=f+o),v.ifModified&&(S.lastModified[f]&&T.setRequestHeader("If-Modified-Since",S.lastModified[f]),S.etag[f]&&T.setRequestHeader("If-None-Match",S.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+It+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Bt(Mt,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=C.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&C.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<S.inArray("script",v.dataTypes)&&(v.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(S.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(S.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--S.active||S.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return S.get(e,t,n,"json")},getScript:function(e,t){return S.get(e,void 0,t,"script")}}),S.each(["get","post"],function(e,i){S[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),S.ajax(S.extend({url:e,type:i,dataType:r,data:t,success:n},S.isPlainObject(e)&&e))}}),S.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),S._evalUrl=function(e,t,n){return S.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){S.globalEval(e,t,n)}})},S.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=S(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return m(n)?this.each(function(e){S(this).wrapInner(n.call(this,e))}):this.each(function(){var e=S(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=m(t);return this.each(function(e){S(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){S(this).replaceWith(this.childNodes)}),this}}),S.expr.pseudos.hidden=function(e){return!S.expr.pseudos.visible(e)},S.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new C.XMLHttpRequest}catch(e){}};var _t={0:200,1223:204},zt=S.ajaxSettings.xhr();y.cors=!!zt&&"withCredentials"in zt,y.ajax=zt=!!zt,S.ajaxTransport(function(i){var o,a;if(y.cors||zt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(_t[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&C.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),S.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),S.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return S.globalEval(e),e}}}),S.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),S.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=S("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=vt(e.slice(s)),e=e.slice(0,s)),m(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&S.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?S("<div>").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.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(e,n){S.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var Gt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;S.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),m(e))return r=s.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(s.call(arguments)))}).guid=e.guid=e.guid||S.guid++,i},S.holdReady=function(e){e?S.readyWait++:S.ready(!0)},S.isArray=Array.isArray,S.parseJSON=JSON.parse,S.nodeName=A,S.isFunction=m,S.isWindow=x,S.camelCase=X,S.type=w,S.now=Date.now,S.isNumeric=function(e){var t=S.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},S.trim=function(e){return null==e?"":(e+"").replace(Gt,"")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return S});var Yt=C.jQuery,Qt=C.$;return S.noConflict=function(e){return C.$===S&&(C.$=Qt),e&&C.jQuery===S&&(C.jQuery=Yt),S},"undefined"==typeof e&&(C.jQuery=C.$=S),S});
|
||
|
||
/*!
|
||
* Cropper v3.1.6
|
||
* https://github.com/fengyuanchen/cropper
|
||
*
|
||
* Copyright (c) 2014-2018 Chen Fengyuan
|
||
* Released under the MIT license
|
||
*
|
||
*/
|
||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],i):i(t.jQuery)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var i="undefined"!=typeof window?window:{},e="cropper",a="all",n="crop",h="move",o="zoom",s="e",r="w",d="s",c="n",l="ne",p="nw",g="se",m="sw",u=e+"-crop",f=e+"-disabled",v=e+"-hidden",w=e+"-hide",x=e+"-modal",b=e+"-move",y="action",C="preview",M="crop",$="move",B="none",k="crop",W="cropend",D="cropmove",T="cropstart",Y="dblclick",H="error",X="load",O=i.PointerEvent?"pointerdown":"touchstart mousedown",E=i.PointerEvent?"pointermove":"touchmove mousemove",N=i.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",R="ready",z="resize",L="wheel mousewheel DOMMouseScroll",P="zoom",I=/^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/,U=/^data:/,A=/^data:image\/jpeg;base64,/,F=/^(img|canvas)$/i,j={viewMode:0,dragMode:M,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},S=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},q=function(){function t(t,i){for(var e=0;e<i.length;e++){var a=i[e];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(i,e,a){return e&&t(i.prototype,e),a&&t(i,a),i}}(),Q=function(t){if(Array.isArray(t)){for(var i=0,e=Array(t.length);i<t.length;i++)e[i]=t[i];return e}return Array.from(t)};var K=Number.isNaN||i.isNaN;function Z(t){return"number"==typeof t&&!K(t)}function V(t){return void 0===t}function G(t,i){for(var e=arguments.length,a=Array(e>2?e-2:0),n=2;n<e;n++)a[n-2]=arguments[n];return function(){for(var e=arguments.length,n=Array(e),h=0;h<e;h++)n[h]=arguments[h];return t.apply(i,a.concat(n))}}var J=Object.keys||function(i){var e=[];return t.each(i,function(t){e.push(t)}),e},_=/\.\d*(?:0|9){12}\d*$/i;function tt(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return _.test(t)?Math.round(t*i)/i:t}var it=i.location,et=/^(https?:)\/\/([^:/?#]+):?(\d*)/i;function at(t){var i=t.match(et);return i&&(i[1]!==it.protocol||i[2]!==it.hostname||i[3]!==it.port)}function nt(t){var i="timestamp="+(new Date).getTime();return t+(-1===t.indexOf("?")?"?":"&")+i}function ht(t){var i=t.rotate,e=t.scaleX,a=t.scaleY,n=t.translateX,h=t.translateY,o=[];return Z(n)&&0!==n&&o.push("translateX("+n+"px)"),Z(h)&&0!==h&&o.push("translateY("+h+"px)"),Z(i)&&0!==i&&o.push("rotate("+i+"deg)"),Z(e)&&1!==e&&o.push("scaleX("+e+")"),Z(a)&&1!==a&&o.push("scaleY("+a+")"),o.length?o.join(" "):"none"}var ot=i.navigator,st=ot&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(ot.userAgent);function rt(i,e){var a=i.pageX,n=i.pageY,h={endX:a,endY:n};return e?h:t.extend({startX:a,startY:n},h)}var dt=Number.isFinite||i.isFinite;function ct(t){var i=t.aspectRatio,e=t.height,a=t.width,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",h=function(t){return dt(t)&&t>0};if(h(a)&&h(e)){var o=e*i;"contain"===n&&o>a||"cover"===n&&o<a?e=a/i:a=e*i}else h(a)?e=a/i:h(e)&&(a=e*i);return{width:a,height:e}}var lt=String.fromCharCode;var pt=/^data:.*,/;function gt(t){var i=new DataView(t),e=void 0,a=void 0,n=void 0,h=void 0;if(255===i.getUint8(0)&&216===i.getUint8(1))for(var o=i.byteLength,s=2;s<o;){if(255===i.getUint8(s)&&225===i.getUint8(s+1)){n=s;break}s+=1}if(n){var r=n+10;if("Exif"===function(t,i,e){var a="",n=void 0;for(e+=i,n=i;n<e;n+=1)a+=lt(t.getUint8(n));return a}(i,n+4,4)){var d=i.getUint16(r);if(((a=18761===d)||19789===d)&&42===i.getUint16(r+2,a)){var c=i.getUint32(r+4,a);c>=8&&(h=r+c)}}}if(h){var l=i.getUint16(h,a),p=void 0,g=void 0;for(g=0;g<l;g+=1)if(p=h+12*g+2,274===i.getUint16(p,a)){p+=8,e=i.getUint16(p,a),i.setUint16(p,1,a);break}}return e}var mt={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.$element,i=this.options,e=this.$container,a=this.$cropper;a.addClass(v),t.removeClass(v),a.css(this.container={width:Math.max(e.width(),Number(i.minContainerWidth)||200),height:Math.max(e.height(),Number(i.minContainerHeight)||100)}),t.addClass(v),a.removeClass(v)},initCanvas:function(){var i=this.container,e=this.image,a=this.options.viewMode,n=Math.abs(e.rotate)%180==90,h=n?e.naturalHeight:e.naturalWidth,o=n?e.naturalWidth:e.naturalHeight,s=h/o,r=i.width,d=i.height;i.height*s>i.width?3===a?r=i.height*s:d=i.width/s:3===a?d=i.width/s:r=i.height*s;var c={aspectRatio:s,naturalWidth:h,naturalHeight:o,width:r,height:d};c.left=(i.width-r)/2,c.top=(i.height-d)/2,c.oldLeft=c.left,c.oldTop=c.top,this.canvas=c,this.limited=1===a||2===a,this.limitCanvas(!0,!0),this.initialImage=t.extend({},e),this.initialCanvas=t.extend({},c)},limitCanvas:function(t,i){var e=this.options,a=this.container,n=this.canvas,h=this.cropBox,o=e.viewMode,s=n.aspectRatio,r=this.cropped&&h;if(t){var d=Number(e.minCanvasWidth)||0,c=Number(e.minCanvasHeight)||0;o>0&&(o>1?(d=Math.max(d,a.width),c=Math.max(c,a.height),3===o&&(c*s>d?d=c*s:c=d/s)):d?d=Math.max(d,r?h.width:0):c?c=Math.max(c,r?h.height:0):r&&(d=h.width,(c=h.height)*s>d?d=c*s:c=d/s));var l=ct({aspectRatio:s,width:d,height:c});d=l.width,c=l.height,n.minWidth=d,n.minHeight=c,n.maxWidth=1/0,n.maxHeight=1/0}if(i)if(o>0){var p=a.width-n.width,g=a.height-n.height;n.minLeft=Math.min(0,p),n.minTop=Math.min(0,g),n.maxLeft=Math.max(0,p),n.maxTop=Math.max(0,g),r&&this.limited&&(n.minLeft=Math.min(h.left,h.left+h.width-n.width),n.minTop=Math.min(h.top,h.top+h.height-n.height),n.maxLeft=h.left,n.maxTop=h.top,2===o&&(n.width>=a.width&&(n.minLeft=Math.min(0,p),n.maxLeft=Math.max(0,p)),n.height>=a.height&&(n.minTop=Math.min(0,g),n.maxTop=Math.max(0,g))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,i){var e=this.canvas,a=this.image;if(i){var n=function(t){var i=t.width,e=t.height,a=t.degree;if(90==(a=Math.abs(a)%180))return{width:e,height:i};var n=a%90*Math.PI/180,h=Math.sin(n),o=Math.cos(n),s=i*o+e*h,r=i*h+e*o;return a>90?{width:r,height:s}:{width:s,height:r}}({width:a.naturalWidth*Math.abs(a.scaleX||1),height:a.naturalHeight*Math.abs(a.scaleY||1),degree:a.rotate||0}),h=n.width,o=n.height,s=e.width*(h/e.naturalWidth),r=e.height*(o/e.naturalHeight);e.left-=(s-e.width)/2,e.top-=(r-e.height)/2,e.width=s,e.height=r,e.aspectRatio=h/o,e.naturalWidth=h,e.naturalHeight=o,this.limitCanvas(!0,!1)}(e.width>e.maxWidth||e.width<e.minWidth)&&(e.left=e.oldLeft),(e.height>e.maxHeight||e.height<e.minHeight)&&(e.top=e.oldTop),e.width=Math.min(Math.max(e.width,e.minWidth),e.maxWidth),e.height=Math.min(Math.max(e.height,e.minHeight),e.maxHeight),this.limitCanvas(!1,!0),e.left=Math.min(Math.max(e.left,e.minLeft),e.maxLeft),e.top=Math.min(Math.max(e.top,e.minTop),e.maxTop),e.oldLeft=e.left,e.oldTop=e.top,this.$canvas.css({width:e.width,height:e.height,transform:ht({translateX:e.left,translateY:e.top})}),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(i){var e=this.canvas,a=this.image,n=a.naturalWidth*(e.width/e.naturalWidth),h=a.naturalHeight*(e.height/e.naturalHeight);t.extend(a,{width:n,height:h,left:(e.width-n)/2,top:(e.height-h)/2}),this.$clone.css({width:a.width,height:a.height,transform:ht(t.extend({translateX:a.left,translateY:a.top},a))}),i&&this.output()},initCropBox:function(){var i=this.options,e=this.canvas,a=i.aspectRatio,n=Number(i.autoCropArea)||.8,h={width:e.width,height:e.height};a&&(e.height*a>e.width?h.height=h.width/a:h.width=h.height*a),this.cropBox=h,this.limitCropBox(!0,!0),h.width=Math.min(Math.max(h.width,h.minWidth),h.maxWidth),h.height=Math.min(Math.max(h.height,h.minHeight),h.maxHeight),h.width=Math.max(h.minWidth,h.width*n),h.height=Math.max(h.minHeight,h.height*n),h.left=e.left+(e.width-h.width)/2,h.top=e.top+(e.height-h.height)/2,h.oldLeft=h.left,h.oldTop=h.top,this.initialCropBox=t.extend({},h)},limitCropBox:function(t,i){var e=this.options,a=this.container,n=this.canvas,h=this.cropBox,o=this.limited,s=e.aspectRatio;if(t){var r=Number(e.minCropBoxWidth)||0,d=Number(e.minCropBoxHeight)||0,c=Math.min(a.width,o?n.width:a.width),l=Math.min(a.height,o?n.height:a.height);r=Math.min(r,a.width),d=Math.min(d,a.height),s&&(r&&d?d*s>r?d=r/s:r=d*s:r?d=r/s:d&&(r=d*s),l*s>c?l=c/s:c=l*s),h.minWidth=Math.min(r,c),h.minHeight=Math.min(d,l),h.maxWidth=c,h.maxHeight=l}i&&(o?(h.minLeft=Math.max(0,n.left),h.minTop=Math.max(0,n.top),h.maxLeft=Math.min(a.width,n.left+n.width)-h.width,h.maxTop=Math.min(a.height,n.top+n.height)-h.height):(h.minLeft=0,h.minTop=0,h.maxLeft=a.width-h.width,h.maxTop=a.height-h.height))},renderCropBox:function(){var t=this.options,i=this.container,e=this.cropBox;(e.width>e.maxWidth||e.width<e.minWidth)&&(e.left=e.oldLeft),(e.height>e.maxHeight||e.height<e.minHeight)&&(e.top=e.oldTop),e.width=Math.min(Math.max(e.width,e.minWidth),e.maxWidth),e.height=Math.min(Math.max(e.height,e.minHeight),e.maxHeight),this.limitCropBox(!1,!0),e.left=Math.min(Math.max(e.left,e.minLeft),e.maxLeft),e.top=Math.min(Math.max(e.top,e.minTop),e.maxTop),e.oldLeft=e.left,e.oldTop=e.top,t.movable&&t.cropBoxMovable&&this.$face.data(y,e.width>=i.width&&e.height>=i.height?h:a),this.$cropBox.css({width:e.width,height:e.height,transform:ht({translateX:e.left,translateY:e.top})}),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),this.completed&&this.trigger(k,this.getData())}},ut={initPreview:function(){var i=this.crossOrigin,e=i?this.crossOriginUrl:this.url,a=document.createElement("img");i&&(a.crossOrigin=i),a.src=e;var n=t(a);this.$preview=t(this.options.preview),this.$clone2=n,this.$viewBox.html(n),this.$preview.each(function(a,n){var h=t(n),o=document.createElement("img");h.data(C,{width:h.width(),height:h.height(),html:h.html()}),i&&(o.crossOrigin=i),o.src=e,o.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',h.html(o)})},resetPreview:function(){this.$preview.each(function(i,e){var a=t(e),n=a.data(C);a.css({width:n.width,height:n.height}).html(n.html).removeData(C)})},preview:function(){var i=this.image,e=this.canvas,a=this.cropBox,n=a.width,h=a.height,o=i.width,s=i.height,r=a.left-e.left-i.left,d=a.top-e.top-i.top;this.cropped&&!this.disabled&&(this.$clone2.css({width:o,height:s,transform:ht(t.extend({translateX:-r,translateY:-d},i))}),this.$preview.each(function(e,a){var c=t(a),l=c.data(C),p=l.width,g=l.height,m=p,u=g,f=1;n&&(u=h*(f=p/n)),h&&u>g&&(m=n*(f=g/h),u=g),c.css({width:m,height:u}).find("img").css({width:o*f,height:s*f,transform:ht(t.extend({translateX:-r*f,translateY:-d*f},i))})}))}},ft={bind:function(){var i=this.$element,e=this.options,a=this.$cropper;t.isFunction(e.cropstart)&&i.on(T,e.cropstart),t.isFunction(e.cropmove)&&i.on(D,e.cropmove),t.isFunction(e.cropend)&&i.on(W,e.cropend),t.isFunction(e.crop)&&i.on(k,e.crop),t.isFunction(e.zoom)&&i.on(P,e.zoom),a.on(O,G(this.cropStart,this)),e.zoomable&&e.zoomOnWheel&&a.on(L,G(this.wheel,this)),e.toggleDragModeOnDblclick&&a.on(Y,G(this.dblclick,this)),t(this.element.ownerDocument).on(E,this.onCropMove=G(this.cropMove,this)).on(N,this.onCropEnd=G(this.cropEnd,this)),e.responsive&&t(window).on(z,this.onResize=G(this.resize,this))},unbind:function(){var i=this.$element,e=this.options,a=this.$cropper;t.isFunction(e.cropstart)&&i.off(T,e.cropstart),t.isFunction(e.cropmove)&&i.off(D,e.cropmove),t.isFunction(e.cropend)&&i.off(W,e.cropend),t.isFunction(e.crop)&&i.off(k,e.crop),t.isFunction(e.zoom)&&i.off(P,e.zoom),a.off(O,this.cropStart),e.zoomable&&e.zoomOnWheel&&a.off(L,this.wheel),e.toggleDragModeOnDblclick&&a.off(Y,this.dblclick),t(this.element.ownerDocument).off(E,this.onCropMove).off(N,this.onCropEnd),e.responsive&&t(window).off(z,this.onResize)}},vt={resize:function(){var i=this.options,e=this.$container,a=this.container,n=Number(i.minContainerWidth)||200,h=Number(i.minContainerHeight)||100;if(!(this.disabled||a.width<=n||a.height<=h)){var o=e.width()/a.width;if(1!==o||e.height()!==a.height){var s=void 0,r=void 0;i.restore&&(s=this.getCanvasData(),r=this.getCropBoxData()),this.render(),i.restore&&(this.setCanvasData(t.each(s,function(t,i){s[t]=i*o})),this.setCropBoxData(t.each(r,function(t,i){r[t]=i*o})))}}},dblclick:function(){this.disabled||this.options.dragMode===B||this.setDragMode(this.$dragBox.hasClass(u)?$:M)},wheel:function(t){var i=this,e=t.originalEvent||t,a=Number(this.options.wheelZoomRatio)||.1;if(!this.disabled&&(t.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){i.wheeling=!1},50);var n=1;e.deltaY?n=e.deltaY>0?1:-1:e.wheelDelta?n=-e.wheelDelta/120:e.detail&&(n=e.detail>0?1:-1),this.zoom(-n*a,t)}},cropStart:function(i){if(!this.disabled){var e=this.options,a=this.pointers,h=i.originalEvent,s=void 0;h&&h.changedTouches?t.each(h.changedTouches,function(t,i){a[i.identifier]=rt(i)}):a[h&&h.pointerId||0]=rt(h||i),s=J(a).length>1&&e.zoomable&&e.zoomOnTouch?o:t(i.target).data(y),I.test(s)&&(this.trigger(T,{originalEvent:h,action:s}).isDefaultPrevented()||(i.preventDefault(),this.action=s,this.cropping=!1,s===n&&(this.cropping=!0,this.$dragBox.addClass(x))))}},cropMove:function(i){var e=this.action;if(!this.disabled&&e){var a=this.pointers,n=i.originalEvent;i.preventDefault(),this.trigger(D,{originalEvent:n,action:e}).isDefaultPrevented()||(n&&n.changedTouches?t.each(n.changedTouches,function(i,e){t.extend(a[e.identifier],rt(e,!0))}):t.extend(a[n&&n.pointerId||0],rt(n||i,!0)),this.change(i))}},cropEnd:function(i){if(!this.disabled){var e=this.action,a=this.pointers,n=i.originalEvent;n&&n.changedTouches?t.each(n.changedTouches,function(t,i){delete a[i.identifier]}):delete a[n&&n.pointerId||0],e&&(i.preventDefault(),J(a).length||(this.action=""),this.cropping&&(this.cropping=!1,this.$dragBox.toggleClass(x,this.cropped&&this.options.modal)),this.trigger(W,{originalEvent:n,action:e}))}}},wt={change:function(i){var e=this.options,u=this.pointers,f=this.container,w=this.canvas,x=this.cropBox,b=this.action,y=e.aspectRatio,C=x.left,M=x.top,$=x.width,B=x.height,k=C+$,W=M+B,D=0,T=0,Y=f.width,H=f.height,X=!0,O=void 0;!y&&i.shiftKey&&(y=$&&B?$/B:1),this.limited&&(D=x.minLeft,T=x.minTop,Y=D+Math.min(f.width,w.width,w.left+w.width),H=T+Math.min(f.height,w.height,w.top+w.height));var E,N,R,z=u[J(u)[0]],L={x:z.endX-z.startX,y:z.endY-z.startY},P=function(t){switch(t){case s:k+L.x>Y&&(L.x=Y-k);break;case r:C+L.x<D&&(L.x=D-C);break;case c:M+L.y<T&&(L.y=T-M);break;case d:W+L.y>H&&(L.y=H-W)}};switch(b){case a:C+=L.x,M+=L.y;break;case s:if(L.x>=0&&(k>=Y||y&&(M<=T||W>=H))){X=!1;break}P(s),$+=L.x,y&&(B=$/y,M-=L.x/y/2),$<0&&(b=r,$=0);break;case c:if(L.y<=0&&(M<=T||y&&(C<=D||k>=Y))){X=!1;break}P(c),B-=L.y,M+=L.y,y&&($=B*y,C+=L.y*y/2),B<0&&(b=d,B=0);break;case r:if(L.x<=0&&(C<=D||y&&(M<=T||W>=H))){X=!1;break}P(r),$-=L.x,C+=L.x,y&&(B=$/y,M+=L.x/y/2),$<0&&(b=s,$=0);break;case d:if(L.y>=0&&(W>=H||y&&(C<=D||k>=Y))){X=!1;break}P(d),B+=L.y,y&&($=B*y,C-=L.y*y/2),B<0&&(b=c,B=0);break;case l:if(y){if(L.y<=0&&(M<=T||k>=Y)){X=!1;break}P(c),B-=L.y,M+=L.y,$=B*y}else P(c),P(s),L.x>=0?k<Y?$+=L.x:L.y<=0&&M<=T&&(X=!1):$+=L.x,L.y<=0?M>T&&(B-=L.y,M+=L.y):(B-=L.y,M+=L.y);$<0&&B<0?(b=m,B=0,$=0):$<0?(b=p,$=0):B<0&&(b=g,B=0);break;case p:if(y){if(L.y<=0&&(M<=T||C<=D)){X=!1;break}P(c),B-=L.y,M+=L.y,$=B*y,C+=L.y*y}else P(c),P(r),L.x<=0?C>D?($-=L.x,C+=L.x):L.y<=0&&M<=T&&(X=!1):($-=L.x,C+=L.x),L.y<=0?M>T&&(B-=L.y,M+=L.y):(B-=L.y,M+=L.y);$<0&&B<0?(b=g,B=0,$=0):$<0?(b=l,$=0):B<0&&(b=m,B=0);break;case m:if(y){if(L.x<=0&&(C<=D||W>=H)){X=!1;break}P(r),$-=L.x,C+=L.x,B=$/y}else P(d),P(r),L.x<=0?C>D?($-=L.x,C+=L.x):L.y>=0&&W>=H&&(X=!1):($-=L.x,C+=L.x),L.y>=0?W<H&&(B+=L.y):B+=L.y;$<0&&B<0?(b=l,B=0,$=0):$<0?(b=g,$=0):B<0&&(b=p,B=0);break;case g:if(y){if(L.x>=0&&(k>=Y||W>=H)){X=!1;break}P(s),B=($+=L.x)/y}else P(d),P(s),L.x>=0?k<Y?$+=L.x:L.y>=0&&W>=H&&(X=!1):$+=L.x,L.y>=0?W<H&&(B+=L.y):B+=L.y;$<0&&B<0?(b=p,B=0,$=0):$<0?(b=m,$=0):B<0&&(b=l,B=0);break;case h:this.move(L.x,L.y),X=!1;break;case o:this.zoom((E=u,N=t.extend({},E),R=[],t.each(E,function(i,e){delete N[i],t.each(N,function(t,i){var a=Math.abs(e.startX-i.startX),n=Math.abs(e.startY-i.startY),h=Math.abs(e.endX-i.endX),o=Math.abs(e.endY-i.endY),s=Math.sqrt(a*a+n*n),r=(Math.sqrt(h*h+o*o)-s)/s;R.push(r)})}),R.sort(function(t,i){return Math.abs(t)<Math.abs(i)}),R[0]),i.originalEvent),X=!1;break;case n:if(!L.x||!L.y){X=!1;break}O=this.$cropper.offset(),C=z.startX-O.left,M=z.startY-O.top,$=x.minWidth,B=x.minHeight,L.x>0?b=L.y>0?g:l:L.x<0&&(C-=$,b=L.y>0?m:p),L.y<0&&(M-=B),this.cropped||(this.$cropBox.removeClass(v),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}X&&(x.width=$,x.height=B,x.left=C,x.top=M,this.action=b,this.renderCropBox()),t.each(u,function(t,i){i.startX=i.endX,i.startY=i.endY})}},xt={crop:function(){this.ready&&!this.disabled&&(this.cropped||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&this.$dragBox.addClass(x),this.$cropBox.removeClass(v)),this.setCropBoxData(this.initialCropBox))},reset:function(){this.ready&&!this.disabled&&(this.image=t.extend({},this.initialImage),this.canvas=t.extend({},this.initialCanvas),this.cropBox=t.extend({},this.initialCropBox),this.renderCanvas(),this.cropped&&this.renderCropBox())},clear:function(){this.cropped&&!this.disabled&&(t.extend(this.cropBox,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),this.$dragBox.removeClass(x),this.$cropBox.addClass(v))},replace:function(t,i){!this.disabled&&t&&(this.isImg&&this.$element.attr("src",t),i?(this.url=t,this.$clone.attr("src",t),this.ready&&this.$preview.find("img").add(this.$clone2).attr("src",t)):(this.isImg&&(this.replaced=!0),this.options.data=null,this.load(t)))},enable:function(){this.ready&&(this.disabled=!1,this.$cropper.removeClass(f))},disable:function(){this.ready&&(this.disabled=!0,this.$cropper.addClass(f))},destroy:function(){var t=this.$element;this.loaded?(this.isImg&&this.replaced&&t.attr("src",this.originalUrl),this.unbuild(),t.removeClass(v)):this.isImg?t.off(X,this.start):this.$clone&&this.$clone.remove(),t.removeData(e)},move:function(t,i){var e=this.canvas,a=e.left,n=e.top;this.moveTo(V(t)?t:a+Number(t),V(i)?i:n+Number(i))},moveTo:function(t,i){var e=this.canvas,a=!1;V(i)&&(i=t),t=Number(t),i=Number(i),this.ready&&!this.disabled&&this.options.movable&&(Z(t)&&(e.left=t,a=!0),Z(i)&&(e.top=i,a=!0),a&&this.renderCanvas(!0))},zoom:function(t,i){var e=this.canvas;t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(e.width*t/e.naturalWidth,i)},zoomTo:function(i,e){var a,n,h,o,s=this.options,r=this.pointers,d=this.canvas,c=d.width,l=d.height,p=d.naturalWidth,g=d.naturalHeight;if((i=Number(i))>=0&&this.ready&&!this.disabled&&s.zoomable){var m=p*i,u=g*i,f=void 0;if(e&&(f=e.originalEvent),this.trigger(P,{originalEvent:f,oldRatio:c/p,ratio:m/p}).isDefaultPrevented())return;if(f){var v=this.$cropper.offset(),w=r&&J(r).length?(a=r,n=0,h=0,o=0,t.each(a,function(t,i){var e=i.startX,a=i.startY;n+=e,h+=a,o+=1}),{pageX:n/=o,pageY:h/=o}):{pageX:e.pageX||f.pageX||0,pageY:e.pageY||f.pageY||0};d.left-=(m-c)*((w.pageX-v.left-d.left)/c),d.top-=(u-l)*((w.pageY-v.top-d.top)/l)}else d.left-=(m-c)/2,d.top-=(u-l)/2;d.width=m,d.height=u,this.renderCanvas(!0)}},rotate:function(t){this.rotateTo((this.image.rotate||0)+Number(t))},rotateTo:function(t){Z(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.image.rotate=t%360,this.renderCanvas(!0,!0))},scaleX:function(t){var i=this.image.scaleY;this.scale(t,Z(i)?i:1)},scaleY:function(t){var i=this.image.scaleX;this.scale(Z(i)?i:1,t)},scale:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,e=this.image,a=!1;t=Number(t),i=Number(i),this.ready&&!this.disabled&&this.options.scalable&&(Z(t)&&(e.scaleX=t,a=!0),Z(i)&&(e.scaleY=i,a=!0),a&&this.renderCanvas(!0,!0))},getData:function(){var i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.options,a=this.image,n=this.canvas,h=this.cropBox,o=void 0;if(this.ready&&this.cropped){o={x:h.left-n.left,y:h.top-n.top,width:h.width,height:h.height};var s=a.width/a.naturalWidth;t.each(o,function(t,e){e/=s,o[t]=i?Math.round(e):e})}else o={x:0,y:0,width:0,height:0};return e.rotatable&&(o.rotate=a.rotate||0),e.scalable&&(o.scaleX=a.scaleX||1,o.scaleY=a.scaleY||1),o},setData:function(i){var e=this.options,a=this.image,n=this.canvas,h={};if(t.isFunction(i)&&(i=i.call(this.element)),this.ready&&!this.disabled&&t.isPlainObject(i)){var o=!1;e.rotatable&&Z(i.rotate)&&i.rotate!==a.rotate&&(a.rotate=i.rotate,o=!0),e.scalable&&(Z(i.scaleX)&&i.scaleX!==a.scaleX&&(a.scaleX=i.scaleX,o=!0),Z(i.scaleY)&&i.scaleY!==a.scaleY&&(a.scaleY=i.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var s=a.width/a.naturalWidth;Z(i.x)&&(h.left=i.x*s+n.left),Z(i.y)&&(h.top=i.y*s+n.top),Z(i.width)&&(h.width=i.width*s),Z(i.height)&&(h.height=i.height*s),this.setCropBoxData(h)}},getContainerData:function(){return this.ready?t.extend({},this.container):{}},getImageData:function(){return this.loaded?t.extend({},this.image):{}},getCanvasData:function(){var i=this.canvas,e={};return this.ready&&t.each(["left","top","width","height","naturalWidth","naturalHeight"],function(t,a){e[a]=i[a]}),e},setCanvasData:function(i){var e=this.canvas,a=e.aspectRatio;t.isFunction(i)&&(i=i.call(this.$element)),this.ready&&!this.disabled&&t.isPlainObject(i)&&(Z(i.left)&&(e.left=i.left),Z(i.top)&&(e.top=i.top),Z(i.width)?(e.width=i.width,e.height=i.width/a):Z(i.height)&&(e.height=i.height,e.width=i.height*a),this.renderCanvas(!0))},getCropBoxData:function(){var t=this.cropBox;return this.ready&&this.cropped?{left:t.left,top:t.top,width:t.width,height:t.height}:{}},setCropBoxData:function(i){var e=this.cropBox,a=this.options.aspectRatio,n=void 0,h=void 0;t.isFunction(i)&&(i=i.call(this.$element)),this.ready&&this.cropped&&!this.disabled&&t.isPlainObject(i)&&(Z(i.left)&&(e.left=i.left),Z(i.top)&&(e.top=i.top),Z(i.width)&&i.width!==e.width&&(n=!0,e.width=i.width),Z(i.height)&&i.height!==e.height&&(h=!0,e.height=i.height),a&&(n?e.height=e.width/a:h&&(e.width=e.height*a)),this.renderCropBox())},getCroppedCanvas:function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e,a,n,h,o,s,r,d,c,l,p,g,m,u,f,v,w,x,b,y,C,M,$,B,k,W,D,T,Y,H,X,O,E,N,R=this.canvas,z=(e=this.$clone[0],a=this.image,n=R,h=i,o=a.rotate,s=void 0===o?0:o,r=a.scaleX,d=void 0===r?1:r,c=a.scaleY,l=void 0===c?1:c,p=n.aspectRatio,g=n.naturalWidth,m=n.naturalHeight,u=h.fillColor,f=void 0===u?"transparent":u,v=h.imageSmoothingEnabled,w=void 0===v||v,x=h.imageSmoothingQuality,b=void 0===x?"low":x,y=h.maxWidth,C=void 0===y?1/0:y,M=h.maxHeight,$=void 0===M?1/0:M,B=h.minWidth,k=void 0===B?0:B,W=h.minHeight,D=void 0===W?0:W,T=document.createElement("canvas"),Y=T.getContext("2d"),H=ct({aspectRatio:p,width:C,height:$}),X=ct({aspectRatio:p,width:k,height:D},"cover"),O=Math.min(H.width,Math.max(X.width,g)),E=Math.min(H.height,Math.max(X.height,m)),N=[-O/2,-E/2,O,E],T.width=tt(O),T.height=tt(E),Y.fillStyle=f,Y.fillRect(0,0,O,E),Y.save(),Y.translate(O/2,E/2),Y.rotate(s*Math.PI/180),Y.scale(d,l),Y.imageSmoothingEnabled=w,Y.imageSmoothingQuality=b,Y.drawImage.apply(Y,[e].concat(Q(t.map(N,function(t){return Math.floor(tt(t))})))),Y.restore(),T);if(!this.cropped)return z;var L=this.getData(),P=L.x,I=L.y,U=L.width,A=L.height,F=z.width/Math.floor(R.naturalWidth);1!==F&&(P*=F,I*=F,U*=F,A*=F);var j=U/A,S=ct({aspectRatio:j,width:i.maxWidth||1/0,height:i.maxHeight||1/0}),q=ct({aspectRatio:j,width:i.minWidth||0,height:i.minHeight||0},"cover"),K=ct({aspectRatio:j,width:i.width||(1!==F?z.width:U),height:i.height||(1!==F?z.height:A)}),Z=K.width,V=K.height;Z=Math.min(S.width,Math.max(q.width,Z)),V=Math.min(S.height,Math.max(q.height,V));var G=document.createElement("canvas"),J=G.getContext("2d");G.width=tt(Z),G.height=tt(V),J.fillStyle=i.fillColor||"transparent",J.fillRect(0,0,Z,V);var _=i.imageSmoothingEnabled,it=void 0===_||_,et=i.imageSmoothingQuality;J.imageSmoothingEnabled=it,et&&(J.imageSmoothingQuality=et);var at=z.width,nt=z.height,ht=P,ot=I,st=void 0,rt=void 0,dt=void 0,lt=void 0,pt=void 0,gt=void 0;ht<=-U||ht>at?(ht=0,st=0,dt=0,pt=0):ht<=0?(dt=-ht,ht=0,pt=st=Math.min(at,U+ht)):ht<=at&&(dt=0,pt=st=Math.min(U,at-ht)),st<=0||ot<=-A||ot>nt?(ot=0,rt=0,lt=0,gt=0):ot<=0?(lt=-ot,ot=0,gt=rt=Math.min(nt,A+ot)):ot<=nt&&(lt=0,gt=rt=Math.min(A,nt-ot));var mt=[ht,ot,st,rt];if(pt>0&>>0){var ut=Z/U;mt.push(dt*ut,lt*ut,pt*ut,gt*ut)}return J.drawImage.apply(J,[z].concat(Q(t.map(mt,function(t){return Math.floor(tt(t))})))),G},setAspectRatio:function(t){var i=this.options;this.disabled||V(t)||(i.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox()))},setDragMode:function(t){var i=this.options,e=void 0,a=void 0;this.loaded&&!this.disabled&&(e=t===M,a=i.movable&&t===$,t=e||a?t:B,this.$dragBox.data(y,t).toggleClass(u,e).toggleClass(b,a),i.cropBoxMovable||this.$face.data(y,t).toggleClass(u,e).toggleClass(b,a))}},bt=function(){function i(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(S(this,i),!e||!F.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.$element=t(e),this.options=t.extend({},j,t.isPlainObject(a)&&a),this.completed=!1,this.cropped=!1,this.disabled=!1,this.isImg=!1,this.limited=!1,this.loaded=!1,this.ready=!1,this.replaced=!1,this.wheeling=!1,this.originalUrl="",this.canvas=null,this.cropBox=null,this.pointers={},this.init()}return q(i,[{key:"init",value:function(){var t=this.$element,i=void 0;if(t.is("img")){if(this.isImg=!0,i=t.attr("src")||"",this.originalUrl=i,!i)return;i=t.prop("src")}else t.is("canvas")&&window.HTMLCanvasElement&&(i=t[0].toDataURL());this.load(i)}},{key:"trigger",value:function(i,e){var a=t.Event(i,e);return this.$element.trigger(a),a}},{key:"load",value:function(i){var e=this;if(i){this.url=i,this.image={};var a=this.$element,n=this.options;if(n.checkOrientation&&window.ArrayBuffer)if(U.test(i))A.test(i)?this.read((h=i.replace(pt,""),o=atob(h),s=new ArrayBuffer(o.length),r=new Uint8Array(s),t.each(r,function(t){r[t]=o.charCodeAt(t)}),s)):this.clone();else{var h,o,s,r,d=new XMLHttpRequest;d.onerror=function(){e.clone()},d.onload=function(){e.read(d.response)},n.checkCrossOrigin&&at(i)&&!a.prop("crossOrigin")&&(i=nt(i)),d.open("get",i),d.responseType="arraybuffer",d.withCredentials="use-credentials"===a.prop("crossOrigin"),d.send()}else this.clone()}}},{key:"read",value:function(i){var e,a,n,h=this.options,o=this.image,s=gt(i),r=0,d=1,c=1;if(s>1){this.url=(e="image/jpeg",a=new Uint8Array(i),n="",t.each(a,function(t,i){n+=lt(i)}),"data:"+e+";base64,"+btoa(n));var l=function(t){var i=0,e=1,a=1;switch(t){case 2:e=-1;break;case 3:i=-180;break;case 4:a=-1;break;case 5:i=90,a=-1;break;case 6:i=90;break;case 7:i=90,e=-1;break;case 8:i=-90}return{rotate:i,scaleX:e,scaleY:a}}(s);r=l.rotate,d=l.scaleX,c=l.scaleY}h.rotatable&&(o.rotate=r),h.scalable&&(o.scaleX=d,o.scaleY=c),this.clone()}},{key:"clone",value:function(){var i=this.$element,e=this.options,a=this.url,n="",h=void 0;e.checkCrossOrigin&&at(a)&&((n=i.prop("crossOrigin"))?h=a:(n="anonymous",h=nt(a))),this.crossOrigin=n,this.crossOriginUrl=h;var o=document.createElement("img");n&&(o.crossOrigin=n),o.src=h||a;var s=t(o);this.$clone=s,this.isImg?this.element.complete?this.start():i.one(X,t.proxy(this.start,this)):s.one(X,t.proxy(this.start,this)).one(H,t.proxy(this.stop,this)).addClass(w).insertAfter(i)}},{key:"start",value:function(){var i=this,e=this.$clone,a=this.$element;this.isImg||(e.off(H,this.stop),a=e),function(t,i){if(!t.naturalWidth||st){var e=document.createElement("img");e.onload=function(){i(e.width,e.height)},e.src=t.src}else i(t.naturalWidth,t.naturalHeight)}(a[0],function(e,a){t.extend(i.image,{naturalWidth:e,naturalHeight:a,aspectRatio:e/a}),i.loaded=!0,i.build()})}},{key:"stop",value:function(){this.$clone.remove(),this.$clone=null}},{key:"build",value:function(){var i=this;if(this.loaded){this.ready&&this.unbuild();var n=this.$element,h=this.options,o=this.$clone,s=t('<div class="cropper-container"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-action="e"></span><span class="cropper-line line-n" data-action="n"></span><span class="cropper-line line-w" data-action="w"></span><span class="cropper-line line-s" data-action="s"></span><span class="cropper-point point-e" data-action="e"></span><span class="cropper-point point-n" data-action="n"></span><span class="cropper-point point-w" data-action="w"></span><span class="cropper-point point-s" data-action="s"></span><span class="cropper-point point-ne" data-action="ne"></span><span class="cropper-point point-nw" data-action="nw"></span><span class="cropper-point point-sw" data-action="sw"></span><span class="cropper-point point-se" data-action="se"></span></div></div>'),r=s.find("."+e+"-crop-box"),d=r.find("."+e+"-face");this.$container=n.parent(),this.$cropper=s,this.$canvas=s.find("."+e+"-canvas").append(o),this.$dragBox=s.find("."+e+"-drag-box"),this.$cropBox=r,this.$viewBox=s.find("."+e+"-view-box"),this.$face=d,n.addClass(v).after(s),this.isImg||o.removeClass(w),this.initPreview(),this.bind(),h.aspectRatio=Math.max(0,h.aspectRatio)||NaN,h.viewMode=Math.max(0,Math.min(3,Math.round(h.viewMode)))||0,this.cropped=h.autoCrop,h.autoCrop?h.modal&&this.$dragBox.addClass(x):r.addClass(v),h.guides||r.find("."+e+"-dashed").addClass(v),h.center||r.find("."+e+"-center").addClass(v),h.cropBoxMovable&&d.addClass(b).data(y,a),h.highlight||d.addClass("cropper-invisible"),h.background&&s.addClass(e+"-bg"),h.cropBoxResizable||r.find("."+e+"-line,."+e+"-point").addClass(v),this.setDragMode(h.dragMode),this.render(),this.ready=!0,this.setData(h.data),this.completing=setTimeout(function(){t.isFunction(h.ready)&&n.one(R,h.ready),i.trigger(R),i.trigger(k,i.getData()),i.completed=!0},0)}}},{key:"unbuild",value:function(){this.ready&&(this.completed||clearTimeout(this.completing),this.ready=!1,this.completed=!1,this.initialImage=null,this.initialCanvas=null,this.initialCropBox=null,this.container=null,this.canvas=null,this.cropBox=null,this.unbind(),this.resetPreview(),this.$preview=null,this.$viewBox=null,this.$cropBox=null,this.$dragBox=null,this.$canvas=null,this.$container=null,this.$cropper.remove(),this.$cropper=null)}}],[{key:"setDefaults",value:function(i){t.extend(j,t.isPlainObject(i)&&i)}}]),i}();if(t.extend&&t.extend(bt.prototype,mt,ut,ft,vt,wt,xt),t.fn){var yt=t.fn.cropper;t.fn.cropper=function(i){for(var a=arguments.length,n=Array(a>1?a-1:0),h=1;h<a;h++)n[h-1]=arguments[h];var o=void 0;return this.each(function(a,h){var s=t(h),r=s.data(e);if(!r){if(/destroy/.test(i))return;var d=t.extend({},s.data(),t.isPlainObject(i)&&i);r=new bt(h,d),s.data(e,r)}if("string"==typeof i){var c=r[i];t.isFunction(c)&&(o=c.apply(r,n))}}),V(o)?this:o},t.fn.cropper.Constructor=bt,t.fn.cropper.setDefaults=bt.setDefaults,t.fn.cropper.noConflict=function(){return t.fn.cropper=yt,this}}});
|
||
|
||
|
||
/*!
|
||
* jquery-timepicker v1.13.16 - A jQuery timepicker plugin inspired by Google Calendar. It supports both mouse and keyboard navigation.
|
||
* Copyright (c) 2016 Jon Thornton - http://jonthornton.github.com/jquery-timepicker/
|
||
* License: MIT
|
||
*/
|
||
!function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function s(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function r(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?s(Object(i),!0).forEach((function(t){n(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):s(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function o(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return a(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(e,t):void 0}}(e))){var t=0,i=function(){};return{s:i,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,s,r=!0,o=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return r=e.done,e},e:function(e){o=!0,s=e},f:function(){try{r||null==n.return||n.return()}finally{if(o)throw s}}}}var l=function(e,t){if(null===e)return null;if("number"!=typeof t.step)return e;var i=e%(60*t.step);return(i-=(t.minTime||0)%(60*t.step))>=30*t.step?e+=60*t.step-i:e-=i,function(e,t){if(86400==e&&t.show2400)return e;return e%86400}(e,t)};var u,c={appendTo:"body",className:null,closeOnWindowScroll:!1,disableTextInput:!1,disableTimeRanges:[],disableTouchKeyboard:!1,durationTime:null,forceRoundTime:!1,lang:{},listWidth:null,maxTime:null,minTime:null,noneOption:!1,orientation:"l",roundingFunction:l,scrollDefault:null,selectOnBlur:!1,show2400:!1,showDuration:!1,showOn:["click","focus"],showOnFocus:!0,step:30,stopScrollPropagation:!1,timeFormat:"g:ia",typeaheadHighlight:!0,useSelect:!1,wrapHours:!0},m={am:"am",pm:"pm",AM:"AM",PM:"PM",decimal:".",mins:"mins",hr:"hr",hrs:"hrs"},p=function(){function n(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t(this,n),this.targetEl=e;var s=n.extractAttrOptions(e,Object.keys(c));this.settings=this.parseSettings(r(r(r({},c),i),s))}var s,a,l;return s=n,l=[{key:"extractAttrOptions",value:function(e,t){var i,n={},s=o(t);try{for(s.s();!(i=s.n()).done;){var r=i.value;r in e.dataset&&(n[r]=e.dataset[r])}}catch(e){s.e(e)}finally{s.f()}return n}},{key:"isVisible",value:function(e){var t=e[0];return t.offsetWidth>0&&t.offsetHeight>0}}],(a=[{key:"_findRow",value:function(e){if(!e&&0!==e)return!1;var t=!1;return e=this.settings.roundingFunction(e,this.settings),!!this.list&&(this.list.find("li").each((function(i,n){var s=Number.parseInt(n.dataset.time);if(!Number.isNaN(s))return s==e?(t=n,!1):void 0})),t)}},{key:"_hideKeyboard",value:function(){return(window.navigator.msMaxTouchPoints||"ontouchstart"in document)&&this.settings.disableTouchKeyboard}},{key:"_setTimeValue",value:function(e,t){if("INPUT"===this.targetEl.nodeName){null===e&&""==this.targetEl.value||(this.targetEl.value=e);var i=this;i.settings.useSelect&&"select"!=t&&i.list&&i.list.val(i._roundAndFormatTime(i.time2int(e)))}var n=new Event("selectTime");if(this.selectedValue!=e){this.selectedValue=e;var s=new Event("changeTime"),r=new CustomEvent("change",{detail:"timepicker"});return"select"==t?(this.targetEl.dispatchEvent(n),this.targetEl.dispatchEvent(s),this.targetEl.dispatchEvent(r)):-1==["error","initial"].indexOf(t)&&this.targetEl.dispatchEvent(s),!0}return-1==["error","initial"].indexOf(t)&&this.targetEl.dispatchEvent(n),!1}},{key:"_getTimeValue",value:function(){return"INPUT"===this.targetEl.nodeName?this.targetEl.value:this.selectedValue}},{key:"_selectValue",value:function(){this.settings;var e=this.list.find(".ui-timepicker-selected");if(e.hasClass("ui-timepicker-disabled"))return!1;if(!e.length)return!0;var t=e.get(0).dataset.time;if(t){var i=Number.parseInt(t);i&&(t=i)}return null!==t&&("string"!=typeof t&&(t=this._int2time(t)),this._setTimeValue(t,"select")),!0}},{key:"time2int",value:function(e){if(""===e||null==e)return null;if(e instanceof Date)return 3600*e.getHours()+60*e.getMinutes()+e.getSeconds();if("string"!=typeof e)return e;"a"!=(e=e.toLowerCase().replace(/[\s\.]/g,"")).slice(-1)&&"p"!=e.slice(-1)||(e+="m");var t=/^(([^0-9]*))?([0-9]?[0-9])(([0-5][0-9]))?(([0-5][0-9]))?(([^0-9]*))$/;e.match(/\W/)&&(t=/^(([^0-9]*))?([0-9]?[0-9])(\W+([0-5][0-9]?))?(\W+([0-5][0-9]))?(([^0-9]*))$/);var i=e.match(t);if(!i)return null;var n=parseInt(1*i[3],10),s=i[2]||i[9],r=n,a=1*i[5]||0,o=1*i[7]||0;if(s||2!=i[3].length||"0"!=i[3][0]||(s="am"),n<=12&&s){var l=(s=s.trim())==this.settings.lang.pm||s==this.settings.lang.PM;r=12==n?l?12:0:n+(l?12:0)}else if(3600*n+60*a+o>=86400+(this.settings.show2400?1:0)){if(!1===this.settings.wrapHours)return null;r=n%24}var u=3600*r+60*a+o;if(n<12&&!s&&this.settings._twelveHourTime&&this.settings.scrollDefault){var c=u-this.settings.scrollDefault();c<0&&c>=-43200&&(u=(u+43200)%86400)}return u}},{key:"parseSettings",value:function(e){var t=this;if(e.lang=r(r({},m),e.lang),this.settings=e,e.minTime&&(e.minTime=this.time2int(e.minTime)),e.maxTime&&(e.maxTime=this.time2int(e.maxTime)),e.listWidth&&(e.listWidth=this.time2int(e.listWidth)),e.durationTime&&"function"!=typeof e.durationTime&&(e.durationTime=this.time2int(e.durationTime)),"now"==e.scrollDefault)e.scrollDefault=function(){return e.roundingFunction(t.time2int(new Date),e)};else if(e.scrollDefault&&"function"!=typeof e.scrollDefault){var i=e.scrollDefault;e.scrollDefault=function(){return e.roundingFunction(t.time2int(i),e)}}else e.minTime&&(e.scrollDefault=function(){return e.roundingFunction(e.minTime,e)});if("string"==typeof e.timeFormat&&e.timeFormat.match(/[gh]/)&&(e._twelveHourTime=!0),!1===e.showOnFocus&&-1!=e.showOn.indexOf("focus")&&e.showOn.splice(e.showOn.indexOf("focus"),1),e.disableTimeRanges||(e.disableTimeRanges=[]),e.disableTimeRanges.length>0){for(var n in e.disableTimeRanges)e.disableTimeRanges[n]=[this.time2int(e.disableTimeRanges[n][0]),this.time2int(e.disableTimeRanges[n][1])];for(e.disableTimeRanges=e.disableTimeRanges.sort((function(e,t){return e[0]-t[0]})),n=e.disableTimeRanges.length-1;n>0;n--)e.disableTimeRanges[n][0]<=e.disableTimeRanges[n-1][1]&&(e.disableTimeRanges[n-1]=[Math.min(e.disableTimeRanges[n][0],e.disableTimeRanges[n-1][0]),Math.max(e.disableTimeRanges[n][1],e.disableTimeRanges[n-1][1])],e.disableTimeRanges.splice(n,1))}return e}},{key:"_disableTextInputHandler",value:function(e){switch(e.keyCode){case 13:case 9:return;default:e.preventDefault()}}},{key:"_int2duration",value:function(e,t){e=Math.abs(e);var i,n,s=Math.round(e/60),r=[];return s<60?r=[s,this.settings.lang.mins]:(i=Math.floor(s/60),n=s%60,30==t&&30==n&&(i+=this.settings.lang.decimal+5),r.push(i),r.push(1==i?this.settings.lang.hr:this.settings.lang.hrs),30!=t&&n&&(r.push(n),r.push(this.settings.lang.mins))),r.join(" ")}},{key:"_roundAndFormatTime",value:function(e){if(null!==(e=this.settings.roundingFunction(e,this.settings)))return this._int2time(e)}},{key:"_int2time",value:function(e){if("number"!=typeof e)return null;var t=parseInt(e%60),i=parseInt(e/60%60),n=parseInt(e/3600%24),s=new Date(1970,0,2,n,i,t,0);if(isNaN(s.getTime()))return null;if("function"==typeof this.settings.timeFormat)return this.settings.timeFormat(s);for(var r,a,o="",l=0;l<this.settings.timeFormat.length;l++)switch(a=this.settings.timeFormat.charAt(l)){case"a":o+=s.getHours()>11?this.settings.lang.pm:this.settings.lang.am;break;case"A":o+=s.getHours()>11?this.settings.lang.PM:this.settings.lang.AM;break;case"g":o+=0==(r=s.getHours()%12)?"12":r;break;case"G":r=s.getHours(),86400===e&&(r=this.settings.show2400?24:0),o+=r;break;case"h":0!=(r=s.getHours()%12)&&r<10&&(r="0"+r),o+=0===r?"12":r;break;case"H":r=s.getHours(),86400===e&&(r=this.settings.show2400?24:0),o+=r>9?r:"0"+r;break;case"i":o+=(i=s.getMinutes())>9?i:"0"+i;break;case"s":o+=(t=s.getSeconds())>9?t:"0"+t;break;case"\\":l++,o+=this.settings.timeFormat.charAt(l);break;default:o+=a}return o}},{key:"_setSelected",value:function(){var e=this.list;e.find("li").removeClass("ui-timepicker-selected");var t=this.time2int(this._getTimeValue());if(null!==t){var i=this._findRow(t);if(i){var n=i.getBoundingClientRect(),s=e.get(0).getBoundingClientRect(),r=n.top-s.top;if(r+n.height>s.height||r<0){var a=e.scrollTop()+(n.top-s.top)-n.height;e.scrollTop(a)}var o=Number.parseInt(i.dataset.time);(this.settings.forceRoundTime||o===t)&&i.classList.add("ui-timepicker-selected")}}}},{key:"_generateNoneElement",value:function(t,i){var n,s,r,a;return"object"==e(t)?(n=t.label,s=t.className,r=t.value):"string"==typeof t?(n=t,r=""):$.error("Invalid noneOption value"),i?(a=document.createElement("option")).value=r:(a=document.createElement("li")).dataset.time=String(r),a.innerText=n,a.classList.add(s),a}}])&&i(s.prototype,a),l&&i(s,l),n}();u=function(t){var i={init:function(e){return this.each((function(){var s=t(this),l=new p(this,e),u=l.settings;if(u.lang,s.data("timepicker-obj",l),s.addClass("ui-timepicker-input"),u.useSelect)n(s);else{if(s.prop("autocomplete","off"),u.showOn)for(var c in u.showOn)s.on(u.showOn[c]+".timepicker",i.show);s.on("change.timepicker",r),s.on("keydown.timepicker",a),s.on("keyup.timepicker",o),u.disableTextInput&&s.on("keydown.timepicker",l._disableTextInputHandler),s.on("cut.timepicker",o),s.on("paste.timepicker",o),r.call(s.get(0),null,"initial")}}))},show:function(e){var r=t(this),a=r.data("timepicker-obj"),o=a.settings;if(e&&e.preventDefault(),o.useSelect)a.list.focus();else{a._hideKeyboard()&&r.blur();var l=a.list;if(!r.prop("readonly")&&(l&&0!==l.length&&"function"!=typeof o.durationTime||(n(r),l=a.list),!p.isVisible(l))){r.is("input")&&(a.selectedValue=r.val()),a._setSelected(),i.hide(),"number"==typeof o.listWidth&&l.width(r.outerWidth()*o.listWidth),l.show();var u={};o.orientation.match(/r/)?u.left=r.offset().left+r.outerWidth()-l.outerWidth()+parseInt(l.css("marginLeft").replace("px",""),10):o.orientation.match(/l/)?u.left=r.offset().left+parseInt(l.css("marginLeft").replace("px",""),10):o.orientation.match(/c/)&&(u.left=r.offset().left+(r.outerWidth()-l.outerWidth())/2+parseInt(l.css("marginLeft").replace("px",""),10)),"t"==(o.orientation.match(/t/)?"t":o.orientation.match(/b/)?"b":r.offset().top+r.outerHeight(!0)+l.outerHeight()>t(window).height()+t(window).scrollTop()?"t":"b")?(l.addClass("ui-timepicker-positioned-top"),u.top=r.offset().top-l.outerHeight()+parseInt(l.css("marginTop").replace("px",""),10)):(l.removeClass("ui-timepicker-positioned-top"),u.top=r.offset().top+r.outerHeight()+parseInt(l.css("marginTop").replace("px",""),10)),l.offset(u);var c=l.find(".ui-timepicker-selected");if(!c.length){var m=a.time2int(a._getTimeValue());null!==m?c=t(a._findRow(m)):o.scrollDefault&&(c=t(a._findRow(o.scrollDefault())))}if(c.length&&!c.hasClass("ui-timepicker-disabled")||(c=l.find("li:not(.ui-timepicker-disabled):first")),c&&c.length){var d=l.scrollTop()+c.position().top-c.outerHeight();l.scrollTop(d)}else l.scrollTop(0);return o.stopScrollPropagation&&t(document).on("wheel.ui-timepicker",".ui-timepicker-wrapper",(function(e){e.preventDefault();var i=t(this).scrollTop();t(this).scrollTop(i+e.originalEvent.deltaY)})),t(document).on("mousedown.ui-timepicker",s),t(window).on("resize.ui-timepicker",s),o.closeOnWindowScroll&&t(document).on("scroll.ui-timepicker",s),r.trigger("showTimepicker"),this}}},hide:function(e){var i=t(this),n=i.data("timepicker-obj");return n&&n.settings&&n.settings.useSelect&&i.blur(),t(".ui-timepicker-wrapper").each((function(){var e=t(this);if(p.isVisible(e)){var i=e.data("timepicker-input"),n=i.data("timepicker-obj");n&&n.settings&&n.settings.selectOnBlur&&n._selectValue(),e.hide(),i.trigger("hideTimepicker")}})),this},option:function(i,s){return"string"==typeof i&&void 0===s?t(this).data("timepicker-obj").settings[i]:this.each((function(){var a=t(this),o=a.data("timepicker-obj"),l=o.settings,u=o.list;"object"==e(i)?l=t.extend(l,i):"string"==typeof i&&(l[i]=s),l=o.parseSettings(l),o.settings=l,r.call(a.get(0),{type:"change"},"initial"),u&&(u.remove(),o.list=null),l.useSelect&&n(a)}))},getSecondsFromMidnight:function(){var e=t(this).data("timepicker-obj");return e.time2int(e._getTimeValue())},getTime:function(e){var i=t(this).data("timepicker-obj"),n=i._getTimeValue();if(!n)return null;var s=i.time2int(n);if(null===s)return null;e||(e=new Date);var r=new Date(e);return r.setHours(s/3600),r.setMinutes(s%3600/60),r.setSeconds(s%60),r.setMilliseconds(0),r},isVisible:function(){var e=this.data("timepicker-obj");return!!(e&&e.list&&p.isVisible(e.list))},setTime:function(e){var t=this.data("timepicker-obj"),i=t.settings;if(i.forceRoundTime)var n=t._roundAndFormatTime(t.time2int(e));else n=t._int2time(t.time2int(e));return e&&null===n&&i.noneOption&&(n=e),t._setTimeValue(n,"initial"),r.call(this.get(0),{type:"change"},"initial"),t&&t.list&&t._setSelected(),this},remove:function(){if(this.hasClass("ui-timepicker-input")){var e=this.data("timepicker-obj"),t=e.settings;return this.removeAttr("autocomplete","off"),this.removeClass("ui-timepicker-input"),this.removeData("timepicker-obj"),this.off(".timepicker"),e.list&&e.list.remove(),t.useSelect&&this.show(),e.list=null,this}}};function n(e){var n=e.data("timepicker-obj"),s=n.list,r=n.settings;if(s&&s.length&&(s.remove(),n.list=null),r.useSelect){s=t("<select />",{class:"ui-timepicker-select"}),e.attr("name")&&s.attr("name","ui-timepicker-"+e.attr("name"));var a=s}else s=t("<ul />",{class:"ui-timepicker-list"}),(a=t("<div />",{class:"ui-timepicker-wrapper",tabindex:-1})).css({display:"none",position:"absolute"}).append(s);if(r.noneOption)if(!0===r.noneOption&&(r.noneOption=r.useSelect?"Time...":"None"),t.isArray(r.noneOption)){for(var o in r.noneOption)if(parseInt(o,10)==o){var u=n._generateNoneElement(r.noneOption[o],r.useSelect);s.append(u)}}else u=n._generateNoneElement(r.noneOption,r.useSelect),s.append(u);r.className&&a.addClass(r.className),null===r.minTime&&null===r.durationTime||!r.showDuration||("function"==typeof r.step||r.step,a.addClass("ui-timepicker-with-duration"),a.addClass("ui-timepicker-step-"+r.step));var c=r.minTime;"function"==typeof r.durationTime?c=n.time2int(r.durationTime()):null!==r.durationTime&&(c=r.durationTime);var m=null!==r.minTime?r.minTime:0,p=null!==r.maxTime?r.maxTime:m+86400-1;p<m&&(p+=86400),86399===p&&"string"===t.type(r.timeFormat)&&r.show2400&&(p=86400);var d=r.disableTimeRanges,f=0,h=d.length,g=r.step;"function"!=typeof g&&(g=function(){return r.step}),o=m;for(var v=0;o<=p;o+=60*g(++v)){var b,k=o,y=n._int2time(k);if(r.useSelect?(b=t("<option />",{value:y})).text(y):((b=t("<li />")).addClass(k%86400<43200?"ui-timepicker-am":"ui-timepicker-pm"),b.attr("data-time",l(k,r)),b.text(y)),(null!==r.minTime||null!==r.durationTime)&&r.showDuration){var T=n._int2duration(o-c,r.step);if(r.useSelect)b.text(b.text()+" ("+T+")");else{var w=t("<span />",{class:"ui-timepicker-duration"});w.text(" ("+T+")"),b.append(w)}}f<h&&(k>=d[f][1]&&(f+=1),d[f]&&k>=d[f][0]&&k<d[f][1]&&(r.useSelect?b.prop("disabled",!0):b.addClass("ui-timepicker-disabled"))),s.append(b)}if(a.data("timepicker-input",e),n.list=a,r.useSelect)e.val()&&s.val(n._roundAndFormatTime(n.time2int(e.val()))),s.on("focus",(function(){t(this).data("timepicker-input").trigger("showTimepicker")})),s.on("blur",(function(){t(this).data("timepicker-input").trigger("hideTimepicker")})),s.on("change",(function(){n._setTimeValue(t(this).val(),"select")})),n._setTimeValue(s.val(),"initial"),e.hide().after(s);else{var O=r.appendTo;"string"==typeof O?O=t(O):"function"==typeof O&&(O=O(e)),O.append(a),n._setSelected(),s.on("mousedown click","li",(function(r){e.off("focus.timepicker"),e.on("focus.timepicker-ie-hack",(function(){e.off("focus.timepicker-ie-hack"),e.on("focus.timepicker",i.show)})),n._hideKeyboard()||e[0].focus(),s.find("li").removeClass("ui-timepicker-selected"),t(this).addClass("ui-timepicker-selected"),n._selectValue()&&(e.trigger("hideTimepicker"),s.on("mouseup.timepicker click.timepicker","li",(function(e){s.off("mouseup.timepicker click.timepicker"),a.hide()})))}))}}function s(e){if(e.target!=window){var n=t(e.target);n.closest(".ui-timepicker-input").length||n.closest(".ui-timepicker-wrapper").length||(i.hide(),t(document).unbind(".ui-timepicker"),t(window).unbind(".ui-timepicker"))}}function r(e,i){if(!e||"timepicker"!=e.detail){var n=t(this),s=n.data("timepicker-obj");if(""!==this.value){if(!n.is(":focus")||e&&"change"==e.type){var r=s.settings,a=s.time2int(this.value);if(null!==a){var o=!1;if(null!==r.minTime&&null!==r.maxTime&&(a<r.minTime||a>r.maxTime)&&(o=!0),t.each(r.disableTimeRanges,(function(){if(a>=this[0]&&a<this[1])return o=!0,!1})),r.forceRoundTime){var l=r.roundingFunction(a,r);l!=a&&(a=l,i=null)}var u=s._int2time(a);o?(s._setTimeValue(u,"error")||e&&"change"==e.type)&&n.trigger("timeRangeError"):s._setTimeValue(u,i)}else n.trigger("timeFormatError")}}else s._setTimeValue(null,i)}}function a(e){var n=t(this),s=n.data("timepicker-obj"),a=s.list;if(!a||!p.isVisible(a)){if(40!=e.keyCode)return!0;i.show.call(n.get(0)),a=s.list,s._hideKeyboard()||n.focus()}switch(e.keyCode){case 13:return s._selectValue()&&(r.call(n.get(0),{type:"change"}),i.hide.apply(this)),e.preventDefault(),!1;case 38:var o=a.find(".ui-timepicker-selected");return o.length?o.is(":first-child")||(o.removeClass("ui-timepicker-selected"),o.prev().addClass("ui-timepicker-selected"),o.prev().position().top<o.outerHeight()&&a.scrollTop(a.scrollTop()-o.outerHeight())):(a.find("li").each((function(e,i){if(t(i).position().top>0)return o=t(i),!1})),o.addClass("ui-timepicker-selected")),!1;case 40:return 0===(o=a.find(".ui-timepicker-selected")).length?(a.find("li").each((function(e,i){if(t(i).position().top>0)return o=t(i),!1})),o.addClass("ui-timepicker-selected")):o.is(":last-child")||(o.removeClass("ui-timepicker-selected"),o.next().addClass("ui-timepicker-selected"),o.next().position().top+2*o.outerHeight()>a.outerHeight()&&a.scrollTop(a.scrollTop()+o.outerHeight())),!1;case 27:a.find("li").removeClass("ui-timepicker-selected"),i.hide();break;case 9:i.hide();break;default:return!0}}function o(e){var i=t(this).data("timepicker-obj"),n=i.list,s=i.settings;if(!n||!p.isVisible(n)||s.disableTextInput)return!0;if("paste"!==e.type&&"cut"!==e.type)switch(e.keyCode){case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 65:case 77:case 80:case 186:case 8:case 46:s.typeaheadHighlight?i._setSelected():n.hide()}else setTimeout((function(){s.typeaheadHighlight?i._setSelected():n.hide()}),0)}t.fn.qorTimepicker=function(n){return this.length?i[n]?this.hasClass("ui-timepicker-input")?i[n].apply(this,Array.prototype.slice.call(arguments,1)):this:"object"!==e(n)&&n?void t.error("Method "+n+" does not exist on jQuery.timepicker"):i.init.apply(this,arguments):this},t.fn.qorTimepicker.defaults=c},"object"===("undefined"==typeof exports?"undefined":e(exports))&&exports&&"object"===("undefined"==typeof module?"undefined":e(module))&&module&&module.exports===exports?u(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],u):u(jQuery)}();
|
||
|
||
|
||
/**
|
||
* material-design-lite - Material Design Components in CSS, JS and HTML
|
||
* @version v1.3.0
|
||
* @license Apache-2.0
|
||
* @copyright 2015 Google, Inc.
|
||
* @link https://github.com/google/material-design-lite
|
||
*/
|
||
!function(){"use strict";function e(e,t){if(e){if(t.element_.classList.contains(t.CssClasses_.MDL_JS_RIPPLE_EFFECT)){var s=document.createElement("span");s.classList.add(t.CssClasses_.MDL_RIPPLE_CONTAINER),s.classList.add(t.CssClasses_.MDL_JS_RIPPLE_EFFECT);var i=document.createElement("span");i.classList.add(t.CssClasses_.MDL_RIPPLE),s.appendChild(i),e.appendChild(s)}e.addEventListener("click",function(s){if("#"===e.getAttribute("href").charAt(0)){s.preventDefault();var i=e.href.split("#")[1],n=t.element_.querySelector("#"+i);t.resetTabState_(),t.resetPanelState_(),e.classList.add(t.CssClasses_.ACTIVE_CLASS),n.classList.add(t.CssClasses_.ACTIVE_CLASS)}})}}function t(e,t,s,i){function n(){var n=e.href.split("#")[1],a=i.content_.querySelector("#"+n);i.resetTabState_(t),i.resetPanelState_(s),e.classList.add(i.CssClasses_.IS_ACTIVE),a.classList.add(i.CssClasses_.IS_ACTIVE)}if(i.tabBar_.classList.contains(i.CssClasses_.JS_RIPPLE_EFFECT)){var a=document.createElement("span");a.classList.add(i.CssClasses_.RIPPLE_CONTAINER),a.classList.add(i.CssClasses_.JS_RIPPLE_EFFECT);var l=document.createElement("span");l.classList.add(i.CssClasses_.RIPPLE),a.appendChild(l),e.appendChild(a)}i.tabBar_.classList.contains(i.CssClasses_.TAB_MANUAL_SWITCH)||e.addEventListener("click",function(t){"#"===e.getAttribute("href").charAt(0)&&(t.preventDefault(),n())}),e.show=n}var s={upgradeDom:function(e,t){},upgradeElement:function(e,t){},upgradeElements:function(e){},upgradeAllRegistered:function(){},registerUpgradedCallback:function(e,t){},register:function(e){},downgradeElements:function(e){}};s=function(){function e(e,t){for(var s=0;s<c.length;s++)if(c[s].className===e)return"undefined"!=typeof t&&(c[s]=t),c[s];return!1}function t(e){var t=e.getAttribute("data-upgraded");return null===t?[""]:t.split(",")}function s(e,s){var i=t(e);return i.indexOf(s)!==-1}function i(e,t,s){if("CustomEvent"in window&&"function"==typeof window.CustomEvent)return new CustomEvent(e,{bubbles:t,cancelable:s});var i=document.createEvent("Events");return i.initEvent(e,t,s),i}function n(t,s){if("undefined"==typeof t&&"undefined"==typeof s)for(var i=0;i<c.length;i++)n(c[i].className,c[i].cssClass);else{var l=t;if("undefined"==typeof s){var o=e(l);o&&(s=o.cssClass)}for(var r=document.querySelectorAll("."+s),_=0;_<r.length;_++)a(r[_],l)}}function a(n,a){if(!("object"==typeof n&&n instanceof Element))throw new Error("Invalid argument provided to upgrade MDL element.");var l=i("mdl-componentupgrading",!0,!0);if(n.dispatchEvent(l),!l.defaultPrevented){var o=t(n),r=[];if(a)s(n,a)||r.push(e(a));else{var _=n.classList;c.forEach(function(e){_.contains(e.cssClass)&&r.indexOf(e)===-1&&!s(n,e.className)&&r.push(e)})}for(var d,h=0,u=r.length;h<u;h++){if(d=r[h],!d)throw new Error("Unable to find a registered component for the given class.");o.push(d.className),n.setAttribute("data-upgraded",o.join(","));var E=new d.classConstructor(n);E[C]=d,p.push(E);for(var m=0,L=d.callbacks.length;m<L;m++)d.callbacks[m](n);d.widget&&(n[d.className]=E);var I=i("mdl-componentupgraded",!0,!1);n.dispatchEvent(I)}}}function l(e){Array.isArray(e)||(e=e instanceof Element?[e]:Array.prototype.slice.call(e));for(var t,s=0,i=e.length;s<i;s++)t=e[s],t instanceof HTMLElement&&(a(t),t.children.length>0&&l(t.children))}function o(t){var s="undefined"==typeof t.widget&&"undefined"==typeof t.widget,i=!0;s||(i=t.widget||t.widget);var n={classConstructor:t.constructor||t.constructor,className:t.classAsString||t.classAsString,cssClass:t.cssClass||t.cssClass,widget:i,callbacks:[]};if(c.forEach(function(e){if(e.cssClass===n.cssClass)throw new Error("The provided cssClass has already been registered: "+e.cssClass);if(e.className===n.className)throw new Error("The provided className has already been registered")}),t.constructor.prototype.hasOwnProperty(C))throw new Error("MDL component classes must not have "+C+" defined as a property.");var a=e(t.classAsString,n);a||c.push(n)}function r(t,s){var i=e(t);i&&i.callbacks.push(s)}function _(){for(var e=0;e<c.length;e++)n(c[e].className)}function d(e){if(e){var t=p.indexOf(e);p.splice(t,1);var s=e.element_.getAttribute("data-upgraded").split(","),n=s.indexOf(e[C].classAsString);s.splice(n,1),e.element_.setAttribute("data-upgraded",s.join(","));var a=i("mdl-componentdowngraded",!0,!1);e.element_.dispatchEvent(a)}}function h(e){var t=function(e){p.filter(function(t){return t.element_===e}).forEach(d)};if(e instanceof Array||e instanceof NodeList)for(var s=0;s<e.length;s++)t(e[s]);else{if(!(e instanceof Node))throw new Error("Invalid argument provided to downgrade MDL nodes.");t(e)}}var c=[],p=[],C="mdlComponentConfigInternal_";return{upgradeDom:n,upgradeElement:a,upgradeElements:l,upgradeAllRegistered:_,registerUpgradedCallback:r,register:o,downgradeElements:h}}(),s.ComponentConfigPublic,s.ComponentConfig,s.Component,s.upgradeDom=s.upgradeDom,s.upgradeElement=s.upgradeElement,s.upgradeElements=s.upgradeElements,s.upgradeAllRegistered=s.upgradeAllRegistered,s.registerUpgradedCallback=s.registerUpgradedCallback,s.register=s.register,s.downgradeElements=s.downgradeElements,window.componentHandler=s,window.componentHandler=s,window.addEventListener("load",function(){"classList"in document.createElement("div")&&"querySelector"in document&&"addEventListener"in window&&Array.prototype.forEach?(document.documentElement.classList.add("mdl-js"),s.upgradeAllRegistered()):(s.upgradeElement=function(){},s.register=function(){})}),Date.now||(Date.now=function(){return(new Date).getTime()},Date.now=Date.now);for(var i=["webkit","moz"],n=0;n<i.length&&!window.requestAnimationFrame;++n){var a=i[n];window.requestAnimationFrame=window[a+"RequestAnimationFrame"],window.cancelAnimationFrame=window[a+"CancelAnimationFrame"]||window[a+"CancelRequestAnimationFrame"],window.requestAnimationFrame=window.requestAnimationFrame,window.cancelAnimationFrame=window.cancelAnimationFrame}if(/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent)||!window.requestAnimationFrame||!window.cancelAnimationFrame){var l=0;window.requestAnimationFrame=function(e){var t=Date.now(),s=Math.max(l+16,t);return setTimeout(function(){e(l=s)},s-t)},window.cancelAnimationFrame=clearTimeout,window.requestAnimationFrame=window.requestAnimationFrame,window.cancelAnimationFrame=window.cancelAnimationFrame}var o=function(e){this.element_=e,this.init()};window.MaterialButton=o,o.prototype.Constant_={},o.prototype.CssClasses_={RIPPLE_EFFECT:"mdl-js-ripple-effect",RIPPLE_CONTAINER:"mdl-button__ripple-container",RIPPLE:"mdl-ripple"},o.prototype.blurHandler_=function(e){e&&this.element_.blur()},o.prototype.disable=function(){this.element_.disabled=!0},o.prototype.disable=o.prototype.disable,o.prototype.enable=function(){this.element_.disabled=!1},o.prototype.enable=o.prototype.enable,o.prototype.init=function(){if(this.element_){if(this.element_.classList.contains(this.CssClasses_.RIPPLE_EFFECT)){var e=document.createElement("span");e.classList.add(this.CssClasses_.RIPPLE_CONTAINER),this.rippleElement_=document.createElement("span"),this.rippleElement_.classList.add(this.CssClasses_.RIPPLE),e.appendChild(this.rippleElement_),this.boundRippleBlurHandler=this.blurHandler_.bind(this),this.rippleElement_.addEventListener("mouseup",this.boundRippleBlurHandler),this.element_.appendChild(e)}this.boundButtonBlurHandler=this.blurHandler_.bind(this),this.element_.addEventListener("mouseup",this.boundButtonBlurHandler),this.element_.addEventListener("mouseleave",this.boundButtonBlurHandler)}},s.register({constructor:o,classAsString:"MaterialButton",cssClass:"mdl-js-button",widget:!0});var r=function(e){this.element_=e,this.init()};window.MaterialCheckbox=r,r.prototype.Constant_={TINY_TIMEOUT:.001},r.prototype.CssClasses_={INPUT:"mdl-checkbox__input",BOX_OUTLINE:"mdl-checkbox__box-outline",FOCUS_HELPER:"mdl-checkbox__focus-helper",TICK_OUTLINE:"mdl-checkbox__tick-outline",RIPPLE_EFFECT:"mdl-js-ripple-effect",RIPPLE_IGNORE_EVENTS:"mdl-js-ripple-effect--ignore-events",RIPPLE_CONTAINER:"mdl-checkbox__ripple-container",RIPPLE_CENTER:"mdl-ripple--center",RIPPLE:"mdl-ripple",IS_FOCUSED:"is-focused",IS_DISABLED:"is-disabled",IS_CHECKED:"is-checked",IS_UPGRADED:"is-upgraded"},r.prototype.onChange_=function(e){this.updateClasses_()},r.prototype.onFocus_=function(e){this.element_.classList.add(this.CssClasses_.IS_FOCUSED)},r.prototype.onBlur_=function(e){this.element_.classList.remove(this.CssClasses_.IS_FOCUSED)},r.prototype.onMouseUp_=function(e){this.blur_()},r.prototype.updateClasses_=function(){this.checkDisabled(),this.checkToggleState()},r.prototype.blur_=function(){window.setTimeout(function(){this.inputElement_.blur()}.bind(this),this.Constant_.TINY_TIMEOUT)},r.prototype.checkToggleState=function(){this.inputElement_.checked?this.element_.classList.add(this.CssClasses_.IS_CHECKED):this.element_.classList.remove(this.CssClasses_.IS_CHECKED)},r.prototype.checkToggleState=r.prototype.checkToggleState,r.prototype.checkDisabled=function(){this.inputElement_.disabled?this.element_.classList.add(this.CssClasses_.IS_DISABLED):this.element_.classList.remove(this.CssClasses_.IS_DISABLED)},r.prototype.checkDisabled=r.prototype.checkDisabled,r.prototype.disable=function(){this.inputElement_.disabled=!0,this.updateClasses_()},r.prototype.disable=r.prototype.disable,r.prototype.enable=function(){this.inputElement_.disabled=!1,this.updateClasses_()},r.prototype.enable=r.prototype.enable,r.prototype.check=function(){this.inputElement_.checked=!0,this.updateClasses_()},r.prototype.check=r.prototype.check,r.prototype.uncheck=function(){this.inputElement_.checked=!1,this.updateClasses_()},r.prototype.uncheck=r.prototype.uncheck,r.prototype.init=function(){if(this.element_){this.inputElement_=this.element_.querySelector("."+this.CssClasses_.INPUT);var e=document.createElement("span");e.classList.add(this.CssClasses_.BOX_OUTLINE);var t=document.createElement("span");t.classList.add(this.CssClasses_.FOCUS_HELPER);var s=document.createElement("span");if(s.classList.add(this.CssClasses_.TICK_OUTLINE),e.appendChild(s),this.element_.appendChild(t),this.element_.appendChild(e),this.element_.classList.contains(this.CssClasses_.RIPPLE_EFFECT)){this.element_.classList.add(this.CssClasses_.RIPPLE_IGNORE_EVENTS),this.rippleContainerElement_=document.createElement("span"),this.rippleContainerElement_.classList.add(this.CssClasses_.RIPPLE_CONTAINER),this.rippleContainerElement_.classList.add(this.CssClasses_.RIPPLE_EFFECT),this.rippleContainerElement_.classList.add(this.CssClasses_.RIPPLE_CENTER),this.boundRippleMouseUp=this.onMouseUp_.bind(this),this.rippleContainerElement_.addEventListener("mouseup",this.boundRippleMouseUp);var i=document.createElement("span");i.classList.add(this.CssClasses_.RIPPLE),this.rippleContainerElement_.appendChild(i),this.element_.appendChild(this.rippleContainerElement_)}this.boundInputOnChange=this.onChange_.bind(this),this.boundInputOnFocus=this.onFocus_.bind(this),this.boundInputOnBlur=this.onBlur_.bind(this),this.boundElementMouseUp=this.onMouseUp_.bind(this),this.inputElement_.addEventListener("change",this.boundInputOnChange),this.inputElement_.addEventListener("focus",this.boundInputOnFocus),this.inputElement_.addEventListener("blur",this.boundInputOnBlur),this.element_.addEventListener("mouseup",this.boundElementMouseUp),this.updateClasses_(),this.element_.classList.add(this.CssClasses_.IS_UPGRADED)}},s.register({constructor:r,classAsString:"MaterialCheckbox",cssClass:"mdl-js-checkbox",widget:!0});var _=function(e){this.element_=e,this.init()};window.MaterialIconToggle=_,_.prototype.Constant_={TINY_TIMEOUT:.001},_.prototype.CssClasses_={INPUT:"mdl-icon-toggle__input",JS_RIPPLE_EFFECT:"mdl-js-ripple-effect",RIPPLE_IGNORE_EVENTS:"mdl-js-ripple-effect--ignore-events",RIPPLE_CONTAINER:"mdl-icon-toggle__ripple-container",RIPPLE_CENTER:"mdl-ripple--center",RIPPLE:"mdl-ripple",IS_FOCUSED:"is-focused",IS_DISABLED:"is-disabled",IS_CHECKED:"is-checked"},_.prototype.onChange_=function(e){this.updateClasses_()},_.prototype.onFocus_=function(e){this.element_.classList.add(this.CssClasses_.IS_FOCUSED)},_.prototype.onBlur_=function(e){this.element_.classList.remove(this.CssClasses_.IS_FOCUSED)},_.prototype.onMouseUp_=function(e){this.blur_()},_.prototype.updateClasses_=function(){this.checkDisabled(),this.checkToggleState()},_.prototype.blur_=function(){window.setTimeout(function(){this.inputElement_.blur()}.bind(this),this.Constant_.TINY_TIMEOUT)},_.prototype.checkToggleState=function(){this.inputElement_.checked?this.element_.classList.add(this.CssClasses_.IS_CHECKED):this.element_.classList.remove(this.CssClasses_.IS_CHECKED)},_.prototype.checkToggleState=_.prototype.checkToggleState,_.prototype.checkDisabled=function(){this.inputElement_.disabled?this.element_.classList.add(this.CssClasses_.IS_DISABLED):this.element_.classList.remove(this.CssClasses_.IS_DISABLED)},_.prototype.checkDisabled=_.prototype.checkDisabled,_.prototype.disable=function(){this.inputElement_.disabled=!0,this.updateClasses_()},_.prototype.disable=_.prototype.disable,_.prototype.enable=function(){this.inputElement_.disabled=!1,this.updateClasses_()},_.prototype.enable=_.prototype.enable,_.prototype.check=function(){this.inputElement_.checked=!0,this.updateClasses_()},_.prototype.check=_.prototype.check,_.prototype.uncheck=function(){this.inputElement_.checked=!1,this.updateClasses_()},_.prototype.uncheck=_.prototype.uncheck,_.prototype.init=function(){if(this.element_){if(this.inputElement_=this.element_.querySelector("."+this.CssClasses_.INPUT),this.element_.classList.contains(this.CssClasses_.JS_RIPPLE_EFFECT)){this.element_.classList.add(this.CssClasses_.RIPPLE_IGNORE_EVENTS),this.rippleContainerElement_=document.createElement("span"),this.rippleContainerElement_.classList.add(this.CssClasses_.RIPPLE_CONTAINER),this.rippleContainerElement_.classList.add(this.CssClasses_.JS_RIPPLE_EFFECT),this.rippleContainerElement_.classList.add(this.CssClasses_.RIPPLE_CENTER),this.boundRippleMouseUp=this.onMouseUp_.bind(this),this.rippleContainerElement_.addEventListener("mouseup",this.boundRippleMouseUp);var e=document.createElement("span");e.classList.add(this.CssClasses_.RIPPLE),this.rippleContainerElement_.appendChild(e),this.element_.appendChild(this.rippleContainerElement_)}this.boundInputOnChange=this.onChange_.bind(this),this.boundInputOnFocus=this.onFocus_.bind(this),this.boundInputOnBlur=this.onBlur_.bind(this),this.boundElementOnMouseUp=this.onMouseUp_.bind(this),this.inputElement_.addEventListener("change",this.boundInputOnChange),this.inputElement_.addEventListener("focus",this.boundInputOnFocus),this.inputElement_.addEventListener("blur",this.boundInputOnBlur),this.element_.addEventListener("mouseup",this.boundElementOnMouseUp),this.updateClasses_(),this.element_.classList.add("is-upgraded")}},s.register({constructor:_,classAsString:"MaterialIconToggle",cssClass:"mdl-js-icon-toggle",widget:!0});var d=function(e){this.element_=e,this.init()};window.MaterialMenu=d,d.prototype.Constant_={TRANSITION_DURATION_SECONDS:.3,TRANSITION_DURATION_FRACTION:.8,CLOSE_TIMEOUT:150},d.prototype.Keycodes_={ENTER:13,ESCAPE:27,SPACE:32,UP_ARROW:38,DOWN_ARROW:40},d.prototype.CssClasses_={CONTAINER:"mdl-menu__container",OUTLINE:"mdl-menu__outline",ITEM:"mdl-menu__item",ITEM_RIPPLE_CONTAINER:"mdl-menu__item-ripple-container",RIPPLE_EFFECT:"mdl-js-ripple-effect",RIPPLE_IGNORE_EVENTS:"mdl-js-ripple-effect--ignore-events",RIPPLE:"mdl-ripple",IS_UPGRADED:"is-upgraded",IS_VISIBLE:"is-visible",IS_ANIMATING:"is-animating",BOTTOM_LEFT:"mdl-menu--bottom-left",BOTTOM_RIGHT:"mdl-menu--bottom-right",TOP_LEFT:"mdl-menu--top-left",TOP_RIGHT:"mdl-menu--top-right",UNALIGNED:"mdl-menu--unaligned"},d.prototype.init=function(){if(this.element_){var e=document.createElement("div");e.classList.add(this.CssClasses_.CONTAINER),this.element_.parentElement.insertBefore(e,this.element_),this.element_.parentElement.removeChild(this.element_),e.appendChild(this.element_),this.container_=e;var t=document.createElement("div");t.classList.add(this.CssClasses_.OUTLINE),this.outline_=t,e.insertBefore(t,this.element_);var s=this.element_.getAttribute("for")||this.element_.getAttribute("data-mdl-for"),i=null;s&&(i=document.getElementById(s),i&&(this.forElement_=i,i.addEventListener("click",this.handleForClick_.bind(this)),i.addEventListener("keydown",this.handleForKeyboardEvent_.bind(this))));var n=this.element_.querySelectorAll("."+this.CssClasses_.ITEM);this.boundItemKeydown_=this.handleItemKeyboardEvent_.bind(this),this.boundItemClick_=this.handleItemClick_.bind(this);for(var a=0;a<n.length;a++)n[a].addEventListener("click",this.boundItemClick_),n[a].tabIndex="-1",n[a].addEventListener("keydown",this.boundItemKeydown_);if(this.element_.classList.contains(this.CssClasses_.RIPPLE_EFFECT))for(this.element_.classList.add(this.CssClasses_.RIPPLE_IGNORE_EVENTS),a=0;a<n.length;a++){var l=n[a],o=document.createElement("span");o.classList.add(this.CssClasses_.ITEM_RIPPLE_CONTAINER);var r=document.createElement("span");r.classList.add(this.CssClasses_.RIPPLE),o.appendChild(r),l.appendChild(o),l.classList.add(this.CssClasses_.RIPPLE_EFFECT)}this.element_.classList.contains(this.CssClasses_.BOTTOM_LEFT)&&this.outline_.classList.add(this.CssClasses_.BOTTOM_LEFT),this.element_.classList.contains(this.CssClasses_.BOTTOM_RIGHT)&&this.outline_.classList.add(this.CssClasses_.BOTTOM_RIGHT),this.element_.classList.contains(this.CssClasses_.TOP_LEFT)&&this.outline_.classList.add(this.CssClasses_.TOP_LEFT),this.element_.classList.contains(this.CssClasses_.TOP_RIGHT)&&this.outline_.classList.add(this.CssClasses_.TOP_RIGHT),this.element_.classList.contains(this.CssClasses_.UNALIGNED)&&this.outline_.classList.add(this.CssClasses_.UNALIGNED),e.classList.add(this.CssClasses_.IS_UPGRADED)}},d.prototype.handleForClick_=function(e){if(this.element_&&this.forElement_){var t=this.forElement_.getBoundingClientRect(),s=this.forElement_.parentElement.getBoundingClientRect();this.element_.classList.contains(this.CssClasses_.UNALIGNED)||(this.element_.classList.contains(this.CssClasses_.BOTTOM_RIGHT)?(this.container_.style.right=s.right-t.right+"px",this.container_.style.top=this.forElement_.offsetTop+this.forElement_.offsetHeight+"px"):this.element_.classList.contains(this.CssClasses_.TOP_LEFT)?(this.container_.style.left=this.forElement_.offsetLeft+"px",this.container_.style.bottom=s.bottom-t.top+"px"):this.element_.classList.contains(this.CssClasses_.TOP_RIGHT)?(this.container_.style.right=s.right-t.right+"px",this.container_.style.bottom=s.bottom-t.top+"px"):(this.container_.style.left=this.forElement_.offsetLeft+"px",this.container_.style.top=this.forElement_.offsetTop+this.forElement_.offsetHeight+"px"))}this.toggle(e)},d.prototype.handleForKeyboardEvent_=function(e){if(this.element_&&this.container_&&this.forElement_){var t=this.element_.querySelectorAll("."+this.CssClasses_.ITEM+":not([disabled])");t&&t.length>0&&this.container_.classList.contains(this.CssClasses_.IS_VISIBLE)&&(e.keyCode===this.Keycodes_.UP_ARROW?(e.preventDefault(),t[t.length-1].focus()):e.keyCode===this.Keycodes_.DOWN_ARROW&&(e.preventDefault(),t[0].focus()))}},d.prototype.handleItemKeyboardEvent_=function(e){if(this.element_&&this.container_){var t=this.element_.querySelectorAll("."+this.CssClasses_.ITEM+":not([disabled])");if(t&&t.length>0&&this.container_.classList.contains(this.CssClasses_.IS_VISIBLE)){var s=Array.prototype.slice.call(t).indexOf(e.target);if(e.keyCode===this.Keycodes_.UP_ARROW)e.preventDefault(),s>0?t[s-1].focus():t[t.length-1].focus();else if(e.keyCode===this.Keycodes_.DOWN_ARROW)e.preventDefault(),t.length>s+1?t[s+1].focus():t[0].focus();else if(e.keyCode===this.Keycodes_.SPACE||e.keyCode===this.Keycodes_.ENTER){e.preventDefault();var i=new MouseEvent("mousedown");e.target.dispatchEvent(i),i=new MouseEvent("mouseup"),e.target.dispatchEvent(i),e.target.click()}else e.keyCode===this.Keycodes_.ESCAPE&&(e.preventDefault(),this.hide())}}},d.prototype.handleItemClick_=function(e){e.target.hasAttribute("disabled")?e.stopPropagation():(this.closing_=!0,window.setTimeout(function(e){this.hide(),this.closing_=!1}.bind(this),this.Constant_.CLOSE_TIMEOUT))},d.prototype.applyClip_=function(e,t){this.element_.classList.contains(this.CssClasses_.UNALIGNED)?this.element_.style.clip="":this.element_.classList.contains(this.CssClasses_.BOTTOM_RIGHT)?this.element_.style.clip="rect(0 "+t+"px 0 "+t+"px)":this.element_.classList.contains(this.CssClasses_.TOP_LEFT)?this.element_.style.clip="rect("+e+"px 0 "+e+"px 0)":this.element_.classList.contains(this.CssClasses_.TOP_RIGHT)?this.element_.style.clip="rect("+e+"px "+t+"px "+e+"px "+t+"px)":this.element_.style.clip=""},d.prototype.removeAnimationEndListener_=function(e){e.target.classList.remove(d.prototype.CssClasses_.IS_ANIMATING)},d.prototype.addAnimationEndListener_=function(){this.element_.addEventListener("transitionend",this.removeAnimationEndListener_),this.element_.addEventListener("webkitTransitionEnd",this.removeAnimationEndListener_)},d.prototype.show=function(e){if(this.element_&&this.container_&&this.outline_){var t=this.element_.getBoundingClientRect().height,s=this.element_.getBoundingClientRect().width;this.container_.style.width=s+"px",this.container_.style.height=t+"px",this.outline_.style.width=s+"px",this.outline_.style.height=t+"px";for(var i=this.Constant_.TRANSITION_DURATION_SECONDS*this.Constant_.TRANSITION_DURATION_FRACTION,n=this.element_.querySelectorAll("."+this.CssClasses_.ITEM),a=0;a<n.length;a++){var l=null;l=this.element_.classList.contains(this.CssClasses_.TOP_LEFT)||this.element_.classList.contains(this.CssClasses_.TOP_RIGHT)?(t-n[a].offsetTop-n[a].offsetHeight)/t*i+"s":n[a].offsetTop/t*i+"s",n[a].style.transitionDelay=l}this.applyClip_(t,s),window.requestAnimationFrame(function(){this.element_.classList.add(this.CssClasses_.IS_ANIMATING),this.element_.style.clip="rect(0 "+s+"px "+t+"px 0)",this.container_.classList.add(this.CssClasses_.IS_VISIBLE)}.bind(this)),this.addAnimationEndListener_();var o=function(t){t===e||this.closing_||t.target.parentNode===this.element_||(document.removeEventListener("click",o),this.hide())}.bind(this);document.addEventListener("click",o)}},d.prototype.show=d.prototype.show,d.prototype.hide=function(){if(this.element_&&this.container_&&this.outline_){for(var e=this.element_.querySelectorAll("."+this.CssClasses_.ITEM),t=0;t<e.length;t++)e[t].style.removeProperty("transition-delay");var s=this.element_.getBoundingClientRect(),i=s.height,n=s.width;this.element_.classList.add(this.CssClasses_.IS_ANIMATING),this.applyClip_(i,n),this.container_.classList.remove(this.CssClasses_.IS_VISIBLE),this.addAnimationEndListener_()}},d.prototype.hide=d.prototype.hide,d.prototype.toggle=function(e){this.container_.classList.contains(this.CssClasses_.IS_VISIBLE)?this.hide():this.show(e)},d.prototype.toggle=d.prototype.toggle,s.register({constructor:d,classAsString:"MaterialMenu",cssClass:"mdl-js-menu",widget:!0});var h=function(e){this.element_=e,this.init()};window.MaterialProgress=h,h.prototype.Constant_={},h.prototype.CssClasses_={INDETERMINATE_CLASS:"mdl-progress__indeterminate"},h.prototype.setProgress=function(e){this.element_.classList.contains(this.CssClasses_.INDETERMINATE_CLASS)||(this.progressbar_.style.width=e+"%")},h.prototype.setProgress=h.prototype.setProgress,h.prototype.setBuffer=function(e){this.bufferbar_.style.width=e+"%",this.auxbar_.style.width=100-e+"%"},h.prototype.setBuffer=h.prototype.setBuffer,h.prototype.init=function(){if(this.element_){var e=document.createElement("div");e.className="progressbar bar bar1",this.element_.appendChild(e),this.progressbar_=e,e=document.createElement("div"),e.className="bufferbar bar bar2",this.element_.appendChild(e),this.bufferbar_=e,e=document.createElement("div"),e.className="auxbar bar bar3",this.element_.appendChild(e),this.auxbar_=e,this.progressbar_.style.width="0%",this.bufferbar_.style.width="100%",this.auxbar_.style.width="0%",this.element_.classList.add("is-upgraded")}},s.register({constructor:h,classAsString:"MaterialProgress",cssClass:"mdl-js-progress",widget:!0});var c=function(e){this.element_=e,this.init()};window.MaterialRadio=c,c.prototype.Constant_={TINY_TIMEOUT:.001},c.prototype.CssClasses_={IS_FOCUSED:"is-focused",IS_DISABLED:"is-disabled",IS_CHECKED:"is-checked",IS_UPGRADED:"is-upgraded",JS_RADIO:"mdl-js-radio",RADIO_BTN:"mdl-radio__button",RADIO_OUTER_CIRCLE:"mdl-radio__outer-circle",RADIO_INNER_CIRCLE:"mdl-radio__inner-circle",RIPPLE_EFFECT:"mdl-js-ripple-effect",RIPPLE_IGNORE_EVENTS:"mdl-js-ripple-effect--ignore-events",RIPPLE_CONTAINER:"mdl-radio__ripple-container",RIPPLE_CENTER:"mdl-ripple--center",RIPPLE:"mdl-ripple"},c.prototype.onChange_=function(e){for(var t=document.getElementsByClassName(this.CssClasses_.JS_RADIO),s=0;s<t.length;s++){var i=t[s].querySelector("."+this.CssClasses_.RADIO_BTN);i.getAttribute("name")===this.btnElement_.getAttribute("name")&&"undefined"!=typeof t[s].MaterialRadio&&t[s].MaterialRadio.updateClasses_()}},c.prototype.onFocus_=function(e){this.element_.classList.add(this.CssClasses_.IS_FOCUSED)},c.prototype.onBlur_=function(e){this.element_.classList.remove(this.CssClasses_.IS_FOCUSED)},c.prototype.onMouseup_=function(e){this.blur_()},c.prototype.updateClasses_=function(){this.checkDisabled(),this.checkToggleState()},c.prototype.blur_=function(){window.setTimeout(function(){this.btnElement_.blur()}.bind(this),this.Constant_.TINY_TIMEOUT)},c.prototype.checkDisabled=function(){this.btnElement_.disabled?this.element_.classList.add(this.CssClasses_.IS_DISABLED):this.element_.classList.remove(this.CssClasses_.IS_DISABLED)},c.prototype.checkDisabled=c.prototype.checkDisabled,c.prototype.checkToggleState=function(){this.btnElement_.checked?this.element_.classList.add(this.CssClasses_.IS_CHECKED):this.element_.classList.remove(this.CssClasses_.IS_CHECKED)},c.prototype.checkToggleState=c.prototype.checkToggleState,c.prototype.disable=function(){this.btnElement_.disabled=!0,this.updateClasses_()},c.prototype.disable=c.prototype.disable,c.prototype.enable=function(){this.btnElement_.disabled=!1,this.updateClasses_()},c.prototype.enable=c.prototype.enable,c.prototype.check=function(){this.btnElement_.checked=!0,this.onChange_(null)},c.prototype.check=c.prototype.check,c.prototype.uncheck=function(){this.btnElement_.checked=!1,this.onChange_(null)},c.prototype.uncheck=c.prototype.uncheck,c.prototype.init=function(){if(this.element_){this.btnElement_=this.element_.querySelector("."+this.CssClasses_.RADIO_BTN),this.boundChangeHandler_=this.onChange_.bind(this),this.boundFocusHandler_=this.onChange_.bind(this),this.boundBlurHandler_=this.onBlur_.bind(this),this.boundMouseUpHandler_=this.onMouseup_.bind(this);var e=document.createElement("span");e.classList.add(this.CssClasses_.RADIO_OUTER_CIRCLE);var t=document.createElement("span");t.classList.add(this.CssClasses_.RADIO_INNER_CIRCLE),this.element_.appendChild(e),this.element_.appendChild(t);var s;if(this.element_.classList.contains(this.CssClasses_.RIPPLE_EFFECT)){this.element_.classList.add(this.CssClasses_.RIPPLE_IGNORE_EVENTS),s=document.createElement("span"),s.classList.add(this.CssClasses_.RIPPLE_CONTAINER),s.classList.add(this.CssClasses_.RIPPLE_EFFECT),s.classList.add(this.CssClasses_.RIPPLE_CENTER),s.addEventListener("mouseup",this.boundMouseUpHandler_);var i=document.createElement("span");i.classList.add(this.CssClasses_.RIPPLE),s.appendChild(i),this.element_.appendChild(s)}this.btnElement_.addEventListener("change",this.boundChangeHandler_),this.btnElement_.addEventListener("focus",this.boundFocusHandler_),this.btnElement_.addEventListener("blur",this.boundBlurHandler_),this.element_.addEventListener("mouseup",this.boundMouseUpHandler_),this.updateClasses_(),this.element_.classList.add(this.CssClasses_.IS_UPGRADED)}},s.register({constructor:c,classAsString:"MaterialRadio",cssClass:"mdl-js-radio",widget:!0});var p=function(e){this.element_=e,this.isIE_=window.navigator.msPointerEnabled,this.init()};window.MaterialSlider=p,p.prototype.Constant_={},p.prototype.CssClasses_={IE_CONTAINER:"mdl-slider__ie-container",SLIDER_CONTAINER:"mdl-slider__container",BACKGROUND_FLEX:"mdl-slider__background-flex",BACKGROUND_LOWER:"mdl-slider__background-lower",BACKGROUND_UPPER:"mdl-slider__background-upper",IS_LOWEST_VALUE:"is-lowest-value",IS_UPGRADED:"is-upgraded"},p.prototype.onInput_=function(e){this.updateValueStyles_()},p.prototype.onChange_=function(e){this.updateValueStyles_()},p.prototype.onMouseUp_=function(e){e.target.blur()},p.prototype.onContainerMouseDown_=function(e){if(e.target===this.element_.parentElement){e.preventDefault();var t=new MouseEvent("mousedown",{target:e.target,buttons:e.buttons,clientX:e.clientX,clientY:this.element_.getBoundingClientRect().y});this.element_.dispatchEvent(t)}},p.prototype.updateValueStyles_=function(){var e=(this.element_.value-this.element_.min)/(this.element_.max-this.element_.min);0===e?this.element_.classList.add(this.CssClasses_.IS_LOWEST_VALUE):this.element_.classList.remove(this.CssClasses_.IS_LOWEST_VALUE),this.isIE_||(this.backgroundLower_.style.flex=e,this.backgroundLower_.style.webkitFlex=e,this.backgroundUpper_.style.flex=1-e,this.backgroundUpper_.style.webkitFlex=1-e)},p.prototype.disable=function(){this.element_.disabled=!0},p.prototype.disable=p.prototype.disable,p.prototype.enable=function(){this.element_.disabled=!1},p.prototype.enable=p.prototype.enable,p.prototype.change=function(e){"undefined"!=typeof e&&(this.element_.value=e),this.updateValueStyles_()},p.prototype.change=p.prototype.change,p.prototype.init=function(){if(this.element_){if(this.isIE_){var e=document.createElement("div");e.classList.add(this.CssClasses_.IE_CONTAINER),this.element_.parentElement.insertBefore(e,this.element_),this.element_.parentElement.removeChild(this.element_),e.appendChild(this.element_)}else{var t=document.createElement("div");t.classList.add(this.CssClasses_.SLIDER_CONTAINER),this.element_.parentElement.insertBefore(t,this.element_),this.element_.parentElement.removeChild(this.element_),t.appendChild(this.element_);var s=document.createElement("div");s.classList.add(this.CssClasses_.BACKGROUND_FLEX),t.appendChild(s),this.backgroundLower_=document.createElement("div"),this.backgroundLower_.classList.add(this.CssClasses_.BACKGROUND_LOWER),s.appendChild(this.backgroundLower_),this.backgroundUpper_=document.createElement("div"),this.backgroundUpper_.classList.add(this.CssClasses_.BACKGROUND_UPPER),s.appendChild(this.backgroundUpper_)}this.boundInputHandler=this.onInput_.bind(this),this.boundChangeHandler=this.onChange_.bind(this),this.boundMouseUpHandler=this.onMouseUp_.bind(this),this.boundContainerMouseDownHandler=this.onContainerMouseDown_.bind(this),this.element_.addEventListener("input",this.boundInputHandler),this.element_.addEventListener("change",this.boundChangeHandler),this.element_.addEventListener("mouseup",this.boundMouseUpHandler),this.element_.parentElement.addEventListener("mousedown",this.boundContainerMouseDownHandler),this.updateValueStyles_(),this.element_.classList.add(this.CssClasses_.IS_UPGRADED)}},s.register({constructor:p,classAsString:"MaterialSlider",cssClass:"mdl-js-slider",widget:!0});var C=function(e){if(this.element_=e,this.textElement_=this.element_.querySelector("."+this.cssClasses_.MESSAGE),this.actionElement_=this.element_.querySelector("."+this.cssClasses_.ACTION),!this.textElement_)throw new Error("There must be a message element for a snackbar.");if(!this.actionElement_)throw new Error("There must be an action element for a snackbar.");this.active=!1,this.actionHandler_=void 0,this.message_=void 0,this.actionText_=void 0,this.queuedNotifications_=[],this.setActionHidden_(!0)};window.MaterialSnackbar=C,C.prototype.Constant_={ANIMATION_LENGTH:250},C.prototype.cssClasses_={SNACKBAR:"mdl-snackbar",MESSAGE:"mdl-snackbar__text",ACTION:"mdl-snackbar__action",ACTIVE:"mdl-snackbar--active"},C.prototype.displaySnackbar_=function(){this.element_.setAttribute("aria-hidden","true"),
|
||
this.actionHandler_&&(this.actionElement_.textContent=this.actionText_,this.actionElement_.addEventListener("click",this.actionHandler_),this.setActionHidden_(!1)),this.textElement_.textContent=this.message_,this.element_.classList.add(this.cssClasses_.ACTIVE),this.element_.setAttribute("aria-hidden","false"),setTimeout(this.cleanup_.bind(this),this.timeout_)},C.prototype.showSnackbar=function(e){if(void 0===e)throw new Error("Please provide a data object with at least a message to display.");if(void 0===e.message)throw new Error("Please provide a message to be displayed.");if(e.actionHandler&&!e.actionText)throw new Error("Please provide action text with the handler.");this.active?this.queuedNotifications_.push(e):(this.active=!0,this.message_=e.message,e.timeout?this.timeout_=e.timeout:this.timeout_=2750,e.actionHandler&&(this.actionHandler_=e.actionHandler),e.actionText&&(this.actionText_=e.actionText),this.displaySnackbar_())},C.prototype.showSnackbar=C.prototype.showSnackbar,C.prototype.checkQueue_=function(){this.queuedNotifications_.length>0&&this.showSnackbar(this.queuedNotifications_.shift())},C.prototype.cleanup_=function(){this.element_.classList.remove(this.cssClasses_.ACTIVE),setTimeout(function(){this.element_.setAttribute("aria-hidden","true"),this.textElement_.textContent="",Boolean(this.actionElement_.getAttribute("aria-hidden"))||(this.setActionHidden_(!0),this.actionElement_.textContent="",this.actionElement_.removeEventListener("click",this.actionHandler_)),this.actionHandler_=void 0,this.message_=void 0,this.actionText_=void 0,this.active=!1,this.checkQueue_()}.bind(this),this.Constant_.ANIMATION_LENGTH)},C.prototype.setActionHidden_=function(e){e?this.actionElement_.setAttribute("aria-hidden","true"):this.actionElement_.removeAttribute("aria-hidden")},s.register({constructor:C,classAsString:"MaterialSnackbar",cssClass:"mdl-js-snackbar",widget:!0});var u=function(e){this.element_=e,this.init()};window.MaterialSpinner=u,u.prototype.Constant_={MDL_SPINNER_LAYER_COUNT:4},u.prototype.CssClasses_={MDL_SPINNER_LAYER:"mdl-spinner__layer",MDL_SPINNER_CIRCLE_CLIPPER:"mdl-spinner__circle-clipper",MDL_SPINNER_CIRCLE:"mdl-spinner__circle",MDL_SPINNER_GAP_PATCH:"mdl-spinner__gap-patch",MDL_SPINNER_LEFT:"mdl-spinner__left",MDL_SPINNER_RIGHT:"mdl-spinner__right"},u.prototype.createLayer=function(e){var t=document.createElement("div");t.classList.add(this.CssClasses_.MDL_SPINNER_LAYER),t.classList.add(this.CssClasses_.MDL_SPINNER_LAYER+"-"+e);var s=document.createElement("div");s.classList.add(this.CssClasses_.MDL_SPINNER_CIRCLE_CLIPPER),s.classList.add(this.CssClasses_.MDL_SPINNER_LEFT);var i=document.createElement("div");i.classList.add(this.CssClasses_.MDL_SPINNER_GAP_PATCH);var n=document.createElement("div");n.classList.add(this.CssClasses_.MDL_SPINNER_CIRCLE_CLIPPER),n.classList.add(this.CssClasses_.MDL_SPINNER_RIGHT);for(var a=[s,i,n],l=0;l<a.length;l++){var o=document.createElement("div");o.classList.add(this.CssClasses_.MDL_SPINNER_CIRCLE),a[l].appendChild(o)}t.appendChild(s),t.appendChild(i),t.appendChild(n),this.element_.appendChild(t)},u.prototype.createLayer=u.prototype.createLayer,u.prototype.stop=function(){this.element_.classList.remove("is-active")},u.prototype.stop=u.prototype.stop,u.prototype.start=function(){this.element_.classList.add("is-active")},u.prototype.start=u.prototype.start,u.prototype.init=function(){if(this.element_){for(var e=1;e<=this.Constant_.MDL_SPINNER_LAYER_COUNT;e++)this.createLayer(e);this.element_.classList.add("is-upgraded")}},s.register({constructor:u,classAsString:"MaterialSpinner",cssClass:"mdl-js-spinner",widget:!0});var E=function(e){this.element_=e,this.init()};window.MaterialSwitch=E,E.prototype.Constant_={TINY_TIMEOUT:.001},E.prototype.CssClasses_={INPUT:"mdl-switch__input",TRACK:"mdl-switch__track",THUMB:"mdl-switch__thumb",FOCUS_HELPER:"mdl-switch__focus-helper",RIPPLE_EFFECT:"mdl-js-ripple-effect",RIPPLE_IGNORE_EVENTS:"mdl-js-ripple-effect--ignore-events",RIPPLE_CONTAINER:"mdl-switch__ripple-container",RIPPLE_CENTER:"mdl-ripple--center",RIPPLE:"mdl-ripple",IS_FOCUSED:"is-focused",IS_DISABLED:"is-disabled",IS_CHECKED:"is-checked"},E.prototype.onChange_=function(e){this.updateClasses_()},E.prototype.onFocus_=function(e){this.element_.classList.add(this.CssClasses_.IS_FOCUSED)},E.prototype.onBlur_=function(e){this.element_.classList.remove(this.CssClasses_.IS_FOCUSED)},E.prototype.onMouseUp_=function(e){this.blur_()},E.prototype.updateClasses_=function(){this.checkDisabled(),this.checkToggleState()},E.prototype.blur_=function(){window.setTimeout(function(){this.inputElement_.blur()}.bind(this),this.Constant_.TINY_TIMEOUT)},E.prototype.checkDisabled=function(){this.inputElement_.disabled?this.element_.classList.add(this.CssClasses_.IS_DISABLED):this.element_.classList.remove(this.CssClasses_.IS_DISABLED)},E.prototype.checkDisabled=E.prototype.checkDisabled,E.prototype.checkToggleState=function(){this.inputElement_.checked?this.element_.classList.add(this.CssClasses_.IS_CHECKED):this.element_.classList.remove(this.CssClasses_.IS_CHECKED)},E.prototype.checkToggleState=E.prototype.checkToggleState,E.prototype.disable=function(){this.inputElement_.disabled=!0,this.updateClasses_()},E.prototype.disable=E.prototype.disable,E.prototype.enable=function(){this.inputElement_.disabled=!1,this.updateClasses_()},E.prototype.enable=E.prototype.enable,E.prototype.on=function(){this.inputElement_.checked=!0,this.updateClasses_()},E.prototype.on=E.prototype.on,E.prototype.off=function(){this.inputElement_.checked=!1,this.updateClasses_()},E.prototype.off=E.prototype.off,E.prototype.init=function(){if(this.element_){this.inputElement_=this.element_.querySelector("."+this.CssClasses_.INPUT);var e=document.createElement("div");e.classList.add(this.CssClasses_.TRACK);var t=document.createElement("div");t.classList.add(this.CssClasses_.THUMB);var s=document.createElement("span");if(s.classList.add(this.CssClasses_.FOCUS_HELPER),t.appendChild(s),this.element_.appendChild(e),this.element_.appendChild(t),this.boundMouseUpHandler=this.onMouseUp_.bind(this),this.element_.classList.contains(this.CssClasses_.RIPPLE_EFFECT)){this.element_.classList.add(this.CssClasses_.RIPPLE_IGNORE_EVENTS),this.rippleContainerElement_=document.createElement("span"),this.rippleContainerElement_.classList.add(this.CssClasses_.RIPPLE_CONTAINER),this.rippleContainerElement_.classList.add(this.CssClasses_.RIPPLE_EFFECT),this.rippleContainerElement_.classList.add(this.CssClasses_.RIPPLE_CENTER),this.rippleContainerElement_.addEventListener("mouseup",this.boundMouseUpHandler);var i=document.createElement("span");i.classList.add(this.CssClasses_.RIPPLE),this.rippleContainerElement_.appendChild(i),this.element_.appendChild(this.rippleContainerElement_)}this.boundChangeHandler=this.onChange_.bind(this),this.boundFocusHandler=this.onFocus_.bind(this),this.boundBlurHandler=this.onBlur_.bind(this),this.inputElement_.addEventListener("change",this.boundChangeHandler),this.inputElement_.addEventListener("focus",this.boundFocusHandler),this.inputElement_.addEventListener("blur",this.boundBlurHandler),this.element_.addEventListener("mouseup",this.boundMouseUpHandler),this.updateClasses_(),this.element_.classList.add("is-upgraded")}},s.register({constructor:E,classAsString:"MaterialSwitch",cssClass:"mdl-js-switch",widget:!0});var m=function(e){this.element_=e,this.init()};window.MaterialTabs=m,m.prototype.Constant_={},m.prototype.CssClasses_={TAB_CLASS:"mdl-tabs__tab",PANEL_CLASS:"mdl-tabs__panel",ACTIVE_CLASS:"is-active",UPGRADED_CLASS:"is-upgraded",MDL_JS_RIPPLE_EFFECT:"mdl-js-ripple-effect",MDL_RIPPLE_CONTAINER:"mdl-tabs__ripple-container",MDL_RIPPLE:"mdl-ripple",MDL_JS_RIPPLE_EFFECT_IGNORE_EVENTS:"mdl-js-ripple-effect--ignore-events"},m.prototype.initTabs_=function(){this.element_.classList.contains(this.CssClasses_.MDL_JS_RIPPLE_EFFECT)&&this.element_.classList.add(this.CssClasses_.MDL_JS_RIPPLE_EFFECT_IGNORE_EVENTS),this.tabs_=this.element_.querySelectorAll("."+this.CssClasses_.TAB_CLASS),this.panels_=this.element_.querySelectorAll("."+this.CssClasses_.PANEL_CLASS);for(var t=0;t<this.tabs_.length;t++)new e(this.tabs_[t],this);this.element_.classList.add(this.CssClasses_.UPGRADED_CLASS)},m.prototype.resetTabState_=function(){for(var e=0;e<this.tabs_.length;e++)this.tabs_[e].classList.remove(this.CssClasses_.ACTIVE_CLASS)},m.prototype.resetPanelState_=function(){for(var e=0;e<this.panels_.length;e++)this.panels_[e].classList.remove(this.CssClasses_.ACTIVE_CLASS)},m.prototype.init=function(){this.element_&&this.initTabs_()},s.register({constructor:m,classAsString:"MaterialTabs",cssClass:"mdl-js-tabs"});var L=function(e){this.element_=e,this.maxRows=this.Constant_.NO_MAX_ROWS,this.init()};window.MaterialTextfield=L,L.prototype.Constant_={NO_MAX_ROWS:-1,MAX_ROWS_ATTRIBUTE:"maxrows"},L.prototype.CssClasses_={LABEL:"mdl-textfield__label",INPUT:"mdl-textfield__input",IS_DIRTY:"is-dirty",IS_FOCUSED:"is-focused",IS_DISABLED:"is-disabled",IS_INVALID:"is-invalid",IS_UPGRADED:"is-upgraded",HAS_PLACEHOLDER:"has-placeholder"},L.prototype.onKeyDown_=function(e){var t=e.target.value.split("\n").length;13===e.keyCode&&t>=this.maxRows&&e.preventDefault()},L.prototype.onFocus_=function(e){this.element_.classList.add(this.CssClasses_.IS_FOCUSED)},L.prototype.onBlur_=function(e){this.element_.classList.remove(this.CssClasses_.IS_FOCUSED)},L.prototype.onReset_=function(e){this.updateClasses_()},L.prototype.updateClasses_=function(){this.checkDisabled(),this.checkValidity(),this.checkDirty(),this.checkFocus()},L.prototype.checkDisabled=function(){this.input_.disabled?this.element_.classList.add(this.CssClasses_.IS_DISABLED):this.element_.classList.remove(this.CssClasses_.IS_DISABLED)},L.prototype.checkDisabled=L.prototype.checkDisabled,L.prototype.checkFocus=function(){Boolean(this.element_.querySelector(":focus"))?this.element_.classList.add(this.CssClasses_.IS_FOCUSED):this.element_.classList.remove(this.CssClasses_.IS_FOCUSED)},L.prototype.checkFocus=L.prototype.checkFocus,L.prototype.checkValidity=function(){this.input_.validity&&(this.input_.validity.valid?this.element_.classList.remove(this.CssClasses_.IS_INVALID):this.element_.classList.add(this.CssClasses_.IS_INVALID))},L.prototype.checkValidity=L.prototype.checkValidity,L.prototype.checkDirty=function(){this.input_.value&&this.input_.value.length>0?this.element_.classList.add(this.CssClasses_.IS_DIRTY):this.element_.classList.remove(this.CssClasses_.IS_DIRTY)},L.prototype.checkDirty=L.prototype.checkDirty,L.prototype.disable=function(){this.input_.disabled=!0,this.updateClasses_()},L.prototype.disable=L.prototype.disable,L.prototype.enable=function(){this.input_.disabled=!1,this.updateClasses_()},L.prototype.enable=L.prototype.enable,L.prototype.change=function(e){this.input_.value=e||"",this.updateClasses_()},L.prototype.change=L.prototype.change,L.prototype.init=function(){if(this.element_&&(this.label_=this.element_.querySelector("."+this.CssClasses_.LABEL),this.input_=this.element_.querySelector("."+this.CssClasses_.INPUT),this.input_)){this.input_.hasAttribute(this.Constant_.MAX_ROWS_ATTRIBUTE)&&(this.maxRows=parseInt(this.input_.getAttribute(this.Constant_.MAX_ROWS_ATTRIBUTE),10),isNaN(this.maxRows)&&(this.maxRows=this.Constant_.NO_MAX_ROWS)),this.input_.hasAttribute("placeholder")&&this.element_.classList.add(this.CssClasses_.HAS_PLACEHOLDER),this.boundUpdateClassesHandler=this.updateClasses_.bind(this),this.boundFocusHandler=this.onFocus_.bind(this),this.boundBlurHandler=this.onBlur_.bind(this),this.boundResetHandler=this.onReset_.bind(this),this.input_.addEventListener("input",this.boundUpdateClassesHandler),this.input_.addEventListener("focus",this.boundFocusHandler),this.input_.addEventListener("blur",this.boundBlurHandler),this.input_.addEventListener("reset",this.boundResetHandler),this.maxRows!==this.Constant_.NO_MAX_ROWS&&(this.boundKeyDownHandler=this.onKeyDown_.bind(this),this.input_.addEventListener("keydown",this.boundKeyDownHandler));var e=this.element_.classList.contains(this.CssClasses_.IS_INVALID);this.updateClasses_(),this.element_.classList.add(this.CssClasses_.IS_UPGRADED),e&&this.element_.classList.add(this.CssClasses_.IS_INVALID),this.input_.hasAttribute("autofocus")&&(this.element_.focus(),this.checkFocus())}},s.register({constructor:L,classAsString:"MaterialTextfield",cssClass:"mdl-js-textfield",widget:!0});var I=function(e){this.element_=e,this.init()};window.MaterialTooltip=I,I.prototype.Constant_={},I.prototype.CssClasses_={IS_ACTIVE:"is-active",BOTTOM:"mdl-tooltip--bottom",LEFT:"mdl-tooltip--left",RIGHT:"mdl-tooltip--right",TOP:"mdl-tooltip--top"},I.prototype.handleMouseEnter_=function(e){var t=e.target.getBoundingClientRect(),s=t.left+t.width/2,i=t.top+t.height/2,n=-1*(this.element_.offsetWidth/2),a=-1*(this.element_.offsetHeight/2);this.element_.classList.contains(this.CssClasses_.LEFT)||this.element_.classList.contains(this.CssClasses_.RIGHT)?(s=t.width/2,i+a<0?(this.element_.style.top="0",this.element_.style.marginTop="0"):(this.element_.style.top=i+"px",this.element_.style.marginTop=a+"px")):s+n<0?(this.element_.style.left="0",this.element_.style.marginLeft="0"):(this.element_.style.left=s+"px",this.element_.style.marginLeft=n+"px"),this.element_.classList.contains(this.CssClasses_.TOP)?this.element_.style.top=t.top-this.element_.offsetHeight-10+"px":this.element_.classList.contains(this.CssClasses_.RIGHT)?this.element_.style.left=t.left+t.width+10+"px":this.element_.classList.contains(this.CssClasses_.LEFT)?this.element_.style.left=t.left-this.element_.offsetWidth-10+"px":this.element_.style.top=t.top+t.height+10+"px",this.element_.classList.add(this.CssClasses_.IS_ACTIVE)},I.prototype.hideTooltip_=function(){this.element_.classList.remove(this.CssClasses_.IS_ACTIVE)},I.prototype.init=function(){if(this.element_){var e=this.element_.getAttribute("for")||this.element_.getAttribute("data-mdl-for");e&&(this.forElement_=document.getElementById(e)),this.forElement_&&(this.forElement_.hasAttribute("tabindex")||this.forElement_.setAttribute("tabindex","0"),this.boundMouseEnterHandler=this.handleMouseEnter_.bind(this),this.boundMouseLeaveAndScrollHandler=this.hideTooltip_.bind(this),this.forElement_.addEventListener("mouseenter",this.boundMouseEnterHandler,!1),this.forElement_.addEventListener("touchend",this.boundMouseEnterHandler,!1),this.forElement_.addEventListener("mouseleave",this.boundMouseLeaveAndScrollHandler,!1),window.addEventListener("scroll",this.boundMouseLeaveAndScrollHandler,!0),window.addEventListener("touchstart",this.boundMouseLeaveAndScrollHandler))}},s.register({constructor:I,classAsString:"MaterialTooltip",cssClass:"mdl-tooltip"});var f=function(e){this.element_=e,this.init()};window.MaterialLayout=f,f.prototype.Constant_={MAX_WIDTH:"(max-width: 1024px)",TAB_SCROLL_PIXELS:100,RESIZE_TIMEOUT:100,MENU_ICON:"",CHEVRON_LEFT:"chevron_left",CHEVRON_RIGHT:"chevron_right"},f.prototype.Keycodes_={ENTER:13,ESCAPE:27,SPACE:32},f.prototype.Mode_={STANDARD:0,SEAMED:1,WATERFALL:2,SCROLL:3},f.prototype.CssClasses_={CONTAINER:"mdl-layout__container",HEADER:"mdl-layout__header",DRAWER:"mdl-layout__drawer",CONTENT:"mdl-layout__content",DRAWER_BTN:"mdl-layout__drawer-button",ICON:"material-icons",JS_RIPPLE_EFFECT:"mdl-js-ripple-effect",RIPPLE_CONTAINER:"mdl-layout__tab-ripple-container",RIPPLE:"mdl-ripple",RIPPLE_IGNORE_EVENTS:"mdl-js-ripple-effect--ignore-events",HEADER_SEAMED:"mdl-layout__header--seamed",HEADER_WATERFALL:"mdl-layout__header--waterfall",HEADER_SCROLL:"mdl-layout__header--scroll",FIXED_HEADER:"mdl-layout--fixed-header",OBFUSCATOR:"mdl-layout__obfuscator",TAB_BAR:"mdl-layout__tab-bar",TAB_CONTAINER:"mdl-layout__tab-bar-container",TAB:"mdl-layout__tab",TAB_BAR_BUTTON:"mdl-layout__tab-bar-button",TAB_BAR_LEFT_BUTTON:"mdl-layout__tab-bar-left-button",TAB_BAR_RIGHT_BUTTON:"mdl-layout__tab-bar-right-button",TAB_MANUAL_SWITCH:"mdl-layout__tab-manual-switch",PANEL:"mdl-layout__tab-panel",HAS_DRAWER:"has-drawer",HAS_TABS:"has-tabs",HAS_SCROLLING_HEADER:"has-scrolling-header",CASTING_SHADOW:"is-casting-shadow",IS_COMPACT:"is-compact",IS_SMALL_SCREEN:"is-small-screen",IS_DRAWER_OPEN:"is-visible",IS_ACTIVE:"is-active",IS_UPGRADED:"is-upgraded",IS_ANIMATING:"is-animating",ON_LARGE_SCREEN:"mdl-layout--large-screen-only",ON_SMALL_SCREEN:"mdl-layout--small-screen-only"},f.prototype.contentScrollHandler_=function(){if(!this.header_.classList.contains(this.CssClasses_.IS_ANIMATING)){var e=!this.element_.classList.contains(this.CssClasses_.IS_SMALL_SCREEN)||this.element_.classList.contains(this.CssClasses_.FIXED_HEADER);this.content_.scrollTop>0&&!this.header_.classList.contains(this.CssClasses_.IS_COMPACT)?(this.header_.classList.add(this.CssClasses_.CASTING_SHADOW),this.header_.classList.add(this.CssClasses_.IS_COMPACT),e&&this.header_.classList.add(this.CssClasses_.IS_ANIMATING)):this.content_.scrollTop<=0&&this.header_.classList.contains(this.CssClasses_.IS_COMPACT)&&(this.header_.classList.remove(this.CssClasses_.CASTING_SHADOW),this.header_.classList.remove(this.CssClasses_.IS_COMPACT),e&&this.header_.classList.add(this.CssClasses_.IS_ANIMATING))}},f.prototype.keyboardEventHandler_=function(e){e.keyCode===this.Keycodes_.ESCAPE&&this.drawer_.classList.contains(this.CssClasses_.IS_DRAWER_OPEN)&&this.toggleDrawer()},f.prototype.screenSizeHandler_=function(){this.screenSizeMediaQuery_.matches?this.element_.classList.add(this.CssClasses_.IS_SMALL_SCREEN):(this.element_.classList.remove(this.CssClasses_.IS_SMALL_SCREEN),this.drawer_&&(this.drawer_.classList.remove(this.CssClasses_.IS_DRAWER_OPEN),this.obfuscator_.classList.remove(this.CssClasses_.IS_DRAWER_OPEN)))},f.prototype.drawerToggleHandler_=function(e){if(e&&"keydown"===e.type){if(e.keyCode!==this.Keycodes_.SPACE&&e.keyCode!==this.Keycodes_.ENTER)return;e.preventDefault()}this.toggleDrawer()},f.prototype.headerTransitionEndHandler_=function(){this.header_.classList.remove(this.CssClasses_.IS_ANIMATING)},f.prototype.headerClickHandler_=function(){this.header_.classList.contains(this.CssClasses_.IS_COMPACT)&&(this.header_.classList.remove(this.CssClasses_.IS_COMPACT),this.header_.classList.add(this.CssClasses_.IS_ANIMATING))},f.prototype.resetTabState_=function(e){for(var t=0;t<e.length;t++)e[t].classList.remove(this.CssClasses_.IS_ACTIVE)},f.prototype.resetPanelState_=function(e){for(var t=0;t<e.length;t++)e[t].classList.remove(this.CssClasses_.IS_ACTIVE)},f.prototype.toggleDrawer=function(){var e=this.element_.querySelector("."+this.CssClasses_.DRAWER_BTN);this.drawer_.classList.toggle(this.CssClasses_.IS_DRAWER_OPEN),this.obfuscator_.classList.toggle(this.CssClasses_.IS_DRAWER_OPEN),this.drawer_.classList.contains(this.CssClasses_.IS_DRAWER_OPEN)?(this.drawer_.setAttribute("aria-hidden","false"),e.setAttribute("aria-expanded","true")):(this.drawer_.setAttribute("aria-hidden","true"),e.setAttribute("aria-expanded","false"))},f.prototype.toggleDrawer=f.prototype.toggleDrawer,f.prototype.init=function(){if(this.element_){var e=document.createElement("div");e.classList.add(this.CssClasses_.CONTAINER);var s=this.element_.querySelector(":focus");this.element_.parentElement.insertBefore(e,this.element_),this.element_.parentElement.removeChild(this.element_),e.appendChild(this.element_),s&&s.focus();for(var i=this.element_.childNodes,n=i.length,a=0;a<n;a++){var l=i[a];l.classList&&l.classList.contains(this.CssClasses_.HEADER)&&(this.header_=l),l.classList&&l.classList.contains(this.CssClasses_.DRAWER)&&(this.drawer_=l),l.classList&&l.classList.contains(this.CssClasses_.CONTENT)&&(this.content_=l)}window.addEventListener("pageshow",function(e){e.persisted&&(this.element_.style.overflowY="hidden",requestAnimationFrame(function(){this.element_.style.overflowY=""}.bind(this)))}.bind(this),!1),this.header_&&(this.tabBar_=this.header_.querySelector("."+this.CssClasses_.TAB_BAR));var o=this.Mode_.STANDARD;if(this.header_&&(this.header_.classList.contains(this.CssClasses_.HEADER_SEAMED)?o=this.Mode_.SEAMED:this.header_.classList.contains(this.CssClasses_.HEADER_WATERFALL)?(o=this.Mode_.WATERFALL,this.header_.addEventListener("transitionend",this.headerTransitionEndHandler_.bind(this)),this.header_.addEventListener("click",this.headerClickHandler_.bind(this))):this.header_.classList.contains(this.CssClasses_.HEADER_SCROLL)&&(o=this.Mode_.SCROLL,e.classList.add(this.CssClasses_.HAS_SCROLLING_HEADER)),o===this.Mode_.STANDARD?(this.header_.classList.add(this.CssClasses_.CASTING_SHADOW),this.tabBar_&&this.tabBar_.classList.add(this.CssClasses_.CASTING_SHADOW)):o===this.Mode_.SEAMED||o===this.Mode_.SCROLL?(this.header_.classList.remove(this.CssClasses_.CASTING_SHADOW),this.tabBar_&&this.tabBar_.classList.remove(this.CssClasses_.CASTING_SHADOW)):o===this.Mode_.WATERFALL&&(this.content_.addEventListener("scroll",this.contentScrollHandler_.bind(this)),this.contentScrollHandler_())),this.drawer_){var r=this.element_.querySelector("."+this.CssClasses_.DRAWER_BTN);if(!r){r=document.createElement("div"),r.setAttribute("aria-expanded","false"),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.classList.add(this.CssClasses_.DRAWER_BTN);var _=document.createElement("i");_.classList.add(this.CssClasses_.ICON),_.innerHTML=this.Constant_.MENU_ICON,r.appendChild(_)}this.drawer_.classList.contains(this.CssClasses_.ON_LARGE_SCREEN)?r.classList.add(this.CssClasses_.ON_LARGE_SCREEN):this.drawer_.classList.contains(this.CssClasses_.ON_SMALL_SCREEN)&&r.classList.add(this.CssClasses_.ON_SMALL_SCREEN),r.addEventListener("click",this.drawerToggleHandler_.bind(this)),r.addEventListener("keydown",this.drawerToggleHandler_.bind(this)),this.element_.classList.add(this.CssClasses_.HAS_DRAWER),this.element_.classList.contains(this.CssClasses_.FIXED_HEADER)?this.header_.insertBefore(r,this.header_.firstChild):this.element_.insertBefore(r,this.content_);var d=document.createElement("div");d.classList.add(this.CssClasses_.OBFUSCATOR),this.element_.appendChild(d),d.addEventListener("click",this.drawerToggleHandler_.bind(this)),this.obfuscator_=d,this.drawer_.addEventListener("keydown",this.keyboardEventHandler_.bind(this)),this.drawer_.setAttribute("aria-hidden","true")}if(this.screenSizeMediaQuery_=window.matchMedia(this.Constant_.MAX_WIDTH),this.screenSizeMediaQuery_.addListener(this.screenSizeHandler_.bind(this)),this.screenSizeHandler_(),this.header_&&this.tabBar_){this.element_.classList.add(this.CssClasses_.HAS_TABS);var h=document.createElement("div");h.classList.add(this.CssClasses_.TAB_CONTAINER),this.header_.insertBefore(h,this.tabBar_),this.header_.removeChild(this.tabBar_);var c=document.createElement("div");c.classList.add(this.CssClasses_.TAB_BAR_BUTTON),c.classList.add(this.CssClasses_.TAB_BAR_LEFT_BUTTON);var p=document.createElement("i");p.classList.add(this.CssClasses_.ICON),p.textContent=this.Constant_.CHEVRON_LEFT,c.appendChild(p),c.addEventListener("click",function(){this.tabBar_.scrollLeft-=this.Constant_.TAB_SCROLL_PIXELS}.bind(this));var C=document.createElement("div");C.classList.add(this.CssClasses_.TAB_BAR_BUTTON),C.classList.add(this.CssClasses_.TAB_BAR_RIGHT_BUTTON);var u=document.createElement("i");u.classList.add(this.CssClasses_.ICON),u.textContent=this.Constant_.CHEVRON_RIGHT,C.appendChild(u),C.addEventListener("click",function(){this.tabBar_.scrollLeft+=this.Constant_.TAB_SCROLL_PIXELS}.bind(this)),h.appendChild(c),h.appendChild(this.tabBar_),h.appendChild(C);var E=function(){this.tabBar_.scrollLeft>0?c.classList.add(this.CssClasses_.IS_ACTIVE):c.classList.remove(this.CssClasses_.IS_ACTIVE),this.tabBar_.scrollLeft<this.tabBar_.scrollWidth-this.tabBar_.offsetWidth?C.classList.add(this.CssClasses_.IS_ACTIVE):C.classList.remove(this.CssClasses_.IS_ACTIVE)}.bind(this);this.tabBar_.addEventListener("scroll",E),E();var m=function(){this.resizeTimeoutId_&&clearTimeout(this.resizeTimeoutId_),this.resizeTimeoutId_=setTimeout(function(){E(),this.resizeTimeoutId_=null}.bind(this),this.Constant_.RESIZE_TIMEOUT)}.bind(this);window.addEventListener("resize",m),this.tabBar_.classList.contains(this.CssClasses_.JS_RIPPLE_EFFECT)&&this.tabBar_.classList.add(this.CssClasses_.RIPPLE_IGNORE_EVENTS);for(var L=this.tabBar_.querySelectorAll("."+this.CssClasses_.TAB),I=this.content_.querySelectorAll("."+this.CssClasses_.PANEL),f=0;f<L.length;f++)new t(L[f],L,I,this)}this.element_.classList.add(this.CssClasses_.IS_UPGRADED)}},window.MaterialLayoutTab=t,s.register({constructor:f,classAsString:"MaterialLayout",cssClass:"mdl-js-layout"});var b=function(e){this.element_=e,this.init()};window.MaterialDataTable=b,b.prototype.Constant_={},b.prototype.CssClasses_={DATA_TABLE:"mdl-data-table",SELECTABLE:"mdl-data-table--selectable",SELECT_ELEMENT:"mdl-data-table__select",IS_SELECTED:"is-selected",IS_UPGRADED:"is-upgraded"},b.prototype.selectRow_=function(e,t,s){return t?function(){e.checked?t.classList.add(this.CssClasses_.IS_SELECTED):t.classList.remove(this.CssClasses_.IS_SELECTED)}.bind(this):s?function(){var t,i;if(e.checked)for(t=0;t<s.length;t++)i=s[t].querySelector("td").querySelector(".mdl-checkbox"),i.MaterialCheckbox.check(),s[t].classList.add(this.CssClasses_.IS_SELECTED);else for(t=0;t<s.length;t++)i=s[t].querySelector("td").querySelector(".mdl-checkbox"),i.MaterialCheckbox.uncheck(),s[t].classList.remove(this.CssClasses_.IS_SELECTED)}.bind(this):void 0},b.prototype.createCheckbox_=function(e,t){var i=document.createElement("label"),n=["mdl-checkbox","mdl-js-checkbox","mdl-js-ripple-effect",this.CssClasses_.SELECT_ELEMENT];i.className=n.join(" ");var a=document.createElement("input");return a.type="checkbox",a.classList.add("mdl-checkbox__input"),e?(a.checked=e.classList.contains(this.CssClasses_.IS_SELECTED),a.addEventListener("change",this.selectRow_(a,e))):t&&a.addEventListener("change",this.selectRow_(a,null,t)),i.appendChild(a),s.upgradeElement(i,"MaterialCheckbox"),i},b.prototype.init=function(){if(this.element_){var e=this.element_.querySelector("th"),t=Array.prototype.slice.call(this.element_.querySelectorAll("tbody tr")),s=Array.prototype.slice.call(this.element_.querySelectorAll("tfoot tr")),i=t.concat(s);if(this.element_.classList.contains(this.CssClasses_.SELECTABLE)){var n=document.createElement("th"),a=this.createCheckbox_(null,i);n.appendChild(a),e.parentElement.insertBefore(n,e);for(var l=0;l<i.length;l++){var o=i[l].querySelector("td");if(o){var r=document.createElement("td");if("TBODY"===i[l].parentNode.nodeName.toUpperCase()){var _=this.createCheckbox_(i[l]);r.appendChild(_)}i[l].insertBefore(r,o)}}this.element_.classList.add(this.CssClasses_.IS_UPGRADED)}}},s.register({constructor:b,classAsString:"MaterialDataTable",cssClass:"mdl-js-data-table"});var S=function(e){this.element_=e,this.init()};window.MaterialRipple=S,S.prototype.Constant_={INITIAL_SCALE:"scale(0.0001, 0.0001)",INITIAL_SIZE:"1px",INITIAL_OPACITY:"0.4",FINAL_OPACITY:"0",FINAL_SCALE:""},S.prototype.CssClasses_={RIPPLE_CENTER:"mdl-ripple--center",RIPPLE_EFFECT_IGNORE_EVENTS:"mdl-js-ripple-effect--ignore-events",RIPPLE:"mdl-ripple",IS_ANIMATING:"is-animating",IS_VISIBLE:"is-visible"},S.prototype.downHandler_=function(e){if(!this.rippleElement_.style.width&&!this.rippleElement_.style.height){var t=this.element_.getBoundingClientRect();this.boundHeight=t.height,this.boundWidth=t.width,this.rippleSize_=2*Math.sqrt(t.width*t.width+t.height*t.height)+2,this.rippleElement_.style.width=this.rippleSize_+"px",this.rippleElement_.style.height=this.rippleSize_+"px"}if(this.rippleElement_.classList.add(this.CssClasses_.IS_VISIBLE),"mousedown"===e.type&&this.ignoringMouseDown_)this.ignoringMouseDown_=!1;else{"touchstart"===e.type&&(this.ignoringMouseDown_=!0);var s=this.getFrameCount();if(s>0)return;this.setFrameCount(1);var i,n,a=e.currentTarget.getBoundingClientRect();if(0===e.clientX&&0===e.clientY)i=Math.round(a.width/2),n=Math.round(a.height/2);else{var l=void 0!==e.clientX?e.clientX:e.touches[0].clientX,o=void 0!==e.clientY?e.clientY:e.touches[0].clientY;i=Math.round(l-a.left),n=Math.round(o-a.top)}this.setRippleXY(i,n),this.setRippleStyles(!0),window.requestAnimationFrame(this.animFrameHandler.bind(this))}},S.prototype.upHandler_=function(e){e&&2!==e.detail&&window.setTimeout(function(){this.rippleElement_.classList.remove(this.CssClasses_.IS_VISIBLE)}.bind(this),0)},S.prototype.init=function(){if(this.element_){var e=this.element_.classList.contains(this.CssClasses_.RIPPLE_CENTER);this.element_.classList.contains(this.CssClasses_.RIPPLE_EFFECT_IGNORE_EVENTS)||(this.rippleElement_=this.element_.querySelector("."+this.CssClasses_.RIPPLE),this.frameCount_=0,this.rippleSize_=0,this.x_=0,this.y_=0,this.ignoringMouseDown_=!1,this.boundDownHandler=this.downHandler_.bind(this),this.element_.addEventListener("mousedown",this.boundDownHandler),this.element_.addEventListener("touchstart",this.boundDownHandler),this.boundUpHandler=this.upHandler_.bind(this),this.element_.addEventListener("mouseup",this.boundUpHandler),this.element_.addEventListener("mouseleave",this.boundUpHandler),this.element_.addEventListener("touchend",this.boundUpHandler),this.element_.addEventListener("blur",this.boundUpHandler),this.getFrameCount=function(){return this.frameCount_},this.setFrameCount=function(e){this.frameCount_=e},this.getRippleElement=function(){return this.rippleElement_},this.setRippleXY=function(e,t){this.x_=e,this.y_=t},this.setRippleStyles=function(t){if(null!==this.rippleElement_){var s,i,n,a="translate("+this.x_+"px, "+this.y_+"px)";t?(i=this.Constant_.INITIAL_SCALE,n=this.Constant_.INITIAL_SIZE):(i=this.Constant_.FINAL_SCALE,n=this.rippleSize_+"px",e&&(a="translate("+this.boundWidth/2+"px, "+this.boundHeight/2+"px)")),s="translate(-50%, -50%) "+a+i,this.rippleElement_.style.webkitTransform=s,this.rippleElement_.style.msTransform=s,this.rippleElement_.style.transform=s,t?this.rippleElement_.classList.remove(this.CssClasses_.IS_ANIMATING):this.rippleElement_.classList.add(this.CssClasses_.IS_ANIMATING)}},this.animFrameHandler=function(){this.frameCount_-- >0?window.requestAnimationFrame(this.animFrameHandler.bind(this)):this.setRippleStyles(!1)})}},s.register({constructor:S,classAsString:"MaterialRipple",cssClass:"mdl-js-ripple-effect",widget:!1})}();
|
||
|
||
|
||
//! moment.js
|
||
//! version : 2.29.1
|
||
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
||
//! license : MIT
|
||
//! momentjs.com
|
||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function f(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function l(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(m(e,t))return;return 1}function r(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function a(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){for(var n=[],s=0;s<e.length;++s)n.push(t(e[s],s));return n}function c(e,t){for(var n in t)m(t,n)&&(e[n]=t[n]);return m(t,"toString")&&(e.toString=t.toString),m(t,"valueOf")&&(e.valueOf=t.valueOf),e}function _(e,t,n,s){return xt(e,t,n,s,!0).utc()}function y(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function g(e){if(null==e._isValid){var t=y(e),n=i.call(t.parsedDateParts,function(e){return null!=e}),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function w(e){var t=_(NaN);return null!=e?c(y(t),e):y(t).userInvalidated=!0,t}i=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var p=f.momentProperties=[],t=!1;function v(e,t){var n,s,i;if(r(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),r(t._i)||(e._i=t._i),r(t._f)||(e._f=t._f),r(t._l)||(e._l=t._l),r(t._strict)||(e._strict=t._strict),r(t._tzm)||(e._tzm=t._tzm),r(t._isUTC)||(e._isUTC=t._isUTC),r(t._offset)||(e._offset=t._offset),r(t._pf)||(e._pf=y(t)),r(t._locale)||(e._locale=t._locale),0<p.length)for(n=0;n<p.length;n++)r(i=t[s=p[n]])||(e[s]=i);return e}function k(e){v(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===t&&(t=!0,f.updateOffset(this),t=!1)}function M(e){return e instanceof k||null!=e&&null!=e._isAMomentObject}function D(e){!1===f.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return c(function(){if(null!=f.deprecationHandler&&f.deprecationHandler(null,i),a){for(var e,t,n=[],s=0;s<arguments.length;s++){if(e="","object"==typeof arguments[s]){for(t in e+="\n["+s+"] ",arguments[0])m(arguments[0],t)&&(e+=t+": "+arguments[0][t]+", ");e=e.slice(0,-2)}else e=arguments[s];n.push(e)}D(i+"\nArguments: "+Array.prototype.slice.call(n).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var s,S={};function Y(e,t){null!=f.deprecationHandler&&f.deprecationHandler(e,t),S[e]||(D(t),S[e]=!0)}function O(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function b(e,t){var n,s=c({},e);for(n in t)m(t,n)&&(u(e[n])&&u(t[n])?(s[n]={},c(s[n],e[n]),c(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)m(e,n)&&!m(t,n)&&u(e[n])&&(s[n]=c({},s[n]));return s}function x(e){null!=e&&this.set(e)}f.suppressDeprecationWarnings=!1,f.deprecationHandler=null,s=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)m(e,t)&&n.push(t);return n};function T(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,P=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,R={},W={};function C(e,t,n,s){var i="string"==typeof s?function(){return this[s]()}:s;e&&(W[e]=i),t&&(W[t[0]]=function(){return T(i.apply(this,arguments),t[1],t[2])}),n&&(W[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function U(e,t){return e.isValid()?(t=H(t,e.localeData()),R[t]=R[t]||function(s){for(var e,i=s.match(N),t=0,r=i.length;t<r;t++)W[i[t]]?i[t]=W[i[t]]:i[t]=(e=i[t]).match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"");return function(e){for(var t="",n=0;n<r;n++)t+=O(i[n])?i[n].call(e,s):i[n];return t}}(t),R[t](e)):e.localeData().invalidDate()}function H(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(P.lastIndex=0;0<=n&&P.test(e);)e=e.replace(P,s),P.lastIndex=0,--n;return e}var F={};function L(e,t){var n=e.toLowerCase();F[n]=F[n+"s"]=F[t]=e}function V(e){return"string"==typeof e?F[e]||F[e.toLowerCase()]:void 0}function G(e){var t,n,s={};for(n in e)m(e,n)&&(t=V(n))&&(s[t]=e[n]);return s}var E={};function A(e,t){E[e]=t}function j(e){return e%4==0&&e%100!=0||e%400==0}function I(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function Z(e){var t=+e,n=0;return 0!=t&&isFinite(t)&&(n=I(t)),n}function z(t,n){return function(e){return null!=e?(q(this,t,e),f.updateOffset(this,n),this):$(this,t)}}function $(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function q(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&j(e.year())&&1===e.month()&&29===e.date()?(n=Z(n),e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),xe(n,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](n))}var B,J=/\d/,Q=/\d\d/,X=/\d{3}/,K=/\d{4}/,ee=/[+-]?\d{6}/,te=/\d\d?/,ne=/\d\d\d\d?/,se=/\d\d\d\d\d\d?/,ie=/\d{1,3}/,re=/\d{1,4}/,ae=/[+-]?\d{1,6}/,oe=/\d+/,ue=/[+-]?\d+/,le=/Z|[+-]\d\d:?\d\d/gi,he=/Z|[+-]\d\d(?::?\d\d)?/gi,de=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function ce(e,n,s){B[e]=O(n)?n:function(e,t){return e&&s?s:n}}function fe(e,t){return m(B,e)?B[e](t._strict,t._locale):new RegExp(me(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function me(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}B={};var _e={};function ye(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),h(n)&&(s=function(e,t){t[n]=Z(e)}),t=0;t<e.length;t++)_e[e[t]]=s}function ge(e,i){ye(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var we,pe=0,ve=1,ke=2,Me=3,De=4,Se=5,Ye=6,Oe=7,be=8;function xe(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1==s?j(e)?29:28:31-s%7%2}we=Array.prototype.indexOf?Array.prototype.indexOf:function(e){for(var t=0;t<this.length;++t)if(this[t]===e)return t;return-1},C("M",["MM",2],"Mo",function(){return this.month()+1}),C("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),C("MMMM",0,0,function(e){return this.localeData().months(this,e)}),L("month","M"),A("month",8),ce("M",te),ce("MM",te,Q),ce("MMM",function(e,t){return t.monthsShortRegex(e)}),ce("MMMM",function(e,t){return t.monthsRegex(e)}),ye(["M","MM"],function(e,t){t[ve]=Z(e)-1}),ye(["MMM","MMMM"],function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[ve]=i:y(n).invalidMonth=e});var Te="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Ne="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Pe=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Re=de,We=de;function Ce(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=Z(t);else if(!h(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),xe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Ue(e){return null!=e?(Ce(this,e),f.updateOffset(this,!0),this):$(this,"Month")}function He(){function e(e,t){return t.length-e.length}for(var t,n=[],s=[],i=[],r=0;r<12;r++)t=_([2e3,r]),n.push(this.monthsShort(t,"")),s.push(this.months(t,"")),i.push(this.months(t,"")),i.push(this.monthsShort(t,""));for(n.sort(e),s.sort(e),i.sort(e),r=0;r<12;r++)n[r]=me(n[r]),s[r]=me(s[r]);for(r=0;r<24;r++)i[r]=me(i[r]);this._monthsRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+n.join("|")+")","i")}function Fe(e){return j(e)?366:365}C("Y",0,0,function(){var e=this.year();return e<=9999?T(e,4):"+"+e}),C(0,["YY",2],0,function(){return this.year()%100}),C(0,["YYYY",4],0,"year"),C(0,["YYYYY",5],0,"year"),C(0,["YYYYYY",6,!0],0,"year"),L("year","y"),A("year",1),ce("Y",ue),ce("YY",te,Q),ce("YYYY",re,K),ce("YYYYY",ae,ee),ce("YYYYYY",ae,ee),ye(["YYYYY","YYYYYY"],pe),ye("YYYY",function(e,t){t[pe]=2===e.length?f.parseTwoDigitYear(e):Z(e)}),ye("YY",function(e,t){t[pe]=f.parseTwoDigitYear(e)}),ye("Y",function(e,t){t[pe]=parseInt(e,10)}),f.parseTwoDigitYear=function(e){return Z(e)+(68<Z(e)?1900:2e3)};var Le=z("FullYear",!0);function Ve(e){var t,n;return e<100&&0<=e?((n=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Ge(e,t,n){var s=7+t-n;return s-(7+Ve(e,0,s).getUTCDay()-t)%7-1}function Ee(e,t,n,s,i){var r,a=1+7*(t-1)+(7+n-s)%7+Ge(e,s,i),o=a<=0?Fe(r=e-1)+a:a>Fe(e)?(r=e+1,a-Fe(e)):(r=e,a);return{year:r,dayOfYear:o}}function Ae(e,t,n){var s,i,r=Ge(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+je(i=e.year()-1,t,n):a>je(e.year(),t,n)?(s=a-je(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function je(e,t,n){var s=Ge(e,t,n),i=Ge(e+1,t,n);return(Fe(e)-s+i)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),L("week","w"),L("isoWeek","W"),A("week",5),A("isoWeek",5),ce("w",te),ce("ww",te,Q),ce("W",te),ce("WW",te,Q),ge(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=Z(e)});function Ie(e,t){return e.slice(t,7).concat(e.slice(0,t))}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),L("day","d"),L("weekday","e"),L("isoWeekday","E"),A("day",11),A("weekday",11),A("isoWeekday",11),ce("d",te),ce("e",te),ce("E",te),ce("dd",function(e,t){return t.weekdaysMinRegex(e)}),ce("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ce("dddd",function(e,t){return t.weekdaysRegex(e)}),ge(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:y(n).invalidWeekday=e}),ge(["d","e","E"],function(e,t,n,s){t[s]=Z(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),$e="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),qe=de,Be=de,Je=de;function Qe(){function e(e,t){return t.length-e.length}for(var t,n,s,i,r=[],a=[],o=[],u=[],l=0;l<7;l++)t=_([2e3,1]).day(l),n=me(this.weekdaysMin(t,"")),s=me(this.weekdaysShort(t,"")),i=me(this.weekdays(t,"")),r.push(n),a.push(s),o.push(i),u.push(n),u.push(s),u.push(i);r.sort(e),a.sort(e),o.sort(e),u.sort(e),this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,Xe),C("k",["kk",2],0,function(){return this.hours()||24}),C("hmm",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)}),C("hmmss",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),L("hour","h"),A("hour",13),ce("a",et),ce("A",et),ce("H",te),ce("h",te),ce("k",te),ce("HH",te,Q),ce("hh",te,Q),ce("kk",te,Q),ce("hmm",ne),ce("hmmss",se),ce("Hmm",ne),ce("Hmmss",se),ye(["H","HH"],Me),ye(["k","kk"],function(e,t,n){var s=Z(e);t[Me]=24===s?0:s}),ye(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ye(["h","hh"],function(e,t,n){t[Me]=Z(e),y(n).bigHour=!0}),ye("hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s)),y(n).bigHour=!0}),ye("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i)),y(n).bigHour=!0}),ye("Hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s))}),ye("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i))});var tt=z("Hours",!0);var nt,st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Te,monthsShort:Ne,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=at(e[r]).split("-")).length,n=(n=at(e[r+1]))?n.split("-"):null;0<t;){if(s=ut(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s<n;s+=1)if(e[s]!==t[s])return s;return n}(i,n)>=t-1)break;t--}r++}return nt}function ut(t){var e;if(void 0===it[t]&&"undefined"!=typeof module&&module&&module.exports)try{e=nt._abbr,require("./locale/"+t),lt(e)}catch(e){it[t]=null}return it[t]}function lt(e,t){var n;return e&&((n=r(t)?dt(e):ht(e,t))?nt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),nt._abbr}function ht(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])Y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ut(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new x(b(s,t)),rt[e]&&rt[e].forEach(function(e){ht(e.name,e.config)}),lt(e),it[e]}function dt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return nt;if(!o(e)){if(t=ut(e))return t;e=[e]}return ot(e)}function ct(e){var t,n=e._a;return n&&-2===y(e).overflow&&(t=n[ve]<0||11<n[ve]?ve:n[ke]<1||n[ke]>xe(n[pe],n[ve])?ke:n[Me]<0||24<n[Me]||24===n[Me]&&(0!==n[De]||0!==n[Se]||0!==n[Ye])?Me:n[De]<0||59<n[De]?De:n[Se]<0||59<n[Se]?Se:n[Ye]<0||999<n[Ye]?Ye:-1,y(e)._overflowDayOfYear&&(t<pe||ke<t)&&(t=ke),y(e)._overflowWeeks&&-1===t&&(t=Oe),y(e)._overflowWeekday&&-1===t&&(t=be),y(e).overflow=t),e}var ft=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,mt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/Z|[+-]\d\d(?::?\d\d)?/,yt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],gt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],wt=/^\/?Date\((-?\d+)/i,pt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,vt={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function kt(e){var t,n,s,i,r,a,o=e._i,u=ft.exec(o)||mt.exec(o);if(u){for(y(e).iso=!0,t=0,n=yt.length;t<n;t++)if(yt[t][1].exec(u[1])){i=yt[t][0],s=!1!==yt[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=gt.length;t<n;t++)if(gt[t][1].exec(u[3])){r=(u[2]||" ")+gt[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!_t.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),Ot(e)}else e._isValid=!1}function Mt(e,t,n,s,i,r){var a=[function(e){var t=parseInt(e,10);{if(t<=49)return 2e3+t;if(t<=999)return 1900+t}return t}(e),Ne.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&a.push(parseInt(r,10)),a}function Dt(e){var t,n,s,i,r=pt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(r){if(t=Mt(r[4],r[3],r[2],r[5],r[6],r[7]),n=r[1],s=t,i=e,n&&ze.indexOf(n)!==new Date(s[0],s[1],s[2]).getDay()&&(y(i).weekdayMismatch=!0,!void(i._isValid=!1)))return;e._a=t,e._tzm=function(e,t,n){if(e)return vt[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return 60*((s-i)/100)+i}(r[8],r[9],r[10]),e._d=Ve.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),y(e).rfc2822=!0}else e._isValid=!1}function St(e,t,n){return null!=e?e:null!=t?t:n}function Yt(e){var t,n,s,i,r,a,o,u=[];if(!e._d){for(a=e,o=new Date(f.now()),s=a._useUTC?[o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()]:[o.getFullYear(),o.getMonth(),o.getDate()],e._w&&null==e._a[ke]&&null==e._a[ve]&&function(e){var t,n,s,i,r,a,o,u,l;null!=(t=e._w).GG||null!=t.W||null!=t.E?(r=1,a=4,n=St(t.GG,e._a[pe],Ae(Tt(),1,4).year),s=St(t.W,1),((i=St(t.E,1))<1||7<i)&&(u=!0)):(r=e._locale._week.dow,a=e._locale._week.doy,l=Ae(Tt(),r,a),n=St(t.gg,e._a[pe],l.year),s=St(t.w,l.week),null!=t.d?((i=t.d)<0||6<i)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(u=!0)):i=r);s<1||s>je(n,r,a)?y(e)._overflowWeeks=!0:null!=u?y(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[pe]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=St(e._a[pe],s[pe]),(e._dayOfYear>Fe(r)||0===e._dayOfYear)&&(y(e)._overflowDayOfYear=!0),n=Ve(r,0,e._dayOfYear),e._a[ve]=n.getUTCMonth(),e._a[ke]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=u[t]=s[t];for(;t<7;t++)e._a[t]=u[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Me]&&0===e._a[De]&&0===e._a[Se]&&0===e._a[Ye]&&(e._nextDay=!0,e._a[Me]=0),e._d=(e._useUTC?Ve:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,u),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Me]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(y(e).weekdayMismatch=!0)}}function Ot(e){if(e._f!==f.ISO_8601)if(e._f!==f.RFC_2822){e._a=[],y(e).empty=!0;for(var t,n,s,i,r,a,o,u=""+e._i,l=u.length,h=0,d=H(e._f,e._locale).match(N)||[],c=0;c<d.length;c++)n=d[c],(t=(u.match(fe(n,e))||[])[0])&&(0<(s=u.substr(0,u.indexOf(t))).length&&y(e).unusedInput.push(s),u=u.slice(u.indexOf(t)+t.length),h+=t.length),W[n]?(t?y(e).empty=!1:y(e).unusedTokens.push(n),r=n,o=e,null!=(a=t)&&m(_e,r)&&_e[r](a,o._a,o,r)):e._strict&&!t&&y(e).unusedTokens.push(n);y(e).charsLeftOver=l-h,0<u.length&&y(e).unusedInput.push(u),e._a[Me]<=12&&!0===y(e).bigHour&&0<e._a[Me]&&(y(e).bigHour=void 0),y(e).parsedDateParts=e._a.slice(0),y(e).meridiem=e._meridiem,e._a[Me]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):(null!=e.isPM&&((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0)),t)}(e._locale,e._a[Me],e._meridiem),null!==(i=y(e).era)&&(e._a[pe]=e._locale.erasConvertYear(i,e._a[pe])),Yt(e),ct(e)}else Dt(e);else kt(e)}function bt(e){var t,n,s=e._i,i=e._f;return e._locale=e._locale||dt(e._l),null===s||void 0===i&&""===s?w({nullInput:!0}):("string"==typeof s&&(e._i=s=e._locale.preparse(s)),M(s)?new k(ct(s)):(a(s)?e._d=s:o(i)?function(e){var t,n,s,i,r,a,o=!1;if(0===e._f.length)return y(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,a=!1,t=v({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Ot(t),g(t)&&(a=!0),r+=y(t).charsLeftOver,r+=10*y(t).unusedTokens.length,y(t).score=r,o?r<s&&(s=r,n=t):(null==s||r<s||a)&&(s=r,n=t,a&&(o=!0));c(e,n||t)}(e):i?Ot(e):r(n=(t=e)._i)?t._d=new Date(f.now()):a(n)?t._d=new Date(n.valueOf()):"string"==typeof n?function(e){var t=wt.exec(e._i);null===t?(kt(e),!1===e._isValid&&(delete e._isValid,Dt(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:f.createFromInputFallback(e)))):e._d=new Date(+t[1])}(t):o(n)?(t._a=d(n.slice(0),function(e){return parseInt(e,10)}),Yt(t)):u(n)?function(e){var t,n;e._d||(n=void 0===(t=G(e._i)).day?t.date:t.day,e._a=d([t.year,t.month,n,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),Yt(e))}(t):h(n)?t._d=new Date(n):f.createFromInputFallback(t),g(e)||(e._d=null),e))}function xt(e,t,n,s,i){var r,a={};return!0!==t&&!1!==t||(s=t,t=void 0),!0!==n&&!1!==n||(s=n,n=void 0),(u(e)&&l(e)||o(e)&&0===e.length)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=s,(r=new k(ct(bt(a))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function Tt(e,t,n,s){return xt(e,t,n,s,!1)}f.createFromInputFallback=n("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),f.ISO_8601=function(){},f.RFC_2822=function(){};var Nt=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Tt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:w()}),Pt=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Tt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:w()});function Rt(e,t){var n,s;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return Tt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Wt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ct(e){var t=G(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||t.isoWeek||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,h=t.millisecond||0;this._isValid=function(e){var t,n,s=!1;for(t in e)if(m(e,t)&&(-1===we.call(Wt,t)||null!=e[t]&&isNaN(e[t])))return!1;for(n=0;n<Wt.length;++n)if(e[Wt[n]]){if(s)return!1;parseFloat(e[Wt[n]])!==Z(e[Wt[n]])&&(s=!0)}return!0}(t),this._milliseconds=+h+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=dt(),this._bubble()}function Ut(e){return e instanceof Ct}function Ht(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){C(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+T(~~(e/60),2)+n+T(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),ce("Z",he),ce("ZZ",he),ye(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Vt(he,e)});var Lt=/([\+\-]|\d\d)/gi;function Vt(e,t){var n,s,i=(t||"").match(e);return null===i?null:0===(s=60*(n=((i[i.length-1]||[])+"").match(Lt)||["-",0,0])[1]+Z(n[2]))?0:"+"===n[0]?s:-s}function Gt(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(M(e)||a(e)?e.valueOf():Tt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),f.updateOffset(n,!1),n):Tt(e).local()}function Et(e){return-Math.round(e._d.getTimezoneOffset())}function At(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}f.updateOffset=function(){};var jt=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,It=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Zt(e,t){var n,s,i,r=e,a=null;return Ut(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:h(e)||!isNaN(+e)?(r={},t?r[t]=+e:r.milliseconds=+e):(a=jt.exec(e))?(n="-"===a[1]?-1:1,r={y:0,d:Z(a[ke])*n,h:Z(a[Me])*n,m:Z(a[De])*n,s:Z(a[Se])*n,ms:Z(Ht(1e3*a[Ye]))*n}):(a=It.exec(e))?(n="-"===a[1]?-1:1,r={y:zt(a[2],n),M:zt(a[3],n),w:zt(a[4],n),d:zt(a[5],n),h:zt(a[6],n),m:zt(a[7],n),s:zt(a[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=$t(e,t):((n=$t(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(Tt(r.from),Tt(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),s=new Ct(r),Ut(e)&&m(e,"_locale")&&(s._locale=e._locale),Ut(e)&&m(e,"_isValid")&&(s._isValid=e._isValid),s}function zt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function $t(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=t-e.clone().add(n.months,"M"),n}function qt(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(Y(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),Bt(this,Zt(e,t),s),this}}function Bt(e,t,n,s){var i=t._milliseconds,r=Ht(t._days),a=Ht(t._months);e.isValid()&&(s=null==s||s,a&&Ce(e,$(e,"Month")+a*n),r&&q(e,"Date",$(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&f.updateOffset(e,r||a))}Zt.fn=Ct.prototype,Zt.invalid=function(){return Zt(NaN)};var Jt=qt(1,"add"),Qt=qt(-1,"subtract");function Xt(e){return"string"==typeof e||e instanceof String}function Kt(e){return M(e)||a(e)||Xt(e)||h(e)||function(t){var e=o(t),n=!1;e&&(n=0===t.filter(function(e){return!h(e)&&Xt(t)}).length);return e&&n}(e)||function(e){var t,n,s=u(e)&&!l(e),i=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"];for(t=0;t<r.length;t+=1)n=r[t],i=i||m(e,n);return s&&i}(e)||null==e}function en(e,t){if(e.date()<t.date())return-en(t,e);var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months"),i=t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(1+n,"months")-s);return-(n+i)||0}function tn(e){var t;return void 0===e?this._locale._abbr:(null!=(t=dt(e))&&(this._locale=t),this)}f.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",f.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var nn=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function sn(){return this._locale}var rn=126227808e5;function an(e,t){return(e%t+t)%t}function on(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-rn:new Date(e,t,n).valueOf()}function un(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-rn:Date.UTC(e,t,n)}function ln(e,t){return t.erasAbbrRegex(e)}function hn(){for(var e=[],t=[],n=[],s=[],i=this.eras(),r=0,a=i.length;r<a;++r)t.push(me(i[r].name)),e.push(me(i[r].abbr)),n.push(me(i[r].narrow)),s.push(me(i[r].name)),s.push(me(i[r].abbr)),s.push(me(i[r].narrow));this._erasRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+t.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+e.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}function dn(e,t){C(0,[e,e.length],0,t)}function cn(e,t,n,s,i){var r;return null==e?Ae(this,s,i).year:((r=je(e,s,i))<t&&(t=r),function(e,t,n,s,i){var r=Ee(e,t,n,s,i),a=Ve(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}C("N",0,0,"eraAbbr"),C("NN",0,0,"eraAbbr"),C("NNN",0,0,"eraAbbr"),C("NNNN",0,0,"eraName"),C("NNNNN",0,0,"eraNarrow"),C("y",["y",1],"yo","eraYear"),C("y",["yy",2],0,"eraYear"),C("y",["yyy",3],0,"eraYear"),C("y",["yyyy",4],0,"eraYear"),ce("N",ln),ce("NN",ln),ce("NNN",ln),ce("NNNN",function(e,t){return t.erasNameRegex(e)}),ce("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),ye(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){var i=n._locale.erasParse(e,s,n._strict);i?y(n).era=i:y(n).invalidEra=e}),ce("y",oe),ce("yy",oe),ce("yyy",oe),ce("yyyy",oe),ce("yo",function(e,t){return t._eraYearOrdinalRegex||oe}),ye(["y","yy","yyy","yyyy"],pe),ye(["yo"],function(e,t,n,s){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[pe]=n._locale.eraYearOrdinalParse(e,i):t[pe]=parseInt(e,10)}),C(0,["gg",2],0,function(){return this.weekYear()%100}),C(0,["GG",2],0,function(){return this.isoWeekYear()%100}),dn("gggg","weekYear"),dn("ggggg","weekYear"),dn("GGGG","isoWeekYear"),dn("GGGGG","isoWeekYear"),L("weekYear","gg"),L("isoWeekYear","GG"),A("weekYear",1),A("isoWeekYear",1),ce("G",ue),ce("g",ue),ce("GG",te,Q),ce("gg",te,Q),ce("GGGG",re,K),ce("gggg",re,K),ce("GGGGG",ae,ee),ce("ggggg",ae,ee),ge(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=Z(e)}),ge(["gg","GG"],function(e,t,n,s){t[s]=f.parseTwoDigitYear(e)}),C("Q",0,"Qo","quarter"),L("quarter","Q"),A("quarter",7),ce("Q",J),ye("Q",function(e,t){t[ve]=3*(Z(e)-1)}),C("D",["DD",2],"Do","date"),L("date","D"),A("date",9),ce("D",te),ce("DD",te,Q),ce("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ye(["D","DD"],ke),ye("Do",function(e,t){t[ke]=Z(e.match(te)[0])});var fn=z("Date",!0);C("DDD",["DDDD",3],"DDDo","dayOfYear"),L("dayOfYear","DDD"),A("dayOfYear",4),ce("DDD",ie),ce("DDDD",X),ye(["DDD","DDDD"],function(e,t,n){n._dayOfYear=Z(e)}),C("m",["mm",2],0,"minute"),L("minute","m"),A("minute",14),ce("m",te),ce("mm",te,Q),ye(["m","mm"],De);var mn=z("Minutes",!1);C("s",["ss",2],0,"second"),L("second","s"),A("second",15),ce("s",te),ce("ss",te,Q),ye(["s","ss"],Se);var _n,yn,gn=z("Seconds",!1);for(C("S",0,0,function(){return~~(this.millisecond()/100)}),C(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),C(0,["SSS",3],0,"millisecond"),C(0,["SSSS",4],0,function(){return 10*this.millisecond()}),C(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),C(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),C(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),C(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),C(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),L("millisecond","ms"),A("millisecond",16),ce("S",ie,J),ce("SS",ie,Q),ce("SSS",ie,X),_n="SSSS";_n.length<=9;_n+="S")ce(_n,oe);function wn(e,t){t[Ye]=Z(1e3*("0."+e))}for(_n="S";_n.length<=9;_n+="S")ye(_n,wn);yn=z("Milliseconds",!1),C("z",0,0,"zoneAbbr"),C("zz",0,0,"zoneName");var pn=k.prototype;function vn(e){return e}pn.add=Jt,pn.calendar=function(e,t){1===arguments.length&&(arguments[0]?Kt(arguments[0])?(e=arguments[0],t=void 0):function(e){for(var t=u(e)&&!l(e),n=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i=0;i<s.length;i+=1)n=n||m(e,s[i]);return t&&n}(arguments[0])&&(t=arguments[0],e=void 0):t=e=void 0);var n=e||Tt(),s=Gt(n,this).startOf("day"),i=f.calendarFormat(this,s)||"sameElse",r=t&&(O(t[i])?t[i].call(this,n):t[i]);return this.format(r||this.localeData().calendar(i,this,Tt(n)))},pn.clone=function(){return new k(this)},pn.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=V(t)){case"year":r=en(this,s)/12;break;case"month":r=en(this,s);break;case"quarter":r=en(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:I(r)},pn.endOf=function(e){var t,n;if(void 0===(e=V(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?un:on,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-an(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-an(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-an(t,1e3)-1;break}return this._d.setTime(t),f.updateOffset(this,!0),this},pn.format=function(e){e=e||(this.isUtc()?f.defaultFormatUtc:f.defaultFormat);var t=U(this,e);return this.localeData().postformat(t)},pn.from=function(e,t){return this.isValid()&&(M(e)&&e.isValid()||Tt(e).isValid())?Zt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},pn.fromNow=function(e){return this.from(Tt(),e)},pn.to=function(e,t){return this.isValid()&&(M(e)&&e.isValid()||Tt(e).isValid())?Zt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},pn.toNow=function(e){return this.to(Tt(),e)},pn.get=function(e){return O(this[e=V(e)])?this[e]():this},pn.invalidAt=function(){return y(this).overflow},pn.isAfter=function(e,t){var n=M(e)?e:Tt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=V(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},pn.isBefore=function(e,t){var n=M(e)?e:Tt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=V(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},pn.isBetween=function(e,t,n,s){var i=M(e)?e:Tt(e),r=M(t)?t:Tt(t);return!!(this.isValid()&&i.isValid()&&r.isValid())&&(("("===(s=s||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===s[1]?this.isBefore(r,n):!this.isAfter(r,n)))},pn.isSame=function(e,t){var n,s=M(e)?e:Tt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=V(t)||"millisecond")?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},pn.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},pn.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},pn.isValid=function(){return g(this)},pn.lang=nn,pn.locale=tn,pn.localeData=sn,pn.max=Pt,pn.min=Nt,pn.parsingFlags=function(){return c({},y(this))},pn.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t,n=[];for(t in e)m(e,t)&&n.push({unit:t,priority:E[t]});return n.sort(function(e,t){return e.priority-t.priority}),n}(e=G(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(O(this[e=V(e)]))return this[e](t);return this},pn.startOf=function(e){var t,n;if(void 0===(e=V(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?un:on,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=an(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=an(t,6e4);break;case"second":t=this._d.valueOf(),t-=an(t,1e3);break}return this._d.setTime(t),f.updateOffset(this,!0),this},pn.subtract=Qt,pn.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},pn.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},pn.toDate=function(){return new Date(this.valueOf())},pn.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||9999<n.year()?U(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):O(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",U(n,"Z")):U(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},pn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,n,s="moment",i="";return this.isLocal()||(s=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+s+'("]',t=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+n)},"undefined"!=typeof Symbol&&null!=Symbol.for&&(pn[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),pn.toJSON=function(){return this.isValid()?this.toISOString():null},pn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},pn.unix=function(){return Math.floor(this.valueOf()/1e3)},pn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},pn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},pn.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].name;if(t[n].until<=e&&e<=t[n].since)return t[n].name}return""},pn.eraNarrow=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].narrow;if(t[n].until<=e&&e<=t[n].since)return t[n].narrow}return""},pn.eraAbbr=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].abbr;if(t[n].until<=e&&e<=t[n].since)return t[n].abbr}return""},pn.eraYear=function(){for(var e,t,n=this.localeData().eras(),s=0,i=n.length;s<i;++s)if(e=n[s].since<=n[s].until?1:-1,t=this.clone().startOf("day").valueOf(),n[s].since<=t&&t<=n[s].until||n[s].until<=t&&t<=n[s].since)return(this.year()-f(n[s].since).year())*e+n[s].offset;return this.year()},pn.year=Le,pn.isLeapYear=function(){return j(this.year())},pn.weekYear=function(e){return cn.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},pn.isoWeekYear=function(e){return cn.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},pn.quarter=pn.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},pn.month=Ue,pn.daysInMonth=function(){return xe(this.year(),this.month())},pn.week=pn.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},pn.isoWeek=pn.isoWeeks=function(e){var t=Ae(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},pn.weeksInYear=function(){var e=this.localeData()._week;return je(this.year(),e.dow,e.doy)},pn.weeksInWeekYear=function(){var e=this.localeData()._week;return je(this.weekYear(),e.dow,e.doy)},pn.isoWeeksInYear=function(){return je(this.year(),1,4)},pn.isoWeeksInISOWeekYear=function(){return je(this.isoWeekYear(),1,4)},pn.date=fn,pn.day=pn.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},pn.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},pn.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,n,s=(t=e,n=this.localeData(),"string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t);return this.day(this.day()%7?s:s-7)},pn.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},pn.hour=pn.hours=tt,pn.minute=pn.minutes=mn,pn.second=pn.seconds=gn,pn.millisecond=pn.milliseconds=yn,pn.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Et(this);if("string"==typeof e){if(null===(e=Vt(he,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Et(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?Bt(this,Zt(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,f.updateOffset(this,!0),this._changeInProgress=null)),this},pn.utc=function(e){return this.utcOffset(0,e)},pn.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Et(this),"m")),this},pn.parseZone=function(){var e;return null!=this._tzm?this.utcOffset(this._tzm,!1,!0):"string"==typeof this._i&&(null!=(e=Vt(le,this._i))?this.utcOffset(e):this.utcOffset(0,!0)),this},pn.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?Tt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},pn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},pn.isLocal=function(){return!!this.isValid()&&!this._isUTC},pn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},pn.isUtc=At,pn.isUTC=At,pn.zoneAbbr=function(){return this._isUTC?"UTC":""},pn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},pn.dates=n("dates accessor is deprecated. Use date instead.",fn),pn.months=n("months accessor is deprecated. Use month instead",Ue),pn.years=n("years accessor is deprecated. Use year instead",Le),pn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),pn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!r(this._isDSTShifted))return this._isDSTShifted;var e,t={};return v(t,this),(t=bt(t))._a?(e=(t._isUTC?_:Tt)(t._a),this._isDSTShifted=this.isValid()&&0<function(e,t,n){for(var s=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),r=0,a=0;a<s;a++)(n&&e[a]!==t[a]||!n&&Z(e[a])!==Z(t[a]))&&r++;return r+i}(t._a,e.toArray())):this._isDSTShifted=!1,this._isDSTShifted});var kn=x.prototype;function Mn(e,t,n,s){var i=dt(),r=_().set(s,t);return i[n](r,e)}function Dn(e,t,n){if(h(e)&&(t=e,e=void 0),e=e||"",null!=t)return Mn(e,t,n,"month");for(var s=[],i=0;i<12;i++)s[i]=Mn(e,i,n,"month");return s}function Sn(e,t,n,s){t=("boolean"==typeof e?h(t)&&(n=t,t=void 0):(t=e,e=!1,h(n=t)&&(n=t,t=void 0)),t||"");var i,r=dt(),a=e?r._week.dow:0,o=[];if(null!=n)return Mn(t,(n+a)%7,s,"day");for(i=0;i<7;i++)o[i]=Mn(t,(i+a)%7,s,"day");return o}kn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return O(s)?s.call(t,n):s},kn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(N).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},kn.invalidDate=function(){return this._invalidDate},kn.ordinal=function(e){return this._ordinal.replace("%d",e)},kn.preparse=vn,kn.postformat=vn,kn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return O(i)?i(e,t,n,s):i.replace(/%d/i,e)},kn.pastFuture=function(e,t){var n=this._relativeTime[0<e?"future":"past"];return O(n)?n(t):n.replace(/%s/i,t)},kn.set=function(e){var t,n;for(n in e)m(e,n)&&(O(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},kn.eras=function(e,t){for(var n,s=this._eras||dt("en")._eras,i=0,r=s.length;i<r;++i){switch(typeof s[i].since){case"string":n=f(s[i].since).startOf("day"),s[i].since=n.valueOf();break}switch(typeof s[i].until){case"undefined":s[i].until=1/0;break;case"string":n=f(s[i].until).startOf("day").valueOf(),s[i].until=n.valueOf();break}}return s},kn.erasParse=function(e,t,n){var s,i,r,a,o,u=this.eras();for(e=e.toUpperCase(),s=0,i=u.length;s<i;++s)if(r=u[s].name.toUpperCase(),a=u[s].abbr.toUpperCase(),o=u[s].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(a===e)return u[s];break;case"NNNN":if(r===e)return u[s];break;case"NNNNN":if(o===e)return u[s];break}else if(0<=[r,a,o].indexOf(e))return u[s]},kn.erasConvertYear=function(e,t){var n=e.since<=e.until?1:-1;return void 0===t?f(e.since).year():f(e.since).year()+(t-e.offset)*n},kn.erasAbbrRegex=function(e){return m(this,"_erasAbbrRegex")||hn.call(this),e?this._erasAbbrRegex:this._erasRegex},kn.erasNameRegex=function(e){return m(this,"_erasNameRegex")||hn.call(this),e?this._erasNameRegex:this._erasRegex},kn.erasNarrowRegex=function(e){return m(this,"_erasNarrowRegex")||hn.call(this),e?this._erasNarrowRegex:this._erasRegex},kn.months=function(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||Pe).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone},kn.monthsShort=function(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[Pe.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},kn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=_([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=we.call(this._shortMonthsParse,a))?i:null:-1!==(i=we.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=we.call(this._shortMonthsParse,a))||-1!==(i=we.call(this._longMonthsParse,a))?i:null:-1!==(i=we.call(this._longMonthsParse,a))||-1!==(i=we.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=_([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},kn.monthsRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||He.call(this),e?this._monthsStrictRegex:this._monthsRegex):(m(this,"_monthsRegex")||(this._monthsRegex=We),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},kn.monthsShortRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||He.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(m(this,"_monthsShortRegex")||(this._monthsShortRegex=Re),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},kn.week=function(e){return Ae(e,this._week.dow,this._week.doy).week},kn.firstDayOfYear=function(){return this._week.doy},kn.firstDayOfWeek=function(){return this._week.dow},kn.weekdays=function(e,t){var n=o(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?Ie(n,this._week.dow):e?n[e.day()]:n},kn.weekdaysMin=function(e){return!0===e?Ie(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},kn.weekdaysShort=function(e){return!0===e?Ie(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},kn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=_([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=we.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=we.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=we.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=we.call(this._weekdaysParse,a))||-1!==(i=we.call(this._shortWeekdaysParse,a))||-1!==(i=we.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=we.call(this._shortWeekdaysParse,a))||-1!==(i=we.call(this._weekdaysParse,a))||-1!==(i=we.call(this._minWeekdaysParse,a))?i:null:-1!==(i=we.call(this._minWeekdaysParse,a))||-1!==(i=we.call(this._weekdaysParse,a))||-1!==(i=we.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=_([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},kn.weekdaysRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(m(this,"_weekdaysRegex")||(this._weekdaysRegex=qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},kn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(m(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Be),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},kn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(m(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Je),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},kn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},kn.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},lt("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===Z(e%100/10)?"th":1==t?"st":2==t?"nd":3==t?"rd":"th")}}),f.lang=n("moment.lang is deprecated. Use moment.locale instead.",lt),f.langData=n("moment.langData is deprecated. Use moment.localeData instead.",dt);var Yn=Math.abs;function On(e,t,n,s){var i=Zt(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function bn(e){return e<0?Math.floor(e):Math.ceil(e)}function xn(e){return 4800*e/146097}function Tn(e){return 146097*e/4800}function Nn(e){return function(){return this.as(e)}}var Pn=Nn("ms"),Rn=Nn("s"),Wn=Nn("m"),Cn=Nn("h"),Un=Nn("d"),Hn=Nn("w"),Fn=Nn("M"),Ln=Nn("Q"),Vn=Nn("y");function Gn(e){return function(){return this.isValid()?this._data[e]:NaN}}var En=Gn("milliseconds"),An=Gn("seconds"),jn=Gn("minutes"),In=Gn("hours"),Zn=Gn("days"),zn=Gn("months"),$n=Gn("years");var qn=Math.round,Bn={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Jn(e,t,n,s){var i=Zt(e).abs(),r=qn(i.as("s")),a=qn(i.as("m")),o=qn(i.as("h")),u=qn(i.as("d")),l=qn(i.as("M")),h=qn(i.as("w")),d=qn(i.as("y")),c=(r<=n.ss?["s",r]:r<n.s&&["ss",r])||a<=1&&["m"]||a<n.m&&["mm",a]||o<=1&&["h"]||o<n.h&&["hh",o]||u<=1&&["d"]||u<n.d&&["dd",u];return null!=n.w&&(c=c||h<=1&&["w"]||h<n.w&&["ww",h]),(c=c||l<=1&&["M"]||l<n.M&&["MM",l]||d<=1&&["y"]||["yy",d])[2]=t,c[3]=0<+e,c[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,c)}var Qn=Math.abs;function Xn(e){return(0<e)-(e<0)||+e}function Kn(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,s,i,r,a,o,u=Qn(this._milliseconds)/1e3,l=Qn(this._days),h=Qn(this._months),d=this.asSeconds();return d?(e=I(u/60),t=I(e/60),u%=60,e%=60,n=I(h/12),h%=12,s=u?u.toFixed(3).replace(/\.?0+$/,""):"",i=d<0?"-":"",r=Xn(this._months)!==Xn(d)?"-":"",a=Xn(this._days)!==Xn(d)?"-":"",o=Xn(this._milliseconds)!==Xn(d)?"-":"",i+"P"+(n?r+n+"Y":"")+(h?r+h+"M":"")+(l?a+l+"D":"")+(t||e||u?"T":"")+(t?o+t+"H":"")+(e?o+e+"M":"")+(u?o+s+"S":"")):"P0D"}var es=Ct.prototype;return es.isValid=function(){return this._isValid},es.abs=function(){var e=this._data;return this._milliseconds=Yn(this._milliseconds),this._days=Yn(this._days),this._months=Yn(this._months),e.milliseconds=Yn(e.milliseconds),e.seconds=Yn(e.seconds),e.minutes=Yn(e.minutes),e.hours=Yn(e.hours),e.months=Yn(e.months),e.years=Yn(e.years),this},es.add=function(e,t){return On(this,e,t,1)},es.subtract=function(e,t){return On(this,e,t,-1)},es.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=V(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+xn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Tn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},es.asMilliseconds=Pn,es.asSeconds=Rn,es.asMinutes=Wn,es.asHours=Cn,es.asDays=Un,es.asWeeks=Hn,es.asMonths=Fn,es.asQuarters=Ln,es.asYears=Vn,es.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*Z(this._months/12):NaN},es._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return 0<=r&&0<=a&&0<=o||r<=0&&a<=0&&o<=0||(r+=864e5*bn(Tn(o)+a),o=a=0),u.milliseconds=r%1e3,e=I(r/1e3),u.seconds=e%60,t=I(e/60),u.minutes=t%60,n=I(t/60),u.hours=n%24,a+=I(n/24),o+=i=I(xn(a)),a-=bn(Tn(i)),s=I(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},es.clone=function(){return Zt(this)},es.get=function(e){return e=V(e),this.isValid()?this[e+"s"]():NaN},es.milliseconds=En,es.seconds=An,es.minutes=jn,es.hours=In,es.days=Zn,es.weeks=function(){return I(this.days()/7)},es.months=zn,es.years=$n,es.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var n,s,i=!1,r=Bn;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(i=e),"object"==typeof t&&(r=Object.assign({},Bn,t),null!=t.s&&null==t.ss&&(r.ss=t.s-1)),n=this.localeData(),s=Jn(this,!i,r,n),i&&(s=n.pastFuture(+this,s)),n.postformat(s)},es.toISOString=Kn,es.toString=Kn,es.toJSON=Kn,es.locale=tn,es.localeData=sn,es.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Kn),es.lang=nn,C("X",0,0,"unix"),C("x",0,0,"valueOf"),ce("x",ue),ce("X",/[+-]?\d+(\.\d{1,3})?/),ye("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e))}),ye("x",function(e,t,n){n._d=new Date(Z(e))}),f.version="2.29.1",e=Tt,f.fn=pn,f.min=function(){return Rt("isBefore",[].slice.call(arguments,0))},f.max=function(){return Rt("isAfter",[].slice.call(arguments,0))},f.now=function(){return Date.now?Date.now():+new Date},f.utc=_,f.unix=function(e){return Tt(1e3*e)},f.months=function(e,t){return Dn(e,t,"months")},f.isDate=a,f.locale=lt,f.invalid=w,f.duration=Zt,f.isMoment=M,f.weekdays=function(e,t,n){return Sn(e,t,n,"weekdays")},f.parseZone=function(){return Tt.apply(null,arguments).parseZone()},f.localeData=dt,f.isDuration=Ut,f.monthsShort=function(e,t){return Dn(e,t,"monthsShort")},f.weekdaysMin=function(e,t,n){return Sn(e,t,n,"weekdaysMin")},f.defineLocale=ht,f.updateLocale=function(e,t){var n,s,i;return null!=t?(i=st,null!=it[e]&&null!=it[e].parentLocale?it[e].set(b(it[e]._config,t)):(null!=(s=ut(e))&&(i=s._config),t=b(i,t),null==s&&(t.abbr=e),(n=new x(t)).parentLocale=it[e],it[e]=n),lt(e)):null!=it[e]&&(null!=it[e].parentLocale?(it[e]=it[e].parentLocale,e===lt()&<(e)):null!=it[e]&&delete it[e]),it[e]},f.locales=function(){return s(it)},f.weekdaysShort=function(e,t,n){return Sn(e,t,n,"weekdaysShort")},f.normalizeUnits=V,f.relativeTimeRounding=function(e){return void 0===e?qn:"function"==typeof e&&(qn=e,!0)},f.relativeTimeThreshold=function(e,t){return void 0!==Bn[e]&&(void 0===t?Bn[e]:(Bn[e]=t,"s"===e&&(Bn.ss=t-1),!0))},f.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},f.prototype=pn,f.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},f});
|
||
|
||
/*!
|
||
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
||
* version : 3.1.0
|
||
* http://github.com/janl/mustache.js
|
||
*/
|
||
(function defineMustache(global,factory){if(typeof exports==="object"&&exports&&typeof exports.nodeName!=="string"){factory(exports)}else if(typeof define==="function"&&define.amd){define(["exports"],factory)}else{global.Mustache={};factory(global.Mustache)}})(this,function mustacheFactory(mustache){var objectToString=Object.prototype.toString;var isArray=Array.isArray||function isArrayPolyfill(object){return objectToString.call(object)==="[object Array]"};function isFunction(object){return typeof object==="function"}function typeStr(obj){return isArray(obj)?"array":typeof obj}function escapeRegExp(string){return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function hasProperty(obj,propName){return obj!=null&&typeof obj==="object"&&propName in obj}var regExpTest=RegExp.prototype.test;function testRegExp(re,string){return regExpTest.call(re,string)}var nonSpaceRe=/\S/;function isWhitespace(string){return!testRegExp(nonSpaceRe,string)}var entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function escapeHtml(string){return String(string).replace(/[&<>"'`=\/]/g,function fromEntityMap(s){return entityMap[s]})}var whiteRe=/\s*/;var spaceRe=/\s+/;var equalsRe=/\s*=/;var curlyRe=/\s*\}/;var tagRe=/#|\^|\/|>|\{|&|=|!/;function parseTemplate(template,tags){if(!template)return[];var sections=[];var tokens=[];var spaces=[];var hasTag=false;var nonSpace=false;function stripSpace(){if(hasTag&&!nonSpace){while(spaces.length)delete tokens[spaces.pop()]}else{spaces=[]}hasTag=false;nonSpace=false}var openingTagRe,closingTagRe,closingCurlyRe;function compileTags(tagsToCompile){if(typeof tagsToCompile==="string")tagsToCompile=tagsToCompile.split(spaceRe,2);if(!isArray(tagsToCompile)||tagsToCompile.length!==2)throw new Error("Invalid tags: "+tagsToCompile);openingTagRe=new RegExp(escapeRegExp(tagsToCompile[0])+"\\s*");closingTagRe=new RegExp("\\s*"+escapeRegExp(tagsToCompile[1]));closingCurlyRe=new RegExp("\\s*"+escapeRegExp("}"+tagsToCompile[1]))}compileTags(tags||mustache.tags);var scanner=new Scanner(template);var start,type,value,chr,token,openSection;while(!scanner.eos()){start=scanner.pos;value=scanner.scanUntil(openingTagRe);if(value){for(var i=0,valueLength=value.length;i<valueLength;++i){chr=value.charAt(i);if(isWhitespace(chr)){spaces.push(tokens.length)}else{nonSpace=true}tokens.push(["text",chr,start,start+1]);start+=1;if(chr==="\n")stripSpace()}}if(!scanner.scan(openingTagRe))break;hasTag=true;type=scanner.scan(tagRe)||"name";scanner.scan(whiteRe);if(type==="="){value=scanner.scanUntil(equalsRe);scanner.scan(equalsRe);scanner.scanUntil(closingTagRe)}else if(type==="{"){value=scanner.scanUntil(closingCurlyRe);scanner.scan(curlyRe);scanner.scanUntil(closingTagRe);type="&"}else{value=scanner.scanUntil(closingTagRe)}if(!scanner.scan(closingTagRe))throw new Error("Unclosed tag at "+scanner.pos);token=[type,value,start,scanner.pos];tokens.push(token);if(type==="#"||type==="^"){sections.push(token)}else if(type==="/"){openSection=sections.pop();if(!openSection)throw new Error('Unopened section "'+value+'" at '+start);if(openSection[1]!==value)throw new Error('Unclosed section "'+openSection[1]+'" at '+start)}else if(type==="name"||type==="{"||type==="&"){nonSpace=true}else if(type==="="){compileTags(value)}}openSection=sections.pop();if(openSection)throw new Error('Unclosed section "'+openSection[1]+'" at '+scanner.pos);return nestTokens(squashTokens(tokens))}function squashTokens(tokens){var squashedTokens=[];var token,lastToken;for(var i=0,numTokens=tokens.length;i<numTokens;++i){token=tokens[i];if(token){if(token[0]==="text"&&lastToken&&lastToken[0]==="text"){lastToken[1]+=token[1];lastToken[3]=token[3]}else{squashedTokens.push(token);lastToken=token}}}return squashedTokens}function nestTokens(tokens){var nestedTokens=[];var collector=nestedTokens;var sections=[];var token,section;for(var i=0,numTokens=tokens.length;i<numTokens;++i){token=tokens[i];switch(token[0]){case"#":case"^":collector.push(token);sections.push(token);collector=token[4]=[];break;case"/":section=sections.pop();section[5]=token[2];collector=sections.length>0?sections[sections.length-1][4]:nestedTokens;break;default:collector.push(token)}}return nestedTokens}function Scanner(string){this.string=string;this.tail=string;this.pos=0}Scanner.prototype.eos=function eos(){return this.tail===""};Scanner.prototype.scan=function scan(re){var match=this.tail.match(re);if(!match||match.index!==0)return"";var string=match[0];this.tail=this.tail.substring(string.length);this.pos+=string.length;return string};Scanner.prototype.scanUntil=function scanUntil(re){var index=this.tail.search(re),match;switch(index){case-1:match=this.tail;this.tail="";break;case 0:match="";break;default:match=this.tail.substring(0,index);this.tail=this.tail.substring(index)}this.pos+=match.length;return match};function Context(view,parentContext){this.view=view;this.cache={".":this.view};this.parent=parentContext}Context.prototype.push=function push(view){return new Context(view,this)};Context.prototype.lookup=function lookup(name){var cache=this.cache;var value;if(cache.hasOwnProperty(name)){value=cache[name]}else{var context=this,names,index,lookupHit=false;while(context){if(name.indexOf(".")>0){value=context.view;names=name.split(".");index=0;while(value!=null&&index<names.length){if(index===names.length-1)lookupHit=hasProperty(value,names[index]);value=value[names[index++]]}}else{value=context.view[name];lookupHit=hasProperty(context.view,name)}if(lookupHit)break;context=context.parent}cache[name]=value}if(isFunction(value))value=value.call(this.view);return value};function Writer(){this.cache={}}Writer.prototype.clearCache=function clearCache(){this.cache={}};Writer.prototype.parse=function parse(template,tags){var cache=this.cache;var tokens=cache[template];if(tokens==null)tokens=cache[template]=parseTemplate(template,tags);return tokens};Writer.prototype.render=function render(template,view,partials){var tokens=this.parse(template);var context=view instanceof Context?view:new Context(view);return this.renderTokens(tokens,context,partials,template)};Writer.prototype.renderTokens=function renderTokens(tokens,context,partials,originalTemplate){var buffer="";var token,symbol,value;for(var i=0,numTokens=tokens.length;i<numTokens;++i){value=undefined;token=tokens[i];symbol=token[0];if(symbol==="#")value=this.renderSection(token,context,partials,originalTemplate);else if(symbol==="^")value=this.renderInverted(token,context,partials,originalTemplate);else if(symbol===">")value=this.renderPartial(token,context,partials,originalTemplate);else if(symbol==="&")value=this.unescapedValue(token,context);else if(symbol==="name")value=this.escapedValue(token,context);else if(symbol==="text")value=this.rawValue(token);if(value!==undefined)buffer+=value}return buffer};Writer.prototype.renderSection=function renderSection(token,context,partials,originalTemplate){var self=this;var buffer="";var value=context.lookup(token[1]);function subRender(template){return self.render(template,context,partials)}if(!value)return;if(isArray(value)){for(var j=0,valueLength=value.length;j<valueLength;++j){buffer+=this.renderTokens(token[4],context.push(value[j]),partials,originalTemplate)}}else if(typeof value==="object"||typeof value==="string"||typeof value==="number"){buffer+=this.renderTokens(token[4],context.push(value),partials,originalTemplate)}else if(isFunction(value)){if(typeof originalTemplate!=="string")throw new Error("Cannot use higher-order sections without the original template");value=value.call(context.view,originalTemplate.slice(token[3],token[5]),subRender);if(value!=null)buffer+=value}else{buffer+=this.renderTokens(token[4],context,partials,originalTemplate)}return buffer};Writer.prototype.renderInverted=function renderInverted(token,context,partials,originalTemplate){var value=context.lookup(token[1]);if(!value||isArray(value)&&value.length===0)return this.renderTokens(token[4],context,partials,originalTemplate)};Writer.prototype.renderPartial=function renderPartial(token,context,partials){if(!partials)return;var value=isFunction(partials)?partials(token[1]):partials[token[1]];if(value!=null)return this.renderTokens(this.parse(value),context,partials,value)};Writer.prototype.unescapedValue=function unescapedValue(token,context){var value=context.lookup(token[1]);if(value!=null)return value};Writer.prototype.escapedValue=function escapedValue(token,context){var value=context.lookup(token[1]);if(value!=null)return mustache.escape(value)};Writer.prototype.rawValue=function rawValue(token){return token[1]};mustache.name="mustache.js";mustache.version="2.3.0";mustache.tags=["{{","}}"];var defaultWriter=new Writer;mustache.clearCache=function clearCache(){return defaultWriter.clearCache()};mustache.parse=function parse(template,tags){return defaultWriter.parse(template,tags)};mustache.render=function render(template,view,partials){if(typeof template!=="string"){throw new TypeError('Invalid template! Template should be a "string" '+'but "'+typeStr(template)+'" was given as the first '+"argument for mustache#render(template, view, partials)")}return defaultWriter.render(template,view,partials)};mustache.to_html=function to_html(template,view,partials,send){var result=mustache.render(template,view,partials);if(isFunction(send)){send(result)}else{return result}};mustache.escape=escapeHtml;mustache.Scanner=Scanner;mustache.Context=Context;mustache.Writer=Writer;return mustache});
|
||
|
||
/*
|
||
Redactor 3
|
||
License: OEM
|
||
version 3.4.6 from November 17, 2020
|
||
*/
|
||
if(void 0===CodeMirror)var CodeMirror=void 0;if(void 0===jQuery)var jQuery=void 0;!function(){var Ajax={settings:{},post:function(t){return new AjaxRequest("post",t)},get:function(t){return new AjaxRequest("get",t)}},AjaxRequest=function(t,e){var i={method:t,url:"",before:function(){},success:function(){},error:function(){},data:!1,async:!0,headers:{}};this.p=this.extend(i,e),this.p=this.extend(this.p,Ajax.settings),this.p.method=this.p.method.toUpperCase(),this.prepareData(),this.xhr=new XMLHttpRequest,this.xhr.open(this.p.method,this.p.url,this.p.async),this.setHeaders(),!1!==("function"!=typeof this.p.before||this.p.before(this.xhr))&&this.send()};AjaxRequest.prototype={extend:function(t,e){if(e)for(var i in e)t[i]=e[i];return t},prepareData:function(){"POST"!==this.p.method||this.isFormData()||(this.p.headers["Content-Type"]="application/x-www-form-urlencoded"),"object"!=typeof this.p.data||this.isFormData()||(this.p.data=this.toParams(this.p.data)),"GET"===this.p.method&&(this.p.url=this.p.data?this.p.url+"?"+this.p.data:this.p.url)},setHeaders:function(){for(var t in this.xhr.setRequestHeader("X-Requested-With",this.p.headers["X-Requested-With"]||"XMLHttpRequest"),this.p.headers)this.xhr.setRequestHeader(t,this.p.headers[t])},isFormData:function(){return void 0!==window.FormData&&this.p.data instanceof window.FormData},isComplete:function(){return!(this.xhr.status<200||300<=this.xhr.status&&304!==this.xhr.status)},send:function(){this.p.async?(this.xhr.onload=this.loaded.bind(this),this.xhr.send(this.p.data)):(this.xhr.send(this.p.data),this.loaded.call(this))},loaded:function(){if(this.isComplete()){var t=this.xhr.response,e=this.parseJson(t);t=e||t,"function"==typeof this.p.success&&this.p.success(t,this.xhr)}else"function"==typeof this.p.error&&this.p.error(this.xhr.statusText)},parseJson:function(t){try{var e=JSON.parse(t);if(e&&"object"==typeof e)return e}catch(t){}return!1},toParams:function(e){return Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&")}};var DomCache=[0],DomExpando="data"+(new Date).getTime(),DomHClass="is-hidden",DomHMClass="is-hidden-mobile",Dom=function(t,e){return this.parse(t,e)};Dom.ready=function(t){"loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",t)},Dom.prototype={get sdom(){return!0},get length(){return this.nodes.length},parse:function(t,e){var i;if(t){if(t.sdom)return this.nodes=t.nodes,t;i="string"!=typeof t?t.nodeType&&11===t.nodeType?t.childNodes:t.nodeType||t===window?[t]:t:/^\s*<(\w+|!)[^>]*>/.test(t)?this.create(t):this._query(t,e)}else i=[];this.nodes=this._slice(i)},create:function(t){if(/^<(\w+)\s*\/?>(?:<\/\1>|)$/.test(t))return[document.createElement(RegExp.$1)];var e=[],i=document.createElement("div"),s=i.childNodes;i.innerHTML=t;for(var n=0,r=s.length;n<r;n++)e.push(s[n]);return e},add:function(t){this.nodes=this.nodes.concat(this._toArray(t))},get:function(t){return this.nodes[t||0]||!1},getAll:function(){return this.nodes},eq:function(t){return new Dom(this.nodes[t])},first:function(){return new Dom(this.nodes[0])},last:function(){return new Dom(this.nodes[this.nodes.length-1])},contents:function(){return this.get().childNodes},each:function(t){for(var e=this.nodes.length,i=0;i<e;i++)t.call(this,this.nodes[i].sdom?this.nodes[i].get():this.nodes[i],i);return this},is:function(t){return 0<this.filter(t).length},filter:function(e){var t;return void 0===e?this:(t="function"==typeof e?e:function(t){return e instanceof Node?e===t:e&&e.sdom?-1!==e.nodes.indexOf(t):(t.matches=t.matches||t.msMatchesSelector||t.webkitMatchesSelector,1===t.nodeType&&t.matches(e||"*"))},new Dom(this.nodes.filter(t)))},not:function(e){return this.filter(function(t){return!new Dom(t).is(e||!0)})},find:function(s){var n=[];return this.each(function(t){for(var e=this._query(s||"*",t),i=0;i<e.length;i++)n.push(e[i])}),new Dom(n)},children:function(t){var s=[];return this.each(function(t){if(t.children)for(var e=t.children,i=0;i<e.length;i++)s.push(e[i])}),new Dom(s).filter(t)},parent:function(t){var e=[];return this.each(function(t){t.parentNode&&e.push(t.parentNode)}),new Dom(e).filter(t)},parents:function(i,s){s=this._getContext(s);var n=[];return this.each(function(t){for(var e=t.parentNode;e&&e!==s;)i?new Dom(e).is(i)&&n.push(e):n.push(e),e=e.parentNode}),new Dom(n)},closest:function(e,i){i=this._getContext(i),e=e.sdom?e.get():e;var s=[],n=e&&e.nodeType;return this.each(function(t){do{if(n&&t===e||new Dom(t).is(e))return s.push(t)}while((t=t.parentNode)&&t!==i)}),new Dom(s)},next:function(t){return this._getSibling(t,"nextSibling")},nextElement:function(t){return this._getSibling(t,"nextElementSibling")},prev:function(t){return this._getSibling(t,"previousSibling")},prevElement:function(t){return this._getSibling(t,"previousElementSibling")},css:function(s,n){if(void 0!==n||"object"==typeof s)return this.each(function(t){var e={};for(var i in"object"==typeof s?e=s:e[s]=n,e)t.style&&(t.style[i]=e[i])});var t=this.get();return"width"===s||"height"===s?t.style?this._getHeightOrWidth(s,t,!1)+"px":void 0:t.style?getComputedStyle(t,null)[s]:void 0},attr:function(s,n,r){if(r=r?"data-":"",void 0!==n||"object"==typeof s)return this.each(function(t){var e={};for(var i in"object"==typeof s?e=s:e[s]=n,e)3!==t.nodeType&&("checked"===i?t.checked=e[i]:t.setAttribute(r+i,e[i]))});var t=this.get();return t&&3!==t.nodeType?"checked"===s?t.checked:this._getBooleanFromStr(t.getAttribute(r+s)):void 0},data:function(t,e){if(void 0!==t)return this.attr(t,e,!0);function i(t){return t[1].toUpperCase()}var s=/^data-(.+)$/,n=this.get().attributes,r={};for(var o in n)if(n[o]&&s.test(n[o].nodeName)){var a=n[o].nodeName.match(s)[1],l=n[o].value;a=a.replace(/-([a-z])/g,i),l=this._isObjectString(l)?this._toObject(l):this._isNumber(l)?parseFloat(l):this._getBooleanFromStr(l),r[a]=l}return r},val:function(e){if(void 0!==e)return this.each(function(t){t.value=e});var t=this.get();return t.type&&"checkbox"===t.type?t.checked:t.value},removeAttr:function(t){return this.each(function(e){t.split(" ").forEach(function(t){3!==e.nodeType&&e.removeAttribute(t)})})},removeData:function(t){return this.each(function(e){t.split(" ").forEach(function(t){3!==e.nodeType&&e.removeAttribute("data-"+t)})})},dataset:function(e,i){return this.each(function(t){DomCache[this.dataindex(t)][e]=i})},dataget:function(t){return DomCache[this.dataindex(this.get())][t]},dataindex:function(t){var e=t[DomExpando],i=DomCache.length;return e||(e=t[DomExpando]=i,DomCache[e]={}),e},addClass:function(t){return this._eachClass(t,"add")},removeClass:function(t){return this._eachClass(t,"remove")},toggleClass:function(t){return this._eachClass(t,"toggle")},hasClass:function(e){return this.nodes.some(function(t){return!!t.classList&&t.classList.contains(e)})},empty:function(){return this.each(function(t){t.innerHTML=""})},html:function(t){return void 0===t?this.get().innerHTML||"":this.empty().append(t)},text:function(e){return void 0===e?this.get().textContent||"":this.each(function(t){t.textContent=e})},after:function(t){return this._inject(t,function(t,e){if("string"==typeof t)e.insertAdjacentHTML("afterend",t);else if(null!==e.parentNode)for(var i=t instanceof Node?[t]:this._toArray(t).reverse(),s=0;s<i.length;s++)e.parentNode.insertBefore(i[s],e.nextSibling);return e})},before:function(t){return this._inject(t,function(t,e){if("string"==typeof t)e.insertAdjacentHTML("beforebegin",t);else for(var i=t instanceof Node?[t]:this._toArray(t),s=0;s<i.length;s++)e.parentNode.insertBefore(i[s],e);return e})},append:function(t){return this._inject(t,function(t,e){if("string"==typeof t||"number"==typeof t)e.insertAdjacentHTML("beforeend",t);else for(var i=t instanceof Node?[t]:this._toArray(t),s=0;s<i.length;s++)e.appendChild(i[s]);return e})},prepend:function(t){return this._inject(t,function(t,e){if("string"==typeof t||"number"==typeof t)e.insertAdjacentHTML("afterbegin",t);else for(var i=t instanceof Node?[t]:this._toArray(t).reverse(),s=0;s<i.length;s++)e.insertBefore(i[s],e.firstChild);return e})},wrap:function(t){return this._inject(t,function(t,e){var i="string"==typeof t||"number"==typeof t?this.create(t)[0]:t instanceof Node?t:this._toArray(t)[0];return e.parentNode&&e.parentNode.insertBefore(i,e),i.appendChild(e),new Dom(i)})},unwrap:function(){return this.each(function(t){var e=new Dom(t);return e.replaceWith(e.contents())})},replaceWith:function(t){return this._inject(t,function(t,e){for(var i=document.createDocumentFragment(),s="string"==typeof t||"number"==typeof t?this.create(t):t instanceof Node?[t]:this._toArray(t),n=0;n<s.length;n++)i.appendChild(s[n]);var r=i.childNodes[0];return e.parentNode&&e.parentNode.replaceChild(i,e),r})},remove:function(){return this.each(function(t){t.parentNode&&t.parentNode.removeChild(t)})},clone:function(i){var s=[];return this.each(function(t){var e=this._clone(t);i&&(e=this._cloneEvents(t,e)),s.push(e)}),new Dom(s)},show:function(){return this.each(function(t){if(t.style&&this._hasDisplayNone(t)){var e,i=t.getAttribute("domTargetShow"),s=!!t.classList&&t.classList.contains(DomHClass),n=!!t.classList&&t.classList.contains(DomHMClass);s?(e=DomHClass,t.classList.remove(DomHClass)):n?(e=DomHMClass,t.classList.remove(DomHMClass)):t.style.display=i||"block",e&&t.setAttribute("domTargetHide",e),t.removeAttribute("domTargetShow")}}.bind(this))},hide:function(){return this.each(function(t){if(t.style&&!this._hasDisplayNone(t)){var e=t.style.display,i=t.getAttribute("domTargetHide");i===DomHClass?t.classList.add(DomHClass):i===DomHMClass?t.classList.add(DomHMClass):("block"!==e&&t.setAttribute("domTargetShow",e),t.style.display="none"),t.removeAttribute("domTargetHide")}})},scrollTop:function(t){var e=this.get(),i=e===window,s=9===e.nodeType,n=s?document.scrollingElement||document.body.parentNode||document.body||document.documentElement:e;if(void 0===t)return s?void 0!==window.pageYOffset?window.pageYOffset:document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop?document.body.scrollTop:0:i?window.pageYOffset:n.scrollTop;i?window.scrollTo(0,t):n.scrollTop=t},offset:function(){return this._getDim("Offset")},position:function(){return this._getDim("Position")},width:function(t,e){return this._getSize("width","Width",t,e)},height:function(t,e){return this._getSize("height","Height",t,e)},outerWidth:function(){return this._getInnerOrOuter("width","outer")},outerHeight:function(){return this._getInnerOrOuter("height","outer")},innerWidth:function(){return this._getInnerOrOuter("width","inner")},innerHeight:function(){return this._getInnerOrOuter("height","inner")},click:function(){return this._triggerEvent("click")},focus:function(){return this._triggerEvent("focus")},trigger:function(n){return this.each(function(t){for(var e=n.split(" "),i=0;i<e.length;i++){var s;try{s=new window.CustomEvent(e[i],{bubbles:!0,cancelable:!0})}catch(t){(s=document.createEvent("CustomEvent")).initCustomEvent(e[i],!0,!0)}t.dispatchEvent(s)}})},on:function(r,o,a){return this.each(function(t){for(var e=r.split(" "),i=0;i<e.length;i++){var s=this._getEventName(e[i]),n=this._getEventNamespace(e[i]);o=a?this._getOneHandler(o,r):o,t.addEventListener(s,o),t._e=t._e||{},t._e[n]=t._e[n]||{},t._e[n][s]=t._e[n][s]||[],t._e[n][s].push(o)}})},one:function(t,e){return this.on(t,e,!0)},off:function(r,o){function a(t,e,i){return t===i}function l(t,e,i,s){return e===s}function h(t,e,i,s){return t===i&&e===s}function e(){return!0}return void 0===r?this.each(function(t){this._offEvent(t,!1,!1,o,e)}):this.each(function(t){for(var e=r.split(" "),i=0;i<e.length;i++){var s=this._getEventName(e[i]),n=this._getEventNamespace(e[i]);"_events"===n?this._offEvent(t,s,n,o,a):s||"_events"===n?this._offEvent(t,s,n,o,h):this._offEvent(t,s,n,o,l)}})},serialize:function(t){for(var e={},i=this.get().elements,s=0;s<i.length;s++){var n=i[s];if((!/(checkbox|radio)/.test(n.type)||n.checked)&&(n.name&&!n.disabled&&"file"!==n.type)){if("select-multiple"===n.type)for(var r=0;r<n.options.length;r++){var o=n.options[r];o.selected&&(e[n.name]=o.value)}e[n.name]=this._isNumber(n.value)?parseFloat(n.value):this._getBooleanFromStr(n.value)}}return t?e:this._toParams(e)},ajax:function(t,e){if(void 0!==AjaxRequest){var i=this.attr("method")||"post",s={url:this.attr("action"),data:this.serialize(),success:t,error:e};return new AjaxRequest(i,s)}},_queryContext:function(t,e){return 3!==(e=this._getContext(e)).nodeType&&"function"==typeof e.querySelectorAll?e.querySelectorAll(t):[]},_query:function(t,e){if(e)return this._queryContext(t,e);if(/^[.#]?[\w-]*$/.test(t)){if("#"!==t[0])return"."===t[0]?document.getElementsByClassName(t.slice(1)):document.getElementsByTagName(t);var i=document.getElementById(t.slice(1));return i?[i]:[]}return document.querySelectorAll(t)},_getContext:function(t){return(t="string"==typeof t?document.querySelector(t):t)&&t.sdom?t.get():t||document},_inject:function(t,e){for(var i=this.nodes.length,s=[];i--;){var n="function"==typeof t?t.call(this,this.nodes[i]):t,r=0===i?n:this._clone(n),o=e.call(this,r,this.nodes[i]);o&&(o.sdom?s.push(o.get()):s.push(o))}return new Dom(s)},_cloneEvents:function(t,e){var i=t._e;if(i)for(var s in(e._e=i)._events)for(var n=0;n<i._events[s].length;n++)e.addEventListener(s,i._events[s][n]);return e},_clone:function(t){if(void 0!==t)return"string"==typeof t?t:t instanceof Node||t.nodeType?t.cloneNode(!0):"length"in t?[].map.call(this._toArray(t),function(t){return t.cloneNode(!0)}):void 0},_slice:function(t){return t&&0!==t.length?t.length?[].slice.call(t.nodes||t):[t]:[]},_eachClass:function(t,i){return this.each(function(e){if(t){t.split(" ").forEach(function(t){e.classList&&e.classList[i](t)})}})},_triggerEvent:function(t){var e=this.get();return e&&3!==e.nodeType&&e[t](),this},_getOneHandler:function(t,e){var i=this;return function(){t.apply(this,arguments),i.off(e)}},_getEventNamespace:function(t){var e=t.split("."),i=e[1]?e[1]:"_events";return e[2]?i+e[2]:i},_getEventName:function(t){return t.split(".")[0]},_offEvent:function(t,e,i,s,n){for(var r in t._e)for(var o in t._e[r])if(n(o,r,e,i))for(var a=t._e[r][o],l=0;l<a.length;l++)void 0!==s&&a[l].toString()!==s.toString()||(t.removeEventListener(o,a[l]),t._e[r][o].splice(l,1),0===t._e[r][o].length&&delete t._e[r][o],0===Object.keys(t._e[r]).length&&delete t._e[r])},_getInnerOrOuter:function(t,e){return this[t](void 0,e)},_getDocSize:function(t,e){var i=t.body,s=t.documentElement;return Math.max(i["scroll"+e],i["offset"+e],s["client"+e],s["scroll"+e],s["offset"+e])},_getSize:function(e,t,i,s){if(void 0!==i)return this.each(function(t){i=parseFloat(i),i+=this._adjustResultHeightOrWidth(e,t,s||"normal"),new Dom(t).css(e,i+"px")}.bind(this));var n=this.get();return i=3===n.nodeType?0:9===n.nodeType?this._getDocSize(n,t):n===window?window["inner"+t]:this._getHeightOrWidth(e,n,s||"normal"),Math.round(i)},_getHeightOrWidth:function(t,e,i){if(!e)return 0;var s=t.charAt(0).toUpperCase()+t.slice(1),n=0,r=getComputedStyle(e,null),o=new Dom(e),a=o.parents().filter(function(t){return 1===t.nodeType&&"none"===getComputedStyle(t,null).display&&t});if("none"===r.display&&a.add(e),0!==a.length){var l="visibility: hidden !important; display: block !important;",h=[];a.each(function(t){var e=new Dom(t),i=e.attr("style");null!==i&&h.push(i),e.attr("style",null!==i?i+";"+l:l)}),n=o.get()["offset"+s]-this._adjustResultHeightOrWidth(t,e,i),a.each(function(t,e){var i=new Dom(t);void 0===h[e]?i.removeAttr("style"):i.attr("style",h[e])})}else n=e["offset"+s]-this._adjustResultHeightOrWidth(t,e,i);return n},_adjustResultHeightOrWidth:function(t,e,i){if(!e||!1===i)return 0;var s=0,n=getComputedStyle(e,null),r="border-box"===n.boxSizing;return"height"===t?(("inner"===i||"normal"===i&&r)&&(s+=(parseFloat(n.borderTopWidth)||0)+(parseFloat(n.borderBottomWidth)||0)),"outer"===i&&(s-=(parseFloat(n.marginTop)||0)+(parseFloat(n.marginBottom)||0))):(("inner"===i||"normal"===i&&r)&&(s+=(parseFloat(n.borderLeftWidth)||0)+(parseFloat(n.borderRightWidth)||0)),"outer"===i&&(s-=(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0))),s},_getDim:function(t){var e=this.get();return 3===e.nodeType?{top:0,left:0}:this["_get"+t](e)},_getPosition:function(t){return{top:t.offsetTop,left:t.offsetLeft}},_getOffset:function(t){var e=t.getBoundingClientRect(),i=t.ownerDocument,s=i.documentElement,n=i.defaultView;return{top:e.top+n.pageYOffset-s.clientTop,left:e.left+n.pageXOffset-s.clientLeft}},_getSibling:function(e,i){var s,n=(e=e&&e.sdom?e.get():e)&&e.nodeType;return this.each(function(t){for(;t=t[i];)if(n&&t===e||new Dom(t).is(e))return void(s=t)}),new Dom(s)},_toArray:function(t){if(t instanceof NodeList){for(var e=[],i=0;i<t.length;i++)e[i]=t[i];return e}return void 0===t?[]:t.sdom?t.nodes:t},_toParams:function(t){var e="";for(var i in t)e+="&"+this._encodeUri(i)+"="+this._encodeUri(t[i]);return e.replace(/^&/,"")},_toObject:function(t){return new Function("return "+t)()},_encodeUri:function(t){return encodeURIComponent(t).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A").replace(/%20/g,"+")},_isNumber:function(t){return!isNaN(t)&&!isNaN(parseFloat(t))},_isObjectString:function(t){return-1!==t.search(/^{/)},_getBooleanFromStr:function(t){return"true"===t||"false"!==t&&t},_hasDisplayNone:function(t){return"none"===t.style.display||"none"===(t.currentStyle?t.currentStyle.display:getComputedStyle(t,null).display)}};var uuid=0,$R=function(t,e){return RedactorApp(t,e,[].slice.call(arguments,2))};$R.app=[],$R.version="3.4.6",$R.options={},$R.modules={},$R.services={},$R.classes={},$R.plugins={},$R.mixins={},$R.modals={},$R.lang={},$R.dom=function(t,e){return new Dom(t,e)},$R.ajax=Ajax,$R.Dom=Dom,$R.keycodes={BACKSPACE:8,DELETE:46,UP:38,DOWN:40,ENTER:13,SPACE:32,ESC:27,TAB:9,CTRL:17,META:91,SHIFT:16,ALT:18,RIGHT:39,LEFT:37},$R.env={plugin:"plugins",module:"modules",service:"services",class:"classes",mixin:"mixins"},void 0!==jQuery&&(jQuery.fn.redactor=function(t){return RedactorApp(this.toArray(),t,[].slice.call(arguments,1))});var RedactorApp=function(t,e,i){for(var s,n="redactor",r=Array.isArray(t)?t:t&&t.nodeType?[t]:document.querySelectorAll(t),o="string"==typeof e||"function"==typeof e,a=[],l=0;l<r.length;l++){var h=r[l],c=$R.dom(h);if((s=c.dataget(n))||o||(s=new App(h,e,uuid),c.dataset(n,s),$R.app[uuid]=s,uuid++),s&&o){var d,u="destroy"===e;void 0!==(d="function"==typeof(e=u?"stop":e)?e.apply(s,i):(i.unshift(e),s.api.apply(s,i)))&&a.push(d),u&&c.dataset(n,!1)}}return 0===a.length||1===a.length?0===a.length?s:a[0]:a};$R.add=function(t,e,i){if(void 0!==$R.env[t])if(i.translations&&($R.lang=$R.extend(!0,{},$R.lang,i.translations)),i.modals&&($R.modals=$R.extend(!0,{},$R.modals,i.modals)),"mixin"===t)$R[$R.env[t]][e]=i;else{function s(){}if((s.prototype=i).mixins)for(var n=0;n<i.mixins.length;n++)$R.inherit(s,$R.mixins[i.mixins[n]]);$R[$R.env[t]][e]=s}},$R.addLang=function(t,e){void 0===$R.lang[t]&&($R.lang[t]={}),$R.lang[t]=$R.extend($R.lang[t],e)},$R.create=function(t){var e=t.split("."),i=[].slice.call(arguments,1),s="classes";void 0!==$R.env[e[0]]&&(s=$R.env[e[0]],t=e.slice(1).join("."));var n=new $R[s][t];if(n.init){var r=n.init.apply(n,i);return r||n}return n},$R.inherit=function(t,e){function i(){}i.prototype=e;var s=new i;for(var n in t.prototype)t.prototype.__lookupGetter__(n)?s.__defineGetter__(n,t.prototype.__lookupGetter__(n)):s[n]=t.prototype[n];return t.prototype=s,t.prototype.super=e,t},$R.error=function(t){throw t},$R.extend=function(){var i={},s=!1,t=0,e=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(s=arguments[0],t++);function n(t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(s&&"[object Object]"===Object.prototype.toString.call(t[e])?i[e]=$R.extend(!0,i[e],t[e]):i[e]=t[e])}for(;t<e;t++){n(arguments[t])}return i},$R.opts={animation:!0,lang:"en",direction:"ltr",spellcheck:!0,structure:!1,scrollTarget:!1,styles:!0,stylesClass:"redactor-styles",placeholder:!1,source:!0,showSource:!1,inline:!1,breakline:!1,markup:"p",enterKey:!0,clickToEdit:!1,clickToSave:!1,clickToCancel:!1,focus:!1,focusEnd:!1,minHeight:!1,maxHeight:!1,maxWidth:!1,plugins:[],callbacks:{},preClass:!1,preSpaces:4,tabindex:!1,tabAsSpaces:!1,tabKey:!0,autosave:!1,autosaveName:!1,autosaveData:!1,toolbar:!0,toolbarFixed:!0,toolbarFixedTarget:document,toolbarFixedTopOffset:0,toolbarExternal:!1,toolbarContext:!0,air:!1,formatting:["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],formattingAdd:!1,formattingHide:!1,buttons:["html","format","bold","italic","deleted","lists","image","file","link"],buttonsTextLabeled:!1,buttonsAdd:[],buttonsAddFirst:[],buttonsAddAfter:!1,buttonsAddBefore:!1,buttonsHide:[],buttonsHideOnMobile:[],imageUpload:!1,imageUploadParam:"file",imageData:!1,imageEditable:!0,imageCaption:!0,imageLink:!0,imagePosition:!1,imageResizable:!1,imageFloatMargin:"10px",imageFigure:!0,imageObserve:!0,imageSrcData:!1,fileUpload:!1,fileUploadParam:"file",fileData:!1,fileAttachment:!1,uploadData:!1,dragUpload:!0,multipleUpload:!0,clipboardUpload:!0,uploadBase64:!1,linkTarget:!1,linkTitle:!1,linkNewTab:!0,linkNofollow:!1,linkSize:30,linkValidation:!0,cleanOnEnter:!0,cleanInlineOnEnter:!1,paragraphize:!0,removeScript:!0,removeNewLines:!1,removeComments:!0,replaceTags:{b:"strong",i:"em",strike:"del"},pastePlainText:!1,pasteLinkTarget:!1,pasteImages:!0,pasteLinks:!0,pasteClean:!0,pasteKeepStyle:[],pasteKeepClass:[],pasteKeepAttrs:["td","th"],pasteBlockTags:["pre","h1","h2","h3","h4","h5","h6","table","tbody","thead","tfoot","th","tr","td","ul","ol","li","blockquote","p","figure","figcaption"],pasteInlineTags:["a","img","br","strong","ins","code","del","span","samp","kbd","sup","sub","mark","var","cite","small","b","u","em","i","abbr"],activeButtons:{b:"bold",strong:"bold",i:"italic",em:"italic",del:"deleted",strike:"deleted",u:"underline"},activeButtonsAdd:{},activeButtonsObservers:{},autoparse:!0,autoparseStart:!0,autoparsePaste:!0,autoparseLinks:!0,autoparseImages:!0,autoparseVideo:!0,shortcodes:{"p.":{format:"p"},"quote.":{format:"blockquote"},"pre.":{format:"pre"},"h1.":{format:"h1"},"h2.":{format:"h2"},"h3.":{format:"h3"},"h4.":{format:"h4"},"h5.":{format:"h5"},"h6.":{format:"h6"},"*.":{format:"ul"}},shortcodesAdd:!1,shortcuts:{"ctrl+shift+m, meta+shift+m":{api:"module.inline.clearformat"},"ctrl+b, meta+b":{api:"module.inline.format",args:"b"},"ctrl+i, meta+i":{api:"module.inline.format",args:"i"},"ctrl+u, meta+u":{api:"module.inline.format",args:"u"},"ctrl+h, meta+h":{api:"module.inline.format",args:"sup"},"ctrl+l, meta+l":{api:"module.inline.format",args:"sub"},"ctrl+k, meta+k":{api:"module.link.open"},"ctrl+alt+0, meta+alt+0":{api:"module.block.format",args:"p"},"ctrl+alt+1, meta+alt+1":{api:"module.block.format",args:"h1"},"ctrl+alt+2, meta+alt+2":{api:"module.block.format",args:"h2"},"ctrl+alt+3, meta+alt+3":{api:"module.block.format",args:"h3"},"ctrl+alt+4, meta+alt+4":{api:"module.block.format",args:"h4"},"ctrl+alt+5, meta+alt+5":{api:"module.block.format",args:"h5"},"ctrl+alt+6, meta+alt+6":{api:"module.block.format",args:"h6"},"ctrl+shift+7, meta+shift+7":{api:"module.list.toggle",args:"ol"},"ctrl+shift+8, meta+shift+8":{api:"module.list.toggle",args:"ul"}},shortcutsAdd:!1,grammarly:!0,notranslate:!1,bufferLimit:100,emptyHtml:"<p></p>",markerChar:"\ufeff",imageTypes:["image/png","image/jpeg","image/gif"],imageAttrs:["alt","title","src","class","width","height","srcset"],inlineTags:["a","span","strong","strike","b","u","em","i","code","del","ins","samp","kbd","sup","sub","mark","var","cite","small","abbr"],blockTags:["pre","ul","ol","li","p","h1","h2","h3","h4","h5","h6","dl","dt","dd","div","table","tbody","thead","tfoot","tr","th","td","blockquote","output","figcaption","figure","address","section","header","footer","aside","article","iframe"],regex:{youtube:/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w-\s])([\w-]{11})(?=[^\w-]|$)(?![?=&+%\w.-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/gi,vimeo:/(http|https)?:\/\/(?:www.|player.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:\/[a-zA-Z0-9_-]+)?/gi,imageurl:/((https?|www)[^\s]+\.)(jpe?g|png|gif)(\?[^\s-]+)?/gi,url:/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/gi},input:!0,zindex:!1,modes:{inline:{pastePlainText:!0,pasteImages:!1,enterKey:!1,toolbar:!1,autoparse:!1,source:!1,showSource:!1,styles:!1,air:!1},original:{styles:!1}}},$R.lang.en={format:"Format",image:"Image",file:"File",link:"Link",bold:"Bold",italic:"Italic",deleted:"Strikethrough",underline:"Underline",superscript:"Superscript",subscript:"Subscript","bold-abbr":"B","italic-abbr":"I","deleted-abbr":"S","underline-abbr":"U","superscript-abbr":"Sup","subscript-abbr":"Sub",lists:"Lists","link-insert":"Insert Link","link-edit":"Edit Link","link-in-new-tab":"Open link in new tab",unlink:"Unlink",cancel:"Cancel",close:"Close",insert:"Insert",save:"Save",delete:"Delete",text:"Text",edit:"Edit",title:"Alt",paragraph:"Normal text",quote:"Quote",code:"Code",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",filename:"Name",optional:"optional",unorderedlist:"Unordered List",orderedlist:"Ordered List",outdent:"Outdent",indent:"Indent",horizontalrule:"Line",upload:"Upload","upload-label":"Drop files here or click to upload","accessibility-help-label":"Rich text editor",caption:"Caption",bulletslist:"Bullets",numberslist:"Numbers","image-position":"Position",none:"None",left:"Left",right:"Right",center:"Center",undo:"Undo",redo:"Redo"},$R.buttons={html:{title:"HTML",icon:!0,api:"module.source.toggle"},undo:{title:"## undo ##",icon:!0,api:"module.buffer.undo"},redo:{title:"## redo ##",icon:!0,api:"module.buffer.redo"},format:{title:"## format ##",icon:!0,dropdown:{p:{title:"## paragraph ##",api:"module.block.format",args:{tag:"p"}},blockquote:{title:"## quote ##",api:"module.block.format",args:{tag:"blockquote"}},pre:{title:"## code ##",api:"module.block.format",args:{tag:"pre"}},h1:{title:"## heading1 ##",api:"module.block.format",args:{tag:"h1"}},h2:{title:"## heading2 ##",api:"module.block.format",args:{tag:"h2"}},h3:{title:"## heading3 ##",api:"module.block.format",args:{tag:"h3"}},h4:{title:"## heading4 ##",api:"module.block.format",args:{tag:"h4"}},h5:{title:"## heading5 ##",api:"module.block.format",args:{tag:"h5"}},h6:{title:"## heading6 ##",api:"module.block.format",args:{tag:"h6"}}}},bold:{title:"## bold-abbr ##",icon:!0,tooltip:"## bold ##",api:"module.inline.format",args:{tag:"b"}},italic:{title:"## italic-abbr ##",icon:!0,tooltip:"## italic ##",api:"module.inline.format",args:{tag:"i"}},deleted:{title:"## deleted-abbr ##",icon:!0,tooltip:"## deleted ##",api:"module.inline.format",args:{tag:"del"}},underline:{title:"## underline-abbr ##",icon:!0,tooltip:"## underline ##",api:"module.inline.format",args:{tag:"u"}},sup:{title:"## superscript-abbr ##",icon:!0,tooltip:"## superscript ##",api:"module.inline.format",args:{tag:"sup"}},sub:{title:"## subscript-abbr ##",icon:!0,tooltip:"## subscript ##",api:"module.inline.format",args:{tag:"sub"}},lists:{title:"## lists ##",icon:!0,observe:"list",dropdown:{observe:"list",unorderedlist:{title:"• ## unorderedlist ##",api:"module.list.toggle",args:"ul"},orderedlist:{title:"1. ## orderedlist ##",api:"module.list.toggle",args:"ol"},outdent:{title:"< ## outdent ##",api:"module.list.outdent"},indent:{title:"> ## indent ##",api:"module.list.indent"}}},ul:{title:"• ## bulletslist ##",icon:!0,api:"module.list.toggle",observe:"list",args:"ul"},ol:{title:"1. ## numberslist ##",icon:!0,api:"module.list.toggle",observe:"list",args:"ol"},outdent:{title:"## outdent ##",icon:!0,api:"module.list.outdent",observe:"list"},indent:{title:"## indent ##",icon:!0,api:"module.list.indent",observe:"list"},image:{title:"## image ##",icon:!0,api:"module.image.open"},file:{title:"## file ##",icon:!0,api:"module.file.open"},link:{title:"## link ##",icon:!0,observe:"link",dropdown:{observe:"link",link:{title:"## link-insert ##",api:"module.link.open"},unlink:{title:"## unlink ##",api:"module.link.unlink"}}},line:{title:"## horizontalrule ##",icon:!0,api:"module.line.insert"}};var App=function(t,e,i){this.module={},this.plugin={},this.instances={},this.started=!1,this.stopped=!1,this.uuid=i,this.rootElement=t,this.rootOpts=e,this.dragInside=!1,this.dragComponentInside=!1,this.keycodes=$R.keycodes,this.namespace="redactor",this.$win=$R.dom(window),this.$doc=$R.dom(document),this.$body=$R.dom("body"),this.editorReadOnly=!1,this.opts=$R.create("service.options",e,t),this.lang=$R.create("service.lang",this),this.buildServices(),this.buildModules(),this.buildPlugins(),this.start()};App.prototype={start:function(){this.stopped=!1,this.broadcast("start"),this.broadcast("startcode"),this.opts.clickToEdit?this.broadcast("startclicktoedit"):(this.broadcast("enable"),this.opts.showSource&&this.broadcast("startcodeshow"),this.broadcast("enablefocus")),this.broadcast("started"),this.started=!0},stop:function(){this.started=!1,this.stopped=!0,this.broadcast("stop"),this.broadcast("disable"),this.broadcast("stopped")},isStarted:function(){return this.started},isStopped:function(){return this.stopped},buildServices:function(){var t=["options","lang"],e=["uuid","keycodes","opts","lang","$win","$doc","$body"],i=[];for(var s in $R.services)-1===t.indexOf(s)&&(this[s]=$R.create("service."+s,this),i.push(s),e.push(s));for(var n=0;n<i.length;n++)for(var r=i[n],o=0;o<e.length;o++){var a=e[o];r!==a&&(this[r][a]=this[a])}},buildModules:function(){for(var t in $R.modules)this.module[t]=$R.create("module."+t,this),this.instances[t]=this.module[t]},buildPlugins:function(){for(var t=this.opts.plugins,e=0;e<t.length;e++){var i=t[e];void 0!==$R.plugins[i]&&(this.plugin[i]=$R.create("plugin."+i,this),this.instances[i]=this.plugin[i])}},isDragInside:function(){return this.dragInside},setDragInside:function(t){this.dragInside=t},isDragComponentInside:function(){return this.dragComponentInside},setDragComponentInside:function(t){this.dragComponentInside=t},getDragComponentInside:function(){return this.dragComponentInside},isReadOnly:function(){return this.editorReadOnly},enableReadOnly:function(){this.editorReadOnly=!0,this.broadcast("enablereadonly"),this.component.clearActive(),this.toolbar.disableButtons()},disableReadOnly:function(){this.editorReadOnly=!1,this.broadcast("disablereadonly"),this.toolbar.enableButtons()},callMessageHandler:function(t,e,i){var s,n=e.split(".");if(1===n.length)"function"==typeof t["on"+e]&&(s=t["on"+e].apply(t,i));else{n[0]="on"+n[0];var r=this.utils.checkProperty(t,n);"function"==typeof r&&(s=r.apply(t,i))}return s},broadcast:function(t){var e,i=[].slice.call(arguments,1);for(var s in this.instances){var n=this.callMessageHandler(this.instances[s],t,i);void 0!==n&&(e=n)}var r=this.callback.trigger(t,i);return void 0!==e?e:r},on:function(t,e){this.callback.add(t,e)},off:function(t,e){this.callback.remove(t,e)},api:function(t){if((this.isStarted()||"start"===t)&&(!this.isReadOnly()||"disableReadOnly"===t)){this.broadcast("state");var e=[].slice.call(arguments,1),i=t.split("."),s=1===i.length,n="on"===i[0]||"off"===i[0],r=!n&&2===i.length,o="plugin"===i[0],a="module"===i[0];if(s){if("function"==typeof this[i[0]])return this.callInstanceMethod(this,i[0],e)}else{if(n)return"on"===i[0]?this.on(i[1],e[0]):this.off(i[1],e[0]||void 0);if(r){if(this.isInstanceExists(this,i[0]))return this.callInstanceMethod(this[i[0]],i[1],e);$R.error(new Error('Service "'+i[0]+'" not found'))}else if(o){if(this.isInstanceExists(this.plugin,i[1]))return this.callInstanceMethod(this.plugin[i[1]],i[2],e);$R.error(new Error('Plugin "'+i[1]+'" not found'))}else if(a){if(this.isInstanceExists(this.module,i[1]))return this.callInstanceMethod(this.module[i[1]],i[2],e);$R.error(new Error('Module "'+i[1]+'" not found'))}}}},isInstanceExists:function(t,e){return void 0!==t[e]},callInstanceMethod:function(t,e,i){if("function"==typeof t[e])return t[e].apply(t,i)}},$R.add("mixin","formatter",{buildArgs:function(t){this.args={class:t.class||!1,style:t.style||!1,attr:t.attr||!1},this.args.class||this.args.style||this.args.attr||(this.args=!1)},applyArgs:function(t,e){return t=this.args?this[this.type](this.args,!1,t,e):this._clearAll(t,e)},clearClass:function(t,e){this.selection.save();var i=e?$R.dom(e):this.getElements(t,!0);return i.removeAttr("class"),e=this._unwrapSpanWithoutAttr(i.getAll()),this.selection.restore(),e},clearStyle:function(t,e){this.selection.save();var i=e?$R.dom(e):this.getElements(t,!0);return i.removeAttr("style"),e=this._unwrapSpanWithoutAttr(i.getAll()),this.selection.restore(),e},clearAttr:function(t,e){this.selection.save();var i=e?$R.dom(e):this.getElements(t,!0);return this._removeAllAttr(i),e=this._unwrapSpanWithoutAttr(i.getAll()),this.selection.restore(),e},set:function(t,e,i,s){!1!==s&&this.selection.save();var n=i?$R.dom(i):this.getElements(e);return t.class&&(n.removeAttr("class"),n.addClass(t.class)),t.style&&(n.removeAttr("style"),n.css(t.style),n.each(function(t){var e=$R.dom(t);e.attr("data-redactor-style-cache",e.attr("style"))})),t.attr&&(this._removeAllAttr(n),n.attr(t.attr)),!1!==s&&this.selection.restore(),n.getAll()},toggle:function(t,e,i,s){!1!==s&&this.selection.save();var r,n=i?$R.dom(i):this.getElements(e);return t.class&&(n.toggleClass(t.class),n.each(function(t){""===t.className&&t.removeAttribute("class")})),t.style&&(r=t.style,n.each(function(t){var e=$R.dom(t);for(var i in r){var s=r[i],n=e.css(i);n=this.utils.isRgb(n)?this.utils.rgb2hex(n):n.replace(/"/g,""),s=this.utils.isRgb(s)?this.utils.rgb2hex(s):s.replace(/"/g,""),n=this.utils.hex2long(n),("string"==typeof(s=this.utils.hex2long(s))?s.toLowerCase():s)===("string"==typeof n?n.toLowerCase():n)?e.css(i,""):e.css(i,s)}this._convertStyleQuotes(e),this.utils.removeEmptyAttr(t,"style")?e.removeAttr("data-redactor-style-cache"):e.attr("data-redactor-style-cache",e.attr("style"))}.bind(this))),t.attr&&(r=t.attr,n.each(function(t){var e=$R.dom(t);for(var i in r)e.attr(i)?e.removeAttr(i):e.attr(i,r[i])})),!1!==s&&this.selection.restore(),n.getAll()},add:function(t,e,i,s){!1!==s&&this.selection.save();var n=i?$R.dom(i):this.getElements(e);if(t.class&&n.addClass(t.class),t.style){var r=t.style;n.each(function(t){var e=$R.dom(t);e.css(r),e.attr("data-redactor-style-cache",e.attr("style")),this._convertStyleQuotes(e)}.bind(this))}return t.attr&&n.attr(t.attr),!1!==s&&this.selection.restore(),n.getAll()},remove:function(t,e,i,s){!1!==s&&this.selection.save();var n=i?$R.dom(i):this.getElements(e);if(t.class&&(n.removeClass(t.class),n.each(function(t){""===t.className&&t.removeAttribute("class")})),t.style){var r=t.style;n.each(function(t){var e=$R.dom(t);e.css(r,""),this.utils.removeEmptyAttr(t,"style")?e.removeAttr("data-redactor-style-cache"):e.attr("data-redactor-style-cache",e.attr("style"))}.bind(this))}return t.attr&&n.removeAttr(t.attr),i=this._unwrapSpanWithoutAttr(n.getAll()),!1!==s&&this.selection.restore(),i},_removeAllAttr:function(t){t.each(function(t){for(var e=t.attributes.length;0<e--;){var i=t.attributes[e],s=i.name;"style"!==s&&"class"!==s&&t.removeAttributeNode(i)}})},_convertStyleQuotes:function(t){var e=t.attr("style");e&&t.attr("style",e.replace(/"/g,"'"))},_clearAll:function(t,e){!1!==e&&this.selection.save();for(var i=0;i<t.length;i++)for(var s=t[i];0<s.attributes.length;)s.removeAttribute(s.attributes[0].name);return t=this._unwrapSpanWithoutAttr(t),!1!==e&&this.selection.restore(),t},_unwrapSpanWithoutAttr:function(t){for(var e=[],i=0;i<t.length;i++){var s=t[i];s.attributes.length<=0&&3!==s.nodeType&&"SPAN"===s.tagName?$R.dom(s).unwrap():e.push(s)}return e}}),$R.add("mixin","dom",$R.Dom.prototype),$R.add("mixin","component",{get cmnt(){return!0}}),$R.add("service","options",{init:function(t,e){var i=$R.dom(e),s=$R.extend({},$R.opts,e?i.data():{},$R.options);return s=$R.extend(!0,s,t)}}),$R.add("service","lang",{init:function(t){this.app=t,this.opts=t.opts,this.vars=this._build(this.opts.lang)},rebuild:function(t){this.opts.lang=t,this.vars=this._build(t)},extend:function(t){this.vars=$R.extend(this.vars,t)},parse:function(t){if(void 0===t)return"";var e=t.match(/## (.*?) ##/g);if(e)for(var i=0;i<e.length;i++){var s=e[i].replace(/^##\s/g,"").replace(/\s##$/g,"");t=t.replace(e[i],this.get(s))}return t},get:function(t){var e="";return void 0!==this.vars[t]?e=this.vars[t]:"en"!==this.opts.lang&&void 0!==$R.lang.en[t]&&(e=$R.lang.en[t]),e},_build:function(t){var e=$R.lang.en;return"en"!==t&&(e=void 0!==$R.lang[t]?$R.lang[t]:e),e}}),$R.add("service","callback",{init:function(t){this.app=t,this.opts=t.opts,this.callbacks={},this.opts.callbacks&&this._set(this.opts.callbacks,"")},stop:function(){this.callbacks={}},add:function(t,e){this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e)},remove:function(t,e){if(void 0===e)delete this.callbacks[t];else{for(var i=0;i<this.callbacks[t].length;i++)this.callbacks[t].splice(i,1);0===Object.keys(this.callbacks[t]).length&&delete this.callbacks[t]}},trigger:function(t,e){var i=this._loop(t,e,this.callbacks);return void 0===i&&e&&!1!==e[0]?e[0]:i},_set:function(t,e){for(var i in t){var s=""===e?i:e+"."+i;"object"==typeof t[i]?this._set(t[i],s):(this.callbacks[s]=[],this.callbacks[s].push(t[i]))}},_loop:function(t,e,i){var s;for(var n in i)if(t===n)for(var r=0;r<i[n].length;r++)s=i[n][r].apply(this.app,e);return s}}),$R.add("service","animate",{init:function(t){this.animationOpt=t.opts.animation},start:function(t,e,i,s){var n={duration:!1,iterate:!1,delay:!1,timing:!1,prefix:"redactor-"};return n="function"==typeof i?n:$R.extend(n,i),s="function"==typeof i?i:s,new $R.AnimatePlay(t,e,n,s,this.animationOpt)},stop:function(t){this.$el=$R.dom(t),this.$el.removeClass("redactor-animated");var e=this.$el.attr("redactor-animate-effect");this.$el.removeClass(e),this.$el.removeAttr("redactor-animate-effect");var i=this.$el.attr("redactor-animate-hide");i&&this.$el.addClass(i).removeAttr("redactor-animate-hide"),this.$el.off("animationend webkitAnimationEnd")}}),$R.AnimatePlay=function(t,e,i,s,n){return this.hidableEffects=["fadeOut","flipOut","slideUp","zoomOut","slideOutUp","slideOutRight","slideOutLeft"],this.prefixes=["","-webkit-"],this.$el=$R.dom(t),this.$body=$R.dom("body"),this.callback=s,this.animation=n?e:this.buildAnimationOff(e),this.defaults=i,"slideUp"===this.animation&&this.$el.height(this.$el.height()),this.isInanimate()?this.inanimate():this.animate()},$R.AnimatePlay.prototype={buildAnimationOff:function(t){return this.isHidable(t)?"hide":"show"},buildHideClass:function(){return"redactor-animate-hide"},isInanimate:function(){return"show"===this.animation||"hide"===this.animation},isAnimated:function(){return this.$el.hasClass("redactor-animated")},isHidable:function(t){return-1!==this.hidableEffects.indexOf(t)},inanimate:function(){var t;return this.defaults.timing="linear","show"===this.animation?(t=this.buildHideClass(),this.$el.attr("redactor-animate-hide",t),this.$el.removeClass(t)):(t=this.$el.attr("redactor-animate-hide"),this.$el.addClass(t).removeAttr("redactor-animate-hide")),"function"==typeof this.callback&&this.callback(this),this},animate:function(){var t=this.defaults.delay?this.defaults.delay:0;return setTimeout(function(){if(this.$body.addClass("no-scroll-x"),this.$el.addClass("redactor-animated"),!this.$el.attr("redactor-animate-hide")){var t=this.buildHideClass();this.$el.attr("redactor-animate-hide",t),this.$el.removeClass(t)}this.$el.addClass(this.defaults.prefix+this.animation),this.$el.attr("redactor-animate-effect",this.defaults.prefix+this.animation),this.set(this.defaults.duration+"s",this.defaults.iterate,this.defaults.timing),this.complete()}.bind(this),1e3*t),this},set:function(t,e,i){for(var s=this.prefixes.length;s--;)!1===t&&""!==t||this.$el.css(this.prefixes[s]+"animation-duration",t),!1===e&&""!==e||this.$el.css(this.prefixes[s]+"animation-iteration-count",e),!1===i&&""!==i||this.$el.css(this.prefixes[s]+"animation-timing-function",i)},clean:function(){this.$body.removeClass("no-scroll-x"),this.$el.removeClass("redactor-animated"),this.$el.removeClass(this.defaults.prefix+this.animation),this.$el.removeAttr("redactor-animate-effect"),this.set("","","")},complete:function(){this.$el.one("animationend webkitAnimationEnd",function(){if(this.$el.hasClass(this.defaults.prefix+this.animation)&&this.clean(),this.isHidable(this.animation)){var t=this.$el.attr("redactor-animate-hide");this.$el.addClass(t).removeAttr("redactor-animate-hide")}"slideUp"===this.animation&&this.$el.height(""),"function"==typeof this.callback&&this.callback(this.$el)}.bind(this))}},$R.add("service","caret",{init:function(t){this.app=t},setStart:function(t){this._setCaret("Start",t)},setEnd:function(t){this._setCaret("End",t)},setBefore:function(t){this._setCaret("Before",t)},setAfter:function(t){this._setCaret("After",t)},isStart:function(t){return this._isStartOrEnd(t,"First")},isEnd:function(t){return this._isStartOrEnd(t,"Last")},setAtEnd:function(t){var e=this.inspector.parse(t).getTag(),i=document.createRange();if(this._isInPage(t)){if("a"===e){var s=this.utils.createInvisibleChar();$R.dom(t).after(s),i.selectNodeContents(s),i.collapse(!0)}else i.selectNodeContents(t),i.collapse(!1);this.selection.setRange(i)}},setAtStart:function(t){var e=document.createRange(),i=this.inspector.parse(t);if(this._isInPage(t)){if(e.setStart(t,0),e.collapse(!0),i.isInline()||this.utils.isEmpty(t)){var s=this.utils.createInvisibleChar();e.insertNode(s),e.selectNodeContents(s),e.collapse(!1)}this.selection.setRange(e)}},setAtBefore:function(t){var e=this.inspector.parse(t),i=document.createRange();if(this._isInPage(t)){if(i.setStartBefore(t),i.collapse(!0),e.isInline()){var s=this.utils.createInvisibleChar();t.parentNode.insertBefore(s,t),i.selectNodeContents(s),i.collapse(!1)}this.selection.setRange(i)}},setAtAfter:function(t){var e=document.createRange();if(this._isInPage(t)){e.setStartAfter(t),e.collapse(!0);var i=this.utils.createInvisibleChar();e.insertNode(i),e.selectNodeContents(i),e.collapse(!1),this.selection.setRange(e)}},setAtPrev:function(t){var e=t.previousSibling;(e=e&&(3===e.nodeType&&this._isEmptyTextNode(e)?e.previousElementSibling:e))&&this.setEnd(e)},setAtNext:function(t){var e=t.nextSibling;(e=e&&(3===e.nodeType&&this._isEmptyTextNode(e)?e.nextElementSibling:e))&&this.setStart(e)},_setCaret:function(t,e){var i=this.inspector.parse(e),s=i.getNode();s&&(this.component.clearActive(),this["_set"+t](s,i,i.getTag()))},_setStart:function(t,e,i){if(e.isText())return this.editor.focus(),this.setAtStart(t);if("ul"===i||"ol"===i){t=e.findFirstNode("li");var s=this.utils.getFirstElement(t),n=this.inspector.parse(s);if(s&&n.isComponent())return this.setStart(n.getComponent())}else if("dl"===i)t=e.findFirstNode("dt");else{if("br"===i||"hr"===i)return this.setBefore(t);if("td"===i||"th"===i){var r=e.getFirstElement(t);if(r)return this.setStart(r)}else{if("table"===i||"tr"===i)return this.setStart(e.findFirstNode("th, td"));if(e.isComponentType("code")&&!e.isFigcaption()){var o=e.findLastNode("pre, code");return this.editor.focus(),this.setAtStart(o)}if("figure"===i&&e.isComponentType("table")){var a=e.getTable(),l=this.inspector.parse(a);return this.setStart(l.findFirstNode("th, td"))}if(!e.isComponentType("table")&&e.isComponent()&&!e.isFigcaption())return this.component.setActive(t)}}this.editor.focus(),this._setInline(t,"Start")||this.setAtStart(t)},_setEnd:function(t,e,i){if(e.isText())return this.editor.focus(),this.setAtEnd(t);if("ul"===i||"ol"===i){t=e.findLastNode("li");var s=this.utils.getLastElement(t),n=this.inspector.parse(s);if(s&&n.isComponent())return this.setEnd(n.getComponent())}else if("dl"===i)t=e.findLastNode("dd");else{if("br"===i||"hr"===i)return this.setAfter(t);if("td"===i||"th"===i){var r=e.getLastElement();if(r)return this.setEnd(r)}else{if("table"===i||"tr"===i)return this.setEnd(e.findLastNode("th, td"));if(e.isComponentType("code")&&!e.isFigcaption()){var o=e.findLastNode("pre, code");return this.editor.focus(),this.setAtEnd(o)}if("figure"===i&&e.isComponentType("table")){var a=e.getTable(),l=this.inspector.parse(a);return this.setEnd(l.findLastNode("th, td"))}if(!e.isComponentType("table")&&e.isComponent()&&!e.isFigcaption())return this.component.setActive(t)}}if(this.editor.focus(),!this._setInline(t,"End")){if(this.utils.isEmpty(t))return this.setStart(t);this.setAtEnd(t)}},_setBefore:function(t,e,i){return 3===t.nodeType?this.setAtBefore(t):e.isInline()?this.setAtBefore(t):e.isFirstTableCell()?this.setAtPrev(e.getComponent()):"td"===i||"th"===i?this.setAtPrev(t):e.isFirstListItem()?this.setAtPrev(e.getList()):e.isFigcaption()?this.setStart(e.getComponent()):!e.isComponentType("table")&&e.isComponent()?this.setAtPrev(e.getComponent()):e.isBlock()?this.setAtPrev(t):(this.editor.focus(),void this.setAtBefore(t))},_setAfter:function(t,e,i){return 3===t.nodeType?this.setAtAfter(t):e.isInline()?this.setAtAfter(t):e.isLastTableCell()?this.setAtNext(e.getComponent()):"td"===i||"th"===i?this.setAtNext(t):e.isFirstListItem()?this.setAtNext(e.getList()):!e.isComponentType("table")&&e.isComponent()?this.setAtNext(e.getComponent()):e.isBlock()?this.setAtNext(t):(this.editor.focus(),void this.setAtAfter(t))},_setInline:function(t,e){var i=this._hasInlineChild(t,"Start"===e?"first":"last");if(i)return"Start"===e?this.setStart(i):this.setEnd(i),!0},_isStartOrEnd:function(t,e){var i=this.utils.getNode(t);if(!i)return!1;var s=this.inspector.parse(i);if((i=this._getStartEndNode(i,s,e))&&3!==i.nodeType&&"LI"!==i.tagName){var n=3===i.nodeType?i.textContent:i.innerHTML;if(""===(n=this.utils.trimSpaces(n)))return!0}if(!s.isFigcaption()&&s.isComponent()&&!s.isComponentEditable())return!0;var r=this.offset.get(i,!0);return!!r&&("First"===e?0===r.start:r.end===this.offset.size(i,!0))},_isInPage:function(t){return!(!t||!t.nodeType)&&(t!==document.body&&document.body.contains(t))},_hasInlineChild:function(t,e){var i=this.inspector.parse(t),s="first"===e?i.getFirstNode():i.getLastNode(),n=$R.dom(s);if(s&&3!==s.nodeType&&this.inspector.isInlineTag(s.tagName)&&!n.hasClass("redactor-component")&&!n.hasClass("non-editable"))return s},_isEmptyTextNode:function(t){var e=t.textContent.trim().replace(/\n/,"");return""===(e=this.utils.removeInvisibleChars(e))},_getStartEndNode:function(t,e,i){return e.isFigcaption()?t=e.getFigcaption():e.isTable()?t=e["find"+i+"Node"]("th, td"):e.isList()?t=e["find"+i+"Node"]("li"):e.isComponentType("code")&&(t=e.findLastNode("pre, code")),t}});var containsNode=function(t){return document.getSelection().containsNode(t,!0)},containsNodePolyfill=function(t){var e=document.getSelection(),i=e.anchorNode.parentNode,s=e.focusNode.parentNode,n=e.getRangeAt(0).getBoundingClientRect(),r=t.getBoundingClientRect();return!!$R.dom(i).closest(t).length||(!!$R.dom(s).closest(t).length||n.top<r.top&&n.height>r.height)};"containsNode"in Selection.prototype||(containsNode=containsNodePolyfill),$R.add("service","selection",{init:function(t){this.app=t},is:function(){var t=this.get();if(t){var e=t.anchorNode,i=this.inspector.parse(e);return i.isInEditor()||i.isEditor()}return!1},isCollapsed:function(){var t=this.get(),e=this.getRange();return!(!t||!t.isCollapsed)||!(!e||0!==e.toString().length)},isBackwards:function(){var t=!1,e=this.get();if(e&&!e.isCollapsed){var i=document.createRange();i.setStart(e.anchorNode,e.anchorOffset),i.setEnd(e.focusNode,e.focusOffset),t=i.collapsed,i.detach()}return t},isIn:function(t){var e=$R.dom(t).get(),i=this.getCurrent();return!(!i||!e)&&e.contains(i)},isText:function(){var t=this.get();if(t){var e=t.anchorNode,i=this.getBlock(e),s=this.getBlocks();if(i&&this.inspector.isTableCellTag(i.tagName)||!1===i&&0===s.length)return!0}return!1},isAll:function(t){var e=this.utils.getNode(t);if(!e)return!1;var i=this.editor.isEditor(e),s=this.inspector.parse(e);if(!s.isFigcaption()&&this.component.isNonEditable(e)&&this.component.isActive(e))return!0;if(i){var n=this.editor.getElement().html().replace(/<p><\/p>$/i,"");if(this.getHtml(!1).length!==n.length)return!1}if(i&&this.editor.isEmpty()||this.isCollapsed())return!1;var r=this.offset.get(e,!0),o=this.offset.size(e,!0);return!i&&s.isComponentType("code")&&(o=this.getText().trim().length),!(!r||0!==r.start||r.end!==o)},hasNonEditable:function(){var t=this.getHtml(),e=$R.dom("<div>").html(t);return!this.isCollapsed()&&0!==e.find(".non-editable").length},setRange:function(t){var e=window.getSelection();e.removeAllRanges(),e.addRange(t)},setAll:function(t){var e=this.utils.getNode(t);if(e){var i=this.inspector.parse(e);if(this.component.clearActive(),this.editor.focus(),this.editor.saveScroll(),this.editor.disableNonEditables(),e&&"TABLE"===e.tagName){var s=i.findFirstNode("td, th"),n=i.findLastNode("td, th");$R.dom(s).prepend(this.marker.build("start")),$R.dom(n).append(this.marker.build("end")),this.restoreMarkers()}else if(!i.isFigcaption()&&this.component.isNonEditable(e))this.component.setActive(e);else{i.isComponentType("code")&&(e=i.getComponentCodeElement()).focus();var r=document.createRange();r.selectNodeContents(e),this.setRange(r)}this.editor.enableNonEditables(),this.editor.restoreScroll()}},get:function(){var t=window.getSelection();return 0<t.rangeCount?t:null},getRange:function(){var t=this.get();return t&&t.getRangeAt(0)?t.getRangeAt(0):null},getTextBeforeCaret:function(t){t=void 0===t?1:t;var e=this.editor.getElement().get(),i=this.getRange(),s=!1;return i&&((i=i.cloneRange()).collapse(!0),i.setStart(e,0),s=i.toString().slice(-t)),s},getTextAfterCaret:function(t){t=void 0===t?1:t;var e=this.editor.getElement().get(),i=this.getRange(),s=!1;if(i){var n=i.cloneRange();n.selectNodeContents(e),n.setStart(i.endContainer,i.endOffset),s=n.toString().slice(0,t)}return s},getPosition:function(){var t=this.getRange(),e={top:0,left:0,width:0,height:0};if(window.getSelection&&t.getBoundingClientRect){var i=(t=t.cloneRange()).startOffset-1;t.setStart(t.startContainer,i<0?0:i);var s=t.getBoundingClientRect();e={top:s.top,left:s.left,width:s.right-s.left,height:s.bottom-s.top}}return e},getCurrent:function(){var t=!1,e=this.get(),i=this.component.getActive();if(i)t=i;else if(e&&this.is()){t=!this.inspector.parse(e.anchorNode).isEditor()&&e.anchorNode}return t},getParent:function(){var t=!1,e=this.getCurrent();if(e){var i=e.parentNode;t=!this.inspector.parse(i).isEditor()&&i}return t},getElement:function(t){for(var e=t||this.getCurrent();e;){var i=this.inspector.parse(e);if(i.isElement()&&i.isInEditor())return e;e=e.parentNode}return!1},getInline:function(t){for(var e=t||this.getCurrent(),i=!1;e;)this._isInlineNode(e)&&(i=e),e=e.parentNode;return i},getInlineFirst:function(t){for(var e=t||this.getCurrent();e;){if(this._isInlineNode(e))return e;e=e.parentNode}return!1},getInlineAll:function(t){for(var e=t||this.getCurrent(),i=[];e;)this._isInlineNode(e)&&i.push(e),e=e.parentNode;return i},getBlock:function(t){for(var e=t||this.getCurrent();e;){var i=this.inspector.parse(e);if(this.inspector.isBlockTag(e.tagName)&&i.isInEditor(e))return e;e=e.parentNode}return!1},getInlinesAllSelected:function(t){if(this.isAll())return[];var e=this.getInlines({all:!0}),i=this.getNodes({textnodes:!0,inline:!1}),s=this.getText().replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"),n=[];if(0!==i.length)return n;if(""===s)n=e;else if(1<e.length)for(var r=0;r<e.length;r++)this._isTextSelected(e[r],s)&&n.push(e[r]);else 1===e.length&&this._isTextSelected(e[0],s)&&(n=e);return n=t&&t.tags?this._filterNodesByTags(n,t.tags):n},getInlines:function(t){for(var e=this.getNodes(),i=[],s=0;s<e.length;s++){var n;if(t&&t.all)for(n=e[s];n;)this._isInlineNode(n)&&!this._isInNodesArray(i,n)&&i.push(n),n=n.parentNode;else(n=this.getInline(e[s]))&&!this._isInNodesArray(i,n)&&i.push(n)}return i=t&&t.tags?this._filterNodesByTags(i,t.tags):i,i=t&&t.inside?this._filterInlinesInside(i,t):i},getBlocks:function(t){var e=this.getNodes(),i=this.getBlock();e=0===e.length&&i?[i]:e;for(var s=[],n=0;n<e.length;n++){var r=this.getBlock(e[n]);$R.dom(r).hasClass("non-editable")||r&&!this._isInNodesArray(s,r)&&s.push(r)}return s=t&&t.tags?this._filterNodesByTags(s,t.tags):s,s=t&&t.first?this._filterBlocksFirst(s,t):s},getElements:function(t){var e=this.getNodes({textnodes:!1}),i=this.getBlock();e=0===e.length&&i?[i]:e;for(var s=[],n=0;n<e.length;n++)this._isInNodesArray(s,e[n])||s.push(e[n]);return s=t&&t.tags?this._filterNodesByTags(s,t.tags):s},getNodes:function(t){var e=[],i=this.component.getActive();if(i)e=this._getNodesComponent(i);else if(this.isCollapsed()){var s=this.getCurrent();e=s?[s]:[]}else this.is()&&!i&&(e=this._getRangeSelectedNodes());return e=this._filterServicesNodes(e),e=this._filterEditor(e),e=t&&t.tags?this._filterNodesByTags(e,t.tags):e,e=t&&t.textnodes?this._filterNodesTexts(e,t):e,e=t&&!t.textnodes?this._filterNodesElements(e):e},getText:function(){var t=this.get();return t?this.utils.removeInvisibleChars(t.toString()):""},getHtml:function(t){var e="",i=this.get();if(i){for(var s=document.createElement("div"),n=i.rangeCount,r=0;r<n;++r)s.appendChild(i.getRangeAt(r).cloneContents());e=s.innerHTML,e=(e=!1!==t?this.cleaner.output(e):e).replace(/<p><\/p>$/i,"")}return e},clear:function(){this.component.clearActive(),this.get().removeAllRanges()},collapseToStart:function(){var t=this.get();t&&!t.isCollapsed&&t.collapseToStart()},collapseToEnd:function(){var t=this.get();t&&!t.isCollapsed&&t.collapseToEnd()},saveActiveComponent:function(){var t=this.component.getActive();return!!t&&(this.savedComponent=t,!0)},restoreActiveComponent:function(){return!!this.savedComponent&&(this.component.setActive(this.savedComponent),!0)},save:function(){this._clearSaved();var t=this.getElement();!t||-1===["TD","TH","P","DIV","PRE","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE"].indexOf(t.tagName)||""!==t.innerHTML&&"<br>"!==t.innerHTML?this.saveActiveComponent()||(this.saved=this.offset.get()):this.savedElement=t},restore:function(){(this.saved||this.savedComponent||this.savedElement)&&(this.editor.saveScroll(),this.savedElement?this.caret.setStart(this.savedElement):this.restoreActiveComponent()||this.offset.set(this.saved),this._clearSaved(),this.editor.restoreScroll())},saveMarkers:function(){this._clearSaved(),this.saveActiveComponent()||this.marker.insert()},restoreMarkers:function(){this.editor.saveScroll(),this.restoreActiveComponent()||this.marker.restore(),this._clearSaved(),this.editor.restoreScroll()},_getNextNode:function(t){if(t.hasChildNodes())return t.firstChild;for(;t&&!t.nextSibling;)t=t.parentNode;return t?t.nextSibling:null},_getNodesComponent:function(t){var e=this.getCurrent(),i=this.inspector.parse(e);return i.isFigcaption()?[i.getFigcaption()]:[t]},_getRangeSelectedNodes:function(){var t=[],e=this.getRange(),i=e.startContainer,s=e.startContainer,n=e.endContainer,r=this.editor.getElement();if(s===r.get()&&this.isAll())t=this.utils.getChildNodes(r);else if(i===n)t=[i];else{for(;i&&i!==n;)t.push(i=this._getNextNode(i));for(i=e.startContainer;i&&i!==e.commonAncestorContainer;)t.unshift(i),i=i.parentNode}return t},_isInNodesArray:function(t,e){return-1!==t.indexOf(e)},_filterEditor:function(t){for(var e=[],i=0;i<t.length;i++){this.inspector.parse(t[i]).isInEditor()&&e.push(t[i])}return e},_filterServicesNodes:function(t){for(var e=[],i=0;i<t.length;i++){var s=$R.dom(t[i]),n=!1;t[i]&&3===t[i].nodeType&&this.utils.isEmpty(t[i])&&(n=!0),(s.hasClass("redactor-script-tag")||s.hasClass("redactor-component-caret")||s.hasClass("redactor-selection-marker")||s.hasClass("non-editable"))&&(n=!0),n||e.push(t[i])}return e},_filterNodesTexts:function(t,e){for(var i=[],s=0;s<t.length;s++){if(3===t[s].nodeType||e.keepbr&&"BR"===t[s].tagName)this.getInline(t[s])&&e&&!1===e.inline||i.push(t[s])}return i},_filterNodesElements:function(t){for(var e=[],i=0;i<t.length;i++)3!==t[i].nodeType&&e.push(t[i]);return e},_filterNodesByTags:function(t,e,i){for(var s=[],n=0;n<t.length;n++)if(i&&3===t[n].nodeType)s.push(t[n]);else if(3!==t[n].nodeType){var r=t[n].tagName.toLowerCase();-1!==e.indexOf(r.toLowerCase())&&s.push(t[n])}return s},_filterBlocksFirst:function(t){for(var e=[],i=0;i<t.length;i++){var s=$R.dom(t[i]),n=s.parent().get(),r=s.parent().hasClass("redactor-in"),o=n&&("TD"===n.tagName||"TH"===n.tagName);(r||o)&&e.push(t[i])}return e},_filterInlinesInside:function(t){for(var e=[],i=0;i<t.length;i++)containsNode(t[i],!0)&&e.push(t[i]);return e},_isTextSelected:function(t,e){var i=this.utils.removeInvisibleChars(t.textContent);return e===i||-1!==i.search(e)||-1!==e.search(new RegExp("^"+this.utils.escapeRegExp(i)))||-1!==e.search(new RegExp(this.utils.escapeRegExp(i)+"$"))},_isInlineNode:function(t){var e=this.inspector.parse(t);return this.inspector.isInlineTag(t.tagName)&&e.isInEditor()},_clearSaved:function(){this.saved=!1,this.savedComponent=!1,this.savedElement=!1}}),$R.add("service","element",{init:function(t){this.app=t,this.rootElement=t.rootElement,this.$element={},this.type="inline"},start:function(){this._build(),this._buildType()},isType:function(t){return t===this.type},getType:function(){return this.type},getElement:function(){return this.$element},_build:function(){this.$element=$R.dom(this.rootElement)},_buildType:function(){var t=this.$element.get().tagName;this.type="TEXTAREA"===t?"textarea":this.type,this.type="DIV"===t?"div":this.type,this.type=this.opts.inline?"inline":this.type}}),$R.add("service","editor",{init:function(t){this.app=t,this.scrolltop=!1,this.pasting=!1},start:function(){this._build()},focus:function(){this.isFocus()||this._isContenteditableFocus()||(this.saveScroll(),this.$editor.focus(),this.restoreScroll())},startFocus:function(){this.caret.setStart(this.getFirstNode())},endFocus:function(){this.caret.setEnd(this.getLastNode())},isPasting:function(){return this.pasting},enablePasting:function(){this.pasting=!0},disablePasting:function(){this.pasting=!1},saveScroll:function(){this.scrolltop=this._getScrollTarget().scrollTop(),this.opts.maxHeight&&(this.scrolltopin=this.$editor.scrollTop())},restoreScroll:function(){!1!==this.scrolltop&&(this._getScrollTarget().scrollTop(this.scrolltop),this.scrolltop=!1),this.scrolltopin&&(this.$editor.scrollTop(this.scrolltopin),this.scrolltopin=!1)},disableNonEditables:function(){this.$noneditables=this.$editor.find("[contenteditable=false]"),this.$noneditables.attr("contenteditable",!0)},enableNonEditables:function(){this.$noneditables&&setTimeout(function(){this.$noneditables.attr("contenteditable",!1)}.bind(this),1)},getFirstNode:function(){return this.$editor.contents()[0]},getLastNode:function(){var t=this.$editor.contents();return t[t.length-1]},isSourceMode:function(){return this.source.getElement().hasClass("redactor-source-open")},isEditor:function(t){return $R.dom(t).get()===this.$editor.get()},isEmpty:function(t){return this.utils.isEmptyHtml(this.$editor.html(),!1,t)},isFocus:function(){var t=$R.dom(document.activeElement);return 0!==this.$editor.find(".redactor-component-active").length||0!==t.closest(".redactor-in-"+this.uuid).length},setEmpty:function(){this.$editor.html(this.opts.emptyHtml)},getElement:function(){return this.$editor},_build:function(){var t=this.element.getElement(),e=this.element.isType("textarea")?"<div>":t.get();this.$editor=$R.dom(e)},_getScrollTarget:function(){var t=this.$doc;return t=this.opts.toolbarFixedTarget!==document?$R.dom(this.opts.toolbarFixedTarget):this.opts.scrollTarget?$R.dom(this.opts.scrollTarget):t},_isContenteditableFocus:function(){var t=this.selection.getBlock();return 0!==(t?$R.dom(t).closest("[contenteditable=true]").not(".redactor-in"):[]).length}}),$R.add("service","container",{init:function(t){this.app=t},start:function(){this._build()},getElement:function(){return this.$container},_build:function(){var t=this.element.isType("inline")?"<span>":"<div>";this.$container=$R.dom(t)}}),$R.add("service","source",{init:function(t){this.app=t,this.$source={},this.content=""},start:function(){this._build(),this._buildName(),this._buildStartedContent()},getElement:function(){return this.$source},getCode:function(){return this.$source.val()},getName:function(){return this.$source.attr("name")},getStartedContent:function(){return this.content},setCode:function(t){return this.insertion.set(t,!0,!1)},isNameGenerated:function(){return this.name},rebuildStartedContent:function(){this._buildStartedContent()},_build:function(){var t=this.element.getElement(),e=this.element.isType("textarea")?t.get():"<textarea>";this.$source=$R.dom(e)},_buildName:function(){var t=this.element.getElement();this.name=t.attr("name"),this.$source.attr("name",this.name?this.name:"content-"+this.uuid)},_buildStartedContent:function(){var t=this.element.getElement(),e=this.element.isType("textarea")?t.val():t.html();this.content=e.trim()}}),$R.add("service","statusbar",{init:function(t){this.app=t,this.$statusbar={},this.items=[]},start:function(){this.$statusbar=$R.dom("<ul>"),this.$statusbar.attr("dir",this.opts.direction)},add:function(t,e){return this.update(t,e)},update:function(t,e){var i;return void 0!==this.items[t]?i=this.items[t]:(i=$R.dom("<li>"),this.$statusbar.append(i),this.items[t]=i),i.html(e)},get:function(t){return!!this.items[t]&&this.items[t]},remove:function(t){this.items[t]&&(this.items[t].remove(),delete this.items[t])},getItems:function(){return this.items},removeItems:function(){this.items={},this.$statusbar.html("")},getElement:function(){return this.$statusbar}}),$R.add("service","toolbar",{init:function(t){this.app=t,this.buttons=[],this.dropdownOpened=!1,this.buttonsObservers={}},start:function(){this.is()&&(this.opts.activeButtons=this.opts.activeButtonsAdd?this._extendActiveButtons():this.opts.activeButtons,this.create())},stopObservers:function(){this.buttonsObservers={}},create:function(){this.$wrapper=$R.dom("<div>"),this.$toolbar=$R.dom("<div>")},observe:function(){if(this.is()){var t,e;for(var i in this.setButtonsInactive(),this.buttonsObservers)e=this.buttonsObservers[i],t=this.getButton(i),this.app.broadcast("button."+e+".observe",t);var s=this.opts.activeButtons,n=this.selection.getInlinesAllSelected(),r=this.selection.getInline();this.selection.isCollapsed()&&r&&n.push(r);var o=this._inlinesToTags(n);for(var a in s)-1!==o.indexOf(a)&&(t=this.getButton(s[a]))&&t.setActive()}},is:function(){return!(!this.opts.toolbar||this.detector.isMobile()&&this.opts.air)},isAir:function(){return!!this.is()&&this.$toolbar.hasClass("redactor-air")},isFixed:function(){return!!this.is()&&this.$toolbar.hasClass("redactor-toolbar-fixed")},isContextBar:function(){return this.$body.find("#redactor-context-toolbar-"+this.uuid).hasClass("open")},isTarget:function(){return this.opts.toolbarFixedTarget!==document},getElement:function(){return this.$toolbar},getWrapper:function(){return this.$wrapper},getDropdown:function(){return this.dropdownOpened},getTargetElement:function(){return $R.dom(this.opts.toolbarFixedTarget)},getButton:function(t){var e=this._findButton(".re-"+t);return 0!==e.length&&e.dataget("data-button-instance")},getButtons:function(){var i=[];return this._findButtons().each(function(t){var e=$R.dom(t);i.push(e.dataget("data-button-instance"))}),i},getButtonsKeys:function(){var i=[];return this._findButtons().each(function(t){var e=$R.dom(t);i.push(e.attr("data-re-name"))}),i},addButton:function(t,e,i,s,n){i=i||"end";var r=$R.create("toolbar.button",this.app,t,e);if(e.observe&&(this.opts.activeButtonsObservers[t]={observe:e.observe,button:r}),this.is())if("first"===i)this.$toolbar.prepend(r);else if("after"===i)s.after(r);else if("before"===i)s.before(r);else{var o=this.opts.buttons.indexOf(t);if(!0!==n&&-1!==o)if(0===o)this.$toolbar.prepend(r);else this._findButtons().eq(o-1).after(r);else this.$toolbar.append(r)}return r},addButtonFirst:function(t,e){return this.addButton(t,e,"first")},addButtonAfter:function(t,e,i){var s=this.getButton(t);return s?this.addButton(e,i,"after",s):this.addButton(e,i)},addButtonBefore:function(t,e,i){var s=this.getButton(t);return s?this.addButton(e,i,"before",s):this.addButton(e,i)},addButtonObserver:function(t,e){this.buttonsObservers[t]=e},setButtons:function(t){this.buttons=t},setDropdown:function(t){this.dropdownOpened=t},setButtonsInactive:function(){for(var t=this.getButtons(),e=0;e<t.length;e++)t[e].setInactive()},setButtonsActive:function(){for(var t=this.getButtons(),e=0;e<t.length;e++)t[e].setActive()},disableButtons:function(){for(var t=this.getButtons(),e=0;e<t.length;e++)t[e].disable()},enableButtons:function(){for(var t=this.getButtons(),e=0;e<t.length;e++)t[e].enable()},_findButton:function(t){return this.is()?this.$toolbar.find(t):$R.dom()},_findButtons:function(){return this.is()?this.$toolbar.find(".re-button"):$R.dom()},_extendActiveButtons:function(){return $R.extend({},this.opts.activeButtons,this.opts.activeButtonsAdd)},_inlinesToTags:function(t){for(var e=[],i=0;i<t.length;i++)e.push(t[i].tagName.toLowerCase());return e}}),$R.add("class","toolbar.button",{mixins:["dom"],init:function(t,e,i){this.app=t,this.opts=t.opts,this.lang=t.lang,this.$body=t.$body,this.toolbar=t.toolbar,this.detector=t.detector,this.obj=i,this.name=e,this.dropdown=!1,this.tooltip=!1,this._init()},isActive:function(){return this.hasClass("redactor-button-active")},isDisabled:function(){return this.hasClass("redactor-button-disabled")},hasIcon:function(){return this.obj.icon&&!this.opts.buttonsTextLabeled},setDropdown:function(t){this.obj.dropdown=t,this.obj.message=!1,this.dropdown=$R.create("toolbar.dropdown",this.app,this.name,this.obj.dropdown),this.attr("data-dropdown",!0)},setMessage:function(t,e){this.obj.message=t,this.obj.args=e,this.obj.dropdown=!1},setApi:function(t,e){this.obj.api=t,this.obj.args=e,this.obj.dropdown=!1},setTitle:function(t){this.obj.title=this.lang.parse(t),this.obj.tooltip=this.obj.title,this.attr({alt:this.obj.tooltip,"aria-label":this.obj.tooltip}),this.attr("data-re-icon")||this.html(this.obj.title)},setTooltip:function(t){this.obj.tooltip=this.lang.parse(t),this.attr({alt:this.obj.tooltip,"aria-label":this.obj.tooltip})},setIcon:function(t){this.opts.buttonsTextLabeled||(this.obj.icon=!0,this.$icon=$R.dom(t),this.html(""),this.append(this.$icon),this.attr("data-re-icon",!0),this.addClass("re-button-icon"),this.setTooltip(this.obj.title),this._buildTooltip())},setActive:function(){this.addClass("redactor-button-active")},setInactive:function(){this.removeClass("redactor-button-active")},hideTooltip:function(){this.$body.find(".re-button-tooltip").remove()},getDropdown:function(){return this.dropdown},disable:function(){this.addClass("redactor-button-disabled")},enable:function(){this.removeClass("redactor-button-disabled")},toggle:function(t){t&&t.preventDefault(),this.isDisabled()||(this.obj.dropdown?this.dropdown.toggle(t):this.obj.api?this.app.api(this.obj.api,this.obj.args,this.name):this.obj.message&&this.app.broadcast(this.obj.message,this.obj.args,this.name),this.hideTooltip())},_init:function(){this._parseTitle(),this._parseTooltip(),this._build(),this._buildCallback(),this._buildAttributes(),this._buildObserver(),this.hasIcon()?(this._buildIcon(),this._buildTooltip()):this.html(this.obj.title)},_parseTooltip:function(){this.obj.tooltip=this.obj.tooltip?this.lang.parse(this.obj.tooltip):this.obj.title},_parseTitle:function(){this.obj.title=this.lang.parse(this.obj.title)},_build:function(){this.parse("<a>"),this.addClass("re-button re-"+this.name),this.attr("data-re-name",this.name),this.dataset("data-button-instance",this),this.obj.dropdown&&this.setDropdown(this.obj.dropdown)},_buildCallback:function(){this.on("click",this.toggle.bind(this))},_buildAttributes:function(){var t={href:"#",alt:this.obj.tooltip,rel:this.name,role:"button","aria-label":this.obj.tooltip,tabindex:"-1"};this.attr(t)},_buildObserver:function(){void 0!==this.obj.observe&&this.toolbar.addButtonObserver(this.name,this.obj.observe)},_buildIcon:function(){var t=this.obj.icon,e=/(<([^>]+)>)/gi.test(t);this.$icon=e?$R.dom(t):$R.dom("<i>"),e||this.$icon.addClass("re-icon-"+this.name),this.append(this.$icon),this.attr("data-re-icon",!0),this.addClass("re-button-icon")},_buildTooltip:function(){this.detector.isDesktop()&&(this.tooltip=$R.create("toolbar.button.tooltip",this.app,this))}}),$R.add("class","toolbar.button.tooltip",{mixins:["dom"],init:function(t,e){this.app=t,this.uuid=t.uuid,this.opts=t.opts,this.$body=t.$body,this.toolbar=t.toolbar,this.$button=e,this.created=!1,this._init()},open:function(){if(!this.$button.hasClass("redactor-button-disabled")&&!this.$button.hasClass("redactor-button-active")){this.created=!0,this.parse("<span>"),this.addClass("re-button-tooltip re-button-tooltip-"+this.uuid),this.$body.append(this),this.html(this.$button.attr("alt"));var t=this.$button.offset(),e=this.$button.height(),i=this.$button.width();this.css({top:t.top+e+4+"px",left:t.left+i/2-this.width()/2+"px",position:"absolute"}),this.show()}},close:function(){this.created&&!this.$button.hasClass("redactor-button-disabled")&&(this.remove(),this.created=!1)},_init:function(){this.$button.on("mouseover",this.open.bind(this)),this.$button.on("mouseout",this.close.bind(this))}}),$R.add("class","toolbar.dropdown",{mixins:["dom"],init:function(t,e,i){this.app=t,this.uuid=t.uuid,this.opts=t.opts,this.$win=t.$win,this.$doc=t.$doc,this.$body=t.$body,this.animate=t.animate,this.toolbar=t.toolbar,this.name=e,this.started=!1,this.items="format"===e?$R.extend({},!0,i):i,this.$items=[]},toggle:function(t){this.started||this._build(),this.isOpened()&&this.isActive()?this.close(!1):this.open(t)},isOpened:function(){var t=this.$body.find(".redactor-dropdown-"+this.uuid+".open");return 0!==t.length&&t.attr("data-re-name")===this.name},isActive:function(){return 0!==this.$body.find("#redactor-dropdown-"+this.uuid+"-"+this.name+".open").length},getName:function(){return this.attr("data-re-name")},getItem:function(t){return this.$items[t]},getItemsByClass:function(t){var e=[];for(var i in this.$items){var s=this.$items[i];"object"==typeof s&&s.attr("data-re-name")&&s.hasClass(t)&&e.push(s)}return e},open:function(t){this._closeAll(),this.$btn=this.toolbar.getButton(this.name),this.app.broadcast("dropdown.open",t,this,this.$btn),this.toolbar.setDropdown(this),this.show(),this.removeClass("redactor-animate-hide"),this.addClass("open"),this._observe(),this.$btn.hideTooltip(),this.$btn.setActive(),this.$doc.on("keyup.redactor.dropdown-"+this.uuid,this._handleKeyboard.bind(this)),this.$doc.on("click.redactor.dropdown-"+this.uuid,this.close.bind(this)),this.updatePosition(),this.app.broadcast("dropdown.opened",t,this,this.$btn)},close:function(t,e){if(t){var i=$R.dom(t.target);if(this._isButton(t)||i.hasClass("redactor-dropdown-not-close")||i.hasClass("redactor-dropdown-item-disabled"))return void t.preventDefault()}this.app.broadcast("dropdown.close",this,this.$btn),this.toolbar.setDropdown(!1),this.$btn.setInactive(),!1===e?this._close():this.animate.start(this,"fadeOut",this._close.bind(this))},updatePosition:function(){this.toolbar.isFixed(),this.toolbar.isTarget();var t=this.$btn.height(),e=this.$btn.width(),i=this.$btn.offset(),s=i.left+0,n=parseFloat(this.css("width")),r=s-(this.$win.width()<s+n?n-e:0),o=i.top+t+2;r=r<0?4:r,this.css({maxHeight:"",position:"absolute",top:o+"px",left:r+"px"});var a=this.$win.height()-(o-this.$doc.scrollTop())-10;this.css("max-height",a+"px")},_build:function(){this.parse("<div>"),this.attr("dir",this.opts.direction),this.attr("id","redactor-dropdown-"+this.uuid+"-"+this.name),this.attr("data-re-name",this.name),this.addClass("redactor-dropdown redactor-dropdown-"+this.uuid+" redactor-dropdown-"+this.name),this.dataset("data-dropdown-instance",this),this.items.sdom||"string"==typeof this.items?this._buildDom():this._buildItems(),this.$body.append(this),this.started=!0},_buildDom:function(){this.html("").append($R.dom(this.items))},_buildItems:function(){for(var t in this.items="format"===this.name?this._buildFormattingItems():this.items,this.items){var e=this.items[t];if("observe"===t)this.attr("data-observe",this.items[t]);else{var i=$R.create("toolbar.dropdown.item",this.app,t,e,this);this.$items[t]=i,this.append(i)}}},_buildFormattingItems:function(){for(var t in this.items)-1===this.opts.formatting.indexOf(t)&&delete this.items[t];if(this.opts.formattingHide)for(var t in this.items)-1!==this.opts.formattingHide.indexOf(t)&&delete this.items[t];if(this.opts.formattingAdd)for(var t in this.opts.formattingAdd)this.items[t]=this.opts.formattingAdd[t];return this.items},_handleKeyboard:function(t){27===t.which&&this.close()},_isButton:function(t){return $R.dom(t.target).closest(".re-button").get()===this.$btn.get()},_close:function(){this.$btn.setInactive(),this.$doc.off(".redactor.dropdown-"+this.uuid),this.removeClass("open"),this.addClass("redactor-animate-hide"),this.app.broadcast("dropdown.closed",this,this.$btn)},_closeAll:function(){this.$body.find(".redactor-dropdown-"+this.uuid+".open").each(function(t){$R.dom(t).dataget("data-dropdown-instance")._close()})},_observe:function(){var t=this.attr("data-observe");t&&this.app.broadcast("dropdown."+t+".observe",this)}}),$R.add("class","toolbar.dropdown.item",{mixins:["dom"],init:function(t,e,i,s){this.app=t,this.lang=t.lang,this.dropdown=s,this.name=e,this.obj=i,this._init()},setTitle:function(t){this.$span.html(t)},getTitle:function(){return this.$span.html()},enable:function(){this.removeClass("redactor-dropdown-item-disabled")},disable:function(){this.addClass("redactor-dropdown-item-disabled")},toggle:function(t){t&&t.preventDefault(),this.hasClass("redactor-dropdown-item-disabled")||(this.obj.message?this.app.broadcast(this.obj.message,this.obj.args,this.name):this.obj.api&&this.app.api(this.obj.api,this.obj.args,this.name))},_init:function(){this.parse("<a>"),this.attr("href","#"),this.addClass("redactor-dropdown-item-"+this.name),this.obj.classname&&this.addClass(this.obj.classname),this.attr("data-re-name",this.name),this.on("click",this.toggle.bind(this)),this.$span=$R.dom("<span>"),this.append(this.$span),this.setTitle(this.lang.parse(this.obj.title))}}),$R.add("service","cleaner",{init:function(t){this.app=t,this.opts=t.opts,this.storedComponents=[],this.storedComments=[],this.storedImages=[],this.storedLinks=[],this.deniedTags=["font","html","head","link","title","body","meta","applet"],this.convertRules={},this.unconvertRules={},this.reComments=/<!--[\s\S]*?-->\n?/g,this.reSpacedEmpty=/^(||\s||<br\s?\/?>|| )$/i,this.reScriptTag=/<script(.*?[^>]?)>([\w\W]*?)<\/script>/gi},addConvertRules:function(t,e){this.convertRules[t]=e},addUnconvertRules:function(t,e){this.unconvertRules[t]=e},input:function(t,e,i){var s=[];t=this.storeComments(t,s),t=this.encodeCode(t);var n=this.utils.buildWrapper(t);n.find("a, b, i, img, svg, details").removeAttr("onload onerror ontoggle onwheel onmouseover oncopy"),n.find("a").each(function(t){var e=$R.dom(t),i=e.attr("href");i&&-1!==i.search(/^data|javascript:/i)&&e.attr("href","")});var r=["alt","title","src","class","width","height","srcset","style","usemap"];return n.find("img").each(function(t){if(0<t.attributes.length)for(var e=t.attributes,i=e.length-1;0<=i;i--){var s=-1===e[i].name.search(/^data-/)&&-1===r.indexOf(e[i].name),n="src"===e[i].name&&-1!==e[i].value.search(/^data|javascript:/i);this.opts.imageSrcData&&(n=!1),(s||n)&&t.removeAttribute(e[i].name)}}.bind(this)),t=(t=(t=this.utils.getWrapperHtml(n)).replace(/\$/g,"$")).replace(/&/g,"&"),t=$R.create("cleaner.figure",this.app).convert(t,this.convertRules),t=this.storeComponents(t),t=this.replaceTags(t,this.opts.replaceTags),t=this._setSpanAttr(t),t=this._setStyleCache(t),t=this.removeTags(t,this.deniedTags),t=this.opts.removeScript?this._removeScriptTag(t):this._replaceScriptTag(t),t=this.opts.removeComments?this.removeComments(t):t,t=this._isSpacedEmpty(t)?this.opts.emptyHtml:t,t=this.restoreComponents(t),t=this._cleanWrapped(t),t=this.restoreComments(t,s),t=e?this.paragraphize(t):t},output:function(t,e){return t=this.removeInvisibleSpaces(t),this.opts.breakline&&(t=(t=t.replace(/<\/(span|strong|b|i|em)><br\s?\/?><\/div>/gi,"</$1></div>")).replace(/<br\s?\/?><\/(span|strong|b|i|em)><\/div>/gi,"</$1></div>")),t=t.replace(/$/g,"$"),this._isSpacedEmpty(t)?"":this._isParagraphEmpty(t)?"":(t=this.removeServiceTagsAndAttrs(t,e),t=this.storeComponents(t),t=this.removeSpanWithoutAttributes(t),t=this.removeFirstBlockBreaklineInHtml(t),t=this.opts.removeScript?t:this._unreplaceScriptTag(t),t=this.opts.preClass?this._setPreClass(t):t,t=this.opts.linkNofollow?this._setLinkNofollow(t):t,t=this.opts.removeNewLines?this.cleanNewLines(t):t,t=this.restoreComponents(t),t=$R.create("cleaner.figure",this.app).unconvert(t,this.unconvertRules),t=this.removeEmptyAttributes(t,["style","class","rel","alt","title"]),t=this.cleanSpacesInPre(t),t=(t=this.tidy(t)).replace(/&/g,"&"),this.opts.breakline&&(t=(t=t.replace(/<br\s?\/?>/gi,"<br>\n")).replace(/<br\s?\/?>\n+/gi,"<br>\n")),t=""===t.replace(/\n/g,"")?"":t)},paste:function(t){t=(t=this.storeComponents(t)).replace(/<!--[\s\S]*?-->/g,"");var e=this.deniedTags.concat(["iframe"]);t=(t=(t=(t=this.removeTags(t,e)).replace(new RegExp("<!doctype([\\s\\S]+?)>","gi"),"")).replace(new RegExp("<style([\\s\\S]+?)</style>","gi"),"")).replace(new RegExp("</p><br /><p","gi"),"</p><p");var i=this._isHtmlMsWord(t);if(t=this._cleanGDocs(t),t=i?this._cleanMsWord(t):t,!this.opts.pasteClean)return t=this.restoreComponents(t);if(this.opts.pastePlainText)return t=this.restoreComponents(t),this.pastePlainText(t);(n=this.utils.buildWrapper(t)).find("*").removeAttr("style"),n.find("[data-redactor-tag]").each(function(t){var e=$R.dom(t);e.removeAttr("data-redactor-tag"),this.utils.isEmptyHtml(e.html())?e.html("<br>").unwrap():t.lastChild&&"BR"===t.lastChild.tagName?e.unwrap():e.append("<br>").unwrap()}.bind(this)),t=(t=(t=this.utils.getWrapperHtml(n)).replace(/<br\s?\/?>$/,"")).replace(/<br\s?\/?><\/(td|th)>/,"</$1>");var s=this.opts.pasteBlockTags.concat(this.opts.pasteInlineTags);t=this.removeTagsExcept(t,s),t=this.opts.pasteLinks?t:this.removeTags(t,["a"]),t=this.opts.pasteImages?t:this.removeTags(t,["img"]);var n,r=(n=this.utils.buildWrapper(t)).find("*"),o=0!==this.opts.pasteKeepStyle.length?","+this.opts.pasteKeepStyle.join(","):"";r.not("[data-redactor-style-cache]"+o).removeAttr("style");var a=0!==this.opts.pasteKeepClass.length?","+this.opts.pasteKeepClass.join(","):"";r.not("[data-redactor-style-cache], span.redactor-component"+a).removeAttr("class");var l=0!==this.opts.pasteKeepAttrs.length?","+this.opts.pasteKeepAttrs.join(","):"";r.not("img, a, span.redactor-component, [data-redactor-style-cache]"+l).each(function(t){for(var e=t.attributes,i=e.length-1;0<=i;i--)"class"!==t.attributes[i].name&&"dir"!==t.attributes[i].name&&t.removeAttribute(e[i].name)}),this.opts.pasteLinks&&!1!==this.opts.pasteLinkTarget&&n.find("a").attr("target",this.opts.pasteLinkTarget),n.find("[data-redactor-style-cache]").each(function(t){var e=t.getAttribute("data-redactor-style-cache");t.setAttribute("style",e)});var h=this.opts.imageAttrs;return n.find("img").each(function(t){if(0<t.attributes.length)for(var e=t.attributes,i=e.length-1;0<=i;i--)-1===h.indexOf(e[i].name)&&t.removeAttribute(e[i].name)}),n.find("span").each(function(t){0===t.attributes.length&&$R.dom(t).unwrap()}),n.find(this.opts.inlineTags.join(",")).each(function(t){0===t.attributes.length&&this.utils.isEmptyHtml(t.innerHTML)&&$R.dom(t).unwrap()}.bind(this)),n.find("ul, ol").each(function(t){var e=t.previousSibling;if(e&&"LI"===e.tagName){var i=$R.dom(e);i.find("p").unwrap(),i.append(t)}}),t=(t=(t=(t=(t=this.utils.getWrapperHtml(n)).replace(/<li><p>/gi,"<li>")).replace(/<\/p><\/li>/gi,"</li>")).replace(/^<li/gi,"<ul><li")).replace(/<\/li>$/gi,"</li></ul>"),this.opts.breakline&&(t=t.replace(/\n/g,"<br>")),t=(t=t.replace(/<p> <\/p>/gi,"<p></p>")).replace(/<p><br\s?\/?><\/p>/gi,"<p></p>"),i&&(t=(t=t.replace(/<p><\/p>/gi,"")).replace(/<p>\s<\/p>/gi,"")),t=this.restoreComponents(t)},pastePlainText:function(t){return t=this.opts.pasteLinks?this.storeLinks(t):t,t=this.opts.pasteImages?this.storeImages(t):t,t=this.getPlainText(t),t=this._replaceNlToBr(t),t=this.opts.pasteLinks?this.restoreLinks(t):t,t=this.opts.pasteImages?this.restoreImages(t):t},tidy:function(t){return t},paragraphize:function(t){return t=$R.create("cleaner.paragraphize",this.app).convert(t)},storeComments:function(t,e){var i=t.match(new RegExp("\x3c!--([\\w\\W]*?)--\x3e","gi"));if(null!==i)for(var s=0;s<i.length;s++)t=t.replace(i[s],"#####xstarthtmlcommentzz"+s+"xendhtmlcommentzz#####"),e.push(i[s]);return t},restoreComments:function(t,e){for(var i=0;i<e.length;i++)t=t.replace("#####xstarthtmlcommentzz"+i+"xendhtmlcommentzz#####",e[i]);return t},getFlatText:function(t){var e=$R.dom("<div>");return t.nodeType||t.dom?e.append(t):(t=(t=t.toString()).trim(),e.html(t)),void 0===(t=e.get().textContent||e.get().innerText||"")?"":t},getPlainText:function(t){t=(t=(t=(t=(t=(t=t.replace(/<!--[\s\S]*?-->/gi,"")).replace(/<style[\s\S]*?style>/gi,"")).replace(/<p><\/p>/g,"")).replace(/<\/div>|<\/li>|<\/td>/gi,"\n")).replace(/<\/p>/gi,"\n\n")).replace(/<\/H[1-6]>/gi,"\n\n");var e=document.createElement("div");return e.innerHTML=t,(t=e.textContent||e.innerText).trim()},replaceTags:function(t,e){if(e){var i=this,s=Object.keys(e),n=this.utils.buildWrapper(t);n.find(s.join(",")).each(function(t){i.utils.replaceToTag(t,e[t.tagName.toLowerCase()])}),t=this.utils.getWrapperHtml(n)}return t},replaceNbspToSpaces:function(t){return t.replace(" "," ")},replaceBlocksToBr:function(t){return t=t.replace(/<\/div>|<\/li>|<\/td>|<\/p>|<\/H[1-6]>/gi,"<br>")},cleanNewLines:function(t){return t.replace(/\r?\n/g,"")},cleanSpacesInPre:function(t){return t.replace(" "," ")},removeInvisibleSpaces:function(t){return t=(t=this.utils.removeInvisibleChars(t)).replace(//gi,"")},removeNl:function(t){return t=(t=t.replace(/\n/g," ")).replace(/\s+/g,"s")},removeBrAtEnd:function(t){return t=(t=t.replace(/<br\s?\/?>$/gi," ")).replace(/<br\s?\/?><li/gi,"<li")},removeTags:function(t,i){var e=i?/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi:/(<([^>]+)>)/gi,s=i?function(t,e){return-1===i.indexOf(e.toLowerCase())?t:""}:"";return t.replace(e,s)},removeTagsExcept:function(t,i){if(void 0===i)return t.replace(/(<([^>]+)>)/gi,"");return t.replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,function(t,e){return-1===i.indexOf(e.toLowerCase())?"":t})},removeComments:function(t){return t.replace(this.reComments,"")},removeServiceTagsAndAttrs:function(t,e){var i=this.utils.buildWrapper(t),s=this;return!1!==e&&i.find(".redactor-selection-marker").each(function(t){var e=$R.dom(t);return""===s.utils.removeInvisibleChars(e.text())?e.remove():e.unwrap()}),i.find("[data-redactor-style-cache]").removeAttr("data-redactor-style-cache"),this.utils.getWrapperHtml(i)},removeSpanWithoutAttributes:function(t){var e=this.utils.buildWrapper(t);return e.find("span").removeAttr("data-redactor-span data-redactor-style-cache").each(function(t){0===t.attributes.length&&$R.dom(t).unwrap()}),this.utils.getWrapperHtml(e)},removeFirstBlockBreaklineInHtml:function(t){return t.replace(new RegExp("</li><br\\s?/?>","gi"),"</li>")},removeEmptyAttributes:function(t,e){for(var i=this.utils.buildWrapper(t),s=0;s<e.length;s++)i.find("["+e[s]+'=""]').removeAttr(e[s]);return this.utils.getWrapperHtml(i)},encodeHtml:function(t){return t=(t=(t=(t=(t=(t=t.replace(/<br\s?\/?>/g,"\n")).replace(/ /g," ")).replace(/”/g,'"')).replace(/“/g,'"')).replace(/‘/g,"'")).replace(/’/g,"'"),t=(t=this.encodeEntities(t)).replace(/\$/g,"$"),this.opts.preSpaces&&(t=t.replace(/\t/g,new Array(this.opts.preSpaces+1).join(" "))),t},encodeCode:function(t){return t=(t=(t=(t=(t=t.replace(/<(.*?)>/gi,"xtagstartz$1xtagendz")).replace(/xtagstartzpre(.*?)xtagendz/g,"<pre$1>")).replace(/xtagstartzcode(.*?)xtagendz/g,"<code$1>")).replace(/xtagstartz\/codextagendz/g,"</code>")).replace(/xtagstartz\/prextagendz/g,"</pre>"),t=(t=(t=this._encodeCode(t)).replace(/xtagstartz(.*?)xtagendz/g,"<$1>")).replace(/xtagstartz\/(.*?)xtagendz/g,"</$1>")},_encodeCode:function(t){var e=this.utils.buildWrapper(t);return e.find("pre code, pre, code").each(this._encodeNode.bind(this)),this.utils.getWrapperHtml(e)},_encodeNode:function(t){var e=t.firstChild,i=t.innerHTML;if("PRE"!==t.tagName||!e||"CODE"!==e.tagName){i=(i=i.replace(/xtagstartz/g,"<")).replace(/xtagendz/g,">");var s=this.decodeEntities(i);t.textContent=this._encodeNodeHtml(s)}},_encodeNodeHtml:function(t){return t=t.replace(/ /g," ").replace(/<br\s?\/?>/g,"\n"),t=this.opts.preSpaces?t.replace(/\t/g,new Array(this.opts.preSpaces+1).join(" ")):t},encodeEntities:function(t){return t=(t=this.decodeEntities(t)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},encodePhpCode:function(t){return t=(t=(t=t.replace("<?php","<?php")).replace("<?","<?")).replace("?>","?>")},decodeEntities:function(t){return String(t).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")},storeComponents:function(t){var e=this.utils.getElementsFromHtml(t,"figure","table");return this._storeMatched(t,e,"Components","figure")},restoreComponents:function(t){return this._restoreMatched(t,"Components","figure")},storeLinks:function(t){var e=this.utils.getElementsFromHtml(t,"a");return this._storeMatched(t,e,"Links","a")},storeImages:function(t){var e=this.utils.getElementsFromHtml(t,"img");return this._storeMatched(t,e,"Images","img")},restoreLinks:function(t){return this._restoreMatched(t,"Links","a")},restoreImages:function(t){return this._restoreMatched(t,"Images","img")},_cleanWrapped:function(t){return t=t.replace(new RegExp("<p><figure([\\w\\W]*?)</figure></p>","gi"),"<figure$1</figure>")},_cleanGDocs:function(t){return t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/<b\sid="internal-source-marker(.*?)">([\w\W]*?)<\/b>/gi,"$2")).replace(/<b(.*?)id="docs-internal-guid(.*?)">([\w\W]*?)<\/b>/gi,"$3")).replace(/<span[^>]*(font-style:\s?italic;\s?font-weight:\s?bold|font-weight:\s?bold;\s?font-style:\s?italic)[^>]*>([\w\W]*?)<\/span>/gi,"<b><i>$2</i></b>")).replace(/<span[^>]*(font-style:\s?italic;\s?font-weight:\s?600|font-weight:\s?600;\s?font-style:\s?italic)[^>]*>([\w\W]*?)<\/span>/gi,"<b><i>$2</i></b>")).replace(/<span[^>]*(font-style:\s?italic;\s?font-weight:\s?700|font-weight:\s?700;\s?font-style:\s?italic)[^>]*>([\w\W]*?)<\/span>/gi,"<b><i>$2</i></b>")).replace(/<span[^>]*font-style:\s?italic[^>]*>([\w\W]*?)<\/span>/gi,"<i>$1</i>")).replace(/<span[^>]*font-weight:\s?bold[^>]*>([\w\W]*?)<\/span>/gi,"<b>$1</b>")).replace(/<span[^>]*font-weight:\s?700[^>]*>([\w\W]*?)<\/span>/gi,"<b>$1</b>")).replace(/<span[^>]*font-weight:\s?600[^>]*>([\w\W]*?)<\/span>/gi,"<b>$1</b>")},_cleanMsWord:function(t){t=(t=(t=(t=(t=t.replace(/<!--[\s\S]+?-->/gi,"")).replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,"")).replace(/<(\/?)s>/gi,"<$1strike>")).replace(/ /gi," ")).replace(/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(t,e){return 0<e.length?e.replace(/./," ").slice(Math.floor(e.length/2)).split("").join(" "):""});var e=this.utils.buildWrapper(t);e.find(".MsoFootnoteText").each(function(t){var e=$R.dom(t),i=e.parent();0!==i.length&&-1!==i.attr("style").search(/mso-element:footnote/)&&e.find("a").attr("id","_"+i.attr("id"))}),e.find(".MsoFootnoteReference").each(function(t){var e=$R.dom(t).parent();0!==e.length&&"A"===e.get().tagName&&e.attr("id",e.attr("name"))}),e.find("p").each(function(t){var e=$R.dom(t),i=e.attr("style"),s=/mso-list:\w+ \w+([0-9]+)/.exec(i);s&&e.attr("data-listLevel",parseInt(s[1],10))}),this._parseWordLists(e),e.find("[align]").removeAttr("align"),e.find("[name]").removeAttr("name"),e.find("span").each(function(t){var e=$R.dom(t),i=e.attr("style");/mso-list:Ignore/.exec(i)?e.remove():e.unwrap()}),e.find("[style]").removeAttr("style"),e.find("[class^='Mso']").removeAttr("class"),e.find("a").filter(function(t){return!t.hasAttribute("href")}).unwrap();for(var i="",s=(t=(t=(t=(t=(t=this.utils.getWrapperHtml(e)).replace(/<p[^>]*><\/p>/gi,"")).replace(/<li>·/gi,"<li>")).trim()).replace(/\/(p|ul|ol|h1|h2|h3|h4|h5|h6|blockquote)>\s+<(p|ul|ol|h1|h2|h3|h4|h5|h6|blockquote)/gi,"/$1>\n<$2")).split(/\n/),n=0;n<s.length;n++){var r=""!==s[n]&&-1===s[n].search(/>$/)?" ":"\n";i+=s[n]+r}return i},_parseWordLists:function(t){var a=0,l=null,h=null,c=null;t.find("p").each(function(t){var e=$R.dom(t),i=e.attr("data-listLevel");if(null===i&&e.hasClass("MsoListParagraphCxSpMiddle")&&(i=1),null!==i){var s=e.text(),n=/^\s*\w+\./.test(s)?"<ol></ol>":"<ul></ul>";if(e.hasClass("MsoListParagraphCxSpFirst")||e.hasClass("MsoNormal")?(h=$R.dom(n),e.before(h)):a<i&&0!==a&&(c=$R.dom(n),l.append(c),h=c),i<a)for(var r=a-i+1,o=0;o<r;o++)h=h.parent();e.find("span").first().unwrap(),l=$R.dom("<li>"+e.html().trim()+"</li>"),null===h&&(e.before(n),h=e.prev()),h.append(l),e.remove(),a=i}else h=null,a=0})},_isSpacedEmpty:function(t){return-1!==t.search(this.reSpacedEmpty)},_isParagraphEmpty:function(t){return-1!==t.search(/^<p><\/p>$/i)},_isHtmlMsWord:function(t){return t.match(/class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i)},_setSpanAttr:function(t){var e=this.utils.buildWrapper(t);return e.find("span").attr("data-redactor-span",!0),this.utils.getWrapperHtml(e)},_setStyleCache:function(t){var e=this.utils.buildWrapper(t);return e.find("[style]").each(function(t){var e=$R.dom(t);e.attr("data-redactor-style-cache",e.attr("style"))}),this.utils.getWrapperHtml(e)},_setPreClass:function(t){var e=this.utils.buildWrapper(t);return e.find("pre").addClass(this.opts.preClass),this.utils.getWrapperHtml(e)},_setLinkNofollow:function(t){var e=this.utils.buildWrapper(t);return e.find("a").attr("rel","nofollow"),this.utils.getWrapperHtml(e)},_replaceScriptTag:function(t){return t.replace(this.reScriptTag,'<script class="redactor-script-tag" $1>$2<\/script>')},_unreplaceScriptTag:function(t){return t.replace(/<script class="redactor-script-tag"(.*?[^>]?)>([\w\W]*?)<\/script>/gi,"<script$1>$2<\/script>")},_replaceNlToBr:function(t){return t.replace(/\n/g,"<br />")},_removeScriptTag:function(t){return t.replace(this.reScriptTag,"")},_storeMatched:function(t,e,i,s){if(this["stored"+i]=[],e)for(var n=0;n<e.length;n++)this["stored"+i][n]=e[n],t=t.replace(e[n],"####"+s+n+"####");return t},_restoreMatched:function(t,e,i){if(this["stored"+e])for(var s=0;s<this["stored"+e].length;s++)t=t.replace("####"+i+s+"####",this["stored"+e][s]);return t}}),$R.add("class","cleaner.figure",{init:function(t){this.app=t,this.opts=t.opts,this.utils=t.utils,this.detector=t.detector},convert:function(t,e){var i=this.utils.buildWrapper(t);return i.find("img").each(this._convertImage.bind(this)),i.find("hr").each(this._convertLine.bind(this)),i.find("iframe").each(this._convertIframe.bind(this)),i.find("table").each(this._convertTable.bind(this)),i.find("form").each(this._convertForm.bind(this)),i.find("figure pre").each(this._convertCode.bind(this)),i.find("[data-redactor-type=variable]").addClass("redactor-component"),i.find("figure").not(".redactor-component, .redactor-figure-code").each(this._convertWidget.bind(this)),i.find("figure pre").each(this._setContenteditableCode.bind(this)),i.find(".redactor-component, .non-editable").attr("contenteditable",!1),this.detector.isIe()&&i.find("[data-redactor-type=table]").removeAttr("contenteditable"),i.find("figcaption, td, th").attr("contenteditable",!0),i.find(".redactor-component, figcaption").attr("tabindex","-1"),this._acceptExtraRules(i,e),this.utils.getWrapperHtml(i)},unconvert:function(t,e){t=(t=t.replace(/<\/([^>]+)><div data-redactor-tag/g,"</$1>\n<div data-redactor-tag")).replace(/<\/([^>]+)><p/g,"</$1>\n<p");var i=this.utils.buildWrapper(t);return i.find("th, td, figcaption, figure, pre, code, .redactor-component").removeAttr("contenteditable tabindex"),i.find("figure").removeClass("redactor-component redactor-component-active redactor-uploaded-figure"),i.find("[data-redactor-type=variable]").removeClass("redactor-component redactor-component-active"),i.find("figure[data-redactor-type=line]").unwrap(),i.find("figure[data-redactor-type=widget]").each(this._unconvertWidget.bind(this)),i.find("figure[data-redactor-type=form]").each(this._unconvertForm.bind(this)),i.find("figure[data-redactor-type=table]").each(this._unconvertTable.bind(this)),i.find("figure[data-redactor-type=image]").removeAttr("rel").each(this._unconvertImages.bind(this)),i.find("img").removeAttr("data-redactor-type").removeClass("redactor-component"),i.find(".non-editable").removeAttr("contenteditable"),i.find("figure").each(this._removeTypes.bind(this)),i.find("span.redactor-component-caret").remove(),i=this._unconvertBreakTag(i),this._acceptExtraRules(i,e),t=(t=(t=this.utils.getWrapperHtml(i)).replace(/<br\s?\/?>$/,"")).replace(/<br\s?\/?><\/(td|th)>/,"</$1>")},_convertImage:function(t){var e=$R.dom(t);if(!this._isNonEditable(e)){this.opts.imageObserve&&!e.attr("data-image")&&e.attr("data-image",this.utils.getRandomId());var i=e.closest("a"),s=e.closest("figure");if(0===s.children().not("a, img, br, figcaption").length){if(0===s.length){var n=0!==i.length?i.closest("p"):e.closest("p");if(!1===this.opts.imageFigure&&0!==n.length)(s=this.utils.replaceToTag(n,"figure")).addClass("redactor-replace-figure");else 0!==n.length&&n.unwrap(),s=0!==i.length?i.wrap("<figure>"):e.wrap("<figure>")}else s.hasClass("redactor-uploaded-figure")?s.removeClass("redactor-uploaded-figure"):s.addClass("redactor-keep-figure");this._setFigure(s,"image")}}},_convertTable:function(t){if(!this._isNonEditable(t)){var e=this._wrapFigure(t);this._setFigure(e,"table")}},_convertLine:function(t){if(!this._isNonEditable(t)){var e=this._wrapFigure(t);this._setFigure(e,"line")}},_convertForm:function(t){if(!this._isNonEditable(t)){var e=this.utils.replaceToTag(t,"figure");this._setFigure(e,"form")}},_convertIframe:function(t){if(!this._isNonEditable(t)&&0===$R.dom(t).closest(".redactor-component").length){var e=t.getAttribute("src"),i=e&&(e.match(this.opts.regex.youtube)||e.match(this.opts.regex.vimeo)),s=this._wrapFigure(t);i&&this._setFigure(s,"video")}},_convertCode:function(t){if(!this._isNonEditable(t)){var e=this._wrapFigure(t);this._setFigure(e,"code")}},_convertWidget:function(t){if(!this._isNonEditable(t)){var e=$R.dom(t);e.addClass("redactor-component"),e.attr("data-redactor-type","widget"),e.attr("data-widget-code",encodeURI(t.innerHTML.trim()))}},_unconvertBreakTag:function(t){return t.find("[data-redactor-tag]").each(function(t){var e=$R.dom(t);if(e.removeAttr("data-redactor-tag"),0===t.attributes.length)if(t.lastChild&&"BR"===t.lastChild.tagName)e.unwrap();else{var i=e.nextElement();0!==i.length&&i.attr("data-redactor-tag")&&t.appendChild(document.createElement("br")),e.unwrap()}else t.lastChild&&"BR"===t.lastChild.tagName&&$R.dom(t.lastChild).remove()}.bind(this)),t},_unconvertForm:function(t){this.utils.replaceToTag(t,"form")},_unconvertTable:function(t){$R.dom(t).unwrap()},_unconvertWidget:function(t){var e=$R.dom(t);e.html(decodeURI(e.attr("data-widget-code"))),e.removeAttr("data-widget-code")},_unconvertImages:function(t){var e=$R.dom(t);e.removeClass("redactor-component");var i=0!==e.closest("li").length,s=0!==e.closest("table").length,n=0!==e.find("figcaption").length,r=e.attr("style"),o=!(null===r||""===r),a=""!==e.attr("class");!i&&(!s||n||o||a)||e.unwrap()},_removeTypes:function(t){var e=$R.dom(t),i=e.attr("data-redactor-type");if(i&&-1!==["image","widget","line","video","code","form","table"].indexOf(i)&&e.removeAttr("data-redactor-type"),e.hasClass("redactor-keep-figure"))e.removeClass("redactor-keep-figure");else if("image"===i&&!1===this.opts.imageFigure){0!==e.find("figcaption").length||(e.hasClass("redactor-replace-figure")&&e.removeClass("redactor-replace-figure"),this.utils.replaceToTag(e,"p"))}e.removeClass("redactor-replace-figure")},_wrapFigure:function(t){var e=$R.dom(t),i=e.closest("figure");return 0===i.length?e.wrap("<figure>"):i},_setFigure:function(t,e){t.addClass("redactor-component"),t.attr("data-redactor-type",e)},_setContenteditableCode:function(t){if(!this._isNonEditable(t)){var e=$R.dom(t),i=e.children("code").first();(0!==i.length?i:e).attr("contenteditable",!0).attr("tabindex","-1")}},_acceptExtraRules:function(t,e){for(var i in e)"function"==typeof e[i]&&e[i](t)},_isNonEditable:function(t){return 0!==$R.dom(t).closest(".non-editable").length}}),$R.add("class","cleaner.paragraphize",{init:function(t){this.app=t,this.opts=t.opts,this.utils=t.utils,this.cleaner=t.cleaner,this.element=t.element,this.stored=[],this.remStart="#####replace",this.remEnd="#####",this.paragraphizeTags=["table","div","pre","form","ul","ol","h1","h2","h3","h4","h5","h6","dl","blockquote","figcaption","address","section","header","footer","aside","article","object","style","script","iframe","select","input","textarea","button","option","map","area","math","hr","fieldset","legend","hgroup","nav","figure","details","menu","summary","p"]},convert:function(t){var e=this._isConverted(t);return e=!0===e?this._convert(t):e,e=this._convertTable(e)},_convert:function(t,e){var i=this.opts.breakline||e?"sdivtag":this.opts.markup,s=e?"tbr":"br";t=this._storeTags(t);var n=[];t=(t=this.cleaner.storeComments(t,n)).trim(),t=this._trimLinks(t);var r=this.opts.inlineTags.join("|");t=(t=(t=(t=(t=t.replace(new RegExp("<("+r+")(.*?[^>]?)>\n</("+r+")>","gi"),"<$1$2></$3>")).replace(/xparagraphmarkerz(?:\r\n|\r|\n)$/g,"")).replace(/xparagraphmarkerz$/g,"")).replace(/xparagraphmarkerz(?:\r\n|\r|\n)/g,"\n")).replace(/xparagraphmarkerz/g,"\n");for(var o="",a=(t=this.opts.breakline?(t=(t=t.replace(/<br\s?\/?>(?:\r\n|\r|\n)/gi,"xbreakmarkerz\n")).replace(/<br\s?\/?>/gi,"xbreakmarkerz\n")).replace(/xbreakmarkerz\n<\//gi,"xbreakmarkerz</"):t.replace(/[\n]+/g,"\n")).split("\n"),l=0;l<a.length;l++)o+="<"+i+">"+a[l]+"</"+i+">\n";return t=(t=(t=(t=o.replace(/\n$/,"")).replace(new RegExp("<"+i+">\\s+#####","gi"),"#####")).replace(new RegExp("<"+i+">#####","gi"),"#####")).replace(new RegExp("#####</"+i+">","gi"),"#####"),t=this.opts.breakline?t.replace(/xbreakmarkerz/gi,"<br>"):t,t=this._restoreTags(t),t=this.cleaner.restoreComments(t,n),this.opts.breakline&&(t=t.replace(new RegExp("<"+i+"></"+i+">","gi"),"<"+i+"><br></"+i+">")),t=(t=(t=t.replace(new RegExp("<sdivtag>","gi"),'<div data-redactor-tag="'+s+'">')).replace(new RegExp("sdivtag","gi"),"div")).replace(/<\/([^>]+)><div data-redactor-tag/g,"</$1>\n<div data-redactor-tag")},_convertTable:function(t){var e=this.utils.buildWrapper(t);return e.find("td, th").each(this._convertCell.bind(this)),t=this.utils.getWrapperHtml(e)},_convertCell:function(t){var e=$R.dom(t);this.stored=[];var i=this._convert(e.html(),!0);e.html(i)},_storeTags:function(t){var s=this,e=this.utils.buildWrapper(t);return e.find(this.paragraphizeTags.join(", ")).each(function(t,e){var i=document.createTextNode(s.remStart+e+s.remEnd+"xparagraphmarkerz");s.stored.push(t.outerHTML),t.parentNode.replaceChild(i,t)}),this.utils.getWrapperHtml(e)},_restoreTags:function(t){for(var e=0;e<this.stored.length;e++)this.stored[e]=this.stored[e].replace(/\$/g,"$"),t=t.replace(this.remStart+e+this.remEnd,this.stored[e]);return t},_trimLinks:function(t){var e=this.utils.buildWrapper(t);return e.find("a").each(this._trimLink.bind(this)),t=this.utils.getWrapperHtml(e)},_trimLink:function(t){var e=$R.dom(t);e.html(e.html().trim())},_isConverted:function(t){return this._isDisabled(t)?t:!this._isEmptyHtml(t)||this.opts.emptyHtml},_isDisabled:function(){return!1===this.opts.paragraphize||this.element.isType("inline")},_isEmptyHtml:function(t){return""===t||"<p></p>"===t||"<div></div>"===t}}),$R.add("service","detector",{init:function(t){this.app=t,this.userAgent=navigator.userAgent.toLowerCase()},isWebkit:function(){return/webkit/.test(this.userAgent)},isFirefox:function(){return-1<this.userAgent.indexOf("firefox")},isIe:function(t){return document.documentMode||/Edge/.test(navigator.userAgent)?"edge":RegExp("msie"+(isNaN(t)?"":"\\s"+t),"i").test(navigator.userAgent)||!!navigator.userAgent.match(/Trident.*rv[ :]*11\./)},isMobile:function(){return/(iPhone|iPod|Android)/.test(navigator.userAgent)},isDesktop:function(){return!/(iPhone|iPod|iPad|Android)/.test(navigator.userAgent)},isIpad:function(){return/iPad/.test(navigator.userAgent)}}),$R.add("service","offset",{init:function(t){this.app=t},get:function(t,e){var i={start:0,end:0},s=this.utils.getNode(t);if(!s)return!1;var n=this.editor.isEditor(s),r=!!n||this.selection.isIn(s),o=this.selection.getRange();if(n||r){if(this.selection.is()&&r){var a=$R.dom(o.startContainer).hasClass("redactor-component")?o.startOffset:0,l=o.cloneRange();l.selectNodeContents(s),l.setEnd(o.startContainer,o.startOffset);var h=this._getString(o,e);i.start=this._getString(l,e).length-a,i.end=i.start+h.length+a}}else i=!1;return i},set:function(t,e){if(!this._setComponentOffset(e)){this.component.clearActive();var i=this.utils.getNode(e);if(i){var s=this.size(i),n=0,r=document.createRange();t.end=t.end>s?s:t.end,r.setStart(i,0),r.collapse(!0);for(var o=[i],a=!1,l=!1;!l&&(i=o.pop());)if(3===i.nodeType){var h=n+i.length;!a&&!this._isFigcaptionNext(i)&&t.start>=n&&t.start<=h&&(r.setStart(i,t.start-n),a=!0),a&&t.end>=n&&t.end<=h&&(r.setEnd(i,t.end-n),l=!0),n=h}else for(var c=i.childNodes.length;c--;)o.push(i.childNodes[c]);this.selection.setRange(r)}}},size:function(t,e){var i=this.utils.getNode(t);if(i){var s=document.createRange().cloneRange();return s.selectNodeContents(i),this._getString(s,e).length}return 0},_getString:function(t,e){var i=t.toString();return i=this.editor.isEmpty()?i.replace(/\uFEFF/g,""):i,i=e?i.trim():i},_setComponentOffset:function(t){return!!this.component.isNonEditable(t)&&this.component.setActive(t)},_isFigcaptionNext:function(t){var e=t.nextSibling;return""===t.nodeValue.trim()&&e&&"FIGCAPTION"===e.tagName}}),$R.add("service","inspector",{init:function(t){this.app=t},parse:function(t){return $R.create("inspector.parser",this.app,this,t)},isText:function(t){if("string"==typeof t&&!/^\s*<(\w+|!)[^>]*>/.test(t))return!0;var e=$R.dom(t).get();return e&&3===e.nodeType},isInlineTag:function(t,e){var i=this._extendTags(this.opts.inlineTags,e);return this._isTag(t)&&-1!==i.indexOf(t.toLowerCase())},isBlockTag:function(t,e){var i=this._extendTags(this.opts.blockTags,e);return this._isTag(t)&&-1!==i.indexOf(t.toLowerCase())},isTableCellTag:function(t){return-1!==["td","th"].indexOf(t.toLowerCase())},isHeadingTag:function(t){return-1!==["h1","h2","h3","h4","h5","h6"].indexOf(t.toLowerCase())},_isTag:function(t){return void 0!==t&&t},_extendTags:function(t,e){if(t=t.concat(t),e)for(var i=0;i<e.length;i++)t.push(e[i]);return t}}),$R.add("class","inspector.parser",{init:function(t,e,i){this.app=t,this.uuid=t.uuid,this.opts=t.opts,this.utils=t.utils,this.editor=t.editor,this.selection=t.selection,this.inspector=e,this.el=i,this.$el=$R.dom(this.el,".redactor-in-"+this.uuid),this.node=this.$el.get(),this.node&&8===this.node.nodeType&&(this.node=!1),this.$component=this.$el.closest(".redactor-component",".redactor-in")},isEditor:function(){return this.node===this.editor.getElement().get()},isInEditor:function(){return 0!==this.$el.parents(".redactor-in-"+this.uuid).length},isComponent:function(){return 0!==this.$component.length},isComponentType:function(t){return this.getComponentType()===t},isComponentActive:function(){return this.isComponent()&&this.$component.hasClass("redactor-component-active")},isComponentEditable:function(){var t=this.getComponentType();return this.isComponent()&&-1!==["code","table"].indexOf(t)},isFigcaption:function(){return this.getFigcaption()},isPre:function(){return this.getPre()},isCode:function(){var t=this.$el.closest("code"),e=t.parent("pre");return 0!==t.length&&0===e.length},isList:function(){return this.getList()},isFirstListItem:function(){return this._getLastOrFirstListItem("first")},isLastListItem:function(){return this._getLastOrFirstListItem("last")},isFirstTableCell:function(){return this._getLastOrFirstTableCell("first")},isLastTableCell:function(){return this._getLastOrFirstTableCell("last")},isTable:function(){return this.isComponentType("table")||this.getTable()},isHeading:function(){return this.getHeading()},isBlockquote:function(){return this.getBlockquote()},isDl:function(){return this.getDl()},isParagraph:function(){return this.getParagraph()},isLink:function(){return this.getLink()},isFile:function(){return this.getFile()},isText:function(){return this.inspector.isText(this.el)},isInline:function(){var t=this.opts.inlineTags;return!!this.isElement()&&-1!==t.indexOf(this.node.tagName.toLowerCase())},isBlock:function(){var t=this.opts.blockTags;return!!this.isElement()&&-1!==t.indexOf(this.node.tagName.toLowerCase())},isElement:function(){return this.node&&this.node.nodeType&&3!==this.node.nodeType},hasParent:function(t){return 0!==this.$el.closest(t.join(",")).length},getNode:function(){return this.node},getTag:function(){return!!this.isElement()&&this.node.tagName.toLowerCase()},getComponent:function(){return!!this.isComponent()&&this.$component.get()},getComponentType:function(){return!!this.isComponent()&&this.$component.attr("data-redactor-type")},getFirstNode:function(){return this.utils.getFirstNode(this.node)},getLastNode:function(){return this.utils.getLastNode(this.node)},getFirstElement:function(){return this.utils.getFirstElement(this.node)},getLastElement:function(){return this.utils.getLastElement(this.node)},getFigcaption:function(){return this._getClosestNode("figcaption")},getPre:function(){return this._getClosestNode("pre")},getCode:function(){return this._getClosestNode("code")},getList:function(){return this._getClosestNode("ul, ol")},getParentList:function(){return this._getClosestUpNode("ul, ol")},getListItem:function(){return this._getClosestNode("li")},getTable:function(){return this.getComponentType("table")?this.$component.find("table").get():this._getClosestNode("table")},getTableCell:function(){var t=this.$el.closest("td, th");return 0!==t.length&&t.get()},getComponentCodeElement:function(){return!!this.isComponentType("code")&&this.$component.find("pre code, pre").last().get()},getImageElement:function(){return!!this.isComponentType("image")&&this.$component.find("img").get()},getParagraph:function(){return this._getClosestNode("p")},getHeading:function(){return this._getClosestNode("h1, h2, h3, h4, h5, h6")},getDl:function(){return this._getClosestNode("dl")},getBlockquote:function(){return this._getClosestNode("blockquote")},getLink:function(){var t=this.isComponent()&&!this.isFigcaption();if(!this.isComponentType("table")&&t)return!1;var e=this._getClosestElement("a");return!(!e||e.attr("data-file"))&&e.get()},getFile:function(){var t=this.isComponent();if(!this.isComponentType("table")&&t)return!1;var e=this._getClosestElement("a");return!(!e||!e.attr("data-file"))&&e.get()},findFirstNode:function(t){return this.$el.find(t).first().get()},findLastNode:function(t){return this.$el.find(t).last().get()},_getLastOrFirstListItem:function(t){var e=this.getList(),i=this.getTag();if(e&&"li"===i){var s=$R.dom(e).find("li")[t]().get();if(s&&this.node===s)return!0}return!1},_getLastOrFirstTableCell:function(t){var e=this.getTable(),i=this.getTag();if(e&&("td"===i||"th"===i)){var s=$R.dom(e).find("td, th")[t]().get();if(s&&this.node===s)return!0}return!1},_getClosestUpNode:function(t){var e=this.$el.parents(t,".redactor-in-"+this.uuid).last();return 0!==e.length&&e.get()},_getClosestNode:function(t){var e=this.$el.closest(t,".redactor-in-"+this.uuid);return 0!==e.length&&e.get()},_getClosestElement:function(t){var e=this.$el.closest(t,".redactor-in-"+this.uuid);return 0!==e.length&&e}}),$R.add("service","marker",{init:function(t){this.app=t},build:function(t,e){var i=document.createElement("span");return i.id="selection-marker-"+this._getPos(t),i.className="redactor-selection-marker",i.innerHTML=this.opts.markerChar,e?i.outerHTML:i},buildHtml:function(t){return this.build(t,!0)},insert:function(t){this.remove();var e="both"!==t&&("start"===t||this.selection.isCollapsed());this.selection.is()||this.editor.focus();var i=this.selection.getRange();if(i){var s=this.build("start"),n=this.build("end"),r=i.cloneRange();return e||(r.collapse(!1),r.insertNode(n)),r.setStart(i.startContainer,i.startOffset),r.collapse(!0),r.insertNode(s),i.setStartAfter(s),e||i.setEndBefore(n),this.selection.setRange(i),s}},find:function(t,e){var i=this.editor.getElement(),s=(e||i).find("span#selection-marker-"+this._getPos(t));return 0!==s.length&&s.get()},restore:function(){var t=this.find("start"),e=this.find("end"),i=this.selection.getRange();if(i&&this.selection.is()||(this.editor.focus(),i=document.createRange()),t){var s=!!e&&e.previousSibling,n=t.nextSibling;n=(!n||3!==n.nodeType||""!==n.textContent.replace(/[\n\t]/g,""))&&n,e?n&&"selection-marker-end"===n.id?this._restoreInject(i,t):s&&n?(i.selectNodeContents(s),i.collapse(!1),i.setStart(n,0)):s&&!n?(i.selectNodeContents(s),i.collapse(!1),i.setStartAfter(t)):(i.setStartAfter(t),i.setEndBefore(e)):n?(i.selectNodeContents(n),i.collapse(!0)):this._restoreInject(i,t),this.selection.setRange(i),t&&t.parentNode.removeChild(t),e&&e.parentNode.removeChild(e)}},remove:function(){var t=this.find("start"),e=this.find("end");t&&t.parentNode.removeChild(t),e&&e.parentNode.removeChild(e)},_getPos:function(t){return void 0===t?"start":t},_restoreInject:function(t,e){var i=this.utils.createInvisibleChar();$R.dom(e).after(i),t.selectNodeContents(i),t.collapse(!1)}}),$R.add("service","component",{init:function(t){this.app=t,this.activeClass="redactor-component-active"},create:function(t,e){return $R.create(t+".component",this.app,e)},build:function(t){var e,i=$R.dom(t).attr("data-redactor-type");return i&&(e=this.create(i,t)),e||t},remove:function(t,e){var i=$R.dom(t).closest(".redactor-component"),s=i.attr("data-redactor-type"),n=i.parent(),r=this.inspector.parse(n),o=this.utils.findSiblings(i,"prev"),a=this.utils.findSiblings(i,"next");if(!1!==this.app.broadcast(s+".delete",i)){if(i.remove(),this.app.broadcast(s+".deleted",i),this.app.broadcast("contextbar.close"),this.app.broadcast("imageresizer.stop"),!1!==e){var l=r.getTableCell();l&&this.utils.isEmptyHtml(l.innerHTML)?this.caret.setStart(l):a?this.caret.setStart(a):o?this.caret.setEnd(o):this.editor.startFocus()}this.editor.isEmpty()&&(this.editor.setEmpty(),this.editor.startFocus(),this.app.broadcast("empty"))}},isNonEditable:function(t){var e=this.inspector.parse(t);return e.isComponent()&&!e.isComponentEditable()},isActive:function(t){if(t){var e=this.inspector.parse(t);return $R.dom(e.getComponent()).hasClass(this.activeClass)}return 0!==this._find().length},getActive:function(t){var e=this._find();return 0!==e.length&&(t?e:e.get())},setActive:function(t){this.clearActive(),this.editor.focus();var e=this.inspector.parse(t),i=e.getComponent(),s=$R.dom(i);if(!e.isFigcaption()){var n=s.find(".redactor-component-caret");0===n.length&&(n=this._buildCaret(),s.prepend(n)),this.caret.setAtStart(n.get())}s.addClass(this.activeClass)},clearActive:function(){var t=this._find();t.removeClass(this.activeClass),t.find(".redactor-component-caret").remove(),this.app.broadcast("imageresizer.stop")},setOnEvent:function(t,e){this.clearActive();var i=this.inspector.parse(t.target);i.isFigcaption()||i.isComponentEditable()||i.isComponent()&&(this.setActive(t.target),!0!==e&&t.preventDefault())},executeScripts:function(scripts){if(void 0===scripts){var $editor=this.editor.getElement(),scripts=$editor.find("[data-redactor-type]").find("script").getAll();this.executeScripts.call(this,scripts)}else for(var i=0;i<scripts.length;i++){if(""!==scripts[i].src){var src=scripts[i].src;this.$doc.find('head script[src="'+src+'"]').remove();var $script=$R.dom("<script>");$script.attr("src",src),$script.attr("async defer"),$script.get().onload=function(){-1!==src.search("instagram")&&window.instgrm.Embeds.process(),this.executeScripts(scripts.slice(i+1))}.bind(this);var head=document.getElementsByTagName("head")[0];head&&head.appendChild($script.get());break}try{eval(scripts[i].innerHTML)}catch(t){}}},_find:function(){return this.editor.getElement().find("."+this.activeClass)},_buildCaret:function(){var t=$R.dom("<span>");return t.addClass("redactor-component-caret"),t.attr("contenteditable",!0),t}}),$R.add("service","insertion",{init:function(t){this.app=t},set:function(t,e,i){return null===t&&(t=""),t=!1!==e?this.cleaner.input(t):t,t=!1!==e?this.cleaner.paragraphize(t):t,this.editor.getElement().html(t),!1!==i&&this.editor.endFocus(),t},insertNode:function(t,e){this.editor.focus();var i=this.utils.isFragment(t)?t:this.utils.createFragment(t);return this._collapseSelection(),this._insertFragment(i),this._setCaret(e,i),this._sendNodes(i.nodes)},insertBreakLine:function(){return this.insertNode(document.createElement("br"),"after")},insertNewline:function(){return this.insertNode(document.createTextNode("\n"),"after")},insertText:function(t){return this.insertHtml(this.cleaner.getFlatText(t))},insertChar:function(t){return this.insertNode(t,"after")},insertRaw:function(t){return this.insertHtml(t,!1)},insertToEnd:function(t,e){if(t){3===t.nodeType&&-1!==t.nodeValue.search(/^\n/)&&(t=t.previousElementSibling);var i=$R.dom(t);if(i.attr("data-redactor-type")===e){var s=this.opts.breakline?"<br>":"<p>",n=$R.dom(s);i.after(n),this.caret.setStart(n)}}},insertPoint:function(t){var e,i=this.marker.build("start"),s=!1,n=t.clientX,r=t.clientY;if(document.caretPositionFromPoint){var o=document.caretPositionFromPoint(n,r),a=document.getSelection();this.inspector.parse(o.offsetNode).isInEditor()&&((e=a.getRangeAt(0)).setStart(o.offsetNode,o.offset),e.collapse(!0),e.insertNode(i),s=!0)}else document.caretRangeFromPoint&&(e=document.caretRangeFromPoint(n,r),this.inspector.parse(e.startContainer).isInEditor()&&(e.insertNode(i),s=!0));return s},insertToPoint:function(t,e,i,s){if(!(!0===i||this.insertPoint(t))){var n=this.editor.getLastNode();$R.dom(n).after(this.marker.build("start"))}return this.component.clearActive(),this.selection.restoreMarkers(),this.insertHtml(e,s)},insertToOffset:function(t,e){return this.offset.set({start:t,end:t}),this.insertHtml(e)},insertHtml:function(t,e){if(this.opts.input){var i=this.utils.parseHtml(t);if(this.selection.isAll())return this._insertToAllSelected(i);if(!this.selection.is()){var s=$R.dom("<p>");this.editor.getElement().append(s),this.caret.setStart(s)}var n=this.selection.isCollapsed(),r=this.selection.isText(),o=this.selection.getCurrent(),a=this.selection.getBlock(),l=this.inspector.parse(o);this._collapseSelection(),i=this._getCleanedInput(i,l,e);var h,c,d=this._isFigure(i.html),u=this._isComponentSpan(i.html),p=this.inspector.isText(i.html);if(this.editor.isEmpty())return this._insertToEmptyEditor(i.html);if(l.isComponent()&&!l.isComponentEditable())return this._insertToWidget(o,l,i.html);if(u)return this.insertNode(i.nodes,"end");if(d&&!r&&!l.isList())return l.isInline()?this._insertToInline(o,i):(h=this.utils.createFragment(i.html),this.utils.splitNode(o,h),this.caret.setEnd(h.last),this._sendNodes(h.nodes));if(l.isCode())return this._insertToCode(i,o,e);if(l.isPre())return this._insertToPre(i,e);if(l.isHeading()||l.isFigcaption())return i.html=!1!==e?this.cleaner.removeTagsExcept(i.html,["a"]):i.html,i.html=!1!==e?this.cleaner.replaceNbspToSpaces(i.html):i.html,h=this.utils.createFragment(i.html),this.insertNode(h,"end");if(this.opts.breakline&&a&&"DIV"===a.tagName){i.html=!1!==e?this.cleaner.paragraphize(i.html):i.html,h=this.utils.createFragment(i.html);var f=this.selection.getRange();return f&&!this.selection.isCollapsed()&&f.deleteContents(),this.utils.splitNode(o,h),this.caret.setEnd(h.last),this._sendNodes(h.nodes)}if(p)return!r&&"br"!==this.opts.markup&&this._hasBlocksAndImages(i.nodes)?(i.html=!1!==e?this.cleaner.paragraphize(i.html):i.html,h=this.utils.createFragment(i.html),this.utils.splitNode(o,h),this.caret.setEnd(h.last),this._sendNodes(h.nodes)):(i.html=!1!==e?i.html.replace(/\n/g,"<br>"):i.html,h=this.utils.createFragment(i.html),this.insertNode(h.nodes,"end"));if(!n&&!d)return this._isPlainHtml(i.html)?this.insertNode(i.nodes,"end"):(i.html=!1!==e?this.cleaner.paragraphize(i.html):i.html,h=this.utils.createFragment(i.html),this.insertNode(h,"end"));if(l.isInline()&&!this._isPlainHtml(i.html))return this._insertToInline(o,i);if(l.isBlockquote()||l.isDl())return(c=this.opts.inlineTags).concat(["br"]),i.html=!1!==e?this.cleaner.replaceBlocksToBr(i.html):i.html,i.html=!1!==e?this.cleaner.removeTagsExcept(i.html,c):i.html,h=this.utils.createFragment(i.html),this.insertNode(h,"end");if(l.isParagraph())return this._isPlainHtml(i.html)?this.insertNode(i.nodes,"end"):(i.html=!1!==e?this.cleaner.paragraphize(i.html):i.html,h=this.utils.createFragment(i.html),this.utils.splitNode(o,h),this.caret.setEnd(h.last),this._sendNodes(h.nodes));if(l.isList()&&(c=(c=this.opts.inlineTags).concat(["br","li","ul","ol","img"]),i.html=!1!==e?this.cleaner.replaceBlocksToBr(i.html):i.html,i.html=!1!==e?this.cleaner.removeTagsExcept(i.html,c):i.html,i.html=!1!==e?this.cleaner.removeBrAtEnd(i.html):i.html,h=this.utils.createFragment(i.html),i.nodes=h.nodes,this._containsTags(i.html,["ul","ol","li"]))){var m=this.selection.getElement(o);if(m&&"LI"===m.tagName&&this.caret.isStart(m)){i.nodes=$R.dom(h.nodes).unwrap("ul, ol").getAll(),$R.dom(m).before(i.nodes);var g=i.nodes[i.nodes.length-1];return this.caret.setEnd(g),this._sendNodes(i.nodes)}return this._isPlainHtml(i.html)?this.insertNode(h,"end"):(h=this._buildList(i,m,h),this.utils.splitNode(o,h,!0),this.caret.setEnd(h.last),this._sendNodes(h.nodes))}return this.insertNode(i.nodes,"end")}},_insertToAllSelected:function(t){var e=this.set(t.html),i=this.utils.parseHtml(e);return this._sendNodes(i.nodes)},_insertToEmptyEditor:function(t){t=this.cleaner.paragraphize(t);var e=this.utils.createFragment(t),i=this.editor.getElement();return i.html(""),i.append(e.frag),this.caret.setEnd(e.last),this._sendNodes(e.nodes)},_insertToInline:function(t,e){var i=this.utils.createFragment(e.html);return this.utils.splitNode(t,i,!1,!0),this.caret.setEnd(i.last),this._sendNodes(i.nodes)},_insertToCode:function(t,e,i){t.html=!1!==i?this.cleaner.encodeHtml(t.html):t.html,t.html=!1!==i?this.cleaner.removeNl(t.html):t.html;var s=this.utils.createFragment(t.html),n=this.insertNode(s,"end");return this.utils.normalizeTextNodes(e),n},_insertToPre:function(t,e){t.html=!1!==e?this.cleaner.encodeHtml(t.html):t.html;var i=this.utils.createFragment(t.html);return this.insertNode(i,"end")},_insertToWidget:function(t,e,i){i=this._isComponentSpan(i)?i:this.cleaner.paragraphize(i);var s=this.utils.createFragment(i),n=e.getComponent(),r=$R.dom(n);return r.after(s.frag),r.remove(),this.caret.setEnd(s.last),this._sendNodes(s.nodes)},_insertFragment:function(t){var e=this.selection.getRange();if(e){if(this.selection.isCollapsed()){var i=e.startContainer;3!==i.nodeType&&"BR"===i.tagName&&(this.caret.setAfter(i),i.parentNode.removeChild(i))}else e.deleteContents();e.insertNode(t.frag)}},_sendNodes:function(t){for(var e=0;e<t.length;e++){var i=t[e],s=3!==i.nodeType&&"function"==typeof i.getAttribute&&i.getAttribute("data-redactor-type");s&&this.app.broadcast(s+".inserted",this.component.build(i))}return this.detector.isIe()&&this.editor.getElement().find("[data-redactor-type=table]").attr("contenteditable",!0),this.app.broadcast("inserted",t),this.component.executeScripts(),t},_setCaret:function(t,e){var i=this._isLastInline(e);t?(t=i&&"end"===t?"after":t,this.caret["set"+this.utils.ucfirst(t)](e.last)):!1!==t&&i&&this.caret.setAfter(e.last)},_isLastInline:function(t){return!!t.last&&this.inspector.parse(t.last).isInline()},_getCleanedInput:function(t,e,i){var s=e.isCode()||e.isPre();return t.html=t.html.replace(/ /g," "),t.html=s||!1===i?t.html:this.cleaner.input(t.html),t=s||!1===i?t:this.utils.parseHtml(t.html)},_getContainer:function(t){return $R.dom(this.utils.createTmpContainer(t))},_buildList:function(t,e,i){var s=t.nodes[0];if(s&&3!==s.nodeType&&"li"===s.tagName){var n=$R.dom(e).get().tagName.toLowerCase(),r=$R.dom("<"+n+" />");return r.append(i.nodes),this.utils.createFragment(r.get().outerHTML)}return i},_containsTags:function(t,e){return 0!==this._getContainer(t).find(e.join(",")).length},_collapseSelection:function(){},_hasFigureOrTable:function(t){return 0!==this._getContainer(t).find("figure, table").length},_hasBlocks:function(t){return 0!==this._getContainer(t).find(this.opts.blockTags.join(",")).length},_hasBlocksAndImages:function(t){return 0!==this._getContainer(t).find(this.opts.blockTags.join(",")+",img").length},_isPlainHtml:function(t){return 0===this._getContainer(t).find(this.opts.blockTags.join(",")+", img").length},_isFigure:function(t){if(this._isHtmlString(t))return 0!==$R.dom(t).closest("figure").length},_isComponentSpan:function(t){if(this._isHtmlString(t))return 0!==$R.dom(t).closest("span.redactor-component").length},_isHtmlString:function(t){return!("string"==typeof t&&!/^\s*<(\w+|!)[^>]*>/.test(t))}}),$R.add("service","block",{init:function(t){this.app=t,this.tags=["p","div","blockquote","pre","h1","h2","h3","h4","h5","h6"]},format:function(t){return this.params={args:!1},this.params.type=t.type?t.type:"set",this.params.tag="string"==typeof t?t:t.tag||this.opts.markup,this.params.tag=this.params.tag.toLowerCase(),this.params.args={class:t.class||!1,style:t.style||!1,attr:t.attr||!1},t.class||t.style||t.attr||(this.params.args=!1),this._format()},add:function(t,e,i){return this._apply("add",t,e,!0,i)},set:function(t,e){return this._apply("set",t,e)},toggle:function(t,e){return this._apply("toggle",t,e)},remove:function(t,e){return this._apply("remove",t,e)},clearFormat:function(t){return this._clear(t,"all")},clearStyle:function(t){return this._clear(t,"style")},clearClass:function(t){return this._clear(t,"class")},clearAttr:function(t){return this._clear(t,"attr")},_format:function(){var t=[];this.collapsed=this.selection.isCollapsed(),this.selection.save();this.selection.getBlock();var e=this._getBlocks(),i=this._isToggleFormatType(e)?"toggle":"set",s=this._getReplacedTag(i);return t=this._replaceBlocks(e,s),t=this._buildNodes(t),this._restoreSelection(t),t},_clear:function(t,e,i,s){!1!==i&&this.selection.save();var n=this._getElements(t,s);return"all"===e?this._removeAllAttr(n,!1):"style"===e?(n.removeAttr("style"),n.removeAttr("data-redactor-style-cache")):"class"===e?n.removeAttr("class"):"attr"===e&&this._removeAllAttr(n),s=n.getAll(),!1!==i&&this._restoreSelection(s),s},_getElements:function(t,e){return e?$R.dom(e):$R.dom(this._getBlocks(t))},_getBlocks:function(t){for(var e=this.selection.getBlocks({tags:t||this.tags}),i=[],s=0;s<e.length;s++)"DIV"===e[s].tagName&&!e[s].getAttribute("data-redactor-tag")||i.push(e[s]);return i},_getReplacedTag:function(t){return this.opts.breakline?"toggle"===t?"div":"p"===this.params.tag?"div":this.params.tag:"toggle"===t?this.opts.markup:this.params.tag},_isStandardParagraph:function(){return!this.opts.breakline&&"p"===this.opts.markup},_isStandardDiv:function(){return!this.opts.breakline&&"div"===this.opts.markup},_isBreaklineBlock:function(t){return t&&"DIV"===t.tagName&&"br"===t.getAttribute("data-redactor-tag")},_isToggleFormatType:function(t){for(var e=0,i=t.length,s=0;s<i;s++)t[s]&&this.params.tag===t[s].tagName.toLowerCase()&&e++;return e===i},_isCurrentBlockOneAndEmpty:function(t){return this.collapsed&&1===t.length&&this.utils.isEmpty(t[0])},_buildNodes:function(t){return 0<t.length&&(t=this._applyArgs(t,!1),t=this._combinePre(t),t=this._cleanBlocks(t)),t},_replaceBlocks:function(t,e){for(var i=[],s=0;s<t.length;s++){var n=this.utils.replaceToTag(t[s],e);i.push(n.get())}return i},_combinePre:function(t){for(var e=[],i=0;i<t.length;i++){var s=t[i].nextElementSibling;if(s&&"PRE"===t[i].tagName&&"PRE"===s.tagName){var n=$R.dom(t[i]),r=$R.dom(s),o=document.createTextNode("\n");n.append(o),n.append(r),r.unwrap("pre")}e.push(t[i])}return e},_cleanBlocks:function(t){for(var e=["h1","h2","h3","h4","h5","h6"],i=this.opts.inlineTags,s=0;s<t.length;s++){var n=t[s].tagName.toLowerCase(),r=$R.dom(t[s]);-1!==e.indexOf(n)?r.find("span").not(".redactor-component, .non-editable, .redactor-selection-marker").unwrap():"pre"===n&&r.find(i.join(",")).not(".redactor-selection-marker").unwrap(),!1===this.params.args&&"p"===this.params.tag&&r.removeAttr("class"),this.opts.breakline&&"div"===n?r.attr("data-redactor-tag","br"):r.removeAttr("data-redactor-tag"),this.utils.normalizeTextNodes(t[s])}return t},_cleanEmptyClass:function(t){t.each(function(t){""===t.className&&t.removeAttribute("class")})},_cleanEmptyStyle:function(t){this.utils.removeEmptyAttr(t.get(),"style")?t.removeAttr("data-redactor-style-cache"):t.attr("data-redactor-style-cache",t.attr("style"))},_apply:function(t,e,i,s,n){!1!==s&&this.selection.save();var r=this._getElements(i,n);if(e.class&&("set"===t?(r.removeAttr("class"),r.addClass(e.class)):"add"===t?r.addClass(e.class):"toggle"===t?r.toggleClass(e.class):"remove"===t&&r.removeClass(e.class),this._cleanEmptyClass(r)),e.attr&&("set"===t?(this._removeAllAttr(r),r.attr(e.attr)):"add"===t?r.attr(e.attr):"toggle"===t?(o=e.attr,r.each(function(t){var e=$R.dom(t);for(var i in o)e.attr(i)?e.removeAttr(i):e.attr(i,o[i])})):"remove"===t&&r.removeAttr(e.attr)),e.style)if("set"===t)r.removeAttr("style"),r.css(e.style),r.each(function(t){var e=$R.dom(t);e.attr("data-redactor-style-cache",e.attr("style"))});else if("add"===t){var o=e.style;r.each(function(t){var e=$R.dom(t);e.css(o),e.attr("data-redactor-style-cache",e.attr("style")),this._convertStyleQuotes(e)}.bind(this))}else if("toggle"===t){o=e.style;r.each(function(t){var e=$R.dom(t);for(var i in o){var s=o[i],n=e.css(i);n=this.utils.isRgb(n)?this.utils.rgb2hex(n):n.replace(/"/g,""),s=this.utils.isRgb(s)?this.utils.rgb2hex(s):s.replace(/"/g,""),n=this.utils.hex2long(n),("string"==typeof(s=this.utils.hex2long(s))?s.toLowerCase():s)===("string"==typeof n?n.toLowerCase():n)?e.css(i,""):e.css(i,s)}this._convertStyleQuotes(e),this._cleanEmptyStyle(e)}.bind(this))}else if("remove"===t){var a=e.style;r.each(function(t){var e=$R.dom(t);e.css(a,""),this._cleanEmptyStyle(e)}.bind(this))}return n=r.getAll(),!1!==s&&this._restoreSelection(n),n},_applyArgs:function(t){return t=this.params.args?this._apply(this.params.type,this.params.args,!1,!1,t):this._clear(!1,"all",!1,t)},_removeAllAttr:function(t,r){t.each(function(t){var e=["data-redactor-tag","data-redactor-style-cache"];!1===r&&(e.push("style"),e.push("class"));for(var i=t.attributes.length;0<i--;){var s=t.attributes[i],n=s.name;-1===e.indexOf(n)&&t.removeAttributeNode(s)}})},_restoreSelection:function(t){this._isCurrentBlockOneAndEmpty(t)?this.caret.setStart(t[0]):setTimeout(function(){this.selection.restore()}.bind(this),1)},_convertStyleQuotes:function(t){var e=t.attr("style");e&&t.attr("style",e.replace(/"/g,"'"))}}),$R.add("service","inline",{mixins:["formatter"],init:function(t){this.app=t,this.count=0},format:function(t){if(!this._isFormat())return[];this.type=t.type?t.type:"set",this.tag="string"==typeof t?t:t.tag,this.tag=this.tag.toLowerCase(),this.tag=this.arrangeTag(this.tag),"string"==typeof t?this.args=!1:this.buildArgs(t),this.detector.isIe()||this.editor.disableNonEditables();var e=this.selection.isCollapsed()?this.formatCollapsed():this.formatUncollapsed();return this.detector.isIe()||this.editor.enableNonEditables(),e},_isFormat:function(){var t=this.selection.getCurrent(),e=this.inspector.parse(t),i=e.isComponent()&&!e.isComponentType("table")&&!e.isFigcaption();return!(!1!==t||!this.selection.isAll())||!(!t||e.isPre()||e.isCode()||i)},arrangeTag:function(t){var e=this.opts.replaceTags;for(var i in e)t===i&&(t=e[i]);return t},formatCollapsed:function(){var t,e,i,s,n=[],r=this.selection.getInlineFirst(),o=this.selection.getInlines({all:!0}),a=$R.dom(r);if(r){var l=this.inspector.parse(r);if(this.utils.isEmptyHtml(r.innerHTML))if(r.tagName.toLowerCase()===this.tag)if(this.hasSameArgs(r)){this.caret.setAfter(r),a.remove();var h=this.selection.getElement();this.utils.normalizeTextNodes(h)}else"span"===this.tag?(n=this.applyArgs([r],!1),this.caret.setStart(r)):n=this.insertInline(n);else l.hasParent([this.tag])?(e=(t=a.closest(this.tag)).get(),this.hasSameArgs(e)?(t.unwrap(),this.caret.setStart(r)):n=this.insertInline(n)):n=this.insertInline(n);else if(r.tagName.toLowerCase()===this.tag)this.hasSameArgs(r)?(s=this.utils.extractHtmlFromCaret(r),i=$R.dom("<"+this.tag+" />"),i=this.utils.cloneAttributes(r,i),a.after(i.append(s)),""===i.html().trim()&&i.remove(),this.caret.setAfter(r)):n=this.insertInline(n);else if(l.hasParent([this.tag]))if(e=(t=a.closest(this.tag)).get(),this.hasSameArgs(e)){var c,d;s=this.utils.extractHtmlFromCaret(e,e),i=$R.dom("<"+this.tag+" />"),i=this.utils.cloneAttributes(e,i);var u=0;o=o.reverse();for(var p=0;p<o.length;p++)o[p]!==e&&(d=$R.dom("<"+o[p].tagName.toLowerCase()+">"),0===u?c=d:c.append(d),u++);t.after(i.append(s)),t.after(c),this.caret.setStart(d)}else n=this.insertInline(n);else n=this.insertInline(n)}else n=this.insertInline(n);return n},insertInline:function(t){var e=document.createElement(this.tag);return t=this.insertion.insertNode(e,"start"),this.applyArgs(t,!1)},hasSameArgs:function(t){if(0===t.attributes.length&&!1===this.args)return!0;var e=!0;if(this.args){var i=0;for(var s in this.args){var n=$R.dom(t),r=this.args[s],o=this.utils.toParams(r),a=n.attr(s);if(r)if("style"===s){o=o.trim().replace(/;$/,"");for(var l=this.utils.styleToObj(n.attr("style")),h=o.split(";"),c=0,d=0;d<h.length;d++){var u=h[d].split(":"),p=u[0].trim(),f=u[1].trim();if(-1!==p.search(/color/)){var m=n.css(p);!m||m!==f&&this.utils.rgb2hex(m)!==f||c++}else n.css(p)===f&&c++}c===h.length&&Object.keys(l).length===h.length&&i++}else a===o&&i++;else a&&""!==a||i++}e=i===Object.keys(this.args).length}return e},formatUncollapsed:function(){var t=this.selection.getInlines({all:!0,inside:!0});this.detector.isIe()?this.selection.saveMarkers():this.selection.save(),this._convertTags("u"),this._convertTags("del"),this._convertToStrike(t),this.detector.isIe()?this.selection.restoreMarkers():this.selection.restore(),document.execCommand("strikethrough"),this._clearDecoration(),this.selection.save();var e=this._revertToInlines();e=this.applyArgs(e,!1);for(var i=0;i<e.length;i++){var s=e[i],n=s.tagName.toLowerCase(),r=s.attributes.length;n===this.tag&&0===r&&this.args&&($R.dom(s).unwrap(),e.splice(i,1))}return this.selection.restore(),this._clearEmptyStyle(),e=this._normalizeBlocks(e)},_convertTags:function(e){this.tag!==e&&this.editor.getElement().find(e).each(function(t){this.utils.replaceToTag(t,"span").addClass("redactor-convertable-"+e)}.bind(this))},_revertTags:function(i){this.editor.getElement().find("span.redactor-convertable-"+i).each(function(t){var e=this.utils.replaceToTag(t,i);e.removeClass("redactor-convertable-"+i),this.utils.removeEmptyAttr(e,"class")&&e.removeAttr("class")}.bind(this))},_convertToStrike:function(t){for(var e=this.selection.getText().replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"),i=0;i<t.length;i++){var s=this.arrangeTag(t[i].tagName.toLowerCase()),n=t[i],r=$R.dom(n),o=this.hasSameArgs(n);s===this.tag&&("span"===this.tag&&this._isTextSelected(n,e)?r.addClass("redactor-convertable-apply"):o&&"a"!==this.tag?this._replaceToStrike(r):"span"===this.tag?r.addClass("redactor-unconvertable-apply"):o||r.addClass("redactor-convertable-apply"))}},_replaceToStrike:function(t){t.replaceWith(function(){return $R.dom("<strike>").append(t.contents())})},_revertToInlines:function(){var i=[],t=this.editor.getElement();return"u"!==this.tag&&t.find("u").unwrap(),t.find(".redactor-convertable-u").each(function(t){i.push(t)}),t.find(".redactor-convertable-apply").each(function(t){var e=$R.dom(t);e.find("strike").unwrap(),this._forceRemoveClass(e,"redactor-convertable-apply"),i.push(t)}.bind(this)),t.find("span.redactor-unconvertable-apply").each(function(t){var e=$R.dom(t);this._forceRemoveClass(e,"redactor-unconvertable-apply")}.bind(this)),t.find("strike").each(function(t){var e=this.utils.replaceToTag(t,this.tag);i.push(e.get())}.bind(this)),this._revertTags("u"),this._revertTags("del"),i},_normalizeBlocks:function(e){var t=this.opts.inlineTags,i=this.selection.getBlocks();if(i)for(var s=0;s<i.length;s++){if("PRE"===i[s].tagName)$R.dom(i[s]).find(t.join(",")).not(".redactor-selection-marker").each(function(t){-1!==e.indexOf(t)&&(e=this.utils.removeFromArrayByValue(e,t)),$R.dom(t).unwrap()}.bind(this))}return e},_clearDecoration:function(){this.editor.getElement().find(this.opts.inlineTags.join(",")).each(function(t){if("line-through"===t.style.textDecoration||"line-through"===t.style.textDecorationLine){var e=$R.dom(t);e.css("textDecorationLine",""),e.css("textDecoration",""),e.wrap("<strike>")}})},_clearEmptyStyle:function(){for(var t=this.getInlines(),e=0;e<t.length;e++){this._clearEmptyStyleAttr(t[e]);var i=t[e].childNodes;if(i)for(var s=0;s<i.length;s++)this._clearEmptyStyleAttr(i[s])}},_clearEmptyStyleAttr:function(t){3!==t.nodeType&&this.utils.removeEmptyAttr(t,"style")&&(t.removeAttribute("style"),t.removeAttribute("data-redactor-style-cache"))},_forceRemoveClass:function(t,e){t.removeClass(e),this.utils.removeEmptyAttr(t,"class")&&t.removeAttr("class")},_isTextSelected:function(t,e){var i=this.utils.removeInvisibleChars(t.textContent);return e===i||-1!==e.search(new RegExp("^"+this.utils.escapeRegExp(i)+"$"))},getInlines:function(t){return t?this.selection.getInlines({tags:t,all:!0}):this.selection.getInlines({all:!0})},getElements:function(t){return $R.dom(this.getInlines(t))},clearFormat:function(){this.selection.save();for(var t=this.selection.getInlines({all:!0}),e=0;e<t.length;e++){var i=$R.dom(t[e]);this.selection.getInline(t[e])&&i.unwrap()}this.selection.restore()}}),$R.add("service","autoparser",{init:function(t){this.app=t,this.cleaner=this.app.cleaner},observe:function(){var t=this.editor.getElement().find(".redactor-autoparser-object").each(function(t){var e=$R.dom(t);e.removeClass("redactor-autoparser-object"),""===e.attr("class")&&e.removeAttr("class")});0<t.length&&t.each(function(t){var e,i=!1,s=t.tagName;"A"===s?e="link":"IMG"===s?e="image":"IFRAME"===s&&(e="video"),e&&(i=$R.create(e+".component",this.app,t),this.app.broadcast(e+".inserted",i),this.app.broadcast("autoparse",e,i))}.bind(this))},format:function(t,e){this._isKey(e)&&this._format(e===this.keycodes.ENTER)},parse:function(t){var e=["figure","form","pre","iframe","code","a","img"],i=[],s=0,n=[];t=this.cleaner.storeComments(t,n),t=(t=(t=this.cleaner.encodeCode(t)).replace(/\$/g,"$")).replace(/&/g,"&");for(var r=0;r<e.length;r++){var o="img"===e[r]?"<"+e[r]+"[^>]*>":"<"+e[r]+"([\\w\\W]*?)</"+e[r]+">";if(null!==(u=t.match(new RegExp(o,"gi"))))for(var a=0;a<u.length;a++)t=t.replace(u[a],"#####replaceparse"+s+"#####"),i.push(u[a]),s++}if(this.opts.autoparseImages&&t.match(this.opts.regex.imageurl)){var l=t.match(this.opts.regex.imageurl);for(r=0;r<l.length;r++)t=t.replace(l[r],'<img class="redactor-autoparser-object" src="'+l[r]+'">')}if(this.opts.autoparseVideo&&(t.match(this.opts.regex.youtube)||t.match(this.opts.regex.vimeo))){var h,c;t.match(this.opts.regex.youtube)?(h="//www.youtube.com/embed/$1",c=this.opts.regex.youtube):t.match(this.opts.regex.vimeo)&&(h="//player.vimeo.com/video/$2",c=this.opts.regex.vimeo);var d=this.component.create("video",'<iframe width="500" height="281" src="'+h+'" frameborder="0" allowfullscreen></iframe>');t=t.replace(c,d.get().outerHTML)}for(r=0;r<e.length;r++){var u;o="img"===e[r]?"<"+e[r]+"[^>]*>":"<"+e[r]+"([\\w\\W]*?)</"+e[r]+">";if(null!==(u=t.match(new RegExp(o,"gi"))))for(a=0;a<u.length;a++)t=t.replace(u[a],"#####replaceparse"+s+"#####"),i.push(u[a]),s++}return this.opts.autoparseLinks&&t.match(this.opts.regex.url)&&(t=this._formatLinks(t)),t=this._restoreReplaced(i,t),t=this._restoreReplaced(i,t),t=this.cleaner.restoreComments(t,n)},_isKey:function(t){return t===this.keycodes.ENTER||t===this.keycodes.SPACE},_format:function(t){var e=this.selection.getParent(),i=$R.dom(e);if(!(e&&0!==i.closest("figure, pre, code, img, a, iframe").length)&&this.selection.isCollapsed()){var s=this.utils.createInvisibleChar();this.selection.getRange().insertNode(s);var n=this.selection.getCurrent(),r=this.inspector.parse(n),o=$R.dom(n);if(s.parentNode.removeChild(s),n&&3===n.nodeType){var a,l=n.textContent;if(this.opts.autoparseImages&&l.match(this._convertToRegExp(this.opts.regex.imageurl))){var h=r.isList(),c=l.match(this.opts.regex.imageurl),d=h?void 0:"<figure><img></figure>",u=this.component.create("image",d);u.setSrc(c[0]),u.addClass("redactor-autoparser-object"),l=l.replace(c[0],u.get().outerHTML),a="image"}else if(this.opts.autoparseVideo&&(l.match(this._convertToRegExp(this.opts.regex.youtube))||l.match(this._convertToRegExp(this.opts.regex.vimeo)))){var p,f;l.match(this.opts.regex.youtube)?(p="//www.youtube.com/embed/$1",f=this.opts.regex.youtube):l.match(this.opts.regex.vimeo)&&(p="//player.vimeo.com/video/$2",f=this.opts.regex.vimeo);var m=this.component.create("video",'<iframe width="500" height="281" src="'+p+'" frameborder="0" allowfullscreen></iframe>');m.addClass("redactor-autoparser-object"),l=l.replace(f,m.get().outerHTML),a="video"}else this.opts.autoparseLinks&&l.match(this._convertToRegExp(this.opts.regex.url))&&(l=this._formatLinks(l,t),a="link");if(a){t?(this.selection.save(),o.replaceWith(l),this.selection.restore()):o.replaceWith(l);var g=this.editor.getElement().find(".redactor-autoparser-object").removeClass("redactor-autoparser-object");if(g="link"===a?$R.create("link.component",this.app,g):g,"link"===a)t||this.caret.setAfter(g),this.app.broadcast("link.inserted",g);else{this.caret.setAfter(g);var v=g.clone();g.remove(),g=this.insertion.insertHtml(v),g=this.component.build(g)}this.app.broadcast("autoparse",a,g)}}}},_formatLinks:function(t,e){for(var i=t.match(this.opts.regex.url),s={},n=0;n<i.length;n++){e&&-1!==i[n].search(/\.$/)&&(i[n]=i[n].replace(/\.$/,""));var r=i[n],o=r,a=null!==r.match(/(https?|ftp):\/\//i)?"":"http://",l=-1!==["/","&","="].indexOf(r.slice(-1))?"":"\\b",h=!1!==this.opts.pasteLinkTarget?' target="'+this.opts.pasteLinkTarget+'"':"";o=-1===(o=o.length>this.opts.linkSize?o.substring(0,this.opts.linkSize)+"...":o).search("%")?decodeURIComponent(o):o;s["("+r.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")+l+")"]='<a href="'+a+r.trim()+'"'+h+' class="redactor-autoparser-object">'+o.trim()+"</a>"}for(var c in s)t=t.replace(new RegExp(c,"g"),s[c]);return t},_restoreReplaced:function(t,e){for(var i=0;i<t.length;i++)e=e.replace("#####replaceparse"+i+"#####",t[i]);return e},_convertToRegExp:function(t){return new RegExp(String(t).replace(/^\//,"").replace(/\/ig$/,"").replace(/\/gi$/,"")+"$","gi")}}),$R.add("service","storage",{init:function(t){this.app=t,this.data=[]},observeImages:function(){this.opts.imageObserve&&this.editor.getElement().find("[data-image]").each(this._addImage.bind(this))},observeFiles:function(){this.editor.getElement().find("[data-file]").each(this._addFile.bind(this))},setStatus:function(t,e){this.data[t].status=e},getChanges:function(){var t=this.editor.getElement();for(var e in this.data){var i=this.data[e],s=t.find("[data-"+i.type+'="'+i.id+'"]');this.setStatus(i.id,0!==s.length)}return this.data},add:function(t,e){var i=$R.dom(e),s=i.attr("data-"+t);this.data[s]={type:t,status:!0,node:i.get(),id:i.attr("data-"+t)}},_addImage:function(t){this.add("image",t)},_addFile:function(t){this.add("file",t)}}),$R.add("service","utils",{init:function(t){this.app=t},isEmpty:function(t){var e=!1;return(t=$R.dom(t).get())&&(e=3===t.nodeType?""===t.textContent.trim().replace(/\n/,""):""===t.innerHTML),e},isEmptyHtml:function(t,e,i){return t=(t=(t=(t=(t=(t=this.removeInvisibleChars(t)).replace(/ /gi,"")).replace(/<\/?br\s?\/?>/g,e?"br":"")).replace(/\s/g,"")).replace(/^<p>[^\W\w\D\d]*?<\/p>$/i,"")).replace(/^<div>[^\W\w\D\d]*?<\/div>$/i,""),i&&(t=(t=t.replace(/<ul(.*?[^>])>$/i,"ul")).replace(/<ol(.*?[^>])>$/i,"ol")),""===(t=(t=(t=(t=(t=(t=t.replace(/<hr(.*?[^>])>$/i,"hr")).replace(/<iframe(.*?[^>])>$/i,"iframe")).replace(/<source(.*?[^>])>$/i,"source")).replace(/<[^\/>][^>]*><\/[^>]+>/gi,"")).replace(/<[^\/>][^>]*><\/[^>]+>/gi,"")).trim())},trimSpaces:function(t){return this.removeInvisibleChars(t.trim())},createInvisibleChar:function(){return document.createTextNode(this.opts.markerChar)},searchInvisibleChars:function(t){return t.search(/^\uFEFF$/g)},removeInvisibleChars:function(t){return t.replace(/\uFEFF/g,"")},trimInvisibleChars:function(t){if(this.selection.isCollapsed()){var e=this.selection.getCurrent(),i="left"===t?this.selection.getTextBeforeCaret():this.selection.getTextAfterCaret();if(e&&3===e.nodeType&&0===this.searchInvisibleChars(i))if("left"===t)$R.dom(e).replaceWith(e.textContent.trim());else{var s=this.offset.get();this.offset.set({start:s.start+1,end:s.end+1})}}},buildWrapper:function(t){return $R.dom("<div>").html(t)},getWrapperHtml:function(t){var e=t.html();return t.remove(),e},createTmpContainer:function(t){var e=$R.dom("<div>");return"string"==typeof t?e.html(t):e.append($R.dom(t).clone(!0)),e.get()},createFragment:function(t){for(var e,i,s,n=this.createTmpContainer(t),r=document.createDocumentFragment(),o=[],a=0;e=n.firstChild;){a++;var l=r.appendChild(e);1===a&&(i=l),o.push(l),s=l}return{frag:r,first:i,last:s,nodes:o}},isFragment:function(t){return"object"==typeof t&&t.frag},parseHtml:function(t){var e=this.createTmpContainer(t);return{html:e.innerHTML,nodes:e.childNodes}},splitNode:function(t,e,i,s){var n;e=this.isFragment(e)?e.frag:e,n=s?this.inspector.isInlineTag(t.tagName)?t:this.selection.getInline(t):this.inspector.isBlockTag(t.tagName)?t:this.selection.getBlock(t);var r=$R.dom(n);if(!s&&this.isEmptyHtml(n.innerHTML,!0))return r.after(e),r.remove(),e;var o=r.get().tagName.toLowerCase(),a=this.caret.isEnd(n),l=this.caret.isStart(n);if(!a&&!l){var h=this.extractHtmlFromCaret(s),c=$R.dom("<"+o+" />");c=this.cloneAttributes(n,c),r.after(c.append(h))}if(l)return r.before(e);if(i)return r.append(e);e=r.after(e);var d=r.html();return""===(d=(d=this.removeInvisibleChars(d)).replace(/ /gi,""))&&r.remove(),e},extractHtmlFromCaret:function(t,e){var i=this.selection.getRange();if(i&&(e=e||(t?this.selection.getInline():this.selection.getBlock()))){var s=i.cloneRange();return s.selectNodeContents(e),s.setStart(i.endContainer,i.endOffset),s.extractContents()}},createMarkup:function(t){var e=document.createElement(this.opts.markup);this.opts.breakline&&e.setAttribute("data-redactor-tag","br"),$R.dom(t).after(e),this.caret.setStart(e)},createMarkupBefore:function(t){var e=document.createElement(this.opts.markup);this.opts.breakline&&e.setAttribute("data-redactor-tag","br"),$R.dom(t).before(e),this.caret.setEnd(e)},getNode:function(t){var e=$R.dom(t).get(),i=this.editor.getElement().get();return void 0===t?i:e||!1},findSiblings:function(t,e){for(t=$R.dom(t).get(),e="next"===e?"nextSibling":"previousSibling";t=t[e];)if((3!==t.nodeType||""!==t.textContent.trim())&&"BR"!==t.tagName)return t;return!1},getElementsFromHtml:function(t,e,i){var s=document.createElement("div");s.innerHTML=t;var n=s.querySelectorAll(e);return function(t,e){if("number"==typeof this.length&&"function"==typeof t){var i=[];if("object"==typeof this)for(var s=0;s<this.length;s++){if(!(s in this))return;i[s]=t.call(e||this,this[s],s,this)}return i}}.call(n,function(t){var e=t.getAttribute("data-redactor-type");if(!i||!e||e!==i)return t.outerHTML})},getChildNodes:function(t,e,i){var s=(t=t&&t.nodeType&&11===t.nodeType?t:$R.dom(t).get()).childNodes,n=[];if(s)for(var r=0;r<s.length;r++)if(!(!0===i&&3===s[r].nodeType||3===s[r].nodeType&&this.isEmpty(s[r])||(n.push(s[r]),!1===e))){var o=this.getChildNodes(s[r],i);0<o.length&&(n=n.concat(o))}return n},getChildElements:function(t){return this.getChildNodes(t,!0,!0)},getFirstNode:function(t){return this._getFirst(this.getChildNodes(t,!1))},getLastNode:function(t){return this._getLast(this.getChildNodes(t,!1))},getFirstElement:function(t){return this._getFirst(this.getChildNodes(t,!1,!0))},getLastElement:function(t){return this._getLast(this.getChildNodes(t,!1,!0))},replaceToTag:function(t,n){return $R.dom(t).replaceWith(function(t){var e=$R.dom("<"+n+">").append($R.dom(t).contents());if(t.attributes)for(var i=t.attributes,s=0;s<i.length;s++)e.attr(i[s].nodeName,i[s].value);return e})},ucfirst:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},removeFromArrayByValue:function(t,e){for(var i,s=arguments,n=s.length;1<n&&t.length;)for(e=s[--n];-1!==(i=t.indexOf(e));)t.splice(i,1);return t},removeEmptyAttr:function(t,e){var i=$R.dom(t);return void 0===i.attr(e)||null===i.attr(e)||""===i.attr(e)&&(i.removeAttr(e),!0)},cloneAttributes:function(t,e){t=$R.dom(t).get(),e=$R.dom(e);for(var i=t.attributes,s=i.length;s--;){var n=i[s];e.attr(n.name,n.value)}return e},toParams:function(t){if("object"!=typeof t)return t;var e=Object.keys(t);if(!e.length)return"";for(var i="",s=0;s<e.length;s++){var n=e[s];i+=n+":"+t[n]+";"}return i},styleToObj:function(t){var e={};if(t)for(var i=t.replace(/;$/,"").split(";"),s=0;s<i.length;s++){var n=i[s].split(":");e[n[0].trim()]=n[1].trim()}return e},checkProperty:function(t){for(var e=arguments[1]&&Array.isArray(arguments[1])?arguments[1]:[].slice.call(arguments,1),i=0;i<e.length;i++){if(!t||void 0===t[e[i]])return!1;t=t[e[i]]}return t},extendData:function(r,t){for(var e in t){if("elements"===e)$R.dom(t[e]).each(function(t){var e=$R.dom(t);if("FORM"===t.tagName){var i=e.serialize(!0);for(var s in i)r=this._setData(r,s,i[s])}else{var n=e.attr("name")?e.attr("name"):e.attr("id");r=this._setData(r,n,e.val())}}.bind(this));else r=this._setData(r,e,t[e])}return r},_setData:function(t,e,i){return t instanceof FormData?t.append(e,i):t[e]=i,t},normalizeTextNodes:function(t){(t=$R.dom(t).get())&&t.normalize()},isRgb:function(t){return 0===t.search(/^rgb/i)},rgb2hex:function(t){return(t=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===t.length?"#"+("0"+parseInt(t[1],10).toString(16)).slice(-2)+("0"+parseInt(t[2],10).toString(16)).slice(-2)+("0"+parseInt(t[3],10).toString(16)).slice(-2):""},hex2long:function(t){return-1!==t.search(/^#/)&&4===t.length&&(t="#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),t},escapeRegExp:function(t){return t.replace(/[-\/\\^$*~+?.()|[\]{}]/g,"\\$&")},getRandomId:function(){for(var t="",e="abcdefghijklmnopqrstuvwxyz0123456789",i=0;i<12;i++)t+=e.charAt(Math.floor(Math.random()*e.length));return t},_getFirst:function(t){return 0!==t.length&&t[0]},_getLast:function(t){return 0!==t.length&&t[t.length-1]}}),$R.add("service","progress",{init:function(t){this.app=t,this.$box=null,this.$bar=null},show:function(){this._is()||this._build(),this.$box.show()},hide:function(){this._is()&&this.animate.start(this.$box,"fadeOut",this._destroy.bind(this))},update:function(t){this.show(),this.$bar.css("width",t+"%")},_is:function(){return null!==this.$box},_build:function(){this.$bar=$R.dom("<span />"),this.$box=$R.dom('<div id="redactor-progress" />'),this.$box.append(this.$bar),this.$body.append(this.$box)},_destroy:function(){this._is()&&this.$box.remove(),this.$box=null,this.$bar=null}}),$R.add("module","starter",{init:function(t){this.app=t,this.opts=t.opts,this.plugin=t.plugin,this.module=t.module},onstart:function(){this._startStop("start",this.app,["element","container","source","editor","statusbar","toolbar"]),this._startStop("start",this.module,["element","container","source","editor","statusbar","contextbar","input"])},onstop:function(){this._startStop("stop",this.module,["observer","element","container","source","editor","contextbar"])},onenable:function(){var t=this.opts.plugins;this._startStop("start",this.module,["observer","toolbar"]),this._startStop("start",this.plugin,t)},ondisable:function(){var t=this.opts.plugins;this._startStop("stop",this.module,["observer","toolbar"]),this._startStop("stop",this.plugin,t)},_startStop:function(t,e,i){for(var s=0;s<i.length;s++)void 0!==e[i[s]]&&this.app.callInstanceMethod(e[i[s]],t)}}),$R.add("module","element",{init:function(t){this.app=t,this.uuid=t.uuid,this.opts=t.opts,this.namespace=t.namespace,this.element=t.element,this.rootOpts=$R.extend({},!0,$R.options,t.rootOpts)},start:function(){this._build(),this._buildModes(),this._buildMarkup()},stop:function(){this.element.getElement().removeData(this.namespace+"-uuid")},_build:function(){this.element.getElement().data(this.namespace+"-uuid",this.uuid)},_buildModes:function(){var t=this.element.getType();"inline"===t&&this._redefineOptions(this.opts.modes.inline),"div"===t&&this._redefineOptions(this.opts.modes.original),"inline"!==t&&(this._isRootOption("styles")&&this.rootOpts.styles&&(this.opts.styles=!0),this._isRootOption("source")&&!this.rootOpts.source&&(this.opts.showSource=!1))},_buildMarkup:function(){"inline"===this.element.getType()?this.opts.emptyHtml="":this.opts.breakline?(this.opts.markup="div",this.opts.emptyHtml='<div data-redactor-tag="br">'+this.opts.markerChar+"</div>"):this.opts.emptyHtml="<"+this.opts.markup+"></"+this.opts.markup+">"},_redefineOptions:function(t){for(var e in t)this.opts[e]=t[e]},_isRootOption:function(){return void 0!==this.rootOpts.styles}}),$R.add("module","editor",{init:function(t){this.app=t,this.uuid=t.uuid,this.opts=t.opts,this.editor=t.editor,this.source=t.source,this.element=t.element,this.component=t.component,this.container=t.container,this.inspector=t.inspector,this.autoparser=t.autoparser,this.placeholder=!1,this.events=!1},onenable:function(){this.enable()},ondisable:function(){this.disable()},onenablefocus:function(){this._enableFocus()},oncontextmenu:function(t){this.component.setOnEvent(t,!0)},onclick:function(t){this.component.setOnEvent(t)},onkeyup:function(t){this.inspector.parse(t.target).isComponent()||this.component.clearActive()},onenablereadonly:function(){this._enableReadOnly()},ondisablereadonly:function(){this._disableReadOnly()},onautoparseobserve:function(){this.autoparser.observe()},onplaceholder:{build:function(){this._buildPlaceholder()},toggle:function(){this._togglePlacehodler()}},start:function(){this._build(),this._buildEvents(),this._buildOptions(),this._buildAccesibility()},stop:function(){var t=this.editor.getElement(),e=this.container.getElement(),i=["redactor-in","redactor-in-"+this.uuid,"redactor-structure","redactor-placeholder","notranslate"];""!==this.opts.stylesClass&&i.push(this.opts.stylesClass);t.removeAttr("spellcheck"),t.removeAttr("dir"),t.removeAttr("contenteditable"),t.removeAttr("placeholder"),t.removeAttr("data-gramm_editor"),t.removeClass(i.join(" ")),e.removeClass(["redactor-focus","redactor-blur","redactor-over","redactor-styles-on","redactor-styles-off","redactor-toolbar-on","redactor-text-labeled-on","redactor-source-view"].join(" ")),this._destroyEvents(),0===t.get().classList.length&&t.removeAttr("class")},enable:function(){var t=this.editor.getElement(),e=this.container.getElement();t.addClass("redactor-in redactor-in-"+this.uuid),t.attr({contenteditable:!0}),this.opts.structure&&t.addClass("redactor-structure"),!this.opts.toolbar||this.opts.air||this.opts.toolbarExternal||e.addClass("redactor-toolbar-on"),this._disableBrowsersEditing()},disable:function(){var t=this.editor.getElement(),e=this.container.getElement();t.removeClass("redactor-in redactor-in-"+this.uuid),t.removeClass("redactor-structure"),t.removeAttr("contenteditable"),e.addClass("redactor-toolbar-on")},_build:function(){var t=this.editor.getElement(),e=this.element.getElement(),i=this.container.getElement();i.addClass("redactor-blur"),this.opts.grammarly||t.attr("data-gramm_editor",!1),this.opts.notranslate&&t.addClass("notranslate"),this.opts.styles?(t.addClass(this.opts.stylesClass),i.addClass("redactor-styles-on")):i.addClass("redactor-styles-off"),this.opts.buttonsTextLabeled&&i.addClass("redactor-text-labeled-on"),this.element.isType("textarea")&&e.before(t)},_buildEvents:function(){this.events=$R.create("editor.events",this.app)},_buildOptions:function(){var t=this.editor.getElement();t.attr("dir",this.opts.direction),this.opts.spellcheck||t.attr("spellcheck",!1),this.opts.tabindex&&t.attr("tabindex",this.opts.tabindex),this.opts.minHeight&&t.css("min-height",this.opts.minHeight),this.opts.maxHeight&&t.css("max-height",this.opts.maxHeight),this.opts.maxWidth&&t.css({"max-width":this.opts.maxWidth,margin:"auto"})},_buildAccesibility:function(){this.editor.getElement().attr({"aria-labelledby":"redactor-voice-"+this.uuid,role:"presentation"})},_buildPlaceholder:function(){this.placeholder=$R.create("editor.placeholder",this.app)},_enableFocus:function(){this.opts.showSource?this._enableFocusSource():this._enableFocusEditor()},_enableFocusSource:function(){var t=this.source.getElement();this.opts.focus?(t.focus(),t.get().setSelectionRange(0,0)):this.opts.focusEnd&&t.focus()},_enableFocusEditor:function(){this.opts.focus?setTimeout(this.editor.startFocus.bind(this.editor),100):this.opts.focusEnd&&setTimeout(this.editor.endFocus.bind(this.editor),100)},_togglePlacehodler:function(){this.placeholder&&this.placeholder.toggle()},_disableBrowsersEditing:function(){try{document.execCommand("enableObjectResizing",!1,!1),document.execCommand("enableInlineTableEditing",!1,!1),document.execCommand("AutoUrlDetect",!1,!1);var t=this.editor.getElement().get();t.addEventListener?t.addEventListener("mscontrolselect",function(t){t.preventDefault()}):t.attachEvent("oncontrolselect",function(t){t.returnValue=!1})}catch(t){}},_destroyEvents:function(){this.events&&this.events.destroy()},_enableReadOnly:function(){var t=this.editor.getElement();this._getEditables(t).removeAttr("contenteditable"),t.removeAttr("contenteditable"),t.addClass("redactor-read-only"),this.events&&this.events.destroy()},_disableReadOnly:function(){var t=this.editor.getElement();this._getEditables(t).attr({contenteditable:!0}),t.removeClass("redactor-read-only"),t.attr({contenteditable:!0}),this._buildEvents()},_getEditables:function(t){return t.find("figcaption, td, th")}}),$R.add("class","editor.placeholder",{init:function(t){this.app=t,this.opts=t.opts,this.editor=t.editor,this.element=t.element,this.build()},build:function(){var t=this.element.getElement(),e=this.editor.getElement();if(!1!==this.opts.placeholder||t.attr("placeholder")){var i=!1!==this.opts.placeholder?this.opts.placeholder:t.attr("placeholder");e.attr("placeholder",i),this.toggle()}},toggle:function(){return this.editor.isEmpty(!0)?this.show():this.hide()},show:function(){this.editor.getElement().addClass("redactor-placeholder")},hide:function(){this.editor.getElement().removeClass("redactor-placeholder")}}),$R.add("class","editor.events",{init:function(t){this.app=t,this.opts=t.opts,this.$doc=t.$doc,this.uuid=t.uuid,this.source=t.source,this.editor=t.editor,this.cleaner=t.cleaner,this.container=t.container,this.insertion=t.insertion,this.inspector=t.inspector,this.selection=t.selection,this.component=t.component,this.blurNamespace=".redactor-blur."+this.uuid,this.eventsList=["paste","click","contextmenu","keydown","keyup","mouseup","touchstart","cut","copy","dragenter","dragstart","drop","dragover","dragleave"],this._init()},destroy:function(){this.editor.getElement().off(".redactor-focus"),this.$doc.off("keyup"+this.blurNamespace+" mousedown"+this.blurNamespace),this._loop("off")},focus:function(t){var e=this.container.getElement();this.editor.isPasting()||e.hasClass("redactor-focus")||(e.addClass("redactor-focus"),e.removeClass("redactor-blur"),this.app.broadcast("observe",t),this.app.broadcast("focus",t),this.isFocused=!0,this.isBlured=!1)},blur:function(t){var e=this.container.getElement(),i=$R.dom(t.target),s=[".redactor-in-"+this.uuid,".redactor-toolbar",".redactor-dropdown",".redactor-context-toolbar",".redactor-modal-box","#redactor-image-resizer"];this.app.broadcast("originalblur",t),this.app.stopBlur||this.app.isStarted()&&!this.editor.isPasting()&&0===i.closest(s.join(",")).length&&(this.isBlured||e.hasClass("redactor-blur")||(e.removeClass("redactor-focus"),e.addClass("redactor-blur"),this.app.broadcast("blur",t),this.isFocused=!1,this.isBlured=!0))},cut:function(t){var e=this.selection.getCurrent(),i=this.inspector.parse(e);this.app.broadcast("state",t),this.component.isNonEditable(e)&&(this._passSelectionToClipboard(t,i,!0),t.preventDefault())},copy:function(t){var e=this.selection.getCurrent(),i=this.inspector.parse(e);this.app.broadcast("state",t),this.component.isNonEditable(e)&&(this._passSelectionToClipboard(t,i,!1),t.preventDefault())},drop:function(t){if((t=t.originalEvent||t).stopPropagation(),this._removeOverClass(),!1!==this.opts.dragUpload){if(this.app.isDragComponentInside()){var e=$R.dom(this.app.getDragComponentInside()),i=e.clone(!0);return this.insertion.insertToPoint(t,i),e.remove(),this.app.setDragComponentInside(!1),this.app.broadcast("state",t),this.app.broadcast("drop",t),this.app.broadcast("image.observe",t),void t.preventDefault()}if(this.app.isDragInside()&&this.opts.input){this.insertion.insertPoint(t);var s=t.dataTransfer.getData("text/html"),n=this.selection.getRange();if(n){var r=this.selection.getBlocks();n.deleteContents();for(var o=0;o<r.length;o++)""===r[o].innerHTML&&$R.dom(r[o]).remove()}return $R.create("input.paste",this.app,t,!0,s,!0),this.app.broadcast("state",t),this.app.broadcast("drop",t),this.app.setDragInside(!1),void t.preventDefault()}this.app.broadcast("state",t),this.app.broadcast("paste",t,t.dataTransfer),this.app.broadcast("drop",t)}else t.preventDefault()},dragenter:function(t){t.preventDefault()},dragstart:function(t){this.app.setDragComponentInside(!1),this.app.setDragInside(!1);var e=this.inspector.parse(t.target);!e.isComponent()||e.isComponentEditable()||e.isFigcaption()?this.selection.is()&&!this.selection.isCollapsed()&&(this.app.setDragInside(!0),this._setDragData(t)):this.app.setDragComponentInside(e.getComponent()),this.app.broadcast("dragstart",t)},dragover:function(t){this.app.broadcast("dragover",t)},dragleave:function(t){this.app.broadcast("dragleave",t)},paste:function(t){this.app.broadcast("paste",t)},contextmenu:function(t){},click:function(t){if(3===t.detail){t.preventDefault();var e=this.selection.getBlock();if(e){var i=document.createRange();i.selectNodeContents(e),this.selection.setRange(i)}}var s=$R.dom(t.target);if(s.hasClass("redactor-in")){var n=s.offset().top,r=parseFloat(s.css("padding-bottom"));n+s.height()-2*r<t.pageY?this.app.broadcast("bottomclick",t):s.hasClass("redactor-placeholder")&&this.editor.startFocus(this.editor)}this.app.broadcast("state",t),this.app.broadcast("click",t)},keydown:function(t){if(this.app.broadcast("state",t),!1===this.app.broadcast("keydown",t))return t.preventDefault()},keyup:function(t){this.app.broadcast("keyup",t)},mouseup:function(t){this.app.broadcast("observe",t),this.app.broadcast("state",t)},touchstart:function(t){this.app.broadcast("observe",t),this.app.broadcast("state",t)},_init:function(){this.editor.getElement().on("focus.redactor-focus click.redactor-focus",this.focus.bind(this)),this.$doc.on("keyup"+this.blurNamespace+" mousedown"+this.blurNamespace,this.blur.bind(this)),this._loop("on")},_removeOverClass:function(){this.editor.getElement().removeClass("over")},_loop:function(t){for(var e=this.editor.getElement(),i=0;i<this.eventsList.length;i++){var s=this.eventsList[i]+".redactor-events",n=this.eventsList[i];e[t](s,this[n].bind(this))}},_passAllToClipboard:function(t){var e=t.clipboardData,i=this.source.getCode();e.setData("text/html",i),e.setData("text/plain",i.toString().replace(/\n$/,""))},_passSelectionToClipboard:function(t,e,i){var s=t.clipboardData,n=e.getComponent(),r=$R.dom(n).clone();r.find(".redactor-component-caret").remove(),r.removeClass("redactor-component-active"),r.removeAttr("contenteditable"),r.removeAttr("tabindex");var o=r.get().outerHTML;i&&this.component.remove(n),s.setData("text/html",o),s.setData("text/plain",o.toString().replace(/\n$/,""))},_setDragData:function(t){var e=(t=t.originalEvent||t).dataTransfer;e.effectAllowed="move",e.setData("text/Html",this.selection.getHtml())}}),$R.add("module","container",{init:function(t){this.app=t,this.uuid=t.uuid,this.opts=t.opts,this.lang=t.lang,this.element=t.element,this.container=t.container},start:function(){this._build(),this._buildAccesibility()},stop:function(){var t=this.element.getElement(),e=this.container.getElement();e.after(t),e.remove(),t.show()},_build:function(){var t=this.element.getElement(),e=this.container.getElement();e.addClass("redactor-box"),e.attr("dir",this.opts.direction),this.element.isType("inline")&&e.addClass("redactor-inline"),t.after(e),e.append(t)},_buildAccesibility:function(){var t=this.container.getElement(),e=$R.dom("<span />");e.addClass("redactor-voice-label"),e.attr({id:"redactor-voice-"+this.uuid,"aria-hidden":!1}),e.html(this.lang.get("accessibility-help-label")),t.prepend(e)}}),$R.add("module","source",{init:function(t){this.app=t,this.uuid=t.uuid,this.opts=t.opts,this.utils=t.utils,this.element=t.element,this.source=t.source,this.editor=t.editor,this.toolbar=t.toolbar,this.cleaner=t.cleaner,this.component=t.component,this.container=t.container,this.autoparser=t.autoparser,this.selection=t.selection,this.syncedHtml=""},onstartcode:function(){var t=this.source.getStartedContent(),e=this.editor.getElement(),i=this.source.getElement();this.opts.autoparse&&this.opts.autoparseStart&&(t=this.autoparser.parse(t));var s=this.cleaner.input(t,!0,!0),n=this.cleaner.output(s);e.html(s),i.val(n),this.syncedHtml=n,this.app.broadcast("placeholder.build"),this.app.broadcast("autoparseobserve"),this.component.executeScripts()},onstartcodeshow:function(){this.show()},ontrytosync:function(){this.sync()},onhardsync:function(){var t=this.editor.getElement().html();t=this.app.broadcast("syncBefore",t),t=this.cleaner.output(t),this._syncing(t)},start:function(){this._build(),this._buildClasses()},stop:function(){var t=this.element.getElement(),e=this.source.getElement();t.removeClass("redactor-source redactor-source-open"),e.off("input.redactor-source"),e.removeAttr("data-gramm_editor"),0===e.get().classList.length&&e.removeAttr("class"),this.source.isNameGenerated()||t.removeAttr("name"),this.element.isType("textarea")||e.remove()},getCode:function(){return this.source.getCode()},toggle:function(){if(this.opts.source)return this.source.getElement().hasClass("redactor-source-open")?this.hide():this.show()},show:function(){if(this.opts.source){var t=this.editor.getElement(),e=this.source.getElement(),i=this.container.getElement(),s=e.val();this.app.isStarted()&&(s=this.app.broadcast("source.open",s));var n=t.height();if(t.hide(),e.height(n),e.val(s.trim()),e.show(),e.addClass("redactor-source-open"),e.on("input.redactor-source-events",this._onChangedSource.bind(this)),e.on("keydown.redactor-source-events",this._onTabKey.bind(this)),e.on("focus.redactor-source-events",this._onFocus.bind(this)),this.opts.source.hasOwnProperty("codemirror")){var r="object"==typeof this.opts.source.codemirror?this.opts.source.codemirror:{},o=void 0!==this.opts.source.codemirrorSrc?this.opts.source.codemirrorSrc:CodeMirror;this.codemirror=o.fromTextArea(e.get(),r),this.codemirror.setSize(null,n),this.codemirror.on("change",function(t,e){t.save()}),this.codemirror.on("change",this._onChangedSource.bind(this))}else i.addClass("redactor-source-view");setTimeout(function(){this._disableButtons(),this._setActiveSourceButton()}.bind(this),100),this.app.isStarted()&&this.app.broadcast("source.opened")}},hide:function(){if(this.opts.source){var t=this.editor.getElement(),e=this.source.getElement(),i=this.container.getElement(),s=e.val();this.opts.source.hasOwnProperty("codemirror")&&(s=this.codemirror.getValue(),this.codemirror.toTextArea()),s=this.cleaner.input(s,!0),s=this.utils.isEmptyHtml(s)?this.opts.emptyHtml:s,s=this.app.broadcast("source.close",s),this._enableButtons(),this._setInactiveSourceButton(),e.hide(),e.removeClass("redactor-source-open"),e.off(".redactor-source-events"),t.show(),t.html(s),i.removeClass("redactor-source-view"),setTimeout(function(){this.editor.startFocus(),this.component.executeScripts()}.bind(this),0),this.app.broadcast("source.closed")}},sync:function(){var t=this,e=this.editor.getElement().html();e=this.app.broadcast("syncBefore",e),e=this.cleaner.output(e),this._isSync(e)&&(this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){t._syncing(e)},200))},_build:function(){var t=this.source.getElement(),e=this.element.getElement();t.hide(),this.opts.grammarly||t.attr("data-gramm_editor",!1),this.element.isType("textarea")||e.after(t)},_buildClasses:function(){this.source.getElement().addClass("redactor-source")},_syncing:function(t){t=this.app.broadcast("syncing",t),this.source.getElement().val(t),this.app.broadcast("synced",t),this.app.broadcast("changed",t)},_isSync:function(t){return this.syncedHtml!==t&&(this.syncedHtml=t,!0)},_onChangedSource:function(){var t=this.source.getElement().val();this.app.broadcast("changed",t),this.app.broadcast("source.changed",t)},_onTabKey:function(t){if(9!==t.keyCode)return!0;t.preventDefault();var e=this.source.getElement(),i=e.get(),s=i.selectionStart;e.val(e.val().substring(0,s)+" "+e.val().substring(i.selectionEnd)),i.selectionStart=i.selectionEnd=s+4},_onFocus:function(){this.app.broadcast("sourcefocus")},_disableButtons:function(){this.toolbar.disableButtons()},_enableButtons:function(){this.toolbar.enableButtons()},_setActiveSourceButton:function(){var t=this.toolbar.getButton("html");t.enable(),t.setActive()},_setInactiveSourceButton:function(){this.toolbar.getButton("html").setInactive()}}),$R.add("module","observer",{init:function(t){this.app=t,this.editor=t.editor,this.observerUnit=!1},start:function(){if(window.MutationObserver){var t=this.editor.getElement().get();this.observerUnit=this._build(t),this.observerUnit.observe(t,{attributes:!0,subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0})}},stop:function(){this.observerUnit&&this.observerUnit.disconnect()},_build:function(e){var i=this;return new MutationObserver(function(t){i._observe(t[t.length-1],e)})},_observe:function(t,e){this.app.isReadOnly()||"attributes"===t.type&&t.target===e||(this.app.broadcast("observe"),this.app.broadcast("trytosync"),this.app.broadcast("placeholder.toggle"))}}),$R.add("module","clicktoedit",{init:function(t){this.app=t,this.opts=t.opts,this.source=t.source,this.editor=t.editor,this.container=t.container,this.selection=t.selection},onstartclicktoedit:function(){this.start()},onenablereadonly:function(){this.opts.clickToEdit&&(this._isEnabled()||this.stop())},ondisablereadonly:function(){this.opts.clickToEdit&&(this._isEnabled()||this.start())},onstop:function(){this.stop()},start:function(){this._build()},stop:function(){this.buttonSave&&this.buttonSave.stop(),this.buttonCancel&&this.buttonCancel.stop(),this._destroy(),this.app.broadcast("disable")},enable:function(){this.app.broadcast("clickStart");var t=this.editor.isEmpty();t||this.selection.saveMarkers(),this._setFocus(),this._destroy(),this.app.broadcast("enable"),this.buttonSave.enable(),this.buttonCancel.enable(),t||this.selection.restoreMarkers(),t&&this.editor.focus(),this.container.getElement().addClass("redactor-clicktoedit-enabled"),this.source.rebuildStartedContent(),this.app.broadcast("startcode"),this.app.broadcast("image.observe")},save:function(t){t&&t.preventDefault();var e=this.source.getCode();this.app.broadcast("disable"),this.app.broadcast("clickSave",e),this.app.broadcast("clickStop"),this.app.broadcast("toolbar.removeexternal"),this._build()},cancel:function(t){t&&t.preventDefault();var e=this.saved;this.editor.getElement().html(e),this.saved="",this.app.broadcast("disable"),this.app.broadcast("clickCancel",e),this.app.broadcast("clickStop"),this.app.broadcast("toolbar.removeexternal"),this._build()},_build:function(){this.buttonSave=$R.create("clicktoedit.button","save",this.app,this),this.buttonCancel=$R.create("clicktoedit.button","cancel",this.app,this),this.buttonSave.stop(),this.buttonCancel.stop();var t=this.editor.getElement(),e=this.container.getElement();t.on("click.redactor-click-to-edit mouseup.redactor-click-to-edit",this.enable.bind(this)),e.addClass("redactor-over"),e.removeClass("redactor-clicktoedit-enabled")},_isEnabled:function(){return this.container.getElement().hasClass("redactor-clicktoedit-enabled")},_destroy:function(){var t=this.editor.getElement(),e=this.container.getElement();t.off(".redactor-click-to-edit"),e.removeClass("redactor-over redactor-clicktoedit-enabled")},_setFocus:function(){this.saved=this.source.getCode(),this.buttonSave.start(),this.buttonCancel.start()}}),$R.add("class","clicktoedit.button",{init:function(t,e,i){this.app=e,this.opts=e.opts,this.toolbar=e.toolbar,this.context=i,this.type=t,this.name="save"===t?"clickToSave":"clickToCancel",this.objected=!1,this.enabled=!1,this.namespace=".redactor-click-to-edit",this._build()},enable:function(){if(this.objected){var t=this.opts[this.name];t.api="module.clicktoedit."+this.type,this.toolbar.addButton(this.type,t),this.enabled=!0}},start:function(){this.objected||(this.$button.off(this.namespace),this.$button.show(),this.$button.on("click"+this.namespace,this.context[this.type].bind(this.context)))},stop:function(){!this.objected&&this.enabled&&this.$button.hide()},_build:function(){this.objected="object"==typeof this.opts[this.name],this.objected||(this.$button=$R.dom(this.opts[this.name]),this.enabled=!0)}}),$R.add("module","statusbar",{init:function(t){this.app=t,this.opts=t.opts,this.element=t.element,this.statusbar=t.statusbar,this.container=t.container},start:function(){if(!this.element.isType("inline")){var t=this.statusbar.getElement(),e=this.container.getElement();t.addClass("redactor-statusbar"),e.append(t)}}}),$R.add("module","contextbar",{init:function(t){this.app=t,this.opts=t.opts,this.uuid=t.uuid,this.$win=t.$win,this.$doc=t.$doc,this.$body=t.$body,this.editor=t.editor,this.toolbar=t.toolbar,this.detector=t.detector,this.$target=this.toolbar.isTarget()?this.toolbar.getTargetElement():this.$body},onstop:function(){this.stop()},onenablereadonly:function(){this.stop()},ondisablereadonly:function(){this.start()},oncontextbar:{close:function(){this.close()}},start:function(){if(this.opts.toolbarContext){var t=this.editor.getElement();this._build(),t.on("click.redactor-context mouseup.redactor-context",this.open.bind(this)),this.opts.scrollTarget?$R.dom(this.opts.scrollTarget).on("scroll.redactor-context",this.close.bind(this)):!1!==this.opts.maxHeight&&t.on("scroll.redactor-context",this.close.bind(this))}},stop:function(){this.editor.getElement().off(".redactor-context"),this.$doc.off(".redactor-context"),this.$win.off(".redactor-context"),this.$contextbar&&this.$contextbar.remove(),this.opts.scrollTarget&&$R.dom(this.opts.scrollTarget).off(".redactor-context")},is:function(){return this.$contextbar&&this.$contextbar.hasClass("open")},set:function(t,e,i,s){for(var n in this.$contextbar.html(""),this.$el=$R.dom(e),i){var r=$R.create("contextbar.button",this.app,i[n]);""!==r.html()&&this.$contextbar.append(r)}var o=this._buildPosition(t,this.$el,s);this.$contextbar.css(o),this.$contextbar.show(),this.$contextbar.addClass("open"),this.$doc.on("click.redactor-context mouseup.redactor-context",this.close.bind(this)),this.$win.on("resize.redactor-context",this.close.bind(this))},open:function(t){setTimeout(function(){this.app.broadcast("contextbar",t,this)}.bind(this),0)},close:function(t){if(this.$contextbar){if(t){var e=$R.dom(t.target);if(this.$el&&0!==e.closest(this.$el).length)return}this.$contextbar.hide(),this.$contextbar.removeClass("open"),this.$doc.off(".redactor.context")}},_build:function(){this.$contextbar=$R.dom("<div>"),this.$contextbar.attr("id","redactor-context-toolbar-"+this.uuid),this.$contextbar.attr("dir",this.opts.direction),this.$contextbar.addClass("redactor-context-toolbar"),this.$contextbar.hide(),this.$target.append(this.$contextbar)},_buildPosition:function(t,e,i){var s,n,r=this.toolbar.isTarget(),o=r?e.position():e.offset(),a=e.width(),l=e.height(),h=this.$contextbar.width(),c=this.$contextbar.height(),d=r?this.$target.scrollTop()+this.$doc.scrollTop():this.$doc.scrollTop(),u=this.$target.offset(),p=r?u.left:0,f=r?u.top:0;return i?"top"===i?(s=o.top-c,n=o.left+a/2-h/2):"bottom"===i&&(s=o.top+l,n=o.left+a/2-h/2):(s=t.clientY+d-c,n=t.clientX-h/2),n<0&&(n=0),{top:s-f+"px",left:n-p+"px"}}}),$R.add("class","contextbar.button",{mixins:["dom"],init:function(t,e){this.app=t,this.obj=e,this._init()},_init:function(){if(this.parse("<a>"),"string"!=typeof this.obj.title){var t=this.obj.title.attr("href");this.attr("href",t),-1===t.search(/^#/)&&this.attr("target","_blank"),this.text(this.obj.html||t)}else this.attr("href","#"),this._buildTitle(),this._buildMessage()},_buildTitle:function(){this.html(this.obj.title)},_buildMessage:function(){void 0===this.obj.message&&void 0===this.obj.api||this.on("click",this._toggle.bind(this))},_toggle:function(t){t.preventDefault(),this.obj.message?this.app.broadcast(this.obj.message,this.obj.args):this.obj.api&&this.app.api(this.obj.api,this.obj.args)}}),$R.add("module","toolbar",{init:function(t){this.app=t,this.uuid=t.uuid,this.opts=t.opts,this.utils=t.utils,this.toolbar=t.toolbar,this.detector=t.detector,this.buttons=[],this.toolbarModule=!1},onsource:{open:function(){!this.toolbar.isAir()&&this.toolbar.isFixed()&&this.toolbarModule.resetPosition()},opened:function(){this.toolbar.isAir()&&this.toolbarModule&&this.toolbarModule.createSourceHelper(),setTimeout(function(){$R.dom(".re-button-tooltip-"+this.uuid).remove()}.bind(this),100)},close:function(){this.toolbar.isAir()&&this.toolbarModule&&this.toolbarModule.destroySourceHelper()},closed:function(){this.toolbar.is()&&this.opts.air&&this.toolbarModule.openSelected()}},ontoolbar:{removeexternal:function(){!this.opts.air&&this.opts.toolbarExternal&&this.opts.clickToEdit&&$R.dom(this.opts.toolbarExternal).html("")}},onobserve:function(){this.toolbar.is()&&this.toolbar.observe()},onfocus:function(){this._setExternalOnFocus()},onsourcefocus:function(){this._setExternalOnFocus()},onempty:function(){this.toolbar.isFixed()&&this.toolbarModule.resetPosition()},onenablereadonly:function(){this.toolbar.isAir()&&this.toolbarModule.close()},start:function(){this.toolbar.is()&&(this._buildButtons(),this._initToolbar(),this._initButtons())},stop:function(){this.toolbarModule&&this.toolbarModule.stop(),$R.dom(".re-button-tooltip-"+this.uuid).remove(),$R.dom(".redactor-dropdown-"+this.uuid).remove()},_buildButtons:function(){this.buttons=this.opts.buttons.concat(),this._buildImageButton(),this._buildFileButton(),this._buildSourceButton(),this._buildAdditionalButtons(),this._buildHiddenButtons()},_buildImageButton:function(){this.opts.imageUpload||this.opts.imageManagerJson||this.utils.removeFromArrayByValue(this.buttons,"image")},_buildFileButton:function(){this.opts.fileUpload||this.utils.removeFromArrayByValue(this.buttons,"file")},_buildSourceButton:function(){this.opts.source||this.utils.removeFromArrayByValue(this.buttons,"html")},_buildAdditionalButtons:function(){var t,e;if(0!==this.opts.buttonsAdd.length&&(this.opts.buttonsAdd=this._removeExistButtons(this.opts.buttonsAdd),this.buttons=this.buttons.concat(this.opts.buttonsAdd)),0!==this.opts.buttonsAddFirst.length&&(this.opts.buttonsAddFirst=this._removeExistButtons(this.opts.buttonsAddFirst),this.buttons.unshift(this.opts.buttonsAddFirst)),!1!==this.opts.buttonsAddAfter){t=this.buttons.indexOf(this.opts.buttonsAddAfter.after)+1,e=this.opts.buttonsAddAfter.buttons;for(var i=0;i<e.length;i++)this.buttons.splice(t+i,0,e[i])}if(!1!==this.opts.buttonsAddBefore){t=this.buttons.indexOf(this.opts.buttonsAddBefore.before)+1,e=this.opts.buttonsAddBefore.buttons;for(i=0;i<e.length;i++)this.buttons.splice(t-(1-i),0,e[i])}},_buildHiddenButtons:function(){if(0!==this.opts.buttonsHide.length)for(var t=this.opts.buttonsHide,e=0;e<t.length;e++)this.utils.removeFromArrayByValue(this.buttons,t[e]);if(this.detector.isMobile()&&0!==this.opts.buttonsHideOnMobile.length)for(t=this.opts.buttonsHideOnMobile,e=0;e<t.length;e++)this.utils.removeFromArrayByValue(this.buttons,t[e])},_removeExistButtons:function(t){for(var e=0;e<t.length;e++)-1!==this.opts.buttons.indexOf(t[e])&&this.utils.removeFromArrayByValue(t,t[e]);return t},_setExternalOnFocus:function(){!this.opts.air&&this.opts.toolbarExternal&&this.toolbarModule.setExternal()},_initToolbar:function(){this.toolbarModule=this.opts.air?$R.create("toolbar.air",this.app):$R.create("toolbar.standard",this.app)},_initButtons:function(){this.toolbar.setButtons(this.buttons);for(var t=0;t<this.buttons.length;t++){var e=this.buttons[t];$R.buttons[e]&&this.toolbar.addButton(e,$R.extend(!0,{},$R.buttons[e]),!1,!1,!0)}}}),$R.add("class","toolbar.air",{init:function(t){this.app=t,this.uuid=t.uuid,this.$doc=t.$doc,this.$win=t.$win,this.utils=t.utils,this.editor=t.editor,this.animate=t.animate,this.toolbar=t.toolbar,this.container=t.container,this.inspector=t.inspector,this.selection=t.selection,this.clicks=0,this._init()},stop:function(){this.toolbar.getWrapper().remove(),this.editor.getElement().off(".redactor-air-trigger-"+this.uuid),this.$doc.off(".redactor-air-"+this.uuid),this.$doc.off(".redactor-air-trigger-"+this.uuid),this.toolbar.stopObservers()},createSourceHelper:function(){this.$airHelper=$R.dom("<span>"),this.$airHelper.addClass("redactor-air-helper"),this.$airHelper.html('<i class="re-icon-html"></i>'),this.$airHelper.on("click",function(t){t.preventDefault(),this.app.api("module.source.hide")}.bind(this)),this.container.getElement().append(this.$airHelper)},destroySourceHelper:function(){this.$airHelper&&this.$airHelper.remove()},openSelected:function(){setTimeout(function(){this._isSelection()&&this._open(!1)}.bind(this),0)},close:function(){this.$doc.off(".redactor-air-"+this.uuid);var t=this.toolbar.getElement();t.removeClass("open"),t.hide()},_init:function(){this.toolbar.create();var t=this.toolbar.getWrapper(),e=this.toolbar.getElement(),i=this.editor.getElement(),s=this.container.getElement();t.addClass("redactor-toolbar-wrapper-air"),e.addClass("redactor-air"),e.hide(),t.append(e),s.prepend(t),this.openSelected(),this.$doc.on("mouseup.redactor-air-trigger-"+this.uuid,this._open.bind(this)),i.on("keyup.redactor-air-trigger-"+this.uuid,this._openCmd.bind(this))},_isSelection:function(){return this.selection.is()&&!this.selection.isCollapsed()},_isOpened:function(){return this.toolbar.getElement().hasClass("open")},_open:function(t){var e=!!t&&t.target,i=!!t&&$R.dom(t.target),s=this.inspector.parse(e),n=s.isComponent()&&!s.isComponentType("table"),r=s.isFigcaption(),o=i&&0!==i.closest(".redactor-modal").length,a=t&&0!==i.closest(".re-button").length;if(!(t&&0!==i.closest(".redactor-dropdown").length||a||o||r||n||this.toolbar.isContextBar())&&this._isSelection()){var l=this.selection.getPosition();setTimeout(function(){this.app.isReadOnly()||this._isSelection()&&this._doOpen(l)}.bind(this),1)}},_openCmd:function(){if(this.selection.isAll()){var t=this.toolbar.getElement(),e=this.selection.getPosition();e.top=e.top<20?0:e.top-t.height(),e.height=0,this._doOpen(e)}},_doOpen:function(t){var e=this.toolbar.getWrapper(),i=this.toolbar.getElement(),s=this.container.getElement().offset(),n=0,r=this.$win.width(),o=i.width();r<t.left+o&&(n=o-this.selection.getPosition().width);e.css({left:t.left-s.left-n+"px",top:t.top-s.top+t.height+this.$doc.scrollTop()+"px"}),this.app.broadcast("airOpen"),i.addClass("open"),i.show(),this.$doc.on("click.redactor-air-"+this.uuid,this._close.bind(this)),this.$doc.on("keydown.redactor-air-"+this.uuid,this._close.bind(this)),this.app.broadcast("airOpened")},_close:function(t){var e=!!t&&$R.dom(t.target),i=t&&0!==e.closest("[data-dropdown], .redactor-dropdown-not-close").length;(!i&&t&&0!==e.closest(".re-button").length||!i&&this._isOpened())&&(this.app.broadcast("airClose"),this.close(),this.app.broadcast("airClosed"))}}),$R.add("class","toolbar.fixed",{init:function(t){this.app=t,this.uuid=t.uuid,this.opts=t.opts,this.$doc=t.$doc,this.$win=t.$win,this.editor=t.editor,this.toolbar=t.toolbar,this.detector=t.detector,this.container=t.container,this._init()},stop:function(){this.$fixedTarget.off(".redactor-toolbar-"+this.uuid),this.$win.off(".redactor-toolbar-"+this.uuid)},reset:function(){var t=this.toolbar.getElement();this.toolbar.getWrapper().css("height",""),t.removeClass("redactor-toolbar-fixed"),t.css({position:"",top:"",left:"",width:""});var e=this.toolbar.getDropdown();e&&e.updatePosition()},_init:function(){this.$fixedTarget=this.toolbar.isTarget()?this.toolbar.getTargetElement():this.$win,this._doFixed(),this.toolbar.isTarget()&&(this.$win.on("scroll.redactor-toolbar-"+this.uuid,this._doFixed.bind(this)),this.$win.on("resize.redactor-toolbar-"+this.uuid,this._doFixed.bind(this))),this.$fixedTarget.on("scroll.redactor-toolbar-"+this.uuid,this._doFixed.bind(this)),this.$fixedTarget.on("resize.redactor-toolbar-"+this.uuid,this._doFixed.bind(this))},_doFixed:function(){var t=this.editor.getElement(),e=this.container.getElement(),i=this.toolbar.getElement(),s=this.toolbar.getWrapper();if(!this.editor.isSourceMode()&&0===e.parents().filter(function(t){return"none"===getComputedStyle(t,null).display&&t}).length){var n=t.height()<100,r=this.editor.isEmpty();if(n||r)this.reset();else if(!this.editor.isSourceMode()){var o=i.height(),a=(this.toolbar.isTarget()?e.position():e.offset()).top,l=a+e.height()-60,h=this.$fixedTarget.scrollTop()+this.opts.toolbarFixedTopOffset,c=this.toolbar.isTarget()?this.$fixedTarget.offset().top-this.$win.scrollTop():0;if(this.toolbar.isTarget()&&"fixed"===this.$fixedTarget.css("position")){var d=this.$fixedTarget.hasClass("modal")&&this.$fixedTarget.hasClass("fade")?e.closest(".modal-dialog").position().top:0;c=this.$fixedTarget.scrollTop()-d}if(a<h&&h<l){var u=this.detector.isDesktop()?"fixed":"absolute";c=this.detector.isDesktop()?c:h-a,this.detector.isMobile()&&(this.fixedScrollTimeout&&clearTimeout(this.fixedScrollTimeout),i.hide(),this.fixedScrollTimeout=setTimeout(function(){i.show()},250)),s.height(o),i.addClass("redactor-toolbar-fixed"),e.hasClass("redactor-box-fullscreen")?i.css({position:u,top:"0px",width:e.width()+"px"}):i.css({position:u,top:c+this.opts.toolbarFixedTopOffset+"px",width:e.width()+"px"});var p=this.toolbar.getDropdown();p&&p.updatePosition(),this.app.broadcast("toolbar.fixed")}else this.reset(),this.app.broadcast("toolbar.unfixed")}}}}),$R.add("class","toolbar.standard",{init:function(t){this.app=t,this.opts=t.opts,this.uuid=t.uuid,this.$body=t.$body,this.toolbar=t.toolbar,this.container=t.container,this.isExternalMultiple=!1,this.toolbarFixed=!1,this._init()},stop:function(){this.toolbar.getWrapper().remove(),this.toolbarFixed&&this.toolbarFixed.stop(),this.opts.toolbarExternal&&this._findToolbars(),this.toolbar.stopObservers(),this.$body.find(".re-button-tooltip-"+this.uuid).remove()},setExternal:function(){this._findToolbars(),this.isExternalMultiple&&(this.$toolbars.hide(),this.$external.find(".redactor-toolbar-external-"+this.uuid).show())},resetPosition:function(){this.toolbarFixed&&this.toolbarFixed.reset()},_init:function(){(this._build(),this.opts.toolbarExternal)?this._buildExternal():(this._buildFixed(),this.toolbar.getElement().show())},_build:function(){this.toolbar.create();var t=this.toolbar.getWrapper(),e=this.toolbar.getElement();t.addClass("redactor-toolbar-wrapper"),e.addClass("redactor-toolbar"),e.hide(),t.append(e),this.opts.toolbarExternal||this.container.getElement().prepend(t)},_buildExternal:function(){(this._initExternal(),this._findToolbars(),this.isExternalMultiple)?this._hideToolbarsExceptFirst():this.toolbar.getElement().show()},_buildFixed:function(){this.opts.toolbarFixed&&(this.toolbarFixed=$R.create("toolbar.fixed",this.app))},_initExternal:function(){var t=this.toolbar.getElement(),e=this.toolbar.getElement();t.addClass("redactor-toolbar-external redactor-toolbar-external-"+this.uuid),this.$external=$R.dom(this.opts.toolbarExternal),this.$external.append(e)},_findToolbars:function(){this.$toolbars=this.$external.find(".redactor-toolbar-external"),this.isExternalMultiple=1<this.$toolbars.length},_hideToolbarsExceptFirst:function(){this.$toolbars.hide(),this.$toolbars.first().show()}}),$R.add("module","line",{init:function(t){this.app=t,this.lang=t.lang,this.component=t.component,this.inspector=t.inspector,this.insertion=t.insertion},oncontextbar:function(t,e){var i=this.inspector.parse(t.target);if(i.isComponentType("line")){var s=i.getComponent(),n={remove:{title:this.lang.get("delete"),api:"module.line.remove",args:s}};e.set(t,s,n,"bottom")}},insert:function(){var t=this.component.create("line");this.insertion.insertRaw(t)},remove:function(t){this.component.remove(t)}}),$R.add("class","line.component",{mixins:["dom","component"],init:function(t,e){return this.app=t,e&&void 0!==e.cmnt?e:this._init(e)},_init:function(t){var e,i;if(void 0!==t){var s=$R.dom(t),n=s.get();"HR"===n.tagName?i=n:"FIGURE"===n.tagName&&(e=n,i=s.find("hr").get())}this._buildWrapper(e),this._buildElement(i),this._initWrapper()},_buildElement:function(t){t?this.$element=$R.dom(t):(this.$element=$R.dom("<hr>"),this.append(this.$element))},_buildWrapper:function(t){t=t||"<figure>",this.parse(t)},_initWrapper:function(){this.addClass("redactor-component"),this.attr({"data-redactor-type":"line",tabindex:"-1",contenteditable:!1})}}),$R.add("module","link",{modals:{link:'<form action=""> <div class="form-item"> <label for="modal-link-url">URL <span class="req">*</span></label> <input type="text" id="modal-link-url" name="url"> </div> <div class="form-item"> <label for="modal-link-text">## text ##</label> <input type="text" id="modal-link-text" name="text"> </div> <div class="form-item form-item-title"> <label for="modal-link-title">## title ##</label> <input type="text" id="modal-link-title" name="title"> </div> <div class="form-item form-item-target"> <label class="checkbox"> <input type="checkbox" name="target"> ## link-in-new-tab ## </label> </div> </form>'},init:function(t){this.app=t,this.opts=t.opts,this.lang=t.lang,this.caret=t.caret,this.utils=t.utils,this.inline=t.inline,this.editor=t.editor,this.inspector=t.inspector,this.insertion=t.insertion,this.selection=t.selection,this.isCurrentLink=!1,this.currentText=!1},onmodal:{link:{open:function(t,e){this._setFormData(e,t)},opened:function(t,e){this._setFormFocus(e)},update:function(t,e){var i=e.getData();this._validateData(e,i)&&this._update(i)},insert:function(t,e){var i=e.getData();this._validateData(e,i)&&this._insert(i)},unlink:function(){this._unlink()}}},onbutton:{link:{observe:function(t){this._observeButton(t)}}},ondropdown:{link:{observe:function(t){this._observeUnlink(t),this._observeEdit(t)}}},oncontextbar:function(t,e){var i=this._getCurrent(),s=this.inspector.parse(i);if(s.isLink()||s.isFile()){var n=s.isFile()?s.getFile():s.getLink(),r=$R.dom(n),o=$R.dom("<a>"),a=r.attr("href");o.text(this._truncateText(a)),o.attr("href",a),o.attr("target","_blank");var l={link:{title:o,html:this._truncateText(a)},edit:{title:this.lang.get("edit"),api:"module.link.open"},unlink:{title:this.lang.get("unlink"),api:"module.link.unlink"}};e.set(t,n,l,"bottom")}},open:function(){this.$link=this._buildCurrent(),this.app.api("module.modal.build",this._getModalData())},insert:function(t){this._insert(t)},update:function(t){this._update(t)},unlink:function(){this._unlink()},_observeButton:function(t){var e=this.selection.getCurrent(),i=this.inspector.parse(e);i.isPre()||i.isCode()?t.disable():t.enable()},_observeUnlink:function(t){var e=t.getItem("unlink");0===this._getLinks().length?e.disable():e.enable()},_observeEdit:function(t){var e=this._getCurrent(),i=t.getItem("link"),s=this.inspector.parse(e),n=s.isLink()||s.isFile()?this.lang.get("link-edit"):this.lang.get("link-insert");i.setTitle(n)},_unlink:function(){this.app.api("module.modal.close");var t=[],e=this._getLinks();this.selection.save();for(var i=0;i<e.length;i++){var s=$R.create("link.component",this.app,e[i]);t.push(this.selection.getElement(e[i])),s.unwrap(),this.app.broadcast("link.deleted",s)}this.selection.restore();for(i=0;i<t.length;i++){var n=t[i]?t[i]:this.editor.getElement();this.utils.normalizeTextNodes(n)}this._resetCurrent()},_update:function(t){this.app.api("module.modal.close");var e=this._getLinks();this._setLinkData(e,t,"updated"),this._resetCurrent(),this.app.broadcast("link.changed",e)},_insert:function(t){this.app.api("module.modal.close");var e=this._getLinks();this._insertSingle(e,t)||(this._removeInSelection(e),this._insertMultiple(t)),this._resetCurrent()},_removeInSelection:function(t){this.selection.save();for(var e=0;e<t.length;e++){var i=$R.create("link.component",this.app,t[e]),s=i.clone();i.unwrap(),this.app.broadcast("link.deleted",s)}this.selection.restore()},_insertMultiple:function(t){var e=this.selection.getRange();e&&this._isCurrentTextChanged(t)&&this._deleteContents(e);var i=this.inline.format({tag:"a"});this._setLinkData(i,t,"inserted")},_insertSingle:function(t,e){var i=this.selection.getInline();if(1===t.length&&(t[0].textContext===this.selection.getText()||i&&"A"===i.tagName)){var s=$R.create("link.component",this.app,t[0]);return s.setData(e),this.caret.setAfter(s),this.app.broadcast("link.inserted",s),!0}return!1},_setLinkData:function(t,e,i){e.text=""===e.text.trim()?this._truncateText(e.url):e.text;var s=!this.currentText||this.currentText!==e.text;this.selection.save();for(var n=0;n<t.length;n++){var r=$R.create("link.component",this.app,t[n]),o={};e.text&&s&&(o.text=e.text),e.url&&(o.url=e.url),void 0!==e.title&&(o.title=e.title),void 0!==e.target&&(o.target=e.target),r.setData(o),this.app.broadcast("link."+i,r)}setTimeout(this.selection.restore.bind(this.selection),0)},_deleteContents:function(t){var e=this.selection.getHtml(),i=this.utils.parseHtml(e).nodes[0];if(i&&3!==i.nodeType){var s=i.tagName.toLowerCase(),n=document.createElement(s);this.insertion.insertNode(n,"start")}else t.deleteContents()},_getModalData:function(){var t;return t=this._isLink()?{update:{title:this.lang.get("save")},unlink:{title:this.lang.get("unlink"),type:"danger"},cancel:{title:this.lang.get("cancel")}}:{insert:{title:this.lang.get("insert")},cancel:{title:this.lang.get("cancel")}},{name:"link",title:this._isLink()?this.lang.get("link-edit"):this.lang.get("link-insert"),handle:this._isLink()?"update":"insert",commands:t}},_isLink:function(){return this.currentLink},_isCurrentTextChanged:function(t){return this.currentText&&this.currentText!==t.text},_buildCurrent:function(){var t,e=this._getCurrent(),i=this.inspector.parse(e);if(i.isLink()||i.isFile())this.currentLink=!0,t=i.isFile()?i.getFile():i.getLink(),t=$R.create("link.component",this.app,t);else{this.currentLink=!1,t=$R.create("link.component",this.app);var s={text:this.selection.getText()};t.setData(s)}return t},_getCurrent:function(){return this.selection.getInlinesAllSelected({tags:["a"]})[0]},_getLinks:function(){for(var t=this.selection.getInlines({all:!0,tags:["a"]}),e=[],i=0;i<t.length;i++){var s=this.inspector.parse(t[i]);(s.isLink()||s.isFile())&&e.push(t[i])}return e},_resetCurrent:function(){this.isCurrentLink=!1,this.currentText=!1},_truncateText:function(t){return t&&t.length>this.opts.linkSize?t.substring(0,this.opts.linkSize)+"...":t},_validateData:function(t,e){return""!==e.url.trim()||t.setError("url")},_setFormFocus:function(t){t.getField("url").focus()},_setFormData:function(t,e){var i=this.$link.getData(),s={url:i.url,text:i.text,title:i.title,target:this.opts.linkTarget||i.target};this.opts.linkNewTab||e.find(".form-item-target").hide(),this.opts.linkTitle||e.find(".form-item-title").hide(),t.setData(s),this.currentText=t.getField("text").val()}}),$R.add("class","link.component",{mixins:["dom","component"],init:function(t,e){return this.app=t,this.opts=t.opts,this.reUrl=/^(?:(?:(?:https?|ftp):)?\/\/)?(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:[/?#]\S*)?$/i,e&&void 0!==e.cmnt?e:this._init(e)},setData:function(t){for(var e in t)this._set(e,t[e])},getData:function(){for(var t=["url","text","target","title"],e={},i=0;i<t.length;i++)e[t[i]]=this._get(t[i]);return e},_init:function(t){var e=$R.dom(t);void 0===t?this.parse("<a>"):this.parse(e)},_set:function(t,e){this["_set_"+t](e)},_get:function(t){return this["_get_"+t]()},_get_target:function(){return!!this.attr("target")&&this.attr("target")},_get_url:function(){return this.attr("href")},_get_title:function(){return this.attr("title")},_get_text:function(){return this._getContext().text()},_getContext:function(){return this._findDeepestChild(this).element},_set_target:function(t){!1===t?this.removeAttr("target"):t&&this.attr("target",!0===t?"_blank":t)},_set_text:function(t){this._getContext().html(t)},_set_title:function(t){t&&""!==t?this.attr("title",t):this.removeAttr("title")},_set_url:function(t){this.opts.linkValidation&&(t=this._cleanUrl(t),this._isMailto(t)?t="mailto:"+t.replace("mailto:",""):this._isUrl(t)&&-1===t.search(/^(ftp|https?)/i)&&(t="http://"+t.replace(/(ftp|https?):\/\//i,""))),this.attr("href",t)},_isMailto:function(t){return-1!==t.search("@")&&!1===/(ftp|https?):\/\//i.test(t)},_isUrl:function(t){return this.reUrl.test(t)},_cleanUrl:function(t){return(t=t.replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")).trim().replace(/[^\W\w\D\d+&\'@#/%?=~_|!:,.;\(\)]/gi,"")},_findDeepestChild:function(s){var n={depth:0,element:s};return s.children().each(function(t){var e=$R.dom(t);if(t.outerHTML===s.html()){var i=this._findDeepestChild(e);i.depth+1>n.depth&&(n={depth:1+i.depth,element:i.element})}}.bind(this)),n}}),$R.add("module","modal",{init:function(t){this.app=t,this.uuid=t.uuid,this.lang=t.lang,this.$doc=t.$doc,this.$win=t.$win,this.$body=t.$body,this.utils=t.utils,this.editor=t.editor,this.animate=t.animate,this.detector=t.detector,this.selection=t.selection,this.$box=!1,this.$modal=!1,this.selectionMarkers=!1,this.defaults={name:!1,url:!1,title:!1,width:"600px",height:!1,handle:!1,commands:!1}},build:function(t){this._open(t)},close:function(){this._close()},onstop:function(){this.$body.find("#redactor-modal-"+this.uuid).remove(),this.$body.find("#redactor-overlay-"+this.uuid).remove()},stop:function(){this.$box&&(this.$box.remove(),this.$box=!1,this.$modal=!1),this.$overlay&&this.$overlay.remove(),this.$doc.off(".redactor.modal"),this.$win.off(".redactor.modal")},resize:function(){this.$modal.setWidth(this.p.width),this.$modal.updatePosition()},_isOpened:function(){return this.$modal&&this.$modal.hasClass("open")},_open:function(t){this._buildDefaults(t),this.p.url?this._openUrl():this._openTemplate()},_openUrl:function(){$R.ajax.post({url:this.p.url,success:this._doOpen.bind(this)})},_openTemplate:function(){if(void 0!==$R.modals[this.p.name]){var t=this.lang.parse($R.modals[this.p.name]);this._doOpen(t)}},_doOpen:function(t){this.stop(),this.selection.isCollapsed()?(this.selection.save(),this.selectionMarkers=!1):(this.selection.saveMarkers(),this.selectionMarkers=!0),this.detector.isDesktop()||document.activeElement.blur(),this._createModal(t),this._buildModalBox(),this._buildOverlay(),this._buildModal(),this._buildModalForm(),this._buildModalCommands(),this._broadcast("open"),this.$modal.updatePosition(),this._buildModalTabs(),this.animate.start(this.$box,"fadeIn",this._opened.bind(this)),this.animate.start(this.$overlay,"fadeIn")},_opened:function(){this.$modal.addClass("open"),this.$box.on("mousedown.redactor.modal",this._close.bind(this)),this.$doc.on("keyup.redactor.modal",this._handleEscape.bind(this)),this.$win.on("resize.redactor.modal",this.resize.bind(this)),this.$modal.getBody().find("input[type=text],input[type=url],input[type=email]").on("keydown.redactor.modal",this._handleEnter.bind(this)),window.jQuery&&window.jQuery(document).off("focusin.modal"),this._broadcast("opened")},_close:function(t){if(this.$box&&this._isOpened()){if(t){if(!this._needToClose(t.target))return;t.stopPropagation(),t.preventDefault()}this.selectionMarkers?this.selection.restoreMarkers():this.selection.restore(),this.selectionMarkers=!1,this._broadcast("close"),this.animate.start(this.$box,"fadeOut",this._closed.bind(this)),this.animate.start(this.$overlay,"fadeOut")}},_closed:function(){this.$modal.removeClass("open"),this.$box.off(".redactor.modal"),this.$doc.off(".redactor.modal"),this.$win.off(".redactor.modal"),this._broadcast("closed")},_createModal:function(t){this.$modal=$R.create("modal.element",this.app,t)},_broadcast:function(t){this.app.broadcast("modal."+t,this.$modal,this.$modalForm),this.app.broadcast("modal."+this.p.name+"."+t,this.$modal,this.$modalForm)},_buildDefaults:function(t){this.p=$R.extend({},this.defaults,t)},_buildModalBox:function(){this.$box=$R.dom("<div>"),this.$box.attr("id","redactor-modal-"+this.uuid),this.$box.addClass("redactor-modal-box redactor-animate-hide"),this.$box.html(""),this.$body.append(this.$box)},_buildOverlay:function(){this.$overlay=$R.dom("#redactor-overlay-"+this.uuid),0===this.$overlay.length&&(this.$overlay=$R.dom("<div>"),this.$overlay.attr("id","redactor-overlay-"+this.uuid),this.$overlay.addClass("redactor-overlay redactor-animate-hide"),this.$body.prepend(this.$overlay))},_buildModal:function(){this.$box.append(this.$modal),this.$modal.setTitle(this.p.title),this.$modal.setHeight(this.p.height),this.$modal.setWidth(this.p.width)},_buildModalCommands:function(){if(this.p.commands){var t=this.p.commands,e=this.$modal.getFooter();for(var i in t){var s=$R.dom("<button>");s.html(t[i].title),s.attr("data-command",i),"cancel"===i&&(s.attr("data-action","close"),s.addClass("redactor-button-unstyled")),void 0!==t[i].type&&"danger"===t[i].type&&s.addClass("redactor-button-danger"),s.on("click",this._handleCommand.bind(this)),e.append(s)}}},_buildModalTabs:function(){var t=this.$modal.getBody(),e=t.find(".redactor-modal-tab"),n=t.find(".redactor-modal-tabs");1<e.length&&((n=0===n.length?$R.dom("<div>"):n.html("")).addClass("redactor-modal-tabs"),e.each(function(t,e){var i=$R.dom(t),s=$R.dom("<a>");s.attr("href","#"),s.attr("rel",e),s.text(i.attr("data-title")),s.on("click",this._showTab.bind(this)),0===e&&s.addClass("active"),n.append(s)}.bind(this)),t.prepend(n)),1===e.length&&e.show()},_buildModalForm:function(){this.$modalForm=$R.create("modal.form",this.app,this.$modal.getForm())},_showTab:function(t){t.preventDefault();var e=$R.dom(t.target),i=e.attr("rel"),s=this.$modal.getBody(),n=s.find(".redactor-modal-tab");n.hide(),n.eq(i).show(),s.find(".redactor-modal-tabs a").removeClass("active"),e.addClass("active")},_needToClose:function(t){var e=$R.dom(t);return!("close"!==e.attr("data-action")&&!this.$modal.isCloseNode(t)&&0!==e.closest(".redactor-modal").length)},_handleCommand:function(t){var e=$R.dom(t.target).closest("button").attr("data-command");"cancel"!==e&&t.preventDefault(),this._broadcast(e)},_handleEnter:function(t){13===t.which&&this.p.handle&&(t.preventDefault(),this._broadcast(this.p.handle))},_handleEscape:function(t){27===t.which&&this._close()}}),$R.add("class","modal.element",{mixins:["dom"],init:function(t,e){this.app=t,this.opts=t.opts,this.$win=t.$win,this._init(e)},getForm:function(){return this.find("form")},getHeader:function(){return this.$modalHeader},getBody:function(){return this.$modalBody},getFooter:function(){return this.$modalFooter},setTitle:function(t){t&&this.$modalHeader.html(t)},setWidth:function(t){t=parseInt(t)>=this.$win.width()?"96%":t,this.css("max-width",t)},setHeight:function(t){!1!==t&&this.$modalBody.css("height",t)},updatePosition:function(){var t=this.width();this.css({left:"50%","margin-left":"-"+t/2+"px"});var e=this.$win.height(),i=this.height(),s=e/2-i/2;i<e&&0!=s&&this.css("margin-top",s+"px")},isCloseNode:function(t){return t===this.$modalClose.get()},_init:function(t){this._build(),this._buildClose(),this._buildHeader(),this._buildBody(),this._buildFooter(),this._buildTemplate(t)},_build:function(){this.parse("<div>"),this.addClass("redactor-modal"),this.attr("dir",this.opts.direction)},_buildClose:function(){this.$modalClose=$R.dom("<span>"),this.$modalClose.addClass("redactor-close"),this.append(this.$modalClose)},_buildHeader:function(){this.$modalHeader=$R.dom("<div>"),this.$modalHeader.addClass("redactor-modal-header"),this.append(this.$modalHeader)},_buildBody:function(){this.$modalBody=$R.dom("<div>"),this.$modalBody.addClass("redactor-modal-body"),this.append(this.$modalBody)},_buildFooter:function(){this.$modalFooter=$R.dom("<div>"),this.$modalFooter.addClass("redactor-modal-footer"),this.append(this.$modalFooter)},_buildTemplate:function(t){this.$modalBody.html(t)}}),$R.add("class","modal.form",{mixins:["dom"],init:function(t,e){this.app=t,this.build(e)},build:function(t){this.parse(t)},getData:function(){var i={};return this.find("[name]").each(function(t){var e=$R.dom(t);i[e.attr("name")]=e.val()}),i},setData:function(s){this.find("[name]").each(function(t){var e=$R.dom(t),i=e.attr("name");s.hasOwnProperty(i)&&(t.type&&"checkbox"===t.type?t.checked=s[i]:e.val(s[i]))})},getField:function(t){return this.find("[name="+t+"]")},setError:function(t){var e=this.getField(t);return e.addClass("error"),e.one(this._getFieldEventName(e.get()),this._clearError),!1},_clearError:function(){return $R.dom(this).removeClass("error")},_getFieldEventName:function(t){return"SELECT"===t.tagName||"checkbox"===t.type||"radio"===t.type?"change":"keyup"}}),$R.add("module","block",{init:function(t){this.app=t,this.block=t.block},format:function(t){var e=this.block.format(t);this.app.broadcast("format","block",e)},clearformat:function(){this.block.clearFormat()},clearstyle:function(){this.block.clearStyle()},clearclass:function(){this.block.clearClass()},clearattr:function(){this.block.clearAttr()},add:function(t,e){this.block.add(t,e)},toggle:function(t,e){this.block.toggle(t,e)},set:function(t,e){this.block.set(t,e)},remove:function(t,e){this.block.remove(t,e)}}),$R.add("module","inline",{init:function(t){this.app=t,this.inline=t.inline},format:function(t){var e=this.inline.format(t);this.app.broadcast("format","inline",e)},clearformat:function(){this.inline.clearFormat()},clearstyle:function(){this.inline.clearStyle()},clearclass:function(){this.inline.clearClass()},clearattr:function(){this.inline.clearAttr()},add:function(t,e){this.inline.add(t,e)},toggle:function(t,e){this.inline.toggle(t,e)},set:function(t,e){this.inline.set(t,e)},remove:function(t,e){this.inline.remove(t,e)}}),$R.add("module","autosave",{init:function(t){this.app=t,this.opts=t.opts,this.utils=t.utils,this.source=t.source},onsynced:function(){this.opts.autosave&&this._send()},_send:function(){var e=this.opts.autosaveName?this.opts.autosaveName:this.source.getName(),i={};i[e]=this.source.getCode(),i=this.utils.extendData(i,this.opts.autosaveData),$R.ajax.post({url:this.opts.autosave,data:i,success:function(t){this._complete(t,e,i)}.bind(this)})},_complete:function(t,e,i){var s=t&&t.error?"autosaveError":"autosave";this.app.broadcast(s,e,i,t)}}),$R.add("module","input",{init:function(t){this.app=t,this.opts=t.opts,this.utils=t.utils,this.editor=t.editor,this.keycodes=t.keycodes,this.element=t.element,this.selection=t.selection,this.insertion=t.insertion,this.inspector=t.inspector,this.autoparser=t.autoparser,this.lastShiftKey=!1},onpaste:function(t,e){if(this.opts.input)return $R.create("input.paste",this.app,t,e)},onkeydown:function(t){if(this.opts.input){var e=t.which;if(!$R.create("input.shortcut",this.app,t).is()){if((t.ctrlKey||t.metaKey)&&!t.altKey&&65===e)return t.preventDefault(),this._selectAll();var i=[this.keycodes.ENTER,this.keycodes.SPACE,this.keycodes.BACKSPACE,this.keycodes.DELETE],s=[this.keycodes.UP,this.keycodes.DOWN,this.keycodes.LEFT,this.keycodes.RIGHT],n=-1!==i.indexOf(e),r=-1!==s.indexOf(e),o=(t.ctrlKey||t.metaKey)&&88===e,a=!t.ctrlKey&&!t.metaKey&&(48<=e&&e<=57||65<=e&&e<=90);if(this.selection.isAll()&&r&&(o||!t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.shiftKey)){if(o)return this.editor.disableNonEditables(),void this.app.broadcast("empty");if(this._isArrowKey(e))return!0;if(n&&t.preventDefault(),this.element.isType("inline"))this.editor.getElement().html(""),this.editor.startFocus();else this.insertion.set(this.opts.emptyHtml);if(n)return;this.app.broadcast("empty")}if(this.opts.autoparse&&this.autoparser.format(t,e),!a||!this.selection.hasNonEditable())return e===this.keycodes.ENTER?$R.create("input.enter",this.app,t,e):t.metaKey&&219===e?(t.preventDefault(),void this.app.api("module.list.outdent")):e===this.keycodes.TAB||t.metaKey&&221===e?$R.create("input.tab",this.app,t,e):e===this.keycodes.SPACE?$R.create("input.space",this.app,t,e,this.lastShiftKey):this._isDeleteKey(e)?$R.create("input.delete",this.app,t,e):this._isArrowKey(e)?$R.create("input.arrow",this.app,t,e):void 0;t.preventDefault()}}},onkeyup:function(t){if(this.opts.input){var e=t.which;if(this.lastShiftKey=t.shiftKey,this.app.broadcast("contextbar.close"),!$R.create("input.shortcode",this.app,t,e).is()){if(e===this.keycodes.BACKSPACE){var i=this.editor.getElement(),s=this.utils.trimSpaces(i.html());if(""===(s=(s=s.replace(/<br\s?\/?>/g,"")).replace(/<div><\/div>/,"")))return t.preventDefault(),this.editor.setEmpty(),void this.editor.startFocus()}this.editor.isEmpty()&&this.app.broadcast("empty")}}},start:function(){this.opts.shortcutsAdd&&(this.opts.shortcuts=$R.extend({},!0,this.opts.shortcuts,this.opts.shortcutsAdd))},_selectAll:function(){var t,e=this.selection.getCurrent(),i=this.inspector.parse(e);return i.isComponentType("table")?(t=i.getTable(),void this.selection.setAll(t)):i.isComponentType("code")?(t=i.getComponentCodeElement(),void this.selection.setAll(t)):void this.selection.setAll()},_isArrowKey:function(t){return-1!==[this.keycodes.UP,this.keycodes.DOWN,this.keycodes.RIGHT,this.keycodes.LEFT].indexOf(t)},_isDeleteKey:function(t){return t===this.keycodes.BACKSPACE||t===this.keycodes.DELETE}}),$R.add("class","input.arrow",{init:function(t,e,i){this.app=t,this.opts=t.opts,this.utils=t.utils,this.caret=t.caret,this.offset=t.offset,this.marker=t.marker,this.editor=t.editor,this.keycodes=t.keycodes,this.component=t.component,this.inspector=t.inspector,this.selection=t.selection,this.key=i,this._init(e)},_init:function(t){if(!this._isRightLeftKey()||!this._isExitVariable(t)){if(this._isRightDownKey()){if(this._isExitOnDownRight(t))return;if(this._selectComponent(t,"End","next"))return}if(this._isLeftUpKey()){if(this._isExitOnUpLeft(t))return;if(this._selectComponent(t,"Start","prev"))return}this.key===this.keycodes.LEFT?this.utils.trimInvisibleChars("left"):this.key===this.keycodes.RIGHT&&this.utils.trimInvisibleChars("right")}},_isRightDownKey:function(){return-1!==[this.keycodes.DOWN,this.keycodes.RIGHT].indexOf(this.key)},_isLeftUpKey:function(){return-1!==[this.keycodes.UP,this.keycodes.LEFT].indexOf(this.key)},_isRightLeftKey:function(){return-1!==[this.keycodes.RIGHT,this.keycodes.LEFT].indexOf(this.key)},_isExitVariable:function(t){var e=this.selection.getCurrent(),i=this.inspector.parse(e),s=i.getComponent();if(i.isComponentType("variable")&&i.isComponentActive()){t.preventDefault();var n=this.key===this.keycodes.LEFT?"setBefore":"setAfter";this.caret[n](s)}else;},_isExitOnUpLeft:function(t){var e=this.selection.getCurrent(),i=this.selection.getBlock(e),s=this.inspector.parse(e),n=i.previousElementSibling,r=this.caret.isStart(i);if(r&&n&&"TABLE"===n.tagName)return t.preventDefault(),this.caret.setEnd(n),!0;if(s.isFigcaption()){i=s.getFigcaption(),r=this.caret.isStart(i);var o=$R.dom(i).closest(".redactor-component");if(r&&0!==o.length)return t.preventDefault(),this.caret.setEnd(o),!0}else{if(s.isTable()&&r)return t.preventDefault(),this.caret.setEnd(i.previousElementSibling),!0;if(!s.isComponentEditable()&&s.isComponent()&&!s.isComponentType("variable")){var a=s.getComponent();if(!a.previousElementSibling)return t.preventDefault(),this.component.clearActive(),this._exitPrevElement(t,s.getComponent());if(a.previousElementSibling)return t.preventDefault(),this.component.clearActive(),this.caret.setEnd(a.previousElementSibling),!0}}},_isExitOnDownRight:function(t){var e,i,s=this.editor.getElement(),n=this.selection.getCurrent(),r=this.inspector.parse(n),o=this.caret.isEnd();if(r.isTable()){if(e=r.getTable(),(i=this.caret.isEnd(e))||o)return this._exitNextElement(t,r.getComponent())}else if(r.isFigcaption()){if(e=r.getFigcaption(),(i=this.caret.isEnd(e))||o)return this._exitNextElement(t,r.getComponent())}else if(r.isComponentType("code")){var a=r.getComponent(),l=$R.dom(r.getComponentCodeElement()).closest("pre");i=this.caret.isEnd(e);var h=l&&l.get().nextElementSibling;if(i&&!h)return this._exitNextElement(t,a)}else if(r.isPre()||r.isBlockquote()||r.isDl()){if(o){if(r.isPre())return this._exitNextElement(t,r.getPre());if(r.isBlockquote())return this._exitNextElement(t,r.getBlockquote());if(r.isDl())return this._exitNextElement(t,r.getDl())}}else if(r.isList()){var c=$R.dom(n).parents("ul, ol",s).last();if((i=this.caret.isEnd(c))||o)return this._exitNextElement(t,c.get())}else if(r.isComponent()&&!r.isComponentType("variable")&&"span"!==r.getTag())return this.component.clearActive(),this._exitNextElement(t,r.getComponent())},_exitPrevElement:function(t,e){return t.preventDefault(),e.previousElementSibling?this.caret.setEnd(e.previousElementSibling):this.utils.createMarkupBefore(e),!0},_exitNextElement:function(t,e){return t.preventDefault(),e.nextElementSibling?this.caret.setStart(e.nextElementSibling):this.utils.createMarkup(e),!0},_selectComponent:function(t,e,i){var s=this.selection.getCurrent(),n=this.selection.getBlock(s),r=this.utils.findSiblings(s,i),o=this.utils.findSiblings(n,i);r&&this.caret["is"+e](s)?this._selectComponentItem(t,r,e):o&&this.caret["is"+e](n)&&this._selectComponentItem(t,o,e)},_selectComponentItem:function(t,e,i){if(this.component.isNonEditable(e))return t.preventDefault(),this.caret["set"+i](e),!0}}),$R.add("class","input.delete",{init:function(t,e,i){this.app=t,this.opts=t.opts,this.caret=t.caret,this.utils=t.utils,this.editor=t.editor,this.marker=t.marker,this.keycodes=t.keycodes,this.component=t.component,this.inspector=t.inspector,this.selection=t.selection,this.insertion=t.insertion,this.key=i,this._init(e)},_init:function(t){if(!this._removeActiveComponent(t)&&!this._removeAllSelectedTable(t)){if(this.key===this.keycodes.BACKSPACE){var e=this.editor.getElement();if(this.utils.trimSpaces(e.html())===this.opts.emptyHtml)return void t.preventDefault()}if(this._detectVariableOrNonEditable()||this.selection.hasNonEditable())t.preventDefault();else{if(this.selection.isAll())return t.preventDefault(),void this.insertion.set(this.opts.emptyHtml);this.selection.isCollapsed()&&(this.key===this.keycodes.BACKSPACE?this._traverseBackspace(t):this.key===this.keycodes.DELETE&&this._traverseDelete(t)),this.key===this.keycodes.BACKSPACE&&this.utils.trimInvisibleChars("left"),this._removeUnwantedStyles(),this._removeEmptySpans(),this._removeSpanTagsInHeadings(),this._removeInlineTagsInPre()}}},_detectVariableOrNonEditable:function(){var t,e=this.selection.getBlock(),i=this.caret.isStart(e),s=this.caret.isEnd(e);if(this.key===this.keycodes.BACKSPACE&&i){if(t=e.previousSibling,this._isNonEditable(t))return!0}else if(this.key===this.keycodes.DELETE&&s&&(t=e.nextSibling,this._isNonEditable(t)))return!0;var n=this.selection.getCurrent(),r=this.caret.isStart(n),o=this.caret.isEnd(n),a=""===this.selection.getTextBeforeCaret().trim(),l=""===this.selection.getTextAfterCaret().trim();if(this.key===this.keycodes.BACKSPACE&&r&&!a){if(t=n.previousSibling,this._isVariable(t))return this.caret.setEnd(t),!0;if(this._isNonEditable(t))return!0}else if(this.key===this.keycodes.DELETE&&o&&!l){if(t=n.nextSibling,this._isVariable(t))return this.caret.setStart(t),!0;if(this._isNonEditable(t))return!0}},_isVariable:function(t){return 0!==$R.dom(t).closest('[data-redactor-type="variable"]').length},_isNonEditable:function(t){return 0!==$R.dom(t).closest(".non-editable").length},_getBlock:function(){var t=this.editor.getElement(),e=this.selection.getBlock(),i=this.inspector.parse(e);return e=i.isList()?$R.dom(e).parents("ul, ol",t).last().get():e,e=i.isDl()?i.getDl():e,e=i.isTable()?i.getTable():e},_traverseDelete:function(t){var e,i,s,n=this.selection.getCurrent(),r=this.inspector.parse(n);if(r.isFigcaption()){if(e=r.getFigcaption(),i=this.caret.isEnd(e))return void t.preventDefault()}else if(r.isComponentType("code")&&(e=r.getComponent(),i=this.caret.isEnd(e)))return void t.preventDefault();e=this._getBlock();var o=this.utils.findSiblings(e,"next");if(o){i=this.caret.isEnd(e);var a=this.inspector.parse(o),l="P"===o.tagName||"DIV"===o.tagName;if(i&&a.isComponentType("table"))return t.preventDefault(),void this.caret.setStart(o);if(i&&a.isComponentEditable())return t.preventDefault(),void this.component.remove(o,!1);if(i&&a.isComponent())return t.preventDefault(),this.caret.setStart(o),void(this.utils.isEmptyHtml(e.innerHTML)&&$R.dom(e).remove());if(i&&a.isList()){var h=$R.dom(e);if(s=$R.dom(o),r.isList())return t.preventDefault(),h.append(s),void s.unwrap();var c=s.children("li").first(),d=c.find("ul, ol");if(0!==d.length)return t.preventDefault(),s.prepend(d),d.unwrap(),h.append(c),void c.unwrap()}else if(i&&!r.isList()&&!r.isTable()&&l&&!this.utils.isEmptyHtml(e.innerHTML)){t.preventDefault();var u=$R.dom(e);return s=$R.dom(o),u.append(s),void s.unwrap()}}},_traverseBackspace:function(t){var e,i,s,n,r=this.selection.getCurrent(),o=this.inspector.parse(r);if(o.isFigcaption()){if(e=o.getFigcaption(),i=this.caret.isStart(e))return void t.preventDefault()}else if(o.isComponentType("code")&&(e=o.getComponent(),(i=this.caret.isStart(e))&&e.previousElementSibling))return t.preventDefault(),this.caret.setEnd(e.previousElementSibling),!0;e=this._getBlock();var a=this.utils.findSiblings(e,"prev");if(a){i=this.caret.isStart(e);var l=this.inspector.parse(a),h="P"===a.tagName||"DIV"===a.tagName;if(i&&l.isComponentType("code"))return t.preventDefault(),void this.component.remove(a,!1);if(i&&l.isComponentType("table"))return t.preventDefault(),void this.caret.setEnd(a);if(i&&l.isComponent())return t.preventDefault(),this.caret.setStart(a),void(this.utils.isEmptyHtml(e.innerHTML)&&$R.dom(e).remove());if(i&&o.isList())if(t.preventDefault(),n=$R.dom(e),s=$R.dom(a),l.isList())n.children("li").first().prepend(this.marker.build("start")),s.append(n),n.unwrap(),this.selection.restoreMarkers();else{var c=n.children("li").first(),d=c.get(),u=c.find("ul, ol"),p=this.utils.replaceToTag(d,this.opts.markup);this.opts.breakline&&p.attr("data-redactor-tag","br"),n.before(p),this.caret.setStart(p),0!==u.length&&(n.prepend(u),u.unwrap())}else if(i&&h){if(t.preventDefault(),this.utils.isEmpty(a))return void(s=$R.dom(a)).remove();var f=this.utils.createInvisibleChar(),m=$R.dom(e);return s=$R.dom(a),this.caret.setEnd(s),m.prepend(f),s.append(m.contents()),void m.remove()}}else setTimeout(this._replaceBlock.bind(this),1)},_replaceBlock:function(){var t=this.selection.getBlock(),e=$R.dom(t);if("p"===this.opts.markup&&t&&this._isNeedToReplaceBlock(t)){var i=document.createElement(this.opts.markup);e.replaceWith(i),this.caret.setStart(i)}this.opts.breakline&&t&&"DIV"===t.tagName&&e.attr("data-redactor-tag","br")},_isNeedToReplaceBlock:function(t){return"DIV"===t.tagName&&this.utils.isEmptyHtml(t.innerHTML)},_removeActiveComponent:function(t){var e=this.selection.getCurrent(),i=this.inspector.parse(e),s=i.getComponent();if(i.isComponent()&&this.component.isActive(s))return t.preventDefault(),this.component.remove(s),!0},_removeAllSelectedTable:function(t){var e=this.selection.getCurrent(),i=this.inspector.parse(e).getTable();if(i&&this.selection.isAll(i))return t.preventDefault(),this.component.remove(i),!0},_removeUnwantedStyles:function(){var t=this.editor.getElement();setTimeout(function(){t.find("*[style]").not("img, figure, iframe, [data-redactor-style-cache], [data-redactor-span]").removeAttr("style")},0)},_removeEmptySpans:function(){var t=this.editor.getElement();setTimeout(function(){t.find("span").each(function(t){0===t.attributes.length&&$R.dom(t).replaceWith(t.childNodes)})},0)},_removeSpanTagsInHeadings:function(){var t=this.editor.getElement();setTimeout(function(){t.find("h1, h2, h3, h4, h5, h6").each(function(t){var e=$R.dom(t);0===e.closest("figure").length&&e.find("span").not(".redactor-component, .non-editable, .redactor-selection-marker, [data-redactor-style-cache], [data-redactor-span]").unwrap()})},1)},_removeInlineTagsInPre:function(){var t=this.editor.getElement(),i=this.opts.inlineTags;setTimeout(function(){t.find("pre").each(function(t){var e=$R.dom(t);0===e.closest("figure").length&&e.find(i.join(",")).not("code, .redactor-selection-marker").unwrap()})},1)}}),$R.add("class","input.enter",{init:function(t,e){this.app=t,this.opts=t.opts,this.utils=t.utils,this.caret=t.caret,this.editor=t.editor,this.insertion=t.insertion,this.selection=t.selection,this.inspector=t.inspector,this._init(e)},_init:function(t){return this.opts.enterKey?!1===this.app.broadcast("enter",t)?t.preventDefault():this.selection.hasNonEditable()?void t.preventDefault():t.ctrlKey||t.shiftKey?this._insertBreak(t):void(this._isExit(t)||this._traverse(t)):this._disable(t)},_disable:function(t){t.preventDefault();var e=this.selection.getRange();e&&!e.collapsed&&e.deleteContents()},_insertBreak:function(t){t.preventDefault();var e=this.selection.getCurrent(),i=this.inspector.parse(e);i.isComponent()&&!i.isComponentEditable()||i.isCode()||(i.isPre()?this.insertion.insertNewline():this.insertion.insertBreakLine())},_isExit:function(t){var e=this.editor.getElement(),i=this.selection.getBlock(),s=this.inspector.parse(i),n=this.caret.isEnd(i),r=this.selection.getCurrent(),o=r.previousSibling;if(s.isBlockquote()){var a=n&&this._isExitableBlock(i,"P"),l=n&&this._isExitableDblBreak(o);if(a||l)return this._exitFromElement(t,l?o:i,s.getBlockquote())}else if(!s.isComponentType("code")&&s.isPre()){if(n){var h=i.innerHTML;if(null!==(h=this.utils.removeInvisibleChars(h)).match(/(\n\n\n)$/))return $R.dom(o.previousSibling.previousSibling).remove(),this._exitFromElement(t,o,i)}}else if(s.isDl()){if(n&&this._isExitableBlock(i,"DT"))return this._exitFromElement(t,i,s.getDl())}else if(s.isList()){var c=$R.dom(r).parents("ul, ol",e).last();if((n=this.caret.isEnd(c))&&this._isExitableBlock(i,"LI"))return this._exitFromElement(t,i,c)}else if(s.isComponent()&&s.isComponentActive()&&!s.isFigcaption()&&!s.isComponentEditable())return this._exitFromElement(t,!1,s.getComponent())},_isExitableDblBreak:function(t){var e=!!t&&t.nextSibling;if(e){var i=this.utils.removeInvisibleChars(e.textContent);return 3===e.nodeType&&""===i.trim()}},_isExitableBlock:function(t,e){return t&&t.tagName===e&&this.utils.isEmptyHtml(t.innerHTML)},_exitFromElement:function(t,e,i){return t.preventDefault(),e&&$R.dom(e).remove(),this.utils.createMarkup(i),!0},_exitNextElement:function(t,e){return t.preventDefault(),e.nextSibling?this.caret.setStart(e.nextSibling):this.utils.createMarkup(e),!0},_traverse:function(t){var e=this.selection.getCurrent(),i=this.selection.isText(),s=this.selection.getBlock(),n=this.inspector.parse(e),r=!!s&&s.tagName.toLowerCase(),o=$R.dom(e).closest("[data-redactor-type=variable]");if(0!==o.length&&this.caret.setAfter(o),n.isPre())return t.preventDefault(),this.insertion.insertNewline();if(n.isBlockquote())return(s=this.selection.getBlock(e))&&"BLOCKQUOTE"===s.tagName?(t.preventDefault(),this.insertion.insertBreakLine()):void 0;if(n.isFigcaption()){s=n.getFigcaption();var a=this.caret.isEnd(s),l=this.caret.isEnd();return a||l?this._exitNextElement(t,n.getComponent()):void t.preventDefault()}return n.isDl()?(t.preventDefault(),this._traverseDl(e)):this.opts.breakline&&"div"===r?void setTimeout(this._replaceBlock.bind(this),1):i?(t.preventDefault(),this.insertion.insertBreakLine()):n.isList()?void 0:void setTimeout(this._replaceBlock.bind(this),1)},_traverseDl:function(t){var e=this.selection.getBlock(t),i=this.inspector.parse(e).getTag(),s=$R.dom(e),n=s.get().nextSibling||!1,r=$R.dom(n),o=n&&r.is("dd"),a=n&&r.is("dt"),l=this.caret.isEnd(e);if("dt"===i&&!o&&l){var h=document.createElement("dd");return s.after(h),void this.caret.setStart(h)}if("dd"!==i||a||!l)return this.insertion.insertBreakLine();var c=document.createElement("dt");return s.after(c),void this.caret.setStart(c)},_replaceBlock:function(){var t=this.selection.getBlock(),e=$R.dom(t);if("p"===this.opts.markup&&t&&this._isNeedToReplaceBlock(t)){var i=document.createElement(this.opts.markup);e.replaceWith(i),this.caret.setStart(i)}else if(t)if(this.utils.isEmptyHtml(t.innerHTML))this._clearBlock(e,t);else{var s=this.utils.getFirstNode(t);s&&"BR"===s.tagName&&($R.dom(s).remove(),this.caret.setStart(t))}t&&this._isNeedToCleanBlockStyle(t)&&this.opts.cleanOnEnter&&e.removeAttr("class style"),this.opts.breakline&&t&&t.tagName},_clearBlock:function(t,e){"DIV"===e.tagName&&t.find("br").remove(),!this.opts.cleanInlineOnEnter&&"<br>"!==e.innerHTML||t.html(""),this.caret.setStart(e)},_isNeedToReplaceBlock:function(t){return"DIV"===t.tagName&&this.utils.isEmptyHtml(t.innerHTML)},_isNeedToCleanBlockStyle:function(t){return"P"===t.tagName&&this.utils.isEmptyHtml(t.innerHTML)}}),$R.add("class","input.paste",{init:function(t,e,i,s,n){this.app=t,this.opts=t.opts,this.editor=t.editor,this.cleaner=t.cleaner,this.container=t.container,this.inspector=t.inspector,this.insertion=t.insertion,this.selection=t.selection,this.autoparser=t.autoparser,this.pasteHtml=s,this.pointInserted=n,this.dataTransfer=i,this._init(e)},_init:function(t){var e,i=this.dataTransfer||t.clipboardData,s=this.selection.getCurrent(),n=this.inspector.parse(s);if(this.dropPasted=this.dataTransfer,this.isRawCode=n.isPre()||n.isCode(),this.editor.enablePasting(),this.editor.saveScroll(),this.dropPasted||this.selection.saveMarkers(),this.isRawCode||!i)return e=this.isRawCode||i||!window.clipboardData?i.getData("text/plain"):window.clipboardData.getData("text"),t.preventDefault(),void this._insert(t,e);if(this.pasteHtml)t.preventDefault(),this._insert(t,this.pasteHtml);else{var r=i.getData("URL"),o=this._isPlainText(i)?this.cleaner.encodeEntities(i.getData("text/plain")):i.getData("text/html");if(o=r&&""!==r?r:o,null!==i.files&&0<i.files.length&&""===o){for(var a=[],l=0;l<i.files.length;l++){var h=i.files[l]||i.items[l].getAsFile();h&&a.push(h)}if(0<a.length)return t.preventDefault(),void this._insertFiles(t,a)}t.preventDefault(),this._insert(t,o)}},_isPlainText:function(t){var e=t.getData("text/plain"),i=t.getData("text/html");if(!e||!i)return null!==e;var s=document.createElement("div");return s.innerHTML=i,s.textContent===e?!s.querySelector(":not(meta)"):void 0},_restoreSelection:function(){this.editor.restoreScroll(),this.editor.disablePasting(),this.dropPasted||this.selection.restoreMarkers()},_insert:function(t,e){var i=this.app.broadcast("pasteBefore",e);if(e=(e=void 0===i?e:i).trim(),e=(e=this.isRawCode?e:this.cleaner.paste(e)).trim(),e=this.isRawCode?this.cleaner.encodePhpCode(e):e,e=void 0===(i=this.app.broadcast("pasting",e))?e:i,this._restoreSelection(),this.opts.input){this.app.broadcast("state",!1);var s=[];if(this.isRawCode){e=e.replace("<?php","<?php");var n=document.createTextNode(e);s=this.insertion.insertNode(n,"after"),this.app.broadcast("pasted",s)}else this.opts.autoparse&&this.opts.autoparsePaste&&(e=this.autoparser.parse(e)),s=this.dropPasted?this.insertion.insertToPoint(t,e,this.pointInserted):this.insertion.insertHtml(e),this.app.broadcast("pasted",s),this.app.broadcast("autoparseobserve")}},_insertFiles:function(t,e){this._restoreSelection();var i=-1!==this.opts.imageTypes.indexOf(e[0].type),s=void 0===this.dropPasted;i?this.app.broadcast("dropimage",t,e,s):this.app.broadcast("dropfile",t,e,s)}}),$R.add("class","input.shortcode",{init:function(t,e,i){this.app=t,this.opts=t.opts,this.utils=t.utils,this.marker=t.marker,this.keycodes=t.keycodes,this.selection=t.selection,this.worked=!1,i===this.keycodes.SPACE&&this._init()},is:function(){return this.worked},_init:function(){var t=this.selection.getCurrent();if(t&&3===t.nodeType){var e=this.utils.removeInvisibleChars(t.textContent),i=this.opts.shortcodes;for(var s in i){var n=new RegExp("^"+this.utils.escapeRegExp(s));if(null!==e.match(n)&&void 0!==i[s].format)return this._format(i[s].format,t,n)}}},_format:function(t,e,i){var s=(e=this.marker.insert("start").previousSibling).textContent;s=(s=this.utils.trimSpaces(s)).replace(i,""),e.textContent=s;var n="ul"===t||"ol"===t?"module.list.toggle":"module.block.format";this.app.api(n,t),this.selection.restoreMarkers(),this.worked=!0}}),$R.add("class","input.shortcut",{init:function(t,e){this.app=t,this.opts=t.opts,this.worked=!1,this.hotkeys={8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},this.hotkeysShiftNums={"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},this._init(e)},is:function(){return this.worked},_init:function(t){if(!1!==this.opts.shortcuts)for(var e in this.opts.shortcuts)this._build(t,e,this.opts.shortcuts[e]);else!t.ctrlKey&&!t.metaKey||66!==t.which&&73!==t.which||t.preventDefault()},_build:function(t,e,i){for(var s=e.split(","),n=s.length,r=0;r<n;r++)"string"==typeof s[r]&&this._handler(t,s[r].trim(),i)},_handler:function(t,e,i){e=e.toLowerCase().split(" ");for(var s=this.hotkeys[t.keyCode],n=String.fromCharCode(t.which).toLowerCase(),r="",o={},a=["meta","ctrl","alt","shift"],l=0;l<a.length;l++){var h=a[l];t[h+"Key"]&&s!==h&&(r+=h+"+")}s&&(o[r+s]=!0),n&&(o[r+n]=!0,o[r+this.hotkeysShiftNums[n]]=!0,"shift+"===r&&(o[this.hotkeysShiftNums[n]]=!0));var c=e.length;for(l=0;l<c;l++)if(o[e[l]])return t.preventDefault(),this.worked=!0,void(i.message?(this.app.broadcast(i.message,i.args),this.app.broadcast("buffer.trigger")):i.api&&(this.app.api(i.api,i.args),this.app.broadcast("buffer.trigger")))}}),$R.add("class","input.space",{init:function(t,e,i,s){this.app=t,this.keycodes=t.keycodes,this.insertion=t.insertion,this.selection=t.selection,this.key=i,this.lastShiftKey=s,this._init(e)},_init:function(t){if(!this.selection.hasNonEditable())return this.lastShiftKey||this.key!==this.keycodes.SPACE||!t.ctrlKey&&!t.shiftKey||t.metaKey?void 0:(t.preventDefault(),void this.insertion.insertChar(" "));t.preventDefault()}}),$R.add("class","input.tab",{init:function(t,e){this.app=t,this.opts=t.opts,this.inspector=t.inspector,this.insertion=t.insertion,this.selection=t.selection,this._init(e)},_init:function(t){if(this.opts.tabKey){if(!1===this.app.broadcast("tab",t))return t.preventDefault();this._traverse(t)}},_traverse:function(t){var e=this.selection.getCurrent(),i=this.inspector.parse(e);return!i.isComponent()&&t.shiftKey?this._insertHardTab(t,4):i.isList()?(t.preventDefault(),this.app.api("module.list.indent")):i.isPre()||i.isComponentType("code")&&!i.isFigcaption()?this._tabCode(t):!1!==this.opts.tabAsSpaces?this._insertHardTab(t,this.opts.tabAsSpaces):void 0},_insertHardTab:function(t,e){t.preventDefault();var i=document.createTextNode(Array(e+1).join(" "));return this.insertion.insertNode(i,"end")},_tabCode:function(t){t.preventDefault();var e=this.opts.preSpaces?document.createTextNode(Array(this.opts.preSpaces+1).join(" ")):document.createTextNode("\t");return this.insertion.insertNode(e,"end")}}),$R.add("module","upload",{init:function(t){this.app=t,this.opts=t.opts,this.lang=t.lang,this.utils=t.utils,this.editor=t.editor,this.progress=t.progress,this.defaults={event:!1,element:!1,name:!1,files:!1,url:!1,data:!1,paramName:!1}},build:function(t){this.p=$R.extend(this.defaults,t),this.$el=$R.dom(this.p.element),"INPUT"===this.$el.get().tagName?this._buildInput():this._buildBox()},send:function(t){this.p=$R.extend(this.defaults,t),this.$uploadbox=this.editor.getElement(),this._send(this.p.event,this.p.files)},complete:function(t,e){this._complete(t,e)},_buildInput:function(){this.box=!1,this.prefix="",this.$uploadbox=$R.dom('<div class="upload-redactor-box" />'),this.$el.hide(),this.$el.after(this.$uploadbox),this.opts.multipleUpload?this.$el.attr("multiple","multiple"):this.$el.removeAttr("multiple"),"file"!==this.p.name&&this.$el.attr("accept","image/*"),this._buildPlaceholder(),this._buildEvents()},_buildBox:function(){this.box=!0,this.prefix="box-",this.$uploadbox=this.$el,this.$uploadbox.attr("ondragstart","return false;"),this.$uploadbox.on("drop.redactor.upload",this._onDropBox.bind(this)),this.$uploadbox.on("dragover.redactor.upload",this._onDragOver.bind(this)),this.$uploadbox.on("dragleave.redactor.upload",this._onDragLeave.bind(this))},_buildPlaceholder:function(){this.$placeholder=$R.dom('<div class="upload-redactor-placeholder" />'),this.$placeholder.html(this.lang.get("upload-label")),this.$uploadbox.append(this.$placeholder)},_buildEvents:function(){this.$el.on("change.redactor.upload",this._onChange.bind(this)),this.$uploadbox.on("click.redactor.upload",this._onClick.bind(this)),this.$uploadbox.on("drop.redactor.upload",this._onDrop.bind(this)),this.$uploadbox.on("dragover.redactor.upload",this._onDragOver.bind(this)),this.$uploadbox.on("dragleave.redactor.upload",this._onDragLeave.bind(this))},_onClick:function(t){t.preventDefault(),this.$el.click()},_onChange:function(t){this._send(t,this.$el.get().files)},_onDrop:function(t){t.preventDefault(),this._clear(),this._setStatusDrop(),this._send(t)},_onDragOver:function(t){return t.preventDefault(),this._setStatusHover(),!1},_onDragLeave:function(t){return t.preventDefault(),this._removeStatusHover(),!1},_onDropBox:function(t){t.preventDefault(),this._clear(),this._setStatusDrop(),this._send(t)},_removeStatusHover:function(){this.$uploadbox.removeClass("upload-redactor-"+this.prefix+"hover")},_setStatusDrop:function(){this.$uploadbox.addClass("upload-redactor-"+this.prefix+"drop")},_setStatusHover:function(){this.$uploadbox.addClass("upload-redactor-"+this.prefix+"hover")},_setStatusError:function(){this.$uploadbox.addClass("upload-redactor-"+this.prefix+"error")},_setStatusSuccess:function(){this.$uploadbox.addClass("upload-redactor-"+this.prefix+"success")},_clear:function(){for(var t=["drop","hover","error","success"],e=0;e<t.length;e++)this.$uploadbox.removeClass("upload-redactor-"+this.prefix+t[e]);this.$uploadbox.removeAttr("ondragstart")},_send:function(t,e){t=t.originalEvent||t,e=e||t.dataTransfer.files;var i=new FormData,s=this._getUploadParam();i=this._buildData(s,e,i),i=this.utils.extendData(i,this.p.data),!1!==this.app.broadcast("upload.start",t,i,e)&&this._sendData(i,e,t)},_sendData:function(t,e,i){if(this.progress.show(),"function"==typeof this.p.url){var s=this.p.url(t,e,i,this);s instanceof Promise||this._complete(s,i)}else $R.ajax.post({url:this.p.url,data:t,before:function(t){return this.app.broadcast("upload.beforeSend",t)}.bind(this),success:function(t){this._complete(t,i)}.bind(this)})},_getUploadParam:function(){return this.p.paramName?this.p.paramName:"file"},_buildData:function(t,e,i){if(1===e.length)i.append(t+"[]",e[0]);else if(1<e.length&&!1!==this.opts.multipleUpload)for(var s=0;s<e.length;s++)i.append(t+"[]",e[s]);return i},_complete:function(t,e){this._clear(),this.progress.hide(),t&&t.error?(this._setStatusError(),this.app.broadcast("upload."+this.p.name+".error",t,e),this.app.broadcast("upload.error",t)):(this._setStatusSuccess(),this.app.broadcast("upload."+this.p.name+".complete",t,e),this.app.broadcast("upload.complete",t),setTimeout(this._clear.bind(this),500))}}),$R.add("class","code.component",{mixins:["dom","component"],init:function(t,e){return this.app=t,e&&void 0!==e.cmnt?e:this._init(e)},_init:function(t){var e;if(void 0!==t){var i=$R.dom(t).closest("figure");0!==i.length?this.parse(i):(this.parse("<figure>"),this.append(t)),e=this.find("pre code, pre").last()}else e=$R.dom("<pre>"),this.parse("<figure>"),this.append(e);this._initElement(e),this._initWrapper()},_initElement:function(t){t.attr({tabindex:"-1",contenteditable:!0})},_initWrapper:function(){this.addClass("redactor-component"),this.attr({"data-redactor-type":"code",tabindex:"-1",contenteditable:!1})}}),$R.add("module","form",{init:function(t){this.app=t,this.lang=t.lang,this.component=t.component,this.inspector=t.inspector},onform:{remove:function(t){this._remove(t)}},oncontextbar:function(t,e){var i=this.inspector.parse(t.target);if(i.isComponentType("form")){var s=i.getComponent(),n={remove:{title:this.lang.get("delete"),api:"module.form.remove",args:s}};e.set(t,s,n,"top")}},_remove:function(t){this.component.remove(t)}}),$R.add("class","form.component",{mixins:["dom","component"],init:function(t,e){return this.app=t,this.utils=t.utils,e&&void 0!==e.cmnt?e:this._init(e)},_init:function(t){if(void 0!==t)if(0!==$R.dom(t).closest("form").length){var e=this.utils.replaceToTag(t,"figure");this.parse(e)}else this.parse("<figure>"),this.append(t);else this.parse("<figure>");this._initWrapper()},_initWrapper:function(){this.addClass("redactor-component"),this.attr({"data-redactor-type":"form",tabindex:"-1",contenteditable:!1})}}),$R.add("module","image",{modals:{image:'<div class="redactor-modal-tab redactor-modal-tab-upload" data-title="## upload ##"><form action=""> <input type="file" name="file"> </form></div>',imageedit:'<div class="redactor-modal-group"> <div id="redactor-modal-image-preview" class="redactor-modal-side"></div> <form action="" class="redactor-modal-area"> <div class="form-item"> <label for="modal-image-title"> ## title ##</label> <input type="text" id="modal-image-title" name="title" /> </div> <div class="form-item form-item-caption"> <label for="modal-image-caption">## caption ##</label> <input type="text" id="modal-image-caption" name="caption" aria-label="## caption ##" /> </div> <div class="form-item form-item-align"> <label>## image-position ##</label> <select name="align" aria-label="## image-position ##"> <option value="none">## none ##</option> <option value="left">## left ##</option> <option value="center">## center ##</option> <option value="right">## right ##</option> </select> </div> <div class="form-item form-item-link"> <label for="modal-image-url">## link ##</label> <input type="text" id="modal-image-url" name="url" aria-label="## link ##" /> </div> <div class="form-item form-item-link"> <label class="checkbox"><input type="checkbox" name="target" aria-label="## link-in-new-tab ##"> ## link-in-new-tab ##</label> </div> </form> </div>'},init:function(t){this.app=t,this.opts=t.opts,this.lang=t.lang,this.caret=t.caret,this.utils=t.utils,this.editor=t.editor,this.storage=t.storage,this.component=t.component,this.inspector=t.inspector,this.insertion=t.insertion,this.selection=t.selection,this.justResized=!1},oninsert:function(){this._observeImages()},onstarted:function(){this.storage.observeImages(),this.opts.imageResizable&&(this.resizer=$R.create("image.resize",this.app)),this._observeImages()},ondropimage:function(t,e,i){if(this.opts.imageUpload){var s={url:this.opts.imageUpload,event:!i&&t,files:e,name:"imagedrop",data:this.opts.imageData,paramName:this.opts.imageUploadParam};this.app.api("module.upload.send",s)}},onstop:function(){this.resizer&&this.resizer.stop()},onbottomclick:function(){this.insertion.insertToEnd(this.editor.getLastNode(),"image")},onimageresizer:{stop:function(){this.resizer&&this.resizer.hide()}},onsource:{open:function(){this.resizer&&this.resizer.hide()},closed:function(){this._observeImages(),this.resizer&&this.resizer.rebuild()}},onupload:{complete:function(){this._observeImages()},image:{complete:function(t){this._insert(t)},error:function(t){this._uploadError(t)}},imageedit:{complete:function(t){this._change(t)},error:function(t){this._uploadError(t)}},imagedrop:{complete:function(t,e){this._insert(t,e)},error:function(t){this._uploadError(t)}},imagereplace:{complete:function(t){this._change(t,!1)},error:function(t){this._uploadError(t)}}},onmodal:{image:{open:function(t,e){this._setUpload(t,e)}},imageedit:{open:function(t,e){this._setFormData(t,e)},opened:function(t,e){this._setFormFocus(e)},remove:function(){this._remove(this.$image)},save:function(t,e){this._save(t,e)}}},onimage:{observe:function(){this._observeImages()},resized:function(){this.justResized=!0}},oncontextbar:function(t,e){if(this.justResized)this.justResized=!1;else{var i=this.selection.getCurrent(),s=this.inspector.parse(i),n=$R.dom(i).closest("img");if(!s.isFigcaption()&&s.isComponentType("image")||0!==n.length){var r=0!==n.length?n.get():s.getComponent(),o={edit:{title:this.lang.get("edit"),api:"module.image.open"},remove:{title:this.lang.get("delete"),api:"module.image.remove",args:r}};e.set(t,r,o)}}},open:function(){this.$image=this._getCurrent(),this.app.api("module.modal.build",this._getModalData())},insert:function(t){this._insert(t)},remove:function(t){this._remove(t)},_getModalData:function(){return this._isImage()&&this.opts.imageEditable?{name:"imageedit",width:"800px",title:this.lang.get("edit"),handle:"save",commands:{save:{title:this.lang.get("save")},remove:{title:this.lang.get("delete"),type:"danger"},cancel:{title:this.lang.get("cancel")}}}:{name:"image",title:this.lang.get("image")}},_isImage:function(){return this.$image},_getCurrent:function(){var t=this.selection.getCurrent(),e=this.inspector.parse(t),i=$R.dom(t).closest("img");return 0!==i.length?this.component.create("image",i):!(!e.isComponentType("image")||!e.isComponentActive())&&this.component.create("image",e.getComponent())},_insert:function(t,e){if(this.app.api("module.modal.close"),Array.isArray(t)){for(var i={},s=0;s<t.length;s++)i=$R.extend(i,t[s]);t=i}else"string"==typeof t&&(t={file:{url:t}});if("object"==typeof t){var n=0;for(var r in t)"object"==typeof t[r]&&n++;1<n?this._insertMultiple(t,e):this._insertSingle(t,e)}},_insertSingle:function(t,e){for(var i in t)if("object"==typeof t[i]){var s=this._createImageAndStore(t[i]),n=e?this.insertion.insertToPoint(e,s,!1,!1):this.insertion.insertHtml(s,!1);this._removeSpaceBeforeFigure(n[0]),this.component.setActive(n[0]),this.app.broadcast("image.uploaded",n[0],t)}},_insertMultiple:function(t,e){var i,s=0,n=[];for(var r in t)if("object"==typeof t[r]){s++;var o=this._createImageAndStore(t[r]);if(1===s)n=e?this.insertion.insertToPoint(e,o,!1,!1):this.insertion.insertHtml(o,!1);else $R.dom(n[0]).after(o),n=[o.get()],this.app.broadcast("image.inserted",o);i=n[0],this._removeSpaceBeforeFigure(n[0]),this.app.broadcast("image.uploaded",n[0],t)}this.component.setActive(i)},_createImageAndStore:function(t){var e=this.component.create("image");return e.addClass("redactor-uploaded-figure"),e.setData({src:t.url,id:t.id?t.id:this.utils.getRandomId()}),this.storage.add("image",e.getElement()),e},_removeSpaceBeforeFigure:function(t){if(t){var e=t.previousSibling,i=t.nextSibling,s=$R.dom(e),n=$R.dom(i);this.opts.breakline&&(i&&"br"===n.attr("data-redactor-tag")&&n.find("br").first().remove(),e&&"br"===s.attr("data-redactor-tag")&&s.find("br").last().remove()),e&&(this._removeInvisibleSpace(e),this._removeInvisibleSpace(e.previousSibling))}},_removeInvisibleSpace:function(t){t&&3===t.nodeType&&-1!==this.utils.searchInvisibleChars(t.textContent)&&t.parentNode.removeChild(t)},_save:function(t,e){var i=e.getData(),s={title:i.title};this.opts.imageLink&&(s.link={url:i.url,target:i.target}),this.opts.imageCaption&&(s.caption=i.caption),this.opts.imagePosition&&(s.align=i.align),this.$image.setData(s),this.resizer&&this.resizer.rebuild(),this.app.broadcast("image.changed",this.$image),this.app.api("module.modal.close")},_change:function(t,e){if("string"==typeof t&&(t={file:{url:t}}),"object"==typeof t){var i;for(var s in t)if("object"==typeof t[s]){(i=$R.dom("<img>")).attr("src",t[s].url),this.$image.changeImage(t[s]),this.app.broadcast("image.changed",this.$image,t),this.app.broadcast("image.uploaded",this.$image,t),this.app.broadcast("hardsync");break}!1!==e&&i.on("load",function(){this.$previewBox.html(i)}.bind(this))}},_uploadError:function(t){this.app.broadcast("image.uploadError",t)},_remove:function(t){this.app.api("module.modal.close"),this.component.remove(t)},_observeImages:function(){var t=this.editor.getElement(),i=this;t.find("img").each(function(t){var e=$R.dom(t);e.off(".drop-to-replace"),e.on("dragover.drop-to-replace dragenter.drop-to-replace",function(t){t.preventDefault()}),e.on("drop.drop-to-replace",function(t){if(!i.app.isDragComponentInside())return i._setReplaceUpload(t,e)})})},_setFormData:function(t,e){this._buildPreview(t),this._buildPreviewUpload();var i=this.$image.getData(),s={title:i.title};this.opts.imageCaption?s.caption=i.caption:t.find(".form-item-caption").hide(),this.opts.imagePosition?s.align=i.align:t.find(".form-item-align").hide(),this.opts.imageLink?i.link&&(s.url=i.link.url,i.link.target&&(s.target=!0)):t.find(".form-item-link").hide(),e.setData(s)},_setFormFocus:function(t){t.getField("title").focus()},_setReplaceUpload:function(t,e){if((t=t.originalEvent||t).stopPropagation(),t.preventDefault(),this.opts.imageUpload){this.$image=this.component.create("image",e);var i={url:this.opts.imageUpload,files:t.dataTransfer.files,name:"imagereplace",data:this.opts.imageData,paramName:this.opts.imageUploadParam};this.app.api("module.upload.send",i)}},_setUpload:function(t,e){this.opts.imageUpload||t.getBody().find(".redactor-modal-tab-upload").remove();var i={url:this.opts.imageUpload,element:e.getField("file"),name:"image",data:this.opts.imageData,paramName:this.opts.imageUploadParam};this.app.api("module.upload.build",i)},_buildPreview:function(t){this.$preview=t.find("#redactor-modal-image-preview");var e=this.$image.getData(),i=$R.dom("<img>");i.attr("src",e.src),this.$previewBox=$R.dom("<div>"),this.$previewBox.append(i),this.$preview.html(""),this.$preview.append(this.$previewBox)},_buildPreviewUpload:function(){if(this.opts.imageUpload){var t=$R.dom('<div class="desc">');t.html(this.lang.get("upload-change-label")),this.$preview.append(t);var e={url:this.opts.imageUpload,element:this.$previewBox,name:"imageedit",data:this.opts.imageData,paramName:this.opts.imageUploadParam};this.app.api("module.upload.build",e)}}}),$R.add("class","image.component",{mixins:["dom","component"],init:function(t,e){return this.app=t,this.opts=t.opts,this.selection=t.selection,e&&void 0!==e.cmnt?e:this._init(e)},setData:function(t){for(var e in t)this._set(e,t[e])},getData:function(){for(var t=["src","title","caption","align","link","id"],e={},i=0;i<t.length;i++)e[t[i]]=this._get(t[i]);return e},getElement:function(){return this.$element},changeImage:function(t){this.$element.attr("src",t.url)},_init:function(t){var e=$R.dom(t),i=e.closest("figure");void 0===t?(this.$element=$R.dom("<img>"),this.parse("<figure>"),this.append(this.$element)):0===i.length?(this.parse("<figure>"),this.$element=e,this.$element.wrap(this)):(this.parse(i),this.$element=this.find("img")),this._initWrapper()},_set:function(t,e){this["_set_"+t](e)},_get:function(t){return this["_get_"+t]()},_set_src:function(t){this.$element.attr("src",t)},_set_id:function(t){this.opts.imageObserve&&this.$element.attr("data-image",t)},_set_title:function(t){""===(t=t.trim().replace(/(<([^>]+)>)/gi,""))?this.$element.removeAttr("alt"):this.$element.attr("alt",t)},_set_caption:function(t){var e=this.find("figcaption");return 0===e.length&&((e=$R.dom("<figcaption>")).attr("contenteditable","true"),this.append(e)),""===t?e.remove():e.html(t),e},_set_align:function(t){var e="",i="",s="",n=this,r=this.find("img"),o=this.find("figcaption");if("object"==typeof this.opts.imagePosition){var a=this.opts.imagePosition;for(var l in a)n.removeClass(a[l]);var h=void 0!==a[t]&&a[t];h&&n.addClass(h)}else{var c=r.width();switch(t){case"left":e="left",i="0 "+this.opts.imageFloatMargin+" "+this.opts.imageFloatMargin+" 0";break;case"right":e="right",i="0 0 "+this.opts.imageFloatMargin+" "+this.opts.imageFloatMargin;break;case"center":s="center",i="auto"}n.css({float:e,width:c+"px",maxWidth:c+"px",margin:i,"text-align":s}),n.attr("rel",n.attr("style")),"none"===t&&(n.css("max-width",""),n.css("width","")),"center"===t?(n.css("max-width",""),n.css("width",""),o.css("text-align","center")):o.css("text-align","")}},_set_link:function(t){var e=this._findLink();if(""!==t.url)return e||(e=$R.dom("<a>"),this.$element.wrap(e)),e.attr("href",t.url),t.target?e.attr("target",!0===t.target?"_blank":t.target):e.removeAttr("target"),e;e&&e.unwrap()},_get_src:function(){return this.$element.attr("src")},_get_id:function(){return this.$element.attr("data-image")},_get_title:function(){var t=this.$element.attr("alt");return t||""},_get_caption:function(){var t=this.find("figcaption");return 0===t.length?"":t.html()},_get_align:function(){var t="";if("object"==typeof this.opts.imagePosition){t="none";var e=this.opts.imagePosition;for(var i in e)if(this.hasClass(e[i])){t=i;break}}else t="center"===this.css("text-align")?"center":this.css("float");return t},_get_link:function(){var t=this._findLink();if(t){var e=!!t.attr("target");return{url:t.attr("href"),target:e}}},_initWrapper:function(){this.addClass("redactor-component"),this.attr({"data-redactor-type":"image",tabindex:"-1",contenteditable:!1})},_findLink:function(){var t=this.find("a").filter(function(t){return 0===$R.dom(t).closest("figcaption").length});return 0!==t.length&&t}}),$R.add("class","image.resize",{init:function(t){this.app=t,this.$doc=t.$doc,this.$win=t.$win,this.$body=t.$body,this.editor=t.editor,this.toolbar=t.toolbar,this.inspector=t.inspector,this.$target=this.toolbar.isTarget()?this.toolbar.getTargetElement():this.$body,this._init()},rebuild:function(){this._setResizerPosition()},hide:function(){this.$target.find("#redactor-image-resizer").remove()},stop:function(){this.editor.getElement().off(".redactor.image-resize"),this.$doc.off(".redactor.image-resize"),this.$win.off("resize.redactor.image-resize"),this.hide()},_init:function(){this.editor.getElement().on("click.redactor.image-resize",this._build.bind(this)),this.$win.on("resize.redactor.image-resize",this._setResizerPosition.bind(this))},_build:function(t){if(this.$target.find("#redactor-image-resizer").remove(),!this.app.isReadOnly()){var e=this.inspector.parse(t.target),i=this.editor.getElement();e.isComponentType("image")&&(this.$resizableBox=i,this.$resizableImage=$R.dom(e.getImageElement()),this.$resizer=$R.dom("<span>"),this.$resizer.attr("id","redactor-image-resizer"),this.$target.append(this.$resizer),this._setResizerPosition(),this.$resizer.on("mousedown touchstart",this._set.bind(this)))}},_setResizerPosition:function(){if(this.$resizer){var t=this.toolbar.isTarget(),e=this.$target.offset(),i=t?7-e.top+this.$target.scrollTop():7,s=t?7-e.left:7,n=this.$resizableImage.offset(),r=this.$resizableImage.width(),o=this.$resizableImage.height(),a=this.$resizer.width(),l=this.$resizer.height();this.$resizer.css({top:Math.round(n.top+o-l+i)+"px",left:Math.round(n.left+r-a+s)+"px"})}},_set:function(t){t.preventDefault(),this.resizeHandle={x:t.pageX,y:t.pageY,el:this.$resizableImage,$figure:this.$resizableImage.closest("figure"),ratio:this.$resizableImage.width()/this.$resizableImage.height(),h:this.$resizableImage.height()},(t=t.originalEvent||t).targetTouches&&(this.resizeHandle.x=t.targetTouches[0].pageX,this.resizeHandle.y=t.targetTouches[0].pageY),this.app.broadcast("contextbar.close"),this.app.broadcast("image.resize",this.$resizableImage),this._start()},_start:function(){this.$doc.on("mousemove.redactor.image-resize touchmove.redactor.image-resize",this._move.bind(this)),this.$doc.on("mouseup.redactor.image-resize touchend.redactor.image-resize",this._stop.bind(this))},_stop:function(){this.$doc.off(".redactor.image-resize"),this.app.broadcast("image.resized",this.$resizableImage)},_move:function(t){t.preventDefault(),t=t.originalEvent||t;var e=this.resizeHandle.h;t.targetTouches?e+=t.targetTouches[0].pageY-this.resizeHandle.y:e+=t.pageY-this.resizeHandle.y;var i=e*this.resizeHandle.ratio;i=Math.round(i),(e=Math.round(e))<20||i<100||this._getResizableBoxWidth()<=i||(0!==this.resizeHandle.$figure.length&&""!==this.resizeHandle.$figure.css("max-width")&&this.resizeHandle.$figure.css("max-width",i+"px"),this.resizeHandle.el.attr({width:i,height:e}),this.resizeHandle.el.width(i),this.resizeHandle.el.css("max-width",i+"px"),this.resizeHandle.el.height(e),this._setResizerPosition())},_getResizableBoxWidth:function(){return this.$resizableBox.width()-parseInt(this.$resizableBox.css("padding-left"))-parseInt(this.$resizableBox.css("padding-right"))}}),$R.add("module","file",{modals:{file:'<div class="redactor-modal-tab" data-title="## upload ##"><form action=""> <div class="form-item form-item-title"> <label for="modal-file-title"> ## filename ## <span class="desc">(## optional ##)</span></label> <input type="text" id="modal-file-title" name="title" /> </div> <input type="file" name="file"> </form></div>'},init:function(t){this.app=t,this.opts=t.opts,this.lang=t.lang,this.caret=t.caret,this.utils=t.utils,this.storage=t.storage,this.component=t.component,this.inspector=t.inspector,this.insertion=t.insertion,this.selection=t.selection},onstarted:function(){this.storage.observeFiles()},ondropfile:function(t,e,i){if(this.opts.fileUpload){var s={url:this.opts.fileUpload,event:!i&&t,files:e,name:"filedrop",data:this.opts.fileData};this.app.api("module.upload.send",s)}},onmodal:{file:{open:function(t,e){this._setFormData(t,e),this._setUpload(e)},opened:function(t,e){this._setFormFocus(e),this.$form=e}}},onupload:{file:{complete:function(t){this._insert(t)},error:function(t){this._uploadError(t)}},filedrop:{complete:function(t,e){this._insert(t,e)},error:function(t){this._uploadError(t)}}},open:function(){this._open()},insert:function(t){this._insert(t)},remove:function(t){this._remove(t)},_open:function(){this.app.api("module.modal.build",this._getModalData())},_getModalData:function(){return{name:"file",title:this.lang.get("file")}},_insert:function(t,e){if(this.app.api("module.modal.close"),"object"==typeof t){if(Array.isArray(t)){for(var i={},s=0;s<t.length;s++)i=$R.extend(i,t[s]);t=i}1<Object.keys(t).length?this._insertMultiple(t,e):this._insertSingle(t,e),this.$form=!1}},_insertSingle:function(t,e){var i=[];for(var s in t){var n=this._createFileAndStore(t[s]);i=this.opts.fileAttachment?this._insertAsAttachment(n):e?this.insertion.insertToPoint(e,n):this.insertion.insertRaw(n),this.app.broadcast("file.uploaded",i[0],t)}},_insertMultiple:function(t,e){var i,s=0,n=[];for(var r in t){s++;var o=this._createFileAndStore(t[r]);if(this.opts.fileAttachment)n=this._insertAsAttachment(o,t);else if(1===s)n=e?this.insertion.insertToPoint(e,o):this.insertion.insertRaw(o);else $R.dom(n[0]).after(o).after(" "),n=[o.get()],this.app.broadcast("file.inserted",o);i=o,this.app.broadcast("file.uploaded",n[0],t)}this.opts.fileAttachment||this.caret.setAfter(i)},_insertAsAttachment:function(t,e){var i=$R.dom(this.opts.fileAttachment),s=t.wrapAttachment();i.append(s);var n=[s.get()];return this.app.broadcast("file.appended",n[0],e),n},_createFileAndStore:function(t){var e=!!this.$form&&this.$form.getData(),i=t.name?t.name:t.url,s=!this.opts.fileAttachment&&e&&""!==e.title?e.title:this._truncateUrl(i),n=this.component.create("file");return n.attr("href",t.url),n.attr("data-file",t.id?t.id:this.utils.getRandomId()),n.attr("data-name",t.name),n.html(s),this.storage.add("file",n),n},_remove:function(t){this.selection.save();var e=this.component.create("file",t);!1!==this.app.broadcast("file.delete",e)?(e.unwrap(),this.selection.restore(),this.app.broadcast("file.deleted",e)):this.selection.restore()},_truncateUrl:function(t){return-1!==t.search(/^http/)&&20<t.length?t.substring(0,20)+"...":t},_setUpload:function(t){var e={url:this.opts.fileUpload,element:t.getField("file"),name:"file",data:this.opts.fileData,paramName:this.opts.fileUploadParam};this.app.api("module.upload.build",e)},_setFormData:function(t,e){this.opts.fileAttachment?t.find(".form-item-title").hide():e.setData({title:this.selection.getText()})},_setFormFocus:function(t){t.getField("title").focus()},_uploadError:function(t){this.app.broadcast("file.uploadError",t)}}),$R.add("class","file.component",{mixins:["dom","component"],init:function(t,e){return this.app=t,this.opts=t.opts,e&&void 0!==e.cmnt?e:this._init(e)},wrapAttachment:function(){return this.$wrapper=$R.dom('<span class="redactor-file-item">'),this.$remover=$R.dom('<span class="redactor-file-remover">'),this.$remover.html("×"),this.$remover.on("click",this.removeAttachment.bind(this)),this.$wrapper.append(this),this.$wrapper.append(this.$remover),this.$wrapper},removeAttachment:function(t){t.preventDefault(),!1!==this.app.broadcast("file.delete",this,this.$wrapper)&&(this.$wrapper.remove(),this.app.broadcast("file.deleted",this),this.app.broadcast("file.removeAttachment",this))},_init:function(t){if(void 0===t)this.parse("<a>");else{var e=$R.dom(t).closest("a");this.parse(e)}}}),$R.add("module","buffer",{init:function(t){this.app=t,this.opts=t.opts,this.editor=t.editor,this.offset=t.offset,this.keycodes=t.keycodes,this.selection=t.selection,this.state=!1,this.passed=!1,this.keyPressed=!1,this.undoStorage=[],this.redoStorage=[]},onkeydown:function(t){this._listen(t)},onsyncing:function(){this.keyPressed||this.trigger(),this.keyPressed=!1},onbuffer:{trigger:function(){this.trigger()}},onstate:function(t,e,i){t&&(t.ctrlKey||t.metaKey)||t&&(this._isUndo(t)||this._isRedo(t))||(this.passed=!1,this._saveState(e,i),!1===t&&this._setUndo())},onenable:function(){this.clear()},clear:function(){this.state=!1,this.undoStorage=[],this.redoStorage=[]},undo:function(){this._getUndo()},redo:function(){this._getRedo()},trigger:function(){this.state&&!1===this.passed&&this._setUndo()},_saveState:function(t,e){var i=this.editor.getElement();this.state={html:t||i.html(),offset:e||this.offset.get()}},_listen:function(t){var e=t.which,i=t.ctrlKey||t.metaKey,s=i||t.shiftKey||t.altKey,n=[this.keycodes.SPACE,this.keycodes.ENTER,this.keycodes.BACKSPACE,this.keycodes.DELETE,this.keycodes.TAB,this.keycodes.LEFT,this.keycodes.RIGHT,this.keycodes.UP,this.keycodes.DOWN];return this._isUndo(t)?(t.preventDefault(),void this.undo()):this._isRedo(t)?(t.preventDefault(),void this.redo()):((i||-1===n.indexOf(e))&&(!i||88!==e&&67!==e)||(s=!0,this.trigger()),s||this._hasUndo()||this.trigger(),void(this.keyPressed=!0))},_isUndo:function(t){var e=t.which;return(t.ctrlKey||t.metaKey)&&90===e&&!t.shiftKey&&!t.altKey},_isRedo:function(t){var e=t.which;return(t.ctrlKey||t.metaKey)&&(90===e&&t.shiftKey||89===e&&!t.shiftKey)&&!t.altKey},_setUndo:function(){var t=this.undoStorage[this.undoStorage.length-1];void 0!==t&&t[0]===this.state.html||(this.undoStorage.push([this.state.html,this.state.offset]),this._removeOverStorage())},_setRedo:function(){var t=this.editor.getElement(),e=this.offset.get(),i=t.html();this.redoStorage.push([i,e]),this.redoStorage=this.redoStorage.slice(0,this.opts.bufferLimit)},_getUndo:function(){if(this._hasUndo()){this.passed=!0;var t=this.editor.getElement(),e=this.undoStorage.pop();this._setRedo(),t.html(e[0]),this.offset.set(e[1]),this._saveState(e[0],e[1]),this.selection.restore(),this.app.broadcast("undo",e[0],e[1])}},_getRedo:function(){if(this._hasRedo()){this.passed=!0;var t=this.editor.getElement(),e=this.redoStorage.pop();this._setUndo(),t.html(e[0]),this.offset.set(e[1]),this._saveState(e[0],e[1]),this.app.broadcast("redo",e[0],e[1])}},_removeOverStorage:function(){this.undoStorage.length>this.opts.bufferLimit&&(this.undoStorage=this.undoStorage.slice(0,this.undoStorage.length-this.opts.bufferLimit))},_hasUndo:function(){return 0!==this.undoStorage.length},_hasRedo:function(){return 0!==this.redoStorage.length}}),$R.add("module","list",{init:function(t){this.app=t,this.uuid=t.uuid,this.opts=t.opts,this.utils=t.utils,this.block=t.block,this.toolbar=t.toolbar,this.inspector=t.inspector,this.selection=t.selection},onbutton:{list:{observe:function(t){this._observeButton(t)}}},ondropdown:{list:{observe:function(t){this._observeDropdown(t)}}},toggle:function(t){var e=this._getBlocks(),i=this.selection.getBlock(),s=$R.dom(i).parents("ul, ol",".redactor-in-"+this.uuid).last();return 0===e.length&&0!==s.length&&(e=[s.get()]),!i||"TD"!==i.tagName&&"TH"!==i.tagName||(e=this.block.format("div")),this.selection.saveMarkers(),e=0!==e.length&&this._isUnformat(t,e)?this._unformat(t,e):this._format(t,e),this.selection.restoreMarkers(),e},indent:function(){var t=this.selection.isCollapsed(),e=this.selection.getCurrent(),i=this.inspector.parse(e),s=!!i.isList()&&i.getListItem(),n=$R.dom(s),r=n.prevElement(),o=r.get();if(t&&s&&o&&"LI"===o.tagName){this.selection.saveMarkers();var a=(r=$R.dom(o)).children("ul, ol"),l=n.closest("ul, ol");if(0!==a.length)a.append(n);else{var h=l.get().tagName.toLowerCase(),c=$R.dom("<"+h+">");c.append(n),r.append(c)}this.selection.restoreMarkers()}},outdent:function(){var t=this.selection.isCollapsed(),e=this.selection.getCurrent(),i=this.inspector.parse(e),s=!!i.isList()&&i.getListItem(),n=$R.dom(s);if(t&&s){var r,o,a,l=n.parent(),h=l.closest("li",".redactor-in-"+this.uuid),c=n.prevElement(),d=n.nextElement(),u=c.get(),p=d.get(),f=!1===u,m=!1!==u&&!1!==p,g=!f&&!1===p;if(this.selection.saveMarkers(),0!==h.length)if(m){r=this._getAllNext(n.get()),a=$R.dom("<"+l.get().tagName.toLowerCase()+">");for(var v=0;v<r.length;v++)a.append(r[v]);h.after(n),n.append(a)}else h.after(n),0===l.children().length?l.remove():f&&n.append(l);else{var b=this._createUnformatContainer(n),_=b.find("ul, ol").first();if(f)l.before(b);else if(g)l.after(b);else if(m){a=$R.dom("<"+l.get().tagName.toLowerCase()+">"),r=this._getAllNext(n.get());for(v=0;v<r.length;v++)a.append(r[v]);l.after(b),b.after(a)}0!==_.length&&((o=b.nextElement().get())&&o.tagName===l.get().tagName?($R.dom(o).prepend(_),_.unwrap()):b.after(_)),n.remove()}this.selection.restoreMarkers()}},_getAllNext:function(t){for(var e=[];t;){if(!(t=$R.dom(t).nextElement().get()))return e;e.push(t)}return e},_isUnformat:function(t,e){for(var i=0,s=0;s<e.length;s++)if(3!==e[s].nodeType){var n=e[s].tagName.toLowerCase();n!==t&&"figure"!==n||i++}return i===e.length},_format:function(t,e){var i=this._uniteBlocks(e,["p","div","blockquote","pre","h1","h2","h3","h4","h5","h6","ul","ol"]),s=[];for(var n in i){for(var r=i[n],o=this._createList(t,i[n]),a=0;a<r.length;a++){var l;if(3===r[a].nodeType||"UL"!==r[a].tagName&&"OL"!==r[a].tagName){var h=(l=this._createListItem(r[a])).get().lastChild;h&&"BR"===h.tagName&&$R.dom(h).remove(),this.utils.normalizeTextNodes(l),o.append(l)}else{var c=$R.dom(r[a]);l=c.contents(),o.append(l),this.utils.isEmpty(c)&&c.remove()}}s.push(o.get())}return s},_uniteBlocks:function(t,e){for(var i=0,s={0:[]},n=!1,r=0;r<t.length;r++){var o=$R.dom(t[r]).closest("th, td");0!==o.length?(o.get()!==n&&(s[++i]=[]),this._isUniteBlock(t[r],e)&&s[i].push(t[r])):this._isUniteBlock(t[r],e)?s[i].push(t[r]):s[++i]=[],n=o.get()}return s},_isUniteBlock:function(t,e){return 3===t.nodeType||-1!==e.indexOf(t.tagName.toLowerCase())},_createList:function(t,e){var i=e[e.length-1],s=$R.dom(i),n=$R.dom("<"+t+">");return s.after(n),n},_createListItem:function(t){var e=$R.dom("<li>");if(3===t.nodeType)e.append(t);else{var i=$R.dom(t);e.append(i.contents()),i.remove()}return e},_unformat:function(t,e){if(1===e.length){var i=$R.dom(e[0]),s=i.find("li"),n=this.selection.getNodes({tags:["li"]}),r=this.selection.getBlock(),o=$R.dom(r).closest("li");if(0===n.length&&0!==o.length&&(n=[o.get()]),n.length===s.length)return this._unformatEntire(e[0]);var a=this._getItemsPosition(s,n);if("Top"===a)return this._unformatAtSide("before",n,i);if("Bottom"===a)return n.reverse(),this._unformatAtSide("after",n,i);if("Middle"===a){var l=$R.dom(n[n.length-1]),h=!1,c=!1,d=$R.dom("<"+i.get().tagName.toLowerCase()+">");s.each(function(t){if(h){var e=$R.dom(t);0!==e.closest(".redactor-split-item").length||!1!==c&&0!==e.closest(c).length||e.addClass("redactor-split-item"),c=e}t===l.get()&&(h=!0)}),s.filter(".redactor-split-item").each(function(t){$R.dom(t).removeClass("redactor-split-item"),d.append(t)}),i.after(d),n.reverse();for(var u=0;u<n.length;u++){var p=$R.dom(n[u]),f=this._createUnformatContainer(p);i.after(f),f.find("ul, ol").remove(),p.remove()}return}}else for(u=0;u<e.length;u++)3!==e[u].nodeType&&e[u].tagName.toLowerCase()===t&&this._unformatEntire(e[u])},_unformatEntire:function(t){var s=$R.dom(t);s.find("li").each(function(t){var e=$R.dom(t),i=this._createUnformatContainer(e);e.remove(),s.before(i)}.bind(this)),s.remove()},_unformatAtSide:function(t,s,e){for(var n=0;n<s.length;n++){var i=$R.dom(s[n]),r=this._createUnformatContainer(i);e[t](r);var o=r.find("ul, ol").first();i.append(o),o.each(function(t){var e=$R.dom(t),i=e.closest("li");i.get()===s[n]&&(e.unwrap(),i.addClass("r-unwrapped"))}),this.utils.isEmptyHtml(i.html())&&i.remove()}e.find(".r-unwrapped").each(function(t){var e=$R.dom(t);""===e.html().trim()?e.remove():e.removeClass("r-unwrapped")})},_getItemsPosition:function(t,e){var i="Middle",s=e[0],n=e[e.length-1],r=t.first().get(),o=t.last().get();return r===s&&o!==n?i="Top":r!==s&&o===n&&(i="Bottom"),i},_createUnformatContainer:function(t){var e=$R.dom("<"+this.opts.markup+">");return this.opts.breakline&&e.attr("data-redactor-tag","br"),e.append(t.contents()),e},_getBlocks:function(){return this.selection.getBlocks({first:!0})},_observeButton:function(){var t=this.selection.getCurrent(),e=this.inspector.parse(t),i=e.isPre()||e.isCode()||e.isFigcaption();this._observeButtonsList(i,["lists","ul","ol","outdent","indent"]);var s=this.toolbar.getButton("outdent"),n=this.toolbar.getButton("indent");this._observeIndent(n,s)},_observeDropdown:function(t){var e=t.getItem("outdent"),i=t.getItem("indent");this._observeIndent(i,e)},_observeIndent:function(t,e){var i=this.selection.isCollapsed(),s=this.selection.getCurrent(),n=this.inspector.parse(s),r=!!n.isList()&&n.getListItem(),o=$R.dom(r).prevElement().get(),a=i&&r&&o&&"LI"===o.tagName;e&&(r&&i?e.enable():e.disable()),t&&(r&&a?t.enable():t.disable())},_observeButtonsList:function(t,e){for(var i=0;i<e.length;i++){var s=this.toolbar.getButton(e[i]);s&&(t?s.disable():s.enable())}}}),$R.add("class","video.component",{mixins:["dom","component"],init:function(t,e){return this.app=t,e&&void 0!==e.cmnt?e:this._init(e)},_init:function(t){if(void 0!==t){var e=$R.dom(t).closest("figure");0!==e.length?this.parse(e):(this.parse("<figure>"),this.append(t))}else this.parse("<figure>");this._initWrapper()},_initWrapper:function(){this.addClass("redactor-component"),this.attr({"data-redactor-type":"video",tabindex:"-1",contenteditable:!1})}}),$R.add("class","widget.component",{mixins:["dom","component"],init:function(t,e){return this.app=t,e&&void 0!==e.cmnt?e:this._init(e)},getData:function(){return{html:this._getHtml()}},_init:function(t){if(void 0!==t){var e=$R.dom(t).closest("figure");0!==e.length?this.parse(e):(this.parse("<figure>"),this.html(t))}else this.parse("<figure>");this._initWrapper()},_getHtml:function(){var t=$R.dom("<div>");return t.html(this.html()),t.find(".redactor-component-caret").remove(),t.html()},_initWrapper:function(){this.addClass("redactor-component"),this.attr({"data-redactor-type":"widget",tabindex:"-1",contenteditable:!1})}});var Redactor=$R;window.Redactor=window.$R=$R,window.addEventListener("load",function(){$R("[data-redactor]")}),"object"==typeof module&&module.exports&&(module.exports=Redactor,module.exports.Redactor=Redactor)}();
|
||
|
||
|
||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define("underscore",r):(n=n||self,function(){var t=n._,e=n._=r();e.noConflict=function(){return n._=t,e}}())}(this,(function(){
|
||
// Underscore.js 1.12.0
|
||
// https://underscorejs.org
|
||
// (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||
// Underscore may be freely distributed under the MIT license.
|
||
var n="1.12.0",r="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},t=Array.prototype,e=Object.prototype,u="undefined"!=typeof Symbol?Symbol.prototype:null,o=t.push,i=t.slice,a=e.toString,f=e.hasOwnProperty,c="undefined"!=typeof ArrayBuffer,l="undefined"!=typeof DataView,s=Array.isArray,p=Object.keys,v=Object.create,h=c&&ArrayBuffer.isView,y=isNaN,g=isFinite,d=!{toString:null}.propertyIsEnumerable("toString"),b=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],m=Math.pow(2,53)-1;function j(n,r){return r=null==r?n.length-1:+r,function(){for(var t=Math.max(arguments.length-r,0),e=Array(t),u=0;u<t;u++)e[u]=arguments[u+r];switch(r){case 0:return n.call(this,e);case 1:return n.call(this,arguments[0],e);case 2:return n.call(this,arguments[0],arguments[1],e)}var o=Array(r+1);for(u=0;u<r;u++)o[u]=arguments[u];return o[r]=e,n.apply(this,o)}}function _(n){var r=typeof n;return"function"===r||"object"===r&&!!n}function w(n){return void 0===n}function A(n){return!0===n||!1===n||"[object Boolean]"===a.call(n)}function x(n){var r="[object "+n+"]";return function(n){return a.call(n)===r}}var S=x("String"),O=x("Number"),M=x("Date"),E=x("RegExp"),B=x("Error"),N=x("Symbol"),I=x("ArrayBuffer"),k=x("Function"),T=r.document&&r.document.childNodes;"function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof T&&(k=function(n){return"function"==typeof n||!1});var D=k,R=x("Object"),F=l&&R(new DataView(new ArrayBuffer(8))),V="undefined"!=typeof Map&&R(new Map),P=x("DataView");var q=F?function(n){return null!=n&&D(n.getInt8)&&I(n.buffer)}:P,U=s||x("Array");function W(n,r){return null!=n&&f.call(n,r)}var z=x("Arguments");!function(){z(arguments)||(z=function(n){return W(n,"callee")})}();var L=z;function C(n){return O(n)&&y(n)}function K(n){return function(){return n}}function J(n){return function(r){var t=n(r);return"number"==typeof t&&t>=0&&t<=m}}function $(n){return function(r){return null==r?void 0:r[n]}}var G=$("byteLength"),H=J(G),Q=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;var X=c?function(n){return h?h(n)&&!q(n):H(n)&&Q.test(a.call(n))}:K(!1),Y=$("length");function Z(n,r){r=function(n){for(var r={},t=n.length,e=0;e<t;++e)r[n[e]]=!0;return{contains:function(n){return r[n]},push:function(t){return r[t]=!0,n.push(t)}}}(r);var t=b.length,u=n.constructor,o=D(u)&&u.prototype||e,i="constructor";for(W(n,i)&&!r.contains(i)&&r.push(i);t--;)(i=b[t])in n&&n[i]!==o[i]&&!r.contains(i)&&r.push(i)}function nn(n){if(!_(n))return[];if(p)return p(n);var r=[];for(var t in n)W(n,t)&&r.push(t);return d&&Z(n,r),r}function rn(n,r){var t=nn(r),e=t.length;if(null==n)return!e;for(var u=Object(n),o=0;o<e;o++){var i=t[o];if(r[i]!==u[i]||!(i in u))return!1}return!0}function tn(n){return n instanceof tn?n:this instanceof tn?void(this._wrapped=n):new tn(n)}function en(n){return new Uint8Array(n.buffer||n,n.byteOffset||0,G(n))}tn.VERSION=n,tn.prototype.value=function(){return this._wrapped},tn.prototype.valueOf=tn.prototype.toJSON=tn.prototype.value,tn.prototype.toString=function(){return String(this._wrapped)};var un="[object DataView]";function on(n,r,t,e){if(n===r)return 0!==n||1/n==1/r;if(null==n||null==r)return!1;if(n!=n)return r!=r;var o=typeof n;return("function"===o||"object"===o||"object"==typeof r)&&function n(r,t,e,o){r instanceof tn&&(r=r._wrapped);t instanceof tn&&(t=t._wrapped);var i=a.call(r);if(i!==a.call(t))return!1;if(F&&"[object Object]"==i&&q(r)){if(!q(t))return!1;i=un}switch(i){case"[object RegExp]":case"[object String]":return""+r==""+t;case"[object Number]":return+r!=+r?+t!=+t:0==+r?1/+r==1/t:+r==+t;case"[object Date]":case"[object Boolean]":return+r==+t;case"[object Symbol]":return u.valueOf.call(r)===u.valueOf.call(t);case"[object ArrayBuffer]":case un:return n(en(r),en(t),e,o)}var f="[object Array]"===i;if(!f&&X(r)){if(G(r)!==G(t))return!1;if(r.buffer===t.buffer&&r.byteOffset===t.byteOffset)return!0;f=!0}if(!f){if("object"!=typeof r||"object"!=typeof t)return!1;var c=r.constructor,l=t.constructor;if(c!==l&&!(D(c)&&c instanceof c&&D(l)&&l instanceof l)&&"constructor"in r&&"constructor"in t)return!1}o=o||[];var s=(e=e||[]).length;for(;s--;)if(e[s]===r)return o[s]===t;if(e.push(r),o.push(t),f){if((s=r.length)!==t.length)return!1;for(;s--;)if(!on(r[s],t[s],e,o))return!1}else{var p,v=nn(r);if(s=v.length,nn(t).length!==s)return!1;for(;s--;)if(p=v[s],!W(t,p)||!on(r[p],t[p],e,o))return!1}return e.pop(),o.pop(),!0}(n,r,t,e)}function an(n){if(!_(n))return[];var r=[];for(var t in n)r.push(t);return d&&Z(n,r),r}function fn(n){var r=Y(n);return function(t){if(null==t)return!1;var e=an(t);if(Y(e))return!1;for(var u=0;u<r;u++)if(!D(t[n[u]]))return!1;return n!==hn||!D(t[cn])}}var cn="forEach",ln="has",sn=["clear","delete"],pn=["get",ln,"set"],vn=sn.concat(cn,pn),hn=sn.concat(pn),yn=["add"].concat(sn,cn,ln),gn=V?fn(vn):x("Map"),dn=V?fn(hn):x("WeakMap"),bn=V?fn(yn):x("Set"),mn=x("WeakSet");function jn(n){for(var r=nn(n),t=r.length,e=Array(t),u=0;u<t;u++)e[u]=n[r[u]];return e}function _n(n){for(var r={},t=nn(n),e=0,u=t.length;e<u;e++)r[n[t[e]]]=t[e];return r}function wn(n){var r=[];for(var t in n)D(n[t])&&r.push(t);return r.sort()}function An(n,r){return function(t){var e=arguments.length;if(r&&(t=Object(t)),e<2||null==t)return t;for(var u=1;u<e;u++)for(var o=arguments[u],i=n(o),a=i.length,f=0;f<a;f++){var c=i[f];r&&void 0!==t[c]||(t[c]=o[c])}return t}}var xn=An(an),Sn=An(nn),On=An(an,!0);function Mn(n){if(!_(n))return{};if(v)return v(n);var r=function(){};r.prototype=n;var t=new r;return r.prototype=null,t}function En(n){return _(n)?U(n)?n.slice():xn({},n):n}function Bn(n){return U(n)?n:[n]}function Nn(n){return tn.toPath(n)}function In(n,r){for(var t=r.length,e=0;e<t;e++){if(null==n)return;n=n[r[e]]}return t?n:void 0}function kn(n,r,t){var e=In(n,Nn(r));return w(e)?t:e}function Tn(n){return n}function Dn(n){return n=Sn({},n),function(r){return rn(r,n)}}function Rn(n){return n=Nn(n),function(r){return In(r,n)}}function Fn(n,r,t){if(void 0===r)return n;switch(null==t?3:t){case 1:return function(t){return n.call(r,t)};case 3:return function(t,e,u){return n.call(r,t,e,u)};case 4:return function(t,e,u,o){return n.call(r,t,e,u,o)}}return function(){return n.apply(r,arguments)}}function Vn(n,r,t){return null==n?Tn:D(n)?Fn(n,r,t):_(n)&&!U(n)?Dn(n):Rn(n)}function Pn(n,r){return Vn(n,r,1/0)}function qn(n,r,t){return tn.iteratee!==Pn?tn.iteratee(n,r):Vn(n,r,t)}function Un(){}function Wn(n,r){return null==r&&(r=n,n=0),n+Math.floor(Math.random()*(r-n+1))}tn.toPath=Bn,tn.iteratee=Pn;var zn=Date.now||function(){return(new Date).getTime()};function Ln(n){var r=function(r){return n[r]},t="(?:"+nn(n).join("|")+")",e=RegExp(t),u=RegExp(t,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,r):n}}var Cn={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Kn=Ln(Cn),Jn=Ln(_n(Cn)),$n=tn.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},Gn=/(.)^/,Hn={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Qn=/\\|'|\r|\n|\u2028|\u2029/g;function Xn(n){return"\\"+Hn[n]}var Yn=0;function Zn(n,r,t,e,u){if(!(e instanceof r))return n.apply(t,u);var o=Mn(n.prototype),i=n.apply(o,u);return _(i)?i:o}var nr=j((function(n,r){var t=nr.placeholder,e=function(){for(var u=0,o=r.length,i=Array(o),a=0;a<o;a++)i[a]=r[a]===t?arguments[u++]:r[a];for(;u<arguments.length;)i.push(arguments[u++]);return Zn(n,e,this,this,i)};return e}));nr.placeholder=tn;var rr=j((function(n,r,t){if(!D(n))throw new TypeError("Bind must be called on a function");var e=j((function(u){return Zn(n,e,r,this,t.concat(u))}));return e})),tr=J(Y);function er(n,r,t,e){if(e=e||[],r||0===r){if(r<=0)return e.concat(n)}else r=1/0;for(var u=e.length,o=0,i=Y(n);o<i;o++){var a=n[o];if(tr(a)&&(U(a)||L(a)))if(r>1)er(a,r-1,t,e),u=e.length;else for(var f=0,c=a.length;f<c;)e[u++]=a[f++];else t||(e[u++]=a)}return e}var ur=j((function(n,r){var t=(r=er(r,!1,!1)).length;if(t<1)throw new Error("bindAll must be passed function names");for(;t--;){var e=r[t];n[e]=rr(n[e],n)}return n}));var or=j((function(n,r,t){return setTimeout((function(){return n.apply(null,t)}),r)})),ir=nr(or,tn,1);function ar(n){return function(){return!n.apply(this,arguments)}}function fr(n,r){var t;return function(){return--n>0&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}}var cr=nr(fr,2);function lr(n,r,t){r=qn(r,t);for(var e,u=nn(n),o=0,i=u.length;o<i;o++)if(r(n[e=u[o]],e,n))return e}function sr(n){return function(r,t,e){t=qn(t,e);for(var u=Y(r),o=n>0?0:u-1;o>=0&&o<u;o+=n)if(t(r[o],o,r))return o;return-1}}var pr=sr(1),vr=sr(-1);function hr(n,r,t,e){for(var u=(t=qn(t,e,1))(r),o=0,i=Y(n);o<i;){var a=Math.floor((o+i)/2);t(n[a])<u?o=a+1:i=a}return o}function yr(n,r,t){return function(e,u,o){var a=0,f=Y(e);if("number"==typeof o)n>0?a=o>=0?o:Math.max(o+f,a):f=o>=0?Math.min(o+1,f):o+f+1;else if(t&&o&&f)return e[o=t(e,u)]===u?o:-1;if(u!=u)return(o=r(i.call(e,a,f),C))>=0?o+a:-1;for(o=n>0?a:f-1;o>=0&&o<f;o+=n)if(e[o]===u)return o;return-1}}var gr=yr(1,pr,hr),dr=yr(-1,vr);function br(n,r,t){var e=(tr(n)?pr:lr)(n,r,t);if(void 0!==e&&-1!==e)return n[e]}function mr(n,r,t){var e,u;if(r=Fn(r,t),tr(n))for(e=0,u=n.length;e<u;e++)r(n[e],e,n);else{var o=nn(n);for(e=0,u=o.length;e<u;e++)r(n[o[e]],o[e],n)}return n}function jr(n,r,t){r=qn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=Array(u),i=0;i<u;i++){var a=e?e[i]:i;o[i]=r(n[a],a,n)}return o}function _r(n){var r=function(r,t,e,u){var o=!tr(r)&&nn(r),i=(o||r).length,a=n>0?0:i-1;for(u||(e=r[o?o[a]:a],a+=n);a>=0&&a<i;a+=n){var f=o?o[a]:a;e=t(e,r[f],f,r)}return e};return function(n,t,e,u){var o=arguments.length>=3;return r(n,Fn(t,u,4),e,o)}}var wr=_r(1),Ar=_r(-1);function xr(n,r,t){var e=[];return r=qn(r,t),mr(n,(function(n,t,u){r(n,t,u)&&e.push(n)})),e}function Sr(n,r,t){r=qn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(!r(n[i],i,n))return!1}return!0}function Or(n,r,t){r=qn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(r(n[i],i,n))return!0}return!1}function Mr(n,r,t,e){return tr(n)||(n=jn(n)),("number"!=typeof t||e)&&(t=0),gr(n,r,t)>=0}var Er=j((function(n,r,t){var e,u;return D(r)?u=r:(r=Nn(r),e=r.slice(0,-1),r=r[r.length-1]),jr(n,(function(n){var o=u;if(!o){if(e&&e.length&&(n=In(n,e)),null==n)return;o=n[r]}return null==o?o:o.apply(n,t)}))}));function Br(n,r){return jr(n,Rn(r))}function Nr(n,r,t){var e,u,o=-1/0,i=-1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=tr(n)?n:jn(n)).length;a<f;a++)null!=(e=n[a])&&e>o&&(o=e);else r=qn(r,t),mr(n,(function(n,t,e){((u=r(n,t,e))>i||u===-1/0&&o===-1/0)&&(o=n,i=u)}));return o}function Ir(n,r,t){if(null==r||t)return tr(n)||(n=jn(n)),n[Wn(n.length-1)];var e=tr(n)?En(n):jn(n),u=Y(e);r=Math.max(Math.min(r,u),0);for(var o=u-1,i=0;i<r;i++){var a=Wn(i,o),f=e[i];e[i]=e[a],e[a]=f}return e.slice(0,r)}function kr(n,r){return function(t,e,u){var o=r?[[],[]]:{};return e=qn(e,u),mr(t,(function(r,u){var i=e(r,u,t);n(o,r,i)})),o}}var Tr=kr((function(n,r,t){W(n,t)?n[t].push(r):n[t]=[r]})),Dr=kr((function(n,r,t){n[t]=r})),Rr=kr((function(n,r,t){W(n,t)?n[t]++:n[t]=1})),Fr=kr((function(n,r,t){n[t?0:1].push(r)}),!0),Vr=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function Pr(n,r,t){return r in t}var qr=j((function(n,r){var t={},e=r[0];if(null==n)return t;D(e)?(r.length>1&&(e=Fn(e,r[1])),r=an(n)):(e=Pr,r=er(r,!1,!1),n=Object(n));for(var u=0,o=r.length;u<o;u++){var i=r[u],a=n[i];e(a,i,n)&&(t[i]=a)}return t})),Ur=j((function(n,r){var t,e=r[0];return D(e)?(e=ar(e),r.length>1&&(t=r[1])):(r=jr(er(r,!1,!1),String),e=function(n,t){return!Mr(r,t)}),qr(n,e,t)}));function Wr(n,r,t){return i.call(n,0,Math.max(0,n.length-(null==r||t?1:r)))}function zr(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[0]:Wr(n,n.length-r)}function Lr(n,r,t){return i.call(n,null==r||t?1:r)}var Cr=j((function(n,r){return r=er(r,!0,!0),xr(n,(function(n){return!Mr(r,n)}))})),Kr=j((function(n,r){return Cr(n,r)}));function Jr(n,r,t,e){A(r)||(e=t,t=r,r=!1),null!=t&&(t=qn(t,e));for(var u=[],o=[],i=0,a=Y(n);i<a;i++){var f=n[i],c=t?t(f,i,n):f;r&&!t?(i&&o===c||u.push(f),o=c):t?Mr(o,c)||(o.push(c),u.push(f)):Mr(u,f)||u.push(f)}return u}var $r=j((function(n){return Jr(er(n,!0,!0))}));function Gr(n){for(var r=n&&Nr(n,Y).length||0,t=Array(r),e=0;e<r;e++)t[e]=Br(n,e);return t}var Hr=j(Gr);function Qr(n,r){return n._chain?tn(r).chain():r}function Xr(n){return mr(wn(n),(function(r){var t=tn[r]=n[r];tn.prototype[r]=function(){var n=[this._wrapped];return o.apply(n,arguments),Qr(this,t.apply(tn,n))}})),tn}mr(["pop","push","reverse","shift","sort","splice","unshift"],(function(n){var r=t[n];tn.prototype[n]=function(){var t=this._wrapped;return null!=t&&(r.apply(t,arguments),"shift"!==n&&"splice"!==n||0!==t.length||delete t[0]),Qr(this,t)}})),mr(["concat","join","slice"],(function(n){var r=t[n];tn.prototype[n]=function(){var n=this._wrapped;return null!=n&&(n=r.apply(n,arguments)),Qr(this,n)}}));var Yr=Xr({__proto__:null,VERSION:n,restArguments:j,isObject:_,isNull:function(n){return null===n},isUndefined:w,isBoolean:A,isElement:function(n){return!(!n||1!==n.nodeType)},isString:S,isNumber:O,isDate:M,isRegExp:E,isError:B,isSymbol:N,isArrayBuffer:I,isDataView:q,isArray:U,isFunction:D,isArguments:L,isFinite:function(n){return!N(n)&&g(n)&&!isNaN(parseFloat(n))},isNaN:C,isTypedArray:X,isEmpty:function(n){if(null==n)return!0;var r=Y(n);return"number"==typeof r&&(U(n)||S(n)||L(n))?0===r:0===Y(nn(n))},isMatch:rn,isEqual:function(n,r){return on(n,r)},isMap:gn,isWeakMap:dn,isSet:bn,isWeakSet:mn,keys:nn,allKeys:an,values:jn,pairs:function(n){for(var r=nn(n),t=r.length,e=Array(t),u=0;u<t;u++)e[u]=[r[u],n[r[u]]];return e},invert:_n,functions:wn,methods:wn,extend:xn,extendOwn:Sn,assign:Sn,defaults:On,create:function(n,r){var t=Mn(n);return r&&Sn(t,r),t},clone:En,tap:function(n,r){return r(n),n},get:kn,has:function(n,r){for(var t=(r=Nn(r)).length,e=0;e<t;e++){var u=r[e];if(!W(n,u))return!1;n=n[u]}return!!t},mapObject:function(n,r,t){r=qn(r,t);for(var e=nn(n),u=e.length,o={},i=0;i<u;i++){var a=e[i];o[a]=r(n[a],a,n)}return o},identity:Tn,constant:K,noop:Un,toPath:Bn,property:Rn,propertyOf:function(n){return null==n?Un:function(r){return kn(n,r)}},matcher:Dn,matches:Dn,times:function(n,r,t){var e=Array(Math.max(0,n));r=Fn(r,t,1);for(var u=0;u<n;u++)e[u]=r(u);return e},random:Wn,now:zn,escape:Kn,unescape:Jn,templateSettings:$n,template:function(n,r,t){!r&&t&&(r=t),r=On({},r,tn.templateSettings);var e,u=RegExp([(r.escape||Gn).source,(r.interpolate||Gn).source,(r.evaluate||Gn).source].join("|")+"|$","g"),o=0,i="__p+='";n.replace(u,(function(r,t,e,u,a){return i+=n.slice(o,a).replace(Qn,Xn),o=a+r.length,t?i+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":e?i+="'+\n((__t=("+e+"))==null?'':__t)+\n'":u&&(i+="';\n"+u+"\n__p+='"),r})),i+="';\n",r.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{e=new Function(r.variable||"obj","_",i)}catch(n){throw n.source=i,n}var a=function(n){return e.call(this,n,tn)},f=r.variable||"obj";return a.source="function("+f+"){\n"+i+"}",a},result:function(n,r,t){var e=(r=Nn(r)).length;if(!e)return D(t)?t.call(n):t;for(var u=0;u<e;u++){var o=null==n?void 0:n[r[u]];void 0===o&&(o=t,u=e),n=D(o)?o.call(n):o}return n},uniqueId:function(n){var r=++Yn+"";return n?n+r:r},chain:function(n){var r=tn(n);return r._chain=!0,r},iteratee:Pn,partial:nr,bind:rr,bindAll:ur,memoize:function(n,r){var t=function(e){var u=t.cache,o=""+(r?r.apply(this,arguments):e);return W(u,o)||(u[o]=n.apply(this,arguments)),u[o]};return t.cache={},t},delay:or,defer:ir,throttle:function(n,r,t){var e,u,o,i,a=0;t||(t={});var f=function(){a=!1===t.leading?0:zn(),e=null,i=n.apply(u,o),e||(u=o=null)},c=function(){var c=zn();a||!1!==t.leading||(a=c);var l=r-(c-a);return u=this,o=arguments,l<=0||l>r?(e&&(clearTimeout(e),e=null),a=c,i=n.apply(u,o),e||(u=o=null)):e||!1===t.trailing||(e=setTimeout(f,l)),i};return c.cancel=function(){clearTimeout(e),a=0,e=u=o=null},c},debounce:function(n,r,t){var e,u,o=function(r,t){e=null,t&&(u=n.apply(r,t))},i=j((function(i){if(e&&clearTimeout(e),t){var a=!e;e=setTimeout(o,r),a&&(u=n.apply(this,i))}else e=or(o,r,this,i);return u}));return i.cancel=function(){clearTimeout(e),e=null},i},wrap:function(n,r){return nr(r,n)},negate:ar,compose:function(){var n=arguments,r=n.length-1;return function(){for(var t=r,e=n[r].apply(this,arguments);t--;)e=n[t].call(this,e);return e}},after:function(n,r){return function(){if(--n<1)return r.apply(this,arguments)}},before:fr,once:cr,findKey:lr,findIndex:pr,findLastIndex:vr,sortedIndex:hr,indexOf:gr,lastIndexOf:dr,find:br,detect:br,findWhere:function(n,r){return br(n,Dn(r))},each:mr,forEach:mr,map:jr,collect:jr,reduce:wr,foldl:wr,inject:wr,reduceRight:Ar,foldr:Ar,filter:xr,select:xr,reject:function(n,r,t){return xr(n,ar(qn(r)),t)},every:Sr,all:Sr,some:Or,any:Or,contains:Mr,includes:Mr,include:Mr,invoke:Er,pluck:Br,where:function(n,r){return xr(n,Dn(r))},max:Nr,min:function(n,r,t){var e,u,o=1/0,i=1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=tr(n)?n:jn(n)).length;a<f;a++)null!=(e=n[a])&&e<o&&(o=e);else r=qn(r,t),mr(n,(function(n,t,e){((u=r(n,t,e))<i||u===1/0&&o===1/0)&&(o=n,i=u)}));return o},shuffle:function(n){return Ir(n,1/0)},sample:Ir,sortBy:function(n,r,t){var e=0;return r=qn(r,t),Br(jr(n,(function(n,t,u){return{value:n,index:e++,criteria:r(n,t,u)}})).sort((function(n,r){var t=n.criteria,e=r.criteria;if(t!==e){if(t>e||void 0===t)return 1;if(t<e||void 0===e)return-1}return n.index-r.index})),"value")},groupBy:Tr,indexBy:Dr,countBy:Rr,partition:Fr,toArray:function(n){return n?U(n)?i.call(n):S(n)?n.match(Vr):tr(n)?jr(n,Tn):jn(n):[]},size:function(n){return null==n?0:tr(n)?n.length:nn(n).length},pick:qr,omit:Ur,first:zr,head:zr,take:zr,initial:Wr,last:function(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[n.length-1]:Lr(n,Math.max(0,n.length-r))},rest:Lr,tail:Lr,drop:Lr,compact:function(n){return xr(n,Boolean)},flatten:function(n,r){return er(n,r,!1)},without:Kr,uniq:Jr,unique:Jr,union:$r,intersection:function(n){for(var r=[],t=arguments.length,e=0,u=Y(n);e<u;e++){var o=n[e];if(!Mr(r,o)){var i;for(i=1;i<t&&Mr(arguments[i],o);i++);i===t&&r.push(o)}}return r},difference:Cr,unzip:Gr,transpose:Gr,zip:Hr,object:function(n,r){for(var t={},e=0,u=Y(n);e<u;e++)r?t[n[e]]=r[e]:t[n[e][0]]=n[e][1];return t},range:function(n,r,t){null==r&&(r=n||0,n=0),t||(t=r<n?-1:1);for(var e=Math.max(Math.ceil((r-n)/t),0),u=Array(e),o=0;o<e;o++,n+=t)u[o]=n;return u},chunk:function(n,r){if(null==r||r<1)return[];for(var t=[],e=0,u=n.length;e<u;)t.push(i.call(n,e,e+=r));return t},mixin:Xr,default:tn});return Yr._=Yr,Yr}));
|
||
|
||
|
||
/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
||
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(u){var e=function(){if(u&&u.fn&&u.fn.select2&&u.fn.select2.amd)var e=u.fn.select2.amd;var t,n,r,h,o,s,f,g,m,v,y,_,i,a,b;function w(e,t){return i.call(e,t)}function l(e,t){var n,r,i,o,s,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(s=(e=e.split("/")).length-1,y.nodeIdCompat&&b.test(e[s])&&(e[s]=e[s].replace(b,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u<e.length;u++)if("."===(p=e[u]))e.splice(u,1),u-=1;else if(".."===p){if(0===u||1===u&&".."===e[2]||".."===e[u-1])continue;0<u&&(e.splice(u-1,2),u-=2)}e=e.join("/")}if((h||g)&&f){for(u=(n=e.split("/")).length;0<u;u-=1){if(r=n.slice(0,u).join("/"),h)for(d=h.length;0<d;d-=1)if(i=(i=f[h.slice(0,d).join("/")])&&i[r]){o=i,a=u;break}if(o)break;!l&&g&&g[r]&&(l=g[r],c=u)}!o&&l&&(o=l,a=c),o&&(n.splice(0,a,o),e=n.join("/"))}return e}function A(t,n){return function(){var e=a.call(arguments,0);return"string"!=typeof e[0]&&1===e.length&&e.push(null),s.apply(h,e.concat([t,n]))}}function x(t){return function(e){m[t]=e}}function D(e){if(w(v,e)){var t=v[e];delete v[e],_[e]=!0,o.apply(h,t)}if(!w(m,e)&&!w(_,e))throw new Error("No "+e);return m[e]}function c(e){var t,n=e?e.indexOf("!"):-1;return-1<n&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function S(e){return e?c(e):[]}return e&&e.requirejs||(e?n=e:e={},m={},v={},y={},_={},i=Object.prototype.hasOwnProperty,a=[].slice,b=/\.js$/,f=function(e,t){var n,r=c(e),i=r[0],o=t[1];return e=r[1],i&&(n=D(i=l(i,o))),i?e=n&&n.normalize?n.normalize(e,function(t){return function(e){return l(e,t)}}(o)):l(e,o):(i=(r=c(e=l(e,o)))[0],e=r[1],i&&(n=D(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},g={require:function(e){return A(e)},exports:function(e){var t=m[e];return void 0!==t?t:m[e]={}},module:function(e){return{id:e,uri:"",exports:m[e],config:function(e){return function(){return y&&y.config&&y.config[e]||{}}}(e)}}},o=function(e,t,n,r){var i,o,s,a,l,c,u,d=[],p=typeof n;if(c=S(r=r||e),"undefined"==p||"function"==p){for(t=!t.length&&n.length?["require","exports","module"]:t,l=0;l<t.length;l+=1)if("require"===(o=(a=f(t[l],c)).f))d[l]=g.require(e);else if("exports"===o)d[l]=g.exports(e),u=!0;else if("module"===o)i=d[l]=g.module(e);else if(w(m,o)||w(v,o)||w(_,o))d[l]=D(o);else{if(!a.p)throw new Error(e+" missing "+o);a.p.load(a.n,A(r,!0),x(o),{}),d[l]=m[o]}s=n?n.apply(m[e],d):void 0,e&&(i&&i.exports!==h&&i.exports!==m[e]?m[e]=i.exports:s===h&&u||(m[e]=s))}else e&&(m[e]=n)},t=n=s=function(e,t,n,r,i){if("string"==typeof e)return g[e]?g[e](t):D(f(e,S(t)).f);if(!e.splice){if((y=e).deps&&s(y.deps,y.callback),!t)return;t.splice?(e=t,t=n,n=null):e=h}return t=t||function(){},"function"==typeof n&&(n=r,r=i),r?o(h,e,t,n):setTimeout(function(){o(h,e,t,n)},4),s},s.config=function(e){return s(e)},t._defined=m,(r=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),w(m,e)||w(v,e)||(v[e]=[e,t,n])}).amd={jQuery:!0},e.requirejs=t,e.require=n,e.define=r),e.define("almond",function(){}),e.define("jquery",[],function(){var e=u||$;return null==e&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),e}),e.define("select2/utils",["jquery"],function(o){var i={};function u(e){var t=e.prototype,n=[];for(var r in t){"function"==typeof t[r]&&"constructor"!==r&&n.push(r)}return n}i.Extend=function(e,t){var n={}.hasOwnProperty;function r(){this.constructor=e}for(var i in t)n.call(t,i)&&(e[i]=t[i]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},i.Decorate=function(r,i){var e=u(i),t=u(r);function o(){var e=Array.prototype.unshift,t=i.prototype.constructor.length,n=r.prototype.constructor;0<t&&(e.call(arguments,r.prototype.constructor),n=i.prototype.constructor),n.apply(this,arguments)}i.displayName=r.displayName,o.prototype=new function(){this.constructor=o};for(var n=0;n<t.length;n++){var s=t[n];o.prototype[s]=r.prototype[s]}function a(e){var t=function(){};e in o.prototype&&(t=o.prototype[e]);var n=i.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),n.apply(this,arguments)}}for(var l=0;l<e.length;l++){var c=e[l];o.prototype[c]=a(c)}return o};function e(){this.listeners={}}e.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},e.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),(n[0]._type=e)in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},e.prototype.invoke=function(e,t){for(var n=0,r=e.length;n<r;n++)e[n].apply(this,t)},i.Observable=e,i.generateChars=function(e){for(var t="",n=0;n<e;n++){t+=Math.floor(36*Math.random()).toString(36)}return t},i.bind=function(e,t){return function(){e.apply(t,arguments)}},i._convertData=function(e){for(var t in e){var n=t.split("-"),r=e;if(1!==n.length){for(var i=0;i<n.length;i++){var o=n[i];(o=o.substring(0,1).toLowerCase()+o.substring(1))in r||(r[o]={}),i==n.length-1&&(r[o]=e[t]),r=r[o]}delete e[t]}}return e},i.hasScroll=function(e,t){var n=o(t),r=t.style.overflowX,i=t.style.overflowY;return(r!==i||"hidden"!==i&&"visible"!==i)&&("scroll"===r||"scroll"===i||(n.innerHeight()<t.scrollHeight||n.innerWidth()<t.scrollWidth))},i.escapeMarkup=function(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},i.appendMany=function(e,t){if("1.7"===o.fn.jquery.substr(0,3)){var n=o();o.map(t,function(e){n=n.add(e)}),t=n}e.append(t)},i.__cache={};var n=0;return i.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null==t&&(e.id?(t=e.id,e.setAttribute("data-select2-id",t)):(e.setAttribute("data-select2-id",++n),t=n.toString())),t},i.StoreData=function(e,t,n){var r=i.GetUniqueElementId(e);i.__cache[r]||(i.__cache[r]={}),i.__cache[r][t]=n},i.GetData=function(e,t){var n=i.GetUniqueElementId(e);return t?i.__cache[n]&&null!=i.__cache[n][t]?i.__cache[n][t]:o(e).data(t):i.__cache[n]},i.RemoveData=function(e){var t=i.GetUniqueElementId(e);null!=i.__cache[t]&&delete i.__cache[t],e.removeAttribute("data-select2-id")},i}),e.define("select2/results",["jquery","./utils"],function(h,f){function r(e,t,n){this.$element=e,this.data=n,this.options=t,r.__super__.constructor.call(this)}return f.Extend(r,f.Observable),r.prototype.render=function(){var e=h('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},r.prototype.clear=function(){this.$results.empty()},r.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),r=this.options.get("translations").get(e.message);n.append(t(r(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},r.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},r.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var r=e.results[n],i=this.option(r);t.push(i)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},r.prototype.position=function(e,t){t.find(".select2-results").append(e)},r.prototype.sort=function(e){return this.options.get("sorter")(e)},r.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option[aria-selected]"),t=e.filter("[aria-selected=true]");0<t.length?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},r.prototype.setClasses=function(){var t=this;this.data.current(function(e){var r=h.map(e,function(e){return e.id.toString()});t.$results.find(".select2-results__option[aria-selected]").each(function(){var e=h(this),t=f.GetData(this,"data"),n=""+t.id;null!=t.element&&t.element.selected||null==t.element&&-1<h.inArray(n,r)?e.attr("aria-selected","true"):e.attr("aria-selected","false")})})},r.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},n=this.option(t);n.className+=" loading-results",this.$results.prepend(n)},r.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},r.prototype.option=function(e){var t=document.createElement("li");t.className="select2-results__option";var n={role:"option","aria-selected":"false"},r=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var i in(null!=e.element&&r.call(e.element,":disabled")||null==e.element&&e.disabled)&&(delete n["aria-selected"],n["aria-disabled"]="true"),null==e.id&&delete n["aria-selected"],null!=e._resultId&&(t.id=e._resultId),e.title&&(t.title=e.title),e.children&&(n.role="group",n["aria-label"]=e.text,delete n["aria-selected"]),n){var o=n[i];t.setAttribute(i,o)}if(e.children){var s=h(t),a=document.createElement("strong");a.className="select2-results__group";h(a);this.template(e,a);for(var l=[],c=0;c<e.children.length;c++){var u=e.children[c],d=this.option(u);l.push(d)}var p=h("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});p.append(l),s.append(a),s.append(p)}else this.template(e,t);return f.StoreData(t,"data",e),t},r.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=f.GetData(e[0],"data");"true"==e.attr("aria-selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e);if(!(n<=0)){var r=n-1;0===e.length&&(r=0);var i=t.eq(r);i.trigger("mouseenter");var o=l.$results.offset().top,s=i.offset().top,a=l.$results.scrollTop()+(s-o);0===r?l.$results.scrollTop(0):s-o<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find("[aria-selected]"),n=t.index(e)+1;if(!(n>=t.length)){var r=t.eq(n);r.trigger("mouseenter");var i=l.$results.offset().top+l.$results.outerHeight(!1),o=r.offset().top+r.outerHeight(!1),s=l.$results.scrollTop()+o-i;0===n?l.$results.scrollTop(0):i<o&&l.$results.scrollTop(s)}}),t.on("results:focus",function(e){e.element.addClass("select2-results__option--highlighted")}),t.on("results:message",function(e){l.displayMessage(e)}),h.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=l.$results.scrollTop(),n=l.$results.get(0).scrollHeight-t+e.deltaY,r=0<e.deltaY&&t-e.deltaY<=0,i=e.deltaY<0&&n<=l.$results.height();r?(l.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):i&&(l.$results.scrollTop(l.$results.get(0).scrollHeight-l.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(e){var t=h(this),n=f.GetData(this,"data");"true"!==t.attr("aria-selected")?l.trigger("select",{originalEvent:e,data:n}):l.options.get("multiple")?l.trigger("unselect",{originalEvent:e,data:n}):l.trigger("close",{})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(e){var t=f.GetData(this,"data");l.getHighlightedResults().removeClass("select2-results__option--highlighted"),l.trigger("results:focus",{data:t,element:h(this)})})},r.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},r.prototype.destroy=function(){this.$results.remove()},r.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find("[aria-selected]").index(e),n=this.$results.offset().top,r=e.offset().top,i=this.$results.scrollTop()+(r-n),o=r-n;i-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(o>this.$results.outerHeight()||o<0)&&this.$results.scrollTop(i)}},r.prototype.template=function(e,t){var n=this.options.get("templateResult"),r=this.options.get("escapeMarkup"),i=n(e,t);null==i?t.style.display="none":"string"==typeof i?t.innerHTML=r(i):h(t).append(i)},r}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(n,r,i){function o(e,t){this.$element=e,this.options=t,o.__super__.constructor.call(this)}return r.Extend(o,r.Observable),o.prototype.render=function(){var e=n('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=r.GetData(this.$element[0],"old-tabindex")?this._tabindex=r.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},o.prototype.bind=function(e,t){var n=this,r=e.id+"-results";this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===i.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",r),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},o.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||n.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},o.prototype._attachCloseHandler=function(e){n(document.body).on("mousedown.select2."+e.id,function(e){var t=n(e.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=t[0]&&r.GetData(this,"element").select2("close")})})},o.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},o.prototype.position=function(e,t){t.find(".selection").append(e)},o.prototype.destroy=function(){this._detachCloseHandler(this.container)},o.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},o.prototype.isEnabled=function(){return!this.isDisabled()},o.prototype.isDisabled=function(){return this.options.get("disabled")},o}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,r){function i(){i.__super__.constructor.apply(this,arguments)}return n.Extend(i,t),i.prototype.render=function(){var e=i.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},i.prototype.bind=function(t,e){var n=this;i.__super__.bind.apply(this,arguments);var r=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",r).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",r),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},i.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},i.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},i.prototype.selectionContainer=function(){return e("<span></span>")},i.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),r=this.display(t,n);n.empty().append(r);var i=t.title||t.text;i?n.attr("title",i):n.removeAttr("title")}else this.clear()},i}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,l){function n(e,t){n.__super__.constructor.apply(this,arguments)}return l.Extend(n,e),n.prototype.render=function(){var e=n.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},n.prototype.bind=function(e,t){var r=this;n.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){r.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!r.isDisabled()){var t=i(this).parent(),n=l.GetData(t[0],"data");r.trigger("unselect",{originalEvent:e,data:n})}})},n.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},n.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},n.prototype.selectionContainer=function(){return i('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>')},n.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=this.selectionContainer(),o=this.display(r,i);i.append(o);var s=r.title||r.text;s&&i.attr("title",s),l.StoreData(i[0],"data",r),t.push(i)}var a=this.$selection.find(".select2-selection__rendered");l.appendMany(a,t)}},n}),e.define("select2/selection/placeholder",["../utils"],function(e){function t(e,t,n){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n)}return t.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},t.prototype.createPlaceholder=function(e,t){var n=this.selectionContainer();return n.html(this.display(t)),n.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),n},t.prototype.update=function(e,t){var n=1==t.length&&t[0].id!=this.placeholder.id;if(1<t.length||n)return e.call(this,t);this.clear();var r=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(r)},t}),e.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(i,r,a){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(e){r._handleClear(e)}),t.on("keypress",function(e){r._handleKeyboardClear(e,t)})},e.prototype._handleClear=function(e,t){if(!this.isDisabled()){var n=this.$selection.find(".select2-selection__clear");if(0!==n.length){t.stopPropagation();var r=a.GetData(n[0],"data"),i=this.$element.val();this.$element.val(this.placeholder.id);var o={data:r};if(this.trigger("clear",o),o.prevented)this.$element.val(i);else{for(var s=0;s<r.length;s++)if(o={data:r[s]},this.trigger("unselect",o),o.prevented)return void this.$element.val(i);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},e.prototype._handleKeyboardClear=function(e,t,n){n.isOpen()||t.which!=r.DELETE&&t.which!=r.BACKSPACE||this._handleClear(t)},e.prototype.update=function(e,t){if(e.call(this,t),!(0<this.$selection.find(".select2-selection__placeholder").length||0===t.length)){var n=this.options.get("translations").get("removeAllItems"),r=i('<span class="select2-selection__clear" title="'+n()+'">×</span>');a.StoreData(r[0],"data",t),this.$selection.find(".select2-selection__rendered").prepend(r)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(r,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=r('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></li>');this.$searchContainer=t,this.$search=t.find("input");var n=e.call(this);return this._transferTabIndex(),n},e.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),t.on("open",function(){r.$search.attr("aria-controls",i),r.$search.trigger("focus")}),t.on("close",function(){r.$search.val(""),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.trigger("focus")}),t.on("enable",function(){r.$search.prop("disabled",!1),r._transferTabIndex()}),t.on("disable",function(){r.$search.prop("disabled",!0)}),t.on("focus",function(e){r.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){r.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){r._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===r.$search.val()){var t=r.$searchContainer.prev(".select2-selection__choice");if(0<t.length){var n=a.GetData(t[0],"data");r.searchRemoveChoice(n),e.preventDefault()}}}),this.$selection.on("click",".select2-search--inline",function(e){r.$search.val()&&e.stopPropagation()});var o=document.documentMode,s=o&&o<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){s?r.$selection.off("input.search input.searchcheck"):r.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){if(s&&"input"===e.type)r.$selection.off("input.search input.searchcheck");else{var t=e.which;t!=l.SHIFT&&t!=l.CTRL&&t!=l.ALT&&t!=l.TAB&&r.handleSearch(e)}})},e.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},e.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},e.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),n&&this.$search.trigger("focus")},e.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},e.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="";""!==this.$search.attr("placeholder")?e=this.$selection.find(".select2-selection__rendered").width():e=.75*(this.$search.val().length+1)+"em";this.$search.css("width",e)},e}),e.define("select2/selection/eventRelay",["jquery"],function(s){function e(){}return e.prototype.bind=function(e,t,n){var r=this,i=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],o=["opening","closing","selecting","unselecting","clearing"];e.call(this,t,n),t.on("*",function(e,t){if(-1!==s.inArray(e,i)){t=t||{};var n=s.Event("select2:"+e,{params:t});r.$element.trigger(n),-1!==s.inArray(e,o)&&(t.prevented=n.isDefaultPrevented())}})},e}),e.define("select2/translation",["jquery","require"],function(t,n){function r(e){this.dict=e||{}}return r.prototype.all=function(){return this.dict},r.prototype.get=function(e){return this.dict[e]},r.prototype.extend=function(e){this.dict=t.extend({},e.all(),this.dict)},r._cache={},r.loadPath=function(e){if(!(e in r._cache)){var t=n(e);r._cache[e]=t}return new r(r._cache[e])},r}),e.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Œ":"OE","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","œ":"oe","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}}),e.define("select2/data/base",["../utils"],function(r){function n(e,t){n.__super__.constructor.call(this)}return r.Extend(n,r.Observable),n.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},n.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},n.prototype.bind=function(e,t){},n.prototype.destroy=function(){},n.prototype.generateResultId=function(e,t){var n=e.id+"-result-";return n+=r.generateChars(4),null!=t.id?n+="-"+t.id.toString():n+="-"+r.generateChars(4),n},n}),e.define("select2/data/select",["./base","../utils","jquery"],function(e,a,l){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return a.Extend(n,e),n.prototype.current=function(e){var n=[],r=this;this.$element.find(":selected").each(function(){var e=l(this),t=r.item(e);n.push(t)}),e(n)},n.prototype.select=function(i){var o=this;if(i.selected=!0,l(i.element).is("option"))return i.element.selected=!0,void this.$element.trigger("input").trigger("change");if(this.$element.prop("multiple"))this.current(function(e){var t=[];(i=[i]).push.apply(i,e);for(var n=0;n<i.length;n++){var r=i[n].id;-1===l.inArray(r,t)&&t.push(r)}o.$element.val(t),o.$element.trigger("input").trigger("change")});else{var e=i.id;this.$element.val(e),this.$element.trigger("input").trigger("change")}},n.prototype.unselect=function(i){var o=this;if(this.$element.prop("multiple")){if(i.selected=!1,l(i.element).is("option"))return i.element.selected=!1,void this.$element.trigger("input").trigger("change");this.current(function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n].id;r!==i.id&&-1===l.inArray(r,t)&&t.push(r)}o.$element.val(t),o.$element.trigger("input").trigger("change")})}},n.prototype.bind=function(e,t){var n=this;(this.container=e).on("select",function(e){n.select(e.data)}),e.on("unselect",function(e){n.unselect(e.data)})},n.prototype.destroy=function(){this.$element.find("*").each(function(){a.RemoveData(this)})},n.prototype.query=function(r,e){var i=[],o=this;this.$element.children().each(function(){var e=l(this);if(e.is("option")||e.is("optgroup")){var t=o.item(e),n=o.matches(r,t);null!==n&&i.push(n)}}),e({results:i})},n.prototype.addOptions=function(e){a.appendMany(this.$element,e)},n.prototype.option=function(e){var t;e.children?(t=document.createElement("optgroup")).label=e.text:void 0!==(t=document.createElement("option")).textContent?t.textContent=e.text:t.innerText=e.text,void 0!==e.id&&(t.value=e.id),e.disabled&&(t.disabled=!0),e.selected&&(t.selected=!0),e.title&&(t.title=e.title);var n=l(t),r=this._normalizeItem(e);return r.element=t,a.StoreData(t,"data",r),n},n.prototype.item=function(e){var t={};if(null!=(t=a.GetData(e[0],"data")))return t;if(e.is("option"))t={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if(e.is("optgroup")){t={text:e.prop("label"),children:[],title:e.prop("title")};for(var n=e.children("option"),r=[],i=0;i<n.length;i++){var o=l(n[i]),s=this.item(o);r.push(s)}t.children=r}return(t=this._normalizeItem(t)).element=e[0],a.StoreData(e[0],"data",t),t},n.prototype._normalizeItem=function(e){e!==Object(e)&&(e={id:e,text:e});return null!=(e=l.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),l.extend({},{selected:!1,disabled:!1},e)},n.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},n}),e.define("select2/data/array",["./select","../utils","jquery"],function(e,f,g){function r(e,t){this._dataToConvert=t.get("data")||[],r.__super__.constructor.call(this,e,t)}return f.Extend(r,e),r.prototype.bind=function(e,t){r.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},r.prototype.select=function(n){var e=this.$element.find("option").filter(function(e,t){return t.value==n.id.toString()});0===e.length&&(e=this.option(n),this.addOptions(e)),r.__super__.select.call(this,n)},r.prototype.convertToOptions=function(e){var t=this,n=this.$element.find("option"),r=n.map(function(){return t.item(g(this)).id}).get(),i=[];function o(e){return function(){return g(this).val()==e.id}}for(var s=0;s<e.length;s++){var a=this._normalizeItem(e[s]);if(0<=g.inArray(a.id,r)){var l=n.filter(o(a)),c=this.item(l),u=g.extend(!0,{},a,c),d=this.option(u);l.replaceWith(d)}else{var p=this.option(a);if(a.children){var h=this.convertToOptions(a.children);f.appendMany(p,h)}i.push(p)}}return i},r}),e.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,o){function n(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype._applyDefaults=function(e){var t={data:function(e){return o.extend({},e,{q:e.term})},transport:function(e,t,n){var r=o.ajax(e);return r.then(t),r.fail(n),r}};return o.extend({},t,e,!0)},n.prototype.processResults=function(e){return e},n.prototype.query=function(n,r){var i=this;null!=this._request&&(o.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var t=o.extend({type:"GET"},this.ajaxOptions);function e(){var e=t.transport(t,function(e){var t=i.processResults(e,n);i.options.get("debug")&&window.console&&console.error&&(t&&t.results&&o.isArray(t.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),r(t)},function(){"status"in e&&(0===e.status||"0"===e.status)||i.trigger("results:message",{message:"errorLoading"})});i._request=e}"function"==typeof t.url&&(t.url=t.url.call(this.$element,n)),"function"==typeof t.data&&(t.data=t.data.call(this.$element,n)),this.ajaxOptions.delay&&null!=n.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(e,this.ajaxOptions.delay)):e()},n}),e.define("select2/data/tags",["jquery"],function(u){function e(e,t,n){var r=n.get("tags"),i=n.get("createTag");void 0!==i&&(this.createTag=i);var o=n.get("insertTag");if(void 0!==o&&(this.insertTag=o),e.call(this,t,n),u.isArray(r))for(var s=0;s<r.length;s++){var a=r[s],l=this._normalizeItem(a),c=this.option(l);this.$element.append(c)}}return e.prototype.query=function(e,c,u){var d=this;this._removeOldTags(),null!=c.term&&null==c.page?e.call(this,c,function e(t,n){for(var r=t.results,i=0;i<r.length;i++){var o=r[i],s=null!=o.children&&!e({results:o.children},!0);if((o.text||"").toUpperCase()===(c.term||"").toUpperCase()||s)return!n&&(t.data=r,void u(t))}if(n)return!0;var a=d.createTag(c);if(null!=a){var l=d.option(a);l.attr("data-select2-tag",!0),d.addOptions([l]),d.insertTag(r,a)}t.results=r,u(t)}):e.call(this,c,u)},e.prototype.createTag=function(e,t){var n=u.trim(t.term);return""===n?null:{id:n,text:n}},e.prototype.insertTag=function(e,t,n){t.unshift(n)},e.prototype._removeOldTags=function(e){this.$element.find("option[data-select2-tag]").each(function(){this.selected||u(this).remove()})},e}),e.define("select2/data/tokenizer",["jquery"],function(d){function e(e,t,n){var r=n.get("tokenizer");void 0!==r&&(this.tokenizer=r),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){e.call(this,t,n),this.$search=t.dropdown.$search||t.selection.$search||n.find(".select2-search__field")},e.prototype.query=function(e,t,n){var r=this;t.term=t.term||"";var i=this.tokenizer(t,this.options,function(e){var t=r._normalizeItem(e);if(!r.$element.find("option").filter(function(){return d(this).val()===t.id}).length){var n=r.option(t);n.attr("data-select2-tag",!0),r._removeOldTags(),r.addOptions([n])}!function(e){r.trigger("select",{data:e})}(t)});i.term!==t.term&&(this.$search.length&&(this.$search.val(i.term),this.$search.trigger("focus")),t.term=i.term),e.call(this,t,n)},e.prototype.tokenizer=function(e,t,n,r){for(var i=n.get("tokenSeparators")||[],o=t.term,s=0,a=this.createTag||function(e){return{id:e.term,text:e.term}};s<o.length;){var l=o[s];if(-1!==d.inArray(l,i)){var c=o.substr(0,s),u=a(d.extend({},t,{term:c}));null!=u?(r(u),o=o.substr(s+1)||"",s=0):s++}else s++}return{term:o}},e}),e.define("select2/data/minimumInputLength",[],function(){function e(e,t,n){this.minimumInputLength=n.get("minimumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumInputLength",[],function(){function e(e,t,n){this.maximumInputLength=n.get("maximumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",0<this.maximumInputLength&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(){r._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var r=this;this._checkIfMaximumSelected(function(){e.call(r,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var r=this;this.current(function(e){var t=null!=e?e.length:0;0<r.maximumSelectionLength&&t>=r.maximumSelectionLength?r.trigger("results:message",{message:"maximumSelected",args:{maximum:r.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('<span class="select2-dropdown"><span class="select2-results"></span></span>');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery","../utils"],function(o,e){function t(){}return t.prototype.render=function(e){var t=e.call(this),n=o('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></span>');return this.$searchContainer=n,this.$search=n.find("input"),t.prepend(n),t},t.prototype.bind=function(e,t,n){var r=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){r.trigger("keypress",e),r._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){r.handleSearch(e)}),t.on("open",function(){r.$search.attr("tabindex",0),r.$search.attr("aria-controls",i),r.$search.trigger("focus"),window.setTimeout(function(){r.$search.trigger("focus")},0)}),t.on("close",function(){r.$search.attr("tabindex",-1),r.$search.removeAttr("aria-controls"),r.$search.removeAttr("aria-activedescendant"),r.$search.val(""),r.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||r.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(r.showSearch(e)?r.$searchContainer.removeClass("select2-search--hide"):r.$searchContainer.addClass("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?r.$search.attr("aria-activedescendant",e.data._resultId):r.$search.removeAttr("aria-activedescendant")})},t.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},t.prototype.showSearch=function(e,t){return!0},t}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,r){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,r)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),r=t.length-1;0<=r;r--){var i=t[r];this.placeholder.id===i.id&&n.splice(r,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,r){this.lastParams={},e.call(this,t,n,r),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("query",function(e){r.lastParams=e,r.loading=!0}),t.on("query:append",function(e){r.lastParams=e,r.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);if(!this.loading&&e){var t=this.$results.offset().top+this.$results.outerHeight(!1);this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore()}},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"></li>'),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("open",function(){r._showDropdown(),r._attachPositioningHandler(t),r._bindContainerResultHandlers(t)}),t.on("close",function(){r._hideDropdown(),r._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f("<span></span>"),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0}},e.prototype._attachPositioningHandler=function(e,t){var n=this,r="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id,s=this.$container.parents().filter(a.hasScroll);s.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),s.on(r,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(r+" "+i+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,r="resize.select2."+t.id,i="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+r+" "+i)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),r=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=i.top,o.bottom=i.top+o.height;var s=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=a<i.top-s,u=l>i.bottom+s,d={left:i.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h={top:0,left:0};(f.contains(document.body,p[0])||p[0].isConnected)&&(h=p.offset()),d.top-=h.top,d.left-=h.left,t||n||(r="below"),u||!c||t?!c&&u&&t&&(r="below"):r="above",("above"==r||t&&"below"!==r)&&(d.top=o.top-h.top-s),null!=r&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+r),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+r)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,r){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,r)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,r=0;r<t.length;r++){var i=t[r];i.children?n+=e(i.children):n++}return n}(t.data.results)<this.minimumResultsForSearch)&&e.call(this,t)},e}),e.define("select2/dropdown/selectOnClose",["../utils"],function(o){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("close",function(e){r._handleSelectOnClose(e)})},e.prototype._handleSelectOnClose=function(e,t){if(t&&null!=t.originalSelect2Event){var n=t.originalSelect2Event;if("select"===n._type||"unselect"===n._type)return}var r=this.getHighlightedResults();if(!(r.length<1)){var i=o.GetData(r[0],"data");null!=i.element&&i.element.selected||null==i.element&&i.selected||this.trigger("select",{data:i})}},e}),e.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var r=this;e.call(this,t,n),t.on("select",function(e){r._selectTriggered(e)}),t.on("unselect",function(e){r._selectTriggered(e)})},e.prototype._selectTriggered=function(e,t){var n=t.originalEvent;n&&(n.ctrlKey||n.metaKey)||this.trigger("close",{originalEvent:n,originalSelect2Event:t})},e}),e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return 1!=t&&(n+="s"),n},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),e.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(c,u,d,p,h,f,g,m,v,y,s,t,_,$,b,w,A,x,D,S,E,C,O,T,q,L,I,j,e){function n(){this.reset()}return n.prototype.apply=function(e){if(null==(e=c.extend(!0,{},this.defaults,e)).dataAdapter){if(null!=e.ajax?e.dataAdapter=b:null!=e.data?e.dataAdapter=$:e.dataAdapter=_,0<e.minimumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,x)),0<e.maximumInputLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,D)),0<e.maximumSelectionLength&&(e.dataAdapter=y.Decorate(e.dataAdapter,S)),e.tags&&(e.dataAdapter=y.Decorate(e.dataAdapter,w)),null==e.tokenSeparators&&null==e.tokenizer||(e.dataAdapter=y.Decorate(e.dataAdapter,A)),null!=e.query){var t=u(e.amdBase+"compat/query");e.dataAdapter=y.Decorate(e.dataAdapter,t)}if(null!=e.initSelection){var n=u(e.amdBase+"compat/initSelection");e.dataAdapter=y.Decorate(e.dataAdapter,n)}}if(null==e.resultsAdapter&&(e.resultsAdapter=d,null!=e.ajax&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,T)),null!=e.placeholder&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,O)),e.selectOnClose&&(e.resultsAdapter=y.Decorate(e.resultsAdapter,I))),null==e.dropdownAdapter){if(e.multiple)e.dropdownAdapter=E;else{var r=y.Decorate(E,C);e.dropdownAdapter=r}if(0!==e.minimumResultsForSearch&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,L)),e.closeOnSelect&&(e.dropdownAdapter=y.Decorate(e.dropdownAdapter,j)),null!=e.dropdownCssClass||null!=e.dropdownCss||null!=e.adaptDropdownCssClass){var i=u(e.amdBase+"compat/dropdownCss");e.dropdownAdapter=y.Decorate(e.dropdownAdapter,i)}e.dropdownAdapter=y.Decorate(e.dropdownAdapter,q)}if(null==e.selectionAdapter){if(e.multiple?e.selectionAdapter=h:e.selectionAdapter=p,null!=e.placeholder&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,f)),e.allowClear&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,g)),e.multiple&&(e.selectionAdapter=y.Decorate(e.selectionAdapter,m)),null!=e.containerCssClass||null!=e.containerCss||null!=e.adaptContainerCssClass){var o=u(e.amdBase+"compat/containerCss");e.selectionAdapter=y.Decorate(e.selectionAdapter,o)}e.selectionAdapter=y.Decorate(e.selectionAdapter,v)}e.language=this._resolveLanguage(e.language),e.language.push("en");for(var s=[],a=0;a<e.language.length;a++){var l=e.language[a];-1===s.indexOf(l)&&s.push(l)}return e.language=s,e.translations=this._processTranslations(e.language,e.debug),e},n.prototype.reset=function(){function a(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return t[e]||e})}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:y.escapeMarkup,language:{},matcher:function e(t,n){if(""===c.trim(t.term))return n;if(n.children&&0<n.children.length){for(var r=c.extend(!0,{},n),i=n.children.length-1;0<=i;i--)null==e(t,n.children[i])&&r.children.splice(i,1);return 0<r.children.length?r:e(t,r)}var o=a(n.text).toUpperCase(),s=a(t.term).toUpperCase();return-1<o.indexOf(s)?n:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},n.prototype.applyFromElement=function(e,t){var n=e.language,r=this.defaults.language,i=t.prop("lang"),o=t.closest("[lang]").prop("lang"),s=Array.prototype.concat.call(this._resolveLanguage(i),this._resolveLanguage(n),this._resolveLanguage(r),this._resolveLanguage(o));return e.language=s,e},n.prototype._resolveLanguage=function(e){if(!e)return[];if(c.isEmptyObject(e))return[];if(c.isPlainObject(e))return[e];var t;t=c.isArray(e)?e:[e];for(var n=[],r=0;r<t.length;r++)if(n.push(t[r]),"string"==typeof t[r]&&0<t[r].indexOf("-")){var i=t[r].split("-")[0];n.push(i)}return n},n.prototype._processTranslations=function(e,t){for(var n=new s,r=0;r<e.length;r++){var i=new s,o=e[r];if("string"==typeof o)try{i=s.loadPath(o)}catch(e){try{o=this.defaults.amdLanguageBase+o,i=s.loadPath(o)}catch(e){t&&window.console&&console.warn&&console.warn('Select2: The language file for "'+o+'" could not be automatically loaded. A fallback will be used instead.')}}else i=c.isPlainObject(o)?new s(o):o;n.extend(i)}return n},n.prototype.set=function(e,t){var n={};n[c.camelCase(e)]=t;var r=y._convertData(n);c.extend(!0,this.defaults,r)},new n}),e.define("select2/options",["require","jquery","./defaults","./utils"],function(r,d,i,p){function e(e,t){if(this.options=e,null!=t&&this.fromElement(t),null!=t&&(this.options=i.applyFromElement(this.options,t)),this.options=i.apply(this.options),t&&t.is("input")){var n=r(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=p.Decorate(this.options.dataAdapter,n)}}return e.prototype.fromElement=function(e){var t=["select2"];null==this.options.multiple&&(this.options.multiple=e.prop("multiple")),null==this.options.disabled&&(this.options.disabled=e.prop("disabled")),null==this.options.dir&&(e.prop("dir")?this.options.dir=e.prop("dir"):e.closest("[dir]").prop("dir")?this.options.dir=e.closest("[dir]").prop("dir"):this.options.dir="ltr"),e.prop("disabled",this.options.disabled),e.prop("multiple",this.options.multiple),p.GetData(e[0],"select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),p.StoreData(e[0],"data",p.GetData(e[0],"select2Tags")),p.StoreData(e[0],"tags",!0)),p.GetData(e[0],"ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),e.attr("ajax--url",p.GetData(e[0],"ajaxUrl")),p.StoreData(e[0],"ajax-Url",p.GetData(e[0],"ajaxUrl")));var n={};function r(e,t){return t.toUpperCase()}for(var i=0;i<e[0].attributes.length;i++){var o=e[0].attributes[i].name,s="data-";if(o.substr(0,s.length)==s){var a=o.substring(s.length),l=p.GetData(e[0],a);n[a.replace(/-([a-z])/g,r)]=l}}d.fn.jquery&&"1."==d.fn.jquery.substr(0,2)&&e[0].dataset&&(n=d.extend(!0,{},e[0].dataset,n));var c=d.extend(!0,{},p.GetData(e[0]),n);for(var u in c=p._convertData(c))-1<d.inArray(u,t)||(d.isPlainObject(this.options[u])?d.extend(this.options[u],c[u]):this.options[u]=c[u]);return this},e.prototype.get=function(e){return this.options[e]},e.prototype.set=function(e,t){this.options[e]=t},e}),e.define("select2/core",["jquery","./options","./utils","./keys"],function(o,c,u,r){var d=function(e,t){null!=u.GetData(e[0],"select2")&&u.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),t=t||{},this.options=new c(t,e),d.__super__.constructor.call(this);var n=e.attr("tabindex")||0;u.StoreData(e[0],"old-tabindex",n),e.attr("tabindex","-1");var r=this.options.get("dataAdapter");this.dataAdapter=new r(e,this.options);var i=this.render();this._placeContainer(i);var o=this.options.get("selectionAdapter");this.selection=new o(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,i);var s=this.options.get("dropdownAdapter");this.dropdown=new s(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,i);var a=this.options.get("resultsAdapter");this.results=new a(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var l=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){l.trigger("selection:update",{data:e})}),e.addClass("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),u.StoreData(e[0],"select2",this),e.data("select2",this)};return u.Extend(d,u.Observable),d.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+u.generateChars(2):u.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},d.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},d.prototype._resolveWidth=function(e,t){var n=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var r=this._resolveWidth(e,"style");return null!=r?r:this._resolveWidth(e,"element")}if("element"==t){var i=e.outerWidth(!1);return i<=0?"auto":i+"px"}if("style"!=t)return"computedstyle"!=t?t:window.getComputedStyle(e[0]).width;var o=e.attr("style");if("string"!=typeof o)return null;for(var s=o.split(";"),a=0,l=s.length;a<l;a+=1){var c=s[a].replace(/\s/g,"").match(n);if(null!==c&&1<=c.length)return c[1]}return null},d.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},d.prototype._registerDomEvents=function(){var t=this;this.$element.on("change.select2",function(){t.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})}),this.$element.on("focus.select2",function(e){t.trigger("focus",e)}),this._syncA=u.bind(this._syncAttributes,this),this._syncS=u.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=e?(this._observer=new e(function(e){t._syncA(),t._syncS(null,e)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",t._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",t._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",t._syncS,!1))},d.prototype._registerDataEvents=function(){var n=this;this.dataAdapter.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerSelectionEvents=function(){var n=this,r=["toggle","focus"];this.selection.on("toggle",function(){n.toggleDropdown()}),this.selection.on("focus",function(e){n.focus(e)}),this.selection.on("*",function(e,t){-1===o.inArray(e,r)&&n.trigger(e,t)})},d.prototype._registerDropdownEvents=function(){var n=this;this.dropdown.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerResultsEvents=function(){var n=this;this.results.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerEvents=function(){var n=this;this.on("open",function(){n.$container.addClass("select2-container--open")}),this.on("close",function(){n.$container.removeClass("select2-container--open")}),this.on("enable",function(){n.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){n.$container.addClass("select2-container--disabled")}),this.on("blur",function(){n.$container.removeClass("select2-container--focus")}),this.on("query",function(t){n.isOpen()||n.trigger("open",{}),this.dataAdapter.query(t,function(e){n.trigger("results:all",{data:e,query:t})})}),this.on("query:append",function(t){this.dataAdapter.query(t,function(e){n.trigger("results:append",{data:e,query:t})})}),this.on("keypress",function(e){var t=e.which;n.isOpen()?t===r.ESC||t===r.TAB||t===r.UP&&e.altKey?(n.close(e),e.preventDefault()):t===r.ENTER?(n.trigger("results:select",{}),e.preventDefault()):t===r.SPACE&&e.ctrlKey?(n.trigger("results:toggle",{}),e.preventDefault()):t===r.UP?(n.trigger("results:previous",{}),e.preventDefault()):t===r.DOWN&&(n.trigger("results:next",{}),e.preventDefault()):(t===r.ENTER||t===r.SPACE||t===r.DOWN&&e.altKey)&&(n.open(),e.preventDefault())})},d.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},d.prototype._isChangeMutation=function(e,t){var n=!1,r=this;if(!e||!e.target||"OPTION"===e.target.nodeName||"OPTGROUP"===e.target.nodeName){if(t)if(t.addedNodes&&0<t.addedNodes.length)for(var i=0;i<t.addedNodes.length;i++){t.addedNodes[i].selected&&(n=!0)}else t.removedNodes&&0<t.removedNodes.length?n=!0:o.isArray(t)&&o.each(t,function(e,t){if(r._isChangeMutation(e,t))return!(n=!0)});else n=!0;return n}},d.prototype._syncSubtree=function(e,t){var n=this._isChangeMutation(e,t),r=this;n&&this.dataAdapter.current(function(e){r.trigger("selection:update",{data:e})})},d.prototype.trigger=function(e,t){var n=d.__super__.trigger,r={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in r){var i=r[e],o={prevented:!1,name:e,args:t};if(n.call(this,i,o),o.prevented)return void(t.prevented=!0)}n.call(this,e,t)},d.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},d.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},d.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},d.prototype.isEnabled=function(){return!this.isDisabled()},d.prototype.isDisabled=function(){return this.options.get("disabled")},d.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},d.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},d.prototype.focus=function(e){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},d.prototype.enable=function(e){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},d.prototype.data=function(){this.options.get("debug")&&0<arguments.length&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var t=[];return this.dataAdapter.current(function(e){t=e}),t},d.prototype.val=function(e){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==e||0===e.length)return this.$element.val();var t=e[0];o.isArray(t)&&(t=o.map(t,function(e){return e.toString()})),this.$element.val(t).trigger("input").trigger("change")},d.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",u.GetData(this.$element[0],"old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),u.RemoveData(this.$element[0]),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},d.prototype.render=function(){var e=o('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container.addClass("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("jquery-mousewheel",["jquery"],function(e){return e}),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(i,e,o,t,s){if(null==i.fn.select2){var a=["open","close","destroy"];i.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=i.extend(!0,{},t);new o(i(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=s.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,r)}),-1<i.inArray(t,a)?this:n}}return null==i.fn.select2.defaults&&(i.fn.select2.defaults=t),o}),{define:e.define,require:e.require}}(),t=e.require("jquery.select2");return u.fn.select2.amd=e,t}); |