mirror of
https://github.com/chinchang/web-maker.git
synced 2025-05-18 00:01:07 +02:00
1 line
1.2 MiB
1 line
1.2 MiB
(function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);(this||window).CodeMirror=e()}})(function(){"use strict";function e(n,o){if(!(this instanceof e))return new e(n,o);this.options=o=o?Fr(o):{},Fr(ii,o,!1),u(o);var r=o.value;"string"==typeof r&&(r=new Li(r,o.mode,null,o.lineSeparator)),this.doc=r;var a=new e.inputStyles[o.inputStyle](this),l=this.display=new t(n,r,a);l.wrapper.CodeMirror=this,d(this),s(this),o.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),o.autofocus&&!Da&&l.input.focus(),f(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Lr,keySeq:null,specialChars:null};var p=this;for(var c in Ta&&11>wa&&setTimeout(function(){p.display.input.reset(!0)},20),Ht(this),Qr(),xt(this),this.curOp.forceUpdate=!0,Yo(this,r),o.autofocus&&!Da||p.hasFocus()?setTimeout(Br(yn,this),20):bn(this),si)si.hasOwnProperty(c)&&si[c](this,o[c],di);C(this),o.finishInit&&o.finishInit(this);for(var h=0;h<ui.length;++h)ui[h](this);St(this),Ia&&o.lineWrapping&&"optimizelegibility"==getComputedStyle(l.lineDiv).textRendering&&(l.lineDiv.style.textRendering="auto")}function t(e,t,n){var o=this;this.input=n,o.scrollbarFiller=Hr("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=Hr("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=Hr("div",null,"CodeMirror-code"),o.selectionDiv=Hr("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=Hr("div",null,"CodeMirror-cursors"),o.measure=Hr("div",null,"CodeMirror-measure"),o.lineMeasure=Hr("div",null,"CodeMirror-measure"),o.lineSpace=Hr("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none"),o.mover=Hr("div",[Hr("div",[o.lineSpace],"CodeMirror-lines")],null,"position: relative"),o.sizer=Hr("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=Hr("div",null,null,"position: absolute; height: "+Vi+"px; width: 1px;"),o.gutters=Hr("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=Hr("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=Hr("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),Ta&&8>wa&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),Ia||Sa&&Da||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,n.init(o)}function n(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),o(t)}function o(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Ue(e,100),e.state.modeGen++,e.curOp&&Dt(e)}function r(e){var t=bt(e.display),n=e.options.lineWrapping,o=n&&va(5,e.display.scroller.clientWidth/vt(e.display)-3);return function(r){if(Eo(e.doc,r))return 0;var a=0;if(r.widgets)for(var s=0;s<r.widgets.length;s++)r.widgets[s].height&&(a+=r.widgets[s].height);return n?a+(ba(r.text.length/o)||1)*t:a+t}}function a(e){var t=e.doc,n=r(e);t.iter(function(e){var t=n(e);t!=e.height&&er(e,t)})}function s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),st(e)}function i(e){d(e),Dt(e),setTimeout(function(){x(e)},20)}function d(e){var t=e.display.gutters,n=e.options.gutters;jr(t);for(var o=0;o<n.length;++o){var r=n[o],a=t.appendChild(Hr("div",null,"CodeMirror-gutter "+r));"CodeMirror-linenumbers"==r&&(e.display.lineGutter=a,a.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=o?"":"none",l(e)}function l(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function p(e){if(0==e.height)return 0;for(var t=e.text.length,n=e,o,r;o=fo(n);)r=o.find(0,!0),n=r.from.line,t+=r.from.ch-r.to.ch;for(n=e;o=yo(n);){var r=o.find(0,!0);t-=n.text.length-r.from.ch,n=r.to.line,t+=n.text.length-r.to.ch}return t}function c(e){var t=e.display,n=e.doc;t.maxLine=Jo(n,n.first),t.maxLineLength=p(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=p(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function u(e){var t=Pr(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):-1<t&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function h(e){var t=e.display,n=t.gutters.offsetWidth,o=ya(e.doc.height+qe(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:o,scrollHeight:o+Ke(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function m(e,t,n){this.cm=n;var o=this.vert=Hr("div",[Hr("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=Hr("div",[Hr("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(o),e(r),Mi(o,"scroll",function(){o.clientHeight&&t(o.scrollTop,"vertical")}),Mi(r,"scroll",function(){r.clientWidth&&t(r.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,Ta&&8>wa&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function f(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&es(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Mi(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?rn(t,e):nn(t,e)},t),t.display.scrollbars.addClass&&ts(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=h(e));var n=e.display.barWidth,o=e.display.barHeight;b(e,t);for(var r=0;4>r&&n!=e.display.barWidth||o!=e.display.barHeight;r++)n!=e.display.barWidth&&e.options.lineWrapping&&L(e),b(e,h(e)),n=e.display.barWidth,o=e.display.barHeight}function b(e,t){var n=e.display,o=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=o.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=o.bottom)+"px",n.heightForcer.style.borderBottom=o.bottom+"px solid transparent",o.right&&o.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=o.bottom+"px",n.scrollbarFiller.style.width=o.right+"px"):n.scrollbarFiller.style.display="",o.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=o.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function v(e,t,n){var o=n&&null!=n.top?va(0,n.top):e.scroller.scrollTop;o=fa(o-je(e));var r=n&&null!=n.bottom?n.bottom:o+e.wrapper.clientHeight,a=nr(t,o),i=nr(t,r);if(n&&n.ensure){var s=n.ensure.from.line,d=n.ensure.to.line;s<a?(a=s,i=nr(t,or(Jo(t,s))+e.wrapper.clientHeight)):ga(d,t.lastLine())>=i&&(a=nr(t,or(Jo(t,d))-e.wrapper.clientHeight),i=d)}return{from:a,to:va(i,a+1)}}function x(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var o=E(t)-t.scroller.scrollLeft+e.doc.scrollLeft,r=t.gutters.offsetWidth,a=o+"px",s=0;s<n.length;s++)if(!n[s].hidden){e.options.fixedGutter&&n[s].gutter&&(n[s].gutter.style.left=a);var i=n[s].alignable;if(i)for(var d=0;d<i.length;d++)i[d].style.left=a}e.options.fixedGutter&&(t.gutters.style.left=o+r+"px")}}function C(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=S(e.options,t.first+t.size-1),o=e.display;if(n.length!=o.lineNumChars){var r=o.measure.appendChild(Hr("div",[Hr("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),a=r.firstChild.offsetWidth,i=r.offsetWidth-a;return o.lineGutter.style.width="",o.lineNumInnerWidth=va(a,o.lineGutter.offsetWidth-i)+1,o.lineNumWidth=o.lineNumInnerWidth+i,o.lineNumChars=o.lineNumInnerWidth?n.length:-1,o.lineGutter.style.width=o.lineNumWidth+"px",l(e),!0}return!1}function S(e,t){return e.lineNumberFormatter(t+e.firstLineNumber)+""}function E(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function k(e,t,n){var o=e.display;this.viewport=t,this.visible=v(o,e.doc,t),this.editorIsHidden=!o.wrapper.offsetWidth,this.wrapperHeight=o.wrapper.clientHeight,this.wrapperWidth=o.wrapper.clientWidth,this.oldDisplayWidth=Ge(e),this.force=n,this.dims=O(e),this.events=[]}function T(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Ke(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ke(e)+"px",t.scrollbarsClipped=!0)}function w(e,t){var n=e.display,o=e.doc;if(t.editorIsHidden)return Ft(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Wt(e))return!1;C(e)&&(Ft(e),t.dims=O(e));var r=o.first+o.size,a=va(t.visible.from-e.options.viewportMargin,o.first),i=ga(r,t.visible.to+e.options.viewportMargin);n.viewFrom<a&&20>a-n.viewFrom&&(a=va(o.first,n.viewFrom)),n.viewTo>i&&20>n.viewTo-i&&(i=ga(r,n.viewTo)),ja&&(a=Co(e.doc,a),i=So(e.doc,i));var s=a!=n.viewFrom||i!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vt(e,a,i),n.viewOffset=or(Jo(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var d=Wt(e);if(!s&&0==d&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var l=zr();return 4<d&&(n.lineDiv.style.display="none"),P(e,n.updateLineNumbers,t.dims),4<d&&(n.lineDiv.style.display=""),n.renderedView=n.view,l&&zr()!=l&&l.offsetHeight&&l.focus(),jr(n.cursorDiv),jr(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,s&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Ue(e,400)),n.updateLineNumbers=null,!0}function I(e,t){for(var n=t.viewport,o=!0;;o=!1){if((!o||!e.options.lineWrapping||t.oldDisplayWidth==Ge(e))&&(n&&null!=n.top&&(n={top:ga(e.doc.height+qe(e.display)-Xe(e),n.top)}),t.visible=v(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo))break;if(!w(e,t))break;L(e);var r=h(e);_e(e),y(e,r),A(e,r)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function N(e,t){var n=new k(e,t);if(w(e,n)){L(e),I(e,n);var o=h(e);_e(e),y(e,o),A(e,o),n.finish()}}function A(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ke(e)+"px"}function L(e){for(var t=e.display,n=t.lineDiv.offsetTop,o=0;o<t.view.length;o++){var r=t.view[o],a;if(!r.hidden){if(Ta&&8>wa){var i=r.node.offsetTop+r.node.offsetHeight;a=i-n,n=i}else{var s=r.node.getBoundingClientRect();a=s.bottom-s.top}var d=r.line.height-a;if(2>a&&(a=bt(t)),(.001<d||-.001>d)&&(er(r.line,a),R(r.line),r.rest))for(var l=0;l<r.rest.length;l++)R(r.rest[l])}}}function R(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.parentNode.offsetHeight}function O(e){for(var t=e.display,o={},r={},a=t.gutters.clientLeft,s=t.gutters.firstChild,n=0;s;s=s.nextSibling,++n)o[e.options.gutters[n]]=s.offsetLeft+s.clientLeft+a,r[e.options.gutters[n]]=s.clientWidth;return{fixedPos:E(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:o,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function P(e,t,n){function o(t){var n=t.nextSibling;return Ia&&Ma&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var r=e.display,a=e.options.lineNumbers,s=r.lineDiv,d=s.firstChild,l=r.view,p=r.viewFrom,c=0,i;c<l.length;c++){if(i=l[c],i.hidden);else if(!i.node||i.node.parentNode!=s){var u=H(e,i,p,n);s.insertBefore(u,d)}else{for(;d!=i.node;)d=o(d);var h=a&&null!=t&&t<=p&&i.lineNumber;i.changes&&(-1<Pr(i.changes,"gutter")&&(h=!1),_(e,i,p,n)),h&&(jr(i.lineNumber),i.lineNumber.appendChild(document.createTextNode(S(e.options,p)))),d=i.node.nextSibling}p+=i.size}for(;d;)d=o(d)}function _(e,t,n,o){for(var r=0,a;r<t.changes.length;r++)a=t.changes[r],"text"==a?B(e,t):"gutter"==a?V(e,t,n,o):"class"==a?U(t):"widget"==a&&W(e,t,o);t.changes=null}function D(e){return e.node==e.text&&(e.node=Hr("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),Ta&&8>wa&&(e.node.style.zIndex=2)),e.node}function M(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=D(e);e.background=n.insertBefore(Hr("div",null,t),n.firstChild)}}function F(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Uo(e,t)}function B(e,t){var n=t.text.className,o=F(e,t);t.text==t.node&&(t.node=o.pre),t.text.parentNode.replaceChild(o.pre,t.text),t.text=o.pre,o.bgClass!=t.bgClass||o.textClass!=t.textClass?(t.bgClass=o.bgClass,t.textClass=o.textClass,U(t)):n&&(t.text.className=n)}function U(e){M(e),e.line.wrapClass?D(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function V(e,t,n,o){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var r=D(t);t.gutterBackground=Hr("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?o.fixedPos:-o.gutterTotalWidth)+"px; width: "+o.gutterTotalWidth+"px"),r.insertBefore(t.gutterBackground,t.text)}var a=t.line.gutterMarkers;if(e.options.lineNumbers||a){var r=D(t),i=t.gutter=Hr("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?o.fixedPos:-o.gutterTotalWidth)+"px");if(e.display.input.setUneditable(i),r.insertBefore(i,t.text),t.line.gutterClass&&(i.className+=" "+t.line.gutterClass),!e.options.lineNumbers||a&&a["CodeMirror-linenumbers"]||(t.lineNumber=i.appendChild(Hr("div",S(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+o.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),a)for(var s=0;s<e.options.gutters.length;++s){var d=e.options.gutters[s],l=a.hasOwnProperty(d)&&a[d];l&&i.appendChild(Hr("div",[l],"CodeMirror-gutter-elt","left: "+o.gutterLeft[d]+"px; width: "+o.gutterWidth[d]+"px"))}}}function W(e,t,n){t.alignable&&(t.alignable=null);for(var o=t.node.firstChild,r,r;o;o=r)r=o.nextSibling,"CodeMirror-linewidget"==o.className&&t.node.removeChild(o);j(e,t,n)}function H(e,t,n,o){var r=F(e,t);return t.text=t.node=r.pre,r.bgClass&&(t.bgClass=r.bgClass),r.textClass&&(t.textClass=r.textClass),U(t),V(e,t,n,o),j(e,t,o),t.node}function j(e,t,n){if(q(e,t.line,t,n,!0),t.rest)for(var o=0;o<t.rest.length;o++)q(e,t.rest[o],t,n,!1)}function q(e,t,n,o,r){if(t.widgets)for(var a=D(n),s=0,i=t.widgets;s<i.length;++s){var d=i[s],l=Hr("div",[d.node],"CodeMirror-linewidget");d.handleMouseEvents||l.setAttribute("cm-ignore-events","true"),z(d,l,n,o),e.display.input.setUneditable(l),r&&d.above?a.insertBefore(l,n.gutter||n.text):a.appendChild(l),kr(d,"redraw")}}function z(e,t,n,o){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var r=o.wrapperWidth;t.style.left=o.fixedPos+"px",e.coverGutter||(r-=o.gutterTotalWidth,t.style.paddingLeft=o.gutterTotalWidth+"px"),t.style.width=r+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",!e.noHScroll&&(t.style.marginLeft=-o.gutterTotalWidth+"px"))}function K(e){return qa(e.line,e.ch)}function G(e,t){return 0>za(e,t)?t:e}function X(e,t){return 0>za(e,t)?e:t}function Q(e){e.state.focused||(e.display.input.focus(),yn(e))}function Y(e,t,n,o,r){var a=e.doc;e.display.shift=!1,o||(o=a.sel);var s=e.state.pasteIncoming||"paste"==r,d=a.splitLines(t),l=null;if(s&&1<o.ranges.length)if(!(Ka&&Ka.join("\n")==t))d.length==o.ranges.length&&(l=_r(d,function(e){return[e]}));else if(0==o.ranges.length%Ka.length){l=[];for(var p=0;p<Ka.length;p++)l.push(a.splitLines(Ka[p]))}for(var p=o.ranges.length-1;0<=p;p--){var i=o.ranges[p],c=i.from(),u=i.to();i.empty()&&(n&&0<n?c=qa(c.line,c.ch-n):e.state.overwrite&&!s&&(u=qa(u.line,ga(Jo(a,u.line).text.length,u.ch+Or(d).length))));var h=e.curOp.updateInput,m={from:c,to:u,text:l?l[p%l.length]:d,origin:r||(s?"paste":e.state.cutIncoming?"cut":"+input")};wn(e.doc,m),kr(e,"inputRead",e,m)}t&&!s&&$(e,t),Bn(e),e.curOp.updateInput=h,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function J(t,e){var n=t.clipboardData&&t.clipboardData.getData("text/plain");if(n)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||At(e,function(){Y(e,n,0,null,"paste")}),!0}function $(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,o=n.ranges.length-1,r;0<=o;o--)if(r=n.ranges[o],!(100<r.head.ch||o&&n.ranges[o-1].head.line==r.head.line)){var a=e.getModeAt(r.head),i=!1;if(a.electricChars){for(var s=0;s<a.electricChars.length;s++)if(-1<t.indexOf(a.electricChars.charAt(s))){i=Vn(e,r.head.line,"smart");break}}else a.electricInput&&a.electricInput.test(Jo(e.doc,r.head.line).text.slice(0,r.head.ch))&&(i=Vn(e,r.head.line,"smart"));i&&kr(e,"electricInput",e,r.head.line)}}function Z(e){for(var t=[],n=[],o=0;o<e.doc.sel.ranges.length;o++){var r=e.doc.sel.ranges[o].head.line,a={anchor:qa(r,0),head:qa(r+1,0)};n.push(a),t.push(e.getRange(a.anchor,a.head))}return{text:t,ranges:n}}function ee(e){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false")}function te(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Lr,this.inaccurateSelection=!1,this.hasSelection=!1,this.composing=null}function ne(){var e=Hr("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none"),t=Hr("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return Ia?e.style.width="1000px":e.setAttribute("wrap","off"),_a&&(e.style.border="1px solid black"),ee(e),t}function oe(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Lr,this.gracePeriod=!1}function re(e,t){var n=Ze(e,t.line);if(!n||n.hidden)return null;var o=Jo(e.doc,t.line),r=Ye(n,o,t.line),a=rr(o),i="left";if(a){var s=la(a,t.ch);i=s%2?"right":"left"}var d=nt(r.map,t.ch,i);return d.offset="right"==d.collapse?d.end:d.start,d}function ae(e,t){return t&&(e.bad=!0),e}function se(e,t,n){var o;if(t==e.display.lineDiv){if(o=e.display.lineDiv.childNodes[n],!o)return ae(e.clipPos(qa(e.display.viewTo-1)),!0);t=null,n=0}else for(o=t;;o=o.parentNode){if(!o||o==e.display.lineDiv)return null;if(o.parentNode&&o.parentNode==e.display.lineDiv)break}for(var r=0,a;r<e.display.view.length;r++)if(a=e.display.view[r],a.node==o)return de(a,t,n)}function de(e,t,n){function o(t,n,o){for(var r=-1,a;r<(p?p.length:0);r++){a=0>r?l.map:p[r];for(var i=0,s;i<a.length;i+=3)if(s=a[i+2],s==t||s==n){var d=tr(0>r?e.line:e.rest[r]),c=a[i]+o;return(0>o||s!=t)&&(c=a[i+(o?1:0)]),qa(d,c)}}}var r=e.text.firstChild,a=!1;if(!t||!Zi(r,t))return ae(qa(tr(e.line),0),!0);if(t==r&&(a=!0,t=r.childNodes[n],n=0,!t)){var i=e.rest?Or(e.rest):e.line;return ae(qa(tr(i),i.text.length),a)}var s=3==t.nodeType?t:null,d=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,n&&(n=s.nodeValue.length));d.parentNode!=r;)d=d.parentNode;var l=e.measure,p=l.maps,c=o(s,d,n);if(c)return ae(c,a);for(var u=d.nextSibling,h=s?s.nodeValue.length-n:0;u;u=u.nextSibling){if(c=o(u,u.firstChild,0),c)return ae(qa(c.line,c.ch-h),a);h+=u.textContent.length}for(var m=d.previousSibling,h=n;m;m=m.previousSibling){if(c=o(m,m.firstChild,-1),c)return ae(qa(c.line,c.ch+h),a);h+=u.textContent.length}}function le(e,t,n,o,r){function a(e){return function(t){return t.id==e}}function s(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return""==n&&(n=t.textContent.replace(/\u200b/g,"")),void(d+=n);var p=t.getAttribute("cm-marker"),c;if(p){var u=e.findMarks(qa(o,0),qa(r+1,0),a(+p));return void(u.length&&(c=u[0].find())&&(d+=$o(e.doc,c.from,c.to).join(i)))}if("false"==t.getAttribute("contenteditable"))return;for(var h=0;h<t.childNodes.length;h++)s(t.childNodes[h]);/^(pre|div|p)$/i.test(t.nodeName)&&(l=!0)}else if(3==t.nodeType){var m=t.nodeValue;if(!m)return;l&&(d+=i,l=!1),d+=m}}for(var d="",l=!1,i=e.doc.lineSeparator();;){if(s(t),t==n)break;t=t.nextSibling}return d}function pe(e,t){this.ranges=e,this.primIndex=t}function ce(e,t){this.anchor=e,this.head=t}function ue(e,t){var n=e[t];e.sort(function(e,t){return za(e.from(),t.from())}),t=Pr(e,n);for(var o=1;o<e.length;o++){var r=e[o],a=e[o-1];if(0<=za(a.to(),r.from())){var i=X(a.from(),r.from()),s=G(a.to(),r.to()),d=a.empty()?r.from()==r.head:a.from()==a.head;o<=t&&--t,e.splice(--o,2,new ce(d?s:i,d?i:s))}}return new pe(e,t)}function he(e,t){return new pe([new ce(e,t||e)],0)}function me(e,t){return va(e.first,ga(t,e.first+e.size-1))}function ge(e,t){if(t.line<e.first)return qa(e.first,0);var n=e.first+e.size-1;return t.line>n?qa(n,Jo(e,n).text.length):fe(t,Jo(e,t.line).text.length)}function fe(e,t){var n=e.ch;return null==n||n>t?qa(e.line,t):0>n?qa(e.line,0):e}function ye(e,t){return t>=e.first&&t<e.first+e.size}function be(e,t){for(var n=[],o=0;o<t.length;o++)n[o]=ge(e,t[o]);return n}function ve(e,t,n,o){if(e.cm&&e.cm.display.shift||e.extend){var r=t.anchor;if(o){var a=0>za(n,r);a==0>za(o,r)?a!=0>za(n,o)&&(n=o):(r=n,n=o)}return new ce(r,n)}return new ce(o||n,n)}function xe(e,t,n,o){we(e,new pe([ve(e,e.sel.primary(),t,n)],0),o)}function Ce(e,t,n){for(var o=[],r=0;r<e.sel.ranges.length;r++)o[r]=ve(e,e.sel.ranges[r],t[r],null);var a=ue(o,e.sel.primIndex);we(e,a,n)}function Se(e,t,n,o){var r=e.sel.ranges.slice(0);r[t]=n,we(e,ue(r,e.sel.primIndex),o)}function Ee(e,t,n,o){we(e,he(t,n),o)}function ke(e,t,n){var o={ranges:t.ranges,update:function(t){this.ranges=[];for(var n=0;n<t.length;n++)this.ranges[n]=new ce(ge(e,t[n].anchor),ge(e,t[n].head))},origin:n&&n.origin};return Bi(e,"beforeSelectionChange",e,o),e.cm&&Bi(e.cm,"beforeSelectionChange",e.cm,o),o.ranges==t.ranges?t:ue(o.ranges,o.ranges.length-1)}function Te(e,t,n){var o=e.history.done,r=Or(o);r&&r.ranges?(o[o.length-1]=t,Ie(e,t,n)):we(e,t,n)}function we(e,t,n){Ie(e,t,n),cr(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Ie(e,t,n){(Nr(e,"beforeSelectionChange")||e.cm&&Nr(e.cm,"beforeSelectionChange"))&&(t=ke(e,t,n));var o=n&&n.bias||(0>za(t.primary().head,e.sel.primary().head)?-1:1);Ne(e,Le(e,t,o,!0)),!(n&&!1===n.scroll)&&e.cm&&Bn(e.cm)}function Ne(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Ir(e.cm)),kr(e,"cursorActivity",e))}function Ae(e){Ne(e,Le(e,e.sel,null,!1),Hi)}function Le(e,t,n,o){for(var r=0,a;r<t.ranges.length;r++){var i=t.ranges[r],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[r],d=Oe(e,i.anchor,s&&s.anchor,n,o),l=Oe(e,i.head,s&&s.head,n,o);(a||d!=i.anchor||l!=i.head)&&(!a&&(a=t.ranges.slice(0,r)),a[r]=new ce(d,l))}return a?ue(a,t.primIndex):t}function Re(e,t,n,o,r){var a=Jo(e,t.line);if(a.markedSpans)for(var s=0;s<a.markedSpans.length;++s){var i=a.markedSpans[s],d=i.marker;if((null==i.from||(d.inclusiveLeft?i.from<=t.ch:i.from<t.ch))&&(null==i.to||(d.inclusiveRight?i.to>=t.ch:i.to>t.ch))){if(r&&(Bi(d,"beforeCursorEnter"),d.explicitlyCleared))if(!a.markedSpans)break;else{--s;continue}if(!d.atomic)continue;if(n){var l=d.find(0>o?1:-1),p;if((0>o?d.inclusiveRight:d.inclusiveLeft)&&(l=Pe(e,l,-o,l&&l.line==t.line?a:null)),l&&l.line==t.line&&(p=za(l,n))&&(0>o?0>p:0<p))return Re(e,l,t,o,r)}var c=d.find(0>o?-1:1);return(0>o?d.inclusiveLeft:d.inclusiveRight)&&(c=Pe(e,c,o,c.line==t.line?a:null)),c?Re(e,c,t,o,r):null}}return t}function Oe(e,t,n,o,r){var a=o||1,i=Re(e,t,n,a,r)||!r&&Re(e,t,n,a,!0)||Re(e,t,n,-a,r)||!r&&Re(e,t,n,-a,!0);return i?i:(e.cantEdit=!0,qa(e.first,0))}function Pe(e,t,n,o){return 0>n&&0==t.ch?t.line>e.first?ge(e,qa(t.line-1)):null:0<n&&t.ch==(o||Jo(e,t.line)).text.length?t.line<e.first+e.size-1?qa(t.line+1,0):null:new qa(t.line,t.ch+n)}function _e(e){e.display.input.showSelection(e.display.input.prepareSelection())}function De(e,t){for(var n=e.doc,o={},r=o.cursors=document.createDocumentFragment(),a=o.selection=document.createDocumentFragment(),s=0;s<n.sel.ranges.length;s++)if(!1!==t||s!=n.sel.primIndex){var i=n.sel.ranges[s];if(!(i.from().line>=e.display.viewTo||i.to().line<e.display.viewFrom)){var d=i.empty();(d||e.options.showCursorWhenSelecting)&&Me(e,i.head,r),d||Fe(e,i,a)}}return o}function Me(e,t,n){var o=ht(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),r=n.appendChild(Hr("div","\xA0","CodeMirror-cursor"));if(r.style.left=o.left+"px",r.style.top=o.top+"px",r.style.height=va(0,o.bottom-o.top)*e.options.cursorHeight+"px",o.other){var a=n.appendChild(Hr("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="",a.style.left=o.other.left+"px",a.style.top=o.other.top+"px",a.style.height=.85*(o.other.bottom-o.other.top)+"px"}}function Fe(e,t,n){function o(e,t,n,o){0>t&&(t=0),t=ya(t),o=ya(o),s.appendChild(Hr("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==n?p-e:n)+"px; height: "+(o-t)+"px"))}function r(t,n,r){function a(n,o){return ut(e,qa(t,n),"div",s,o)}var s=Jo(i,t),d=s.text.length,c,u;return ea(rr(s),n||0,null==r?d:r,function(e,t,i){var s=a(e,"left"),h,m,g;if(e==t)h=s,m=g=s.left;else{if(h=a(t-1,"right"),"rtl"==i){var f=s;s=h,h=f}m=s.left,g=h.right}null==n&&0==e&&(m=l),3<h.top-s.top&&(o(m,s.top,null,s.bottom),m=l,s.bottom<h.top&&o(m,s.bottom,null,h.top)),null==r&&t==d&&(g=p),(!c||s.top<c.top||s.top==c.top&&s.left<c.left)&&(c=s),(!u||h.bottom>u.bottom||h.bottom==u.bottom&&h.right>u.right)&&(u=h),m<l+1&&(m=l),o(m,h.top,g-m,h.bottom)}),{start:c,end:u}}var a=e.display,i=e.doc,s=document.createDocumentFragment(),d=ze(e.display),l=d.left,p=va(a.sizerWidth,Ge(e)-a.sizer.offsetLeft)-d.right,c=t.from(),u=t.to();if(c.line==u.line)r(c.line,c.ch,u.ch);else{var h=Jo(i,c.line),m=Jo(i,u.line),g=vo(h)==vo(m),f=r(c.line,c.ch,g?h.text.length+1:null).end,y=r(u.line,g?0:null,u.ch).start;g&&(f.top<y.top-2?(o(f.right,f.top,null,f.bottom),o(l,y.top,y.left,y.bottom)):o(f.right,f.top,y.left-f.right,f.bottom)),f.bottom<y.top&&o(l,f.bottom,null,y.top)}n.appendChild(s)}function Be(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):0>e.options.cursorBlinkRate&&(t.cursorDiv.style.visibility="hidden")}}function Ue(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,Br(Ve,e))}function Ve(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,o=mi(t.mode,He(e,t.frontier)),r=[];t.iter(t.frontier,ga(t.first+t.size,e.display.viewTo+500),function(a){if(t.frontier>=e.display.viewFrom){var s=a.styles,d=a.text.length>e.options.maxHighlightLength,l=Do(e,a,d?mi(t.mode,o):o,!0);a.styles=l.styles;var p=a.styleClasses,c=l.classes;c?a.styleClasses=c:p&&(a.styleClasses=null);for(var u=!s||s.length!=a.styles.length||p!=c&&(!p||!c||p.bgClass!=c.bgClass||p.textClass!=c.textClass),h=0;!u&&h<s.length;++h)u=s[h]!=a.styles[h];u&&r.push(t.frontier),a.stateAfter=d?o:mi(t.mode,o)}else a.text.length<=e.options.maxHighlightLength&&Fo(e,a.text,o),a.stateAfter=0==t.frontier%5?mi(t.mode,o):null;return(++t.frontier,+new Date>n)?(Ue(e,e.options.workDelay),!0):void 0}),r.length&&At(e,function(){for(var t=0;t<r.length;t++)Mt(e,r[t],"text")})}}function We(e,t,n){for(var o=e.doc,r=n?-1:t-(e.doc.mode.innerMode?1e3:100),a=t,i,s;a>r;--a){if(a<=o.first)return o.first;var d=Jo(o,a-1);if(d.stateAfter&&(!n||a<=o.frontier))return a;var l=zi(d.text,null,e.options.tabSize);(null==s||i>l)&&(s=a-1,i=l)}return s}function He(e,t,n){var o=e.doc,r=e.display;if(!o.mode.startState)return!0;var a=We(e,t,n),i=a>o.first&&Jo(o,a-1).stateAfter;return i=i?mi(o.mode,i):gi(o.mode),o.iter(a,t,function(n){Fo(e,n.text,i);var s=a==t-1||0==a%5||a>=r.viewFrom&&a<r.viewTo;n.stateAfter=s?mi(o.mode,i):null,++a}),n&&(o.frontier=a),i}function je(e){return e.lineSpace.offsetTop}function qe(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ze(t){if(t.cachedPaddingH)return t.cachedPaddingH;var n=qr(t.measure,Hr("pre","x")),e=window.getComputedStyle?window.getComputedStyle(n):n.currentStyle,o={left:parseInt(e.paddingLeft),right:parseInt(e.paddingRight)};return isNaN(o.left)||isNaN(o.right)||(t.cachedPaddingH=o),o}function Ke(e){return Vi-e.display.nativeBarWidth}function Ge(e){return e.display.scroller.clientWidth-Ke(e)-e.display.barWidth}function Xe(e){return e.display.scroller.clientHeight-Ke(e)-e.display.barHeight}function Qe(e,t,n){var o=e.options.lineWrapping,r=o&&Ge(e);if(!t.measure.heights||o&&t.measure.width!=r){var a=t.measure.heights=[];if(o){t.measure.width=r;for(var s=t.text.firstChild.getClientRects(),d=0;d<s.length-1;d++){var i=s[d],l=s[d+1];2<ha(i.bottom-l.bottom)&&a.push((i.bottom+l.top)/2-n.top)}}a.push(n.bottom-n.top)}}function Ye(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var o=0;o<e.rest.length;o++)if(e.rest[o]==t)return{map:e.measure.maps[o],cache:e.measure.caches[o]};for(var o=0;o<e.rest.length;o++)if(tr(e.rest[o])>n)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function Je(e,t){t=vo(t);var n=tr(t),o=e.display.externalMeasured=new Pt(e.doc,t,n);o.lineN=n;var r=o.built=Uo(e,o);return o.text=r.pre,qr(e.display.lineMeasure,r.pre),o}function $e(e,t,n,o){return tt(e,et(e,t),n,o)}function Ze(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Bt(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function et(e,t){var n=tr(t),o=Ze(e,n);o&&!o.text?o=null:o&&o.changes&&(_(e,o,n,O(e)),e.curOp.forceUpdate=!0),o||(o=Je(e,t));var r=Ye(o,t,n);return{line:t,view:o,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function tt(e,t,n,o,r){t.before&&(n=-1);var a=n+(o||""),i;return t.cache.hasOwnProperty(a)?i=t.cache[a]:(!t.rect&&(t.rect=t.view.text.getBoundingClientRect()),!t.hasHeights&&(Qe(e,t.view,t.rect),t.hasHeights=!0),i=ot(e,t,n,o),!i.bogus&&(t.cache[a]=i)),{left:i.left,right:i.right,top:r?i.rtop:i.top,bottom:r?i.rbottom:i.bottom}}function nt(e,t,n){for(var o=0,r,a,i,s;o<e.length;o+=3){var d=e[o],l=e[o+1];if(t<d?(a=0,i=1,s="left"):t<l?(a=t-d,i=a+1):(o==e.length-3||t==l&&e[o+3]>t)&&(i=l-d,a=i-1,t>=l&&(s="right")),null!=a){if(r=e[o+2],d==l&&n==(r.insertLeft?"left":"right")&&(s=n),"left"==n&&0==a)for(;o&&e[o-2]==e[o-3]&&e[o-1].insertLeft;)r=e[(o-=3)+2],s="left";if("right"==n&&a==l-d)for(;o<e.length-3&&e[o+3]==e[o+4]&&!e[o+5].insertLeft;)r=e[(o+=3)+2],s="right";break}}return{node:r,start:a,end:i,collapse:s,coverStart:d,coverEnd:l}}function ot(e,t,n,o){var r=nt(t.map,n,o),a=r.node,s=r.start,d=r.end,l=r.collapse,p;if(3==a.nodeType){for(var c=0;4>c;c++){for(;s&&Wr(t.line.text.charAt(r.coverStart+s));)--s;for(;r.coverStart+d<r.coverEnd&&Wr(t.line.text.charAt(r.coverStart+d));)++d;if(Ta&&9>wa&&0==s&&d==r.coverEnd-r.coverStart)p=a.parentNode.getBoundingClientRect();else if(Ta&&e.options.lineWrapping){var i=$i(a,s,d).getClientRects();p=i.length?i["right"==o?i.length-1:0]:Ga}else p=$i(a,s,d).getBoundingClientRect()||Ga;if(p.left||p.right||0==s)break;d=s,--s,l="right"}Ta&&11>wa&&(p=rt(e.display.measure,p))}else{0<s&&(l=o="right");var i;p=e.options.lineWrapping&&1<(i=a.getClientRects()).length?i["right"==o?i.length-1:0]:a.getBoundingClientRect()}if(Ta&&9>wa&&!s&&(!p||!p.left&&!p.right)){var u=a.parentNode.getClientRects()[0];p=u?{left:u.left,right:u.left+vt(e.display),top:u.top,bottom:u.bottom}:Ga}for(var h=p.top-t.rect.top,m=p.bottom-t.rect.top,g=t.view.measure.heights,c=0;c<g.length-1&&!((h+m)/2<g[c]);c++);var f=c?g[c-1]:0,y=g[c],b={left:("right"==l?p.right:p.left)-t.rect.left,right:("left"==l?p.left:p.right)-t.rect.left,top:f,bottom:y};return p.left||p.right||(b.bogus=!0),e.options.singleCursorHeightPerLine||(b.rtop=h,b.rbottom=m),b}function rt(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Zr(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,o=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*o,bottom:t.bottom*o}}function at(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function it(e){e.display.externalMeasure=null,jr(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)at(e.display.view[t])}function st(e){it(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function dt(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function lt(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function pt(e,t,n,o){if(t.widgets)for(var r=0;r<t.widgets.length;++r)if(t.widgets[r].above){var a=wo(t.widgets[r]);n.top+=a,n.bottom+=a}if("line"==o)return n;o||(o="local");var i=or(t);if("local"==o?i+=je(e.display):i-=e.display.viewOffset,"page"==o||"window"==o){var s=e.display.lineSpace.getBoundingClientRect();i+=s.top+("window"==o?0:lt());var d=s.left+("window"==o?0:dt());n.left+=d,n.right+=d}return n.top+=i,n.bottom+=i,n}function ct(e,t,n){if("div"==n)return t;var o=t.left,r=t.top;if("page"==n)o-=dt(),r-=lt();else if("local"==n||!n){var a=e.display.sizer.getBoundingClientRect();o+=a.left,r+=a.top}var i=e.display.lineSpace.getBoundingClientRect();return{left:o-i.left,top:r-i.top}}function ut(e,t,n,o,r){return o||(o=Jo(e.doc,t.line)),pt(e,o,$e(e,o,t.ch,r),n)}function ht(e,t,n,o,r,a){function i(t,i){var s=tt(e,r,t,i?"right":"left",a);return i?s.left=s.right:s.right=s.left,pt(e,o,s,n)}function s(e,t){var n=d[t],o=n.level%2;return e==ta(n)&&t&&n.level<d[t-1].level?(n=d[--t],e=na(n)-(n.level%2?0:1),o=!0):e==na(n)&&t<d.length-1&&n.level<d[t+1].level&&(n=d[++t],e=ta(n)-n.level%2,o=!1),o&&e==n.to&&e>n.from?i(e-1):i(e,o)}o=o||Jo(e.doc,t.line),r||(r=et(e,o));var d=rr(o),l=t.ch;if(!d)return i(l);var p=la(d,l),c=s(l,p);return null!=us&&(c.other=s(l,us)),c}function mt(e,t){var n=0,t=ge(e.doc,t);e.options.lineWrapping||(n=vt(e.display)*t.ch);var o=Jo(e.doc,t.line),r=or(o)+je(e.display);return{left:n,right:n,top:r,bottom:r+o.height}}function gt(e,t,n,o){var r=qa(e,t);return r.xRel=o,n&&(r.outside=!0),r}function ft(e,t,n){var o=e.doc;if(n+=e.display.viewOffset,0>n)return gt(o.first,0,!0,-1);var r=nr(o,n),a=o.first+o.size-1;if(r>a)return gt(o.first+o.size-1,Jo(o,a).text.length,!0,1);0>t&&(t=0);for(var i=Jo(o,r);;){var s=yt(e,i,r,t,n),d=yo(i),l=d&&d.find(0,!0);if(d&&(s.ch>l.from.ch||s.ch==l.from.ch&&0<s.xRel))r=tr(i=l.to.line);else return s}}function yt(e,t,n,o,r){function a(o){var r=ht(e,qa(n,o),"line",t,p);return(d=!0,s>r.bottom)?r.left-l:s<r.top?r.left+l:(d=!1,r.left)}var s=r-or(t),d=!1,l=2*e.display.wrapper.clientWidth,p=et(e,t),c=rr(t),u=t.text.length,h=oa(t),m=ra(t),g=a(h),f=d,y=a(m),b=d;if(o>y)return gt(n,m,b,1);for(;;){if(c?m==h||m==ca(t,h,1):1>=m-h){for(var v=o<g||o-g<=y-o?h:m,x=o-(v==h?g:y);Wr(t.text.charAt(v));)++v;var C=gt(n,v,v==h?f:b,-1>x?-1:1<x?1:0);return C}var S=ba(u/2),E=h+S;if(c){E=h;for(var k=0;k<S;++k)E=ca(t,E,1)}var i=a(E);i>o?(m=E,y=i,(b=d)&&(y+=1e3),u=S):(h=E,g=i,f=d,u-=S)}}function bt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Za){Za=Hr("pre");for(var t=0;49>t;++t)Za.appendChild(document.createTextNode("x")),Za.appendChild(Hr("br"));Za.appendChild(document.createTextNode("x"))}qr(e.measure,Za);var n=Za.offsetHeight/50;return 3<n&&(e.cachedTextHeight=n),jr(e.measure),n||1}function vt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Hr("span","xxxxxxxxxx"),n=Hr("pre",[t]);qr(e.measure,n);var o=t.getBoundingClientRect(),r=(o.right-o.left)/10;return 2<r&&(e.cachedCharWidth=r),r||10}function xt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Qa},Xa?Xa.ops.push(e.curOp):e.curOp.ownsGroup=Xa={ops:[e.curOp],delayedCallbacks:[]}}function Ct(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var o=0,r;o<e.ops.length;o++)if(r=e.ops[o],r.cursorActivityHandlers)for(;r.cursorActivityCalled<r.cursorActivityHandlers.length;)r.cursorActivityHandlers[r.cursorActivityCalled++].call(null,r.cm)}while(n<t.length)}function St(e){var t=e.curOp,n=t.ownsGroup;if(n)try{Ct(n)}finally{Xa=null;for(var o=0;o<n.ops.length;o++)n.ops[o].cm.curOp=null;Et(n)}}function Et(e){for(var t=e.ops,n=0;n<t.length;n++)kt(t[n]);for(var n=0;n<t.length;n++)Tt(t[n]);for(var n=0;n<t.length;n++)wt(t[n]);for(var n=0;n<t.length;n++)It(t[n]);for(var n=0;n<t.length;n++)Nt(t[n])}function kt(e){var t=e.cm,n=t.display;T(t),e.updateMaxLine&&c(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new k(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Tt(e){e.updatedDisplay=e.mustUpdate&&w(e.cm,e.update)}function wt(e){var t=e.cm,n=t.display;e.updatedDisplay&&L(t),e.barMeasure=h(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$e(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=va(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ke(t)+t.display.barWidth),e.maxScrollLeft=va(0,n.sizer.offsetLeft+e.adjustWidthTo-Ge(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function It(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&rn(t,ga(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1),e.preparedSelection&&t.display.input.showSelection(e.preparedSelection),(e.updatedDisplay||e.startHeight!=t.doc.height)&&y(t,e.barMeasure),e.updatedDisplay&&A(t,e.barMeasure),e.selectionChanged&&Be(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),e.focus&&e.focus==zr()&&(!document.hasFocus||document.hasFocus())&&Q(e.cm)}function Nt(e){var t=e.cm,n=t.display,o=t.doc;if(e.updatedDisplay&&I(t,e.update),null!=n.wheelStartX&&(null!=e.scrollTop||null!=e.scrollLeft||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&(n.scroller.scrollTop!=e.scrollTop||e.forceScroll)&&(o.scrollTop=va(0,ga(n.scroller.scrollHeight-n.scroller.clientHeight,e.scrollTop)),n.scrollbars.setScrollTop(o.scrollTop),n.scroller.scrollTop=o.scrollTop),null!=e.scrollLeft&&(n.scroller.scrollLeft!=e.scrollLeft||e.forceScroll)&&(o.scrollLeft=va(0,ga(n.scroller.scrollWidth-n.scroller.clientWidth,e.scrollLeft)),n.scrollbars.setScrollLeft(o.scrollLeft),n.scroller.scrollLeft=o.scrollLeft,x(t)),e.scrollToPos){var r=_n(t,ge(o,e.scrollToPos.from),ge(o,e.scrollToPos.to),e.scrollToPos.margin);e.scrollToPos.isCursor&&t.state.focused&&Pn(t,r)}var a=e.maybeHiddenMarkers,s=e.maybeUnhiddenMarkers;if(a)for(var d=0;d<a.length;++d)a[d].lines.length||Bi(a[d],"hide");if(s)for(var d=0;d<s.length;++d)s[d].lines.length&&Bi(s[d],"unhide");n.wrapper.offsetHeight&&(o.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Bi(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function At(e,t){if(e.curOp)return t();xt(e);try{return t()}finally{St(e)}}function Lt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);xt(e);try{return t.apply(e,arguments)}finally{St(e)}}}function Rt(e){return function(){if(this.curOp)return e.apply(this,arguments);xt(this);try{return e.apply(this,arguments)}finally{St(this)}}}function Ot(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);xt(t);try{return e.apply(this,arguments)}finally{St(t)}}}function Pt(e,t,n){this.line=t,this.rest=xo(t),this.size=this.rest?tr(Or(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Eo(e,t)}function _t(e,t,n){for(var o=[],r=t,a,i;r<n;r=a)i=new Pt(e.doc,Jo(e.doc,r),r),a=r+i.size,o.push(i);return o}function Dt(e,t,n,o){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),o||(o=0);var r=e.display;if(o&&n<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>t)&&(r.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=r.viewTo)ja&&Co(e.doc,t)<r.viewTo&&Ft(e);else if(n<=r.viewFrom)ja&&So(e.doc,n+o)>r.viewFrom?Ft(e):(r.viewFrom+=o,r.viewTo+=o);else if(t<=r.viewFrom&&n>=r.viewTo)Ft(e);else if(t<=r.viewFrom){var a=Ut(e,n,n+o,1);a?(r.view=r.view.slice(a.index),r.viewFrom=a.lineN,r.viewTo+=o):Ft(e)}else if(n>=r.viewTo){var a=Ut(e,t,t,-1);a?(r.view=r.view.slice(0,a.index),r.viewTo=a.lineN):Ft(e)}else{var i=Ut(e,t,t,-1),s=Ut(e,n,n+o,1);i&&s?(r.view=r.view.slice(0,i.index).concat(_t(e,i.lineN,s.lineN)).concat(r.view.slice(s.index)),r.viewTo+=o):Ft(e)}var d=r.externalMeasured;d&&(n<d.lineN?d.lineN+=o:t<d.lineN+d.size&&(r.externalMeasured=null))}function Mt(e,t,n){e.curOp.viewChanged=!0;var o=e.display,r=e.display.externalMeasured;if(r&&t>=r.lineN&&t<r.lineN+r.size&&(o.externalMeasured=null),!(t<o.viewFrom||t>=o.viewTo)){var a=o.view[Bt(e,t)];if(null!=a.node){var i=a.changes||(a.changes=[]);-1==Pr(i,n)&&i.push(n)}}}function Ft(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var n=e.display.view,o=0;o<n.length;o++)if(t-=n[o].size,0>t)return o}function Ut(e,t,o,r){var a=Bt(e,t),s=e.display.view,d;if(!ja||o==e.doc.first+e.doc.size)return{index:a,lineN:o};for(var l=0,i=e.display.viewFrom;l<a;l++)i+=s[l].size;if(i!=t){if(0<r){if(a==s.length-1)return null;d=i+s[a].size-t,a++}else d=i-t;t+=d,o+=d}for(;Co(e.doc,o)!=o;){if(a==(0>r?0:s.length-1))return null;o+=r*s[a-(0>r?1:0)].size,a+=r}return{index:a,lineN:o}}function Vt(e,t,n){var o=e.display,r=o.view;0==r.length||t>=o.viewTo||n<=o.viewFrom?(o.view=_t(e,t,n),o.viewFrom=t):(o.viewFrom>t?o.view=_t(e,t,o.viewFrom).concat(o.view):o.viewFrom<t&&(o.view=o.view.slice(Bt(e,t))),o.viewFrom=t,o.viewTo<n?o.view=o.view.concat(_t(e,o.viewTo,n)):o.viewTo>n&&(o.view=o.view.slice(0,Bt(e,n)))),o.viewTo=n}function Wt(e){for(var t=e.display.view,n=0,o=0,r;o<t.length;o++)r=t[o],r.hidden||r.node&&!r.changes||++n;return n}function Ht(t){function n(){a.activeTouch&&(s=setTimeout(function(){a.activeTouch=null},1e3),i=a.activeTouch,i.end=+new Date)}function o(t){if(1!=t.touches.length)return!1;var e=t.touches[0];return 1>=e.radiusX&&1>=e.radiusY}function r(e,t){if(null==t.left)return!0;var n=t.left-e.left,o=t.top-e.top;return 400<n*n+o*o}var a=t.display;Mi(a.scroller,"mousedown",Lt(t,Kt)),Ta&&11>wa?Mi(a.scroller,"dblclick",Lt(t,function(n){if(!wr(t,n)){var e=zt(t,n);if(!(!e||Jt(t,n)||qt(t.display,n))){Pi(n);var o=t.findWordAt(e);xe(t.doc,o.anchor,o.head)}}})):Mi(a.scroller,"dblclick",function(n){wr(t,n)||Pi(n)}),Wa||Mi(a.scroller,"contextmenu",function(n){vn(t,n)});var i={end:0},s;Mi(a.scroller,"touchstart",function(n){if(!wr(t,n)&&!o(n)){clearTimeout(s);var e=+new Date;a.activeTouch={start:e,moved:!1,prev:300>=e-i.end?i:null},1==n.touches.length&&(a.activeTouch.left=n.touches[0].pageX,a.activeTouch.top=n.touches[0].pageY)}}),Mi(a.scroller,"touchmove",function(){a.activeTouch&&(a.activeTouch.moved=!0)}),Mi(a.scroller,"touchend",function(o){var e=a.activeTouch;if(e&&!qt(a,o)&&null!=e.left&&!e.moved&&300>new Date-e.start){var i=t.coordsChar(a.activeTouch,"page"),s;s=!e.prev||r(e,e.prev)?new ce(i,i):!e.prev.prev||r(e,e.prev.prev)?t.findWordAt(i):new ce(qa(i.line,0),ge(t.doc,qa(i.line+1,0))),t.setSelection(s.anchor,s.head),t.focus(),Pi(o)}n()}),Mi(a.scroller,"touchcancel",n),Mi(a.scroller,"scroll",function(){a.scroller.clientHeight&&(nn(t,a.scroller.scrollTop),rn(t,a.scroller.scrollLeft,!0),Bi(t,"scroll",t))}),Mi(a.scroller,"mousewheel",function(n){an(t,n)}),Mi(a.scroller,"DOMMouseScroll",function(n){an(t,n)}),Mi(a.wrapper,"scroll",function(){a.wrapper.scrollTop=a.wrapper.scrollLeft=0}),a.dragFunctions={enter:function(n){wr(t,n)||Di(n)},over:function(n){wr(t,n)||(en(t,n),Di(n))},start:function(n){Zt(t,n)},drop:Lt(t,$t),leave:function(n){wr(t,n)||tn(t)}};var e=a.input.getField();Mi(e,"keyup",function(n){mn.call(t,n)}),Mi(e,"keydown",Lt(t,un)),Mi(e,"keypress",Lt(t,gn)),Mi(e,"focus",Br(yn,t)),Mi(e,"blur",Br(bn,t))}function jt(e){var t=e.display;t.lastWrapHeight==t.wrapper.clientHeight&&t.lastWrapWidth==t.wrapper.clientWidth||(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function qt(t,o){for(var e=Cr(o);e!=t.wrapper;e=e.parentNode)if(!e||1==e.nodeType&&"true"==e.getAttribute("cm-ignore-events")||e.parentNode==t.sizer&&e!=t.mover)return!0}function zt(t,n,e,o){var r=t.display;if(!e&&"true"==Cr(n).getAttribute("cm-not-content"))return null;var a=r.lineSpace.getBoundingClientRect(),i,s;try{i=n.clientX-a.left,s=n.clientY-a.top}catch(t){return null}var d=ft(t,i,s),l;if(o&&1==d.xRel&&(l=Jo(t.doc,d.line).text).length==d.ch){var p=zi(l,l.length,t.options.tabSize)-l.length;d=qa(d.line,va(0,ya((i-ze(t.display).left)/vt(t.display))-p))}return d}function Kt(t){var e=this,n=e.display;if(!(wr(e,t)||n.activeTouch&&n.input.supportsTouch())){if(n.shift=t.shiftKey,qt(n,t))return void(Ia||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100)));if(!Jt(e,t)){var o=zt(e,t);switch(window.focus(),Sr(t)){case 1:e.state.selectingText?e.state.selectingText(t):o?Gt(e,t,o):Cr(t)==n.scroller&&Pi(t);break;case 2:Ia&&(e.state.lastMiddleDown=+new Date),o&&xe(e.doc,o),setTimeout(function(){n.input.focus()},20),Pi(t);break;case 3:Wa?vn(e,t):fn(e);}}}}function Gt(t,n,e){Ta?setTimeout(Br(Q,t),0):t.curOp.focus=zr();var o=+new Date,r;ti&&ti.time>o-400&&0==za(ti.pos,e)?r="triple":ei&&ei.time>o-400&&0==za(ei.pos,e)?(r="double",ti={time:o,pos:e}):(r="single",ei={time:o,pos:e});var a=t.doc.sel,i=Ma?n.metaKey:n.ctrlKey,s;t.options.dragDrop&&os&&!t.isReadOnly()&&"single"==r&&-1<(s=a.contains(e))&&(0>za((s=a.ranges[s]).from(),e)||0<e.xRel)&&(0<za(s.to(),e)||0>e.xRel)?Xt(t,n,e,i):Qt(t,n,e,r,i)}function Xt(t,n,e,o){var r=t.display,a=+new Date,i=Lt(t,function(s){Ia&&(r.scroller.draggable=!1),t.state.draggingText=!1,Fi(document,"mouseup",i),Fi(r.scroller,"drop",i),10>ha(n.clientX-s.clientX)+ha(n.clientY-s.clientY)&&(Pi(s),!o&&+new Date-200<a&&xe(t.doc,e),Ia||Ta&&9==wa?setTimeout(function(){document.body.focus(),r.input.focus()},20):r.input.focus())});Ia&&(r.scroller.draggable=!0),t.state.draggingText=i,r.scroller.dragDrop&&r.scroller.dragDrop(),Mi(document,"mouseup",i),Mi(r.scroller,"drop",i)}function Qt(t,n,e,o,r){function a(n){if(0!=za(f,n))if(f=n,"rect"==o){for(var r=[],a=t.options.tabSize,i=zi(Jo(l,e.line).text,e.ch,a),s=zi(Jo(l,n.line).text,n.ch,a),d=ga(i,s),c=va(i,s),m=ga(e.line,n.line),g=ga(t.lastLine(),va(e.line,n.line));m<=g;m++){var y=Jo(l,m).text,b=Ki(y,d,a);d==c?r.push(new ce(qa(m,b),qa(m,b))):y.length>b&&r.push(new ce(qa(m,b),qa(m,Ki(y,c,a))))}r.length||r.push(new ce(e,e)),we(l,ue(p.ranges.slice(0,h).concat(r),h),{origin:"*mouse",scroll:!1}),t.scrollIntoView(n)}else{var v=u,x=v.anchor,C=n;if("single"!=o){if("double"==o)var S=t.findWordAt(n);else var S=new ce(qa(n.line,0),ge(l,qa(n.line+1,0)));0<za(S.anchor,x)?(C=S.head,x=X(v.from(),S.anchor)):(C=S.anchor,x=G(v.to(),S.head))}var r=p.ranges.slice(0);r[h]=new ce(ge(l,x),C),we(l,ue(r,h),ji)}}function i(n){var e=++b,r=zt(t,n,!0,"rect"==o);if(r)if(0!=za(r,f)){t.curOp.focus=zr(),a(r);var s=v(d,l);(r.line>=s.to||r.line<s.from)&&setTimeout(Lt(t,function(){b==e&&i(n)}),150)}else{var p=n.clientY<y.top?-20:n.clientY>y.bottom?20:0;p&&setTimeout(Lt(t,function(){b!=e||(d.scroller.scrollTop+=p,i(n))}),50)}}function s(n){t.state.selectingText=!1,b=Infinity,Pi(n),d.input.focus(),Fi(document,"mousemove",x),Fi(document,"mouseup",C),l.history.lastSelOrigin=null}var d=t.display,l=t.doc;Pi(n);var p=l.sel,c=p.ranges,u,h;if(r&&!n.shiftKey?(h=l.sel.contains(e),u=-1<h?c[h]:new ce(e,e)):(u=l.sel.primary(),h=l.sel.primIndex),Fa?n.shiftKey&&n.metaKey:n.altKey)o="rect",r||(u=new ce(e,e)),e=zt(t,n,!0,!0),h=-1;else if("double"==o){var m=t.findWordAt(e);u=t.display.shift||l.extend?ve(l,u,m.anchor,m.head):m}else if("triple"==o){var g=new ce(qa(e.line,0),ge(l,qa(e.line+1,0)));u=t.display.shift||l.extend?ve(l,u,g.anchor,g.head):g}else u=ve(l,u,e);r?-1==h?(h=c.length,we(l,ue(c.concat([u]),h),{scroll:!1,origin:"*mouse"})):1<c.length&&c[h].empty()&&"single"==o&&!n.shiftKey?(we(l,ue(c.slice(0,h).concat(c.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),p=l.sel):Se(l,h,u,ji):(h=0,we(l,new pe([u],0),ji),p=l.sel);var f=e,y=d.wrapper.getBoundingClientRect(),b=0,x=Lt(t,function(t){Sr(t)?i(t):s(t)}),C=Lt(t,s);t.state.selectingText=C,Mi(document,"mousemove",x),Mi(document,"mouseup",C)}function Yt(t,n,e,o){try{var r=n.clientX,a=n.clientY}catch(t){return!1}if(r>=fa(t.display.gutters.getBoundingClientRect().right))return!1;o&&Pi(n);var s=t.display,d=s.lineDiv.getBoundingClientRect();if(a>d.bottom||!Nr(t,e))return xr(n);a-=d.top-s.viewOffset;for(var l=0,i;l<t.options.gutters.length;++l)if(i=s.gutters.childNodes[l],i&&i.getBoundingClientRect().right>=r){var p=nr(t.doc,a),c=t.options.gutters[l];return Bi(t,e,t,p,c,n),xr(n)}}function Jt(t,n){return Yt(t,n,"gutterClick",!0)}function $t(t){var e=this;if(tn(e),!(wr(e,t)||qt(e.display,t))){Pi(t),Ta&&(Ya=+new Date);var o=zt(e,t,!0),r=t.dataTransfer.files;if(o&&!e.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var a=r.length,n=Array(a),s=0,d=function(t,r){if(!(e.options.allowDropFileTypes&&-1==Pr(e.options.allowDropFileTypes,t.type))){var i=new FileReader;i.onload=Lt(e,function(){var t=i.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(t)&&(t=""),n[r]=t,++s==a){o=ge(e.doc,o);var d={from:o,to:o,text:e.doc.splitLines(n.join(e.doc.lineSeparator())),origin:"paste"};wn(e.doc,d),Te(e.doc,he(o,ai(d)))}}),i.readAsText(t)}},l=0;l<a;++l)d(r[l],l);else{if(e.state.draggingText&&-1<e.doc.sel.contains(o))return e.state.draggingText(t),void setTimeout(function(){e.display.input.focus()},20);try{var n=t.dataTransfer.getData("Text");if(n){if(e.state.draggingText&&(Ma?!t.altKey:!t.ctrlKey))var i=e.listSelections();if(Ie(e.doc,he(o,o)),i)for(var l=0;l<i.length;++l)On(e.doc,"",i[l].anchor,i[l].head,"drag");e.replaceSelection(n,"around","paste"),e.display.input.focus()}}catch(t){}}}}function Zt(t,n){if(Ta&&(!t.state.draggingText||100>+new Date-Ya))return void Di(n);if(!(wr(t,n)||qt(t.display,n))&&(n.dataTransfer.setData("Text",t.getSelection()),n.dataTransfer.effectAllowed="copyMove",n.dataTransfer.setDragImage&&!Ra)){var e=Hr("img",null,null,"position: fixed; left: 0; top: 0;");e.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",La&&(e.width=e.height=1,t.display.wrapper.appendChild(e),e._top=e.offsetTop),n.dataTransfer.setDragImage(e,0,0),La&&e.parentNode.removeChild(e)}}function en(t,n){var e=zt(t,n);if(e){var o=document.createDocumentFragment();Me(t,e,o),t.display.dragCursor||(t.display.dragCursor=Hr("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),qr(t.display.dragCursor,o)}}function tn(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function nn(e,t){2>ha(e.doc.scrollTop-t)||(e.doc.scrollTop=t,!Sa&&N(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbars.setScrollTop(t),Sa&&N(e),Ue(e,100))}function rn(e,t,n){(n?t==e.doc.scrollLeft:2>ha(e.doc.scrollLeft-t))||(t=ga(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,x(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function an(t,n){var e=ni(n),o=e.x,r=e.y,a=t.display,s=a.scroller,d=s.scrollWidth>s.clientWidth,l=s.scrollHeight>s.clientHeight;if(o&&d||r&&l){if(r&&Ma&&Ia)outer:for(var p=n.target,c=a.view;p!=s;p=p.parentNode)for(var u=0;u<c.length;u++)if(c[u].node==p){t.display.currentWheelTarget=p;break outer}if(o&&!Sa&&!La&&null!=$a)return r&&l&&nn(t,va(0,ga(s.scrollTop+r*$a,s.scrollHeight-s.clientHeight))),rn(t,va(0,ga(s.scrollLeft+o*$a,s.scrollWidth-s.clientWidth))),(!r||r&&l)&&Pi(n),void(a.wheelStartX=null);if(r&&null!=$a){var i=r*$a,h=t.doc.scrollTop,m=h+a.wrapper.clientHeight;0>i?h=va(0,h+i-50):m=ga(t.doc.height,m+i+50),N(t,{top:h,bottom:m})}20>Ja&&(null==a.wheelStartX?(a.wheelStartX=s.scrollLeft,a.wheelStartY=s.scrollTop,a.wheelDX=o,a.wheelDY=r,setTimeout(function(){if(null!=a.wheelStartX){var e=s.scrollLeft-a.wheelStartX,t=s.scrollTop-a.wheelStartY,n=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX;a.wheelStartX=a.wheelStartY=null,n&&($a=($a*Ja+n)/(Ja+1),++Ja)}},200)):(a.wheelDX+=o,a.wheelDY+=r))}}function sn(e,t,n){if("string"==typeof t&&(t=fi[t],!t))return!1;e.display.input.ensurePolled();var o=e.display.shift,r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),r=t(e)!=Wi}finally{e.display.shift=o,e.state.suppressEdits=!1}return r}function dn(e,t,n){for(var o=0,r;o<e.state.keyMaps.length;o++)if(r=bi(t,e.state.keyMaps[o],n,e),r)return r;return e.options.extraKeys&&bi(t,e.options.extraKeys,n,e)||bi(t,e.options.keyMap,n,e)}function ln(t,n,o,e){var r=t.state.keySeq;if(r){if(vi(n))return"handled";oi.set(50,function(){t.state.keySeq==r&&(t.state.keySeq=null,t.display.input.reset())}),n=r+" "+n}var a=dn(t,n,e);return"multi"==a&&(t.state.keySeq=n),"handled"==a&&kr(t,"keyHandled",t,n,o),("handled"==a||"multi"==a)&&(Pi(o),Be(t)),r&&!a&&/\'$/.test(n)?(Pi(o),!0):!!a}function pn(t,n){var e=xi(n,!0);return!!e&&(n.shiftKey&&!t.state.keySeq?ln(t,"Shift-"+e,n,function(e){return sn(t,e,!0)})||ln(t,e,n,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return sn(t,e)}):ln(t,e,n,function(e){return sn(t,e)}))}function cn(t,n,e){return ln(t,"'"+e+"'",n,function(e){return sn(t,e,!0)})}function un(t){var e=this;if(e.curOp.focus=zr(),!wr(e,t)){Ta&&11>wa&&27==t.keyCode&&(t.returnValue=!1);var n=t.keyCode;e.display.shift=16==n||t.shiftKey;var o=pn(e,t);La&&(ri=o?n:null,!o&&88==n&&!is&&(Ma?t.metaKey:t.ctrlKey)&&e.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||hn(e)}}function hn(e){function t(o){18!=o.keyCode&&o.altKey||(es(n,"CodeMirror-crosshair"),Fi(document,"keyup",t),Fi(document,"mouseover",t))}var n=e.display.lineDiv;ts(n,"CodeMirror-crosshair"),Mi(document,"keyup",t),Mi(document,"mouseover",t)}function mn(t){16==t.keyCode&&(this.doc.sel.shift=!1),wr(this,t)}function gn(t){var e=this;if(!(qt(e.display,t)||wr(e,t)||t.ctrlKey&&!t.altKey||Ma&&t.metaKey)){var n=t.keyCode,o=t.charCode;if(La&&n==ri)return ri=null,void Pi(t);if(!(La&&(!t.which||10>t.which)&&pn(e,t))){var r=ma(null==o?n:o);cn(e,t,r)||e.display.input.onKeyPress(t)}}}function fn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,bn(e))},100)}function yn(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"==e.options.readOnly||(!e.state.focused&&(Bi(e,"focus",e),e.state.focused=!0,ts(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),Ia&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Be(e))}function bn(e){e.state.delayingBlurEvent||(e.state.focused&&(Bi(e,"blur",e),e.state.focused=!1,es(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function vn(t,n){qt(t.display,n)||xn(t,n)||wr(t,n,"contextmenu")||t.display.input.onContextMenu(n)}function xn(t,n){return!!Nr(t,"gutterContextMenu")&&Yt(t,n,"gutterContextMenu",!1)}function Cn(e,t){if(0>za(e,t.from))return e;if(0>=za(e,t.to))return ai(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,o=e.ch;return e.line==t.to.line&&(o+=ai(t).ch-t.to.ch),qa(n,o)}function Sn(e,t){for(var n=[],o=0,r;o<e.sel.ranges.length;o++)r=e.sel.ranges[o],n.push(new ce(Cn(r.anchor,t),Cn(r.head,t)));return ue(n,e.sel.primIndex)}function En(e,t,n){return e.line==t.line?qa(n.line,e.ch-t.ch+n.ch):qa(n.line+(e.line-t.line),e.ch)}function kn(e,t,n){for(var o=[],r=qa(e.first,0),a=r,s=0;s<t.length;s++){var i=t[s],d=En(i.from,r,a),l=En(ai(i),r,a);if(r=i.to,a=l,"around"==n){var p=e.sel.ranges[s],c=0>za(p.head,p.anchor);o[s]=new ce(c?l:d,c?d:l)}else o[s]=new ce(d,d)}return new pe(o,e.sel.primIndex)}function Tn(e,t,n){var o={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return n&&(o.update=function(t,n,o,r){t&&(this.from=ge(e,t)),n&&(this.to=ge(e,n)),o&&(this.text=o),void 0!==r&&(this.origin=r)}),Bi(e,"beforeChange",e,o),e.cm&&Bi(e.cm,"beforeChange",e.cm,o),o.canceled?null:{from:o.from,to:o.to,text:o.text,origin:o.origin}}function wn(e,t,n){if(e.cm){if(!e.cm.curOp)return Lt(e.cm,wn)(e,t,n);if(e.cm.state.suppressEdits)return}if(!((Nr(e,"beforeChange")||e.cm&&Nr(e.cm,"beforeChange"))&&(t=Tn(e,t,!0),!t))){var o=Ha&&!n&&lo(e,t.from,t.to);if(o)for(var r=o.length-1;0<=r;--r)In(e,{from:o[r].from,to:o[r].to,text:r?[""]:t.text});else In(e,t)}}function In(e,t){if(1!=t.text.length||""!=t.text[0]||0!=za(t.from,t.to)){var n=Sn(e,t);lr(e,t,n,e.cm?e.cm.curOp.id:NaN),Ln(e,t,n,ao(e,t));var o=[];Qo(e,function(e,n){n||-1!=Pr(o,e.history)||(vr(e.history,t),o.push(e.history)),Ln(e,t,null,ao(e,t))})}}function Nn(e,t,n){if(!(e.cm&&e.cm.state.suppressEdits)){for(var o=e.history,r=e.sel,a="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,d=0,l;d<a.length&&(l=a[d],n?!l.ranges||l.equals(e.sel):!!l.ranges);d++);if(d!=a.length){for(o.lastOrigin=o.lastSelOrigin=null;;)if(l=a.pop(),l.ranges){if(ur(l,s),n&&!l.equals(e.sel))return void we(e,l,{clearRedo:!1});r=l}else break;var p=[];ur(r,s),s.push({changes:p,generation:o.generation}),o.generation=l.generation||++o.maxGeneration;for(var c=Nr(e,"beforeChange")||e.cm&&Nr(e.cm,"beforeChange"),d=l.changes.length-1,u;0<=d;--d){if(u=l.changes[d],u.origin=t,c&&!Tn(e,u,!1))return void(a.length=0);p.push(ir(e,u));var h=d?Sn(e,u):Or(a);Ln(e,u,h,so(e,u)),!d&&e.cm&&e.cm.scrollIntoView({from:u.from,to:ai(u)});var m=[];Qo(e,function(e,t){t||-1!=Pr(m,e.history)||(vr(e.history,u),m.push(e.history)),Ln(e,u,null,so(e,u))})}}}}function An(e,t){if(0!=t&&(e.first+=t,e.sel=new pe(_r(e.sel.ranges,function(e){return new ce(qa(e.anchor.line+t,e.anchor.ch),qa(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Dt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,o=n.viewFrom;o<n.viewTo;o++)Mt(e.cm,o,"gutter")}}function Ln(e,t,n,o){if(e.cm&&!e.cm.curOp)return Lt(e.cm,Ln)(e,t,n,o);if(t.to.line<e.first)return void An(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var r=t.text.length-1-(e.first-t.from.line);An(e,r),t={from:qa(e.first,0),to:qa(t.to.line+r,t.to.ch),text:[Or(t.text)],origin:t.origin}}var a=e.lastLine();t.to.line>a&&(t={from:t.from,to:qa(a,Jo(e,a).text.length),text:[t.text[0]],origin:t.origin}),t.removed=$o(e,t.from,t.to),n||(n=Sn(e,t)),e.cm?Rn(e.cm,t,o):Ko(e,t,o),Ie(e,n,Hi)}}function Rn(e,t,n){var o=e.doc,a=e.display,i=t.from,s=t.to,d=!1,l=i.line;e.options.lineWrapping||(l=tr(vo(Jo(o,i.line))),o.iter(l,s.line+1,function(e){if(e==a.maxLine)return d=!0,!0})),-1<o.sel.contains(t.from,t.to)&&Ir(e),Ko(o,t,n,r(e)),e.options.lineWrapping||(o.iter(l,i.line+t.text.length,function(e){var t=p(e);t>a.maxLineLength&&(a.maxLine=e,a.maxLineLength=t,a.maxLineChanged=!0,d=!1)}),d&&(e.curOp.updateMaxLine=!0)),o.frontier=ga(o.frontier,i.line),Ue(e,400);var c=t.text.length-(s.line-i.line)-1;t.full?Dt(e):i.line!=s.line||1!=t.text.length||zo(e.doc,t)?Dt(e,i.line,s.line+1,c):Mt(e,i.line,"text");var u=Nr(e,"changes"),h=Nr(e,"change");if(h||u){var m={from:i,to:s,text:t.text,removed:t.removed,origin:t.origin};h&&kr(e,"change",e,m),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(m)}e.display.selForContextMenu=null}function On(e,t,n,o,r){if(o||(o=n),0>za(o,n)){var a=o;o=n,n=a}"string"==typeof t&&(t=e.splitLines(t)),wn(e,{from:n,to:o,text:t,origin:r})}function Pn(e,t){if(!wr(e,"scrollCursorIntoView")){var n=e.display,o=n.sizer.getBoundingClientRect(),r=null;if(0>t.top+o.top?r=!0:t.bottom+o.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),null!=r&&!Pa){var a=Hr("div","\u200B",null,"position: absolute; top: "+(t.top-n.viewOffset-je(e.display))+"px; height: "+(t.bottom-t.top+Ke(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(a),a.scrollIntoView(r),e.display.lineSpace.removeChild(a)}}}function _n(e,t,n,o){null==o&&(o=0);for(var r=0;5>r;r++){var a=!1,i=ht(e,t),s=n&&n!=t?ht(e,n):i,d=Mn(e,ga(i.left,s.left),ga(i.top,s.top)-o,va(i.left,s.left),va(i.bottom,s.bottom)+o),l=e.doc.scrollTop,p=e.doc.scrollLeft;if(null!=d.scrollTop&&(nn(e,d.scrollTop),1<ha(e.doc.scrollTop-l)&&(a=!0)),null!=d.scrollLeft&&(rn(e,d.scrollLeft),1<ha(e.doc.scrollLeft-p)&&(a=!0)),!a)break}return i}function Dn(e,t,n,o,r){var a=Mn(e,t,n,o,r);null!=a.scrollTop&&nn(e,a.scrollTop),null!=a.scrollLeft&&rn(e,a.scrollLeft)}function Mn(e,t,n,o,r){var a=e.display,i=bt(e.display);0>n&&(n=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:a.scroller.scrollTop,d=Xe(e),l={};r-n>d&&(r=n+d);var p=e.doc.height+qe(a),c=n<i,u=r>p-i;if(n<s)l.scrollTop=c?0:n;else if(r>s+d){var h=ga(n,(u?p:r)-d);h!=s&&(l.scrollTop=h)}var m=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:a.scroller.scrollLeft,g=Ge(e)-(e.options.fixedGutter?a.gutters.offsetWidth:0),f=o-t>g;return f&&(o=t+g),10>t?l.scrollLeft=0:t<m?l.scrollLeft=va(0,t-(f?0:10)):o>g+m-3&&(l.scrollLeft=o+(f?0:10)-g),l}function Fn(e,t,n){(null!=t||null!=n)&&Un(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=n&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+n)}function Bn(e){Un(e);var t=e.getCursor(),n=t,o=t;e.options.lineWrapping||(n=t.ch?qa(t.line,t.ch-1):t,o=qa(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:o,margin:e.options.cursorScrollMargin,isCursor:!0}}function Un(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=mt(e,t.from),o=mt(e,t.to),r=Mn(e,ga(n.left,o.left),ga(n.top,o.top)-t.margin,va(n.right,o.right),va(n.bottom,o.bottom)+t.margin);e.scrollTo(r.scrollLeft,r.scrollTop)}}function Vn(e,t,n,o){var r=e.doc,a;null==n&&(n="add"),"smart"==n&&(r.mode.indent?a=He(e,t):n="prev");var s=e.options.tabSize,d=Jo(r,t),l=zi(d.text,null,s);d.stateAfter&&(d.stateAfter=null);var p=d.text.match(/^\s*/)[0],c;if(!o&&!/\S/.test(d.text))c=0,n="not";else if("smart"==n&&(c=r.mode.indent(a,d.text.slice(p.length),d.text),c==Wi||150<c)){if(!o)return;n="prev"}"prev"==n?t>r.first?c=zi(Jo(r,t-1).text,null,s):c=0:"add"==n?c=l+e.options.indentUnit:"subtract"==n?c=l-e.options.indentUnit:"number"==typeof n&&(c=l+n),c=va(0,c);var u="",h=0;if(e.options.indentWithTabs)for(var m=fa(c/s);m;--m)h+=s,u+="\t";if(h<c&&(u+=Rr(c-h)),u!=p)return On(r,u,qa(t,0),qa(t,p.length),"+input"),d.stateAfter=null,!0;for(var m=0,i;m<r.sel.ranges.length;m++)if(i=r.sel.ranges[m],i.head.line==t&&i.head.ch<p.length){var h=qa(t,p.length);Se(r,m,new ce(h,h));break}}function Wn(e,t,n,o){var r=t,a=t;return("number"==typeof t?a=Jo(e,me(e,t)):r=tr(t),null==r)?null:(o(a,r)&&e.cm&&Mt(e.cm,r,n),a)}function Hn(e,t){for(var n=e.doc.sel.ranges,o=[],r=0,a;r<n.length;r++){for(a=t(n[r]);o.length&&0>=za(a.from,Or(o).to);){var i=o.pop();if(0>za(i.from,a.from)){a.from=i.from;break}}o.push(a)}At(e,function(){for(var t=o.length-1;0<=t;t--)On(e.doc,"",o[t].from,o[t].to,"+delete");Bn(e)})}function jn(e,t,n,o,r){function a(){var t=s+n;return t<e.first||t>=e.first+e.size?!1:(s=t,p=Jo(e,t))}function i(e){var t=(r?ca:ua)(p,d,n,!0);if(null!=t)d=t;else if(!e&&a())d=r?(0>n?ra:oa)(p):0>n?p.text.length:0;else return!1;return!0}var s=t.line,d=t.ch,l=n,p=Jo(e,s);if("char"==o)i();else if("column"==o)i(!0);else if("word"==o||"group"==o)for(var c=null,u="group"==o,h=e.cm&&e.cm.getHelper(t,"wordChars"),m=!0;;m=!1){if(0>n&&!i(!m))break;var g=p.text.charAt(d)||"\n",f=Ur(g,h)?"w":u&&"\n"==g?"n":!u||/\s/.test(g)?null:"p";if(!u||m||f||(f="s"),c&&c!=f){0>n&&(n=1,i());break}if(f&&(c=f),0<n&&!i(!m))break}var y=Oe(e,qa(s,d),t,l,!0);return za(t,y)||(y.hitSide=!0),y}function qn(e,t,n,o){var r=e.doc,a=t.left,i;if("page"==o){var s=ga(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+n*(s-(0>n?1.5:.5)*bt(e.display))}else"line"==o&&(i=0<n?t.bottom+3:t.top-3);for(;;){var d=ft(e,a,i);if(!d.outside)break;if(0>n?0>=i:i>=r.height){d.hitSide=!0;break}i+=5*n}return d}function zn(t,n,o,r){e.defaults[t]=n,o&&(si[t]=r?function(e,t,n){n!=di&&o(e,t,n)}:o)}function Kn(e){for(var t=e.split(/-(?!$)/),e=t[t.length-1],n=0,o,r,a,i,s;n<t.length-1;n++)if(s=t[n],/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))o=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else if(/^s(hift)$/i.test(s))a=!0;else throw new Error("Unrecognized modifier name: "+s);return o&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),a&&(e="Shift-"+e),e}function Gn(e){return"string"==typeof e?yi[e]:e}function Xn(e,t,n,o,r){if(o&&o.shared)return Qn(e,t,n,o,r);if(e.cm&&!e.cm.curOp)return Lt(e.cm,Xn)(e,t,n,o,r);var a=new Ei(e,r),s=za(t,n);if(o&&Fr(o,a,!1),0<s||0==s&&!1!==a.clearWhenEmpty)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=Hr("span",[a.replacedWith],"CodeMirror-widget"),!o.handleMouseEvents&&a.widgetNode.setAttribute("cm-ignore-events","true"),o.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if(bo(e,t.line,t,n,a)||t.line!=n.line&&bo(e,n.line,t,n,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");ja=!0}a.addToHistory&&lr(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var d=t.line,l=e.cm,p;if(e.iter(d,n.line+1,function(e){l&&a.collapsed&&!l.options.lineWrapping&&vo(e)==l.display.maxLine&&(p=!0),a.collapsed&&d!=t.line&&er(e,0),no(e,new Zn(a,d==t.line?t.ch:null,d==n.line?n.ch:null)),++d}),a.collapsed&&e.iter(t.line,n.line+1,function(t){Eo(e,t)&&er(t,0)}),a.clearOnEnter&&Mi(a,"beforeCursorEnter",function(){a.clear()}),a.readOnly&&(Ha=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),a.collapsed&&(a.id=++Si,a.atomic=!0),l){if(p&&(l.curOp.updateMaxLine=!0),a.collapsed)Dt(l,t.line,n.line+1);else if(a.className||a.title||a.startStyle||a.endStyle||a.css)for(var c=t.line;c<=n.line;c++)Mt(l,c,"text");a.atomic&&Ae(l.doc),kr(l,"markerAdded",l,a)}return a}function Qn(e,t,n,o,r){o=Fr(o),o.shared=!1;var a=[Xn(e,t,n,o,r)],s=a[0],d=o.widgetNode;return Qo(e,function(e){d&&(o.widgetNode=d.cloneNode(!0)),a.push(Xn(e,ge(e,t),ge(e,n),o,r));for(var l=0;l<e.linked.length;++l)if(e.linked[l].isParent)return;s=Or(a)}),new ki(a,s)}function Yn(e){return e.findMarks(qa(e.first,0),e.clipPos(qa(e.lastLine())),function(e){return e.parent})}function Jn(e,t){for(var n=0;n<t.length;n++){var o=t[n],r=o.find(),a=e.clipPos(r.from),i=e.clipPos(r.to);if(za(a,i)){var s=Xn(e,a,i,o.primary,o.primary.type);o.markers.push(s),s.parent=o}}}function $n(e){for(var t=0;t<e.length;t++){var n=e[t],o=[n.primary.doc];Qo(n.primary.doc,function(e){o.push(e)});for(var r=0,a;r<n.markers.length;r++)a=n.markers[r],-1==Pr(o,a.doc)&&(a.parent=null,n.markers.splice(r--,1))}}function Zn(e,t,n){this.marker=e,this.from=t,this.to=n}function eo(e,t){if(e)for(var n=0,o;n<e.length;++n)if(o=e[n],o.marker==t)return o}function to(e,t){for(var n=0,o;n<e.length;++n)e[n]!=t&&(o||(o=[])).push(e[n]);return o}function no(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function oo(e,t,n){if(e)for(var o=0,r;o<e.length;++o){var a=e[o],i=a.marker,s=null==a.from||(i.inclusiveLeft?a.from<=t:a.from<t);if(s||a.from==t&&"bookmark"==i.type&&(!n||!a.marker.insertLeft)){var d=null==a.to||(i.inclusiveRight?a.to>=t:a.to>t);(r||(r=[])).push(new Zn(i,a.from,d?null:a.to))}}return r}function ro(e,t,n){if(e)for(var o=0,r;o<e.length;++o){var a=e[o],i=a.marker,s=null==a.to||(i.inclusiveRight?a.to>=t:a.to>t);if(s||a.from==t&&"bookmark"==i.type&&(!n||a.marker.insertLeft)){var d=null==a.from||(i.inclusiveLeft?a.from<=t:a.from<t);(r||(r=[])).push(new Zn(i,d?null:a.from-t,null==a.to?null:a.to-t))}}return r}function ao(e,t){if(t.full)return null;var n=ye(e,t.from.line)&&Jo(e,t.from.line).markedSpans,o=ye(e,t.to.line)&&Jo(e,t.to.line).markedSpans;if(!n&&!o)return null;var r=t.from.ch,a=t.to.ch,s=0==za(t.from,t.to),d=oo(n,r,s),l=ro(o,a,s),p=1==t.text.length,c=Or(t.text).length+(p?r:0);if(d)for(var u=0,i;u<d.length;++u)if(i=d[u],null==i.to){var h=eo(l,i.marker);h?p&&(i.to=null==h.to?null:h.to+c):i.to=r}if(l)for(var u=0,i;u<l.length;++u)if(i=l[u],null!=i.to&&(i.to+=c),null==i.from){var h=eo(d,i.marker);h||(i.from=c,p&&(d||(d=[])).push(i))}else i.from+=c,p&&(d||(d=[])).push(i);d&&(d=io(d)),l&&l!=d&&(l=io(l));var m=[d];if(!p){var g=t.text.length-2,f;if(0<g&&d)for(var u=0;u<d.length;++u)null==d[u].to&&(f||(f=[])).push(new Zn(d[u].marker,null,null));for(var u=0;u<g;++u)m.push(f);m.push(l)}return m}function io(e){for(var t=0,n;t<e.length;++t)n=e[t],null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1);return e.length?e:null}function so(e,t){var n=gr(e,t),o=ao(e,t);if(!n)return o;if(!o)return n;for(var r=0;r<n.length;++r){var a=n[r],i=o[r];if(a&&i)spans:for(var s=0,d;s<i.length;++s){d=i[s];for(var l=0;l<a.length;++l)if(a[l].marker==d.marker)continue spans;a.push(d)}else i&&(n[r]=i)}return n}function lo(e,t,n){var o=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0,n;t<e.markedSpans.length;++t)n=e.markedSpans[t].marker,n.readOnly&&(!o||-1==Pr(o,n))&&(o||(o=[])).push(n)}),!o)return null;for(var r=[{from:t,to:n}],a=0;a<o.length;++a)for(var i=o[a],s=i.find(0),d=0,l;d<r.length;++d)if(l=r[d],!(0>za(l.to,s.from)||0<za(l.from,s.to))){var p=[d,1],c=za(l.from,s.from),u=za(l.to,s.to);!(0>c)&&(i.inclusiveLeft||c)||p.push({from:l.from,to:s.from}),!(0<u)&&(i.inclusiveRight||u)||p.push({from:s.to,to:l.to}),r.splice.apply(r,p),d+=p.length-1}return r}function po(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function co(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function uo(e){return e.inclusiveLeft?-1:0}function ho(e){return e.inclusiveRight?1:0}function mo(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var o=e.find(),r=t.find(),a=za(o.from,r.from)||uo(e)-uo(t);if(a)return-a;var i=za(o.to,r.to)||ho(e)-ho(t);return i?i:t.id-e.id}function go(e,t){var n=ja&&e.markedSpans,o;if(n)for(var r=0,a;r<n.length;++r)a=n[r],a.marker.collapsed&&null==(t?a.from:a.to)&&(!o||0>mo(o,a.marker))&&(o=a.marker);return o}function fo(e){return go(e,!0)}function yo(e){return go(e,!1)}function bo(e,t,n,o,r){var a=Jo(e,t),s=ja&&a.markedSpans;if(s)for(var d=0,i;d<s.length;++d)if(i=s[d],i.marker.collapsed){var l=i.marker.find(0),p=za(l.from,n)||uo(i.marker)-uo(r),c=za(l.to,o)||ho(i.marker)-ho(r);if(!(0<=p&&0>=c||0>=p&&0<=c)&&(0>=p&&(0<za(l.to,n)||i.marker.inclusiveRight&&r.inclusiveLeft)||0<=p&&(0>za(l.from,o)||i.marker.inclusiveLeft&&r.inclusiveRight)))return!0}}function vo(e){for(var t;t=fo(e);)e=t.find(-1,!0).line;return e}function xo(e){for(var t,n;t=yo(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Co(e,t){var n=Jo(e,t),o=vo(n);return n==o?t:tr(o)}function So(e,t){if(t>e.lastLine())return t;var n=Jo(e,t),o;if(!Eo(e,n))return t;for(;o=yo(n);)n=o.find(1,!0).line;return tr(n)+1}function Eo(e,t){var n=ja&&t.markedSpans;if(n)for(var o=0,r;o<n.length;++o)if(r=n[o],r.marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&ko(e,t,r))return!0}}function ko(e,t,n){if(null==n.to){var o=n.marker.find(1,!0);return ko(e,o.line,eo(o.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var r=0,a;r<t.markedSpans.length;++r)if(a=t.markedSpans[r],a.marker.collapsed&&!a.marker.widgetNode&&a.from==n.to&&(null==a.to||a.to!=n.from)&&(a.marker.inclusiveLeft||n.marker.inclusiveRight)&&ko(e,t,a))return!0}function To(e,t,n){or(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Fn(e,null,n)}function wo(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Zi(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),qr(t.display.measure,Hr("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Io(e,t,n,o){var r=new Ti(e,n,o),a=e.cm;return a&&r.noHScroll&&(a.display.alignWidgets=!0),Wn(e,t,"widget",function(t){var n=t.widgets||(t.widgets=[]);if(null==r.insertAt?n.push(r):n.splice(ga(n.length-1,va(0,r.insertAt)),0,r),r.line=t,a&&!Eo(e,t)){var o=or(t)<e.scrollTop;er(t,t.height+wo(r)),o&&Fn(a,null,r.height),a.curOp.forceUpdate=!0}return!0}),r}function No(e,t,n,o){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),po(e),co(e,n);var r=o?o(e):1;r!=e.height&&er(e,r)}function Ao(e){e.parent=null,po(e)}function Lo(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var o=n[1]?"bgClass":"textClass";null==t[o]?t[o]=n[2]:!new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(t[o])&&(t[o]+=" "+n[2])}return e}function Ro(t,n){if(t.blankLine)return t.blankLine(n);if(t.innerMode){var o=e.innerMode(t,n);if(o.mode.blankLine)return o.mode.blankLine(o.state)}}function Oo(t,n,o,r){for(var a=0;10>a;a++){r&&(r[0]=e.innerMode(t,o).mode);var i=t.token(n,o);if(n.pos>n.start)return i}throw new Error("Mode "+t.name+" failed to advance stream.")}function Po(e,t,n,o){function r(e){return{start:p.start,end:p.pos,string:p.current(),type:s||null,state:e?mi(a.mode,l):l}}var a=e.doc,i=a.mode,s;t=ge(a,t);var d=Jo(a,t.line),l=He(e,t.line,n),p=new Ci(d.text,e.options.tabSize),c;for(o&&(c=[]);(o||p.pos<t.ch)&&!p.eol();)p.start=p.pos,s=Oo(i,p,l),o&&c.push(r(!0));return o?c:r()}function _o(e,t,n,o,r,a,i){var s=n.flattenSpans;null==s&&(s=e.options.flattenSpans);var d=0,l=null,p=new Ci(t,e.options.tabSize),c=e.options.addModeClass&&[null],u;for(""==t&&Lo(Ro(n,o),a);!p.eol();){if(p.pos>e.options.maxHighlightLength?(s=!1,i&&Fo(e,t,o,p.pos),p.pos=t.length,u=null):u=Lo(Oo(n,p,o,c),a),c){var h=c[0].name;h&&(u="m-"+(u?h+" "+u:h))}if(!s||l!=u){for(;d<p.start;)d=ga(p.start,d+5e4),r(d,l);l=u}p.start=p.pos}for(;d<p.pos;){var m=ga(p.pos,d+5e4);r(m,l),d=m}}function Do(e,t,n,r){var a=[e.state.modeGen],s={};_o(e,t.text,e.doc.mode,n,function(e,t){a.push(e,t)},s,r);for(var d=0;d<e.state.overlays.length;++d){var o=e.state.overlays[d],l=1,i=0;_o(e,t.text,o.mode,!0,function(e,t){for(var n=l,r;i<e;)r=a[l],r>e&&a.splice(l,1,e,a[l+1],r),l+=2,i=ga(e,r);if(t)if(o.opaque)a.splice(n,l-n,e,"cm-overlay "+t),l=n+2;else for(;n<l;n+=2){var s=a[n+1];a[n+1]=(s?s+" ":"")+"cm-overlay "+t}},s)}return{styles:a,classes:s.bgClass||s.textClass?s:null}}function Mo(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var o=He(e,tr(t)),r=Do(e,t,t.text.length>e.options.maxHighlightLength?mi(e.doc.mode,o):o);t.stateAfter=o,t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function Fo(e,t,n,o){var r=e.doc.mode,a=new Ci(t,e.options.tabSize);for(a.start=a.pos=o||0,""==t&&Ro(r,n);!a.eol();)Oo(r,a,n),a.start=a.pos}function Bo(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ni:Ii;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Uo(e,t){var n=Hr("span",null,null,Ia?"padding-right: .1px":null),o={pre:Hr("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,splitSpaces:(Ta||Ia)&&e.getOption("lineWrapping")};t.measure={};for(var r=0;r<=(t.rest?t.rest.length:0);r++){var a=r?t.rest[r-1]:t.line,i;o.pos=0,o.addToken=Vo,$r(e.display.measure)&&(i=rr(a))&&(o.addToken=Ho(o.addToken,i)),o.map=[];var s=t!=e.display.externalMeasured&&tr(a);qo(a,o,Mo(e,a,s)),a.styleClasses&&(a.styleClasses.bgClass&&(o.bgClass=Gr(a.styleClasses.bgClass,o.bgClass||"")),a.styleClasses.textClass&&(o.textClass=Gr(a.styleClasses.textClass,o.textClass||""))),0==o.map.length&&o.map.push(0,0,o.content.appendChild(Jr(e.display.measure))),0==r?(t.measure.map=o.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(o.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return Ia&&/\bcm-tab\b/.test(o.content.lastChild.className)&&(o.content.className="cm-tab-wrap-hack"),Bi(e,"renderLine",e,t.line,o.pre),o.pre.className&&(o.textClass=Gr(o.pre.className,o.textClass||"")),o}function Vo(e,t,n,o,r,a,i){if(t){var s=e.splitSpaces?t.replace(/ {3,}/g,Wo):t,d=e.cm.state.specialChars,l=!1;if(!d.test(t)){e.col+=t.length;var p=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,p),Ta&&9>wa&&(l=!0),e.pos+=t.length}else for(var p=document.createDocumentFragment(),c=0;;){d.lastIndex=c;var u=d.exec(t),h=u?u.index-c:t.length-c;if(h){var g=document.createTextNode(s.slice(c,c+h));Ta&&9>wa?p.appendChild(Hr("span",[g])):p.appendChild(g),e.map.push(e.pos,e.pos+h,g),e.col+=h,e.pos+=h}if(!u)break;if(c+=h+1,"\t"==u[0]){var f=e.cm.options.tabSize,y=f-e.col%f,g=p.appendChild(Hr("span",Rr(y),"cm-tab"));g.setAttribute("role","presentation"),g.setAttribute("cm-text","\t"),e.col+=y}else if("\r"==u[0]||"\n"==u[0]){var g=p.appendChild(Hr("span","\r"==u[0]?"\u240D":"\u2424","cm-invalidchar"));g.setAttribute("cm-text",u[0]),e.col+=1}else{var g=e.cm.options.specialCharPlaceholder(u[0]);g.setAttribute("cm-text",u[0]),Ta&&9>wa?p.appendChild(Hr("span",[g])):p.appendChild(g),e.col+=1}e.map.push(e.pos,e.pos+1,g),e.pos++}if(n||o||r||l||i){var b=n||"";o&&(b+=o),r&&(b+=r);var v=Hr("span",[p],b,i);return a&&(v.title=a),e.content.appendChild(v)}e.content.appendChild(p)}}function Wo(e){for(var t=" ",n=0;n<e.length-2;++n)t+=n%2?" ":"\xA0";return t+=" ",t}function Ho(e,t){return function(n,o,r,a,s,d,l){r=r?r+" cm-force-border":"cm-force-border";for(var p=n.pos,c=p+o.length;;){for(var u=0,i;u<t.length&&(i=t[u],!(i.to>p&&i.from<=p));u++);if(i.to>=c)return e(n,o,r,a,s,d,l);e(n,o.slice(0,i.to-p),r,a,null,d,l),a=null,o=o.slice(i.to-p),p=i.to}}}function jo(e,t,n,o){var r=!o&&n.widgetNode;r&&e.map.push(e.pos,e.pos+t,r),!o&&e.cm.display.input.needsContentAttribute&&(!r&&(r=e.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(e.cm.display.input.setUneditable(r),e.content.appendChild(r)),e.pos+=t}function qo(e,t,n){var o=e.markedSpans,r=e.text,a=0;if(!o){for(var s=1;s<n.length;s+=2)t.addToken(t,r.slice(a,a=n[s]),Bo(n[s+1],t.cm.options));return}for(var i=r.length,d=0,s=1,l="",p=0,c,u,h,g,f,y,b;;){if(p==d){h=g=f=y=u="",b=null,p=Infinity;for(var v=[],x=0,C;x<o.length;++x){var S=o[x],E=S.marker;"bookmark"==E.type&&S.from==d&&E.widgetNode?v.push(E):S.from<=d&&(null==S.to||S.to>d||E.collapsed&&S.to==d&&S.from==d)?(null!=S.to&&S.to!=d&&p>S.to&&(p=S.to,g=""),E.className&&(h+=" "+E.className),E.css&&(u=(u?u+";":"")+E.css),E.startStyle&&S.from==d&&(f+=" "+E.startStyle),E.endStyle&&S.to==p&&(C||(C=[])).push(E.endStyle,S.to),E.title&&!y&&(y=E.title),E.collapsed&&(!b||0>mo(b.marker,E))&&(b=S)):S.from>d&&p>S.from&&(p=S.from)}if(C)for(var x=0;x<C.length;x+=2)C[x+1]==p&&(g+=" "+C[x]);if(!b||b.from==d)for(var x=0;x<v.length;++x)jo(t,0,v[x]);if(b&&(b.from||0)==d){if(jo(t,(null==b.to?i+1:b.to)-d,b.marker,null==b.from),null==b.to)return;b.to==d&&(b=!1)}}if(d>=i)break;for(var m=ga(i,p);;){if(l){var k=d+l.length;if(!b){var T=k>m?l.slice(0,m-d):l;t.addToken(t,T,c?c+h:h,f,d+T.length==p?g:"",y,u)}if(k>=m){l=l.slice(m-d),d=m;break}d=k,f=""}l=r.slice(a,a=n[s++]),c=Bo(n[s++],t.cm.options)}}}function zo(e,t){return 0==t.from.ch&&0==t.to.ch&&""==Or(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ko(e,t,o,n){function r(e){return o?o[e]:null}function a(e,o,r){No(e,o,r,n),kr(e,"change",e,t)}function i(e,t){for(var o=e,a=[];o<t;++o)a.push(new wi(l[o],r(o),n));return a}var s=t.from,d=t.to,l=t.text,p=Jo(e,s.line),c=Jo(e,d.line),u=Or(l),h=r(l.length-1),m=d.line-s.line;if(t.full)e.insert(0,i(0,l.length)),e.remove(l.length,e.size-l.length);else if(zo(e,t)){var g=i(0,l.length-1);a(c,c.text,h),m&&e.remove(s.line,m),g.length&&e.insert(s.line,g)}else if(p==c){if(1==l.length)a(p,p.text.slice(0,s.ch)+u+p.text.slice(d.ch),h);else{var g=i(1,l.length-1);g.push(new wi(u+p.text.slice(d.ch),h,n)),a(p,p.text.slice(0,s.ch)+l[0],r(0)),e.insert(s.line+1,g)}}else if(1==l.length)a(p,p.text.slice(0,s.ch)+l[0]+c.text.slice(d.ch),r(0)),e.remove(s.line+1,m);else{a(p,p.text.slice(0,s.ch)+l[0],r(0)),a(c,u+c.text.slice(d.ch),h);var g=i(1,l.length-1);1<m&&e.remove(s.line+1,m-1),e.insert(s.line+1,g)}kr(e,"change",e,t)}function Go(e){this.lines=e,this.parent=null;for(var t=0,n=0;t<e.length;++t)e[t].parent=this,n+=e[t].height;this.height=n}function Xo(e){this.children=e;for(var t=0,n=0,o=0,r;o<e.length;++o)r=e[o],t+=r.chunkSize(),n+=r.height,r.parent=this;this.size=t,this.height=n,this.parent=null}function Qo(e,t,n){function o(e,r,a){if(e.linked)for(var s=0,i;s<e.linked.length;++s)if(i=e.linked[s],i.doc!=r){var d=a&&i.sharedHist;n&&!d||(t(i.doc,d),o(i.doc,e,d))}}o(e,null,!0)}function Yo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),n(e),e.options.lineWrapping||c(e),e.options.mode=t.modeOption,Dt(e)}function Jo(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var o=0;;++o){var r=n.children[o],a=r.chunkSize();if(t<a){n=r;break}t-=a}return n.lines[t]}function $o(e,t,o){var r=[],a=t.line;return e.iter(t.line,o.line+1,function(e){var n=e.text;a==o.line&&(n=n.slice(0,o.ch)),a==t.line&&(n=n.slice(t.ch)),r.push(n),++a}),r}function Zo(e,t,n){var o=[];return e.iter(t,n,function(e){o.push(e.text)}),o}function er(e,t){var o=t-e.height;if(o)for(var r=e;r;r=r.parent)r.height+=o}function tr(e){if(null==e.parent)return null;for(var t=e.parent,n=Pr(t.lines,e),o=t.parent;o;t=o,o=o.parent)for(var r=0;;++r){if(o.children[r]==t)break;n+=o.children[r].chunkSize()}return n+t.first}function nr(e,t){var o=e.first;outer:do{for(var n=0;n<e.children.length;++n){var r=e.children[n],a=r.height;if(t<a){e=r;continue outer}t-=a,o+=r.chunkSize()}return o}while(!e.lines);for(var n=0;n<e.lines.length;++n){var i=e.lines[n],s=i.height;if(t<s)break;t-=s}return o+n}function or(e){e=vo(e);for(var t=0,n=e.parent,o=0,r;o<n.lines.length&&(r=n.lines[o],r!=e);++o)t+=r.height;for(var a=n.parent;a;n=a,a=n.parent)for(var o=0,i;o<a.children.length&&(i=a.children[o],i!=n);++o)t+=i.height;return t}function rr(e){var t=e.order;return null==t&&(t=e.order=cs(e.text)),t}function ar(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function ir(e,t){var n={from:K(t.from),to:ai(t),text:$o(e,t.from,t.to)};return hr(e,n,t.from.line,t.to.line+1),Qo(e,function(e){hr(e,n,t.from.line,t.to.line+1)},!0),n}function sr(e){for(;e.length;){var t=Or(e);if(t.ranges)e.pop();else break}}function dr(e,t){return t?(sr(e.done),Or(e.done)):e.done.length&&!Or(e.done).ranges?Or(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),Or(e.done)):void 0}function lr(e,t,n,o){var r=e.history;r.undone.length=0;var a=+new Date,i;if((r.lastOp==o||r.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&r.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(i=dr(r,r.lastOp==o))){var s=Or(i.changes);0==za(t.from,t.to)&&0==za(t.from,s.to)?s.to=ai(t):i.changes.push(ir(e,t))}else{var d=Or(r.done);for(d&&d.ranges||ur(e.sel,r.done),i={changes:[ir(e,t)],generation:r.generation},r.done.push(i);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=o,r.lastOrigin=r.lastSelOrigin=t.origin,s||Bi(e,"historyAdded")}function pr(e,t,n,o){var r=t.charAt(0);return"*"==r||"+"==r&&n.ranges.length==o.ranges.length&&n.somethingSelected()==o.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function cr(e,t,n,o){var r=e.history,a=o&&o.origin;n==r.lastSelOp||a&&r.lastSelOrigin==a&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==a||pr(e,a,Or(r.done),t))?r.done[r.done.length-1]=t:ur(t,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=a,r.lastSelOp=n,o&&!1!==o.clearRedo&&sr(r.undone)}function ur(e,t){var n=Or(t);n&&n.ranges&&n.equals(e)||t.push(e)}function hr(e,t,o,r){var a=t["spans_"+e.id],i=0;e.iter(va(e.first,o),ga(e.first+e.size,r),function(n){n.markedSpans&&((a||(a=t["spans_"+e.id]={}))[i]=n.markedSpans),++i})}function mr(e){if(!e)return null;for(var t=0,n;t<e.length;++t)e[t].marker.explicitlyCleared?n||(n=e.slice(0,t)):n&&n.push(e[t]);return n?n.length?n:null:e}function gr(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var o=0,r=[];o<t.text.length;++o)r.push(mr(n[o]));return r}function fr(e,t,n){for(var o=0,r=[],a;o<e.length;++o){if(a=e[o],a.ranges){r.push(n?pe.prototype.deepCopy.call(a):a);continue}var i=a.changes,s=[];r.push({changes:s});for(var d=0;d<i.length;++d){var l=i[d],p;if(s.push({from:l.from,to:l.to,text:l.text}),t)for(var c in l)(p=c.match(/^spans_(\d+)$/))&&-1<Pr(t,+p[1])&&(Or(s)[c]=l[c],delete l[c])}}return r}function yr(e,t,n,o){n<e.line?e.line+=o:t<e.line&&(e.line=t,e.ch=0)}function br(e,t,n,o){for(var r=0;r<e.length;++r){var a=e[r],i=!0;if(a.ranges){a.copied||(a=e[r]=a.deepCopy(),a.copied=!0);for(var s=0;s<a.ranges.length;s++)yr(a.ranges[s].anchor,t,n,o),yr(a.ranges[s].head,t,n,o);continue}for(var s=0,d;s<a.changes.length;++s)if(d=a.changes[s],n<d.from.line)d.from=qa(d.from.line+o,d.from.ch),d.to=qa(d.to.line+o,d.to.ch);else if(t<=d.to.line){i=!1;break}i||(e.splice(0,r+1),r=0)}}function vr(e,t){var n=t.from.line,o=t.to.line,r=t.text.length-(o-n)-1;br(e.done,n,o,r),br(e.undone,n,o,r)}function xr(t){return null==t.defaultPrevented?!1==t.returnValue:t.defaultPrevented}function Cr(t){return t.target||t.srcElement}function Sr(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),Ma&&t.ctrlKey&&1==e&&(e=3),e}function Er(e,t,n){var o=e._handlers&&e._handlers[t];return n?o&&0<o.length?o.slice():on:o||on}function kr(e,t){function n(e){return function(){e.apply(null,r)}}var o=Er(e,t,!1);if(o.length){var r=Array.prototype.slice.call(arguments,2),a;Xa?a=Xa.delayedCallbacks:Ui?a=Ui:(a=Ui=[],setTimeout(Tr,0));for(var s=0;s<o.length;++s)a.push(n(o[s]))}}function Tr(){var e=Ui;Ui=null;for(var t=0;t<e.length;++t)e[t]()}function wr(t,n,o){return"string"==typeof n&&(n={type:n,preventDefault:function(){this.defaultPrevented=!0}}),Bi(t,o||n.type,t,n),xr(n)||n.codemirrorIgnore}function Ir(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),o=0;o<t.length;++o)-1==Pr(n,t[o])&&n.push(t[o])}function Nr(e,t){return 0<Er(e,t).length}function Ar(e){e.prototype.on=function(e,t){Mi(this,e,t)},e.prototype.off=function(e,t){Fi(this,e,t)}}function Lr(){this.id=null}function Rr(e){for(;Gi.length<=e;)Gi.push(Or(Gi)+" ");return Gi[e]}function Or(e){return e[e.length-1]}function Pr(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}function _r(e,t){for(var n=[],o=0;o<e.length;o++)n[o]=t(e[o],o);return n}function Dr(){}function Mr(e,t){var n;return Object.create?n=Object.create(e):(Dr.prototype=e,n=new Dr),t&&Fr(t,n),n}function Fr(e,t,n){for(var o in t||(t={}),e)e.hasOwnProperty(o)&&(!1!==n||!t.hasOwnProperty(o))&&(t[o]=e[o]);return t}function Br(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Ur(e,t){return t?-1<t.source.indexOf("\\w")&&Yi(e)||t.test(e):Yi(e)}function Vr(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Wr(e){return 768<=e.charCodeAt(0)&&Ji.test(e)}function Hr(t,n,o,r){var a=document.createElement(t);if(o&&(a.className=o),r&&(a.style.cssText=r),"string"==typeof n)a.appendChild(document.createTextNode(n));else if(n)for(var e=0;e<n.length;++e)a.appendChild(n[e]);return a}function jr(t){for(var e=t.childNodes.length;0<e;--e)t.removeChild(t.firstChild);return t}function qr(t,n){return jr(t).appendChild(n)}function zr(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Kr(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Gr(e,t){for(var n=e.split(" "),o=0;o<n.length;o++)n[o]&&!Kr(n[o]).test(t)&&(t+=" "+n[o]);return t}function Xr(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),n=0,o;n<t.length;n++)o=t[n].CodeMirror,o&&e(o)}function Qr(){ns||(Yr(),ns=!0)}function Yr(){var e;Mi(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Xr(jt)},100))}),Mi(window,"blur",function(){Xr(bn)})}function Jr(e){if(null==ls){var t=Hr("span","\u200B");qr(e,Hr("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ls=1>=t.offsetWidth&&2<t.offsetHeight&&!(Ta&&8>wa))}var n=ls?Hr("span","\u200B"):Hr("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function $r(e){if(null!=ps)return ps;var t=qr(e,document.createTextNode("A\u062EA")),n=$i(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var o=$i(t,1,2).getBoundingClientRect();return ps=3>o.right-n.right}function Zr(e){if(null!=ss)return ss;var t=qr(e,Hr("span","x")),n=t.getBoundingClientRect(),o=$i(t,0,1).getBoundingClientRect();return ss=1<ha(n.left-o.left)}function ea(e,t,n,o){if(!e)return o(t,n,"ltr");for(var r=!1,a=0,i;a<e.length;++a)i=e[a],(i.from<n&&i.to>t||t==n&&i.to==t)&&(o(va(i.from,t),ga(i.to,n),1==i.level?"rtl":"ltr"),r=!0);r||o(t,n,"ltr")}function ta(e){return e.level%2?e.to:e.from}function na(e){return e.level%2?e.from:e.to}function oa(e){var t=rr(e);return t?ta(t[0]):0}function ra(e){var t=rr(e);return t?na(Or(t)):e.text.length}function aa(e,t){var n=Jo(e.doc,t),o=vo(n);o!=n&&(t=tr(o));var r=rr(o),a=r?r[0].level%2?ra(o):oa(o):0;return qa(t,a)}function ia(e,t){for(var n=Jo(e.doc,t),o;o=yo(n);)n=o.find(1,!0).line,t=null;var r=rr(n),a=r?r[0].level%2?oa(n):ra(n):n.text.length;return qa(null==t?tr(n):t,a)}function sa(e,t){var n=aa(e,t.line),o=Jo(e.doc,n.line),r=rr(o);if(!r||0==r[0].level){var a=va(0,o.text.search(/\S/)),i=t.line==n.line&&t.ch<=a&&t.ch;return qa(n.line,i?0:a)}return n}function da(e,t,n){var o=e[0].level;return t==o||n!=o&&t<n}function la(e,t){us=null;for(var n=0,o,r;n<e.length;++n){if(r=e[n],r.from<t&&r.to>t)return n;if(r.from==t||r.to==t)if(null==o)o=n;else return da(e,r.level,e[o].level)?(r.from!=r.to&&(us=o),n):(r.from!=r.to&&(us=n),o)}return o}function pa(e,t,n,o){if(!o)return t+n;do t+=n;while(0<t&&Wr(e.text.charAt(t)));return t}function ca(e,t,n,o){var r=rr(e);if(!r)return ua(e,t,n,o);for(var a=la(r,t),i=r[a],s=pa(e,t,i.level%2?-n:n,o);;){if(s>i.from&&s<i.to)return s;if(s==i.from||s==i.to)return la(r,s)==a?s:(i=r[a+=n],0<n==i.level%2?i.to:i.from);if(i=r[a+=n],!i)return null;s=0<n==i.level%2?pa(e,i.to,-1,o):pa(e,i.from,1,o)}}function ua(e,t,n,o){var r=t+n;if(o)for(;0<r&&Wr(e.text.charAt(r));)r+=n;return 0>r||r>e.text.length?null:r}var ha=Math.abs,ma=String.fromCharCode,ga=Math.min,fa=Math.floor,ya=Math.round,ba=Math.ceil,va=Math.max,xa=navigator.userAgent,Ca=navigator.platform,Sa=/gecko\/\d/i.test(xa),Ea=/MSIE \d/.test(xa),ka=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(xa),Ta=Ea||ka,wa=Ta&&(Ea?document.documentMode||6:ka[1]),Ia=/WebKit\//.test(xa),Na=Ia&&/Qt\/\d+\.\d+/.test(xa),Aa=/Chrome\//.test(xa),La=/Opera\//.test(xa),Ra=/Apple Computer/.test(navigator.vendor),Oa=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(xa),Pa=/PhantomJS/.test(xa),_a=/AppleWebKit/.test(xa)&&/Mobile\/\w+/.test(xa),Da=_a||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(xa),Ma=_a||/Mac/.test(Ca),Fa=/\bCrOS\b/.test(xa),Ba=/win/i.test(Ca),Ua=La&&xa.match(/Version\/(\d*\.\d*)/);Ua&&(Ua=+Ua[1]),Ua&&15<=Ua&&(La=!1,Ia=!0);var Va=Ma&&(Na||La&&(null==Ua||12.11>Ua)),Wa=Sa||Ta&&9<=wa,Ha=!1,ja=!1;m.prototype=Fr({update:function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,o=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?o+"px":"0";var r=e.viewHeight-(t?o:0);this.vert.firstChild.style.height=va(0,e.scrollHeight-e.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?o+"px":"0",this.horiz.style.left=e.barLeft+"px";var a=e.viewWidth-e.barLeft-(n?o:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+a+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&0<e.clientHeight&&(0==o&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?o:0,bottom:t?o:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var e=Ma&&!Oa?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Lr,this.disableVert=new Lr},enableZeroWidthBar:function(e,t){function n(){var o=e.getBoundingClientRect(),r=document.elementFromPoint(o.left+1,o.bottom-1);r==e?t.set(1e3,n):e.style.pointerEvents="none"}e.style.pointerEvents="auto",t.set(1e3,n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=Fr({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={native:m,null:g},k.prototype.signal=function(e,t){Nr(e,t)&&this.events.push(arguments)},k.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Bi.apply(null,this.events[e])};var qa=e.Pos=function(e,t){return this instanceof qa?void(this.line=e,this.ch=t):new qa(e,t)},za=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch},Ka=null;te.prototype=Fr({init:function(t){function e(t){if(!wr(o,t)){if(o.somethingSelected())Ka=o.getSelections(),n.inaccurateSelection&&(n.prevInput="",n.inaccurateSelection=!1,a.value=Ka.join("\n"),Xi(a));else{if(!o.options.lineWiseCopyCut)return;var e=Z(o);Ka=e.text,"cut"==t.type?o.setSelections(e.ranges,null,Hi):(n.prevInput="",a.value=e.text.join("\n"),Xi(a))}"cut"==t.type&&(o.state.cutIncoming=!0)}}var n=this,o=this.cm,r=this.wrapper=ne(),a=this.textarea=r.firstChild;t.wrapper.insertBefore(r,t.wrapper.firstChild),_a&&(a.style.width="0px"),Mi(a,"input",function(){Ta&&9<=wa&&n.hasSelection&&(n.hasSelection=null),n.poll()}),Mi(a,"paste",function(t){wr(o,t)||J(t,o)||(o.state.pasteIncoming=!0,n.fastPoll())}),Mi(a,"cut",e),Mi(a,"copy",e),Mi(t.scroller,"paste",function(r){qt(t,r)||wr(o,r)||(o.state.pasteIncoming=!0,n.focus())}),Mi(t.lineSpace,"selectstart",function(n){qt(t,n)||Pi(n)}),Mi(a,"compositionstart",function(){var e=o.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:o.markText(e,o.getCursor("to"),{className:"CodeMirror-composing"})}}),Mi(a,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,n=e.doc,o=De(e);if(e.options.moveInputWithCursor){var r=ht(e,n.sel.primary().head,"div"),a=t.wrapper.getBoundingClientRect(),i=t.lineDiv.getBoundingClientRect();o.teTop=va(0,ga(t.wrapper.clientHeight-10,r.top+i.top-a.top)),o.teLeft=va(0,ga(t.wrapper.clientWidth-10,r.left+i.left-a.left))}return o},showSelection:function(e){var t=this.cm,n=t.display;qr(n.cursorDiv,e.cursors),qr(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t=this.cm,n=t.doc,o,r;if(t.somethingSelected()){this.prevInput="";var a=n.sel.primary();o=is&&(100<a.to().line-a.from().line||1e3<(r=t.getSelection()).length);var i=o?"-":r||t.getSelection();this.textarea.value=i,t.state.focused&&Xi(this.textarea),Ta&&9<=wa&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",Ta&&9<=wa&&(this.hasSelection=null));this.inaccurateSelection=o}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Da||zr()!=this.textarea))try{this.textarea.focus()}catch(t){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var o=n.poll();o||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,n=this.prevInput;if(this.contextMenuPending||!e.state.focused||as(t)&&!n&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var o=t.value;if(o==n&&!e.somethingSelected())return!1;if(Ta&&9<=wa&&this.hasSelection===o||Ma&&/[\uf700-\uf7ff]/.test(o))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var r=o.charCodeAt(0);if(8203!=r||n||(n="\u200B"),8666==r)return this.reset(),this.cm.execCommand("undo")}for(var a=0,i=ga(n.length,o.length);a<i&&n.charCodeAt(a)==o.charCodeAt(a);)++a;var s=this;return At(e,function(){Y(e,o.slice(a),n.length-a,null,s.composing?"*compose":null),1e3<o.length||-1<o.indexOf("\n")?t.value=s.prevInput="":s.prevInput=o,s.composing&&(s.composing.range.clear(),s.composing.range=e.markText(s.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){Ta&&9<=wa&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(t){function e(){if(null!=s.selectionStart){var e=r.somethingSelected(),t="\u200B"+(e?s.value:"");s.value="\u21DA",s.value=t,o.prevInput=e?"":"\u200B",s.selectionStart=1,s.selectionEnd=t.length,a.selForContextMenu=r.doc.sel}}function n(){if(o.contextMenuPending=!1,o.wrapper.style.cssText=c,s.style.cssText=p,Ta&&9>wa&&a.scrollbars.setScrollTop(a.scroller.scrollTop=d),null!=s.selectionStart){(!Ta||Ta&&9>wa)&&e();var t=0,n=function(){a.selForContextMenu==r.doc.sel&&0==s.selectionStart&&0<s.selectionEnd&&"\u200B"==o.prevInput?Lt(r,fi.selectAll)(r):10>t++?a.detectingSelectAll=setTimeout(n,500):a.input.reset()};a.detectingSelectAll=setTimeout(n,200)}}var o=this,r=o.cm,a=r.display,s=o.textarea,i=zt(r,t),d=a.scroller.scrollTop;if(i&&!La){var l=r.options.resetSelectionOnContextMenu;l&&-1==r.doc.sel.contains(i)&&Lt(r,we)(r.doc,he(i),Hi);var p=s.style.cssText,c=o.wrapper.style.cssText;o.wrapper.style.cssText="position: absolute";var u=o.wrapper.getBoundingClientRect();if(s.style.cssText="position: absolute; width: 30px; height: 30px; top: "+(t.clientY-u.top-5)+"px; left: "+(t.clientX-u.left-5)+"px; z-index: 1000; background: "+(Ta?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Ia)var h=window.scrollY;if(a.input.focus(),Ia&&window.scrollTo(null,h),a.input.reset(),r.somethingSelected()||(s.value=o.prevInput=" "),o.contextMenuPending=!0,a.selForContextMenu=r.doc.sel,clearTimeout(a.detectingSelectAll),Ta&&9<=wa&&e(),Wa){Di(t);var m=function(){Fi(window,"mouseup",m),setTimeout(n,20)};Mi(window,"mouseup",m)}else setTimeout(n,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Dr,needsContentAttribute:!1},te.prototype),oe.prototype=Fr({init:function(e){function t(t){if(!wr(o,t)){if(o.somethingSelected())Ka=o.getSelections(),"cut"==t.type&&o.replaceSelection("",null,"cut");else{if(!o.options.lineWiseCopyCut)return;var e=Z(o);Ka=e.text,"cut"==t.type&&o.operation(function(){o.setSelections(e.ranges,0,Hi),o.replaceSelection("",null,"cut")})}if(t.clipboardData&&!_a)t.preventDefault(),t.clipboardData.clearData(),t.clipboardData.setData("text/plain",Ka.join("\n"));else{var n=ne(),r=n.firstChild;o.display.lineSpace.insertBefore(n,o.display.lineSpace.firstChild),r.value=Ka.join("\n");var a=document.activeElement;Xi(r),setTimeout(function(){o.display.lineSpace.removeChild(n),a.focus()},50)}}}var n=this,o=n.cm,r=n.div=e.lineDiv;ee(r),Mi(r,"paste",function(t){wr(o,t)||J(t,o)}),Mi(r,"compositionstart",function(t){var e=t.data;if(n.composing={sel:o.doc.sel,data:e,startData:e},!!e){var r=o.doc.sel.primary(),a=o.getLine(r.head.line),i=a.indexOf(e,va(0,r.head.ch-e.length));-1<i&&i<=r.head.ch&&(n.composing.sel=he(qa(r.head.line,i),qa(r.head.line,i+e.length)))}}),Mi(r,"compositionupdate",function(t){n.composing.data=t.data}),Mi(r,"compositionend",function(t){var e=n.composing;e&&(t.data!=e.startData&&!/\u200b/.test(t.data)&&(e.data=t.data),setTimeout(function(){e.handled||n.applyComposition(e),n.composing==e&&(n.composing=null)},50))}),Mi(r,"touchstart",function(){n.forceCompositionEnd()}),Mi(r,"input",function(){n.composing||(o.isReadOnly()||!n.pollContent())&&At(n.cm,function(){Dt(o)})}),Mi(r,"copy",t),Mi(r,"cut",t)},prepareSelection:function(){var e=De(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),n=se(this.cm,e.anchorNode,e.anchorOffset),o=se(this.cm,e.focusNode,e.focusOffset);if(!n||n.bad||!o||o.bad||0!=za(X(n,o),t.from())||0!=za(G(n,o),t.to())){var r=re(this.cm,t.from()),a=re(this.cm,t.to());if(r||a){var i=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(!r)r={node:i[0].measure.map[2],offset:0};else if(!a){var d=i[i.length-1].measure,l=d.maps?d.maps[d.maps.length-1]:d.map;a={node:l[l.length-1],offset:l[l.length-2]-l[l.length-3]}}try{var p=$i(r.node,r.offset,a.offset,a.node)}catch(t){}p&&(!Sa&&this.cm.state.focused?(e.collapse(r.node,r.offset),!p.collapsed&&e.addRange(p)):(e.removeAllRanges(),e.addRange(p)),s&&null==e.anchorNode?e.addRange(s):Sa&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){qr(this.cm.display.cursorDiv,e.cursors),qr(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Zi(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():At(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var n=se(t,e.anchorNode,e.anchorOffset),o=se(t,e.focusNode,e.focusOffset);n&&o&&At(t,function(){we(t.doc,he(n,o),Hi),(n.bad||o.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,n=e.doc.sel.primary(),o=n.from(),r=n.to();if(o.line<t.viewFrom||r.line>t.viewTo-1)return!1;var a;if(o.line==t.viewFrom||0==(a=Bt(e,o.line)))var i=tr(t.view[0].line),s=t.view[0].node;else var i=tr(t.view[a].line),s=t.view[a-1].node.nextSibling;var d=Bt(e,r.line);if(d==t.view.length-1)var l=t.viewTo-1,p=t.lineDiv.lastChild;else var l=tr(t.view[d+1].line)-1,p=t.view[d+1].node.previousSibling;for(var c=e.doc.splitLines(le(e,s,p,i,l)),u=$o(e.doc,qa(i,0),qa(l,Jo(e.doc,l).text.length));1<c.length&&1<u.length;)if(Or(c)==Or(u))c.pop(),u.pop(),l--;else if(c[0]==u[0])c.shift(),u.shift(),i++;else break;for(var h=0,m=0,g=c[0],f=u[0],y=ga(g.length,f.length);h<y&&g.charCodeAt(h)==f.charCodeAt(h);)++h;for(var b=Or(c),v=Or(u),x=ga(b.length-(1==c.length?h:0),v.length-(1==u.length?h:0));m<x&&b.charCodeAt(b.length-m-1)==v.charCodeAt(v.length-m-1);)++m;c[c.length-1]=b.slice(0,b.length-m),c[0]=c[0].slice(h);var C=qa(i,h),S=qa(l,u.length?Or(u).length-m:0);if(1<c.length||c[0]||za(C,S))return On(e.doc,c,C,S,"+input"),!0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){!this.composing||this.composing.handled||(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){this.cm.isReadOnly()?Lt(this.cm,Dt)(this.cm):e.data&&e.data!=e.startData&&Lt(this.cm,Y)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(t){t.preventDefault(),this.cm.isReadOnly()||Lt(this.cm,Y)(this.cm,ma(null==t.charCode?t.keyCode:t.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=("nocursor"!=e)+""},onContextMenu:Dr,resetPosition:Dr,needsContentAttribute:!0},oe.prototype),e.inputStyles={textarea:te,contenteditable:oe},pe.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],o=e.ranges[t];if(0!=za(n.anchor,o.anchor)||0!=za(n.head,o.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new ce(K(this.ranges[t].anchor),K(this.ranges[t].head));return new pe(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var n=0,o;n<this.ranges.length;n++)if(o=this.ranges[n],0<=za(t,o.from())&&0>=za(e,o.to()))return n;return-1}},ce.prototype={from:function(){return X(this.anchor,this.head)},to:function(){return G(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Ga={left:0,right:0,top:0,bottom:0},Xa=null,Qa=0,Ya=0,Ja=0,$a=null,Za,ei,ti;Ta?$a=-.53:Sa?$a=15:Aa?$a=-.7:Ra&&($a=-1/3);var ni=function(t){var e=t.wheelDeltaX,n=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta),{x:e,y:n}};e.wheelEventPixels=function(t){var e=ni(t);return e.x*=$a,e.y*=$a,e};var oi=new Lr,ri=null,ai=e.changeEnd=function(e){return e.text?qa(e.from.line+e.text.length-1,Or(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,o=n[e];n[e]==t&&"mode"!=e||(n[e]=t,si.hasOwnProperty(e)&&Lt(this,si[e])(this,t,o))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Gn(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:Rt(function(t,n){var o=t.token?t:e.getMode(this.options,t);if(o.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:o,modeSpec:t,opaque:n&&n.opaque}),this.state.modeGen++,Dt(this)}),removeOverlay:Rt(function(e){for(var t=this.state.overlays,n=0,o;n<t.length;++n)if(o=t[n].modeSpec,o==e||"string"==typeof e&&o.name==e)return t.splice(n,1),this.state.modeGen++,void Dt(this)}),indentLine:Rt(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(null==t?t=this.options.smartIndent?"smart":"prev":t=t?"add":"subtract"),ye(this.doc,e)&&Vn(this,e,t,n)}),indentSelection:Rt(function(e){for(var t=this.doc.sel.ranges,n=-1,o=0,r;o<t.length;o++)if(r=t[o],!r.empty()){var a=r.from(),i=r.to(),s=va(n,a.line);n=ga(this.lastLine(),i.line-(i.ch?0:1))+1;for(var d=s;d<n;++d)Vn(this,d,e);var l=this.doc.sel.ranges;0==a.ch&&t.length==l.length&&0<l[o].from().ch&&Se(this.doc,o,new ce(a,l[o].to()),Hi)}else r.head.line>n&&(Vn(this,r.head.line,e,!0),n=r.head.line,o==this.doc.sel.primIndex&&Bn(this))}),getTokenAt:function(e,t){return Po(this,e,t)},getLineTokens:function(e,t){return Po(this,qa(e),t,!0)},getTokenTypeAt:function(e){e=ge(this.doc,e);var t=Mo(this,Jo(this.doc,e.line)),n=0,o=(t.length-1)/2,r=e.ch,a;if(0==r)a=t[2];else for(;;){var i=n+o>>1;if((i?t[2*i-1]:0)>=r)o=i;else if(t[2*i+1]<r)n=i+1;else{a=t[2*i+2];break}}var s=a?a.indexOf("cm-overlay "):-1;return 0>s?a:0==s?null:a.slice(0,s-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!hi.hasOwnProperty(t))return n;var o=hi[t],r=this.getModeAt(e);if("string"==typeof r[t])o[r[t]]&&n.push(o[r[t]]);else if(r[t])for(var a=0,i;a<r[t].length;a++)i=o[r[t][a]],i&&n.push(i);else r.helperType&&o[r.helperType]?n.push(o[r.helperType]):o[r.name]&&n.push(o[r.name]);for(var a=0,s;a<o._global.length;a++)s=o._global[a],s.pred(r,this)&&-1==Pr(n,s.val)&&n.push(s.val);return n},getStateAfter:function(e,t){var n=this.doc;return e=me(n,null==e?n.first+n.size-1:e),He(this,e+1,t)},cursorCoords:function(e,t){var n=this.doc.sel.primary(),o;return o=null==e?n.head:"object"==typeof e?ge(this.doc,e):e?n.from():n.to(),ht(this,o,t||"page")},charCoords:function(e,t){return ut(this,ge(this.doc,e),t||"page")},coordsChar:function(e,t){return e=ct(this,e,t||"page"),ft(this,e.left,e.top)},lineAtHeight:function(e,t){return e=ct(this,{top:e,left:0},t||"page").top,nr(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var n=!1,o;if("number"==typeof e){var r=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>r&&(e=r,n=!0),o=Jo(this.doc,e)}else o=e;return pt(this,o,{top:0,left:0},t||"page").top+(n?this.doc.height-or(o):0)},defaultTextHeight:function(){return bt(this.display)},defaultCharWidth:function(){return vt(this.display)},setGutterMarker:Rt(function(e,t,n){return Wn(this.doc,e,"gutter",function(e){var o=e.gutterMarkers||(e.gutterMarkers={});return o[t]=n,!n&&Vr(o)&&(e.gutterMarkers=null),!0})}),clearGutter:Rt(function(e){var t=this,n=t.doc,o=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,Mt(t,o,"gutter"),Vr(n.gutterMarkers)&&(n.gutterMarkers=null)),++o})}),lineInfo:function(e){if("number"==typeof e){if(!ye(this.doc,e))return null;var t=e;if(e=Jo(this.doc,e),!e)return null}else{var t=tr(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,o,r){var a=this.display;e=ht(this,ge(this.doc,e));var i=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==o)i=e.top;else if("above"==o||"near"==o){var d=va(a.wrapper.clientHeight,this.doc.height),l=va(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==o||e.bottom+t.offsetHeight>d)&&e.top>t.offsetHeight?i=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=d&&(i=e.bottom),s+t.offsetWidth>l&&(s=l-t.offsetWidth)}t.style.top=i+"px",t.style.left=t.style.right="","right"==r?(s=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==r?s=0:"middle"==r&&(s=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),n&&Dn(this,s,i,s+t.offsetWidth,i+t.offsetHeight)},triggerOnKeyDown:Rt(un),triggerOnKeyPress:Rt(gn),triggerOnKeyUp:mn,execCommand:function(e){if(fi.hasOwnProperty(e))return fi[e].call(null,this)},triggerElectric:Rt(function(e){$(this,e)}),findPosH:function(e,t,n,o){var r=1;0>t&&(r=-1,t=-t);for(var a=0,i=ge(this.doc,e);a<t&&(i=jn(this.doc,i,r,n,o),!i.hitSide);++a);return i},moveH:Rt(function(e,t){var n=this;n.extendSelectionsBy(function(o){return n.display.shift||n.doc.extend||o.empty()?jn(n.doc,o.head,e,t,n.options.rtlMoveVisually):0>e?o.from():o.to()},qi)}),deleteH:Rt(function(e,t){var n=this.doc.sel,o=this.doc;n.somethingSelected()?o.replaceSelection("",null,"+delete"):Hn(this,function(n){var r=jn(o,n.head,e,t,!1);return 0>e?{from:r,to:n.head}:{from:n.head,to:r}})}),findPosV:function(e,t,n,o){var r=1,a=o;0>t&&(r=-1,t=-t);for(var s=0,i=ge(this.doc,e),d;s<t&&(d=ht(this,i,"div"),null==a?a=d.left:d.left=a,i=qn(this,d,r,n),!i.hitSide);++s);return i},moveV:Rt(function(e,t){var n=this,o=this.doc,r=[],a=!n.display.shift&&!o.extend&&o.sel.somethingSelected();if(o.extendSelectionsBy(function(i){if(a)return 0>e?i.from():i.to();var s=ht(n,i.head,"div");null!=i.goalColumn&&(s.left=i.goalColumn),r.push(s.left);var d=qn(n,s,e,t);return"page"==t&&i==o.sel.primary()&&Fn(n,null,ut(n,d,"div").top-s.top),d},qi),r.length)for(var s=0;s<o.sel.ranges.length;s++)o.sel.ranges[s].goalColumn=r[s]}),findWordAt:function(e){var t=this.doc,n=Jo(t,e.line).text,o=e.ch,r=e.ch;if(n){var a=this.getHelper(e,"wordChars");(0>e.xRel||r==n.length)&&o?--o:++r;for(var i=n.charAt(o),s=Ur(i,a)?function(e){return Ur(e,a)}:/\s/.test(i)?function(e){return /\s/.test(e)}:function(e){return!/\s/.test(e)&&!Ur(e)};0<o&&s(n.charAt(o-1));)--o;for(;r<n.length&&s(n.charAt(r));)++r}return new ce(qa(e.line,o),qa(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?ts(this.display.cursorDiv,"CodeMirror-overwrite"):es(this.display.cursorDiv,"CodeMirror-overwrite"),Bi(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==zr()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Rt(function(e,t){(null!=e||null!=t)&&Un(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Ke(this)-this.display.barHeight,width:e.scrollWidth-Ke(this)-this.display.barWidth,clientHeight:Xe(this),clientWidth:Ge(this)}},scrollIntoView:Rt(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:qa(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)Un(this),this.curOp.scrollToPos=e;else{var n=Mn(this,ga(e.from.left,e.to.left),ga(e.from.top,e.to.top)-e.margin,va(e.from.right,e.to.right),va(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(n.scrollLeft,n.scrollTop)}}),setSize:Rt(function(e,t){function n(e){return"number"==typeof e||/^\d+$/.test(e+"")?e+"px":e}var o=this;null!=e&&(o.display.wrapper.style.width=n(e)),null!=t&&(o.display.wrapper.style.height=n(t)),o.options.lineWrapping&&it(this);var r=o.display.viewFrom;o.doc.iter(r,o.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){Mt(o,r,"widget");break}++r}),o.curOp.forceUpdate=!0,Bi(o,"refresh",this)}),operation:function(e){return At(this,e)},refresh:Rt(function(){var e=this.display.cachedTextHeight;Dt(this),this.curOp.forceUpdate=!0,st(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),l(this),(null==e||.5<ha(e-bt(this.display)))&&a(this),Bi(this,"refresh",this)}),swapDoc:Rt(function(e){var t=this.doc;return t.cm=null,Yo(this,e),st(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,kr(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ar(e);var ii=e.defaults={},si=e.optionHandlers={},di=e.Init={toString:function(){return"CodeMirror.Init"}};zn("value","",function(e,t){e.setValue(t)},!0),zn("mode",null,function(e,t){e.doc.modeOption=t,n(e)},!0),zn("indentUnit",2,n,!0),zn("indentWithTabs",!1),zn("smartIndent",!0),zn("tabSize",4,function(e){o(e),st(e),Dt(e)},!0),zn("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,!!t){var n=[],o=e.doc.first;e.doc.iter(function(e){for(var r=0,a;;){if(a=e.text.indexOf(t,r),-1==a)break;r=a+t.length,n.push(qa(o,a))}o++});for(var r=n.length-1;0<=r;r--)On(e.doc,t,n[r],qa(n[r].line,n[r].ch+t.length))}}),zn("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,n,o){t.state.specialChars=new RegExp(n.source+(n.test("\t")?"":"|\t"),"g"),o!=e.Init&&t.refresh()}),zn("specialCharPlaceholder",function(e){var t=Hr("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t},function(e){e.refresh()},!0),zn("electricChars",!0),zn("inputStyle",Da?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),zn("rtlMoveVisually",!Ba),zn("wholeLineUpdateBefore",!0),zn("theme","default",function(e){s(e),i(e)},!0),zn("keyMap","default",function(t,n,o){var r=Gn(n),a=o!=e.Init&&Gn(o);a&&a.detach&&a.detach(t,r),r.attach&&r.attach(t,a||null)}),zn("extraKeys",null),zn("lineWrapping",!1,function(e){e.options.lineWrapping?(ts(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(es(e.display.wrapper,"CodeMirror-wrap"),c(e)),a(e),Dt(e),st(e),setTimeout(function(){y(e)},100)},!0),zn("gutters",[],function(e){u(e.options),i(e)},!0),zn("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?E(e.display)+"px":"0",e.refresh()},!0),zn("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),zn("scrollbarStyle","native",function(e){f(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),zn("lineNumbers",!1,function(e){u(e.options),i(e)},!0),zn("firstLineNumber",1,i,!0),zn("lineNumberFormatter",function(e){return e},i,!0),zn("showCursorWhenSelecting",!1,_e,!0),zn("resetSelectionOnContextMenu",!0),zn("lineWiseCopyCut",!0),zn("readOnly",!1,function(e,t){"nocursor"==t?(bn(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),zn("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),zn("dragDrop",!0,function(t,n,o){var r=o&&o!=e.Init;if(!n!=!r){var a=t.display.dragFunctions,i=n?Mi:Fi;i(t.display.scroller,"dragstart",a.start),i(t.display.scroller,"dragenter",a.enter),i(t.display.scroller,"dragover",a.over),i(t.display.scroller,"dragleave",a.leave),i(t.display.scroller,"drop",a.drop)}}),zn("allowDropFileTypes",null),zn("cursorBlinkRate",530),zn("cursorScrollMargin",0),zn("cursorHeight",1,_e,!0),zn("singleCursorHeightPerLine",!0,_e,!0),zn("workTime",100),zn("workDelay",100),zn("flattenSpans",!0,o,!0),zn("addModeClass",!1,o,!0),zn("pollInterval",100),zn("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),zn("historyEventDelay",1250),zn("viewportMargin",10,function(e){e.refresh()},!0),zn("maxHighlightLength",1e4,o,!0),zn("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),zn("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),zn("autofocus",null);var li=e.modes={},pi=e.mimeModes={};e.defineMode=function(t,n){e.defaults.mode||"null"==t||(e.defaults.mode=t),2<arguments.length&&(n.dependencies=Array.prototype.slice.call(arguments,2)),li[t]=n},e.defineMIME=function(e,t){pi[e]=t},e.resolveMode=function(t){if("string"==typeof t&&pi.hasOwnProperty(t))t=pi[t];else if(t&&"string"==typeof t.name&&pi.hasOwnProperty(t.name)){var n=pi[t.name];"string"==typeof n&&(n={name:n}),t=Mr(n,t),t.name=n.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,n){var n=e.resolveMode(n),o=li[n.name];if(!o)return e.getMode(t,"text/plain");var r=o(t,n);if(ci.hasOwnProperty(n.name)){var a=ci[n.name];for(var i in a)a.hasOwnProperty(i)&&(r.hasOwnProperty(i)&&(r["_"+i]=r[i]),r[i]=a[i])}if(r.name=n.name,n.helperType&&(r.helperType=n.helperType),n.modeProps)for(var i in n.modeProps)r[i]=n.modeProps[i];return r},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var ci=e.modeExtensions={};e.extendMode=function(e,t){var n=ci.hasOwnProperty(e)?ci[e]:ci[e]={};Fr(t,n)},e.defineExtension=function(t,n){e.prototype[t]=n},e.defineDocExtension=function(e,t){Li.prototype[e]=t},e.defineOption=zn;var ui=[];e.defineInitHook=function(e){ui.push(e)};var hi=e.helpers={};e.registerHelper=function(t,n,o){hi.hasOwnProperty(t)||(hi[t]=e[t]={_global:[]}),hi[t][n]=o},e.registerGlobalHelper=function(t,n,o,r){e.registerHelper(t,n,r),hi[t]._global.push({pred:o,val:r})};var mi=e.copyState=function(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var o={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),o[r]=n}return o},gi=e.startState=function(e,t,n){return!e.startState||e.startState(t,n)};e.innerMode=function(e,t){for(;e.innerMode;){var n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}};var fi=e.commands={selectAll:function(e){e.setSelection(qa(e.firstLine(),0),qa(e.lastLine()),Hi)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Hi)},killLine:function(e){Hn(e,function(t){if(t.empty()){var n=Jo(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:qa(t.head.line+1,0)}:{from:t.head,to:qa(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){Hn(e,function(t){return{from:qa(t.from().line,0),to:ge(e.doc,qa(t.to().line+1,0))}})},delLineLeft:function(e){Hn(e,function(e){return{from:qa(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){Hn(e,function(t){var n=e.charCoords(t.head,"div").top+5,o=e.coordsChar({left:0,top:n},"div");return{from:o,to:t.from()}})},delWrappedLineRight:function(e){Hn(e,function(t){var n=e.charCoords(t.head,"div").top+5,o=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:o}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(qa(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(qa(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return aa(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){return sa(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){e.extendSelectionsBy(function(t){return ia(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},qi)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},qi)},goLineLeftSmart:function(e){e.extendSelectionsBy(function(t){var n=e.charCoords(t.head,"div").top+5,o=e.coordsChar({left:0,top:n},"div");return o.ch<e.getLine(o.line).search(/\S/)?sa(e,t.head):o},qi)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),o=e.options.tabSize,r=0;r<n.length;r++){var a=n[r].from(),i=zi(e.getLine(a.line),a.ch,o);t.push(Array(o-i%o+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){At(e,function(){for(var t=e.listSelections(),n=[],o=0;o<t.length;o++){var r=t[o].head,a=Jo(e.doc,r.line).text;if(a)if(r.ch==a.length&&(r=new qa(r.line,r.ch-1)),0<r.ch)r=new qa(r.line,r.ch+1),e.replaceRange(a.charAt(r.ch-1)+a.charAt(r.ch-2),qa(r.line,r.ch-2),r,"+transpose");else if(r.line>e.doc.first){var i=Jo(e.doc,r.line-1).text;i&&e.replaceRange(a.charAt(0)+e.doc.lineSeparator()+i.charAt(i.length-1),qa(r.line-1,i.length-1),qa(r.line,1),"+transpose")}n.push(new ce(r,r))}e.setSelections(n)})},newlineAndIndent:function(e){At(e,function(){for(var t=e.listSelections().length,n=0,o;n<t;n++)o=e.listSelections()[n],e.replaceRange(e.doc.lineSeparator(),o.anchor,o.head,"+input"),e.indentLine(o.from().line+1,null,!0);Bn(e)})},toggleOverwrite:function(e){e.toggleOverwrite()}},yi=e.keyMap={};yi.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},yi.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},yi.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},yi.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},yi["default"]=Ma?yi.macDefault:yi.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==o){delete e[n];continue}for(var r=_r(n.split(" "),Kn),a=0;a<r.length;a++){var i,s;a==r.length-1?(s=r.join(" "),i=o):(s=r.slice(0,a+1).join(" "),i="...");var d=t[s];if(!d)t[s]=i;else if(d!=i)throw new Error("Inconsistent bindings for "+s)}delete e[n]}for(var l in t)e[l]=t[l];return e};var bi=e.lookupKey=function(e,t,n,o){t=Gn(t);var r=t.call?t.call(e,o):t[e];if(!1===r)return"nothing";if("..."===r)return"multi";if(null!=r&&n(r))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return bi(e,t.fallthrough,n,o);for(var a=0,i;a<t.fallthrough.length;a++)if(i=bi(e,t.fallthrough[a],n,o),i)return i}},vi=e.isModifierKey=function(e){var t="string"==typeof e?e:ds[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},xi=e.keyName=function(e,t){if(La&&34==e.keyCode&&e.char)return!1;var n=ds[e.keyCode],o=n;return null==o||e.altGraphKey?!1:(e.altKey&&"Alt"!=n&&(o="Alt-"+o),(Va?e.metaKey:e.ctrlKey)&&"Ctrl"!=n&&(o="Ctrl-"+o),(Va?e.ctrlKey:e.metaKey)&&"Cmd"!=n&&(o="Cmd-"+o),!t&&e.shiftKey&&"Shift"!=n&&(o="Shift-"+o),o)};e.fromTextArea=function(t,n){function o(){t.value=d.getValue()}if(n=n?Fr(n):{},n.value=t.value,!n.tabindex&&t.tabIndex&&(n.tabindex=t.tabIndex),!n.placeholder&&t.placeholder&&(n.placeholder=t.placeholder),null==n.autofocus){var r=zr();n.autofocus=r==t||null!=t.getAttribute("autofocus")&&r==document.body}if(t.form&&(Mi(t.form,"submit",o),!n.leaveSubmitMethodAlone)){var a=t.form,i=a.submit;try{var s=a.submit=function(){o(),a.submit=i,a.submit(),a.submit=s}}catch(t){}}n.finishInit=function(e){e.save=o,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,o(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(Fi(t.form,"submit",o),"function"==typeof t.form.submit&&(t.form.submit=i))}},t.style.display="none";var d=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},n);return d};var Ci=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};Ci.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var n=t==e;else var n=t&&(e.test?e.test(t):e(t));return n?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);if(-1<t)return this.pos=t,!0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=zi(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?zi(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return zi(this.string,null,this.tabSize)-(this.lineStart?zi(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,n){if("string"==typeof e){var o=function(e){return n?e.toLowerCase():e},r=this.string.substr(this.pos,e.length);if(o(r)==o(e))return!1!==t&&(this.pos+=e.length),!0}else{var a=this.string.slice(this.pos).match(e);return a&&0<a.index?null:(a&&!1!==t&&(this.pos+=a[0].length),a)}},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var Si=0,Ei=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Si};Ar(Ei),Ei.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&xt(e),Nr(this,"clear")){var n=this.find();n&&kr(this,"clear",n.from,n.to)}for(var o=null,r=null,a=0;a<this.lines.length;++a){var i=this.lines[a],s=eo(i.markedSpans,this);e&&!this.collapsed?Mt(e,tr(i),"text"):e&&(null!=s.to&&(r=tr(i)),null!=s.from&&(o=tr(i))),i.markedSpans=to(i.markedSpans,s),null==s.from&&this.collapsed&&!Eo(this.doc,i)&&e&&er(i,bt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var a=0;a<this.lines.length;++a){var d=vo(this.lines[a]),l=p(d);l>e.display.maxLineLength&&(e.display.maxLine=d,e.display.maxLineLength=l,e.display.maxLineChanged=!0)}null!=o&&e&&this.collapsed&&Dt(e,o,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ae(e.doc)),e&&kr(e,"markerCleared",e,this),t&&St(e),this.parent&&this.parent.clear()}},Ei.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var n=0,o,r;n<this.lines.length;++n){var a=this.lines[n],i=eo(a.markedSpans,this);if(null!=i.from&&(o=qa(t?a:tr(a),i.from),-1==e))return o;if(null!=i.to&&(r=qa(t?a:tr(a),i.to),1==e))return r}return o&&{from:o,to:r}},Ei.prototype.changed=function(){var e=this.find(-1,!0),t=this,n=this.doc.cm;e&&n&&At(n,function(){var o=e.line,r=tr(e.line),a=Ze(n,r);if(a&&(at(a),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Eo(t.doc,o)&&null!=t.height){var i=t.height;t.height=null;var s=wo(t)-i;s&&er(o,o.height+s)}})},Ei.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=Pr(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ei.prototype.detachLine=function(e){if(this.lines.splice(Pr(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var Si=0,ki=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Ar(ki),ki.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();kr(this,"clear")}},ki.prototype.find=function(e,t){return this.primary.find(e,t)};var Ti=e.LineWidget=function(e,t,n){if(n)for(var o in n)n.hasOwnProperty(o)&&(this[o]=n[o]);this.doc=e,this.node=t};Ar(Ti),Ti.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,o=tr(n);if(null!=o&&t){for(var r=0;r<t.length;++r)t[r]==this&&t.splice(r--,1);t.length||(n.widgets=null);var a=wo(this);er(n,va(0,n.height-a)),e&&At(e,function(){To(e,n,-a),Mt(e,o,"widget")})}},Ti.prototype.changed=function(){var e=this.height,t=this.doc.cm,n=this.line;this.height=null;var o=wo(this)-e;o&&(er(n,n.height+o),t&&At(t,function(){t.curOp.forceUpdate=!0,To(t,n,o)}))};var wi=e.Line=function(e,t,n){this.text=e,co(this,t),this.height=n?n(this):1};Ar(wi),wi.prototype.lineNo=function(){return tr(this)};var Ii={},Ni={};Go.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,o;n<e+t;++n)o=this.lines[n],this.height-=o.height,Ao(o),kr(o,"delete");this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var o=0;o<t.length;++o)t[o].parent=this},iterN:function(t,o,n){for(var r=t+o;t<r;++t)if(n(this.lines[t]))return!0}},Xo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var o=this.children[n],r=o.chunkSize();if(e<r){var a=ga(t,r-e),i=o.height;if(o.removeInner(e,a),this.height-=i-o.height,r==a&&(this.children.splice(n--,1),o.parent=null),0==(t-=a))break;e=0}else e-=r}if(25>this.size-t&&(1<this.children.length||!(this.children[0]instanceof Go))){var s=[];this.collapse(s),this.children=[new Go(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var o=0;o<this.children.length;++o){var r=this.children[o],a=r.chunkSize();if(e<=a){if(r.insertInner(e,t,n),r.lines&&50<r.lines.length){for(;50<r.lines.length;){var i=r.lines.splice(r.lines.length-25,25),s=new Go(i);r.height-=s.height,this.children.splice(o+1,0,s),s.parent=this}this.maybeSpill()}break}e-=a}},maybeSpill:function(){if(!(10>=this.children.length)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Xo(t);if(!e.parent){var o=new Xo(e.children);o.parent=e,e.children=[o,n],e=o}else{e.size-=n.size,e.height-=n.height;var r=Pr(e.parent.children,e);e.parent.children.splice(r+1,0,n)}n.parent=e.parent}while(10<e.children.length);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var o=0;o<this.children.length;++o){var r=this.children[o],a=r.chunkSize();if(e<a){var i=ga(t,a-e);if(r.iterN(e,i,n))return!0;if(0==(t-=i))break;e=0}else e-=a}}};var Ai=0,Li=e.Doc=function(e,t,n,o){if(!(this instanceof Li))return new Li(e,t,n,o);null==n&&(n=0),Xo.call(this,[new Go([new wi("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var r=qa(n,0);this.sel=he(r),this.history=new ar(null),this.id=++Ai,this.modeOption=t,this.lineSep=o,this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Ko(this,{from:r,to:r,text:e}),we(this,he(r),Hi)};Li.prototype=Mr(Xo.prototype,{constructor:Li,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,o=0;o<t.length;++o)n+=t[o].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Zo(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Ot(function(e){var t=qa(this.first,0),n=this.first+this.size-1;wn(this,{from:t,to:qa(n,Jo(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),we(this,he(t))}),replaceRange:function(e,t,n,o){t=ge(this,t),n=n?ge(this,n):t,On(this,e,t,n,o)},getRange:function(e,t,n){var o=$o(this,ge(this,e),ge(this,t));return!1===n?o:o.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(ye(this,e))return Jo(this,e)},getLineNumber:function(e){return tr(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Jo(this,e)),vo(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ge(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return n=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Ot(function(e,t,n){Ee(this,ge(this,"number"==typeof e?qa(e,t||0):e),null,n)}),setSelection:Ot(function(e,t,n){Ee(this,ge(this,e),ge(this,t||e),n)}),extendSelection:Ot(function(e,t,n){xe(this,ge(this,e),t&&ge(this,t),n)}),extendSelections:Ot(function(e,t){Ce(this,be(this,e),t)}),extendSelectionsBy:Ot(function(e,t){var n=_r(this.sel.ranges,e);Ce(this,be(this,n),t)}),setSelections:Ot(function(e,t,n){if(e.length){for(var o=0,r=[];o<e.length;o++)r[o]=new ce(ge(this,e[o].anchor),ge(this,e[o].head));null==t&&(t=ga(e.length-1,this.sel.primIndex)),we(this,ue(r,t),n)}}),addSelection:Ot(function(e,t,n){var o=this.sel.ranges.slice(0);o.push(new ce(ge(this,e),ge(this,t||e))),we(this,ue(o,o.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n=0,o,r;n<t.length;n++)r=$o(this,t[n].from(),t[n].to()),o=o?o.concat(r):r;return!1===e?o:o.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,o=0,r;o<n.length;o++)r=$o(this,n[o].from(),n[o].to()),!1!==e&&(r=r.join(e||this.lineSeparator())),t[o]=r;return t},replaceSelection:function(e,t,n){for(var o=[],r=0;r<this.sel.ranges.length;r++)o[r]=e;this.replaceSelections(o,t,n||"+input")},replaceSelections:Ot(function(e,t,n){for(var o=[],r=this.sel,a=0,i;a<r.ranges.length;a++)i=r.ranges[a],o[a]={from:i.from(),to:i.to(),text:this.splitLines(e[a]),origin:n};for(var s=t&&"end"!=t&&kn(this,o,t),a=o.length-1;0<=a;a--)wn(this,o[a]);s?Te(this,s):this.cm&&Bn(this.cm)}),undo:Ot(function(){Nn(this,"undo")}),redo:Ot(function(){Nn(this,"redo")}),undoSelection:Ot(function(){Nn(this,"undo",!0)}),redoSelection:Ot(function(){Nn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,o=0;o<e.done.length;o++)e.done[o].ranges||++t;for(var o=0;o<e.undone.length;o++)e.undone[o].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new ar(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:fr(this.history.done),undone:fr(this.history.undone)}},setHistory:function(e){var t=this.history=new ar(this.history.maxGeneration);t.done=fr(e.done.slice(0),null,!0),t.undone=fr(e.undone.slice(0),null,!0)},addLineClass:Ot(function(e,t,n){return Wn(this,e,"gutter"==t?"gutter":"class",function(e){var o="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(!e[o])e[o]=n;else{if(Kr(n).test(e[o]))return!1;e[o]+=" "+n}return!0})}),removeLineClass:Ot(function(e,t,n){return Wn(this,e,"gutter"==t?"gutter":"class",function(e){var o="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",r=e[o];if(!r)return!1;if(null==n)e[o]=null;else{var a=r.match(Kr(n));if(!a)return!1;var i=a.index+a[0].length;e[o]=r.slice(0,a.index)+(a.index&&i!=r.length?" ":"")+r.slice(i)||null}return!0})}),addLineWidget:Ot(function(e,t,n){return Io(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Xn(this,ge(this,e),ge(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ge(this,e),Xn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ge(this,e);var t=[],n=Jo(this,e.line).markedSpans;if(n)for(var o=0,r;o<n.length;++o)r=n[o],(null==r.from||r.from<=e.ch)&&(null==r.to||r.to>=e.ch)&&t.push(r.marker.parent||r.marker);return t},findMarks:function(e,t,n){e=ge(this,e),t=ge(this,t);var o=[],r=e.line;return this.iter(e.line,t.line+1,function(a){var s=a.markedSpans;if(s)for(var d=0,i;d<s.length;d++)i=s[d],null!=i.to&&r==e.line&&e.ch>=i.to||null==i.from&&r!=e.line||null!=i.from&&r==t.line&&i.from>=t.ch||n&&!n(i.marker)||o.push(i.marker.parent||i.marker);++r}),o},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var o=0;o<n.length;++o)null!=n[o].from&&e.push(n[o].marker)}),e},posFromIndex:function(e){var t=this.first,n=this.lineSeparator().length,o;return this.iter(function(r){var a=r.text.length+n;return a>e?(o=e,!0):void(e-=a,++t)}),ge(this,qa(t,o))},indexFromPos:function(e){e=ge(this,e);var t=e.ch;if(e.line<this.first||0>e.ch)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+n}),t},copy:function(e){var t=new Li(Zo(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var o=new Li(Zo(this,t,n),e.mode||this.modeOption,t,this.lineSep);return e.sharedHist&&(o.history=this.history),(this.linked||(this.linked=[])).push({doc:o,sharedHist:e.sharedHist}),o.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Jn(o,Yn(this)),o},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var n=0,o;n<this.linked.length;++n)if(o=this.linked[n],o.doc==t){this.linked.splice(n,1),t.unlinkDoc(this),$n(Yn(this));break}if(t.history==this.history){var r=[t.id];Qo(t,function(e){r.push(e.id)},!0),t.history=new ar(null),t.history.done=fr(this.history.done,r),t.history.undone=fr(this.history.undone,r)}},iterLinkedDocs:function(e){Qo(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):rs(e)},lineSeparator:function(){return this.lineSep||"\n"}}),Li.prototype.eachLine=Li.prototype.iter;var Ri=["iter","insert","remove","copy","getEditor","constructor"];for(var Oi in Li.prototype)Li.prototype.hasOwnProperty(Oi)&&0>Pr(Ri,Oi)&&(e.prototype[Oi]=function(e){return function(){return e.apply(this.doc,arguments)}}(Li.prototype[Oi]));Ar(Li);var Pi=e.e_preventDefault=function(t){t.preventDefault?t.preventDefault():t.returnValue=!1},_i=e.e_stopPropagation=function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},Di=e.e_stop=function(t){Pi(t),_i(t)},Mi=e.on=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var o=e._handlers||(e._handlers={}),r=o[t]||(o[t]=[]);r.push(n)}},on=[],Fi=e.off=function(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else for(var o=Er(e,t,!1),r=0;r<o.length;++r)if(o[r]==n){o.splice(r,1);break}},Bi=e.signal=function(e,t){var n=Er(e,t,!0);if(n.length)for(var o=Array.prototype.slice.call(arguments,2),r=0;r<n.length;++r)n[r].apply(null,o)},Ui=null,Vi=30,Wi=e.Pass={toString:function(){return"CodeMirror.Pass"}},Hi={scroll:!1},ji={origin:"*mouse"},qi={origin:"+move"};Lr.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var zi=e.countColumn=function(e,t,o,r,a){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var s=r||0,i=a||0,n;;){if(n=e.indexOf("\t",s),0>n||n>=t)return i+(t-s);i+=n-s,i+=o-i%o,s=n+1}},Ki=e.findColumn=function(e,t,n){for(var o=0,r=0,a;;){a=e.indexOf("\t",o),-1==a&&(a=e.length);var i=a-o;if(a==e.length||r+i>=t)return o+ga(i,t-r);if(r+=a-o,r+=n-r%n,o=a+1,r>=t)return o}},Gi=[""],Xi=function(e){e.select()};_a?Xi=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:Ta&&(Xi=function(e){try{e.select()}catch(e){}});var Qi=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Yi=e.isWordChar=function(e){return /\w/.test(e)||"\x80"<e&&(e.toUpperCase()!=e.toLowerCase()||Qi.test(e))},Ji=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,$i;$i=document.createRange?function(e,t,n,o){var a=document.createRange();return a.setEnd(o||e,n),a.setStart(e,t),a}:function(e,t,n){var o=document.body.createTextRange();try{o.moveToElementText(e.parentNode)}catch(t){return o}return o.collapse(!0),o.moveEnd("character",n),o.moveStart("character",t),o};var Zi=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};Ta&&11>wa&&(zr=function(){try{return document.activeElement}catch(t){return document.body}});var es=e.rmClass=function(e,t){var n=e.className,o=Kr(t).exec(n);if(o){var r=n.slice(o.index+o[0].length);e.className=n.slice(0,o.index)+(r?o[1]+r:"")}},ts=e.addClass=function(e,t){var n=e.className;Kr(t).test(n)||(e.className+=(n?" ":"")+t)},ns=!1,os=function(){if(Ta&&9>wa)return!1;var e=Hr("div");return"draggable"in e||"dragDrop"in e}(),rs=e.splitLines=3=="\n\nb".split(/\n/).length?function(e){return e.split(/\r\n?|\n/)}:function(e){for(var t=0,n=[],o=e.length,r;t<=o;){r=e.indexOf("\n",t),-1==r&&(r=e.length);var a=e.slice(t,"\r"==e.charAt(r-1)?r-1:r),i=a.indexOf("\r");-1==i?(n.push(a),t=r+1):(n.push(a.slice(0,i)),t+=i+1)}return n},as=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(t){}return t&&t.parentElement()==e&&0!=t.compareEndPoints("StartToEnd",t)},is=function(){var t=Hr("div");return!!("oncopy"in t)||(t.setAttribute("oncopy","return;"),"function"==typeof t.oncopy)}(),ss=null,ds=e.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",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",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},ls,ps;(function(){for(var e=0;10>e;e++)ds[e+48]=ds[e+96]=e+"";for(var e=65;90>=e;e++)ds[e]=ma(e);for(var e=1;12>=e;e++)ds[e+111]=ds[e+63235]="F"+e})();var cs=function(){function e(e){return 247>=e?n.charAt(e):1424<=e&&1524>=e?"R":1536<=e&&1773>=e?o.charAt(e-1536):1774<=e&&2220>=e?"r":8192<=e&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",o="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,a=/[stwN]/,s=/[LRr]/,d=/[Lb1n]/,l=/[1n]/,p="L";return function(n){if(!r.test(n))return!1;for(var o=n.length,c=[],u=0,i;u<o;++u)c.push(i=e(n.charCodeAt(u)));for(var u=0,h=p,i;u<o;++u)i=c[u],"m"==i?c[u]=h:h=i;for(var u=0,g=p,i;u<o;++u)i=c[u],"1"==i&&"r"==g?c[u]="n":s.test(i)&&(g=i,"r"==i&&(c[u]="R"));for(var u=1,h=c[0],i;u<o-1;++u)i=c[u],"+"==i&&"1"==h&&"1"==c[u+1]?c[u]="1":","==i&&h==c[u+1]&&("1"==h||"n"==h)&&(c[u]=h),h=i;for(var u=0,i;u<o;++u)if(i=c[u],","==i)c[u]="N";else if("%"==i){for(var f=u+1;f<o&&"%"==c[f];++f);for(var y=u&&"!"==c[u-1]||f<o&&"1"==c[f]?"1":"N",b=u;b<f;++b)c[b]=y;u=f-1}for(var u=0,g=p,i;u<o;++u)i=c[u],"L"==g&&"1"==i?c[u]="L":s.test(i)&&(g=i);for(var u=0;u<o;++u)if(a.test(c[u])){for(var f=u+1;f<o&&a.test(c[f]);++f);for(var v="L"==(u?c[u-1]:p),x="L"==(f<o?c[f]:p),y=v||x?"L":"R",b=u;b<f;++b)c[b]=y;u=f-1}for(var C=[],u=0,S;u<o;)if(d.test(c[u])){var m=u;for(++u;u<o&&d.test(c[u]);++u);C.push(new t(0,m,u))}else{var E=u,k=C.length;for(++u;u<o&&"L"!=c[u];++u);for(var b=E;b<u;)if(l.test(c[b])){E<b&&C.splice(k,0,new t(1,E,b));var T=b;for(++b;b<u&&l.test(c[b]);++b);C.splice(k,0,new t(2,T,b)),E=b}else++b;E<u&&C.splice(k,0,new t(1,E,u))}return 1==C[0].level&&(S=n.match(/^\s+/))&&(C[0].from=S[0].length,C.unshift(new t(0,0,S[0].length))),1==Or(C).level&&(S=n.match(/\s+$/))&&(Or(C).to-=S[0].length,C.push(new t(0,o-S[0].length,o))),2==C[0].level&&C.unshift(new t(1,C[0].to,C[0].to)),C[0].level!=Or(C).level&&C.push(new t(C[0].level,o,o)),C}}(),us;return e.version="5.14.2",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,o,r){var a=e.getLineHandle(t.line),d=t.ch-1,l=0<=d&&s[a.text.charAt(d)]||s[a.text.charAt(++d)];if(!l)return null;var p=">"==l.charAt(1)?1:-1;if(o&&0<p!=(d==t.ch))return null;var c=e.getTokenTypeAt(i(t.line,d+1)),u=n(e,i(t.line,d+(0<p?1:0)),p,c||null,r);return null==u?null:{from:i(t.line,d),to:u&&u.pos,match:u&&u.ch==l.charAt(0),forward:0<p}}function n(e,t,n,o,r){for(var a=r&&r.maxScanLineLength||1e4,d=r&&r.maxScanLines||1e3,l=[],p=r&&r.bracketRegex?r.bracketRegex:/[(){}[\]]/,c=0<n?Math.min(t.line+d,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-d),u=t.line,h;u!=c;u+=n)if(h=e.getLine(u),h){var m=0<n?0:h.length-1,g=0<n?h.length:-1;if(!(h.length>a))for(u==t.line&&(m=t.ch-(0>n?1:0));m!=g;m+=n){var f=h.charAt(m);if(p.test(f)&&(void 0===o||e.getTokenTypeAt(i(u,m+1))==o)){var y=s[f];if(">"==y.charAt(1)==0<n)l.push(f);else{if(!l.length)return{pos:i(u,m),ch:f};l.pop()}}}}return u-n!=(0<n?e.lastLine():e.firstLine())&&null}function o(e,n,o){for(var r=e.state.matchBrackets.maxHighlightLineLength||1e3,s=[],d=e.listSelections(),l=0,p;l<d.length;l++)if(p=d[l].empty()&&t(e,d[l].head,!1,o),p&&e.getLine(p.from.line).length<=r){var c=p.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";s.push(e.markText(p.from,i(p.from.line,p.from.ch+1),{className:c})),p.to&&e.getLine(p.to.line).length<=r&&s.push(e.markText(p.to,i(p.to.line,p.to.ch+1),{className:c}))}if(s.length){a&&e.state.focused&&e.focus();var u=function(){e.operation(function(){for(var e=0;e<s.length;e++)s[e].clear()})};if(n)setTimeout(u,800);else return u}}function r(e){e.operation(function(){d&&(d(),d=null),d=o(e,!1,e.state.matchBrackets)})}var a=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||8>document.documentMode),i=e.Pos,s={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},d=null;e.defineOption("matchBrackets",!1,function(t,n,o){o&&o!=e.Init&&t.off("cursorActivity",r),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",r))}),e.defineExtension("matchBrackets",function(){o(this,!0)}),e.defineExtension("findMatchingBracket",function(e,n,o){return t(this,e,n,o)}),e.defineExtension("scanForBracket",function(e,t,o,r){return n(this,e,t,o,r)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){"use strict";function t(e){e.state.tagHit&&e.state.tagHit.clear(),e.state.tagOther&&e.state.tagOther.clear(),e.state.tagHit=e.state.tagOther=null}function n(n){n.state.failedTagMatch=!1,n.operation(function(){if(t(n),!n.somethingSelected()){var o=n.getCursor(),r=n.getViewport();r.from=Math.min(r.from,o.line),r.to=Math.max(o.line+1,r.to);var a=e.findMatchingTag(n,o,r);if(a){if(n.state.matchBothTags){var i="open"==a.at?a.open:a.close;i&&(n.state.tagHit=n.markText(i.from,i.to,{className:"CodeMirror-matchingtag"}))}var s="close"==a.at?a.open:a.close;s?n.state.tagOther=n.markText(s.from,s.to,{className:"CodeMirror-matchingtag"}):n.state.failedTagMatch=!0}}})}function o(e){e.state.failedTagMatch&&n(e)}e.defineOption("matchTags",!1,function(r,a,i){i&&i!=e.Init&&(r.off("cursorActivity",n),r.off("viewportChange",o),t(r)),a&&(r.state.matchBothTags="object"==typeof a&&a.bothTags,r.on("cursorActivity",n),r.on("viewportChange",o),n(r))}),e.commands.toMatchingTag=function(t){var n=e.findMatchingTag(t,t.getCursor());if(n){var o="close"==n.at?n.open:n.close;o&&t.extendSelection(o.to,o.from)}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:u[t]}function n(e){return function(t){return d(t,e)}}function o(e){var t=e.state.closeBrackets;if(!t)return null;var n=e.getModeAt(e.getCursor());return n.closeBrackets||t}function r(n){var r=o(n);if(!r||n.getOption("disableInput"))return e.Pass;for(var a=t(r,"pairs"),s=n.listSelections(),d=0;d<s.length;d++){if(!s[d].empty())return e.Pass;var i=p(n,s[d].head);if(!i||0!=a.indexOf(i)%2)return e.Pass}for(var d=s.length-1,l;0<=d;d--)l=s[d].head,n.replaceRange("",h(l.line,l.ch-1),h(l.line,l.ch+1),"+delete")}function a(n){var r=o(n),a=r&&t(r,"explode");if(!a||n.getOption("disableInput"))return e.Pass;for(var s=n.listSelections(),d=0;d<s.length;d++){if(!s[d].empty())return e.Pass;var i=p(n,s[d].head);if(!i||0!=a.indexOf(i)%2)return e.Pass}n.operation(function(){n.replaceSelection("\n\n",null),n.execCommand("goCharLeft"),s=n.listSelections();for(var e=0,t;e<s.length;e++)t=s[e].head.line,n.indentLine(t,null,!0),n.indentLine(t+1,null,!0)})}function s(t){var n=0<e.cmpPos(t.anchor,t.head);return{anchor:new h(t.anchor.line,t.anchor.ch+(n?-1:1)),head:new h(t.head.line,t.head.ch+(n?1:-1))}}function d(n,r){var a=o(n);if(!a||n.getOption("disableInput"))return e.Pass;var d=t(a,"pairs"),p=d.indexOf(r);if(-1==p)return e.Pass;for(var u=t(a,"triples"),m=d.charAt(p+1)==r,g=n.listSelections(),f=0==p%2,y=0,b,i;y<g.length;y++){var v=g[y],x=v.head,i=n.getRange(x,h(x.line,x.ch+1)),C;if(f&&!v.empty())C="surround";else if((m||!f)&&i==r)C=0<=u.indexOf(r)&&n.getRange(x,h(x.line,x.ch+3))==r+r+r?"skipThree":"skip";else if(m&&1<x.ch&&0<=u.indexOf(r)&&n.getRange(h(x.line,x.ch-2),x)==r+r&&(2>=x.ch||n.getRange(h(x.line,x.ch-3),h(x.line,x.ch-2))!=r))C="addFour";else if(m){if(!e.isWordChar(i)&&c(n,x,r))C="both";else return e.Pass;}else if(f&&(n.getLine(x.line).length==x.ch||l(i,d)||/\s/.test(i)))C="both";else return e.Pass;if(!b)b=C;else if(b!=C)return e.Pass}var S=p%2?d.charAt(p-1):r,E=p%2?r:d.charAt(p+1);n.operation(function(){if("skip"==b)n.execCommand("goCharRight");else if("skipThree"==b)for(var e=0;3>e;e++)n.execCommand("goCharRight");else if("surround"==b){for(var t=n.getSelections(),e=0;e<t.length;e++)t[e]=S+t[e]+E;n.replaceSelections(t,"around"),t=n.listSelections().slice();for(var e=0;e<t.length;e++)t[e]=s(t[e]);n.setSelections(t)}else"both"==b?(n.replaceSelection(S+E,null),n.triggerElectric(S+E),n.execCommand("goCharLeft")):"addFour"==b&&(n.replaceSelection(S+S+S+S,"before"),n.execCommand("goCharRight"))})}function l(e,t){var n=t.lastIndexOf(e);return-1<n&&1==n%2}function p(e,t){var n=e.getRange(h(t.line,t.ch-1),h(t.line,t.ch+1));return 2==n.length?n:null}function c(t,n,o){var r=t.getLine(n.line),a=t.getTokenAt(n);if(/\bstring2?\b/.test(a.type))return!1;var i=new e.StringStream(r.slice(0,n.ch)+o+r.slice(n.ch),4);for(i.pos=i.start=a.start;;){var s=t.getMode().token(i,a.state);if(i.pos>=n.ch+1)return /\bstring2?\b/.test(s);i.start=i.pos}}var u={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},h=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,n,o){o&&o!=e.Init&&(t.removeKeyMap(g),t.state.closeBrackets=null),n&&(t.state.closeBrackets=n,t.addKeyMap(g))});for(var m=u.pairs+"`",g={Backspace:r,Enter:a},f=0;f<m.length;f++)g["'"+m.charAt(f)+"'"]=n(m.charAt(f))}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../fold/xml-fold")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../fold/xml-fold"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var n=t.listSelections(),o=[],l=0;l<n.length;l++){if(!n[l].empty())return e.Pass;var i=n[l].head,p=t.getTokenAt(i),c=e.innerMode(t.getMode(),p.state),u=c.state;if("xml"!=c.mode.name||!u.tagName)return e.Pass;var h=t.getOption("autoCloseTags"),m="html"==c.mode.configuration,g="object"==typeof h&&h.dontCloseTags||m&&s,f="object"==typeof h&&h.indentTags||m&&d,y=u.tagName;p.end>i.ch&&(y=y.slice(0,y.length-p.end+i.ch));var b=y.toLowerCase();if(!y||"string"==p.type&&(p.end!=i.ch||!/[\"\']/.test(p.string.charAt(p.string.length-1))||1==p.string.length)||"tag"==p.type&&"closeTag"==u.type||p.string.indexOf("/")==p.string.length-1||g&&-1<r(g,b)||a(t,y,i,u,!0))return e.Pass;var v=f&&-1<r(f,b);o[l]={indent:v,text:">"+(v?"\n\n":"")+"</"+y+">",newPos:v?e.Pos(i.line+1,0):e.Pos(i.line,i.ch+1)}}for(var l=n.length-1,x;0<=l;l--){x=o[l],t.replaceRange(x.text,n[l].head,n[l].anchor,"+insert");var C=t.listSelections().slice(0);C[l]={head:x.newPos,anchor:x.newPos},t.setSelections(C),x.indent&&(t.indentLine(x.newPos.line,null,!0),t.indentLine(x.newPos.line+1,null,!0))}}function n(t,n){for(var o=t.listSelections(),r=[],s=n?"/":"</",d=0;d<o.length;d++){if(!o[d].empty())return e.Pass;var i=o[d].head,l=t.getTokenAt(i),p=e.innerMode(t.getMode(),l.state),c=p.state;if(n&&("string"==l.type||"<"!=l.string.charAt(0)||l.start!=i.ch-1))return e.Pass;var u;if(!("xml"!=p.mode.name)){if(!c.context||!c.context.tagName||a(t,c.context.tagName,i,c))return e.Pass;u=s+c.context.tagName}else if("htmlmixed"==t.getMode().name&&"javascript"==p.mode.name)u=s+"script";else if("htmlmixed"==t.getMode().name&&"css"==p.mode.name)u=s+"style";else return e.Pass;">"!=t.getLine(i.line).charAt(l.end)&&(u+=">"),r[d]=u}t.replaceSelections(r),o=t.listSelections();for(var d=0;d<o.length;d++)(d==o.length-1||o[d].head.line<o[d+1].head.line)&&t.indentLine(o[d].head.line)}function o(t){return t.getOption("disableInput")?e.Pass:n(t,!0)}function r(t,n){if(t.indexOf)return t.indexOf(n);for(var o=0,r=t.length;o<r;++o)if(t[o]==n)return o;return-1}function a(t,n,o,r,a){if(!e.scanForClosingTag)return!1;var s=Math.min(t.lastLine()+1,o.line+500),d=e.scanForClosingTag(t,o,null,s);if(!d||d.tag!=n)return!1;for(var l=r.context,p=a?1:0;l&&l.tagName==n;l=l.prev)++p;o=d.to;for(var c=1,i;c<p;c++){if(i=e.scanForClosingTag(t,o,null,s),!i||i.tag!=n)return!1;o=i.to}return!0}e.defineOption("autoCloseTags",!1,function(n,r,a){if(a!=e.Init&&a&&n.removeKeyMap("autoCloseTags"),!!r){var i={name:"autoCloseTags"};("object"!=typeof r||r.whenClosing)&&(i["'/'"]=function(e){return o(e)}),("object"!=typeof r||r.whenOpening)&&(i["'>'"]=function(e){return t(e)}),n.addKeyMap(i)}});var s=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],d=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return n(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.search(a);return-1==t?0:t}function n(e,t,n){return /\bstring\b/.test(e.getTokenTypeAt(s(t.line,0)))&&!/^[\'\"`]/.test(n)}var o=Math.min,r={},a=/[^\s\u00a0]/,s=e.Pos;e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",function(e){e||(e=r);for(var t=this,n=Infinity,o=this.listSelections(),a=null,d=o.length-1;0<=d;d--){var i=o[d].from(),l=o[d].to();i.line>=n||(l.line>=n&&(l=s(n,0)),n=i.line,null==a?t.uncomment(i,l,e)?a="un":(t.lineComment(i,l,e),a="line"):"un"==a?t.uncomment(i,l,e):t.lineComment(i,l,e))}}),e.defineExtension("lineComment",function(e,i,d){d||(d=r);var l=this,p=l.getModeAt(e),c=l.getLine(e.line);if(!(null==c||n(l,e,c))){var u=d.lineComment||p.lineComment;if(!u)return void((d.blockCommentStart||p.blockCommentStart)&&(d.fullLines=!0,l.blockComment(e,i,d)));var h=o(0!=i.ch||i.line==e.line?i.line+1:i.line,l.lastLine()+1),m=null==d.padding?" ":d.padding,g=d.commentBlankLines||e.line==i.line;l.operation(function(){if(d.indent){for(var n=null,o=e.line;o<h;++o){var r=l.getLine(o),i=r.slice(0,t(r));(null==n||n.length>i.length)&&(n=i)}for(var o=e.line;o<h;++o){var r=l.getLine(o),p=n.length;!g&&!a.test(r)||(r.slice(0,p)!=n&&(p=t(r)),l.replaceRange(n+u+m,s(o,0),s(o,p)))}}else for(var o=e.line;o<h;++o)(g||a.test(l.getLine(o)))&&l.replaceRange(u+m,s(o,0))})}}),e.defineExtension("blockComment",function(e,t,n){n||(n=r);var d=this,l=d.getModeAt(e),p=n.blockCommentStart||l.blockCommentStart,c=n.blockCommentEnd||l.blockCommentEnd;if(!p||!c)return void((n.lineComment||l.lineComment)&&!1!=n.fullLines&&d.lineComment(e,t,n));var u=o(t.line,d.lastLine());u!=e.line&&0==t.ch&&a.test(d.getLine(u))&&--u;var h=null==n.padding?" ":n.padding;e.line>u||d.operation(function(){if(!1!=n.fullLines){var o=a.test(d.getLine(u));d.replaceRange(h+c,s(u)),d.replaceRange(p+h,s(e.line,0));var r=n.blockCommentLead||l.blockCommentLead;if(null!=r)for(var m=e.line+1;m<=u;++m)(m!=u||o)&&d.replaceRange(r+h,s(m,0))}else d.replaceRange(c,t),d.replaceRange(p,e)})}),e.defineExtension("uncomment",function(e,t,n){n||(n=r);var d=this,l=d.getModeAt(e),p=o(0!=t.ch||t.line==e.line?t.line:t.line-1,d.lastLine()),c=o(e.line,p),u=n.lineComment||l.lineComment,h=[],m=null==n.padding?" ":n.padding,g;lineComment:{if(!u)break lineComment;for(var f=c;f<=p;++f){var i=d.getLine(f),y=i.indexOf(u);if(-1<y&&!/comment/.test(d.getTokenTypeAt(s(f,y+1)))&&(y=-1),-1==y&&(f!=p||f==c)&&a.test(i))break lineComment;if(-1<y&&a.test(i.slice(0,y)))break lineComment;h.push(i)}if(d.operation(function(){for(var e=c;e<=p;++e){var t=h[e-c],n=t.indexOf(u),o=n+u.length;0>n||(t.slice(o,o+m.length)==m&&(o+=m.length),g=!0,d.replaceRange("",s(e,n),s(e,o)))}}),g)return!0}var b=n.blockCommentStart||l.blockCommentStart,v=n.blockCommentEnd||l.blockCommentEnd;if(!b||!v)return!1;var x=n.blockCommentLead||l.blockCommentLead,C=d.getLine(c),S=p==c?C:d.getLine(p),E=C.indexOf(b),k=S.lastIndexOf(v);if(-1==k&&c!=p&&(S=d.getLine(--p),k=S.lastIndexOf(v)),-1==E||-1==k||!/comment/.test(d.getTokenTypeAt(s(c,E+1)))||!/comment/.test(d.getTokenTypeAt(s(p,k+1))))return!1;var T=C.lastIndexOf(b,e.ch),w=-1==T?-1:C.slice(0,e.ch).indexOf(v,T+b.length);if(-1!=T&&-1!=w&&w+v.length!=e.ch)return!1;w=S.indexOf(v,t.ch);var I=S.slice(t.ch).lastIndexOf(b,w-t.ch);return(T=-1==w||-1==I?-1:t.ch+I,-1==w||-1==T||T==t.ch)&&(d.operation(function(){d.replaceRange("",s(p,k-(m&&S.slice(k-m.length,k)==m?m.length:0)),s(p,k+v.length));var e=E+b.length;if(m&&C.slice(e,e+m.length)==m&&(e+=m.length),d.replaceRange("",s(c,E),s(c,e)),x)for(var t=c+1;t<=p;++t){var n=d.getLine(t),o=n.indexOf(x);if(!(-1==o||a.test(n.slice(0,o)))){var r=o+x.length;m&&n.slice(r,r+m.length)==m&&(r+=m.length),d.replaceRange("",s(t,o),s(t,r))}}}),!0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(t){"use strict";function e(e,r,a,s){function i(t){var n=d(e,r);if(!n||n.to.line-n.from.line<l)return null;for(var o=e.findMarksAt(n.from),a=0;a<o.length;++a)if(o[a].__isFold&&"fold"!==s){if(!t)return null;n.cleared=!0,o[a].clear()}return n}if(a&&a.call){var d=a;a=null}else var d=o(e,a,"rangeFinder");"number"==typeof r&&(r=t.Pos(r,0));var l=o(e,a,"minFoldSize"),p=i(!0);if(o(e,a,"scanUp"))for(;!p&&r.line>e.firstLine();)r=t.Pos(r.line-1,0),p=i(!1);if(p&&!p.cleared&&"unfold"!==s){var c=n(e,a);t.on(c,"mousedown",function(n){u.clear(),t.e_preventDefault(n)});var u=e.markText(p.from,p.to,{replacedWith:c,clearOnEnter:!0,__isFold:!0});u.on("clear",function(n,o){t.signal(e,"unfold",e,n,o)}),t.signal(e,"fold",e,p.from,p.to)}}function n(e,t){var n=o(e,t,"widget");if("string"==typeof n){var r=document.createTextNode(n);n=document.createElement("span"),n.appendChild(r),n.className="CodeMirror-foldmarker"}return n}function o(e,t,n){if(t&&t[n]!==void 0)return t[n];var o=e.options.foldOptions;return o&&void 0!==o[n]?o[n]:r[n]}t.newFoldFunction=function(t,n){return function(o,r){e(o,r,{rangeFinder:t,widget:n})}},t.defineExtension("foldCode",function(t,n,o){e(this,t,n,o)}),t.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),n=0;n<t.length;++n)if(t[n].__isFold)return!0}),t.commands.toggleFold=function(e){e.foldCode(e.getCursor())},t.commands.fold=function(e){e.foldCode(e.getCursor(),null,"fold")},t.commands.unfold=function(e){e.foldCode(e.getCursor(),null,"unfold")},t.commands.foldAll=function(n){n.operation(function(){for(var o=n.firstLine(),r=n.lastLine();o<=r;o++)n.foldCode(t.Pos(o,0),null,"fold")})},t.commands.unfoldAll=function(n){n.operation(function(){for(var o=n.firstLine(),r=n.lastLine();o<=r;o++)n.foldCode(t.Pos(o,0),null,"unfold")})},t.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,n){for(var o=0,r;o<e.length;++o)if(r=e[o](t,n),r)return r}}),t.registerHelper("fold","auto",function(e,t){for(var n=e.getHelpers(t,"fold"),o=0,r;o<n.length;o++)if(r=n[o](e,t),r)return r});var r={rangeFinder:t.fold.auto,widget:"\u2194",minFoldSize:0,scanUp:!1};t.defineOption("foldOptions",null),t.defineExtension("foldOption",function(e,t){return o(this,e,t)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],e):e(CodeMirror)}(function(e){"use strict";function t(e){this.options=e,this.from=this.to=0}function n(e){return!0===e&&(e={}),null==e.gutter&&(e.gutter="CodeMirror-foldgutter"),null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open"),null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded"),e}function o(e,t){for(var n=e.findMarksAt(c(t)),o=0;o<n.length;++o)if(n[o].__isFold&&n[o].find().from.line==t)return n[o]}function r(e){if("string"==typeof e){var t=document.createElement("div");return t.className=e+" CodeMirror-guttermarker-subtle",t}return e.cloneNode(!0)}function a(e,t,n){var a=e.state.foldGutter.options,i=t,s=e.foldOption(a,"minFoldSize"),d=e.foldOption(a,"rangeFinder");e.eachLine(t,n,function(t){var n=null;if(o(e,i))n=r(a.indicatorFolded);else{var l=c(i,0),p=d&&d(e,l);p&&p.to.line-p.from.line>=s&&(n=r(a.indicatorOpen))}e.setGutterMarker(t,a.gutter,n),++i})}function i(e){var t=e.getViewport(),n=e.state.foldGutter;n&&(e.operation(function(){a(e,t.from,t.to)}),n.from=t.from,n.to=t.to)}function s(e,t,n){var r=e.state.foldGutter;if(r){var a=r.options;if(n==a.gutter){var i=o(e,t);i?i.clear():e.foldCode(c(t,0),a.rangeFinder)}}}function d(e){var t=e.state.foldGutter;if(t){var n=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){i(e)},n.foldOnChangeTimeSpan||600)}}function l(e){var t=e.state.foldGutter;if(t){var n=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var n=e.getViewport();t.from==t.to||20<n.from-t.to||20<t.from-n.to?i(e):e.operation(function(){n.from<t.from&&(a(e,n.from,t.from),t.from=n.from),n.to>t.to&&(a(e,t.to,n.to),t.to=n.to)})},n.updateViewportTimeSpan||400)}}function p(e,t){var n=e.state.foldGutter;if(n){var o=t.line;o>=n.from&&o<n.to&&a(e,o,o+1)}}e.defineOption("foldGutter",!1,function(o,r,a){a&&a!=e.Init&&(o.clearGutter(o.state.foldGutter.options.gutter),o.state.foldGutter=null,o.off("gutterClick",s),o.off("change",d),o.off("viewportChange",l),o.off("fold",p),o.off("unfold",p),o.off("swapDoc",d)),r&&(o.state.foldGutter=new t(n(r)),i(o),o.on("gutterClick",s),o.on("change",d),o.on("viewportChange",l),o.on("fold",p),o.on("unfold",p),o.on("swapDoc",d))});var c=e.Pos}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line-t.line||e.ch-t.ch}function n(e,t,n,o){this.line=t,this.ch=n,this.cm=e,this.text=e.getLine(t),this.min=o?o.from:e.firstLine(),this.max=o?o.to-1:e.lastLine()}function o(e,t){var n=e.cm.getTokenTypeAt(u(e.line,t));return n&&/\btag\b/.test(n)}function r(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function a(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function s(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t)if(r(e))continue;else return;if(!o(e,t+1)){e.ch=t+1;continue}var n=e.text.lastIndexOf("/",t),a=-1<n&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,a?"selfClose":"regular"}}function d(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t)if(a(e))continue;else return;if(!o(e,t+1)){e.ch=t;continue}h.lastIndex=t,e.ch=t;var n=h.exec(e.text);if(n&&n.index==t)return n}}function l(e){for(;;){h.lastIndex=e.ch;var t=h.exec(e.text);if(!t)if(r(e))continue;else return;if(!o(e,t.index+1)){e.ch=t.index+1;continue}return e.ch=t.index+t[0].length,t}}function p(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t)if(a(e))continue;else return;if(!o(e,t+1)){e.ch=t;continue}var n=e.text.lastIndexOf("/",t),r=-1<n&&!/\S/.test(e.text.slice(n+1,t));return e.ch=t+1,r?"selfClose":"regular"}}function i(e,t){for(var n=[];;){var o=l(e),r=e.line,a=e.ch-(o?o[0].length:0),d;if(!o||!(d=s(e)))return;if("selfClose"!=d)if(o[1]){for(var p=n.length-1;0<=p;--p)if(n[p]==o[2]){n.length=p;break}if(0>p&&(!t||t==o[2]))return{tag:o[2],from:u(r,a),to:u(e.line,e.ch)}}else n.push(o[2])}}function c(e,t){for(var n=[];;){var o=p(e);if(!o)return;if("selfClose"==o){d(e);continue}var r=e.line,a=e.ch,s=d(e);if(!s)return;if(s[1])n.push(s[2]);else{for(var l=n.length-1;0<=l;--l)if(n[l]==s[2]){n.length=l;break}if(0>l&&(!t||t==s[2]))return{tag:s[2],from:u(e.line,e.ch),to:u(r,a)}}}}var u=e.Pos,h=/<(\/?)([A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD-:.0-9\u00B7\u0300-\u036F\u203F-\u2040]*)/g;e.registerHelper("fold","xml",function(e,t){for(var o=new n(e,t.line,0);;){var r=l(o),a;if(!r||o.line!=t.line||!(a=s(o)))return;if(!r[1]&&"selfClose"!=a){var t=u(o.line,o.ch),d=i(o,r[2]);return d&&{from:t,to:d.from}}}}),e.findMatchingTag=function(e,o,r){var a=new n(e,o.line,o.ch,r);if(-1!=a.text.indexOf(">")||-1!=a.text.indexOf("<")){var l=s(a),p=l&&u(a.line,a.ch),h=l&&d(a);if(l&&h&&!(0<t(a,o))){var m={from:u(a.line,a.ch),to:p,tag:h[2]};return"selfClose"==l?{open:m,close:null,at:"open"}:h[1]?{open:c(a,h[2]),close:m,at:"close"}:(a=new n(e,p.line,p.ch,r),{open:m,close:i(a,h[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,o){for(var r=new n(e,t.line,t.ch,o);;){var a=c(r);if(!a)break;var s=new n(e,t.line,t.ch,o),d=i(s,a.tag);if(d)return{open:a,close:d}}},e.scanForClosingTag=function(e,t,o,r){var a=new n(e,t.line,t.ch,r?{from:0,to:r}:null);return i(a,o)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("fold","indent",function(t,n){var o=t.getOption("tabSize"),r=t.getLine(n.line);if(/\S/.test(r)){for(var a=function(t){return e.countColumn(t,null,o)},s=a(r),d=null,l=n.line+1,i=t.lastLine();l<=i;++l){var p=t.getLine(l),c=a(p);if(c>s)d=l;else if(!/\S/.test(p));else break}if(d)return{from:e.Pos(n.line,r.length),to:e.Pos(d,t.getLine(d).length)}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerGlobalHelper("fold","comment",function(e){return e.blockCommentStart&&e.blockCommentEnd},function(t,n){var o=t.getModeAt(n),r=o.blockCommentStart,a=o.blockCommentEnd;if(r&&a){for(var s=n.line,d=t.getLine(s),l=n.ch,p=0,c,u;;){if(u=0>=l?-1:d.lastIndexOf(r,l-1),-1==u){if(1==p)return;p=1,l=d.length;continue}if(1==p&&u<n.ch)return;if(/comment/.test(t.getTokenTypeAt(e.Pos(s,u+1)))&&(d.slice(u-a.length,u)==a||!/comment/.test(t.getTokenTypeAt(e.Pos(s,u))))){c=u+r.length;break}l=u-1}var h=1,m=t.lastLine(),g,f;outer:for(var y=s;y<=m;++y)for(var i=t.getLine(y),b=y==s?c:0;;){var v=i.indexOf(r,b),x=i.indexOf(a,b);if(0>v&&(v=i.length),0>x&&(x=i.length),b=Math.min(v,x),b==i.length)break;if(b==v)++h;else if(! --h){g=y,f=b;break outer}++b}return null==g||s==g&&f==c?void 0:{from:e.Pos(s,c),to:e.Pos(g,f)}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(t){"use strict";var n=Math.min;t.registerHelper("fold","brace",function(e,o){function r(n){for(var r=o.ch,i=0,d;;){if(d=0>=r?-1:s.lastIndexOf(n,r-1),-1==d){if(1==i)break;i=1,r=s.length;continue}if(1==i&&d<o.ch)break;if(c=e.getTokenTypeAt(t.Pos(a,d+1)),!/^(comment|string)/.test(c))return d+1;r=d-1}}var a=o.line,s=e.getLine(a),d="{",l="}",p=r("{"),p,c;if(null==p&&(d="[",l="]",p=r("[")),null!=p){var u=1,h=e.lastLine(),m,g;outer:for(var f=a;f<=h;++f)for(var i=e.getLine(f),y=f==a?p:0;;){var b=i.indexOf(d,y),v=i.indexOf(l,y);if(0>b&&(b=i.length),0>v&&(v=i.length),y=n(b,v),y==i.length)break;if(e.getTokenTypeAt(t.Pos(f,y+1))==c)if(y==b)++u;else if(! --u){m=f,g=y;break outer}++y}return null==m||a==m&&g==p?void 0:{from:t.Pos(a,p),to:t.Pos(m,g)}}}),t.registerHelper("fold","import",function(o,e){function r(r){if(r<o.firstLine()||r>o.lastLine())return null;var a=o.getTokenAt(t.Pos(r,1));if(/\S/.test(a.string)||(a=o.getTokenAt(t.Pos(r,a.end+1))),"keyword"!=a.type||"import"!=a.string)return null;for(var s=r,i=n(o.lastLine(),r+10);s<=i;++s){var e=o.getLine(s),d=e.indexOf(";");if(-1!=d)return{startCh:a.end,end:t.Pos(s,d)}}}var e=e.line,a=r(e),i;if(!a||r(e-1)||(i=r(e-2))&&i.end.line==e-1)return null;for(var s=a.end,d;;){if(d=r(s.line+1),null==d)break;s=d.end}return{from:o.clipPos(t.Pos(e,a.startCh+1)),to:s}}),t.registerHelper("fold","include",function(e,n){function o(n){if(n<e.firstLine()||n>e.lastLine())return null;var o=e.getTokenAt(t.Pos(n,1));if(/\S/.test(o.string)||(o=e.getTokenAt(t.Pos(n,o.end+1))),"meta"==o.type&&"#include"==o.string.slice(0,8))return o.start+8}var n=n.line,r=o(n);if(null==r||null!=o(n-1))return null;for(var a=n,i;;){if(i=o(a+1),null==i)break;++a}return{from:t.Pos(n,r+1),to:e.clipPos(t.Pos(a))}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),"cjs"):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],function(t){e(t,"amd")}):e(CodeMirror,"plain")}(function(e,t){function n(e,t){var n=t;return function(){0==--n&&e()}}function o(t,o){var r=e.modes[t].dependencies;if(!r)return o();for(var a=[],s=0;s<r.length;++s)e.modes.hasOwnProperty(r[s])||a.push(r[s]);if(!a.length)return o();for(var i=n(o,a.length),s=0;s<a.length;++s)e.requireMode(a[s],i)}e.modeURL||(e.modeURL="../mode/%N/%N.js");var r={};e.requireMode=function(n,a){if("string"!=typeof n&&(n=n.name),e.modes.hasOwnProperty(n))return o(n,a);if(r.hasOwnProperty(n))return r[n].push(a);var i=e.modeURL.replace(/%N/g,n);if("plain"==t){var s=document.createElement("script");s.src=i;var d=document.getElementsByTagName("script")[0],l=r[n]=[a];e.on(s,"load",function(){o(n,function(){for(var e=0;e<l.length;++e)l[e]()})}),d.parentNode.insertBefore(s,d)}else"cjs"==t?(require(i),a()):"amd"==t&&requirejs([i],a)},e.autoLoadMode=function(t,n){e.modes.hasOwnProperty(n)||e.requireMode(n,function(){t.setOption("mode",t.getOption("mode"))})}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){this.cm=e,this.options=t,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var n=this;e.on("cursorActivity",this.activityFunc=function(){n.cursorActivity()})}function n(t,n){var o=e.cmpPos(n.from,t.from);return 0<o&&t.to.ch-t.from.ch!=n.to.ch-n.from.ch}function o(e,t,n){var o=e.options.hintOptions,r={};for(var a in g)r[a]=g[a];if(o)for(var a in o)void 0!==o[a]&&(r[a]=o[a]);if(n)for(var a in n)void 0!==n[a]&&(r[a]=n[a]);return r.hint.resolve&&(r.hint=r.hint.resolve(e,t)),r}function r(e){return"string"==typeof e?e:e.text}function a(e,t){function n(e,n){var r;r="string"==typeof n?o.hasOwnProperty(n)?o[n]:n:function(e){return n(e,t)},a[e]=r}var o={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(-t.menuSize()+1,!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close},r=e.options.customKeys,a=r?{}:o;if(r)for(var i in r)r.hasOwnProperty(i)&&n(i,r[i]);var s=e.options.extraKeys;if(s)for(var i in s)s.hasOwnProperty(i)&&n(i,s[i]);return a}function i(e,t){for(;t&&t!=e;){if("LI"===t.nodeName.toUpperCase()&&t.parentNode==e)return t;t=t.parentNode}}function s(n,t){this.completion=n,this.data=t,this.picked=!1;var o=this,s=n.cm,d=this.hints=document.createElement("ul");d.className="CodeMirror-hints",this.selectedHint=t.selectedHint||0;for(var l=t.list,h=0;h<l.length;++h){var m=d.appendChild(document.createElement("li")),g=l[h],f=c+(h==this.selectedHint?" "+u:"");null!=g.className&&(f=g.className+" "+f),m.className=f,g.render?g.render(m,t,g):m.appendChild(document.createTextNode(g.displayText||r(g))),m.hintId=h}var y=s.cursorCoords(n.options.alignWithWord?t.from:null),b=y.left,v=y.bottom,x=!0;d.style.left=b+"px",d.style.top=v+"px";var C=window.innerWidth||p(document.body.offsetWidth,document.documentElement.offsetWidth),S=window.innerHeight||p(document.body.offsetHeight,document.documentElement.offsetHeight);(n.options.container||document.body).appendChild(d);var E=d.getBoundingClientRect(),k=E.bottom-S;if(0<k){var T=E.bottom-E.top,w=y.top-(y.bottom-E.top);if(0<w-T)d.style.top=(v=y.top-T)+"px",x=!1;else if(T>S){d.style.height=S-5+"px",d.style.top=(v=y.bottom-E.top)+"px";var I=s.getCursor();t.from.ch!=I.ch&&(y=s.cursorCoords(I),d.style.left=(b=y.left)+"px",E=d.getBoundingClientRect())}}var N=E.right-C;if(0<N&&(E.right-E.left>C&&(d.style.width=C-5+"px",N-=E.right-E.left-C),d.style.left=(b=y.left-N)+"px"),s.addKeyMap(this.keyMap=a(n,{moveFocus:function(e,t){o.changeActive(o.selectedHint+e,t)},setFocus:function(e){o.changeActive(e)},menuSize:function(){return o.screenAmount()},length:l.length,close:function(){n.close()},pick:function(){o.pick()},data:t})),n.options.closeOnUnfocus){var A;s.on("blur",this.onBlur=function(){A=setTimeout(function(){n.close()},100)}),s.on("focus",this.onFocus=function(){clearTimeout(A)})}var L=s.getScrollInfo();return s.on("scroll",this.onScroll=function(){var e=s.getScrollInfo(),t=s.getWrapperElement().getBoundingClientRect(),o=v+L.top-e.top,r=o-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return x||(r+=d.offsetHeight),r<=t.top||r>=t.bottom?n.close():void(d.style.top=o+"px",d.style.left=b+L.left-e.left+"px")}),e.on(d,"dblclick",function(n){var e=i(d,n.target||n.srcElement);e&&null!=e.hintId&&(o.changeActive(e.hintId),o.pick())}),e.on(d,"click",function(r){var e=i(d,r.target||r.srcElement);e&&null!=e.hintId&&(o.changeActive(e.hintId),n.options.completeOnSingleClick&&o.pick())}),e.on(d,"mousedown",function(){setTimeout(function(){s.focus()},20)}),e.signal(t,"select",l[0],d.firstChild),!0}function d(e,t){if(!e.somethingSelected())return t;for(var n=[],o=0;o<t.length;o++)t[o].supportsSelection&&n.push(t[o]);return n}function l(e,t,n,o){if(e.async)e(t,o,n);else{var r=e(t,n);r&&r.then?r.then(o):o(r)}}var p=Math.max,c="CodeMirror-hint",u="CodeMirror-hint-active";e.showHint=function(e,t,n){if(!t)return e.showHint(n);n&&n.async&&(t.async=!0);var o={hint:t};if(n)for(var r in n)o[r]=n[r];return e.showHint(o)},e.defineExtension("showHint",function(n){n=o(this,this.getCursor("start"),n);var r=this.listSelections();if(!(1<r.length)){if(this.somethingSelected()){if(!n.hint.supportsSelection)return;for(var a=0;a<r.length;a++)if(r[a].head.line!=r[a].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();var i=this.state.completionActive=new t(this,n);i.options.hint&&(e.signal(this,"startCompletion",this),i.update(!0))}});var h=window.requestAnimationFrame||function(e){return setTimeout(e,1e3/60)},m=window.cancelAnimationFrame||clearTimeout;t.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&e.signal(this.data,"close"),this.widget&&this.widget.close(),e.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(t,n){var o=t.list[n];o.hint?o.hint(this.cm,t,o):this.cm.replaceRange(r(o),o.from||t.from,o.to||t.to,"complete"),e.signal(t,"pick",o),this.close()},cursorActivity:function(){this.debounce&&(m(this.debounce),this.debounce=0);var e=this.cm.getCursor(),t=this.cm.getLine(e.line);if(e.line!=this.startPos.line||t.length-e.ch!=this.startLen-this.startPos.ch||e.ch<this.startPos.ch||this.cm.somethingSelected()||e.ch&&this.options.closeCharacters.test(t.charAt(e.ch-1)))this.close();else{var n=this;this.debounce=h(function(){n.update()}),this.widget&&this.widget.disable()}},update:function(e){if(null!=this.tick){var t=this,n=++this.tick;l(this.options.hint,this.cm,this.options,function(o){t.tick==n&&t.finishUpdate(o,e)})}},finishUpdate:function(t,o){this.data&&e.signal(this.data,"update");var r=this.widget&&this.widget.picked||o&&this.options.completeSingle;this.widget&&this.widget.close();t&&this.data&&n(this.data,t)||(this.data=t,t&&t.list.length&&(r&&1==t.list.length?this.pick(t,0):(this.widget=new s(this,t),e.signal(t,"shown"))))}},s.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var e=this.completion.cm;this.completion.options.closeOnUnfocus&&(e.off("blur",this.onBlur),e.off("focus",this.onFocus)),e.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var e=this;this.keyMap={Enter:function(){e.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(t,n){if(t>=this.data.list.length?t=n?this.data.list.length-1:0:0>t&&(t=n?0:this.data.list.length-1),this.selectedHint!=t){var o=this.hints.childNodes[this.selectedHint];o.className=o.className.replace(" "+u,""),o=this.hints.childNodes[this.selectedHint=t],o.className+=" "+u,o.offsetTop<this.hints.scrollTop?this.hints.scrollTop=o.offsetTop-3:o.offsetTop+o.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=o.offsetTop+o.offsetHeight-this.hints.clientHeight+3),e.signal(this.data,"select",this.data.list[this.selectedHint],o)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},e.registerHelper("hint","auto",{resolve:function(t,n){var o=t.getHelpers(n,"hint"),r;if(o.length){var a=function(e,t,n){function r(o){return o==a.length?t(null):void l(a[o],e,n,function(e){e&&0<e.list.length?t(e):r(o+1)})}var a=d(e,o);r(0)};return a.async=!0,a.supportsSelection=!0,a}return(r=t.getHelper(t.getCursor(),"hintWords"))?function(t){return e.hint.fromList(t,{words:r})}:e.hint.anyword?function(t,n){return e.hint.anyword(t,n)}:function(){}}}),e.registerHelper("hint","fromList",function(t,n){var o=t.getCursor(),r=t.getTokenAt(o),a=e.Pos(o.line,r.end);if(r.string&&/\w/.test(r.string[r.string.length-1]))var s=r.string,d=e.Pos(o.line,r.start);else var s="",d=a;for(var l=[],p=0,i;p<n.words.length;p++)i=n.words[p],i.slice(0,s.length)==s&&l.push(i);if(l.length)return{list:l,from:d,to:a}}),e.commands.autocomplete=e.showHint;var g={hint:e.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};e.defineOption("hintOptions",null)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(t,n){for(var o=0,r=t.length;o<r;++o)n(t[o])}function n(e,t){if(!Array.prototype.indexOf){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1}return-1!=e.indexOf(t)}function o(t,n,o,r){var s=t.getCursor(),d=o(t,s);if(!/\b(?:string|comment)\b/.test(d.type)){d.state=e.innerMode(t.getMode(),d.state).state,/^[\w$_]*$/.test(d.string)?d.end>s.ch&&(d.end=s.ch,d.string=d.string.slice(0,s.ch-d.start)):d={start:s.ch,end:s.ch,string:"",state:d.state,type:"."==d.string?"property":null};for(var l=d;"property"==l.type;){if(l=o(t,i(s.line,l.start)),"."!=l.string)return;if(l=o(t,i(s.line,l.start)),!p)var p=[];p.push(l)}return{list:a(d,p,n,r),from:i(s.line,d.start),to:i(s.line,d.end)}}}function r(e,t){var n=e.getTokenAt(t);return t.ch==n.start+1&&"."==n.string.charAt(0)?(n.end=n.start,n.string=".",n.type="property"):/^\.[\w$_]*$/.test(n.string)&&(n.type="property",n.start++,n.string=n.string.replace(/\./,"")),n}function a(e,o,r,a){function i(e){0!=e.lastIndexOf(u,0)||n(c,e)||c.push(e)}function p(e){for(var n in"string"==typeof e?t(s,i):e instanceof Array?t(d,i):e instanceof Function&&t(l,i),e)i(n)}var c=[],u=e.string,h=a&&a.globalScope||window;if(o&&o.length){var m=o.pop(),g;for(m.type&&0===m.type.indexOf("variable")?(a&&a.additionalContext&&(g=a.additionalContext[m.string]),(!a||!1!==a.useGlobalScope)&&(g=g||h[m.string])):"string"==m.type?g="":"atom"==m.type?g=1:"function"==m.type&&(null!=h.jQuery&&("$"==m.string||"jQuery"==m.string)&&"function"==typeof h.jQuery?g=h.jQuery():null!=h._&&"_"==m.string&&"function"==typeof h._&&(g=h._()));null!=g&&o.length;)g=g[o.pop().string];null!=g&&p(g)}else{for(var f=e.state.localVars;f;f=f.next)i(f.name);for(var f=e.state.globalVars;f;f=f.next)i(f.name);a&&!1===a.useGlobalScope||p(h),t(r,i)}return c}var i=e.Pos;e.registerHelper("hint","javascript",function(e,t){return o(e,p,function(t,e){return t.getTokenAt(e)},t)}),e.registerHelper("hint","coffeescript",function(e,t){return o(e,c,r,t)});var s="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),d="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),l=["prototype","apply","call","bind"],p="break case catch continue debugger default delete do else false finally for function if in instanceof new null return switch throw true try typeof var void while with".split(" "),c="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t=Math.max,o=e.Pos;e.registerHelper("hint","xml",function(r,a){var s=a&&a.schemaInfo,d=a&&a.quoteChar||"\"";if(s){var l=r.getCursor(),p=r.getTokenAt(l);p.end>l.ch&&(p.end=l.ch,p.string=p.string.slice(0,l.ch-p.start));var c=e.innerMode(r.getMode(),p.state);if("xml"==c.mode.name){var u=[],h=!1,m=/\btag\b/.test(p.type)&&!/>$/.test(p.string),g=m&&/^\w/.test(p.string),f,y;if(g){var b=r.getLine(l.line).slice(t(0,p.start-2),p.start),v=/<\/$/.test(b)?"close":/<$/.test(b)?"open":null;v&&(y=p.start-("close"==v?2:1))}else m&&"<"==p.string?v="open":m&&"</"==p.string&&(v="close");if(!m&&!c.state.tagName||v){g&&(f=p.string),h=v;var x=c.state.context,C=x&&s[x.tagName],S=x?C&&C.children:s["!top"];if(S&&"close"!=v)for(var E=0;E<S.length;++E)f&&0!=S[E].lastIndexOf(f,0)||u.push("<"+S[E]);else if("close"!=v)for(var i in s)s.hasOwnProperty(i)&&"!top"!=i&&"!attrs"!=i&&(!f||0==i.lastIndexOf(f,0))&&u.push("<"+i);x&&(!f||"close"==v&&0==x.tagName.lastIndexOf(f,0))&&u.push("</"+x.tagName+">")}else{var C=s[c.state.tagName],k=C&&C.attrs,T=s["!attrs"];if(!k&&!T)return;if(!k)k=T;else if(T){var w={};for(var I in T)T.hasOwnProperty(I)&&(w[I]=T[I]);for(var I in k)k.hasOwnProperty(I)&&(w[I]=k[I]);k=w}if("string"==p.type||"="==p.string){var b=r.getRange(o(l.line,t(0,l.ch-60)),o(l.line,"string"==p.type?p.start:p.end)),N=b.match(/([^\s\u00a0=<>\"\']+)=$/),A;if(!N||!k.hasOwnProperty(N[1])||!(A=k[N[1]]))return;if("function"==typeof A&&(A=A.call(this,r)),"string"==p.type){f=p.string;var L=0;/['"]/.test(p.string.charAt(0))&&(d=p.string.charAt(0),f=p.string.slice(1),L++);var n=p.string.length;/['"]/.test(p.string.charAt(n-1))&&(d=p.string.charAt(n-1),f=p.string.substr(L,n-2)),h=!0}for(var E=0;E<A.length;++E)f&&0!=A[E].lastIndexOf(f,0)||u.push(d+A[E]+d)}else for(var R in"attribute"==p.type&&(f=p.string,h=!0),k)k.hasOwnProperty(R)&&(!f||0==R.lastIndexOf(f,0))&&u.push(R)}return{list:u,from:h?o(l.line,null==y?p.start:y):l,to:h?o(l.line,p.end):l}}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./xml-hint")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./xml-hint"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t in c)c.hasOwnProperty(t)&&(e.attrs[t]=c[t])}var n=["ab","aa","af","ak","sq","am","ar","an","hy","as","av","ae","ay","az","bm","ba","eu","be","bn","bh","bi","bs","br","bg","my","ca","ch","ce","ny","zh","cv","kw","co","cr","hr","cs","da","dv","nl","dz","en","eo","et","ee","fo","fj","fi","fr","ff","gl","ka","de","el","gn","gu","ht","ha","he","hz","hi","ho","hu","ia","id","ie","ga","ig","ik","io","is","it","iu","ja","jv","kl","kn","kr","ks","kk","km","ki","rw","ky","kv","kg","ko","ku","kj","la","lb","lg","li","ln","lo","lt","lu","lv","gv","mk","mg","ms","ml","mt","mi","mr","mh","mn","na","nv","nb","nd","ne","ng","nn","no","ii","nr","oc","oj","cu","om","or","os","pa","pi","fa","pl","ps","pt","qu","rm","rn","ro","ru","sa","sc","sd","se","sm","sg","sr","gd","sn","si","sk","sl","so","st","es","su","sw","ss","sv","ta","te","tg","th","ti","bo","tk","tl","tn","to","tr","ts","tt","tw","ty","ug","uk","ur","uz","ve","vi","vo","wa","cy","wo","fy","xh","yi","yo","za","zu"],o=["_blank","_self","_top","_parent"],r=["ascii","utf-8","utf-16","latin1","latin1"],a=["get","post","put","delete"],i=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],d=["all","screen","print","embossed","braille","handheld","print","projection","screen","tty","tv","speech","3d-glasses","resolution [>][<][=] [X]","device-aspect-ratio: X/Y","orientation:portrait","orientation:landscape","device-height: [X]","device-width: [X]"],l={attrs:{}},p={a:{attrs:{href:null,ping:null,type:null,media:d,target:o,hreflang:n}},abbr:l,acronym:l,address:l,applet:l,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:d,hreflang:n,type:null,shape:["default","rect","circle","poly"]}},article:l,aside:l,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["","autoplay"],loop:["","loop"],controls:["","controls"]}},b:l,base:{attrs:{href:null,target:o}},basefont:l,bdi:l,bdo:l,big:l,blockquote:{attrs:{cite:null}},body:l,br:l,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["","autofocus"],disabled:["","autofocus"],formenctype:i,formmethod:a,formnovalidate:["","novalidate"],formtarget:o,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:l,center:l,cite:l,code:l,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["","disabled"],checked:["","checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["","disabled"],multiple:["","multiple"]}},datalist:{attrs:{data:null}},dd:l,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["","open"]}},dfn:l,dir:l,div:l,dl:l,dt:l,em:l,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["","disabled"],form:null,name:null}},figcaption:l,figure:l,font:l,footer:l,form:{attrs:{action:null,name:null,"accept-charset":r,autocomplete:["on","off"],enctype:i,method:a,novalidate:["","novalidate"],target:o}},frame:l,frameset:l,h1:l,h2:l,h3:l,h4:l,h5:l,h6:l,head:{attrs:{},children:["title","base","link","style","meta","script","noscript","command"]},header:l,hgroup:l,hr:l,html:{attrs:{manifest:null},children:["head","body"]},i:l,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["","seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["","autofocus"],checked:["","checked"],disabled:["","disabled"],formenctype:i,formmethod:a,formnovalidate:["","novalidate"],formtarget:o,multiple:["","multiple"],readonly:["","readonly"],required:["","required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:l,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["","autofocus"],disabled:["","disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:l,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:n,media:d,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:l,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:r,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:l,noframes:l,noscript:l,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["","typemustmatch"]}},ol:{attrs:{reversed:["","reversed"],start:null,type:["1","a","A","i","I"]}},optgroup:{attrs:{disabled:["","disabled"],label:null}},option:{attrs:{disabled:["","disabled"],label:null,selected:["","selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:l,param:{attrs:{name:null,value:null}},pre:l,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:l,rt:l,ruby:l,s:l,samp:l,script:{attrs:{type:["text/javascript"],src:null,async:["","async"],defer:["","defer"],charset:r}},section:l,select:{attrs:{form:null,name:null,size:null,autofocus:["","autofocus"],disabled:["","disabled"],multiple:["","multiple"]}},small:l,source:{attrs:{src:null,type:null,media:null}},span:l,strike:l,strong:l,style:{attrs:{type:["text/css"],media:d,scoped:null}},sub:l,summary:l,sup:l,table:l,tbody:l,td:{attrs:{colspan:null,rowspan:null,headers:null}},textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["","autofocus"],disabled:["","disabled"],readonly:["","readonly"],required:["","required"],wrap:["soft","hard"]}},tfoot:l,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:l,time:{attrs:{datetime:null}},title:l,tr:l,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:n}},tt:l,u:l,ul:l,var:l,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["","autoplay"],mediagroup:["movie"],muted:["","muted"],controls:["","controls"]}},wbr:l},c={accesskey:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9"],class:null,contenteditable:["true","false"],contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["en","es"],spellcheck:["true","false"],style:null,tabindex:["1","2","3","4","5","6","7","8","9"],title:null,translate:["yes","no"],onclick:null,rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"]};for(var u in t(l),p)p.hasOwnProperty(u)&&p[u]!=l&&t(p[u]);e.htmlSchema=p,e.registerHelper("hint","html",function(t,n){var o={schemaInfo:p};if(n)for(var r in n)o[r]=n[r];return e.hint.xml(t,o)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../../mode/css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/css/css"],e):e(CodeMirror)}(function(e){"use strict";var t={link:1,visited:1,active:1,hover:1,focus:1,"first-letter":1,"first-line":1,"first-child":1,before:1,after:1,lang:1};e.registerHelper("hint","css",function(n){function o(e){for(var t in e)l&&0!=t.lastIndexOf(l,0)||c.push(t)}var r=n.getCursor(),a=n.getTokenAt(r),i=e.innerMode(n.getMode(),a.state);if("css"==i.mode.name){if("keyword"==a.type&&0=="!important".indexOf(a.string))return{list:["!important"],from:e.Pos(r.line,a.start),to:e.Pos(r.line,a.end)};var s=a.start,d=r.ch,l=a.string.slice(0,d-s);/[^\w$_-]/.test(l)&&(l="",s=d=r.ch);var p=e.resolveMode("text/css"),c=[],u=i.state.state;if("pseudo"==u||"variable-3"==a.type?o(t):"block"==u||"maybeprop"==u?o(p.propertyKeywords):"prop"==u||"parens"==u||"at"==u||"params"==u?(o(p.valueKeywords),o(p.colorKeywords)):("media"==u||"media_parens"==u)&&(o(p.mediaTypes),o(p.mediaFeatures)),c.length)return{list:c,from:e.Pos(r.line,s),to:e.Pos(r.line,d)}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",a),e.removeLineClass(e.state.activeLines[t],"background",s),e.removeLineClass(e.state.activeLines[t],"gutter",d)}function n(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function o(e,o){for(var r=[],l=0,i;l<o.length;l++)if(i=o[l],i.empty()){var p=e.getLineHandleVisualStart(i.head.line);r[r.length-1]!=p&&r.push(p)}n(e.state.activeLines,r)||e.operation(function(){t(e);for(var n=0;n<r.length;n++)e.addLineClass(r[n],"wrap",a),e.addLineClass(r[n],"background",s),e.addLineClass(r[n],"gutter",d);e.state.activeLines=r})}function r(e,t){o(e,t.ranges)}var a="CodeMirror-activeline",s="CodeMirror-activeline-background",d="CodeMirror-activeline-gutter";e.defineOption("styleActiveLine",!1,function(n,a,i){var s=i&&i!=e.Init;a&&!s?(n.state.activeLines=[],o(n,n.listSelections()),n.on("beforeSelectionChange",r)):!a&&s&&(n.off("beforeSelectionChange",r),t(n),delete n.state.activeLines)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,a){if(this.atOccurrence=!1,this.doc=e,null==a&&"string"==typeof t&&(a=!1),r=r?e.clipPos(r):o(0,0),this.pos={from:r,to:r},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(n,r){if(n){t.lastIndex=0;for(var a=e.getLine(r.line).slice(0,r.ch),i=0,s,d;;){t.lastIndex=i;var l=t.exec(a);if(!l)break;if(s=l,d=s.index,i=s.index+(s[0].length||1),i==a.length)break}var p=s&&s[0].length||0;p||(0==d&&0==a.length?s=void 0:d!=e.getLine(r.line).length&&p++)}else{t.lastIndex=r.ch;var a=e.getLine(r.line),s=t.exec(a),p=s&&s[0].length||0,d=s&&s.index;d+p==a.length||p||(p=1)}return s&&p?{from:o(r.line,d),to:o(r.line,d+p),match:s}:void 0};else{var i=t;a&&(t=t.toLowerCase());var s=a?function(e){return e.toLowerCase()}:function(e){return e},d=t.split("\n");if(1==d.length)this.matches=t.length?function(r,a){if(r){var d=e.getLine(a.line).slice(0,a.ch),l=s(d),p=l.lastIndexOf(t);if(-1<p)return p=n(d,l,p),{from:o(a.line,p),to:o(a.line,p+i.length)}}else{var d=e.getLine(a.line).slice(a.ch),l=s(d),p=l.indexOf(t);if(-1<p)return p=n(d,l,p)+a.ch,{from:o(a.line,p),to:o(a.line,p+i.length)}}}:function(){};else{var l=i.split("\n");this.matches=function(t,n){var r=d.length-1;if(t){if(n.line-(d.length-1)<e.firstLine())return;if(s(e.getLine(n.line).slice(0,l[r].length))!=d[d.length-1])return;for(var a=o(n.line,l[r].length),p=n.line-1,c=r-1;1<=c;--c,--p)if(d[c]!=s(e.getLine(p)))return;var i=e.getLine(p),u=i.length-l[0].length;return s(i.slice(u))==d[0]?{from:o(p,u),to:a}:void 0}if(!(n.line+(d.length-1)>e.lastLine())){var i=e.getLine(n.line),u=i.length-l[0].length;if(s(i.slice(u))==d[0]){for(var h=o(n.line,u),p=n.line+1,c=1;c<r;++c,++p)if(d[c]!=s(e.getLine(p)))return;return s(e.getLine(p).slice(0,l[r].length))==d[r]?{from:h,to:o(p,l[r].length)}:void 0}}}}}}function n(e,t,n){if(e.length==t.length)return n;for(var o=Math.min(n,e.length),r;;)if(r=e.slice(0,o).toLowerCase().length,r<n)++o;else if(r>n)--o;else return o}var o=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=o(e,0);return n.pos={from:t,to:t},n.atOccurrence=!1,!1}for(var n=this,r=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,r))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!r.line)return t(0);r=o(r.line-1,this.doc.getLine(r.line-1).length)}else{var a=this.doc.lineCount();if(r.line==a-1)return t(a);r=o(r.line+1,0)}}},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(t,n){if(this.atOccurrence){var r=e.splitLines(t);this.doc.replaceRange(r,this.pos.from,this.pos.to,n),this.pos.to=o(this.pos.from.line+r.length-1,r[r.length-1].length+(1==r.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,n,o){return new t(this.doc,e,n,o)}),e.defineDocExtension("getSearchCursor",function(e,n,o){return new t(this,e,n,o)}),e.defineExtension("selectMatches",function(t,n){for(var o=[],r=this.getSearchCursor(t,this.getCursor("from"),n);r.findNext()&&!(0<e.cmpPos(r.to(),this.getCursor("to")));)o.push({anchor:r.from(),head:r.to()});o.length&&this.setSelections(o,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):!e.global&&(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var n=e.exec(t.string);return n&&n.index==t.pos?(t.pos+=n[0].length||1,"searching"):void(n?t.pos=n.index:t.skipToEnd())}}}function n(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function o(e){return e.state.search||(e.state.search=new n)}function r(e){return"string"==typeof e&&e==e.toLowerCase()}function a(e,t,n){return e.getSearchCursor(t,n,r(t))}function i(e,t,n,o){e.openDialog(t,o,{value:n,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){m(e)}})}function s(e,t,n,o,r){e.openDialog?e.openDialog(t,r,{value:o,selectValueOnOpen:!0}):r(prompt(n,o))}function d(e,t,n,o){e.openConfirm?e.openConfirm(t,o):confirm(n)&&o[0]()}function l(e){return e.replace(/\\(.)/g,function(e,t){return"n"==t?"\n":"r"==t?"\r":t})}function p(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(t){}else e=l(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function c(e,n,o){n.queryText=o,n.query=p(o),e.removeOverlay(n.overlay,r(n.query)),n.overlay=t(n.query,r(n.query)),e.addOverlay(n.overlay),e.showMatchesOnScrollbar&&(n.annotate&&(n.annotate.clear(),n.annotate=null),n.annotate=e.showMatchesOnScrollbar(n.query,r(n.query)))}function u(t,n,r){var a=o(t);if(a.query)return h(t,n);var d=t.getSelection()||a.lastQuery;if(r&&t.openDialog){var l=null;i(t,y,d,function(n,o){e.e_stop(o);n&&(n!=a.queryText&&(c(t,a,n),a.posFrom=a.posTo=t.getCursor()),l&&(l.style.opacity=1),h(t,o.shiftKey,function(e,n){var o;3>n.line&&document.querySelector&&(o=t.display.wrapper.querySelector(".CodeMirror-dialog"))&&o.getBoundingClientRect().bottom-4>t.cursorCoords(n,"window").top&&((l=o).style.opacity=.4)}))})}else s(t,y,"Search for:",d,function(e){e&&!a.query&&t.operation(function(){c(t,a,e),a.posFrom=a.posTo=t.getCursor(),h(t,n)})})}function h(t,n,r){t.operation(function(){var i=o(t),s=a(t,i.query,n?i.posFrom:i.posTo);!s.find(n)&&(s=a(t,i.query,n?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),!s.find(n))||(t.setSelection(s.from(),s.to()),t.scrollIntoView({from:s.from(),to:s.to()},20),i.posFrom=s.from(),i.posTo=s.to(),r&&r(s.from(),s.to()))})}function m(e){e.operation(function(){var t=o(e);t.lastQuery=t.query;t.query&&(t.query=t.queryText=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function g(e,t,n){e.operation(function(){for(var o=a(e,t);o.findNext();)if("string"!=typeof t){var r=e.getRange(o.from(),o.to()).match(t);o.replace(n.replace(/\$(\d)/g,function(e,t){return r[t]}))}else o.replace(n)})}function f(e,t){if(!e.getOption("readOnly")){var n=e.getSelection()||o(e).lastQuery,r=t?"Replace all:":"Replace:";s(e,r+b,r,n,function(n){n&&(n=p(n),s(e,v,"Replace with:","",function(o){if(o=l(o),t)g(e,n,o);else{m(e);var r=a(e,n,e.getCursor("from")),i=function(){var t=r.from(),l;!(l=r.findNext())&&(r=a(e,n),!(l=r.findNext())||t&&r.from().line==t.line&&r.from().ch==t.ch)||(e.setSelection(r.from(),r.to()),e.scrollIntoView({from:r.from(),to:r.to()}),d(e,x,"Replace?",[function(){s(l)},i,function(){g(e,n,o)}]))},s=function(e){r.replace("string"==typeof n?o:o.replace(/\$(\d)/g,function(t,n){return e[n]})),i()};i()}}))})}}var y="Search: <input type=\"text\" style=\"width: 10em\" class=\"CodeMirror-search-field\"/> <span style=\"color: #888\" class=\"CodeMirror-search-hint\">(Use /re/ syntax for regexp search)</span>",b=" <input type=\"text\" style=\"width: 10em\" class=\"CodeMirror-search-field\"/> <span style=\"color: #888\" class=\"CodeMirror-search-hint\">(Use /re/ syntax for regexp search)</span>",v="With: <input type=\"text\" style=\"width: 10em\" class=\"CodeMirror-search-field\"/>",x="Replace? <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>";e.commands.find=function(e){m(e),u(e)},e.commands.findPersistent=function(e){m(e),u(e,!1,!0)},e.commands.findNext=u,e.commands.findPrev=function(e){u(e,!0)},e.commands.clearSearch=m,e.commands.replace=f,e.commands.replaceAll=function(e){f(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(t){function e(e,t,n){var o=e.getWrapperElement(),r;return r=o.appendChild(document.createElement("div")),r.className=n?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?r.innerHTML=t:r.appendChild(t),r}function n(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}t.defineExtension("openDialog",function(o,r,a){function i(e){if("string"==typeof e)p.value=e;else{if(d)return;d=!0,s.parentNode.removeChild(s),l.focus(),a.onClose&&a.onClose(s)}}a||(a={}),n(this,null);var s=e(this,o,a.bottom),d=!1,l=this,p=s.getElementsByTagName("input")[0],c;return p?(p.focus(),a.value&&(p.value=a.value,!1!==a.selectValueOnOpen&&p.select()),a.onInput&&t.on(p,"input",function(t){a.onInput(t,p.value,i)}),a.onKeyUp&&t.on(p,"keyup",function(t){a.onKeyUp(t,p.value,i)}),t.on(p,"keydown",function(n){a&&a.onKeyDown&&a.onKeyDown(n,p.value,i)||((27==n.keyCode||!1!==a.closeOnEnter&&13==n.keyCode)&&(p.blur(),t.e_stop(n),i()),13==n.keyCode&&r(p.value,n))}),!1!==a.closeOnBlur&&t.on(p,"blur",i)):(c=s.getElementsByTagName("button")[0])&&(t.on(c,"click",function(){i(),l.focus()}),!1!==a.closeOnBlur&&t.on(c,"blur",i),c.focus()),i}),t.defineExtension("openConfirm",function(o,r,a){function s(){p||(p=!0,d.parentNode.removeChild(d),c.focus())}n(this,null);var d=e(this,o,a&&a.bottom),l=d.getElementsByTagName("button"),p=!1,c=this,u=1;l[0].focus();for(var h=0,i;h<l.length;++h)i=l[h],function(n){t.on(i,"click",function(o){t.e_preventDefault(o),s(),n&&n(c)})}(r[h]),t.on(i,"blur",function(){--u,setTimeout(function(){0>=u&&s()},200)}),t.on(i,"focus",function(){++u})}),t.defineExtension("openNotification",function(o,r){function a(){s||(s=!0,clearTimeout(l),i.parentNode.removeChild(i))}n(this,a);var i=e(this,o,r&&r.bottom),s=!1,d=r&&"undefined"!=typeof r.duration?r.duration:5e3,l;return t.on(i,"click",function(n){t.e_preventDefault(n),a()}),d&&(l=setTimeout(a,d)),a})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n,o,r){e.openDialog?e.openDialog(t,r,{value:o,selectValueOnOpen:!0}):r(prompt(n,o))}function n(e,t){var n=+t;return /^[-+]/.test(t)?e.getCursor().line+n:n-1}e.commands.jumpToLine=function(e){var o=e.getCursor();t(e,"Jump to line: <input type=\"text\" style=\"width: 10em\" class=\"CodeMirror-search-field\"/> <span style=\"color: #888\" class=\"CodeMirror-search-hint\">(Use line:column or scroll% syntax)</span>","Jump to line:",o.line+1+":"+o.ch,function(t){if(t){var r;if(r=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(t))e.setCursor(n(e,r[1]),+r[2]);else if(r=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(t)){var a=Math.round(e.lineCount()*+r[1]/100);/^[-+]/.test(r[1])&&(a=o.line+a+1),e.setCursor(a-1,o.ch)}else(r=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(t))&&e.setCursor(n(e,r[1]),o.ch)}})},e.keyMap["default"]["Alt-G"]="jumpToLine"}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},n={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};e.defineMode("xml",function(o,r){function a(e,t){function n(n){return t.tokenize=n,n(e,t)}var o=e.next();if("<"==o)return e.eat("!")?e.eat("[")?e.match("CDATA[")?n(d("atom","]]>")):null:e.match("--")?n(d("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),n(l(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=d("meta","?>"),"meta"):(w=e.eat("/")?"closeTag":"openTag",t.tokenize=i,"tag bracket");if("&"==o){var r;return r=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),r?"atom":"error"}return e.eatWhile(/[^&<]/),null}function i(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=a,w=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return w="equals",null;if("<"==n){t.tokenize=a,t.state=h,t.tagName=t.tagStart=null;var o=t.tokenize(e,t);return o?o+" tag error":"tag error"}return /[\'\"]/.test(n)?(t.tokenize=s(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function s(e){var t=function(t,n){for(;!t.eol();)if(t.next()==e){n.tokenize=i;break}return"string"};return t.isInAttribute=!0,t}function d(e,t){return function(n,o){for(;!n.eol();){if(n.match(t)){o.tokenize=a;break}n.next()}return e}}function l(e){return function(t,n){for(var o;null!=(o=t.next());){if("<"==o)return n.tokenize=l(e+1),n.tokenize(t,n);if(">"==o)if(1==e){n.tokenize=a;break}else return n.tokenize=l(e-1),n.tokenize(t,n)}return"meta"}}function p(e,t,n){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=n,(E.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function c(e){e.context&&(e.context=e.context.prev)}function u(e,t){for(var n;;){if(!e.context)return;if(n=e.context.tagName,!E.contextGrabbers.hasOwnProperty(n)||!E.contextGrabbers[n].hasOwnProperty(t))return;c(e)}}function h(e,t,n){return"openTag"==e?(n.tagStart=t.column(),m):"closeTag"==e?g:h}function m(e,t,n){return"word"==e?(n.tagName=t.current(),I="tag",b):(I="error",m)}function g(e,t,n){if("word"==e){var o=t.current();return n.context&&n.context.tagName!=o&&E.implicitlyClosed.hasOwnProperty(n.context.tagName)&&c(n),n.context&&n.context.tagName==o||!1===E.matchClosing?(I="tag",f):(I="tag error",y)}return I="error",y}function f(e,t,n){return"endTag"==e?(c(n),h):(I="error",f)}function y(e,t,n){return I="error",f(e,t,n)}function b(e,t,n){if("word"==e)return I="attribute",v;if("endTag"==e||"selfcloseTag"==e){var o=n.tagName,r=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==e||E.autoSelfClosers.hasOwnProperty(o)?u(n,o):(u(n,o),n.context=new p(n,o,r==n.indented)),h}return I="error",b}function v(e,t,n){return"equals"==e?x:(E.allowMissing||(I="error"),b(e,t,n))}function x(e,t,n){return"string"==e?C:"word"==e&&E.allowUnquoted?(I="string",b):(I="error",b(e,t,n))}function C(e,t,n){return"string"==e?C:b(e,t,n)}var S=o.indentUnit,E={},k=r.htmlMode?t:n;for(var T in k)E[T]=k[T];for(var T in r)E[T]=r[T];var w,I;return a.isInText=!0,{startState:function(e){var t={tokenize:a,state:h,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;w=null;var n=t.tokenize(e,t);return(n||w)&&"comment"!=n&&(I=null,t.state=t.state(w||n,e,t),I&&(n="error"==I?n+" error":I)),n},indent:function(t,n,o){var r=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+S;if(r&&r.noIndent)return e.Pass;if(t.tokenize!=i&&t.tokenize!=a)return o?o.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1===E.multilineTagIndentPastTag?t.tagStart+S*(E.multilineTagIndentFactor||1):t.tagStart+t.tagName.length+2;if(E.alignCDATA&&/<!\[CDATA\[/.test(n))return 0;var s=n&&/^<(\/)?([\w_:\.-]*)/.exec(n);if(s&&s[1]){for(;r;)if(r.tagName==s[2]){r=r.prev;break}else if(E.implicitlyClosed.hasOwnProperty(r.tagName))r=r.prev;else break;}else if(s)for(;r;){var d=E.contextGrabbers[r.tagName];if(d&&d.hasOwnProperty(s[2]))r=r.prev;else break}for(;r&&r.prev&&!r.startOfLine;)r=r.prev;return r?r.indent+S:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:E.htmlMode?"html":"xml",helperType:E.htmlMode?"html":"xml",skipAttribute:function(e){e.state==x&&(e.state=b)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n){return /^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(n||0)))}e.defineMode("javascript",function(n,o){function r(e){for(var t=!1,n=!1,o;null!=(o=e.next());){if(!t){if("/"==o&&!n)return;"["==o?n=!0:n&&"]"==o&&(n=!1)}t=!t&&"\\"==o}}function a(e,t,n){return Pe=e,_e=n,t}function s(e,n){var o=e.next();if("\""==o||"'"==o)return n.tokenize=i(o),n.tokenize(e,n);if("."==o&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return a("number","number");if("."==o&&e.match(".."))return a("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(o))return a(o);if("="==o&&e.eat(">"))return a("=>","operator");if("0"==o&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),a("number","number");if("0"==o&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),a("number","number");if("0"==o&&e.eat(/b/i))return e.eatWhile(/[01]/i),a("number","number");if(/\d/.test(o))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),a("number","number");if("/"==o)return e.eat("*")?(n.tokenize=d,d(e,n)):e.eat("/")?(e.skipToEnd(),a("comment","comment")):t(e,n,1)?(r(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),a("regexp","string-2")):(e.eatWhile(Ie),a("operator","operator",e.current()));if("`"==o)return n.tokenize=l,l(e,n);if("#"==o)return e.skipToEnd(),a("error","error");if(Ie.test(o))return e.eatWhile(Ie),a("operator","operator",e.current());if(Te.test(o)){e.eatWhile(Te);var s=e.current(),p=we.propertyIsEnumerable(s)&&we[s];return p&&"."!=n.lastType?a(p.type,p.style,s):a("variable","variable",s)}}function i(e){return function(t,n){var o=!1,r;if(Se&&"@"==t.peek()&&t.match(Ne))return n.tokenize=s,a("jsonld-keyword","meta");for(;null!=(r=t.next())&&(r!=e||o);)o=!o&&"\\"==r;return o||(n.tokenize=s),a("string","string")}}function d(e,t){for(var n=!1,o;o=e.next();){if("/"==o&&n){t.tokenize=s;break}n="*"==o}return a("comment","comment")}function l(e,t){for(var n=!1,o;null!=(o=e.next());){if(!n&&("`"==o||"$"==o&&e.eat("{"))){t.tokenize=s;break}n=!n&&"\\"==o}return a("quasi","string-2",e.current())}function p(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(!(0>n)){for(var o=0,r=!1,a=n-1;0<=a;--a){var i=e.string.charAt(a),s=Ae.indexOf(i);if(0<=s&&3>s){if(!o){++a;break}if(0==--o)break}else if(3<=s&&6>s)++o;else if(Te.test(i))r=!0;else{if(/["'\/]/.test(i))return;if(r&&!o){++a;break}}}r&&!o&&(t.fatArrowAt=a)}}function c(e,t,n,o,r,a){this.indented=e,this.column=t,this.type=n,this.prev=r,this.info=a,null!=o&&(this.align=o)}function u(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var o=e.context;o;o=o.prev)for(var n=o.vars;n;n=n.next)if(n.name==t)return!0}function h(e,t,n,o,r){var a=e.cc;for(Re.state=e,Re.stream=r,Re.marked=null,Re.cc=a,Re.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var i=a.length?a.pop():Ee?E:S;if(i(n,o)){for(;a.length&&a[a.length-1].lex;)a.pop()();return Re.marked?Re.marked:"variable"==n&&u(e,o)?"variable-2":t}}}function m(){for(var e=arguments.length-1;0<=e;e--)Re.cc.push(arguments[e])}function g(){return m.apply(null,arguments),!0}function f(e){function t(t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}var n=Re.state;if(Re.marked="def",n.context){if(t(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(t(n.globalVars))return;o.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function y(){Re.state.context={prev:Re.state.context,vars:Re.state.localVars},Re.state.localVars=Oe}function b(){Re.state.localVars=Re.state.context.vars,Re.state.context=Re.state.context.prev}function v(e,t){var n=function(){var n=Re.state,o=n.indented;if("stat"==n.lexical.type)o=n.lexical.indented;else for(var r=n.lexical;r&&")"==r.type&&r.align;r=r.prev)o=r.indented;n.lexical=new c(o,Re.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function x(){var e=Re.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function C(e){function t(n){return n==e?g():";"==e?m():g(t)}return t}function S(e,t){return"var"==e?g(v("vardef",t.length),X,C(";"),x):"keyword a"==e?g(v("form"),E,S,x):"keyword b"==e?g(v("form"),S,x):"{"==e?g(v("}"),q,x):";"==e?g():"if"==e?("else"==Re.state.lexical.info&&Re.state.cc[Re.state.cc.length-1]==x&&Re.state.cc.pop()(),g(v("form"),E,S,x,Z)):"function"==e?g(ae):"for"==e?g(v("form"),ee,S,x):"variable"==e?g(v("stat"),F):"switch"==e?g(v("form"),E,v("}","switch"),C("{"),q,x,x):"case"==e?g(E,C(":")):"default"==e?g(C(":")):"catch"==e?g(v("form"),y,C("("),ie,C(")"),S,x,b):"class"==e?g(v("form"),se,x):"export"==e?g(v("stat"),ce,x):"import"==e?g(v("stat"),ue,x):"module"==e?g(v("form"),Q,v("}"),C("{"),q,x,x):m(v("stat"),E,C(";"),x)}function E(e){return T(e,!1)}function k(e){return T(e,!0)}function T(e,t){if(Re.state.fatArrowAt==Re.stream.start){var n=t?P:O;if("("==e)return g(y,v(")"),H(Q,")"),x,C("=>"),n,b);if("variable"==e)return m(y,Q,C("=>"),n,b)}var o=t?A:N;return Le.hasOwnProperty(e)?g(o):"function"==e?g(ae,o):"keyword c"==e?g(t?I:w):"("==e?g(v(")"),w,be,C(")"),x,o):"operator"==e||"spread"==e?g(t?k:E):"["==e?g(v("]"),fe,x,o):"{"==e?j(U,"}",null,o):"quasi"==e?m(L,o):"new"==e?g(_(t)):g()}function w(e){return e.match(/[;\}\)\],]/)?m():m(E)}function I(e){return e.match(/[;\}\)\],]/)?m():m(k)}function N(e,t){return","==e?g(E):A(e,t,!1)}function A(e,t,n){var o=!1==n?N:A,r=!1==n?E:k;return"=>"==e?g(y,n?P:O,b):"operator"==e?/\+\+|--/.test(t)?g(o):"?"==t?g(E,C(":"),r):g(r):"quasi"==e?m(L,o):";"==e?void 0:"("==e?j(k,")","call",o):"."==e?g(B,o):"["==e?g(v("]"),w,C("]"),x,o):void 0}function L(e,t){return"quasi"==e?"${"==t.slice(t.length-2)?g(E,R):g(L):m()}function R(e){if("}"==e)return Re.marked="string-2",Re.state.tokenize=l,g(L)}function O(e){return p(Re.stream,Re.state),m("{"==e?S:E)}function P(e){return p(Re.stream,Re.state),m("{"==e?S:k)}function _(e){return function(t){return"."==t?g(e?M:D):m(e?k:E)}}function D(e,t){if("target"==t)return Re.marked="keyword",g(N)}function M(e,t){if("target"==t)return Re.marked="keyword",g(A)}function F(e){return":"==e?g(x,S):m(N,C(";"),x)}function B(e){if("variable"==e)return Re.marked="property",g()}function U(e,t){return"variable"==e||"keyword"==Re.style?(Re.marked="property","get"==t||"set"==t?g(V):g(W)):"number"==e||"string"==e?(Re.marked=Se?"property":Re.style+" property",g(W)):"jsonld-keyword"==e?g(W):"modifier"==e?g(U):"["==e?g(E,C("]"),W):"spread"==e?g(E):void 0}function V(e){return"variable"==e?(Re.marked="property",g(ae)):m(W)}function W(e){return":"==e?g(k):"("==e?m(ae):void 0}function H(e,t){function n(o){if(","==o){var r=Re.state.lexical;return"call"==r.info&&(r.pos=(r.pos||0)+1),g(e,n)}return o==t?g():g(C(t))}return function(o){return o==t?g():m(e,n)}}function j(e,t,n){for(var o=3;o<arguments.length;o++)Re.cc.push(arguments[o]);return g(v(t,n),H(e,t),x)}function q(e){return"}"==e?g():m(S,q)}function z(e){if(ke&&":"==e)return g(G)}function K(e,t){if("="==t)return g(k)}function G(e){if("variable"==e)return Re.marked="variable-3",g()}function X(){return m(Q,z,J,$)}function Q(e,t){return"modifier"==e?g(Q):"variable"==e?(f(t),g()):"spread"==e?g(Q):"["==e?j(Q,"]"):"{"==e?j(Y,"}"):void 0}function Y(e,t){return"variable"!=e||Re.stream.match(/^\s*:/,!1)?("variable"==e&&(Re.marked="property"),"spread"==e?g(Q):"}"==e?m():g(C(":"),Q,J)):(f(t),g(J))}function J(e,t){if("="==t)return g(k)}function $(e){if(","==e)return g(X)}function Z(e,t){if("keyword b"==e&&"else"==t)return g(v("form","else"),S,x)}function ee(e){if("("==e)return g(v(")"),te,C(")"),x)}function te(e){return"var"==e?g(X,C(";"),oe):";"==e?g(oe):"variable"==e?g(ne):m(E,C(";"),oe)}function ne(e,t){return"in"==t||"of"==t?(Re.marked="keyword",g(E)):g(N,oe)}function oe(e,t){return";"==e?g(re):"in"==t||"of"==t?(Re.marked="keyword",g(E)):m(E,C(";"),re)}function re(e){")"!=e&&g(E)}function ae(e,t){return"*"==t?(Re.marked="keyword",g(ae)):"variable"==e?(f(t),g(ae)):"("==e?g(y,v(")"),H(ie,")"),x,S,b):void 0}function ie(e){return"spread"==e?g(ie):m(Q,z,K)}function se(e,t){if("variable"==e)return f(t),g(de)}function de(e,t){return"extends"==t?g(E,de):"{"==e?g(v("}"),le,x):void 0}function le(e,t){return"variable"==e||"keyword"==Re.style?"static"==t?(Re.marked="keyword",g(le)):(Re.marked="property","get"==t||"set"==t?g(pe,ae,le):g(ae,le)):"*"==t?(Re.marked="keyword",g(le)):";"==e?g(le):"}"==e?g():void 0}function pe(e){return"variable"==e?(Re.marked="property",g()):m()}function ce(e,t){return"*"==t?(Re.marked="keyword",g(ge,C(";"))):"default"==t?(Re.marked="keyword",g(E,C(";"))):m(S)}function ue(e){return"string"==e?g():m(he,ge)}function he(e,t){return"{"==e?j(he,"}"):("variable"==e&&f(t),"*"==t&&(Re.marked="keyword"),g(me))}function me(e,t){if("as"==t)return Re.marked="keyword",g(he)}function ge(e,t){if("from"==t)return Re.marked="keyword",g(E)}function fe(e){return"]"==e?g():m(k,ye)}function ye(e){return"for"==e?m(be,C("]")):","==e?g(H(I,"]")):m(H(k,"]"))}function be(e){return"for"==e?g(ee,be):"if"==e?g(E,be):void 0}function ve(e,t){return"operator"==e.lastType||","==e.lastType||Ie.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}var xe=n.indentUnit,Ce=o.statementIndent,Se=o.jsonld,Ee=o.json||Se,ke=o.typescript,Te=o.wordCharacters||/[\w$\xa1-\uffff]/,we=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),o=e("keyword c"),r=e("operator"),a={type:"atom",style:"atom"},i={if:e("if"),while:t,with:t,else:n,do:n,try:n,finally:n,return:o,break:o,continue:o,new:e("new"),delete:o,throw:o,debugger:o,var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:r,typeof:r,instanceof:r,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:e("this"),class:e("class"),super:e("atom"),yield:o,export:e("export"),import:e("import"),extends:o};if(ke){var s={type:"variable",style:"variable-3"},d={interface:e("class"),implements:o,namespace:o,module:e("module"),enum:e("module"),public:e("modifier"),private:e("modifier"),protected:e("modifier"),abstract:e("modifier"),as:r,string:s,number:s,boolean:s,any:s};for(var l in d)i[l]=d[l]}return i}(),Ie=/[+\-*&%=<>!?|~^]/,Ne=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Ae="([{}])",Le={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0},Re={state:null,column:null,marked:null,cc:null},Oe={name:"this",next:{name:"arguments"}},Pe,_e;return x.lex=!0,{startState:function(e){var t={tokenize:s,lastType:"sof",cc:[],lexical:new c((e||0)-xe,0,"block",!1),localVars:o.localVars,context:o.localVars&&{vars:o.localVars},indented:e||0};return o.globalVars&&"object"==typeof o.globalVars&&(t.globalVars=o.globalVars),t},token:function(e,t){if(e.sol()&&(!t.lexical.hasOwnProperty("align")&&(t.lexical.align=!1),t.indented=e.indentation(),p(e,t)),t.tokenize!=d&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==Pe?n:(t.lastType="operator"==Pe&&("++"==_e||"--"==_e)?"incdec":Pe,h(t,n,Pe,_e,e))},indent:function(t,n){if(t.tokenize==d)return e.Pass;if(t.tokenize!=s)return 0;var r=n&&n.charAt(0),a=t.lexical;if(!/^\s*else\b/.test(n))for(var l=t.cc.length-1,i;0<=l;--l)if(i=t.cc[l],i==x)a=a.prev;else if(i!=Z)break;"stat"==a.type&&"}"==r&&(a=a.prev),Ce&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var p=a.type,c=r==p;return"vardef"==p?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==p&&"{"==r?a.indented:"form"==p?a.indented+xe:"stat"==p?a.indented+(ve(t,n)?Ce||xe:0):"switch"!=a.info||c||!1==o.doubleIndentSwitch?a.align?a.column+(c?0:1):a.indented+(c?0:xe):a.indented+(/^(?:case|default)\b/.test(n)?xe:2*xe)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Ee?null:"/*",blockCommentEnd:Ee?null:"*/",lineComment:Ee?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Ee?"json":"javascript",jsonldMode:Se,jsonMode:Ee,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1];(t==E||t==k)&&e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=!0;return t}function n(e,t){for(var n=!1,o;null!=(o=e.next());){if(n&&"/"==o){t.tokenize=null;break}n="*"==o}return["comment","comment"]}e.defineMode("css",function(t,n){function o(e,t){return A=t,e}function r(e,t){var n=e.next();if(g[n]){var r=g[n](e,t);if(!1!==r)return r}if("@"==n)return e.eatWhile(/[\w\\\-]/),o("def",e.current());if("="==n||("~"==n||"|"==n)&&e.eat("="))return o(null,"compare");if("\""==n||"'"==n)return t.tokenize=a(n),t.tokenize(e,t);if("#"==n)return e.eatWhile(/[\w\\\-]/),o("atom","hash");if("!"==n)return e.match(/^\s*\w*/),o("keyword","important");if(/\d/.test(n)||"."==n&&e.eat(/\d/))return e.eatWhile(/[\w.%]/),o("number","unit");if("-"===n){if(/[\d.]/.test(e.peek()))return e.eatWhile(/[\w.%]/),o("number","unit");if(e.match(/^-[\w\\\-]+/))return e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?o("variable-2","variable-definition"):o("variable-2","variable");if(e.match(/^\w+-/))return o("meta","meta")}else return /[,+>*\/]/.test(n)?o(null,"select-op"):"."==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?o("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(n)?o(null,n):"u"==n&&e.match(/rl(-prefix)?\(/)||"d"==n&&e.match("omain(")||"r"==n&&e.match("egexp(")?(e.backUp(1),t.tokenize=i,o("property","word")):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),o("property","word")):o(null,null)}function a(e){return function(t,n){for(var r=!1,a;null!=(a=t.next());){if(a==e&&!r){")"==e&&t.backUp(1);break}r=!r&&"\\"==a}return a!=e&&(r||")"==e)||(n.tokenize=null),o("string","string")}}function i(e,t){return e.next(),t.tokenize=e.match(/\s*[\"\')]/,!1)?null:a(")"),o(null,"(")}function s(e,t,n){this.type=e,this.indent=t,this.prev=n}function d(e,t,n,o){return e.context=new s(n,t.indentation()+(!1===o?0:m),e.context),n}function l(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function p(e,t,n){return N[n.context.type](e,t,n)}function c(e,t,o,r){for(var n=r||1;0<n;n--)o.context=o.context.prev;return p(e,t,o)}function u(e){var t=e.current().toLowerCase();L=T.hasOwnProperty(t)?"atom":k.hasOwnProperty(t)?"keyword":"variable"}var h=n.inline;n.propertyKeywords||(n=e.resolveMode("text/css"));var m=t.indentUnit,g=n.tokenHooks,f=n.documentTypes||{},y=n.mediaTypes||{},b=n.mediaFeatures||{},v=n.mediaValueKeywords||{},x=n.propertyKeywords||{},C=n.nonStandardPropertyKeywords||{},S=n.fontProperties||{},E=n.counterDescriptors||{},k=n.colorKeywords||{},T=n.valueKeywords||{},w=n.allowNested,I=!0===n.supportsAtComponent,N={},A,L;return N.top=function(e,t,n){if("{"==e)return d(n,t,"block");if("}"==e&&n.context.prev)return l(n);if(I&&/@component/.test(e))return d(n,t,"atComponentBlock");if(/^@(-moz-)?document$/.test(e))return d(n,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(e))return d(n,t,"atBlock");if(/^@(font-face|counter-style)/.test(e))return n.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return d(n,t,"at");if("hash"==e)L="builtin";else if("word"==e)L="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return d(n,t,"interpolation");if(":"==e)return"pseudo";if(w&&"("==e)return d(n,t,"parens")}return n.context.type},N.block=function(e,t,n){if("word"==e){var o=t.current().toLowerCase();return x.hasOwnProperty(o)?(L="property","maybeprop"):C.hasOwnProperty(o)?(L="string-2","maybeprop"):w?(L=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(L+=" error","maybeprop")}return"meta"==e?"block":w||"hash"!=e&&"qualifier"!=e?N.top(e,t,n):(L="error","block")},N.maybeprop=function(e,t,n){return":"==e?d(n,t,"prop"):p(e,t,n)},N.prop=function(e,t,n){if(";"==e)return l(n);if("{"==e&&w)return d(n,t,"propBlock");if("}"==e||"{"==e)return c(e,t,n);if("("==e)return d(n,t,"parens");if("hash"==e&&!/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current()))L+=" error";else if("word"==e)u(t);else if("interpolation"==e)return d(n,t,"interpolation");return"prop"},N.propBlock=function(e,t,n){return"}"==e?l(n):"word"==e?(L="property","maybeprop"):n.context.type},N.parens=function(e,t,n){return"{"==e||"}"==e?c(e,t,n):")"==e?l(n):"("==e?d(n,t,"parens"):"interpolation"==e?d(n,t,"interpolation"):("word"==e&&u(t),"parens")},N.pseudo=function(e,t,n){return"word"==e?(L="variable-3",n.context.type):p(e,t,n)},N.documentTypes=function(e,t,n){return"word"==e&&f.hasOwnProperty(t.current())?(L="tag",n.context.type):N.atBlock(e,t,n)},N.atBlock=function(e,t,n){if("("==e)return d(n,t,"atBlock_parens");if("}"==e||";"==e)return c(e,t,n);if("{"==e)return l(n)&&d(n,t,w?"block":"top");if("interpolation"==e)return d(n,t,"interpolation");if("word"==e){var o=t.current().toLowerCase();L="only"==o||"not"==o||"and"==o||"or"==o?"keyword":y.hasOwnProperty(o)?"attribute":b.hasOwnProperty(o)?"property":v.hasOwnProperty(o)?"keyword":x.hasOwnProperty(o)?"property":C.hasOwnProperty(o)?"string-2":T.hasOwnProperty(o)?"atom":k.hasOwnProperty(o)?"keyword":"error"}return n.context.type},N.atComponentBlock=function(e,t,n){return"}"==e?c(e,t,n):"{"==e?l(n)&&d(n,t,w?"block":"top",!1):("word"==e&&(L="error"),n.context.type)},N.atBlock_parens=function(e,t,n){return")"==e?l(n):"{"==e||"}"==e?c(e,t,n,2):N.atBlock(e,t,n)},N.restricted_atBlock_before=function(e,t,n){return"{"==e?d(n,t,"restricted_atBlock"):"word"==e&&"@counter-style"==n.stateArg?(L="variable","restricted_atBlock_before"):p(e,t,n)},N.restricted_atBlock=function(e,t,n){return"}"==e?(n.stateArg=null,l(n)):"word"==e?(L=("@font-face"!=n.stateArg||S.hasOwnProperty(t.current().toLowerCase()))&&("@counter-style"!=n.stateArg||E.hasOwnProperty(t.current().toLowerCase()))?"property":"error","maybeprop"):"restricted_atBlock"},N.keyframes=function(e,t,n){return"word"==e?(L="variable","keyframes"):"{"==e?d(n,t,"top"):p(e,t,n)},N.at=function(e,t,n){return";"==e?l(n):"{"==e||"}"==e?c(e,t,n):("word"==e?L="tag":"hash"==e&&(L="builtin"),"at")},N.interpolation=function(e,t,n){return"}"==e?l(n):"{"==e||";"==e?c(e,t,n):("word"==e?L="variable":"variable"!=e&&"("!=e&&")"!=e&&(L="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:h?"block":"top",stateArg:null,context:new s(h?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var n=(t.tokenize||r)(e,t);return n&&"object"==typeof n&&(A=n[1],n=n[0]),L=n,t.state=N[t.state](A,e,t),L},indent:function(e,t){var n=e.context,o=t&&t.charAt(0),r=n.indent;return"prop"==n.type&&("}"==o||")"==o)&&(n=n.prev),n.prev&&("}"==o&&("block"==n.type||"top"==n.type||"interpolation"==n.type||"restricted_atBlock"==n.type)?(n=n.prev,r=n.indent):(")"==o&&("parens"==n.type||"atBlock_parens"==n.type)||"{"==o&&("at"==n.type||"atBlock"==n.type))&&(r=Math.max(0,n.indent-m),n=n.prev)),r},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var o=["domain","regexp","url","url-prefix"],r=t(o),a=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],i=t(a),s=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],d=t(s),l=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],p=t(l),c=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],u=t(c),h=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],m=t(h),g=t(["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),f=t(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),y=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],b=t(y),v=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],x=t(v),C=o.concat(a).concat(s).concat(l).concat(c).concat(h).concat(y).concat(v);e.registerHelper("hintWords","css",C),e.defineMIME("text/css",{documentTypes:r,mediaTypes:i,mediaFeatures:d,mediaValueKeywords:p,propertyKeywords:u,nonStandardPropertyKeywords:m,fontProperties:g,counterDescriptors:f,colorKeywords:b,valueKeywords:x,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=n,n(e,t))}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:i,mediaFeatures:d,mediaValueKeywords:p,propertyKeywords:u,nonStandardPropertyKeywords:m,colorKeywords:b,valueKeywords:x,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=n,n(e,t)):["operator","operator"]},":":function(e){return!!e.match(/\s*\{/)&&[null,"{"]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:i,mediaFeatures:d,mediaValueKeywords:p,propertyKeywords:u,nonStandardPropertyKeywords:m,colorKeywords:b,valueKeywords:x,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=n,n(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),e.defineMIME("text/x-gss",{documentTypes:r,mediaTypes:i,mediaFeatures:d,propertyKeywords:u,nonStandardPropertyKeywords:m,fontProperties:g,counterDescriptors:f,colorKeywords:b,valueKeywords:x,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=n,n(e,t))}},name:"css",helperType:"gss"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n){var o=e.current(),r=o.search(t);return-1<r?e.backUp(o.length-r):o.match(/<\/?$/)&&(e.backUp(o.length),!e.match(t,!1)&&e.match(o)),n}function n(e){var t=d[e];return t?t:d[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function o(e,t){var o=e.match(n(t));return o?o[2]:""}function r(e,t){return new RegExp((t?"^":"")+"</s*"+e+"s*>","i")}function a(e,t){for(var n in e)for(var o=t[n]||(t[n]=[]),r=e[n],a=r.length-1;0<=a;a--)o.unshift(r[a])}function i(e,t){for(var n=0,r;n<e.length;n++)if(r=e[n],!r[0]||r[1].test(o(t,r[0])))return r[2]}var s={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},d={};e.defineMode("htmlmixed",function(n,o){function d(o,a){var s=l.token(o,a.htmlState),c=/\btag\b/.test(s),u;if(c&&!/[<>\s\/]/.test(o.current())&&(u=a.htmlState.tagName&&a.htmlState.tagName.toLowerCase())&&p.hasOwnProperty(u))a.inTag=u+" ";else if(a.inTag&&c&&/>$/.test(o.current())){var h=/^([\S]+) (.*)/.exec(a.inTag);a.inTag=null;var m=">"==o.current()&&i(p[h[1]],h[2]),g=e.getMode(n,m),f=r(h[1],!0),y=r(h[1],!1);a.token=function(e,n){return e.match(f,!1)?(n.token=d,n.localState=n.localMode=null,null):t(e,y,n.localMode.token(e,n.localState))},a.localMode=g,a.localState=e.startState(g,l.indent(a.htmlState,""))}else a.inTag&&(a.inTag+=o.current(),o.eol()&&(a.inTag+=" "));return s}var l=e.getMode(n,{name:"xml",htmlMode:!0,multilineTagIndentFactor:o.multilineTagIndentFactor,multilineTagIndentPastTag:o.multilineTagIndentPastTag}),p={},c=o&&o.tags,u=o&&o.scriptTypes;if(a(s,p),c&&a(c,p),u)for(var h=u.length-1;0<=h;h--)p.script.unshift(["type",u[h].matches,u[h].mode]);return{startState:function(){var e=l.startState();return{token:d,inTag:null,localMode:null,localState:null,htmlState:e}},copyState:function(t){var n;return t.localState&&(n=e.copyState(t.localMode,t.localState)),{token:t.token,inTag:t.inTag,localMode:t.localMode,localState:n,htmlState:e.copyState(l,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,n){return!t.localMode||/^\s*<\//.test(n)?l.indent(t.htmlState,n):t.localMode.indent?t.localMode.indent(t.localState,n):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||l}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";function t(t,n,o){if(0>o&&0==n.ch)return t.clipPos(u(n.line-1));var r=t.getLine(n.line);if(0<o&&n.ch>=r.length)return t.clipPos(u(n.line+1,0));for(var a="start",s=n.ch,d=0>o?0:r.length,l=0,i;s!=d;s+=o,l++){var p=r.charAt(0>o?s-1:s),c="_"!=p&&e.isWordChar(p)?"w":"o";if("w"==c&&p.toUpperCase()==p&&(c="W"),"start"==a)"o"!=c&&(a="in",i=c);else if("in"==a&&i!=c){if("w"==i&&"W"==c&&0>o&&s--,"W"==i&&"w"==c&&0<o){i="w";continue}break}}return u(n.line,s)}function n(e,n){e.extendSelectionsBy(function(o){return e.display.shift||e.doc.extend||o.empty()?t(e.doc,o.head,n):0>n?o.from():o.to()})}function o(t,n){return t.isReadOnly()?e.Pass:void t.operation(function(){for(var e=t.listSelections().length,o=[],r=-1,a=0,i;a<e;a++)if(i=t.listSelections()[a].head,!(i.line<=r)){var s=u(i.line+(n?0:1),0);t.replaceRange("\n",s,null,"+insertLine"),t.indentLine(s.line,null,!0),o.push({head:s,anchor:s}),r=i.line+1}t.setSelections(o)})}function r(t,n){for(var o=n.ch,r=o,a=t.getLine(n.line);o&&e.isWordChar(a.charAt(o-1));)--o;for(;r<a.length&&e.isWordChar(a.charAt(r));)++r;return{from:u(n.line,o),to:u(n.line,r),word:a.slice(o,r)}}function a(e){var t=e.getCursor(),n=e.scanForBracket(t,-1);if(n)for(;;){var o=e.scanForBracket(t,1);if(!o)return;if(o.ch==f.charAt(f.indexOf(n.ch)+1))return e.setSelection(u(n.pos.line,n.pos.ch+1),o.pos,!1),!0;t=u(o.pos.line,o.pos.ch+1)}}function i(t,n){if(t.isReadOnly())return e.Pass;for(var o=t.listSelections(),r=[],a=0,s,i;a<o.length;a++)if(i=o[a],!i.empty()){for(var d=i.from().line,l=i.to().line;a<o.length-1&&o[a+1].from().line==l;)l=i[++a].to().line;r.push(d,l)}r.length?s=!0:r.push(t.firstLine(),t.lastLine()),t.operation(function(){for(var e=[],o=0;o<r.length;o+=2){var a=r[o],i=r[o+1],d=u(a,0),l=u(i),p=t.getRange(d,l,!1);n?p.sort():p.sort(function(e,t){var n=e.toUpperCase(),o=t.toUpperCase();return n!=o&&(e=n,t=o),e<t?-1:e==t?0:1}),t.replaceRange(p,d,l),s&&e.push({anchor:d,head:l})}s&&t.setSelections(e,0)})}function s(t,n){t.operation(function(){for(var o=t.listSelections(),a=[],s=[],d=0,i;d<o.length;d++)i=o[d],i.empty()?(a.push(d),s.push("")):s.push(n(t.getRange(i.from(),i.to())));t.replaceSelections(s,"around","case");for(var d=a.length-1,l,i;0<=d;d--)if(i=o[a[d]],!(l&&0<e.cmpPos(i.head,l))){var p=r(t,i.head);l=p.from,t.replaceRange(n(p.word),p.from,p.to)}})}function d(t){var n=t.getCursor("from"),o=t.getCursor("to");if(0==e.cmpPos(n,o)){var a=r(t,n);if(!a.word)return;n=a.from,o=a.to}return{from:n,to:o,query:t.getRange(n,o),word:a}}function l(e,t){var n=d(e);if(n){var o=n.query,r=e.getSearchCursor(o,t?n.to:n.from);(t?r.findNext():r.findPrevious())?e.setSelection(r.from(),r.to()):(r=e.getSearchCursor(o,t?u(e.firstLine(),0):e.clipPos(u(e.lastLine()))),(t?r.findNext():r.findPrevious())?e.setSelection(r.from(),r.to()):n.word&&e.setSelection(n.from,n.to))}}var p=e.keyMap.sublime={fallthrough:"default"},c=e.commands,u=e.Pos,h=e.keyMap["default"]==e.keyMap.macDefault,m=h?"Cmd-":"Ctrl-";c[p["Alt-Left"]="goSubwordLeft"]=function(e){n(e,-1)},c[p["Alt-Right"]="goSubwordRight"]=function(e){n(e,1)},h&&(p["Cmd-Left"]="goLineStartSmart");var g=h?"Ctrl-Alt-":"Ctrl-";c[p[g+"Up"]="scrollLineUp"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top+t.clientHeight,"local");e.getCursor().line>=n&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},c[p[g+"Down"]="scrollLineDown"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var n=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=n&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},c[p["Shift-"+m+"L"]="splitSelectionByLine"]=function(e){for(var t=e.listSelections(),n=[],o=0;o<t.length;o++)for(var r=t[o].from(),a=t[o].to(),i=r.line;i<=a.line;++i)a.line>r.line&&i==a.line&&0==a.ch||n.push({anchor:i==r.line?r:u(i,0),head:i==a.line?a:u(i)});e.setSelections(n,0)},p["Shift-Tab"]="indentLess",c[p.Esc="singleSelectionTop"]=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},c[p[m+"L"]="selectLine"]=function(e){for(var t=e.listSelections(),n=[],o=0,r;o<t.length;o++)r=t[o],n.push({anchor:u(r.from().line,0),head:u(r.to().line+1,0)});e.setSelections(n)},p["Shift-Ctrl-K"]="deleteLine",c[p[m+"Enter"]="insertLineAfter"]=function(e){return o(e,!1)},c[p["Shift-"+m+"Enter"]="insertLineBefore"]=function(e){return o(e,!0)},c[p[m+"D"]="selectNextOccurrence"]=function(t){var n=t.getCursor("from"),o=t.getCursor("to"),a=t.state.sublimeFindFullWord==t.doc.sel;if(0==e.cmpPos(n,o)){var i=r(t,n);if(!i.word)return;t.setSelection(i.from,i.to),a=!0}else{var s=t.getRange(n,o),d=a?new RegExp("\\b"+s+"\\b"):s,l=t.getSearchCursor(d,o);l.findNext()?t.addSelection(l.from(),l.to()):(l=t.getSearchCursor(d,u(t.firstLine(),0)),l.findNext()&&t.addSelection(l.from(),l.to()))}a&&(t.state.sublimeFindFullWord=t.doc.sel)};var f="(){}[]";c[p["Shift-"+m+"Space"]="selectScope"]=function(e){a(e)||e.execCommand("selectAll")},c[p["Shift-"+m+"M"]="selectBetweenBrackets"]=function(t){if(!a(t))return e.Pass},c[p[m+"M"]="goToBracket"]=function(t){t.extendSelectionsBy(function(n){var o=t.scanForBracket(n.head,1);if(o&&0!=e.cmpPos(o.pos,n.head))return o.pos;var r=t.scanForBracket(n.head,-1);return r&&u(r.pos.line,r.pos.ch+1)||n.head})};var y=h?"Cmd-Ctrl-":"Shift-Ctrl-";c[p[y+"Up"]="swapLineUp"]=function(t){if(t.isReadOnly())return e.Pass;for(var n=t.listSelections(),o=[],r=t.firstLine()-1,a=[],s=0;s<n.length;s++){var i=n[s],d=i.from().line-1,l=i.to().line;a.push({anchor:u(i.anchor.line-1,i.anchor.ch),head:u(i.head.line-1,i.head.ch)}),0!=i.to().ch||i.empty()||--l,d>r?o.push(d,l):o.length&&(o[o.length-1]=l),r=l}t.operation(function(){for(var e=0;e<o.length;e+=2){var n=o[e],r=o[e+1],i=t.getLine(n);t.replaceRange("",u(n,0),u(n+1,0),"+swapLine"),r>t.lastLine()?t.replaceRange("\n"+i,u(t.lastLine()),null,"+swapLine"):t.replaceRange(i+"\n",u(r,0),null,"+swapLine")}t.setSelections(a),t.scrollIntoView()})},c[p[y+"Down"]="swapLineDown"]=function(t){if(t.isReadOnly())return e.Pass;for(var n=t.listSelections(),o=[],r=t.lastLine()+1,a=n.length-1;0<=a;a--){var i=n[a],s=i.to().line+1,d=i.from().line;0!=i.to().ch||i.empty()||s--,s<r?o.push(s,d):o.length&&(o[o.length-1]=d),r=d}t.operation(function(){for(var e=o.length-2;0<=e;e-=2){var n=o[e],r=o[e+1],a=t.getLine(n);n==t.lastLine()?t.replaceRange("",u(n-1),u(n),"+swapLine"):t.replaceRange("",u(n,0),u(n+1,0),"+swapLine"),t.replaceRange(a+"\n",u(r,0),null,"+swapLine")}t.scrollIntoView()})},c[p[m+"/"]="toggleCommentIndented"]=function(e){e.toggleComment({indent:!0})},c[p[m+"J"]="joinLines"]=function(e){for(var t=e.listSelections(),n=[],o=0;o<t.length;o++){for(var r=t[o],a=r.from(),i=a.line,s=r.to().line;o<t.length-1&&t[o+1].from().line==s;)s=t[++o].to().line;n.push({start:i,end:s,anchor:!r.empty()&&a})}e.operation(function(){for(var t=0,o=[],r=0;r<n.length;r++){for(var a=n[r],i=a.anchor&&u(a.anchor.line-t,a.anchor.ch),s=a.start,d,l;s<=a.end;s++)l=s-t,s==a.end&&(d=u(l,e.getLine(l).length+1)),l<e.lastLine()&&(e.replaceRange(" ",u(l),u(l+1,/^\s*/.exec(e.getLine(l+1))[0].length)),++t);o.push({anchor:i||d,head:d})}e.setSelections(o,0)})},c[p["Shift-"+m+"D"]="duplicateLine"]=function(e){e.operation(function(){for(var t=e.listSelections().length,n=0,o;n<t;n++)o=e.listSelections()[n],o.empty()?e.replaceRange(e.getLine(o.head.line)+"\n",u(o.head.line,0)):e.replaceRange(e.getRange(o.from(),o.to()),o.from());e.scrollIntoView()})},p[m+"T"]="transposeChars",c[p.F9="sortLines"]=function(e){i(e,!0)},c[p[m+"F9"]="sortLinesInsensitive"]=function(e){i(e,!1)},c[p.F2="nextBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var n=t.shift(),o=n.find();if(o)return t.push(n),e.setSelection(o.from,o.to)}},c[p["Shift-F2"]="prevBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var n=t[t.length-1].find();if(!n)t.pop();else return e.setSelection(n.from,n.to)}},c[p[m+"F2"]="toggleBookmark"]=function(e){for(var t=e.listSelections(),n=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),o=0;o<t.length;o++){for(var r=t[o].from(),a=t[o].to(),i=e.findMarks(r,a),s=0;s<i.length;s++)if(i[s].sublimeBookmark){i[s].clear();for(var d=0;d<n.length;d++)n[d]==i[s]&&n.splice(d--,1);break}s==i.length&&n.push(e.markText(r,a,{sublimeBookmark:!0,clearWhenEmpty:!1}))}},c[p["Shift-"+m+"F2"]="clearBookmarks"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(var n=0;n<t.length;n++)t[n].clear();t.length=0},c[p["Alt-F2"]="selectBookmarks"]=function(e){var t=e.state.sublimeBookmarks,n=[];if(t)for(var o=0,r;o<t.length;o++)r=t[o].find(),r?n.push({anchor:r.from,head:r.to}):t.splice(o--,0);n.length&&e.setSelections(n,0)},p["Alt-Q"]="wrapLines";var b=m+"K ";p[b+m+"Backspace"]="delLineLeft",c[p.Backspace="smartBackspace"]=function(t){if(t.somethingSelected())return e.Pass;var n=t.getCursor(),o=t.getRange({line:n.line,ch:0},n),r=e.countColumn(o,null,t.getOption("tabSize")),a=t.getOption("indentUnit");if(o&&!/\S/.test(o)&&0==r%a){var i=new u(n.line,e.findColumn(o,r-a,a));return i.ch==n.ch?e.Pass:t.replaceRange("",i,n,"+delete")}return e.Pass},c[p[b+m+"K"]="delLineRight"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=t.length-1;0<=n;n--)e.replaceRange("",t[n].anchor,u(t[n].to().line),"+delete");e.scrollIntoView()})},c[p[b+m+"U"]="upcaseAtCursor"]=function(e){s(e,function(e){return e.toUpperCase()})},c[p[b+m+"L"]="downcaseAtCursor"]=function(e){s(e,function(e){return e.toLowerCase()})},c[p[b+m+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},c[p[b+m+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},c[p[b+m+"W"]="deleteToSublimeMark"]=function(t){var n=t.state.sublimeMark&&t.state.sublimeMark.find();if(n){var o=t.getCursor(),r=n;if(0<e.cmpPos(o,r)){var a=r;r=o,o=a}t.state.sublimeKilled=t.getRange(o,r),t.replaceRange("",o,r)}},c[p[b+m+"X"]="swapWithSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},c[p[b+m+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},p[b+m+"G"]="clearBookmarks",c[p[b+m+"C"]="showInCenter"]=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},c[p["Shift-Alt-Up"]="selectLinesUpward"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=0,o;n<t.length;n++)o=t[n],o.head.line>e.firstLine()&&e.addSelection(u(o.head.line-1,o.head.ch))})},c[p["Shift-Alt-Down"]="selectLinesDownward"]=function(e){e.operation(function(){for(var t=e.listSelections(),n=0,o;n<t.length;n++)o=t[n],o.head.line<e.lastLine()&&e.addSelection(u(o.head.line+1,o.head.ch))})};c[p[m+"F3"]="findUnder"]=function(e){l(e,!0)},c[p["Shift-"+m+"F3"]="findUnderPrevious"]=function(e){l(e,!1)},c[p["Alt-F3"]="findAllUnder"]=function(e){var t=d(e);if(t){for(var n=e.getSearchCursor(t.query),o=[],r=-1;n.findNext();)o.push({anchor:n.from(),head:n.to()}),n.from().line<=t.from.line&&n.from().ch<=t.from.ch&&r++;e.setSelections(o,r)}},p["Shift-"+m+"["]="fold",p["Shift-"+m+"]"]="unfold",p[b+m+"0"]=p[b+m+"j"]="unfoldAll",p[m+"I"]="findIncremental",p["Shift-"+m+"I"]="findIncrementalReverse",p[m+"H"]="replace",p.F3="findNext",p["Shift-F3"]="findPrev",e.normalizeKeyMap(p)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(t){"use strict";var e=Math.abs,n=String.fromCharCode,o=Math.min,r=Math.floor,a=Math.max,s=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",type:"action",action:"replayMacro"},{keys:"q<character>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:"\"<character>",type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],d=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],l=t.Pos;t.Vim=function(){function i(e){e.setOption("disableInput",!0),e.setOption("showCursorWhenSelecting",!1),t.signal(e,"vim-mode-change",{mode:"normal"}),e.on("cursorActivity",tt),N(e),t.on(e.getInputField(),"paste",g(e))}function p(e){e.setOption("disableInput",!1),e.off("cursorActivity",tt),t.off(e.getInputField(),"paste",g(e)),e.state.vim=null}function c(e,n){this==t.keyMap.vim&&t.rmClass(e.getWrapperElement(),"cm-fat-cursor"),n&&n.attach==u||p(e,!1)}function u(e,n){this==t.keyMap.vim&&t.addClass(e.getWrapperElement(),"cm-fat-cursor"),n&&n.attach==u||i(e)}function h(e,n){if(n){if(this[e])return this[e];var o=m(e);if(!o)return!1;var r=t.Vim.findKey(n,o);return"function"==typeof r&&t.signal(n,"vim-keypress",o),r}}function m(e){if("'"==e.charAt(0))return e.charAt(1);var t=e.split(/-(?!$)/),n=t[t.length-1];if(1==t.length&&1==t[0].length)return!1;if(2==t.length&&"Shift"==t[0]&&1==n.length)return!1;for(var o=!1,r=0,a;r<t.length;r++)a=t[r],a in dt?t[r]=dt[a]:o=!0,a in lt&&(t[r]=lt[a]);return!!o&&(C(n)&&(t[t.length-1]=n.toLowerCase()),"<"+t.join("-")+">")}function g(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(B(e.getCursor(),0,1)),wt.enterInsertMode(e,{},t))}),t.onPasteFn}function f(e,t){for(var o=[],r=e;r<e+t;r++)o.push(n(r));return o}function y(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function b(e){return /^[a-z]$/.test(e)}function v(e){return-1!="()[]{}".indexOf(e)}function x(e){return pt.test(e)}function C(e){return /^[A-Z]$/.test(e)}function S(e){return /^\s*$/.test(e)}function E(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}function k(e,t,n,o,r){if(void 0===t&&!r)throw Error("defaultValue is required unless callback is provided");if(n||(n="string"),bt[e]={type:n,defaultValue:t,callback:r},o)for(var a=0;a<o.length;a++)bt[o[a]]=bt[e];t&&T(e,t)}function T(e,t,n,o){var r=bt[e];o=o||{};var a=o.scope;if(!r)throw Error("Unknown option: "+e);if("boolean"==r.type)if(t&&!0!==t)throw Error("Invalid argument: "+e+"="+t);else!1!==t&&(t=!0);r.callback?("local"!==a&&r.callback(t,void 0),"global"!==a&&n&&r.callback(t,n)):("local"!==a&&(r.value="boolean"==r.type?!!t:t),"global"!==a&&n&&(n.state.vim.options[e]={value:t}))}function w(e,t,n){var o=bt[e];n=n||{};var r=n.scope;if(!o)throw Error("Unknown option: "+e);if(o.callback){var a=t&&o.callback(void 0,t);return"global"!==r&&void 0!==a?a:"local"===r?void 0:o.callback()}var a="global"!==r&&t&&t.state.vim.options[e];return(a||"local"!==r&&o||{}).value}function I(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=xt()}function N(e){return e.state.vim||(e.state.vim={inputState:new L,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}function A(){for(var e in Ct={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:vt(),macroModeState:new I,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new P({}),searchHistoryController:new _({}),exCommandHistoryController:new _({})},bt){var t=bt[e];t.value=t.defaultValue}}function L(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}function R(e,n){e.state.vim.inputState=new L,t.signal(e,"vim-command-done",n)}function O(e,t,n){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!n}function P(e){this.registers=e,this.unnamedRegister=e["\""]=new O,e["."]=new O,e[":"]=new O,e["/"]=new O}function _(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}function D(e,t){for(var n=[],o=0;o<t;o++)n.push(e);return n}function M(e,t,n){var r=o(a(e.firstLine(),t.line),e.lastLine()),i=Y(e,r)-1;i=n?i+1:i;var s=o(a(0,t.ch),i);return l(r,s)}function F(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function B(e,t,n){return"object"==typeof t&&(n=t.ch,t=t.line),l(e.line+t,e.ch+n)}function U(e,t){return{line:t.line-e.line,ch:t.line-e.line}}function V(e,t,n,o){for(var r=[],a=[],s=0,i,d;s<t.length;s++)(d=t[s],!("insert"==n&&"insert"!=d.context||d.context&&d.context!=n||o.operator&&"action"==d.type||!(i=W(e,d.keys))))&&("partial"==i&&r.push(d),"full"==i&&a.push(d));return{partial:r.length&&r,full:a.length&&a}}function W(e,t){if("<character>"==t.slice(-11)){var n=t.length-11,o=e.slice(0,n),r=t.slice(0,n);return o==r&&e.length>n?"full":0==r.indexOf(o)&&"partial"}return e==t?"full":0==t.indexOf(e)&&"partial"}function H(e){var t=/^.*(<[\w\-]+>)$/.exec(e),n=t?t[1]:e.slice(-1);if(1<n.length)switch(n){case"<CR>":n="\n";break;case"<Space>":n=" ";break;default:}return n}function j(e,t,n){return function(){for(var o=0;o<n;o++)t(e)}}function q(e){return l(e.line,e.ch)}function z(e,t){return e.ch==t.ch&&e.line==t.line}function K(e,t){return!!(e.line<t.line)||e.line==t.line&&e.ch<t.ch}function G(e,t){return 2<arguments.length&&(t=G.apply(void 0,Array.prototype.slice.call(arguments,1))),K(e,t)?e:t}function X(e,t){return 2<arguments.length&&(t=X.apply(void 0,Array.prototype.slice.call(arguments,1))),K(e,t)?t:e}function Q(e,t,n){var o=K(e,t),r=K(t,n);return o&&r}function Y(e,t){return e.getLine(t).length}function J(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function $(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Z(e,t,n){var o=Y(e,t),r=Array(n-o+1).join(" ");e.setCursor(l(t,o)),e.replaceRange(r,e.getCursor())}function ee(e,t){var n=[],r=e.listSelections(),i=q(e.clipPos(t)),s=!z(t,i),d=e.getCursor("head"),p=ne(r,d),c=z(r[p].head,r[p].anchor),u=r.length-1,h=u-p>p?u:0,m=r[h].anchor,g=o(m.line,i.line),f=a(m.line,i.line),y=m.ch,b=i.ch,v=r[h].head.ch-y,x=b-y;0<v&&0>=x?(y++,!s&&b--):0>v&&0<=x?(y--,!c&&b++):0>v&&-1==x&&(y--,b++);for(var C=g,S;C<=f;C++)S={anchor:new l(C,y),head:new l(C,b)},n.push(S);return p=i.line==f?n.length-1:0,e.setSelections(n),t.ch=b,m.ch=y,m}function te(e,t,n){for(var o=[],r=0,a;r<n;r++)a=B(t,r,0),o.push({anchor:a,head:a});e.setSelections(o,0)}function ne(e,t,n){for(var o=0;o<e.length;o++){var r="head"!=n&&z(e[o].anchor,t),a="anchor"!=n&&z(e[o].head,t);if(r||a)return o}return-1}function oe(e,t){var n=t.lastSelection;return t.visualMode?function(){var t=e.listSelections(),n=t[0],o=t[t.length-1],r=K(n.anchor,n.head)?n.anchor:n.head,a=K(o.anchor,o.head)?o.head:o.anchor;return[r,a]}():function(){var t=e.getCursor(),o=e.getCursor(),r=n.visualBlock;if(r){var a=r.width,s=r.height;o=l(t.line+s,t.ch+a);for(var d=[],p=t.line;p<o.line;p++){var i=l(p,t.ch),c=l(p,o.ch);d.push({anchor:i,head:c})}e.setSelections(d)}else{var u=n.anchorMark.find(),h=n.headMark.find(),m=h.line-u.line,g=h.ch-u.ch;o={line:o.line+m,ch:m?o.ch:g+o.ch},n.visualLine&&(t=l(t.line,0),o=l(o.line,Y(e,o.line))),e.setSelection(t,o)}return[t,o]}()}function re(e,t){var n=t.sel.anchor,o=t.sel.head;t.lastPastedText&&(o=e.posFromIndex(e.indexFromPos(n)+t.lastPastedText.length),t.lastPastedText=null),t.lastSelection={anchorMark:e.setBookmark(n),headMark:e.setBookmark(o),anchor:q(n),head:q(o),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function ae(e,t,n){var o=e.state.vim.sel,r=o.head,a=o.anchor,i;return K(n,t)&&(i=n,n=t,t=i),K(r,a)?(r=G(t,r),a=X(a,n)):(a=G(t,a),r=X(r,n),r=B(r,0,-1),-1==r.ch&&r.line!=e.firstLine()&&(r=l(r.line-1,Y(e,r.line-1)))),[a,r]}function ie(e,t,n){var o=e.state.vim;t=t||o.sel;var n=n||o.visualLine?"line":o.visualBlock?"block":"char",r=se(e,t,n);e.setSelections(r.ranges,r.primary),nt(e)}function se(e,t,n,r){var s=q(t.head),d=q(t.anchor);if("char"==n){var p=r||K(t.head,t.anchor)?0:1,c=K(t.head,t.anchor)?1:0;return s=B(t.head,0,p),d=B(t.anchor,0,c),{ranges:[{anchor:d,head:s}],primary:0}}if("line"==n){if(!K(t.head,t.anchor)){d.ch=0;var u=e.lastLine();s.line>u&&(s.line=u),s.ch=Y(e,s.line)}else s.ch=0,d.ch=Y(e,d.line);return{ranges:[{anchor:d,head:s}],primary:0}}if("block"==n){for(var h=o(d.line,s.line),m=o(d.ch,s.ch),g=a(d.line,s.line),f=a(d.ch,s.ch)+1,y=g-h+1,b=s.line==h?0:y-1,v=[],x=0;x<y;x++)v.push({anchor:l(h+x,m),head:l(h+x,f)});return{ranges:v,primary:b}}}function de(e){var t=e.getCursor("head");return 1==e.getSelection().length&&(t=G(t,e.getCursor("anchor"))),t}function le(e,n){var o=e.state.vim;!1!==n&&e.setCursor(M(e,o.sel.head)),re(e,o),o.visualMode=!1,o.visualLine=!1,o.visualBlock=!1,t.signal(e,"vim-mode-change",{mode:"normal"}),o.fakeCursor&&o.fakeCursor.clear()}function pe(e,t,n){var o=e.getRange(t,n);if(/\n\s*$/.test(o)){var r=o.split("\n");r.pop();for(var a=r.pop(),a;0<r.length&&a&&S(a);a=r.pop())n.line--,n.ch=0;a?(n.line--,n.ch=Y(e,n.line)):n.ch=0}}function ce(e,t,n){t.ch=0,n.ch=0,n.line++}function ue(e){if(!e)return 0;var t=e.search(/\S/);return-1==t?e.length:t}function he(e,t,n,o,r){for(var a=de(e),i=e.getLine(a.line),s=a.ch,d=r?ct[0]:ut[0];!d(i.charAt(s));)if(s++,s>=i.length)return null;o?d=ut[0]:(d=ct[0],!d(i.charAt(s))&&(d=ct[1]));for(var p=s,c=s;d(i.charAt(p))&&p<i.length;)p++;for(;d(i.charAt(c))&&0<=c;)c--;if(c++,t){for(var u=p;/\s/.test(i.charAt(p))&&p<i.length;)p++;if(u==p){for(var h=c;/\s/.test(i.charAt(c-1))&&0<c;)c--;c||(c=h)}}return{start:l(a.line,c),end:l(a.line,p)}}function me(e,t,n){z(t,n)||Ct.jumpList.add(e,t,n)}function ge(e,t){Ct.lastCharacterSearch.increment=e,Ct.lastCharacterSearch.forward=t.forward,Ct.lastCharacterSearch.selectedCharacter=t.selectedCharacter}function fe(e,t,n,o){var r=q(e.getCursor()),a=n?1:-1,i=n?e.lineCount():-1,s=r.ch,d=r.line,p=e.getLine(d),c={lineText:p,nextCh:p.charAt(s),lastCh:null,index:s,symb:o,reverseSymb:(n?{")":"(","}":"{"}:{"(":")","{":"}"})[o],forward:n,depth:0,curMoveThrough:!1},u=It[o];if(!u)return r;var h=Nt[u].init,m=Nt[u].isComplete;for(h&&h(c);d!==i&&t;){if(c.index+=a,c.nextCh=c.lineText.charAt(c.index),!c.nextCh){if(d+=a,c.lineText=e.getLine(d)||"",0<a)c.index=0;else{var g=c.lineText.length;c.index=0<g?g-1:0}c.nextCh=c.lineText.charAt(c.index)}m(c)&&(r.line=d,r.ch=c.index,t--)}return c.nextCh||c.curMoveThrough?l(d,c.index):r}function ye(e,t,n,r,s){var d=t.line,l=t.ch,p=e.getLine(d),c=n?1:-1,u=r?ut:ct;if(s&&""==p){if(d+=c,p=e.getLine(d),!y(e,d))return null;l=n?0:p.length}for(;;){if(s&&""==p)return{from:0,to:0,line:d};for(var h=0<c?p.length:-1,m=h,g=h;l!=h;){for(var f=!1,b=0;b<u.length&&!f;++b)if(u[b](p.charAt(l))){for(m=l;l!=h&&u[b](p.charAt(l));)l+=c;if(g=l,f=m!=g,m==t.ch&&d==t.line&&g==m+c)continue;else return{from:o(m,g+1),to:a(m,g),line:d}}f||(l+=c)}if(d+=c,!y(e,d))return null;p=e.getLine(d),l=0<c?0:p.length}}function be(e,t,n,o,r,a){var s=q(t),d=[];(o&&!r||!o&&r)&&n++;for(var p=0,i;p<n;p++){if(i=ye(e,t,o,a,!(o&&r)),!i){var c=Y(e,e.lastLine());d.push(o?{line:e.lastLine(),from:c,to:c}:{line:0,from:0,to:0});break}d.push(i),t=l(i.line,o?i.to-1:i.from)}var u=d.length!=n,h=d[0],m=d.pop();return o&&!r?(u||h.from==s.ch&&h.line==s.line||(m=d.pop()),l(m.line,m.from)):o&&r?l(m.line,m.to-1):!o&&r?(u||h.to==s.ch&&h.line==s.line||(m=d.pop()),l(m.line,m.to)):l(m.line,m.from)}function ve(e,t,n,o){for(var r=e.getCursor(),a=r.ch,s=0,i,d;s<t;s++){if(d=e.getLine(r.line),i=Se(a,d,o,n,!0),-1==i)return null;a=i}return l(e.getCursor().line,i)}function xe(e,t){var n=e.getCursor().line;return M(e,l(n,t-1))}function Ce(e,t,n,o){E(n,ft)&&(t.marks[n]&&t.marks[n].clear(),t.marks[n]=e.setBookmark(o))}function Se(e,t,n,o,r){var a;return o?(a=t.indexOf(n,e+1),-1!=a&&!r&&(a-=1)):(a=t.lastIndexOf(n,e-1),-1!=a&&!r&&(a+=1)),a}function Ee(e,t,n,o,r){function a(t){return!e.getLine(t)}function s(e,t,n){return n?a(e)!=a(e+t):!a(e)&&a(e+t)}var d=t.line,p=e.firstLine(),c=e.lastLine(),u=d,i,h;if(o){for(;p<=u&&u<=c&&0<n;)s(u,o)&&n--,u+=o;return new l(u,0)}var m=e.state.vim;if(m.visualLine&&s(d,1,!0)){var g=m.sel.anchor;s(g.line,-1,!0)&&(!r||g.line!=d)&&(d+=1)}var f=a(d);for(u=d;u<=c&&n;u++)s(u,1,!0)&&(r&&a(u)==f||n--);for(h=new l(u,0),u>c&&!f?f=!0:r=!1,u=d;u>p&&(r&&a(u)!=f&&u!=d||!s(u,-1,!0));u--);return i=new l(u,0),{start:i,end:h}}function ke(e,t,n,o){var r=t,a={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[n],i={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[n],s=e.getLine(r.line).charAt(r.ch),d=s===i?1:0,p,c;if(p=e.scanForBracket(l(r.line,r.ch+d),-1,null,{bracketRegex:a}),c=e.scanForBracket(l(r.line,r.ch+d),1,null,{bracketRegex:a}),!p||!c)return{start:r,end:r};if(p=p.pos,c=c.pos,p.line==c.line&&p.ch>c.ch||p.line>c.line){var u=p;p=c,c=u}return o?c.ch+=1:p.ch+=1,{start:p,end:c}}function Te(e,t,n,o){var r=q(t),a=e.getLine(r.line),s=a.split(""),d=s.indexOf(n),p,c,u,i;if(r.ch<d?r.ch=d:d<r.ch&&s[r.ch]==n&&(c=r.ch,--r.ch),s[r.ch]==n&&!c)p=r.ch+1;else for(u=r.ch;-1<u&&!p;u--)s[u]==n&&(p=u+1);if(p&&!c)for(u=p,i=s.length;u<i&&!c;u++)s[u]==n&&(c=u);return p&&c?(o&&(--p,++c),{start:l(r.line,p),end:l(r.line,c)}):{start:r,end:r}}function we(){}function Ie(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new we)}function Ne(e,t,n,o,r){e.openDialog?e.openDialog(t,o,{bottom:!0,value:r.value,onKeyDown:r.onKeyDown,onKeyUp:r.onKeyUp,selectValueOnOpen:!1}):o(prompt(n,""))}function Ae(e){var t=Le(e)||[];if(!t.length)return[];var n=[];if(0===t[0]){for(var o=0;o<t.length;o++)"number"==typeof t[o]&&n.push(e.substring(t[o]+1,t[o+1]));return n}}function Le(e){for(var t=!1,n=[],o=0,r;o<e.length;o++)r=e.charAt(o),t||"/"!=r||n.push(o),t=!t&&"\\"==r;return n}function Re(e){for(var t=!1,o=[],r=-1;r<e.length;r++){var a=e.charAt(r)||"",i=e.charAt(r+1)||"",n=i&&-1!="|(){".indexOf(i);t?(("\\"!==a||!n)&&o.push(a),t=!1):"\\"===a?(t=!0,i&&-1!="}".indexOf(i)&&(n=!0),(!n||"\\"===i)&&o.push(a)):(o.push(a),n&&"\\"!==i&&o.push("\\"))}return o.join("")}function Oe(e){for(var t=!1,o=[],r=-1;r<e.length;r++){var a=e.charAt(r)||"",i=e.charAt(r+1)||"";At[a+i]?(o.push(At[a+i]),r++):t?(o.push(a),t=!1):"\\"===a?(t=!0,x(i)||"$"===i?o.push("$"):"/"!==i&&"\\"!==i&&o.push("\\")):("$"===a&&o.push("$"),o.push(a),"/"===i&&o.push("\\"))}return o.join("")}function Pe(e){for(var n=new t.StringStream(e),o=[];!n.eol();){for(;n.peek()&&"\\"!=n.peek();)o.push(n.next());var r=!1;for(var a in Lt)if(n.match(a,!0)){r=!0,o.push(Lt[a]);break}r||o.push(n.next())}return o.join("")}function _e(e,t,n){var o=Ct.registerController.getRegister("/");if(o.setText(e),e instanceof RegExp)return e;var r=Le(e),a,i;if(!r.length)a=e;else{a=e.substring(0,r[0]);var s=e.substring(r[0]);i=-1!=s.indexOf("i")}if(!a)return null;w("pcre")||(a=Re(a)),n&&(t=/^[^A-Z]*$/.test(a));var d=new RegExp(a,t||i?"i":void 0);return d}function De(e,t){e.openNotification?e.openNotification("<span style=\"color: red\">"+t+"</span>",{bottom:!0,duration:5e3}):alert(t)}function Me(e,t){var n="<span style=\"font-family: monospace; white-space: pre\">"+(e||"")+"<input type=\"text\"></span>";return t&&(n+=" <span style=\"color: #888\">"+t+"</span>"),n}function Fe(e,t){var n=(t.prefix||"")+" "+(t.desc||""),o=Me(t.prefix,t.desc);Ne(e,o,n,t.onClose,t)}function Be(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var n=["global","multiline","ignoreCase","source"],o=0,r;o<n.length;o++)if(r=n[o],e[r]!==t[r])return!1;return!0}return!1}function Ue(e,t,n,o){if(t){var r=Ie(e),a=_e(t,!!n,!!o);if(a)return(We(e,a),Be(a,r.getQuery()))?a:(r.setQuery(a),a)}}function Ve(e){if("^"==e.source.charAt(0));return{token:function(t){if(!t.sol())return void t.skipToEnd();var n=t.match(e,!1);if(n)return 0==n[0].length?(t.next(),"searching"):!t.sol()&&(t.backUp(1),!e.exec(t.next()+n[0]))?(t.next(),null):(t.match(e),"searching");for(;!t.eol()&&(t.next(),!t.match(e,!1)););},query:e}}function We(e,t){var n=Ie(e),o=n.getOverlay();o&&t==o.query||(o&&e.removeOverlay(o),o=Ve(t),e.addOverlay(o),e.showMatchesOnScrollbar&&(n.getScrollbarAnnotate()&&n.getScrollbarAnnotate().clear(),n.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),n.setOverlay(o))}function He(e,t,n,o){return void 0===o&&(o=1),e.operation(function(){for(var r=e.getCursor(),a=e.getSearchCursor(n,r),s=0,i;s<o;s++)if(i=a.find(t),0==s&&i&&z(a.from(),r)&&(i=a.find(t)),!i&&(a=e.getSearchCursor(n,t?l(e.lastLine()):l(e.firstLine(),0)),!a.find(t)))return;return a.from()})}function je(e){var t=Ie(e);e.removeOverlay(Ie(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function qe(e,t,n){return"number"!=typeof e&&(e=e.line),t instanceof Array?E(e,t):n?e>=t&&e<=n:e==t}function ze(e){var t=e.getScrollInfo(),n=e.coordsChar({left:0,top:6+t.top},"local"),o=t.clientHeight-10+t.top,r=e.coordsChar({left:0,top:o},"local");return{top:n.line,bottom:r.line}}function Ke(e,t,n){if("'"==n){var o=e.doc.history.done,r=o[o.length-2];return r&&r.ranges&&r.ranges[0].head}var a=t.marks[n];return a&&a.find()}function Ge(e,n,o,r,a,i,s,d,l){function p(){e.operation(function(){for(;!m;)c(),u();h()})}function c(){var t=e.getRange(i.from(),i.to()),n=t.replace(s,d);i.replace(n)}function u(){for(;i.findNext()&&qe(i.from(),r,a);)if(o||!g||i.from().line!=g.line)return e.scrollIntoView(i.from(),30),e.setSelection(i.from(),i.to()),g=i.from(),void(m=!1);m=!0}function h(t){if(t&&t(),e.focus(),g){e.setCursor(g);var n=e.state.vim;n.exMode=!1,n.lastHPos=n.lastHSPos=g.ch}l&&l()}e.state.vim.exMode=!0;var m=!1,g=i.from();return u(),m?void De(e,"No matches for "+s.source):n?void Fe(e,{prefix:"replace with <strong>"+d+"</strong> (y/n/a/q/l)",onKeyDown:function(n,o,r){t.e_stop(n);var a=t.keyName(n);switch(a){case"Y":c(),u();break;case"N":u();break;case"A":var i=l;l=void 0,e.operation(p),l=i;break;case"L":c();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":h(r);}return m&&h(r),!0}}):(p(),void(l&&l()))}function Xe(e){var n=e.state.vim,o=Ct.macroModeState,r=Ct.registerController.getRegister("."),a=o.isPlaying,s=o.lastInsertModeChanges,d=[];if(!a){for(var l=s.inVisualBlock?n.lastSelection.visualBlock.height:1,p=s.changes,d=[],c=0;c<p.length;)d.push(p[c]),p[c]instanceof rt?c++:c+=l;s.changes=d,e.off("change",et),t.off(e.getInputField(),"keydown",at)}!a&&1<n.insertModeRepeat&&(it(e,n,n.insertModeRepeat-1,!0),n.lastEditInputState.repeatOverride=n.insertModeRepeat),delete n.insertModeRepeat,n.insertMode=!1,e.setCursor(e.getCursor().line,e.getCursor().ch-1),e.setOption("keyMap","vim"),e.setOption("disableInput",!0),e.toggleOverwrite(!1),r.setText(s.changes.join("")),t.signal(e,"vim-mode-change",{mode:"normal"}),o.isRecording&&$e(o)}function Qe(e){s.unshift(e)}function Ye(e,n,o,r){var a=Ct.registerController.getRegister(r);if(":"==r)return a.keyBuffer[0]&&_t.processCommand(e,a.keyBuffer[0]),void(o.isPlaying=!1);var s=a.keyBuffer,d=0;o.isPlaying=!0,o.replaySearchQueries=a.searchQueries.slice(0);for(var l=0;l<s.length;l++)for(var i=s[l],p,c;i;)if(p=/<\w+-.+?>|<\w+>|./.exec(i),c=p[0],i=i.substring(p.index+c.length),t.Vim.handleKey(e,c,"macro"),n.insertMode){var u=a.insertModeChanges[d++].changes;Ct.macroModeState.lastInsertModeChanges.changes=u,st(e,u,1),Xe(e)}o.isPlaying=!1}function Je(e,t){if(!e.isPlaying){var n=e.latestRegister,o=Ct.registerController.getRegister(n);o&&o.pushText(t)}}function $e(e){if(!e.isPlaying){var t=e.latestRegister,n=Ct.registerController.getRegister(t);n&&n.pushInsertModeChanges&&n.pushInsertModeChanges(e.lastInsertModeChanges)}}function Ze(e,t){if(!e.isPlaying){var n=e.latestRegister,o=Ct.registerController.getRegister(n);o&&o.pushSearchQuery&&o.pushSearchQuery(t)}}function et(e,t){var n=Ct.macroModeState,o=n.lastInsertModeChanges;if(!n.isPlaying)for(;t;){if(o.expectCursorActivityForChange=!0,"+input"==t.origin||"paste"==t.origin||void 0===t.origin){var r=t.text.join("\n");o.maybeReset&&(o.changes=[],o.maybeReset=!1),o.changes.push(r)}t=t.next}}function tt(e){var t=e.state.vim;if(t.insertMode){var n=Ct.macroModeState;if(n.isPlaying)return;var o=n.lastInsertModeChanges;o.expectCursorActivityForChange?o.expectCursorActivityForChange=!1:o.maybeReset=!0}else e.curOp.isVimOp||ot(e,t);t.visualMode&&nt(e)}function nt(e){var t=e.state.vim,n=M(e,q(t.sel.head)),o=B(n,0,1);t.fakeCursor&&t.fakeCursor.clear(),t.fakeCursor=e.markText(n,o,{className:"cm-animate-fat-cursor"})}function ot(e,n){var o=e.getCursor("anchor"),r=e.getCursor("head");if(n.visualMode&&!e.somethingSelected()?le(e,!1):!n.visualMode&&!n.insertMode&&e.somethingSelected()&&(n.visualMode=!0,n.visualLine=!1,t.signal(e,"vim-mode-change",{mode:"visual"})),n.visualMode){var a=K(r,o)?0:-1,i=K(r,o)?-1:0;r=B(r,0,a),o=B(o,0,i),n.sel={anchor:o,head:r},Ce(e,n,"<",G(r,o)),Ce(e,n,">",X(r,o))}else n.insertMode||(n.lastHPos=e.getCursor().ch)}function rt(e){this.keyName=e}function at(n){var e=Ct.macroModeState,o=e.lastInsertModeChanges,r=t.keyName(n);r&&(-1==r.indexOf("Delete")&&-1==r.indexOf("Backspace")||t.lookupKey(r,"vim-insert",function(){return o.maybeReset&&(o.changes=[],o.maybeReset=!1),o.changes.push(new rt(r)),!0}))}function it(e,t,n,o){function r(){d?Et.processAction(e,t,t.lastEditActionCommand):Et.evalInput(e,t)}function a(n){if(0<s.lastInsertModeChanges.changes.length){n=t.lastEditActionCommand?n:1;var o=s.lastInsertModeChanges;st(e,o.changes,n)}}var s=Ct.macroModeState;s.isPlaying=!0;var d=!!t.lastEditActionCommand,l=t.inputState;if(t.inputState=t.lastEditInputState,d&&t.lastEditActionCommand.interlaceInsertRepeat)for(var p=0;p<n;p++)r(),a(1);else o||r(),a(n);t.inputState=l,t.insertMode&&!o&&Xe(e),s.isPlaying=!1}function st(e,n,o){function r(n){return"string"==typeof n?t.commands[n](e):n(e),!0}var a=e.getCursor("head"),s=Ct.macroModeState.lastInsertModeChanges.inVisualBlock;if(s){var d=e.state.vim,l=d.lastSelection,p=U(l.anchor,l.head);te(e,a,p.line+1),o=e.listSelections().length,e.setCursor(a)}for(var c=0;c<o;c++){s&&e.setCursor(B(a,c,0));for(var i=0,u;i<n.length;i++)if(u=n[i],u instanceof rt)t.lookupKey(u.keyName,"vim-insert",r);else{var h=e.getCursor();e.replaceRange(u,h,h)}}s&&e.setCursor(B(a,0,1))}t.defineOption("vimMode",!1,function(e,n,o){n&&"vim"!=e.getOption("keyMap")?e.setOption("keyMap","vim"):!n&&o!=t.Init&&/^vim/.test(e.getOption("keyMap"))&&e.setOption("keyMap","default")});var dt={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A"},lt={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"},pt=/[\d]/,ct=[t.isWordChar,function(e){return e&&!t.isWordChar(e)&&!/\s/.test(e)}],ut=[function(e){return /\S/.test(e)}],ht=f(65,26),mt=f(97,26),gt=f(48,10),ft=[].concat(ht,mt,gt,["<",">"]),yt=[].concat(ht,mt,gt,["-","\"",".",":","/"]),bt={};k("filetype",void 0,"string",["ft"],function(e,t){if(void 0!==t){if(void 0===e){var n=t.getOption("mode");return"null"==n?"":n}var n=""==e?"null":e;t.setOption("mode",n)}});var vt=function(){var e=100,t=-1,n=0,o=0,r=Array(e);return{cachedCursor:void 0,add:function(a,i,s){function d(n){var o=++t%e,i=r[o];i&&i.clear(),r[o]=a.setBookmark(n)}var l=t%e,p=r[l];if(p){var c=p.find();c&&!z(c,i)&&d(i)}else d(i);d(s),n=t,o=t-e+1,0>o&&(o=0)},move:function(a,i){t+=i,t>n?t=n:t<o&&(t=o);var s=r[(e+t)%e];if(s&&!s.find()){var d=0<i?1:-1,l=a.getCursor(),p;do if(t+=d,s=r[(e+t)%e],s&&(p=s.find())&&!z(l,p))break;while(t<n&&t>o)}return s}}},xt=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};I.prototype={exitMacroRecordMode:function(){var e=Ct.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var n=Ct.registerController.getRegister(t);n&&(n.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog("(recording)["+t+"]",null,{bottom:!0})),this.isRecording=!0)}};var Ct,St;L.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},L.prototype.getRepeat=function(){var e=0;return(0<this.prefixRepeat.length||0<this.motionRepeat.length)&&(e=1,0<this.prefixRepeat.length&&(e*=parseInt(this.prefixRepeat.join(""),10)),0<this.motionRepeat.length&&(e*=parseInt(this.motionRepeat.join(""),10))),e},O.prototype={setText:function(e,t,n){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!n},pushText:function(e,t){t&&(!this.linewise&&this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(xt(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},P.prototype={pushText:function(e,t,n,o,r){o&&"\n"==n.charAt(0)&&(n=n.slice(1)+"\n"),o&&"\n"!==n.charAt(n.length-1)&&(n+="\n");var a=this.isValidRegister(e)?this.getRegister(e):null;if(!a)return"yank"===t?this.registers[0]=new O(n,o,r):"delete"===t||"change"===t?-1==n.indexOf("\n")?this.registers["-"]=new O(n,o):(this.shiftNumericRegisters_(),this.registers[1]=new O(n,o)):void 0,void this.unnamedRegister.setText(n,o,r);var i=C(e);i?a.pushText(n,o):a.setText(n,o,r),this.unnamedRegister.setText(a.toString(),o)},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new O),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&E(e,yt)},shiftNumericRegisters_:function(){for(var e=9;2<=e;e--)this.registers[e]=this.getRegister(""+(e-1))}},_.prototype={nextMatch:function(e,t){var n=this.historyBuffer,o=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var r=this.iterator+o,a;t?0<=r:r<n.length;r+=o){a=n[r];for(var i=0;i<=a.length;i++)if(this.initialPrefix==a.substring(0,i))return this.iterator=r,a}return r>=n.length?(this.iterator=n.length,this.initialPrefix):0>r?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);-1<t&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var Et={matchCommand:function(e,t,n,o){var r=V(e,t,o,n);if(!r.full&&!r.partial)return{type:"none"};if(!r.full&&r.partial)return{type:"partial"};for(var a=0,i,s;a<r.full.length;a++)s=r.full[a],i||(i=s);return"<character>"==i.keys.slice(-11)&&(n.selectedCharacter=H(e)),{type:"full",command:i}},processCommand:function(e,t,n){switch(t.inputState.repeatOverride=n.repeatOverride,n.type){case"motion":this.processMotion(e,t,n);break;case"operator":this.processOperator(e,t,n);break;case"operatorMotion":this.processOperatorMotion(e,t,n);break;case"action":this.processAction(e,t,n);break;case"search":this.processSearch(e,t,n);break;case"ex":case"keyToEx":this.processEx(e,t,n);break;default:}},processMotion:function(e,t,n){t.inputState.motion=n.motion,t.inputState.motionArgs=F(n.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,n){var o=t.inputState;if(o.operator){if(o.operator==n.operator)return o.motion="expandToLine",o.motionArgs={linewise:!0},void this.evalInput(e,t);R(e)}o.operator=n.operator,o.operatorArgs=F(n.operatorArgs),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,n){var o=t.visualMode,r=F(n.operatorMotionArgs);r&&o&&r.visualLine&&(t.visualLine=!0),this.processOperator(e,t,n),o||this.processMotion(e,t,n)},processAction:function(e,t,n){var o=t.inputState,r=o.getRepeat(),a=F(n.actionArgs)||{};o.selectedCharacter&&(a.selectedCharacter=o.selectedCharacter),n.operator&&this.processOperator(e,t,n),n.motion&&this.processMotion(e,t,n),(n.motion||n.operator)&&this.evalInput(e,t),a.repeat=r||1,a.repeatIsExplicit=!!r,a.registerName=o.registerName,R(e),t.lastMotion=null,n.isEdit&&this.recordLastEdit(t,o,n),wt[n.action](e,a,t)},processSearch:function(n,e,r){function a(t,o,a){Ct.searchHistoryController.pushInput(t),Ct.searchHistoryController.reset();try{Ue(n,t,o,a)}catch(o){return De(n,"Invalid regex: "+t),void R(n)}Et.processMotion(n,e,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:r.searchArgs.toJumplist}})}function i(e){n.scrollTo(h.left,h.top),a(e,!0,!0);var t=Ct.macroModeState;t.isRecording&&Ze(t,e)}function s(r,e,a){var i=t.keyName(r),s,d;"Up"==i||"Down"==i?(s="Up"==i,d=r.target?r.target.selectionEnd:0,e=Ct.searchHistoryController.nextMatch(e,s)||"",a(e),d&&r.target&&(r.target.selectionEnd=r.target.selectionStart=o(d,r.target.value.length))):"Left"!=i&&"Right"!=i&&"Ctrl"!=i&&"Alt"!=i&&"Shift"!=i&&Ct.searchHistoryController.reset();var p;try{p=Ue(n,e,!0,!0)}catch(t){}p?n.scrollIntoView(He(n,!l,p),30):(je(n),n.scrollTo(h.left,h.top))}function d(o,e,r){var a=t.keyName(o);"Esc"==a||"Ctrl-C"==a||"Ctrl-["==a||"Backspace"==a&&""==e?(Ct.searchHistoryController.pushInput(e),Ct.searchHistoryController.reset(),Ue(n,u),je(n),n.scrollTo(h.left,h.top),t.e_stop(o),R(n),r(),n.focus()):"Up"==a||"Down"==a?t.e_stop(o):"Ctrl-U"==a&&(t.e_stop(o),r(""))}if(n.getSearchCursor){var l=r.searchArgs.forward,p=r.searchArgs.wholeWordOnly;Ie(n).setReversed(!l);var c=l?"/":"?",u=Ie(n).getQuery(),h=n.getScrollInfo();switch(r.searchArgs.querySrc){case"prompt":var m=Ct.macroModeState;if(m.isPlaying){var g=m.replaySearchQueries.shift();a(g,!0,!1)}else Fe(n,{onClose:i,prefix:c,desc:Rt,onKeyUp:s,onKeyDown:d});break;case"wordUnderCursor":var f=he(n,!1,!0,!1,!0),y=!0;if(f||(f=he(n,!1,!0,!1,!1),y=!1),!f)return;var g=n.getLine(f.start.line).substring(f.start.ch,f.end.ch);g=y&&p?"\\b"+g+"\\b":$(g),Ct.jumpList.cachedCursor=n.getCursor(),n.setCursor(f.start),a(g,!0,!1);}}},processEx:function(n,e,r){function a(e){Ct.exCommandHistoryController.pushInput(e),Ct.exCommandHistoryController.reset(),_t.processCommand(n,e)}function i(r,e,a){var i=t.keyName(r),s,d;("Esc"==i||"Ctrl-C"==i||"Ctrl-["==i||"Backspace"==i&&""==e)&&(Ct.exCommandHistoryController.pushInput(e),Ct.exCommandHistoryController.reset(),t.e_stop(r),R(n),a(),n.focus()),"Up"==i||"Down"==i?(t.e_stop(r),s="Up"==i,d=r.target?r.target.selectionEnd:0,e=Ct.exCommandHistoryController.nextMatch(e,s)||"",a(e),d&&r.target&&(r.target.selectionEnd=r.target.selectionStart=o(d,r.target.value.length))):"Ctrl-U"==i?(t.e_stop(r),a("")):"Left"!=i&&"Right"!=i&&"Ctrl"!=i&&"Alt"!=i&&"Shift"!=i&&Ct.exCommandHistoryController.reset()}"keyToEx"==r.type?_t.processCommand(n,r.exArgs.input):e.visualMode?Fe(n,{onClose:a,prefix:":",value:"'<,'>",onKeyDown:i}):Fe(n,{onClose:a,prefix:":",onKeyDown:i})},evalInput:function(t,n){var o=n.inputState,r=o.motion,a=o.motionArgs||{},s=o.operator,d=o.operatorArgs||{},p=o.registerName,c=n.sel,u=q(n.visualMode?M(t,c.head):t.getCursor("head")),h=q(n.visualMode?M(t,c.anchor):t.getCursor("anchor")),m=q(u),g=q(h),f,y,b;if(s&&this.recordLastEdit(n,o),b=void 0===o.repeatOverride?o.getRepeat():o.repeatOverride,0<b&&a.explicitRepeat?a.repeatIsExplicit=!0:(a.noRepeat||!a.explicitRepeat&&0===b)&&(b=1,a.repeatIsExplicit=!1),o.selectedCharacter&&(a.selectedCharacter=d.selectedCharacter=o.selectedCharacter),a.repeat=b,R(t),r){var v=kt[r](t,u,a,n);if(n.lastMotion=kt[r],!v)return;if(a.toJumplist){var x=Ct.jumpList,C=x.cachedCursor;C?(me(t,C,v),delete x.cachedCursor):me(t,u,v)}v instanceof Array?(y=v[0],f=v[1]):f=v,f||(f=q(u)),n.visualMode?(!(n.visualBlock&&f.ch===Infinity)&&(f=M(t,f,n.visualBlock)),y&&(y=M(t,y,!0)),y=y||g,c.anchor=y,c.head=f,ie(t),Ce(t,n,"<",K(y,f)?y:f),Ce(t,n,">",K(y,f)?f:y)):!s&&(f=M(t,f),t.setCursor(f.line,f.ch))}if(s){if(d.lastSel){y=g;var S=d.lastSel,E=e(S.head.line-S.anchor.line),k=e(S.head.ch-S.anchor.ch);f=S.visualLine?l(g.line+E,g.ch):S.visualBlock?l(g.line+E,g.ch+k):S.head.line==S.anchor.line?l(g.line,g.ch+k):l(g.line+E,g.ch),n.visualMode=!0,n.visualLine=S.visualLine,n.visualBlock=S.visualBlock,c=n.sel={anchor:y,head:f},ie(t)}else n.visualMode&&(d.lastSel={anchor:q(c.anchor),head:q(c.head),visualBlock:n.visualBlock,visualLine:n.visualLine});var T,w,I,N,A;if(!n.visualMode){if(T=q(y||g),w=q(f||m),K(w,T)){var L=T;T=w,w=L}I=a.linewise||d.linewise,I?ce(t,T,w):a.forward&&pe(t,T,w),N="char";var O=!a.inclusive||I;A=se(t,{anchor:T,head:w},N,O)}else if(T=G(c.head,c.anchor),w=X(c.head,c.anchor),I=n.visualLine||d.linewise,N=n.visualBlock?"block":I?"line":"char",A=se(t,{anchor:T,head:w},N),I){var P=A.ranges;if("block"==N)for(var _=0;_<P.length;_++)P[_].head.ch=Y(t,P[_].head.line);else"line"==N&&(P[0].head=l(P[0].head.line+1,0))}t.setSelections(A.ranges,A.primary),n.lastMotion=null,d.repeat=b,d.registerName=p,d.linewise=I;var i=Tt[s](t,d,A.ranges,g,f);n.visualMode&&le(t,null!=i),i&&t.setCursor(i)}},recordLastEdit:function(e,t,n){var o=Ct.macroModeState;o.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=n,o.lastInsertModeChanges.changes=[],o.lastInsertModeChanges.expectCursorActivityForChange=!1)}},kt={moveToTopLine:function(e,t,n){var o=ze(e).top+n.repeat-1;return l(o,ue(e.getLine(o)))},moveToMiddleLine:function(e){var t=ze(e),n=r(0.5*(t.top+t.bottom));return l(n,ue(e.getLine(n)))},moveToBottomLine:function(e,t,n){var o=ze(e).bottom-n.repeat+1;return l(o,ue(e.getLine(o)))},expandToLine:function(e,t,n){return l(t.line+n.repeat-1,Infinity)},findNext:function(e,t,n){var o=Ie(e),r=o.getQuery();if(r){var a=!n.forward;return a=o.isReversed()?!a:a,We(e,r),He(e,a,r,n.repeat)}},goToMark:function(e,t,n,o){var r=Ke(e,o,n.selectedCharacter);return r?n.linewise?{line:r.line,ch:ue(e.getLine(r.line))}:r:null},moveToOtherHighlightedEnd:function(e,t,n,o){if(o.visualBlock&&n.sameLine){var r=o.sel;return[M(e,l(r.anchor.line,r.head.ch)),M(e,l(r.head.line,r.anchor.ch))]}return[o.sel.head,o.sel.anchor]},jumpToMark:function(e,t,n,o){for(var r=t,a=0,i;a<n.repeat;a++)for(var s in i=r,o.marks)if(b(s)){var d=o.marks[s].find(),p=n.forward?K(d,i):K(i,d);if(!p&&!(n.linewise&&d.line==i.line)){var c=z(i,r),u=n.forward?Q(i,d,r):Q(r,d,i);(c||u)&&(r=d)}}return n.linewise&&(r=l(r.line,ue(e.getLine(r.line)))),r},moveByCharacters:function(e,t,n){var o=t,r=n.repeat,a=n.forward?o.ch+r:o.ch-r;return l(o.line,a)},moveByLines:function(e,t,n,o){var r=t,a=r.ch;switch(o.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:a=o.lastHPos;break;default:o.lastHPos=a;}var i=n.repeat+(n.repeatOffset||0),s=n.forward?r.line+i:r.line-i,d=e.firstLine(),p=e.lastLine();return s<d&&r.line==d?this.moveToStartOfLine(e,t,n,o):s>p&&r.line==p?this.moveToEol(e,t,n,o):(n.toFirstChar&&(a=ue(e.getLine(s)),o.lastHPos=a),o.lastHSPos=e.charCoords(l(s,a),"div").left,l(s,a))},moveByDisplayLines:function(e,t,n,o){var r=t;switch(o.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:o.lastHSPos=e.charCoords(r,"div").left;}var a=n.repeat,i=e.findPosV(r,n.forward?a:-a,"line",o.lastHSPos);if(i.hitSide)if(n.forward)var s=e.charCoords(i,"div"),d={top:s.top+8,left:o.lastHSPos},i=e.coordsChar(d,"div");else{var p=e.charCoords(l(e.firstLine(),0),"div");p.left=o.lastHSPos,i=e.coordsChar(p,"div")}return o.lastHPos=i.ch,i},moveByPage:function(e,t,n){var o=n.repeat;return e.findPosV(t,n.forward?o:-o,"page")},moveByParagraph:function(e,t,n){var o=n.forward?1:-1;return Ee(e,t,n.repeat,o)},moveByScroll:function(e,t,n,o){var r=e.getScrollInfo(),a=null,i=n.repeat;i||(i=r.clientHeight/(2*e.defaultTextHeight()));var s=e.charCoords(t,"local");n.repeat=i;var a=kt.moveByDisplayLines(e,t,n,o);if(!a)return null;var d=e.charCoords(a,"local");return e.scrollTo(null,r.top+d.top-s.top),a},moveByWords:function(e,t,n){return be(e,t,n.repeat,!!n.forward,!!n.wordEnd,!!n.bigWord)},moveTillCharacter:function(e,t,n){var o=n.repeat,r=ve(e,o,n.forward,n.selectedCharacter),a=n.forward?-1:1;return(ge(a,n),!r)?null:(r.ch+=a,r)},moveToCharacter:function(e,t,n){var o=n.repeat;return ge(0,n),ve(e,o,n.forward,n.selectedCharacter)||t},moveToSymbol:function(e,t,n){var o=n.repeat;return fe(e,o,n.forward,n.selectedCharacter)||t},moveToColumn:function(e,t,n,o){var r=n.repeat;return o.lastHPos=r-1,o.lastHSPos=e.charCoords(t,"div").left,xe(e,r)},moveToEol:function(e,t,n,o){o.lastHPos=Infinity;var r=l(t.line+n.repeat-1,Infinity),a=e.clipPos(r);return a.ch--,o.lastHSPos=e.charCoords(a,"div").left,r},moveToFirstNonWhiteSpaceCharacter:function(e,t){var n=t;return l(n.line,ue(e.getLine(n.line)))},moveToMatchedSymbol:function(e,t){var n=t,o=n.line,r=n.ch,a=e.getLine(o),i;do if(i=a.charAt(r++),i&&v(i)){var s=e.getTokenTypeAt(l(o,r));if("string"!==s&&"comment"!==s)break}while(i);if(i){var d=e.findMatchingBracket(l(o,r));return d.to}return n},moveToStartOfLine:function(e,t){return l(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,n){var o=n.forward?e.lastLine():e.firstLine();return n.repeatIsExplicit&&(o=n.repeat-e.getOption("firstLineNumber")),l(o,ue(e.getLine(o)))},textObjectManipulation:function(e,t,n,o){var r=n.selectedCharacter;"b"==r?r="(":"B"==r&&(r="{");var a=!n.textObjectInner,i;if({"(":")",")":"(","{":"}","}":"{","[":"]","]":"["}[r])i=ke(e,t,r,a);else if({"'":!0,'"':!0}[r])i=Te(e,t,r,a);else if("W"===r)i=he(e,a,!0,!0);else if("w"===r)i=he(e,a,!0,!1);else{if("p"!==r)return null;if(i=Ee(e,t,n.repeat,0,a),n.linewise=!0,o.visualMode)o.visualLine||(o.visualLine=!0);else{var s=o.inputState.operatorArgs;s&&(s.linewise=!0),i.end.line--}}return e.state.vim.visualMode?ae(e,i.start,i.end):[i.start,i.end]},repeatLastCharacterSearch:function(e,t,n){var o=Ct.lastCharacterSearch,r=n.repeat,a=n.forward===o.forward,i=(o.increment?1:0)*(a?-1:1);e.moveH(-i,"char"),n.inclusive=!!a;var s=ve(e,r,a,o.selectedCharacter);return s?(s.ch+=i,s):(e.moveH(i,"char"),t)}},Tt={change:function(e,n,o){var r=Number.MAX_VALUE,a=e.state.vim,i,s;if(Ct.macroModeState.lastInsertModeChanges.inVisualBlock=a.visualBlock,!a.visualMode){var d=o[0].anchor,p=o[0].head;s=e.getRange(d,p);var c=a.lastEditInputState||{};if("moveByWords"==c.motion&&!S(s)){var u=/\s+$/.exec(s);u&&c.motionArgs&&c.motionArgs.forward&&(p=B(p,0,-u[0].length),s=s.slice(0,-u[0].length))}var h=new l(d.line-1,r),m=e.firstLine()==e.lastLine();p.line>e.lastLine()&&n.linewise&&!m?e.replaceRange("",h,p):e.replaceRange("",d,p),n.linewise&&(!m&&(e.setCursor(h),t.commands.newlineAndIndent(e)),d.ch=r),i=d}else{s=e.getSelection();var g=D("",o.length);e.replaceSelections(g),i=G(o[0].head,o[0].anchor)}Ct.registerController.pushText(n.registerName,"change",s,n.linewise,1<o.length),wt.enterInsertMode(e,{head:i},e.state.vim)},delete:function(e,t,n){var o=e.state.vim,r,a;if(!o.visualBlock){var i=n[0].anchor,s=n[0].head;t.linewise&&s.line!=e.firstLine()&&i.line==e.lastLine()&&i.line==s.line-1&&(i.line==e.firstLine()?i.ch=0:i=l(i.line-1,Y(e,i.line-1))),a=e.getRange(i,s),e.replaceRange("",i,s),r=i,t.linewise&&(r=kt.moveToFirstNonWhiteSpaceCharacter(e,i))}else{a=e.getSelection();var d=D("",n.length);e.replaceSelections(d),r=n[0].anchor}return Ct.registerController.pushText(t.registerName,"delete",a,t.linewise,o.visualBlock),M(e,r)},indent:function(e,t,n){var o=e.state.vim,r=n[0].anchor.line,a=o.visualBlock?n[n.length-1].anchor.line:n[0].head.line,s=o.visualMode?t.repeat:1;t.linewise&&a--;for(var d=r;d<=a;d++)for(var i=0;i<s;i++)e.indentLine(d,t.indentRight);return kt.moveToFirstNonWhiteSpaceCharacter(e,n[0].anchor)},changeCase:function(e,t,n,o,r){for(var a=e.getSelections(),s=[],d=t.toLower,l=0;l<a.length;l++){var p=a[l],c="";if(!0===d)c=p.toLowerCase();else if(!1===d)c=p.toUpperCase();else for(var u=0,i;u<p.length;u++)i=p.charAt(u),c+=C(i)?i.toLowerCase():i.toUpperCase();s.push(c)}return e.replaceSelections(s),t.shouldMoveCursor?r:!e.state.vim.visualMode&&t.linewise&&n[0].anchor.line+1==n[0].head.line?kt.moveToFirstNonWhiteSpaceCharacter(e,o):t.linewise?o:G(n[0].anchor,n[0].head)},yank:function(e,t,n,o){var r=e.state.vim,a=e.getSelection(),i=r.visualMode?G(r.sel.anchor,r.sel.head,n[0].head,n[0].anchor):o;return Ct.registerController.pushText(t.registerName,"yank",a,t.linewise,r.visualBlock),i}},wt={jumpListWalk:function(e,t,n){if(!n.visualMode){var o=t.repeat,r=t.forward,a=Ct.jumpList,i=a.move(e,r?o:-o),s=i?i.find():void 0;s=s?s:e.getCursor(),e.setCursor(s)}},scroll:function(e,t,n){if(!n.visualMode){var o=t.repeat||1,a=e.defaultTextHeight(),i=e.getScrollInfo().top,s=a*o,d=t.forward?i+s:i-s,l=q(e.getCursor()),p=e.charCoords(l,"local");if(t.forward)d>p.top?(l.line+=(d-p.top)/a,l.line=Math.ceil(l.line),e.setCursor(l),p=e.charCoords(l,"local"),e.scrollTo(null,p.top)):e.scrollTo(null,d);else{var c=d+e.getScrollInfo().clientHeight;c<p.bottom?(l.line-=(p.bottom-c)/a,l.line=r(l.line),e.setCursor(l),p=e.charCoords(l,"local"),e.scrollTo(null,p.bottom-e.getScrollInfo().clientHeight)):e.scrollTo(null,d)}}},scrollToCursor:function(e,t){var n=e.getCursor().line,o=e.charCoords(l(n,0),"local"),r=e.getScrollInfo().clientHeight,a=o.top,i=o.bottom-a;switch(t.position){case"center":a=a-r/2+i;break;case"bottom":a=a-r+i;}e.scrollTo(null,a)},replayMacro:function(e,t,n){var o=t.selectedCharacter,r=t.repeat,a=Ct.macroModeState;for("@"==o&&(o=a.latestRegister);r--;)Ye(e,n,a,o)},enterMacroRecordMode:function(e,t){var n=Ct.macroModeState,o=t.selectedCharacter;n.enterMacroRecordMode(e,o)},toggleOverwrite:function(e){e.state.overwrite?(e.toggleOverwrite(!1),e.setOption("keyMap","vim-insert"),t.signal(e,"vim-mode-change",{mode:"insert"})):(e.toggleOverwrite(!0),e.setOption("keyMap","vim-replace"),t.signal(e,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(n,r,i){if(!n.getOption("readOnly")){i.insertMode=!0,i.insertModeRepeat=r&&r.repeat||1;var s=r?r.insertAt:null,d=i.sel,p=r.head||n.getCursor("head"),c=n.listSelections().length;if("eol"==s)p=l(p.line,Y(n,p.line));else if("charAfter"==s)p=B(p,0,1);else if("firstNonBlank"==s)p=kt.moveToFirstNonWhiteSpaceCharacter(n,p);else if("startOfSelectedArea"==s)i.visualBlock?(p=l(o(d.head.line,d.anchor.line),o(d.head.ch,d.anchor.ch)),c=e(d.head.line-d.anchor.line)+1):d.head.line<d.anchor.line?p=d.head:p=l(d.anchor.line,0);else if("endOfSelectedArea"==s)i.visualBlock?(p=l(o(d.head.line,d.anchor.line),a(d.head.ch+1,d.anchor.ch)),c=e(d.head.line-d.anchor.line)+1):d.head.line>=d.anchor.line?p=B(d.head,0,1):p=l(d.anchor.line,0);else if("inplace"==s&&i.visualMode)return;n.setOption("disableInput",!1),r&&r.replace?(n.toggleOverwrite(!0),n.setOption("keyMap","vim-replace"),t.signal(n,"vim-mode-change",{mode:"replace"})):(n.toggleOverwrite(!1),n.setOption("keyMap","vim-insert"),t.signal(n,"vim-mode-change",{mode:"insert"})),Ct.macroModeState.isPlaying||(n.on("change",et),t.on(n.getInputField(),"keydown",at)),i.visualMode&&le(n),te(n,p,c)}},toggleVisualMode:function(e,n,o){var r=n.repeat,a=e.getCursor(),i;o.visualMode?o.visualLine^n.linewise||o.visualBlock^n.blockwise?(o.visualLine=!!n.linewise,o.visualBlock=!!n.blockwise,t.signal(e,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),ie(e)):le(e):(o.visualMode=!0,o.visualLine=!!n.linewise,o.visualBlock=!!n.blockwise,i=M(e,l(a.line,a.ch+r-1),!0),o.sel={anchor:a,head:i},t.signal(e,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),ie(e),Ce(e,o,"<",G(a,i)),Ce(e,o,">",X(a,i)))},reselectLastSelection:function(e,n,o){var r=o.lastSelection;if(o.visualMode&&re(e,o),r){var a=r.anchorMark.find(),i=r.headMark.find();if(!a||!i)return;o.sel={anchor:a,head:i},o.visualMode=!0,o.visualLine=r.visualLine,o.visualBlock=r.visualBlock,ie(e),Ce(e,o,"<",G(a,i)),Ce(e,o,">",X(a,i)),t.signal(e,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""})}},joinLines:function(e,t,n){var o,r;if(n.visualMode){if(o=e.getCursor("anchor"),r=e.getCursor("head"),K(r,o)){var s=r;r=o,o=s}r.ch=Y(e,r.line)-1}else{var d=a(t.repeat,2);o=e.getCursor(),r=M(e,l(o.line+d-1,Infinity))}for(var p=0,c=o.line;c<r.line;c++){p=Y(e,o.line);var s=l(o.line+1,Y(e,o.line+1)),i=e.getRange(o,s);i=i.replace(/\n\s*/g," "),e.replaceRange(i,o,s)}var u=l(o.line,p);n.visualMode&&le(e,!1),e.setCursor(u)},newLineAndEnterInsertMode:function(e,n,o){o.insertMode=!0;var r=q(e.getCursor());if(r.line===e.firstLine()&&!n.after)e.replaceRange("\n",l(e.firstLine(),0)),e.setCursor(e.firstLine(),0);else{r.line=n.after?r.line:r.line-1,r.ch=Y(e,r.line),e.setCursor(r);var a=t.commands.newlineAndIndentContinueComment||t.commands.newlineAndIndent;a(e)}this.enterInsertMode(e,{repeat:n.repeat},o)},paste:function(e,t,n){var o=q(e.getCursor()),a=Ct.registerController.getRegister(t.registerName),s=a.toString();if(s){if(t.matchIndent){var d=e.getOption("tabSize"),p=function(e){var t=e.split("\t").length-1,n=e.split(" ").length-1;return t*d+1*n},c=e.getLine(e.getCursor().line),u=p(c.match(/^\s*/)[0]),h=s.replace(/\n$/,""),m=s!==h,g=p(s.match(/^\s*/)[0]),s=h.replace(/^\s*/gm,function(t){var n=u+(p(t)-g);if(0>n)return"";if(e.getOption("indentWithTabs")){var o=r(n/d);return Array(o+1).join("\t")}return Array(n+1).join(" ")});s+=m?"\n":""}if(1<t.repeat)var s=Array(t.repeat+1).join(s);var f=a.linewise,y=a.blockwise;if(f)n.visualMode?s=n.visualLine?s.slice(0,-1):"\n"+s.slice(0,s.length-1)+"\n":t.after?(s="\n"+s.slice(0,s.length-1),o.ch=Y(e,o.line)):o.ch=0;else{if(y){s=s.split("\n");for(var b=0;b<s.length;b++)s[b]=""==s[b]?" ":s[b]}o.ch+=t.after?1:0}var i,v;if(n.visualMode){n.lastPastedText=s;var x=oe(e,n),C=x[0],S=x[1],E=e.getSelection(),k=e.listSelections(),T=Array(k.length).join("1").split("1"),w;n.lastSelection&&(w=n.lastSelection.headMark.find()),Ct.registerController.unnamedRegister.setText(E),y?(e.replaceSelections(T),S=l(C.line+s.length-1,C.ch),e.setCursor(C),ee(e,S),e.replaceSelections(s),i=C):n.visualBlock?(e.replaceSelections(T),e.setCursor(C),e.replaceRange(s,C,C),i=C):(e.replaceRange(s,C,S),i=e.posFromIndex(e.indexFromPos(C)+s.length-1)),w&&(n.lastSelection.headMark=e.setBookmark(w)),f&&(i.ch=0)}else if(y){e.setCursor(o);for(var b=0,I;b<s.length;b++){I=o.line+b,I>e.lastLine()&&e.replaceRange("\n",l(I,0));var N=Y(e,I);N<o.ch&&Z(e,I,o.ch)}e.setCursor(o),ee(e,l(o.line+s.length-1,o.ch)),e.replaceSelections(s),i=o}else e.replaceRange(s,o),f&&t.after?i=l(o.line+1,ue(e.getLine(o.line+1))):f&&!t.after?i=l(o.line,ue(e.getLine(o.line))):!f&&t.after?(v=e.indexFromPos(o),i=e.posFromIndex(v+s.length-1)):(v=e.indexFromPos(o),i=e.posFromIndex(v+s.length));n.visualMode&&le(e,!1),e.setCursor(i)}},undo:function(e,n){e.operation(function(){j(e,t.commands.undo,n.repeat)(),e.setCursor(e.getCursor("anchor"))})},redo:function(e,n){j(e,t.commands.redo,n.repeat)()},setRegister:function(e,t,n){n.inputState.registerName=t.selectedCharacter},setMark:function(e,t,n){var o=t.selectedCharacter;Ce(e,n,o,e.getCursor())},replace:function(e,n,o){var r=n.selectedCharacter,a=e.getCursor(),i=e.listSelections(),s,d;if(o.visualMode)a=e.getCursor("start"),d=e.getCursor("end");else{var p=e.getLine(a.line);s=a.ch+n.repeat,s>p.length&&(s=p.length),d=l(a.line,s)}if("\n"==r)o.visualMode||e.replaceRange("",a,d),(t.commands.newlineAndIndentContinueComment||t.commands.newlineAndIndent)(e);else{var c=e.getRange(a,d);if(c=c.replace(/[^\n]/g,r),o.visualBlock){var u=Array(e.getOption("tabSize")+1).join(" ");c=e.getSelection(),c=c.replace(/\t/g,u).replace(/[^\n]/g,r).split("\n"),e.replaceSelections(c)}else e.replaceRange(c,a,d);o.visualMode?(a=K(i[0].anchor,i[0].head)?i[0].anchor:i[0].head,e.setCursor(a),le(e,!1)):e.setCursor(B(d,0,-1))}},incrementNumberToken:function(e,t){for(var n=e.getCursor(),o=e.getLine(n.line),r=/-?\d+/g,a,i,s,d,p;null!==(a=r.exec(o))&&(p=a[0],i=a.index,s=i+p.length,!(n.ch<s)););if(t.backtrack||!(s<=n.ch)){if(p){var c=t.increase?1:-1,u=parseInt(p)+c*t.repeat,h=l(n.line,i),m=l(n.line,s);d=u.toString(),e.replaceRange(d,h,m)}else return;e.setCursor(l(n.line,i+d.length-1))}},repeatLastEdit:function(e,t,n){var o=n.lastEditInputState;if(o){var r=t.repeat;r&&t.repeatIsExplicit?n.lastEditInputState.repeatOverride=r:r=n.lastEditInputState.repeatOverride||r,it(e,n,r,!1)}},indent:function(e,t){e.indentLine(e.getCursor().line,t.indentRight)},exitInsertMode:Xe},It={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},Nt={bracket:{isComplete:function(e){if(e.nextCh!==e.symb)e.nextCh===e.reverseSymb&&e.depth--;else if(e.depth++,1<=e.depth)return!0;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?"]":"[")===e.symb?"{":"}"},isComplete:function(e){return 0===e.index&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t="*"===e.lastCh&&"/"===e.nextCh;return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb="m"===e.symb?"{":"}",e.reverseSymb="{"===e.symb?"}":"{"},isComplete:function(e){return e.nextCh===e.symb}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if("#"===e.nextCh){var t=e.lineText.match(/#(\w+)/)[1];if("endif"===t){if(e.forward&&0===e.depth)return!0;e.depth++}else if("if"===t){if(!e.forward&&0===e.depth)return!0;e.depth--}if("else"===t&&0===e.depth)return!0}return!1}}};k("pcre",!0,"boolean"),we.prototype={getQuery:function(){return Ct.query},setQuery:function(e){Ct.query=e},getOverlay:function(){return this.searchOverlay},setOverlay:function(e){this.searchOverlay=e},isReversed:function(){return Ct.isReversed},setReversed:function(e){Ct.isReversed=e},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(e){this.annotate=e}};var At={"\\n":"\n","\\r":"\r","\\t":"\t"},Lt={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t"},Rt="(Javascript regexp)",Ot=function(){this.buildCommandMap_()};Ot.prototype={processCommand:function(e,t,n){var o=this;e.operation(function(){e.curOp.isVimOp=!0,o._processCommand(e,t,n)})},_processCommand:function(n,e,o){var r=n.state.vim,a=Ct.registerController.getRegister(":"),s=a.toString();r.visualMode&&le(n);var d=new t.StringStream(e);a.setText(e);var l=o||{};l.input=e;try{this.parseInput_(n,d,l)}catch(t){throw De(n,t),t}var p,c;if(!l.commandName)void 0!==l.line&&(c="move");else if(p=this.matchCommand_(l.commandName),p){if(c=p.name,p.excludeFromCommandHistory&&a.setText(s),this.parseCommandArgs_(d,l,p),"exToKey"==p.type){for(var u=0;u<p.toKeys.length;u++)t.Vim.handleKey(n,p.toKeys[u],"mapping");return}if("exToEx"==p.type)return void this.processCommand(n,p.toInput)}if(!c)return void De(n,"Not an editor command \":"+e+"\"");try{Pt[c](n,l),p&&p.possiblyAsync||!l.callback||l.callback()}catch(t){throw De(n,t),t}},parseInput_:function(e,t,n){t.eatWhile(":"),t.eat("%")?(n.line=e.firstLine(),n.lineEnd=e.lastLine()):(n.line=this.parseLineSpec_(e,t),void 0!==n.line&&t.eat(",")&&(n.lineEnd=this.parseLineSpec_(e,t)));var o=t.match(/^(\w+)/);return n.commandName=o?o[1]:t.match(/.*/)[0],n},parseLineSpec_:function(e,t){var n=t.match(/^(\d+)/);if(n)return parseInt(n[1],10)-1;switch(t.next()){case".":return e.getCursor().line;case"$":return e.lastLine();case"'":var o=t.next(),r=Ke(e,e.state.vim,o);if(!r)throw new Error("Mark not set");return r.line;default:return void t.backUp(1);}},parseCommandArgs_:function(e,t,n){if(!e.eol()){t.argString=e.match(/.*/)[0];var o=n.argDelimiter||/\s+/,r=J(t.argString).split(o);r.length&&r[0]&&(t.args=r)}},matchCommand_:function(e){for(var t=e.length,n;0<t;t--)if(n=e.substring(0,t),this.commandMap_[n]){var o=this.commandMap_[n];if(0===o.name.indexOf(e))return o}return null},buildCommandMap_:function(){this.commandMap_={};for(var e=0;e<d.length;e++){var t=d[e],n=t.shortName||t.name;this.commandMap_[n]=t}},map:function(e,t,n){if(":"!=e&&":"==e.charAt(0)){if(n)throw Error("Mode not supported for ex mappings");var o=e.substring(1);this.commandMap_[o]=":"!=t&&":"==t.charAt(0)?{name:o,type:"exToEx",toInput:t.substring(1),user:!0}:{name:o,type:"exToKey",toKeys:t,user:!0}}else if(":"!=t&&":"==t.charAt(0)){var r={keys:e,type:"keyToEx",exArgs:{input:t.substring(1)}};n&&(r.context=n),s.unshift(r)}else{var r={keys:e,type:"keyToKey",toKeys:t};n&&(r.context=n),s.unshift(r)}},unmap:function(e,t){if(":"!=e&&":"==e.charAt(0)){if(t)throw Error("Mode not supported for ex mappings");var n=e.substring(1);if(this.commandMap_[n]&&this.commandMap_[n].user)return void delete this.commandMap_[n]}else for(var o=0;o<s.length;o++)if(e==s[o].keys&&s[o].context===t)return void s.splice(o,1);throw Error("No such mapping.")}};var Pt={colorscheme:function(e,t){return!t.args||1>t.args.length?void De(e,e.getOption("theme")):void e.setOption("theme",t.args[0])},map:function(e,t,n){var o=t.args;return!o||2>o.length?void(e&&De(e,"Invalid mapping: "+t.input)):void _t.map(o[0],o[1],n)},imap:function(e,t){this.map(e,t,"insert")},nmap:function(e,t){this.map(e,t,"normal")},vmap:function(e,t){this.map(e,t,"visual")},unmap:function(e,t,n){var o=t.args;return!o||1>o.length?void(e&&De(e,"No such mapping: "+t.input)):void _t.unmap(o[0],n)},move:function(e,t){Et.processCommand(e,e.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var n=t.args,o=t.setCfg||{};if(!n||1>n.length)return void(e&&De(e,"Invalid mapping: "+t.input));var r=n[0].split("="),a=r[0],i=r[1],s=!1;if("?"==a.charAt(a.length-1)){if(i)throw Error("Trailing characters: "+t.argString);a=a.substring(0,a.length-1),s=!0}void 0===i&&"no"==a.substring(0,2)&&(a=a.substring(2),i=!1);var d=bt[a]&&"boolean"==bt[a].type;if(d&&void 0==i&&(i=!0),!d&&void 0===i||s){var l=w(a,e,o);!0===l||!1===l?De(e," "+(l?"":"no")+a):De(e," "+a+"="+l)}else T(a,i,e,o)},setlocal:function(e,t){t.setCfg={scope:"local"},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:"global"},this.set(e,t)},registers:function(e,t){var n=t.args,o=Ct.registerController.registers,r="----------Registers----------<br><br>";if(!n)for(var a in o){var s=o[a].toString();s.length&&(r+="\""+a+" "+s+"<br>")}else{var a;n=n.join("");for(var d=0;d<n.length;d++)if(a=n.charAt(d),!!Ct.registerController.isValidRegister(a)){var i=o[a]||new O;r+="\""+a+" "+i.toString()+"<br>"}}De(e,r)},sort:function(e,n){function o(e,t){if(s){var n;n=e,e=t,t=n}d&&(e=e.toLowerCase(),t=t.toLowerCase());var o=c&&v.exec(e),r=c&&v.exec(t);return o?(o=parseInt((o[1]+o[2]).toLowerCase(),x),r=parseInt((r[1]+r[2]).toLowerCase(),x),o-r):e<t?-1:1}function r(e,t){if(s){var n;n=e,e=t,t=n}return d&&(e[0]=e[0].toLowerCase(),t[0]=t[0].toLowerCase()),e[0]<t[0]?-1:1}var a=function(){if(n.argString){var e=new t.StringStream(n.argString);if(e.eat("!")&&(s=!0),e.eol())return;if(!e.eatSpace())return"Invalid arguments";var o=e.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!o&&!e.eol())return"Invalid arguments";if(o[1]){d=-1!=o[1].indexOf("i"),p=-1!=o[1].indexOf("u");var r=-1!=o[1].indexOf("d")||-1!=o[1].indexOf("n")&&1,a=-1!=o[1].indexOf("x")&&1,i=-1!=o[1].indexOf("o")&&1;if(1<r+a+i)return"Invalid arguments";c=r&&"decimal"||a&&"hex"||i&&"octal"}o[2]&&(u=new RegExp(o[2].substr(1,o[2].length-2),d?"i":""))}}(),s,d,p,c,u;if(a)return void De(e,a+": "+n.argString);var h=n.line||e.firstLine(),m=n.lineEnd||n.line||e.lastLine();if(h!=m){var g=l(h,0),f=l(m,Y(e,m)),y=e.getRange(g,f).split("\n"),v=u?u:"decimal"==c?/(-?)([\d]+)/:"hex"==c?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==c?/([0-7]+)/:null,x="decimal"==c?10:"hex"==c?16:"octal"==c?8:null,b=[],C=[];if(c||u)for(var S=0,i;S<y.length;S++)i=u?y[S].match(u):null,i&&""!=i[0]?b.push(i):!u&&v.exec(y[S])?b.push(y[S]):C.push(y[S]);else C=y;if(b.sort(u?r:o),u)for(var S=0;S<b.length;S++)b[S]=b[S].input;else c||C.sort(o);if(y=s?b.concat(C):C.concat(b),p){var E=y,k;y=[];for(var S=0;S<E.length;S++)E[S]!=k&&y.push(E[S]),k=E[S]}e.replaceRange(y.join("\n"),g,f)}},global:function(e,t){var n=t.argString;if(!n)return void De(e,"Regular Expression missing from global");var o=void 0===t.line?e.firstLine():t.line,r=t.lineEnd||t.line||e.lastLine(),a=Ae(n),s=n,d;if(a.length&&(s=a[0],d=a.slice(1,a.length).join("/")),s)try{Ue(e,s,!0,!0)}catch(t){return void De(e,"Invalid regex: "+s)}for(var l=Ie(e).getQuery(),p=[],c="",u=o,i;u<=r;u++)i=l.test(e.getLine(u)),i&&(p.push(u+1),c+=e.getLine(u)+"<br>");if(!d)return void De(e,c);var h=0,m=function(){if(h<p.length){var t=p[h]+d;_t.processCommand(e,t,{callback:m})}h++};m()},substitute:function(e,t){if(!e.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var n=t.argString,o=n?Ae(n):[],r="",a=!1,i=!1,s,d,p,c;if(o.length)s=o[0],r=o[1],void 0!==r&&(r=w("pcre")?Pe(r):Oe(r),Ct.lastSubstituteReplacePart=r),d=o[2]?o[2].split(" "):[];else if(n&&n.length)return void De(e,"Substitutions should be of the form :s/pattern/replace/");if(d&&(p=d[0],c=parseInt(d[1]),p&&(-1!=p.indexOf("c")&&(a=!0,p.replace("c","")),-1!=p.indexOf("g")&&(i=!0,p.replace("g","")),s=s+"/"+p)),s)try{Ue(e,s,!0,!0)}catch(t){return void De(e,"Invalid regex: "+s)}if(r=r||Ct.lastSubstituteReplacePart,void 0===r)return void De(e,"No previous substitute regular expression");var u=Ie(e),h=u.getQuery(),m=void 0===t.line?e.getCursor().line:t.line,g=t.lineEnd||m;m==e.firstLine()&&g==e.lastLine()&&(g=Infinity),c&&(m=g,g=m+c-1);var f=M(e,l(m,0)),y=e.getSearchCursor(h,f);Ge(e,a,i,m,g,y,h,r,t.callback)},redo:t.commands.redo,undo:t.commands.undo,write:function(e){t.commands.save?t.commands.save(e):e.save&&e.save()},nohlsearch:function(e){je(e)},yank:function(e){var t=q(e.getCursor()),n=t.line,o=e.getLine(n);Ct.registerController.pushText("0","yank",o,!0,!0)},delmarks:function(e,o){if(!o.argString||!J(o.argString))return void De(e,"Argument required");for(var r=e.state.vim,a=new t.StringStream(J(o.argString));!a.eol();){a.eatSpace();var i=a.pos;if(!a.match(/[a-zA-Z]/,!1))return void De(e,"Invalid argument: "+o.argString.substring(i));var s=a.next();if(a.match("-",!0)){if(!a.match(/[a-zA-Z]/,!1))return void De(e,"Invalid argument: "+o.argString.substring(i));var d=s,l=a.next();if(b(d)&&b(l)||C(d)&&C(l)){var p=d.charCodeAt(0),c=l.charCodeAt(0);if(p>=c)return void De(e,"Invalid argument: "+o.argString.substring(i));for(var u=0,h;u<=c-p;u++)h=n(p+u),delete r.marks[h]}else return void De(e,"Invalid argument: "+d+"-")}else delete r.marks[s]}}},_t=new Ot;return t.keyMap.vim={attach:u,detach:c,call:h},k("insertModeEscKeysTimeout",200,"number"),t.keyMap["vim-insert"]={fallthrough:["default"],attach:u,detach:c,call:h},t.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:u,detach:c,call:h},(A(),{buildKeyMap:function(){},getRegisterController:function(){return Ct.registerController},resetVimGlobalState_:A,getVimGlobalState_:function(){return Ct},maybeInitVimState_:N,suppressErrorLogging:!1,InsertModeKey:rt,map:function(e,t,n){_t.map(e,t,n)},unmap:function(e,t){_t.unmap(e,t)},setOption:T,getOption:w,defineOption:k,defineEx:function(e,t,n){if(!t)t=e;else if(0!==e.indexOf(t))throw new Error("(Vim.defineEx) \""+t+"\" is not a prefix of \""+e+"\", command not registered");Pt[e]=n,_t.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,n){var o=this.findKey(e,t,n);if("function"==typeof o)return o()},findKey:function(n,e,o){function r(){var t=Ct.macroModeState;if(t.isRecording){if("q"==e)return t.exitMacroRecordMode(),R(n),!0;"mapping"!=o&&Je(t,e)}}function a(){if("<Esc>"==e)return R(n),d.visualMode?le(n):d.insertMode&&Xe(n),!0}function i(o){for(var r;o;)r=/<\w+-.+?>|<\w+>|./.exec(o),e=r[0],o=o.substring(r.index+e.length),t.Vim.handleKey(n,e,"mapping")}var d=N(n),l;return l=d.insertMode?function(){if(a())return!0;for(var t=d.inputState.keyBuffer+=e,o=1==e.length,r=Et.matchCommand(t,s,d.inputState,"insert");1<t.length&&"full"!=r.type;){var t=d.inputState.keyBuffer=t.slice(1),l=Et.matchCommand(t,s,d.inputState,"insert");"none"!=l.type&&(r=l)}if("none"==r.type)return R(n),!1;if("partial"==r.type)return St&&window.clearTimeout(St),St=window.setTimeout(function(){d.insertMode&&d.inputState.keyBuffer&&R(n)},w("insertModeEscKeysTimeout")),!o;if(St&&window.clearTimeout(St),o){for(var p=n.listSelections(),c=0,i;c<p.length;c++)i=p[c].head,n.replaceRange("",B(i,0,-(t.length-1)),i,"+input");Ct.macroModeState.lastInsertModeChanges.changes.pop()}return R(n),r.command}():function(){if(r()||a())return!0;var t=d.inputState.keyBuffer+=e;if(/^[1-9]\d*$/.test(t))return!0;var o=/^(\d*)(.*)$/.exec(t);if(!o)return R(n),!1;var i=d.visualMode?"visual":"normal",l=Et.matchCommand(o[2]||o[1],s,d.inputState,i);if("none"==l.type)return R(n),!1;if("partial"==l.type)return!0;d.inputState.keyBuffer="";var o=/^(\d*)(.*)$/.exec(t);return o[1]&&"0"!=o[1]&&d.inputState.pushRepeatDigit(o[1]),l.command}(),!1===l?void 0:!0===l?function(){return!0}:function(){return n.operation(function(){n.curOp.isVimOp=!0;try{"keyToKey"==l.type?i(l.toKeys):Et.processCommand(n,d,l)}catch(o){throw n.state.vim=void 0,N(n),t.Vim.suppressErrorLogging||console.log(o),o}return!0})}},handleEx:function(e,t){_t.processCommand(e,t)},defineMotion:function(e,t){kt[e]=t},defineAction:function(e,t){wt[e]=t},defineOperator:function(e,t){Tt[e]=t},mapCommand:function(e,t,n,o,r){var a={keys:e,type:t};for(var i in a[t]=n,a[t+"Args"]=o,r)a[i]=r[i];Qe(a)},_mapCommand:Qe,defineRegister:function(e,t){var n=Ct.registerController.registers[e];if(!e||1!=e.length)throw Error("Register name must be 1 character");if(n[e])throw Error("Register already defined "+e);n[e]=t,yt.push(e)},exitVisualMode:le,exitInsertMode:Xe})}()}),!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";function te(e){return e===Sr||e===Er}function Tt(t){var o=t.pos,n=t.prev();if(te(n))for(;!t.sol();)if(t.prev()===n&&t.peek()!==qr)return!0;return t.pos=o,!1}function e(e){return n(e)||Gt(e)}function n(e){var t=e.pos;return!!(Tt(e)&&e.eat(Rr)&&i(e))||(e.pos=t,!1)}function Gt(n){var t=n.pos;return!!(n.eatWhile(l)&&n.eat(Rr)&&i(n))||(n.pos=t,!1)}function i(e){return e.eatWhile(o)}function o(e){return e===Mr||r(e)||a(e)}function r(e){return 65<=(e&=-33)&&90>=e}function a(e){return 47<e&&58>e}function s(e){return e===Tr||e===zr}function l(t){return t&&t!==Rr&&!s(t)&&!te(t)}function c(s,l,e){l=_r(s.length,jr(0,null==l?s.length:l)),null!=e&&!0!==e||(l=u(s,l));var n=new $r(s),i;n.pos=l;for(var r=[];!n.sol();){if(i=n.peek(),h(i))r.push(i);else if(!d(i)){if(t(r,Wr)||t(r,Br)){n.pos--;continue}if(Lr(n)||!p(i))break}else if(r.pop()!==Yr.get(i))break;n.pos--}if(!r.length&&n.pos!==l){var o=s.slice(n.pos,l).replace(/^[\*\+\>\^]+/,"");return{abbreviation:o,location:l-o.length}}}function u(t,e){for(te(t.charCodeAt(e))&&e++;h(t.charCodeAt(e));)e++;return e}function t(n,t){return-1!==n.indexOf(t)}function p(e){return 64<e&&91>e||96<e&&123>e||47<e&&58>e||Dr.has(e)}function d(e){return e===Fr||e===Pr||e===Ir}function h(e){return e===Wr||e===Ur||e===Br}function m(n,t){return t&&(n="upper"===t?n.toUpperCase():n.toLowerCase()),n}function g(n,o){return n instanceof Jr?n:"string"==typeof n?new Jr(n,o):n&&"object"==typeof n?new Jr(n.name,n.value,n.options):void 0}function f(e){return(e+"").trim()}function y(o,t,e){return o&&e.indexOf(o)===t}function b(e){return e===ia||e===sa}function v(e){return 47<e&&58>e}function x(o,t,e){return t=t||65,e=e||90,(o&=-33)>=t&&o<=e}function k(e){return v(e)||x(e)}function C(e){return 32===e||9===e||160===e}function w(e){return C(e)||10===e||13===e}function A(s,t,e,n){n=n?Object.assign({},$a,n):$a;var r=s.pos;if(s.eat(t)){for(var i=1,a;!s.eof();)if(!Ca(s,n))if((a=s.next())===t)i++;else if(!(a===e))a===n.escape&&s.next();else if(! --i)return s.start=r,!0;if(s.pos=r,n.throws)throw s.error("Unable to find matching pair for "+Or(t))}return!1}function O(o){var r={};o.charCodeAt(0)===ai&&(o=o.slice(1),r.implied=!0),o.charCodeAt(o.length-1)===ii&&(o=o.slice(0,o.length-1),r.boolean=!0);var e={name:o};return Object.keys(r).length&&(e.options=r),e}function _(n){var t=n.pos;if(n.eatWhile(S))return n.start=t,!0}function S(e){return!w(e)&&!b(e)&&e!==di&&e!==li&&e!==si}function E(e){return e.start=e.pos,e.eatWhile(j),e.current()}function j(e){return k(e)||45===e||58===e||36===e||64===e||33===e||95===e||37===e}function q(d){for(var t=new aa(d.trim()),n=new Kr,r=n,i=[],o;!t.eof();)if(!((o=t.peek())!==hi)){var e=new Kr,l=i.length?T(i)[0]:r;i.push([e,l,t.pos]),r=e,t.next()}else if(o!==mi){var p=ui(t);if(r.appendChild(p),t.eof())break;switch(t.peek()){case gi:t.next();continue;case fi:t.next(),r=p;continue;case yi:for(;t.eat(yi);)r=r.parent||r;continue;}}else{var a=i.pop();if(!a)throw t.error("Unexpected \")\" group end");var c=a[0];if(r=a[1],t.next(),c.repeat=ei(t))r.appendChild(c);else{for(;c.firstChild;)r.appendChild(c.firstChild);t.eat(gi)}}if(i.length)throw t.pos=i.pop()[2],t.error("Expected group close");return n}function T(e){return e[e.length-1]}function M(o){if(o.repeat&&o.repeat.count){for(var t=1,e;t<o.repeat.count;t++)e=o.clone(!0),e.repeat.value=t,e.walk(M),o.parent.insertBefore(e,o);o.repeat.value=o.repeat.count}}function R(o,s){var e=new Set,n=function(r){var t=s.resolve(r.name);if(t&&!e.has(t)){if("function"==typeof t.value)return t.value(r,s,n);var i=bi(t.value);e.add(t),i.walk(n),e.delete(t);var o=W(i);for(L(o,r);i.firstChild;)r.parent.insertBefore(i.firstChild,r);o.parent.insertBefore(r,o),o.remove()}};n(o)}function L(n,t){return t.name=n.name,n.selfClosing&&(t.selfClosing=!0),null!=n.value&&(t.value=n.value),n.repeat&&(t.repeat=Object.assign({},n.repeat)),N(n,t)}function N(d,t){F(d,t);for(var e=new Map,n=d.attributes,r=0;r<n.length;r++)e.set(n[r].name,n[r].clone());n=t.attributes.slice();for(var i=0,o=void 0,a=void 0;i<n.length;i++)o=n[i],e.has(o.name)?(a=e.get(o.name),a.value=o.value,a.options.implied&&(a.options.implied=!1)):e.set(o.name,o),t.removeAttribute(o);for(var s=Array.from(e.values()),p=0;p<s.length;p++)t.setAttribute(s[p]);return t}function F(o,t){for(var e=o.classList,n=0;n<e.length;n++)t.addClass(e[n]);return t}function W(e){for(;e.children.length;)e=e.children[e.children.length-1];return e}function P(e){return e=(e||"").toLowerCase(),Ci[e]||(xi.has(e)?"span":"div")}function U(s,t){for(var e=new Set,n=t.length,r=0;-1!==(r=s.indexOf(t,r));)e.add(r),r+=n;if(e.size)for(var i=0,o=s.length;i<o;)"\\"===s[i++]&&e.delete(i++);return Array.from(e).map(function(e){return B(e,n)})}function I(o,t,e){for(var a=t.length-1,r;0<=a;a--)r=t[a],o=o.substring(0,r[0])+("function"==typeof e?e(o.substr(r[0],r[1])):e)+o.substring(r[0]+r[1]);return o}function B(n,t){return[n,t]}function D(o){var t=z(o);if(t&&null!=t.value){var a=t.value;o.name=G(o.name,a),o.value=G(o.value,a),o.attributes.forEach(function(t){var e=o.getAttribute(t.name).clone();e.name=G(t.name,a),e.value=G(t.value,a),o.replaceAttribute(t.name,e)})}return o}function z(e){for(;e;){if(e.repeat)return e.repeat;e=e.parent}}function G(n,o){return"string"==typeof n?X(n,V(n),o):n}function V(o){return U(o||"",Ei).reduce(function(t,e){if(!/[#{]/.test(o[e[0]+1]||"")){var n=t[t.length-1];n&&n[0]+n[1]===e[0]?n[1]+=e[1]:t.push(e)}return t},[])}function X(o,t,r){return H(I(o,t,function(n){for(var t=r+"";t.length<n.length;)t="0"+t;return t}))}function H(o){for(var t=0,e="",n=o.length,r;t<n;)r=o[t++],e+="\\"===r?o[t++]||"":r;return e}function Y(n,o){return o=o||1,n.walk(function(e){if(e.repeat&&null===e.repeat.count){for(var t=0,n;t<o;t++)n=e.clone(!0),n.repeat.implicit=!0,n.repeat.count=o,n.repeat.value=t+1,n.repeat.index=t,e.parent.insertBefore(n,e);e.remove()}}),n}function Q(o,r){if(Array.isArray(r)&&r.length){var e=!1;o.walk(function(n){n.repeat&&n.repeat.implicit&&(e=!0,J(n,r[n.repeat.index]))}),e||et(Z(o),r.join("\n"))}return o}function J(o,r){var e=K(o,r);return o.walk(function(n){return e|=K(n,r)}),e||et(Z(o),r),o}function K(o,t){var e={replaced:!1};return o.value=$(o.value,t,e),o.attributes.forEach(function(n){n.value&&o.setAttribute(n.name,$(n.value,t,e))}),e.replaced}function $(o,a,e){if("string"==typeof o){var n=U(o,wi);n.length&&(e&&(e.replaced=!0),o=I(o,n,a))}return o}function Z(e){for(;e.children.length;)e=e.children[e.children.length-1];return e}function et(o,t){if(o.value){var e=U(o.value,Ti);if(e.length)return void(o.value=I(o.value,e,t))}(o.name.toLowerCase("a")||o.hasAttribute("href"))&&(Ai.test(t)?o.setAttribute("href",(Li.test(t)?"":"http://")+t):Ri.test(t)&&o.setAttribute("href","mailto:"+t)),o.value=t}function tt(o,a){var e=o.classList.reduce(function(e,t){var n=t.indexOf(a.modifier);return-1!==n&&e.add(t.slice(0,n)),e.add(t)},new Set);e.size&&o.setAttribute("class",Array.from(e).join(" "))}function nt(s,t,e){var n=s.classList.reduce(function(n,r){var i=r,d,o;for((o=r.match(Oi))&&(d=rt(s,t,o[1])+e.element+o[2],n.add(d),r=r.slice(o[0].length));o=r.match(_i);)d||(d=rt(s,t,o[1]),n.add(d)),n.add(""+d+e.modifier+o[2]),r=r.slice(o[0].length);return r===i&&n.add(i),n},new Set);s.setAttribute("class",Array.from(n).join(" "))}function ot(n){var o=new Map;return n.walk(function(e){var t=e.classList;t.length&&o.set(e,at(t,Pi)||at(t,Di)||o.get(e.parent))}),o}function rt(o,t,e){for(var n=1<e.length?e.length:0;o.parent&&n--;)o=o.parent;return t.get(o)}function at(n,t){return n.filter(t)[0]}function it(o,t,e){var n=o.getAttribute(t);n&&(n.name=e)}function st(n,o){return o=o||{},n.walk(function(e){return lt(e,o)}),n}function lt(a,t){for(var e=a.attributes,n=0,r=e.length,i;n<r;n++)i=e[n],"string"==typeof i.value&&a.setAttribute(i.name,ct(i.value,t));return null!=a.value&&(a.value=ct(a.value,t)),a}function ct(d,t){for(var e=pt(d),n=0,r="",i=0,o=e.variables.length;i<o;i++){var a=e.variables[i],s=a.name in t?t[a.name]:a.name;"function"==typeof s&&(s=s(e.string,a,n+a.location)),r+=e.string.slice(n,a.location)+s,n=a.location+a.length}return r+e.string.slice(n)}function pt(d){for(var m=/\$\{([a-z][\w\-]*)\}/gi,n=[],g=new Map,i;i=m.exec(d);)g.set(i.index,i);if(g.size){for(var e=0,o=0,a=d.length,s="";o<a;)if(92===d.charCodeAt(o)&&g.has(o+1)){var u=g.get(o+1);s+=d.slice(e,o)+u[0],e=o=u.index+u[0].length,g.delete(o+1)}else o++;d=s+d.slice(e);for(var l=Array.from(g.values()),c=0,f=l.length,p;c<f;c++)p=l[c],n.push({name:p[1],location:p.index,length:p[0].length})}return{string:d,variables:n}}function ut(d){for(var t=new aa(d),r=[],i="",o=0,a=0,s,e;!t.eof();)s=t.peek(),a=t.pos,s===Wi?(t.next(),t.next()):(e=mt(t,i.length+a-o))?(r.push(e),i+=t.string.slice(o,a)+e.placeholder,o=t.pos):t.next();return new eo(i+t.string.slice(o),r)}function dt(a,t,s){s=s||ht;var e=t.map(function(n,o){return{order:o,field:n,end:n.location+n.length}}).sort(function(n,t){return n.end-t.end||n.order-t.order}),n=0;return e.map(function(t){var e=a.substr(t.field.location,t.field.length),r=a.slice(n,t.field.location);return n=t.end,r+s(t.field.index,e)}).join("")+a.slice(n)}function ht(n,t){return t?"${"+n+":"+t+"}":"${"+n+"}"}function mt(o,t){var e=o.pos;if(o.eat(Ui)){var n=ft(o),r="";if(null!=n)return new to(n,r,t);if(o.eat(Hi)&&null!=(n=ft(o))&&(o.eat(Vi)&&(r=gt(o)),o.eat(ji)))return new to(n,r,t)}o.pos=e}function gt(o){var t=[],n;for(o.start=o.pos;!o.eof();){if((n=o.peek())===Hi)t.push(o.pos);else if(n===ji){if(!t.length)break;t.pop()}o.next()}if(t.length)throw o.error("Unable to find matching \"}\" for curly brace at "+t.pop());return o.current()}function ft(e){if(e.start=e.pos,e.eatWhile(v))return+e.current()}function yt(e){return(e||"").split(/\r\n|\r|\n/g)}function bt(o,a,e){void 0===e&&(e=a,a=null),a=a||io;var n={index:1};return vt(o.children,e,function(e){return null==e?a(n.index++):kt(e,n).mark(a)})}function vt(o,a,e){return o.filter(xt).map(function(n){var t=a(new ro(n,e));return t?t.toString(vt(n.children,a,e)):""}).join("")}function xt(e){return!e.isGroup}function kt(o,a){var e="object"==typeof o?o:ut(o),n=-1;return e.fields.forEach(function(e){e.index+=a.index,e.index>n&&(n=e.index)}),-1!==n&&(a.index=n+1),e}function Ct(d,l){if(null==d)return d;for(var e=[],t=function(e,t,n,o){return null==l[n]?"":t+l[n]+o},o="",a=0,i=0,s,n;i<d.length;)s=d.charCodeAt(i),s===ao?e.push(i):s===so&&(n=e.pop(),e.length||(o+=d.slice(a,n)+d.slice(n+1,i).replace(oo,t),a=i+1)),i++;return o+d.slice(a)}function wt(e){return(e||"").split(/\r\n|\r|\n/g)}function At(e){return e.parent.firstChild===e}function Ot(e){return e&&!e.parent}function _t(e){return e.isTextOnly&&!!e.children.length}function St(o){var t=o.node;if(_t(t)){var e=ut(t.value),n=Et(e);if(n){var r=jt(e,n);o.open=o.renderFields(r[0]),o.close=o.renderFields(r[1])}else o.text=o.renderFields(e);return!0}return!1}function Et(e){return e.fields.reduce(function(n,o){return!n||o.index<n.index?o:n},null)}function jt(o,t){var e=o.fields.indexOf(t);return[new o.constructor(o.string.slice(0,t.location),o.fields.slice(0,e)),new o.constructor(o.string.slice(t.location+t.length),o.fields.slice(e+1))]}function qt(o,t){var e=o.node;if(Mt(e,t)){o.indent=t.indent(Pt(e,t)),o.newline="\n";var n=o.newline+o.indent;Ot(e.parent)&&At(e)||(o.beforeOpen=n,e.isTextOnly&&(o.beforeText=n)),Lt(e,t)&&(e.isTextOnly||(o.beforeText=n+t.indent(1)),o.beforeClose=n)}return o}function Mt(n,t){return!!t.get("format")&&(!n.parent.isTextOnly||1!==n.parent.children.length||!ut(n.parent.value).fields.length)&&(!Ft(n,t)||Rt(n,t))}function Rt(d,t){if(!Ft(d,t))return!1;if(_t(d))return!0;if(0===d.childIndex){for(var e=d;e=e.nextSibling;)if(!Ft(e,t))return!0;}else if(!Ft(d.previousSibling,t))return!0;if(t.get("inlineBreak")){for(var n=1,r=d,i=d;Wt(r=r.previousSibling,t);)n++;for(;Wt(i=i.nextSibling,t);)n++;if(n>=t.get("inlineBreak"))return!0}for(var o=0,a=d.children.length;o<a;o++)if(Mt(d.children[o],t))return!0;return!1}function Lt(o,t){var e=(o.name||"").toLowerCase();if(-1!==t.get("formatForce").indexOf(e))return!0;for(var n=0;n<o.children.length;n++)if(Mt(o.children[n],t))return!0;return!1}function Nt(o,t){return o.node.attributes.map(function(e){if(e.options.implied&&null==e.value)return null;var n=t.attribute(e.name),r=null;if(e.options.boolean||-1!==t.get("booleanAttributes").indexOf(n.toLowerCase())){if(t.get("compactBooleanAttributes")&&null==e.value)return" "+n;null==e.value&&(r=n)}return null==r&&(r=o.renderFields(e.value))," "+n+"="+t.quote(r)}).join("")}function Ft(n,t){return n&&n.isTextOnly||Wt(n,t)}function Wt(n,t){return n&&t.isInline(n)}function Pt(o,t){for(var e=t.get("formatSkip")||[],n=o.parent.isTextOnly?-2:-1,r=o;r=r.parent;)-1===e.indexOf((r.name||"").toLowerCase())&&n++;return 0>n?0:n}function Ut(a,t){var e=a.node;if(t.enabled&&t.trigger&&e.name)for(var n=a.node.attributes.reduce(function(n,t){return t.name&&null!=t.value&&(n[t.name.toUpperCase().replace(/-/g,"_")]=t.value),n},{}),r=0,i=t.trigger.length;r<i;r++)if(t.trigger[r].toUpperCase()in n){a.open=Ct(t.before,n)+a.open,a.close&&(a.close+=Ct(t.after,n));break}}function It(o,t,e){e=Object.assign({},qi,e);var n=o.node;if(o.indent=t.indent(Dt(n,t)),o.newline="\n",Ot(n.parent)&&At(n)||(o.beforeOpen=o.newline+o.indent),n.name){var r=Object.assign({NAME:t.name(n.name),SELF_CLOSE:n.selfClosing?e.selfClose:null},Bt(o,t,e.attributes));e.omitName&&e.omitName.test(r.NAME)&&r.PRIMARY_ATTRS&&(r.NAME=null),null!=e.open&&(o.open=Ct(e.open,r)),null!=e.close&&(o.close=Ct(e.close,r))}return o}function Bt(d,t,e){e=Object.assign({},fo,e);var l=[],r=[];return d.node.attributes.forEach(function(e){if(e.options.implied&&null==e.value)return null;var n=t.attribute(e.name),i=d.renderFields(e.value);if(lo.test(n))i&&l.push("#"+i);else if(co.test(n))i&&l.push("."+i.replace(/\s+/g,"."));else{var p=null==e.value&&(e.options.boolean||-1!==t.get("booleanAttributes").indexOf(n.toLowerCase()));r.push({name:n,value:i,isBoolean:p})}}),{PRIMARY_ATTRS:e.primary(l)||null,SECONDARY_ATTRS:e.secondary(r)||null}}function Dt(e){for(var t=e.parent.isTextOnly?-2:-1,n=e;n=n.parent;)t++;return 0>t?0:t}function zt(o,t){var e=o.node;return!e.isTextOnly&&e.value&&(o.beforeText=ho.test(e.value)?o.newline+o.indent+t.indent(1):" "),o}function Vt(o,t){if(null!=o.value&&ho.test(o.value)){var e=wt(o.value),n=t.indent(1),r=e.reduce(function(n,t){return jr(n,t.length)},0);return e.map(function(o,t){return""+(t?n:"")+Xt(o,r)+" |"}).join("\n")}return o.value}function Xt(n,t){for(;n.length<t;)n+=" ";return n}function Ht(o,t){var e=o.node,n=e.parent;return 0===t.get("inlineBreak")&&Yt(e,t)&&!Ot(n)&&null==n.value&&1===n.children.length&&(o.beforeOpen=": "),!e.isTextOnly&&e.value&&(o.beforeText=mo.test(e.value)?o.newline+o.indent+t.indent(1):" "),o}function Qt(o,t){if(null!=o.value&&mo.test(o.value)){var r=t.indent(1);return wt(o.value).map(function(n,t){return r+(t?" ":"|")+" "+n}).join("\n")}return o.value}function Yt(n,t){return n&&(n.isTextOnly||t.isInline(n))}function Kt(o,t){var e=o.node;return!e.isTextOnly&&e.value&&(o.beforeText=bo.test(e.value)?o.newline+o.indent+t.indent(1):" "),o}function ee(o,t){if(null!=o.value&&bo.test(o.value)){var e=t.indent(1);return wt(o.value).map(function(n){return e+"| "+n}).join("\n")}return o.value}function ne(e){return!!e&&e in vo}function re(e){return v(e)||x(e,65,70)}function ie(e){return!(e%17)}function oe(e){return(e>>4).toString(16)}function ae(e){return se(e.toString(16),2)}function se(n,t){for(;n.length<t;)n="0"+n;return n}function ue(e){return v(e)||le(e)}function le(e){return 95===e||x(e)}function ce(a){for(var t=a.pos,n=a.eat(Ao),r=!1,s=!1,d;!a.eof()&&(d=a.peek(),d===Co?!r:v(d));)s=!0,d===Co&&(r=!0),a.next();return n&&!s&&(a.pos=t),t!==a.pos}function fe(e){return ue(e)||e===_o}function pe(e){return 45===e||ue(e)}function he(o){if(!o.eat(Mo))return null;for(var t=[],n;!o.eof();)if(n=de(o))t.push(n);else{if(o.eatWhile(C),o.eat(Ro))break;if(!o.eat(Lo))throw o.error("Expected , or )")}return t}function de(o){for(var t=new xo,n;!o.eof()&&(o.eatWhile(C),n=Oo(o)||ko(o)||zo(o)||me(o));)t.add(n);return t.size?t:null}function me(o){var t=So(o);if(t){var e=he(o);return e?new No(t.toString(),e):t}}function ge(e){return e.start=e.pos,e.eatWhile(ye),e.eatWhile(ve),e.start===e.pos?null:e.current()}function be(o){for(var t=new xo,n;!o.eof()&&(o.eat(Uo),(n=Oo(o)||ko(o))?n.unit||o.eat(Po):(o.eat(Po),n=So(o,!0)),n);)t.add(n);return t}function ve(e){return le(e)}function ye(e){return e===Io||e===Wo||e===Fo}function xe(e){return e*(e+1)/2}function we(o){o=o.sort(ke);for(var t=[],e=0,n=void 0,r=void 0;e<o.length;e++)if(n=o[e],n.property){for(;t.length;){if(r=t[t.length-1],0===n.property.indexOf(r.property)&&n.property.charCodeAt(r.property.length)===Yo){r.addDependency(n),t.push(n);break}t.pop()}t.length||t.push(n)}return o}function ke(n,t){return n.key===t.key?0:n.key<t.key?-1:1}function $e(e){return /^\s*[\w\-]+/.test(e)}function Ce(e){return(e+"").split("|")}function Ae(e){return Go(e.all({type:"string"}))}function Oe(o,t){var e=Ee(o.name,t,"key");return e?e.property?je(o,e):_e(o,e):"!"===o.name?Se(o,"!important"):o}function je(s,t){var e=s.name;if(s.name=t.property,s.value&&"object"==typeof s.value){var n=t.keywords();if(s.value.size)for(var r=0,i=void 0;r<s.value.value.length;r++)i=s.value.value[r],"!"===i?i=(r?"":"${1} ")+"!important":Te(i)?i=Ee(i.value,n)||Ee(i.value,Ho)||i:Me(i)&&(i=Le(s.name,i)),s.value.value[r]=i;else{var o=Ee(ze(e,t.key),n);o||(o=t.defaulValue)&&-1===o.indexOf("${")&&(o="${1:"+o+"}"),o&&s.value.add(o)}}return s}function _e(n,t){return Se(n,t.value)}function Se(n,t){return n.name=null,n.value=t,n}function Ee(d,l,e){if(!d)return null;for(var n=null,r=0,i=0,o=void 0;i<l.length;i++){o=l[i];var a=Do(d,qe(o,e));if(1===a)return o;a&&a>=r&&(r=a,n=o)}return n}function qe(o,a){var e=o&&"object"==typeof o?o[a]:o,n=(e||"").match(/^[\w-@]+/);return n?n[0]:e}function ze(o,t){for(var e=0,n=0;e<o.length;e++){if(-1===(n=t.indexOf(o[e],n)))return o.slice(e);n++}return""}function Te(e){return Re(e,"keyword")}function Me(e){return Re(e,"numeric")}function Re(n,o){return n&&"object"==typeof n&&n.type===o}function Le(n,t){return t.unit?t.unit=Qo[t.unit]||t.unit:0!==t.value&&-1===Zo.indexOf(n)&&(t.unit=t.value===(0|t.value)?"px":"em"),t}function Ne(a,t,e){return e=Object.assign({},Ko,e),bt(a,e.field,function(n){var r=n.node,i=(r.value||"")+"";return r.attributes.length&&(i=Fe(i,r.attributes.map(function(n){return We(n,e)}))),n.open=r.name&&t.name(r.name),n.afterOpen=e.format.between,n.text=n.renderFields(i||null),n.open&&(n.afterText=e.format.after),t.get("format")&&(n.newline="\n",a.lastChild!==r&&(n.afterText+=n.newline)),n})}function Fe(d,t){var e=ut(d),n=e.fields.length;if(n)for(t=t.slice(),t.length>n&&(t=t.slice(0,n-1).concat(t.slice(n-1).join(", ")));t.length;){var r=t.shift(),i=e.fields.shift(),o=r.length-i.length;e.string=e.string.slice(0,i.location)+r+e.string.slice(i.location+i.length);for(var a=0,s=e.fields.length;a<s;a++)e.fields[a].location+=o}return e}function We(n,o){return n.value&&"object"==typeof n.value&&"css-value"===n.value.type?n.value.value.map(function(e){return e&&"object"==typeof e?"color"===e.type?e.toString(o.shortHex):e.toString():e+""}).join(" "):null==n.value?"":n.value+""}function Pe(e){return!!e&&e in ta}function Ue(o,t){var e=ta[o];return"string"==typeof e&&(e=ta[e]),Object.assign({},e,t&&t.format)}function Ie(e){return!e.parent}function Be(n,t){return Math.floor(Math.random()*(t-n)+n)}function De(o,t){for(var e=o.length,n=_r(e,t),r=new Set;r.size<n;)r.add(o[Be(0,e)]);return Array.from(r)}function Ye(e){return e[Be(0,e.length-1)]}function Ge(n,t){return n.length&&(n=[Ve(n[0])].concat(n.slice(1))),n.join(" ")+(t||Ye("?!..."))}function Ve(e){return e[0].toUpperCase()+e.slice(1)}function Xe(a){if(2>a.length)return a;a=a.slice();var t=a.length,e=/,$/,n=0;n=3<t&&6>=t?Be(0,1):6<t&&12>=t?Be(0,2):Be(1,4);for(var r=0,i=void 0;r<n;r++)i=Be(0,t-2),e.test(a[i])||(a[i]+=",");return a}function He(a,t,e){var n=[],i=0,o;for(e&&a.common&&(o=a.common.slice(0,t),i+=o.length,n.push(Ge(Xe(o),".")));i<t;)o=De(a.words,_r(Be(2,30),t-i)),i+=o.length,n.push(Ge(Xe(o)));return n.join(" ")}function Ze(e){for(;e.parent;){if(e.repeat&&e.repeat.value&&1<e.repeat.value)return!0;e=e.parent}return!1}function Qe(n,o){return o=o||{},"string"==typeof n&&(n=Je(n,o)),yo(n,o.profile,o.syntax,o.format)}function Je(n,t){return bi(n).use(Bi,t.text,t.addons).use(vi,t.snippets).use(st,t.variables)}function Ke(n,o){return o=o||{},"string"==typeof n&&(n=Jt(n,o)),ea(n,o.profile,o.syntax,o.format)}function Jt(n,o){return"string"==typeof n&&(n=Bo(n)),n.use(Jo,o.snippets)}function $t(o){var t={},e=o.name.match(fa);return e[1]&&(t.lang=e[1]),e[2]&&(t.wordCount=+e[2]),ca(o,t)}function Zt(n,t){return t=nn(t),on(t.syntax)?Ke(n,t):Qe(n,t)}function en(n,t){return t=nn(t),on(t.syntax)?Jt(n,t):Je(n,t)}function tn(n,t){return t instanceof Qr?t:pa(on(n)?"css":n,t)}function nn(e){return"string"==typeof e&&(e={syntax:e}),e=Object.assign({},ma,e),e.format=Object.assign({field:e.field},e.format),e.profile=rn(e),e.variables=Object.assign({},ha,e.variables),e.snippets=tn(on(e.syntax)?"css":e.syntax,e.snippets),e}function on(e){return da.has(e)}function rn(e){return e.profile instanceof Vr?e.profile:new Vr(e.profile)}function an(o,t){var e=o.getModeAt(t||o.getCursor()),n="xml"===e.name?"html":e.name;if(sn(n))return n;var r=o.getOption("emmet");return r&&sn(r.syntax)?r.syntax:null}function sn(e){return ga.has(e)}function ln(o,t){var e=an(o,t);return e&&(!zi[e]||zi[e](o,t))}function pn(e){return e.getOption("indentWithTabs")?"\t":un(" ",e.getOption("indentUnit"))}function cn(o,t,a){var e=dn(t),n=pn(o);return"\t"!==n&&(e=e.map(function(e){return e.replace(/^\t+/,function(e){return un(n,e.length)})})),a&&(e=e.map(function(n,t){return t?a+n:n})),e.join("\n")}function dn(e){return Array.isArray(e)?e:e.split(/\r\n|\r|\n/g)}function un(o,t){for(var e="";0<t--;)e+=o;return e}function hn(e){return e.replace(/\$\{\d+(:[^\}]+)?\}/g,"")}function mn(o,t,e){return e?0<gn(t,o.from)&&0>gn(t,o.to):0<=gn(t,o.from)&&0>=gn(t,o.to)}function gn(n,t){return n.line-t.line||n.ch-t.ch}function fn(o,t,e){return Zt(o,Object.assign({syntax:an(t),field:xa},Cn(t),e))}function yn(n,t){return en(n,Object.assign({syntax:an(t)},Cn(t)))}function bn(n,t){return t=t||t.getCursor(),c(n.getLine(t.line),t.ch,!0)}function vn(n,o){try{return{ast:yn(n,o),abbreviation:n,snippet:fn(n,o)}}catch(e){return null}}function xn(d,t,l){var n=!1,p=0,o;try{o=fn(t,d,{field:function(o,t){return void 0===t&&(t=""),n||(n=!0,p=t.length,t=ya+t),t}})}catch(e){return!1}var e=d.getLine(l.from.line),r=e.match(/^\s+/);o=cn(d,o,r&&r[0]);var a=o.length;return n&&(a=o.indexOf(ya),o=o.slice(0,a)+o.slice(a+ya.length)),d.operation(function(){d.replaceRange(o,l.from,l.to);var t=d.indexFromPos(l.from),e=d.posFromIndex(a+t);return p?d.setSelection(e,{line:e.line,ch:e.ch+p}):d.setCursor(e),!0})}function Cn(o,t){var e=o.getModeAt(t||o.getCursor()),n=o.getOption("emmet"),r=n&&n.profile;return"xml"===e.name&&(r=Object.assign({selfClosingStyle:e.configuration},r)),Object.assign({profile:r,snippets:kn(o,an(o,t))},n)}function kn(o,t){var e=o.getOption("emmet");if(e)return on(t)?e.stylesheetSnippets:e.markupSnippets}function wn(n){var t=An(n,n.getCursor());t&&_n(n,t)||(Sn(n),ln(n)&&On(n,n.getCursor()))}function An(o,t){for(var e=o.findMarksAt(t),n=0;n<e.length;n++)if(e[n].className===Ki)return e[n]}function On(d,t,e){var n=An(d,t);if(n)return n;Sn(d);var r=bn(d,t),i=r&&vn(r.abbreviation,d);if(i&&(e||En(i))){var o={line:t.line,ch:r.location},a={line:t.line,ch:r.location+r.abbreviation.length},s=d.markText(o,a,{inclusiveRight:!0,clearWhenEmpty:!0,className:Ki});return s.model=i,s}}function Sn(o){for(var t=o.getAllMarks(),e=0;e<t.length;e++)t[e].className===Ki&&t[e].clear()}function En(n){var t=n.ast.children[0];return t&&/^[a-z]/i.test(t.name)}function _n(o,t){var e=t.find();if(e.from.line!==e.to.line)return!1;var n=o.getRange(e.from,e.to);return n&&!/^\s|\s$/g.test(n)&&(t.model&&t.model.abbreviation===n||(t.model=vn(n,o)),t.model&&t.model.snippet)}function jn(o){o=o.sort(Tn);for(var t=[],e=0,n=void 0,r=void 0;e<o.length;e++)if(n=o[e],n.property){for(;t.length;){if(r=t[t.length-1],0===n.property.indexOf(r.property)&&n.property.charCodeAt(r.property.length)===Gi){r.addDependency(n),t.push(n);break}t.pop()}t.length||t.push(n)}return o}function Tn(n,t){return n.key===t.key?0:n.key<t.key?-1:1}function Mn(e){return /^\s*[\w\-]+/.test(e)}function Rn(e){return(e+"").split("|")}function Ln(e){return Aa(e.all({type:"string"}))}function Nn(d,t,e,l){var p=[];l=l||d.getCursor();var i={from:e,to:{line:e.line,ch:e.ch+t.abbreviation.length}};p.push(new Sa("expanded-abbreviation",d,i,"Expand abbreviation",t.snippet,function(){return xn(d,t.abbreviation,i)}));var o=Pn(t.abbreviation,l.ch-e.ch);if(null!==o){var a={from:{line:l.line,ch:l.ch-o.length},to:l},s=Wn(d,l).filter(function(e){return e.key!==o&&0===e.key.indexOf(o)}).map(function(t){return new Sa("snippet",d,a,t.key,t.preview,t.key)});p=p.concat(s)}return p}function Fn(d,t,e,l){var p=[];l=l||d.getCursor();var i={from:e,to:{line:e.line,ch:e.ch+t.abbreviation.length}};p.push(new Sa("expanded-abbreviation",d,i,"Expand abbreviation",t.snippet,function(){return xn(d,t.abbreviation,i)}));var o=Un(t.abbreviation,l.ch-e.ch);if(null!==o){var a={from:{line:l.line,ch:l.ch-o.length},to:l},s=Wn(d,l).filter(function(e){return e.key!==o&&0===e.key.indexOf(o)}).map(function(t){return new Sa("snippet",d,a,t.key,t.preview,t.key)});p=p.concat(s)}return p}function Wn(s,t){var e=an(s,t);s.state.emmetCompletions||(s.state.emmetCompletions={});var d=s.state.emmetCompletions;if(!(e in d)){var r=tn(e,kn(s,e));if(on(e))d[e]=Ln(r).map(function(o){var t=o.property,r=o.keywords();return r.length&&(t+=": "+hn(r.join(" | "))),{key:o.key,value:o.value,keywords:r,preview:t}});else{var i=function(n,t){return t||""},l={syntax:e,field:i};d[e]=r.all({type:"string"}).map(function(t){return{key:t.key,value:t.value,preview:fn(t.value,s,l)}})}}return d[e]}function Pn(n,t){return In(n,t,/[\w:\-\$@]+$/)}function Un(n,t){return In(n,t,/[\w-@$]+$/)}function In(o,t,e){if(0===t)return"";var n=o.slice(0,t).match(e),r=n&&n[0]||"";return r&&(r===o||/[>\^\+\(\)]/.test(o[t-r.length-1]))?r:null}function Bn(e){return e===qa||e===za}function Dn(e){return 47<e&&58>e}function qn(o,t,e){return t=t||65,e=e||90,(o&=-33)>=t&&o<=e}function zn(e){return Dn(e)||qn(e)}function Vn(e){return 32===e||9===e||160===e}function Gn(e){return Vn(e)||10===e||13===e}function Hn(s,t,e,n){n=n?Object.assign({},Ra,n):Ra;var r=s.pos;if(s.eat(t)){for(var i=1,a;!s.eof();)if(!Ma(s,n))if((a=s.next())===t)i++;else if(!(a===e))a===n.escape&&s.next();else if(! --i)return s.start=r,!0;if(s.pos=r,n.throws)throw s.error("Unable to find matching pair for "+Or(t))}return!1}function Xn(o,t){var e=o.pos;return o.eatWhile(t)?new Wa(o,e,o.pos):void(o.pos=e)}function Qn(e){return Ia(e)||Fa(e,Kn)}function Yn(a){var t=a.pos;if(Ma(a)){var e=a.pos,i,n;a.pos=t,a.next(),i=a.start=a.pos,a.pos=e,a.backUp(1),n=a.pos;var r=Fa(a,i,n);return a.pos=e,r}return Ia(a)||$n(a)}function Kn(e){return e!==Da&&!Jn(e)&&!Gn(e)}function Jn(e){return e===Ya||e===Ba}function $n(e){return Fa(e,Zn)}function Zn(e){return!(isNaN(e)||Bn(e)||Gn(e)||Jn(e))}function er(e){return Fa(e,tr)}function tr(e){return zn(e)||e===Ha||e===Xa||e===Va||e===Za}function nr(o,t){for(var e=o.pos,n=0;n<t.length;n++)if(!o.eat(t[n]))return o.pos=e,!1;return o.start=e,!0}function or(o,t,e,n){var a=o.pos;if(nr(o,t)){for(;!o.eof();){if(nr(o,e))return!0;o.next()}return!!n||(o.pos=a,!1)}return o.pos=a,null}function rr(e){return e.split("").map(function(e){return e.charCodeAt(0)})}function ar(d,p){p=Object.assign({},$i,p);for(var e="string"==typeof d?new Ea(d):d,o=new La(e,"root"),a=new Set(p.empty),s=p.special.reduce(function(n,t){return n.set(t,rr("</"+t+">"))},new Map),u=[o],l,n,r;!e.eof();)if(!(l=ir(e)))e.next();else if(r=lr(l),"open"===l.type)n=new La(e,"tag",l),pr(u).addChild(n),s.has(r)?n.close=sr(e,s.get(r)):function(e,t){return e.selfClosing||!p.xml&&a.has(t)}(l,r)||u.push(n);else if("close"===l.type){for(var i=u.length-1;0<i;i--)if(u[i].name.toLowerCase()===r){u[i].close=l,u=u.slice(0,i);break}}else pr(u).addChild(new La(e,l.type,l));return o}function ir(e){if(60===e.peek())return Xi(e)||Ji(e)||Qa(e)}function sr(o,t){for(var e=o.pos;!o.eof();){if(nr(o,t))return o.pos=o.start,Qa(o);o.next()}return o.pos=e,null}function lr(e){return e.name?e.name.value.toLowerCase():"#"+e.type}function pr(e){return e[e.length-1]}function cr(e){return{from:e.start,to:e.end}}function dr(o,t){var e=new ts(o);try{return new Zi(ar(e,{xml:"xml"===t}),"html",t||"html")}catch(e){console.warn(e)}}function ur(e){return dr(e,gr(e))}function hr(e){return e.state._emmetModel||(e.state._emmetModel=ur(e)),e.state._emmetModel}function mr(e){e.state._emmetModel=null}function gr(n){var t=n.getMode();return"htmlmixed"===t.name?"html":"xml"===t.name?t.configuration:t.name}function fr(o,t){t=t||o.getCursor();var e=yr(o);if(e)if(mn(e.open.find(),t)){if(!e.close||Cr(o,e.open)===Cr(o,e.close))return e;}else if(e.close&&mn(e.close.find(),t)&&Cr(o,e.open)===Cr(o,e.close))return e;br(o);var n=vr(o,t);if(n&&"tag"===n.type)return{open:xr(o,n.open.name,ns),close:n.close&&xr(o,n.close.name,os)}}function yr(o){var r,a;return o.getAllMarks().forEach(function(e){e.className===ns?r=e:e.className===os&&(a=e)}),r?{open:r,close:a}:null}function br(e){e.getAllMarks().forEach(function(e){e.className!==ns&&e.className!==os||e.clear()})}function vr(o,t){var e=o.getEmmetDocumentModel();return e&&e.nodeForPoint(t||o.getCursor())}function xr(o,t,e){return o.markText(t.start,t.end,{className:e,inclusiveLeft:!0,inclusiveRight:!0,clearWhenEmpty:!1})}function Cr(o,t){var e=t.find();return e?o.getRange(e.from,e.to):""}function kr(o,t){var e=yr(o),n=t.from;e&&(mn(e.open.find(),n)&&e.close?wr(o,e.open,e.close):e.close&&mn(e.close.find(),n)&&wr(o,e.close,e.open))}function wr(s,t,e){var n=Ar(s,t),r=e.find(),i=n.match(/[\w:\-]+/),o=n?i&&i[0]:"";null==o?br(s):s.getRange(r.from,r.to)!==o&&s.replaceRange(o,r.from,r.to)}function Ar(o,t){var e=t.find();return e?o.getRange(e.from,e.to):""}var Or=String.fromCharCode,_r=Math.min,jr=Math.max,$r=function(e){this.string=e,this.pos=this.string.length};$r.prototype.sol=function(){return 0===this.pos},$r.prototype.peek=function(e){return this.string.charCodeAt(this.pos-1+(e||0))},$r.prototype.prev=function(){if(!this.sol())return this.string.charCodeAt(--this.pos)},$r.prototype.eat=function(n){var o="function"==typeof n?n(this.peek()):n===this.peek();return o&&this.pos--,o},$r.prototype.eatWhile=function(n){for(var t=this.pos;this.eat(n););return this.pos<t};var Sr=39,Er=34,qr=92,zr=9,Tr=32,Mr=58,Rr=61,Lr=function(n){var t=n.pos;if(!n.eat(62))return!1;var o=!1;for(n.eat(47);!n.sol();){if(n.eatWhile(s),i(n)){if(n.eat(47)){o=n.eat(60);break}if(n.eat(60)){o=!0;break}if(n.eat(s))continue;if(n.eat(Rr)){o=i(n);break}if(Gt(n)){o=!0;break}break}if(!e(n))break}return n.pos=t,o},Nr=function(e){return e.charCodeAt(0)},Fr=Nr("["),Wr=Nr("]"),Pr=Nr("("),Ur=Nr(")"),Ir=Nr("{"),Br=Nr("}"),Dr=new Set(["#",".","*",":","$","-","_","!","@","%","^","+",">","/"].map(Nr)),Yr=new Map().set(Fr,Wr).set(Pr,Ur).set(Ir,Br),Gr={indent:"\t",tagCase:"",attributeCase:"",attributeQuotes:"double",format:!0,formatSkip:["html"],formatForce:["body"],inlineBreak:3,compactBooleanAttributes:!1,booleanAttributes:["contenteditable","seamless","async","autofocus","autoplay","checked","controls","defer","disabled","formnovalidate","hidden","ismap","loop","multiple","muted","novalidate","readonly","required","reversed","selected","typemustmatch"],selfClosingStyle:"html",inlineElements:["a","abbr","acronym","applet","b","basefont","bdo","big","br","button","cite","code","del","dfn","em","font","i","iframe","img","input","ins","kbd","label","map","object","q","s","samp","select","small","span","strike","strong","sub","sup","textarea","tt","u","var"]},Vr=function(e){this.options=Object.assign({},Gr,e),this.quoteChar="single"===this.options.attributeQuotes?"'":"\""};Vr.prototype.get=function(e){return this.options[e]},Vr.prototype.quote=function(e){return""+this.quoteChar+(null==e?"":e)+this.quoteChar},Vr.prototype.name=function(e){return m(e,this.options.tagCase)},Vr.prototype.attribute=function(e){return m(e,this.options.attributeCase)},Vr.prototype.isBooleanAttribute=function(e){return e.options.boolean||-1!==this.get("booleanAttributes").indexOf((e.name||"").toLowerCase())},Vr.prototype.selfClose=function(){switch(this.options.selfClosingStyle){case"xhtml":return" /";case"xml":return"/";default:return"";}},Vr.prototype.indent=function(o){var t=this;o=o||0;for(var e="";o--;)e+=t.options.indent;return e},Vr.prototype.isInline=function(e){return"string"==typeof e?-1!==this.get("inlineElements").indexOf(e.toLowerCase()):null==e.name?e.isTextOnly:this.isInline(e.name)},Vr.prototype.field=function(n,t){return this.options.field(n,t)};var Xr=function(n,t){this.key=n,this.value=t},Hr=function(e){this._string=new Map,this._regexp=new Map,this._disabled=!1,this.load(e)},Zr={disabled:{}};Zr.disabled.get=function(){return this._disabled},Hr.prototype.disable=function(){this._disabled=!0},Hr.prototype.enable=function(){this._disabled=!1},Hr.prototype.set=function(o,r){var e=this;if("string"==typeof o)o.split("|").forEach(function(n){return e._string.set(n,new Xr(n,r))});else{if(!(o instanceof RegExp))throw new Error("Unknow snippet key: "+o);this._regexp.set(o,new Xr(o,r))}return this},Hr.prototype.get=function(o){var t=this;if(!this.disabled){if(this._string.has(o))return this._string.get(o);for(var e=Array.from(this._regexp.keys()),n=0,r=e.length;n<r;n++)if(e[n].test(o))return t._regexp.get(e[n])}},Hr.prototype.load=function(o){var r=this;this.reset(),o instanceof Map?o.forEach(function(e,t){return r.set(t,e)}):o&&"object"==typeof o&&Object.keys(o).forEach(function(e){return r.set(e,o[e])})},Hr.prototype.reset=function(){this._string.clear(),this._regexp.clear()},Hr.prototype.values=function(){if(this.disabled)return[];var n=Array.from(this._string.values()),t=Array.from(this._regexp.values());return n.concat(t)},Object.defineProperties(Hr.prototype,Zr);var Qr=function(n){var o=this;this._registry=[],Array.isArray(n)?n.forEach(function(e,t){return o.add(t,e)}):"object"==typeof n&&this.add(n)};Qr.prototype.get=function(o){for(var t=this,e=0,n;e<this._registry.length;e++)if(n=t._registry[e],n.level===o)return n.store},Qr.prototype.add=function(o,r){null!=o&&"object"==typeof o&&(r=o,o=0);var e=new Hr(r);return this.remove(o),this._registry.push({level:o,store:e}),this._registry.sort(function(n,t){return t.level-n.level}),e},Qr.prototype.remove=function(n){this._registry=this._registry.filter(function(t){return t.level!==n&&t.store!==n})},Qr.prototype.resolve=function(o){for(var t=this,e=0,n;e<this._registry.length;e++)if(n=t._registry[e].store.get(o),n)return n},Qr.prototype.all=function(o){o=o||{};var t=new Map,e=function(e){var n=e.key instanceof RegExp?"regexp":"string";o.type&&o.type!==n||t.has(e.key)||t.set(e.key,e)};return this._registry.forEach(function(n){n.store.values().forEach(e)}),Array.from(t.values())},Qr.prototype.clear=function(){this._registry.length=0};var Jr=function(o,t,e){this.name=o,this.value=null==t?null:t,this.options=e||{}};Jr.prototype.clone=function(){return new Jr(this.name,this.value,Object.assign({},this.options))},Jr.prototype.valueOf=function(){return this.name+"=\""+this.value+"\""};var Kr=function(o,t){var e=this;this.name=o||null,this.value=null,this.repeat=null,this.selfClosing=!1,this.children=[],this.parent=null,this.next=null,this.previous=null,this._attributes=[],Array.isArray(t)&&t.forEach(function(n){return e.setAttribute(n)})},ra={attributes:{},attributesMap:{},isGroup:{},isTextOnly:{},firstChild:{},lastChild:{},childIndex:{},nextSibling:{},previousSibling:{},classList:{}};ra.attributes.get=function(){return this._attributes},ra.attributesMap.get=function(){return this.attributes.reduce(function(n,t){return n[t.name]=t.options.boolean?t.name:t.value,n},{})},ra.isGroup.get=function(){return!this.name&&!this.value&&!this._attributes.length},ra.isTextOnly.get=function(){return!this.name&&!!this.value&&!this._attributes.length},ra.firstChild.get=function(){return this.children[0]},ra.lastChild.get=function(){return this.children[this.children.length-1]},ra.childIndex.get=function(){return this.parent?this.parent.children.indexOf(this):-1},ra.nextSibling.get=function(){return this.next},ra.previousSibling.get=function(){return this.previous},ra.classList.get=function(){var e=this.getAttribute("class");return e&&e.value?e.value.split(/\s+/g).filter(y):[]},Kr.prototype.create=function(n,t){return new Kr(n,t)},Kr.prototype.setAttribute=function(o,t){var e=g(o,t),n=this.getAttribute(o);n?this.replaceAttribute(n,e):this._attributes.push(e)},Kr.prototype.hasAttribute=function(e){return!!this.getAttribute(e)},Kr.prototype.getAttribute=function(o){var a=this;"object"==typeof o&&(o=o.name);for(var e=0,n;e<this._attributes.length;e++)if(n=a._attributes[e],n.name===o)return n},Kr.prototype.replaceAttribute=function(o,a,e){"string"==typeof o&&(o=this.getAttribute(o));var n=this._attributes.indexOf(o);-1!==n&&this._attributes.splice(n,1,g(a,e))},Kr.prototype.removeAttribute=function(n){"string"==typeof n&&(n=this.getAttribute(n));var o=this._attributes.indexOf(n);-1!==o&&this._attributes.splice(o,1)},Kr.prototype.clearAttributes=function(){this._attributes.length=0},Kr.prototype.addClass=function(e){e=f(e),this.hasAttribute("class")?e&&!this.hasClass(e)&&this.setAttribute("class",this.classList.concat(e).join(" ")):this.setAttribute("class",e)},Kr.prototype.hasClass=function(e){return-1!==this.classList.indexOf(f(e))},Kr.prototype.removeClass=function(n){n=f(n),this.hasClass(n)&&this.setAttribute("class",this.classList.filter(function(t){return t!==n}).join(" "))},Kr.prototype.appendChild=function(e){this.insertAt(e,this.children.length)},Kr.prototype.insertBefore=function(n,t){this.insertAt(n,this.children.indexOf(t))},Kr.prototype.insertAt=function(o,t){if(0>t||t>this.children.length)throw new Error("Unable to insert node: position is out of child list range");var e=this.children[t-1],n=this.children[t];o.remove(),o.parent=this,this.children.splice(t,0,o),e&&(o.previous=e,e.next=o),n&&(o.next=n,n.previous=o)},Kr.prototype.removeChild=function(n){var t=this.children.indexOf(n);-1!==t&&(this.children.splice(t,1),n.previous&&(n.previous.next=n.next),n.next&&(n.next.previous=n.previous),n.parent=n.next=n.previous=null)},Kr.prototype.remove=function(){this.parent&&this.parent.removeChild(this)},Kr.prototype.clone=function(n){var o=new Kr(this.name);return o.value=this.value,o.selfClosing=this.selfClosing,this.repeat&&(o.repeat=Object.assign({},this.repeat)),this._attributes.forEach(function(e){return o.setAttribute(e.clone())}),n&&this.children.forEach(function(e){return o.appendChild(e.clone(!0))}),o},Kr.prototype.walk=function(o,t){t=t||0;for(var e=this.firstChild,n;e;){if(n=e.next,!1===o(e,t)||!1===e.walk(o,t+1))return!1;e=n}},Kr.prototype.use=function(o){for(var t=arguments,e=[this],n=1;n<arguments.length;n++)e.push(t[n]);return o.apply(null,e),this},Kr.prototype.toString=function(){var o=this,t=this.attributes.map(function(t){t=o.getAttribute(t.name);var e=t.options,n=(e&&e.implied?"!":"")+(t.name||"");return e&&e.boolean?n+=".":null!=t.value&&(n+="=\""+t.value+"\""),n}),e=""+(this.name||"");return t.length&&(e+="["+t.join(" ")+"]"),null!=this.value&&(e+="{"+this.value+"}"),this.selfClosing&&(e+="/"),this.repeat&&(e+="*"+(this.repeat.count?this.repeat.count:""),null!=this.repeat.value&&(e+="@"+this.repeat.value)),e},Object.defineProperties(Kr.prototype,ra);var aa=function(o,r,e){null==e&&"string"==typeof o&&(e=o.length),this.string=o,this.pos=this.start=r||0,this.end=e};aa.prototype.eof=function(){return this.pos>=this.end},aa.prototype.limit=function(n,t){return new this.constructor(this.string,n,t)},aa.prototype.peek=function(){return this.string.charCodeAt(this.pos)},aa.prototype.next=function(){if(this.pos<this.string.length)return this.string.charCodeAt(this.pos++)},aa.prototype.eat=function(o){var r=this.peek(),e="function"==typeof o?o(r):r===o;return e&&this.next(),e},aa.prototype.eatWhile=function(n){for(var t=this.pos;!this.eof()&&this.eat(n););return this.pos!==t},aa.prototype.backUp=function(e){this.pos-=e||1},aa.prototype.current=function(){return this.substring(this.start,this.pos)},aa.prototype.substring=function(n,t){return this.string.slice(n,t)},aa.prototype.error=function(n){var t=new Error(n+" at char "+(this.pos+1));return t.originalMessage=n,t.pos=this.pos,t.string=this.string,t};var ia=39,sa=34,ua={escape:92,throws:!1},Ca=function(o,t){t=t?Object.assign({},ua,t):ua;var e=o.pos,n=o.peek();if(o.eat(b)){for(;!o.eof();)switch(o.next()){case n:return o.start=e,!0;case t.escape:o.next();}if(o.pos=e,t.throws)throw o.error("Unable to consume quoted string")}return!1},$a={escape:92,throws:!1},ei=function(e){if(e.eat(42))return e.start=e.pos,{count:e.eatWhile(v)?+e.current():null}},ti={throws:!0},ni=function(e){if(Ca(e,ti))return e.current().slice(1,-1)},oi={throws:!0},ri=function(e){return A(e,123,125,oi)?e.current().slice(1,-1):null},ai=33,ii=46,si=61,di=91,li=93,pi=/^\!?[\w\-:\$@]+\.?$/,ci=function(o){if(!o.eat(di))return null;for(var t=[],r,a;!o.eof();){if(o.eatWhile(C),o.eat(li))return t;if(null!=(r=ni(o)))t.push({name:null,value:r});else{if(!_(o))throw o.error("Expected attribute name");r=o.current(),pi.test(r)?(a=O(r),t.push(a),o.eat(si)&&(null==(r=ni(o))?null==(r=ri(o))?_(o)&&(a.value=o.current()):(a.value=r,a.options={before:"{",after:"}"}):a.value=r)):t.push({name:null,value:r})}}throw o.error("Expected closing \"]\" brace")},ui=function(a){for(var t=a.pos,n=new Kr(E(a)),r;!a.eof();)if(a.eat(46))n.addClass(E(a));else if(a.eat(35))n.setAttribute("id",E(a));else{if(a.eat(47)){if(n.isGroup)throw a.backUp(1),a.error("Unexpected self-closing indicator");n.selfClosing=!0,(r=ei(a))&&(n.repeat=r);break}if(r=ci(a))for(var e=0,i=r.length;e<i;e++)n.setAttribute(r[e]);else if(null!==(r=ri(a)))n.value=r;else{if(!(r=ei(a)))break;n.repeat=r}}if(t===a.pos)throw a.error("Unable to consume abbreviation node, unexpected "+a.peek());return n},hi=40,mi=41,gi=43,fi=62,yi=94,bi=function(n){var t=q(n);return t.walk(M),t},vi=function(n,o){return n.walk(function(e){return R(e,o)}),n},xi=new Set(["a","abbr","acronym","applet","b","basefont","bdo","big","br","button","cite","code","del","dfn","em","font","i","iframe","img","input","ins","kbd","label","map","object","q","s","samp","select","small","span","strike","strong","sub","sup","textarea","tt","u","var"]),Ci={p:"span",ul:"li",ol:"li",table:"tr",tr:"td",tbody:"tr",thead:"tr",tfoot:"tr",colgroup:"col",select:"option",optgroup:"option",audio:"source",video:"source",object:"param",map:"area"},Si=function(e){return e.walk(function(e){null==e.name&&e.attributes.length&&(e.name=P(e.parent.name))}),e},Ei="$",ki=function(e){return e.walk(D),e},wi="$#",Ti="|",Ai=/^((?:https?|ftp|file):\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,Ri=/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/,Li=/^([a-z]+:)?\/\//i,Ni={element:"__",modifier:"_"},Oi=/^(-+)([a-z0-9]+)/i,_i=/^(_+)([a-z0-9]+)/i,Pi=function(e){return /^[a-z]\-/i.test(e)},Di=function(e){return /^[a-z]/i.test(e)},Ii=/^xsl:(variable|with\-param)$/i,Mi={bem:function(o,r){r=Object.assign({},Ni,r),o.walk(function(e){return tt(e,r)});var e=ot(o);return o.walk(function(n){return nt(n,e,r)}),o},jsx:function(e){return e.walk(function(e){it(e,"class","className"),it(e,"for","htmlFor")}),e},xsl:function(e){return e.walk(function(e){Ii.test(e.name||"")&&(e.children.length||e.value)&&e.removeAttribute("select")}),e}},Fi=function(o,t){return Object.keys(t||{}).forEach(function(e){if(e in Mi){var n="object"==typeof t[e]?t[e]:null;o=o.use(Mi[e],n)}}),o},Bi=function(o,t,r){return"string"==typeof t?t=[t]:t&&"object"==typeof t&&!Array.isArray(t)&&(r=t,t=null),o.use(Si).use(Y,Array.isArray(t)?t.length:null).use(ki).use(Q,t).use(Fi,r)},Ui=36,Vi=58,Wi=92,Hi=123,ji=125,to=function(o,t,e){this.index=o,this.placeholder=t,this.location=e,this.length=this.placeholder.length},eo=function(n,t){this.string=n,this.fields=t};eo.prototype.mark=function(e){return dt(this.string,this.fields,e)},eo.prototype.toString=function(){return string};var no=function(e){return e},ro=function(o,t,r){"object"==typeof t&&(r=t,t=null),this.node=o,this._fieldsRenderer=t||no,this.open=null,this.beforeOpen="",this.afterOpen="",this.close=null,this.beforeClose="",this.afterClose="",this.text=null,this.beforeText="",this.afterText="",this.indent="",this.newline="",r&&Object.assign(this,r)};ro.prototype.clone=function(){return new this.constructor(this.node,this)},ro.prototype.indentText=function(o){var a=this,e=yt(o);if(1===e.length)return o;var t=this.newline||this.indent?this.newline:" ";return e.map(function(e,t){return t?a.indent+e:e}).join(t)},ro.prototype.renderFields=function(e){return this._fieldsRenderer(e)},ro.prototype.toString=function(o){var t=this._wrap(this.open,this.beforeOpen,this.afterOpen),e=this._wrap(this.close,this.beforeClose,this.afterClose);return t+this._wrap(this.text,this.beforeText,this.afterText)+(null==o?"":o)+e},ro.prototype._wrap=function(o,t,e){return t=null==t?"":t,e=null==e?"":e,null==o?"":(o=t?o.replace(/^\s+/,""):o,o=e?o.replace(/\s+$/,""):o,t+this.indentText(o)+e)};var io=function(n,t){return t||""},oo=/^(.*?)([A-Z_]+)(.*?)$/,ao=91,so=93,uo={enabled:!1,trigger:["id","class"],before:"",after:"\n<!-- /[#ID][.CLASS] -->"},lo=/^id$/i,co=/^class$/i,fo={primary:function(e){return e.join("")},secondary:function(e){return e.map(function(e){return e.isBoolean?e.name:e.name+"="+e.value}).join(", ")}},qi={open:null,close:null,omitName:/^div$/i,attributes:fo},ho=/\n|\r/,mo=/\n|\r/,go={none:"[ SECONDARY_ATTRS]",round:"[(SECONDARY_ATTRS)]",curly:"[{SECONDARY_ATTRS}]",square:"[[SECONDARY_ATTRS]"},bo=/\n|\r/,vo={html:function(o,a,e){return e=Object.assign({},e),e.comment=Object.assign({},uo,e.comment),bt(o,e.field,function(n){if(n=qt(n,a),!St(n)){var t=n.node;if(t.name){var r=a.name(t.name),i=Nt(n,a);n.open="<"+r+i+(t.selfClosing?a.selfClose():"")+">",t.selfClosing||(n.close="</"+r+">"),Ut(n,e.comment)}!t.value&&(t.children.length||t.selfClosing)||(n.text=n.renderFields(t.value))}return n})},haml:function(o,a,e){e=e||{};var i={open:"[%NAME][PRIMARY_ATTRS][(SECONDARY_ATTRS)][SELF_CLOSE]",selfClose:"/",attributes:{secondary:function(e){return e.map(function(e){return e.isBoolean?e.name+(a.get("compactBooleanAttributes")?"":"=true"):e.name+"="+a.quote(e.value)}).join(" ")}}};return bt(o,e.field,function(e){if(e=It(e,a,i),e=zt(e,a),!St(e)){var t=e.node;!t.value&&(t.children.length||t.selfClosing)||(e.text=e.renderFields(Vt(t,a)))}return e})},slim:function(a,s,e){e=e||{};var t=e.attributeWrap&&go[e.attributeWrap]||go.none,n=t===go.none?function(e){return e.name+"=true"}:function(e){return e.name},i={open:"[NAME][PRIMARY_ATTRS]"+t+"[SELF_CLOSE]",selfClose:"/",attributes:{secondary:function(e){return e.map(function(e){return e.isBoolean?n(e):e.name+"="+s.quote(e.value)}).join(" ")}}};return bt(a,e.field,function(e){if(e=It(e,s,i),e=Ht(e,s),!St(e)){var t=e.node;!t.value&&(t.children.length||t.selfClosing)||(e.text=e.renderFields(Qt(t,s)))}return e})},pug:function(o,a,e){e=e||{};var i={open:"[NAME][PRIMARY_ATTRS][(SECONDARY_ATTRS)]",attributes:{secondary:function(e){return e.map(function(e){return e.isBoolean?e.name:e.name+"="+a.quote(e.value)}).join(", ")}}};return bt(o,e.field,function(e){if(e=It(e,a,i),e=Kt(e,a),!St(e)){var t=e.node;!t.value&&(t.children.length||t.selfClosing)||(e.text=e.renderFields(ee(t,a)))}return e})}},yo=function(o,t,e,a){return"object"==typeof e&&(a=e,e=null),ne(e)||(e="html"),vo[e](o,t,a)},xo=function(){this.type="css-value",this.value=[]},wo={size:{}};wo.size.get=function(){return this.value.length},xo.prototype.add=function(e){this.value.push(e)},xo.prototype.has=function(e){return-1!==this.value.indexOf(e)},xo.prototype.toString=function(){return this.value.join(" ")},Object.defineProperties(xo.prototype,wo);var ko=function(n){if(35===n.peek()){n.start=n.pos,n.next(),n.eat(116)||n.eatWhile(re);var t=n.current();if(n.start=n.pos,n.eat(46)&&!n.eatWhile(v))throw n.error("Unexpected character for alpha value of color");return new $o(t,n.current())}},$o=function(o,t){this.type="color",this.raw=o,this.alpha=+(null!=t&&""!==t?t:1),o=o.slice(1);var e=0,n=0,r=0;if("t"===o)this.alpha=0;else switch(o.length){case 0:break;case 1:e=n=r=o+o;break;case 2:e=n=r=o;break;case 3:e=o[0]+o[0],n=o[1]+o[1],r=o[2]+o[2];break;default:o+=o,e=o.slice(0,2),n=o.slice(2,4),r=o.slice(4,6);}this.r=parseInt(e,16),this.g=parseInt(n,16),this.b=parseInt(r,16)};$o.prototype.toHex=function(n){var t=n&&ie(this.r)&&ie(this.g)&&ie(this.b)?oe:ae;return"#"+t(this.r)+t(this.g)+t(this.b)},$o.prototype.toRGB=function(){var e=[this.r,this.g,this.b];return 1!==this.alpha&&e.push(this.alpha.toFixed(8).replace(/\.?0+$/,"")),(3===e.length?"rgb":"rgba")+"("+e.join(", ")+")"},$o.prototype.toString=function(e){return this.r||this.g||this.b||this.alpha?1===this.alpha?this.toHex(e):this.toRGB():"transparent"};var Co=46,Ao=45,Oo=function(n){if(n.start=n.pos,ce(n)){var t=n.current();return n.start=n.pos,n.eat(37)||n.eatWhile(le),new jo(t,n.current())}},jo=function(n,o){this.type="numeric",this.value=+n,this.unit=o||""};jo.prototype.toString=function(){return""+this.value+this.unit};var _o=45,So=function(n,t){return n.start=n.pos,n.eat(36)||n.eat(64)?n.eatWhile(pe):t?n.eatWhile(le):n.eatWhile(fe),n.start===n.pos?null:new Eo(n.current())},Eo=function(e){this.type="keyword",this.value=e};Eo.prototype.toString=function(){return this.value};var qo={throws:!0},zo=function(e){if(Ca(e,qo))return new To(e.current())},To=function(e){this.type="string",this.value=e};To.prototype.toString=function(){return this.value};var Mo=40,Ro=41,Lo=44,No=function(n,t){this.type="function",this.name=n,this.args=t||[]};No.prototype.toString=function(){return this.name+"("+this.args.join(", ")+")"};var Fo=33,Wo=36,Po=45,Uo=58,Io=64,Bo=function(a){for(var t=new Kr,e=new aa(a),n;!e.eof();){n=new Kr(ge(e)),n.value=be(e);var r=he(e);if(r)for(var i=0;i<r.length;i++)n.setAttribute(i+"",r[i]);if(e.eat(Fo)&&n.value.add("!"),t.appendChild(n),!e.eat(43))break}if(!e.eof())throw e.error("Unexpected character");return t},Do=function(d,t){if(d===t)return 1;if(!t||d.charCodeAt(0)!==t.charCodeAt(0))return 0;for(var p=d.length,a=t.length,s=1,u=1,l=a,c,n,r,h;s<p;){for(c=d.charCodeAt(s),r=!1,h=!1;u<a;){if(n=t.charCodeAt(u),c===n){r=!0,l+=(a-u)*(h?2:1);break}h=45===n,u++}if(!r)break;s++}return l&&l*(s/p)/xe(a)},Yo=45,Go=function(e){return we(e.map(function(e){return new Vo(e.key,e.value)}))},Vo=function(o,t){this.key=o,this.value=t,this.property=null;var e=t&&t.match(/^([a-z\-]+)(?:\s*:\s*([^\n\r]+))?$/);e&&(this.property=e[1],this.value=e[2]),this.dependencies=[]},Xo={defaulValue:{}};Vo.prototype.addDependency=function(e){this.dependencies.push(e)},Xo.defaulValue.get=function(){return null==this.value?null:Ce(this.value)[0]},Vo.prototype.keywords=function(){var d=[],n=new Set,r=0,i,t;for(this.property&&d.push(this);r<d.length;)if(i=d[r++],i.value){t=Ce(i.value).filter($e);for(var e=0;e<t.length;e++)n.add(t[e].trim());for(var o=0,a=i.dependencies;o<a.length;o++)-1===d.indexOf(a[o])&&d.push(a[o])}return Array.from(n)},Object.defineProperties(Vo.prototype,Xo);var Ho=["auto","inherit","unset"],Zo=["z-index","line-height","opacity","font-weight","zoom","flex","flex-grow","flex-shrink"],Qo={e:"em",p:"%",x:"ex",r:"rem"},Jo=function(o,t){var e=Ae(t);return o.walk(function(n){return Oe(n,e)}),o},Ko={shortHex:!0,format:{between:": ",after:";"}},ta={css:{between:": ",after:";"},scss:"css",less:"css",sass:{between:": ",after:""},stylus:{between:" ",after:""}},ea=function(o,t,e,a){return"object"==typeof e&&(a=e,e=null),Pe(e)||(e="css"),a=Object.assign({},a,{format:Ue(e,a)}),Ne(o,t,a)},na={html:{a:"a[href]","a:link":"a[href='http://${0}']","a:mail":"a[href='mailto:${0}']",abbr:"abbr[title]","acr|acronym":"acronym[title]",base:"base[href]/",basefont:"basefont/",br:"br/",frame:"frame/",hr:"hr/",bdo:"bdo[dir]","bdo:r":"bdo[dir=rtl]","bdo:l":"bdo[dir=ltr]",col:"col/",link:"link[rel=stylesheet href]/","link:css":"link[href='${1:style}.css']","link:print":"link[href='${1:print}.css' media=print]","link:favicon":"link[rel='shortcut icon' type=image/x-icon href='${1:favicon.ico}']","link:touch":"link[rel=apple-touch-icon href='${1:favicon.png}']","link:rss":"link[rel=alternate type=application/rss+xml title=RSS href='${1:rss.xml}']","link:atom":"link[rel=alternate type=application/atom+xml title=Atom href='${1:atom.xml}']","link:im|link:import":"link[rel=import href='${1:component}.html']",meta:"meta/","meta:utf":"meta[http-equiv=Content-Type content='text/html;charset=UTF-8']","meta:vp":"meta[name=viewport content='width=${1:device-width}, initial-scale=${2:1.0}']","meta:compat":"meta[http-equiv=X-UA-Compatible content='${1:IE=7}']","meta:edge":"meta:compat[content='${1:ie=edge}']","meta:redirect":"meta[http-equiv=refresh content='0; url=${1:http://example.com}']",style:"style",script:"script[!src]","script:src":"script[src]",img:"img[src alt]/","img:s|img:srcset":"img[srcset src alt]","img:z|img:sizes":"img[sizes srcset src alt]",picture:"picture","src|source":"source/","src:sc|source:src":"source[src type]","src:s|source:srcset":"source[srcset]","src:t|source:type":"source[srcset type='${1:image/}']","src:z|source:sizes":"source[sizes srcset]","src:m|source:media":"source[media='(${1:min-width: })' srcset]","src:mt|source:media:type":"source:media[type='${2:image/}']","src:mz|source:media:sizes":"source:media[sizes srcset]","src:zt|source:sizes:type":"source[sizes srcset type='${1:image/}']",iframe:"iframe[src frameborder=0]",embed:"embed[src type]/",object:"object[data type]",param:"param[name value]/",map:"map[name]",area:"area[shape coords href alt]/","area:d":"area[shape=default]","area:c":"area[shape=circle]","area:r":"area[shape=rect]","area:p":"area[shape=poly]",form:"form[action]","form:get":"form[method=get]","form:post":"form[method=post]",label:"label[for]",input:"input[type=${1:text}]/",inp:"input[name=${1} id=${1}]","input:h|input:hidden":"input[type=hidden name]","input:t|input:text":"inp","input:search":"inp[type=search]","input:email":"inp[type=email]","input:url":"inp[type=url]","input:p|input:password":"inp[type=password]","input:datetime":"inp[type=datetime]","input:date":"inp[type=date]","input:datetime-local":"inp[type=datetime-local]","input:month":"inp[type=month]","input:week":"inp[type=week]","input:time":"inp[type=time]","input:tel":"inp[type=tel]","input:number":"inp[type=number]","input:color":"inp[type=color]","input:c|input:checkbox":"inp[type=checkbox]","input:r|input:radio":"inp[type=radio]","input:range":"inp[type=range]","input:f|input:file":"inp[type=file]","input:s|input:submit":"input[type=submit value]","input:i|input:image":"input[type=image src alt]","input:b|input:button":"input[type=button value]","input:reset":"input:button[type=reset]",isindex:"isindex/",select:"select[name=${1} id=${1}]","select:d|select:disabled":"select[disabled.]","opt|option":"option[value]",textarea:"textarea[name=${1} id=${1} cols=${2:30} rows=${3:10}]",marquee:"marquee[behavior direction]","menu:c|menu:context":"menu[type=context]","menu:t|menu:toolbar":"menu[type=toolbar]",video:"video[src]",audio:"audio[src]","html:xml":"html[xmlns=http://www.w3.org/1999/xhtml]",keygen:"keygen/",command:"command/","btn:s|button:s|button:submit":"button[type=submit]","btn:r|button:r|button:reset":"button[type=reset]","btn:d|button:d|button:disabled":"button[disabled.]","fst:d|fset:d|fieldset:d|fieldset:disabled":"fieldset[disabled.]",bq:"blockquote",fig:"figure",figc:"figcaption",pic:"picture",ifr:"iframe",emb:"embed",obj:"object",cap:"caption",colg:"colgroup",fst:"fieldset",btn:"button",optg:"optgroup",tarea:"textarea",leg:"legend",sect:"section",art:"article",hdr:"header",ftr:"footer",adr:"address",dlg:"dialog",str:"strong",prog:"progress",mn:"main",tem:"template",fset:"fieldset",datag:"datagrid",datal:"datalist",kg:"keygen",out:"output",det:"details",cmd:"command","ri:d|ri:dpr":"img:s","ri:v|ri:viewport":"img:z","ri:a|ri:art":"pic>src:m+img","ri:t|ri:type":"pic>src:t+img","!!!":"{<!DOCTYPE html>}",doc:"html[lang=${lang}]>(head>meta[charset=${charset}]+meta:vp+meta:edge+title{${1:Document}})+body","!|html:5":"!!!+doc",c:"{<!-- ${0} -->}","cc:ie":"{<!--[if IE]>${0}<![endif]-->}","cc:noie":"{<!--[if !IE]><!-->${0}<!--<![endif]-->}"},css:{"@f":"@font-face {\n\tfont-family: ${1};\n\tsrc: url(${1});\n}","@ff":"@font-face {\n\tfont-family: '${1:FontName}';\n\tsrc: url('${2:FileName}.eot');\n\tsrc: url('${2:FileName}.eot?#iefix') format('embedded-opentype'),\n\t\t url('${2:FileName}.woff') format('woff'),\n\t\t url('${2:FileName}.ttf') format('truetype'),\n\t\t url('${2:FileName}.svg#${1:FontName}') format('svg');\n\tfont-style: ${3:normal};\n\tfont-weight: ${4:normal};\n}","@i|@import":"@import url(${0});","@kf":"@keyframes ${1:identifier} {\n\t${2}\n}","@m|@media":"@media ${1:screen} {\n\t${0}\n}",ac:"align-content:flex-start|flex-end|center|space-between|space-around|stretch",ai:"align-items:flex-start|flex-end|center|baseline|stretch",anim:"animation:${1:name} ${2:duration} ${3:timing-function} ${4:delay} ${5:iteration-count} ${6:direction} ${7:fill-mode}",animdel:"animation-delay:${1:time}",animdir:"animation-direction:normal|reverse|alternate|alternate-reverse",animdur:"animation-duration:${1:0}s",animfm:"animation-fill-mode:both|forwards|backwards",animic:"animation-iteration-count:1|infinite",animn:"animation-name",animps:"animation-play-state:running|paused",animtf:"animation-timing-function:linear|ease|ease-in|ease-out|ease-in-out|cubic-bezier(${1:0.1}, ${2:0.7}, ${3:1.0}, ${3:0.1})",ap:"appearance:none",as:"align-self:auto|flex-start|flex-end|center|baseline|stretch",b:"bottom",bd:"border:${1:1px} ${2:solid} ${3:#000}",bdb:"border-bottom:${1:1px} ${2:solid} ${3:#000}",bdbc:"border-bottom-color:#${1:000}",bdbi:"border-bottom-image:url(${0})",bdbk:"border-break:close",bdbli:"border-bottom-left-image:url(${0})|continue",bdblrs:"border-bottom-left-radius",bdbri:"border-bottom-right-image:url(${0})|continue",bdbrrs:"border-bottom-right-radius",bdbs:"border-bottom-style",bdbw:"border-bottom-width",bdc:"border-color:#${1:000}",bdci:"border-corner-image:url(${0})|continue",bdcl:"border-collapse:collapse|separate",bdf:"border-fit:repeat|clip|scale|stretch|overwrite|overflow|space",bdi:"border-image:url(${0})",bdl:"border-left:${1:1px} ${2:solid} ${3:#000}",bdlc:"border-left-color:#${1:000}",bdlen:"border-length",bdli:"border-left-image:url(${0})",bdls:"border-left-style",bdlw:"border-left-width",bdr:"border-right:${1:1px} ${2:solid} ${3:#000}",bdrc:"border-right-color:#${1:000}",bdri:"border-right-image:url(${0})",bdrs:"border-radius",bdrst:"border-right-style",bdrw:"border-right-width",bds:"border-style:hidden|dotted|dashed|solid|double|dot-dash|dot-dot-dash|wave|groove|ridge|inset|outset",bdsp:"border-spacing",bdt:"border-top:${1:1px} ${2:solid} ${3:#000}",bdtc:"border-top-color:#${1:000}",bdti:"border-top-image:url(${0})",bdtli:"border-top-left-image:url(${0})|continue",bdtlrs:"border-top-left-radius",bdtri:"border-top-right-image:url(${0})|continue",bdtrrs:"border-top-right-radius",bdts:"border-top-style",bdtw:"border-top-width",bdw:"border-width",bfv:"backface-visibility:hidden|visible",bg:"background:#${1:000}",bga:"background-attachment:fixed|scroll",bgbk:"background-break:bounding-box|each-box|continuous",bgc:"background-color:#${1:fff}",bgcp:"background-clip:padding-box|border-box|content-box|no-clip",bgi:"background-image:url(${0})",bgo:"background-origin:padding-box|border-box|content-box",bgp:"background-position:${1:0} ${2:0}",bgpx:"background-position-x",bgpy:"background-position-y",bgr:"background-repeat:no-repeat|repeat-x|repeat-y|space|round",bgsz:"background-size:contain|cover",bxsh:"box-shadow:${1:inset }${2:hoff} ${3:voff} ${4:blur} ${5:color}|none",bxsz:"box-sizing:border-box|content-box|border-box",c:"color:#${1:000}",cl:"clear:both|left|right|none",cm:"/* ${0} */",cnt:"content:'${0}'|normal|open-quote|no-open-quote|close-quote|no-close-quote|attr(${0})|counter(${0})|counters({$0})",coi:"counter-increment",colm:"columns",colmc:"column-count",colmf:"column-fill",colmg:"column-gap",colmr:"column-rule",colmrc:"column-rule-color",colmrs:"column-rule-style",colmrw:"column-rule-width",colms:"column-span",colmw:"column-width",cor:"counter-reset",cp:"clip:auto|rect(${1:top} ${2:right} ${3:bottom} ${4:left})",cps:"caption-side:top|bottom",cur:"cursor:pointer|auto|default|crosshair|hand|help|move|pointer|text",d:"display:block|none|flex|inline-flex|inline|inline-block|list-item|run-in|compact|table|inline-table|table-caption|table-column|table-column-group|table-header-group|table-footer-group|table-row|table-row-group|table-cell|ruby|ruby-base|ruby-base-group|ruby-text|ruby-text-group",ec:"empty-cells:show|hide",f:"font:${1:1em} ${2:sans-serif}",fef:"font-effect:none|engrave|emboss|outline",fem:"font-emphasize",femp:"font-emphasize-position:before|after",fems:"font-emphasize-style:none|accent|dot|circle|disc",ff:"font-family:serif|sans-serif|cursive|fantasy|monospace",fl:"float:left|right|none",fs:"font-style:italic|normal|oblique",fsm:"font-smoothing:antialiased|subpixel-antialiased|none",fst:"font-stretch:normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded",fv:"font-variant:normal|small-caps",fw:"font-weight:normal|bold|bolder|lighter",fx:"flex",fxb:"flex-basis:fill|max-content|min-content|fit-content|content",fxd:"flex-direction:row|row-reverse|column|column-reverse",fxf:"flex-flow",fxg:"flex-grow",fxsh:"flex-shrink",fxw:"flex-wrap:nowrap|wrap|wrap-reverse",fz:"font-size",fza:"font-size-adjust",h:"height",jc:"justify-content:flex-start|flex-end|center|space-between|space-around",l:"left",lg:"background-image:linear-gradient(${1})",lh:"line-height",lis:"list-style",lisi:"list-style-image",lisp:"list-style-position:inside|outside",list:"list-style-type:disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman",lts:"letter-spacing:normal",m:"margin",mah:"max-height",mar:"max-resolution",maw:"max-width",mb:"margin-bottom",mih:"min-height",mir:"min-resolution",miw:"min-width",ml:"margin-left",mr:"margin-right",mt:"margin-top",ol:"outline",olc:"outline-color:#${1:000}|invert",olo:"outline-offset",ols:"outline-style:none|dotted|dashed|solid|double|groove|ridge|inset|outset",olw:"outline-width|thin|medium|thick",op:"opacity",ord:"order",ori:"orientation:landscape|portrait",orp:"orphans",ov:"overflow:hidden|visible|hidden|scroll|auto",ovs:"overflow-style:scrollbar|auto|scrollbar|panner|move|marquee",ovx:"overflow-x:hidden|visible|hidden|scroll|auto",ovy:"overflow-y:hidden|visible|hidden|scroll|auto",p:"padding",pb:"padding-bottom",pgba:"page-break-after:auto|always|left|right",pgbb:"page-break-before:auto|always|left|right",pgbi:"page-break-inside:auto|avoid",pl:"padding-left",pos:"position:relative|absolute|relative|fixed|static",pr:"padding-right",pt:"padding-top",q:"quotes",qen:"quotes:'\\201C' '\\201D' '\\2018' '\\2019'",qru:"quotes:'\\00AB' '\\00BB' '\\201E' '\\201C'",r:"right",rsz:"resize:none|both|horizontal|vertical",t:"top",ta:"text-align:left|center|right|justify",tal:"text-align-last:left|center|right",tbl:"table-layout:fixed",td:"text-decoration:none|underline|overline|line-through",te:"text-emphasis:none|accent|dot|circle|disc|before|after",th:"text-height:auto|font-size|text-size|max-size",ti:"text-indent",tj:"text-justify:auto|inter-word|inter-ideograph|inter-cluster|distribute|kashida|tibetan",to:"text-outline:${1:0} ${2:0} ${3:#000}",tov:"text-overflow:ellipsis|clip",tr:"text-replace",trf:"transform:${1}|skewX(${1:angle})|skewY(${1:angle})|scale(${1:x}, ${2:y})|scaleX(${1:x})|scaleY(${1:y})|scaleZ(${1:z})|scale3d(${1:x}, ${2:y}, ${3:z})|rotate(${1:angle})|rotateX(${1:angle})|rotateY(${1:angle})|rotateZ(${1:angle})|translate(${1:x}, ${2:y})|translateX(${1:x})|translateY(${1:y})|translateZ(${1:z})|translate3d(${1:tx}, ${2:ty}, ${3:tz})",trfo:"transform-origin",trfs:"transform-style:preserve-3d",trs:"transition:${1:prop} ${2:time}",trsde:"transition-delay:${1:time}",trsdu:"transition-duration:${1:time}",trsp:"transition-property:${1:prop}",trstf:"transition-timing-function:${1:fn}",tsh:"text-shadow:${1:hoff} ${2:voff} ${3:blur} ${4:#000}",tt:"text-transform:uppercase|lowercase|capitalize|none",tw:"text-wrap:none|normal|unrestricted|suppress",us:"user-select:none",v:"visibility:hidden|visible|collapse",va:"vertical-align:top|super|text-top|middle|baseline|bottom|text-bottom|sub",w:"width",whs:"white-space:nowrap|pre|pre-wrap|pre-line|normal",whsc:"white-space-collapse:normal|keep-all|loose|break-strict|break-all",wid:"widows",wm:"writing-mode:lr-tb|lr-tb|lr-bt|rl-tb|rl-bt|tb-rl|tb-lr|bt-lr|bt-rl",wob:"word-break:normal|keep-all|break-all",wos:"word-spacing",wow:"word-wrap:none|unrestricted|suppress|break-word|normal",z:"z-index",zom:"zoom:1"}},oa={latin:{common:["lorem","ipsum","dolor","sit","amet","consectetur","adipisicing","elit"],words:["exercitationem","perferendis","perspiciatis","laborum","eveniet","sunt","iure","nam","nobis","eum","cum","officiis","excepturi","odio","consectetur","quasi","aut","quisquam","vel","eligendi","itaque","non","odit","tempore","quaerat","dignissimos","facilis","neque","nihil","expedita","vitae","vero","ipsum","nisi","animi","cumque","pariatur","velit","modi","natus","iusto","eaque","sequi","illo","sed","ex","et","voluptatibus","tempora","veritatis","ratione","assumenda","incidunt","nostrum","placeat","aliquid","fuga","provident","praesentium","rem","necessitatibus","suscipit","adipisci","quidem","possimus","voluptas","debitis","sint","accusantium","unde","sapiente","voluptate","qui","aspernatur","laudantium","soluta","amet","quo","aliquam","saepe","culpa","libero","ipsa","dicta","reiciendis","nesciunt","doloribus","autem","impedit","minima","maiores","repudiandae","ipsam","obcaecati","ullam","enim","totam","delectus","ducimus","quis","voluptates","dolores","molestiae","harum","dolorem","quia","voluptatem","molestias","magni","distinctio","omnis","illum","dolorum","voluptatum","ea","quas","quam","corporis","quae","blanditiis","atque","deserunt","laboriosam","earum","consequuntur","hic","cupiditate","quibusdam","accusamus","ut","rerum","error","minus","eius","ab","ad","nemo","fugit","officia","at","in","id","quos","reprehenderit","numquam","iste","fugiat","sit","inventore","beatae","repellendus","magnam","recusandae","quod","explicabo","doloremque","aperiam","consequatur","asperiores","commodi","optio","dolor","labore","temporibus","repellat","veniam","architecto","est","esse","mollitia","nulla","a","similique","eos","alias","dolore","tenetur","deleniti","porro","facere","maxime","corrupti"]},ru:{common:["\u0434\u0430\u043B\u0435\u043A\u043E-\u0434\u0430\u043B\u0435\u043A\u043E","\u0437\u0430","\u0441\u043B\u043E\u0432\u0435\u0441\u043D\u044B\u043C\u0438","\u0433\u043E\u0440\u0430\u043C\u0438","\u0432 \u0441\u0442\u0440\u0430\u043D\u0435","\u0433\u043B\u0430\u0441\u043D\u044B\u0445","\u0438 \u0441\u043E\u0433\u043B\u0430\u0441\u043D\u044B\u0445","\u0436\u0438\u0432\u0443\u0442","\u0440\u044B\u0431\u043D\u044B\u0435","\u0442\u0435\u043A\u0441\u0442\u044B"],words:["\u0432\u0434\u0430\u043B\u0438","\u043E\u0442 \u0432\u0441\u0435\u0445","\u043E\u043D\u0438","\u0431\u0443\u043A\u0432\u0435\u043D\u043D\u044B\u0445","\u0434\u043E\u043C\u0430\u0445","\u043D\u0430 \u0431\u0435\u0440\u0435\u0433\u0443","\u0441\u0435\u043C\u0430\u043D\u0442\u0438\u043A\u0430","\u0431\u043E\u043B\u044C\u0448\u043E\u0433\u043E","\u044F\u0437\u044B\u043A\u043E\u0432\u043E\u0433\u043E","\u043E\u043A\u0435\u0430\u043D\u0430","\u043C\u0430\u043B\u0435\u043D\u044C\u043A\u0438\u0439","\u0440\u0443\u0447\u0435\u0435\u043A","\u0434\u0430\u043B\u044C","\u0436\u0443\u0440\u0447\u0438\u0442","\u043F\u043E \u0432\u0441\u0435\u0439","\u043E\u0431\u0435\u0441\u043F\u0435\u0447\u0438\u0432\u0430\u0435\u0442","\u0435\u0435","\u0432\u0441\u0435\u043C\u0438","\u043D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u044B\u043C\u0438","\u043F\u0440\u0430\u0432\u0438\u043B\u0430\u043C\u0438","\u044D\u0442\u0430","\u043F\u0430\u0440\u0430\u0434\u0438\u0433\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F","\u0441\u0442\u0440\u0430\u043D\u0430","\u043A\u043E\u0442\u043E\u0440\u043E\u0439","\u0436\u0430\u0440\u0435\u043D\u043D\u044B\u0435","\u043F\u0440\u0435\u0434\u043B\u043E\u0436\u0435\u043D\u0438\u044F","\u0437\u0430\u043B\u0435\u0442\u0430\u044E\u0442","\u043F\u0440\u044F\u043C\u043E","\u0440\u043E\u0442","\u0434\u0430\u0436\u0435","\u0432\u0441\u0435\u043C\u043E\u0433\u0443\u0449\u0430\u044F","\u043F\u0443\u043D\u043A\u0442\u0443\u0430\u0446\u0438\u044F","\u043D\u0435","\u0438\u043C\u0435\u0435\u0442","\u0432\u043B\u0430\u0441\u0442\u0438","\u043D\u0430\u0434","\u0440\u044B\u0431\u043D\u044B\u043C\u0438","\u0442\u0435\u043A\u0441\u0442\u0430\u043C\u0438","\u0432\u0435\u0434\u0443\u0449\u0438\u043C\u0438","\u0431\u0435\u0437\u043E\u0440\u0444\u043E\u0433\u0440\u0430\u0444\u0438\u0447\u043D\u044B\u0439","\u043E\u0431\u0440\u0430\u0437","\u0436\u0438\u0437\u043D\u0438","\u043E\u0434\u043D\u0430\u0436\u0434\u044B","\u043E\u0434\u043D\u0430","\u043C\u0430\u043B\u0435\u043D\u044C\u043A\u0430\u044F","\u0441\u0442\u0440\u043E\u0447\u043A\u0430","\u0440\u044B\u0431\u043D\u043E\u0433\u043E","\u0442\u0435\u043A\u0441\u0442\u0430","\u0438\u043C\u0435\u043D\u0438","lorem","ipsum","\u0440\u0435\u0448\u0438\u043B\u0430","\u0432\u044B\u0439\u0442\u0438","\u0431\u043E\u043B\u044C\u0448\u043E\u0439","\u043C\u0438\u0440","\u0433\u0440\u0430\u043C\u043C\u0430\u0442\u0438\u043A\u0438","\u0432\u0435\u043B\u0438\u043A\u0438\u0439","\u043E\u043A\u0441\u043C\u043E\u043A\u0441","\u043F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0436\u0434\u0430\u043B","\u043E","\u0437\u043B\u044B\u0445","\u0437\u0430\u043F\u044F\u0442\u044B\u0445","\u0434\u0438\u043A\u0438\u0445","\u0437\u043D\u0430\u043A\u0430\u0445","\u0432\u043E\u043F\u0440\u043E\u0441\u0430","\u043A\u043E\u0432\u0430\u0440\u043D\u044B\u0445","\u0442\u043E\u0447\u043A\u0430\u0445","\u0437\u0430\u043F\u044F\u0442\u043E\u0439","\u043D\u043E","\u0442\u0435\u043A\u0441\u0442","\u0434\u0430\u043B","\u0441\u0431\u0438\u0442\u044C","\u0441\u0435\u0431\u044F","\u0442\u043E\u043B\u043A\u0443","\u043E\u043D","\u0441\u043E\u0431\u0440\u0430\u043B","\u0441\u0435\u043C\u044C","\u0441\u0432\u043E\u0438\u0445","\u0437\u0430\u0433\u043B\u0430\u0432\u043D\u044B\u0445","\u0431\u0443\u043A\u0432","\u043F\u043E\u0434\u043F\u043E\u044F\u0441\u0430\u043B","\u0438\u043D\u0438\u0446\u0438\u0430\u043B","\u0437\u0430","\u043F\u043E\u044F\u0441","\u043F\u0443\u0441\u0442\u0438\u043B\u0441\u044F","\u0434\u043E\u0440\u043E\u0433\u0443","\u0432\u0437\u043E\u0431\u0440\u0430\u0432\u0448\u0438\u0441\u044C","\u043F\u0435\u0440\u0432\u0443\u044E","\u0432\u0435\u0440\u0448\u0438\u043D\u0443","\u043A\u0443\u0440\u0441\u0438\u0432\u043D\u044B\u0445","\u0433\u043E\u0440","\u0431\u0440\u043E\u0441\u0438\u043B","\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0439","\u0432\u0437\u0433\u043B\u044F\u0434","\u043D\u0430\u0437\u0430\u0434","\u0441\u0438\u043B\u0443\u044D\u0442","\u0441\u0432\u043E\u0435\u0433\u043E","\u0440\u043E\u0434\u043D\u043E\u0433\u043E","\u0433\u043E\u0440\u043E\u0434\u0430","\u0431\u0443\u043A\u0432\u043E\u0433\u0440\u0430\u0434","\u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A","\u0434\u0435\u0440\u0435\u0432\u043D\u0438","\u0430\u043B\u0444\u0430\u0432\u0438\u0442","\u043F\u043E\u0434\u0437\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A","\u0441\u0432\u043E\u0435\u0433\u043E","\u043F\u0435\u0440\u0435\u0443\u043B\u043A\u0430","\u0433\u0440\u0443\u0441\u0442\u043D\u044B\u0439","\u0440\u0435\u0442\u043E\u0440\u0438\u0447\u0435\u0441\u043A\u0438\u0439","\u0432\u043E\u043F\u0440\u043E\u0441","\u0441\u043A\u0430\u0442\u0438\u043B\u0441\u044F","\u0435\u0433\u043E","\u0449\u0435\u043A\u0435","\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u043B","\u0441\u0432\u043E\u0439","\u043F\u0443\u0442\u044C","\u0434\u043E\u0440\u043E\u0433\u0435","\u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043B","\u0440\u0443\u043A\u043E\u043F\u0438\u0441\u044C","\u043E\u043D\u0430","\u043F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0434\u0438\u043B\u0430","\u043C\u043E\u0435\u0439","\u0432\u0441\u0435","\u043F\u0435\u0440\u0435\u043F\u0438\u0441\u044B\u0432\u0430\u0435\u0442\u0441\u044F","\u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E","\u0440\u0430\u0437","\u0435\u0434\u0438\u043D\u0441\u0442\u0432\u0435\u043D\u043D\u043E\u0435","\u0447\u0442\u043E","\u043C\u0435\u043D\u044F","\u043E\u0441\u0442\u0430\u043B\u043E\u0441\u044C","\u044D\u0442\u043E","\u043F\u0440\u0438\u0441\u0442\u0430\u0432\u043A\u0430","\u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0439\u0441\u044F","\u0442\u044B","\u043B\u0443\u0447\u0448\u0435","\u0441\u0432\u043E\u044E","\u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u0443\u044E","\u0441\u0442\u0440\u0430\u043D\u0443","\u043F\u043E\u0441\u043B\u0443\u0448\u0430\u0432\u0448\u0438\u0441\u044C","\u0440\u0443\u043A\u043E\u043F\u0438\u0441\u0438","\u043D\u0430\u0448","\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u043B","\u0441\u0432\u043E\u0439","\u043F\u0443\u0442\u044C","\u0432\u0441\u043A\u043E\u0440\u0435","\u0435\u043C\u0443","\u043F\u043E\u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043B\u0441\u044F","\u043A\u043E\u0432\u0430\u0440\u043D\u044B\u0439","\u0441\u043E\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044C","\u0440\u0435\u043A\u043B\u0430\u043C\u043D\u044B\u0445","\u0442\u0435\u043A\u0441\u0442\u043E\u0432","\u043D\u0430\u043F\u043E\u0438\u0432\u0448\u0438\u0439","\u044F\u0437\u044B\u043A\u043E\u043C","\u0440\u0435\u0447\u044C\u044E","\u0437\u0430\u043C\u0430\u043D\u0438\u0432\u0448\u0438\u0439","\u0441\u0432\u043E\u0435","\u0430\u0433\u0435\u043D\u0442\u0441\u0442\u0432\u043E","\u043A\u043E\u0442\u043E\u0440\u043E\u0435","\u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043B\u043E","\u0441\u043D\u043E\u0432\u0430","\u0441\u043D\u043E\u0432\u0430","\u0441\u0432\u043E\u0438\u0445","\u043F\u0440\u043E\u0435\u043A\u0442\u0430\u0445","\u0435\u0441\u043B\u0438","\u043F\u0435\u0440\u0435\u043F\u0438\u0441\u0430\u043B\u0438","\u0442\u043E","\u0436\u0438\u0432\u0435\u0442","\u0442\u0430\u043C","\u0434\u043E","\u0441\u0438\u0445","\u043F\u043E\u0440"]},sp:{common:["mujer","uno","dolor","m\xE1s","de","poder","mismo","si"],words:["ejercicio","preferencia","perspicacia","laboral","pa\xF1o","suntuoso","molde","namibia","planeador","mirar","dem\xE1s","oficinista","excepci\xF3n","odio","consecuencia","casi","auto","chicharra","velo","elixir","ataque","no","odio","temporal","cu\xF3rum","dign\xEDsimo","facilismo","letra","nihilista","expedici\xF3n","alma","alveolar","aparte","le\xF3n","animal","como","paria","belleza","modo","natividad","justo","ataque","s\xE9quito","pillo","sed","ex","y","voluminoso","temporalidad","verdades","racional","asunci\xF3n","incidente","marejada","placenta","amanecer","fuga","previsor","presentaci\xF3n","lejos","necesariamente","sospechoso","adiposidad","quind\xEDo","p\xF3cima","voluble","d\xE9bito","sinti\xF3","accesorio","falda","sapiencia","volutas","queso","permacultura","laudo","soluciones","entero","pan","litro","tonelada","culpa","libertario","mosca","dictado","reincidente","nascimiento","dolor","escolar","impedimento","m\xEDnima","mayores","repugnante","dulce","obcecado","monta\xF1a","enigma","total","delet\xE9reo","d\xE9cima","c\xE1bala","fotograf\xEDa","dolores","molesto","olvido","paciencia","resiliencia","voluntad","molestias","magn\xEDfico","distinci\xF3n","ovni","marejada","cerro","torre","y","abogada","manantial","corporal","agua","crep\xFAsculo","ataque","desierto","laboriosamente","angustia","afortunado","alma","encefalograma","materialidad","cosas","o","renuncia","error","menos","conejo","abad\xEDa","analfabeto","remo","fugacidad","oficio","en","alm\xE1cigo","vos","pan","represi\xF3n","n\xFAmeros","triste","refugiado","trote","inventor","corchea","repelente","magma","recusado","patr\xF3n","expl\xEDcito","paloma","s\xEDndrome","inmune","autoinmune","comodidad","ley","vietnamita","demonio","tasmania","repeler","ap\xE9ndice","arquitecto","columna","yugo","computador","mula","a","prop\xF3sito","fantas\xEDa","alias","rayo","tenedor","deleznable","ventana","cara","anemia","corrupto"]}},la={wordCount:30,skipCommon:!1,lang:"latin"},ca=function(o,t){t=Object.assign({},la,t);var e=oa[t.lang]||oa.latin,n=!t.skipCommon&&!Ze(o);return o.repeat||Ie(o.parent)?(o.value=He(e,t.wordCount,n),o.name=P(o.parent.name)):(o.parent.value=He(e,t.wordCount,n),o.remove()),o},fa=/^lorem([a-z]*)(\d*)$/,pa=function(o,t){var a=[na[o]||na.html];Array.isArray(t)?t.forEach(function(e){a.push("string"==typeof e?na[e]:e)}):"object"==typeof t&&a.push(t);var n=new Qr(a.filter(Boolean));return"css"!==o&&n.get(0).set(fa,$t),n},ha={lang:"en",locale:"en-US",charset:"UTF-8"},da=new Set(["css","sass","scss","less","stylus","sss"]),ma={syntax:"html",field:function(n,t){return t||""},text:null,profile:null,variables:{},snippets:{},addons:null,format:null},ga=new Set(["html","xml","xsl","jsx","js","pug","slim","haml","css","sass","scss","less","sss","stylus"]),ba=function(o,t){var e=o.getTokenTypeAt(t||o.getCursor());return e&&/^property\b/.test(e)},zi={html:function(n,t){return null===n.getTokenTypeAt(t||n.getCursor())},css:ba,less:ba,sass:ba,scss:ba},ya="[[::emmet-cursor::]]",xa=function(n,t){return void 0===t&&(t=""),t},Ki="emmet-abbreviation",Gi=45,Aa=function(e){return jn(e.map(function(e){return new Oa(e.key,e.value)}))},Oa=function(o,t){this.key=o,this.value=t,this.property=null;var e=t&&t.match(/^([a-z\-]+)(?:\s*:\s*([^\n\r]+))?$/);e&&(this.property=e[1],this.value=e[2]),this.dependencies=[]},ja={defaulValue:{}};Oa.prototype.addDependency=function(e){this.dependencies.push(e)},ja.defaulValue.get=function(){return null==this.value?null:Rn(this.value)[0]},Oa.prototype.keywords=function(){var d=[],n=new Set,r=0,i,t;for(this.property&&d.push(this);r<d.length;)if(i=d[r++],i.value){t=Rn(i.value).filter(Mn);for(var e=0;e<t.length;e++)n.add(t[e].trim());for(var o=0,a=i.dependencies;o<a.length;o++)-1===d.indexOf(a[o])&&d.push(a[o])}return Array.from(n)},Object.defineProperties(Oa.prototype,ja);var _a=function(o,t,e,n){n=n||o.getCursor();var r=an(o,n);return r?on(r)?Fn(o,t,e,n):Nn(o,t,e,n):[]},Sa=function(a,t,e,n,r,i){this.type=a,this.editor=t,this.range=e,this.label=n,this.preview=r,this.snippet=i,this._inserted=!1};Sa.prototype.insert=function(){if(!this._inserted)if(this._inserted=!0,"function"==typeof this.snippet)this.snippet(this.editor,this.range);else{this.editor.replaceRange(this.snippet,this.range.from,this.range.to);var n=this.editor.indexFromPos(this.range.from),t=this.editor.posFromIndex(n+this.snippet.length);this.editor.setCursor(t)}};var Ea=function(o,r,e){null==e&&"string"==typeof o&&(e=o.length),this.string=o,this.pos=this.start=r||0,this.end=e};Ea.prototype.eof=function(){return this.pos>=this.end},Ea.prototype.limit=function(n,t){return new this.constructor(this.string,n,t)},Ea.prototype.peek=function(){return this.string.charCodeAt(this.pos)},Ea.prototype.next=function(){if(this.pos<this.string.length)return this.string.charCodeAt(this.pos++)},Ea.prototype.eat=function(o){var r=this.peek(),e="function"==typeof o?o(r):r===o;return e&&this.next(),e},Ea.prototype.eatWhile=function(n){for(var t=this.pos;!this.eof()&&this.eat(n););return this.pos!==t},Ea.prototype.backUp=function(e){this.pos-=e||1},Ea.prototype.current=function(){return this.substring(this.start,this.pos)},Ea.prototype.substring=function(n,t){return this.string.slice(n,t)},Ea.prototype.error=function(n){var t=new Error(n+" at char "+(this.pos+1));return t.originalMessage=n,t.pos=this.pos,t.string=this.string,t};var qa=39,za=34,Ta={escape:92,throws:!1},Ma=function(o,t){t=t?Object.assign({},Ta,t):Ta;var e=o.pos,n=o.peek();if(o.eat(Bn)){for(;!o.eof();)switch(o.next()){case n:return o.start=e,!0;case t.escape:o.next();}if(o.pos=e,t.throws)throw o.error("Unable to consume quoted string")}return!1},Ra={escape:92,throws:!1},La=function(o,t,e,n){this.stream=o,this.type=t,this.open=e,this.close=n,this.children=[],this.parent=null},Na={name:{},attributes:{},start:{},end:{},firstChild:{},nextSibling:{},previousSibling:{}};Na.name.get=function(){return"tag"===this.type&&this.open?this.open&&this.open.name&&this.open.name.value:"#"+this.type},Na.attributes.get=function(){return this.open&&this.open.attributes},Na.start.get=function(){return this.open&&this.open.start},Na.end.get=function(){return this.close?this.close.end:this.open&&this.open.end},Na.firstChild.get=function(){return this.children[0]},Na.nextSibling.get=function(){var e=this.getIndex();return-1===e?null:this.parent.children[e+1]},Na.previousSibling.get=function(){var e=this.getIndex();return-1===e?null:this.parent.children[e-1]},La.prototype.getIndex=function(){return this.parent?this.parent.children.indexOf(this):-1},La.prototype.addChild=function(e){return this.removeChild(e),this.children.push(e),e.parent=this,this},La.prototype.removeChild=function(n){var t=this.children.indexOf(n);return-1!==t&&(this.children.splice(t,1),n.parent=null),this},Object.defineProperties(La.prototype,Na);var Fa=function(o,t,r){return"function"==typeof t?Xn(o,t):new Wa(o,t,r)},Wa=function(o,t,e){this.stream=o,this.start=null==t?o.start:t,this.end=null==e?o.pos:e,this._value=null},Pa={value:{}};Pa.value.get=function(){if(null===this._value){var n=this.stream.start,t=this.stream.pos;this.stream.start=this.start,this.stream.pos=this.end,this._value=this.stream.current(),this.stream.start=n,this.stream.pos=t}return this._value},Wa.prototype.toString=function(){return this.value},Wa.prototype.valueOf=function(){return this.value+" ["+this.start+"; "+this.end+"]"},Object.defineProperties(Wa.prototype,Pa);var Ua={throws:!0},Ia=function(n){var t=n.pos;if(Hn(n,60,62,Ua)||Hn(n,91,93,Ua)||Hn(n,40,41,Ua)||Hn(n,123,125,Ua))return Fa(n,t)},Ba=47,Da=61,Ya=62,Ga=function(o){for(var t=[],n;!o.eof();)if(o.eatWhile(Gn),n={start:o.pos},n.name=Qn(o))o.eat(Da)?n.value=Yn(o):n.boolean=!0,n.end=o.pos,t.push(n);else{if(Jn(o.peek()))break;o.next()}return t},Va=45,Xa=46,Ha=58,Za=95,Qa=function(o){var t=o.pos;if(o.eat(60)){var e={type:o.eat(47)?"close":"open"};if((e.name=er(o))&&("close"!==e.type&&(e.attributes=Ga(o),o.eatWhile(Gn),e.selfClosing=o.eat(47)),o.eat(62)))return Object.assign(Fa(o,t),e)}return o.pos=t,null},Ja=rr("<!--"),Ka=rr("-->"),Xi=function(o){var t=o.pos;if(or(o,Ja,Ka,!0)){var e=Fa(o,t);return e.type="comment",e}return null},Qi=rr("<![CDATA["),Yi=rr("]]>"),Ji=function(o){var t=o.pos;if(or(o,Qi,Yi,!0)){var e=Fa(o,t);return e.type="cdata",e}return null},$i={xml:!1,special:["script","style"],empty:["img","meta","link","br","base","hr","area","wbr"]},Zi=function(o,t,e){this.dom=o,this.type=t,this.syntax=e};Zi.prototype.nodeForPoint=function(o,t){for(var e=this.dom.firstChild,n=null;e;)mn(cr(e),o,t)?(n=e,e=e.firstChild):e=e.nextSibling;return n};var es=function(o,r,e){null==e&&"string"==typeof o&&(e=o.length),this.string=o,this.pos=this.start=r||0,this.end=e};es.prototype.eof=function(){return this.pos>=this.end},es.prototype.limit=function(n,t){return new this.constructor(this.string,n,t)},es.prototype.peek=function(){return this.string.charCodeAt(this.pos)},es.prototype.next=function(){if(this.pos<this.string.length)return this.string.charCodeAt(this.pos++)},es.prototype.eat=function(o){var r=this.peek(),e="function"==typeof o?o(r):r===o;return e&&this.next(),e},es.prototype.eatWhile=function(n){for(var t=this.pos;!this.eof()&&this.eat(n););return this.pos!==t},es.prototype.backUp=function(e){this.pos-=e||1},es.prototype.current=function(){return this.substring(this.start,this.pos)},es.prototype.substring=function(n,t){return this.string.slice(n,t)},es.prototype.error=function(n){var t=new Error(n+" at char "+(this.pos+1));return t.originalMessage=n,t.pos=this.pos,t.string=this.string,t};var ts=function(a){function t(t,s,n){a.call(this);var r=t.constructor;this.editor=t,this.start=this.pos=s||r.Pos(0,0);var i=t.lastLine();this._eof=n?n.to:r.Pos(i,this._lineLength(i)),this._sof=n?n.from:r.Pos(0,0)}return a&&(t.__proto__=a),t.prototype=Object.create(a&&a.prototype),t.prototype.constructor=t,t.prototype.sof=function(){return 0>=gn(this.pos,this._sof)},t.prototype.eof=function(){return 0<=gn(this.pos,this._eof)},t.prototype.limit=function(n,o){return new this.constructor(this.editor,n,{from:n,to:o})},t.prototype.peek=function(){var o=this.pos,t=(o.line,o.ch),e=this.editor.getLine(this.pos.line);return t<e.length?e.charCodeAt(t):10},t.prototype.next=function(){if(!this.eof()){var e=this.peek();return this.pos=Object.assign({},this.pos,{ch:this.pos.ch+1}),this.pos.ch>=this._lineLength(this.pos.line)&&(this.pos.line++,this.pos.ch=0),this.eof()&&(this.pos=Object.assign({},this._eof)),e}return NaN},t.prototype.backUp=function(a){var t=this,e=this.editor.constructor,n=this.pos,r=n.line,i=n.ch;for(i-=a||1;0<=r&&0>i;)r--,i+=t._lineLength(r);return this.pos=0>r||0>i?e.Pos(0,0):e.Pos(r,i),this.peek()},t.prototype.current=function(){return this.substring(this.start,this.pos)},t.prototype.substring=function(n,t){return this.editor.getRange(n,t)},t.prototype.error=function(n){var t=new Error(n+" at line "+this.pos.line+", column "+this.pos.ch);return t.originalMessage=n,t.pos=this.pos,t.string=this.string,t},t.prototype._lineLength=function(n){var t=n===this.editor.lastLine();return this.editor.getLine(n).length+(t?0:1)},t}(es),ns="emmet-open-tag",os="emmet-close-tag",rs={emmetExpandAbbreviation:function(a){if(a.somethingSelected())return a.constructor.Pass;var t=a.getCursor(),e=An(a,t),n=!1;if(e)n=xn(a,e.model.ast,e.find());else{var r=bn(a,t);if(r){var i={from:{line:t.line,ch:r.location},to:{line:t.line,ch:r.location+r.abbreviation.length}};n=xn(a,r.abbreviation,i)}}return Sn(a),n||a.constructor.Pass},emmetInsertLineBreak:function(d){var t=d.getCursor();if("xml"===d.getModeAt(t).name){var e=(Object.assign({},t,{ch:t.ch+1}),d.getTokenAt(t)),n=d.getTokenAt(Object.assign({},t,{ch:t.ch+1}));if("tag bracket"===e.type&&">"===e.string&&"tag bracket"===n.type&&"</"===n.string){var r=d.getLine(t.line).match(/^\s+/),i=r?r[0]:"",o=pn(d),a="\n"+i+o;d.replaceRange(a+("\n"+i),t,t);var s=d.indexFromPos(t),l=d.posFromIndex(s+a.length);return void d.setCursor(l)}}return d.constructor.Pass}};"undefined"!=typeof CodeMirror&&function(e){Object.assign(e.commands,rs),e.defineOption("markEmmetAbbreviation",!0,function(n,t){t?n.on("change",wn):(n.off("change",wn),Sn(n))}),e.defineOption("autoRenameTags",!0,function(n,t){t?n.on("change",kr):n.off("change",kr)}),e.defineOption("markTagPairs",!1,function(n,t){t?(n.on("cursorActivity",fr),n.on("change",mr)):(n.off("cursorActivity",fr),n.off("change",mr),mr(n),br(n))}),e.defineOption("emmet",{}),e.defineExtension("getEmmetCompletions",function(d,l){var e=this;"boolean"==typeof d&&(l=d,d=null);var n,r;if(d=d||e.getCursor(),e.getOption("markEmmetAbbreviation")){var p=An(e,d)||l&&On(e,d,!0);p&&(n=p.find(),r=_a(e,p.model,n.from,d))}else{var o=bn(e,d);if(o){var a=vn(o.abbreviation,e);a&&(n={from:{line:d.line,ch:o.location},to:{line:d.line,ch:o.location+o.abbreviation.length}},r=_a(e,a,n.from,d))}}return r&&r.length?{from:n.from,to:n.to,list:r}:void 0}),e.defineExtension("getEmmetAbbreviation",function(o){var t=this;o=o||t.getCursor();var e=An(t,o);if(e)return{abbreviation:e.model.abbreviation,ast:e.model.ast,location:e.find().from,fromMarker:!0};var n=bn(t,o);if(n)try{return{abbreviation:n.abbreviation,ast:yn(n.abbreviation,t),location:{line:o.line,ch:n.location},fromMarker:!1}}catch(e){}return null}),e.defineExtension("findEmmetMarker",function(e){return An(this,e||this.getCursor())}),e.defineExtension("getEmmetDocumentModel",function(){var e=this;return e.getOption("markTagPairs")?hr(e):ur(e)})}(CodeMirror)});if(function(){function e(e){var t=getComputedStyle(e).color;if(t)try{return t.match(/(\d+), (\d+), (\d+)/).slice(1)}catch(t){return[255,255,255]}else return[255,255,255]}function t(e,t,n){var o={x:e,y:t+10,alpha:1,color:n};return 1===A?(o.size=a(2,4),o.vx=E.x[0]+Math.random()*(E.x[1]-E.x[0]),o.vy=E.y[0]+Math.random()*(E.y[1]-E.y[0])):2===A&&(o.size=a(2,8),o.drag=0.92,o.vx=a(-3,3),o.vy=a(-3,3),o.wander=0.15,o.theta=a(0,360)*c/180),o}function n(e){e.vy+=C,e.x+=e.vx,e.y+=e.vy,e.alpha*=S,O.fillStyle="rgba("+e.color[0]+","+e.color[1]+","+e.color[2]+","+e.alpha+")",O.fillRect(u(e.x-1),u(e.y-1),e.size,e.size)}function o(e){e.x+=e.vx,e.y+=e.vy,e.vx*=e.drag,e.vy*=e.drag,e.theta+=a(-0.5,0.5),e.vx+=0.1*Math.sin(e.theta),e.vy+=0.1*Math.cos(e.theta),e.size*=0.96,O.fillStyle="rgba("+e.color[0]+","+e.color[1]+","+e.color[2]+","+e.alpha+")",O.beginPath(),O.arc(u(e.x-1),u(e.y-1),e.size,0,2*c),O.fill()}function r(){for(var e=b.length,t;e--;)(t=b[e],!(!t||0.01>t.alpha||0.5>=t.size))&&(1===A?n(t):2===A&&o(t))}function a(e,t){return t||(t=e,e=0),e+~~(Math.random()*(t-e+1))}function i(e,t){var n=!1;return function(){n||(e.apply(this,arguments),n=!0,setTimeout(function(){n=!1},t))}}function s(){h&&(O.clearRect(0,0,k,T),P=new Date().getTime(),!y&&(y=P),_=(P-y)/1e3,y=P,0<m&&(m-=_,D=m/g*f,M=a(-D,D),F=a(-D,D),L.style.transform="translate("+M+"px,"+F+"px)"),r(),requestAnimationFrame(s))}function d(e,t){"+input"!==t.origin&&"+delete"!==t.origin||((!0===e.getOption("blastCode")||e.getOption("blastCode").shake===void 0)&&I(e,0.3),N(e))}function l(e){h=!0,R||(R=document.createElement("canvas"),O=R.getContext("2d"),R.id="code-blast-canvas",R.style.position="absolute",R.style.top=0,R.style.left=0,R.style.zIndex=1,R.style.pointerEvents="none",R.width=k,R.height=T,document.body.appendChild(R),s()),e.on("change",d)}function p(e){e.off("change",d),w.splice(w.indexOf(e),1),w.length||(h=!1,R&&(R.remove(),R=null))}var c=Math.PI,u=Math.round,m=0,g=0,f=5,y=0,b=[],v=0,x={min:2,max:7},C=0.08,S=0.96,E={x:[-1,1],y:[-3.5,-1.5]},k=window.innerWidth,T=window.innerHeight,h=!1,w=[],I=i(function(e,t){L=e.getWrapperElement(),m=g=t},100),N=i(function(n,o){var r=n.getCursor(),s=n.cursorCoords(),d=document.elementFromPoint(s.left-5,s.top+5);o=n.getTokenAt(r),o&&(o=o.type);for(var l=a(x.min,x.max),p=e(d),c=l;c--;)b[v]=t(s.left+10,s.top,p),v=(v+1)%100},100),A,L,R,O,P,_,D,M,F;CodeMirror.defineOption("blastCode",!1,function(e,t){t?(w.push(e),A=t.effect||2,l(e)):p(e)})}(),"use strict",function(){var e=Math.max,t=this,n=t.attachEvent&&!t[r],o=t.document,r="addEventListener",i="removeEventListener",s="getBoundingClientRect",a=function(){for(var e=["","-webkit-","-moz-","-o-"],t=0,n;t<e.length;t++)if(n=o.createElement("div"),n.style.cssText="width:"+e[t]+"calc(9px)",n.style.length)return e[t]+"calc"}(),d=function(e){return"string"==typeof e||e instanceof String?o.querySelector(e):e},l=function(l,p){var c=[],u,h,m,g,f,y,b,v;p="undefined"==typeof p?{}:p,"undefined"==typeof p.gutterSize&&(p.gutterSize=10),"undefined"==typeof p.minSize&&(p.minSize=100),"undefined"==typeof p.snapOffset&&(p.snapOffset=30),"undefined"==typeof p.direction&&(p.direction="horizontal"),"horizontal"==p.direction?(u="width",m="clientWidth",g="clientX",f="left",y="gutter gutter-horizontal",b="paddingLeft",v="paddingRight",!p.cursor&&(p.cursor="ew-resize")):"vertical"==p.direction&&(u="height",m="clientHeight",g="clientY",f="top",y="gutter gutter-vertical",b="paddingTop",v="paddingBottom",!p.cursor&&(p.cursor="ns-resize"));var x=function(n){var e=this,o=e.a,a=e.b;!e.dragging&&p.onDragStart&&p.onDragStart(),n.preventDefault(),e.dragging=!0,e.move=S.bind(e),e.stop=C.bind(e),t[r]("mouseup",e.stop),t[r]("touchend",e.stop),t[r]("touchcancel",e.stop),e.parent[r]("mousemove",e.move),e.parent[r]("touchmove",e.move),o[r]("selectstart",N),o[r]("dragstart",N),a[r]("selectstart",N),a[r]("dragstart",N),o.style.userSelect="none",o.style.webkitUserSelect="none",o.style.MozUserSelect="none",o.style.pointerEvents="none",a.style.userSelect="none",a.style.webkitUserSelect="none",a.style.MozUserSelect="none",a.style.pointerEvents="none",e.gutter.style.cursor=p.cursor,e.parent.style.cursor=p.cursor,E.call(e)},C=function(){var e=this,n=e.a,o=e.b;e.dragging&&p.onDragEnd&&p.onDragEnd(),e.dragging=!1,t[i]("mouseup",e.stop),t[i]("touchend",e.stop),t[i]("touchcancel",e.stop),e.parent[i]("mousemove",e.move),e.parent[i]("touchmove",e.move),delete e.stop,delete e.move,n[i]("selectstart",N),n[i]("dragstart",N),o[i]("selectstart",N),o[i]("dragstart",N),n.style.userSelect="",n.style.webkitUserSelect="",n.style.MozUserSelect="",n.style.pointerEvents="",o.style.userSelect="",o.style.webkitUserSelect="",o.style.MozUserSelect="",o.style.pointerEvents="",e.gutter.style.cursor="",e.parent.style.cursor=""},S=function(t){var e;this.dragging&&(e="touches"in t?t.touches[0][g]-this.start:t[g]-this.start,e<=this.aMin+p.snapOffset+this.aGutterSize?e=this.aMin+this.aGutterSize:e>=this.size-(this.bMin+p.snapOffset+this.bGutterSize)&&(e=this.size-(this.bMin+this.bGutterSize)),k.call(this,e),p.onDrag&&p.onDrag())},E=function(){var e=t.getComputedStyle(this.parent),n=this.parent[m]-parseFloat(e[b])-parseFloat(e[v]);this.size=this.a[s]()[u]+this.b[s]()[u]+this.aGutterSize+this.bGutterSize,this.percentage=Math.min(100*(this.size/n),100),this.start=this.a[s]()[f]},k=function(e){this.a.style[u]=a+"("+e/this.size*this.percentage+"% - "+this.aGutterSize+"px)",this.b.style[u]=a+"("+(this.percentage-e/this.size*this.percentage)+"% - "+this.bGutterSize+"px)"},T=function(){var e=this,t=e.a,n=e.b;t[s]()[u]<e.aMin?(t.style[u]=e.aMin-e.aGutterSize+"px",n.style[u]=e.size-e.aMin-e.aGutterSize+"px"):n[s]()[u]<e.bMin&&(t.style[u]=e.size-e.bMin-e.bGutterSize+"px",n.style[u]=e.bMin-e.bGutterSize+"px")},w=function(){var e=this,t=e.a,n=e.b;n[s]()[u]<e.bMin?(t.style[u]=e.size-e.bMin-e.bGutterSize+"px",n.style[u]=e.bMin-e.bGutterSize+"px"):t[s]()[u]<e.aMin&&(t.style[u]=e.aMin-e.aGutterSize+"px",n.style[u]=e.size-e.aMin-e.aGutterSize+"px")},I=function(e,t,o){"string"==typeof t||t instanceof String||(n?t=p.sizes[h]+"%":t=a+"("+t+"% - "+o+"px)"),e.style[u]=t},N=function(){return!1},A=d(l[0]).parentNode;if(!p.sizes){var L=100/l.length;for(p.sizes=[],h=0;h<l.length;h++)p.sizes.push(L)}if(!Array.isArray(p.minSize)){var R=[];for(h=0;h<l.length;h++)R.push(p.minSize);p.minSize=R}for(h=0;h<l.length;h++){var O=d(l[h]),P=1==h,_=h==l.length-1,D=p.sizes[h],M=p.gutterSize,F=window.getComputedStyle(A).flexDirection,B,U;if(0<h&&(B={a:d(l[h-1]),b:O,aMin:p.minSize[h-1],bMin:p.minSize[h],dragging:!1,parent:A,isFirst:P,isLast:_,direction:p.direction},B.aGutterSize=p.gutterSize,B.bGutterSize=p.gutterSize,P&&(B.aGutterSize=p.gutterSize/2),_&&(B.bGutterSize=p.gutterSize/2),("row-reverse"===F||"column-reverse"===F)&&(U=B.a,B.a=B.b,B.b=U)),!n){if(0<h){var V=o.createElement("div");V.className=y,V.style[u]=p.gutterSize+"px",V[r]("mousedown",x.bind(B)),V[r]("touchstart",x.bind(B)),A.insertBefore(V,O),B.gutter=V}(0===h||h==l.length-1)&&(M=p.gutterSize/2)}I(O,D,M),0<h&&c.push(B)}return function(e){for(var t=0;t<e.length;t++)E.call(e[t]),T.call(e[t]);for(t=e.length-1;0<=t;t--)E.call(e[t]),w.call(e[t])}(c),{setSizes:function(e){for(var t=0;t<e.length;t++)if(0<t){var n=c[t-1];I(n.a,e[t-1],n.aGutterSize),I(n.b,e[t],n.bGutterSize)}},collapse:function(t){var n;t===c.length?(n=c[t-1],E.call(n),k.call(n,n.size-e(n.bGutterSize,n.aMin))):(n=c[t],E.call(n),k.call(n,e(n.aGutterSize,n.aMin)))},destroy:function(){for(var e=0;e<c.length;e++)c[e].parent.removeChild(c[e].gutter),c[e].a.style[u]="",c[e].b.style[u]=""}}};"undefined"==typeof exports?t.Split=l:("undefined"!=typeof module&&module.exports&&(exports=module.exports=l),exports.Split=l)}.call(window),function(){var n=Math.atan2,o=Math.sqrt,s=Math.PI,C=Math.min,t=Math.round,S=Math.max,r=[].slice,p,a,u,m,y,c,f,e,v,i,x,g;f=function(e,t,n){return n=0>n?n+1:1<n?n-1:n,1>6*n?e+6*((t-e)*n):1>2*n?t:2>3*n?e+6*((t-e)*(.66666-n)):e},c=function(t,n,o){var r,a;return a=.5>=o?o*(n+1):o+n-o*n,r=2*o-a,{r:f(r,a,t+.33333),g:f(r,a,t),b:f(r,a,t-.33333)}},x=function(t,n,o){var r,a,s,d,l,p,c;return d=S(t,n,o),l=C(t,n,o),r=d-l,c=d+l,a=l===d?0:t===d?(60*(n-o)/r+360)%360:n===d?60*(o-t)/r+120:60*(t-n)/r+240,s=c/2,p=0===s?0:1===s?1:.5>=s?r/c:r/(2-c),{h:a,s:p,l:s}},y=function(n,o,r,a){return null==a?"hsl("+m(t(180*n/s),360)+","+t(100*o)+"%,"+t(100*r)+"%)":"hsla("+m(t(180*n/s),360)+","+t(100*o)+"%,"+t(100*r)+"%,"+a+")"},u=function(t){var n,o,r,a,e,i;return i=document.createElement("span"),document.body.appendChild(i),i.style.backgroundColor=t,e=getComputedStyle(i).backgroundColor,document.body.removeChild(i),r=/^rgb\((\d+), (\d+), (\d+)\)$/.exec(e),r||(r=/^rgba\((\d+), (\d+), (\d+), ([\d.]+)\)$/.exec(e)),a=parseInt(r[1]),o=parseInt(r[2]),n=parseInt(r[3]),r[4]?{r:a/255,g:o/255,b:n/255,a:parseFloat(r[4])}:{r:a/255,g:o/255,b:n/255}},e=function(e){var t,n;return n=document.createElement("span"),document.body.appendChild(n),n.style.backgroundColor=e,t=0<n.style.backgroundColor.length,n.remove(),t},g=function(e,t){var n,o;for(n in t)o=t[n],e.style[n]=o;return e},m=function(e,t){return e%=t,0>e&&(e+=t),e},v=function(e,t,n){return t+(n-t)*C(1,S(0,e))},p=function(){function e(f,E,b){var T,d,e,g,h,i,I,k,l,m,N,A,p,L,r,R,t,u,v,w,x;for(this.radius=f,this.width=E,this.lightness=b,L=this.radius,v=this.width,d=this.canvas=document.createElement("canvas"),d.width=d.height=2*L,e=d.getContext("2d"),N=e.createImageData(d.width,d.height),h=N.data,(x=m=0,r=d.height);0<=r?m<r:m>r;x=0<=r?++m:--m)for(w=A=0,R=d.width;0<=R?A<R:A>R;w=0<=R?++A:--A)I=x-L,i=w-L,g=o(I*I+i*i),g>L+1.5||(g-=10,u=S(0,C(1,g/(L-v/2-10))),l=n(I,i)/(2*s),t=c(l,u,this.lightness),p=t.r,k=t.g,T=t.b,h[4*(x*d.width+w)+0]=255*p,h[4*(x*d.width+w)+1]=255*k,h[4*(x*d.width+w)+2]=255*T,h[4*(x*d.width+w)+3]=255);e.putImageData(N,0,0)}return e.prototype.drawHSLCircle=function(t,n){var o,r,a,e;return t.width=t.height=2*this.radius,o=t.getContext("2d"),e=this.width,a=this.radius,r=v(n,e,a),o.save(),o.fillStyle="rgba(0,0,0,0.3)",o.beginPath(),o.arc(a,a,a,0,2*s),o.fill(),o.fillStyle="black",o.beginPath(),o.arc(a,a,r,0,2*s),o.arc(a,a,r-e,0,2*s,!0),o.fill(),o.globalCompositeOperation="source-in",o.drawImage(this.canvas,0,0),o.restore()},e}(),i=function(e){return"string"==typeof e&&(e=u(e)),null!=e.r&&null!=e.g&&null!=e.b?(e=x(e.r,e.g,e.b),e.h=e.h*s/180):null!=e.h&&null!=e.s&&null!=e.l&&(e.h=e.h*s/180),e},a=function(){function e(e){this.color=i(e),this.refColor=this.color,this.el=E(),this.circleContainer=this.el.appendChild(l.call(this)),this.lSlider=this.el.appendChild(b.call(this)),this.colorPreview=this.el.appendChild(f.call(this)),d.call(this),this.setLightness(this.color.l)}var d,l,f,h,b,E,T,w;return T=80,w=25,e.prototype.setHue=function(e){var n,o,r;return this.color.h=e,r=v(this.color.s,w,T)-w/2,o=T-w/2,g(this.hueKnob,{left:t(o+Math.cos(e)*r+6-1)+"px",top:t(o+Math.sin(e)*r+6-1)+"px"}),this.colorPreview.style.backgroundColor=this.lKnob.style.backgroundColor=this.hueKnob.style.backgroundColor=y(this.color.h,this.color.s,this.color.l),n=y(this.color.h,this.color.s,.5),this.lSlider.style.backgroundImage="-webkit-linear-gradient(bottom, black, "+n+" 50%, white)",this.lSlider.style.backgroundImage="-moz-linear-gradient(bottom, black, "+n+" 50%, white)",this.emit("changed")},e.prototype.setSaturation=function(e){return this.color.s=e,this.circle.drawHSLCircle(this.circleCanvas,e),this.setHue(this.color.h)},e.prototype.setLightness=function(e){return this.color.l=e,this.circle=new p(T,w,e),this.lKnob.style.top=(1-e)*this.lSlider._height-11+"px",this.setSaturation(this.color.s)},e.prototype.setHSL=function(e,t,n){return this.color.h=m(e,360)*s/180,this.color.s=S(0,C(1,t)),n=S(0,C(1,n)),this.setLightness(n)},e.prototype.getHSL=function(){return{h:m(180*this.color.h/s,360),s:this.color.s,l:this.color.l}},e.prototype.setRGB=function(t,n,o){var r,a,e,i;return e=x(t,n,o),r=e.h,i=e.s,a=e.l,this.setHSL(r,i,a)},e.prototype.getRGB=function(){return c(this.color.h/(2*s),this.color.s,this.color.l)},e.prototype.getCSS=function(){return y(this.color.h,this.color.s,this.color.l)},e.prototype.setCSS=function(t){var n,o,r,e;return e=u(t),r=e.r,o=e.g,n=e.b,this.setRGB(r,o,n)},e.prototype.on=function(e,t){var n;return null==this._listeners&&(this._listeners={}),(null==(n=this._listeners)[e]?n[e]=[]:n[e]).push(t)},e.prototype.emit=function(){var t,n,o,a,i,e,s,d;if(n=arguments[0],t=2<=arguments.length?r.call(arguments,1):[],this._listeners){for(s=null==(e=this._listeners[n])?[]:e,d=[],(o=0,i=s.length);o<i;o++)a=s[o],d.push(a.call.apply(a,[this].concat(r.call(t))));return d}},e.prototype.removeListener=function(t,n){var o;if(this._listeners[t])return this._listeners[t]=function(){var r,a,e,i;for(e=this._listeners[t],i=[],(r=0,a=e.length);r<a;r++)o=e[r],o!==n&&i.push(o);return i}.call(this)},d=function(){var t,r;return this.lKnob.onmousedown=function(e){return function(t){var n,o;return document.documentElement.style.cursor="pointer",window.addEventListener("mousemove",n=function(t){var n,o;return n=e.lSlider.getBoundingClientRect(),o=t.clientY-n.top,e.setLightness(S(0,C(1,1-o/e.lSlider._height)))}),window.addEventListener("mouseup",o=function(){return window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",o),window.removeEventListener("blur",o),document.documentElement.style.cursor=""}),window.addEventListener("blur",o),t.preventDefault(),t.stopPropagation()}}(this),t=this.circleContainer,r=function(r){return function(a){var i,d,e,l,p,c,u;return c=a.layerX,u=a.layerY,d=c-T,e=u-T,i=o(d*d+e*e),p=n(e,d),l=v(r.color.s,w,T),l-w<i&&i<l?-s/8<p&&p<s/8||p>=7*s/8||p<=-7*s/8?t.style.cursor="ew-resize":s/8<=p&&p<3*s/8||-7*s/8<p&&p<=-5*s/8?t.style.cursor="nwse-resize":3*s/8<=p&&p<5*s/8||-5*s/8<p&&p<=-3*s/8?t.style.cursor="ns-resize":5*s/8<=p&&p<7*s/8||-3*s/8<p&&p<=-s/8?t.style.cursor="nesw-resize":void 0:t.style.cursor=""}}(this),t.addEventListener("mouseover",function(n){var o,a;return r(n),t.addEventListener("mousemove",o=function(e){return r(e)}),t.addEventListener("mouseout",a=function(){return t.style.cursor="",t.removeEventListener("mousemove",o),t.removeEventListener("mouseout",a),window.removeEventListener("blur",a)}),window.addEventListener("blur",a)}),t.addEventListener("mousedown",function(r){return function(a){var s,d,e,i,p,c,u,h,l;return a.preventDefault(),h=a.layerX,l=a.layerY,d=h-T,e=l-T,s=o(d*d+e*e),c=n(e,d),p=v(r.color.s,w,T),p-w<s&&s<p?(document.documentElement.style.cursor=t.style.cursor,window.addEventListener("mousemove",i=function(t){var n,a,l;return p=r.circleCanvas.getBoundingClientRect(),n=p.left+p.width/2,a=p.top+p.height/2,d=t.clientX-n,e=t.clientY-a,s=o(d*d+e*e),s-=10,l=S(0,C(1,s/(T-w/2-10))),r.setSaturation(l)}),window.addEventListener("mouseup",u=function(){return window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",u),window.removeEventListener("blur",u),document.documentElement.style.cursor=""}),window.addEventListener("blur",u)):void 0}}(this)),this.hueKnob.onmousedown=function(t){return function(e){var o,r;return document.documentElement.style.cursor="pointer",window.addEventListener("mousemove",o=function(o){var r,a,i;return i=t.circleCanvas.getBoundingClientRect(),r=i.left+i.width/2,a=i.top+i.height/2,t.setHue(n(o.clientY-a,o.clientX-r))}),window.addEventListener("mouseup",r=function(){return window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",r),window.removeEventListener("blur",r),document.documentElement.style.cursor=""}),window.addEventListener("blur",r),e.preventDefault(),e.stopPropagation()}}(this)},E=function(){var e;return e=document.createElement("div"),e.className="picker",g(e,{display:"inline-block",background:"hsl(0, 0%, 97%)",padding:"6px",borderRadius:"6px",boxShadow:"1px 1px 5px hsla(0, 0%, 39%, 0.2), hsla(0, 0%, 100%, 0.9) 0px 0px 1em 0.3em inset",border:"1px solid hsla(0, 0%, 59%, 0.2)",position:"absolute",backgroundImage:"-webkit-linear-gradient(left top, hsla(0, 0%, 0%, 0.05) 25%, transparent 25%, transparent 50%, hsla(0, 0%, 0%, 0.05) 50%, hsla(0, 0%, 0%, 0.05) 75%, transparent 75%, transparent)",backgroundSize:"40px 40px"}),g(e,{backgroundImage:"-moz-linear-gradient(left top, hsla(0, 0%, 0%, 0.05) 25%, transparent 25%, transparent 50%, hsla(0, 0%, 0%, 0.05) 50%, hsla(0, 0%, 0%, 0.05) 75%, transparent 75%, transparent)",zIndex:"1000"}),e},l=function(){var e,t;return e=document.createElement("div"),g(e,{display:"inline-block",width:2*T+"px",height:2*T+"px",borderRadius:T+"px",boxShadow:"0px 0px 7px rgba(0,0,0,0.3)"}),e.appendChild(this.circleCanvas=document.createElement("canvas")),this.hueKnob=t=h(27),e.appendChild(t),e},b=function(){var e,t;return t=document.createElement("div"),g(t,{display:"inline-block",width:"20px",height:2*T-22+"px",marginLeft:"6px",borderRadius:"10px",boxShadow:"hsla(0, 100%, 100%, 0.1) 0 1px 2px 1px inset, hsla(0, 100%, 100%, 0.2) 0 1px inset, hsla(0, 0%, 0%, 0.4) 0 -1px 1px inset, hsla(0, 0%, 0%, 0.4) 0 1px 1px",position:"relative",top:"-11px"}),t._height=2*T-22,this.lKnob=e=h(22),g(e,{left:"-1px"}),t.appendChild(e),t},f=function(){var e,t,n;return e=document.createElement("div"),t=y(this.refColor.h,this.refColor.s,this.refColor.l),n=y(this.refColor.h,this.refColor.s,this.refColor.l,0),g(e,{boxShadow:"hsla(0, 0%, 0%, 0.5) 0 1px 5px, hsla(0, 100%, 100%, 0.4) 0 1px 1px inset, hsla(0, 0%, 0%, 0.3) 0 -1px 1px inset",height:"25px",marginTop:"6px",borderRadius:"3px",backgroundImage:"-webkit-linear-gradient(-20deg, "+n+", "+n+" 69%, "+t+" 70%, "+t+")"}),g(e,{backgroundImage:"-moz-linear-gradient(-20deg, "+n+", "+n+" 69%, "+t+" 70%, "+t+")"}),e},h=function(e){var t;return t=document.createElement("div"),t.className="knob",g(t,{position:"absolute",width:e+"px",height:e+"px",backgroundColor:"red",borderRadius:Math.floor(e/2)+"px",cursor:"pointer",backgroundImage:"-webkit-gradient(radial, 50% 0%, 0, 50% 0%, 15, color-stop(0%, rgba(255, 255, 255, 0.8)), color-stop(100%, rgba(255, 255, 255, 0.2)))",boxShadow:"white 0px 1px 1px inset, rgba(0, 0, 0, 0.4) 0px -1px 1px inset, rgba(0, 0, 0, 0.4) 0px 1px 4px 0px, rgba(0, 0, 0, 0.6) 0 0 2px"}),g(t,{backgroundImage:"radial-gradient(circle at center top, rgba(255,255,255,0.8), rgba(255, 255, 255, 0.2) 15px"}),t},e.prototype.presentModal=function(e,t){var n;return g(this.el,{left:e+"px",top:t-10+"px",opacity:"0",webkitTransition:"0.15s",MozTransition:"0.15s"}),n=document.createElement("div"),n.style.position="fixed",n.style.top=n.style.left=n.style.bottom=n.style.right="0",n.style.zIndex="999",n.onclick=function(e){return function(){var o;return document.body.removeChild(n),e.el.style.top=t+10+"px",e.el.style.opacity=0,o=function(){return document.body.removeChild(e.el),e.el.removeEventListener("webkitTransitionEnd",o),e.el.removeEventListener("transitionend",o)},e.el.addEventListener("webkitTransitionEnd",o),e.el.addEventListener("transitionend",o),e.emit("closed")}}(this),document.body.appendChild(n),document.body.appendChild(this.el),this.el.offsetHeight,this.el.style.opacity="1",this.el.style.top=t+"px",this},e.prototype.presentModalBeneath=function(e){var t,n,o;return t=e.getBoundingClientRect(),n=t.left+window.scrollX,o=t.bottom+window.scrollY+4,this.presentModal(n,o)},e}(),window.thistle={Picker:a,isValidCSSColor:e}}.call(this),"undefined"==typeof Color)var Color={};"undefined"==typeof Color.Space&&(Color.Space={}),function(){"use strict";var t=Math.min,n=Math.floor,o=Math.round,r=Math.max,e=!1,a={},s={"HEX24>HSL":"HEX24>RGB>HSL","HEX32>HSLA":"HEX32>RGBA>HSLA","HEX24>CMYK":"HEX24>RGB>CMY>CMYK","RGB>CMYK":"RGB>CMY>CMYK"},i=Color.Space=function(t,n){s[n]&&(n=s[n]);var o=n.split(">");if("object"==typeof t&&0<=t[0]){for(var r=o[0],d={},l=0,p;l<r.length;l++)p=r.substr(l,1),d[p]=t[l];t=d}if(a[n])return a[n](t);for(var c=1,u=o[0];c<o.length;c++)1<c&&(u=u.substr(u.indexOf("_")+1)),u+=(0===c?"":"_")+o[c],t=i[u](t),e;return e,t};i.RGB_W3=function(e){return"rgb("+(e.R>>0)+","+(e.G>>0)+","+(e.B>>0)+")"},i.RGBA_W3=function(e){var t="number"==typeof e.A?e.A/255:1;return"rgba("+(e.R>>0)+","+(e.G>>0)+","+(e.B>>0)+","+t+")"},i.W3_RGB=function(e){return e=e.substr(4,e.length-5).split(","),{R:parseInt(e[0],10),G:parseInt(e[1],10),B:parseInt(e[2],10)}},i.W3_RGBA=function(e){return e=e.substr(5,e.length-6).split(","),{R:parseInt(e[0],10),G:parseInt(e[1],10),B:parseInt(e[2],10),A:255*parseFloat(e[3])}},i.HSL_W3=function(e){return"hsl("+(e.H+.5>>0)+","+(e.S+.5>>0)+"%,"+(e.L+.5>>0)+"%)"},i.HSLA_W3=function(e){var t="number"==typeof e.A?e.A/255:1;return"hsla("+(e.H+.5>>0)+","+(e.S+.5>>0)+"%,"+(e.L+.5>>0)+"%,"+t+")"},i.W3_HSL=function(e){var t=e.indexOf("(")+1,n=e.indexOf(")");return e=e.substr(t,n-t).split(","),{H:parseInt(e[0],10),S:parseInt(e[1],10),L:parseInt(e[2],10)}},i.W3_HSLA=function(e){var t=e.indexOf("(")+1,n=e.indexOf(")");return e=e.substr(t,n-t).split(","),{H:parseInt(e[0],10),S:parseInt(e[1],10),L:parseInt(e[2],10),A:255*parseFloat(e[3],10)}},i.W3_HEX=i.W3_HEX24=function(e){return"#"===e.substr(0,1)&&(e=e.substr(1)),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),parseInt("0x"+e,16)},i.W3_HEX32=function(e){return"#"===e.substr(0,1)&&(e=e.substr(1)),6===e.length?parseInt("0xFF"+e,10):parseInt("0x"+e,16)},i.HEX_W3=i.HEX24_W3=function(e,t){t||(t=6),e||(e=0);var n=e.toString(16),o;for(o=n.length;o<t;)n="0"+n,o++;for(o=n.length;o>t;)n=n.substr(1),o--;return"#"+n},i.HEX32_W3=function(e){return i.HEX_W3(e,8)},i.HEX_RGB=i.HEX24_RGB=function(e){return{R:e>>16,G:255&e>>8,B:255&e}},i.HEX32_RGBA=function(e){return{R:255&e>>>16,G:255&e>>>8,B:255&e,A:e>>>24}},i.RGBA_HEX32=function(e){return(e.A<<24|e.R<<16|e.G<<8|e.B)>>>0},i.RGB_HEX24=i.RGB_HEX=function(e){return 0>e.R&&(e.R=0),0>e.G&&(e.G=0),0>e.B&&(e.B=0),255<e.R&&(e.R=255),255<e.G&&(e.G=255),255<e.B&&(e.B=255),e.R<<16|e.G<<8|e.B},i.RGB_CMY=function(e){return{C:1-e.R/255,M:1-e.G/255,Y:1-e.B/255}},i.RGBA_HSLA=i.RGB_HSL=function(n){var o=n.R/255,a=n.G/255,s=n.B/255,d=t(o,a,s),e=r(o,a,s),p=e-d,c=(e+d)/2,u,h;if(0==p)u=0,h=0;else{h=.5>c?p/(e+d):p/(2-e-d);var i=((e-o)/6+p/2)/p,g=((e-a)/6+p/2)/p,l=((e-s)/6+p/2)/p;o===e?u=l-g:a===e?u=1/3+i-l:s===e&&(u=2/3+g-i),0>u&&(u+=1),1<u&&(u-=1)}return{H:360*u,S:100*h,L:100*c,A:n.A}},i.RGBA_HSVA=i.RGB_HSV=function(n){var o=n.R/255,a=n.G/255,s=n.B/255,d=t(o,a,s),e=r(o,a,s),p=e-d,c,u;if(0==p)c=0,u=0;else{u=p/e;var i=((e-o)/6+p/2)/p,h=((e-a)/6+p/2)/p,l=((e-s)/6+p/2)/p;o===e?c=l-h:a===e?c=1/3+i-l:s===e&&(c=2/3+h-i),0>c&&(c+=1),1<c&&(c-=1)}return{H:360*c,S:100*u,V:100*e,A:n.A}},i.CMY_RGB=function(e){return{R:r(0,255*(1-e.C)),G:r(0,255*(1-e.M)),B:r(0,255*(1-e.Y))}},i.CMY_CMYK=function(n){var r=n.C,a=n.M,i=n.Y,s=t(i,t(a,t(r,1)));return r=o(100*((r-s)/(1-s))),a=o(100*((a-s)/(1-s))),i=o(100*((i-s)/(1-s))),s=o(100*s),{C:r,M:a,Y:i,K:s}},i.CMYK_CMY=function(e){return{C:e.C*(1-e.K)+e.K,M:e.M*(1-e.K)+e.K,Y:e.Y*(1-e.K)+e.K}},i.HSLA_RGBA=i.HSL_RGB=function(t){var n=t.H/360,o=t.S/100,r=t.L/100,a,e,s,d,l,i;return 0==o?a=e=s=r:(l=.5>r?r*(1+o):r+o-o*r,d=2*r-l,i=n+1/3,0>i&&(i+=1),1<i&&(i-=1),a=1>6*i?d+6*(l-d)*i:1>2*i?l:2>3*i?d+6*((l-d)*(2/3-i)):d,i=n,0>i&&(i+=1),1<i&&(i-=1),e=1>6*i?d+6*(l-d)*i:1>2*i?l:2>3*i?d+6*((l-d)*(2/3-i)):d,i=n-1/3,0>i&&(i+=1),1<i&&(i-=1),s=1>6*i?d+6*(l-d)*i:1>2*i?l:2>3*i?d+6*((l-d)*(2/3-i)):d),{R:255*a,G:255*e,B:255*s,A:t.A}},i.HSVA_RGBA=i.HSV_RGB=function(t){var r=t.H/360,a=t.S/100,s=t.V/100,d,l,p,c,u,i;if(0==a)d=l=p=o(255*s);else switch(1<=r&&(r=0),r=6*r,c=r-n(r),u=o(255*s*(1-a)),p=o(255*s*(1-a*c)),i=o(255*s*(1-a*(1-c))),s=o(255*s),n(r)){case 0:d=s,l=i,p=u;break;case 1:d=p,l=s,p=u;break;case 2:d=u,l=s,p=i;break;case 3:d=u,l=p,p=s;break;case 4:d=i,l=u,p=s;break;case 5:d=s,l=u,p=p;}return{R:d,G:l,B:p,A:t.A}}}(),Inlet=function(){function e(b,C){function c(){var e=d.value+"",t=N.getCursor(!0),n=w(t,"number");if(n){var o={line:t.line,ch:n.start},r={line:t.line,ch:n.end};N.dragging=!0,N.replaceRange(e,o,r)}}function S(n){if(!N.somethingSelected()){I=n.target;var a=N.getCursor(!0),d=N.getTokenAt(a);cursorOffset=N.cursorCoords(!0,"page");var l=N.cursorCoords(!0,L).left,o=w(a,"number"),p=w(a,"hsl"),r=w(a,"hex"),s=w(a,"rgb"),t=w(a,"boolean"),c=cursorOffset.top-h;cursorOffset.top<f&&(c=cursorOffset.top+i);var m=l-k;if(v.style.visibility="hidden",u.style.visibility="hidden",r){var g=r.string;e=new thistle.Picker(g),e.setCSS(g),e.presentModal(m,c),e.on("changed",function(){picked=e.getCSS(),picked=Color.Space(picked,"W3>HSL>RGB>HEX24>W3"),P(picked,"hex")})}else if(p){var g=p.string;e=new thistle.Picker(g),e.setCSS(g),e.presentModal(m,c),e.on("changed",function(){picked=e.getCSS(),P(picked,"hsl")})}else if(s){var g=s.string;e=new thistle.Picker(g),e.setCSS(g),e.presentModal(m,c),e.on("changed",function(){picked=e.getCSS(),picked=Color.Space(picked,"W3>HSL>RGB>W3"),P(picked,"rgb")})}}}function T(e){var t,n;return t=0===e?[-100,100]:[3*-e,5*e],t[0]<t[1]?(min=t[0],max=t[1]):(min=t[1],max=t[0]),n=20<max-min?1:(max-min)/200,{min:min,max:max,step:n}}function w(t,n){if(n){var o;switch(n.toLowerCase()){case"boolean":o=/true|false/g;break;case"hsl":o=/hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)/g;break;case"rgb":o=/rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)/g;break;case"hex":o=/#[a-fA-F0-9]{3,6}/g;break;case"number":o=/[-]?\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g;break;default:throw new Error("invalid match selection");}for(var r=N.getLine(t.line),e=o.exec(r);e;){var a=e[0],s=a.length,d=e.index,l=e.index+s;if(t.ch>=d&&t.ch<=l)return e=null,{start:d,end:l,string:a};e=o.exec(r)}}}var N=b,d,e,A;C||(C={}),C.picker||(C.picker={}),C.slider||(C.slider={}),C.clicker||(C.clicker={});var g=C.container||document.body,h=C.picker.topOffset||220,i=C.picker.bottomOffset||16,f=C.picker.topBoundary||250,k=C.picker.leftOffset||75,l=C.slider.yOffset||15,m=C.slider.xOffset||0,n=C.slider.width,L=C.horizontalMode||"page",o=C.fixedContainer,p=C.slider.callback||function(){},r=C.picker.callback||function(){},s=C.clicker.callback||function(){},t=N.getWrapperElement();t.addEventListener("mouseup",S),document.body.addEventListener("mouseup",function(e){e.target===I||e.target===v||e.target===d||e.target===u||e.target===A||(v.style.visibility="hidden",u.style.visibility="hidden")}),N.setOption("onKeyEvent",function(){if(event=1==arguments.length?arguments[0]:arguments[1],event.keyCode==y||event.keyCode==O){if("visible"===v.style.visibility)return d.stepDown(1),c(),!0;event.altKey&&S()}else if(event.keyCode==E||event.keyCode==R){if("visible"===v.style.visibility)return d.stepUp(1),c(),!0;event.altKey&&S()}else v.style.visibility="hidden"});var u=document.createElement("div");u.className="inlet_clicker",u.style.visibility="hidden",u.style.position="absolute",g.appendChild(u);var A=document.createElement("input");A.className="checkbox",A.setAttribute("type","checkbox"),A.addEventListener("change",function(){var t=A.checked+"",n=N.getCursor(!0),o=w(n,"boolean");if(o){var e={line:n.line,ch:o.start},r={line:n.line,ch:o.end};N.replaceRange(t,e,r)}}),u.appendChild(A);var v=document.createElement("div");v.className="inlet_slider",v.style.visibility="hidden",n&&(v.style.width=n),v.style.position=o?"fixed":"absolute",v.style.top=0,g.appendChild(v);var d=document.createElement("input");d.className="range",d.setAttribute("type","range"),d.addEventListener("input",c),d.addEventListener("change",c);var x=-1<navigator.userAgent.toLowerCase().indexOf("firefox");x||d.addEventListener("mouseup",function(){d.value=0;var e=N.getCursor(!0),t=w(e,"number");if(t){var n=parseFloat(t.string),o=T(n);d.setAttribute("value",n),d.setAttribute("step",o.step),d.setAttribute("min",o.min),d.setAttribute("max",o.max),d.value=n,N.dragging=!1}}),v.appendChild(d);var y=37,R=38,E=39,O=40,P=function(t,n){var o=N.getCursor();if(n){var r=w(o,n),e={line:o.line,ch:r.start},a={line:o.line,ch:r.end};N.picking=!0,N.replaceRange(t,e,a),setTimeout(function(){N.picking=!1},100)}},I;e=new thistle.Picker("#ffffff")}return e}(),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.esprima=t():e.esprima=t()}(this,function(){var e=String.fromCharCode;return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var o=n(1),r=n(3),a=n(11),i=n(15);t.parse=function(e,t,n){var i=null,s=function(e,t){n&&n(e,t),i&&i.visit(e,t)},d="function"==typeof n?s:null,l=!1;if(t){l="boolean"==typeof t.comment&&t.comment;var p="boolean"==typeof t.attachComment&&t.attachComment;(l||p)&&(i=new o.CommentHandler,i.attach=p,t.comment=!0,d=s)}var c=t&&"boolean"==typeof t.jsx&&t.jsx?new a.JSXParser(e,t,d):new r.Parser(e,t,d);var u=c.parseProgram();return l&&(u.comments=i.comments),c.config.tokens&&(u.tokens=c.tokens),c.config.tolerant&&(u.errors=c.errorHandler.errors),u},t.tokenize=function(e,t,n){var o=new i.Tokenizer(e,t),r;r=[];try{for(;;){var a=o.getNextToken();if(!a)break;n&&(a=n(a)),r.push(a)}}catch(t){o.errorHandler.tolerate(t)}return o.errorHandler.tolerant&&(r.errors=o.errors()),r};var s=n(2);t.Syntax=s.Syntax,t.version="3.1.1"},function(e,t,n){"use strict";var o=n(2),r=function(){function e(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return e.prototype.insertInnerComments=function(e,t){if(e.type===o.Syntax.BlockStatement&&0===e.body.length){for(var n=[],r=this.leading.length-1,a;0<=r;--r)a=this.leading[r],t.end.offset>=a.start&&(n.unshift(a.comment),this.leading.splice(r,1),this.trailing.splice(r,1));n.length&&(e.innerComments=n)}},e.prototype.findTrailingComments=function(e,t){var n=[];if(0<this.trailing.length){for(var o=this.trailing.length-1,r;0<=o;--o)r=this.trailing[o],r.start>=t.end.offset&&n.unshift(r.comment);return this.trailing.length=0,n}var a=this.stack[this.stack.length-1];if(a&&a.node.trailingComments){var i=a.node.trailingComments[0];i&&i.range[0]>=t.end.offset&&(n=a.node.trailingComments,delete a.node.trailingComments)}return n},e.prototype.findLeadingComments=function(e,t){for(var n=[],o,r;0<this.stack.length&&(r=this.stack[this.stack.length-1],r&&r.start>=t.start.offset);)o=this.stack.pop().node;if(o){for(var a=o.leadingComments?o.leadingComments.length:0,s=a-1,i;0<=s;--s)i=o.leadingComments[s],i.range[1]<=t.start.offset&&(n.unshift(i),o.leadingComments.splice(s,1));return o.leadingComments&&0===o.leadingComments.length&&delete o.leadingComments,n}for(var s=this.leading.length-1,r;0<=s;--s)r=this.leading[s],r.start<=t.start.offset&&(n.unshift(r.comment),this.leading.splice(s,1));return n},e.prototype.visitNode=function(e,t){if(!(e.type===o.Syntax.Program&&0<e.body.length)){this.insertInnerComments(e,t);var n=this.findTrailingComments(e,t),r=this.findLeadingComments(e,t);0<r.length&&(e.leadingComments=r),0<n.length&&(e.trailingComments=n),this.stack.push({node:e,start:t.start.offset})}},e.prototype.visitComment=function(e,t){var n="L"===e.type[0]?"Line":"Block",o={type:n,value:e.value};if(e.range&&(o.range=e.range),e.loc&&(o.loc=e.loc),this.comments.push(o),this.attach){var r={comment:{type:n,value:e.value,range:[t.start.offset,t.end.offset]},start:t.start.offset};e.loc&&(r.comment.loc=e.loc),e.type=n,this.leading.push(r),this.trailing.push(r)}},e.prototype.visit=function(e,t){"LineComment"===e.type?this.visitComment(e,t):"BlockComment"===e.type?this.visitComment(e,t):this.attach&&this.visitNode(e,t)},e}();t.CommentHandler=r},function(e,t){"use strict";t.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(e,t,n){"use strict";var o=n(4),r=n(5),a=n(6),i=n(7),s=n(8),d=n(2),l=n(10),p="ArrowParameterPlaceHolder",c=function(){function e(e,t,n){void 0===t&&(t={}),this.config={range:"boolean"==typeof t.range&&t.range,loc:"boolean"==typeof t.loc&&t.loc,source:null,tokens:"boolean"==typeof t.tokens&&t.tokens,comment:"boolean"==typeof t.comment&&t.comment,tolerant:"boolean"==typeof t.tolerant&&t.tolerant},this.config.loc&&t.source&&null!==t.source&&(this.config.source=t.source+""),this.delegate=n,this.errorHandler=new a.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new s.Scanner(e,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.sourceType=t&&"module"===t.sourceType?"module":"script",this.lookahead=null,this.hasLineTerminator=!1,this.context={allowIn:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:"module"===this.sourceType},this.tokens=[],this.startMarker={index:0,lineNumber:this.scanner.lineNumber,lineStart:0},this.lastMarker={index:0,lineNumber:this.scanner.lineNumber,lineStart:0},this.nextToken(),this.lastMarker={index:this.scanner.index,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart}}return e.prototype.throwError=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Array.prototype.slice.call(arguments,1),a=e.replace(/%(\d)/g,function(e,t){return o.assert(t<r.length,"Message reference must be in range"),r[t]}),i=this.lastMarker.index,s=this.lastMarker.lineNumber,d=this.lastMarker.index-this.lastMarker.lineStart+1;throw this.errorHandler.createError(i,s,d,a)},e.prototype.tolerateError=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Array.prototype.slice.call(arguments,1),a=e.replace(/%(\d)/g,function(e,t){return o.assert(t<r.length,"Message reference must be in range"),r[t]}),i=this.lastMarker.index,s=this.scanner.lineNumber,d=this.lastMarker.index-this.lastMarker.lineStart+1;this.errorHandler.tolerateError(i,s,d,a)},e.prototype.unexpectedTokenError=function(e,t){var n=t||r.Messages.UnexpectedToken,o;if(e?(!t&&(n=e.type===i.Token.EOF?r.Messages.UnexpectedEOS:e.type===i.Token.Identifier?r.Messages.UnexpectedIdentifier:e.type===i.Token.NumericLiteral?r.Messages.UnexpectedNumber:e.type===i.Token.StringLiteral?r.Messages.UnexpectedString:e.type===i.Token.Template?r.Messages.UnexpectedTemplate:r.Messages.UnexpectedToken,e.type===i.Token.Keyword&&(this.scanner.isFutureReservedWord(e.value)?n=r.Messages.UnexpectedReserved:this.context.strict&&this.scanner.isStrictModeReservedWord(e.value)&&(n=r.Messages.StrictReservedWord))),o=e.type===i.Token.Template?e.value.raw:e.value):o="ILLEGAL",n=n.replace("%0",o),e&&"number"==typeof e.lineNumber){var a=e.start,s=e.lineNumber,d=e.start-this.lastMarker.lineStart+1;return this.errorHandler.createError(a,s,d,n)}var a=this.lastMarker.index,s=this.lastMarker.lineNumber,d=a-this.lastMarker.lineStart+1;return this.errorHandler.createError(a,s,d,n)},e.prototype.throwUnexpectedToken=function(e,t){throw this.unexpectedTokenError(e,t)},e.prototype.tolerateUnexpectedToken=function(e,t){this.errorHandler.tolerate(this.unexpectedTokenError(e,t))},e.prototype.collectComments=function(){if(!this.config.comment)this.scanner.scanComments();else{var t=this.scanner.scanComments();if(0<t.length&&this.delegate)for(var n=0;n<t.length;++n){var o=t[n],e=void 0;e={type:o.multiLine?"BlockComment":"LineComment",value:this.scanner.source.slice(o.slice[0],o.slice[1])},this.config.range&&(e.range=o.range),this.config.loc&&(e.loc=o.loc);var r={start:{line:o.loc.start.line,column:o.loc.start.column,offset:o.range[0]},end:{line:o.loc.end.line,column:o.loc.end.column,offset:o.range[1]}};this.delegate(e,r)}}},e.prototype.getTokenRaw=function(e){return this.scanner.source.slice(e.start,e.end)},e.prototype.convertToken=function(e){var n;return n={type:i.TokenName[e.type],value:this.getTokenRaw(e)},this.config.range&&(n.range=[e.start,e.end]),this.config.loc&&(n.loc={start:{line:this.startMarker.lineNumber,column:this.startMarker.index-this.startMarker.lineStart},end:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}),e.regex&&(n.regex=e.regex),n},e.prototype.nextToken=function(){var e=this.lookahead;this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart,this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.lineNumber=this.scanner.lineNumber,this.startMarker.lineStart=this.scanner.lineStart;var t;return t=this.scanner.lex(),this.hasLineTerminator=e&&t&&e.lineNumber!==t.lineNumber,t&&this.context.strict&&t.type===i.Token.Identifier&&this.scanner.isStrictModeReservedWord(t.value)&&(t.type=i.Token.Keyword),this.lookahead=t,this.config.tokens&&t.type!==i.Token.EOF&&this.tokens.push(this.convertToken(t)),e},e.prototype.nextRegexToken=function(){this.collectComments();var e=this.scanner.scanRegExp();return this.config.tokens&&(this.tokens.pop(),this.tokens.push(this.convertToken(e))),this.lookahead=e,this.nextToken(),e},e.prototype.createNode=function(){return{index:this.startMarker.index,line:this.startMarker.lineNumber,column:this.startMarker.index-this.startMarker.lineStart}},e.prototype.startNode=function(e){return{index:e.start,line:e.lineNumber,column:e.start-e.lineStart}},e.prototype.finalize=function(e,t){if(this.config.range&&(t.range=[e.index,this.lastMarker.index]),this.config.loc&&(t.loc={start:{line:e.line,column:e.column},end:{line:this.lastMarker.lineNumber,column:this.lastMarker.index-this.lastMarker.lineStart}},this.config.source&&(t.loc.source=this.config.source)),this.delegate){var n={start:{line:e.line,column:e.column,offset:e.index},end:{line:this.lastMarker.lineNumber,column:this.lastMarker.index-this.lastMarker.lineStart,offset:this.lastMarker.index}};this.delegate(t,n)}return t},e.prototype.expect=function(e){var t=this.nextToken();(t.type!==i.Token.Punctuator||t.value!==e)&&this.throwUnexpectedToken(t)},e.prototype.expectCommaSeparator=function(){if(this.config.tolerant){var e=this.lookahead;e.type===i.Token.Punctuator&&","===e.value?this.nextToken():e.type===i.Token.Punctuator&&";"===e.value?(this.nextToken(),this.tolerateUnexpectedToken(e)):this.tolerateUnexpectedToken(e,r.Messages.UnexpectedToken)}else this.expect(",")},e.prototype.expectKeyword=function(e){var t=this.nextToken();(t.type!==i.Token.Keyword||t.value!==e)&&this.throwUnexpectedToken(t)},e.prototype.match=function(e){return this.lookahead.type===i.Token.Punctuator&&this.lookahead.value===e},e.prototype.matchKeyword=function(e){return this.lookahead.type===i.Token.Keyword&&this.lookahead.value===e},e.prototype.matchContextualKeyword=function(e){return this.lookahead.type===i.Token.Identifier&&this.lookahead.value===e},e.prototype.matchAssign=function(){if(this.lookahead.type!==i.Token.Punctuator)return!1;var e=this.lookahead.value;return"="===e||"*="===e||"**="===e||"/="===e||"%="===e||"+="===e||"-="===e||"<<="===e||">>="===e||">>>="===e||"&="===e||"^="===e||"|="===e},e.prototype.isolateCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,o=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var r=e.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=t,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=o,r},e.prototype.inheritCoverGrammar=function(e){var t=this.context.isBindingElement,n=this.context.isAssignmentTarget,o=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var r=e.call(this);return this.context.isBindingElement=this.context.isBindingElement&&t,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=o||this.context.firstCoverInitializedNameError,r},e.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():!this.hasLineTerminator&&(this.lookahead.type!==i.Token.EOF&&!this.match("}")&&this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.lineNumber=this.startMarker.lineNumber,this.lastMarker.lineStart=this.startMarker.lineStart)},e.prototype.parsePrimaryExpression=function(){var e=this.createNode(),t,n,o,a;switch(this.lookahead.type){case i.Token.Identifier:"module"===this.sourceType&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),t=this.finalize(e,new l.Identifier(this.nextToken().value));break;case i.Token.NumericLiteral:case i.Token.StringLiteral:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,r.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,o=this.nextToken(),a=this.getTokenRaw(o),t=this.finalize(e,new l.Literal(o.value,a));break;case i.Token.BooleanLiteral:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,o=this.nextToken(),o.value="true"===o.value,a=this.getTokenRaw(o),t=this.finalize(e,new l.Literal(o.value,a));break;case i.Token.NullLiteral:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,o=this.nextToken(),o.value=null,a=this.getTokenRaw(o),t=this.finalize(e,new l.Literal(o.value,a));break;case i.Token.Template:t=this.parseTemplateLiteral();break;case i.Token.Punctuator:n=this.lookahead.value,"("===n?(this.context.isBindingElement=!1,t=this.inheritCoverGrammar(this.parseGroupExpression)):"["===n?t=this.inheritCoverGrammar(this.parseArrayInitializer):"{"===n?t=this.inheritCoverGrammar(this.parseObjectInitializer):"/"===n||"/="===n?(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,o=this.nextRegexToken(),a=this.getTokenRaw(o),t=this.finalize(e,new l.RegexLiteral(o.value,a,o.regex))):this.throwUnexpectedToken(this.nextToken());break;case i.Token.Keyword:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?t=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?t=this.finalize(e,new l.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?t=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),t=this.finalize(e,new l.ThisExpression)):this.matchKeyword("class")?t=this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:this.throwUnexpectedToken(this.nextToken());}return t},e.prototype.parseSpreadElement=function(){var e=this.createNode();this.expect("...");var t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(e,new l.SpreadElement(t))},e.prototype.parseArrayInitializer=function(){var e=this.createNode(),t=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),t.push(null);else if(this.match("...")){var n=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),t.push(n)}else t.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(e,new l.ArrayExpression(t))},e.prototype.parsePropertyMethod=function(e){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var t=this.context.strict,n=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&e.firstRestricted&&this.tolerateUnexpectedToken(e.firstRestricted,e.message),this.context.strict&&e.stricted&&this.tolerateUnexpectedToken(e.stricted,e.message),this.context.strict=t,n},e.prototype.parsePropertyMethodFunction=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!1;var n=this.parseFormalParameters(),o=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new l.FunctionExpression(null,n.params,o,!1))},e.prototype.parseObjectPropertyKey=function(){var e=this.createNode(),t=this.nextToken(),n=null;switch(t.type){case i.Token.StringLiteral:case i.Token.NumericLiteral:this.context.strict&&t.octal&&this.tolerateUnexpectedToken(t,r.Messages.StrictOctalLiteral);var o=this.getTokenRaw(t);n=this.finalize(e,new l.Literal(t.value,o));break;case i.Token.Identifier:case i.Token.BooleanLiteral:case i.Token.NullLiteral:case i.Token.Keyword:n=this.finalize(e,new l.Identifier(t.value));break;case i.Token.Punctuator:"["===t.value?(n=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):this.throwUnexpectedToken(t);break;default:this.throwUnexpectedToken(t);}return n},e.prototype.isPropertyKey=function(e,t){return e.type===d.Syntax.Identifier&&e.name===t||e.type===d.Syntax.Literal&&e.value===t},e.prototype.parseObjectProperty=function(e){var t=this.createNode(),n=this.lookahead,o=!1,a=!1,s=!1,d,p,c;n.type===i.Token.Identifier?(this.nextToken(),p=this.finalize(t,new l.Identifier(n.value))):this.match("*")?this.nextToken():(o=this.match("["),p=this.parseObjectPropertyKey());var u=this.qualifiedPropertyName(this.lookahead);if(n.type===i.Token.Identifier&&"get"===n.value&&u)d="get",o=this.match("["),p=this.parseObjectPropertyKey(),this.context.allowYield=!1,c=this.parseGetterMethod();else if(n.type===i.Token.Identifier&&"set"===n.value&&u)d="set",o=this.match("["),p=this.parseObjectPropertyKey(),c=this.parseSetterMethod();else if(n.type===i.Token.Punctuator&&"*"===n.value&&u)d="init",o=this.match("["),p=this.parseObjectPropertyKey(),c=this.parseGeneratorMethod(),a=!0;else if(p||this.throwUnexpectedToken(this.lookahead),d="init",this.match(":"))!o&&this.isPropertyKey(p,"__proto__")&&(e.value&&this.tolerateError(r.Messages.DuplicateProtoProperty),e.value=!0),this.nextToken(),c=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))c=this.parsePropertyMethodFunction(),a=!0;else if(n.type===i.Token.Identifier){var h=this.finalize(t,new l.Identifier(n.value));if(this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),s=!0;var m=this.isolateCoverGrammar(this.parseAssignmentExpression);c=this.finalize(t,new l.AssignmentPattern(h,m))}else s=!0,c=h}else this.throwUnexpectedToken(this.nextToken());return this.finalize(t,new l.Property(d,p,o,c,a,s))},e.prototype.parseObjectInitializer=function(){var e=this.createNode();this.expect("{");for(var t=[],n={value:!1};!this.match("}");)t.push(this.parseObjectProperty(n)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(e,new l.ObjectExpression(t))},e.prototype.parseTemplateHead=function(){o.assert(this.lookahead.head,"Template literal must start with a template head");var e=this.createNode(),t=this.nextToken(),n={raw:t.value.raw,cooked:t.value.cooked};return this.finalize(e,new l.TemplateElement(n,t.tail))},e.prototype.parseTemplateElement=function(){this.lookahead.type!==i.Token.Template&&this.throwUnexpectedToken();var e=this.createNode(),t=this.nextToken(),n={raw:t.value.raw,cooked:t.value.cooked};return this.finalize(e,new l.TemplateElement(n,t.tail))},e.prototype.parseTemplateLiteral=function(){var e=this.createNode(),t=[],n=[],o=this.parseTemplateHead();for(n.push(o);!o.tail;)t.push(this.parseExpression()),o=this.parseTemplateElement(),n.push(o);return this.finalize(e,new l.TemplateLiteral(n,t))},e.prototype.reinterpretExpressionAsPattern=function(e){switch(e.type){case d.Syntax.Identifier:case d.Syntax.MemberExpression:case d.Syntax.RestElement:case d.Syntax.AssignmentPattern:break;case d.Syntax.SpreadElement:e.type=d.Syntax.RestElement,this.reinterpretExpressionAsPattern(e.argument);break;case d.Syntax.ArrayExpression:e.type=d.Syntax.ArrayPattern;for(var t=0;t<e.elements.length;t++)null!==e.elements[t]&&this.reinterpretExpressionAsPattern(e.elements[t]);break;case d.Syntax.ObjectExpression:e.type=d.Syntax.ObjectPattern;for(var t=0;t<e.properties.length;t++)this.reinterpretExpressionAsPattern(e.properties[t].value);break;case d.Syntax.AssignmentExpression:e.type=d.Syntax.AssignmentPattern,delete e.operator,this.reinterpretExpressionAsPattern(e.left);break;default:}},e.prototype.parseGroupExpression=function(){var e;if(this.expect("("),this.match(")"))this.nextToken(),this.match("=>")||this.expect("=>"),e={type:p,params:[]};else{var t=this.lookahead,n=[];if(this.match("..."))e=this.parseRestElement(n),this.expect(")"),this.match("=>")||this.expect("=>"),e={type:p,params:[e]};else{var o=!1;if(this.context.isBindingElement=!0,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var r=[];for(this.context.isAssignmentTarget=!1,r.push(e);this.startMarker.index<this.scanner.length&&!!this.match(",");){if(this.nextToken(),this.match("...")){this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),r.push(this.parseRestElement(n)),this.expect(")"),this.match("=>")||this.expect("=>"),this.context.isBindingElement=!1;for(var a=0;a<r.length;a++)this.reinterpretExpressionAsPattern(r[a]);o=!0,e={type:p,params:r}}else r.push(this.inheritCoverGrammar(this.parseAssignmentExpression));if(o)break}o||(e=this.finalize(this.startNode(t),new l.SequenceExpression(r)))}if(!o){if(this.expect(")"),this.match("=>")&&(e.type===d.Syntax.Identifier&&"yield"===e.name&&(o=!0,e={type:p,params:[e]}),!o)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),e.type===d.Syntax.SequenceExpression)for(var a=0;a<e.expressions.length;a++)this.reinterpretExpressionAsPattern(e.expressions[a]);else this.reinterpretExpressionAsPattern(e);var i=e.type===d.Syntax.SequenceExpression?e.expressions:[e];e={type:p,params:i}}this.context.isBindingElement=!1}}}return e},e.prototype.parseArguments=function(){this.expect("(");var e=[];if(!this.match(")"))for(;;){var t=this.match("...")?this.parseSpreadElement():this.isolateCoverGrammar(this.parseAssignmentExpression);if(e.push(t),this.match(")"))break;this.expectCommaSeparator()}return this.expect(")"),e},e.prototype.isIdentifierName=function(e){return e.type===i.Token.Identifier||e.type===i.Token.Keyword||e.type===i.Token.BooleanLiteral||e.type===i.Token.NullLiteral},e.prototype.parseIdentifierName=function(){var e=this.createNode(),t=this.nextToken();return this.isIdentifierName(t)||this.throwUnexpectedToken(t),this.finalize(e,new l.Identifier(t.value))},e.prototype.parseNewExpression=function(){var e=this.createNode(),t=this.parseIdentifierName();o.assert("new"===t.name,"New expression must start with `new`");var n;if(!this.match(".")){var r=this.isolateCoverGrammar(this.parseLeftHandSideExpression),a=this.match("(")?this.parseArguments():[];n=new l.NewExpression(r,a),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else if(this.nextToken(),this.lookahead.type===i.Token.Identifier&&this.context.inFunctionBody&&"target"===this.lookahead.value){var s=this.parseIdentifierName();n=new l.MetaProperty(t,s)}else this.throwUnexpectedToken(this.lookahead);return this.finalize(e,n)},e.prototype.parseLeftHandSideExpressionAllowCall=function(){var e=this.lookahead,t=this.context.allowIn;this.context.allowIn=!0;var n;for(this.matchKeyword("super")&&this.context.inFunctionBody?(n=this.createNode(),this.nextToken(),n=this.finalize(n,new l.Super),!this.match("(")&&!this.match(".")&&!this.match("[")&&this.throwUnexpectedToken(this.lookahead)):n=this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression);;)if(this.match(".")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect(".");var o=this.parseIdentifierName();n=this.finalize(this.startNode(e),new l.StaticMemberExpression(n,o))}else if(this.match("(")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!1;var r=this.parseArguments();n=this.finalize(this.startNode(e),new l.CallExpression(n,r))}else if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect("[");var o=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),n=this.finalize(this.startNode(e),new l.ComputedMemberExpression(n,o))}else if(this.lookahead.type===i.Token.Template&&this.lookahead.head){var a=this.parseTemplateLiteral();n=this.finalize(this.startNode(e),new l.TaggedTemplateExpression(n,a))}else break;return this.context.allowIn=t,n},e.prototype.parseSuper=function(){var e=this.createNode();return this.expectKeyword("super"),this.match("[")||this.match(".")||this.throwUnexpectedToken(this.lookahead),this.finalize(e,new l.Super)},e.prototype.parseLeftHandSideExpression=function(){o.assert(this.context.allowIn,"callee of new expression always allow in keyword.");for(var e=this.startNode(this.lookahead),t=this.matchKeyword("super")&&this.context.inFunctionBody?this.parseSuper():this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression);;)if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect("[");var n=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),t=this.finalize(e,new l.ComputedMemberExpression(t,n))}else if(this.match(".")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect(".");var n=this.parseIdentifierName();t=this.finalize(e,new l.StaticMemberExpression(t,n))}else if(this.lookahead.type===i.Token.Template&&this.lookahead.head){var r=this.parseTemplateLiteral();t=this.finalize(e,new l.TaggedTemplateExpression(t,r))}else break;return t},e.prototype.parseUpdateExpression=function(){var e=this.lookahead,t;if(this.match("++")||this.match("--")){var n=this.startNode(e),o=this.nextToken();t=this.inheritCoverGrammar(this.parseUnaryExpression),this.context.strict&&t.type===d.Syntax.Identifier&&this.scanner.isRestrictedWord(t.name)&&this.tolerateError(r.Messages.StrictLHSPrefix),this.context.isAssignmentTarget||this.tolerateError(r.Messages.InvalidLHSInAssignment);var a=!0;t=this.finalize(n,new l.UpdateExpression(o.value,t,a)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else if(t=this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall),!this.hasLineTerminator&&this.lookahead.type===i.Token.Punctuator&&(this.match("++")||this.match("--"))){this.context.strict&&t.type===d.Syntax.Identifier&&this.scanner.isRestrictedWord(t.name)&&this.tolerateError(r.Messages.StrictLHSPostfix),this.context.isAssignmentTarget||this.tolerateError(r.Messages.InvalidLHSInAssignment),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var s=this.nextToken().value,a=!1;t=this.finalize(this.startNode(e),new l.UpdateExpression(s,t,a))}return t},e.prototype.parseUnaryExpression=function(){var e;if(this.match("+")||this.match("-")||this.match("~")||this.match("!")||this.matchKeyword("delete")||this.matchKeyword("void")||this.matchKeyword("typeof")){var t=this.startNode(this.lookahead),n=this.nextToken();e=this.inheritCoverGrammar(this.parseUnaryExpression),e=this.finalize(t,new l.UnaryExpression(n.value,e)),this.context.strict&&"delete"===e.operator&&e.argument.type===d.Syntax.Identifier&&this.tolerateError(r.Messages.StrictDelete),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else e=this.parseUpdateExpression();return e},e.prototype.parseExponentiationExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseUnaryExpression);if(t.type!==d.Syntax.UnaryExpression&&this.match("**")){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var n=t,o=this.isolateCoverGrammar(this.parseExponentiationExpression);t=this.finalize(this.startNode(e),new l.BinaryExpression("**",n,o))}return t},e.prototype.binaryPrecedence=function(e){var t=e.value,n;return n=e.type===i.Token.Punctuator?this.operatorPrecedence[t]||0:e.type===i.Token.Keyword?"instanceof"===t||this.context.allowIn&&"in"===t?7:0:0,n},e.prototype.parseBinaryExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseExponentiationExpression),n=this.lookahead,o=this.binaryPrecedence(n);if(0<o){this.nextToken(),n.prec=o,this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var r=[e,this.lookahead],a=t,s=this.isolateCoverGrammar(this.parseExponentiationExpression),d=[a,n,s];o=this.binaryPrecedence(this.lookahead),!(0>=o);){for(;2<d.length&&o<=d[d.length-2].prec;){s=d.pop();var p=d.pop().value;a=d.pop(),r.pop();var c=this.startNode(r[r.length-1]);d.push(this.finalize(c,new l.BinaryExpression(p,a,s)))}n=this.nextToken(),n.prec=o,d.push(n),r.push(this.lookahead),d.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var u=d.length-1;for(t=d[u],r.pop();1<u;){var c=this.startNode(r.pop());t=this.finalize(c,new l.BinaryExpression(d[u-1].value,d[u-2],t)),u-=2}}return t},e.prototype.parseConditionalExpression=function(){var e=this.lookahead,t=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var n=this.context.allowIn;this.context.allowIn=!0;var o=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");var r=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new l.ConditionalExpression(t,o,r)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return t},e.prototype.checkPatternParam=function(e,t){switch(t.type){case d.Syntax.Identifier:this.validateParam(e,t,t.name);break;case d.Syntax.RestElement:this.checkPatternParam(e,t.argument);break;case d.Syntax.AssignmentPattern:this.checkPatternParam(e,t.left);break;case d.Syntax.ArrayPattern:for(var n=0;n<t.elements.length;n++)null!==t.elements[n]&&this.checkPatternParam(e,t.elements[n]);break;case d.Syntax.YieldExpression:break;default:o.assert(t.type===d.Syntax.ObjectPattern,"Invalid type");for(var n=0;n<t.properties.length;n++)this.checkPatternParam(e,t.properties[n].value);}},e.prototype.reinterpretAsCoverFormalsList=function(e){var t=[e],n;switch(e.type){case d.Syntax.Identifier:break;case p:t=e.params;break;default:return null;}n={paramSet:{}};for(var o=0,a;o<t.length;++o)a=t[o],a.type===d.Syntax.AssignmentPattern&&a.right.type===d.Syntax.YieldExpression&&(a.right.argument&&this.throwUnexpectedToken(this.lookahead),a.right.type=d.Syntax.Identifier,a.right.name="yield",delete a.right.argument,delete a.right.delegate),this.checkPatternParam(n,a),t[o]=a;if(this.context.strict||!this.context.allowYield)for(var o=0,a;o<t.length;++o)a=t[o],a.type===d.Syntax.YieldExpression&&this.throwUnexpectedToken(this.lookahead);if(n.message===r.Messages.StrictParamDupe){var i=this.context.strict?n.stricted:n.firstRestricted;this.throwUnexpectedToken(i,n.message)}return{params:t,stricted:n.stricted,firstRestricted:n.firstRestricted,message:n.message}},e.prototype.parseAssignmentExpression=function(){var e;if(!this.context.allowYield&&this.matchKeyword("yield"))e=this.parseYieldExpression();else{var t=this.lookahead,n=t;if(e=this.parseConditionalExpression(),e.type===p||this.match("=>")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=this.reinterpretAsCoverFormalsList(e);if(o){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var a=this.context.strict,i=this.context.allowYield;this.context.allowYield=!0;var s=this.startNode(t);this.expect("=>");var c=this.match("{")?this.parseFunctionSourceElements():this.isolateCoverGrammar(this.parseAssignmentExpression),u=c.type!==d.Syntax.BlockStatement;this.context.strict&&o.firstRestricted&&this.throwUnexpectedToken(o.firstRestricted,o.message),this.context.strict&&o.stricted&&this.tolerateUnexpectedToken(o.stricted,o.message),e=this.finalize(s,new l.ArrowFunctionExpression(o.params,c,u)),this.context.strict=a,this.context.allowYield=i}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(r.Messages.InvalidLHSInAssignment),this.context.strict&&e.type===d.Syntax.Identifier){var h=e;this.scanner.isRestrictedWord(h.name)&&this.tolerateUnexpectedToken(n,r.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(h.name)&&this.tolerateUnexpectedToken(n,r.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(e):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1),n=this.nextToken();var m=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new l.AssignmentExpression(n.value,e,m)),this.context.firstCoverInitializedNameError=null}}return e},e.prototype.parseExpression=function(){var e=this.lookahead,t=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){for(var n=[t];this.startMarker.index<this.scanner.length&&!!this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));t=this.finalize(this.startNode(e),new l.SequenceExpression(n))}return t},e.prototype.parseStatementListItem=function(){var e=null;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,this.lookahead.type===i.Token.Keyword)switch(this.lookahead.value){case"export":"module"!==this.sourceType&&this.tolerateUnexpectedToken(this.lookahead,r.Messages.IllegalExportDeclaration),e=this.parseExportDeclaration();break;case"import":"module"!==this.sourceType&&this.tolerateUnexpectedToken(this.lookahead,r.Messages.IllegalImportDeclaration),e=this.parseImportDeclaration();break;case"const":e=this.parseLexicalDeclaration({inFor:!1});break;case"function":e=this.parseFunctionDeclaration();break;case"class":e=this.parseClassDeclaration();break;case"let":e=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:e=this.parseStatement();}else e=this.parseStatement();return e},e.prototype.parseBlock=function(){var e=this.createNode();this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.finalize(e,new l.BlockStatement(t))},e.prototype.parseLexicalBinding=function(e,t){var n=this.createNode(),o=this.parsePattern([],e);this.context.strict&&o.type===d.Syntax.Identifier&&this.scanner.isRestrictedWord(o.name)&&this.tolerateError(r.Messages.StrictVarName);var a=null;return"const"===e?!this.matchKeyword("in")&&!this.matchContextualKeyword("of")&&(this.expect("="),a=this.isolateCoverGrammar(this.parseAssignmentExpression)):(!t.inFor&&o.type!==d.Syntax.Identifier||this.match("="))&&(this.expect("="),a=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new l.VariableDeclarator(o,a))},e.prototype.parseBindingList=function(e,t){for(var n=[this.parseLexicalBinding(e,t)];this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(e,t));return n},e.prototype.isLexicalDeclaration=function(){var e=this.scanner.index,t=this.scanner.lineNumber,n=this.scanner.lineStart;this.collectComments();var o=this.scanner.lex();return this.scanner.index=e,this.scanner.lineNumber=t,this.scanner.lineStart=n,o.type===i.Token.Identifier||o.type===i.Token.Punctuator&&"["===o.value||o.type===i.Token.Punctuator&&"{"===o.value||o.type===i.Token.Keyword&&"let"===o.value||o.type===i.Token.Keyword&&"yield"===o.value},e.prototype.parseLexicalDeclaration=function(e){var t=this.createNode(),n=this.nextToken().value;o.assert("let"===n||"const"===n,"Lexical declaration must be either let or const");var r=this.parseBindingList(n,e);return this.consumeSemicolon(),this.finalize(t,new l.VariableDeclaration(r,n))},e.prototype.parseBindingRestElement=function(e,t){var n=this.createNode();this.expect("..."),e.push(this.lookahead);var o=this.parseVariableIdentifier(t);return this.finalize(n,new l.RestElement(o))},e.prototype.parseArrayPattern=function(e,t){var n=this.createNode();this.expect("[");for(var o=[];!this.match("]");)if(this.match(","))this.nextToken(),o.push(null);else{if(this.match("...")){o.push(this.parseBindingRestElement(e,t));break}else o.push(this.parsePatternWithDefault(e,t));this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new l.ArrayPattern(o))},e.prototype.parsePropertyPattern=function(e,t){var n=this.createNode(),o=!1,r=!1,a,s;if(this.lookahead.type===i.Token.Identifier){var d=this.lookahead;a=this.parseVariableIdentifier();var p=this.finalize(n,new l.Identifier(d.value));if(this.match("=")){e.push(d),r=!0,this.nextToken();var c=this.parseAssignmentExpression();s=this.finalize(this.startNode(d),new l.AssignmentPattern(p,c))}else this.match(":")?(this.expect(":"),s=this.parsePatternWithDefault(e,t)):(e.push(d),r=!0,s=p)}else o=this.match("["),a=this.parseObjectPropertyKey(),this.expect(":"),s=this.parsePatternWithDefault(e,t);return this.finalize(n,new l.Property("init",a,o,s,!1,r))},e.prototype.parseObjectPattern=function(e,t){var n=this.createNode(),o=[];for(this.expect("{");!this.match("}");)o.push(this.parsePropertyPattern(e,t)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new l.ObjectPattern(o))},e.prototype.parsePattern=function(e,t){var n;return this.match("[")?n=this.parseArrayPattern(e,t):this.match("{")?n=this.parseObjectPattern(e,t):(this.matchKeyword("let")&&("const"===t||"let"===t)&&this.tolerateUnexpectedToken(this.lookahead,r.Messages.UnexpectedToken),e.push(this.lookahead),n=this.parseVariableIdentifier(t)),n},e.prototype.parsePatternWithDefault=function(e,t){var n=this.lookahead,o=this.parsePattern(e,t);if(this.match("=")){this.nextToken();var r=this.context.allowYield;this.context.allowYield=!0;var a=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=r,o=this.finalize(this.startNode(n),new l.AssignmentPattern(o,a))}return o},e.prototype.parseVariableIdentifier=function(e){var t=this.createNode(),n=this.nextToken();return n.type===i.Token.Keyword&&"yield"===n.value?(this.context.strict&&this.tolerateUnexpectedToken(n,r.Messages.StrictReservedWord),!this.context.allowYield&&this.throwUnexpectedToken(n)):n.type===i.Token.Identifier?"module"===this.sourceType&&n.type===i.Token.Identifier&&"await"===n.value&&this.tolerateUnexpectedToken(n):this.context.strict&&n.type===i.Token.Keyword&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,r.Messages.StrictReservedWord):(this.context.strict||"let"!==n.value||"var"!==e)&&this.throwUnexpectedToken(n),this.finalize(t,new l.Identifier(n.value))},e.prototype.parseVariableDeclaration=function(e){var t=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===d.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(r.Messages.StrictVarName);var o=null;return this.match("=")?(this.nextToken(),o=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type!==d.Syntax.Identifier&&!e.inFor&&this.expect("="),this.finalize(t,new l.VariableDeclarator(n,o))},e.prototype.parseVariableDeclarationList=function(e){var t={inFor:e.inFor},n=[];for(n.push(this.parseVariableDeclaration(t));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(t));return n},e.prototype.parseVariableStatement=function(){var e=this.createNode();this.expectKeyword("var");var t=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(e,new l.VariableDeclaration(t,"var"))},e.prototype.parseEmptyStatement=function(){var e=this.createNode();return this.expect(";"),this.finalize(e,new l.EmptyStatement)},e.prototype.parseExpressionStatement=function(){var e=this.createNode(),t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new l.ExpressionStatement(t))},e.prototype.parseIfStatement=function(){var e=this.createNode(),t=null,n;this.expectKeyword("if"),this.expect("(");var o=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),n=this.finalize(this.createNode(),new l.EmptyStatement)):(this.expect(")"),n=this.parseStatement(),this.matchKeyword("else")&&(this.nextToken(),t=this.parseStatement())),this.finalize(e,new l.IfStatement(o,n,t))},e.prototype.parseDoWhileStatement=function(){var e=this.createNode();this.expectKeyword("do");var t=this.context.inIteration;this.context.inIteration=!0;var n=this.parseStatement();this.context.inIteration=t,this.expectKeyword("while"),this.expect("(");var o=this.parseExpression();return this.expect(")"),this.match(";")&&this.nextToken(),this.finalize(e,new l.DoWhileStatement(n,o))},e.prototype.parseWhileStatement=function(){var e=this.createNode(),t;this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),t=this.finalize(this.createNode(),new l.EmptyStatement);else{this.expect(")");var o=this.context.inIteration;this.context.inIteration=!0,t=this.parseStatement(),this.context.inIteration=o}return this.finalize(e,new l.WhileStatement(n,t))},e.prototype.parseForStatement=function(){var e=null,t=null,n=null,o=!0,a=this.createNode(),i,s;if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){e=this.createNode(),this.nextToken();var p=this.context.allowIn;this.context.allowIn=!1;var c=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=p,1===c.length&&this.matchKeyword("in")){var u=c[0];u.init&&(u.id.type===d.Syntax.ArrayPattern||u.id.type===d.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(r.Messages.ForInOfLoopInitializer,"for-in"),e=this.finalize(e,new l.VariableDeclaration(c,"var")),this.nextToken(),i=e,s=this.parseExpression(),e=null}else 1===c.length&&null===c[0].init&&this.matchContextualKeyword("of")?(e=this.finalize(e,new l.VariableDeclaration(c,"var")),this.nextToken(),i=e,s=this.parseAssignmentExpression(),e=null,o=!1):(e=this.finalize(e,new l.VariableDeclaration(c,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){e=this.createNode();var h=this.nextToken().value;if(!this.context.strict&&"in"===this.lookahead.value)e=this.finalize(e,new l.Identifier(h)),this.nextToken(),i=e,s=this.parseExpression(),e=null;else{var p=this.context.allowIn;this.context.allowIn=!1;var c=this.parseBindingList(h,{inFor:!0});this.context.allowIn=p,1===c.length&&null===c[0].init&&this.matchKeyword("in")?(e=this.finalize(e,new l.VariableDeclaration(c,h)),this.nextToken(),i=e,s=this.parseExpression(),e=null):1===c.length&&null===c[0].init&&this.matchContextualKeyword("of")?(e=this.finalize(e,new l.VariableDeclaration(c,h)),this.nextToken(),i=e,s=this.parseAssignmentExpression(),e=null,o=!1):(this.consumeSemicolon(),e=this.finalize(e,new l.VariableDeclaration(c,h)))}}else{var m=this.lookahead,p=this.context.allowIn;if(this.context.allowIn=!1,e=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=p,this.matchKeyword("in"))this.context.isAssignmentTarget&&e.type!==d.Syntax.AssignmentExpression||this.tolerateError(r.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(e),i=e,s=this.parseExpression(),e=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&e.type!==d.Syntax.AssignmentExpression||this.tolerateError(r.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(e),i=e,s=this.parseAssignmentExpression(),e=null,o=!1;else{if(this.match(",")){for(var g=[e];this.match(",");)this.nextToken(),g.push(this.isolateCoverGrammar(this.parseAssignmentExpression));e=this.finalize(this.startNode(m),new l.SequenceExpression(g))}this.expect(";")}}"undefined"==typeof i&&(!this.match(";")&&(t=this.parseExpression()),this.expect(";"),!this.match(")")&&(n=this.parseExpression()));var f;if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),f=this.finalize(this.createNode(),new l.EmptyStatement);else{this.expect(")");var y=this.context.inIteration;this.context.inIteration=!0,f=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=y}return"undefined"==typeof i?this.finalize(a,new l.ForStatement(e,t,n,f)):o?this.finalize(a,new l.ForInStatement(i,s,f)):this.finalize(a,new l.ForOfStatement(i,s,f))},e.prototype.parseContinueStatement=function(){var e=this.createNode();this.expectKeyword("continue");var t=null;if(this.lookahead.type===i.Token.Identifier&&!this.hasLineTerminator){t=this.parseVariableIdentifier();var n="$"+t.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(r.Messages.UnknownLabel,t.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.throwError(r.Messages.IllegalContinue),this.finalize(e,new l.ContinueStatement(t))},e.prototype.parseBreakStatement=function(){var e=this.createNode();this.expectKeyword("break");var t=null;if(this.lookahead.type===i.Token.Identifier&&!this.hasLineTerminator){t=this.parseVariableIdentifier();var n="$"+t.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(r.Messages.UnknownLabel,t.name)}return this.consumeSemicolon(),null!==t||this.context.inIteration||this.context.inSwitch||this.throwError(r.Messages.IllegalBreak),this.finalize(e,new l.BreakStatement(t))},e.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(r.Messages.IllegalReturn);var e=this.createNode();this.expectKeyword("return");var t=!this.match(";")&&!this.match("}")&&!this.hasLineTerminator&&this.lookahead.type!==i.Token.EOF,n=t?this.parseExpression():null;return this.consumeSemicolon(),this.finalize(e,new l.ReturnStatement(n))},e.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(r.Messages.StrictModeWith);var e=this.createNode();this.expectKeyword("with"),this.expect("(");var t=this.parseExpression();this.expect(")");var n=this.parseStatement();return this.finalize(e,new l.WithStatement(t,n))},e.prototype.parseSwitchCase=function(){var e=this.createNode(),t;this.matchKeyword("default")?(this.nextToken(),t=null):(this.expectKeyword("case"),t=this.parseExpression()),this.expect(":");for(var n=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(e,new l.SwitchCase(t,n))},e.prototype.parseSwitchStatement=function(){var e=this.createNode();this.expectKeyword("switch"),this.expect("(");var t=this.parseExpression();this.expect(")");var n=this.context.inSwitch;this.context.inSwitch=!0;var o=[],a=!1;for(this.expect("{");!this.match("}");){var i=this.parseSwitchCase();null===i.test&&(a&&this.throwError(r.Messages.MultipleDefaultsInSwitch),a=!0),o.push(i)}return this.expect("}"),this.context.inSwitch=n,this.finalize(e,new l.SwitchStatement(t,o))},e.prototype.parseLabelledStatement=function(){var e=this.createNode(),t=this.parseExpression(),n;if(t.type===d.Syntax.Identifier&&this.match(":")){this.nextToken();var o=t,a="$"+o.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,a)&&this.throwError(r.Messages.Redeclaration,"Label",o.name),this.context.labelSet[a]=!0;var i=this.parseStatement();delete this.context.labelSet[a],n=new l.LabeledStatement(o,i)}else this.consumeSemicolon(),n=new l.ExpressionStatement(t);return this.finalize(e,n)},e.prototype.parseThrowStatement=function(){var e=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(r.Messages.NewlineAfterThrow);var t=this.parseExpression();return this.consumeSemicolon(),this.finalize(e,new l.ThrowStatement(t))},e.prototype.parseCatchClause=function(){var e=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var t=[],n=this.parsePattern(t),o={},a=0,i;a<t.length;a++)i="$"+t[a].value,Object.prototype.hasOwnProperty.call(o,i)&&this.tolerateError(r.Messages.DuplicateBinding,t[a].value),o[i]=!0;this.context.strict&&n.type===d.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(r.Messages.StrictCatchVariable),this.expect(")");var s=this.parseBlock();return this.finalize(e,new l.CatchClause(n,s))},e.prototype.parseFinallyClause=function(){return this.expectKeyword("finally"),this.parseBlock()},e.prototype.parseTryStatement=function(){var e=this.createNode();this.expectKeyword("try");var t=this.parseBlock(),n=this.matchKeyword("catch")?this.parseCatchClause():null,o=this.matchKeyword("finally")?this.parseFinallyClause():null;return n||o||this.throwError(r.Messages.NoCatchOrFinally),this.finalize(e,new l.TryStatement(t,n,o))},e.prototype.parseDebuggerStatement=function(){var e=this.createNode();return this.expectKeyword("debugger"),this.consumeSemicolon(),this.finalize(e,new l.DebuggerStatement)},e.prototype.parseStatement=function(){var e=null;switch(this.lookahead.type){case i.Token.BooleanLiteral:case i.Token.NullLiteral:case i.Token.NumericLiteral:case i.Token.StringLiteral:case i.Token.Template:case i.Token.RegularExpression:e=this.parseExpressionStatement();break;case i.Token.Punctuator:var t=this.lookahead.value;e="{"===t?this.parseBlock():"("===t?this.parseExpressionStatement():";"===t?this.parseEmptyStatement():this.parseExpressionStatement();break;case i.Token.Identifier:e=this.parseLabelledStatement();break;case i.Token.Keyword:switch(this.lookahead.value){case"break":e=this.parseBreakStatement();break;case"continue":e=this.parseContinueStatement();break;case"debugger":e=this.parseDebuggerStatement();break;case"do":e=this.parseDoWhileStatement();break;case"for":e=this.parseForStatement();break;case"function":e=this.parseFunctionDeclaration();break;case"if":e=this.parseIfStatement();break;case"return":e=this.parseReturnStatement();break;case"switch":e=this.parseSwitchStatement();break;case"throw":e=this.parseThrowStatement();break;case"try":e=this.parseTryStatement();break;case"var":e=this.parseVariableStatement();break;case"while":e=this.parseWhileStatement();break;case"with":e=this.parseWithStatement();break;default:e=this.parseExpressionStatement();}break;default:this.throwUnexpectedToken(this.lookahead);}return e},e.prototype.parseFunctionSourceElements=function(){var e=this.createNode();this.expect("{");var t=this.parseDirectivePrologues(),n=this.context.labelSet,o=this.context.inIteration,r=this.context.inSwitch,a=this.context.inFunctionBody;for(this.context.labelSet={},this.context.inIteration=!1,this.context.inSwitch=!1,this.context.inFunctionBody=!0;this.startMarker.index<this.scanner.length&&!this.match("}");)t.push(this.parseStatementListItem());return this.expect("}"),this.context.labelSet=n,this.context.inIteration=o,this.context.inSwitch=r,this.context.inFunctionBody=a,this.finalize(e,new l.BlockStatement(t))},e.prototype.validateParam=function(e,t,n){var o="$"+n;this.context.strict?(this.scanner.isRestrictedWord(n)&&(e.stricted=t,e.message=r.Messages.StrictParamName),Object.prototype.hasOwnProperty.call(e.paramSet,o)&&(e.stricted=t,e.message=r.Messages.StrictParamDupe)):!e.firstRestricted&&(this.scanner.isRestrictedWord(n)?(e.firstRestricted=t,e.message=r.Messages.StrictParamName):this.scanner.isStrictModeReservedWord(n)?(e.firstRestricted=t,e.message=r.Messages.StrictReservedWord):Object.prototype.hasOwnProperty.call(e.paramSet,o)&&(e.stricted=t,e.message=r.Messages.StrictParamDupe)),"function"==typeof Object.defineProperty?Object.defineProperty(e.paramSet,o,{value:!0,enumerable:!0,writable:!0,configurable:!0}):e.paramSet[o]=!0},e.prototype.parseRestElement=function(e){var t=this.createNode();this.nextToken(),this.match("{")&&this.throwError(r.Messages.ObjectPatternAsRestParameter),e.push(this.lookahead);var n=this.parseVariableIdentifier();return this.match("=")&&this.throwError(r.Messages.DefaultRestParameter),this.match(")")||this.throwError(r.Messages.ParameterAfterRestParameter),this.finalize(t,new l.RestElement(n))},e.prototype.parseFormalParameter=function(e){var t=[],n=this.lookahead,o;if("..."===n.value)return o=this.parseRestElement(t),this.validateParam(e,o.argument,o.argument.name),e.params.push(o),!1;o=this.parsePatternWithDefault(t);for(var r=0;r<t.length;r++)this.validateParam(e,t[r],t[r].value);return e.params.push(o),!this.match(")")},e.prototype.parseFormalParameters=function(e){var t;if(t={params:[],firstRestricted:e},this.expect("("),!this.match(")"))for(t.paramSet={};this.startMarker.index<this.scanner.length&&!!this.parseFormalParameter(t);)this.expect(",");return this.expect(")"),{params:t.params,stricted:t.stricted,firstRestricted:t.firstRestricted,message:t.message}},e.prototype.parseFunctionDeclaration=function(e){var t=this.createNode();this.expectKeyword("function");var n=this.match("*");n&&this.nextToken();var o=null,a=null,i;if(!e||!this.match("(")){var s=this.lookahead;o=this.parseVariableIdentifier(),this.context.strict?this.scanner.isRestrictedWord(s.value)&&this.tolerateUnexpectedToken(s,r.Messages.StrictFunctionName):this.scanner.isRestrictedWord(s.value)?(a=s,i=r.Messages.StrictFunctionName):this.scanner.isStrictModeReservedWord(s.value)&&(a=s,i=r.Messages.StrictReservedWord)}var d=this.context.allowYield;this.context.allowYield=!n;var p=this.parseFormalParameters(a),c=p.params,u=p.stricted;a=p.firstRestricted,p.message&&(i=p.message);var h=this.context.strict,m=this.parseFunctionSourceElements();return this.context.strict&&a&&this.throwUnexpectedToken(a,i),this.context.strict&&u&&this.tolerateUnexpectedToken(u,i),this.context.strict=h,this.context.allowYield=d,this.finalize(t,new l.FunctionDeclaration(o,c,m,n))},e.prototype.parseFunctionExpression=function(){var e=this.createNode();this.expectKeyword("function");var t=this.match("*");t&&this.nextToken();var n=null,o=this.context.allowYield,a,i;if(this.context.allowYield=!t,!this.match("(")){var s=this.lookahead;n=this.context.strict||t||!this.matchKeyword("yield")?this.parseVariableIdentifier():this.parseIdentifierName(),this.context.strict?this.scanner.isRestrictedWord(s.value)&&this.tolerateUnexpectedToken(s,r.Messages.StrictFunctionName):this.scanner.isRestrictedWord(s.value)?(i=s,a=r.Messages.StrictFunctionName):this.scanner.isStrictModeReservedWord(s.value)&&(i=s,a=r.Messages.StrictReservedWord)}var d=this.parseFormalParameters(i),p=d.params,c=d.stricted;i=d.firstRestricted,d.message&&(a=d.message);var u=this.context.strict,h=this.parseFunctionSourceElements();return this.context.strict&&i&&this.throwUnexpectedToken(i,a),this.context.strict&&c&&this.tolerateUnexpectedToken(c,a),this.context.strict=u,this.context.allowYield=o,this.finalize(e,new l.FunctionExpression(n,p,h,t))},e.prototype.parseDirective=function(){var e=this.lookahead,t=null,n=this.createNode(),o=this.parseExpression();return o.type===d.Syntax.Literal&&(t=this.getTokenRaw(e).slice(1,-1)),this.consumeSemicolon(),this.finalize(n,t?new l.Directive(o,t):new l.ExpressionStatement(o))},e.prototype.parseDirectivePrologues=function(){for(var e=null,t=[],n,o;n=this.lookahead,n.type===i.Token.StringLiteral;){o=this.parseDirective(),t.push(o);var a=o.directive;if("string"!=typeof a)break;"use strict"===a?(this.context.strict=!0,e&&this.tolerateUnexpectedToken(e,r.Messages.StrictOctalLiteral)):!e&&n.octal&&(e=n)}return t},e.prototype.qualifiedPropertyName=function(e){switch(e.type){case i.Token.Identifier:case i.Token.StringLiteral:case i.Token.BooleanLiteral:case i.Token.NullLiteral:case i.Token.NumericLiteral:case i.Token.Keyword:return!0;case i.Token.Punctuator:return"["===e.value;}return!1},e.prototype.parseGetterMethod=function(){var e=this.createNode();this.expect("("),this.expect(")");var t={params:[],stricted:null,firstRestricted:null,message:null},n=this.context.allowYield;this.context.allowYield=!1;var o=this.parsePropertyMethod(t);return this.context.allowYield=n,this.finalize(e,new l.FunctionExpression(null,t.params,o,!1))},e.prototype.parseSetterMethod=function(){var e=this.createNode(),t={params:[],firstRestricted:null,paramSet:{}},n=this.context.allowYield;this.context.allowYield=!1,this.expect("("),this.match(")")?this.tolerateUnexpectedToken(this.lookahead):this.parseFormalParameter(t),this.expect(")");var o=this.parsePropertyMethod(t);return this.context.allowYield=n,this.finalize(e,new l.FunctionExpression(null,t.params,o,!1))},e.prototype.parseGeneratorMethod=function(){var e=this.createNode(),t=this.context.allowYield;this.context.allowYield=!0;var n=this.parseFormalParameters();this.context.allowYield=!1;var o=this.parsePropertyMethod(n);return this.context.allowYield=t,this.finalize(e,new l.FunctionExpression(null,n.params,o,!0))},e.prototype.parseYieldExpression=function(){var e=this.createNode();this.expectKeyword("yield");var t=null,n=!1;if(!this.hasLineTerminator){var o=this.context.allowYield;this.context.allowYield=!1,n=this.match("*"),n?(this.nextToken(),t=this.parseAssignmentExpression()):!this.match(";")&&!this.match("}")&&!this.match(")")&&this.lookahead.type!==i.Token.EOF&&(t=this.parseAssignmentExpression()),this.context.allowYield=o}return this.finalize(e,new l.YieldExpression(t,n))},e.prototype.parseClassElement=function(e){var t=this.lookahead,n=this.createNode(),o=!1,a=!1,s=!1,d,p,c;if(this.match("*"))this.nextToken();else{o=this.match("["),p=this.parseObjectPropertyKey();var u=p;"static"===u.name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(t=this.lookahead,s=!0,o=this.match("["),this.match("*")?this.nextToken():p=this.parseObjectPropertyKey())}var h=this.qualifiedPropertyName(this.lookahead);return t.type===i.Token.Identifier?"get"===t.value&&h?(d="get",o=this.match("["),p=this.parseObjectPropertyKey(),this.context.allowYield=!1,c=this.parseGetterMethod()):"set"===t.value&&h&&(d="set",o=this.match("["),p=this.parseObjectPropertyKey(),c=this.parseSetterMethod()):t.type===i.Token.Punctuator&&"*"===t.value&&h&&(d="init",o=this.match("["),p=this.parseObjectPropertyKey(),c=this.parseGeneratorMethod(),a=!0),!d&&p&&this.match("(")&&(d="init",c=this.parsePropertyMethodFunction(),a=!0),d||this.throwUnexpectedToken(this.lookahead),"init"===d&&(d="method"),o||(s&&this.isPropertyKey(p,"prototype")&&this.throwUnexpectedToken(t,r.Messages.StaticPrototype),!s&&this.isPropertyKey(p,"constructor")&&(("method"!==d||!a||c.generator)&&this.throwUnexpectedToken(t,r.Messages.ConstructorSpecialMethod),e.value?this.throwUnexpectedToken(t,r.Messages.DuplicateConstructor):e.value=!0,d="constructor")),this.finalize(n,new l.MethodDefinition(p,o,c,d,s))},e.prototype.parseClassElementList=function(){var e=[],t={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():e.push(this.parseClassElement(t));return this.expect("}"),e},e.prototype.parseClassBody=function(){var e=this.createNode(),t=this.parseClassElementList();return this.finalize(e,new l.ClassBody(t))},e.prototype.parseClassDeclaration=function(e){var t=this.createNode(),n=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var o=e&&this.lookahead.type!==i.Token.Identifier?null:this.parseVariableIdentifier(),r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var a=this.parseClassBody();return this.context.strict=n,this.finalize(t,new l.ClassDeclaration(o,r,a))},e.prototype.parseClassExpression=function(){var e=this.createNode(),t=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=this.lookahead.type===i.Token.Identifier?this.parseVariableIdentifier():null,o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var r=this.parseClassBody();return this.context.strict=t,this.finalize(e,new l.ClassExpression(n,o,r))},e.prototype.parseProgram=function(){for(var e=this.createNode(),t=this.parseDirectivePrologues();this.startMarker.index<this.scanner.length;)t.push(this.parseStatementListItem());return this.finalize(e,new l.Program(t,this.sourceType))},e.prototype.parseModuleSpecifier=function(){var e=this.createNode();this.lookahead.type!==i.Token.StringLiteral&&this.throwError(r.Messages.InvalidModuleSpecifier);var t=this.nextToken(),n=this.getTokenRaw(t);return this.finalize(e,new l.Literal(t.value,n))},e.prototype.parseImportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),n;return this.matchContextualKeyword("as")?(this.nextToken(),n=this.parseVariableIdentifier()):n=t,this.finalize(e,new l.ImportSpecifier(n,t))},e.prototype.parseNamedImports=function(){this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),e},e.prototype.parseImportDefaultSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName();return this.finalize(e,new l.ImportDefaultSpecifier(t))},e.prototype.parseImportNamespaceSpecifier=function(){var e=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(r.Messages.NoAsAfterImportNamespace),this.nextToken();var t=this.parseIdentifierName();return this.finalize(e,new l.ImportNamespaceSpecifier(t))},e.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(r.Messages.IllegalImportDeclaration);var e=this.createNode();this.expectKeyword("import");var t=[],n;if(this.lookahead.type===i.Token.StringLiteral)n=this.parseModuleSpecifier();else{if(this.match("{")?t=t.concat(this.parseNamedImports()):this.match("*")?t.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(t.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?t.push(this.parseImportNamespaceSpecifier()):this.match("{")?t=t.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var o=this.lookahead.value?r.Messages.UnexpectedToken:r.Messages.MissingFromClause;this.throwError(o,this.lookahead.value)}this.nextToken(),n=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(e,new l.ImportDeclaration(t,n))},e.prototype.parseExportSpecifier=function(){var e=this.createNode(),t=this.parseIdentifierName(),n=t;return this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseIdentifierName()),this.finalize(e,new l.ExportSpecifier(t,n))},e.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(r.Messages.IllegalExportDeclaration);var e=this.createNode();this.expectKeyword("export");var t;if(this.matchKeyword("default")){if(this.nextToken(),this.matchKeyword("function")){var n=this.parseFunctionDeclaration(!0);t=this.finalize(e,new l.ExportDefaultDeclaration(n))}else if(this.matchKeyword("class")){var n=this.parseClassDeclaration(!0);t=this.finalize(e,new l.ExportDefaultDeclaration(n))}else{this.matchContextualKeyword("from")&&this.throwError(r.Messages.UnexpectedToken,this.lookahead.value);var n=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression();this.consumeSemicolon(),t=this.finalize(e,new l.ExportDefaultDeclaration(n))}}else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var o=this.lookahead.value?r.Messages.UnexpectedToken:r.Messages.MissingFromClause;this.throwError(o,this.lookahead.value)}this.nextToken();var a=this.parseModuleSpecifier();this.consumeSemicolon(),t=this.finalize(e,new l.ExportAllDeclaration(a))}else if(this.lookahead.type===i.Token.Keyword){var n=void 0;switch(this.lookahead.value){case"let":case"const":n=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":n=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead);}t=this.finalize(e,new l.ExportNamedDeclaration(n,[],null))}else{var s=[],d=null,p=!1;for(this.expect("{");!this.match("}");)p=p||this.matchKeyword("default"),s.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");if(this.expect("}"),this.matchContextualKeyword("from"))this.nextToken(),d=this.parseModuleSpecifier(),this.consumeSemicolon();else if(p){var o=this.lookahead.value?r.Messages.UnexpectedToken:r.Messages.MissingFromClause;this.throwError(o,this.lookahead.value)}else this.consumeSemicolon();t=this.finalize(e,new l.ExportNamedDeclaration(null,s,d))}return t},e}();t.Parser=c},function(e,t){"use strict";t.assert=function(e,t){if(!e)throw new Error("ASSERT: "+t)}},function(e,t){"use strict";t.Messages={UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",DefaultRestParameter:"Unexpected token =",ObjectPatternAsRestParameter:"Unexpected token {",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ConstructorSpecialMethod:"Class constructor may not be an accessor",DuplicateConstructor:"A class may only have one constructor",StaticPrototype:"Classes may not have static property named prototype",MissingFromClause:"Unexpected token",NoAsAfterImportNamespace:"Unexpected token",InvalidModuleSpecifier:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalExportDeclaration:"Unexpected token",DuplicateBinding:"Duplicate binding %0",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer"}},function(e,t){"use strict";var n=function(){function e(){this.errors=[],this.tolerant=!1}return e.prototype.recordError=function(e){this.errors.push(e)},e.prototype.tolerate=function(e){if(this.tolerant)this.recordError(e);else throw e},e.prototype.constructError=function(e,t){var n=new Error(e);try{throw n}catch(e){Object.create&&Object.defineProperty&&(n=Object.create(e),Object.defineProperty(n,"column",{value:t}))}finally{return n}},e.prototype.createError=function(e,t,n,o){var r=this.constructError("Line "+t+": "+o,n);return r.index=e,r.lineNumber=t,r.description=o,r},e.prototype.throwError=function(e,t,n,o){throw this.createError(e,t,n,o)},(e.prototype.tolerateError=function(e,t,n,o){var r=this.createError(e,t,n,o);if(this.tolerant)this.recordError(r);else throw r},e)}();t.ErrorHandler=n},function(e,t){"use strict";(function(e){e[e.BooleanLiteral=1]="BooleanLiteral",e[e.EOF=2]="EOF",e[e.Identifier=3]="Identifier",e[e.Keyword=4]="Keyword",e[e.NullLiteral=5]="NullLiteral",e[e.NumericLiteral=6]="NumericLiteral",e[e.Punctuator=7]="Punctuator",e[e.StringLiteral=8]="StringLiteral",e[e.RegularExpression=9]="RegularExpression",e[e.Template=10]="Template"})(t.Token||(t.Token={}));var n=t.Token;t.TokenName={},t.TokenName[n.BooleanLiteral]="Boolean",t.TokenName[n.EOF]="<end>",t.TokenName[n.Identifier]="Identifier",t.TokenName[n.Keyword]="Keyword",t.TokenName[n.NullLiteral]="Null",t.TokenName[n.NumericLiteral]="Numeric",t.TokenName[n.Punctuator]="Punctuator",t.TokenName[n.StringLiteral]="String",t.TokenName[n.RegularExpression]="RegularExpression",t.TokenName[n.Template]="Template"},function(t,n,o){"use strict";function r(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function a(e){return"01234567".indexOf(e)}var i=o(4),s=o(5),d=o(9),l=o(7),p=function(){function t(e,t){this.source=e,this.errorHandler=t,this.trackComment=!1,this.length=e.length,this.index=0,this.lineNumber=0<e.length?1:0,this.lineStart=0,this.curlyStack=[]}return t.prototype.eof=function(){return this.index>=this.length},t.prototype.throwUnexpectedToken=function(e){void 0===e&&(e=s.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,e)},t.prototype.tolerateUnexpectedToken=function(){this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,s.Messages.UnexpectedTokenIllegal)},t.prototype.skipSingleLineComment=function(e){var t,n,o;for(this.trackComment&&(t=[],n=this.index-e,o={start:{line:this.lineNumber,column:this.index-this.lineStart-e},end:{}});!this.eof();){var r=this.source.charCodeAt(this.index);if(++this.index,d.Character.isLineTerminator(r)){if(this.trackComment){o.end={line:this.lineNumber,column:this.index-this.lineStart-1};var a={multiLine:!1,slice:[n+e,this.index-1],range:[n,this.index-1],loc:o};t.push(a)}return 13===r&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t}}if(this.trackComment){o.end={line:this.lineNumber,column:this.index-this.lineStart};var a={multiLine:!1,slice:[n+e,this.index],range:[n,this.index],loc:o};t.push(a)}return t},t.prototype.skipMultiLineComment=function(){var e,t,n;for(this.trackComment&&(e=[],t=this.index-2,n={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var o=this.source.charCodeAt(this.index);if(d.Character.isLineTerminator(o))13===o&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===o){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart};var r={multiLine:!0,slice:[t+2,this.index-2],range:[t,this.index],loc:n};e.push(r)}return e}++this.index}else++this.index}if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart};var r={multiLine:!0,slice:[t+2,this.index],range:[t,this.index],loc:n};e.push(r)}return this.tolerateUnexpectedToken(),e},t.prototype.scanComments=function(){var e;this.trackComment&&(e=[]);for(var t=0===this.index,n;!this.eof();)if(n=this.source.charCodeAt(this.index),d.Character.isWhiteSpace(n))++this.index;else if(d.Character.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,t=!0;else if(47===n){if(n=this.source.charCodeAt(this.index+1),47===n){this.index+=2;var o=this.skipSingleLineComment(2);this.trackComment&&(e=e.concat(o)),t=!0}else if(42===n){this.index+=2;var o=this.skipMultiLineComment();this.trackComment&&(e=e.concat(o))}else break;}else if(t&&45===n){if(45===this.source.charCodeAt(this.index+1)&&62===this.source.charCodeAt(this.index+2)){this.index+=3;var o=this.skipSingleLineComment(3);this.trackComment&&(e=e.concat(o))}else break;}else if(60!==n)break;else if("!--"===this.source.slice(this.index+1,this.index+4)){this.index+=4;var o=this.skipSingleLineComment(4);this.trackComment&&(e=e.concat(o))}else break;return e},t.prototype.isFutureReservedWord=function(e){return"enum"===e||"export"===e||"import"===e||"super"===e},t.prototype.isStrictModeReservedWord=function(e){return"implements"===e||"interface"===e||"package"===e||"private"===e||"protected"===e||"public"===e||"static"===e||"yield"===e||"let"===e},t.prototype.isRestrictedWord=function(e){return"eval"===e||"arguments"===e},t.prototype.isKeyword=function(e){switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1;}},t.prototype.codePointAt=function(e){var t=this.source.charCodeAt(e);if(55296<=t&&56319>=t){var n=this.source.charCodeAt(e+1);if(56320<=n&&57343>=n){var o=t;t=1024*(o-55296)+n-56320+65536}}return t},t.prototype.scanHexEscape=function(t){for(var n="u"===t?4:2,o=0,a=0;a<n;++a)if(!this.eof()&&d.Character.isHexDigit(this.source.charCodeAt(this.index)))o=16*o+r(this.source[this.index++]);else return"";return e(o)},t.prototype.scanUnicodeCodePointEscape=function(){var e=this.source[this.index],t=0;for("}"===e&&this.throwUnexpectedToken();!this.eof()&&(e=this.source[this.index++],!!d.Character.isHexDigit(e.charCodeAt(0)));)t=16*t+r(e);return(1114111<t||"}"!==e)&&this.throwUnexpectedToken(),d.Character.fromCodePoint(t)},t.prototype.getIdentifier=function(){for(var e=this.index++,t;!this.eof();){if(t=this.source.charCodeAt(this.index),92===t)return this.index=e,this.getComplexIdentifier();if(55296<=t&&57343>t)return this.index=e,this.getComplexIdentifier();if(d.Character.isIdentifierPart(t))++this.index;else break}return this.source.slice(e,this.index)},t.prototype.getComplexIdentifier=function(){var e=this.codePointAt(this.index),t=d.Character.fromCodePoint(e);this.index+=t.length;var n;for(92===e&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,n=this.scanUnicodeCodePointEscape()):(n=this.scanHexEscape("u"),e=n.charCodeAt(0),(!n||"\\"===n||!d.Character.isIdentifierStart(e))&&this.throwUnexpectedToken()),t=n);!this.eof()&&(e=this.codePointAt(this.index),!!d.Character.isIdentifierPart(e));)n=d.Character.fromCodePoint(e),t+=n,this.index+=n.length,92===e&&(t=t.substr(0,t.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,n=this.scanUnicodeCodePointEscape()):(n=this.scanHexEscape("u"),e=n.charCodeAt(0),(!n||"\\"===n||!d.Character.isIdentifierPart(e))&&this.throwUnexpectedToken()),t+=n);return t},t.prototype.octalToDecimal=function(e){var t="0"!==e,n=a(e);return!this.eof()&&d.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(t=!0,n=8*n+a(this.source[this.index++]),0<="0123".indexOf(e)&&!this.eof()&&d.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+a(this.source[this.index++]))),{code:n,octal:t}},t.prototype.scanIdentifier=function(){var e=this.index,t=92===this.source.charCodeAt(e)?this.getComplexIdentifier():this.getIdentifier(),n;return n=1===t.length?l.Token.Identifier:this.isKeyword(t)?l.Token.Keyword:"null"===t?l.Token.NullLiteral:"true"===t||"false"===t?l.Token.BooleanLiteral:l.Token.Identifier,{type:n,value:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},t.prototype.scanPunctuator=function(){var e={type:l.Token.Punctuator,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index},t=this.source[this.index];return"("===t||"{"===t?("{"===t&&this.curlyStack.push("{"),++this.index):"."===t?(++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,t="...")):"}"===t?(++this.index,this.curlyStack.pop()):")"===t||";"===t||","===t||"["===t||"]"===t||":"===t||"?"===t||"~"===t?++this.index:(t=this.source.substr(this.index,4),">>>="===t?this.index+=4:(t=t.substr(0,3),"==="===t||"!=="===t||">>>"===t||"<<="===t||">>="===t||"**="===t?this.index+=3:(t=t.substr(0,2),"&&"===t||"||"===t||"=="===t||"!="===t||"+="===t||"-="===t||"*="===t||"/="===t||"++"===t||"--"===t||"<<"===t||">>"===t||"&="===t||"|="===t||"^="===t||"%="===t||"<="===t||">="===t||"=>"===t||"**"===t?this.index+=2:(t=this.source[this.index],0<="<>=!+-*%&|^/".indexOf(t)&&++this.index)))),this.index===e.start&&this.throwUnexpectedToken(),e.end=this.index,e.value=t,e},t.prototype.scanHexLiteral=function(e){for(var t="";!this.eof()&&!!d.Character.isHexDigit(this.source.charCodeAt(this.index));)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),d.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:l.Token.NumericLiteral,value:parseInt("0x"+t,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},t.prototype.scanBinaryLiteral=function(e){for(var t="",n;!this.eof()&&(n=this.source[this.index],"0"===n||"1"===n);)t+=this.source[this.index++];return 0===t.length&&this.throwUnexpectedToken(),this.eof()||(n=this.source.charCodeAt(this.index),(d.Character.isIdentifierStart(n)||d.Character.isDecimalDigit(n))&&this.throwUnexpectedToken()),{type:l.Token.NumericLiteral,value:parseInt(t,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},t.prototype.scanOctalLiteral=function(e,t){var n="",o=!1;for(d.Character.isOctalDigit(e.charCodeAt(0))?(o=!0,n="0"+this.source[this.index++]):++this.index;!this.eof()&&!!d.Character.isOctalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return o||0!==n.length||this.throwUnexpectedToken(),(d.Character.isIdentifierStart(this.source.charCodeAt(this.index))||d.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:l.Token.NumericLiteral,value:parseInt(n,8),octal:o,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},t.prototype.isImplicitOctalLiteral=function(){for(var e=this.index+1,t;e<this.length;++e){if(t=this.source[e],"8"===t||"9"===t)return!1;if(!d.Character.isOctalDigit(t.charCodeAt(0)))return!0}return!0},t.prototype.scanNumericLiteral=function(){var e=this.index,t=this.source[e];i.assert(d.Character.isDecimalDigit(t.charCodeAt(0))||"."===t,"Numeric literal must start with a decimal digit or a decimal point");var n="";if("."!==t){if(n=this.source[this.index++],t=this.source[this.index],"0"===n){if("x"===t||"X"===t)return++this.index,this.scanHexLiteral(e);if("b"===t||"B"===t)return++this.index,this.scanBinaryLiteral(e);if("o"===t||"O"===t)return this.scanOctalLiteral(t,e);if(t&&d.Character.isOctalDigit(t.charCodeAt(0))&&this.isImplicitOctalLiteral())return this.scanOctalLiteral(t,e)}for(;d.Character.isDecimalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];t=this.source[this.index]}if("."===t){for(n+=this.source[this.index++];d.Character.isDecimalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];t=this.source[this.index]}if("e"===t||"E"===t)if(n+=this.source[this.index++],t=this.source[this.index],("+"===t||"-"===t)&&(n+=this.source[this.index++]),d.Character.isDecimalDigit(this.source.charCodeAt(this.index)))for(;d.Character.isDecimalDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];else this.throwUnexpectedToken();return d.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:l.Token.NumericLiteral,value:parseFloat(n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},t.prototype.scanStringLiteral=function(){var t=this.index,n=this.source[t];i.assert("'"===n||"\""===n,"String literal must starts with a quote"),++this.index;for(var o=!1,r="",a;!this.eof();)if(a=this.source[this.index++],a===n){n="";break}else if("\\"===a){if(a=this.source[this.index++],!a||!d.Character.isLineTerminator(a.charCodeAt(0)))switch(a){case"u":case"x":if("{"===this.source[this.index])++this.index,r+=this.scanUnicodeCodePointEscape();else{var s=this.scanHexEscape(a);s||this.throwUnexpectedToken(),r+=s}break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\x0B";break;case"8":case"9":r+=a,this.tolerateUnexpectedToken();break;default:if(a&&d.Character.isOctalDigit(a.charCodeAt(0))){var p=this.octalToDecimal(a);o=p.octal||o,r+=e(p.code)}else r+=a;}else++this.lineNumber,"\r"===a&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;}else if(d.Character.isLineTerminator(a.charCodeAt(0)))break;else r+=a;return""!==n&&(this.index=t,this.throwUnexpectedToken()),{type:l.Token.StringLiteral,value:r,octal:o,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},t.prototype.scanTemplate=function(){var e="",t=!1,n=this.index,o="`"===this.source[n],r=!1,a=2;for(++this.index;!this.eof();){var i=this.source[this.index++];if("`"===i){a=1,r=!0,t=!0;break}else if("$"===i){if("{"===this.source[this.index]){this.curlyStack.push("${"),++this.index,t=!0;break}e+=i}else if("\\"!==i)d.Character.isLineTerminator(i.charCodeAt(0))?(++this.lineNumber,"\r"===i&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index,e+="\n"):e+=i;else if(i=this.source[this.index++],!d.Character.isLineTerminator(i.charCodeAt(0)))switch(i){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"u":case"x":if("{"===this.source[this.index])++this.index,e+=this.scanUnicodeCodePointEscape();else{var p=this.index,c=this.scanHexEscape(i);c?e+=c:(this.index=p,e+=i)}break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\x0B";break;default:"0"===i?(d.Character.isDecimalDigit(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(s.Messages.TemplateOctalLiteral),e+="\0"):d.Character.isOctalDigit(i.charCodeAt(0))?this.throwUnexpectedToken(s.Messages.TemplateOctalLiteral):e+=i;}else++this.lineNumber,"\r"===i&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index}return t||this.throwUnexpectedToken(),o||this.curlyStack.pop(),{type:l.Token.Template,value:{cooked:e,raw:this.source.slice(n+1,this.index-a)},head:o,tail:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:n,end:this.index}},t.prototype.testRegExp=function(t,n){var o="\uFFFF",r=t,a=this;0<=n.indexOf("u")&&(r=r.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,function(t,n,r){var i=parseInt(n||r,16);return 1114111<i&&a.throwUnexpectedToken(s.Messages.InvalidRegExp),65535>=i?e(i):o}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,o));try{RegExp(r)}catch(t){this.throwUnexpectedToken(s.Messages.InvalidRegExp)}try{return new RegExp(t,n)}catch(e){return null}},t.prototype.scanRegExpBody=function(){var e=this.source[this.index];i.assert("/"===e,"Regular expression literal must start with a slash");for(var t=this.source[this.index++],n=!1,o=!1;!this.eof();)if(e=this.source[this.index++],t+=e,"\\"===e)e=this.source[this.index++],d.Character.isLineTerminator(e.charCodeAt(0))&&this.throwUnexpectedToken(s.Messages.UnterminatedRegExp),t+=e;else if(d.Character.isLineTerminator(e.charCodeAt(0)))this.throwUnexpectedToken(s.Messages.UnterminatedRegExp);else if(n)"]"===e&&(n=!1);else if("/"===e){o=!0;break}else"["===e&&(n=!0);o||this.throwUnexpectedToken(s.Messages.UnterminatedRegExp);var r=t.substr(1,t.length-2);return{value:r,literal:t}},t.prototype.scanRegExpFlags=function(){for(var e="",t="",n;!this.eof()&&(n=this.source[this.index],!!d.Character.isIdentifierPart(n.charCodeAt(0)));)if(++this.index,"\\"!==n||this.eof())t+=n,e+=n;else if(n=this.source[this.index],"u"===n){++this.index;var o=this.index;if(n=this.scanHexEscape("u"),n)for(t+=n,e+="\\u";o<this.index;++o)e+=this.source[o];else this.index=o,t+="u",e+="\\u";this.tolerateUnexpectedToken()}else e+="\\",this.tolerateUnexpectedToken();return{value:t,literal:e}},t.prototype.scanRegExp=function(){var e=this.index,t=this.scanRegExpBody(),n=this.scanRegExpFlags(),o=this.testRegExp(t.value,n.value);return{type:l.Token.RegularExpression,value:o,literal:t.literal+n.literal,regex:{pattern:t.value,flags:n.value},lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},(t.prototype.lex=function(){if(this.eof())return{type:l.Token.EOF,lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index};var e=this.source.charCodeAt(this.index);return d.Character.isIdentifierStart(e)?this.scanIdentifier():40===e||41===e||59===e?this.scanPunctuator():39===e||34===e?this.scanStringLiteral():46===e?d.Character.isDecimalDigit(this.source.charCodeAt(this.index+1))?this.scanNumericLiteral():this.scanPunctuator():d.Character.isDecimalDigit(e)?this.scanNumericLiteral():96===e||125===e&&"${"===this.curlyStack[this.curlyStack.length-1]?this.scanTemplate():55296<=e&&57343>e&&d.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},t)}();n.Scanner=p},function(t,n){"use strict";var o={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};n.Character={fromCodePoint:function(t){return 65536>t?e(t):e(55296+(t-65536>>10))+e(56320+(1023&t-65536))},isWhiteSpace:function(e){return 32===e||9===e||11===e||12===e||160===e||5760<=e&&0<=[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)},isLineTerminator:function(e){return 10===e||13===e||8232===e||8233===e},isIdentifierStart:function(e){return 36===e||95===e||65<=e&&90>=e||97<=e&&122>=e||92===e||128<=e&&o.NonAsciiIdentifierStart.test(n.Character.fromCodePoint(e))},isIdentifierPart:function(e){return 36===e||95===e||65<=e&&90>=e||97<=e&&122>=e||48<=e&&57>=e||92===e||128<=e&&o.NonAsciiIdentifierPart.test(n.Character.fromCodePoint(e))},isDecimalDigit:function(e){return 48<=e&&57>=e},isHexDigit:function(e){return 48<=e&&57>=e||65<=e&&70>=e||97<=e&&102>=e},isOctalDigit:function(e){return 48<=e&&55>=e}}},function(e,t,n){"use strict";var o=n(2),r=function(){return function(e){this.type=o.Syntax.ArrayExpression,this.elements=e}}();t.ArrayExpression=r;var a=function(){return function(e){this.type=o.Syntax.ArrayPattern,this.elements=e}}();t.ArrayPattern=a;var i=function(){return function(e,t,n){this.type=o.Syntax.ArrowFunctionExpression,this.id=null,this.params=e,this.body=t,this.generator=!1,this.expression=n}}();t.ArrowFunctionExpression=i;var s=function(){return function(e,t,n){this.type=o.Syntax.AssignmentExpression,this.operator=e,this.left=t,this.right=n}}();t.AssignmentExpression=s;var d=function(){return function(e,t){this.type=o.Syntax.AssignmentPattern,this.left=e,this.right=t}}();t.AssignmentPattern=d;var l=function(){return function(e,t,n){this.type="||"===e||"&&"===e?o.Syntax.LogicalExpression:o.Syntax.BinaryExpression,this.operator=e,this.left=t,this.right=n}}();t.BinaryExpression=l;var p=function(){return function(e){this.type=o.Syntax.BlockStatement,this.body=e}}();t.BlockStatement=p;var c=function(){return function(e){this.type=o.Syntax.BreakStatement,this.label=e}}();t.BreakStatement=c;var u=function(){return function(e,t){this.type=o.Syntax.CallExpression,this.callee=e,this.arguments=t}}();t.CallExpression=u;var h=function(){return function(e,t){this.type=o.Syntax.CatchClause,this.param=e,this.body=t}}();t.CatchClause=h;var m=function(){return function(e){this.type=o.Syntax.ClassBody,this.body=e}}();t.ClassBody=m;var g=function(){return function(e,t,n){this.type=o.Syntax.ClassDeclaration,this.id=e,this.superClass=t,this.body=n}}();t.ClassDeclaration=g;var f=function(){return function(e,t,n){this.type=o.Syntax.ClassExpression,this.id=e,this.superClass=t,this.body=n}}();t.ClassExpression=f;var y=function(){return function(e,t){this.type=o.Syntax.MemberExpression,this.computed=!0,this.object=e,this.property=t}}();t.ComputedMemberExpression=y;var b=function(){return function(e,t,n){this.type=o.Syntax.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n}}();t.ConditionalExpression=b;var v=function(){return function(e){this.type=o.Syntax.ContinueStatement,this.label=e}}();t.ContinueStatement=v;var x=function(){return function(){this.type=o.Syntax.DebuggerStatement}}();t.DebuggerStatement=x;var C=function(){return function(e,t){this.type=o.Syntax.ExpressionStatement,this.expression=e,this.directive=t}}();t.Directive=C;var S=function(){return function(e,t){this.type=o.Syntax.DoWhileStatement,this.body=e,this.test=t}}();t.DoWhileStatement=S;var E=function(){return function(){this.type=o.Syntax.EmptyStatement}}();t.EmptyStatement=E;var k=function(){return function(e){this.type=o.Syntax.ExportAllDeclaration,this.source=e}}();t.ExportAllDeclaration=k;var T=function(){return function(e){this.type=o.Syntax.ExportDefaultDeclaration,this.declaration=e}}();t.ExportDefaultDeclaration=T;var w=function(){return function(e,t,n){this.type=o.Syntax.ExportNamedDeclaration,this.declaration=e,this.specifiers=t,this.source=n}}();t.ExportNamedDeclaration=w;var I=function(){return function(e,t){this.type=o.Syntax.ExportSpecifier,this.exported=t,this.local=e}}();t.ExportSpecifier=I;var N=function(){return function(e){this.type=o.Syntax.ExpressionStatement,this.expression=e}}();t.ExpressionStatement=N;var A=function(){return function(e,t,n){this.type=o.Syntax.ForInStatement,this.left=e,this.right=t,this.body=n,this.each=!1}}();t.ForInStatement=A;var L=function(){return function(e,t,n){this.type=o.Syntax.ForOfStatement,this.left=e,this.right=t,this.body=n}}();t.ForOfStatement=L;var R=function(){return function(e,t,n,r){this.type=o.Syntax.ForStatement,this.init=e,this.test=t,this.update=n,this.body=r}}();t.ForStatement=R;var O=function(){return function(e,t,n,r){this.type=o.Syntax.FunctionDeclaration,this.id=e,this.params=t,this.body=n,this.generator=r,this.expression=!1}}();t.FunctionDeclaration=O;var P=function(){return function(e,t,n,r){this.type=o.Syntax.FunctionExpression,this.id=e,this.params=t,this.body=n,this.generator=r,this.expression=!1}}();t.FunctionExpression=P;var _=function(){return function(e){this.type=o.Syntax.Identifier,this.name=e}}();t.Identifier=_;var D=function(){return function(e,t,n){this.type=o.Syntax.IfStatement,this.test=e,this.consequent=t,this.alternate=n}}();t.IfStatement=D;var M=function(){return function(e,t){this.type=o.Syntax.ImportDeclaration,this.specifiers=e,this.source=t}}();t.ImportDeclaration=M;var F=function(){return function(e){this.type=o.Syntax.ImportDefaultSpecifier,this.local=e}}();t.ImportDefaultSpecifier=F;var B=function(){return function(e){this.type=o.Syntax.ImportNamespaceSpecifier,this.local=e}}();t.ImportNamespaceSpecifier=B;var U=function(){return function(e,t){this.type=o.Syntax.ImportSpecifier,this.local=e,this.imported=t}}();t.ImportSpecifier=U;var V=function(){return function(e,t){this.type=o.Syntax.LabeledStatement,this.label=e,this.body=t}}();t.LabeledStatement=V;var W=function(){return function(e,t){this.type=o.Syntax.Literal,this.value=e,this.raw=t}}();t.Literal=W;var H=function(){return function(e,t){this.type=o.Syntax.MetaProperty,this.meta=e,this.property=t}}();t.MetaProperty=H;var j=function(){return function(e,t,n,r,a){this.type=o.Syntax.MethodDefinition,this.key=e,this.computed=t,this.value=n,this.kind=r,this.static=a}}();t.MethodDefinition=j;var q=function(){return function(e,t){this.type=o.Syntax.NewExpression,this.callee=e,this.arguments=t}}();t.NewExpression=q;var z=function(){return function(e){this.type=o.Syntax.ObjectExpression,this.properties=e}}();t.ObjectExpression=z;var K=function(){return function(e){this.type=o.Syntax.ObjectPattern,this.properties=e}}();t.ObjectPattern=K;var G=function(){return function(e,t){this.type=o.Syntax.Program,this.body=e,this.sourceType=t}}();t.Program=G;var X=function(){return function(e,t,n,r,a,i){this.type=o.Syntax.Property,this.key=t,this.computed=n,this.value=r,this.kind=e,this.method=a,this.shorthand=i}}();t.Property=X;var Q=function(){return function(e,t,n){this.type=o.Syntax.Literal,this.value=e,this.raw=t,this.regex=n}}();t.RegexLiteral=Q;var Y=function(){return function(e){this.type=o.Syntax.RestElement,this.argument=e}}();t.RestElement=Y;var J=function(){return function(e){this.type=o.Syntax.ReturnStatement,this.argument=e}}();t.ReturnStatement=J;var $=function(){return function(e){this.type=o.Syntax.SequenceExpression,this.expressions=e}}();t.SequenceExpression=$;var Z=function(){return function(e){this.type=o.Syntax.SpreadElement,this.argument=e}}();t.SpreadElement=Z;var ee=function(){return function(e,t){this.type=o.Syntax.MemberExpression,this.computed=!1,this.object=e,this.property=t}}();t.StaticMemberExpression=ee;var te=function(){return function(){this.type=o.Syntax.Super}}();t.Super=te;var ne=function(){return function(e,t){this.type=o.Syntax.SwitchCase,this.test=e,this.consequent=t}}();t.SwitchCase=ne;var oe=function(){return function(e,t){this.type=o.Syntax.SwitchStatement,this.discriminant=e,this.cases=t}}();t.SwitchStatement=oe;var re=function(){return function(e,t){this.type=o.Syntax.TaggedTemplateExpression,this.tag=e,this.quasi=t}}();t.TaggedTemplateExpression=re;var ae=function(){return function(e,t){this.type=o.Syntax.TemplateElement,this.value=e,this.tail=t}}();t.TemplateElement=ae;var ie=function(){return function(e,t){this.type=o.Syntax.TemplateLiteral,this.quasis=e,this.expressions=t}}();t.TemplateLiteral=ie;var se=function(){return function(){this.type=o.Syntax.ThisExpression}}();t.ThisExpression=se;var de=function(){return function(e){this.type=o.Syntax.ThrowStatement,this.argument=e}}();t.ThrowStatement=de;var le=function(){return function(e,t,n){this.type=o.Syntax.TryStatement,this.block=e,this.handler=t,this.finalizer=n}}();t.TryStatement=le;var pe=function(){return function(e,t){this.type=o.Syntax.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0}}();t.UnaryExpression=pe;var ce=function(){return function(e,t,n){this.type=o.Syntax.UpdateExpression,this.operator=e,this.argument=t,this.prefix=n}}();t.UpdateExpression=ce;var ue=function(){return function(e,t){this.type=o.Syntax.VariableDeclaration,this.declarations=e,this.kind=t}}();t.VariableDeclaration=ue;var he=function(){return function(e,t){this.type=o.Syntax.VariableDeclarator,this.id=e,this.init=t}}();t.VariableDeclarator=he;var me=function(){return function(e,t){this.type=o.Syntax.WhileStatement,this.test=e,this.body=t}}();t.WhileStatement=me;var ge=function(){return function(e,t){this.type=o.Syntax.WithStatement,this.object=e,this.body=t}}();t.WithStatement=ge;var fe=function(){return function(e,t){this.type=o.Syntax.YieldExpression,this.argument=e,this.delegate=t}}();t.YieldExpression=fe},function(t,n,o){"use strict";function r(e){var t;switch(e.type){case p.JSXSyntax.JSXIdentifier:t=e.name;break;case p.JSXSyntax.JSXNamespacedName:var n=e;t=r(n.namespace)+":"+r(n.name);break;case p.JSXSyntax.JSXMemberExpression:var o=e;t=r(o.object)+"."+r(o.property);}return t}var a=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},i=o(9),s=o(7),d=o(3),l=o(12),p=o(13),c=o(10),u=o(14),h;(function(e){e[e.Identifier=100]="Identifier",e[e.Text=101]="Text"})(h||(h={})),s.TokenName[h.Identifier]="JSXIdentifier",s.TokenName[h.Text]="JSXText";var m=function(t){function n(e,n,o){t.call(this,e,n,o)}return a(n,t),n.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():t.prototype.parsePrimaryExpression.call(this)},n.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.lineNumber,this.scanner.lineStart=this.startMarker.lineStart},n.prototype.finishJSX=function(){this.nextToken()},n.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},n.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},n.prototype.scanXHTMLEntity=function(){for(var t="&",n="",o;!this.scanner.eof();){if(o=this.scanner.source[this.scanner.index++],";"===o){if("#"===n[0]){n=n.substr(1);var r="x"===n[0],a=r?parseInt("0"+n,16):parseInt(n,10);t=e(a)}else l.XHTMLEntities[n]?t=l.XHTMLEntities[n]:t+=o;break}n+=o,t+=o}return t},n.prototype.lexJSX=function(){var e=this.scanner.source.charCodeAt(this.scanner.index);if(60===e||62===e||47===e||58===e||61===e||123===e||125===e){var t=this.scanner.source[this.scanner.index++];return{type:s.Token.Punctuator,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index}}if(34===e||39===e){for(var n=this.scanner.index,o=this.scanner.source[this.scanner.index++],r="",a;!this.scanner.eof()&&(a=this.scanner.source[this.scanner.index++],a!==o);)r+="&"===a?this.scanXHTMLEntity():a;return{type:s.Token.StringLiteral,value:r,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:n,end:this.scanner.index}}if(46===e){var d=this.scanner.source.charCodeAt(this.scanner.index+1),l=this.scanner.source.charCodeAt(this.scanner.index+2),t=46===d&&46===l?"...":".",n=this.scanner.index;return this.scanner.index+=t.length,{type:s.Token.Punctuator,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:n,end:this.scanner.index}}if(i.Character.isIdentifierStart(e)&&92!==e){var n=this.scanner.index;for(++this.scanner.index;!this.scanner.eof();){var a=this.scanner.source.charCodeAt(this.scanner.index);if(i.Character.isIdentifierPart(a)&&92!==a)++this.scanner.index;else if(45===a)++this.scanner.index;else break}var p=this.scanner.source.slice(n,this.scanner.index);return{type:h.Identifier,value:p,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:n,end:this.scanner.index}}this.scanner.throwUnexpectedToken()},n.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.lineNumber=this.scanner.lineNumber,this.startMarker.lineStart=this.scanner.lineStart;var e=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(e)),e},n.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.lineNumber=this.scanner.lineNumber,this.startMarker.lineStart=this.scanner.lineStart;for(var e=this.scanner.index,t="",n;!this.scanner.eof()&&(n=this.scanner.source[this.scanner.index],"{"!==n&&"<"!==n);)++this.scanner.index,t+=n,i.Character.isLineTerminator(n.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===n&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index);this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart;var o={type:h.Text,value:t,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index};return 0<t.length&&this.config.tokens&&this.tokens.push(this.convertToken(o)),o},n.prototype.peekJSXToken=function(){var e=this.scanner.index,t=this.scanner.lineNumber,n=this.scanner.lineStart;this.scanner.scanComments();var o=this.lexJSX();return this.scanner.index=e,this.scanner.lineNumber=t,this.scanner.lineStart=n,o},n.prototype.expectJSX=function(e){var t=this.nextJSXToken();(t.type!==s.Token.Punctuator||t.value!==e)&&this.throwUnexpectedToken(t)},n.prototype.matchJSX=function(e){var t=this.peekJSXToken();return t.type===s.Token.Punctuator&&t.value===e},n.prototype.parseJSXIdentifier=function(){var e=this.createJSXNode(),t=this.nextJSXToken();return t.type!==h.Identifier&&this.throwUnexpectedToken(t),this.finalize(e,new u.JSXIdentifier(t.value))},n.prototype.parseJSXElementName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=t;this.expectJSX(":");var o=this.parseJSXIdentifier();t=this.finalize(e,new u.JSXNamespacedName(n,o))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var r=t;this.expectJSX(".");var a=this.parseJSXIdentifier();t=this.finalize(e,new u.JSXMemberExpression(r,a))}return t},n.prototype.parseJSXAttributeName=function(){var e=this.createJSXNode(),t=this.parseJSXIdentifier(),n;if(this.matchJSX(":")){this.expectJSX(":");var o=this.parseJSXIdentifier();n=this.finalize(e,new u.JSXNamespacedName(t,o))}else n=t;return n},n.prototype.parseJSXStringLiteralAttribute=function(){var e=this.createJSXNode(),t=this.nextJSXToken();t.type!==s.Token.StringLiteral&&this.throwUnexpectedToken(t);var n=this.getTokenRaw(t);return this.finalize(e,new c.Literal(t.value,n))},n.prototype.parseJSXExpressionAttribute=function(){var e=this.createJSXNode();this.expectJSX("{");var t=null;return this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression"),t=this.parseAssignmentExpression(),this.startJSX(),this.expectJSX("}"),this.finalize(e,new u.JSXExpressionContainer(t))},n.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},n.prototype.parseJSXNameValueAttribute=function(){var e=this.createJSXNode(),t=this.parseJSXAttributeName(),n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(e,new u.JSXAttribute(t,n))},n.prototype.parseJSXSpreadAttribute=function(){var e=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var t=this.parseAssignmentExpression();return this.startJSX(),this.expectJSX("}"),this.finalize(e,new u.JSXSpreadAttribute(t))},n.prototype.parseJSXAttributes=function(){for(var e=[],t;!this.matchJSX("/")&&!this.matchJSX(">");)t=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute(),e.push(t);return e},n.prototype.parseJSXOpeningElement=function(){var e=this.createJSXNode();this.expectJSX("<");var t=this.parseJSXElementName(),n=this.parseJSXAttributes(),o=this.matchJSX("/");return o&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new u.JSXOpeningElement(t,o,n))},n.prototype.parseJSXBoundaryElement=function(){var e=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var t=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(e,new u.JSXClosingElement(t))}var n=this.parseJSXElementName(),o=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(e,new u.JSXOpeningElement(n,r,o))},n.prototype.parseJSXEmptyExpression=function(){var e=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.lineNumber=this.scanner.lineNumber,this.lastMarker.lineStart=this.scanner.lineStart,this.finalize(e,new u.JSXEmptyExpression)},n.prototype.parseJSXExpression=function(){var e;return this.matchJSX("}")?e=this.parseJSXEmptyExpression():(this.finishJSX(),e=this.parseAssignmentExpression(),this.startJSX()),e},n.prototype.parseJSXExpressionContainer=function(){var e=this.createJSXNode();this.expectJSX("{");var t=this.parseJSXExpression();return this.expectJSX("}"),this.finalize(e,new u.JSXExpressionContainer(t))},n.prototype.parseJSXChildren=function(){for(var e=[];!this.scanner.eof();){var t=this.createJSXChildNode(),n=this.nextJSXText();if(n.start<n.end){var o=this.getTokenRaw(n),r=this.finalize(t,new u.JSXText(n.value,o));e.push(r)}if("{"===this.scanner.source[this.scanner.index]){var a=this.parseJSXExpressionContainer();e.push(a)}else break}return e},n.prototype.parseComplexJSXElement=function(e){for(var t=[];!this.scanner.eof();){e.children=e.children.concat(this.parseJSXChildren());var n=this.createJSXChildNode(),o=this.parseJSXBoundaryElement();if(o.type===p.JSXSyntax.JSXOpeningElement){var a=o;if(a.selfClosing){var i=this.finalize(n,new u.JSXElement(a,[],null));e.children.push(i)}else t.push(e),e={node:n,opening:a,closing:null,children:[]}}if(o.type===p.JSXSyntax.JSXClosingElement){e.closing=o;var s=r(e.opening.name),d=r(e.closing.name);if(s!==d&&this.tolerateError("Expected corresponding JSX closing tag for %0",s),0<t.length){var i=this.finalize(e.node,new u.JSXElement(e.opening,e.children,e.closing));e=t.pop(),e.children.push(i)}else break}}return e},n.prototype.parseJSXElement=function(){var e=this.createJSXNode(),t=this.parseJSXOpeningElement(),n=[],o=null;if(!t.selfClosing){var r=this.parseComplexJSXElement({node:e,opening:t,closing:o,children:n});n=r.children,o=r.closing}return this.finalize(e,new u.JSXElement(t,n,o))},n.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var e=this.parseJSXElement();return this.finishJSX(),e},n}(d.Parser);n.JSXParser=m},function(e,t){"use strict";t.XHTMLEntities={quot:"\"",amp:"&",apos:"'",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",lang:"\u27E8",rang:"\u27E9"}},function(e,t){"use strict";t.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(e,t,n){"use strict";var o=n(13),r=function(){return function(e){this.type=o.JSXSyntax.JSXClosingElement,this.name=e}}();t.JSXClosingElement=r;var a=function(){return function(e,t,n){this.type=o.JSXSyntax.JSXElement,this.openingElement=e,this.children=t,this.closingElement=n}}();t.JSXElement=a;var i=function(){return function(){this.type=o.JSXSyntax.JSXEmptyExpression}}();t.JSXEmptyExpression=i;var s=function(){return function(e){this.type=o.JSXSyntax.JSXExpressionContainer,this.expression=e}}();t.JSXExpressionContainer=s;var d=function(){return function(e){this.type=o.JSXSyntax.JSXIdentifier,this.name=e}}();t.JSXIdentifier=d;var l=function(){return function(e,t){this.type=o.JSXSyntax.JSXMemberExpression,this.object=e,this.property=t}}();t.JSXMemberExpression=l;var p=function(){return function(e,t){this.type=o.JSXSyntax.JSXAttribute,this.name=e,this.value=t}}();t.JSXAttribute=p;var c=function(){return function(e,t){this.type=o.JSXSyntax.JSXNamespacedName,this.namespace=e,this.name=t}}();t.JSXNamespacedName=c;var u=function(){return function(e,t,n){this.type=o.JSXSyntax.JSXOpeningElement,this.name=e,this.selfClosing=t,this.attributes=n}}();t.JSXOpeningElement=u;var h=function(){return function(e){this.type=o.JSXSyntax.JSXSpreadAttribute,this.argument=e}}();t.JSXSpreadAttribute=h;var m=function(){return function(e,t){this.type=o.JSXSyntax.JSXText,this.value=e,this.raw=t}}();t.JSXText=m},function(e,t,n){"use strict";var o=n(8),r=n(6),a=n(7),i=function(){function e(){this.values=[],this.curly=this.paren=-1}return e.prototype.beforeFunctionExpression=function(e){return 0<=["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(e)},e.prototype.isRegexStart=function(){var e=this.values[this.values.length-1],t=null!==e;switch(e){case"this":case"]":t=!1;break;case")":var n=this.values[this.paren-1];t="if"===n||"while"===n||"for"===n||"with"===n;break;case"}":if(t=!1,"function"===this.values[this.curly-3]){var o=this.values[this.curly-4];t=!!o&&!this.beforeFunctionExpression(o)}else if("function"===this.values[this.curly-4]){var r=this.values[this.curly-5];t=!r||!this.beforeFunctionExpression(r)}}return t},(e.prototype.push=function(e){e.type===a.Token.Punctuator||e.type===a.Token.Keyword?("{"===e.value?this.curly=this.values.length:"("===e.value&&(this.paren=this.values.length),this.values.push(e.value)):this.values.push(null)},e)}(),s=function(){function e(e,t){this.errorHandler=new r.ErrorHandler,this.errorHandler.tolerant=!!t&&"boolean"==typeof t.tolerant&&t.tolerant,this.scanner=new o.Scanner(e,this.errorHandler),this.scanner.trackComment=!!t&&"boolean"==typeof t.comment&&t.comment,this.trackRange=!!t&&"boolean"==typeof t.range&&t.range,this.trackLoc=!!t&&"boolean"==typeof t.loc&&t.loc,this.buffer=[],this.reader=new i}return e.prototype.errors=function(){return this.errorHandler.errors},e.prototype.getNextToken=function(){if(0===this.buffer.length){var t=this.scanner.scanComments();if(this.scanner.trackComment)for(var n=0;n<t.length;++n){var o=t[n],e=void 0,r=this.scanner.source.slice(o.slice[0],o.slice[1]);e={type:o.multiLine?"BlockComment":"LineComment",value:r},this.trackRange&&(e.range=o.range),this.trackLoc&&(e.loc=o.loc),this.buffer.push(e)}if(!this.scanner.eof()){var i;this.trackLoc&&(i={start:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart},end:{}});var s;s="/"===this.scanner.source[this.scanner.index]?this.reader.isRegexStart()?this.scanner.scanRegExp():this.scanner.scanPunctuator():this.scanner.lex(),this.reader.push(s);var d;d={type:a.TokenName[s.type],value:this.scanner.source.slice(s.start,s.end)},this.trackRange&&(d.range=[s.start,s.end]),this.trackLoc&&(i.end={line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart},d.loc=i),s.regex&&(d.regex=s.regex),this.buffer.push(d)}}return this.buffer.shift()},e}();t.Tokenizer=s}])});var firebase=function(){var d=String.fromCharCode,a=void 0===a?self:a;return function(s){function d(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return s[t].call(o.exports,o,o.exports,d),o.l=!0,o.exports}var t=a.webpackJsonpFirebase;a.webpackJsonpFirebase=function(n,e,o){for(var r=0,a=[],i,p,c;r<n.length;r++)p=n[r],l[p]&&a.push(l[p][0]),l[p]=0;for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[i]=e[i]);for(t&&t(n,e,o);a.length;)a.shift()();if(o)for(r=0;r<o.length;r++)c=d(d.s=o[r]);return c};var r={},l={5:0};return d.e=function(i){function e(){o.onerror=o.onload=null,clearTimeout(r);var e=l[i];0!==e&&(e&&e[1](Error("Loading chunk "+i+" failed.")),l[i]=void 0)}var p=l[i];if(0===p)return new Promise(function(t){t()});if(p)return p[2];var t=new Promise(function(e,t){p=l[i]=[e,t]});p[2]=t;var n=document.getElementsByTagName("head")[0],o=document.createElement("script");o.type="text/javascript",o.charset="utf-8",o.async=!0,o.timeout=12e4,d.nc&&o.setAttribute("nonce",d.nc),o.src=d.p+""+i+".js";var r=setTimeout(e,12e4);return o.onerror=o.onload=e,n.appendChild(o),t},d.m=s,d.c=r,d.d=function(o,e,t){d.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},d.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return d.d(e,"a",e),e},d.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},d.p="",d.oe=function(t){throw console.error(t),t},d(d.s=57)}([function(o,a,e){"use strict";function t(t){for(var e in t)a.hasOwnProperty(e)||(a[e]=t[e])}Object.defineProperty(a,"__esModule",{value:!0}),t(e(28)),t(e(29)),t(e(20)),t(e(65)),t(e(66)),t(e(67)),t(e(68)),t(e(30)),t(e(69)),t(e(31)),t(e(70)),t(e(71)),t(e(73)),t(e(74)),t(e(75))},,,,,,function(d,e,t){"use strict";function m(){function c(t){S(E[t],"delete"),delete E[t]}function u(t){return t=t||a,i(E,t)||p("no-app",{name:t}),E[t]}function h(n,e){void 0===e?e=a:"string"==typeof e&&""!==e||p("bad-app-name",{name:e+""}),i(E,e)&&p("duplicate-app",{name:e});var o=new g(n,e,y);return E[e]=o,S(o,"create"),o}function x(){return Object.keys(E).map(function(t){return E[t]})}function C(i,t,r,n,a){d[i]&&p("duplicate-service",{name:i}),d[i]=t,n&&(k[i]=n,x().forEach(function(t){n("create",t)}));var s=function(t){return void 0===t&&(t=u()),"function"!=typeof t[i]&&p("invalid-app-argument",{name:i}),t[i]()};return void 0!==r&&Object(o.deepExtend)(s,r),y[i]=s,g.prototype[i]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.t.bind(this,i).apply(this,a?e:[])},s}function S(o,e){Object.keys(d).forEach(function(t){var r=l(o,t);null!==r&&k[r]&&k[r](e,o)})}function l(n,e){if("serverAuth"===e)return null;return n.options,e}var E={},d={},k={},y={__esModule:!0,initializeApp:h,app:u,apps:null,Promise:Promise,SDK_VERSION:"4.8.1",INTERNAL:{registerService:C,createFirebaseNamespace:m,extendNamespace:function(t){Object(o.deepExtend)(y,t)},createSubscribe:o.createSubscribe,ErrorFactory:o.ErrorFactory,removeApp:c,factories:d,useAsService:l,Promise:Promise,deepExtend:o.deepExtend}};return Object(o.patchProperty)(y,"default",y),Object.defineProperty(y,"apps",{get:x}),Object(o.patchProperty)(u,"App",g),y}function p(n,e){throw s.create(n,e)}Object.defineProperty(e,"__esModule",{value:!0});var o=t(0),i=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},a="[DEFAULT]",r=[],g=function(){function t(n,a,t){this.r=t,this.a=!1,this.u={},this.f=a,this.h=Object(o.deepCopy)(n),this.INTERNAL={getUid:function(){return null},getToken:function(){return Promise.resolve(null)},addAuthTokenListener:function(t){r.push(t),setTimeout(function(){return t(null)},0)},removeAuthTokenListener:function(n){r=r.filter(function(e){return e!==n})}}}return Object.defineProperty(t.prototype,"name",{get:function(){return this.v(),this.f},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this.v(),this.h},enumerable:!0,configurable:!0}),t.prototype.delete=function(){var o=this;return new Promise(function(e){o.v(),e()}).then(function(){o.r.INTERNAL.removeApp(o.f);var e=[];return Object.keys(o.u).forEach(function(t){Object.keys(o.u[t]).forEach(function(r){e.push(o.u[t][r])})}),Promise.all(e.map(function(t){return t.INTERNAL.delete()}))}).then(function(){o.a=!0,o.u={}})},t.prototype.t=function(o,e){if(void 0===e&&(e=a),this.v(),this.u[o]||(this.u[o]={}),!this.u[o][e]){var t=e===a?void 0:e,r=this.r.INTERNAL.factories[o](this,this.extendApp.bind(this),t);this.u[o][e]=r}return this.u[o][e]},t.prototype.extendApp=function(n){var a=this;Object(o.deepExtend)(this,n),n.INTERNAL&&n.INTERNAL.addAuthTokenListener&&(r.forEach(function(t){a.INTERNAL.addAuthTokenListener(t)}),r=[])},t.prototype.v=function(){this.a&&p("app-deleted",{name:this.f})},t}();g.prototype.name&&g.prototype.options||g.prototype.delete||console.log("dc");var s=new o.ErrorFactory("app","Firebase",{"no-app":"No Firebase App '{$name}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$name}","duplicate-app":"Firebase App named '{$name}' already exists","app-deleted":"Firebase App named '{$name}' already deleted","duplicate-service":"Firebase service named '{$name}' already registered","sa-not-supported":"Initializing the Firebase SDK with a service account is only allowed in a Node.js environment. On client devices, you should instead initialize the SDK with an api key and auth domain","invalid-app-argument":"firebase.{$name}() takes either no argument or a Firebase App instance."});t.d(e,"firebase",function(){return c});var c=m();e.default=c},,,,,,function(o){var t=function(){return this}();try{t=t||Function("return this")()||(0,eval)("this")}catch(n){"object"==typeof a&&(t=a)}o.exports=t},,,,,,,,function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CONSTANTS={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"}},,,,,,,function(t){function m(){throw Error("setTimeout has not been defined")}function r(){throw Error("clearTimeout has not been defined")}function n(t){if(l===setTimeout)return setTimeout(t,0);if((l===m||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function o(t){if(u===clearTimeout)return clearTimeout(t);if((u===r||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(t);try{return u(t)}catch(e){try{return u.call(null,t)}catch(e){return u.call(this,t)}}}function i(){d&&y&&(d=!1,y.length?g=y.concat(g):b=-1,g.length&&a())}function a(){if(!d){var r=n(i);d=!0;for(var e=g.length;e;){for(y=g,g=[];++b<e;)y&&y[b].run();b=-1,e=g.length}y=null,d=!1,o(r)}}function c(n,e){this.fun=n,this.array=e}function e(){}var s=t.exports={},l,u;!function(){try{l="function"==typeof setTimeout?setTimeout:m}catch(t){l=m}try{u="function"==typeof clearTimeout?clearTimeout:r}catch(t){u=r}}();var g=[],d=!1,b=-1,y;s.nextTick=function(o){var e=Array(arguments.length-1);if(1<arguments.length)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];g.push(new c(o,e)),1!==g.length||d||n(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=e,s.addListener=e,s.once=e,s.off=e,s.removeListener=e,s.removeAllListeners=e,s.emit=e,s.prependListener=e,s.prependOnceListener=e,s.listeners=function(){return[]},s.binding=function(){throw Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(){throw Error("process.chdir is not supported")},s.umask=function(){return 0}},function(o,a,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var t=e(20);a.assert=function(t,n){if(!t)throw a.assertionError(n)},a.assertionError=function(n){return Error("Firebase Database ("+t.CONSTANTS.SDK_VERSION+") INTERNAL ASSERT FAILED: "+n)}},function(r,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var i=function(a){for(var e=[],t=0,r=0,n;r<a.length;r++)n=a.charCodeAt(r),128>n?e[t++]=n:2048>n?(e[t++]=192|n>>6,e[t++]=128|63&n):55296==(64512&n)&&r+1<a.length&&56320==(64512&a.charCodeAt(r+1))?(n=65536+((1023&n)<<10)+(1023&a.charCodeAt(++r)),e[t++]=240|n>>18,e[t++]=128|63&n>>12,e[t++]=128|63&n>>6,e[t++]=128|63&n):(e[t++]=224|n>>12,e[t++]=128|63&n>>6,e[t++]=128|63&n);return e},n=function(l){for(var e=[],t=0,r=0,n;t<l.length;)if(n=l[t++],128>n)e[r++]=d(n);else if(191<n&&224>n){var o=l[t++];e[r++]=d((31&n)<<6|63&o)}else if(239<n&&365>n){var o=l[t++],i=l[t++],a=l[t++],p=((7&n)<<18|(63&o)<<12|(63&i)<<6|63&a)-65536;e[r++]=d(55296+(p>>10)),e[r++]=d(56320+(1023&p))}else{var o=l[t++],i=l[t++];e[r++]=d((15&n)<<12|(63&o)<<6|63&i)}return e.join("")};a.base64={y:null,b:null,_:null,g:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(d,e){if(!Array.isArray(d))throw Error("encodeByteArray takes an array as a parameter");this.O();for(var t=e?this._:this.y,r=[],n=0;n<d.length;n+=3){var o=d[n],i=n+1<d.length,a=i?d[n+1]:0,c=n+2<d.length,s=c?d[n+2]:0,u=(15&a)<<2|s>>6,l=63&s;c||(l=64,i||(u=64)),r.push(t[o>>2],t[(3&o)<<4|a>>4],t[u],t[l])}return r.join("")},encodeString:function(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(i(n),e)},decodeString:function(o,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(o):n(this.decodeStringToByteArray(o,e))},decodeStringToByteArray:function(d,e){this.O();for(var t=e?this.g:this.b,r=[],n=0;n<d.length;){var o=t[d.charAt(n++)],i=n<d.length,a=i?t[d.charAt(n)]:0;++n;var l=n<d.length,s=l?t[d.charAt(n)]:64;++n;var p=n<d.length,c=p?t[d.charAt(n)]:64;if(++n,null==o||null==a||null==s||null==c)throw Error();if(r.push(o<<2|a>>4),64!=s){if(r.push(240&a<<4|s>>2),64!=c){r.push(192&s<<6|c)}}}return r},O:function(){if(!this.y){this.y={},this.b={},this._={},this.g={};for(var t=0;t<this.ENCODED_VALS.length;t++)this.y[t]=this.ENCODED_VALS.charAt(t),this.b[this.y[t]]=t,this._[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.g[this._[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.b[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.g[this.ENCODED_VALS.charAt(t)]=t)}}},a.base64Encode=function(t){var e=i(t);return a.base64.encodeByteArray(e,!0)},a.base64Decode=function(t){try{return a.base64.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}},function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.jsonEval=function(t){return JSON.parse(t)},e.stringify=function(t){return JSON.stringify(t)}},function(n,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.contains=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},a.safeGet=function(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]},a.forEach=function(n,e){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])},a.extend=function(n,e){return a.forEach(e,function(e,t){n[e]=t}),n},a.clone=function(t){return a.extend({},t)},a.isNonNullObject=function(t){return"object"==typeof t&&null!==t},a.isEmpty=function(n){for(var e in n)return!1;return!0},a.getCount=function(n){var e=0;for(var t in n)e++;return e},a.map=function(a,e,t){var r={};for(var n in a)r[n]=e.call(t,a[n],n,a);return r},a.findKey=function(o,e,t){for(var r in o)if(e.call(t,o[r],r,o))return r},a.findValue=function(t,e,r){var n=a.findKey(t,e,r);return n&&t[n]},a.getAnyKey=function(n){for(var e in n)return e},a.getValues=function(o){var e=[],t=0;for(var r in o)e[t++]=o[r];return e},a.every=function(n,e){for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&!e(t,n[t]))return!1;return!0}},,,,,,,,,,,,,,,,,,,,,,,,,,function(n,e,t){t(58),n.exports=t(6).default},function(a,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t(59),n=(t.n(r),t(63)),o=(t.n(n),t(64));t.n(o)},function(e,t,o){(function(e){var t=function(){if(void 0!==e)return e;if(void 0!==a)return a;if("undefined"!=typeof self)return self;throw Error("unable to locate global object")}();"undefined"==typeof Promise&&(t.Promise=Promise=o(60))}).call(t,o(12))},function(d,e,t){(function(p){!function(e){function m(){}function n(n,e){return function(){n.apply(e,arguments)}}function o(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this.T=[],g(t,this)}function i(i,s){for(;3===i._state;)i=i._value;return 0===i._state?void i.T.push(s):void(i._handled=!0,o.A(function(){var e=1===i._state?s.onFulfilled:s.onRejected;if(null===e)return void(1===i._state?a:c)(s.promise,i._value);var t;try{t=e(i._value)}catch(t){return void c(s.promise,t)}a(s.promise,t)}))}function a(a,e){try{if(e===a)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var i=e.then;if(e instanceof o)return a._state=3,a._value=e,void s(a);if("function"==typeof i)return void g(n(i,e),a)}a._state=1,a._value=e,s(a)}catch(e){c(a,e)}}function c(n,e){n._state=2,n._value=e,s(n)}function s(n){2===n._state&&0===n.T.length&&o.A(function(){n._handled||o.j(n._value)});for(var e=0,t=n.T.length;e<t;e++)i(n,n.T[e]);n.T=null}function u(n,o,a){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof o?o:null,this.promise=a}function g(n,o){var t=!1;try{n(function(n){t||(t=!0,a(o,n))},function(n){t||(t=!0,c(o,n))})}catch(n){if(t)return;t=!0,c(o,n)}}var r=setTimeout;o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(n,e){var t=new this.constructor(m);return i(this,new u(n,e,t)),t},o.all=function(n){var s=Array.prototype.slice.call(n);return new o(function(t,d){function r(n,o){try{if(o&&("object"==typeof o||"function"==typeof o)){var i=o.then;if("function"==typeof i)return void i.call(o,function(t){r(n,t)},d)}s[n]=o,0==--e&&t(s)}catch(t){d(t)}}if(0===s.length)return t([]);for(var e=s.length,n=0;n<s.length;n++)r(n,s[n])})},o.resolve=function(n){return n&&"object"==typeof n&&n.constructor===o?n:new o(function(e){e(n)})},o.reject=function(n){return new o(function(e,t){t(n)})},o.race=function(a){return new o(function(e,t){for(var r=0,n=a.length;r<n;r++)a[r].then(e,t)})},o.A="function"==typeof p&&function(t){p(t)}||function(t){r(t,0)},o.j=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},o.S=function(t){o.A=t},o.w=function(t){o.j=t},void 0!==d&&d.exports?d.exports=o:e.Promise||(e.Promise=o)}(this)}).call(e,t(61).setImmediate)},function(e,t,r){function n(n,e){this.P=n,this._clearFn=e}var o=Function.prototype.apply;t.setTimeout=function(){return new n(o.call(setTimeout,a,arguments),clearTimeout)},t.setInterval=function(){return new n(o.call(setInterval,a,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(t){t&&t.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(a,this.P)},t.enroll=function(n,e){clearTimeout(n.N),n.C=e},t.unenroll=function(t){clearTimeout(t.N),t.C=-1},t.k=t.active=function(n){clearTimeout(n.N);var e=n.C;0<=e&&(n.N=setTimeout(function(){n.M&&n.M()},e))},r(62),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(n,e,t){(function(n,o){!function(d,e){"use strict";function t(o){"function"!=typeof o&&(o=Function(""+o));for(var i=Array(arguments.length-1),d=0;d<i.length;d++)i[d]=arguments[d+1];var r={callback:o,args:i};return s[a]=r,l(a),a++}function n(t){delete s[t]}function r(o){var r=o.callback,t=o.args;switch(t.length){case 0:r();break;case 1:r(t[0]);break;case 2:r(t[0],t[1]);break;case 3:r(t[0],t[1],t[2]);break;default:r.apply(e,t);}}function i(o){if(p)setTimeout(i,0,o);else{var e=s[o];if(e){p=!0;try{r(e)}finally{n(o),p=!1}}}}if(!d.setImmediate){var a=1,s={},p=!1,u=d.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(d),l;h=h&&h.setTimeout?h:d,"[object process]"==={}.toString.call(d.process)?function(){l=function(t){o.nextTick(function(){i(t)})}}():function(){if(d.postMessage&&!d.importScripts){var e=!0,t=d.onmessage;return d.onmessage=function(){e=!1},d.postMessage("","*"),d.onmessage=t,e}}()?function(){var e="setImmediate$"+Math.random()+"$",t=function(t){t.source===d&&"string"==typeof t.data&&0===t.data.indexOf(e)&&i(+t.data.slice(e.length))};d.addEventListener?d.addEventListener("message",t,!1):d.attachEvent("onmessage",t),l=function(t){d.postMessage(e+t,"*")}}():d.MessageChannel?function(){var n=new MessageChannel;n.port1.onmessage=function(t){i(t.data)},l=function(e){n.port2.postMessage(e)}}():u&&"onreadystatechange"in u.createElement("script")?function(){var n=u.documentElement;l=function(e){var t=u.createElement("script");t.onreadystatechange=function(){i(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}}():function(){l=function(t){setTimeout(i,0,t)}}(),h.setImmediate=t,h.clearImmediate=n}}("undefined"==typeof self?void 0===n?this:n:self)}).call(e,t(12),t(27))},function(){Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(a){if(null==this)throw new TypeError("\"this\" is null or not defined");var s=Object(this),t=s.length>>>0;if("function"!=typeof a)throw new TypeError("predicate must be a function");for(var r=arguments[1],n=0,o;n<t;){if(o=s[n],a.call(r,o,n,s))return o;n++}}})},function(){Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(a){if(null==this)throw new TypeError("\"this\" is null or not defined");var s=Object(this),t=s.length>>>0;if("function"!=typeof a)throw new TypeError("predicate must be a function");for(var r=arguments[1],n=0,o;n<t;){if(o=s[n],a.call(r,o,n,s))return n;n++}return-1}})},function(n,e){"use strict";function r(o,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===o&&(o={});break;case Array:o=[];break;default:return e;}for(var t in e)e.hasOwnProperty(t)&&(o[t]=r(o[t],e[t]));return o}Object.defineProperty(e,"__esModule",{value:!0}),e.deepCopy=function(t){return r(void 0,t)},e.deepExtend=r,e.patchProperty=function(n,e,t){n[e]=t}},function(o,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function t(){var n=this;this.promise=new Promise(function(e,t){n.resolve=e,n.reject=t})}return t.prototype.wrapCallback=function(o){var a=this;return function(t,r){t?a.reject(t):a.resolve(r),"function"==typeof o&&(a.promise.catch(function(){}),1===o.length?o(t):o(t,r))}},t}();e.Deferred=t},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(20);t.getUA=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""},t.isMobileCordova=function(){return void 0!==a&&!!(a.cordova||a.phonegap||a.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(t.getUA())},t.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},t.isNodeSdk=function(){return!0===n.CONSTANTS.NODE_CLIENT||!0===n.CONSTANTS.NODE_ADMIN}},function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t="FirebaseError",o=Error.captureStackTrace;e.patchCapture=function(n){var e=o;return o=n,e};var s=function(){function n(n,i){if(this.code=n,this.message=i,o)o(this,a.prototype.create);else{var s=Error.apply(this,arguments);this.name=t,Object.defineProperty(this,"stack",{get:function(){return s.stack}})}}return n}();e.FirebaseError=s,s.prototype=Object.create(Error.prototype),s.prototype.constructor=s,s.prototype.name=t;var a=function(){function t(n,o,t){this.service=n,this.serviceName=o,this.errors=t,this.pattern=/\{\$([^}]+)}/g}return t.prototype.create=function(a,d){void 0===d&&(d={});var e=this.errors[a],t=this.service+"/"+a,n;n=void 0===e?"Error":e.replace(this.pattern,function(t,e){var o=d[e];return void 0===o?"<"+e+"?>":""+o}),n=this.serviceName+": "+n+" ("+t+").";var o=new s(t,n);for(var r in d)d.hasOwnProperty(r)&&"_"!==r.slice(-1)&&(o[r]=d[r]);return o},t}();e.ErrorFactory=a},function(a,s,e){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var d=e(29),n=e(30);s.decode=function(o){var e={},s={},l={},p="";try{var u=o.split(".");e=n.jsonEval(d.base64Decode(u[0])||""),s=n.jsonEval(d.base64Decode(u[1])||""),p=u[2],l=s.d||{},delete s.d}catch(t){}return{header:e,claims:s,data:l,signature:p}},s.isValidTimestamp=function(t){var e=s.decode(t).claims,a=Math.floor(new Date().getTime()/1e3),i,r;return"object"==typeof e&&(e.hasOwnProperty("nbf")?i=e.nbf:e.hasOwnProperty("iat")&&(i=e.iat),r=e.hasOwnProperty("exp")?e.exp:i+86400),a&&i&&r&&a>=i&&a<=r},s.issuedAtTime=function(t){var e=s.decode(t).claims;return"object"==typeof e&&e.hasOwnProperty("iat")?e.iat:null},s.isValidFormat=function(t){var e=s.decode(t),o=e.claims;return!!e.signature&&!!o&&"object"==typeof o&&o.hasOwnProperty("iat")},s.isAdmin=function(t){var e=s.decode(t).claims;return"object"==typeof e&&!0===e.admin}},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t(31);e.querystring=function(n){var o=[];return r.forEach(n,function(t,e){Array.isArray(e)?e.forEach(function(e){o.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}):o.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}),o.length?"&"+o.join("&"):""},e.querystringDecode=function(n){var o={};return n.replace(/^\?/,"").split("&").forEach(function(t){if(t){var e=t.split("=");o[e[0]]=e[1]}}),o}},function(a,e,t){"use strict";var r=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t])};return function(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var n=t(72),o=function(n){function e(){var e=n.call(this)||this;e.D=[],e.I=[],e.x=[],e.F=[],e.L=0,e.R=0,e.blockSize=64,e.F[0]=128;for(var o=1;o<e.blockSize;++o)e.F[o]=0;return e.reset(),e}return r(e,n),e.prototype.reset=function(){this.D[0]=1732584193,this.D[1]=4023233417,this.D[2]=2562383102,this.D[3]=271733878,this.D[4]=3285377520,this.L=0,this.R=0},e.prototype.B=function(d,l){l||(l=0);var t=this.x;if("string"==typeof d)for(var r=0;16>r;r++)t[r]=d.charCodeAt(l)<<24|d.charCodeAt(l+1)<<16|d.charCodeAt(l+2)<<8|d.charCodeAt(l+3),l+=4;else for(var r=0;16>r;r++)t[r]=d[l]<<24|d[l+1]<<16|d[l+2]<<8|d[l+3],l+=4;for(var r=16,n;80>r;r++)n=t[r-3]^t[r-8]^t[r-14]^t[r-16],t[r]=4294967295&(n<<1|n>>>31);for(var o=this.D[0],p=this.D[1],s=this.D[2],c=this.D[3],u=this.D[4],r=0,h,i;80>r;r++){40>r?20>r?(h=c^p&(s^c),i=1518500249):(h=p^s^c,i=1859775393):60>r?(h=p&s|c&(p|s),i=2400959708):(h=p^s^c,i=3395469782);var n=4294967295&(o<<5|o>>>27)+h+u+i+t[r];u=c,c=s,s=4294967295&(p<<30|p>>>2),p=o,o=n}this.D[0]=4294967295&this.D[0]+o,this.D[1]=4294967295&this.D[1]+p,this.D[2]=4294967295&this.D[2]+s,this.D[3]=4294967295&this.D[3]+c,this.D[4]=4294967295&this.D[4]+u},e.prototype.update=function(a,s){if(null!=a){void 0===s&&(s=a.length);for(var t=s-this.blockSize,r=0,n=this.I,o=this.L;r<s;){if(0==o)for(;r<=t;)this.B(a,r),r+=this.blockSize;if("string"==typeof a){for(;r<s;)if(n[o]=a.charCodeAt(r),++o,++r,o==this.blockSize){this.B(n),o=0;break}}else for(;r<s;)if(n[o]=a[r],++o,++r,o==this.blockSize){this.B(n),o=0;break}}this.L=o,this.R+=s}},e.prototype.digest=function(){var a=[],e=8*this.R;56>this.L?this.update(this.F,56-this.L):this.update(this.F,this.blockSize-(this.L-56));for(var t=this.blockSize-1;56<=t;t--)this.I[t]=255&e,e/=256;this.B(this.I);for(var r=0,t=0;5>t;t++)for(var n=24;0<=n;n-=8)a[r]=255&this.D[t]>>n,++r;return a},e}(n.Hash);e.Sha1=o},function(o,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){return function(){this.blockSize=-1}}();e.Hash=t},function(n,e){"use strict";function s(a,i){if("object"!=typeof a||null===a)return!1;for(var t=0,r=i,n;t<r.length;t++)if(n=r[t],n in a&&"function"==typeof a[n])return!0;return!1}function i(){}Object.defineProperty(e,"__esModule",{value:!0}),e.createSubscribe=function(n,e){var t=new o(n,e);return t.subscribe.bind(t)};var o=function(){function t(n,o){var t=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=o,this.task.then(function(){n(t)}).catch(function(n){t.error(n)})}return t.prototype.next=function(n){this.forEachObserver(function(e){e.next(n)})},t.prototype.error=function(n){this.forEachObserver(function(e){e.error(n)}),this.close(n)},t.prototype.complete=function(){this.forEachObserver(function(t){t.complete()}),this.close()},t.prototype.subscribe=function(a,d,l){var p=this,o;if(void 0===a&&void 0===d&&void 0===l)throw Error("Missing Observer.");o=s(a,["next","error","complete"])?a:{next:a,error:d,complete:l},void 0===o.next&&(o.next=i),void 0===o.error&&(o.error=i),void 0===o.complete&&(o.complete=i);var n=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{p.finalError?o.error(p.finalError):o.complete()}catch(t){}}),this.observers.push(o),n},t.prototype.unsubscribeOne=function(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},t.prototype.forEachObserver=function(n){if(!this.finalized)for(var e=0;e<this.observers.length;e++)this.sendOne(e,n)},t.prototype.sendOne=function(n,e){var t=this;this.task.then(function(){if(void 0!==t.observers&&void 0!==t.observers[n])try{e(t.observers[n])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}})},t.prototype.close=function(n){var e=this;this.finalized||(this.finalized=!0,void 0!==n&&(this.finalError=n),this.task.then(function(){e.observers=void 0,e.onNoObservers=void 0}))},t}();e.async=function(n,o){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];Promise.resolve(!0).then(function(){n.apply(void 0,e)}).catch(function(t){o&&o(t)})}}},function(r,e){"use strict";function a(a,e,t){var r="";switch(e){case 1:r=t?"first":"First";break;case 2:r=t?"second":"Second";break;case 3:r=t?"third":"Third";break;case 4:r=t?"fourth":"Fourth";break;default:throw Error("errorPrefix called with argumentNumber > 4. Need to update it?");}var i=a+" failed: ";return i+=r+" argument "}function t(n,e,t,i){if((!i||t)&&"string"!=typeof t)throw Error(a(n,e,i)+"must be a valid firebase namespace.")}Object.defineProperty(e,"__esModule",{value:!0}),e.validateArgCount=function(a,e,t,r){var n;if(r<e?n="at least "+e:r>t&&(n=0===t?"none":"no more than "+t),n){var o=a+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+n+".";throw Error(o)}},e.errorPrefix=a,e.validateNamespace=t,e.validateCallback=function(n,e,t,i){if((!i||t)&&"function"!=typeof t)throw Error(a(n,e,i)+"must be a valid function.")},e.validateContextObject=function(n,e,t,i){if((!i||t)&&("object"!=typeof t||null===t))throw Error(a(n,e,i)+"must be a valid context object.")}},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=t(28);e.stringToByteArray=function(n){for(var e=[],t=0,s=0,o;s<n.length;s++){if(o=n.charCodeAt(s),55296<=o&&56319>=o){var i=o-55296;s++,r.assert(s<n.length,"Surrogate pair missing trail surrogate."),o=65536+(i<<10)+(n.charCodeAt(s)-56320)}128>o?e[t++]=o:2048>o?(e[t++]=192|o>>6,e[t++]=128|63&o):65536>o?(e[t++]=224|o>>12,e[t++]=128|63&o>>6,e[t++]=128|63&o):(e[t++]=240|o>>18,e[t++]=128|63&o>>12,e[t++]=128|63&o>>6,e[t++]=128|63&o)}return e},e.stringLength=function(o){for(var e=0,t=0,r;t<o.length;t++)r=o.charCodeAt(t),128>r?e++:2048>r?e+=2:55296<=r&&56319>=r?(e+=4,t++):e+=3;return e}}])}().default;try{webpackJsonpFirebase([4],{76:function(o,t,n){n(77)},77:function(o,t,Kn){var ed=Math.floor,d=Math.max;(function(e){(function(){function td(e){return"string"==typeof e}function e(e){return"boolean"==typeof e}function nd(){}function i(o){var r=typeof o;if("object"==r){if(!o)return"null";if(o instanceof Array)return"array";if(o instanceof Object)return r;var n=Object.prototype.toString.call(o);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof o.length&&void 0!==o.splice&&void 0!==o.propertyIsEnumerable&&!o.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==o.call&&void 0!==o.propertyIsEnumerable&&!o.propertyIsEnumerable("call"))return"function"}else if("function"==r&&void 0===o.call)return"object";return r}function r(e){return null===e}function od(e){return"array"==i(e)}function rd(e){var t=i(e);return"array"==t||"object"==t&&"number"==typeof e.length}function a(e){return"function"==i(e)}function ad(e){var o=typeof e;return"object"==o&&null!=e||"function"==o}function s(e){return e.call.apply(e.bind,arguments)}function h(o,r){if(!o)throw Error();if(2<arguments.length){var n=Array.prototype.slice.call(arguments,2);return function(){var t=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(t,n),o.apply(r,t)}}return function(){return o.apply(r,arguments)}}function f(){return f=Function.prototype.bind&&-1!=(""+Function.prototype.bind).indexOf("native code")?s:h,f.apply(null,arguments)}function l(o){var t=Array.prototype.slice.call(arguments,1);return function(){var e=t.slice();return e.push.apply(e,arguments),o.apply(this,e)}}function id(o,a){function t(){}t.prototype=a.prototype,o.ib=a.prototype,o.prototype=new t,o.prototype.constructor=o,o.Rc=function(n,t){for(var e=Array(arguments.length-2),r=2;r<arguments.length;r++)e[r-2]=arguments[r];return a.prototype[t].apply(n,e)}}function p(e){if(Error.captureStackTrace)Error.captureStackTrace(this,p);else{var t=Error().stack;t&&(this.stack=t)}e&&(this.message=e+"")}function v(n){for(var t=n.split("%s"),e="",o=Array.prototype.slice.call(arguments,1);o.length&&1<t.length;)e+=t.shift()+o.shift();return e+t.join("%s")}function m(e){return Hd.test(e)?(-1!=e.indexOf("&")&&(e=e.replace(Md,"&")),-1!=e.indexOf("<")&&(e=e.replace(Fd,"<")),-1!=e.indexOf(">")&&(e=e.replace(Bd,">")),-1!=e.indexOf("\"")&&(e=e.replace(Ud,""")),-1!=e.indexOf("'")&&(e=e.replace(Vd,"'")),-1!=e.indexOf("\0")&&(e=e.replace(Wd,"�")),e):e}function g(e,t){return-1!=e.indexOf(t)}function b(e,t){return e<t?-1:e>t?1:0}function w(e,t){t.unshift(e),p.call(this,v.apply(null,t)),t.shift()}function y(e){throw new w("Failure"+(e?": "+e:""),Array.prototype.slice.call(arguments,1))}function I(t,n){var e=t.length,o=td(t)?t.split(""):t;for(--e;0<=e;--e)e in o&&n.call(void 0,o[e],e,t)}function T(t){t:{for(var n=Te,e=t.length,a=td(t)?t.split(""):t,r=0;r<e;r++)if(r in a&&n.call(void 0,a[r],r,t)){n=r;break t}n=-1}return 0>n?null:td(t)?t.charAt(n):t[n]}function A(e,t){return 0<=jd(e,t)}function k(o,t){t=jd(o,t);var n;return(n=0<=t)&&Array.prototype.splice.call(o,t,1),n}function E(o,t){var n=0;I(o,function(e,a){t.call(void 0,e,a,o)&&1==Array.prototype.splice.call(o,a,1).length&&n++})}function N(){return Array.prototype.concat.apply([],arguments)}function S(o){var t=o.length;if(0<t){for(var n=Array(t),e=0;e<t;e++)n[e]=o[e];return n}return[]}function O(e){return g(Gd,e)}function P(o,t){for(var n in o)t.call(void 0,o[n],n,o)}function C(o){var t=[],e=0,r;for(r in o)t[e++]=o[r];return t}function R(o){var t=[],e=0,r;for(r in o)t[e++]=r;return t}function _(e){for(var t in e)return!1;return!0}function D(o,t){for(var n in o)if(!(n in t)||o[n]!==t[n])return!1;for(n in t)if(!(n in o))return!1;return!0}function L(o){var t={},e;for(e in o)t[e]=o[e];return t}function x(n){for(var t=1,r,e;t<arguments.length;t++){for(r in e=arguments[t],e)n[r]=e[r];for(var a=0;a<Yd.length;a++)r=Yd[a],Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}}function U(e){return U[" "](e),e}function j(o,t){var n=sl;return Object.prototype.hasOwnProperty.call(n,o)?n[o]:n[o]=t(o)}function M(){var e=Ld.document;return e?e.documentMode:void 0}function V(l){return j(l,function(){for(var t=0,n=Dd(ol+"").split("."),e=Dd(l+"").split("."),i=d(n.length,e.length),r=0;0==t&&r<i;r++){var o=n[r]||"",a=e[r]||"";do{if(o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],a=/(\d*)(\D*)(.*)/.exec(a)||["","","",""],0==o[0].length&&0==a[0].length)break;t=b(0==o[1].length?0:parseInt(o[1],10),0==a[1].length?0:parseInt(a[1],10))||b(0==o[2].length,0==a[2].length)||b(o[2],a[2]),o=o[3],a=a[3]}while(0==t)}return 0<=t})}function F(e){e.prototype.then=e.prototype.then,e.prototype.$goog_Thenable=!0}function K(e){if(!e)return!1;try{return!!e.$goog_Thenable}catch(e){return!1}}function q(o,t,n){this.f=n,this.c=o,this.g=t,this.b=0,this.a=null}function X(e,t){e.g(t),e.b<e.f&&(e.b++,t.next=e.a,e.a=t)}function B(){var e=ul,t=null;return e.a&&(t=e.a,e.a=e.a.next,e.a||(e.b=null),t.next=null),t}function H(){this.next=this.b=this.a=null}function W(e){Ld.setTimeout(function(){throw e},0)}function G(){var o=Ld.MessageChannel;if(void 0===o&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!O("Presto")&&(o=function(){var o=document.createElement("IFRAME");o.style.display="none",o.src="",document.documentElement.appendChild(o);var t=o.contentWindow;o=t.document,o.open(),o.write(""),o.close();var n="callImmediate"+Math.random(),e="file:"==t.location.protocol?"*":t.location.protocol+"//"+t.location.host;o=f(function(o){"*"!=e&&o.origin!=e||o.data!=n||this.port1.onmessage()},this),t.addEventListener("message",o,!1),this.port1={},this.port2={postMessage:function(){t.postMessage(n,e)}}}),void 0!==o&&!O("Trident")&&!O("MSIE")){var r=new o,n={},e=n;return r.port1.onmessage=function(){if(void 0!==n.next){n=n.next;var e=n.pb;n.pb=null,e()}},function(n){e.next={pb:n},e=e.next,r.port2.postMessage(0)}}return"undefined"!=typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(e){var t=document.createElement("SCRIPT");t.onreadystatechange=function(){t.onreadystatechange=null,t.parentNode.removeChild(t),t=null,e(),e=null},document.documentElement.appendChild(t)}:function(e){Ld.setTimeout(e,0)}}function z(o,t){yl||J(),cl||(yl(),cl=!0);var n=ul,e=pl.get();e.set(o,t),n.b?n.b.next=e:n.a=e,n.b=e}function J(){if(-1!=(Ld.Promise+"").indexOf("[native code]")){var e=Ld.Promise.resolve(void 0);yl=function(){e.then(Y)}}else yl=function(){var e=Y;!a(Ld.setImmediate)||Ld.Window&&Ld.Window.prototype&&!O("Edge")&&Ld.Window.prototype.setImmediate==Ld.setImmediate?(fl||(fl=G()),fl(e)):Ld.setImmediate(e)}}function Y(){for(var e;e=B();){try{e.a.call(e.b)}catch(e){W(e)}X(pl,e)}cl=!1}function $(o,t){if(this.a=hl,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,o!=nd)try{var n=this;o.call(t,function(e){ct(n,ml,e)},function(e){if(!(e instanceof gt))try{if(e instanceof Error)throw e;throw Error("Promise rejected.")}catch(e){}ct(n,gl,e)})}catch(e){ct(this,gl,e)}}function Z(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}function Q(o,t,n){var e=bl.get();return e.g=o,e.b=t,e.f=n,e}function tt(e){if(e instanceof $)return e;var t=new $(nd);return ct(t,ml,e),t}function nt(o){return new $(function(t,n){n(o)})}function et(o,t,n){ht(o,t,n,null)||z(l(t,o))}function it(d){return new $(function(p,n){var c=d.length,i=[];if(c)for(var e=function(n,t){c--,i[n]=t,0==c&&p(i)},t=function(e){n(e)},r=0,a;r<d.length;r++)a=d[r],et(a,l(e,r),t);else p(i)})}function rt(s){return new $(function(d){var n=s.length,e=[];if(n)for(var t=function(a,t,r){n--,e[a]=t?{Ub:!0,value:r}:{Ub:!1,reason:r},0==n&&d(e)},o=0,a;o<s.length;o++)a=s[o],et(a,l(t,o,!0),l(t,o,!1));else d(e)})}function ot(e,t){return t=Q(t,t,void 0),t.c=!0,st(e,t),e}function at(s,t){if(s.a==hl)if(s.c){var n=s.c;if(n.b){for(var e=0,i=null,r=null,o=n.b;o&&(o.c||(e++,o.a==s&&(i=o),!(i&&1<e)));o=o.next)i||(r=o);i&&(n.a==hl&&1==e?at(n,t):(r?(e=r,e.next==n.f&&(n.f=e),e.next=e.next.next):dt(n),pt(n,i,gl,t)))}s.c=null}else ct(s,gl,t)}function st(e,t){e.b||e.a!=ml&&e.a!=gl||lt(e),e.f?e.f.next=t:e.b=t,e.f=t}function ut(o,a,s,d){var e=Q(null,null,null);return e.a=new $(function(i,l){e.g=a?function(t){try{var e=a.call(d,t);i(e)}catch(e){l(e)}}:i,e.b=s?function(e){try{var t=s.call(d,e);void 0===t&&e instanceof gt?l(e):i(t)}catch(e){l(e)}}:l}),e.a.c=o,st(o,e),e.a}function ct(o,t,n){o.a==hl&&(o===n&&(t=gl,n=new TypeError("Promise cannot resolve to itself")),o.a=1,ht(n,o.Ac,o.Bc,o)||(o.i=n,o.a=t,o.c=null,lt(o),t!=gl||n instanceof gt||mt(o,n)))}function ht(i,t,n,e){if(i instanceof $)return st(i,Q(t||nd,n||null,e)),!0;if(K(i))return i.then(t,n,e),!0;if(ad(i))try{var r=i.then;if(a(r))return ft(i,r,t,n,e),!0}catch(o){return n.call(e,o),!0}return!1}function ft(d,t,n,e,i){function r(n){a||(a=!0,e.call(i,n))}function o(e){a||(a=!0,n.call(i,e))}var a=!1;try{t.call(d,o,r)}catch(e){r(e)}}function lt(e){e.h||(e.h=!0,z(e.Qb,e))}function dt(e){var t=null;return e.b&&(t=e.b,e.b=t.next,t.next=null),e.b||(e.f=null),t}function pt(o,t,n,e){if(n==gl&&t.b&&!t.c)for(;o&&o.g;o=o.c)o.g=!1;if(t.a)t.a.c=null,vt(t,n,e);else try{t.c?t.g.call(t.f):vt(t,n,e)}catch(e){vl.call(null,e)}X(bl,t)}function vt(o,t,n){t==ml?o.g.call(o.f,n):o.b&&o.b.call(o.f,n)}function mt(e,t){e.g=!0,z(function(){e.g&&vl.call(null,t)})}function gt(e){p.call(this,e)}function bt(){this.a="",this.b=Cl}function wt(e){return e instanceof bt&&e.constructor===bt&&e.b===Cl?e.a:(y("expected object of type Const, got '"+e+"'"),"type_error:Const")}function yt(e){var t=new bt;return t.a=e,t}function It(){this.a="",this.b=kl}function Tt(e){return e instanceof It&&e.constructor===It&&e.b===kl?e.a:(y("expected object of type TrustedResourceUrl, got '"+e+"' of type "+i(e)),"type_error:TrustedResourceUrl")}function At(e,t){return e=kt(e,t),t=new It,t.a=e,t}function kt(o,r){var n=wt(o);if(!El.test(n))throw Error("Invalid TrustedResourceUrl format: "+n);return n.replace(Sl,function(e,t){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error("Found marker, \""+t+"\", in format string, \""+n+"\", but no valid label mapping found in args: "+JSON.stringify(r));return e=r[t],e instanceof bt?wt(e):encodeURIComponent(e+"")})}function Et(){this.a="",this.b=wl}function Nt(e){return e instanceof Et&&e.constructor===Et&&e.b===wl?e.a:(y("expected object of type SafeUrl, got '"+e+"' of type "+i(e)),"type_error:SafeUrl")}function St(e){return e instanceof Et?e:(e=e.la?e.ja():e+"",Tl.test(e)||(e="about:invalid#zClosurez"),Ot(e))}function Ot(e){var t=new Et;return t.a=e,t}function Pt(){this.a="",this.b=Il}function Ct(e){return e instanceof Pt&&e.constructor===Pt&&e.b===Il?e.a:(y("expected object of type SafeHtml, got '"+e+"' of type "+i(e)),"type_error:SafeHtml")}function Rt(e){var t=new Pt;return t.a=e,t}function _t(t){var n=document;return td(t)?n.getElementById(t):t}function Dt(o,e){P(e,function(t,n){t&&t.la&&(t=t.ja()),"style"==n?o.style.cssText=t:"class"==n?o.className=t:"for"==n?o.htmlFor=t:Nl.hasOwnProperty(n)?o.setAttribute(Nl[n],t):0==n.lastIndexOf("aria-",0)||0==n.lastIndexOf("data-",0)?o.setAttribute(n,t):o[n]=t})}function Lt(){var e=arguments,t=document,n=e[0]+"",o=e[1];if(!xl&&o&&(o.name||o.type)){if(n=["<",n],o.name&&n.push(" name=\"",m(o.name),"\""),o.type){n.push(" type=\"",m(o.type),"\"");var r={};x(r,o),delete r.type,o=r}n.push(">"),n=n.join("")}return n=t.createElement(n),o&&(td(o)?n.className=o:od(o)?n.className=o.join(" "):Dt(n,o)),2<e.length&&xt(t,n,e),n}function xt(t,n,e){function i(e){e&&n.appendChild(td(e)?t.createTextNode(e):e)}for(var r=2,o;r<e.length;r++)o=e[r],!rd(o)||ad(o)&&0<o.nodeType?i(o):qd(Ut(o)?S(o):o,i)}function Ut(e){if(e&&"number"==typeof e.length){if(ad(e))return"function"==typeof e.item||"string"==typeof e.item;if(a(e))return"function"==typeof e.item}return!1}function jt(e){var t=[];return Vt(new Mt,e,t),t.join("")}function Mt(){}function Vt(a,t,s){if(null==t)s.push("null");else{if("object"==typeof t){if(od(t)){var e=t;t=e.length,s.push("[");for(var i="",r=0;r<t;r++)s.push(i),Vt(a,e[r],s),i=",";return void s.push("]")}if(!(t instanceof String||t instanceof Number||t instanceof Boolean)){for(e in s.push("{"),i="",t)Object.prototype.hasOwnProperty.call(t,e)&&"function"!=typeof(r=t[e])&&(s.push(i),Ft(e,s),s.push(":"),Vt(a,r,s),i=",");return void s.push("}")}t=t.valueOf()}switch(typeof t){case"string":Ft(t,s);break;case"number":s.push(isFinite(t)&&!isNaN(t)?t+"":"null");break;case"boolean":s.push(t+"");break;case"function":s.push("null");break;default:throw Error("Unknown type: "+typeof t);}}}function Ft(e,t){t.push("\"",e.replace(Ll,function(e){var t=Al[e];return t||(t="\\u"+(65536|e.charCodeAt(0)).toString(16).substr(1),Al[e]=t),t}),"\"")}function Kt(){0!=Rl&&(Ol[this[Rd]||(this[Rd]=++Od)]=this),this.oa=this.oa,this.Fa=this.Fa}function qt(e){e.oa||(e.oa=!0,e.ta(),0!=Rl&&(e=e[Rd]||(e[Rd]=++Od),delete Ol[e]))}function Xt(e,t){this.type=e,this.b=this.target=t,this.Bb=!0}function Bt(t,n){if(Xt.call(this,t?t.type:""),this.relatedTarget=this.b=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.pointerId=0,this.pointerType="",this.a=null,t){var e=this.type=t.type,a=t.changedTouches?t.changedTouches[0]:null;if(!(this.target=t.target||t.srcElement,this.b=n,n=t.relatedTarget))"mouseover"==e?n=t.fromElement:"mouseout"==e&&(n=t.toElement);else if(tl){t:{try{U(n.nodeName);var r=!0;break t}catch(e){}r=!1}r||(n=null)}this.relatedTarget=n,null===a?(this.clientX=void 0===t.clientX?t.pageX:t.clientX,this.clientY=void 0===t.clientY?t.pageY:t.clientY,this.screenX=t.screenX||0,this.screenY=t.screenY||0):(this.clientX=void 0===a.clientX?a.pageX:a.clientX,this.clientY=void 0===a.clientY?a.pageY:a.clientY,this.screenX=a.screenX||0,this.screenY=a.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=td(t.pointerType)?t.pointerType:Fl[t.pointerType]||"",this.a=t,t.defaultPrevented&&this.c()}}function Ht(o,t,n,e,a){this.listener=o,this.a=null,this.src=t,this.type=n,this.capture=!!e,this.La=a,this.key=++Ul,this.ma=this.Ha=!1}function Wt(e){e.ma=!0,e.listener=null,e.a=null,e.src=null,e.La=null}function Gt(e){this.src=e,this.a={},this.b=0}function zt(d,t,n,e,i,l){var o=""+t;(t=d.a[o])||(t=d.a[o]=[],d.b++);var a=Yt(t,n,i,l);return-1<a?(d=t[a],e||(d.Ha=!1)):(d=new Ht(n,d.src,o,!!i,l),d.Ha=e,t.push(d)),d}function Jt(o,t){var n=t.type;n in o.a&&k(o.a[n],t)&&(Wt(t),0==o.a[n].length&&(delete o.a[n],o.b--))}function Yt(a,t,n,s){for(var i=0,r;i<a.length;++i)if(r=a[i],!r.ma&&r.listener==t&&r.capture==!!n&&r.La==s)return i;return-1}function $t(a,t,n,e,s){if(e&&e.once)tn(a,t,n,e,s);else if(od(t))for(var r=0;r<t.length;r++)$t(a,t[r],n,e,s);else n=cn(n),a&&a[Bl]?ln(a,t,n,ad(e)?!!e.capture:!!e,s):Zt(a,t,n,!1,e,s)}function Zt(d,t,l,e,i,p){if(!t)throw Error("Invalid event type");var o=ad(i)?!!i.capture:!!i,a=un(d);if(a||(d[Vl]=a=new Gt(d)),l=zt(a,t,l,e,o,p),!l.a){if(e=Qt(),l.a=e,e.src=d,e.listener=l,d.addEventListener)Ml||(i=o),void 0===i&&(i=!1),d.addEventListener(""+t,e,i);else{if(!d.attachEvent)throw Error("addEventListener and attachEvent are unavailable.");d.attachEvent(rn(""+t),e)}Hl++}}function Qt(){var o=sn,t=_l?function(n){return o.call(t.src,t.listener,n)}:function(n){if(!(n=o.call(t.src,t.listener,n)))return n};return t}function tn(a,t,n,e,s){if(od(t))for(var r=0;r<t.length;r++)tn(a,t[r],n,e,s);else n=cn(n),a&&a[Bl]?dn(a,t,n,ad(e)?!!e.capture:!!e,s):Zt(a,t,n,!0,e,s)}function nn(a,t,n,e,s){if(od(t))for(var r=0;r<t.length;r++)nn(a,t[r],n,e,s);else e=ad(e)?!!e.capture:!!e,n=cn(n),a&&a[Bl]?(a=a.u,(t+="")in a.a&&(r=a.a[t],-1<(n=Yt(r,n,e,s))&&(Wt(r[n]),Array.prototype.splice.call(r,n,1),0==r.length&&(delete a.a[t],a.b--)))):a&&(a=un(a))&&(t=a.a[""+t],a=-1,t&&(a=Yt(t,n,e,s)),(n=-1<a?t[a]:null)&&en(n))}function en(o){if("number"!=typeof o&&o&&!o.ma){var r=o.src;if(r&&r[Bl])Jt(r.u,o);else{var n=o.type,e=o.a;r.removeEventListener?r.removeEventListener(n,e,o.capture):r.detachEvent&&r.detachEvent(rn(n),e),Hl--,(n=un(r))?(Jt(n,o),0==n.b&&(n.src=null,r[Vl]=null)):Wt(o)}}}function rn(e){return e in Wl?Wl[e]:Wl[e]="on"+e}function on(a,t,n,e){var i=!0;if((a=un(a))&&(t=a.a[""+t]))for(t=t.concat(),a=0;a<t.length;a++){var r=t[a];r&&r.capture==n&&!r.ma&&(r=an(r,e),i=i&&!1!==r)}return i}function an(o,t){var n=o.listener,e=o.La||o.src;return o.Ha&&en(o),n.call(e,t)}function sn(a,t){if(a.ma)return!0;if(!_l){if(!t)t:{t=["window","event"];for(var s=Ld,e=0;e<t.length;e++)if(null==(s=s[t[e]])){t=null;break t}t=s}if(e=t,t=new Bt(e,this),s=!0,!(0>e.keyCode||void 0!=e.returnValue)){t:{var i=!1;if(0==e.keyCode)try{e.keyCode=-1;break t}catch(e){i=!0}(i||void 0==e.returnValue)&&(e.returnValue=!0)}for(e=[],i=t.b;i;i=i.parentNode)e.push(i);for(a=a.type,i=e.length-1;0<=i;i--){t.b=e[i];var r=on(e[i],a,!0,t);s=s&&r}for(i=0;i<e.length;i++)t.b=e[i],r=on(e[i],a,!1,t),s=s&&r}return s}return an(a,new Bt(t,this))}function un(e){return e=e[Vl],e instanceof Gt?e:null}function cn(e){return a(e)?e:(e[jl]||(e[jl]=function(t){return e.handleEvent(t)}),e[jl])}function hn(){Kt.call(this),this.u=new Gt(this),this.Ib=this,this.Ra=null}function fn(t,n){var e=t.Ra,r;if(e)for(r=[];e;e=e.Ra)r.push(e);if(t=t.Ib,e=n.type||n,td(n))n=new Xt(n,t);else if(n instanceof Xt)n.target=n.target||t;else{var i=n;n=new Xt(e,t),x(n,i)}if(i=!0,r)for(var o=r.length-1,a;0<=o;o--)a=n.b=r[o],i=pn(a,e,!0,n)&&i;if(a=n.b=t,i=pn(a,e,!0,n)&&i,i=pn(a,e,!1,n)&&i,r)for(o=0;o<r.length;o++)a=n.b=r[o],i=pn(a,e,!1,n)&&i}function ln(o,t,n,e,a){zt(o.u,t+"",n,!1,e,a)}function dn(o,t,n,e,a){zt(o.u,t+"",n,!0,e,a)}function pn(d,t,n,e){if(!(t=d.u.a[t+""]))return!0;t=t.concat();for(var i=!0,r=0,o;r<t.length;++r)if(o=t[r],o&&!o.ma&&o.capture==n){var a=o.listener,s=o.La||o.src;o.Ha&&Jt(d.u,o),i=!1!==a.call(s,e)&&i}return i&&0!=e.Bb}function vn(o,r,i){if(a(o))i&&(o=f(o,i));else{if(!o||"function"!=typeof o.handleEvent)throw Error("Invalid listener argument");o=f(o.handleEvent,o)}return 2147483647<+r?-1:Ld.setTimeout(o,r||0)}function mn(o){var r=null;return new $(function(t,e){-1==(r=vn(function(){t(void 0)},o))&&e(Error("Failed to schedule timer."))}).s(function(e){throw Ld.clearTimeout(r),e})}function gn(o,t,n,e,a){this.reset(o,t,n,e,a)}function bn(e){this.f=e,this.b=this.c=this.a=null}function wn(e,t){this.name=e,this.value=t}function yn(e){return e.c?e.c:e.a?yn(e.a):(y("Root logger has no level set."),null)}function In(o){Ql||(Ql=new bn(""),Xl[""]=Ql,Ql.c=Kl);var t;if(!(t=Xl[o])){t=new bn(o);var n=o.lastIndexOf("."),e=o.substr(n+1);n=In(o.substr(0,n)),n.b||(n.b={}),n.b[e]=t,t.a=n,Xl[o]=t}return t}function Tn(n){this.b={},this.a=[],this.c=0;var t=arguments.length;if(1<t){if(t%2)throw Error("Uneven number of arguments");for(var e=0;e<t;e+=2)this.set(arguments[e],arguments[e+1])}else if(n){n instanceof Tn?(t=n.S(),e=n.P()):(t=R(n),e=C(n));for(var o=0;o<t.length;o++)this.set(t[o],e[o])}}function An(o){if(o.c!=o.a.length){for(var t=0,n=0,e;t<o.a.length;)e=o.a[t],kn(o.b,e)&&(o.a[n++]=e),t++;o.a.length=n}if(o.c!=o.a.length){var a={};for(n=t=0;t<o.a.length;)e=o.a[t],kn(a,e)||(o.a[n++]=e,a[e]=1),t++;o.a.length=n}}function kn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function En(e,t){e&&e.log(Gl,t,void 0)}function Nn(e){return zd(e,function(e){return e=e.toString(16),1<e.length?e:"0"+e}).join("")}function Sn(e){var o="";return On(e,function(e){o+=String.fromCharCode(e)}),o}function On(d,t){function n(t){for(;l<d.length;){var n=d.charAt(l++),o=Jl[n];if(null!=o)return o;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return t}Pn();for(var l=0;;){var e=n(-1),r=n(0),o=n(64),a=n(64);if(64===a&&-1===e)break;t(e<<2|r>>4),64!=o&&(t(240&r<<4|o>>2),64!=a&&t(192&o<<6|a))}}function Pn(){if(!Yl){Yl={},Jl={};for(var e=0;65>e;e++)Yl[e]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e),Jl[Yl[e]]=e,62<=e&&(Jl["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(e)]=e)}}function Cn(e,t){this.g=[],this.v=e,this.o=t||null,this.f=this.a=!1,this.c=void 0,this.u=this.w=this.i=!1,this.h=0,this.b=null,this.l=0}function Rn(o,t,r){o.a=!0,o.c=r,o.f=!t,Un(o)}function _n(e){if(e.a){if(!e.u)throw new jn;e.u=!1}}function Dn(e,t){Ln(e,null,t,void 0)}function Ln(o,t,n,e){o.g.push([t,n,e]),o.a&&Un(o)}function xn(e){return Kd(e.g,function(e){return a(e[1])})}function Un(d){if(d.h&&d.a&&xn(d)){var t=d.h,n=$l[t];n&&(Ld.clearTimeout(n.a),delete $l[t]),d.h=0}d.b&&(d.b.l--,delete d.b),t=d.c;for(var e=n=!1;d.g.length&&!d.i;){var i=d.g.shift(),r=i[0],o=i[1];if(i=i[2],r=d.f?o:r)try{var a=r.call(i||d.o,t);void 0!==a&&(d.f=d.f&&(a==t||a instanceof Error),d.c=t=a),(K(t)||"function"==typeof Ld.Promise&&t instanceof Ld.Promise)&&(e=!0,d.i=!0)}catch(e){t=e,d.f=!0,xn(d)||(n=!0)}}d.c=t,e&&(a=f(d.m,d,!0),e=f(d.m,d,!1),t instanceof Cn?(Ln(t,a,e),t.w=!0):t.then(a,e)),n&&(t=new Vn(t),$l[t.a]=t,d.h=t.a)}function jn(){p.call(this)}function Mn(){p.call(this)}function Vn(e){this.a=Ld.setTimeout(f(this.c,this),0),this.b=e}function Fn(e,t){this.b=-1,this.b=ep,this.f=Ld.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=e,this.h=t,this.l=Ld.Int32Array?new Int32Array(64):Array(64),Zl||(Zl=Ld.Int32Array?new Int32Array(rp):rp),this.reset()}function qn(d){for(var t=d.f,n=d.l,e=0,i=0;i<t.length;)n[e++]=t[i]<<24|t[i+1]<<16|t[i+2]<<8|t[i+3],i=4*e;for(t=16;64>t;t++){i=0|n[t-15],e=0|n[t-2];var r=0|(0|n[t-16])+((i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3),o=0|(0|n[t-7])+((e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10);n[t]=0|r+o}e=0|d.a[0],i=0|d.a[1];var a=0|d.a[2],s=0|d.a[3],p=0|d.a[4],u=0|d.a[5],h=0|d.a[6];for(r=0|d.a[7],t=0;64>t;t++){var m=0|((e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10))+(e&i^e&a^i&a);o=p&u^~p&h,r=0|r+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7)),o=0|o+(0|Zl[t]),o=0|r+(0|o+(0|n[t])),r=h,h=u,u=p,p=0|s+o,s=a,a=i,i=e,e=0|o+m}d.a[0]=0|d.a[0]+e,d.a[1]=0|d.a[1]+i,d.a[2]=0|d.a[2]+a,d.a[3]=0|d.a[3]+s,d.a[4]=0|d.a[4]+p,d.a[5]=0|d.a[5]+u,d.a[6]=0|d.a[6]+h,d.a[7]=0|d.a[7]+r}function Xn(t,n,e){void 0===e&&(e=n.length);var i=0,r=t.c;if(td(n))for(;i<e;)t.f[r++]=n.charCodeAt(i++),r==t.b&&(qn(t),r=0);else{if(!rd(n))throw Error("message must be string or array");for(;i<e;){var o=n[i++];if(!("number"==typeof o&&0<=o&&255>=o&&o==(0|o)))throw Error("message must be a byte array");t.f[r++]=o,r==t.b&&(qn(t),r=0)}}t.c=r,t.g+=e}function Bn(){Fn.call(this,8,ap)}function Hn(t){if(t.P&&"function"==typeof t.P)return t.P();if(td(t))return t.split("");if(rd(t)){for(var n=[],e=t.length,o=0;o<e;o++)n.push(t[o]);return n}return C(t)}function Wn(t){if(t.S&&"function"==typeof t.S)return t.S();if(!t.P||"function"!=typeof t.P){if(rd(t)||td(t)){var n=[];t=t.length;for(var e=0;e<t;e++)n.push(e);return n}return R(t)}}function Gn(t,n){if(t.forEach&&"function"==typeof t.forEach)t.forEach(n,void 0);else if(rd(t)||td(t))qd(t,n,void 0);else for(var e=Wn(t),i=Hn(t),r=i.length,o=0;o<r;o++)n.call(void 0,i[o],e&&e[o],t)}function zn(a,t){if(a){a=a.split("&");for(var n=0;n<a.length;n++){var e=a[n].indexOf("="),i=null;if(0<=e){var r=a[n].substring(0,e);i=a[n].substring(e+1)}else r=a[n];t(r,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}function Jn(o,t){if(this.b=this.l=this.c="",this.i=null,this.h=this.g="",this.f=!1,o instanceof Jn){this.f=void 0===t?o.f:t,Yn(this,o.c),this.l=o.l,this.b=o.b,$n(this,o.i),this.g=o.g,t=o.a;var r=new ae;r.c=t.c,t.a&&(r.a=new Tn(t.a),r.b=t.b),Zn(this,r),this.h=o.h}else o&&(r=(o+"").match(ip))?(this.f=!!t,Yn(this,r[1]||"",!0),this.l=ie(r[2]||""),this.b=ie(r[3]||"",!0),$n(this,r[4]),this.g=ie(r[5]||"",!0),Zn(this,r[6]||"",!0),this.h=ie(r[7]||"")):(this.f=!!t,this.a=new ae(null,0,this.f))}function Yn(o,t,n){o.c=n?ie(t,!0):t,o.c&&(o.c=o.c.replace(/:$/,""))}function $n(e,t){if(t){if(t=+t,isNaN(t)||0>t)throw Error("Bad port number "+t);e.i=t}else e.i=null}function Zn(o,t,n){t instanceof ae?(o.a=t,pe(o.a,o.f)):(n||(t=re(t,pp)),o.a=new ae(t,0,o.f))}function Qn(o,t,n){o.a.set(t,n)}function te(e,t){return e.a.get(t)}function ne(e){return e instanceof Jn?new Jn(e):new Jn(e,void 0)}function ee(o,t){var n=new Jn(null,void 0);return Yn(n,"https"),o&&(n.b=o),t&&(n.g=t),n}function ie(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function re(t,n,e){return td(t)?(t=encodeURI(t).replace(n,oe),e&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function oe(e){return e=e.charCodeAt(0),"%"+(15&e>>4).toString(16)+(15&e).toString(16)}function ae(o,t,n){this.b=this.a=null,this.c=o||null,this.f=!!n}function se(o){o.a||(o.a=new Tn,o.b=0,o.c&&zn(o.c,function(t,n){ce(o,decodeURIComponent(t.replace(/\+/g," ")),n)}))}function ue(a){var t=Wn(a);if(void 0===t)throw Error("Keys are undefined");var n=new ae(null,0,void 0);a=Hn(a);for(var e=0;e<t.length;e++){var i=t[e],r=a[e];od(r)?le(n,i,r):ce(n,i,r)}return n}function ce(o,t,n){se(o),o.c=null,t=de(o,t);var e=o.a.get(t);e||o.a.set(t,e=[]),e.push(n),o.b+=1}function he(e,t){se(e),t=de(e,t),kn(e.a.b,t)&&(e.c=null,e.b-=e.a.get(t).length,e=e.a,kn(e.b,t)&&(delete e.b[t],e.c--,e.a.length>2*e.c&&An(e)))}function fe(e,t){return se(e),t=de(e,t),kn(e.a.b,t)}function le(o,t,n){he(o,t),0<n.length&&(o.c=null,o.a.set(de(o,t),S(n)),o.b+=n.length)}function de(e,t){return t+="",e.f&&(t=t.toLowerCase()),t}function pe(e,t){t&&!e.f&&(se(e),e.c=null,e.a.forEach(function(o,t){var n=t.toLowerCase();t!=n&&(he(this,t),le(this,n,o))},e)),e.f=t}function ve(){}function me(e){return e.c||(e.c=e.b())}function ge(){}function be(o){if(!o.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var t=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0,e;4>n;n++){e=t[n];try{return new ActiveXObject(e),o.f=e}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return o.f}function we(e){hn.call(this),this.headers=new Tn,this.w=e||null,this.b=!1,this.v=this.a=null,this.g=this.I=this.i="",this.c=this.G=this.h=this.A=!1,this.f=0,this.m=null,this.l=hp,this.o=this.N=!1}function ye(a,t,n,e,i){if(a.a)throw Error("[goog.net.XhrIo] Object is active with another request="+a.i+"; newUri="+t);n=n?n.toUpperCase():"GET",a.i=t,a.g="",a.I=n,a.A=!1,a.b=!0,a.a=a.w?a.w.a():up.a(),a.v=me(a.w?a.w:up),a.a.onreadystatechange=f(a.Ab,a);try{En(a.J,Re(a,"Opening Xhr")),a.G=!0,a.a.open(n,t+"",!0),a.G=!1}catch(e){return En(a.J,Re(a,"Error opening Xhr: "+e.message)),void Ae(a,e)}t=e||"";var r=new Tn(a.headers);i&&Gn(i,function(e,t){r.set(t,e)}),i=T(r.S()),e=Ld.FormData&&t instanceof Ld.FormData,!A(yp,n)||i||e||r.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),r.forEach(function(e,t){this.a.setRequestHeader(t,e)},a),a.l&&(a.a.responseType=a.l),"withCredentials"in a.a&&a.a.withCredentials!==a.N&&(a.a.withCredentials=a.N);try{Se(a),0<a.f&&(a.o=Ie(a.a),En(a.J,Re(a,"Will abort after "+a.f+"ms if incomplete, xhr2 "+a.o)),a.o?(a.a.timeout=a.f,a.a.ontimeout=f(a.Ea,a)):a.m=vn(a.Ea,a.f,a)),En(a.J,Re(a,"Sending request")),a.h=!0,a.a.send(t),a.h=!1}catch(e){En(a.J,Re(a,"Send error: "+e.message)),Ae(a,e)}}function Ie(e){return $d&&V(9)&&"number"==typeof e.timeout&&void 0!==e.ontimeout}function Te(e){return"content-type"==e.toLowerCase()}function Ae(e,t){e.b=!1,e.a&&(e.c=!0,e.a.abort(),e.c=!1),e.g=t,ke(e),Ne(e)}function ke(e){e.A||(e.A=!0,fn(e,"complete"),fn(e,"error"))}function Ee(d){if(d.b&&void 0!==Ad)if(d.v[1]&&4==Oe(d)&&2==Pe(d))En(d.J,Re(d,"Local request error detected and ignored"));else if(d.h&&4==Oe(d))vn(d.Ab,0,d);else if(fn(d,"readystatechange"),4==Oe(d)){En(d.J,Re(d,"Request complete")),d.b=!1;try{var t=Pe(d);t:switch(t){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var n=!0;break t;default:n=!1;}var e;if(!(e=n)){var i;if(i=0===t){var r=(d.i+"").match(ip)[1]||null;if(!r&&Ld.self&&Ld.self.location){var l=Ld.self.location.protocol;r=l.substr(0,l.length-1)}i=!fp.test(r?r.toLowerCase():"")}e=i}if(e)fn(d,"complete"),fn(d,"success");else{try{var a=2<Oe(d)?d.a.statusText:""}catch(e){En(d.J,"Can not get status: "+e.message),a=""}d.g=a+" ["+Pe(d)+"]",ke(d)}}finally{Ne(d)}}}function Ne(o,t){if(o.a){Se(o);var n=o.a,e=o.v[0]?nd:null;o.a=null,o.v=null,t||fn(o,"ready");try{n.onreadystatechange=e}catch(e){(o=o.J)&&o.log(zl,"Problem encountered resetting onreadystatechange: "+e.message,void 0)}}}function Se(e){e.a&&e.o&&(e.a.ontimeout=null),"number"==typeof e.m&&(Ld.clearTimeout(e.m),e.m=null)}function Oe(e){return e.a?e.a.readyState:0}function Pe(e){try{return 2<Oe(e)?e.a.status:-1}catch(e){return-1}}function Ce(e){try{return e.a?e.a.responseText:""}catch(t){return En(e.J,"Can not get responseText: "+t.message),""}}function Re(e,t){return t+" ["+e.I+" "+e.i+" "+Pe(e)+"]"}function _e(d){var t={},n=t.document||document,e=Tt(d),i=document.createElement("SCRIPT"),l={Cb:i,Ea:void 0},o=new Cn(Le,l),a=null,s=null==t.timeout?5e3:t.timeout;return 0<s&&(a=window.setTimeout(function(){xe(i,!0);var n=new Ue(xp,"Timeout reached for loading script "+e);_n(o),Rn(o,!1,n)},s),l.Ea=a),i.onload=i.onreadystatechange=function(){i.readyState&&"loaded"!=i.readyState&&"complete"!=i.readyState||(xe(i,t.Sc||!1,a),o.A(null))},i.onerror=function(){xe(i,!0,a);var n=new Ue(vp,"Error while loading script "+e);_n(o),Rn(o,!1,n)},l=t.attributes||{},x(l,{type:"text/javascript",charset:"UTF-8"}),Dt(i,l),i.src=Tt(d),De(n).appendChild(i),o}function De(e){var t;return(t=(e||document).getElementsByTagName("HEAD"))&&0!=t.length?t[0]:e.documentElement}function Le(){if(this&&this.Cb){var e=this.Cb;e&&"SCRIPT"==e.tagName&&xe(e,!0,this.Ea)}}function xe(o,t,n){null!=n&&Ld.clearTimeout(n),o.onload=nd,o.onerror=nd,o.onreadystatechange=nd,t&&window.setTimeout(function(){o&&o.parentNode&&o.parentNode.removeChild(o)},0)}function Ue(o,t){var n="Jsloader error (code #"+o+")";t&&(n+=": "+t),p.call(this,n),this.code=o}function je(){}function Me(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseText="",this.status=-1,this.statusText=this.responseXML=null,this.a.onload=f(this.Wb,this),this.a.onerror=f(this.xb,this),this.a.onprogress=f(this.Xb,this),this.a.ontimeout=f(this.Yb,this)}function Ve(e,t){e.readyState=t,e.onreadystatechange&&e.onreadystatechange()}function Fe(){var e=ii();return $d&&!!ll&&11==ll||/Edge\/\d+/.test(e)}function Ke(){return Ld.window&&Ld.window.location.href||""}function qe(o,t){t=t||Ld.window;var n="about:blank";o&&(n=Nt(St(o))),t.location.href=n}function Xe(o,t){var n=[],r;for(r in o)r in t?typeof o[r]==typeof t[r]?od(o[r])?D(o[r],t[r])||n.push(r):"object"==typeof o[r]&&null!=o[r]&&null!=t[r]?0<Xe(o[r],t[r]).length&&n.push(r):o[r]!==t[r]&&n.push(r):n.push(r):n.push(r);for(r in t)r in o||n.push(r);return n}function Be(){var e=ii();return!((e=ni(e)==Ep?(e=e.match(/\sChrome\/(\d+)/i))&&2==e.length?parseInt(e[1],10):null:null)&&30>e||$d&&ll&&!(9<ll))}function He(e){return e=(e||ii()).toLowerCase(),!!(e.match(/android/)||e.match(/webos/)||e.match(/iphone|ipad|ipod/)||e.match(/blackberry/)||e.match(/windows phone/)||e.match(/iemobile/))}function We(e){e=e||Ld.window;try{e.close()}catch(e){}}function Ge(s,t,d){var l=""+ed(1e9*Math.random());t=t||500,d=d||600;var i=(window.screen.availHeight-d)/2,r=(window.screen.availWidth-t)/2;for(o in t={width:t,height:d,top:0<i?i:0,left:0<r?r:0,location:!0,resizable:!0,statusbar:!0,toolbar:!1},d=ii().toLowerCase(),l&&(t.target=l,g(d,"crios/")&&(t.target="_blank")),ni(ii())==Sp&&(s=s||"http://localhost",t.scrollbars=!0),d=s||"",(l=t)||(l={}),s=window,t=d instanceof Et?d:St(void 0===d.href?d+"":d.href),d=l.target||d.target,i=[],l)switch(o){case"width":case"height":case"top":case"left":i.push(o+"="+l[o]);break;case"target":case"noreferrer":break;default:i.push(o+"="+(l[o]?1:0));}var o=i.join(",");if((O("iPhone")&&!O("iPod")&&!O("iPad")||O("iPad")||O("iPod"))&&s.navigator&&s.navigator.standalone&&d&&"_self"!=d?(o=s.document.createElement("A"),t instanceof Et||t instanceof Et||(t=t.la?t.ja():t+"",Tl.test(t)||(t="about:invalid#zClosurez"),t=Ot(t)),o.href=Nt(t),o.setAttribute("target",d),l.noreferrer&&o.setAttribute("rel","noreferrer"),l=document.createEvent("MouseEvent"),l.initMouseEvent("click",!0,!0,s,1),o.dispatchEvent(l),o={}):l.noreferrer?(o=s.open("",d,o),s=Nt(t),o&&(el&&g(s,";")&&(s="'"+s.replace(/'/g,"%27")+"'"),o.opener=null,yt("b/12014412, meta tag with sanitized URL"),s="<META HTTP-EQUIV=\"refresh\" content=\"0; url="+m(s)+"\">",s=Rt(s),o.document.write(Ct(s)),o.document.close())):o=s.open(Nt(t),d,o),o)try{o.focus()}catch(e){}return o}function ze(o){return new $(function(t){function n(){mn(2e3).then(function(){return o&&!o.closed?n():void t()})}return n()})}function Je(){var e=null;return new $(function(t){"complete"==Ld.document.readyState?t():(e=function(){t()},tn(window,"load",e))}).s(function(t){throw nn(window,"load",e),t})}function Ye(){return $e(void 0)?Je().then(function(){return new $(function(o,t){var n=Ld.document,e=setTimeout(function(){t(Error("Cordova framework is not ready."))},1e3);n.addEventListener("deviceready",function(){clearTimeout(e),o()},!1)})}):nt(Error("Cordova must run in an Android or iOS file scheme."))}function $e(e){return e=e||ii(),"file:"===ui()&&e.toLowerCase().match(/iphone|ipad|ipod|android/)}function Ze(){var e=Ld.window;try{return e&&e!=e.top}catch(e){return!1}}function Qe(){return Nd.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":Nd.INTERNAL.hasOwnProperty("node")?"Node":"Browser"}function ti(){var e=Qe();return"ReactNative"===e||"Node"===e}function ni(e){var t=e.toLowerCase();return g(t,"opera/")||g(t,"opr/")||g(t,"opios/")?"Opera":g(t,"iemobile")?"IEMobile":g(t,"msie")||g(t,"trident/")?"IE":g(t,"edge/")?"Edge":g(t,"firefox/")?Sp:g(t,"silk/")?"Silk":g(t,"blackberry")?"Blackberry":g(t,"webos")?"Webos":!g(t,"safari/")||g(t,"chrome/")||g(t,"crios/")||g(t,"android")?(g(t,"chrome/")||g(t,"crios/"))&&!g(t,"edge/")?Ep:g(t,"android")?"Android":(e=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==e.length?e[1]:"Other":"Safari"}function ei(o,t){t=t||[];var n=[],a={},r;for(r in kp)a[kp[r]]=!0;for(r=0;r<t.length;r++)void 0!==a[t[r]]&&(delete a[t[r]],n.push(t[r]));return n.sort(),t=n,t.length||(t=["FirebaseCore-web"]),n=Qe(),a="",(a="Browser"===n?ni(ii()):n)+"/JsCore/"+o+"/"+t.join(",")}function ii(){return Ld.navigator&&Ld.navigator.userAgent||""}function ri(o,t){o=o.split("."),t=t||Ld;for(var r=0;r<o.length&&"object"==typeof t&&null!=t;r++)t=t[o[r]];return r!=o.length&&(t=void 0),t}function oi(){try{var e=Ld.localStorage,t=di();if(e)return e.setItem(t,"1"),e.removeItem(t),!Fe()||!!Ld.indexedDB}catch(e){}return!1}function ai(){return(si()||"chrome-extension:"===ui()||$e())&&!ti()&&oi()}function si(){return"http:"===ui()||"https:"===ui()}function ui(){return Ld.location&&Ld.location.protocol||null}function ci(e){return e=e||ii(),!He(e)&&ni(e)!=Sp}function hi(e){return void 0===e?null:jt(e)}function fi(o){var t={},e;for(e in o)o.hasOwnProperty(e)&&null!==o[e]&&void 0!==o[e]&&(t[e]=o[e]);return t}function li(e){if(null!==e)return JSON.parse(e)}function di(e){return e||""+ed(1e9*Math.random())}function pi(e){return e=e||ii(),"Safari"!=ni(e)&&!e.toLowerCase().match(/iphone|ipad|ipod/)}function vi(){var o=Ld.___jsl;if(o&&o.H)for(var t in o.H)if(o.H[t].r=o.H[t].r||[],o.H[t].L=o.H[t].L||[],o.H[t].r=o.H[t].L.concat(),o.CP)for(var n=0;n<o.CP.length;n++)o.CP[n]=null}function mi(){var e=Ld.navigator;return!e||"boolean"!=typeof e.onLine||!si()&&"chrome-extension:"!==ui()&&void 0===e.connection||e.onLine}function gi(o,t,n,e){if(o>t)throw Error("Short delay should be less than long delay!");this.c=o,this.b=t,o=n||ii(),e=e||Qe(),this.a=He(o)||"ReactNative"===e}function bi(){var e=Ld.document;return!e||void 0===e.visibilityState||"visible"==e.visibilityState}function wi(){var o=Ld.document,r=null;return bi()||!o?tt():new $(function(t){r=function(){bi()&&(o.removeEventListener("visibilitychange",r,!1),t())},o.addEventListener("visibilitychange",r,!1)}).s(function(t){throw o.removeEventListener("visibilitychange",r,!1),t})}function yi(e){try{var t=new Date(parseInt(e,10));if(!isNaN(t.getTime())&&!/[^0-9]/.test(e))return t.toUTCString()}catch(e){}return null}function Ii(o,t,n){wp?Object.defineProperty(o,t,{configurable:!0,enumerable:!0,value:n}):o[t]=n}function Ti(o,t){if(t)for(var n in t)t.hasOwnProperty(n)&&Ii(o,n,t[n])}function Ai(e){var t={};return Ti(t,e),t}function ki(o){var t={},e;for(e in o)o.hasOwnProperty(e)&&(t[e]=o[e]);return t}function Ei(o,r){if(!r||!r.length)return!0;if(!o)return!1;for(var a=0,e;a<r.length;a++)if(e=o[r[a]],void 0===e||null===e||""===e)return!1;return!0}function Ni(o){var r=o;if("object"==typeof o&&null!=o)for(var n in r="length"in o?[]:{},o)Ii(r,n,Ni(o[n]));return r}function Si(o){var r={},n=o[Np],a=o[Ap];if(o=o[Lp],!n||!o)throw Error("Invalid provider user info!");r[Op]=a||null,r[Rp]=n,Ii(this,_p,o),Ii(this,Pp,Ni(r))}function Oi(e,t){this.code=Dp+e,this.message=t||Mp[e]||""}function sd(e){var t=e&&e.code;return t?new Oi(t.substring(Dp.length),e.message):null}function Ci(o){var r=o[Vp];if(void 0===r)throw new Oi("missing-continue-uri");if("string"!=typeof r||"string"==typeof r&&!r.length)throw new Oi("invalid-continue-uri");this.h=r,this.c=this.a=null,this.g=!1;var a=o[Fp];if(a&&"object"==typeof a){r=a[jp];var s=a[Wp];if(a=a[Hp],"string"==typeof r&&r.length){if(this.a=r,void 0!==s&&"boolean"!=typeof s)throw new Oi("argument-error",Wp+" property must be a boolean when specified.");if(this.g=!!s,void 0!==a&&("string"!=typeof a||"string"==typeof a&&!a.length))throw new Oi("argument-error",Hp+" property must be a non empty string when specified.");this.c=a||null}else{if(void 0!==r)throw new Oi("argument-error",jp+" property must be a non empty string when specified.");if(void 0!==s||void 0!==a)throw new Oi("missing-android-pkg-name")}}else if(void 0!==a)throw new Oi("argument-error",Fp+" property must be a non null object when specified.");if(this.b=null,(r=o[Up])&&"object"==typeof r){if("string"==typeof(r=r[qp])&&r.length)this.b=r;else if(void 0!==r)throw new Oi("argument-error",qp+" property must be a non empty string when specified.");}else if(void 0!==r)throw new Oi("argument-error",Up+" property must be a non null object when specified.");if(void 0!==(o=o[Bp])&&"boolean"!=typeof o)throw new Oi("argument-error",Bp+" property must be a boolean when specified.");if((this.f=!!o)&&!this.b&&!this.a)throw new Oi("argument-error",Bp+" property can't be true when no mobile application is provided.")}function Ri(o){var t={};for(var n in t.continueUrl=o.h,t.canHandleCodeInApp=o.f,(t.androidPackageName=o.a)&&(t.androidMinimumVersion=o.c,t.androidInstallApp=o.g),t.iOSBundleId=o.b,t)null===t[n]&&delete t[n];return t}function _i(e){this.b=e.sub,Pd(),this.a=e.provider_id||e.firebase&&e.firebase.sign_in_provider||null}function Di(o){if(o=o.split("."),3!=o.length)return null;o=o[1];for(var t=(4-o.length%4)%4,n=0;n<t;n++)o+=".";try{var e=JSON.parse(Sn(o));if(e.sub&&e.iss&&e.aud&&e.exp)return new _i(e)}catch(e){}return null}function Li(e){for(var t in Gp)if(Gp[t].Na==e)return Gp[t];return null}function xi(o){var t={"facebook.com":Mi,"google.com":ld,"github.com":dd,"twitter.com":pd},n=o&&o[Qp];try{if(n)return t[n]?new t[n](o):new ji(o);if(void 0!==o[Xp])return new Ui(o)}catch(e){}return null}function Ui(o){var t=o[Qp];if(!t&&o[Xp]){var r=Di(o[Xp]);r&&r.a&&(t=r.a)}if(!t)throw Error("Invalid additional user info!");"anonymous"!=t&&"custom"!=t||(t=null),r=!1,void 0===o.isNewUser?"identitytoolkit#SignupNewUserResponse"===o.kind&&(r=!0):r=!!o.isNewUser,Ii(this,"providerId",t),Ii(this,"isNewUser",r)}function ji(e){Ui.call(this,e),e=li(e.rawUserInfo||"{}"),Ii(this,"profile",Ni(e||{}))}function Mi(e){if(ji.call(this,e),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function dd(e){if(ji.call(this,e),"github.com"!=this.providerId)throw Error("Invalid provider ID!");Ii(this,"username",this.profile&&this.profile.login||null)}function ld(e){if(ji.call(this,e),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function pd(e){if(ji.call(this,e),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");Ii(this,"username",e.screenName||null)}function cd(e,o){return e.then(function(n){if(n[Yp]){var t=Di(n[Yp]);if(!t||o!=t.b)throw new Oi("user-mismatch");return n}throw new Oi("user-mismatch")}).s(function(e){throw e&&e.code&&e.code==Dp+"user-not-found"?new Oi("user-mismatch"):e})}function Xi(e,t){if(t.idToken||t.accessToken)t.idToken&&Ii(this,"idToken",t.idToken),t.accessToken&&Ii(this,"accessToken",t.accessToken);else{if(!t.oauthToken||!t.oauthTokenSecret)throw new Oi("internal-error","failed to construct a credential");Ii(this,"accessToken",t.oauthToken),Ii(this,"secret",t.oauthTokenSecret)}Ii(this,"providerId",e)}function Bi(e){var t={};return e.idToken&&(t.id_token=e.idToken),e.accessToken&&(t.access_token=e.accessToken),e.secret&&(t.oauth_token_secret=e.secret),t.providerId=e.providerId,{postBody:""+ue(t),requestUri:"http://localhost"}}function Hi(e,o){this.rc=o||[],Ti(this,{providerId:e,isOAuthProvider:!0}),this.rb={},this.Wa=(Li(e)||{}).Ma||null,this.Ua=null}function Wi(e){Hi.call(this,e,Kp),this.a=[]}function Gi(){Wi.call(this,"facebook.com")}function zi(e){if(!e)throw new Oi("argument-error","credential failed: expected 1 argument (the OAuth access token).");var o=e;return ad(e)&&(o=e.accessToken),new Gi().credential(null,o)}function Ji(){Wi.call(this,"github.com")}function Yi(e){if(!e)throw new Oi("argument-error","credential failed: expected 1 argument (the OAuth access token).");var o=e;return ad(e)&&(o=e.accessToken),new Ji().credential(null,o)}function $i(){Wi.call(this,"google.com"),this.sa("profile")}function Zi(o,t){var n=o;return ad(o)&&(n=o.idToken,t=o.accessToken),new $i().credential(n,t)}function Qi(){Hi.call(this,"twitter.com",zp)}function tr(o,r){var a=o;if(ad(a)||(a={oauthToken:o,oauthTokenSecret:r}),!a.oauthToken||!a.oauthTokenSecret)throw new Oi("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new Xi("twitter.com",a)}function nr(e,t){this.a=e,this.f=t,Ii(this,"providerId","password")}function er(){Ti(this,{providerId:"password",isOAuthProvider:!1})}function ir(e){if(!(e.Pa&&e.Oa||e.Da&&e.Y))throw new Oi("internal-error");this.a=e,Ii(this,"providerId","phone")}function rr(e){return e.a.Da&&e.a.Y?{temporaryProof:e.a.Da,phoneNumber:e.a.Y}:{sessionInfo:e.a.Pa,code:e.a.Oa}}function or(e){try{this.a=e||Nd.auth()}catch(e){throw new Oi("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}Ti(this,{providerId:"phone",isOAuthProvider:!1})}function ar(e,o){if(!e)throw new Oi("missing-verification-id");if(!o)throw new Oi("missing-verification-code");return new ir({Pa:e,Oa:o})}function sr(o){if(o.temporaryProof&&o.phoneNumber)return new ir({Da:o.temporaryProof,Y:o.phoneNumber});var t=o&&o.providerId;if(!t||"password"===t)return null;var r=o&&o.oauthAccessToken,e=o&&o.oauthTokenSecret;o=o&&o.oauthIdToken;try{return"google.com"===t?Zi(o,r):"facebook.com"===t?zi(r):"github.com"===t?Yi(r):"twitter.com"===t?tr(r,e):new Wi(t).credential(o,r)}catch(e){return null}}function ur(e){if(!e.isOAuthProvider)throw new Oi("invalid-oauth-provider")}function cr(o,t,n,e,a){if(this.b=o,this.c=t||null,this.f=n||null,this.g=e||null,this.a=a||null,!this.f&&!this.a)throw new Oi("invalid-auth-event");if(this.f&&this.a)throw new Oi("invalid-auth-event");if(this.f&&!this.g)throw new Oi("invalid-auth-event")}function hr(e){return e=e||{},e.type?new cr(e.type,e.eventId,e.urlResponse,e.sessionId,e.error&&sd(e.error)):null}function fr(o){var t="unauthorized-domain",n=ne(o),r;o=n.b,n=n.c,"chrome-extension"==n?r=v("This chrome extension ID (chrome-extension://%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",o):"http"==n||"https"==n?r=v("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",o):t="operation-not-supported-in-this-environment",Oi.call(this,t,r)}function lr(o,t,n){Oi.call(this,o,n),o=t||{},o.sb&&Ii(this,"email",o.sb),o.Y&&Ii(this,"phoneNumber",o.Y),o.credential&&Ii(this,"credential",o.credential)}function dr(o){if(o.code){var t=o.code||"";0==t.indexOf(Dp)&&(t=t.substring(Dp.length));var n={credential:sr(o)};if(o.email)n.sb=o.email;else{if(!o.phoneNumber)return new Oi(t,o.message||void 0);n.Y=o.phoneNumber}return new lr(t,n,o.message)}return null}function pr(e){this.f=e}function vr(o,t,n){var e="Node"==Qe();if(!(e=Ld.XMLHttpRequest||e&&Nd.INTERNAL.node&&Nd.INTERNAL.node.XMLHttpRequest))throw new Oi("internal-error","The XMLHttpRequest compatibility library was not found.");this.b=o,o=t||{},this.i=o.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token",this.l=o.secureTokenTimeout||Jp,this.c=L(o.secureTokenHeaders||$p),this.g=o.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.h=o.firebaseTimeout||Zp,this.a=L(o.firebaseHeaders||ec),n&&(this.a["X-Client-Version"]=n,this.c["X-Client-Version"]=n),this.f=new je,this.o=new pr(e)}function mr(e,t){t?e.a["X-Firebase-Locale"]=t:delete e.a["X-Firebase-Locale"]}function gr(e,t){t?(e.a["X-Client-Version"]=t,e.c["X-Client-Version"]=t):(delete e.a["X-Client-Version"],delete e.c["X-Client-Version"])}function br(s,t,n,e,i,r,o){mi()?(Be()?s=f(s.m,s):(tc||(tc=new $(function(e,t){wr(e,t)})),s=f(s.u,s)),s(t,n,e,i,r,o)):n&&n(null)}function wr(e,t){((window.gapi||{}).client||{}).request?e():(Ld[oc]=function(){((window.gapi||{}).client||{}).request?e():t(Error("CORS_UNSUPPORTED"))},Dn(_e(At(nc,{onload:oc})),function(){t(Error("CORS_UNSUPPORTED"))}))}function yr(o,t){return new $(function(n,e){"refresh_token"==t.grant_type&&t.refresh_token||"authorization_code"==t.grant_type&&t.code?br(o,o.i+"?key="+encodeURIComponent(o.b),function(o){o?o.error?e(Mr(o)):o.access_token&&o.refresh_token?n(o):e(new Oi("internal-error")):e(new Oi("network-request-failed"))},"POST",""+ue(t),o.c,o.l.get()):e(new Oi("internal-error"))})}function Ir(d,t,l,e,i,n){var r=ne(d.g+t);Qn(r,"key",d.b),n&&Qn(r,"cb",""+Pd());var a="GET"==l;if(a)for(var o in e)e.hasOwnProperty(o)&&Qn(r,o,e[o]);return new $(function(s,n){br(d,""+r,function(e){e?e.error?n(Mr(e,i||{})):s(e):n(new Oi("network-request-failed"))},l,a?void 0:jt(fi(e)),d.a,d.h.get())})}function Tr(e){if(!bp.test(e.email))throw new Oi("invalid-email")}function Ar(e){"email"in e&&Tr(e)}function ud(e,t){return yd(e,dc,{identifier:t,continueUri:si()?Ke():"http://localhost"}).then(function(e){return e.allProviders||[]})}function Er(e){return yd(e,mc,{}).then(function(e){return e.authorizedDomains||[]})}function Nr(e){if(!e[Yp])throw new Oi("internal-error")}function hd(e){if(!(e.phoneNumber||e.temporaryProof)){if(!e.sessionInfo)throw new Oi("missing-verification-id");if(!e.code)throw new Oi("missing-verification-code")}else if(!e.phoneNumber||!e.temporaryProof)throw new Oi("internal-error")}function md(e,t){return yd(e,bc,t)}function Pr(o,t,r){return yd(o,pc,{idToken:t,deleteProvider:r})}function Cr(e){if(!e.requestUri||!e.sessionId&&!e.postBody)throw new Oi("internal-error")}function gd(e){var t=null;if(e.needConfirmation?(e.code="account-exists-with-different-credential",t=dr(e)):"FEDERATED_USER_ID_ALREADY_LINKED"==e.errorMessage?(e.code="credential-already-in-use",t=dr(e)):"EMAIL_EXISTS"==e.errorMessage?(e.code="email-already-in-use",t=dr(e)):e.errorMessage&&(t=jr(e.errorMessage)),t)throw t;if(!e[Yp])throw new Oi("internal-error")}function fd(e,t){return t.returnIdpCredential=!0,yd(e,Ec,t)}function Dr(e,t){return t.returnIdpCredential=!0,yd(e,Tc,t)}function Lr(e,t){return t.returnIdpCredential=!0,t.autoCreate=!1,yd(e,kc,t)}function xr(e){if(!e.oobCode)throw new Oi("invalid-action-code")}function yd(o,t,n){if(!Ei(n,t.ea))return nt(new Oi("internal-error"));var e=t.zb||"POST",r;return tt(n).then(t.D).then(function(){return t.T&&(n.returnSecureToken=!0),Ir(o,t.endpoint,e,n,t.Pb,t.nb||!1)}).then(function(e){return r=e}).then(t.O).then(function(){if(!t.ga)return r;if(!(t.ga in r))throw new Oi("internal-error");return r[t.ga]})}function jr(e){return Mr({error:{errors:[{message:e}],code:400,message:e}})}function Mr(o,t){var a=(o.error&&o.error.errors&&o.error.errors[0]||{}).reason||"",e={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(a=e[a]?new Oi(e[a]):null)return a;for(var i in a=o.error&&o.error.message||"",e={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code",INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id",QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash"},x(e,t||{}),t=(t=a.match(/^[^\s]+\s*:\s*(.*)$/))&&1<t.length?t[1]:void 0,e)if(0===a.indexOf(i))return new Oi(e[i],t);return!t&&o&&(t=hi(o)),new Oi("internal-error",t)}function Vr(e){for(var t in Rc)if(Rc[t].id===e)return e=Rc[t],{firebaseEndpoint:e.Va,secureTokenEndpoint:e.ab};return null}function Fr(e){this.b=e,this.a=null,this.Ya=Kr(this)}function Kr(a){return Br().then(function(){return new $(function(t,n){ri("gapi.iframes.getContext")().open({where:document.body,url:a.b,messageHandlersFilter:ri("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"),attributes:{style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},dontclear:!0},function(e){function i(){clearTimeout(r),t()}a.a=e,a.a.restyle({setHideOnLeave:!1});var r=setTimeout(function(){n(Error("Network Error"))},Dc.get());e.ping(i).then(i,function(){n(Error("Network Error"))})})})})}function qr(o,t){return o.Ya.then(function(){return new $(function(n){o.a.send(t.type,t,n,ri("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})})}function Xr(e,t){e.Ya.then(function(){e.a.register("authEvent",t,ri("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}function Br(){return Mc||(Mc=new $(function(o,r){if(mi()){var n=function(){vi(),ri("gapi.load")("gapi.iframes",{callback:o,ontimeout:function(){vi(),r(Error("Network Error"))},timeout:_c.get()})};if(ri("gapi.iframes.Iframe"))o();else if(ri("gapi.load"))n();else{var e="__iframefcb"+ed(1e6*Math.random());Ld[e]=function(){ri("gapi.load")?n():r(Error("Network Error"))},e=At(Pc,{onload:e}),tt(_e(e)).s(function(){r(Error("Network Error"))})}}else r(Error("Network Error"))}).s(function(e){throw Mc=null,e}))}function Hr(o,t,n){this.i=o,this.g=t,this.h=n,this.f=null,this.a=ee(this.i,"/__/auth/iframe"),Qn(this.a,"apiKey",this.g),Qn(this.a,"appName",this.h),this.b=null,this.c=[]}function Wr(o,t,n,e,a){this.m=o,this.u=t,this.c=n,this.l=e,this.i=this.g=this.h=null,this.a=a,this.f=null}function Gr(e){try{return Nd.app(e).auth().Ka()}catch(e){return[]}}function zr(o,t,n,e,a){this.u=o,this.f=t,this.b=n,this.c=e||null,this.h=a||null,this.m=this.o=this.v=null,this.g=[],this.l=this.a=null}function Jr(e){var d=Ke();return Er(e).then(function(n){t:{var l=ne(d),e=l.c;l=l.b;for(var i=0;i<n.length;i++){var r=n[i],o=l,a=e;if(0==r.indexOf("chrome-extension://")?o=ne(r).b==o&&"chrome-extension"==a:"http"!=a&&"https"!=a?o=!1:Cp.test(r)?o=o==r:(r=r.split(".").join("\\."),o=RegExp("^(.+\\."+r+"|"+r+")$","i").test(o)),o){n=!0;break t}}n=!1}if(!n)throw new fr(Ke())})}function Yr(o){return o.l?o.l:(o.l=Je().then(function(){if(!o.o){var t=o.c,n=o.h,e=Gr(o.b),a=new Hr(o.u,o.f,o.b);a.f=t,a.b=n,a.c=S(e||[]),o.o=""+a}o.i=new Fr(o.o),Qr(o)}),o.l)}function $r(e){return e.m||(e.v=e.c?ei(e.c,Gr(e.b)):null,e.m=new vr(e.f,Vr(e.h),e.v)),e.m}function Zr(d,t,n,e,i,r,o,a,s,l){return d=new Wr(d,t,n,e,i),d.h=r,d.g=o,d.i=a,d.b=L(s||null),d.f=l,""+d}function Qr(o){if(!o.i)throw Error("IfcHandler must be initialized!");Xr(o.i,function(t){var n={};if(t&&t.authEvent){var e=!1;for(t=hr(t.authEvent),n=0;n<o.g.length;n++)e=o.g[n](t)||e;return n={},n.status=e?"ACK":"ERROR",tt(n)}return n.status="ERROR",tt(n)})}function to(e){var t={type:"webStorageSupport"};return Yr(e).then(function(){return qr(e.i,t)}).then(function(e){if(e&&e.length&&void 0!==e[0].webStorageSupport)return e[0].webStorageSupport;throw Error()})}function no(e){if(this.a=e||Nd.INTERNAL.reactNative&&Nd.INTERNAL.reactNative.AsyncStorage,!this.a)throw new Oi("internal-error","The React Native compatibility library was not found.")}function bd(){this.a={}}function io(s,t,n,e,i,r){try{var o=!!Ld.indexedDB}catch(e){o=!1}if(!o)throw new Oi("web-storage-unsupported");this.u=s,this.h=t,this.g=n,this.l=e,this.m=i,this.f={},this.c=[],this.a=0,this.o=r||Ld.indexedDB}function ro(o){return new $(function(r,n){var e=o.o.open(o.u,o.m);e.onerror=function(e){n(Error(e.target.errorCode))},e.onupgradeneeded=function(e){e=e.target.result;try{e.createObjectStore(o.h,{keyPath:o.g})}catch(e){n(e)}},e.onsuccess=function(e){r(e.target.result)}})}function oo(e){return e.i||(e.i=ro(e)),e.i}function ao(e,t){return t.objectStore(e.h)}function so(o,t,n){return t.transaction([o.h],n?"readwrite":"readonly")}function uo(o){return new $(function(r,n){o.onsuccess=function(e){e&&e.target?r(e.target.result):r()},o.onerror=function(e){n(Error(e.target.errorCode))}})}function co(e){function o(){return e.b=mn(800).then(f(e.zc,e)).then(function(o){0<o.length&&qd(e.c,function(e){e(o)})}).then(o).s(function(e){"STOP_EVENT"!=e.message&&o()}),e.b}e.b&&e.b.cancel("STOP_EVENT"),o()}function ho(){if(!lo()){if("Node"==Qe())throw new Oi("internal-error","The LocalStorage compatibility library was not found.");throw new Oi("web-storage-unsupported")}this.a=vd()||Nd.INTERNAL.node.localStorage}function vd(){try{var e=Ld.localStorage,t=di();return e&&(e.setItem(t,"1"),e.removeItem(t)),e}catch(e){return null}}function lo(){var e="Node"==Qe();if(!(e=vd()||e&&Nd.INTERNAL.node&&Nd.INTERNAL.node.localStorage))return!1;try{return e.setItem("__sak","1"),e.removeItem("__sak"),!0}catch(e){return!1}}function po(){}function xd(){if(!go()){if("Node"==Qe())throw new Oi("internal-error","The SessionStorage compatibility library was not found.");throw new Oi("web-storage-unsupported")}this.a=Cd()||Nd.INTERNAL.node.sessionStorage}function Cd(){try{var e=Ld.sessionStorage,t=di();return e&&(e.setItem(t,"1"),e.removeItem(t)),e}catch(e){return null}}function go(){var e="Node"==Qe();if(!(e=Cd()||e&&Nd.INTERNAL.node&&Nd.INTERNAL.node.sessionStorage))return!1;try{return e.setItem("__sak","1"),e.removeItem("__sak"),!0}catch(e){return!1}}function bo(){var e={};e.Browser=Bc,e.Node=Uc,e.ReactNative=Vc,this.a=e[Qe()]}function wo(o){var r=new Oi("invalid-persistence-type"),n=new Oi("unsupported-persistence-type");t:{for(e in Wc)if(Wc[e]==o){var e=!0;break t}e=!1}if(!e||"string"!=typeof o)throw r;switch(Qe()){case"ReactNative":if("session"===o)throw n;break;case"Node":if("none"!==o)throw n;break;default:if(!oi()&&"none"!==o)throw n;}}function yo(a,t,n,e,i){this.i=a,this.g=t,this.A=n,this.u=e,this.v=i,this.a={},Hc||(Hc=new bo),a=Hc;try{if(Fe()){Fc||(Fc=new io("firebaseLocalStorageDb","firebaseLocalStorage","fbase_key","value",1));var r=Fc}else r=new a.a.C;this.l=r}catch(e){this.l=new bd,this.u=!0}try{this.o=new a.a.jb}catch(e){this.o=new bd}this.w=new bd,this.h=f(this.m,this),this.b={}}function Io(){return jc||(jc=new yo("firebase",":",!pi(ii())&&Ze(),ci(),oi())),jc}function To(e,t){return"session"===t?e.o:"none"===t?e.w:e.l}function Ao(o,t,n){return o.i+o.g+t.name+(n?o.g+n:"")}function ko(o,t,n){return n=Ao(o,t,n),"local"==t.C&&(o.b[n]=null),To(o,t.C).X(n)}function Eo(o,t,n,e){t=Ao(o,t,n),o.v&&(o.b[t]=Ld.localStorage.getItem(t)),_(o.a)&&(To(o,"local").ia(o.h),o.u||Fe()||!o.v||So(o)),o.a[t]||(o.a[t]=[]),o.a[t].push(e)}function No(o,t,n){t=Ao(o,us("local"),t),o.a[t]&&(E(o.a[t],function(e){return e==n}),0==o.a[t].length&&delete o.a[t]),_(o.a)&&Po(o)}function So(o){Oo(o),o.f=setInterval(function(){for(var t in o.a){var r=Ld.localStorage.getItem(t),a=o.b[t];r!=a&&(o.b[t]=r,r=new Bt({type:"storage",key:t,target:window,oldValue:a,newValue:r,a:!0}),o.m(r))}},1e3)}function Oo(e){e.f&&(clearInterval(e.f),e.f=null)}function Po(e){To(e,"local").da(e.h),Oo(e)}function Co(e){this.a=e,this.b=Io()}function Ro(e){return e.b.get(qc,e.a).then(function(e){return hr(e)})}function _o(){this.a=Io()}function Do(s,t,n,e,i,r,o){this.u=s,this.i=t,this.l=n,this.m=e||null,this.o=o||null,this.h=t+":"+n,this.A=new _o,this.g=new Co(this.h),this.f=null,this.b=[],this.v=i||500,this.w=r||2e3,this.a=this.c=null}function Lo(e){return new Oi("invalid-cordova-configuration",e)}function xo(){for(var e=20,t=[];0<e;)t.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(ed(62*Math.random()))),e--;return t.join("")}function Uo(o){var t=new Bn;Xn(t,o),o=[];var n=8*t.g;56>t.c?Xn(t,op,56-t.c):Xn(t,op,t.b-(t.c-56));for(var e=63;56<=e;e--)t.f[e]=255&n,n/=256;for(qn(t),e=n=0;e<t.i;e++)for(var a=24;0<=a;a-=8)o[n++]=255&t.a[e]>>a;return Nn(o)}function jo(d,t,n,e){var i=xo(),r=new cr(t,e,null,i,new Oi("no-auth-event")),o=ri("BuildInfo.packageName",Ld);if("string"!=typeof o)throw new Oi("invalid-cordova-configuration");var l=ri("BuildInfo.displayName",Ld),s={};if(ii().toLowerCase().match(/iphone|ipad|ipod/))s.ibi=o;else{if(!ii().toLowerCase().match(/android/))return nt(new Oi("operation-not-supported-in-this-environment"));s.apn=o}l&&(s.appDisplayName=l),i=Uo(i),s.sessionId=i;var p=Zr(d.u,d.i,d.l,t,n,null,e,d.m,s,d.o);return d.ba().then(function(){var e=d.h;return d.A.a.set(qc,r.B(),e)}).then(function(){var t=ri("cordova.plugins.browsertab.isAvailable",Ld);if("function"!=typeof t)throw new Oi("invalid-cordova-configuration");var o=null;t(function(e){if(e){if("function"!=typeof(o=ri("cordova.plugins.browsertab.openUrl",Ld)))throw new Oi("invalid-cordova-configuration");o(p)}else{if("function"!=typeof(o=ri("cordova.InAppBrowser.open",Ld)))throw new Oi("invalid-cordova-configuration");e=ii(),e=e.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||e.match(/(iPad|iPhone|iPod).*OS 8_\d/i),d.a=o(p,e?"_blank":"_system","location=yes")}})})}function Mo(o,t){for(var n=0;n<o.b.length;n++)try{o.b[n](t)}catch(e){}}function Vo(o){return o.f||(o.f=o.ba().then(function(){return new $(function(t){function n(e){return t(e),o.Ja(n),!1}o.ua(n),Ko(o)})})),o.f}function Fo(o){var t=null;return Ro(o.g).then(function(n){return t=n,n=o.g,ko(n.b,qc,n.a)}).then(function(){return t})}function Ko(d){function s(t){i=!0,r&&r.cancel(),Fo(d).then(function(n){var e=l;if(n&&t&&t.url){e=null;var i=t.url,o=ne(i),a=te(o,"link"),s=te(ne(a),"link");o=te(o,"deep_link_id"),i=te(ne(o),"link")||o||s||a||i,-1!=i.indexOf("/__/auth/callback")&&(e=ne(i),e=li(te(e,"firebaseError")||null),e=(e="object"==typeof e?sd(e):null)?new cr(n.b,n.c,null,null,e):new cr(n.b,n.c,i,n.g)),e=e||l}Mo(d,e)})}var t=ri("universalLinks.subscribe",Ld);if("function"!=typeof t)throw new Oi("invalid-cordova-configuration");var l=new cr("unknown",null,null,null,new Oi("no-auth-event")),i=!1,r=mn(d.v).then(function(){return Fo(d).then(function(){i||Mo(d,l)})}),n=Ld.handleOpenURL;Ld.handleOpenURL=function(e){if(0==e.toLowerCase().indexOf(ri("BuildInfo.packageName",Ld).toLowerCase()+"://")&&s({url:e}),"function"==typeof n)try{n(e)}catch(e){console.error(e)}},t(null,s)}function qo(e){this.a=e,this.b=Io()}function Xo(e){return e.b.set(zc,"pending",e.a)}function Bo(e){return ko(e.b,zc,e.a)}function Ho(e){return e.b.get(zc,e.a).then(function(e){return"pending"==e})}function Wo(o,t,n){this.v=o,this.l=t,this.u=n,this.h=[],this.f=!1,this.i=f(this.m,this),this.c=new Qo,this.o=new aa,this.g=new qo(this.l+":"+this.u),this.b={},this.b.unknown=this.c,this.b.signInViaRedirect=this.c,this.b.linkViaRedirect=this.c,this.b.reauthViaRedirect=this.c,this.b.signInViaPopup=this.o,this.b.linkViaPopup=this.o,this.b.reauthViaPopup=this.o,this.a=Go(this.v,this.l,this.u,Oc)}function Go(o,t,n,e){var a=Nd.SDK_VERSION||null;return $e()?new Do(o,t,n,a,void 0,void 0,e):new zr(o,t,n,a,e)}function zo(o){o.f||(o.f=!0,o.a.ua(o.i));var t=o.a;return o.a.ba().s(function(n){throw o.a==t&&o.reset(),n})}function Jo(o){o.a.Db()&&zo(o).s(function(t){var n=new cr("unknown",null,null,null,new Oi("operation-not-supported-in-this-environment"));$o(t)&&o.m(n)}),o.a.yb()||ta(o.c)}function Yo(a,t,n,e,i,r){return a.a.vb(t,n,e,function(){a.f||(a.f=!0,a.a.ua(a.i))},function(){a.reset()},i,r)}function $o(e){return e&&"auth/cordova-not-ready"==e.code}function Zo(o,t,n){var e=t+":"+n;return Xc[e]||(Xc[e]=new Wo(o,t,n)),Xc[e]}function Qo(){this.b=null,this.f=[],this.c=[],this.a=null,this.g=!1}function ta(e){e.g||(e.g=!0,ra(e,!1,null,null))}function na(a,t,n){n=n.va(t.b,t.c);var e=t.f,i=t.g,r=!!t.b.match(/Redirect$/);return n(e,i).then(function(e){ra(a,r,e,null)}).s(function(e){ra(a,r,null,e)})}function ea(o,t){if(o.b=function(){return nt(t)},o.c.length)for(var n=0;n<o.c.length;n++)o.c[n](t)}function ia(o,t){if(o.b=function(){return tt(t)},o.f.length)for(var n=0;n<o.f.length;n++)o.f[n](t)}function ra(o,t,n,e){t?e?ea(o,e):ia(o,n):ia(o,{user:null}),o.f=[],o.c=[]}function oa(e){var t=new Oi("timeout");e.a&&e.a.cancel(),e.a=mn(Gc.get()).then(function(){e.b||ra(e,!0,null,t)})}function aa(){}function sa(o,r){var n=o.c,e=o.b;return r.va(e,n)(o.f,o.g).then(function(o){r.fa(e,o,null,n)}).s(function(o){r.fa(e,null,o,n)})}function ua(e,t){this.a=t,Ii(this,"verificationId",e)}function ca(o,t,n,e){return new or(o).Qa(t,n).then(function(n){return new ua(n,e)})}function ha(a,t,n,e,i,r){if(this.h=a,this.i=t,this.g=n,this.c=e,this.f=i,this.l=!!r,this.b=null,this.a=this.c,this.f<this.c)throw Error("Proactive refresh lower bound greater than upper bound!")}function fa(e,t){return t?(e.a=e.c,e.g()):(t=e.a,e.a*=2,e.a>e.f&&(e.a=e.f),t)}function la(e,t){da(e),e.b=mn(fa(e,t)).then(function(){return e.l?tt():wi()}).then(function(){return e.h()}).then(function(){la(e,!0)}).s(function(t){e.i(t)&&la(e,!1)})}function da(e){e.b&&(e.b.cancel(),e.b=null)}function pa(e){this.f=e,this.b=this.a=null,this.c=0}function va(o,t){var n=t[Yp],e=t.refreshToken;t=ma(t.expiresIn),o.b=n,o.c=t,o.a=e}function ma(e){return Pd()+1e3*parseInt(e,10)}function ga(e,t){return yr(e.f,t).then(function(t){return e.b=t.access_token,e.c=ma(t.expires_in),e.a=t.refresh_token,{accessToken:e.b,expirationTime:e.c,refreshToken:e.a}}).s(function(t){throw"auth/user-token-expired"==t.code&&(e.a=null),t})}function ba(e,t){this.a=e||null,this.b=t||null,Ti(this,{lastSignInTime:yi(t||null),creationTime:yi(e||null)})}function wa(e){return new ba(e.a,e.b)}function ya(a,s,d,e,i,r){Ti(this,{uid:a,displayName:e||null,photoURL:i||null,email:d||null,phoneNumber:r||null,providerId:s})}function Ia(o,t){for(var n in Xt.call(this,o),t)this[n]=t[n]}function Ta(o,t,n){this.A=[],this.G=o.apiKey,this.o=o.appName,this.w=o.authDomain||null,o=Nd.SDK_VERSION?ei(Nd.SDK_VERSION):null,this.c=new vr(this.G,Vr(Oc),o),this.h=new pa(this.c),Ca(this,t[Yp]),va(this.h,t),Ii(this,"refreshToken",this.h.a),La(this,n||{}),hn.call(this),this.I=!1,this.w&&ai()&&(this.a=Zo(this.w,this.G,this.o)),this.N=[],this.i=null,this.l=Sa(this),this.U=f(this.Ga,this);var e=this;this.ha=null,this.ra=function(n){e.na(n.h)},this.W=null,this.R=[],this.qa=function(n){ka(e,n.f)},this.V=null}function Sd(e,t){e.W&&nn(e.W,"languageCodeChanged",e.ra),(e.W=t)&&$t(t,"languageCodeChanged",e.ra)}function ka(e,t){e.R=t,gr(e.c,Nd.SDK_VERSION?ei(Nd.SDK_VERSION,e.R):null)}function Ea(e,t){e.V&&nn(e.V,"frameworkChanged",e.qa),(e.V=t)&&$t(t,"frameworkChanged",e.qa)}function Na(e){try{return Nd.app(e.o).auth()}catch(t){throw new Oi("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+e.o+"'!")}}function Sa(e){return new ha(function(){return e.F(!0)},function(e){return e&&"auth/network-request-failed"==e.code},function(){var t=e.h.c-Pd()-3e5;return 0<t?t:0},3e4,96e4,!1)}function Oa(e){e.m||e.l.b||(e.l.start(),nn(e,"tokenChanged",e.U),$t(e,"tokenChanged",e.U))}function Pa(e){nn(e,"tokenChanged",e.U),da(e.l)}function Ca(e,t){e.pa=t,Ii(e,"_lat",t)}function Ra(e,o){E(e.N,function(e){return e==o})}function _a(o){for(var t=[],n=0;n<o.N.length;n++)t.push(o.N[n](o));return rt(t).then(function(){return o})}function Da(e){e.a&&!e.I&&(e.I=!0,e.a.subscribe(e))}function La(e,t){Ti(e,{uid:t.uid,displayName:t.displayName||null,photoURL:t.photoURL||null,email:t.email||null,emailVerified:t.emailVerified||!1,phoneNumber:t.phoneNumber||null,isAnonymous:t.isAnonymous||!1,metadata:new ba(t.createdAt,t.lastLoginAt),providerData:[]})}function xa(){}function Ua(e){return tt().then(function(){if(e.m)throw new Oi("app-deleted")})}function ja(e){return zd(e.providerData,function(e){return e.providerId})}function Ma(e,t){t&&(Va(e,t.providerId),e.providerData.push(t))}function Va(e,o){E(e.providerData,function(e){return e.providerId==o})}function Fa(o,t,n){("uid"!=t||n)&&o.hasOwnProperty(t)&&Ii(o,t,n)}function Ka(e,t){e!=t&&(Ti(e,{uid:t.uid,displayName:t.displayName,photoURL:t.photoURL,email:t.email,emailVerified:t.emailVerified,phoneNumber:t.phoneNumber,isAnonymous:t.isAnonymous,providerData:[]}),t.metadata?Ii(e,"metadata",wa(t.metadata)):Ii(e,"metadata",new ba),qd(t.providerData,function(t){Ma(e,t)}),e.h=t.h,Ii(e,"refreshToken",e.h.a))}function qa(o){return o.F().then(function(t){var n=o.isAnonymous;return Ba(o,t).then(function(){return n||Fa(o,"isAnonymous",!1),t})})}function Xa(e,t){t[Yp]&&e.pa!=t[Yp]&&(va(e.h,t),fn(e,new Ia("tokenChanged")),Ca(e,t[Yp]),Fa(e,"refreshToken",e.h.a))}function Ba(e,t){return yd(e.c,cc,{idToken:t}).then(f(e.kc,e))}function Ha(e){return(e=e.providerUserInfo)&&e.length?zd(e,function(e){return new ya(e.rawId,e.providerId,e.email,e.displayName,e.photoUrl,e.phoneNumber)}):[]}function Wa(e,t){return qa(e).then(function(){if(A(ja(e),t))return _a(e).then(function(){throw new Oi("provider-already-linked")})})}function Ga(o,r,a){var s=sr(r);return r=xi(r),Ai({user:o,credential:s,additionalUserInfo:r,operationType:a})}function za(e,t){return Xa(e,t),e.reload().then(function(){return e})}function Ja(d,t,n,e,i){if(!ai())return nt(new Oi("operation-not-supported-in-this-environment"));if(d.i&&!i)return nt(d.i);var l=Li(n.providerId),o=di(d.uid+":::"),a=null;(!ci()||Ze())&&d.w&&n.isOAuthProvider&&(a=Zr(d.w,d.G,d.o,t,n,null,o,Nd.SDK_VERSION||null));var p=Ge(a,l&&l.za,l&&l.ya);return e=e().then(function(){if($a(d),!i)return d.F().then(function(){})}).then(function(){return Yo(d.a,p,t,n,o,!!a)}).then(function(){return new $(function(n,e){d.fa(t,null,new Oi("cancelled-popup-request"),d.g||null),d.f=n,d.v=e,d.g=o,d.b=d.a.Ca(d,t,p,o)})}).then(function(e){return p&&We(p),e?Ai(e):null}).s(function(e){throw p&&We(p),e}),Za(d,e,i)}function Ya(s,t,n,e,i){if(!ai())return nt(new Oi("operation-not-supported-in-this-environment"));if(s.i&&!i)return nt(s.i);var d=null,o=di(s.uid+":::");return e=e().then(function(){if($a(s),!i)return s.F().then(function(){})}).then(function(){return s.Z=o,_a(s)}).then(function(e){return s.ca&&(e=s.ca,e=e.b.set(Qc,s.B(),e.a)),e}).then(function(){return s.a.Aa(t,n,o)}).s(function(e){if(d=e,s.ca)return is(s.ca);throw d}).then(function(){if(d)throw d}),Za(s,e,i)}function $a(e){if(!e.a||!e.I){if(e.a&&!e.I)throw new Oi("internal-error");throw new Oi("auth-domain-config-required")}}function Za(o,t,n){var e=Qa(o,t,n);return o.A.push(e),ot(e,function(){k(o.A,e)}),e}function Qa(o,t,n){return o.i&&!n?(t.cancel(),nt(o.i)):t.s(function(e){throw!e||"auth/user-disabled"!=e.code&&"auth/user-token-expired"!=e.code||(o.i||fn(o,new Ia("userInvalidated")),o.i=e),e})}function ts(o){if(!o.apiKey)return null;var t={apiKey:o.apiKey,authDomain:o.authDomain,appName:o.appName},n={};if(!(o.stsTokenManager&&o.stsTokenManager.accessToken&&o.stsTokenManager.expirationTime))return null;n[Yp]=o.stsTokenManager.accessToken,n.refreshToken=o.stsTokenManager.refreshToken||null,n.expiresIn=(o.stsTokenManager.expirationTime-Pd())/1e3;var e=new Ta(t,n,o);return o.providerData&&qd(o.providerData,function(n){n&&Ma(e,Ai(n))}),o.redirectEventId&&(e.Z=o.redirectEventId),e}function ns(o,t,n,e){var a=new Ta(o,t);return n&&(a.ca=n),e&&ka(a,e),a.reload().then(function(){return a})}function es(e){this.a=e,this.b=Io()}function is(e){return ko(e.b,Qc,e.a)}function rs(e,o){return e.b.get(Qc,e.a).then(function(e){return e&&o&&(e.authDomain=o),ts(e||{})})}function os(e,t){this.a=e,this.b=t||Io(),this.c=null,this.f=ss(this),Eo(this.b,us("local"),this.a,f(this.g,this))}function as(o,t){var n=[],r;for(r in Wc)Wc[r]!==t&&n.push(ko(o.b,us(Wc[r]),o.a));return n.push(ko(o.b,Yc,o.a)),it(n)}function ss(o){var r=us("local"),t=us("session"),n=us("none");return o.b.get(t,o.a).then(function(e){return e?t:o.b.get(n,o.a).then(function(t){return t?n:o.b.get(r,o.a).then(function(t){return t?r:o.b.get(Yc,o.a).then(function(e){return e?us(e):r})})})}).then(function(e){return o.c=e,as(o,e.C)}).s(function(){o.c||(o.c=r)})}function us(e){return{name:"authUser",C:e}}function cs(e){return ds(e,function(){return e.b.set(Yc,e.c.C,e.a)})}function hs(e,t){return ds(e,function(){return e.b.set(e.c,t.B(),e.a)})}function fs(e){return ds(e,function(){return ko(e.b,e.c,e.a)})}function ls(e,o){return ds(e,function(){return e.b.get(e.c,e.a).then(function(e){return e&&o&&(e.authDomain=o),ts(e||{})})})}function ds(e,t){return e.f=e.f.then(t,t),e.f}function ps(e){if(this.l=!1,Ii(this,"app",e),!Ns(this).options||!Ns(this).options.apiKey)throw new Oi("invalid-api-key");e=Nd.SDK_VERSION?ei(Nd.SDK_VERSION):null,this.c=new vr(Ns(this).options&&Ns(this).options.apiKey,Vr(Oc),e),this.N=[],this.m=[],this.I=[],this.Kb=Nd.INTERNAL.createSubscribe(f(this.ac,this)),this.R=void 0,this.Lb=Nd.INTERNAL.createSubscribe(f(this.bc,this)),Is(this,null),this.h=new os(Ns(this).options.apiKey+":"+Ns(this).name),this.G=new es(Ns(this).options.apiKey+":"+Ns(this).name),this.U=Rs(this,As(this)),this.i=Rs(this,ks(this)),this.W=!1,this.ha=f(this.yc,this),this.Ga=f(this.ka,this),this.pa=f(this.Tb,this),this.qa=f(this.Zb,this),this.ra=f(this.$b,this),ws(this),this.INTERNAL={},this.INTERNAL.delete=f(this.delete,this),this.INTERNAL.logFramework=f(this.gc,this),this.o=0,hn.call(this),gs(this),this.A=[]}function Ed(e){Xt.call(this,"languageCodeChanged"),this.h=e}function ms(e){Xt.call(this,"frameworkChanged"),this.f=e}function gs(e){Object.defineProperty(e,"lc",{get:function(){return this.$()},set:function(e){this.na(e)},enumerable:!1}),e.V=null}function bs(e){return e.Jb||nt(new Oi("auth-domain-config-required"))}function ws(o){var t=Ns(o).options.authDomain,n=Ns(o).options.apiKey;t&&ai()&&(o.Jb=o.U.then(function(){if(!o.l){if(o.a=Zo(t,n,Ns(o).name),o.a.subscribe(o),Ss(o)&&Da(Ss(o)),o.w){Da(o.w);var e=o.w;e.na(o.$()),Sd(e,o),e=o.w,ka(e,o.A),Ea(e,o),o.w=null}return o.a}}))}function ys(o,t){var n={};return n.apiKey=Ns(o).options.apiKey,n.authDomain=Ns(o).options.authDomain,n.appName=Ns(o).name,o.U.then(function(){return ns(n,t,o.G,o.Ka())}).then(function(e){return Ss(o)&&e.uid==Ss(o).uid?(Ka(Ss(o),e),o.ka(e)):(Is(o,e),Da(e),o.ka(e))}).then(function(){Ps(o)})}function Is(e,t){Ss(e)&&(Ra(Ss(e),e.Ga),nn(Ss(e),"tokenChanged",e.pa),nn(Ss(e),"userDeleted",e.qa),nn(Ss(e),"userInvalidated",e.ra),Pa(Ss(e))),t&&(t.N.push(e.Ga),$t(t,"tokenChanged",e.pa),$t(t,"userDeleted",e.qa),$t(t,"userInvalidated",e.ra),0<e.o&&Oa(t)),Ii(e,"currentUser",t),t&&(t.na(e.$()),Sd(t,e),ka(t,e.A),Ea(t,e))}function Ts(e){var t=rs(e.G,Ns(e).options.authDomain).then(function(t){return(e.w=t)&&(t.ca=e.G),is(e.G)});return Rs(e,t)}function As(o){var t=Ns(o).options.authDomain,n=Ts(o).then(function(){return ls(o.h,t)}).then(function(t){return t?(t.ca=o.G,o.w&&(o.w.Z||null)==(t.Z||null)?t:t.reload().then(function(){return hs(o.h,t).then(function(){return t})}).s(function(n){return"auth/network-request-failed"==n.code?t:fs(o.h)})):null}).then(function(e){Is(o,e||null)});return Rs(o,n)}function ks(e){return e.U.then(function(){return e.aa()}).s(function(){}).then(function(){if(!e.l)return e.ha()}).s(function(){}).then(function(){if(!e.l){e.W=!0;var t=e.h;Eo(t.b,us("local"),t.a,e.ha)}})}function Es(o,t){var r=null,a=null;return Rs(o,t.then(function(e){return r=sr(e),a=xi(e),ys(o,e)}).then(function(){return Ai({user:Ss(o),credential:r,additionalUserInfo:a,operationType:"signIn"})}))}function Ns(e){return e.app}function Ss(e){return e.currentUser}function Os(e){return Ss(e)&&Ss(e)._lat||null}function Ps(e){if(e.W){for(var t=0;t<e.m.length;t++)e.m[t]&&e.m[t](Os(e));if(e.R!==e.getUid()&&e.I.length)for(e.R=e.getUid(),t=0;t<e.I.length;t++)e.I[t]&&e.I[t](Os(e))}}function Cs(e,t){e.I.push(t),Rs(e,e.i.then(function(){!e.l&&A(e.I,t)&&e.R!==e.getUid()&&(e.R=e.getUid(),t(Os(e)))}))}function Rs(e,t){return e.N.push(t),ot(t,function(){k(e.N,t)}),t}function _s(s,t,n,e){t:{n=Array.prototype.slice.call(n);for(var i=0,r=!1,d=0;d<t.length;d++)if(t[d].optional)r=!0;else{if(r)throw new Oi("internal-error","Argument validator encountered a required argument after an optional argument.");i++}if(r=t.length,n.length<i||r<n.length)e="Expected "+(i==r?1==i?"1 argument":i+" arguments":i+"-"+r+" arguments")+" but got "+n.length+".";else{for(i=0;i<n.length;i++)if(r=t[i].optional&&void 0===n[i],!t[i].M(n[i])&&!r){if(t=t[i],0>i||i>=Jc.length)throw new Oi("internal-error","Argument validator received an unsupported number of arguments.");n=Jc[i],e=(e?"":n+" argument ")+(t.name?"\""+t.name+"\" ":"")+"must be "+t.K+".";break t}e=null}}if(e)throw new Oi("argument-error",s+" failed: "+e)}function Ds(o,n){return{name:o||"",K:"a valid string",optional:!!n,M:td}}function Ls(){return{name:"opt_forceRefresh",K:"a boolean",optional:!0,M:e}}function xs(e,t){return{name:e||"",K:"a valid object",optional:!!t,M:ad}}function Us(e,t){return{name:e||"",K:"a function",optional:!!t,M:a}}function js(e,t){return{name:e||"",K:"null",optional:!!t,M:r}}function Ms(){return{name:"",K:"an HTML element",optional:!1,M:function(e){return!!(e&&e instanceof Element)}}}function Vs(){return{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(e){return!!(e&&e instanceof ps)}}}function Fs(){return{name:"app",K:"an instance of Firebase App",optional:!0,M:function(e){return!!(e&&e instanceof Nd.app.App)}}}function Ks(o){return{name:o?o+"Credential":"credential",K:o?"a valid "+o+" credential":"a valid credential",optional:!1,M:function(r){if(!r)return!1;var a=!o||r.providerId===o;return r.wa&&a}}}function qs(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(e){return!!(e&&e.providerId&&e.hasOwnProperty&&e.hasOwnProperty("isOAuthProvider"))}}}function Xs(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(e){return!!(e&&td(e.type)&&a(e.verify))}}}function Bs(o,t,n,e){return{name:n||"",K:o.K+" or "+t.K,optional:!!e,M:function(n){return o.M(n)||t.M(n)}}}function Hs(d,t,n,e,i,r){if(Ii(this,"type","recaptcha"),this.b=this.c=null,this.m=!1,this.l=t,this.a=n||{theme:"light",type:"image"},this.g=[],this.a[eu])throw new Oi("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.h="invisible"===this.a[tu],!_t(t)||!this.h&&_t(t).hasChildNodes())throw new Oi("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.u=new vr(d,r||null,i||null),this.o=e||function(){return null};var o=this;this.i=[];var a=this.a[$c];this.a[$c]=function(e){if(Ws(o,e),"function"==typeof a)a(e);else if("string"==typeof a){var t=ri(a,Ld);"function"==typeof t&&t(e)}};var l=this.a[Zc];this.a[Zc]=function(){if(Ws(o,null),"function"==typeof l)l();else if("string"==typeof l){var e=ri(l,Ld);"function"==typeof e&&e()}}}function Ws(o,t){for(var n=0;n<o.i.length;n++)try{o.i[n](t)}catch(e){}}function Gs(e,o){E(e.i,function(e){return e==o})}function zs(e,t){return e.g.push(t),ot(t,function(){k(e.g,t)}),t}function Js(e){if(e.m)throw new Oi("internal-error","RecaptchaVerifier instance has been destroyed.")}function Ys(){this.b=Ld.grecaptcha?1/0:0,this.c=null,this.a="__rcb"+ed(1e6*Math.random())}function $s(o,t){return new $(function(n,e){if(!mi())e(new Oi("network-request-failed"));else if(!Ld.grecaptcha||t!==o.c&&!o.b){Ld[o.a]=function(){if(Ld.grecaptcha){o.c=t;var a=Ld.grecaptcha.render;Ld.grecaptcha.render=function(t,n){return t=a(t,n),o.b++,t},n()}else e(new Oi("internal-error"));delete Ld[o.a]};var a=At(nu,{onload:o.a,hl:t||""});tt(_e(a)).s(function(){e(new Oi("internal-error","Unable to load external reCAPTCHA dependencies!"))})}else n()})}function Zs(){return ou||(ou=new Ys),ou}function Qs(o,t,n){try{this.f=n||Nd.app()}catch(e){throw new Oi("argument-error","No firebase.app.App instance is currently initialized.")}if(!this.f.options||!this.f.options.apiKey)throw new Oi("invalid-api-key");n=this.f.options.apiKey;var e=this,a=null;try{a=this.f.auth().Ka()}catch(e){}a=Nd.SDK_VERSION?ei(Nd.SDK_VERSION,a):null,Hs.call(this,n,o,t,function(){try{var n=e.f.auth().$()}catch(e){n=null}return n},a,Vr(Oc))}function kd(o,t){for(var n in t){var e=t[n].name;o[e]=wd(e,o[n],t[n].j)}}function Td(o,t,n,e){o[t]=wd(t,n,e)}function wd(a,s,n){function t(){var e=Array.prototype.slice.call(arguments);return _s(i,n,e),s.apply(this,e)}if(!n)return s;var i=Id(a),o;for(o in s)t[o]=s[o];for(o in s.prototype)t.prototype[o]=s.prototype[o];return t}function Id(e){return e=e.split("."),e[e.length-1]}var Nd=Kn(6).default,Ad=Ad||{},Ld=this,Rd="closure_uid_"+(1e9*Math.random()>>>0),Od=0,Pd=Date.now||function(){return+new Date},_d;id(p,Error),p.prototype.name="CustomError";var Dd=String.prototype.trim?function(e){return e.trim()}:function(e){return e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Md=/&/g,Fd=/</g,Bd=/>/g,Ud=/"/g,Vd=/'/g,Wd=/\x00/g,Hd=/[\x00&<>"']/;id(w,p),w.prototype.name="AssertionError";var jd=Array.prototype.indexOf?function(o,t,n){return Array.prototype.indexOf.call(o,t,n)}:function(t,n,e){if(e=null==e?0:0>e?d(0,t.length+e):e,td(t))return td(n)&&1==n.length?t.indexOf(n,e):-1;for(;e<t.length;e++)if(e in t&&t[e]===n)return e;return-1},qd=Array.prototype.forEach?function(o,t,n){Array.prototype.forEach.call(o,t,n)}:function(t,n,e){for(var i=t.length,r=td(t)?t.split(""):t,o=0;o<i;o++)o in r&&n.call(e,r[o],o,t)},zd=Array.prototype.map?function(o,t,n){return Array.prototype.map.call(o,t,n)}:function(t,n,e){for(var i=t.length,r=Array(i),o=td(t)?t.split(""):t,a=0;a<i;a++)a in o&&(r[a]=n.call(e,o[a],a,t));return r},Kd=Array.prototype.some?function(o,t,n){return Array.prototype.some.call(o,t,n)}:function(t,n,e){for(var i=t.length,r=td(t)?t.split(""):t,o=0;o<i;o++)if(o in r&&n.call(e,r[o],o,t))return!0;return!1},Gd;t:{var Xd=Ld.navigator;if(Xd){var Qd=Xd.userAgent;if(Qd){Gd=Qd;break t}}Gd=""}var Yd=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];U[" "]=nd;var Jd=O("Opera"),$d=O("Trident")||O("MSIE"),Zd=O("Edge"),el=Zd||$d,tl=O("Gecko")&&(!g(Gd.toLowerCase(),"webkit")||O("Edge"))&&!(O("Trident")||O("MSIE"))&&!O("Edge"),nl=g(Gd.toLowerCase(),"webkit")&&!O("Edge"),ol;t:{var rl="",al=function(){var e=Gd;return tl?/rv\:([^\);]+)(\)|;)/.exec(e):Zd?/Edge\/([\d\.]+)/.exec(e):$d?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):nl?/WebKit\/(\S+)/.exec(e):Jd?/(?:Version)[ \/]?(\S+)/.exec(e):void 0}();if(al&&(rl=al?al[1]:""),$d){var il=M();if(null!=il&&il>parseFloat(rl)){ol=il+"";break t}}ol=rl}var sl={},dl=Ld.document,ll;ll=dl&&$d?M()||("CSS1Compat"==dl.compatMode?parseInt(ol,10):5):void 0,q.prototype.get=function(){if(0<this.b){this.b--;var e=this.a;this.a=e.next,e.next=null}else e=this.c();return e};var pl=new q(function(){return new H},function(e){e.reset()},100);H.prototype.set=function(e,t){this.a=e,this.b=t,this.next=null},H.prototype.reset=function(){this.next=this.b=this.a=null};var cl=!1,ul=new function(){this.b=this.a=null},hl=0,ml=2,gl=3,fl,yl;Z.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var bl=new q(function(){return new Z},function(e){e.reset()},100);$.prototype.then=function(o,t,n){return ut(this,a(o)?o:null,a(t)?t:null,n)},F($),_d=$.prototype,_d.s=function(e,t){return ut(this,null,e,t)},_d.cancel=function(e){this.a==hl&&z(function(){at(this,new gt(e))},this)},_d.Ac=function(e){this.a=hl,ct(this,ml,e)},_d.Bc=function(e){this.a=hl,ct(this,gl,e)},_d.Qb=function(){for(var e;e=dt(this);)pt(this,e,this.a,this.i);this.h=!1};var vl=W;id(gt,p),gt.prototype.name="cancel";var xl=!$d||9<=+ll;bt.prototype.la=!0,bt.prototype.ja=function(){return this.a},bt.prototype.toString=function(){return"Const{"+this.a+"}"};var Cl={};yt(""),It.prototype.la=!0,It.prototype.ja=function(){return this.a},It.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var Sl=/%{(\w+)}/g,El=/^(?:https:)?\/\/[0-9a-z.:[\]-]+\/|^\/[^\/\\]|^about:blank(#|$)/i,kl={};Et.prototype.la=!0,Et.prototype.ja=function(){return this.a},Et.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Tl=/^(?:(?:https?|mailto|ftp):|[^:\/?#]*(?:[\/?#]|$))/i,wl={};Ot("about:blank"),Pt.prototype.la=!0,Pt.prototype.ja=function(){return this.a},Pt.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Il={};Rt("<!DOCTYPE html>"),Rt(""),Rt("<br>");var Nl={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"},Al={'"':"\\\"","\\":"\\\\","/":"\\/","":"\\b","":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","":"\\u000b"},Ll=/\uffff/.test("\uFFFF")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,Rl=0,Ol={};Kt.prototype.oa=!1,Kt.prototype.ta=function(){if(this.Fa)for(;this.Fa.length;)this.Fa.shift()()};var Pl=Object.freeze||function(e){return e},_l=!$d||9<=+ll,Dl=$d&&!V("9"),Ml=function(){if(!Ld.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});return Ld.addEventListener("test",nd,t),Ld.removeEventListener("test",nd,t),e}();Xt.prototype.c=function(){this.Bb=!1},id(Bt,Xt);var Fl=Pl({2:"touch",3:"pen",4:"mouse"});Bt.prototype.c=function(){Bt.ib.c.call(this);var e=this.a;if(e.preventDefault)e.preventDefault();else if(e.returnValue=!1,Dl)try{(e.ctrlKey||112<=e.keyCode&&123>=e.keyCode)&&(e.keyCode=-1)}catch(e){}},Bt.prototype.g=function(){return this.a};var Bl="closure_listenable_"+(0|1e6*Math.random()),Ul=0,Vl="closure_lm_"+(0|1e6*Math.random()),Wl={},Hl=0,jl="__closure_events_fn_"+(1e9*Math.random()>>>0);id(hn,Kt),hn.prototype[Bl]=!0,hn.prototype.removeEventListener=function(o,t,n,e){nn(this,o,t,n,e)},hn.prototype.ta=function(){if(hn.ib.ta.call(this),this.u){var o=this.u,n=0,e;for(e in o.a){for(var t=o.a[e],a=0;a<t.length;a++)++n,Wt(t[a]);delete o.a[e],o.b--}}this.Ra=null},gn.prototype.a=null;var ql=0;gn.prototype.reset=function(o,t,n,e,a){"number"==typeof a||ql++,e||Pd(),this.b=t,delete this.a},wn.prototype.toString=function(){return this.name};var zl=new wn("SEVERE",1e3),Kl=new wn("CONFIG",700),Gl=new wn("FINE",500);bn.prototype.log=function(o,t,n){if(o.value>=yn(this).value)for(a(t)&&(t=t()),o=new gn(o,t+"",this.f),n&&(o.a=n),n="log:"+o.b,(o=Ld.console)&&o.timeStamp&&o.timeStamp(n),(o=Ld.msWriteProfilerMark)&&o(n),n=this;n;)n=n.a};var Xl={},Ql=null;_d=Tn.prototype,_d.P=function(){An(this);for(var e=[],t=0;t<this.a.length;t++)e.push(this.b[this.a[t]]);return e},_d.S=function(){return An(this),this.a.concat()},_d.clear=function(){this.b={},this.c=this.a.length=0},_d.get=function(e,t){return kn(this.b,e)?this.b[e]:t},_d.set=function(e,t){kn(this.b,e)||(this.c++,this.a.push(e)),this.b[e]=t},_d.forEach=function(a,t){for(var n=this.S(),e=0;e<n.length;e++){var i=n[e],r=this.get(i);a.call(t,r,i,this)}};var Yl=null,Jl=null;Cn.prototype.cancel=function(e){if(this.a)this.c instanceof Cn&&this.c.cancel();else{if(this.b){var t=this.b;delete this.b,e?t.cancel(e):0>=--t.l&&t.cancel()}this.v?this.v.call(this.o,this):this.u=!0,this.a||(e=new Mn,_n(this),Rn(this,!1,e))}},Cn.prototype.m=function(e,t){this.i=!1,Rn(this,e,t)},Cn.prototype.A=function(e){_n(this),Rn(this,!0,e)},Cn.prototype.then=function(a,t,n){var e=new $(function(e,t){o=e,i=t}),o,i;return Ln(this,o,function(n){n instanceof Mn?e.cancel():i(n)}),e.then(a,t,n)},F(Cn),id(jn,p),jn.prototype.message="Deferred has already fired",jn.prototype.name="AlreadyCalledError",id(Mn,p),Mn.prototype.message="Deferred was canceled",Mn.prototype.name="CanceledError",Vn.prototype.c=function(){throw delete $l[this.a],this.b};var $l={},Zl;id(Fn,function(){this.b=-1});for(var ep=64,tp=[],np=0;np<ep-1;np++)tp[np]=0;var op=N(128,tp);Fn.prototype.reset=function(){this.g=this.c=0,this.a=Ld.Int32Array?new Int32Array(this.h):S(this.h)};var rp=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];id(Bn,Fn);var ap=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],ip=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;Jn.prototype.toString=function(){var o=[],t=this.c;t&&o.push(re(t,sp,!0),":");var n=this.b;return(n||"file"==t)&&(o.push("//"),(t=this.l)&&o.push(re(t,sp,!0),"@"),o.push(encodeURIComponent(n+"").replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.i)&&o.push(":",n+"")),(n=this.g)&&(this.b&&"/"!=n.charAt(0)&&o.push("/"),o.push(re(n,"/"==n.charAt(0)?lp:dp,!0))),(n=""+this.a)&&o.push("?",n),(n=this.h)&&o.push("#",re(n,cp)),o.join("")};var sp=/[#\/\?@]/g,dp=/[\#\?:]/g,lp=/[\#\?]/g,pp=/[\#\?@]/g,cp=/#/g;_d=ae.prototype,_d.clear=function(){this.a=this.c=null,this.b=0},_d.forEach=function(o,t){se(this),this.a.forEach(function(n,r){qd(n,function(n){o.call(t,n,r,this)},this)},this)},_d.S=function(){se(this);for(var a=this.a.P(),t=this.a.S(),n=[],e=0;e<t.length;e++)for(var i=a[e],r=0;r<i.length;r++)n.push(t[e]);return n},_d.P=function(t){se(this);var n=[];if(td(t))fe(this,t)&&(n=N(n,this.a.get(de(this,t))));else{t=this.a.P();for(var e=0;e<t.length;e++)n=N(n,t[e])}return n},_d.set=function(e,t){return se(this),this.c=null,e=de(this,e),fe(this,e)&&(this.b-=this.a.get(e).length),this.a.set(e,[t]),this.b+=1,this},_d.get=function(e,t){return e=e?this.P(e):[],0<e.length?e[0]+"":t},_d.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var s=[],t=this.a.S(),n=0;n<t.length;n++){var e=t[n],i=encodeURIComponent(e+"");e=this.P(e);for(var r=0,o;r<e.length;r++)o=i,""!==e[r]&&(o+="="+encodeURIComponent(e[r]+"")),s.push(o)}return this.c=s.join("&")},ve.prototype.c=null;var up;id(ge,ve),ge.prototype.a=function(){var e=be(this);return e?new ActiveXObject(e):new XMLHttpRequest},ge.prototype.b=function(){var e={};return be(this)&&(e[0]=!0,e[1]=!0),e},up=new ge,id(we,hn);var hp="",mp=we.prototype,gp=In("goog.net.XhrIo");mp.J=gp;var fp=/^https?$/i,yp=["POST","PUT"];_d=we.prototype,_d.Ea=function(){void 0!==Ad&&this.a&&(this.g="Timed out after "+this.f+"ms, aborting",En(this.J,Re(this,this.g)),fn(this,"timeout"),this.abort(8))},_d.abort=function(){this.a&&this.b&&(En(this.J,Re(this,"Aborting")),this.b=!1,this.c=!0,this.a.abort(),this.c=!1,fn(this,"complete"),fn(this,"abort"),Ne(this))},_d.ta=function(){this.a&&(this.b&&(this.b=!1,this.c=!0,this.a.abort(),this.c=!1),Ne(this,!0)),we.ib.ta.call(this)},_d.Ab=function(){this.oa||(this.G||this.h||this.c?Ee(this):this.jc())},_d.jc=function(){Ee(this)},_d.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.l){case hp:case"text":return this.a.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in this.a)return this.a.mozResponseArrayBuffer;}var e=this.J;return e&&e.log(zl,"Response type "+this.l+" is not supported on this browser",void 0),null}catch(e){return En(this.J,"Can not get response: "+e.message),null}};var bp=/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/,vp=0,xp=1;id(Ue,p),id(je,ve),je.prototype.a=function(){var e=new XMLHttpRequest;if("withCredentials"in e)return e;if("undefined"!=typeof XDomainRequest)return new Me;throw Error("Unsupported browser")},je.prototype.b=function(){return{}},_d=Me.prototype,_d.open=function(o,t,n){if(null!=n&&!n)throw Error("Only async requests are supported.");this.a.open(o,t)},_d.send=function(e){if(e){if("string"!=typeof e)throw Error("Only string data is supported");this.a.send(e)}else this.a.send()},_d.abort=function(){this.a.abort()},_d.setRequestHeader=function(){},_d.getResponseHeader=function(e){return"content-type"==e.toLowerCase()?this.a.contentType:""},_d.Wb=function(){this.status=200,this.responseText=this.a.responseText,Ve(this,4)},_d.xb=function(){this.status=500,this.responseText="",Ve(this,4)},_d.Yb=function(){this.xb()},_d.Xb=function(){this.status=200,Ve(this,1)},_d.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType};var Cp=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Sp="Firefox",Ep="Chrome",kp={Gc:"FirebaseCore-web",Ic:"FirebaseUI-web"};gi.prototype.get=function(){return this.a?this.b:this.c};var Tp={},wp;try{var Ip={};Object.defineProperty(Ip,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(Ip,"abcd",{configurable:!0,enumerable:!0,value:2}),wp=2==Ip.abcd}catch(e){wp=!1}var Np="email",Ap="newEmail",Lp="requestType",Rp="email",Op="fromEmail",Pp="data",_p="operation";id(Oi,Error),Oi.prototype.B=function(){return{code:this.code,message:this.message}},Oi.prototype.toJSON=function(){return this.B()};var Dp="auth/",Mp={"argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-already-in-use":"The email address is already in use by another account.","expired-action-code":"The action code has expired. ","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal error has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registed for the current project.","invalid-user-token":"The user's credential is no longer valid. The user must sign in again.","invalid-auth-event":"An internal error has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is malformed or has expired.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal error has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network error (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal error has occurred.","no-such-provider":"User was not linked to an account with the given provider.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":"This operation is not supported in the environment this application is running on. \"location.protocol\" must be http, https or chrome-extension and web storage must be enabled.","popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","user-cancelled":"User did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled."},Fp="android",Bp="handleCodeInApp",Up="iOS",Vp="url",Wp="installApp",Hp="minimumVersion",jp="packageName",qp="bundleId",zp=["oauth_consumer_key","oauth_nonce","oauth_signature","oauth_signature_method","oauth_timestamp","oauth_token","oauth_version"],Kp=["client_id","response_type","scope","redirect_uri","state"],Gp={Hc:{Ma:"locale",za:500,ya:600,Na:"facebook.com",$a:Kp},Jc:{Ma:null,za:500,ya:620,Na:"github.com",$a:Kp},Kc:{Ma:"hl",za:515,ya:680,Na:"google.com",$a:Kp},Qc:{Ma:"lang",za:485,ya:705,Na:"twitter.com",$a:zp}},Xp="idToken",Qp="providerId";id(ji,Ui),id(Mi,ji),id(dd,ji),id(ld,ji),id(pd,ji),Xi.prototype.wa=function(e){return fd(e,Bi(this))},Xi.prototype.b=function(o,t){var n=Bi(this);return n.idToken=t,Dr(o,n)},Xi.prototype.c=function(e,t){return cd(Lr(e,Bi(this)),t)},Xi.prototype.B=function(){var e={providerId:this.providerId};return this.idToken&&(e.oauthIdToken=this.idToken),this.accessToken&&(e.oauthAccessToken=this.accessToken),this.secret&&(e.oauthTokenSecret=this.secret),e},Hi.prototype.Ba=function(e){return this.rb=L(e),this},id(Wi,Hi),Wi.prototype.sa=function(e){return A(this.a,e)||this.a.push(e),this},Wi.prototype.wb=function(){return S(this.a)},Wi.prototype.credential=function(e,o){if(!e&&!o)throw new Oi("argument-error","credential failed: must provide the ID token and/or the access token.");return new Xi(this.providerId,{idToken:e||null,accessToken:o||null})},id(Gi,Wi),Ii(Gi,"PROVIDER_ID","facebook.com"),id(Ji,Wi),Ii(Ji,"PROVIDER_ID","github.com"),id($i,Wi),Ii($i,"PROVIDER_ID","google.com"),id(Qi,Hi),Ii(Qi,"PROVIDER_ID","twitter.com"),nr.prototype.wa=function(e){return yd(e,Ic,{email:this.a,password:this.f})},nr.prototype.b=function(e,t){return yd(e,xc,{idToken:t,email:this.a,password:this.f})},nr.prototype.c=function(e,t){return cd(this.wa(e),t)},nr.prototype.B=function(){return{email:this.a,password:this.f}},Ti(er,{PROVIDER_ID:"password"}),ir.prototype.wa=function(e){return e.Qa(rr(this))},ir.prototype.b=function(o,t){var n=rr(this);return n.idToken=t,yd(o,Ac,n)},ir.prototype.c=function(o,t){var n=rr(this);return n.operation="REAUTH",o=yd(o,Lc,n),cd(o,t)},ir.prototype.B=function(){var e={providerId:"phone"};return this.a.Pa&&(e.verificationId=this.a.Pa),this.a.Oa&&(e.verificationCode=this.a.Oa),this.a.Da&&(e.temporaryProof=this.a.Da),this.a.Y&&(e.phoneNumber=this.a.Y),e},or.prototype.Qa=function(t,o){var e=this.a.c;return tt(o.verify()).then(function(a){if(!td(a))throw new Oi("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(o.type){case"recaptcha":return md(e,{phoneNumber:t,recaptchaToken:a}).then(function(e){return"function"==typeof o.reset&&o.reset(),e},function(e){throw"function"==typeof o.reset&&o.reset(),e});default:throw new Oi("argument-error","Only firebase.auth.ApplicationVerifiers with type=\"recaptcha\" are currently supported.");}})},Ti(or,{PROVIDER_ID:"phone"}),cr.prototype.B=function(){return{type:this.b,eventId:this.c,urlResponse:this.f,sessionId:this.g,error:this.a&&this.a.B()}},id(fr,Oi),id(lr,Oi),lr.prototype.B=function(){var e={code:this.code,message:this.message};this.email&&(e.email=this.email),this.phoneNumber&&(e.phoneNumber=this.phoneNumber);var t=this.credential&&this.credential.B();return t&&x(e,t),e},lr.prototype.toJSON=function(){return this.B()},id(pr,ve),pr.prototype.a=function(){return new this.f},pr.prototype.b=function(){return{}};var Yp="idToken",Jp=new gi(3e4,6e4),$p={"Content-Type":"application/x-www-form-urlencoded"},Zp=new gi(3e4,6e4),ec={"Content-Type":"application/json"},tc;vr.prototype.m=function(l,p,t,e,n,r){var o="Node"==Qe(),a=ti()?o?new we(this.o):new we:new we(this.f);if(r){a.f=d(0,r);var i=setTimeout(function(){fn(a,"timeout")},r)}ln(a,"complete",function(){i&&clearTimeout(i);var e=null;try{e=JSON.parse(Ce(this))||null}catch(t){e=null}p&&p(e)}),dn(a,"ready",function(){i&&clearTimeout(i),qt(this)}),dn(a,"timeout",function(){i&&clearTimeout(i),qt(this),p&&p(null)}),ye(a,l,t,e,n)};var nc=yt("https://apis.google.com/js/client.js?onload=%{onload}"),oc="__fcb"+ed(1e6*Math.random());vr.prototype.u=function(s,d,n,l,p){var c=this;tc.then(function(){window.gapi.client.setApiKey(c.b);var o=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:s,method:n,body:l,headers:p,authType:"none",callback:function(e){window.gapi.auth.setToken(o),d&&d(e)}})}).s(function(e){d&&d({error:{message:e&&e.message||"CORS_UNSUPPORTED"}})})},vr.prototype.gb=function(){return yd(this,Cc,{})},vr.prototype.kb=function(e,o){return yd(this,vc,{idToken:e,email:o})},vr.prototype.lb=function(e,o){return yd(this,xc,{idToken:e,password:o})};var rc={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};_d=vr.prototype,_d.mb=function(o,a){var n={idToken:o},e=[];return P(rc,function(i,t){var r=a[t];null===r?e.push(i):t in a&&(n[t]=r)}),e.length&&(n.deleteAttribute=e),yd(this,vc,n)},_d.cb=function(e,o){return e={requestType:"PASSWORD_RESET",email:e},x(e,o),yd(this,hc,e)},_d.bb=function(e,o){return e={requestType:"VERIFY_EMAIL",idToken:e},x(e,o),yd(this,uc,e)},_d.Qa=function(e){return yd(this,Nc,e)},_d.Ta=function(e,o){return yd(this,yc,{oobCode:e,newPassword:o})},_d.Ia=function(e){return yd(this,ic,{oobCode:e})},_d.Sa=function(e){return yd(this,ac,{oobCode:e})};var ac={endpoint:"setAccountInfo",D:xr,ga:"email"},ic={endpoint:"resetPassword",D:xr,O:function(e){if(!e.email||!e.requestType)throw new Oi("internal-error")}},sc={endpoint:"signupNewUser",D:function(e){if(Tr(e),!e.password)throw new Oi("weak-password")},O:Nr,T:!0},dc={endpoint:"createAuthUri"},lc={endpoint:"deleteAccount",ea:["idToken"]},pc={endpoint:"setAccountInfo",ea:["idToken","deleteProvider"],D:function(e){if(!od(e.deleteProvider))throw new Oi("internal-error")}},cc={endpoint:"getAccountInfo"},uc={endpoint:"getOobConfirmationCode",ea:["idToken","requestType"],D:function(e){if("VERIFY_EMAIL"!=e.requestType)throw new Oi("internal-error")},ga:"email"},hc={endpoint:"getOobConfirmationCode",ea:["requestType"],D:function(e){if("PASSWORD_RESET"!=e.requestType)throw new Oi("internal-error");Tr(e)},ga:"email"},mc={nb:!0,endpoint:"getProjectConfig",zb:"GET"},gc={nb:!0,endpoint:"getRecaptchaParam",zb:"GET",O:function(e){if(!e.recaptchaSiteKey)throw new Oi("internal-error")}},yc={endpoint:"resetPassword",D:xr,ga:"email"},bc={endpoint:"sendVerificationCode",ea:["phoneNumber","recaptchaToken"],ga:"sessionInfo"},vc={endpoint:"setAccountInfo",ea:["idToken"],D:Ar,T:!0},xc={endpoint:"setAccountInfo",ea:["idToken"],D:function(e){if(Ar(e),!e.password)throw new Oi("weak-password")},O:Nr,T:!0},Cc={endpoint:"signupNewUser",O:Nr,T:!0},Ec={endpoint:"verifyAssertion",D:Cr,O:gd,T:!0},kc={endpoint:"verifyAssertion",D:Cr,O:function(e){if(e.errorMessage&&"USER_NOT_FOUND"==e.errorMessage)throw new Oi("user-not-found");if(e.errorMessage)throw jr(e.errorMessage);if(!e[Yp])throw new Oi("internal-error")},T:!0},Tc={endpoint:"verifyAssertion",D:function(e){if(Cr(e),!e.idToken)throw new Oi("internal-error")},O:gd,T:!0},wc={endpoint:"verifyCustomToken",D:function(e){if(!e.token)throw new Oi("invalid-custom-token")},O:Nr,T:!0},Ic={endpoint:"verifyPassword",D:function(e){if(Tr(e),!e.password)throw new Oi("wrong-password")},O:Nr,T:!0},Nc={endpoint:"verifyPhoneNumber",D:hd,O:Nr},Ac={endpoint:"verifyPhoneNumber",D:function(e){if(!e.idToken)throw new Oi("internal-error");hd(e)},O:function(e){if(e.temporaryProof)throw e.code="credential-already-in-use",dr(e);Nr(e)}},Lc={Pb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",D:hd,O:Nr},Rc={Mc:{Va:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",ab:"https://securetoken.googleapis.com/v1/token",id:"p"},Oc:{Va:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",ab:"https://staging-securetoken.sandbox.googleapis.com/v1/token",id:"s"},Pc:{Va:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",ab:"https://test-securetoken.sandbox.googleapis.com/v1/token",id:"t"}},Oc;Oc=Vr("__EID__")?"__EID__":void 0;var Pc=yt("https://apis.google.com/js/api.js?onload=%{onload}"),_c=new gi(3e4,6e4),Dc=new gi(5e3,15e3),Mc=null;Hr.prototype.toString=function(){return this.f?Qn(this.a,"v",this.f):he(this.a.a,"v"),this.b?Qn(this.a,"eid",this.b):he(this.a.a,"eid"),this.c.length?Qn(this.a,"fw",this.c.join(",")):he(this.a.a,"fw"),""+this.a},Wr.prototype.toString=function(){var s=ee(this.m,"/__/auth/handler");if(Qn(s,"apiKey",this.u),Qn(s,"appName",this.c),Qn(s,"authType",this.l),this.a.isOAuthProvider){var t=this.a;try{var n=Nd.app(this.c).auth().$()}catch(e){n=null}for(var e in t.Ua=n,Qn(s,"providerId",this.a.providerId),t=this.a,n=fi(t.rb),n)n[e]=""+n[e];e=t.rc,n=L(n);for(var i=0,r;i<e.length;i++)r=e[i],r in n&&delete n[r];t.Wa&&t.Ua&&!n[t.Wa]&&(n[t.Wa]=t.Ua),_(n)||Qn(s,"customParameters",hi(n))}if("function"==typeof this.a.wb&&(t=this.a.wb(),t.length&&Qn(s,"scopes",t.join(","))),this.h?Qn(s,"redirectUrl",this.h):he(s.a,"redirectUrl"),this.g?Qn(s,"eventId",this.g):he(s.a,"eventId"),this.i?Qn(s,"v",this.i):he(s.a,"v"),this.b)for(var o in this.b)this.b.hasOwnProperty(o)&&!te(s,o)&&Qn(s,o,this.b[o]);return this.f?Qn(s,"eid",this.f):he(s.a,"eid"),o=Gr(this.c),o.length&&Qn(s,"fw",o.join(",")),""+s},_d=zr.prototype,_d.Ca=function(s,t,n){var e=new Oi("popup-closed-by-user"),i=new Oi("web-storage-unsupported"),r=this,o=!1;return this.ba().then(function(){to(r).then(function(n){n||(s&&We(s),t(i),o=!0)})}).s(function(){}).then(function(){if(!o)return ze(s)}).then(function(){if(!o)return mn(n).then(function(){t(e)})})},_d.Db=function(){var e=ii();return!ci(e)&&!pi(e)},_d.yb=function(){return!1},_d.vb=function(d,l,n,e,i,r,o){if(!d)return nt(new Oi("popup-blocked"));if(o&&!ci())return this.ba().s(function(e){We(d),i(e)}),e(),tt();this.a||(this.a=Jr($r(this)));var a=this;return this.a.then(function(){var t=a.ba().s(function(e){throw We(d),i(e),e});return e(),t}).then(function(){ur(n),o||qe(Zr(a.u,a.f,a.b,l,n,null,r,a.c,void 0,a.h),d)}).s(function(e){throw"auth/network-request-failed"==e.code&&(a.a=null),e})},_d.Aa=function(o,t,n){this.a||(this.a=Jr($r(this)));var e=this;return this.a.then(function(){ur(t),qe(Zr(e.u,e.f,e.b,o,t,Ke(),n,e.c,void 0,e.h))}).s(function(n){throw"auth/network-request-failed"==n.code&&(e.a=null),n})},_d.ba=function(){var e=this;return Yr(this).then(function(){return e.i.Ya}).s(function(){throw e.a=null,new Oi("network-request-failed")})},_d.Hb=function(){return!0},_d.ua=function(e){this.g.push(e)},_d.Ja=function(e){E(this.g,function(t){return t==e})},_d=no.prototype,_d.get=function(e){return tt(this.a.getItem(e)).then(function(e){return e&&li(e)})},_d.set=function(e,t){return tt(this.a.setItem(e,hi(t)))},_d.X=function(e){return tt(this.a.removeItem(e))},_d.ia=function(){},_d.da=function(){},_d=bd.prototype,_d.get=function(e){return tt(this.a[e])},_d.set=function(e,t){return this.a[e]=t,tt()},_d.X=function(e){return delete this.a[e],tt()},_d.ia=function(){},_d.da=function(){};var Fc;_d=io.prototype,_d.set=function(s,t){var n=!1,i=this,r;return ot(oo(this).then(function(e){return r=e,e=ao(i,so(i,r,!0)),uo(e.get(s))}).then(function(e){var o=ao(i,so(i,r,!0));return e?(e.value=t,uo(o.put(e))):(i.a++,n=!0,e={},e[i.g]=s,e[i.l]=t,uo(o.add(e)))}).then(function(){i.f[s]=t}),function(){n&&i.a--})},_d.get=function(o){var t=this;return oo(this).then(function(n){return uo(ao(t,so(t,n,!1)).get(o))}).then(function(e){return e&&e.value})},_d.X=function(o){var t=!1,n=this;return ot(oo(this).then(function(e){return t=!0,n.a++,uo(ao(n,so(n,e,!0)).delete(o))}).then(function(){delete n.f[o]}),function(){t&&n.a--})},_d.zc=function(){var o=this;return oo(this).then(function(t){var a=ao(o,so(o,t,!1));return a.getAll?uo(a.getAll()):new $(function(e,o){var t=[],n=a.openCursor();n.onsuccess=function(o){(o=o.target.result)?(t.push(o.value),o.continue()):e(t)},n.onerror=function(e){o(Error(e.target.errorCode))}})}).then(function(t){var n={},e=[];if(0==o.a){for(e=0;e<t.length;e++)n[t[e][o.g]]=t[e][o.l];e=Xe(o.f,n),o.f=n}return e})},_d.ia=function(e){0==this.c.length&&co(this),this.c.push(e)},_d.da=function(e){E(this.c,function(t){return t==e}),0==this.c.length&&this.b&&this.b.cancel("STOP_EVENT")},_d=ho.prototype,_d.get=function(e){var t=this;return tt().then(function(){return li(t.a.getItem(e))})},_d.set=function(o,t){var n=this;return tt().then(function(){var e=hi(t);null===e?n.X(o):n.a.setItem(o,e)})},_d.X=function(e){var t=this;return tt().then(function(){t.a.removeItem(e)})},_d.ia=function(e){Ld.window&&$t(Ld.window,"storage",e)},_d.da=function(e){Ld.window&&nn(Ld.window,"storage",e)},_d=po.prototype,_d.get=function(){return tt(null)},_d.set=function(){return tt()},_d.X=function(){return tt()},_d.ia=function(){},_d.da=function(){},_d=xd.prototype,_d.get=function(e){var t=this;return tt().then(function(){return li(t.a.getItem(e))})},_d.set=function(o,t){var n=this;return tt().then(function(){var e=hi(t);null===e?n.X(o):n.a.setItem(o,e)})},_d.X=function(e){var t=this;return tt().then(function(){t.a.removeItem(e)})},_d.ia=function(){},_d.da=function(){};var Bc={C:ho,jb:xd},Uc={C:ho,jb:xd},Vc={C:no,jb:po},Wc={Lc:"local",NONE:"none",Nc:"session"},Hc,jc;yo.prototype.get=function(e,t){return To(this,e.C).get(Ao(this,e,t))},yo.prototype.set=function(a,t,n){var e=Ao(this,a,n),i=this,r=To(this,a.C);return r.set(e,t).then(function(){return r.get(e)}).then(function(t){"local"==a.C&&(i.b[e]=t)})},yo.prototype.m=function(a){if(a&&a.g){var t=a.a.key;if(null==t)for(var n in this.a){var e=this.b[n];void 0===e&&(e=null);var i=Ld.localStorage.getItem(n);i!==e&&(this.b[n]=i,this.c(n))}else if(0==t.indexOf(this.i+this.g)&&this.a[t]){if(void 0===a.a.a?Oo(this):To(this,"local").da(this.h),this.A)if(n=Ld.localStorage.getItem(t),(e=a.a.newValue)!==n)null===e?Ld.localStorage.removeItem(t):Ld.localStorage.setItem(t,e);else if(this.b[t]===e&&void 0===a.a.a)return;var r=this;n=function(){void 0===a.a.a&&r.b[t]===Ld.localStorage.getItem(t)||(r.b[t]=Ld.localStorage.getItem(t),r.c(t))},$d&&ll&&10==ll&&Ld.localStorage.getItem(t)!==a.a.newValue&&a.a.newValue!==a.a.oldValue?setTimeout(n,10):n()}}else qd(a,f(this.c,this))},yo.prototype.c=function(e){this.a[e]&&qd(this.a[e],function(e){e()})};var qc={name:"authEvent",C:"local"};_d=Do.prototype,_d.ba=function(){return this.xa?this.xa:this.xa=Ye().then(function(){if("function"!=typeof ri("universalLinks.subscribe",Ld))throw Lo("cordova-universal-links-plugin is not installed");if(void 0===ri("BuildInfo.packageName",Ld))throw Lo("cordova-plugin-buildinfo is not installed");if("function"!=typeof ri("cordova.plugins.browsertab.openUrl",Ld))throw Lo("cordova-plugin-browsertab is not installed");if("function"!=typeof ri("cordova.InAppBrowser.open",Ld))throw Lo("cordova-plugin-inappbrowser is not installed")},function(){throw new Oi("cordova-not-ready")})},_d.Ca=function(e,t){return t(new Oi("operation-not-supported-in-this-environment")),tt()},_d.vb=function(){return nt(new Oi("operation-not-supported-in-this-environment"))},_d.Hb=function(){return!1},_d.Db=function(){return!0},_d.yb=function(){return!0},_d.Aa=function(d,t,n){if(this.c)return nt(new Oi("redirect-operation-pending"));var e=this,i=Ld.document,r=null,o=null,a=null,s=null;return this.c=ot(tt().then(function(){return ur(t),Vo(e)}).then(function(){return jo(e,d,t,n)}).then(function(){return new $(function(d,t){o=function(){var t=ri("cordova.plugins.browsertab.close",Ld);return d(),"function"==typeof t&&t(),e.a&&"function"==typeof e.a.close&&(e.a.close(),e.a=null),!1},e.ua(o),a=function(){r||(r=mn(e.w).then(function(){t(new Oi("redirect-cancelled-by-user"))}))},s=function(){bi()&&a()},i.addEventListener("resume",a,!1),ii().toLowerCase().match(/android/)||i.addEventListener("visibilitychange",s,!1)}).s(function(n){return Fo(e).then(function(){throw n})})}),function(){a&&i.removeEventListener("resume",a,!1),s&&i.removeEventListener("visibilitychange",s,!1),r&&r.cancel(),o&&e.Ja(o),e.c=null})},_d.ua=function(e){this.b.push(e),Vo(this).s(function(t){"auth/invalid-cordova-configuration"===t.code&&(t=new cr("unknown",null,null,null,new Oi("no-auth-event")),e(t))})},_d.Ja=function(e){E(this.b,function(t){return t==e})};var zc={name:"pendingRedirect",C:"session"};Wo.prototype.reset=function(){this.f=!1,this.a.Ja(this.i),this.a=Go(this.v,this.l,this.u)},Wo.prototype.subscribe=function(e){if(A(this.h,e)||this.h.push(e),!this.f){var o=this;Ho(this.g).then(function(e){e?Bo(o.g).then(function(){zo(o).s(function(n){var t=new cr("unknown",null,null,null,new Oi("operation-not-supported-in-this-environment"));$o(n)&&o.m(t)})}):Jo(o)}).s(function(){Jo(o)})}},Wo.prototype.unsubscribe=function(e){E(this.h,function(t){return t==e})},Wo.prototype.m=function(o){if(!o)throw new Oi("invalid-auth-event");for(var r=!1,n=0,e;n<this.h.length;n++)if(e=this.h[n],e.ob(o.b,o.c)){(r=this.b[o.b])&&r.h(o,e),r=!0;break}return ta(this.c),r};var Kc=new gi(2e3,1e4),Gc=new gi(3e4,6e4);Wo.prototype.aa=function(){return this.c.aa()},Wo.prototype.Aa=function(o,t,n){var e=this,r;return Xo(this.g).then(function(){return e.a.Aa(o,t,n).s(function(n){if($o(n))throw new Oi("operation-not-supported-in-this-environment");return r=n,Bo(e.g).then(function(){throw r})}).then(function(){return e.a.Hb()?new $(function(){}):Bo(e.g).then(function(){return e.aa()}).then(function(){}).s(function(){})})})},Wo.prototype.Ca=function(o,t,n,r){return this.a.Ca(n,function(n){o.fa(t,null,n,r)},Kc.get())};var Xc={};Qo.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},Qo.prototype.h=function(a,s){if(!a)return nt(new Oi("invalid-auth-event"));this.reset(),this.g=!0;var n=a.b,e=a.c,i=a.a&&"auth/web-storage-unsupported"==a.a.code,r=a.a&&"auth/operation-not-supported-in-this-environment"==a.a.code;return"unknown"!=n||i||r?a.a?(ra(this,!0,null,a.a),a=tt()):a=s.va(n,e)?na(this,a,s):nt(new Oi("invalid-auth-event")):(ra(this,!1,null,null),a=tt()),a},Qo.prototype.aa=function(){var o=this;return new $(function(t,n){o.b?o.b().then(t,n):(o.f.push(t),o.c.push(n),oa(o))})},aa.prototype.h=function(o,r){if(!o)return nt(new Oi("invalid-auth-event"));var n=o.b,e=o.c;return o.a?(r.fa(o.b,null,o.a,o.c),o=tt()):o=r.va(n,e)?sa(o,r):nt(new Oi("invalid-auth-event")),o},ua.prototype.confirm=function(e){return e=ar(this.verificationId,e),this.a(e)},ha.prototype.start=function(){this.a=this.c,la(this,!0)},pa.prototype.B=function(){return{apiKey:this.f.b,refreshToken:this.a,accessToken:this.b,expirationTime:this.c}},pa.prototype.getToken=function(e){return e=!!e,this.b&&!this.a?nt(new Oi("user-token-expired")):e||!this.b||Pd()>this.c-3e4?this.a?ga(this,{grant_type:"refresh_token",refresh_token:this.a}):tt(null):tt({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})},ba.prototype.B=function(){return{lastLoginAt:this.b,createdAt:this.a}},id(Ia,Xt),id(Ta,hn),Ta.prototype.na=function(e){this.ha=e,mr(this.c,e)},Ta.prototype.$=function(){return this.ha},Ta.prototype.Ka=function(){return S(this.R)},Ta.prototype.Ga=function(){this.l.b&&(da(this.l),this.l.start())},Ii(Ta.prototype,"providerId","firebase"),_d=Ta.prototype,_d.reload=function(){var e=this;return Za(this,Ua(this).then(function(){return qa(e).then(function(){return _a(e)}).then(xa)}))},_d.F=function(e){var o=this;return Za(this,Ua(this).then(function(){return o.h.getToken(e)}).then(function(e){if(!e)throw new Oi("internal-error");return e.accessToken!=o.pa&&(Ca(o,e.accessToken),fn(o,new Ia("tokenChanged"))),Fa(o,"refreshToken",e.refreshToken),e.accessToken}))},_d.getToken=function(e){return Tp["firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead."]||(Tp["firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead."]=!0,"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead.")),this.F(e)},_d.kc=function(o){if(!(o=o.users)||!o.length)throw new Oi("internal-error");o=o[0],La(this,{uid:o.localId,displayName:o.displayName,photoURL:o.photoUrl,email:o.email,emailVerified:!!o.emailVerified,phoneNumber:o.phoneNumber,lastLoginAt:o.lastLoginAt,createdAt:o.createdAt});for(var t=Ha(o),n=0;n<t.length;n++)Ma(this,t[n]);Fa(this,"isAnonymous",!(this.email&&o.passwordHash||this.providerData&&this.providerData.length))},_d.Za=function(o){var r=this,n=null;return Za(this,o.c(this.c,this.uid).then(function(e){return Xa(r,e),n=Ga(r,e,"reauthenticate"),r.i=null,r.reload()}).then(function(){return n}),!0)},_d.mc=function(e){return this.Za(e).then(function(){})},_d.Xa=function(o){var r=this,n=null;return Za(this,Wa(this,o.providerId).then(function(){return r.F()}).then(function(t){return o.b(r.c,t)}).then(function(e){return n=Ga(r,e,"link"),za(r,e)}).then(function(){return n}))},_d.cc=function(e){return this.Xa(e).then(function(e){return e.user})},_d.dc=function(o,t){var n=this;return Za(this,Wa(this,"phone").then(function(){return ca(Na(n),o,t,f(n.Xa,n))}))},_d.nc=function(o,t){var n=this;return Za(this,tt().then(function(){return ca(Na(n),o,t,f(n.Za,n))}),!0)},_d.kb=function(o){var r=this;return Za(this,this.F().then(function(t){return r.c.kb(t,o)}).then(function(e){return Xa(r,e),r.reload()}))},_d.Dc=function(o){var r=this;return Za(this,this.F().then(function(t){return o.b(r.c,t)}).then(function(e){return Xa(r,e),r.reload()}))},_d.lb=function(o){var r=this;return Za(this,this.F().then(function(t){return r.c.lb(t,o)}).then(function(e){return Xa(r,e),r.reload()}))},_d.mb=function(o){if(void 0===o.displayName&&void 0===o.photoURL)return Ua(this);var r=this;return Za(this,this.F().then(function(t){return r.c.mb(t,{displayName:o.displayName,photoUrl:o.photoURL})}).then(function(e){return Xa(r,e),Fa(r,"displayName",e.displayName||null),Fa(r,"photoURL",e.photoUrl||null),qd(r.providerData,function(e){"password"===e.providerId&&(Ii(e,"displayName",r.displayName),Ii(e,"photoURL",r.photoURL))}),_a(r)}).then(xa))},_d.Cc=function(o){var r=this;return Za(this,qa(this).then(function(t){return A(ja(r),o)?Pr(r.c,t,[o]).then(function(n){var o={};return qd(n.providerUserInfo||[],function(e){o[e.providerId]=!0}),qd(ja(r),function(e){o[e]||Va(r,e)}),o[or.PROVIDER_ID]||Ii(r,"phoneNumber",null),_a(r)}):_a(r).then(function(){throw new Oi("no-such-provider")})}))},_d.delete=function(){var e=this;return Za(this,this.F().then(function(t){return yd(e.c,lc,{idToken:t})}).then(function(){fn(e,new Ia("userDeleted"))})).then(function(){for(var t=0;t<e.A.length;t++)e.A[t].cancel("app-deleted");Sd(e,null),Ea(e,null),e.A=[],e.m=!0,Pa(e),Ii(e,"refreshToken",null),e.a&&e.a.unsubscribe(e)})},_d.ob=function(e,t){return!!("linkViaPopup"==e&&(this.g||null)==t&&this.f||"reauthViaPopup"==e&&(this.g||null)==t&&this.f||"linkViaRedirect"==e&&(this.Z||null)==t||"reauthViaRedirect"==e&&(this.Z||null)==t)},_d.fa=function(o,t,n,r){"linkViaPopup"!=o&&"reauthViaPopup"!=o||r!=(this.g||null)||(n&&this.v?this.v(n):t&&!n&&this.f&&this.f(t),this.b&&(this.b.cancel(),this.b=null),delete this.f,delete this.v)},_d.va=function(e,t){return"linkViaPopup"==e&&t==(this.g||null)?f(this.tb,this):"reauthViaPopup"==e&&t==(this.g||null)?f(this.ub,this):"linkViaRedirect"==e&&(this.Z||null)==t?f(this.tb,this):"reauthViaRedirect"==e&&(this.Z||null)==t?f(this.ub,this):null},_d.ec=function(e){var t=this;return Ja(this,"linkViaPopup",e,function(){return Wa(t,e.providerId).then(function(){return _a(t)})},!1)},_d.oc=function(e){return Ja(this,"reauthViaPopup",e,function(){return tt()},!0)},_d.fc=function(e){var t=this;return Ya(this,"linkViaRedirect",e,function(){return Wa(t,e.providerId)},!1)},_d.pc=function(e){return Ya(this,"reauthViaRedirect",e,function(){return tt()},!0)},_d.tb=function(o,r){var a=this;this.b&&(this.b.cancel(),this.b=null);var e=null;return Za(this,this.F().then(function(e){return Dr(a.c,{requestUri:o,sessionId:r,idToken:e})}).then(function(n){return e=Ga(a,n,"link"),za(a,n)}).then(function(){return e}))},_d.ub=function(o,r){var a=this;this.b&&(this.b.cancel(),this.b=null);var e=null;return Za(this,tt().then(function(){return cd(Lr(a.c,{requestUri:o,sessionId:r}),a.uid)}).then(function(n){return e=Ga(a,n,"reauthenticate"),Xa(a,n),a.i=null,a.reload()}).then(function(){return e}),!0)},_d.bb=function(o){var r=this,a=null;return Za(this,this.F().then(function(e){return a=e,void 0===o||_(o)?{}:Ri(new Ci(o))}).then(function(e){return r.c.bb(a,e)}).then(function(e){if(r.email!=e)return r.reload()}).then(function(){}))},_d.toJSON=function(){return this.B()},_d.B=function(){var e={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,providerData:[],apiKey:this.G,appName:this.o,authDomain:this.w,stsTokenManager:this.h.B(),redirectEventId:this.Z||null};return this.metadata&&x(e,this.metadata.B()),qd(this.providerData,function(t){e.providerData.push(ki(t))}),e};var Qc={name:"redirectUser",C:"session"};os.prototype.g=function(){var o=this,e=us("local");ds(this,function(){return tt().then(function(){return o.c&&"local"!=o.c.C?o.b.get(e,o.a):null}).then(function(t){if(t)return as(o,"local").then(function(){o.c=e})})})};var Yc={name:"persistence",C:"session"};os.prototype.eb=function(o){var t=null,n=this;return wo(o),ds(this,function(){return o==n.c.C?tt():n.b.get(n.c,n.a).then(function(e){return t=e,as(n,o)}).then(function(){if(n.c=us(o),t)return n.b.set(n.c,t,n.a)})})},id(ps,hn),id(Ed,Xt),id(ms,Xt),_d=ps.prototype,_d.eb=function(e){return e=this.h.eb(e),Rs(this,e)},_d.na=function(e){this.V===e||this.l||(this.V=e,mr(this.c,this.V),fn(this,new Ed(this.$())))},_d.$=function(){return this.V},_d.Ec=function(){var e=Ld.navigator;this.na(e?e.languages&&e.languages[0]||e.language||e.userLanguage||null:null)},_d.gc=function(e){this.A.push(e),gr(this.c,Nd.SDK_VERSION?ei(Nd.SDK_VERSION,this.A):null),fn(this,new ms(this.A))},_d.Ka=function(){return S(this.A)},_d.toJSON=function(){return{apiKey:Ns(this).options.apiKey,authDomain:Ns(this).options.authDomain,appName:Ns(this).name,currentUser:Ss(this)&&Ss(this).B()}},_d.ob=function(e,t){return"unknown"===e||"signInViaRedirect"===e||!("signInViaPopup"!==e)&&this.g==t&&!!this.f},_d.fa=function(o,t,n,r){"signInViaPopup"==o&&this.g==r&&(n&&this.v?this.v(n):t&&!n&&this.f&&this.f(t),this.b&&(this.b.cancel(),this.b=null),delete this.f,delete this.v)},_d.va=function(e,t){return"signInViaRedirect"==e||"signInViaPopup"==e&&this.g==t&&this.f?f(this.Sb,this):null},_d.Sb=function(a,s){var d=this;a={requestUri:a,sessionId:s},this.b&&(this.b.cancel(),this.b=null);var e=null,l=null,p=fd(d.c,a).then(function(n){return e=sr(n),l=xi(n),n});return a=d.U.then(function(){return p}).then(function(e){return ys(d,e)}).then(function(){return Ai({user:Ss(d),credential:e,additionalUserInfo:l,operationType:"signIn"})}),Rs(this,a)},_d.wc=function(a){if(!ai())return nt(new Oi("operation-not-supported-in-this-environment"));var s=this,t=Li(a.providerId),d=di(),e=null;(!ci()||Ze())&&Ns(this).options.authDomain&&a.isOAuthProvider&&(e=Zr(Ns(this).options.authDomain,Ns(this).options.apiKey,Ns(this).name,"signInViaPopup",a,null,d,Nd.SDK_VERSION||null));var i=Ge(e,t&&t.za,t&&t.ya);return t=bs(this).then(function(t){return Yo(t,i,"signInViaPopup",a,d,!!e)}).then(function(){return new $(function(n,t){s.fa("signInViaPopup",null,new Oi("cancelled-popup-request"),s.g),s.f=n,s.v=t,s.g=d,s.b=s.a.Ca(s,"signInViaPopup",i,d)})}).then(function(e){return i&&We(i),e?Ai(e):null}).s(function(e){throw i&&We(i),e}),Rs(this,t)},_d.xc=function(e){if(!ai())return nt(new Oi("operation-not-supported-in-this-environment"));var t=this;return Rs(this,bs(this).then(function(){return cs(t.h)}).then(function(){return t.a.Aa("signInViaRedirect",e)}))},_d.aa=function(){if(!ai())return nt(new Oi("operation-not-supported-in-this-environment"));var e=this;return Rs(this,bs(this).then(function(){return e.a.aa()}).then(function(e){return e?Ai(e):null}))},_d.hb=function(){var e=this;return Rs(this,this.i.then(function(){return Ss(e)?(Is(e,null),fs(e.h).then(function(){Ps(e)})):tt()}))},_d.yc=function(){var o=this;return ls(this.h,Ns(this).options.authDomain).then(function(t){if(!o.l){var n;if(n=Ss(o)&&t){n=Ss(o).uid;var e=t.uid;n=void 0!==n&&null!==n&&""!==n&&void 0!==e&&null!==e&&""!==e&&n==e}if(n)return Ka(Ss(o),t),Ss(o).F();(Ss(o)||t)&&(Is(o,t),t&&(Da(t),t.ca=o.G),o.a&&o.a.subscribe(o),Ps(o))}})},_d.ka=function(e){return hs(this.h,e)},_d.Tb=function(){Ps(this),this.ka(Ss(this))},_d.Zb=function(){this.hb()},_d.$b=function(){this.hb()},_d.ac=function(e){var t=this;this.addAuthTokenListener(function(){e.next(Ss(t))})},_d.bc=function(e){var t=this;Cs(this,function(){e.next(Ss(t))})},_d.ic=function(o,t,n){var e=this;return this.W&&Nd.Promise.resolve().then(function(){a(o)?o(Ss(e)):a(o.next)&&o.next(Ss(e))}),this.Kb(o,t,n)},_d.hc=function(o,t,n){var e=this;return this.W&&Nd.Promise.resolve().then(function(){e.R=e.getUid(),a(o)?o(Ss(e)):a(o.next)&&o.next(Ss(e))}),this.Lb(o,t,n)},_d.Vb=function(e){var t=this;return Rs(this,this.i.then(function(){return Ss(t)?Ss(t).F(e).then(function(e){return{accessToken:e}}):null}))},_d.tc=function(e){return this.Eb(e).then(function(e){return e.user})},_d.Eb=function(e){var o=this;return this.i.then(function(){return Es(o,yd(o.c,wc,{token:e}))}).then(function(n){var t=n.user;return Fa(t,"isAnonymous",!1),o.ka(t),n})},_d.Fb=function(o,r){var a=this;return this.i.then(function(){return Es(a,yd(a.c,Ic,{email:o,password:r}))})},_d.uc=function(e,t){return this.Fb(e,t).then(function(e){return e.user})},_d.Ob=function(e,t){return this.qb(e,t).then(function(e){return e.user})},_d.qb=function(o,r){var a=this;return this.i.then(function(){return Es(a,yd(a.c,sc,{email:o,password:r}))})},_d.sc=function(e){return this.fb(e).then(function(e){return e.user})},_d.fb=function(e){var t=this;return this.i.then(function(){return Es(t,e.wa(t.c))})},_d.gb=function(){return this.Gb().then(function(e){return e.user})},_d.Gb=function(){var o=this;return this.i.then(function(){var e=Ss(o);return e&&e.isAnonymous?Ai({user:e,credential:null,additionalUserInfo:Ai({providerId:null,isNewUser:!1}),operationType:"signIn"}):Es(o,o.c.gb()).then(function(t){var n=t.user;return Fa(n,"isAnonymous",!0),o.ka(n),t})})},_d.getUid=function(){return Ss(this)&&Ss(this).uid||null},_d.Mb=function(e){this.addAuthTokenListener(e),0<++this.o&&Ss(this)&&Oa(Ss(this))},_d.qc=function(o){var t=this;qd(this.m,function(n){n==o&&t.o--}),0>this.o&&(this.o=0),0==this.o&&Ss(this)&&Pa(Ss(this)),this.removeAuthTokenListener(o)},_d.addAuthTokenListener=function(e){var t=this;this.m.push(e),Rs(this,this.i.then(function(){t.l||A(t.m,e)&&e(Os(t))}))},_d.removeAuthTokenListener=function(e){E(this.m,function(t){return t==e})},_d.delete=function(){this.l=!0;for(var e=0;e<this.N.length;e++)this.N[e].cancel("app-deleted");return this.N=[],this.h&&(e=this.h,No(e.b,e.a,this.ha)),this.a&&this.a.unsubscribe(this),Nd.Promise.resolve()},_d.Rb=function(e){return Rs(this,ud(this.c,e))},_d.Fc=function(e){return this.Ia(e).then(function(e){return e.data.email})},_d.Ta=function(e,t){return Rs(this,this.c.Ta(e,t).then(function(){}))},_d.Ia=function(e){return Rs(this,this.c.Ia(e).then(function(e){return new Si(e)}))},_d.Sa=function(e){return Rs(this,this.c.Sa(e).then(function(){}))},_d.cb=function(o,t){var r=this;return Rs(this,tt().then(function(){return void 0===t||_(t)?{}:Ri(new Ci(t))}).then(function(e){return r.c.cb(o,e)}).then(function(){}))},_d.vc=function(e,t){return Rs(this,ca(this,e,t,f(this.fb,this)))};var Jc=["First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth"],$c="callback",Zc="expired-callback",eu="sitekey",tu="size";_d=Hs.prototype,_d.xa=function(){var e=this;return this.c?this.c:this.c=zs(this,tt().then(function(){if(si())return Je();throw new Oi("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return $s(Zs(),e.o())}).then(function(){return yd(e.u,gc,{})}).then(function(t){e.a[eu]=t.recaptchaSiteKey}).s(function(t){throw e.c=null,t}))},_d.render=function(){Js(this);var o=this;return zs(this,this.xa().then(function(){if(null===o.b){var t=o.l;if(!o.h){var n=_t(t);t=Lt("DIV"),n.appendChild(t)}o.b=grecaptcha.render(t,o.a)}return o.b}))},_d.verify=function(){Js(this);var o=this;return zs(this,this.render().then(function(t){return new $(function(a){var e=grecaptcha.getResponse(t);if(e)a(e);else{var i=function(e){e&&(Gs(o,i),a(e))};o.i.push(i),o.h&&grecaptcha.execute(o.b)}})}))},_d.reset=function(){Js(this),null!==this.b&&grecaptcha.reset(this.b)},_d.clear=function(){Js(this),this.m=!0,Zs().b--;for(var e=0;e<this.g.length;e++)this.g[e].cancel("RecaptchaVerifier instance has been destroyed.");if(!this.h){e=_t(this.l);for(var t;t=e.firstChild;)e.removeChild(t)}};var nu=yt("https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),ou=null;id(Qs,Hs),kd(ps.prototype,{Sa:{name:"applyActionCode",j:[Ds("code")]},Ia:{name:"checkActionCode",j:[Ds("code")]},Ta:{name:"confirmPasswordReset",j:[Ds("code"),Ds("newPassword")]},Ob:{name:"createUserWithEmailAndPassword",j:[Ds("email"),Ds("password")]},qb:{name:"createUserAndRetrieveDataWithEmailAndPassword",j:[Ds("email"),Ds("password")]},Rb:{name:"fetchProvidersForEmail",j:[Ds("email")]},aa:{name:"getRedirectResult",j:[]},hc:{name:"onAuthStateChanged",j:[Bs(xs(),Us(),"nextOrObserver"),Us("opt_error",!0),Us("opt_completed",!0)]},ic:{name:"onIdTokenChanged",j:[Bs(xs(),Us(),"nextOrObserver"),Us("opt_error",!0),Us("opt_completed",!0)]},cb:{name:"sendPasswordResetEmail",j:[Ds("email"),Bs(xs("opt_actionCodeSettings",!0),js(null,!0),"opt_actionCodeSettings",!0)]},eb:{name:"setPersistence",j:[Ds("persistence")]},fb:{name:"signInAndRetrieveDataWithCredential",j:[Ks()]},gb:{name:"signInAnonymously",j:[]},Gb:{name:"signInAnonymouslyAndRetrieveData",j:[]},sc:{name:"signInWithCredential",j:[Ks()]},tc:{name:"signInWithCustomToken",j:[Ds("token")]},Eb:{name:"signInAndRetrieveDataWithCustomToken",j:[Ds("token")]},uc:{name:"signInWithEmailAndPassword",j:[Ds("email"),Ds("password")]},Fb:{name:"signInAndRetrieveDataWithEmailAndPassword",j:[Ds("email"),Ds("password")]},vc:{name:"signInWithPhoneNumber",j:[Ds("phoneNumber"),Xs()]},wc:{name:"signInWithPopup",j:[qs()]},xc:{name:"signInWithRedirect",j:[qs()]},hb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[Ds(null,!0)]},Ec:{name:"useDeviceLanguage",j:[]},Fc:{name:"verifyPasswordResetCode",j:[Ds("code")]}}),function(o,t){for(var n in t){var e=t[n].name;if(e!==n){var a=t[n].Nb;Object.defineProperty(o,e,{get:function(){return this[n]},set:function(o){_s(e,[a],[o],!0),this[n]=o},enumerable:!0})}}}(ps.prototype,{lc:{name:"languageCode",Nb:Bs(Ds(),js(),"languageCode")}}),ps.Persistence=Wc,ps.Persistence.LOCAL="local",ps.Persistence.SESSION="session",ps.Persistence.NONE="none",kd(Ta.prototype,{delete:{name:"delete",j:[]},F:{name:"getIdToken",j:[Ls()]},getToken:{name:"getToken",j:[Ls()]},Xa:{name:"linkAndRetrieveDataWithCredential",j:[Ks()]},cc:{name:"linkWithCredential",j:[Ks()]},dc:{name:"linkWithPhoneNumber",j:[Ds("phoneNumber"),Xs()]},ec:{name:"linkWithPopup",j:[qs()]},fc:{name:"linkWithRedirect",j:[qs()]},Za:{name:"reauthenticateAndRetrieveDataWithCredential",j:[Ks()]},mc:{name:"reauthenticateWithCredential",j:[Ks()]},nc:{name:"reauthenticateWithPhoneNumber",j:[Ds("phoneNumber"),Xs()]},oc:{name:"reauthenticateWithPopup",j:[qs()]},pc:{name:"reauthenticateWithRedirect",j:[qs()]},reload:{name:"reload",j:[]},bb:{name:"sendEmailVerification",j:[Bs(xs("opt_actionCodeSettings",!0),js(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[Ds(null,!0)]},Cc:{name:"unlink",j:[Ds("provider")]},kb:{name:"updateEmail",j:[Ds("email")]},lb:{name:"updatePassword",j:[Ds("password")]},Dc:{name:"updatePhoneNumber",j:[Ks("phone")]},mb:{name:"updateProfile",j:[xs("profile")]}}),kd($.prototype,{s:{name:"catch"},then:{name:"then"}}),kd(ua.prototype,{confirm:{name:"confirm",j:[Ds("verificationCode")]}}),Td(er,"credential",function(e,t){return new nr(e,t)},[Ds("email"),Ds("password")]),kd(Gi.prototype,{sa:{name:"addScope",j:[Ds("scope")]},Ba:{name:"setCustomParameters",j:[xs("customOAuthParameters")]}}),Td(Gi,"credential",zi,[Bs(Ds(),xs(),"token")]),kd(Ji.prototype,{sa:{name:"addScope",j:[Ds("scope")]},Ba:{name:"setCustomParameters",j:[xs("customOAuthParameters")]}}),Td(Ji,"credential",Yi,[Bs(Ds(),xs(),"token")]),kd($i.prototype,{sa:{name:"addScope",j:[Ds("scope")]},Ba:{name:"setCustomParameters",j:[xs("customOAuthParameters")]}}),Td($i,"credential",Zi,[Bs(Ds(),Bs(xs(),js()),"idToken"),Bs(Ds(),js(),"accessToken",!0)]),kd(Qi.prototype,{Ba:{name:"setCustomParameters",j:[xs("customOAuthParameters")]}}),Td(Qi,"credential",tr,[Bs(Ds(),xs(),"token"),Ds("secret",!0)]),kd(Wi.prototype,{sa:{name:"addScope",j:[Ds("scope")]},credential:{name:"credential",j:[Bs(Ds(),js(),"idToken",!0),Bs(Ds(),js(),"accessToken",!0)]},Ba:{name:"setCustomParameters",j:[xs("customOAuthParameters")]}}),Td(or,"credential",ar,[Ds("verificationId"),Ds("verificationCode")]),kd(or.prototype,{Qa:{name:"verifyPhoneNumber",j:[Ds("phoneNumber"),Xs()]}}),kd(Oi.prototype,{toJSON:{name:"toJSON",j:[Ds(null,!0)]}}),kd(lr.prototype,{toJSON:{name:"toJSON",j:[Ds(null,!0)]}}),kd(fr.prototype,{toJSON:{name:"toJSON",j:[Ds(null,!0)]}}),kd(Qs.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}),function(){if(void 0===Nd||!Nd.INTERNAL||!Nd.INTERNAL.registerService)throw Error("Cannot find the firebase namespace; be sure to include firebase-app.js before this library.");var e={Auth:ps,Error:Oi};Td(e,"EmailAuthProvider",er,[]),Td(e,"FacebookAuthProvider",Gi,[]),Td(e,"GithubAuthProvider",Ji,[]),Td(e,"GoogleAuthProvider",$i,[]),Td(e,"TwitterAuthProvider",Qi,[]),Td(e,"OAuthProvider",Wi,[Ds("providerId")]),Td(e,"PhoneAuthProvider",or,[Vs()]),Td(e,"RecaptchaVerifier",Qs,[Bs(Ds(),Ms(),"recaptchaContainer"),xs("recaptchaParameters",!0),Fs()]),Nd.INTERNAL.registerService("auth",function(e,t){return e=new ps(e),t({INTERNAL:{getUid:f(e.getUid,e),getToken:f(e.Vb,e),addAuthTokenListener:f(e.Mb,e),removeAuthTokenListener:f(e.qc,e)}}),e},e,function(e,t){if("create"===e)try{t.auth()}catch(e){}}),Nd.INTERNAL.extendNamespace({User:Ta})}()}).call(void 0===e?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:e)}).call(t,Kn(12))}},[76])}catch(e){throw Error("Cannot instantiate firebase-auth.js - be sure to load firebase-app.js first.")}try{webpackJsonpFirebase([0],[,function(d,m,e){"use strict";var t=Math.floor,g=Math.round;Object.defineProperty(m,"__esModule",{value:!0});var f=e(0),r=e(0),i=e(0),o=e(0),a=e(0),s=e(0),u=e(13),l=e(0);m.LUIDGenerator=function(){var t=1;return function(){return t++}}(),m.sha1=function(s){var e=a.stringToByteArray(s),t=new o.Sha1;t.update(e);var n=t.digest();return i.base64.encodeByteArray(n)};var h=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];for(var t="",n=0;n<o.length;n++)t+=Array.isArray(o[n])||o[n]&&"object"==typeof o[n]&&"number"==typeof o[n].length?h.apply(null,o[n]):"object"==typeof o[n]?s.stringify(o[n]):o[n],t+=" ";return t};m.logger=null;var c=!0;m.enableLogging=function(t,o){f.assert(!o||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?("undefined"!=typeof console&&("function"==typeof console.log?m.logger=console.log.bind(console):"object"==typeof console.log&&(m.logger=function(t){console.log(t)})),o&&u.SessionStorage.set("logging_enabled",!0)):"function"==typeof t?m.logger=t:(m.logger=null,u.SessionStorage.remove("logging_enabled"))},m.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!0==c&&(c=!1,null===m.logger&&!0===u.SessionStorage.get("logging_enabled")&&m.enableLogging(!0)),m.logger){var n=h.apply(null,t);m.logger(n)}},m.logWrapper=function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];m.log.apply(void 0,[t].concat(e))}},m.error=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];if("undefined"!=typeof console){var t="FIREBASE INTERNAL ERROR: "+h.apply(void 0,o);void 0===console.error?console.log(t):console.error(t)}},m.fatal=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];var t=h.apply(void 0,o);throw Error("FIREBASE FATAL ERROR: "+t)},m.warn=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];if("undefined"!=typeof console){var t="FIREBASE WARNING: "+h.apply(void 0,o);void 0===console.warn?console.log(t):console.warn(t)}},m.warnIfPageIsSecure=function(){"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&m.warn("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},m.warnAboutUnsupportedMethod=function(t){m.warn(t+" is unsupported and will likely change soon. Please do not use.")},m.isInvalidJSONNumber=function(t){return"number"==typeof t&&(t!=t||t==Number.POSITIVE_INFINITY||t==Number.NEGATIVE_INFINITY)},m.executeWhenDOMReady=function(o){if(l.isNodeSdk()||"complete"===document.readyState)o();else{var e=!1,t=function(){return document.body?void(e||(e=!0,o())):void setTimeout(t,10)};document.addEventListener?(document.addEventListener("DOMContentLoaded",t,!1),window.addEventListener("load",t,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&t()}),window.attachEvent("onload",t))}},m.MIN_NAME="[MIN_NAME]",m.MAX_NAME="[MAX_NAME]",m.nameCompare=function(t,e){if(t===e)return 0;if(t===m.MIN_NAME||e===m.MAX_NAME)return-1;if(e===m.MIN_NAME||t===m.MAX_NAME)return 1;var n=m.tryParseInt(t),o=m.tryParseInt(e);return null===n?null===o?t<e?-1:1:1:null===o?-1:0==n-o?t.length-e.length:n-o},m.stringCompare=function(n,e){return n===e?0:n<e?-1:1},m.requireKey=function(n,e){if(e&&n in e)return e[n];throw Error("Missing required key ("+n+") in object: "+s.stringify(e))},m.ObjectToUniqueKey=function(t){if("object"!=typeof t||null===t)return s.stringify(t);var a=[];for(var n in t)a.push(n);a.sort();for(var r="{",i=0;i<a.length;i++)0!==i&&(r+=","),r+=s.stringify(a[i]),r+=":",r+=m.ObjectToUniqueKey(t[a[i]]);return r+="}"},m.splitStringBySize=function(o,e){var t=o.length;if(t<=e)return[o];for(var n=[],r=0;r<t;r+=e)r+e>t?n.push(o.substring(r,t)):n.push(o.substring(r,r+e));return n},m.each=function(o,a){if(Array.isArray(o))for(var e=0;e<o.length;++e)a(e,o[e]);else r.forEach(o,function(t,e){return a(e,t)})},m.bindCallback=function(n,e){return e?n.bind(e):n},m.doubleToIEEE754String=function(r){f.assert(!m.isInvalidJSONNumber(r),"Invalid JSON number");var e,n,i,o,a,s,d;for(0===r?(n=0,i=0,e=1/r==-1/0?1:0):(e=0>r,r=Math.abs(r),2.2250738585072014e-308<=r?(o=Math.min(t(Math.log(r)/Math.LN2),1023),n=o+1023,i=g(r*Math.pow(2,52-o)-4503599627370496)):(n=0,i=g(r/5e-324))),s=[],a=52;a;a-=1)s.push(i%2?1:0),i=t(i/2);for(a=11;a;a-=1)s.push(n%2?1:0),n=t(n/2);s.push(e?1:0),s.reverse(),d=s.join("");var l="";for(a=0;64>a;a+=8){var p=parseInt(d.substr(a,8),2).toString(16);1===p.length&&(p="0"+p),l+=p}return l.toLowerCase()},m.isChromeExtensionContentScript=function(){return"object"==typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href)},m.isWindowsStoreApp=function(){return"object"==typeof Windows&&"object"==typeof Windows.UI},m.errorForServerCode=function(o,e){var t="Unknown Error";"too_big"===o?t="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"==o?t="Client doesn't have permission to access the desired data.":"unavailable"==o&&(t="The service is unavailable");var n=Error(o+" at "+e.path+": "+t);return n.code=o.toUpperCase(),n},m.e=/^-?\d{1,10}$/,m.tryParseInt=function(t){if(m.e.test(t)){var o=+t;if(-2147483648<=o&&2147483647>=o)return o}return null},m.exceptionGuard=function(t){try{t()}catch(t){setTimeout(function(){var e=t.stack||"";throw m.warn("Exception was thrown by user callback.",e),t},0)}},m.callUserCallback=function(t){for(var o=[],n=1;n<arguments.length;n++)o[n-1]=arguments[n];"function"==typeof t&&m.exceptionGuard(function(){t.apply(void 0,o)})},m.beingCrawled=function(){return 0<=("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)},m.exportPropGetter=function(o,e,t){Object.defineProperty(o,e,{get:t})},m.setTimeoutNonBlocking=function(o,e){var t=setTimeout(o,e);return"object"==typeof t&&t.unref&&t.unref(),t}},function(s,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var d=t(1),r=t(0),n=function(){function o(o,a){if(void 0===a){this.n=o.split("/");for(var t=0,n=0;n<this.n.length;n++)0<this.n[n].length&&(this.n[t]=this.n[n],t++);this.n.length=t,this.i=0}else this.n=o,this.i=a}return Object.defineProperty(o,"Empty",{get:function(){return new o("")},enumerable:!0,configurable:!0}),o.prototype.getFront=function(){return this.i>=this.n.length?null:this.n[this.i]},o.prototype.getLength=function(){return this.n.length-this.i},o.prototype.popFront=function(){var e=this.i;return e<this.n.length&&e++,new o(this.n,e)},o.prototype.getBack=function(){return this.i<this.n.length?this.n[this.n.length-1]:null},o.prototype.toString=function(){for(var n="",e=this.i;e<this.n.length;e++)""!==this.n[e]&&(n+="/"+this.n[e]);return n||"/"},o.prototype.toUrlEncodedString=function(){for(var n="",e=this.i;e<this.n.length;e++)""!==this.n[e]&&(n+="/"+encodeURIComponent(this.n[e]+""));return n||"/"},o.prototype.slice=function(t){return void 0===t&&(t=0),this.n.slice(this.i+t)},o.prototype.parent=function(){if(this.i>=this.n.length)return null;for(var e=[],t=this.i;t<this.n.length-1;t++)e.push(this.n[t]);return new o(e,0)},o.prototype.child=function(e){for(var t=[],n=this.i;n<this.n.length;n++)t.push(this.n[n]);if(e instanceof o)for(var n=e.i;n<e.n.length;n++)t.push(e.n[n]);else for(var r=e.split("/"),n=0;n<r.length;n++)0<r[n].length&&t.push(r[n]);return new o(t,0)},o.prototype.isEmpty=function(){return this.i>=this.n.length},o.relativePath=function(e,t){var n=e.getFront(),r=t.getFront();if(null===n)return t;if(n===r)return o.relativePath(e.popFront(),t.popFront());throw Error("INTERNAL ERROR: innerPath ("+t+") is not within outerPath ("+e+")")},o.comparePaths=function(r,e){for(var t=r.slice(),n=e.slice(),i=0,o;i<t.length&&i<n.length;i++)if(o=d.nameCompare(t[i],n[i]),0!==o)return o;return t.length===n.length?0:t.length<n.length?-1:1},o.prototype.equals=function(o){if(this.getLength()!==o.getLength())return!1;for(var e=this.i,t=o.i;e<=this.n.length;e++,t++)if(this.n[e]!==o.n[t])return!1;return!0},o.prototype.contains=function(o){var e=this.i,t=o.i;if(this.getLength()>o.getLength())return!1;for(;e<this.n.length;){if(this.n[e]!==o.n[t])return!1;++e,++t}return!0},o}();e.Path=n;var o=function(){function t(o,a){this.o=a,this.u=o.slice(),this.l=Math.max(1,this.u.length);for(var t=0;t<this.u.length;t++)this.l+=r.stringLength(this.u[t]);this.f()}return Object.defineProperty(t,"MAX_PATH_DEPTH",{get:function(){return 32},enumerable:!0,configurable:!0}),Object.defineProperty(t,"MAX_PATH_LENGTH_BYTES",{get:function(){return 768},enumerable:!0,configurable:!0}),t.prototype.push=function(t){0<this.u.length&&(this.l+=1),this.u.push(t),this.l+=r.stringLength(t),this.f()},t.prototype.pop=function(){var t=this.u.pop();this.l-=r.stringLength(t),0<this.u.length&&(this.l-=1)},t.prototype.f=function(){if(this.l>t.MAX_PATH_LENGTH_BYTES)throw Error(this.o+"has a key path longer than "+t.MAX_PATH_LENGTH_BYTES+" bytes ("+this.l+").");if(this.u.length>t.MAX_PATH_DEPTH)throw Error(this.o+"path specified exceeds the maximum depth that can be written ("+t.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},t.prototype.toErrorString=function(){return 0==this.u.length?"":"in property '"+this.u.join(".")+"'"},t}();e.ValidationPath=o},function(r,e,t){"use strict";var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=t(15),d=t(1),i=t(5),l=t(16),c,a;e.setNodeFromJSON=function(t){c=t},e.setMaxNode=function(t){a=t};var s=function(o){function e(){return null!==o&&o.apply(this,arguments)||this}return n(e,o),e.prototype.compare=function(o,e){var t=o.node.getPriority(),n=e.node.getPriority(),r=t.compareTo(n);return 0===r?d.nameCompare(o.name,e.name):r},e.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},e.prototype.indexedValueChanged=function(n,e){return!n.getPriority().equals(e.getPriority())},e.prototype.minPost=function(){return i.NamedNode.MIN},e.prototype.maxPost=function(){return new i.NamedNode(d.MAX_NAME,new l.LeafNode("[PRIORITY-POST]",a))},e.prototype.makePost=function(o,e){var t=c(o);return new i.NamedNode(e,new l.LeafNode("[PRIORITY-POST]",t))},e.prototype.toString=function(){return".priority"},e}(o.Index);e.PriorityIndex=s,e.PRIORITY_INDEX=new s},function(m,g,e){"use strict";var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(g,"__esModule",{value:!0});var b=e(0),t=e(1),o=e(17),v=e(5),r=e(37),l=e(3),a=e(10),s=e(39),p=e(16),d=e(41),c=function(){function p(o,a,t){this._=o,this.y=a,this.g=t,this.m=null,this.y&&r.validatePriorityNode(this.y),this._.isEmpty()&&b.assert(!this.y||this.y.isEmpty(),"An empty node cannot have a priority")}return Object.defineProperty(p,"EMPTY_NODE",{get:function(){return u||(u=new p(new o.SortedMap(d.NAME_COMPARATOR),null,s.IndexMap.Default))},enumerable:!0,configurable:!0}),p.prototype.isLeafNode=function(){return!1},p.prototype.getPriority=function(){return this.y||u},p.prototype.updatePriority=function(e){return this._.isEmpty()?this:new p(this._,e,this.g)},p.prototype.getImmediateChild=function(n){if(".priority"===n)return this.getPriority();var e=this._.get(n);return null===e?u:e},p.prototype.getChild=function(n){var e=n.getFront();return null===e?this:this.getImmediateChild(e).getChild(n.popFront())},p.prototype.hasChild=function(t){return null!==this._.get(t)},p.prototype.updateImmediateChild=function(e,t){if(b.assert(t,"We should always be passing snapshot nodes"),".priority"===e)return this.updatePriority(t);var n=new v.NamedNode(e,t),o,r,a;return t.isEmpty()?(o=this._.remove(e),r=this.g.removeFromIndexes(n,this._)):(o=this._.insert(e,t),r=this.g.addToIndexes(n,this._)),a=o.isEmpty()?u:this.y,new p(o,a,r)},p.prototype.updateChild=function(o,e){var t=o.getFront();if(null===t)return e;b.assert(".priority"!==o.getFront()||1===o.getLength(),".priority must be the last token in a path");var n=this.getImmediateChild(t).updateChild(o.popFront(),e);return this.updateImmediateChild(t,n)},p.prototype.isEmpty=function(){return this._.isEmpty()},p.prototype.numChildren=function(){return this._.count()},p.prototype.val=function(e){if(this.isEmpty())return null;var d={},n=0,r=0,i=!0;if(this.forEachChild(l.PRIORITY_INDEX,function(t,o){d[t]=o.val(e),n++,i&&p.e.test(t)?r=Math.max(r,+t):i=!1}),!e&&i&&r<2*n){var o=[];for(var a in d)o[a]=d[a];return o}return e&&!this.getPriority().isEmpty()&&(d[".priority"]=this.getPriority().val()),d},p.prototype.hash=function(){if(null===this.m){var o="";this.getPriority().isEmpty()||(o+="priority:"+r.priorityHashText(this.getPriority().val())+":"),this.forEachChild(l.PRIORITY_INDEX,function(e,t){var n=t.hash();""!==n&&(o+=":"+e+":"+n)}),this.m=""==o?"":t.sha1(o)}return this.m},p.prototype.getPredecessorChildName=function(o,e,t){var n=this.C(t);if(n){var r=n.getPredecessorKey(new v.NamedNode(o,e));return r?r.name:null}return this._.getPredecessorKey(o)},p.prototype.getFirstChildName=function(o){var e=this.C(o);if(e){var t=e.minKey();return t&&t.name}return this._.minKey()},p.prototype.getFirstChild=function(n){var e=this.getFirstChildName(n);return e?new v.NamedNode(e,this._.get(e)):null},p.prototype.getLastChildName=function(o){var e=this.C(o);if(e){var t=e.maxKey();return t&&t.name}return this._.maxKey()},p.prototype.getLastChild=function(n){var e=this.getLastChildName(n);return e?new v.NamedNode(e,this._.get(e)):null},p.prototype.forEachChild=function(o,r){var e=this.C(o);return e?e.inorderTraversal(function(t){return r(t.name,t.node)}):this._.inorderTraversal(r)},p.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},p.prototype.getIteratorFrom=function(o,e){var t=this.C(e);if(t)return t.getIteratorFrom(o,function(t){return t});for(var n=this._.getIteratorFrom(o.name,v.NamedNode.Wrap),r=n.peek();null!=r&&0>e.compare(r,o);)n.getNext(),r=n.peek();return n},p.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},p.prototype.getReverseIteratorFrom=function(o,e){var t=this.C(e);if(t)return t.getReverseIteratorFrom(o,function(t){return t});for(var n=this._.getReverseIteratorFrom(o.name,v.NamedNode.Wrap),r=n.peek();null!=r&&0<e.compare(r,o);)n.getNext(),r=n.peek();return n},p.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===g.MAX_NODE?-1:0},p.prototype.withIndex=function(e){if(e===a.KEY_INDEX||this.g.hasIndex(e))return this;var t=this.g.addIndex(e,this._);return new p(this._,this.y,t)},p.prototype.isIndexed=function(t){return t===a.KEY_INDEX||this.g.hasIndex(t)},p.prototype.equals=function(a){if(a===this)return!0;if(a.isLeafNode())return!1;var e=a;if(this.getPriority().equals(e.getPriority())){if(this._.count()===e._.count()){for(var t=this.getIterator(l.PRIORITY_INDEX),n=e.getIterator(l.PRIORITY_INDEX),r=t.getNext(),i=n.getNext();r&&i;){if(r.name!==i.name||!r.node.equals(i.node))return!1;r=t.getNext(),i=n.getNext()}return null===r&&null===i}return!1}return!1},p.prototype.C=function(t){return t===a.KEY_INDEX?null:this.g.get(""+t)},p.e=/^(0|[1-9]\d*)$/,p}(),u;g.ChildrenNode=c;var i=function(r){function e(){return r.call(this,new o.SortedMap(d.NAME_COMPARATOR),c.EMPTY_NODE,s.IndexMap.Default)||this}return n(e,r),e.prototype.compareTo=function(t){return t===this?0:1},e.prototype.equals=function(t){return t===this},e.prototype.getPriority=function(){return this},e.prototype.getImmediateChild=function(){return c.EMPTY_NODE},e.prototype.isEmpty=function(){return!1},e}(c);g.MaxNode=i,g.MAX_NODE=new i,Object.defineProperties(v.NamedNode,{MIN:{value:new v.NamedNode(t.MIN_NAME,c.EMPTY_NODE)},MAX:{value:new v.NamedNode(t.MAX_NAME,g.MAX_NODE)}}),a.KeyIndex.__EMPTY_NODE=c.EMPTY_NODE,p.LeafNode.__childrenNodeConstructor=c,r.setMaxNode(g.MAX_NODE),l.setMaxNode(g.MAX_NODE)},function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function o(n,o){this.name=n,this.node=o}return o.Wrap=function(e,t){return new o(e,t)},o}();e.NamedNode=t},,function(d,p,e){"use strict";Object.defineProperty(p,"__esModule",{value:!0});var t=e(2),c=e(0),m=e(1),g=e(0),o=e(0);p.N=/[\[\].#$\/\u0000-\u001F\u007F]/,p.P=/[\[\].#$\u0000-\u001F\u007F]/,p.S=10485760,p.isValidKey=function(t){return"string"==typeof t&&0!==t.length&&!p.N.test(t)},p.isValidPathString=function(t){return"string"==typeof t&&0!==t.length&&!p.P.test(t)},p.isValidRootPathString=function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),p.isValidPathString(t)},p.isValidPriority=function(t){return null===t||"string"==typeof t||"number"==typeof t&&!m.isInvalidJSONNumber(t)||t&&"object"==typeof t&&c.contains(t,".sv")},p.validateFirebaseDataArg=function(t,e,n,r,a){a&&void 0===n||p.validateFirebaseData(g.errorPrefix(t,e,a),n,r)},p.validateFirebaseData=function(i,e,r){var a=r instanceof t.Path?new t.ValidationPath(r,i):r;if(void 0===e)throw Error(i+"contains undefined "+a.toErrorString());if("function"==typeof e)throw Error(i+"contains a function "+a.toErrorString()+" with contents = "+e);if(m.isInvalidJSONNumber(e))throw Error(i+"contains "+e+" "+a.toErrorString());if("string"==typeof e&&e.length>p.S/3&&o.stringLength(e)>p.S)throw Error(i+"contains a string greater than "+p.S+" utf8 bytes "+a.toErrorString()+" ('"+e.substring(0,50)+"...')");if(e&&"object"==typeof e){var s=!1,d=!1;if(c.forEach(e,function(e,t){if(".value"===e)s=!0;else if(".priority"!==e&&".sv"!==e&&(d=!0,!p.isValidKey(e)))throw Error(i+" contains an invalid key ("+e+") "+a.toErrorString()+". Keys must be non-empty strings and can't contain \".\", \"#\", \"$\", \"/\", \"[\", or \"]\"");a.push(e),p.validateFirebaseData(i,t,a),a.pop()}),s&&d)throw Error(i+" contains \".value\" child "+a.toErrorString()+" in addition to actual children.")}},p.validateFirebaseMergePaths=function(r,e){var n,i;for(n=0;n<e.length;n++){i=e[n];for(var o=i.slice(),a=0;a<o.length;a++)if(".priority"===o[a]&&a===o.length-1);else if(!p.isValidKey(o[a]))throw Error(r+"contains an invalid key ("+o[a]+") in path "+i+". Keys must be non-empty strings and can't contain \".\", \"#\", \"$\", \"/\", \"[\", or \"]\"")}e.sort(t.Path.comparePaths);var s=null;for(n=0;n<e.length;n++){if(i=e[n],null!=s&&s.contains(i))throw Error(r+"contains a path "+s+" that is ancestor of another path "+i);s=i}},p.validateFirebaseMergeDataArg=function(r,e,n,a,i){if(!i||void 0!==n){var s=g.errorPrefix(r,e,i);if(!n||"object"!=typeof n||Array.isArray(n))throw Error(s+" must be an object containing the children to replace.");var d=[];c.forEach(n,function(o,e){var n=new t.Path(o);if(p.validateFirebaseData(s,e,a.child(n)),".priority"===n.getBack()&&!p.isValidPriority(e))throw Error(s+"contains an invalid value for '"+n+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");d.push(n)}),p.validateFirebaseMergePaths(s,d)}},p.validatePriority=function(t,e,n,o){if(!o||void 0!==n){if(m.isInvalidJSONNumber(n))throw Error(g.errorPrefix(t,e,o)+"is "+n+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!p.isValidPriority(n))throw Error(g.errorPrefix(t,e,o)+"must be a valid Firebase priority (a string, finite number, server value, or null).")}},p.validateEventType=function(o,e,t,n){if(!n||void 0!==t)switch(t){case"value":case"child_added":case"child_removed":case"child_changed":case"child_moved":break;default:throw Error(g.errorPrefix(o,e,n)+"must be a valid event type = \"value\", \"child_added\", \"child_removed\", \"child_changed\", or \"child_moved\".");}},p.validateKey=function(t,e,n,o){if(!(o&&void 0===n||p.isValidKey(n)))throw Error(g.errorPrefix(t,e,o)+"was an invalid key = \""+n+"\". Firebase keys must be non-empty strings and can't contain \".\", \"#\", \"$\", \"/\", \"[\", or \"]\").")},p.validatePathString=function(t,e,n,o){if(!(o&&void 0===n||p.isValidPathString(n)))throw Error(g.errorPrefix(t,e,o)+"was an invalid path = \""+n+"\". Paths must be non-empty strings and can't contain \".\", \"#\", \"$\", \"[\", or \"]\"")},p.validateRootPathString=function(t,e,n,o){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),p.validatePathString(t,e,n,o)},p.validateWritablePath=function(n,e){if(".info"===e.getFront())throw Error(n+" failed = Can't modify data under /.info/")},p.validateUrl=function(t,e,n){var o=""+n.path;if("string"!=typeof n.repoInfo.host||0===n.repoInfo.host.length||!p.isValidKey(n.repoInfo.namespace)||0!==o.length&&!p.isValidRootPathString(o))throw Error(g.errorPrefix(t,e,!1)+"must be a valid firebase URL and the path can't contain \".\", \"#\", \"$\", \"[\", or \"]\".")},p.validateCredential=function(o,e,t,a){if((!a||void 0!==t)&&"string"!=typeof t)throw Error(g.errorPrefix(o,e,a)+"must be a valid credential (a string).")},p.validateBoolean=function(o,e,t,a){if((!a||void 0!==t)&&"boolean"!=typeof t)throw Error(g.errorPrefix(o,e,a)+"must be a boolean.")},p.validateString=function(o,e,t,a){if((!a||void 0!==t)&&"string"!=typeof t)throw Error(g.errorPrefix(o,e,a)+"must be a valid string.")},p.validateObject=function(o,e,t,a){if(!(a&&void 0===t||t&&"object"==typeof t&&null!==t))throw Error(g.errorPrefix(o,e,a)+"must be a valid object.")},p.validateObjectContainsKey=function(a,e,t,i,r,o){if(!t||"object"!=typeof t||!c.contains(t,i)){if(r)return;throw Error(g.errorPrefix(a,e,r)+"must contain the key \""+i+"\"")}if(o){var s=c.safeGet(t,i);if("number"===o&&"number"!=typeof s||"string"===o&&"string"!=typeof s||"boolean"===o&&"boolean"!=typeof s||"function"===o&&"function"!=typeof s||"object"===o&&"object"!=typeof s&&s)throw r?Error(g.errorPrefix(a,e,r)+"contains invalid value for key \""+i+"\" (must be of type \""+o+"\")"):Error(g.errorPrefix(a,e,r)+"must contain the key \""+i+"\" with type \""+o+"\"")}}},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=t(0);!function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}(e.OperationType||(e.OperationType={}));var n=function(){function n(o,r,t,n){this.fromUser=o,this.fromServer=r,this.queryId=t,this.tagged=n,a.assert(!n||r,"Tagged queries must be from server.")}return n.User=new n(!0,!1,null,!1),n.Server=new n(!1,!0,null,!1),n.forServerTaggedQuery=function(e){return new n(!1,!0,e,!0)},n}();e.OperationSource=n},function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function o(o,a,t,n,r){this.type=o,this.snapshotNode=a,this.childName=t,this.oldSnap=n,this.prevName=r}return o.valueChange=function(e){return new o(o.VALUE,e)},o.childAddedChange=function(e,t){return new o(o.CHILD_ADDED,t,e)},o.childRemovedChange=function(e,t){return new o(o.CHILD_REMOVED,t,e)},o.childChangedChange=function(e,t,n){return new o(o.CHILD_CHANGED,t,e,n)},o.childMovedChange=function(e,t){return new o(o.CHILD_MOVED,t,e)},o.CHILD_ADDED="child_added",o.CHILD_REMOVED="child_removed",o.CHILD_CHANGED="child_changed",o.CHILD_MOVED="child_moved",o.VALUE="value",o}();e.Change=t},function(d,e,t){"use strict";var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var r=t(15),o=t(5),a=t(1),s=t(0),p=function(r){function e(){return null!==r&&r.apply(this,arguments)||this}return n(e,r),Object.defineProperty(e,"__EMPTY_NODE",{get:function(){return l},set:function(t){l=t},enumerable:!0,configurable:!0}),e.prototype.compare=function(n,e){return a.nameCompare(n.name,e.name)},e.prototype.isDefinedOn=function(){throw s.assertionError("KeyIndex.isDefinedOn not expected to be called.")},e.prototype.indexedValueChanged=function(){return!1},e.prototype.minPost=function(){return o.NamedNode.MIN},e.prototype.maxPost=function(){return new o.NamedNode(a.MAX_NAME,l)},e.prototype.makePost=function(t){return s.assert("string"==typeof t,"KeyIndex indexValue must always be a string."),new o.NamedNode(t,l)},e.prototype.toString=function(){return".key"},e}(r.Index),l;e.KeyIndex=p,e.KEY_INDEX=new p},function(m,e,t){"use strict";function b(c,x){if(void 0===x&&(x=null),null===c)return r.ChildrenNode.EMPTY_NODE;if("object"==typeof c&&".priority"in c&&(x=c[".priority"]),s.assert(null===x||"string"==typeof x||"number"==typeof x||"object"==typeof x&&".sv"in x,"Invalid priority type found: "+typeof x),"object"==typeof c&&".value"in c&&null!==c[".value"]&&(c=c[".value"]),"object"!=typeof c||".sv"in c){var S=c;return new i.LeafNode(S,b(x))}if(c instanceof Array||!p){var E=r.ChildrenNode.EMPTY_NODE,f=c;return a.forEach(f,function(o,e){if(a.contains(f,o)&&"."!==o.substring(0,1)){var t=b(e);!t.isLeafNode()&&t.isEmpty()||(E=E.updateImmediateChild(o,t))}}),E.updatePriority(b(x))}var k=[],y=!1,v=c;if(a.forEach(v,function(t){if("string"!=typeof t||"."!==t.substring(0,1)){var r=b(v[t]);r.isEmpty()||(y=y||!r.getPriority().isEmpty(),k.push(new o.NamedNode(t,r)))}}),0==k.length)return r.ChildrenNode.EMPTY_NODE;var g=u.buildChildSet(k,l.NAME_ONLY_COMPARATOR,function(t){return t.name},l.NAME_COMPARATOR);if(y){var m=u.buildChildSet(k,n.PRIORITY_INDEX.getCompare());return new r.ChildrenNode(g,b(x),new h.IndexMap({".priority":m},{".priority":n.PRIORITY_INDEX}))}return new r.ChildrenNode(g,b(x),h.IndexMap.Default)}Object.defineProperty(e,"__esModule",{value:!0});var r=t(4),i=t(16),o=t(5),a=t(0),s=t(0),u=t(40),l=t(41),h=t(39),n=t(3),p=!0;e.nodeFromJSON=b,n.setNodeFromJSON(b)},,function(a,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(80),r=t(81),i=function(o){try{if("undefined"!=typeof window&&void 0!==window[o]){var e=window[o];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new n.DOMStorageWrapper(e)}}catch(t){}return new r.MemoryStorage};e.PersistentStorage=i("localStorage"),e.SessionStorage=i("sessionStorage")},function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PROTOCOL_VERSION="5",e.VERSION_PARAM="v",e.TRANSPORT_SESSION_PARAM="s",e.REFERER_PARAM="r",e.FORGE_REF="f",e.FORGE_DOMAIN="firebaseio.com",e.LAST_SESSION_PARAM="ls",e.WEBSOCKET="websocket",e.LONG_POLLING="long_polling"},function(a,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=t(5),r=t(1),n=function(){function t(){}return t.prototype.getCompare=function(){return this.compare.bind(this)},t.prototype.indexedValueChanged=function(a,e){var t=new s.NamedNode(r.MIN_NAME,a),n=new s.NamedNode(r.MIN_NAME,e);return 0!==this.compare(t,n)},t.prototype.minPost=function(){return s.NamedNode.MIN},t}();e.Index=n},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=t(0),n=t(1),o=t(37),a=function(){function s(e,t){void 0===t&&(t=s.__childrenNodeConstructor.EMPTY_NODE),this.T=e,this.y=t,this.m=null,l.assert(void 0!==this.T&&null!==this.T,"LeafNode shouldn't be created with null/undefined value."),o.validatePriorityNode(this.y)}return Object.defineProperty(s,"__childrenNodeConstructor",{get:function(){return i},set:function(t){i=t},enumerable:!0,configurable:!0}),s.prototype.isLeafNode=function(){return!0},s.prototype.getPriority=function(){return this.y},s.prototype.updatePriority=function(e){return new s(this.T,e)},s.prototype.getImmediateChild=function(e){return".priority"===e?this.y:s.__childrenNodeConstructor.EMPTY_NODE},s.prototype.getChild=function(e){return e.isEmpty()?this:".priority"===e.getFront()?this.y:s.__childrenNodeConstructor.EMPTY_NODE},s.prototype.hasChild=function(){return!1},s.prototype.getPredecessorChildName=function(){return null},s.prototype.updateImmediateChild=function(e,t){return".priority"===e?this.updatePriority(t):t.isEmpty()&&".priority"!==e?this:s.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,t).updatePriority(this.y)},s.prototype.updateChild=function(e,t){var n=e.getFront();return null===n?t:t.isEmpty()&&".priority"!==n?this:(l.assert(".priority"!==n||1===e.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(n,s.__childrenNodeConstructor.EMPTY_NODE.updateChild(e.popFront(),t)))},s.prototype.isEmpty=function(){return!1},s.prototype.numChildren=function(){return 0},s.prototype.forEachChild=function(){return!1},s.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},s.prototype.hash=function(){if(null===this.m){var r="";this.y.isEmpty()||(r+="priority:"+o.priorityHashText(this.y.val())+":");var e=typeof this.T;r+=e+":",r+="number"==e?n.doubleToIEEE754String(this.T):this.T,this.m=n.sha1(r)}return this.m},s.prototype.getValue=function(){return this.T},s.prototype.compareTo=function(e){return e===s.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof s.__childrenNodeConstructor?-1:(l.assert(e.isLeafNode(),"Unknown node type"),this.w(e))},s.prototype.w=function(e){var t=typeof e.T,n=typeof this.T,r=s.VALUE_TYPE_ORDER.indexOf(t),o=s.VALUE_TYPE_ORDER.indexOf(n);return l.assert(0<=r,"Unknown leaf type: "+t),l.assert(0<=o,"Unknown leaf type: "+n),r===o?"object"==n?0:this.T<e.T?-1:this.T===e.T?0:1:o-r},s.prototype.withIndex=function(){return this},s.prototype.isIndexed=function(){return!0},s.prototype.equals=function(n){if(n===this)return!0;if(n.isLeafNode()){var e=n;return this.T===e.T&&this.y.equals(e.y)}return!1},s.VALUE_TYPE_ORDER=["object","boolean","number","string"],s}(),i;e.LeafNode=a},function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(a,s,t,n,r){void 0===r&&(r=null),this.I=n,this.R=r,this.O=[];for(var i=1;!a.isEmpty();)if(a=a,i=s?t(a.key,s):1,n&&(i*=-1),0>i)a=this.I?a.left:a.right;else{if(0===i){this.O.push(a);break}this.O.push(a),a=this.I?a.right:a.left}}return t.prototype.getNext=function(){if(0===this.O.length)return null;var n=this.O.pop(),t;if(t=this.R?this.R(n.key,n.value):{key:n.key,value:n.value},this.I)for(n=n.left;!n.isEmpty();)this.O.push(n),n=n.right;else for(n=n.right;!n.isEmpty();)this.O.push(n),n=n.left;return t},t.prototype.hasNext=function(){return 0<this.O.length},t.prototype.peek=function(){if(0===this.O.length)return null;var t=this.O[this.O.length-1];return this.R?this.R(t.key,t.value):{key:t.key,value:t.value}},t}();e.SortedMapIterator=s;var r=function(){function a(e,t,n,r,i){this.key=e,this.value=t,this.color=null==n?a.RED:n,this.left=null==r?d.EMPTY_NODE:r,this.right=null==i?d.EMPTY_NODE:i}return a.prototype.copy=function(e,t,n,r,i){return new a(null==e?this.key:e,null==t?this.value:t,null==n?this.color:n,null==r?this.left:r,null==i?this.right:i)},a.prototype.count=function(){return this.left.count()+1+this.right.count()},a.prototype.isEmpty=function(){return!1},a.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)},a.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},a.prototype.A=function(){return this.left.isEmpty()?this:this.left.A()},a.prototype.minKey=function(){return this.A().key},a.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},a.prototype.insert=function(o,e,t){var n,r;return r=this,n=t(o,r.key),r=0>n?r.copy(null,null,null,r.left.insert(o,e,t),null):0===n?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(o,e,t)),r.D()},a.prototype.M=function(){if(this.left.isEmpty())return d.EMPTY_NODE;var t=this;return t.left.L()||t.left.left.L()||(t=t.F()),t=t.copy(null,null,null,t.left.M(),null),t.D()},a.prototype.remove=function(o,e){var t,n;if(t=this,0>e(o,t.key))t.left.isEmpty()||t.left.L()||t.left.left.L()||(t=t.F()),t=t.copy(null,null,null,t.left.remove(o,e),null);else{if(t.left.L()&&(t=t.x()),t.right.isEmpty()||t.right.L()||t.right.left.L()||(t=t.k()),0===e(o,t.key)){if(t.right.isEmpty())return d.EMPTY_NODE;n=t.right.A(),t=t.copy(n.key,n.value,null,null,t.right.M())}t=t.copy(null,null,null,null,t.right.remove(o,e))}return t.D()},a.prototype.L=function(){return this.color},a.prototype.D=function(){var t=this;return t.right.L()&&!t.left.L()&&(t=t.W()),t.left.L()&&t.left.left.L()&&(t=t.x()),t.left.L()&&t.right.L()&&(t=t.j()),t},a.prototype.F=function(){var t=this.j();return t.right.left.L()&&(t=t.copy(null,null,null,null,t.right.x()),t=t.W(),t=t.j()),t},a.prototype.k=function(){var t=this.j();return t.left.left.L()&&(t=t.x(),t=t.j()),t},a.prototype.W=function(){var e=this.copy(null,null,a.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},a.prototype.x=function(){var e=this.copy(null,null,a.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},a.prototype.j=function(){var n=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,n,e)},a.prototype.V=function(){var t=this.Q();return Math.pow(2,t)<=this.count()+1},a.prototype.Q=function(){var t;if(this.L()&&this.left.L())throw Error("Red node has red child("+this.key+","+this.value+")");if(this.right.L())throw Error("Right child of ("+this.key+","+this.value+") is red");if((t=this.left.Q())!==this.right.Q())throw Error("Black depths differ");return t+(this.L()?0:1)},a.RED=!0,a.BLACK=!1,a}();e.LLRBNode=r;var t=function(){function t(){}return t.prototype.copy=function(){return this},t.prototype.insert=function(n,e){return new r(n,e,null)},t.prototype.remove=function(){return this},t.prototype.count=function(){return 0},t.prototype.isEmpty=function(){return!0},t.prototype.inorderTraversal=function(){return!1},t.prototype.reverseTraversal=function(){return!1},t.prototype.minKey=function(){return null},t.prototype.maxKey=function(){return null},t.prototype.Q=function(){return 0},t.prototype.L=function(){return!1},t}();e.LLRBEmptyNode=t;var d=function(){function o(e,t){void 0===t&&(t=o.EMPTY_NODE),this.U=e,this.B=t}return o.prototype.insert=function(e,t){return new o(this.U,this.B.insert(e,t,this.U).copy(null,null,r.BLACK,null,null))},o.prototype.remove=function(e){return new o(this.U,this.B.remove(e,this.U).copy(null,null,r.BLACK,null,null))},o.prototype.get=function(o){for(var e=this.B,n;!e.isEmpty();){if(0===(n=this.U(o,e.key)))return e.value;0>n?e=e.left:0<n&&(e=e.right)}return null},o.prototype.getPredecessorKey=function(o){for(var e=this.B,n=null,r;!e.isEmpty();){if(0===(r=this.U(o,e.key))){if(e.left.isEmpty())return n?n.key:null;for(e=e.left;!e.right.isEmpty();)e=e.right;return e.key}0>r?e=e.left:0<r&&(n=e,e=e.right)}throw Error("Attempted to find predecessor key for a nonexistent key. What gives?")},o.prototype.isEmpty=function(){return this.B.isEmpty()},o.prototype.count=function(){return this.B.count()},o.prototype.minKey=function(){return this.B.minKey()},o.prototype.maxKey=function(){return this.B.maxKey()},o.prototype.inorderTraversal=function(t){return this.B.inorderTraversal(t)},o.prototype.reverseTraversal=function(t){return this.B.reverseTraversal(t)},o.prototype.getIterator=function(t){return new s(this.B,null,this.U,!1,t)},o.prototype.getIteratorFrom=function(n,e){return new s(this.B,n,this.U,!1,e)},o.prototype.getReverseIteratorFrom=function(n,e){return new s(this.B,n,this.U,!0,e)},o.prototype.getReverseIterator=function(t){return new s(this.B,null,this.U,!0,t)},o.EMPTY_NODE=new t,o}();e.SortedMap=d},function(b,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var x=t(43),S=t(11),E=t(2),k=t(44),a=t(86),s=t(97),n=t(0),T=t(1),i=t(0),l=t(98),p=t(25),o=t(100),r=t(49),d=t(101),c=t(50),u=t(106),h=t(32),m=function(){function t(h,m,t){var g=this;this.H=h,this.app=t,this.dataUpdateCount=0,this.G=null,this.K=new d.EventQueue,this.Y=1,this.X=null,this.z=new k.SparseSnapshotTree,this.J=null;var r=new l.AuthTokenProvider(t);if(this.$=p.StatsManager.getCollection(h),m||T.beingCrawled())this.Z=new u.ReadonlyRestClient(this.H,this.ee.bind(this),r),setTimeout(this.te.bind(this,!0),0);else{var i=t.options.databaseAuthVariableOverride;if(void 0!==i&&null!==i){if("object"!=typeof i)throw Error("Only objects are supported for option databaseAuthVariableOverride");try{n.stringify(i)}catch(t){throw Error("Invalid authOverride provided: "+t)}}this.J=new c.PersistentConnection(this.H,this.ee.bind(this),this.te.bind(this),this.ne.bind(this),r,i),this.Z=this.J}r.addTokenChangeListener(function(t){g.Z.refreshAuthToken(t)}),this.re=p.StatsManager.getOrCreateReporter(h,function(){return new o.StatsReporter(g.$,g.Z)}),this.ie(),this.oe=new s.SnapshotHolder,this.ae=new a.SyncTree({startListening:function(r,e,t,n){var i=[],o=g.oe.getNode(r.path);return o.isEmpty()||(i=g.ae.applyServerOverwrite(r.path,o),setTimeout(function(){n("ok")},0)),i},stopListening:function(){}}),this.se("connected",!1),this.ue=new a.SyncTree({startListening:function(r,e,t,a){return g.Z.listen(r,t,e,function(e,t){var n=a(e,t);g.K.raiseEventsForChangedPath(r.path,n)}),[]},stopListening:function(n,e){g.Z.unlisten(n,e)}})}return t.prototype.toString=function(){return(this.H.secure?"https://":"http://")+this.H.host},t.prototype.name=function(){return this.H.namespace},t.prototype.serverTime=function(){var n=this.oe.getNode(new E.Path(".info/serverTimeOffset")),e=n.val()||0;return new Date().getTime()+e},t.prototype.generateServerValues=function(){return x.generateWithValues({timestamp:this.serverTime()})},t.prototype.ee=function(o,e,t,n){this.dataUpdateCount++;var r=new E.Path(o);e=this.X?this.X(o,e):e;var a=[];if(n){if(t){var s=i.map(e,function(t){return S.nodeFromJSON(t)});a=this.ue.applyTaggedQueryMerge(r,s,n)}else{var c=S.nodeFromJSON(e);a=this.ue.applyTaggedQueryOverwrite(r,c,n)}}else if(t){var l=i.map(e,function(t){return S.nodeFromJSON(t)});a=this.ue.applyServerMerge(r,l)}else{var u=S.nodeFromJSON(e);a=this.ue.applyServerOverwrite(r,u)}var p=r;0<a.length&&(p=this.le(r)),this.K.raiseEventsForChangedPath(p,a)},t.prototype.he=function(t){this.X=t},t.prototype.te=function(t){this.se("connected",t),!1===t&&this.ce()},t.prototype.ne=function(n){var o=this;T.each(n,function(t,e){o.se(e,t)})},t.prototype.se=function(o,e){var t=new E.Path("/.info/"+o),n=S.nodeFromJSON(e);this.oe.updateSnapshot(t,n);var r=this.ae.applyServerOverwrite(t,n);this.K.raiseEventsForChangedPath(t,r)},t.prototype.pe=function(){return this.Y++},t.prototype.setWithPriority=function(h,e,r,m){var o=this;this.de("set",{path:""+h,value:e,priority:r});var a=this.generateServerValues(),i=S.nodeFromJSON(e,r),s=x.resolveDeferredValueSnapshot(i,a),l=this.pe(),c=this.ue.applyUserOverwrite(h,s,l,!0);this.K.queueEvents(c),this.Z.put(""+h,i.val(!0),function(e,t){var n="ok"===e;n||T.warn("set at "+h+" failed: "+e);var a=o.ue.ackUserWrite(l,!n);o.K.raiseEventsForChangedPath(h,a),o.callOnCompleteCallback(m,e,t)});var p=this.fe(h);this.le(p),this.K.raiseEventsForChangedPath(p,[])},t.prototype.update=function(d,e,c){var h=this;this.de("update",{path:""+d,value:e});var o=!0,r=this.generateServerValues(),a={};if(i.forEach(e,function(i,e){o=!1;var t=S.nodeFromJSON(e);a[i]=x.resolveDeferredValueSnapshot(t,r)}),o)T.log("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(c,"ok");else{var n=this.pe(),s=this.ue.applyUserMerge(d,a,n);this.K.queueEvents(s),this.Z.merge(""+d,e,function(e,t){var o="ok"===e;o||T.warn("update at "+d+" failed: "+e);var r=h.ue.ackUserWrite(n,!o),a=0<r.length?h.le(d):d;h.K.raiseEventsForChangedPath(a,r),h.callOnCompleteCallback(c,e,t)}),i.forEach(e,function(e){var t=h.fe(d.child(e));h.le(t)}),this.K.raiseEventsForChangedPath(d,[])}},t.prototype.ce=function(){var o=this;this.de("onDisconnectEvents");var e=this.generateServerValues(),t=x.resolveDeferredValueTree(this.z,e),a=[];t.forEachTree(E.Path.Empty,function(e,t){a=a.concat(o.ue.applyServerOverwrite(e,t));var n=o.fe(e);o.le(n)}),this.z=new k.SparseSnapshotTree,this.K.raiseEventsForChangedPath(E.Path.Empty,a)},t.prototype.onDisconnectCancel=function(o,e){var t=this;this.Z.onDisconnectCancel(""+o,function(n,r){"ok"===n&&t.z.forget(o),t.callOnCompleteCallback(e,n,r)})},t.prototype.onDisconnectSet=function(a,e,s){var n=this,r=S.nodeFromJSON(e);this.Z.onDisconnectPut(""+a,r.val(!0),function(e,t){"ok"===e&&n.z.remember(a,r),n.callOnCompleteCallback(s,e,t)})},t.prototype.onDisconnectSetWithPriority=function(i,e,t,s){var r=this,o=S.nodeFromJSON(e,t);this.Z.onDisconnectPut(""+i,o.val(!0),function(e,t){"ok"===e&&r.z.remember(i,o),r.callOnCompleteCallback(s,e,t)})},t.prototype.onDisconnectUpdate=function(a,e,t){var s=this;return i.isEmpty(e)?(T.log("onDisconnect().update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(t,"ok")):void this.Z.onDisconnectMerge(""+a,e,function(n,o){"ok"===n&&i.forEach(e,function(e,t){var n=S.nodeFromJSON(t);s.z.remember(a.child(e),n)}),s.callOnCompleteCallback(t,n,o)})},t.prototype.addEventCallbackForQuery=function(o,e){var t;t=".info"===o.path.getFront()?this.ae.addEventRegistration(o,e):this.ue.addEventRegistration(o,e),this.K.raiseEventsAtPath(o.path,t)},t.prototype.removeEventCallbackForQuery=function(o,e){var t;t=".info"===o.path.getFront()?this.ae.removeEventRegistration(o,e):this.ue.removeEventRegistration(o,e),this.K.raiseEventsAtPath(o.path,t)},t.prototype.interrupt=function(){this.J&&this.J.interrupt("repo_interrupt")},t.prototype.resume=function(){this.J&&this.J.resume("repo_interrupt")},t.prototype.stats=function(o){if(void 0===o&&(o=!1),"undefined"!=typeof console){var e;o?(this.G||(this.G=new r.StatsListener(this.$)),e=this.G.get()):e=this.$.get();var t=Object.keys(e).reduce(function(n,e){return Math.max(e.length,n)},0);i.forEach(e,function(n,e){for(var o=n.length;o<t+2;o++)n+=" ";console.log(n+e)})}},t.prototype.statsIncrementCounter=function(t){this.$.incrementCounter(t),this.re.includeStat(t)},t.prototype.de=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];var t="";this.J&&(t=this.J.id+":"),T.log.apply(void 0,[t].concat(o))},t.prototype.callOnCompleteCallback=function(a,e,t){a&&T.exceptionGuard(function(){if("ok"==e)a(null);else{var n=(e||"error").toUpperCase(),r=n;t&&(r+=": "+t);var i=Error(r);i.code=n,a(i)}})},Object.defineProperty(t.prototype,"database",{get:function(){return this.__database||(this.__database=new h.Database(this))},enumerable:!0,configurable:!0}),t}();e.Repo=m},function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function t(o,r,t){this._e=o,this.ye=r,this.ve=t}return t.prototype.isFullyInitialized=function(){return this.ye},t.prototype.isFiltered=function(){return this.ve},t.prototype.isCompleteForPath=function(n){if(n.isEmpty())return this.isFullyInitialized()&&!this.ve;var e=n.getFront();return this.isCompleteForChild(e)},t.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.ve||this._e.hasChild(t)},t.prototype.getNode=function(){return this._e},t}();e.CacheNode=t},,function(m,e,t){"use strict";var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var r=t(35),g=t(82),o=t(1),b=t(83),a=t(36),i=t(18),s=t(2),l=t(107),c=t(7),p=t(0),d=t(0),u=t(47),h=function(a){function u(e,o){if(!(e instanceof i.Repo))throw Error("new Reference() no longer supported - use app.database().");return a.call(this,e,o,l.QueryParams.DEFAULT,!1)||this}return n(u,a),u.prototype.getKey=function(){return p.validateArgCount("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},u.prototype.child=function(t){return p.validateArgCount("Reference.child",1,1,arguments.length),"number"==typeof t?t+="":t instanceof s.Path||(null===this.path.getFront()?c.validateRootPathString("Reference.child",1,t,!1):c.validatePathString("Reference.child",1,t,!1)),new u(this.repo,this.path.child(t))},u.prototype.getParent=function(){p.validateArgCount("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new u(this.repo,t)},u.prototype.getRoot=function(){p.validateArgCount("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},u.prototype.databaseProp=function(){return this.repo.database},u.prototype.set=function(o,e){p.validateArgCount("Reference.set",1,2,arguments.length),c.validateWritablePath("Reference.set",this.path),c.validateFirebaseDataArg("Reference.set",1,o,this.path,!1),p.validateCallback("Reference.set",2,e,!0);var t=new d.Deferred;return this.repo.setWithPriority(this.path,o,null,t.wrapCallback(e)),t.promise},u.prototype.update=function(a,e){if(p.validateArgCount("Reference.update",1,2,arguments.length),c.validateWritablePath("Reference.update",this.path),Array.isArray(a)){for(var t={},n=0;n<a.length;++n)t[""+n]=a[n];a=t,o.warn("Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}c.validateFirebaseMergeDataArg("Reference.update",1,a,this.path,!1),p.validateCallback("Reference.update",2,e,!0);var r=new d.Deferred;return this.repo.update(this.path,a,r.wrapCallback(e)),r.promise},u.prototype.setWithPriority=function(o,e,t){if(p.validateArgCount("Reference.setWithPriority",2,3,arguments.length),c.validateWritablePath("Reference.setWithPriority",this.path),c.validateFirebaseDataArg("Reference.setWithPriority",1,o,this.path,!1),c.validatePriority("Reference.setWithPriority",2,e,!1),p.validateCallback("Reference.setWithPriority",3,t,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.setWithPriority failed: "+this.getKey()+" is a read-only object.";var n=new d.Deferred;return this.repo.setWithPriority(this.path,o,e,n.wrapCallback(t)),n.promise},u.prototype.remove=function(t){return p.validateArgCount("Reference.remove",0,1,arguments.length),c.validateWritablePath("Reference.remove",this.path),p.validateCallback("Reference.remove",1,t,!0),this.set(null,t)},u.prototype.transaction=function(o,a,e){if(p.validateArgCount("Reference.transaction",1,3,arguments.length),c.validateWritablePath("Reference.transaction",this.path),p.validateCallback("Reference.transaction",1,o,!1),p.validateCallback("Reference.transaction",2,a,!0),c.validateBoolean("Reference.transaction",3,e,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.transaction failed: "+this.getKey()+" is a read-only object.";void 0===e&&(e=!0);var s=new d.Deferred;"function"==typeof a&&s.promise.catch(function(){});return this.repo.startTransaction(this.path,o,function(o,e,n){o?s.reject(o):s.resolve(new g.TransactionResult(e,n)),"function"==typeof a&&a(o,e,n)},e),s.promise},u.prototype.setPriority=function(o,e){p.validateArgCount("Reference.setPriority",1,2,arguments.length),c.validateWritablePath("Reference.setPriority",this.path),c.validatePriority("Reference.setPriority",1,o,!1),p.validateCallback("Reference.setPriority",2,e,!0);var t=new d.Deferred;return this.repo.setWithPriority(this.path.child(".priority"),o,null,t.wrapCallback(e)),t.promise},u.prototype.push=function(s,e){p.validateArgCount("Reference.push",0,2,arguments.length),c.validateWritablePath("Reference.push",this.path),c.validateFirebaseDataArg("Reference.push",1,s,this.path,!0),p.validateCallback("Reference.push",2,e,!0);var d=this.repo.serverTime(),r=b.nextPushId(d),i=this.child(r),o=this.child(r),a;return a=null==s?Promise.resolve(o):i.set(s,e).then(function(){return o}),i.then=a.then.bind(a),i.catch=a.then.bind(a,void 0),"function"==typeof e&&a.catch(function(){}),i},u.prototype.onDisconnect=function(){return c.validateWritablePath("Reference.onDisconnect",this.path),new r.OnDisconnect(this.repo,this.path)},Object.defineProperty(u.prototype,"database",{get:function(){return this.databaseProp()},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"key",{get:function(){return this.getKey()},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"parent",{get:function(){return this.getParent()},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"root",{get:function(){return this.getRoot()},enumerable:!0,configurable:!0}),u}(a.Query);e.Reference=h,a.Query.__referenceConstructor=h,u.SyncPoint.__referenceConstructor=h},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=t(0),r=t(7),i=t(2),o=t(3),n=function(){function a(o,r,t){this._e=o,this.ge=r,this.me=t}return a.prototype.val=function(){return l.validateArgCount("DataSnapshot.val",0,0,arguments.length),this._e.val()},a.prototype.exportVal=function(){return l.validateArgCount("DataSnapshot.exportVal",0,0,arguments.length),this._e.val(!0)},a.prototype.toJSON=function(){return l.validateArgCount("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},a.prototype.exists=function(){return l.validateArgCount("DataSnapshot.exists",0,0,arguments.length),!this._e.isEmpty()},a.prototype.child=function(e){l.validateArgCount("DataSnapshot.child",0,1,arguments.length),e+="",r.validatePathString("DataSnapshot.child",1,e,!1);var t=new i.Path(e),n=this.ge.child(t);return new a(this._e.getChild(t),n,o.PRIORITY_INDEX)},a.prototype.hasChild=function(n){l.validateArgCount("DataSnapshot.hasChild",1,1,arguments.length),r.validatePathString("DataSnapshot.hasChild",1,n,!1);var e=new i.Path(n);return!this._e.getChild(e).isEmpty()},a.prototype.getPriority=function(){return l.validateArgCount("DataSnapshot.getPriority",0,0,arguments.length),this._e.getPriority().val()},a.prototype.forEach=function(e){var t=this;return l.validateArgCount("DataSnapshot.forEach",1,1,arguments.length),l.validateCallback("DataSnapshot.forEach",1,e,!1),!this._e.isLeafNode()&&!!this._e.forEachChild(this.me,function(n,r){return e(new a(r,t.ge.child(n),o.PRIORITY_INDEX))})},a.prototype.hasChildren=function(){return l.validateArgCount("DataSnapshot.hasChildren",0,0,arguments.length),!this._e.isLeafNode()&&!this._e.isEmpty()},Object.defineProperty(a.prototype,"key",{get:function(){return this.ge.getKey()},enumerable:!0,configurable:!0}),a.prototype.numChildren=function(){return l.validateArgCount("DataSnapshot.numChildren",0,0,arguments.length),this._e.numChildren()},a.prototype.getRef=function(){return l.validateArgCount("DataSnapshot.ref",0,0,arguments.length),this.ge},Object.defineProperty(a.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),a}();e.DataSnapshot=n},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(17),p=t(2),o=t(1),a=t(0),i=function(){return l||(l=new n.SortedMap(o.stringCompare)),l},s=function(){function s(n,o){void 0===o&&(o=i()),this.value=n,this.children=o}return s.fromObject=function(e){var o=s.Empty;return a.forEach(e,function(n,e){o=o.set(new p.Path(n),e)}),o},s.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},s.prototype.findRootMostMatchingPathAndValue=function(o,e){if(null!=this.value&&e(this.value))return{path:p.Path.Empty,value:this.value};if(o.isEmpty())return null;var t=o.getFront(),n=this.children.get(t);if(null!==n){var r=n.findRootMostMatchingPathAndValue(o.popFront(),e);return null==r?null:{path:new p.Path(t).child(r.path),value:r.value}}return null},s.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},s.prototype.subtree=function(e){if(e.isEmpty())return this;var t=e.getFront(),n=this.children.get(t);return null===n?s.Empty:n.subtree(e.popFront())},s.prototype.set=function(e,t){if(e.isEmpty())return new s(t,this.children);var n=e.getFront(),r=this.children.get(n)||s.Empty,i=r.set(e.popFront(),t),o=this.children.insert(n,i);return new s(this.value,o)},s.prototype.remove=function(e){if(e.isEmpty())return this.children.isEmpty()?s.Empty:new s(null,this.children);var t=e.getFront(),n=this.children.get(t);if(n){var r=n.remove(e.popFront()),a;return a=r.isEmpty()?this.children.remove(t):this.children.insert(t,r),null===this.value&&a.isEmpty()?s.Empty:new s(this.value,a)}return this},s.prototype.get=function(o){if(o.isEmpty())return this.value;var e=o.getFront(),t=this.children.get(e);return t?t.get(o.popFront()):null},s.prototype.setTree=function(e,t){if(e.isEmpty())return t;var n=e.getFront(),r=this.children.get(n)||s.Empty,i=r.setTree(e.popFront(),t),o;return o=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),new s(this.value,o)},s.prototype.fold=function(t){return this.Ce(p.Path.Empty,t)},s.prototype.Ce=function(o,e){var t={};return this.children.inorderTraversal(function(n,r){t[n]=r.Ce(o.child(n),e)}),e(o,this.value,t)},s.prototype.findOnPath=function(n,e){return this.Ee(n,p.Path.Empty,e)},s.prototype.Ee=function(a,e,t){var n=!!this.value&&t(e,this.value);if(n)return n;if(a.isEmpty())return null;var r=a.getFront(),i=this.children.get(r);return i?i.Ee(a.popFront(),e.child(r),t):null},s.prototype.foreachOnPath=function(n,e){return this.Ne(n,p.Path.Empty,e)},s.prototype.Ne=function(e,t,n){if(e.isEmpty())return this;this.value&&n(t,this.value);var r=e.getFront(),a=this.children.get(r);return a?a.Ne(e.popFront(),t.child(r),n):s.Empty},s.prototype.foreach=function(t){this.Pe(p.Path.Empty,t)},s.prototype.Pe=function(o,e){this.children.inorderTraversal(function(t,n){n.Pe(o.child(t),e)}),this.value&&e(o,this.value)},s.prototype.foreachChild=function(o){this.children.inorderTraversal(function(e,t){t.value&&o(e,t.value)})},s.Empty=new s(null),s}(),l;e.ImmutableTree=s},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=t(0),p=t(9),n=t(4),o=t(3),r=function(){function t(t){this.me=t}return t.prototype.updateChild=function(r,e,t,n,o,a){l.assert(r.isIndexed(this.me),"A node must be indexed if only a child is updated");var i=r.getImmediateChild(e);return i.getChild(n).equals(t.getChild(n))&&i.isEmpty()==t.isEmpty()?r:(null!=a&&(t.isEmpty()?r.hasChild(e)?a.trackChildChange(p.Change.childRemovedChange(e,i)):l.assert(r.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):i.isEmpty()?a.trackChildChange(p.Change.childAddedChange(e,t)):a.trackChildChange(p.Change.childChangedChange(e,t,i))),r.isLeafNode()&&t.isEmpty()?r:r.updateImmediateChild(e,t).withIndex(this.me))},t.prototype.updateFullNode=function(a,i,s){return null!=s&&(a.isLeafNode()||a.forEachChild(o.PRIORITY_INDEX,function(t,e){i.hasChild(t)||s.trackChildChange(p.Change.childRemovedChange(t,e))}),i.isLeafNode()||i.forEachChild(o.PRIORITY_INDEX,function(e,t){if(a.hasChild(e)){var n=a.getImmediateChild(e);n.equals(t)||s.trackChildChange(p.Change.childChangedChange(e,t,n))}else s.trackChildChange(p.Change.childAddedChange(e,t))})),i.withIndex(this.me)},t.prototype.updatePriority=function(o,e){return o.isEmpty()?n.ChildrenNode.EMPTY_NODE:o.updatePriority(e)},t.prototype.filtersNodes=function(){return!1},t.prototype.getIndexedFilter=function(){return this},t.prototype.getIndex=function(){return this.me},t}();e.IndexedFilter=r},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(99),r=function(){function t(){}return t.getCollection=function(o){var e=""+o;return this.be[e]||(this.be[e]=new n.StatsCollection),this.be[e]},t.getOrCreateReporter=function(o,e){var t=""+o;return this.Se[t]||(this.Se[t]=e()),this.Se[t]},t.be={},t.Se={},t}();e.StatsManager=r},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var p=t(0),r=t(18),c=t(1),o=t(33),a=t(7);t(109);var n=function(){function t(){this.Te={},this.we=!1}return t.getInstance=function(){return i||(i=new t),i},t.prototype.interrupt=function(){for(var n in this.Te)for(var e in this.Te[n])this.Te[n][e].interrupt()},t.prototype.resume=function(){for(var n in this.Te)for(var e in this.Te[n])this.Te[n][e].resume()},t.prototype.databaseFromApp=function(s,e){var t=e||s.options.databaseURL;void 0===t&&c.fatal("Can't determine Firebase Database URL. Be sure to include databaseURL option when calling firebase.intializeApp().");var n=o.parseRepoInfo(t),r=n.repoInfo;return a.validateUrl("Invalid Firebase Database URL",1,n),n.path.isEmpty()||c.fatal("Database URL must point to the root of a Firebase Database (not including a child path)."),this.createRepo(r,s).database},t.prototype.deleteRepo=function(n){var e=p.safeGet(this.Te,n.app.name);e&&p.safeGet(e,n.H.toURLString())===n||c.fatal("Database "+n.app.name+"("+n.H+") has already been deleted."),n.interrupt(),delete e[n.H.toURLString()]},t.prototype.createRepo=function(o,e){var t=p.safeGet(this.Te,e.name);t||(t={},this.Te[e.name]=t);var n=p.safeGet(t,o.toURLString());return n&&c.fatal("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),n=new r.Repo(o,this.we,e),t[o.toURLString()]=n,n},t.prototype.forceRestClient=function(t){this.we=t},t}(),i;e.RepoManager=n},,,,,,function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var m=t(1),r=t(33),n=t(2),o=t(21),a=t(18),i=t(26),s=t(0),l=t(7),u=function(){function t(t){this.Ie=t,t instanceof a.Repo||m.fatal("Don't call new Database() directly - please use firebase.database()."),this.B=new o.Reference(t,n.Path.Empty),this.INTERNAL=new c(this)}return Object.defineProperty(t.prototype,"app",{get:function(){return this.Ie.app},enumerable:!0,configurable:!0}),t.prototype.ref=function(t){return this.Re("ref"),s.validateArgCount("database.ref",0,1,arguments.length),void 0===t?this.B:this.B.child(t)},t.prototype.refFromURL=function(a){var e="database.refFromURL";this.Re(e),s.validateArgCount(e,1,1,arguments.length);var t=r.parseRepoInfo(a);l.validateUrl(e,1,t);var n=t.repoInfo;return n.host!==this.Ie.H.host&&m.fatal(e+": Host name does not match the current database: (found "+n.host+" but expected "+this.Ie.H.host+")"),this.ref(""+t.path)},t.prototype.Re=function(t){null===this.Ie&&m.fatal("Cannot call "+t+" on a deleted database.")},t.prototype.goOffline=function(){s.validateArgCount("database.goOffline",0,0,arguments.length),this.Re("goOffline"),this.Ie.interrupt()},t.prototype.goOnline=function(){s.validateArgCount("database.goOnline",0,0,arguments.length),this.Re("goOnline"),this.Ie.resume()},t.ServerValue={TIMESTAMP:{".sv":"timestamp"}},t}();e.Database=u;var c=function(){function t(t){this.database=t}return t.prototype.delete=function(){return this.database.Re("delete"),i.RepoManager.getInstance().deleteRepo(this.database.Ie),this.database.Ie=null,this.database.B=null,this.database.INTERNAL=null,this.database=null,Promise.resolve()},t}();e.DatabaseInternals=c},function(s,d,e){"use strict";function p(o){for(var e="",t=o.split("/"),n=0;n<t.length;n++)if(0<t[n].length){var a=t[n];try{a=decodeURIComponent(a.replace(/\+/g," "))}catch(t){}e+="/"+a}return e}Object.defineProperty(d,"__esModule",{value:!0});var t=e(2),i=e(34),o=e(1);d.parseRepoInfo=function(a){var e=d.parseURL(a),n=e.subdomain;"firebase"===e.domain&&o.fatal(e.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),n&&"undefined"!=n||o.fatal("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),e.secure||o.warnIfPageIsSecure();var r="ws"===e.scheme||"wss"===e.scheme;return{repoInfo:new i.RepoInfo(e.host,e.secure,n,r),path:new t.Path(e.pathString)}},d.parseURL=function(r){var d="",m="",g="",f="",y=!0,b="https",v=443;if("string"==typeof r){var x=r.indexOf("//");0<=x&&(b=r.substring(0,x-1),r=r.substring(x+2));var l=r.indexOf("/");-1===l&&(l=r.length),d=r.substring(0,l),f=p(r.substring(l));var h=d.split(".");3===h.length?(m=h[1],g=h[0].toLowerCase()):2===h.length&&(m=h[0]),0<=(x=d.indexOf(":"))&&(y="https"===b||"wss"===b,v=parseInt(d.substring(x+1),10))}return{host:d,port:v,domain:m,subdomain:g,secure:y,scheme:b,pathString:f}}},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=t(0),r=t(0),p=t(13),i=t(14),n=function(){function t(o,a,t,n,r){void 0===r&&(r=""),this.secure=a,this.namespace=t,this.webSocketOnly=n,this.persistenceKey=r,this.host=o.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=p.PersistentStorage.get("host:"+o)||this.host}return t.prototype.needsQueryParam=function(){return this.host!==this.internalHost},t.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},t.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},t.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},t.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&p.PersistentStorage.set("host:"+this.host,this.internalHost))},t.prototype.connectionURL=function(a,s){l.assert("string"==typeof a,"typeof type must == string"),l.assert("object"==typeof s,"typeof params must == object");var d;if(a===i.WEBSOCKET)d=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(a!==i.LONG_POLLING)throw Error("Unknown connection type: "+a);d=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(s.ns=this.namespace);var n=[];return r.forEach(s,function(o,e){n.push(o+"="+e)}),d+n.join("&")},t.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},t.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},t}();e.RepoInfo=n},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=t(0),r=t(7),i=t(1),p=t(0),n=function(){function t(n,o){this.Ie=n,this.Oe=o}return t.prototype.cancel=function(n){l.validateArgCount("OnDisconnect.cancel",0,1,arguments.length),l.validateCallback("OnDisconnect.cancel",1,n,!0);var e=new p.Deferred;return this.Ie.onDisconnectCancel(this.Oe,e.wrapCallback(n)),e.promise},t.prototype.remove=function(n){l.validateArgCount("OnDisconnect.remove",0,1,arguments.length),r.validateWritablePath("OnDisconnect.remove",this.Oe),l.validateCallback("OnDisconnect.remove",1,n,!0);var e=new p.Deferred;return this.Ie.onDisconnectSet(this.Oe,null,e.wrapCallback(n)),e.promise},t.prototype.set=function(o,e){l.validateArgCount("OnDisconnect.set",1,2,arguments.length),r.validateWritablePath("OnDisconnect.set",this.Oe),r.validateFirebaseDataArg("OnDisconnect.set",1,o,this.Oe,!1),l.validateCallback("OnDisconnect.set",2,e,!0);var t=new p.Deferred;return this.Ie.onDisconnectSet(this.Oe,o,t.wrapCallback(e)),t.promise},t.prototype.setWithPriority=function(a,e,t){l.validateArgCount("OnDisconnect.setWithPriority",2,3,arguments.length),r.validateWritablePath("OnDisconnect.setWithPriority",this.Oe),r.validateFirebaseDataArg("OnDisconnect.setWithPriority",1,a,this.Oe,!1),r.validatePriority("OnDisconnect.setWithPriority",2,e,!1),l.validateCallback("OnDisconnect.setWithPriority",3,t,!0);var n=new p.Deferred;return this.Ie.onDisconnectSetWithPriority(this.Oe,a,e,n.wrapCallback(t)),n.promise},t.prototype.update=function(o,e){if(l.validateArgCount("OnDisconnect.update",1,2,arguments.length),r.validateWritablePath("OnDisconnect.update",this.Oe),Array.isArray(o)){for(var t={},n=0;n<o.length;++n)t[""+n]=o[n];o=t,i.warn("Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}r.validateFirebaseMergeDataArg("OnDisconnect.update",1,o,this.Oe,!1),l.validateCallback("OnDisconnect.update",2,e,!0);var a=new p.Deferred;return this.Ie.onDisconnectUpdate(this.Oe,o,a.wrapCallback(e)),a.promise},t}();e.OnDisconnect=n},function(m,e,t){"use strict";var n=Math.floor;Object.defineProperty(e,"__esModule",{value:!0});var g=t(0),i=t(10),o=t(3),a=t(38),s=t(42),u=t(1),l=t(2),y=t(7),c=t(0),p=t(84),d=t(0),h=function(){function h(o,a,t,n){this.repo=o,this.path=a,this.Ae=t,this.De=n}return Object.defineProperty(h,"__referenceConstructor",{get:function(){return g.assert(f,"Reference.ts has not been loaded"),f},set:function(t){f=t},enumerable:!0,configurable:!0}),h.Me=function(d){var e=null,l=null;if(d.hasStart()&&(e=d.getIndexStartValue()),d.hasEnd()&&(l=d.getIndexEndValue()),d.getIndex()===i.KEY_INDEX){var p="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",r="Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.";if(d.hasStart()){if(d.getIndexStartName()!=u.MIN_NAME)throw Error(p);if("string"!=typeof e)throw Error(r)}if(d.hasEnd()){if(d.getIndexEndName()!=u.MAX_NAME)throw Error(p);if("string"!=typeof l)throw Error(r)}}else if(d.getIndex()===o.PRIORITY_INDEX){if(null!=e&&!y.isValidPriority(e)||null!=l&&!y.isValidPriority(l))throw Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).");}else if(g.assert(d.getIndex()instanceof s.PathIndex||d.getIndex()===a.VALUE_INDEX,"unknown index type."),null!=e&&"object"==typeof e||null!=l&&"object"==typeof l)throw Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},h.Le=function(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},h.prototype.Fe=function(t){if(!0===this.De)throw Error(t+": You can't combine multiple orderBy calls.")},h.prototype.getQueryParams=function(){return this.Ae},h.prototype.getRef=function(){return c.validateArgCount("Query.ref",0,0,arguments.length),new h.__referenceConstructor(this.repo,this.path)},h.prototype.on=function(e,t,n,r){c.validateArgCount("Query.on",2,4,arguments.length),y.validateEventType("Query.on",1,e,!1),c.validateCallback("Query.on",2,t,!1);var i=h.xe("Query.on",n,r);if("value"===e)this.onValueEvent(t,i.cancel,i.context);else{var o={};o[e]=t,this.onChildEvent(o,i.cancel,i.context)}return t},h.prototype.onValueEvent=function(o,e,t){var n=new p.ValueEventRegistration(o,e||null,t||null);this.repo.addEventCallbackForQuery(this,n)},h.prototype.onChildEvent=function(o,e,t){var n=new p.ChildEventRegistration(o,e,t);this.repo.addEventCallbackForQuery(this,n)},h.prototype.off=function(o,e,t){c.validateArgCount("Query.off",0,3,arguments.length),y.validateEventType("Query.off",1,o,!0),c.validateCallback("Query.off",2,e,!0),c.validateContextObject("Query.off",3,t,!0);var n=null,r=null;if("value"===o){n=new p.ValueEventRegistration(e||null,null,t||null)}else o&&(e&&(r={},r[o]=e),n=new p.ChildEventRegistration(r,null,t||null));this.repo.removeEventCallbackForQuery(this,n)},h.prototype.once=function(p,t,e,n){var r=this;c.validateArgCount("Query.once",1,4,arguments.length),y.validateEventType("Query.once",1,p,!1),c.validateCallback("Query.once",2,t,!0);var o=h.xe("Query.once",e,n),a=!0,i=new d.Deferred;i.promise.catch(function(){});var s=function(n){a&&(a=!1,r.off(p,s),t&&t.bind(o.context)(n),i.resolve(n))};return this.on(p,s,function(t){r.off(p,s),o.cancel&&o.cancel.bind(o.context)(t),i.reject(t)}),i.promise},h.prototype.limitToFirst=function(e){if(c.validateArgCount("Query.limitToFirst",1,1,arguments.length),"number"!=typeof e||n(e)!==e||0>=e)throw Error("Query.limitToFirst: First argument must be a positive integer.");if(this.Ae.hasLimit())throw Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new h(this.repo,this.path,this.Ae.limitToFirst(e),this.De)},h.prototype.limitToLast=function(e){if(c.validateArgCount("Query.limitToLast",1,1,arguments.length),"number"!=typeof e||n(e)!==e||0>=e)throw Error("Query.limitToLast: First argument must be a positive integer.");if(this.Ae.hasLimit())throw Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new h(this.repo,this.path,this.Ae.limitToLast(e),this.De)},h.prototype.orderByChild=function(e){if(c.validateArgCount("Query.orderByChild",1,1,arguments.length),"$key"===e)throw Error("Query.orderByChild: \"$key\" is invalid. Use Query.orderByKey() instead.");if("$priority"===e)throw Error("Query.orderByChild: \"$priority\" is invalid. Use Query.orderByPriority() instead.");if("$value"===e)throw Error("Query.orderByChild: \"$value\" is invalid. Use Query.orderByValue() instead.");y.validatePathString("Query.orderByChild",1,e,!1),this.Fe("Query.orderByChild");var t=new l.Path(e);if(t.isEmpty())throw Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");var n=new s.PathIndex(t),o=this.Ae.orderBy(n);return h.Me(o),new h(this.repo,this.path,o,!0)},h.prototype.orderByKey=function(){c.validateArgCount("Query.orderByKey",0,0,arguments.length),this.Fe("Query.orderByKey");var e=this.Ae.orderBy(i.KEY_INDEX);return h.Me(e),new h(this.repo,this.path,e,!0)},h.prototype.orderByPriority=function(){c.validateArgCount("Query.orderByPriority",0,0,arguments.length),this.Fe("Query.orderByPriority");var e=this.Ae.orderBy(o.PRIORITY_INDEX);return h.Me(e),new h(this.repo,this.path,e,!0)},h.prototype.orderByValue=function(){c.validateArgCount("Query.orderByValue",0,0,arguments.length),this.Fe("Query.orderByValue");var e=this.Ae.orderBy(a.VALUE_INDEX);return h.Me(e),new h(this.repo,this.path,e,!0)},h.prototype.startAt=function(e,t){void 0===e&&(e=null),c.validateArgCount("Query.startAt",0,2,arguments.length),y.validateFirebaseDataArg("Query.startAt",1,e,this.path,!0),y.validateKey("Query.startAt",2,t,!0);var n=this.Ae.startAt(e,t);if(h.Le(n),h.Me(n),this.Ae.hasStart())throw Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return void 0===e&&(e=null,t=null),new h(this.repo,this.path,n,this.De)},h.prototype.endAt=function(e,t){void 0===e&&(e=null),c.validateArgCount("Query.endAt",0,2,arguments.length),y.validateFirebaseDataArg("Query.endAt",1,e,this.path,!0),y.validateKey("Query.endAt",2,t,!0);var n=this.Ae.endAt(e,t);if(h.Le(n),h.Me(n),this.Ae.hasEnd())throw Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new h(this.repo,this.path,n,this.De)},h.prototype.equalTo=function(n,e){if(c.validateArgCount("Query.equalTo",1,2,arguments.length),y.validateFirebaseDataArg("Query.equalTo",1,n,this.path,!1),y.validateKey("Query.equalTo",2,e,!0),this.Ae.hasStart())throw Error("Query.equalTo: Starting point was already set (by another call to startAt or equalTo).");if(this.Ae.hasEnd())throw Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.startAt(n,e).endAt(n,e)},h.prototype.toString=function(){return c.validateArgCount("Query.toString",0,0,arguments.length),""+this.repo+this.path.toUrlEncodedString()},h.prototype.toJSON=function(){return c.validateArgCount("Query.toJSON",0,1,arguments.length),""+this},h.prototype.queryObject=function(){return this.Ae.getQueryObject()},h.prototype.queryIdentifier=function(){var n=this.queryObject(),e=u.ObjectToUniqueKey(n);return"{}"===e?"default":e},h.prototype.isEqual=function(e){if(c.validateArgCount("Query.isEqual",1,1,arguments.length),!(e instanceof h))throw Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.");var t=this.repo===e.repo,n=this.path.equals(e.path),o=this.queryIdentifier()===e.queryIdentifier();return t&&n&&o},h.xe=function(o,e,a){var n={cancel:null,context:null};if(e&&a)n.cancel=e,c.validateCallback(o,3,n.cancel,!0),n.context=a,c.validateContextObject(o,4,n.context,!0);else if(e)if("object"==typeof e&&null!==e)n.context=e;else{if("function"!=typeof e)throw Error(c.errorPrefix(o,3,!0)+" must either be a cancel callback or a context object.");n.cancel=e}return n},Object.defineProperty(h.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),h}(),f;e.Query=h},function(r,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0),o=t(1),a=t(0),s;e.setMaxNode=function(t){s=t},e.priorityHashText=function(t){return"number"==typeof t?"number:"+o.doubleToIEEE754String(t):"string:"+t},e.validatePriorityNode=function(o){if(o.isLeafNode()){var e=o.val();n.assert("string"==typeof e||"number"==typeof e||"object"==typeof e&&a.contains(e,".sv"),"Priority must be a string or number.")}else n.assert(o===s||o.isEmpty(),"priority of unexpected type.");n.assert(o===s||o.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")}},function(d,e,t){"use strict";var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var r=t(15),i=t(5),o=t(1),a=t(11),s=function(r){function e(){return null!==r&&r.apply(this,arguments)||this}return n(e,r),e.prototype.compare=function(r,e){var t=r.node.compareTo(e.node);return 0===t?o.nameCompare(r.name,e.name):t},e.prototype.isDefinedOn=function(){return!0},e.prototype.indexedValueChanged=function(n,e){return!n.equals(e)},e.prototype.minPost=function(){return i.NamedNode.MIN},e.prototype.maxPost=function(){return i.NamedNode.MAX},e.prototype.makePost=function(o,e){var t=a.nodeFromJSON(o);return new i.NamedNode(e,t)},e.prototype.toString=function(){return".value"},e}(r.Index);e.ValueIndex=s,e.VALUE_INDEX=new s},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var m=t(0),i=t(40),o=t(0),a=t(5),n=t(3),s=t(10),g={},l=function(){function l(n,o){this.ke=n,this.We=o}return Object.defineProperty(l,"Default",{get:function(){return m.assert(n.PRIORITY_INDEX,"ChildrenNode.ts has not been loaded"),p=p||new l({".priority":g},{".priority":n.PRIORITY_INDEX})},enumerable:!0,configurable:!0}),l.prototype.get=function(n){var e=o.safeGet(this.ke,n);if(!e)throw Error("No index defined for "+n);return e===g?null:e},l.prototype.hasIndex=function(t){return o.contains(this.We,""+t)},l.prototype.addIndex=function(e,t){m.assert(e!==s.KEY_INDEX,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var n=[],r=!1,u=t.getIterator(a.NamedNode.Wrap),c=u.getNext();c;)r=r||e.isDefinedOn(c.node),n.push(c),c=u.getNext();var p=r?i.buildChildSet(n,e.getCompare()):g;var d=""+e,h=o.clone(this.We);h[d]=e;var f=o.clone(this.ke);return f[d]=p,new l(f,h)},l.prototype.addToIndexes=function(s,t){var n=this;return new l(o.map(this.ke,function(r,e){var u=o.safeGet(n.We,e);if(m.assert(u,"Missing index implementation for "+e),r===g){if(u.isDefinedOn(s.node)){for(var l=[],c=t.getIterator(a.NamedNode.Wrap),p=c.getNext();p;)p.name!=s.name&&l.push(p),p=c.getNext();return l.push(s),i.buildChildSet(l,u.getCompare())}return g}var d=t.get(s.name),h=r;return d&&(h=h.remove(new a.NamedNode(s.name,d))),h.insert(s,s.node)}),this.We)},l.prototype.removeFromIndexes=function(i,t){return new l(o.map(this.ke,function(n){if(n===g)return n;var e=t.get(i.name);return e?n.remove(new a.NamedNode(i.name,e)):n}),this.We)},l}(),p;e.IndexMap=l},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var d=t(17),r=t(17),i=function(){function t(n){this.count=function(t){return parseInt(Math.log(t)/0.6931471805599453,10)}(n+1),this.je=this.count-1;var o=function(t){return parseInt(Array(t+1).join("1"),2)}(this.count);this.Ve=n+1&o}return t.prototype.nextBitIsOne=function(){var t=!(this.Ve&1<<this.je);return this.je--,t},t}();e.buildChildSet=function(m,e,g,t){m.sort(e);var n=function(e,t){var r=t-e,i,o;if(0==r)return null;if(1==r)return i=m[e],o=g?g(i):i,new d.LLRBNode(o,i.node,d.LLRBNode.BLACK,null,null);var a=parseInt(r/2,10)+e,s=n(e,a),l=n(a+1,t);return i=m[a],o=g?g(i):i,new d.LLRBNode(o,i.node,d.LLRBNode.BLACK,s,l)},o=new i(m.length),a=function(e){for(var t=null,r=null,s=m.length,o=function(e,t){var r=s-e,o=s;s-=e;var i=n(r+1,o),l=m[r],c=g?g(l):l;a(new d.LLRBNode(c,l.node,t,null,i))},a=function(n){t?(t.left=n,t=n):(r=n,t=n)},i=0;i<e.count;++i){var l=e.nextBitIsOne(),c=Math.pow(2,e.count-(i+1));l?o(c,d.LLRBNode.BLACK):(o(c,d.LLRBNode.BLACK),o(c,d.LLRBNode.RED))}return r}(o);return new r.SortedMap(t||e,a)}},function(r,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(1);e.NAME_ONLY_COMPARATOR=function(o,e){return n.nameCompare(o.name,e.name)},e.NAME_COMPARATOR=function(o,e){return n.nameCompare(o,e)}},function(d,e,t){"use strict";var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var r=t(0),p=t(1),o=t(15),a=t(4),i=t(5),s=t(11),l=function(o){function e(e){var a=o.call(this)||this;return a.Qe=e,r.assert(!e.isEmpty()&&".priority"!==e.getFront(),"Can't create PathIndex with empty path or .priority key"),a}return n(e,o),e.prototype.extractChild=function(t){return t.getChild(this.Qe)},e.prototype.isDefinedOn=function(t){return!t.getChild(this.Qe).isEmpty()},e.prototype.compare=function(o,e){var t=this.extractChild(o.node),n=this.extractChild(e.node),r=t.compareTo(n);return 0===r?p.nameCompare(o.name,e.name):r},e.prototype.makePost=function(o,e){var t=s.nodeFromJSON(o),n=a.ChildrenNode.EMPTY_NODE.updateChild(this.Qe,t);return new i.NamedNode(e,n)},e.prototype.maxPost=function(){var t=a.ChildrenNode.EMPTY_NODE.updateChild(this.Qe,a.MAX_NODE);return new i.NamedNode(p.MAX_NAME,t)},e.prototype.toString=function(){return this.Qe.slice().join("/")},e}(o.Index);e.PathIndex=l},function(d,p,e){"use strict";Object.defineProperty(p,"__esModule",{value:!0});var n=e(0),t=e(2),i=e(44),m=e(16),r=e(11),a=e(3);p.generateWithValues=function(t){return t=t||{},t.timestamp=t.timestamp||new Date().getTime(),t},p.resolveDeferredValue=function(o,r){return o&&"object"==typeof o?(n.assert(".sv"in o,"Unexpected leaf node or priority contents"),r[o[".sv"]]):o},p.resolveDeferredValueTree=function(o,a){var n=new i.SparseSnapshotTree;return o.forEachTree(new t.Path(""),function(t,e){n.remember(t,p.resolveDeferredValueSnapshot(e,a))}),n},p.resolveDeferredValueSnapshot=function(t,s){var e=t.getPriority().val(),n=p.resolveDeferredValue(e,s),d;if(t.isLeafNode()){var o=t,i=p.resolveDeferredValue(o.getValue(),s);return i!==o.getValue()||n!==o.getPriority().val()?new m.LeafNode(i,r.nodeFromJSON(n)):t}var l=t;return d=l,n!==l.getPriority().val()&&(d=d.updatePriority(new m.LeafNode(n))),l.forEachChild(a.PRIORITY_INDEX,function(t,e){var n=p.resolveDeferredValueSnapshot(e,s);n!==e&&(d=d.updateImmediateChild(t,n))}),d}},function(s,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var d=t(2),r=t(3),l=t(45),n=function(){function o(){this.T=null,this._=null}return o.prototype.find=function(n){if(null!=this.T)return this.T.getChild(n);if(n.isEmpty()||null==this._)return null;var e=n.getFront();return n=n.popFront(),this._.contains(e)?this._.get(e).find(n):null},o.prototype.remember=function(e,t){if(e.isEmpty())this.T=t,this._=null;else if(null!==this.T)this.T=this.T.updateChild(e,t);else{null==this._&&(this._=new l.CountedSet);var n=e.getFront();this._.contains(n)||this._.add(n,new o);var r=this._.get(n);e=e.popFront(),r.remember(e,t)}},o.prototype.forget=function(a){if(a.isEmpty())return this.T=null,this._=null,!0;if(null!==this.T){if(this.T.isLeafNode())return!1;var e=this.T;this.T=null;var i=this;return e.forEachChild(r.PRIORITY_INDEX,function(n,e){i.remember(new d.Path(n),e)}),this.forget(a)}if(null!==this._){var t=a.getFront();return a=a.popFront(),this._.contains(t)&&this._.get(t).forget(a)&&this._.remove(t),!!this._.isEmpty()&&(this._=null,!0)}return!0},o.prototype.forEachTree=function(r,e){null===this.T?this.forEachChild(function(t,n){var a=new d.Path(r+"/"+t);n.forEachTree(a,e)}):e(r,this.T)},o.prototype.forEachChild=function(o){null!==this._&&this._.each(function(e,t){o(e,t)})},o}();e.SparseSnapshotTree=n},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0),r=function(){function t(){this.set={}}return t.prototype.add=function(n,e){this.set[n]=null===e||e},t.prototype.contains=function(t){return n.contains(this.set,t)},t.prototype.get=function(t){return this.contains(t)?this.set[t]:void 0},t.prototype.remove=function(t){delete this.set[t]},t.prototype.clear=function(){this.set={}},t.prototype.isEmpty=function(){return n.isEmpty(this.set)},t.prototype.count=function(){return n.getCount(this.set)},t.prototype.each=function(o){n.forEach(this.set,function(e,t){return o(e,t)})},t.prototype.keys=function(){var o=[];return n.forEach(this.set,function(e){o.push(e)}),o},t}();e.CountedSet=r},function(a,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=t(8),n=t(2),r=function(){function o(o,r,t){this.source=o,this.path=r,this.snap=t,this.type=s.OperationType.OVERWRITE}return o.prototype.operationForChild=function(e){return this.path.isEmpty()?new o(this.source,n.Path.Empty,this.snap.getImmediateChild(e)):new o(this.source,this.path.popFront(),this.snap)},o}();e.Overwrite=r},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var m=t(19),i=t(4),o=t(0),g=t(0),s=t(48),u=t(90),n=function(){function d(){this.qe={}}return Object.defineProperty(d,"__referenceConstructor",{get:function(){return o.assert(a,"Reference.ts has not been loaded"),a},set:function(t){o.assert(!a,"__referenceConstructor has already been defined"),a=t},enumerable:!0,configurable:!0}),d.prototype.isEmpty=function(){return g.isEmpty(this.qe)},d.prototype.applyOperation=function(a,e,t){var n=a.source.queryId;if(null!==n){var r=g.safeGet(this.qe,n);return o.assert(null!=r,"SyncTree gave us an op for an invalid query."),r.applyOperation(a,e,t)}var s=[];return g.forEach(this.qe,function(n,o){s=s.concat(o.applyOperation(a,e,t))}),s},d.prototype.addEventRegistration=function(o,e,t,n,r){var a=o.queryIdentifier(),l=g.safeGet(this.qe,a);if(!l){var h=t.calcCompleteEventCache(r?n:null),p=!1;h?p=!0:n instanceof i.ChildrenNode?(h=t.calcCompleteEventChildren(n),p=!1):(h=i.ChildrenNode.EMPTY_NODE,p=!1);var d=new s.ViewCache(new m.CacheNode(h,p,!1),new m.CacheNode(n,r,!1));l=new u.View(o,d),this.qe[a]=l}return l.addEventRegistration(e),l.getInitialEvents(e)},d.prototype.removeEventRegistration=function(e,s,n){var t=e.queryIdentifier(),r=[],i=[],p=this.hasCompleteView();if("default"===t){var c=this;g.forEach(this.qe,function(o,e){i=i.concat(e.removeEventRegistration(s,n)),e.isEmpty()&&(delete c.qe[o],e.getQuery().getQueryParams().loadsAllData()||r.push(e.getQuery()))})}else{var l=g.safeGet(this.qe,t);l&&(i=i.concat(l.removeEventRegistration(s,n)),l.isEmpty()&&(delete this.qe[t],l.getQuery().getQueryParams().loadsAllData()||r.push(l.getQuery())))}return p&&!this.hasCompleteView()&&r.push(new d.__referenceConstructor(e.repo,e.path)),{removed:r,events:i}},d.prototype.getQueryViews=function(){var n=this;return Object.keys(this.qe).map(function(e){return n.qe[e]}).filter(function(t){return!t.getQuery().getQueryParams().loadsAllData()})},d.prototype.getCompleteServerCache=function(o){var e=null;return g.forEach(this.qe,function(t,n){e=e||n.getCompleteServerCache(o)}),e},d.prototype.viewForQuery=function(n){if(n.getQueryParams().loadsAllData())return this.getCompleteView();var e=n.queryIdentifier();return g.safeGet(this.qe,e)},d.prototype.viewExistsForQuery=function(t){return null!=this.viewForQuery(t)},d.prototype.hasCompleteView=function(){return null!=this.getCompleteView()},d.prototype.getCompleteView=function(){return g.findValue(this.qe,function(t){return t.getQuery().getQueryParams().loadsAllData()})||null},d}(),a;e.SyncPoint=n},function(a,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(4),s=t(19),r=function(){function o(n,o){this.Ue=n,this.Be=o}return o.prototype.updateEventSnap=function(e,t,n){return new o(new s.CacheNode(e,t,n),this.Be)},o.prototype.updateServerSnap=function(e,t,n){return new o(this.Ue,new s.CacheNode(e,t,n))},o.prototype.getEventCache=function(){return this.Ue},o.prototype.getCompleteEventSnap=function(){return this.Ue.isFullyInitialized()?this.Ue.getNode():null},o.prototype.getServerCache=function(){return this.Be},o.prototype.getCompleteServerSnap=function(){return this.Be.isFullyInitialized()?this.Be.getNode():null},o.Empty=new o(new s.CacheNode(n.ChildrenNode.EMPTY_NODE,!1,!1),new s.CacheNode(n.ChildrenNode.EMPTY_NODE,!1,!1)),o}();e.ViewCache=r},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0),r=function(){function t(t){this.He=t,this.Ge=null}return t.prototype.get=function(){var o=this.He.get(),r=n.clone(o);return this.Ge&&n.forEach(this.Ge,function(t,e){r[t]-=e}),this.Ge=o,r},t}();e.StatsListener=r},function(g,e,t){"use strict";var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var r=t(6),b=t(0),o=t(0),x=t(0),C=t(1),a=t(2),u=t(102),h=t(103),i=t(0),s=t(52),d=t(0),p=t(0),l=t(55),c=1e3,f=function(m){function g(e,t,n,r,o,a){var i=m.call(this)||this;if(i.H=e,i.ee=t,i.te=n,i.ne=r,i.Ke=o,i.Ye=a,i.id=g.Xe++,i.de=C.logWrapper("p:"+i.id+":"),i.ze={},i.Je={},i.$e=[],i.Ze=0,i.et=[],i.tt=!1,i.nt=c,i.rt=3e5,i.it=null,i.lastSessionId=null,i.ot=null,i.at=!1,i.st={},i.ut=0,i.lt=null,i.ht=null,i.ct=!1,i.pt=0,i.dt=!0,i.ft=null,i._t=null,a&&!p.isNodeSdk())throw Error("Auth override specified in options, but not supported on non Node.js platforms");return i.yt(0),u.VisibilityMonitor.getInstance().on("visible",i.vt,i),-1===e.host.indexOf("fblocal")&&h.OnlineMonitor.getInstance().on("online",i.gt,i),i}return n(g,m),g.prototype.sendRequest=function(a,s,d){var n=++this.ut,l={r:n,a:a,b:s};this.de(o.stringify(l)),x.assert(this.tt,"sendRequest call when we're not connected not allowed."),this.lt.sendRequest(l),d&&(this.st[n]=d)},g.prototype.listen=function(s,d,l,p){var c=s.queryIdentifier(),i=""+s.path;this.de("Listen called for "+i+" "+c),this.Je[i]=this.Je[i]||{},x.assert(s.getQueryParams().isDefault()||!s.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),x.assert(!this.Je[i][c],"listen() called twice for same path/queryId.");var o={onComplete:p,hashFn:d,query:s,tag:l};this.Je[i][c]=o,this.tt&&this.mt(o)},g.prototype.mt=function(t){var e=this,n=t.query,r=""+n.path,d=n.queryIdentifier();this.de("Listen on "+r+" for "+d);var o={p:r};t.tag&&(o.q=n.queryObject(),o.t=t.tag),o.h=t.hashFn(),this.sendRequest("q",o,function(o){var a=o.d,i=o.s;g.Ct(a,n),(e.Je[r]&&e.Je[r][d])===t&&(e.de("listen response",o),"ok"!==i&&e.Et(r,d),t.onComplete&&t.onComplete(i,a))})},g.Ct=function(o,a){if(o&&"object"==typeof o&&b.contains(o,"w")){var t=b.safeGet(o,"w");if(Array.isArray(t)&&~t.indexOf("no_index")){var n="\".indexOn\": \""+a.getQueryParams().getIndex()+"\"",r=""+a.path;C.warn("Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding "+n+" at "+r+" to your security rules for better performance.")}}},g.prototype.refreshAuthToken=function(t){this.ht=t,this.de("Auth token refreshed"),this.ht?this.tryAuth():this.tt&&this.sendRequest("unauth",{},function(){}),this.Nt(t)},g.prototype.Nt=function(t){(t&&40===t.length||i.isAdmin(t))&&(this.de("Admin auth credential detected. Reducing max reconnect time."),this.rt=3e4)},g.prototype.tryAuth=function(){var o=this;if(this.tt&&this.ht){var e=this.ht,a=i.isValidFormat(e)?"auth":"gauth",n={cred:e};null===this.Ye?n.noauth=!0:"object"==typeof this.Ye&&(n.authvar=this.Ye),this.sendRequest(a,n,function(t){var n=t.s,r=t.d||"error";o.ht===e&&("ok"===n?o.pt=0:o.Pt(n,r))})}},g.prototype.unlisten=function(o,e){var t=""+o.path,n=o.queryIdentifier();this.de("Unlisten called for "+t+" "+n),x.assert(o.getQueryParams().isDefault()||!o.getQueryParams().loadsAllData(),"unlisten() called for non-default but complete query"),this.Et(t,n)&&this.tt&&this.bt(t,n,o.queryObject(),e)},g.prototype.bt=function(o,a,t,n){this.de("Unlisten on "+o+" for "+a);var r={p:o};n&&(r.q=t,r.t=n),this.sendRequest("n",r)},g.prototype.onDisconnectPut=function(o,r,a){this.tt?this.St("o",o,r,a):this.et.push({pathString:o,action:"o",data:r,onComplete:a})},g.prototype.onDisconnectMerge=function(o,r,a){this.tt?this.St("om",o,r,a):this.et.push({pathString:o,action:"om",data:r,onComplete:a})},g.prototype.onDisconnectCancel=function(n,o){this.tt?this.St("oc",n,null,o):this.et.push({pathString:n,action:"oc",data:null,onComplete:o})},g.prototype.St=function(o,e,a,s){var r={p:e,d:a};this.de("onDisconnect "+o,r),this.sendRequest(o,r,function(t){s&&setTimeout(function(){s(t.s,t.d)},0)})},g.prototype.put=function(o,e,t,n){this.putInternal("p",o,e,t,n)},g.prototype.merge=function(o,e,t,n){this.putInternal("m",o,e,t,n)},g.prototype.putInternal=function(s,d,l,p,c){var i={p:d,d:l};void 0!==c&&(i.h=c),this.$e.push({action:s,request:i,onComplete:p}),this.Ze++;var u=this.$e.length-1;this.tt?this.Tt(u):this.de("Buffering put: "+d)},g.prototype.Tt=function(o){var e=this,t=this.$e[o].action,n=this.$e[o].request,a=this.$e[o].onComplete;this.$e[o].queued=this.tt,this.sendRequest(t,n,function(n){e.de(t+" response",n),delete e.$e[o],e.Ze--,0===e.Ze&&(e.$e=[]),a&&a(n.s,n.d)})},g.prototype.reportStats=function(o){var r=this;if(this.tt){var t={c:o};this.de("reportStats",t),this.sendRequest("s",t,function(t){if("ok"!==t.s){var e=t.d;r.de("reportStats","Error sending stats: "+e)}})}},g.prototype.wt=function(r){if("r"in r){this.de("from server: "+o.stringify(r));var e=r.r,t=this.st[e];t&&(delete this.st[e],t(r.b))}else{if("error"in r)throw"A server-side error has occurred: "+r.error;"a"in r&&this.It(r.a,r.b)}},g.prototype.It=function(n,e){this.de("handleServerMessage",n,e),"d"===n?this.ee(e.p,e.d,!1,e.t):"m"===n?this.ee(e.p,e.d,!0,e.t):"c"===n?this.Rt(e.p,e.q):"ac"===n?this.Pt(e.s,e.d):"sd"===n?this.Ot(e):C.error("Unrecognized action received from server: "+o.stringify(n)+"\nAre you using the latest client?")},g.prototype.At=function(n,e){this.de("connection ready"),this.tt=!0,this._t=new Date().getTime(),this.Dt(n),this.lastSessionId=e,this.dt&&this.Mt(),this.Lt(),this.dt=!1,this.te(!0)},g.prototype.yt=function(n){var e=this;x.assert(!this.lt,"Scheduling a connect when we're already connected/ing?"),this.ot&&clearTimeout(this.ot),this.ot=setTimeout(function(){e.ot=null,e.Ft()},Math.floor(n))},g.prototype.vt=function(t){t&&!this.at&&this.nt===this.rt&&(this.de("Window became visible. Reducing delay."),this.nt=c,this.lt||this.yt(0)),this.at=t},g.prototype.gt=function(t){t?(this.de("Browser went online."),this.nt=c,this.lt||this.yt(0)):(this.de("Browser went offline. Killing connection."),this.lt&&this.lt.close())},g.prototype.xt=function(){if(this.de("data client disconnected"),this.tt=!1,this.lt=null,this.kt(),this.st={},this.Wt()){if(!this.at)this.de("Window isn't visible. Delaying reconnect."),this.nt=this.rt,this.ft=new Date().getTime();else if(this._t){var o=new Date().getTime()-this._t;3e4<o&&(this.nt=c),this._t=null}var e=new Date().getTime()-this.ft,t=Math.max(0,this.nt-e);t=Math.random()*t,this.de("Trying to reconnect in "+t+"ms"),this.yt(t),this.nt=Math.min(this.rt,1.3*this.nt)}this.te(!1)},g.prototype.Ft=function(){if(this.Wt()){this.de("Making a connection attempt"),this.ft=new Date().getTime(),this._t=null;var u=this.wt.bind(this),e=this.At.bind(this),n=this.xt.bind(this),r=this.id+":"+g.jt++,i=this,o=this.lastSessionId,a=!1,l=null,t=function(){l?l.close():(a=!0,n())},h=function(t){x.assert(l,"sendRequest call when we're not connected not allowed."),l.sendRequest(t)};this.lt={close:t,sendRequest:h};var m=this.ct;this.ct=!1,this.Ke.getToken(m).then(function(d){a?C.log("getToken() completed but was canceled"):(C.log("getToken() completed. Creating connection."),i.ht=d&&d.accessToken,l=new s.Connection(r,i.H,u,e,n,function(t){C.warn(t+" ("+i.H+")"),i.interrupt("server_kill")},o))}).then(null,function(n){i.de("Failed to get token: "+n),a||(d.CONSTANTS.NODE_ADMIN&&C.warn(n),t())})}},g.prototype.interrupt=function(t){C.log("Interrupting connection for reason: "+t),this.ze[t]=!0,this.lt?this.lt.close():(this.ot&&(clearTimeout(this.ot),this.ot=null),this.tt&&this.xt())},g.prototype.resume=function(t){C.log("Resuming connection for reason: "+t),delete this.ze[t],b.isEmpty(this.ze)&&(this.nt=c,this.lt||this.yt(0))},g.prototype.Dt=function(n){var e=n-new Date().getTime();this.ne({serverTimeOffset:e})},g.prototype.kt=function(){for(var n=0,e;n<this.$e.length;n++)e=this.$e[n],e&&"h"in e.request&&e.queued&&(e.onComplete&&e.onComplete("disconnect"),delete this.$e[n],this.Ze--);0===this.Ze&&(this.$e=[])},g.prototype.Rt=function(o,e){var t=e?e.map(function(t){return C.ObjectToUniqueKey(t)}).join("$"):"default";var n=this.Et(o,t);n&&n.onComplete&&n.onComplete("permission_denied")},g.prototype.Et=function(o,e){var t=""+new a.Path(o),r;return void 0===this.Je[t]?r=void 0:(r=this.Je[t][e],delete this.Je[t][e],0===b.getCount(this.Je[t])&&delete this.Je[t]),r},g.prototype.Pt=function(n,e){C.log("Auth token revoked: "+n+"/"+e),this.ht=null,this.ct=!0,this.lt.close(),"invalid_token"!==n&&"permission_denied"!==n||3<=++this.pt&&(this.nt=3e4,this.Ke.notifyForInvalidToken())},g.prototype.Ot=function(t){this.it?this.it(t):"msg"in t&&"undefined"!=typeof console&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},g.prototype.Lt=function(){var o=this;this.tryAuth(),b.forEach(this.Je,function(e,t){b.forEach(t,function(e,t){o.mt(t)})});for(var e=0;e<this.$e.length;e++)this.$e[e]&&this.Tt(e);for(;this.et.length;){var t=this.et.shift();this.St(t.action,t.pathString,t.data,t.onComplete)}},g.prototype.Mt=function(){var n={},e="js";d.CONSTANTS.NODE_ADMIN?e="admin_node":d.CONSTANTS.NODE_CLIENT&&(e="node"),n["sdk."+e+"."+r.default.SDK_VERSION.replace(/\./g,"-")]=1,p.isMobileCordova()?n["framework.cordova"]=1:p.isReactNative()&&(n["framework.reactnative"]=1),this.reportStats(n)},g.prototype.Wt=function(){var t=h.OnlineMonitor.getInstance().currentlyOnline();return b.isEmpty(this.ze)&&t},g.Xe=0,g.jt=0,g}(l.ServerActions);e.PersistentConnection=f},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0),r=function(){function t(t){this.Vt=t,this.Qt={},n.assert(Array.isArray(t)&&0<t.length,"Requires a non-empty array")}return t.prototype.trigger=function(o){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];if(Array.isArray(this.Qt[o]))for(var n=this.Qt[o].slice(),r=0;r<n.length;r++)n[r].callback.apply(n[r].context,e)},t.prototype.on=function(o,e,a){this.qt(o),this.Qt[o]=this.Qt[o]||[],this.Qt[o].push({callback:e,context:a});var i=this.getInitialEvent(o);i&&e.apply(a,i)},t.prototype.off=function(o,e,t){this.qt(o);for(var a=this.Qt[o]||[],r=0;r<a.length;r++)if(a[r].callback===e&&(!t||t===a[r].context))return void a.splice(r,1)},t.prototype.qt=function(o){n.assert(this.Vt.find(function(e){return e===o}),"Unknown event: "+o)},t}();e.EventEmitter=r},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=t(1),n=t(13),r=t(14),p=t(104),o=function(){function t(r,a,t,n,i,o,s){this.id=r,this.H=a,this.Ut=t,this.At=n,this.z=i,this.Bt=o,this.lastSessionId=s,this.connectionCount=0,this.pendingDataMessages=[],this.Ht=0,this.de=l.logWrapper("c:"+this.id+":"),this.Gt=new p.TransportManager(a),this.de("Connection created"),this.Kt()}return t.prototype.Kt=function(){var r=this,e=this.Gt.initialTransport();this.Yt=new e(this.Xt(),this.H,void 0,this.lastSessionId),this.zt=e.responsesRequiredToBeHealthy||0;var t=this.Jt(this.Yt),n=this.$t(this.Yt);this.Zt=this.Yt,this.en=this.Yt,this.tn=null,this.nn=!1,setTimeout(function(){r.Yt&&r.Yt.open(t,n)},0);var a=e.healthyTimeout||0;0<a&&(this.rn=l.setTimeoutNonBlocking(function(){r.rn=null,r.nn||(r.Yt&&102400<r.Yt.bytesReceived?(r.de("Connection exceeded healthy timeout but has received "+r.Yt.bytesReceived+" bytes. Marking connection healthy."),r.nn=!0,r.Yt.markConnectionHealthy()):r.Yt&&10240<r.Yt.bytesSent?r.de("Connection exceeded healthy timeout but has sent "+r.Yt.bytesSent+" bytes. Leaving connection alive."):(r.de("Closing unhealthy connection after timeout."),r.close()))},Math.floor(a)))},t.prototype.Xt=function(){return"c:"+this.id+":"+this.connectionCount++},t.prototype.$t=function(o){var e=this;return function(t){o===e.Yt?e.in(t):o===e.tn?(e.de("Secondary connection lost."),e.an()):e.de("closing an old connection")}},t.prototype.Jt=function(o){var e=this;return function(t){2!=e.Ht&&(o===e.en?e.sn(t):o===e.tn?e.un(t):e.de("message on old connection"))}},t.prototype.sendRequest=function(t){this.ln({t:"d",d:t})},t.prototype.tryCleanupConnection=function(){this.Zt===this.tn&&this.en===this.tn&&(this.de("cleaning up and promoting a connection: "+this.tn.connId),this.Yt=this.tn,this.tn=null)},t.prototype.hn=function(n){if("t"in n){var e=n.t;"a"===e?this.cn():"r"===e?(this.de("Got a reset on secondary, closing it"),this.tn.close(),this.Zt!==this.tn&&this.en!==this.tn||this.close()):"o"===e&&(this.de("got pong on secondary."),this.pn--,this.cn())}},t.prototype.un=function(o){var e=l.requireKey("t",o),t=l.requireKey("d",o);if("c"==e)this.hn(t);else{if("d"!=e)throw Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(t)}},t.prototype.cn=function(){0>=this.pn?(this.de("Secondary connection is healthy."),this.nn=!0,this.tn.markConnectionHealthy(),this.dn()):(this.de("sending ping on secondary."),this.tn.send({t:"c",d:{t:"p",d:{}}}))},t.prototype.dn=function(){this.tn.start(),this.de("sending client ack on secondary"),this.tn.send({t:"c",d:{t:"a",d:{}}}),this.de("Ending transmission on primary"),this.Yt.send({t:"c",d:{t:"n",d:{}}}),this.Zt=this.tn,this.tryCleanupConnection()},t.prototype.sn=function(o){var e=l.requireKey("t",o),t=l.requireKey("d",o);"c"==e?this.fn(t):"d"==e&&this.wt(t)},t.prototype.wt=function(t){this._n(),this.Ut(t)},t.prototype._n=function(){this.nn||0>=--this.zt&&(this.de("Primary connection is healthy."),this.nn=!0,this.Yt.markConnectionHealthy())},t.prototype.fn=function(o){var e=l.requireKey("t",o);if("d"in o){var t=o.d;if("h"===e)this.yn(t);else if("n"===e){this.de("recvd end transmission on primary"),this.en=this.tn;for(var n=0;n<this.pendingDataMessages.length;++n)this.wt(this.pendingDataMessages[n]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===e?this.vn(t):"r"===e?this.gn(t):"e"===e?l.error("Server Error: "+t):"o"===e?(this.de("got pong on primary."),this._n(),this.mn()):l.error("Unknown control packet command: "+e)}},t.prototype.yn=function(o){var e=o.ts,t=o.v,n=o.h;this.sessionId=o.s,this.H.updateHost(n),0==this.Ht&&(this.Yt.start(),this.Cn(this.Yt,e),r.PROTOCOL_VERSION!==t&&l.warn("Protocol version mismatch detected"),this.En())},t.prototype.En=function(){var t=this.Gt.upgradeTransport();t&&this.Nn(t)},t.prototype.Nn=function(o){var e=this;this.tn=new o(this.Xt(),this.H,this.sessionId),this.pn=o.responsesRequiredToBeHealthy||0;var t=this.Jt(this.tn),n=this.$t(this.tn);this.tn.open(t,n),l.setTimeoutNonBlocking(function(){e.tn&&(e.de("Timed out trying to upgrade."),e.tn.close())},60000)},t.prototype.gn=function(t){this.de("Reset packet received. New host: "+t),this.H.updateHost(t),1===this.Ht?this.close():(this.Pn(),this.Kt())},t.prototype.Cn=function(o,e){var t=this;this.de("Realtime connection established."),this.Yt=o,this.Ht=1,this.At&&(this.At(e,this.sessionId),this.At=null),0===this.zt?(this.de("Primary connection is healthy."),this.nn=!0):l.setTimeoutNonBlocking(function(){t.mn()},5000)},t.prototype.mn=function(){this.nn||1!==this.Ht||(this.de("sending ping on primary."),this.ln({t:"c",d:{t:"p",d:{}}}))},t.prototype.an=function(){var t=this.tn;this.tn=null,this.Zt!==t&&this.en!==t||this.close()},t.prototype.in=function(t){this.Yt=null,t||0!==this.Ht?1===this.Ht&&this.de("Realtime connection lost."):(this.de("Realtime connection failed."),this.H.isCacheableHost()&&(n.PersistentStorage.remove("host:"+this.H.host),this.H.internalHost=this.H.host)),this.close()},t.prototype.vn=function(t){this.de("Connection shutdown command received. Shutting down..."),this.Bt&&(this.Bt(t),this.Bt=null),this.z=null,this.close()},t.prototype.ln=function(t){if(1!==this.Ht)throw"Connection is not connected";this.Zt.send(t)},t.prototype.close=function(){2!==this.Ht&&(this.de("Closing realtime connection."),this.Ht=2,this.Pn(),this.z&&(this.z(),this.z=null))},t.prototype.Pn=function(){this.de("Shutting down all connections"),this.Yt&&(this.Yt.close(),this.Yt=null),this.tn&&(this.tn.close(),this.tn=null),this.rn&&(clearTimeout(this.rn),this.rn=null)},t}();e.Connection=o},function(d,p,e){"use strict";var t=Math.floor;Object.defineProperty(p,"__esModule",{value:!0});var m=e(1),r=e(45),g=e(25),o=e(105),a=e(14),s=e(0),f=e(0);p.FIREBASE_LONGPOLL_START_PARAM="start",p.FIREBASE_LONGPOLL_CLOSE_COMMAND="close",p.FIREBASE_LONGPOLL_COMMAND_CB_NAME="pLPCommand",p.FIREBASE_LONGPOLL_DATA_CB_NAME="pRTLPCB",p.FIREBASE_LONGPOLL_ID_PARAM="id",p.FIREBASE_LONGPOLL_PW_PARAM="pw",p.FIREBASE_LONGPOLL_SERIAL_PARAM="ser",p.FIREBASE_LONGPOLL_CALLBACK_ID_PARAM="cb",p.FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM="seg",p.FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET="ts",p.FIREBASE_LONGPOLL_DATA_PARAM="d",p.FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM="disconn",p.FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM="dframe";var n=function(){function n(o,r,t,n){this.connId=o,this.repoInfo=r,this.transportSessionId=t,this.lastSessionId=n,this.bytesSent=0,this.bytesReceived=0,this.bn=!1,this.de=m.logWrapper(o),this.$=g.StatsManager.getCollection(r),this.urlFn=function(t){return r.connectionURL(a.LONG_POLLING,t)}}return n.prototype.open=function(r,e){var s=this;this.curSegmentNum=0,this.z=e,this.myPacketOrderer=new o.PacketReceiver(r),this.Sn=!1,this.Tn=setTimeout(function(){s.de("Timed out trying to connect."),s.wn(),s.Tn=null},30000),m.executeWhenDOMReady(function(){if(!s.Sn){s.scriptTagHolder=new l(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[0],r=t[1],o=t[2];if(t[3],t[4],s.In(t),s.scriptTagHolder)if(s.Tn&&(clearTimeout(s.Tn),s.Tn=null),s.bn=!0,n==p.FIREBASE_LONGPOLL_START_PARAM)s.id=r,s.password=o;else{if(n!==p.FIREBASE_LONGPOLL_CLOSE_COMMAND)throw Error("Unrecognized command received: "+n);r?(s.scriptTagHolder.sendNewPolls=!1,s.myPacketOrderer.closeAfter(r,function(){s.wn()})):s.wn()}},function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];var t=o[0],n=o[1];s.In(o),s.myPacketOrderer.handleResponse(t,n)},function(){s.wn()},s.urlFn);var o={};o[p.FIREBASE_LONGPOLL_START_PARAM]="t",o[p.FIREBASE_LONGPOLL_SERIAL_PARAM]=t(1e8*Math.random()),s.scriptTagHolder.uniqueCallbackIdentifier&&(o[p.FIREBASE_LONGPOLL_CALLBACK_ID_PARAM]=s.scriptTagHolder.uniqueCallbackIdentifier),o[a.VERSION_PARAM]=a.PROTOCOL_VERSION,s.transportSessionId&&(o[a.TRANSPORT_SESSION_PARAM]=s.transportSessionId),s.lastSessionId&&(o[a.LAST_SESSION_PARAM]=s.lastSessionId),!f.isNodeSdk()&&"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(a.FORGE_DOMAIN)&&(o[a.REFERER_PARAM]=a.FORGE_REF);var e=s.urlFn(o);s.de("Connecting via long-poll to "+e),s.scriptTagHolder.addTag(e,function(){})}})},n.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},n.forceAllow=function(){n.Rn=!0},n.forceDisallow=function(){n.On=!0},n.isAvailable=function(){return n.Rn||!n.On&&"undefined"!=typeof document&&null!=document.createElement&&!m.isChromeExtensionContentScript()&&!m.isWindowsStoreApp()&&!f.isNodeSdk()},n.prototype.markConnectionHealthy=function(){},n.prototype.An=function(){this.Sn=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.Tn&&(clearTimeout(this.Tn),this.Tn=null)},n.prototype.wn=function(){this.Sn||(this.de("Longpoll is closing itself"),this.An(),this.z&&(this.z(this.bn),this.z=null))},n.prototype.close=function(){this.Sn||(this.de("Longpoll is being closed."),this.An())},n.prototype.send=function(r){var e=s.stringify(r);this.bytesSent+=e.length,this.$.incrementCounter("bytes_sent",e.length);for(var t=s.base64Encode(e),n=m.splitStringBySize(t,1840),a=0;a<n.length;a++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,n.length,n[a]),this.curSegmentNum++},n.prototype.addDisconnectPingFrame=function(t,e){if(!f.isNodeSdk()){this.myDisconnFrame=document.createElement("iframe");var n={};n[p.FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM]="t",n[p.FIREBASE_LONGPOLL_ID_PARAM]=t,n[p.FIREBASE_LONGPOLL_PW_PARAM]=e,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}},n.prototype.In=function(n){var e=s.stringify(n).length;this.bytesReceived+=e,this.$.incrementCounter("bytes_received",e)},n}();p.BrowserPollConnection=n;var l=function(){function a(e,n,o,i){if(this.onDisconnect=o,this.urlFn=i,this.outstandingRequests=new r.CountedSet,this.pendingSegs=[],this.currentSerial=t(1e8*Math.random()),this.sendNewPolls=!0,f.isNodeSdk())this.commandCB=e,this.onMessageCB=n;else{this.uniqueCallbackIdentifier=m.LUIDGenerator(),window[p.FIREBASE_LONGPOLL_COMMAND_CB_NAME+this.uniqueCallbackIdentifier]=e,window[p.FIREBASE_LONGPOLL_DATA_CB_NAME+this.uniqueCallbackIdentifier]=n,this.myIFrame=a.Dn();var s="";this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,11)&&(s="<script>document.domain=\""+document.domain+"\";</script>");var d="<html><body>"+s+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(d),this.myIFrame.doc.close()}catch(t){m.log("frame writing exception"),t.stack&&m.log(t.stack),m.log(t)}}}return a.Dn=function(){var n=document.createElement("iframe");if(n.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(n);try{n.contentWindow.document||m.log("No IE domain setting required")}catch(t){var e=document.domain;n.src="javascript:void((function(){document.open();document.domain='"+e+"';document.close();})())"}return n.contentDocument?n.doc=n.contentDocument:n.contentWindow?n.doc=n.contentWindow.document:n.document&&(n.doc=n.document),n},a.prototype.close=function(){var e=this;if(this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout(function(){null!==e.myIFrame&&(document.body.removeChild(e.myIFrame),e.myIFrame=null)},0)),f.isNodeSdk()&&this.myID){var t={};t[p.FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM]="t",t[p.FIREBASE_LONGPOLL_ID_PARAM]=this.myID,t[p.FIREBASE_LONGPOLL_PW_PARAM]=this.myPW;var n=this.urlFn(t);a.nodeRestRequest(n)}var r=this.onDisconnect;r&&(this.onDisconnect=null,r())},a.prototype.startLongPoll=function(n,e){for(this.myID=n,this.myPW=e,this.alive=!0;this.Mn(););},a.prototype.Mn=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.count()<(0<this.pendingSegs.length?2:1)){this.currentSerial++;var t={};t[p.FIREBASE_LONGPOLL_ID_PARAM]=this.myID,t[p.FIREBASE_LONGPOLL_PW_PARAM]=this.myPW,t[p.FIREBASE_LONGPOLL_SERIAL_PARAM]=this.currentSerial;for(var e=this.urlFn(t),n="",r=0,a;0<this.pendingSegs.length&&1870>=this.pendingSegs[0].d.length+30+n.length;)a=this.pendingSegs.shift(),n=n+"&"+p.FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM+r+"="+a.seg+"&"+p.FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET+r+"="+a.ts+"&"+p.FIREBASE_LONGPOLL_DATA_PARAM+r+"="+a.d,r++;return e+=n,this.Ln(e,this.currentSerial),!0}return!1},a.prototype.enqueueSegment=function(o,r,a){this.pendingSegs.push({seg:o,ts:r,d:a}),this.alive&&this.Mn()},a.prototype.Ln=function(o,e){var t=this;this.outstandingRequests.add(e,1);var n=function(){t.outstandingRequests.remove(e),t.Mn()},r=setTimeout(n,25000);this.addTag(o,function(){clearTimeout(r),n()})},a.prototype.addTag=function(o,r){var e=this;f.isNodeSdk()?this.doNodeLongPoll(o,r):setTimeout(function(){try{if(!e.sendNewPolls)return;var t=e.myIFrame.doc.createElement("script");t.type="text/javascript",t.async=!0,t.src=o,t.onload=t.onreadystatechange=function(){var n=t.readyState;n&&"loaded"!==n&&"complete"!==n||(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),r())},t.onerror=function(){m.log("Long-poll script failed to load: "+o),e.sendNewPolls=!1,e.close()},e.myIFrame.doc.body.appendChild(t)}catch(t){}},1)},a}();p.FirebaseIFrameScriptHolder=l},function(o,r,t){"use strict";(function(n){Object.defineProperty(r,"__esModule",{value:!0});var e=t(6),i=t(0),o=t(1),a=t(25),m=t(14),u=t(0),l=t(13),s=t(0),h=t(0),p=null;"undefined"==typeof MozWebSocket?"undefined"!=typeof WebSocket&&(p=WebSocket):p=MozWebSocket,r.setWebSocketImpl=function(t){p=t};var d=function(){function d(t,e,n,r){this.connId=t,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.de=o.logWrapper(this.connId),this.$=a.StatsManager.getCollection(e),this.connURL=d.Fn(e,n,r)}return d.Fn=function(o,e,t){var n={};return n[m.VERSION_PARAM]=m.PROTOCOL_VERSION,!h.isNodeSdk()&&"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(m.FORGE_DOMAIN)&&(n[m.REFERER_PARAM]=m.FORGE_REF),e&&(n[m.TRANSPORT_SESSION_PARAM]=e),t&&(n[m.LAST_SESSION_PARAM]=t),o.connectionURL(m.WEBSOCKET,n)},d.prototype.open=function(i,t){var d=this;this.onDisconnect=t,this.onMessage=i,this.de("Websocket connecting to "+this.connURL),this.bn=!1,l.PersistentStorage.set("previous_websocket_failure",!0);try{if(h.isNodeSdk()){var r=u.CONSTANTS.NODE_ADMIN?"AdminNode":"Node",o={headers:{"User-Agent":"Firebase/"+m.PROTOCOL_VERSION+"/"+e.default.SDK_VERSION+"/"+n.platform+"/"+r}},a=n.env,s=0==this.connURL.indexOf("wss://")?a.HTTPS_PROXY||a.https_proxy:a.HTTP_PROXY||a.http_proxy;s&&(o.proxy={origin:s}),this.mySock=new p(this.connURL,[],o)}else this.mySock=new p(this.connURL)}catch(t){this.de("Error instantiating WebSocket.");var g=t.message||t.data;return g&&this.de(g),void this.wn()}this.mySock.onopen=function(){d.de("Websocket connected."),d.bn=!0},this.mySock.onclose=function(){d.de("Websocket connection was disconnected."),d.mySock=null,d.wn()},this.mySock.onmessage=function(t){d.handleIncomingFrame(t)},this.mySock.onerror=function(n){d.de("WebSocket error. Closing connection.");var e=n.message||n.data;e&&d.de(e),d.wn()}},d.prototype.start=function(){},d.forceDisallow=function(){d.On=!0},d.isAvailable=function(){var t=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var o=/Android ([0-9]{0,}\.[0-9]{0,})/,n=navigator.userAgent.match(o);n&&1<n.length&&4.4>parseFloat(n[1])&&(t=!0)}return!t&&null!==p&&!d.On},d.previouslyFailed=function(){return l.PersistentStorage.isInMemoryStorage||!0===l.PersistentStorage.get("previous_websocket_failure")},d.prototype.markConnectionHealthy=function(){l.PersistentStorage.remove("previous_websocket_failure")},d.prototype.xn=function(o){if(this.frames.push(o),this.frames.length==this.totalFrames){var e=this.frames.join("");this.frames=null;var t=s.jsonEval(e);this.onMessage(t)}},d.prototype.kn=function(t){this.totalFrames=t,this.frames=[]},d.prototype.Wn=function(n){if(i.assert(null===this.frames,"We already have a frame buffer"),6>=n.length){var o=+n;if(!isNaN(o))return this.kn(o),null}return this.kn(1),n},d.prototype.handleIncomingFrame=function(o){if(null!==this.mySock){var e=o.data;if(this.bytesReceived+=e.length,this.$.incrementCounter("bytes_received",e.length),this.resetKeepAlive(),null!==this.frames)this.xn(e);else{var t=this.Wn(e);null!==t&&this.xn(t)}}},d.prototype.send=function(a){this.resetKeepAlive();var e=s.stringify(a);this.bytesSent+=e.length,this.$.incrementCounter("bytes_sent",e.length);var t=o.splitStringBySize(e,16384);1<t.length&&this.jn(t.length+"");for(var n=0;n<t.length;n++)this.jn(t[n])},d.prototype.An=function(){this.Sn=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},d.prototype.wn=function(){this.Sn||(this.de("WebSocket is closing itself"),this.An(),this.onDisconnect&&(this.onDisconnect(this.bn),this.onDisconnect=null))},d.prototype.close=function(){this.Sn||(this.de("WebSocket is being closed"),this.An())},d.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(function(){t.mySock&&t.jn("0"),t.resetKeepAlive()},45000)},d.prototype.jn=function(t){try{this.mySock.send(t)}catch(t){this.de("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.wn.bind(this),0)}},d.responsesRequiredToBeHealthy=2,d.healthyTimeout=3e4,d}();r.WebSocketConnection=d}).call(r,t(27))},function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=function(){function t(){}return t.prototype.put=function(){},t.prototype.merge=function(){},t.prototype.refreshAuthToken=function(){},t.prototype.onDisconnectPut=function(){},t.prototype.onDisconnectMerge=function(){},t.prototype.onDisconnectCancel=function(){},t.prototype.reportStats=function(){},t}();e.ServerActions=t},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(24),l=t(3),p=t(5),o=t(4),r=function(){function r(e){this.Vn=new n.IndexedFilter(e.getIndex()),this.me=e.getIndex(),this.Qn=r.qn(e),this.Un=r.Bn(e)}return r.prototype.getStartPost=function(){return this.Qn},r.prototype.getEndPost=function(){return this.Un},r.prototype.matches=function(t){return 0>=this.me.compare(this.getStartPost(),t)&&0>=this.me.compare(t,this.getEndPost())},r.prototype.updateChild=function(a,e,t,n,r,i){return this.matches(new p.NamedNode(e,t))||(t=o.ChildrenNode.EMPTY_NODE),this.Vn.updateChild(a,e,t,n,r,i)},r.prototype.updateFullNode=function(a,e,t){e.isLeafNode()&&(e=o.ChildrenNode.EMPTY_NODE);var n=e.withIndex(this.me);n=n.updatePriority(o.ChildrenNode.EMPTY_NODE);var r=this;return e.forEachChild(l.PRIORITY_INDEX,function(a,e){r.matches(new p.NamedNode(a,e))||(n=n.updateImmediateChild(a,o.ChildrenNode.EMPTY_NODE))}),this.Vn.updateFullNode(a,n,t)},r.prototype.updatePriority=function(t){return t},r.prototype.filtersNodes=function(){return!0},r.prototype.getIndexedFilter=function(){return this.Vn},r.prototype.getIndex=function(){return this.me},r.qn=function(n){if(n.hasStart()){var e=n.getIndexStartName();return n.getIndex().makePost(n.getIndexStartValue(),e)}return n.getIndex().minPost()},r.Bn=function(n){if(n.hasEnd()){var e=n.getIndexEndName();return n.getIndex().makePost(n.getIndexEndValue(),e)}return n.getIndex().maxPost()},r}();e.RangedFilter=r},,,,,,,,,,,,,,,,,,,,,,function(o,e,t){o.exports=t(79)},function(m,e,t){"use strict";function n(e){var t=e.INTERNAL.registerService("database",function(o,e,t){return u.RepoManager.getInstance().databaseFromApp(o,t)},{Reference:a.Reference,Query:o.Query,Database:i.Database,enableLogging:s.enableLogging,INTERNAL:l,ServerValue:p,TEST_ACCESS:g},null,!0);y.isNodeSdk()&&(m.exports=t)}Object.defineProperty(e,"__esModule",{value:!0});var r=t(6),i=t(32);e.Database=i.Database;var o=t(36);e.Query=o.Query;var a=t(21);e.Reference=a.Reference;var s=t(1);e.enableLogging=s.enableLogging;var u=t(26),l=t(111),g=t(112),y=t(0),p=i.Database.ServerValue;e.ServerValue=p,e.registerDatabase=n,n(r.default);var b=t(22);e.DataSnapshot=b.DataSnapshot;var f=t(35);e.OnDisconnect=f.OnDisconnect},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0),r=function(){function t(t){this.Hn=t,this.Gn="firebase:"}return t.prototype.set=function(o,e){null==e?this.Hn.removeItem(this.Kn(o)):this.Hn.setItem(this.Kn(o),n.stringify(e))},t.prototype.get=function(o){var e=this.Hn.getItem(this.Kn(o));return null==e?null:n.jsonEval(e)},t.prototype.remove=function(t){this.Hn.removeItem(this.Kn(t))},t.prototype.Kn=function(t){return this.Gn+t},t.prototype.toString=function(){return""+this.Hn},t}();e.DOMStorageWrapper=r},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0),r=function(){function t(){this.Yn={},this.isInMemoryStorage=!0}return t.prototype.set=function(n,e){null==e?delete this.Yn[n]:this.Yn[n]=e},t.prototype.get=function(t){return n.contains(this.Yn,t)?this.Yn[t]:null},t.prototype.remove=function(t){delete this.Yn[t]},t}();e.MemoryStorage=r},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0),r=function(){function t(n,o){this.committed=n,this.snapshot=o}return t.prototype.toJSON=function(){return n.validateArgCount("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},t}();e.TransactionResult=r},function(o,e,t){"use strict";var d=Math.floor;Object.defineProperty(e,"__esModule",{value:!0});var l=t(0);e.nextPushId=function(){var o="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",e=0,t=[];return function(n){var r=n===e;e=n;var i=Array(8),s;for(s=7;0<=s;s--)i[s]=o.charAt(n%64),n=d(n/64);l.assert(0===n,"Cannot push at time == 0");var a=i.join("");if(r){for(s=11;0<=s&&63===t[s];s--)t[s]=0;t[s]++}else for(s=0;12>s;s++)t[s]=d(64*Math.random());for(s=0;12>s;s++)a+=o.charAt(t[s]);return l.assert(20===a.length,"nextPushId: Length should be 20."),a}}()},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=t(22),r=t(85),p=t(0),i=t(0),n=function(){function n(o,r,t){this.Xn=o,this.zn=r,this.Jn=t}return n.prototype.respondsTo=function(t){return"value"===t},n.prototype.createEvent=function(o,e){var t=e.getQueryParams().getIndex();return new r.DataEvent("value",this,new l.DataSnapshot(o.snapshotNode,e.getRef(),t))},n.prototype.getEventRunner=function(o){var e=this.Jn;if("cancel"===o.getEventType()){i.assert(this.zn,"Raising a cancel event on a listener with no cancel callback");var t=this.zn;return function(){t.call(e,o.error)}}var n=this.Xn;return function(){n.call(e,o.snapshot)}},n.prototype.createCancelEvent=function(n,e){return this.zn?new r.CancelEvent(this,n,e):null},n.prototype.matches=function(e){return e instanceof n&&(!e.Xn||!this.Xn||e.Xn===this.Xn&&e.Jn===this.Jn)},n.prototype.hasAnyCallback=function(){return null!==this.Xn},n}();e.ValueEventRegistration=n;var o=function(){function o(o,r,t){this.$n=o,this.zn=r,this.Jn=t}return o.prototype.respondsTo=function(n){var e="children_added"===n?"child_added":n;return e="children_removed"==e?"child_removed":e,p.contains(this.$n,e)},o.prototype.createCancelEvent=function(n,e){return this.zn?new r.CancelEvent(this,n,e):null},o.prototype.createEvent=function(a,e){i.assert(null!=a.childName,"Child events should have a childName.");var t=e.getRef().child(a.childName),n=e.getQueryParams().getIndex();return new r.DataEvent(a.type,this,new l.DataSnapshot(a.snapshotNode,t,n),a.prevName)},o.prototype.getEventRunner=function(o){var e=this.Jn;if("cancel"===o.getEventType()){i.assert(this.zn,"Raising a cancel event on a listener with no cancel callback");var t=this.zn;return function(){t.call(e,o.error)}}var n=this.$n[o.eventType];return function(){n.call(e,o.snapshot,o.prevName)}},o.prototype.matches=function(a){if(a instanceof o){if(!this.$n||!a.$n)return!0;if(this.Jn===a.Jn){var e=p.getCount(a.$n);if(e===p.getCount(this.$n)){if(1===e){var t=p.getAnyKey(a.$n),n=p.getAnyKey(this.$n);return!(n!==t||a.$n[t]&&this.$n[n]&&a.$n[t]!==this.$n[n])}return p.every(this.$n,function(t,e){return a.$n[t]===e})}}}return!1},o.prototype.hasAnyCallback=function(){return null!==this.$n},o}();e.ChildEventRegistration=o},function(a,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0),r=function(){function t(o,a,t,n){this.eventType=o,this.eventRegistration=a,this.snapshot=t,this.prevName=n}return t.prototype.getPath=function(){var t=this.snapshot.getRef();return"value"===this.eventType?t.path:t.getParent().path},t.prototype.getEventType=function(){return this.eventType},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.getPath()+":"+this.eventType+":"+n.stringify(this.snapshot.exportVal())},t}();e.DataEvent=r;var i=function(){function t(o,r,t){this.eventRegistration=o,this.error=r,this.path=t}return t.prototype.getPath=function(){return this.path},t.prototype.getEventType=function(){return"cancel"},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.path+":cancel"},t}();e.CancelEvent=i},function(m,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var g=t(0),b=t(1),i=t(87),r=t(4),o=t(0),v=t(23),n=t(88),u=t(89),h=t(8),c=t(46),x=t(2),a=t(47),s=t(95),d=function(){function m(t){this.Zn=t,this.er=v.ImmutableTree.Empty,this.tr=new s.WriteTree,this.nr={},this.rr={}}return m.prototype.applyUserOverwrite=function(o,e,t,n){return this.tr.addOverwrite(o,e,t,n),n?this.ir(new c.Overwrite(h.OperationSource.User,o,e)):[]},m.prototype.applyUserMerge=function(o,e,t){this.tr.addMerge(o,e,t);var n=v.ImmutableTree.fromObject(e);return this.ir(new u.Merge(h.OperationSource.User,o,n))},m.prototype.ackUserWrite=function(a,e){void 0===e&&(e=!1);var t=this.tr.getWrite(a);if(this.tr.removeWrite(a)){var n=v.ImmutableTree.Empty;return null==t.snap?o.forEach(t.children,function(o,e){n=n.set(new x.Path(o),e)}):n=n.set(x.Path.Empty,!0),this.ir(new i.AckUserWrite(t.path,n,e))}return[]},m.prototype.applyServerOverwrite=function(n,e){return this.ir(new c.Overwrite(h.OperationSource.Server,n,e))},m.prototype.applyServerMerge=function(o,e){var t=v.ImmutableTree.fromObject(e);return this.ir(new u.Merge(h.OperationSource.Server,o,t))},m.prototype.applyListenComplete=function(t){return this.ir(new n.ListenComplete(h.OperationSource.Server,t))},m.prototype.applyTaggedQueryOverwrite=function(e,t,n){var r=this.or(n);if(null!=r){var i=m.ar(r),o=i.path,a=i.queryId,s=x.Path.relativePath(o,e),d=new c.Overwrite(h.OperationSource.forServerTaggedQuery(a),s,t);return this.sr(o,d)}return[]},m.prototype.applyTaggedQueryMerge=function(e,t,n){var r=this.or(n);if(r){var i=m.ar(r),o=i.path,a=i.queryId,s=x.Path.relativePath(o,e),d=v.ImmutableTree.fromObject(t),l=new u.Merge(h.OperationSource.forServerTaggedQuery(a),s,d);return this.sr(o,l)}return[]},m.prototype.applyTaggedListenComplete=function(e,t){var d=this.or(t);if(d){var r=m.ar(d),i=r.path,o=r.queryId,a=x.Path.relativePath(i,e),s=new n.ListenComplete(h.OperationSource.forServerTaggedQuery(o),a);return this.sr(i,s)}return[]},m.prototype.addEventRegistration=function(e,t){var d=e.path,i=null,o=!1;this.er.foreachOnPath(d,function(r,e){var t=x.Path.relativePath(r,d);i=i||e.getCompleteServerCache(t),o=o||e.hasCompleteView()});var n=this.er.get(d);n?(o=o||n.hasCompleteView(),i=i||n.getCompleteServerCache(x.Path.Empty)):(n=new a.SyncPoint,this.er=this.er.set(d,n));var u;null==i?(u=!1,i=r.ChildrenNode.EMPTY_NODE,this.er.subtree(d).foreachChild(function(o,e){var t=e.getCompleteServerCache(x.Path.Empty);t&&(i=i.updateImmediateChild(o,t))})):u=!0;var l=n.viewExistsForQuery(e);if(!l&&!e.getQueryParams().loadsAllData()){var f=m.ur(e);g.assert(!(f in this.rr),"View does not exist, but we have a tag");var c=m.lr();this.rr[f]=c,this.nr["_"+c]=f}var p=this.tr.childWrites(d),b=n.addEventRegistration(e,t,p,i,u);if(!l&&!o){var y=n.viewForQuery(e);b=b.concat(this.hr(e,y))}return b},m.prototype.removeEventRegistration=function(e,t,n){var r=this,i=e.path,o=this.er.get(i),a=[];if(o&&("default"===e.queryIdentifier()||o.viewExistsForQuery(e))){var s=o.removeEventRegistration(e,t,n);o.isEmpty()&&(this.er=this.er.remove(i));var u=s.removed;a=s.events;var l=-1!==u.findIndex(function(t){return t.getQueryParams().loadsAllData()}),h=this.er.findOnPath(i,function(n,e){return e.hasCompleteView()});if(l&&!h){var g=this.er.subtree(i);if(!g.isEmpty())for(var p=this.cr(g),d=0;d<p.length;++d){var f=p[d],b=f.getQuery(),y=this.pr(f);this.Zn.startListening(m.dr(b),this.fr(b),y.hashFn,y.onComplete)}}h||!(0<u.length)||n||(l?this.Zn.stopListening(m.dr(e),null):u.forEach(function(e){var t=r.rr[m.ur(e)];r.Zn.stopListening(m.dr(e),t)})),this._r(u)}return a},m.prototype.calcCompleteEventCache=function(o,e){var t=this.tr,n=this.er.findOnPath(o,function(e,t){var n=x.Path.relativePath(e,o),r=t.getCompleteServerCache(n);if(r)return r});return t.calcCompleteEventCache(o,n,e,!0)},m.prototype.cr=function(t){return t.fold(function(a,e,t){if(e&&e.hasCompleteView())return[e.getCompleteView()];var n=[];return e&&(n=e.getQueryViews()),o.forEach(t,function(o,e){n=n.concat(e)}),n})},m.prototype._r=function(e){for(var t=0,n;t<e.length;++t)if(n=e[t],!n.getQueryParams().loadsAllData()){var r=m.ur(n),a=this.rr[r];delete this.rr[r],delete this.nr["_"+a]}},m.dr=function(t){return t.getQueryParams().loadsAllData()&&!t.getQueryParams().isDefault()?t.getRef():t},m.prototype.hr=function(e,t){var n=e.path,r=this.fr(e),i=this.pr(t),a=this.Zn.startListening(m.dr(e),r,i.hashFn,i.onComplete),s=this.er.subtree(n);if(r)g.assert(!s.value.hasCompleteView(),"If we're adding a query, it shouldn't be shadowed");else for(var d=s.fold(function(a,e,t){if(!a.isEmpty()&&e&&e.hasCompleteView())return[e.getCompleteView().getQuery()];var n=[];return e&&(n=n.concat(e.getQueryViews().map(function(t){return t.getQuery()}))),o.forEach(t,function(o,e){n=n.concat(e)}),n}),l=0,c;l<d.length;++l)c=d[l],this.Zn.stopListening(m.dr(c),this.fr(c));return a},m.prototype.pr=function(o){var a=this,t=o.getQuery(),n=this.fr(t);return{hashFn:function(){return(o.getServerCache()||r.ChildrenNode.EMPTY_NODE).hash()},onComplete:function(r){if("ok"===r)return n?a.applyTaggedListenComplete(t.path,n):a.applyListenComplete(t.path);var e=b.errorForServerCode(r,t);return a.removeEventRegistration(t,null,e)}}},m.ur=function(t){return t.path+"$"+t.queryIdentifier()},m.ar=function(n){var e=n.indexOf("$");return g.assert(-1!==e&&e<n.length-1,"Bad queryKey."),{queryId:n.substr(e+1),path:new x.Path(n.substr(0,e))}},m.prototype.or=function(t){return this.nr["_"+t]},m.prototype.fr=function(e){var t=m.ur(e);return o.safeGet(this.rr,t)},m.lr=function(){return m.yr++},m.prototype.sr=function(o,e){var t=this.er.get(o);g.assert(t,"Missing sync point for query tag that we're tracking");var n=this.tr.childWrites(o);return t.applyOperation(e,n,null)},m.prototype.ir=function(t){return this.vr(t,this.er,null,this.tr.childWrites(x.Path.Empty))},m.prototype.vr=function(d,e,t,n){if(d.path.isEmpty())return this.gr(d,e,t,n);var r=e.get(x.Path.Empty);null==t&&null!=r&&(t=r.getCompleteServerCache(x.Path.Empty));var i=[],o=d.path.getFront(),a=d.operationForChild(o),s=e.children.get(o);if(s&&a){var p=t?t.getImmediateChild(o):null,l=n.child(o);i=i.concat(this.vr(a,s,p,l))}return r&&(i=i.concat(r.applyOperation(d,n,t))),i},m.prototype.gr=function(d,e,p,n){var r=this,t=e.get(x.Path.Empty);null==p&&null!=t&&(p=t.getCompleteServerCache(x.Path.Empty));var i=[];return e.children.inorderTraversal(function(e,t){var o=p?p.getImmediateChild(e):null,a=n.child(e),s=d.operationForChild(e);s&&(i=i.concat(r.gr(s,t,o,a)))}),t&&(i=i.concat(t.applyOperation(d,n,p))),i},m.yr=1,m}();e.SyncTree=d},function(s,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var d=t(0),r=t(2),i=t(8),n=function(){function o(o,r,t){this.path=o,this.affectedTree=r,this.revert=t,this.type=i.OperationType.ACK_USER_WRITE,this.source=i.OperationSource.User}return o.prototype.operationForChild=function(e){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return d.assert(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var t=this.affectedTree.subtree(new r.Path(e));return new o(r.Path.Empty,t,this.revert)}return d.assert(this.path.getFront()===e,"operationForChild called for unrelated child."),new o(this.path.popFront(),this.affectedTree,this.revert)},o}();e.AckUserWrite=n},function(a,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(2),r=t(8),i=function(){function t(n,o){this.source=n,this.path=o,this.type=r.OperationType.LISTEN_COMPLETE}return t.prototype.operationForChild=function(){return this.path.isEmpty()?new t(this.source,n.Path.Empty):new t(this.source,this.path.popFront())},t}();e.ListenComplete=i},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=t(8),r=t(46),i=t(2),o=t(0),n=function(){function a(o,r,t){this.source=o,this.path=r,this.children=t,this.type=l.OperationType.MERGE}return a.prototype.operationForChild=function(e){if(this.path.isEmpty()){var t=this.children.subtree(new i.Path(e));return t.isEmpty()?null:t.value?new r.Overwrite(this.source,i.Path.Empty,t.value):new a(this.source,i.Path.Empty,t)}return o.assert(this.path.getFront()===e,"Can't get a merge for a child not on the path of the operation"),new a(this.source,this.path.popFront(),this.children)},a.prototype.toString=function(){return"Operation("+this.path+": "+this.source+" merge: "+this.children+")"},a}();e.Merge=n},function(m,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var g=t(24),r=t(91),i=t(4),o=t(19),a=t(48),s=t(94),u=t(0),l=t(8),h=t(9),c=t(3),n=function(){function t(u,m){this.mr=u,this.Cr=[];var t=this.mr.getQueryParams(),n=new g.IndexedFilter(t.getIndex()),l=t.getNodeFilter();this.Er=new r.ViewProcessor(l);var h=m.getServerCache(),c=m.getEventCache(),p=n.updateFullNode(i.ChildrenNode.EMPTY_NODE,h.getNode(),null),d=l.updateFullNode(i.ChildrenNode.EMPTY_NODE,c.getNode(),null),f=new o.CacheNode(p,h.isFullyInitialized(),n.filtersNodes()),b=new o.CacheNode(d,c.isFullyInitialized(),l.filtersNodes());this.Nr=new a.ViewCache(b,f),this.Pr=new s.EventGenerator(this.mr)}return t.prototype.getQuery=function(){return this.mr},t.prototype.getServerCache=function(){return this.Nr.getServerCache().getNode()},t.prototype.getCompleteServerCache=function(n){var e=this.Nr.getCompleteServerSnap();return e&&(this.mr.getQueryParams().loadsAllData()||!n.isEmpty()&&!e.getImmediateChild(n.getFront()).isEmpty())?e.getChild(n):null},t.prototype.isEmpty=function(){return 0===this.Cr.length},t.prototype.addEventRegistration=function(t){this.Cr.push(t)},t.prototype.removeEventRegistration=function(s,d){var t=[];if(d){u.assert(null==s,"A cancel should cancel all event registrations.");var n=this.mr.path;this.Cr.forEach(function(o){d=d;var e=o.createCancelEvent(d,n);e&&t.push(e)})}if(s){for(var e=[],r=0,o;r<this.Cr.length;++r)if(o=this.Cr[r],!o.matches(s))e.push(o);else if(s.hasAnyCallback()){e=e.concat(this.Cr.slice(r+1));break}this.Cr=e}else this.Cr=[];return t},t.prototype.applyOperation=function(o,e,t){o.type===l.OperationType.MERGE&&null!==o.source.queryId&&(u.assert(this.Nr.getCompleteServerSnap(),"We should always have a full cache before handling merges"),u.assert(this.Nr.getCompleteEventSnap(),"Missing event cache, even though we have a server cache"));var n=this.Nr,r=this.Er.applyOperation(n,o,e,t);return this.Er.assertIndexed(r.viewCache),u.assert(r.viewCache.getServerCache().isFullyInitialized()||!n.getServerCache().isFullyInitialized(),"Once a server snap is complete, it should never go back"),this.Nr=r.viewCache,this.br(r.changes,r.viewCache.getEventCache().getNode(),null)},t.prototype.getInitialEvents=function(o){var e=this.Nr.getEventCache(),r=[];return e.getNode().isLeafNode()||e.getNode().forEachChild(c.PRIORITY_INDEX,function(n,e){r.push(h.Change.childAddedChange(n,e))}),e.isFullyInitialized()&&r.push(h.Change.valueChange(e.getNode())),this.br(r,e.getNode(),o)},t.prototype.br=function(o,e,t){var n=t?[t]:this.Cr;return this.Pr.generateEventsForChanges(o,e,n)},t}();e.View=n},function(m,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var g=t(8),b=t(0),r=t(92),f=t(9),i=t(4),n=t(10),y=t(23),v=t(2),x=t(93),o=function(){function t(n,o){this.viewCache=n,this.changes=o}return t}();e.ProcessorResult=o;var a=function(){function p(t){this.Sr=t}return p.prototype.assertIndexed=function(t){b.assert(t.getEventCache().getNode().isIndexed(this.Sr.getIndex()),"Event snap not indexed"),b.assert(t.getServerCache().getNode().isIndexed(this.Sr.getIndex()),"Server snap not indexed")},p.prototype.applyOperation=function(e,t,n,a){var i=new r.ChildChangeAccumulator,s,u;if(t.type===g.OperationType.OVERWRITE){var l=t;l.source.fromUser?s=this.Tr(e,l.path,l.snap,n,a,i):(b.assert(l.source.fromServer,"Unknown source."),u=l.source.tagged||e.getServerCache().isFiltered()&&!l.path.isEmpty(),s=this.wr(e,l.path,l.snap,n,a,u,i))}else if(t.type===g.OperationType.MERGE){var c=t;c.source.fromUser?s=this.Ir(e,c.path,c.children,n,a,i):(b.assert(c.source.fromServer,"Unknown source."),u=c.source.tagged||e.getServerCache().isFiltered(),s=this.Rr(e,c.path,c.children,n,a,u,i))}else if(t.type===g.OperationType.ACK_USER_WRITE){var d=t;s=d.revert?this.Or(e,d.path,n,a,i):this.Ar(e,d.path,d.affectedTree,n,a,i)}else{if(t.type!==g.OperationType.LISTEN_COMPLETE)throw b.assertionError("Unknown operation type: "+t.type);s=this.Dr(e,t.path,n,i)}var h=i.getChanges();return p.Mr(e,s,h),new o(s,h)},p.Mr=function(a,e,t){var n=e.getEventCache();if(n.isFullyInitialized()){var r=n.getNode().isLeafNode()||n.getNode().isEmpty(),s=a.getCompleteEventSnap();!(0<t.length)&&a.getEventCache().isFullyInitialized()&&(!r||n.getNode().equals(s))&&n.getNode().getPriority().equals(s.getPriority())||t.push(f.Change.valueChange(e.getCompleteEventSnap()))}},p.prototype.Lr=function(s,e,t,n,r){var o=s.getEventCache();if(null!=t.shadowingWrite(e))return s;var a,u;if(!e.isEmpty()){var l=e.getFront();if(".priority"==l){b.assert(1==e.getLength(),"Can't have a priority with additional path components");var f=o.getNode();u=s.getServerCache().getNode();var x=t.calcEventCacheAfterServerOverwrite(e,f,u);a=null==x?o.getNode():this.Sr.updatePriority(f,x)}else{var y=e.popFront(),v;if(o.isCompleteForChild(l)){u=s.getServerCache().getNode();var g=t.calcEventCacheAfterServerOverwrite(e,o.getNode(),u);v=null==g?o.getNode().getImmediateChild(l):o.getNode().getImmediateChild(l).updateChild(y,g)}else v=t.calcCompleteChild(l,s.getServerCache());a=null==v?o.getNode():this.Sr.updateChild(o.getNode(),l,v,y,n,r)}}else if(b.assert(s.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),s.getServerCache().isFiltered()){var m=s.getCompleteServerSnap(),h=m instanceof i.ChildrenNode?m:i.ChildrenNode.EMPTY_NODE,c=t.calcCompleteEventChildren(h);a=this.Sr.updateFullNode(s.getEventCache().getNode(),c,r)}else{var p=t.calcCompleteEventCache(s.getCompleteServerSnap());a=this.Sr.updateFullNode(s.getEventCache().getNode(),p,r)}return s.updateEventSnap(a,o.isFullyInitialized()||e.isEmpty(),this.Sr.filtersNodes())},p.prototype.wr=function(c,e,t,n,r,i,o){var a=c.getServerCache(),u=i?this.Sr:this.Sr.getIndexedFilter(),l;if(e.isEmpty())l=u.updateFullNode(a.getNode(),t,null);else if(u.filtersNodes()&&!a.isFiltered()){var s=a.getNode().updateChild(e,t);l=u.updateFullNode(a.getNode(),s,null)}else{var h=e.getFront();if(!a.isCompleteForPath(e)&&1<e.getLength())return c;var p=e.popFront(),d=a.getNode().getImmediateChild(h),m=d.updateChild(p,t);l=".priority"==h?u.updatePriority(a.getNode(),m):u.updateChild(a.getNode(),h,m,p,x.NO_COMPLETE_CHILD_SOURCE,null)}var g=c.updateServerSnap(l,a.isFullyInitialized()||e.isEmpty(),u.filtersNodes()),f=new x.WriteTreeCompleteChildSource(n,g,r);return this.Lr(g,e,n,f,o)},p.prototype.Tr=function(s,e,t,n,r,c){var o=s.getEventCache(),l=new x.WriteTreeCompleteChildSource(n,s,r),h,a;if(e.isEmpty())a=this.Sr.updateFullNode(s.getEventCache().getNode(),t,c),h=s.updateEventSnap(a,!0,this.Sr.filtersNodes());else{var u=e.getFront();if(".priority"===u)a=this.Sr.updatePriority(s.getEventCache().getNode(),t),h=s.updateEventSnap(a,o.isFullyInitialized(),o.isFiltered());else{var p=e.popFront(),d=o.getNode().getImmediateChild(u),m;if(p.isEmpty())m=t;else{var g=l.getCompleteChild(u);m=null==g?i.ChildrenNode.EMPTY_NODE:".priority"===p.getBack()&&g.getChild(p.parent()).isEmpty()?g:g.updateChild(p,t)}if(d.equals(m))h=s;else{var f=this.Sr.updateChild(o.getNode(),u,m,p,l,c);h=s.updateEventSnap(f,o.isFullyInitialized(),this.Sr.filtersNodes())}}}return h},p.Fr=function(n,e){return n.getEventCache().isCompleteForChild(e)},p.prototype.Ir=function(e,t,n,d,i,o){var a=this,s=e;return n.foreach(function(n,r){var l=t.child(n);p.Fr(e,l.getFront())&&(s=a.Tr(s,l,r,d,i,o))}),n.foreach(function(n,r){var l=t.child(n);p.Fr(e,l.getFront())||(s=a.Tr(s,l,r,d,i,o))}),s},p.prototype.xr=function(o,e){return e.foreach(function(e,t){o=o.updateChild(e,t)}),o},p.prototype.Rr=function(h,e,t,m,r,i,o){var a=this;if(h.getServerCache().getNode().isEmpty()&&!h.getServerCache().isFullyInitialized())return h;var s=h,n;n=e.isEmpty()?t:y.ImmutableTree.Empty.setTree(e,t);var c=h.getServerCache().getNode();return n.children.inorderTraversal(function(e,t){if(c.hasChild(e)){var n=h.getServerCache().getNode().getImmediateChild(e),d=a.xr(n,t);s=a.wr(s,new v.Path(e),d,m,r,i,o)}}),n.children.inorderTraversal(function(e,t){var n=!h.getServerCache().isCompleteForChild(e)&&null==t.value;if(!c.hasChild(e)&&!n){var p=h.getServerCache().getNode().getImmediateChild(e),l=a.xr(p,t);s=a.wr(s,new v.Path(e),l,m,r,i,o)}}),s},p.prototype.Ar=function(d,l,e,t,r,i){if(null!=t.shadowingWrite(l))return d;var o=d.getServerCache().isFiltered(),a=d.getServerCache();if(null!=e.value){if(l.isEmpty()&&a.isFullyInitialized()||a.isCompleteForPath(l))return this.wr(d,l,a.getNode().getChild(l),t,r,o,i);if(l.isEmpty()){var s=y.ImmutableTree.Empty;return a.getNode().forEachChild(n.KEY_INDEX,function(n,e){s=s.set(new v.Path(n),e)}),this.Rr(d,l,s,t,r,o,i)}return d}var c=y.ImmutableTree.Empty;return e.foreach(function(t){var e=l.child(t);a.isCompleteForPath(e)&&(c=c.set(t,a.getNode().getChild(e)))}),this.Rr(d,l,c,t,r,o,i)},p.prototype.Dr=function(a,e,t,n){var r=a.getServerCache(),i=a.updateServerSnap(r.getNode(),r.isFullyInitialized()||e.isEmpty(),r.isFiltered());return this.Lr(i,e,t,x.NO_COMPLETE_CHILD_SOURCE,n)},p.prototype.Or=function(s,e,t,n,r){var o;if(null!=t.shadowingWrite(e))return s;var a=new x.WriteTreeCompleteChildSource(t,s,n),c=s.getEventCache().getNode(),l;if(e.isEmpty()||".priority"===e.getFront()){var p;if(s.getServerCache().isFullyInitialized())p=t.calcCompleteEventCache(s.getCompleteServerSnap());else{var d=s.getServerCache().getNode();b.assert(d instanceof i.ChildrenNode,"serverChildren would be complete if leaf node"),p=t.calcCompleteEventChildren(d)}p=p,l=this.Sr.updateFullNode(c,p,r)}else{var u=e.getFront(),h=t.calcCompleteChild(u,s.getServerCache());null==h&&s.getServerCache().isCompleteForChild(u)&&(h=c.getImmediateChild(u)),l=null==h?s.getEventCache().getNode().hasChild(u)?this.Sr.updateChild(c,u,i.ChildrenNode.EMPTY_NODE,e.popFront(),a,r):c:this.Sr.updateChild(c,u,h,e.popFront(),a,r),l.isEmpty()&&s.getServerCache().isFullyInitialized()&&(o=t.calcCompleteEventCache(s.getCompleteServerSnap()),o.isLeafNode()&&(l=this.Sr.updateFullNode(l,o,r)))}return o=s.getServerCache().isFullyInitialized()||null!=t.shadowingWrite(v.Path.Empty),s.updateEventSnap(l,o,this.Sr.filtersNodes())},p}();e.ViewProcessor=a},function(s,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var d=t(0),r=t(9),i=t(0),n=function(){function t(){this.kr={}}return t.prototype.trackChildChange=function(o){var e=o.type,t=o.childName;i.assert(e==r.Change.CHILD_ADDED||e==r.Change.CHILD_CHANGED||e==r.Change.CHILD_REMOVED,"Only child changes supported for tracking"),i.assert(".priority"!==t,"Only non-priority child changes can be tracked.");var n=d.safeGet(this.kr,t);if(n){var a=n.type;if(e==r.Change.CHILD_ADDED&&a==r.Change.CHILD_REMOVED)this.kr[t]=r.Change.childChangedChange(t,o.snapshotNode,n.snapshotNode);else if(e==r.Change.CHILD_REMOVED&&a==r.Change.CHILD_ADDED)delete this.kr[t];else if(e==r.Change.CHILD_REMOVED&&a==r.Change.CHILD_CHANGED)this.kr[t]=r.Change.childRemovedChange(t,n.oldSnap);else if(e==r.Change.CHILD_CHANGED&&a==r.Change.CHILD_ADDED)this.kr[t]=r.Change.childAddedChange(t,o.snapshotNode);else{if(e!=r.Change.CHILD_CHANGED||a!=r.Change.CHILD_CHANGED)throw i.assertionError("Illegal combination of changes: "+o+" occurred after "+n);this.kr[t]=r.Change.childChangedChange(t,o.snapshotNode,n.oldSnap)}}else this.kr[t]=o},t.prototype.getChanges=function(){return d.getValues(this.kr)},t}();e.ChildChangeAccumulator=n},function(a,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=t(19),n=function(){function t(){}return t.prototype.getCompleteChild=function(){return null},t.prototype.getChildAfterChild=function(){return null},t}();e.Wr=n,e.NO_COMPLETE_CHILD_SOURCE=new n;var r=function(){function t(o,r,t){void 0===t&&(t=null),this.jr=o,this.Nr=r,this.Vr=t}return t.prototype.getCompleteChild=function(o){var e=this.Nr.getEventCache();if(e.isCompleteForChild(o))return e.getNode().getImmediateChild(o);var t=null==this.Vr?this.Nr.getServerCache():new s.CacheNode(this.Vr,!0,!1);return this.jr.calcCompleteChild(o,t)},t.prototype.getChildAfterChild=function(o,e,t){var n=null==this.Vr?this.Nr.getCompleteServerSnap():this.Vr,r=this.jr.calcIndexedSlice(n,e,1,t,o);return 0===r.length?null:r[0]},t}();e.WriteTreeCompleteChildSource=r},function(s,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var d=t(5),l=t(9),r=t(0),n=function(){function t(t){this.mr=t,this.me=this.mr.getQueryParams().getIndex()}return t.prototype.generateEventsForChanges=function(i,e,t){var n=this,r=[],o=[];return i.forEach(function(t){t.type===l.Change.CHILD_CHANGED&&n.me.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(l.Change.childMovedChange(t.childName,t.snapshotNode))}),this.Qr(r,l.Change.CHILD_REMOVED,i,t,e),this.Qr(r,l.Change.CHILD_ADDED,i,t,e),this.Qr(r,l.Change.CHILD_MOVED,o,t,e),this.Qr(r,l.Change.CHILD_CHANGED,i,t,e),this.Qr(r,l.Change.VALUE,i,t,e),r},t.prototype.Qr=function(s,d,e,l,r){var i=this,t=e.filter(function(t){return t.type===d});t.sort(this.qr.bind(this)),t.forEach(function(e){var t=i.Ur(e,r);l.forEach(function(n){n.respondsTo(e.type)&&s.push(n.createEvent(t,i.mr))})})},t.prototype.Ur=function(n,e){return"value"===n.type||"child_removed"===n.type?n:(n.prevName=e.getPredecessorChildName(n.childName,n.snapshotNode,this.me),n)},t.prototype.qr=function(o,e){if(null==o.childName||null==e.childName)throw r.assertionError("Should only compare child_ events.");var t=new d.NamedNode(o.childName,o.snapshotNode),n=new d.NamedNode(e.childName,e.snapshotNode);return this.me.compare(t,n)},t}();e.EventGenerator=n},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0),m=t(0),g=t(2),o=t(96),a=t(3),c=t(4),r=function(){function d(){this.Br=o.CompoundWrite.Empty,this.Hr=[],this.Gr=-1}return d.prototype.childWrites=function(t){return new i(t,this)},d.prototype.addOverwrite=function(o,a,i,s){m.assert(i>this.Gr,"Stacking an older write on top of newer ones"),void 0===s&&(s=!0),this.Hr.push({path:o,snap:a,writeId:i,visible:s}),s&&(this.Br=this.Br.addWrite(o,a)),this.Gr=i},d.prototype.addMerge=function(o,r,a){m.assert(a>this.Gr,"Stacking an older merge on top of newer ones"),this.Hr.push({path:o,children:r,writeId:a,visible:!0}),this.Br=this.Br.addWrites(o,r),this.Gr=a},d.prototype.getWrite=function(o){for(var e=0,t;e<this.Hr.length;e++)if(t=this.Hr[e],t.writeId===o)return t;return null},d.prototype.removeWrite=function(r){var i=this,e=this.Hr.findIndex(function(e){return e.writeId===r});m.assert(0<=e,"removeWrite called with nonexistent writeId.");var t=this.Hr[e];this.Hr.splice(e,1);for(var o=t.visible,a=!1,s=this.Hr.length-1,d;o&&0<=s;)d=this.Hr[s],d.visible&&(s>=e&&this.Kr(d,t.path)?o=!1:t.path.contains(d.path)&&(a=!0)),s--;if(o){if(a)return this.Yr(),!0;if(t.snap)this.Br=this.Br.removeWrite(t.path);else{var l=t.children;n.forEach(l,function(n){i.Br=i.Br.removeWrite(t.path.child(n))})}return!0}return!1},d.prototype.getCompleteWriteData=function(t){return this.Br.getCompleteNode(t)},d.prototype.calcCompleteEventCache=function(o,e,t,n){if(t||n){var u=this.Br.childCompoundWrite(o);if(!n&&u.isEmpty())return e;if(n||null!=e||u.hasCompleteWrite(g.Path.Empty)){var a=function(a){return(a.visible||n)&&(!t||!~t.indexOf(a.writeId))&&(a.path.contains(o)||o.contains(a.path))},s=d.Xr(this.Hr,a,o),l=e||c.ChildrenNode.EMPTY_NODE;return s.apply(l)}return null}var h=this.Br.getCompleteNode(o);if(null!=h)return h;var m=this.Br.childCompoundWrite(o);if(m.isEmpty())return e;if(null!=e||m.hasCompleteWrite(g.Path.Empty)){var l=e||c.ChildrenNode.EMPTY_NODE;return m.apply(l)}return null},d.prototype.calcCompleteEventChildren=function(o,e){var s=c.ChildrenNode.EMPTY_NODE,t=this.Br.getCompleteNode(o);if(t)return t.isLeafNode()||t.forEachChild(a.PRIORITY_INDEX,function(n,e){s=s.updateImmediateChild(n,e)}),s;if(e){var n=this.Br.childCompoundWrite(o);return e.forEachChild(a.PRIORITY_INDEX,function(o,e){var t=n.childCompoundWrite(new g.Path(o)).apply(e);s=s.updateImmediateChild(o,t)}),n.getCompleteChildren().forEach(function(t){s=s.updateImmediateChild(t.name,t.node)}),s}return this.Br.childCompoundWrite(o).getCompleteChildren().forEach(function(t){s=s.updateImmediateChild(t.name,t.node)}),s},d.prototype.calcEventCacheAfterServerOverwrite=function(i,e,t,n){m.assert(t||n,"Either existingEventSnap or existingServerSnap must exist");var r=i.child(e);if(this.Br.hasCompleteWrite(r))return null;var o=this.Br.childCompoundWrite(r);return o.isEmpty()?n.getChild(e):o.apply(n.getChild(e))},d.prototype.calcCompleteChild=function(o,e,t){var n=o.child(e),r=this.Br.getCompleteNode(n);return null==r?t.isCompleteForChild(e)?this.Br.childCompoundWrite(n).apply(t.getNode().getImmediateChild(e)):null:r},d.prototype.shadowingWrite=function(t){return this.Br.getCompleteNode(t)},d.prototype.calcIndexedSlice=function(o,e,t,n,r,i){var a=this.Br.childCompoundWrite(o),u=a.getCompleteNode(g.Path.Empty),l;if(null!=u)l=u;else{if(null==e)return[];l=a.apply(e)}if(l=l.withIndex(i),l.isEmpty()||l.isLeafNode())return[];for(var s=[],h=i.getCompare(),c=r?l.getReverseIteratorFrom(t,i):l.getIteratorFrom(t,i),p=c.getNext();p&&s.length<n;)0!==h(p,t)&&s.push(p),p=c.getNext();return s},d.prototype.Kr=function(o,e){return o.snap?o.path.contains(e):!!n.findKey(o.children,function(t,n){return o.path.child(n).contains(e)})},d.prototype.Yr=function(){this.Br=d.Xr(this.Hr,d.zr,g.Path.Empty),this.Gr=0<this.Hr.length?this.Hr[this.Hr.length-1].writeId:-1},d.zr=function(t){return t.visible},d.Xr=function(r,e,t){for(var a=o.CompoundWrite.Empty,i=0,s;i<r.length;++i)if(s=r[i],e(s)){var l=s.path,u=void 0;if(s.snap)t.contains(l)?(u=g.Path.relativePath(t,l),a=a.addWrite(u,s.snap)):l.contains(t)&&(u=g.Path.relativePath(l,t),a=a.addWrite(g.Path.Empty,s.snap.getChild(u)));else{if(!s.children)throw m.assertionError("WriteRecord should have .snap or .children");if(t.contains(l))u=g.Path.relativePath(t,l),a=a.addWrites(u,s.children);else if(l.contains(t))if(u=g.Path.relativePath(l,t),u.isEmpty())a=a.addWrites(g.Path.Empty,s.children);else{var c=n.safeGet(s.children,u.getFront());if(c){var p=c.getChild(u.popFront());a=a.addWrite(g.Path.Empty,p)}}}}return a},d}();e.WriteTree=r;var i=function(){function n(n,o){this.Jr=n,this.$r=o}return n.prototype.calcCompleteEventCache=function(o,e,t){return this.$r.calcCompleteEventCache(this.Jr,o,e,t)},n.prototype.calcCompleteEventChildren=function(t){return this.$r.calcCompleteEventChildren(this.Jr,t)},n.prototype.calcEventCacheAfterServerOverwrite=function(o,e,t){return this.$r.calcEventCacheAfterServerOverwrite(this.Jr,o,e,t)},n.prototype.shadowingWrite=function(t){return this.$r.shadowingWrite(this.Jr.child(t))},n.prototype.calcIndexedSlice=function(o,e,t,n,r){return this.$r.calcIndexedSlice(this.Jr,o,e,t,n,r)},n.prototype.calcCompleteChild=function(n,e){return this.$r.calcCompleteChild(this.Jr,n,e)},n.prototype.child=function(e){return new n(this.Jr.child(e),this.$r)},n}();e.WriteTreeRef=i},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var p=t(23),r=t(2),i=t(0),o=t(5),n=t(3),a=t(0),s=function(){function d(t){this.$r=t}return d.prototype.addWrite=function(e,t){if(e.isEmpty())return new d(new p.ImmutableTree(t));var n=this.$r.findRootMostValueAndPath(e);if(null!=n){var o=n.path,a=n.value,i=r.Path.relativePath(o,e);return a=a.updateChild(i,t),new d(this.$r.set(o,a))}var s=new p.ImmutableTree(t);return new d(this.$r.setTree(e,s))},d.prototype.addWrites=function(o,e){var a=this;return i.forEach(e,function(e,t){a=a.addWrite(o.child(e),t)}),a},d.prototype.removeWrite=function(e){return e.isEmpty()?d.Empty:new d(this.$r.setTree(e,p.ImmutableTree.Empty))},d.prototype.hasCompleteWrite=function(t){return null!=this.getCompleteNode(t)},d.prototype.getCompleteNode=function(n){var e=this.$r.findRootMostValueAndPath(n);return null==e?null:this.$r.get(e.path).getChild(r.Path.relativePath(e.path,n))},d.prototype.getCompleteChildren=function(){var r=[],e=this.$r.value;return null==e?this.$r.children.inorderTraversal(function(e,t){null!=t.value&&r.push(new o.NamedNode(e,t.value))}):e.isLeafNode()||e.forEachChild(n.PRIORITY_INDEX,function(e,t){r.push(new o.NamedNode(e,t))}),r},d.prototype.childCompoundWrite=function(e){if(e.isEmpty())return this;var t=this.getCompleteNode(e);return new d(null==t?this.$r.subtree(e):new p.ImmutableTree(t))},d.prototype.isEmpty=function(){return this.$r.isEmpty()},d.prototype.apply=function(e){return d.Zr(r.Path.Empty,this.$r,e)},d.Empty=new d(new p.ImmutableTree(null)),d.Zr=function(e,t,s){if(null!=t.value)return s.updateChild(e,t.value);var r=null;return t.children.inorderTraversal(function(t,n){".priority"===t?(a.assert(null!==n.value,"Priority writes must always be leaf nodes"),r=n.value):s=d.Zr(e.child(t),n,s)}),s.getChild(e).isEmpty()||null===r||(s=s.updateChild(e.child(".priority"),r)),s},d}();e.CompoundWrite=s},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(4),r=function(){function t(){this.ei=n.ChildrenNode.EMPTY_NODE}return t.prototype.getNode=function(t){return this.ei.getChild(t)},t.prototype.updateSnapshot=function(n,e){this.ei=this.ei.updateChild(n,e)},t}();e.SnapshotHolder=r},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(1),r=function(){function t(t){this.ti=t}return t.prototype.getToken=function(t){return this.ti.INTERNAL.getToken(t).then(null,function(t){return t&&"auth/token-not-initialized"===t.code?(n.log("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t)})},t.prototype.addTokenChangeListener=function(t){this.ti.INTERNAL.addAuthTokenListener(t)},t.prototype.removeTokenChangeListener=function(t){this.ti.INTERNAL.removeAuthTokenListener(t)},t.prototype.notifyForInvalidToken=function(){var t="Provided authentication credentials for the app named \""+this.ti.name+"\" are invalid. This usually indicates your app was not initialized correctly. ";t+="credential"in this.ti.options?"Make sure the \"credential\" property provided to initializeApp() is authorized to access the specified \"databaseURL\" and is from the correct project.":"serviceAccount"in this.ti.options?"Make sure the \"serviceAccount\" property provided to initializeApp() is authorized to access the specified \"databaseURL\" and is from the correct project.":"Make sure the \"apiKey\" and \"databaseURL\" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.",n.warn(t)},t}();e.AuthTokenProvider=r},function(a,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0),r=t(0),i=function(){function t(){this.ni={}}return t.prototype.incrementCounter=function(n,e){void 0===e&&(e=1),r.contains(this.ni,n)||(this.ni[n]=0),this.ni[n]+=e},t.prototype.get=function(){return n.deepCopy(this.ni)},t}();e.StatsCollection=i},function(s,e,t){"use strict";var d=Math.floor;Object.defineProperty(e,"__esModule",{value:!0});var l=t(0),r=t(1),i=t(49),o=1e4,n=function(){function t(a,s){this.Z=s,this.ri={},this.G=new i.StatsListener(a);var t=o+(3e4-o)*Math.random();r.setTimeoutNonBlocking(this.ii.bind(this),d(t))}return t.prototype.includeStat=function(t){this.ri[t]=!0},t.prototype.ii=function(){var a=this,e=this.G.get(),s={},n=!1;l.forEach(e,function(e,t){0<t&&l.contains(a.ri,e)&&(s[e]=t,n=!0)}),n&&this.Z.reportStats(s),r.setTimeoutNonBlocking(this.ii.bind(this),d(3e5*(2*Math.random())))},t}();e.StatsReporter=n},function(a,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=t(1),n=function(){function t(){this.oi=[],this.ai=0}return t.prototype.queueEvents=function(o){for(var e=null,t=0;t<o.length;t++){var n=o[t],r=n.getPath();null==e||r.equals(e.getPath())||(this.oi.push(e),e=null),null==e&&(e=new d(r)),e.add(n)}e&&this.oi.push(e)},t.prototype.raiseEventsAtPath=function(n,e){this.queueEvents(e),this.si(function(e){return e.equals(n)})},t.prototype.raiseEventsForChangedPath=function(n,e){this.queueEvents(e),this.si(function(e){return e.contains(n)||n.contains(e)})},t.prototype.si=function(o){this.ai++;for(var e=!0,t=0,n;t<this.oi.length;t++)n=this.oi[t],n&&(o(n.getPath())?(this.oi[t].raise(),this.oi[t]=null):e=!1);e&&(this.oi=[]),this.ai--},t}();e.EventQueue=n;var d=function(){function t(t){this.Oe=t,this.ui=[]}return t.prototype.add=function(t){this.ui.push(t)},t.prototype.raise=function(){for(var o=0,e;o<this.ui.length;o++)if(e=this.ui[o],null!==e){this.ui[o]=null;var t=e.getEventRunner();s.logger&&s.log("event: "+e),s.exceptionGuard(t)}},t.prototype.getPath=function(){return this.Oe},t}();e.EventList=d},function(s,e,t){"use strict";var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var r=t(51),i=t(0),o=function(o){function e(){var a=o.call(this,["visible"])||this,r,e;return"undefined"!=typeof document&&void 0!==document.addEventListener&&(void 0===document.hidden?void 0===document.mozHidden?void 0===document.msHidden?void 0!==document.webkitHidden&&(e="webkitvisibilitychange",r="webkitHidden"):(e="msvisibilitychange",r="msHidden"):(e="mozvisibilitychange",r="mozHidden"):(e="visibilitychange",r="hidden")),a.at=!0,e&&document.addEventListener(e,function(){var t=!document[r];t!==a.at&&(a.at=t,a.trigger("visible",t))},!1),a}return n(e,o),e.getInstance=function(){return new e},e.prototype.getInitialEvent=function(t){return i.assert("visible"===t,"Unknown event type: "+t),[this.at]},e}(r.EventEmitter);e.VisibilityMonitor=o},function(d,e,t){"use strict";var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var r=t(0),i=t(51),o=t(0),a=function(a){function e(){var e=a.call(this,["online"])||this;return e.li=!0,"undefined"==typeof window||void 0===window.addEventListener||o.isMobileCordova()||(window.addEventListener("online",function(){e.li||(e.li=!0,e.trigger("online",!0))},!1),window.addEventListener("offline",function(){e.li&&(e.li=!1,e.trigger("online",!1))},!1)),e}return n(e,a),e.getInstance=function(){return new e},e.prototype.getInitialEvent=function(t){return r.assert("online"===t,"Unknown event type: "+t),[this.li]},e.prototype.currentlyOnline=function(){return this.li},e}(i.EventEmitter);e.OnlineMonitor=a},function(s,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(53),d=t(54),i=t(1),o=function(){function t(t){this.hi(t)}return Object.defineProperty(t,"ALL_TRANSPORTS",{get:function(){return[n.BrowserPollConnection,d.WebSocketConnection]},enumerable:!0,configurable:!0}),t.prototype.hi=function(e){var o=d.WebSocketConnection&&d.WebSocketConnection.isAvailable(),n=o&&!d.WebSocketConnection.previouslyFailed();if(e.webSocketOnly&&(o||i.warn("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),n=!0),n)this.ci=[d.WebSocketConnection];else{var r=this.ci=[];i.each(t.ALL_TRANSPORTS,function(n,e){e&&e.isAvailable()&&r.push(e)})}},t.prototype.initialTransport=function(){if(0<this.ci.length)return this.ci[0];throw Error("No transports available")},t.prototype.upgradeTransport=function(){return 1<this.ci.length?this.ci[1]:null},t}();e.TransportManager=o},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=t(1),n=function(){function t(t){this.Ut=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}return t.prototype.closeAfter=function(n,e){this.closeAfterResponse=n,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},t.prototype.handleResponse=function(o,e){var r=this;this.pendingResponses[o]=e;for(var n=this;this.pendingResponses[this.currentResponseNum]&&"break"!==function(){var o=n.pendingResponses[n.currentResponseNum];delete n.pendingResponses[n.currentResponseNum];for(var e=0;e<o.length;++e)!function(e){o[e]&&a.exceptionGuard(function(){r.Ut(o[e])})}(e);return n.currentResponseNum===n.closeAfterResponse?(n.onClose&&(n.onClose(),n.onClose=null),"break"):void n.currentResponseNum++}(););},t}();e.PacketReceiver=n},function(d,e,t){"use strict";var n=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(o,e){for(var t in e)e.hasOwnProperty(t)&&(o[t]=e[t])};return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var r=t(0),p=t(1),o=t(0),c=t(0),a=t(0),i=t(55),s=function(s){function d(e,o,n){var r=s.call(this)||this;return r.H=e,r.ee=o,r.Ke=n,r.de=p.logWrapper("p:rest:"),r.Je={},r}return n(d,s),d.prototype.reportStats=function(){throw Error("Method not implemented.")},d.pi=function(n,e){return void 0===e?(r.assert(n.getQueryParams().isDefault(),"should have a tag if it's not a default query."),""+n.path):"tag$"+e},d.prototype.listen=function(t,e,s,n){var r=this,o=""+t.path;this.de("Listen called for "+o+" "+t.queryIdentifier());var a=d.pi(t,s),i={};this.Je[a]=i;var l=t.getQueryParams().toRestQueryStringParameters();this.di(o+".json",l,function(d,e){var t=e;if(404===d&&(t=null,d=null),null===d&&r.ee(o,t,!1,s),c.safeGet(r.Je,a)===i){var l;l=d?401==d?"permission_denied":"rest_error:"+d:"ok",n(l,null)}})},d.prototype.unlisten=function(t,e){var n=d.pi(t,e);delete this.Je[n]},d.prototype.refreshAuthToken=function(){},d.prototype.di=function(d,e,t){var n=this;void 0===e&&(e={}),e.format="export",this.Ke.getToken(!1).then(function(r){var i=r&&r.accessToken;i&&(e.auth=i);var s=(n.H.secure?"https://":"http://")+n.H.host+d+"?"+a.querystring(e);n.de("Sending REST request for "+s);var l=new XMLHttpRequest;l.onreadystatechange=function(){if(t&&4===l.readyState){n.de("REST Response for "+s+" received. status:",l.status,"response:",l.responseText);var r=null;if(200<=l.status&&300>l.status){try{r=o.jsonEval(l.responseText)}catch(t){p.warn("Failed to parse JSON response for "+s+": "+l.responseText)}t(null,r)}else 401!==l.status&&404!==l.status&&p.warn("Got unsuccessful REST response for "+s+" Status: "+l.status),t(l.status);t=null}},l.open("GET",s,!0),l.send()})},d}(i.ServerActions);e.ReadonlyRestClient=s},function(m,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var g=t(0),n=t(1),r=t(10),o=t(3),a=t(38),s=t(42),i=t(24),l=t(108),u=t(56),c=t(0),p=function(){function d(){this.fi=!1,this._i=!1,this.yi=!1,this.vi=!1,this.gi=!1,this.mi=0,this.Ci="",this.Ei=null,this.Ni="",this.Pi=null,this.bi="",this.me=o.PRIORITY_INDEX}return d.prototype.hasStart=function(){return this._i},d.prototype.isViewFromLeft=function(){return""===this.Ci?this._i:this.Ci===d.Si.VIEW_FROM_LEFT},d.prototype.getIndexStartValue=function(){return g.assert(this._i,"Only valid if start has been set"),this.Ei},d.prototype.getIndexStartName=function(){return g.assert(this._i,"Only valid if start has been set"),this.yi?this.Ni:n.MIN_NAME},d.prototype.hasEnd=function(){return this.vi},d.prototype.getIndexEndValue=function(){return g.assert(this.vi,"Only valid if end has been set"),this.Pi},d.prototype.getIndexEndName=function(){return g.assert(this.vi,"Only valid if end has been set"),this.gi?this.bi:n.MAX_NAME},d.prototype.hasLimit=function(){return this.fi},d.prototype.hasAnchoredLimit=function(){return this.fi&&""!==this.Ci},d.prototype.getLimit=function(){return g.assert(this.fi,"Only valid if limit has been set"),this.mi},d.prototype.getIndex=function(){return this.me},d.prototype.Ti=function(){var e=new d;return e.fi=this.fi,e.mi=this.mi,e._i=this._i,e.Ei=this.Ei,e.yi=this.yi,e.Ni=this.Ni,e.vi=this.vi,e.Pi=this.Pi,e.gi=this.gi,e.bi=this.bi,e.me=this.me,e.Ci=this.Ci,e},d.prototype.limit=function(n){var e=this.Ti();return e.fi=!0,e.mi=n,e.Ci="",e},d.prototype.limitToFirst=function(e){var t=this.Ti();return t.fi=!0,t.mi=e,t.Ci=d.Si.VIEW_FROM_LEFT,t},d.prototype.limitToLast=function(e){var t=this.Ti();return t.fi=!0,t.mi=e,t.Ci=d.Si.VIEW_FROM_RIGHT,t},d.prototype.startAt=function(o,e){var t=this.Ti();return t._i=!0,void 0===o&&(o=null),t.Ei=o,null==e?(t.yi=!1,t.Ni=""):(t.yi=!0,t.Ni=e),t},d.prototype.endAt=function(o,e){var t=this.Ti();return t.vi=!0,void 0===o&&(o=null),t.Pi=o,void 0===e?(t.gi=!1,t.bi=""):(t.gi=!0,t.bi=e),t},d.prototype.orderBy=function(n){var e=this.Ti();return e.me=n,e},d.prototype.getQueryObject=function(){var e=d.Si,t={};if(this._i&&(t[e.INDEX_START_VALUE]=this.Ei,this.yi&&(t[e.INDEX_START_NAME]=this.Ni)),this.vi&&(t[e.INDEX_END_VALUE]=this.Pi,this.gi&&(t[e.INDEX_END_NAME]=this.bi)),this.fi){t[e.LIMIT]=this.mi;var n=this.Ci;""===n&&(n=this.isViewFromLeft()?e.VIEW_FROM_LEFT:e.VIEW_FROM_RIGHT),t[e.VIEW_FROM]=n}return this.me!==o.PRIORITY_INDEX&&(t[e.INDEX]=""+this.me),t},d.prototype.loadsAllData=function(){return!(this._i||this.vi||this.fi)},d.prototype.isDefault=function(){return this.loadsAllData()&&this.me==o.PRIORITY_INDEX},d.prototype.getNodeFilter=function(){return this.loadsAllData()?new i.IndexedFilter(this.getIndex()):this.hasLimit()?new l.LimitedFilter(this):new u.RangedFilter(this)},d.prototype.toRestQueryStringParameters=function(){var e=d.wi,t={};if(this.isDefault())return t;var n;return this.me===o.PRIORITY_INDEX?n=e.PRIORITY_INDEX:this.me===a.VALUE_INDEX?n=e.VALUE_INDEX:this.me===r.KEY_INDEX?n=e.KEY_INDEX:(g.assert(this.me instanceof s.PathIndex,"Unrecognized index type!"),n=""+this.me),t[e.ORDER_BY]=c.stringify(n),this._i&&(t[e.START_AT]=c.stringify(this.Ei),this.yi&&(t[e.START_AT]+=","+c.stringify(this.Ni))),this.vi&&(t[e.END_AT]=c.stringify(this.Pi),this.gi&&(t[e.END_AT]+=","+c.stringify(this.bi))),this.fi&&(this.isViewFromLeft()?t[e.LIMIT_TO_FIRST]=this.mi:t[e.LIMIT_TO_LAST]=this.mi),t},d.Si={INDEX_START_VALUE:"sp",INDEX_START_NAME:"sn",INDEX_END_VALUE:"ep",INDEX_END_NAME:"en",LIMIT:"l",VIEW_FROM:"vf",VIEW_FROM_LEFT:"l",VIEW_FROM_RIGHT:"r",INDEX:"i"},d.wi={ORDER_BY:"orderBy",PRIORITY_INDEX:"$priority",VALUE_INDEX:"$value",KEY_INDEX:"$key",START_AT:"startAt",END_AT:"endAt",LIMIT_TO_FIRST:"limitToFirst",LIMIT_TO_LAST:"limitToLast"},d.DEFAULT=new d,d}();e.QueryParams=p},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(56),m=t(4),i=t(5),o=t(0),a=t(9),r=function(){function t(t){this.Ii=new n.RangedFilter(t),this.me=t.getIndex(),this.mi=t.getLimit(),this.Ri=!t.isViewFromLeft()}return t.prototype.updateChild=function(o,e,t,n,r,a){return this.Ii.matches(new i.NamedNode(e,t))||(t=m.ChildrenNode.EMPTY_NODE),o.getImmediateChild(e).equals(t)?o:o.numChildren()<this.mi?this.Ii.getIndexedFilter().updateChild(o,e,t,n,r,a):this.Oi(o,e,t,r,a)},t.prototype.updateFullNode=function(i,e,t){var n;if(e.isLeafNode()||e.isEmpty())n=m.ChildrenNode.EMPTY_NODE.withIndex(this.me);else if(2*this.mi<e.numChildren()&&e.isIndexed(this.me)){n=m.ChildrenNode.EMPTY_NODE.withIndex(this.me);var r=this.Ri?e.getReverseIteratorFrom(this.Ii.getEndPost(),this.me):e.getIteratorFrom(this.Ii.getStartPost(),this.me);for(var o=0;r.hasNext()&&o<this.mi;){var a=r.getNext(),s=void 0;if(!(s=this.Ri?0>=this.me.compare(this.Ii.getStartPost(),a):0>=this.me.compare(a,this.Ii.getEndPost())))break;n=n.updateImmediateChild(a.name,a.node),o++}}else{n=e.withIndex(this.me),n=n.updatePriority(m.ChildrenNode.EMPTY_NODE);var r=void 0,u,l,h;if(this.Ri){r=n.getReverseIterator(this.me),u=this.Ii.getEndPost(),l=this.Ii.getStartPost();var c=this.me.getCompare();h=function(n,e){return c(e,n)}}else r=n.getIterator(this.me),u=this.Ii.getStartPost(),l=this.Ii.getEndPost(),h=this.me.getCompare();for(var o=0,p=!1,a;r.hasNext();){a=r.getNext(),!p&&0>=h(u,a)&&(p=!0);var s=p&&o<this.mi&&0>=h(a,l);s?o++:n=n.updateImmediateChild(a.name,m.ChildrenNode.EMPTY_NODE)}}return this.Ii.getIndexedFilter().updateFullNode(i,n,t)},t.prototype.updatePriority=function(t){return t},t.prototype.filtersNodes=function(){return!0},t.prototype.getIndexedFilter=function(){return this.Ii.getIndexedFilter()},t.prototype.getIndex=function(){return this.me},t.prototype.Oi=function(s,e,t,n,r){var u;if(this.Ri){var l=this.me.getCompare();u=function(n,e){return l(e,n)}}else u=this.me.getCompare();var h=s;o.assert(h.numChildren()==this.mi,"");var c=new i.NamedNode(e,t),p=this.Ri?h.getFirstChild(this.me):h.getLastChild(this.me),d=this.Ii.matches(c);if(h.hasChild(e)){for(var f=h.getImmediateChild(e),b=n.getChildAfterChild(this.me,p,this.Ri);null!=b&&(b.name==e||h.hasChild(b.name));)b=n.getChildAfterChild(this.me,b,this.Ri);var y=null==b?1:u(b,c);if(d&&!t.isEmpty()&&0<=y)return null!=r&&r.trackChildChange(a.Change.childChangedChange(e,t,f)),h.updateImmediateChild(e,t);null!=r&&r.trackChildChange(a.Change.childRemovedChange(e,f));var v=h.updateImmediateChild(e,m.ChildrenNode.EMPTY_NODE);return null!=b&&this.Ii.matches(b)?(null!=r&&r.trackChildChange(a.Change.childAddedChange(b.name,b.node)),v.updateImmediateChild(b.name,b.node)):v}return t.isEmpty()?s:d&&0<=u(p,c)?(null!=r&&(r.trackChildChange(a.Change.childRemovedChange(p.name,p.node)),r.trackChildChange(a.Change.childAddedChange(e,t))),h.updateImmediateChild(e,t).updateImmediateChild(p.name,m.ChildrenNode.EMPTY_NODE)):s},t}();e.LimitedFilter=r},function(m,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var x=t(0),i=t(21),o=t(22),a=t(2),n=t(110),s=t(3),l=t(1),h=t(43),c=t(7),p=t(0),d=t(11),u=t(4),f=t(18),k;!function(t){t[t.RUN=0]="RUN",t[t.SENT=1]="SENT",t[t.COMPLETED=2]="COMPLETED",t[t.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",t[t.NEEDS_ABORT=4]="NEEDS_ABORT"}(k=e.TransactionStatus||(e.TransactionStatus={})),f.Repo.Ai=25,f.Repo.prototype.ie=function(){this.Di=new n.Tree},f.Repo.prototype.startTransaction=function(r,a,f,v){this.de("transaction on "+r);var A=function(){},L=new i.Reference(this,r);L.on("value",A);var y={path:r,update:a,onComplete:f,status:null,order:l.LUIDGenerator(),applyLocally:v,retryCount:0,unwatcher:function(){L.off("value",A)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},g=this.Mi(r);y.currentInputSnapshot=g;var m=y.update(g.val());if(!(void 0===m)){c.validateFirebaseData("transaction failed: Data returned ",m,y.path),y.status=k.RUN;var R=this.Di.subTree(r),N=R.getValue()||[];N.push(y),R.setValue(N);var O;"object"==typeof m&&null!==m&&p.contains(m,".priority")?(O=p.safeGet(m,".priority"),x.assert(c.isValidPriority(O),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):O=(this.ue.calcCompleteEventCache(r)||u.ChildrenNode.EMPTY_NODE).getPriority().val(),O=O;var b=this.generateServerValues(),S=d.nodeFromJSON(m,O),T=h.resolveDeferredValueSnapshot(S,b);y.currentOutputSnapshotRaw=S,y.currentOutputSnapshotResolved=T,y.currentWriteId=this.pe();var w=this.ue.applyUserOverwrite(r,T,y.currentWriteId,y.applyLocally);this.K.raiseEventsForChangedPath(r,w),this.Li()}else if(y.unwatcher(),y.currentOutputSnapshotRaw=null,y.currentOutputSnapshotResolved=null,y.onComplete){var I=new o.DataSnapshot(y.currentInputSnapshot,new i.Reference(this,y.path),s.PRIORITY_INDEX);y.onComplete(null,!1,I)}},f.Repo.prototype.Mi=function(n,e){return this.ue.calcCompleteEventCache(n,e)||u.ChildrenNode.EMPTY_NODE},f.Repo.prototype.Li=function(o){var r=this;if(void 0===o&&(o=this.Di),o||this.Fi(o),null!==o.getValue()){var e=this.xi(o);x.assert(0<e.length,"Sending zero length transaction queue"),e.every(function(t){return t.status===k.RUN})&&this.ki(o.path(),e)}else o.hasChildren()&&o.forEachChild(function(t){r.Li(t)})},f.Repo.prototype.ki=function(r,e){for(var t=this,n=e.map(function(t){return t.currentWriteId}),u=this.Mi(r,n),c=u,p=u.hash(),d=0,h;d<e.length;d++){h=e[d],x.assert(h.status===k.RUN,"tryToSendTransactionQueue_: items in queue should all be run."),h.status=k.SENT,h.retryCount++;var m=a.Path.relativePath(r,h.path);c=c.updateChild(m,h.currentOutputSnapshotRaw)}var f=c.val(!0),y=r;this.Z.put(""+y,f,function(n){t.de("transaction put response",{path:""+y,status:n});var a=[];if("ok"===n){for(var h=[],u=0;u<e.length;u++){if(e[u].status=k.COMPLETED,a=a.concat(t.ue.ackUserWrite(e[u].currentWriteId)),e[u].onComplete){var c=e[u].currentOutputSnapshotResolved,p=new i.Reference(t,e[u].path),d=new o.DataSnapshot(c,p,s.PRIORITY_INDEX);h.push(e[u].onComplete.bind(null,null,!0,d))}e[u].unwatcher()}t.Fi(t.Di.subTree(r)),t.Li(),t.K.raiseEventsForChangedPath(r,a);for(var u=0;u<h.length;u++)l.exceptionGuard(h[u])}else{if("datastale"===n)for(var u=0;u<e.length;u++)e[u].status=e[u].status===k.SENT_NEEDS_ABORT?k.NEEDS_ABORT:k.RUN;else{l.warn("transaction at "+y+" failed: "+n);for(var u=0;u<e.length;u++)e[u].status=k.NEEDS_ABORT,e[u].abortReason=n}t.le(r)}},p)},f.Repo.prototype.le=function(o){var e=this.Wi(o),t=e.path(),n=this.xi(e);return this.ji(n,t),t},f.Repo.prototype.ji=function(r,e){if(0!==r.length){for(var t=[],n=[],u=r.filter(function(t){return t.status===k.RUN}),y=u.map(function(t){return t.currentWriteId}),v=0;v<r.length;v++){var g=r[v],m=a.Path.relativePath(e,g.path),C=!1,E=void 0;if(x.assert(null!==m,"rerunTransactionsUnderNode_: relativePath should not be null."),g.status===k.NEEDS_ABORT)C=!0,E=g.abortReason,n=n.concat(this.ue.ackUserWrite(g.currentWriteId,!0));else if(g.status===k.RUN)if(g.retryCount>=f.Repo.Ai)C=!0,E="maxretry",n=n.concat(this.ue.ackUserWrite(g.currentWriteId,!0));else{var N=this.Mi(g.path,y);g.currentInputSnapshot=N;var L=r[v].update(N.val());if(void 0!==L){c.validateFirebaseData("transaction failed: Data returned ",L,g.path);var P=d.nodeFromJSON(L),S="object"==typeof L&&null!=L&&p.contains(L,".priority");S||(P=P.updatePriority(N.getPriority()));var T=g.currentWriteId,w=this.generateServerValues(),I=h.resolveDeferredValueSnapshot(P,w);g.currentOutputSnapshotRaw=P,g.currentOutputSnapshotResolved=I,g.currentWriteId=this.pe(),y.splice(y.indexOf(T),1),n=n.concat(this.ue.applyUserOverwrite(g.path,I,g.currentWriteId,g.applyLocally)),n=n.concat(this.ue.ackUserWrite(T,!0))}else C=!0,E="nodata",n=n.concat(this.ue.ackUserWrite(g.currentWriteId,!0))}if(this.K.raiseEventsForChangedPath(e,n),n=[],C&&(r[v].status=k.COMPLETED,function(t){setTimeout(t,0)}(r[v].unwatcher),r[v].onComplete))if("nodata"===E){var R=new i.Reference(this,r[v].path),O=r[v].currentInputSnapshot,A=new o.DataSnapshot(O,R,s.PRIORITY_INDEX);t.push(r[v].onComplete.bind(null,null,!1,A))}else t.push(r[v].onComplete.bind(null,Error(E),!1,null))}this.Fi(this.Di);for(var v=0;v<t.length;v++)l.exceptionGuard(t[v]);this.Li()}},f.Repo.prototype.Wi=function(o){for(var e=this.Di,n;null!==(n=o.getFront())&&null===e.getValue();)e=e.subTree(n),o=o.popFront();return e},f.Repo.prototype.xi=function(n){var e=[];return this.Vi(n,e),e.sort(function(n,e){return n.order-e.order}),e},f.Repo.prototype.Vi=function(o,a){var t=this,e=o.getValue();if(null!==e)for(var n=0;n<e.length;n++)a.push(e[n]);o.forEachChild(function(n){t.Vi(n,a)})},f.Repo.prototype.Fi=function(r){var a=this,e=r.getValue();if(e){for(var t=0,n=0;n<e.length;n++)e[n].status!==k.COMPLETED&&(e[t]=e[n],t++);e.length=t,r.setValue(0<e.length?e:null)}r.forEachChild(function(t){a.Fi(t)})},f.Repo.prototype.fe=function(o){var a=this,e=this.Wi(o).path(),t=this.Di.subTree(o);return t.forEachAncestor(function(t){a.Qi(t)}),this.Qi(t),t.forEachDescendant(function(t){a.Qi(t)}),e},f.Repo.prototype.Qi=function(r){var e=r.getValue();if(null!==e){for(var t=[],n=[],o=-1,a=0;a<e.length;a++)e[a].status===k.SENT_NEEDS_ABORT||(e[a].status===k.SENT?(x.assert(o===a-1,"All SENT items should be at beginning of queue."),o=a,e[a].status=k.SENT_NEEDS_ABORT,e[a].abortReason="set"):(x.assert(e[a].status===k.RUN,"Unexpected transaction status in abort"),e[a].unwatcher(),n=n.concat(this.ue.ackUserWrite(e[a].currentWriteId,!0)),e[a].onComplete&&t.push(e[a].onComplete.bind(null,Error("set"),!1,null))));-1===o?r.setValue(null):e.length=o+1,this.K.raiseEventsForChangedPath(r.path(),n);for(var a=0;a<t.length;a++)l.exceptionGuard(t[a])}}},function(d,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(0),l=t(2),i=t(0),o=function(){return function(){this.children={},this.childCount=0,this.value=null}}();e.TreeNode=o;var r=function(){function a(r,a,t){void 0===r&&(r=""),void 0===a&&(a=null),void 0===t&&(t=new o),this.qi=r,this.Ui=a,this._e=t}return a.prototype.subTree=function(e){for(var t=e instanceof l.Path?e:new l.Path(e),r=this,s;null!==(s=t.getFront());)r=new a(s,r,i.safeGet(r._e.children,s)||new o),t=t.popFront();return r},a.prototype.getValue=function(){return this._e.value},a.prototype.setValue=function(t){n.assert(void 0!==t,"Cannot set value to undefined"),this._e.value=t,this.Bi()},a.prototype.clear=function(){this._e.value=null,this._e.children={},this._e.childCount=0,this.Bi()},a.prototype.hasChildren=function(){return 0<this._e.childCount},a.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},a.prototype.forEachChild=function(e){var t=this;i.forEach(this._e.children,function(n,o){e(new a(n,t,o))})},a.prototype.forEachDescendant=function(o,e,r){e&&!r&&o(this),this.forEachChild(function(e){e.forEachDescendant(o,!0,r)}),e&&r&&o(this)},a.prototype.forEachAncestor=function(o,e){for(var t=e?this:this.parent();null!==t;){if(o(t))return!0;t=t.parent()}return!1},a.prototype.forEachImmediateDescendantWithValue=function(n){this.forEachChild(function(e){null===e.getValue()?e.forEachImmediateDescendantWithValue(n):n(e)})},a.prototype.path=function(){return new l.Path(null===this.Ui?this.qi:this.Ui.path()+"/"+this.qi)},a.prototype.name=function(){return this.qi},a.prototype.parent=function(){return this.Ui},a.prototype.Bi=function(){null!==this.Ui&&this.Ui.Hi(this.qi,this)},a.prototype.Hi=function(o,e){var t=e.isEmpty(),n=i.contains(this._e.children,o);t&&n?(delete this._e.children[o],this._e.childCount--,this.Bi()):t||n||(this._e.children[o]=e._e,this._e.childCount++,this.Bi())},a}();e.Tree=r},function(o,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(54),r=t(53);e.forceLongPolling=function(){n.WebSocketConnection.forceDisallow(),r.BrowserPollConnection.forceAllow()},e.forceWebSockets=function(){r.BrowserPollConnection.forceDisallow()},e.isWebSocketsAvailable=function(){return n.WebSocketConnection.isAvailable()},e.setSecurityDebugCallback=function(n,e){n.repo.J.it=e},e.stats=function(n,e){n.repo.stats(e)},e.statsIncrementCounter=function(n,e){n.repo.statsIncrementCounter(e)},e.dataUpdateCount=function(t){return t.repo.dataUpdateCount},e.interceptServerData=function(n,e){return n.repo.he(e)}},function(s,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=t(34),r=t(50),i=t(26),o=t(52);e.DataConnection=r.PersistentConnection,r.PersistentConnection.prototype.simpleListen=function(n,o){this.sendRequest("q",{p:n},o)},r.PersistentConnection.prototype.echo=function(n,o){this.sendRequest("echo",{d:n},o)},e.RealTimeConnection=o.Connection,e.hijackHash=function(a){var e=r.PersistentConnection.prototype.put;return r.PersistentConnection.prototype.put=function(t,n,r,i){void 0!==i&&(i=a()),e.call(this,t,n,r,i)},function(){r.PersistentConnection.prototype.put=e}},e.ConnectionTarget=n.RepoInfo,e.queryIdentifier=function(t){return t.queryIdentifier()},e.listens=function(t){return t.repo.J.Je},e.forceRestClient=function(t){i.RepoManager.getInstance().forceRestClient(t)}}],[78])}catch(t){throw Error("Cannot instantiate firebase-database.js - be sure to load firebase-app.js first.")}try{webpackJsonpFirebase([3],{116:function(n,e,t){t(117)},117:function(g,e,t){"use strict";function r(n){var e=new Uint8Array(n);return window.btoa(String.fromCharCode.apply(null,e))}function n(t){t.INTERNAL.registerService("messaging",function(t){return self&&"ServiceWorkerGlobalScope"in self?new D(t):new w(t)},{Messaging:w})}Object.defineProperty(e,"__esModule",{value:!0});var o=t(0),s={AVAILABLE_IN_WINDOW:"only-available-in-window",AVAILABLE_IN_SW:"only-available-in-sw",SHOULD_BE_INHERITED:"should-be-overriden",BAD_SENDER_ID:"bad-sender-id",INCORRECT_GCM_SENDER_ID:"incorrect-gcm-sender-id",PERMISSION_DEFAULT:"permission-default",PERMISSION_BLOCKED:"permission-blocked",UNSUPPORTED_BROWSER:"unsupported-browser",NOTIFICATIONS_BLOCKED:"notifications-blocked",FAILED_DEFAULT_REGISTRATION:"failed-serviceworker-registration",SW_REGISTRATION_EXPECTED:"sw-registration-expected",GET_SUBSCRIPTION_FAILED:"get-subscription-failed",INVALID_SAVED_TOKEN:"invalid-saved-token",SW_REG_REDUNDANT:"sw-reg-redundant",TOKEN_SUBSCRIBE_FAILED:"token-subscribe-failed",TOKEN_SUBSCRIBE_NO_TOKEN:"token-subscribe-no-token",TOKEN_SUBSCRIBE_NO_PUSH_SET:"token-subscribe-no-push-set",USE_SW_BEFORE_GET_TOKEN:"use-sw-before-get-token",INVALID_DELETE_TOKEN:"invalid-delete-token",DELETE_TOKEN_NOT_FOUND:"delete-token-not-found",DELETE_SCOPE_NOT_FOUND:"delete-scope-not-found",BG_HANDLER_FUNCTION_EXPECTED:"bg-handler-function-expected",NO_WINDOW_CLIENT_TO_MSG:"no-window-client-to-msg",UNABLE_TO_RESUBSCRIBE:"unable-to-resubscribe",NO_FCM_TOKEN_FOR_RESUBSCRIBE:"no-fcm-token-for-resubscribe",FAILED_TO_DELETE_TOKEN:"failed-to-delete-token",NO_SW_IN_REG:"no-sw-in-reg",BAD_SCOPE:"bad-scope",BAD_VAPID_KEY:"bad-vapid-key",BAD_SUBSCRIPTION:"bad-subscription",BAD_TOKEN:"bad-token",BAD_PUSH_SET:"bad-push-set",FAILED_DELETE_VAPID_KEY:"failed-delete-vapid-key"},v=(P={},P[s.AVAILABLE_IN_WINDOW]="This method is available in a Window context.",P[s.AVAILABLE_IN_SW]="This method is available in a service worker context.",P["should-be-overriden"]="This method should be overriden by extended classes.",P["bad-sender-id"]="Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().",P["permission-default"]="The required permissions were not granted and dismissed instead.",P["permission-blocked"]="The required permissions were not granted and blocked instead.",P["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",P["notifications-blocked"]="Notifications have been blocked.",P[s.FAILED_DEFAULT_REGISTRATION]="We are unable to register the default service worker. {$browserErrorMessage}",P["sw-registration-expected"]="A service worker registration was the expected input.",P["get-subscription-failed"]="There was an error when trying to get any existing Push Subscriptions.",P["invalid-saved-token"]="Unable to access details of the saved token.",P["sw-reg-redundant"]="The service worker being used for push was made redundant.",P["token-subscribe-failed"]="A problem occured while subscribing the user to FCM: {$message}",P["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",P["token-subscribe-no-push-set"]="FCM returned an invalid response when getting an FCM token.",P["use-sw-before-get-token"]="You must call useServiceWorker() before calling getToken() to ensure your service worker is used.",P["invalid-delete-token"]="You must pass a valid token into deleteToken(), i.e. the token from getToken().",P["delete-token-not-found"]="The deletion attempt for token could not be performed as the token was not found.",P["delete-scope-not-found"]="The deletion attempt for service worker scope could not be performed as the scope was not found.",P["bg-handler-function-expected"]="The input to setBackgroundMessageHandler() must be a function.",P["no-window-client-to-msg"]="An attempt was made to message a non-existant window client.",P["unable-to-resubscribe"]="There was an error while re-subscribing the FCM token for push messaging. Will have to resubscribe the user on next visit. {$message}",P["no-fcm-token-for-resubscribe"]="Could not find an FCM token and as a result, unable to resubscribe. Will have to resubscribe the user on next visit.",P["failed-to-delete-token"]="Unable to delete the currently saved token.",P["no-sw-in-reg"]="Even though the service worker registration was successful, there was a problem accessing the service worker itself.",P["incorrect-gcm-sender-id"]="Please change your web app manifest's 'gcm_sender_id' value to '103953800507' to use Firebase messaging.",P["bad-scope"]="The service worker scope must be a string with at least one character.",P["bad-vapid-key"]="The public VAPID key must be a string with at least one character.",P["bad-subscription"]="The subscription must be a valid PushSubscription.",P["bad-token"]="The FCM Token used for storage / lookup was not a valid token string.",P["bad-push-set"]="The FCM push set used for storage / lookup was not not a valid push set string.",P["failed-delete-vapid-key"]="The VAPID key could not be deleted.",P),x={codes:s,map:v},u=function(t){return r(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},C=[4,51,148,247,223,161,235,177,220,3,162,94,21,113,219,72,211,46,237,237,178,52,219,183,71,58,12,143,196,204,225,111,60,140,132,223,171,182,102,62,242,12,212,139,254,227,249,118,47,20,28,99,8,106,111,45,177,26,149,176,206,55,192,156,110],I={userVisibleOnly:!0,applicationServerKey:new Uint8Array(C)},L={ENDPOINT:"https://fcm.googleapis.com",APPLICATION_SERVER_KEY:C,SUBSCRIPTION_OPTIONS:I},h="fcm_token_object_Store",p=function(){function a(){this.e=new o.ErrorFactory("messaging","Messaging",x.map),this.t=null}return a.prototype.r=function(){return this.t?this.t:(this.t=new Promise(function(o,t){var e=indexedDB.open(a.DB_NAME,1);e.onerror=function(n){t(n.target.error)},e.onsuccess=function(t){o(t.target.result)},e.onupgradeneeded=function(n){var e=n.target.result,t=e.createObjectStore(h,{keyPath:"swScope"});t.createIndex("fcmSenderId","fcmSenderId",{unique:!1}),t.createIndex("fcmToken","fcmToken",{unique:!0})}}),this.t)},a.prototype.closeDatabase=function(){var n=this;return this.t?this.t.then(function(e){e.close(),n.t=null}):Promise.resolve()},a.prototype.getTokenDetailsFromToken=function(d){return this.r().then(function(e){return new Promise(function(t,r){var n=e.transaction([h]),o=n.objectStore(h),i=o.index("fcmToken"),s=i.get(d);s.onerror=function(t){r(t.target.error)},s.onsuccess=function(n){t(n.target.result)}})})},a.prototype.n=function(a){return this.r().then(function(e){return new Promise(function(t,r){var n=e.transaction([h]),o=n.objectStore(h),i=o.get(a);i.onerror=function(t){r(t.target.error)},i.onsuccess=function(n){t(n.target.result)}})})},a.prototype.o=function(o){return this.r().then(function(e){return new Promise(function(d,t){var n=e.transaction([h]),r=n.objectStore(h),i=[],s=r.openCursor();s.onerror=function(n){t(n.target.error)},s.onsuccess=function(e){var t=e.target.result;t?(t.value.fcmSenderId===o&&i.push(t.value),t.continue()):d(i)}})})},a.prototype.subscribeToFCM=function(d,e,t){var l=this,n=u(e.getKey("p256dh")),o=u(e.getKey("auth")),r="authorized_entity="+d+"&endpoint="+e.endpoint+"&encryption_key="+n+"&encryption_auth="+o;t&&(r+="&pushSet="+t);var i=new Headers;i.append("Content-Type","application/x-www-form-urlencoded");var p={method:"POST",headers:i,body:r};return fetch(L.ENDPOINT+"/fcm/connect/subscribe",p).then(function(t){return t.json()}).then(function(n){var e=n;if(e.error){var t=e.error.message;throw l.e.create(x.codes.TOKEN_SUBSCRIBE_FAILED,{message:t})}if(!e.token)throw l.e.create(x.codes.TOKEN_SUBSCRIBE_NO_TOKEN);if(!e.pushSet)throw l.e.create(x.codes.TOKEN_SUBSCRIBE_NO_PUSH_SET);return{token:e.token,pushSet:e.pushSet}})},a.prototype.i=function(n,e){return n.endpoint===e.endpoint&&u(n.getKey("auth"))===e.auth&&u(n.getKey("p256dh"))===e.p256dh},a.prototype.s=function(a,s,t,r,d){var l={swScope:s.scope,endpoint:t.endpoint,auth:u(t.getKey("auth")),p256dh:u(t.getKey("p256dh")),fcmToken:r,fcmPushSet:d,fcmSenderId:a};return this.r().then(function(a){return new Promise(function(e,t){var r=a.transaction([h],"readwrite"),n=r.objectStore(h),o=n.put(l);o.onerror=function(n){t(n.target.error)},o.onsuccess=function(){e()}})})},a.prototype.getSavedToken=function(n,o){var a=this;return o instanceof ServiceWorkerRegistration?"string"!=typeof n||0===n.length?Promise.reject(this.e.create(x.codes.BAD_SENDER_ID)):this.o(n).then(function(e){if(0!==e.length){var t=e.findIndex(function(e){return o.scope===e.swScope&&n===e.fcmSenderId});if(-1!==t)return e[t]}}).then(function(n){if(n)return o.pushManager.getSubscription().catch(function(){throw a.e.create(x.codes.GET_SUBSCRIPTION_FAILED)}).then(function(e){if(e&&a.i(e,n))return n.fcmToken})}):Promise.reject(this.e.create(x.codes.SW_REGISTRATION_EXPECTED))},a.prototype.createToken=function(a,s){var d=this;if("string"!=typeof a||0===a.length)return Promise.reject(this.e.create(x.codes.BAD_SENDER_ID));if(!(s instanceof ServiceWorkerRegistration))return Promise.reject(this.e.create(x.codes.SW_REGISTRATION_EXPECTED));var r,t;return s.pushManager.getSubscription().then(function(t){return t||s.pushManager.subscribe(L.SUBSCRIPTION_OPTIONS)}).then(function(e){return r=e,d.subscribeToFCM(a,r)}).then(function(e){return t=e,d.s(a,s,r,t.token,t.pushSet)}).then(function(){return t.token})},a.prototype.deleteToken=function(n){var a=this;return"string"!=typeof n||0===n.length?Promise.reject(this.e.create(x.codes.INVALID_DELETE_TOKEN)):this.getTokenDetailsFromToken(n).then(function(t){if(!t)throw a.e.create(x.codes.DELETE_TOKEN_NOT_FOUND);return a.r().then(function(e){return new Promise(function(d,n){var o=e.transaction([h],"readwrite"),r=o.objectStore(h),i=r.delete(t.swScope);i.onerror=function(t){n(t.target.error)},i.onsuccess=function(e){return 0===e.target.result?void n(a.e.create(x.codes.FAILED_TO_DELETE_TOKEN)):void d(t)}})})})},a}(),l="messagingSenderId",E=function(){function t(n){var r=this;if(this.e=new o.ErrorFactory("messaging","Messaging",x.map),!n.options[l]||"string"!=typeof n.options[l])throw this.e.create(x.codes.BAD_SENDER_ID);this.a=n.options[l],this.c=new p,this.app=n,this.INTERNAL={},this.INTERNAL.delete=function(){return r.delete}}return t.prototype.getToken=function(){var n=this,e=this.u();return"granted"===e?this._().then(function(e){return n.c.getSavedToken(n.a,e).then(function(t){return t||n.c.createToken(n.a,e)})}):"denied"===e?Promise.reject(this.e.create(x.codes.NOTIFICATIONS_BLOCKED)):Promise.resolve(null)},t.prototype.deleteToken=function(n){var e=this;return this.c.deleteToken(n).then(function(){return e._().then(function(t){if(t)return t.pushManager.getSubscription()}).then(function(t){if(t)return t.unsubscribe()})})},t.prototype._=function(){throw this.e.create(x.codes.SHOULD_BE_INHERITED)},t.prototype.requestPermission=function(){throw this.e.create(x.codes.AVAILABLE_IN_WINDOW)},t.prototype.useServiceWorker=function(){throw this.e.create(x.codes.AVAILABLE_IN_WINDOW)},t.prototype.onMessage=function(){throw this.e.create(x.codes.AVAILABLE_IN_WINDOW)},t.prototype.onTokenRefresh=function(){throw this.e.create(x.codes.AVAILABLE_IN_WINDOW)},t.prototype.setBackgroundMessageHandler=function(){throw this.e.create(x.codes.AVAILABLE_IN_SW)},t.prototype.delete=function(){return this.c.closeDatabase()},t.prototype.u=function(){return Notification.permission},t.prototype.getTokenManager=function(){return this.c},t}(),T=E,S={TYPE_OF_MSG:"firebase-messaging-msg-type",DATA:"firebase-messaging-msg-data"},R={PARAMS:S,TYPES_OF_MSG:{PUSH_MSG_RECEIVED:"push-msg-received",NOTIFICATION_CLICKED:"notification-clicked"},createNewMsg:function(n,e){return t={},t[S.TYPE_OF_MSG]=n,t[S.DATA]=e,t;var t}},m={path:"/firebase-messaging-sw.js",scope:"/firebase-cloud-messaging-push-scope"},y=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t])};return function(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}}(),N=function(n){function e(e){var a=n.call(this,e)||this;return a.d=null,a.f=Object(o.createSubscribe)(function(t){a.d=t}),a.h=null,a.p=Object(o.createSubscribe)(function(t){a.h=t}),a.l(),a}return y(e,n),e.prototype.getToken=function(){var e=this;return this.g()?this.T().then(function(){return n.prototype.getToken.call(e)}):Promise.reject(this.e.create(x.codes.UNSUPPORTED_BROWSER))},e.prototype.T=function(){var n=this;if(this.S)return this.S;var e=document.querySelector("link[rel=\"manifest\"]");return this.S=e?fetch(e.href).then(function(t){return t.json()}).catch(function(){return Promise.resolve()}).then(function(e){if(e&&e.gcm_sender_id&&"103953800507"!==e.gcm_sender_id)throw n.e.create(x.codes.INCORRECT_GCM_SENDER_ID)}):Promise.resolve(),this.S},e.prototype.requestPermission=function(){var o=this;return"granted"===Notification.permission?Promise.resolve():new Promise(function(e,t){var r=function(r){return"granted"===r?e():t("denied"===r?o.e.create(x.codes.PERMISSION_BLOCKED):o.e.create(x.codes.PERMISSION_DEFAULT))},n=Notification.requestPermission(function(t){n||r(t)});n&&n.then(r)})},e.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw this.e.create(x.codes.SW_REGISTRATION_EXPECTED);if(void 0!==this.b)throw this.e.create(x.codes.USE_SW_BEFORE_GET_TOKEN);this.b=t},e.prototype.onMessage=function(n,e,t){return this.f(n,e,t)},e.prototype.onTokenRefresh=function(n,e,t){return this.p(n,e,t)},e.prototype.v=function(a){var e=this,t=a.installing||a.waiting||a.active;return new Promise(function(s,n){if(!t)return void n(e.e.create(x.codes.NO_SW_IN_REG));if("activated"===t.state)return void s(a);if("redundant"===t.state)return void n(e.e.create(x.codes.SW_REG_REDUNDANT));var o=function(){if("activated"===t.state)s(a);else{if("redundant"!==t.state)return;n(e.e.create(x.codes.SW_REG_REDUNDANT))}t.removeEventListener("statechange",o)};t.addEventListener("statechange",o)})},e.prototype._=function(){var n=this;return this.b?this.v(this.b):(this.b=null,navigator.serviceWorker.register(m.path,{scope:m.scope}).catch(function(e){throw n.e.create(x.codes.FAILED_DEFAULT_REGISTRATION,{browserErrorMessage:e.message})}).then(function(e){return n.v(e).then(function(){return n.b=e,e.update(),e})}))},e.prototype.l=function(){var t=this;"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",function(e){if(e.data&&e.data[R.PARAMS.TYPE_OF_MSG]){var o=e.data;switch(o[R.PARAMS.TYPE_OF_MSG]){case R.TYPES_OF_MSG.PUSH_MSG_RECEIVED:case R.TYPES_OF_MSG.NOTIFICATION_CLICKED:var r=o[R.PARAMS.DATA];t.d.next(r);}}},!1)},e.prototype.g=function(){return"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")},e}(T),w=N,_=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,e){n.__proto__=e}||function(n,e){for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t])};return function(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}}(),O=function(n){function e(e){var o=n.call(this,e)||this;return self.addEventListener("push",function(t){return o.I(t)},!1),self.addEventListener("pushsubscriptionchange",function(t){return o.m(t)},!1),self.addEventListener("notificationclick",function(t){return o.y(t)},!1),o.N=null,o}return _(e,n),e.prototype.I=function(o){var a=this,r;try{r=o.data.json()}catch(t){return}var e=this.w().then(function(t){if(!t){var i=a.O(r);if(i){var n=i.title||"";return self.registration.showNotification(n,i)}if(a.N)return a.N(r)}else if(r.notification||a.N)return a.k(r)});o.waitUntil(e)},e.prototype.m=function(n){var o=this,e=this.getToken().then(function(t){if(!t)throw o.e.create(x.codes.NO_FCM_TOKEN_FOR_RESUBSCRIBE);var a=null,r=o.getTokenManager();return r.getTokenDetailsFromToken(t).then(function(t){if(!(a=t))throw o.e.create(x.codes.INVALID_SAVED_TOKEN);return self.registration.pushManager.subscribe(L.SUBSCRIPTION_OPTIONS)}).then(function(t){return r.subscribeToFCM(a.fcmSenderId,t,a.fcmPushSet)}).catch(function(t){return r.deleteToken(a.fcmToken).then(function(){throw o.e.create(x.codes.UNABLE_TO_RESUBSCRIBE,{message:t})})})});n.waitUntil(e)},e.prototype.y=function(a){var i=this;if(a.notification&&a.notification.data&&a.notification.data.FCM_MSG){a.stopImmediatePropagation(),a.notification.close();var t=a.notification.data.FCM_MSG,r=t.notification.click_action;if(r){var e=this.D(r).then(function(t){return t||self.clients.openWindow(r)}).then(function(o){if(o){t.notification,delete t.notification;var e=R.createNewMsg(R.TYPES_OF_MSG.NOTIFICATION_CLICKED,t);return i.A(o,e)}});a.waitUntil(e)}}},e.prototype.O=function(n){if(n&&"object"==typeof n.notification){var e=Object.assign({},n.notification);return e.data=(t={},t.FCM_MSG=n,t),e;var t}},e.prototype.setBackgroundMessageHandler=function(t){if(t&&"function"!=typeof t)throw this.e.create(x.codes.BG_HANDLER_FUNCTION_EXPECTED);this.N=t},e.prototype.D=function(n){var o=new URL(n).href;return self.clients.matchAll({type:"window",includeUncontrolled:!0}).then(function(t){for(var e=null,r=0;r<t.length;r++)if(new URL(t[r].url).href===o){e=t[r];break}if(e)return e.focus(),e})},e.prototype.A=function(a,e){var t=this;return new Promise(function(r,n){return a?void(a.postMessage(e),r()):n(t.e.create(x.codes.NO_WINDOW_CLIENT_TO_MSG))})},e.prototype.w=function(){return self.clients.matchAll({type:"window",includeUncontrolled:!0}).then(function(t){return t.some(function(t){return"visible"===t.visibilityState})})},e.prototype.k=function(o){var r=this;return self.clients.matchAll({type:"window",includeUncontrolled:!0}).then(function(e){var t=R.createNewMsg(R.TYPES_OF_MSG.PUSH_MSG_RECEIVED,o);return Promise.all(e.map(function(n){return r.A(n,t)}))})},e.prototype._=function(){return Promise.resolve(self.registration)},e}(T),D=O,A=t(6),P;e.registerMessaging=n,n(A.firebase)}},[116])}catch(t){throw Error("Cannot instantiate firebase-messaging.js - be sure to load firebase-app.js first.")}try{webpackJsonpFirebase([2],{118:function(o,t,e){e(119)},119:function(xe,t,e){"use strict";function n(e){return"storage/"+e}function r(){return new Tt(te.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function Ce(e){return new Tt(te.OBJECT_NOT_FOUND,"Object '"+e+"' does not exist.")}function o(e){return new Tt(te.QUOTA_EXCEEDED,"Quota for bucket '"+e+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function a(){return new Tt(te.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again.")}function i(e){return new Tt(te.UNAUTHORIZED,"User does not have permission to access '"+e+"'.")}function s(){return new Tt(te.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function c(){return new Tt(te.CANCELED,"User canceled the upload/download.")}function Se(e){return new Tt(te.INVALID_URL,"Invalid URL '"+e+"'.")}function l(e){return new Tt(te.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+e+"'.")}function ke(){return new Tt(te.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function f(){return new Tt(te.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function d(){return new Tt(te.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function p(o,t,e){return new Tt(te.INVALID_ARGUMENT,"Invalid argument in `"+t+"` at index "+o+": "+e)}function u(a,t,e,n){var r,o;return a===t?(r=a,o=1===a?"argument":"arguments"):(r="between "+a+" and "+t,o="arguments"),new Tt(te.INVALID_ARGUMENT_COUNT,"Invalid argument count in `"+e+"`: Expected "+r+" "+o+", received "+n+".")}function h(){return new Tt(te.APP_DELETED,"The Firebase app was deleted.")}function m(e){return new Tt(te.INVALID_ROOT_OPERATION,"The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function g(n,t){return new Tt(te.INVALID_FORMAT,"String does not match format '"+n+"': "+t)}function y(e){throw new Tt(te.INTERNAL_ERROR,"Internal error: "+e)}function b(e){switch(e){case ee.RAW:case ee.BASE64:case ee.BASE64URL:case ee.DATA_URL:return;default:throw"Expected one of the event types: ["+ee.RAW+", "+ee.BASE64+", "+ee.BASE64URL+", "+ee.DATA_URL+"].";}}function v(n,t){switch(n){case ee.RAW:return new wt(E(t));case ee.BASE64:case ee.BASE64URL:return new wt(T(n,t));case ee.DATA_URL:return new wt(A(t),N(t));}throw r()}function E(s){for(var t=[],e=0,n;e<s.length;e++)if(n=s.charCodeAt(e),127>=n)t.push(n);else if(2047>=n)t.push(192|n>>6,128|63&n);else if(55296==(64512&n)){var r=e<s.length-1&&56320==(64512&s.charCodeAt(e+1));if(r){var o=n,i=s.charCodeAt(++e);n=65536|(1023&o)<<10|1023&i,t.push(240|n>>18,128|63&n>>12,128|63&n>>6,128|63&n)}else t.push(239,191,189)}else 56320==(64512&n)?t.push(239,191,189):t.push(224|n>>12,128|63&n>>6,128|63&n);return new Uint8Array(t)}function w(n){var t;try{t=decodeURIComponent(n)}catch(e){throw g(ee.DATA_URL,"Malformed data URL.")}return E(t)}function T(d,t){switch(d){case ee.BASE64:var e=-1!==t.indexOf("-"),n=-1!==t.indexOf("_");if(e||n){var r=e?"-":"_";throw g(d,"Invalid character '"+r+"' found: is it base64url encoded?")}break;case ee.BASE64URL:var o=-1!==t.indexOf("+"),i=-1!==t.indexOf("/");if(o||i){var r=o?"+":"/";throw g(d,"Invalid character '"+r+"' found: is it base64 encoded?")}t=t.replace(/-/g,"+").replace(/_/g,"/");}var a;try{a=atob(t)}catch(t){throw g(d,"Invalid character found")}for(var s=new Uint8Array(a.length),l=0;l<a.length;l++)s[l]=a.charCodeAt(l);return s}function A(n){var t=new re(n);return t.base64?T(ee.BASE64,t.rest):w(t.rest)}function N(e){return new re(e).contentType}function R(n,t){return!!(n.length>=t.length)&&n.substring(n.length-t.length)===t}function C(e){switch(e){case It.RUNNING:case It.PAUSING:case It.CANCELING:return ae.RUNNING;case It.PAUSED:return ae.PAUSED;case It.SUCCESS:return ae.SUCCESS;case It.CANCELED:return ae.CANCELED;case It.ERROR:default:return ae.ERROR;}}function S(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function k(o,t){for(var e in o)S(o,e)&&t(e,o[e])}function I(n){if(null==n)return{};var o={};return k(n,function(e,t){o[e]=t}),o}function L(e){return new Promise(e)}function O(e){return Promise.resolve(e)}function x(e){return Promise.reject(e)}function P(e){return null!=e}function _(e){return void 0!==e}function D(e){return"function"==typeof e}function M(e){return"object"==typeof e}function B(e){return M(e)&&null!==e}function U(e){return M(e)&&!Array.isArray(e)}function W(e){return"string"==typeof e||e instanceof String}function F(e){return"number"==typeof e||e instanceof Number}function H(e){return j()&&e instanceof Blob}function j(){return"undefined"!=typeof Blob}function q(n){var t;try{t=JSON.parse(n)}catch(e){return null}return U(t)?t:null}function V(n){if(0==n.length)return null;var t=n.lastIndexOf("/");return-1===t?"":n.slice(0,t)}function z(o,t){var e=t.split("/").filter(function(e){return 0<e.length}).join("/");return 0===o.length?e:o+"/"+e}function K(n){var t=n.lastIndexOf("/",n.length-2);return-1===t?n:n.slice(t+1)}function G(e){return Ct+Et+e}function X(e){return St+Et+e}function Q(e){return Ct+kt+e}function Y(o){var a=encodeURIComponent,e="?";return k(o,function(n,t){var r=a(n)+"="+a(t);e=e+r+"&"}),e=e.slice(0,-1)}function J(n,t){return t}function $(e){return!W(e)||2>e.length?e:(e=e,K(e))}function Z(){function a(n,o){return $(o)}function t(n,t){return P(t)?+t:t}function e(a,t){if(!(W(t)&&0<t.length))return[];var i=encodeURIComponent;return t.split(",").map(function(t){var n=a.bucket,r=a.fullPath;return X("/b/"+i(n)+"/o/"+i(r))+Y({alt:"media",token:t})})}if(he)return he;var n=[new le("bucket"),new le("generation"),new le("metageneration"),new le("name","fullPath",!0)],r=new le("name");r.xform=a,n.push(r);var o=new le("size");return o.xform=t,n.push(o),n.push(new le("timeCreated")),n.push(new le("updated")),n.push(new le("md5Hash",null,!0)),n.push(new le("cacheControl",null,!0)),n.push(new le("contentDisposition",null,!0)),n.push(new le("contentEncoding",null,!0)),n.push(new le("contentLanguage",null,!0)),n.push(new le("contentType",null,!0)),n.push(new le("metadata","customMetadata",!0)),n.push(new le("downloadTokens","downloadURLs",!1,e)),he=n}function Ie(a,t){function e(){var e=a.bucket,i=a.fullPath,r=new ce(e,i);return t.makeStorageReference(r)}Object.defineProperty(a,"ref",{get:e})}function Le(s,t,e){for(var n={type:"file"},r=e.length,o=0,i;o<r;o++)i=e[o],n[i.local]=i.xform(n,t[i.server]);return Ie(n,s),n}function Pe(o,t,e){var n=q(t);return null===n?null:Le(o,n,e)}function De(a,t){for(var e={},n=t.length,r=0,o;r<n;r++)o=t[r],o.writable&&(e[o.server]=a[o.local]);return JSON.stringify(e)}function Me(o){if(!o||!M(o))throw"Expected Metadata object.";for(var r in o){var e=o[r];if("customMetadata"==r){if(!M(e))throw"Expected object for 'customMetadata' mapping.";}else if(B(e))throw"Mapping for '"+r+"' cannot be an object."}}function Fe(a,t,e){for(var n=t.length,r=t.length,o=0;o<t.length;o++)if(t[o].optional){n=o;break}if(!(n<=e.length&&e.length<=r))throw u(n,r,a,e.length);for(var o=0;o<e.length;o++)try{t[o].validator(e[o])}catch(t){throw t instanceof Error?p(o,a,t.message):p(o,a,t)}}function Be(o,t){return function(e){o(e),t(e)}}function Ve(o,t){function e(e){if(!W(e))throw"Expected string."}var n;return n=o?Be(e,o):e,new pe(n,t)}function We(){function e(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer||j()&&e instanceof Blob))throw"Expected Blob or File."}return new pe(e)}function He(e){return new pe(Me,e)}function je(){function e(e){if(!(F(e)&&0<=e))throw"Expected a number 0 or greater."}return new pe(e)}function qe(n,t){return new pe(function(t){if(!(null===t||P(t)&&t instanceof Object))throw"Expected an Object.";void 0!==n&&null!==n&&n(t)},t)}function ze(e){return new pe(function(e){if(null!==e&&!D(e))throw"Expected a Function."},e)}function Ke(){return"undefined"==typeof BlobBuilder?"undefined"==typeof WebKitBlobBuilder?void 0:WebKitBlobBuilder:BlobBuilder}function Ge(){for(var a=[],t=0;t<arguments.length;t++)a[t]=arguments[t];var e=Ke();if(void 0!==e){for(var n=new e,r=0;r<a.length;r++)n.append(a[r]);return n.getBlob()}if(j())return new Blob(a);throw Error("This browser doesn't seem to support creating Blobs")}function Xe(o,t,e){return o.webkitSlice?o.webkitSlice(t,e):o.mozSlice?o.mozSlice(t,e):o.slice?o.slice(t,e):null}function Qe(n,t){return-1!==n.indexOf(t)}function Ye(e){return Array.prototype.slice.call(e)}function Je(o,t){var e=o.indexOf(t);-1!==e&&o.splice(e,1)}function $e(e){if(!e)throw r()}function Ze(a,t){function e(e,i){var r=Pe(a,i,t);return $e(null!==r),r}return e}function et(s){function t(t,d){var n;return n=401===t.getStatus()?a():402===t.getStatus()?o(s.bucket):403===t.getStatus()?i(s.path):d,n.setServerResponseProp(d.serverResponseProp()),n}return t}function tt(a){function t(t,n){var r=i(t,n);return 404===t.getStatus()&&(r=Ce(a.path)),r.setServerResponseProp(n.serverResponseProp()),r}var i=et(a);return t}function nt(s,t,e){var n=t.fullServerUrl(),r=G(n),o=s.maxOperationRetryTime(),i=new de(r,"GET",Ze(s,e),o);return i.errorHandler=tt(t),i}function ot(s,t,e,n){var r=t.fullServerUrl(),o=G(r),i=De(e,n),a=s.maxOperationRetryTime(),d=new de(o,"PATCH",Ze(s,n),a);return d.headers={"Content-Type":"application/json; charset=utf-8"},d.body=i,d.errorHandler=tt(t),d}function rt(n,t){var e=t.fullServerUrl(),r=G(e),o=n.maxOperationRetryTime(),i=new de(r,"DELETE",function(){},o);return i.successCodes=[200,204],i.errorHandler=tt(t),i}function at(n,t){return n&&n.contentType||t&&t.type()||"application/octet-stream"}function it(o,t,e){var n=I(e);return n.fullPath=o.path,n.size=t.size(),n.contentType||(n.contentType=at(null,t)),n}function st(h,t,e,n,r){var o=t.bucketOnlyServerUrl(),i={"X-Goog-Upload-Protocol":"multipart"},a=function(){for(var n="",t=0;2>t;t++)n+=(""+Math.random()).slice(2);return n}();i["Content-Type"]="multipart/related; boundary="+a;var s=it(t,n,r),u=De(s,e),c="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+u+"\r\n--"+a+"\r\nContent-Type: "+s.contentType+"\r\n\r\n",l=fe.getBlob(c,n,"\r\n--"+a+"--");if(null===l)throw ke();var p={name:s.fullPath},d=Q(o),m=h.maxUploadRetryTime(),g=new de(d,"POST",Ze(h,e),m);return g.urlParams=p,g.headers=i,g.body=l.uploadData(),g.errorHandler=et(t),g}function dt(o,t){var e;try{e=o.getResponseHeader("X-Goog-Upload-Status")}catch(e){$e(!1)}return $e(Qe(t||["active"],e)),e}function lt(i,t,e,n,r){var o=t.bucketOnlyServerUrl(),a=it(t,n,r),s={name:a.fullPath},d=Q(o),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":n.size(),"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},l=De(a,e),u=i.maxUploadRetryTime(),p=new de(d,"POST",function(e){dt(e);var t;try{t=e.getResponseHeader("X-Goog-Upload-URL")}catch(e){$e(!1)}return $e(W(t)),t},u);return p.urlParams=s,p.headers=c,p.body=l,p.errorHandler=et(t),p}function pt(i,t,e,d){function n(e){var t=dt(e,["active","final"]),r;try{r=e.getResponseHeader("X-Goog-Upload-Size-Received")}catch(e){$e(!1)}var n=parseInt(r,10);return $e(!isNaN(n)),new _e(n,d.size(),"final"===t)}var o=i.maxUploadRetryTime(),r=new de(e,"POST",n,o);return r.headers={"X-Goog-Upload-Command":"query"},r.errorHandler=et(t),r}function ct(d,x,e,C,t,r,n,o){function a(e,t){var n=dt(e,["active","final"]),a=i.current+l,s=C.size(),d;return d="final"===n?Ze(x,r)(e,t):null,new _e(a,s,"final"===n,d)}var i=new _e(0,0);if(n?(i.current=n.current,i.total=n.total):(i.current=0,i.total=C.size()),C.size()!==i.total)throw f();var s=i.total-i.current,l=s;0<t&&(l=Math.min(l,t));var c=i.current,p=c+l,u=l===s?"upload, finalize":"upload",h={"X-Goog-Upload-Command":u,"X-Goog-Upload-Offset":i.current},b=C.slice(c,p);if(null===b)throw ke();var m=x.maxUploadRetryTime(),g=new de(e,"POST",a,m);return g.headers=h,g.body=b.uploadData(),g.progressCallback=o||null,g.errorHandler=et(d),g}function ut(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];O(!0).then(function(){n.apply(null,t)})}}function ht(d,t,e){function n(){return 2===l}function r(){h||(h=!0,t.apply(null,arguments))}function o(t){u=setTimeout(function(){u=null,d(i,n())},t)}function i(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];if(!h){if(i)return void r.apply(null,arguments);if(n()||c)return void r.apply(null,arguments);64>s&&(s*=2);var d;1===l?(l=2,d=0):d=1e3*(s+Math.random()),o(d)}}function a(e){m||(m=!0,h||(null===u?e||(l=1):(e||(l=2),clearTimeout(u),o(0))))}var s=1,u=null,c=!1,l=0,h=!1,m=!1;return o(0),setTimeout(function(){c=!0,a(!0)},e),a}function mt(e){e(!1)}function gt(n,t){null!==t&&0<t.length&&(n.Authorization="Firebase "+t)}function ft(n){var t=void 0===xt.default?"AppManager":xt.default.SDK_VERSION;n["X-Firebase-Storage-Version"]="webjs/"+t}function yt(a,t,e){var n=Y(a.urlParams),r=a.url+n,o=I(a.headers);return gt(o,t),ft(o),new we(r,a.method,o,a.body,a.successCodes,a.additionalRetryCodes,a.handler,a.errorHandler,a.timeout,a.progressCallback,e)}function bt(o,t,e){return new Te(o,new ue(),e)}function vt(e){e.INTERNAL.registerService(Ne,bt,{TaskState:ae,TaskEvent:oe,StringFormat:ee,Storage:Te,Reference:ge},void 0,!0)}Object.defineProperty(t,"__esModule",{value:!0});var xt=e(6),Ct="https://firebasestorage.googleapis.com",St="https://firebasestorage.googleapis.com",Et="/v0",kt="/v0",Tt=function(){function e(o,r){this.t=n(o),this.e="Firebase Storage: "+r,this.n=null,this.r="FirebaseError"}return e.prototype.codeProp=function(){return this.code},e.prototype.codeEquals=function(e){return n(e)===this.codeProp()},e.prototype.serverResponseProp=function(){return this.n},e.prototype.setServerResponseProp=function(e){this.n=e},Object.defineProperty(e.prototype,"name",{get:function(){return this.r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"code",{get:function(){return this.t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this.e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"serverResponse",{get:function(){return this.n},enumerable:!0,configurable:!0}),e}(),te={UNKNOWN:"unknown",OBJECT_NOT_FOUND:"object-not-found",BUCKET_NOT_FOUND:"bucket-not-found",PROJECT_NOT_FOUND:"project-not-found",QUOTA_EXCEEDED:"quota-exceeded",UNAUTHENTICATED:"unauthenticated",UNAUTHORIZED:"unauthorized",RETRY_LIMIT_EXCEEDED:"retry-limit-exceeded",INVALID_CHECKSUM:"invalid-checksum",CANCELED:"canceled",INVALID_EVENT_NAME:"invalid-event-name",INVALID_URL:"invalid-url",INVALID_DEFAULT_BUCKET:"invalid-default-bucket",NO_DEFAULT_BUCKET:"no-default-bucket",CANNOT_SLICE_BLOB:"cannot-slice-blob",SERVER_FILE_WRONG_SIZE:"server-file-wrong-size",NO_DOWNLOAD_URL:"no-download-url",INVALID_ARGUMENT:"invalid-argument",INVALID_ARGUMENT_COUNT:"invalid-argument-count",APP_DELETED:"app-deleted",INVALID_ROOT_OPERATION:"invalid-root-operation",INVALID_FORMAT:"invalid-format",INTERNAL_ERROR:"internal-error"},ee={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},wt=function(){function e(n,o){this.data=n,this.contentType=o||null}return e}(),re=function(){function e(o){this.base64=!1,this.contentType=null;var r=o.match(/^data:([^,]+)?,/);if(null===r)throw g(ee.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");var e=r[1]||null;null!=e&&(this.base64=R(e,";base64"),this.contentType=this.base64?e.substring(0,e.length-7):e),this.rest=o.substring(o.indexOf(",")+1)}return e}(),oe={STATE_CHANGED:"state_changed"},It={RUNNING:"running",PAUSING:"pausing",PAUSED:"paused",SUCCESS:"success",CANCELING:"canceling",CANCELED:"canceled",ERROR:"error"},ae={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"},Nt;!function(e){e[e.NO_ERROR=0]="NO_ERROR",e[e.NETWORK_ERROR=1]="NETWORK_ERROR",e[e.ABORT=2]="ABORT"}(Nt||(Nt={}));var At=function(){function e(){var n=this;this.o=!1,this.i=new XMLHttpRequest,this.a=Nt.NO_ERROR,this.s=L(function(t){n.i.addEventListener("abort",function(){n.a=Nt.ABORT,t(n)}),n.i.addEventListener("error",function(){n.a=Nt.NETWORK_ERROR,t(n)}),n.i.addEventListener("load",function(){t(n)})})}return e.prototype.send=function(a,t,e,n){var r=this;if(this.o)throw y("cannot .send() more than once");return this.o=!0,this.i.open(t,a,!0),P(n)&&k(n,function(n,t){r.i.setRequestHeader(n,""+t)}),P(e)?this.i.send(e):this.i.send(),this.s},e.prototype.getErrorCode=function(){if(!this.o)throw y("cannot .getErrorCode() before sending");return this.a},e.prototype.getStatus=function(){if(!this.o)throw y("cannot .getStatus() before sending");try{return this.i.status}catch(e){return-1}},e.prototype.getResponseText=function(){if(!this.o)throw y("cannot .getResponseText() before sending");return this.i.responseText},e.prototype.abort=function(){this.i.abort()},e.prototype.getResponseHeader=function(e){return this.i.getResponseHeader(e)},e.prototype.addUploadProgressListener=function(e){P(this.i.upload)&&this.i.upload.addEventListener("progress",e)},e.prototype.removeUploadProgressListener=function(e){P(this.i.upload)&&this.i.upload.removeEventListener("progress",e)},e}(),ue=function(){function e(){}return e.prototype.createXhrIo=function(){return new At},e}(),ce=function(){function r(n,o){this.bucket=n,this.u=o}return Object.defineProperty(r.prototype,"path",{get:function(){return this.u},enumerable:!0,configurable:!0}),r.prototype.fullServerUrl=function(){var e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)},r.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},r.makeFromBucketSpec=function(t){var e;try{e=r.makeFromUrl(t)}catch(e){return new r(t,"")}if(""===e.path)return e;throw l(t)},r.makeFromUrl=function(t){function e(e){"/"===e.path.charAt(e.path.length-1)&&(e.u=e.u.slice(0,-1))}function h(e){e.u=decodeURIComponent(e.path)}for(var m=null,o=/^gs:\/\/([A-Za-z0-9.\-]+)(\/(.*))?$/i,g={bucket:1,path:3},y=/^https?:\/\/firebasestorage\.googleapis\.com\/v[A-Za-z0-9_]+\/b\/([A-Za-z0-9.\-]+)\/o(\/([^?#]*).*)?$/i,b={bucket:1,path:3},v=[{regex:o,indices:g,postModify:e},{regex:y,indices:b,postModify:h}],c=0;c<v.length;c++){var l=v[c],p=l.regex.exec(t);if(p){var f=p[l.indices.bucket],d=p[l.indices.path];d||(d=""),m=new r(f,d),l.postModify(m);break}}if(null==m)throw Se(t);return m},r}(),le=function(){function e(o,a,e,i){this.server=o,this.local=a||o,this.writable=!!e,this.xform=i||J}return e}(),he=null,pe=function(){function e(o,r){var a=this;this.validator=function(t){a.optional&&!_(t)||o(t)},this.optional=!!r}return e}(),fe=function(){function d(o,a){var e=0,n="";H(o)?(this.c=o,e=o.size,n=o.type):o instanceof ArrayBuffer?(a?this.c=new Uint8Array(o):(this.c=new Uint8Array(o.byteLength),this.c.set(new Uint8Array(o))),e=this.c.length):o instanceof Uint8Array&&(a?this.c=o:(this.c=new Uint8Array(o.length),this.c.set(o)),e=o.length),this.l=e,this.h=n}return d.prototype.size=function(){return this.l},d.prototype.type=function(){return this.h},d.prototype.slice=function(t,e){if(H(this.c)){var n=this.c,r=Xe(n,t,e);return null===r?null:new d(r)}return new d(new Uint8Array(this.c.buffer,t,e-t),!0)},d.getBlob=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(j()){var n=t.map(function(t){return t instanceof d?t.c:t});return new d(Ge.apply(null,n))}var r=t.map(function(e){return W(e)?v(ee.RAW,e).data:e.c}),o=0;r.forEach(function(e){o+=e.byteLength});var i=new Uint8Array(o),a=0;return r.forEach(function(n){for(var t=0;t<n.length;t++)i[a++]=n[t]}),new d(i,!0)},d.prototype.uploadData=function(){return this.c},d}(),de=function(){function e(o,a,e,n){this.url=o,this.method=a,this.handler=e,this.timeout=n,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}return e}(),_e=function(){function e(o,a,e,i){this.current=o,this.total=a,this.finalized=!!e,this.metadata=i||null}return e}(),ve=function(){function e(o,a,e){if(D(o)||P(a)||P(e))this.next=o,this.error=a||null,this.complete=e||null;else{var n=o;this.next=n.next||null,this.error=n.error||null,this.complete=n.complete||null}}return e}(),be=function(){function e(a,s,e,n,r,o){this.bytesTransferred=a,this.totalBytes=s,this.state=e,this.metadata=n,this.task=r,this.ref=o}return Object.defineProperty(e.prototype,"downloadURL",{get:function(){if(null!==this.metadata){var e=this.metadata.downloadURLs;return null!=e&&null!=e[0]?e[0]:null}return null},enumerable:!0,configurable:!0}),e}(),me=function(){function e(s,d,e,n,r,o){void 0===o&&(o=null);var i=this;this.p=0,this.f=!1,this.d=!1,this._=[],this.v=null,this.b=null,this.m=null,this.g=1,this.y=null,this.R=null,this.w=s,this.U=d,this.T=e,this.A=r,this.N=o,this.O=n,this.C=this.S(this.A),this.k=It.RUNNING,this.I=function(e){i.m=null,i.g=1,e.codeEquals(te.CANCELED)?(i.f=!0,i.L()):(i.v=e,i.P(It.ERROR))},this.x=function(e){i.m=null,e.codeEquals(te.CANCELED)?i.L():(i.v=e,i.P(It.ERROR))},this.D=L(function(n,t){i.y=n,i.R=t,i.M()}),this.D.then(null,function(){})}return e.prototype.W=function(){var o=this,t=this.p;return function(e){o.B(t+e)}},e.prototype.S=function(e){return 262144<e.size()},e.prototype.M=function(){this.k===It.RUNNING&&null===this.m&&(this.C?null===this.b?this.G():this.f?this.j():this.d?this.q():this.F():this.H())},e.prototype.z=function(o){var t=this;this.U.getAuthToken().then(function(e){switch(t.k){case It.RUNNING:o(e);break;case It.CANCELING:t.P(It.CANCELED);break;case It.PAUSING:t.P(It.PAUSED);}})},e.prototype.G=function(){var o=this;this.z(function(t){var e=lt(o.U,o.T,o.O,o.A,o.N),n=o.U.makeRequest(e,t);o.m=n,n.getPromise().then(function(t){o.m=null,o.b=t,o.f=!1,o.L()},o.I)})},e.prototype.j=function(){var a=this,t=this.b;this.z(function(e){var n=pt(a.U,a.T,t,a.A),r=a.U.makeRequest(n,e);a.m=r,r.getPromise().then(function(t){t=t,a.m=null,a.B(t.current),a.f=!1,t.finalized&&(a.d=!0),a.L()},a.I)})},e.prototype.F=function(){var s=this,t=262144*this.g,e=new _e(this.p,this.A.size()),n=this.b;this.z(function(r){var o;try{o=ct(s.T,s.U,n,s.A,t,s.O,e,s.W())}catch(t){return s.v=t,void s.P(It.ERROR)}var i=s.U.makeRequest(o,r);s.m=i,i.getPromise().then(function(t){s.X(),s.m=null,s.B(t.current),t.finalized?(s.N=t.metadata,s.P(It.SUCCESS)):s.L()},s.I)})},e.prototype.X=function(){33554432>262144*this.g&&(this.g*=2)},e.prototype.q=function(){var o=this;this.z(function(t){var e=nt(o.U,o.T,o.O),n=o.U.makeRequest(e,t);o.m=n,n.getPromise().then(function(t){o.m=null,o.N=t,o.P(It.SUCCESS)},o.x)})},e.prototype.H=function(){var o=this;this.z(function(t){var e=st(o.U,o.T,o.O,o.A,o.N),n=o.U.makeRequest(e,t);o.m=n,n.getPromise().then(function(t){o.m=null,o.N=t,o.B(o.A.size()),o.P(It.SUCCESS)},o.I)})},e.prototype.B=function(n){var t=this.p;this.p=n,this.p!==t&&this.V()},e.prototype.P=function(n){if(this.k!==n)switch(n){case It.CANCELING:case It.PAUSING:this.k=n,null!==this.m&&this.m.cancel();break;case It.RUNNING:var t=this.k===It.PAUSED;this.k=n,t&&(this.V(),this.M());break;case It.PAUSED:this.k=n,this.V();break;case It.CANCELED:this.v=c(),this.k=n,this.V();break;case It.ERROR:case It.SUCCESS:this.k=n,this.V();}},e.prototype.L=function(){switch(this.k){case It.PAUSING:this.P(It.PAUSED);break;case It.CANCELING:this.P(It.CANCELED);break;case It.RUNNING:this.M();}},Object.defineProperty(e.prototype,"snapshot",{get:function(){var e=C(this.k);return new be(this.p,this.A.size(),e,this.N,this,this.w)},enumerable:!0,configurable:!0}),e.prototype.on=function(o,t,e,s){function n(e){try{return void i(e)}catch(e){}try{if(d(e),!(_(e.next)||_(e.error)||_(e.complete)))throw""}catch(e){throw a}}function r(o){function t(t,r){null!==o&&Fe("on",o,arguments);var n=new ve(t,r,s);return l.K(n),function(){l.Z(n)}}return t}void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===s&&(s=void 0);var a="Expected a function or an Object with one of `next`, `error`, `complete` properties.",i=ze(!0).validator,d=qe(null,!0).validator;Fe("on",[Ve(function(){if(o!==oe.STATE_CHANGED)throw"Expected one of the event types: ["+oe.STATE_CHANGED+"]."}),qe(n,!0),ze(!0),ze(!0)],arguments);var l=this,c=[qe(function(e){if(null===e)throw a;n(e)}),ze(!0),ze(!0)];return _(t)||_(e)||_(s)?r(null)(t,e,s):r(c)},e.prototype.then=function(n,t){return this.D.then(n,t)},e.prototype.catch=function(e){return this.then(null,e)},e.prototype.K=function(e){this._.push(e),this.J(e)},e.prototype.Z=function(e){Je(this._,e)},e.prototype.V=function(){var n=this;this.Q(),Ye(this._).forEach(function(t){n.J(t)})},e.prototype.Q=function(){if(null!==this.y){var e=!0;switch(C(this.k)){case ae.SUCCESS:ut(this.y.bind(null,this.snapshot))();break;case ae.CANCELED:case ae.ERROR:ut(this.R.bind(null,this.v))();break;default:e=!1;}e&&(this.y=null,this.R=null)}},e.prototype.J=function(e){switch(C(this.k)){case ae.RUNNING:case ae.PAUSED:null!==e.next&&ut(e.next.bind(e,this.snapshot))();break;case ae.SUCCESS:null!==e.complete&&ut(e.complete.bind(e))();break;case ae.CANCELED:case ae.ERROR:null!==e.error&&ut(e.error.bind(e,this.v))();break;default:null!==e.error&&ut(e.error.bind(e,this.v))();}},e.prototype.resume=function(){Fe("resume",[],arguments);var e=this.k===It.PAUSED||this.k===It.PAUSING;return e&&this.P(It.RUNNING),e},e.prototype.pause=function(){Fe("pause",[],arguments);var e=this.k===It.RUNNING;return e&&this.P(It.PAUSING),e},e.prototype.cancel=function(){Fe("cancel",[],arguments);var e=this.k===It.RUNNING||this.k===It.PAUSING;return e&&this.P(It.CANCELING),e},e}(),ge=function(){function o(n,o){this.authWrapper=n,this.location=o instanceof ce?o:ce.makeFromUrl(o)}return o.prototype.toString=function(){return Fe("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},o.prototype.newRef=function(t,e){return new o(t,e)},o.prototype.mappings=function(){return Z()},o.prototype.child=function(o){Fe("child",[Ve()],arguments);var t=z(this.location.path,o),e=new ce(this.location.bucket,t);return this.newRef(this.authWrapper,e)},Object.defineProperty(o.prototype,"parent",{get:function(){var n=V(this.location.path);if(null===n)return null;var t=new ce(this.location.bucket,n);return this.newRef(this.authWrapper,t)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"root",{get:function(){var e=new ce(this.location.bucket,"");return this.newRef(this.authWrapper,e)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"name",{get:function(){return K(this.location.path)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"storage",{get:function(){return this.authWrapper.service()},enumerable:!0,configurable:!0}),o.prototype.put=function(n,t){return void 0===t&&(t=null),Fe("put",[We(),He(!0)],arguments),this.Y("put"),new me(this,this.authWrapper,this.location,this.mappings(),new fe(n),t)},o.prototype.putString=function(a,t,e){void 0===t&&(t=ee.RAW),Fe("putString",[Ve(),Ve(b,!0),He(!0)],arguments),this.Y("putString");var n=v(t,a),r=I(e);return!P(r.contentType)&&P(n.contentType)&&(r.contentType=n.contentType),new me(this,this.authWrapper,this.location,this.mappings(),new fe(n.data,!0),r)},o.prototype.delete=function(){Fe("delete",[],arguments),this.Y("delete");var o=this;return this.authWrapper.getAuthToken().then(function(t){var e=rt(o.authWrapper,o.location);return o.authWrapper.makeRequest(e,t).getPromise()})},o.prototype.getMetadata=function(){Fe("getMetadata",[],arguments),this.Y("getMetadata");var o=this;return this.authWrapper.getAuthToken().then(function(t){var e=nt(o.authWrapper,o.location,o.mappings());return o.authWrapper.makeRequest(e,t).getPromise()})},o.prototype.updateMetadata=function(o){Fe("updateMetadata",[He()],arguments),this.Y("updateMetadata");var t=this;return this.authWrapper.getAuthToken().then(function(e){var n=ot(t.authWrapper,t.location,o,t.mappings());return t.authWrapper.makeRequest(n,e).getPromise()})},o.prototype.getDownloadURL=function(){return Fe("getDownloadURL",[],arguments),this.Y("getDownloadURL"),this.getMetadata().then(function(n){var t=n.downloadURLs[0];if(P(t))return t;throw d()})},o.prototype.Y=function(e){if(""===this.location.path)throw m(e)},o}(),Lt=function(){function e(e){this.D=x(e)}return e.prototype.getPromise=function(){return this.D},e.prototype.cancel=function(e){void 0===e&&(e=!1)},e}(),Re=function(){function e(){this.$={},this.tt=-9007199254740991}return e.prototype.addRequest=function(o){function t(){delete n.$[e]}var e=this.tt;this.tt++,this.$[e]=o;var n=this;o.getPromise().then(t,t)},e.prototype.clear=function(){k(this.$,function(n,t){t&&t.cancel(!0)}),this.$={}},e}(),Ee=function(){function e(t,s,n,r,o){if(this.et=null,this.nt=!1,this.rt=t,null!==this.rt){var i=this.rt.options;P(i)&&(this.et=e.ot(i))}this.it=s,this.at=n,this.st=o,this.ut=r,this.ct=12e4,this.lt=6e4,this.ht=new Re}return e.ot=function(n){var t=n.storageBucket||null;return null==t?null:ce.makeFromBucketSpec(t).bucket},e.prototype.getAuthToken=function(){return null!==this.rt&&P(this.rt.INTERNAL)&&P(this.rt.INTERNAL.getToken)?this.rt.INTERNAL.getToken().then(function(e){return null===e?null:e.accessToken},function(){return null}):O(null)},e.prototype.bucket=function(){if(this.nt)throw h();return this.et},e.prototype.service=function(){return this.ut},e.prototype.makeStorageReference=function(e){return this.it(this,e)},e.prototype.makeRequest=function(o,t){if(this.nt)return new Lt(h());var e=this.at(o,t,this.st);return this.ht.addRequest(e),e},e.prototype.deleteApp=function(){this.nt=!0,this.rt=null,this.ht.clear()},e.prototype.maxUploadRetryTime=function(){return this.lt},e.prototype.setMaxUploadRetryTime=function(e){this.lt=e},e.prototype.maxOperationRetryTime=function(){return this.ct},e.prototype.setMaxOperationRetryTime=function(e){this.ct=e},e}(),we=function(){function e(d,p,e,n,r,o,i,a,s,u,c){this.pt=null,this.ft=null,this.y=null,this.R=null,this.dt=!1,this._t=!1,this.vt=d,this.bt=p,this.mt=e,this.gt=n,this.yt=r.slice(),this.Rt=o.slice(),this.Et=i,this.wt=a,this.Ut=u,this.Tt=s,this.st=c;var l=this;this.D=L(function(n,t){l.y=n,l.R=t,l.M()})}return e.prototype.M=function(){function o(n,a){function l(n){var t=n.loaded,e=n.lengthComputable?n.total:-1;null!==d.Ut&&d.Ut(t,e)}if(a)return void n(!1,new Ue(!1,null,!0));var e=d.st.createXhrIo();d.pt=e,null!==d.Ut&&e.addUploadProgressListener(l),e.send(d.vt,d.bt,d.gt,d.mt).then(function(t){null!==d.Ut&&t.removeUploadProgressListener(l),d.pt=null,t=t;var e=t.getErrorCode()===Nt.NO_ERROR,r=t.getStatus();if(!e||d.At(r)){var i=t.getErrorCode()===Nt.ABORT;return void n(!1,new Ue(!1,null,i))}var a=Qe(d.yt,r);n(!0,new Ue(a,t))})}function t(n,t){var o=d.y,l=d.R,i=t.xhr;if(t.wasSuccessCode)try{var a=d.Et(i,i.getResponseText());_(a)?o(a):o()}catch(e){l(e)}else if(null!==i){var p=r();p.setServerResponseProp(i.getResponseText()),l(d.wt?d.wt(i,p):p)}else if(t.canceled){var p=d._t?h():c();l(p)}else{var p=s();l(p)}}var d=this;this.dt?t(!1,new Ue(!1,null,!0)):this.ft=ht(o,t,this.Tt)},e.prototype.getPromise=function(){return this.D},e.prototype.cancel=function(e){this.dt=!0,this._t=e||!1,null!==this.ft&&mt(this.ft),null!==this.pt&&this.pt.abort()},e.prototype.At=function(e){var t=Qe([408,429],e),n=Qe(this.Rt,e);return 500<=e&&600>e||t||n},e}(),Ue=function(){function e(o,r,e){this.wasSuccessCode=o,this.xhr=r,this.canceled=!!e}return e}(),Te=function(){function e(r,a,e){if(this.et=null,this.U=new Ee(r,function(n,t){return new ge(n,t)},yt,this,a),this.rt=r,null!=e)this.et=ce.makeFromBucketSpec(e);else{var n=this.U.bucket();null!=n&&(this.et=new ce(n,""))}this.Nt=new Rt(this)}return e.prototype.ref=function(e){if(Fe("ref",[Ve(function(e){if(/^[A-Za-z]+:\/\//.test(e))throw"Expected child path but got a URL, use refFromURL instead."},!0)],arguments),null==this.et)throw Error("No Storage Bucket defined in Firebase Options.");var t=new ge(this.U,this.et);return null==e?t:t.child(e)},e.prototype.refFromURL=function(e){return Fe("refFromURL",[Ve(function(e){if(!/^[A-Za-z]+:\/\//.test(e))throw"Expected full URL but got a child path, use ref instead.";try{ce.makeFromUrl(e)}catch(e){throw"Expected valid full URL but got an invalid one."}},!1)],arguments),new ge(this.U,e)},Object.defineProperty(e.prototype,"maxUploadRetryTime",{get:function(){return this.U.maxUploadRetryTime()},enumerable:!0,configurable:!0}),e.prototype.setMaxUploadRetryTime=function(e){Fe("setMaxUploadRetryTime",[je()],arguments),this.U.setMaxUploadRetryTime(e)},Object.defineProperty(e.prototype,"maxOperationRetryTime",{get:function(){return this.U.maxOperationRetryTime()},enumerable:!0,configurable:!0}),e.prototype.setMaxOperationRetryTime=function(e){Fe("setMaxOperationRetryTime",[je()],arguments),this.U.setMaxOperationRetryTime(e)},Object.defineProperty(e.prototype,"app",{get:function(){return this.rt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"INTERNAL",{get:function(){return this.Nt},enumerable:!0,configurable:!0}),e}(),Rt=function(){function e(e){this.ut=e}return e.prototype.delete=function(){return this.ut.U.deleteApp(),O(void 0)},e}();t.registerStorage=vt;var Ne="storage";vt(xt.default)}},[118])}catch(e){throw Error("Cannot instantiate firebase-storage.js - be sure to load firebase-app.js first.")}try{webpackJsonpFirebase([1],{113:function(o,t,e){e(114)},114:function(Mn,t,e){"use strict";function n(){return qt}function r(e){qt=e}function So(s,t){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];if(qt<=Qt.DEBUG){var r=new Date().toISOString(),o=e.map(a);console.log.apply(console,["Firestore ("+jt+") "+r+" ["+s+"]: "+t].concat(o))}}function o(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];if(qt<=Qt.ERROR){var n=new Date().toISOString(),r=t.map(a);console.error.apply(console,["Firestore ("+jt+") "+n+": "+i].concat(r))}}function a(n){if("string"==typeof n)return n;var o=Kt.getPlatform();try{return o.formatJSON(n)}catch(t){return n}}function Wo(n){var t="FIRESTORE ("+jt+") INTERNAL ASSERTION FAILED: "+n;throw o(t),Error(t)}function Ho(n,t){n||Wo(t)}function i(){return Kt.getPlatform().emptyByteString}function s(o,a){function e(){var e="This constructor is private.";throw a&&(e+=" ",e+=a),new Ht(Gt.INVALID_ARGUMENT,e)}for(var t in e.prototype=o.prototype,o)o.hasOwnProperty(t)&&(e[t]=o[t]);return e}function l(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function c(n,t){return void 0===n?t:n}function d(o,t){for(var e in o)if(Object.prototype.hasOwnProperty.call(o,e)){var n=parseInt(e,10);isNaN(n)||t(n,o[e])}}function p(o,t){for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&t(e,o[e])}function u(n){for(var o in Ho(null!=n&&"object"==typeof n,"isEmpty() expects object parameter."),n)if(Object.prototype.hasOwnProperty.call(n,o))return!1;return!0}function h(o){Ho(o&&"object"==typeof o,"shallowCopy() expects object parameter.");var r={};for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(r[e]=o[e]);return r}function m(o,t,e){if(t.length!==e)throw new Ht(Gt.INVALID_ARGUMENT,"Function "+o+"() requires "+O(e,"argument")+", but was called with "+O(t.length,"argument")+".")}function g(o,t,e){if(t.length<e)throw new Ht(Gt.INVALID_ARGUMENT,"Function "+o+"() requires at least "+O(e,"argument")+", but was called with "+O(t.length,"argument")+".")}function f(o,t,e,n){if(t.length<e||t.length>n)throw new Ht(Gt.INVALID_ARGUMENT,"Function "+o+"() requires between "+e+" and "+n+" arguments, but was called with "+O(t.length,"argument")+".")}function y(o,t,e,n){if(!(t instanceof Array)||t.length<n)throw new Ht(Gt.INVALID_ARGUMENT,"Function "+o+"() requires its "+e+" argument to be an array with at least "+O(n,"element")+".")}function b(o,t,e,n){C(o,t,R(e)+" argument",n)}function v(o,t,e,n){void 0!==n&&b(o,t,e,n)}function E(o,t,e,n){C(o,t,e+" option",n)}function S(o,t,e,n){void 0!==n&&E(o,t,e,n)}function C(a,t,e,n){if(typeof n!==t||"object"===t&&!T(n)){var i=k(n);throw new Ht(Gt.INVALID_ARGUMENT,"Function "+a+"() requires its "+e+" to be of type "+t+", but it was: "+i)}}function T(e){return"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype}function k(n){if(void 0===n)return"undefined";if(null===n)return"null";if("string"==typeof n)return 20<n.length&&(n=n.substring(0,20)+"..."),JSON.stringify(n);if("number"==typeof n||"boolean"==typeof n)return""+n;if("object"==typeof n){if(n instanceof Array)return"an array";var o=w(n);return o?"a custom "+o+" object":"an object"}return"function"==typeof n?"a function":Wo("Unknown wrong type: "+typeof n)}function w(o){if(o.constructor){var t=/function\s+([^\s(]+)\s*\(/,e=t.exec(""+o.constructor);if(e&&1<e.length)return e[1]}return null}function I(o,t,e){if(void 0===e)throw new Ht(Gt.INVALID_ARGUMENT,"Function "+o+"() requires a valid "+R(t)+" argument, but it was undefined.")}function N(o,t,r){p(t,function(t){if(0>r.indexOf(t))throw new Ht(Gt.INVALID_ARGUMENT,"Unknown option '"+t+"' passed to function "+o+"(). Available options: "+r.join(", "))})}function A(a,t,e,n){var r=k(n);return new Ht(Gt.INVALID_ARGUMENT,"Function "+a+"() requires its "+R(e)+" argument to be a "+t+", but it was: "+r)}function R(e){return 1===e?"first":2===e?"second":3===e?"third":e+"th"}function O(n,t){return n+" "+t+(1===n?"":"s")}function P(n,t){return n<t?-1:n>t?1:0}function L(n,t){return null!==n&&void 0!==n?t&&n.equals(t):n===t}function x(o,t){if(o.length!==t.length)return!1;for(var e=0;e<o.length;e++)if(!o[e].equals(t[e]))return!1;return!0}function _(n){var t=n.length-1;return 0===n.length?"":"\0"===n.charAt(t)?n.substring(0,t):n.substring(0,t)+Bt(n.charCodeAt(t)-1)}function D(e){return e+"\0"}function M(){if("undefined"==typeof Uint8Array)throw new Ht(Gt.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function F(){if(!Kt.getPlatform().base64Available)throw new Ht(Gt.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}function B(n,t){return n<t?-1:n>t?1:n===t?0:isNaN(n)?isNaN(t)?0:-1:1}function U(n,t){return n===t?0!==n||1/n==1/t:n!==n&&t!==t}function V(e){return null===e||void 0===e}function j(e){return _e(e)&&e<=Me&&e>=Oe}function W(o,t,e){if(e.equals(ge.INSTANCE)){if(t!==Le.EQUAL)throw new Ht(Gt.INVALID_ARGUMENT,"Invalid query. You can only perform equals comparisons on null.");return new Be(o)}if(e.equals(Ie.NAN)){if(t!==Le.EQUAL)throw new Ht(Gt.INVALID_ARGUMENT,"Invalid query. You can only perform equals comparisons on NaN.");return new Ue(o)}return new xe(o,t,e)}function q(e){return e===Gt.OK?Wo("Treated status OK as error"):e===Gt.CANCELLED||e===Gt.UNKNOWN||e===Gt.DEADLINE_EXCEEDED||e===Gt.RESOURCE_EXHAUSTED||e===Gt.INTERNAL||e===Gt.UNAVAILABLE||e===Gt.UNAUTHENTICATED?!1:e===Gt.INVALID_ARGUMENT||e===Gt.NOT_FOUND||e===Gt.ALREADY_EXISTS||e===Gt.PERMISSION_DENIED||e===Gt.FAILED_PRECONDITION||e===Gt.ABORTED||e===Gt.OUT_OF_RANGE||e===Gt.UNIMPLEMENTED||e===Gt.DATA_LOSS||Wo("Unknown status code: "+e)}function H(n){var t=cn[n];if(void 0!==t)return z(t)}function z(e){if(void 0===e)return o("GRPC error has no .code"),Gt.UNKNOWN;return e===cn.OK?Gt.OK:e===cn.CANCELLED?Gt.CANCELLED:e===cn.UNKNOWN?Gt.UNKNOWN:e===cn.DEADLINE_EXCEEDED?Gt.DEADLINE_EXCEEDED:e===cn.RESOURCE_EXHAUSTED?Gt.RESOURCE_EXHAUSTED:e===cn.INTERNAL?Gt.INTERNAL:e===cn.UNAVAILABLE?Gt.UNAVAILABLE:e===cn.UNAUTHENTICATED?Gt.UNAUTHENTICATED:e===cn.INVALID_ARGUMENT?Gt.INVALID_ARGUMENT:e===cn.NOT_FOUND?Gt.NOT_FOUND:e===cn.ALREADY_EXISTS?Gt.ALREADY_EXISTS:e===cn.PERMISSION_DENIED?Gt.PERMISSION_DENIED:e===cn.FAILED_PRECONDITION?Gt.FAILED_PRECONDITION:e===cn.ABORTED?Gt.ABORTED:e===cn.OUT_OF_RANGE?Gt.OUT_OF_RANGE:e===cn.UNIMPLEMENTED?Gt.UNIMPLEMENTED:e===cn.DATA_LOSS?Gt.DATA_LOSS:Wo("Unknown status code: "+e)}function K(e){if(void 0===e)return cn.OK;return e===Gt.OK?cn.OK:e===Gt.CANCELLED?cn.CANCELLED:e===Gt.UNKNOWN?cn.UNKNOWN:e===Gt.DEADLINE_EXCEEDED?cn.DEADLINE_EXCEEDED:e===Gt.RESOURCE_EXHAUSTED?cn.RESOURCE_EXHAUSTED:e===Gt.INTERNAL?cn.INTERNAL:e===Gt.UNAVAILABLE?cn.UNAVAILABLE:e===Gt.UNAUTHENTICATED?cn.UNAUTHENTICATED:e===Gt.INVALID_ARGUMENT?cn.INVALID_ARGUMENT:e===Gt.NOT_FOUND?cn.NOT_FOUND:e===Gt.ALREADY_EXISTS?cn.ALREADY_EXISTS:e===Gt.PERMISSION_DENIED?cn.PERMISSION_DENIED:e===Gt.FAILED_PRECONDITION?cn.FAILED_PRECONDITION:e===Gt.ABORTED?cn.ABORTED:e===Gt.OUT_OF_RANGE?cn.OUT_OF_RANGE:e===Gt.UNIMPLEMENTED?cn.UNIMPLEMENTED:e===Gt.DATA_LOSS?cn.DATA_LOSS:Wo("Unknown status code: "+e)}function G(e){return 200===e?Gt.OK:400===e?Gt.INVALID_ARGUMENT:401===e?Gt.UNAUTHENTICATED:403===e?Gt.PERMISSION_DENIED:404===e?Gt.NOT_FOUND:409===e?Gt.ABORTED:416===e?Gt.OUT_OF_RANGE:429===e?Gt.RESOURCE_EXHAUSTED:499===e?Gt.CANCELLED:500===e?Gt.UNKNOWN:501===e?Gt.UNIMPLEMENTED:503===e?Gt.UNAVAILABLE:504===e?Gt.DEADLINE_EXCEEDED:200<=e&&300>e?Gt.OK:400<=e&&500>e?Gt.FAILED_PRECONDITION:500<=e&&600>e?Gt.INTERNAL:Gt.UNKNOWN}function X(){return ln}function Q(){return fn}function Y(){return dn}function J(){return pn}function $(n,t){0<t.length&&(n.resumeToken=t)}function Z(n,t){Ho(!V(n),t+" is missing")}function et(e){return"number"==typeof e?e:"string"==typeof e?parseInt(e,10):Wo("can't parse "+e)}function tt(o,t,r){return t===r||!t&&r in o}function nt(e){if(0<=e.search(Yo))throw new Ht(Gt.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(Pn.bind.apply(Pn,[void 0].concat(e.split("."))))}catch(t){throw new Ht(Gt.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}function ot(o,t){var e=function(e){return e===Ln.Added?1:e===Ln.Modified||e===Ln.Metadata?2:e===Ln.Removed?0:Wo("Unknown ChangeType: "+e)};return e(o)-e(t)}function rt(o){for(var t="",e=0;e<o.length;e++)0<t.length&&(t=it(t)),t=at(o.get(e),t);return it(t)}function at(a,t){for(var e=t,n=a.length,r=0,o;r<n;r++)o=a.charAt(r),e+="\0"===o?ar+sr:o===ar?ar+lr:o;return e}function it(e){return e+ar+ir}function st(n){var t=n.length;if(Ho(2<=t,"Invalid path "+n),2===t)return Ho(n.charAt(0)===ar&&n.charAt(1)===ir,"Non-empty path "+n+" had length 2"),re.EMPTY_PATH;for(var e=[],r="",o=0,i;o<t;){switch(i=n.indexOf(ar,o),(0>i||i>t-2)&&Wo("Invalid encoded resource path: \""+n+"\""),n.charAt(i+1)){case ir:var a=n.substring(o,i),s=void 0;0===r.length?s=a:(r+=a,s=r,r=""),e.push(s);break;case sr:r+=n.substring(o,i),r+="\0";break;case lr:r+=n.substring(o,i+1);break;default:Wo("Invalid encoded resource path: \""+n+"\"");}o=i+2}return new re(e)}function lt(n,t){Ho(0===t,"Unexpected upgrade from version "+t),n.createObjectStore(pr.store,{keyPath:pr.keyPath}),n.createObjectStore(ur.store,{keyPath:ur.keyPath}),n.createObjectStore(yr.store,{keyPath:yr.keyPath}).createIndex(yr.documentTargetsIndex,yr.documentTargetsKeyPath,{unique:!0}),n.createObjectStore(fr.store,{keyPath:fr.keyPath}).createIndex(fr.queryTargetsIndexName,fr.queryTargetsKeyPath,{unique:!0}),n.createObjectStore(hr.store),n.createObjectStore(gr.store),n.createObjectStore(dr.store),n.createObjectStore(br.store)}function ct(o){return new Gn(function(r,e){o.onsuccess=function(e){var t=e.target.result;r(t)},o.onerror=function(n){e(n.target.error)}})}function dt(e){return Ho("string"==typeof e,"Persisting non-string stream token not supported."),e}function pt(e){return mt(e,ur.store)}function ut(e){return mt(e,hr.store)}function ht(e){return mt(e,pr.store)}function mt(n,t){return n instanceof Cr?n.store(t):Wo("Invalid transaction object provided!")}function gt(e){return bt(e,fr.store)}function ft(e){return bt(e,br.store)}function yt(e){return bt(e,yr.store)}function bt(n,t){return n instanceof Cr?n.store(t):Wo("Invalid transaction object provided!")}function vt(e){return e instanceof Cr?e.store(gr.store):Wo("Invalid transaction object provided!")}function Et(e){return e.path.toArray()}function St(e){return void 0!==e.documents}function Ct(e){if(!e)return new ao;switch(e.type){case"gapi":return new co(e.client,e.sessionIndex||"0");case"provider":return e.client;default:throw new Ht(Gt.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type");}}function Tt(e){return kt(e,["next","error","complete"])}function kt(a,s){if("object"!=typeof a||null===a)return!1;for(var e=a,n=0,r=s,o;n<r.length;n++)if(o=r[n],o in e&&"function"==typeof e[o])return!0;return!1}function wt(e){switch(e){case bo.Set:case bo.MergeSet:case bo.Update:return!0;case bo.QueryValue:return!1;default:throw Wo("Unexpected case for UserDataSource: "+e);}}function It(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof Go||e instanceof Xt||e instanceof wo||e instanceof lo)}function Nt(o,t,e){if(!It(e)||!T(e)){var n=k(e);throw"an object"===n?t.createError(o+" a custom object"):t.createError(o+" "+n)}}function At(n,t){if(t instanceof Pn)return t.t;if("string"==typeof t)return Rt(n,t);throw new Ht(Gt.INVALID_ARGUMENT,"Function "+n+"() called with invalid data. Field path arguments must be of type string or FieldPath.")}function Rt(o,t){try{return nt(t).t}catch(t){var r=Ot(t);throw new Ht(Gt.INVALID_ARGUMENT,"Function "+o+"() called with invalid data. "+r)}}function Ot(e){return e instanceof Error?e.message:""+e}function Pt(n,t){return void 0===t?{merge:!1}:(N(n,t,["merge"]),S(n,"boolean","merge",t.merge),t)}function Lt(o,t,e){if(t instanceof Ro){if(t.firestore!==e)throw new Ht(Gt.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}throw A(o,"DocumentReference",1,t)}function xt(s,t){if(t.oldDocs.isEmpty()){var e=0,r;return t.docChanges.map(function(a){var o=new Oo(s,a.doc.key,a.doc,t.fromCache);return Ho(a.type===Ln.Added,"Invalid event type for first snapshot"),Ho(!r||0>t.query.docComparator(r,a.doc),"Got added events in wrong order"),r=a.doc,{type:"added",doc:o,oldIndex:-1,newIndex:e++}})}var d=t.oldDocs;return t.docChanges.map(function(e){var n=new Oo(s,e.doc.key,e.doc,t.fromCache),o=-1,l=-1;return e.type!==Ln.Added&&(o=d.indexOf(e.doc.key),Ho(0<=o,"Index for document not found"),d=d.delete(e.doc.key)),e.type!==Ln.Removed&&(d=d.add(e.doc),l=d.indexOf(e.doc.key)),{type:_t(e.type),doc:n,oldIndex:o,newIndex:l}})}function _t(e){return e===Ln.Added?"added":e===Ln.Modified||e===Ln.Metadata?"modified":e===Ln.Removed?"removed":Wo("Unknown change type: "+e)}function Dt(e){e.INTERNAL.registerService("firestore",function(e){return new ko(e)},h(na))}function Mt(e){Dt(e)}var Ft=Number.POSITIVE_INFINITY,Bt=String.fromCharCode,Ut=Math.min,Vt=Math.floor;Object.defineProperty(t,"__esModule",{value:!0});var zo=e(6),jt=zo.default.SDK_VERSION,Qt;!function(e){e[e.DEBUG=0]="DEBUG",e[e.ERROR=1]="ERROR",e[e.SILENT=2]="SILENT"}(Qt||(Qt={}));var qt=Qt.ERROR,Kt=function(){function n(){}return n.setPlatform=function(t){n.platform&&Wo("Platform already defined"),n.platform=t},n.getPlatform=function(){return n.platform||Wo("Platform not set"),n.platform},n}(),Wt=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),Gt={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},Ht=function(o){function t(t,a){var n=o.call(this,a)||this;return n.code=t,n.message=a,n.name="FirebaseError",n.toString=function(){return n.name+": [code="+n.code+"]: "+n.message},n}return Wt(t,o),t}(Error),zt=function(){function e(){}return e.newId=function(){for(var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="",e=0;20>e;e++)t+=o.charAt(Vt(Math.random()*o.length));return Ho(20===t.length,"Invalid auto ID: "+t),t},e}(),Xt=function(){function n(e){F(),this.e=e}return n.fromBase64String=function(t){m("Blob.fromBase64String",arguments,1),b("Blob.fromBase64String","string",1,t),F();try{return new n(Kt.getPlatform().atob(t))}catch(e){throw new Ht(Gt.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+e)}},n.fromUint8Array=function(t){if(m("Blob.fromUint8Array",arguments,1),M(),!(t instanceof Uint8Array))throw A("Blob.fromUint8Array","Uint8Array",1,t);return new n(Array.prototype.map.call(t,function(e){return Bt(e)}).join(""))},n.prototype.toBase64=function(){return m("Blob.toBase64",arguments,0),F(),Kt.getPlatform().btoa(this.e)},n.prototype.toUint8Array=function(){m("Blob.toUint8Array",arguments,0),M();for(var n=new Uint8Array(this.e.length),t=0;t<this.e.length;t++)n[t]=this.e.charCodeAt(t);return n},n.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},n.prototype.n=function(e){return this.e===e.e},n.prototype.r=function(e){return P(this.e,e.e)},n}(),Yt=s(Xt,"Use Blob.fromUint8Array() or Blob.fromBase64String() instead."),Go=function(){function e(n,o){if(m("GeoPoint",arguments,2),b("GeoPoint","number",1,n),b("GeoPoint","number",2,o),!isFinite(n)||-90>n||90<n)throw new Ht(Gt.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+n);if(!isFinite(o)||-180>o||180<o)throw new Ht(Gt.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+o);this._lat=n,this.d=o}return Object.defineProperty(e.prototype,"latitude",{get:function(){return this._lat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"longitude",{get:function(){return this.d},enumerable:!0,configurable:!0}),e.prototype.n=function(e){return this._lat===e._lat&&this.d===e.d},e.prototype.r=function(e){return P(this._lat,e._lat)||P(this.d,e.d)},e}(),Xo=function(){function e(o,a,e,n){this.databaseId=o,this.persistenceKey=a,this.host=e,this.ssl=n}return e}(),Zt="(default)",te=function(){function n(n,o){this.projectId=n,this.database=o||Zt}return Object.defineProperty(n.prototype,"isDefaultDatabase",{get:function(){return this.database===Zt},enumerable:!0,configurable:!0}),n.prototype.equals=function(t){return t instanceof n&&t.projectId===this.projectId&&t.database===this.database},n.prototype.compareTo=function(e){return P(this.projectId,e.projectId)||P(this.database,e.database)},n}(),ee=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),ne=function(){function o(o,r,e){this.init(o,r,e)}return o.prototype.init=function(o,t,e){void 0===t?t=0:t>o.length&&Wo("offset "+t+" out of range "+o.length),void 0===e?e=o.length-t:e>o.length-t&&Wo("length "+e+" out of range "+(o.length-t)),this.segments=o,this.offset=t,this.len=e},o.prototype.construct=function(o,t,e){var n=Object.create(Object.getPrototypeOf(this));return n.init(o,t,e),n},Object.defineProperty(o.prototype,"length",{get:function(){return this.len},enumerable:!0,configurable:!0}),o.prototype.equals=function(t){return 0===o.comparator(this,t)},o.prototype.child=function(t){var r=this.segments.slice(this.offset,this.limit());return t instanceof o?t.forEach(function(e){r.push(e)}):"string"==typeof t?r.push(t):Wo("Unknown parameter type for Path.child(): "+t),this.construct(r)},o.prototype.limit=function(){return this.offset+this.length},o.prototype.popFirst=function(e){return e=void 0===e?1:e,Ho(this.length>=e,"Can't call popFirst() with less segments"),this.construct(this.segments,this.offset+e,this.length-e)},o.prototype.popLast=function(){return Ho(!this.isEmpty(),"Can't call popLast() on empty path"),this.construct(this.segments,this.offset,this.length-1)},o.prototype.firstSegment=function(){return Ho(!this.isEmpty(),"Can't call firstSegment() on empty path"),this.segments[this.offset]},o.prototype.lastSegment=function(){return Ho(!this.isEmpty(),"Can't call lastSegment() on empty path"),this.segments[this.limit()-1]},o.prototype.get=function(e){return Ho(e<this.length,"Index out of range"),this.segments[this.offset+e]},o.prototype.isEmpty=function(){return 0===this.length},o.prototype.isPrefixOf=function(n){if(n.length<this.length)return!1;for(var t=0;t<this.length;t++)if(this.get(t)!==n.get(t))return!1;return!0},o.prototype.forEach=function(o){for(var t=this.offset,e=this.limit();t<e;t++)o(this.segments[t])},o.prototype.toArray=function(){return this.segments.slice(this.offset,this.limit())},o.comparator=function(a,t){for(var e=Ut(a.length,t.length),n=0;n<e;n++){var r=a.get(n),o=t.get(n);if(r<o)return-1;if(r>o)return 1}return a.length<t.length?-1:a.length>t.length?1:0},o}(),re=function(n){function o(){return null!==n&&n.apply(this,arguments)||this}return ee(o,n),o.prototype.canonicalString=function(){return this.toArray().join("/")},o.prototype.toString=function(){return this.canonicalString()},o.fromString=function(e){if(0<=e.indexOf("//"))throw new Ht(Gt.INVALID_ARGUMENT,"Invalid path ("+e+"). Paths must not contain // in them.");return new o(e.split("/").filter(function(e){return 0<e.length}))},o.EMPTY_PATH=new o([]),o}(ne),oe=/^[_a-zA-Z][_a-zA-Z0-9]*$/,ie=function(n){function d(){return null!==n&&n.apply(this,arguments)||this}return ee(d,n),d.isValidIdentifier=function(e){return oe.test(e)},d.prototype.canonicalString=function(){return this.toArray().map(function(e){return e=e.replace("\\","\\\\").replace("`","\\`"),d.isValidIdentifier(e)||(e="`"+e+"`"),e}).join(".")},d.prototype.toString=function(){return this.canonicalString()},d.prototype.isKeyField=function(){return 1===this.length&&"__name__"===this.get(0)},d.keyField=function(){return new d(["__name__"])},d.fromServerFormat=function(e){for(var t=[],n="",r=0,o=function(){if(0===n.length)throw new Ht(Gt.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");t.push(n),n=""},i=!1,l;r<e.length;)if(l=e[r],"\\"===l){if(r+1===e.length)throw new Ht(Gt.INVALID_ARGUMENT,"Path has trailing escape character: "+e);var s=e[r+1];if("\\"!==s&&"."!==s&&"`"!==s)throw new Ht(Gt.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=s,r+=2}else"`"===l?(i=!i,r++):"."!==l||i?(n+=l,r++):(o(),r++);if(o(),i)throw new Ht(Gt.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new d(t)},d.EMPTY_PATH=new d([]),d}(ne),ae=function(){function n(t){this.path=t,Ho(n.isDocumentKey(t),"Invalid DocumentKey with an odd number of segments: "+t.toArray().join("/"))}return n.prototype.equals=function(e){return null!==e&&0===re.comparator(this.path,e.path)},n.prototype.toString=function(){return""+this.path},n.comparator=function(n,t){return re.comparator(n.path,t.path)},n.isDocumentKey=function(e){return 0==e.length%2},n.fromSegments=function(t){return new n(new re(t.slice()))},n.fromPathString=function(t){return new n(re.fromString(t))},n.EMPTY=new n(new re([])),n}(),se=function(){function n(o,a,e,n){this.key=o,this.version=a,this.data=e,this.hasLocalMutations=n.hasLocalMutations}return n.prototype.field=function(e){return this.data.field(e)},n.prototype.fieldValue=function(n){var t=this.field(n);return t?t.value():void 0},n.prototype.value=function(){return this.data.value()},n.prototype.equals=function(t){return t instanceof n&&this.key.equals(t.key)&&this.version.equals(t.version)&&this.data.equals(t.data)&&this.hasLocalMutations===t.hasLocalMutations},n.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.data+", {hasLocalMutations: "+this.hasLocalMutations+"})"},n.compareByKey=function(n,t){return ae.comparator(n.key,t.key)},n.compareByField=function(a,t,e){var n=t.field(a),r=e.field(a);return void 0!==n&&void 0!==r?n.compareTo(r):Wo("Trying to compare documents on fields that don't exist")},n}(),ue=function(){function e(n,o){this.key=n,this.version=o}return e.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},e.prototype.equals=function(e){return e&&e.version.equals(this.version)&&e.key.equals(this.key)},e.compareByKey=function(n,t){return ae.comparator(n.key,t.key)},e}(),ce=function(){function o(n,o){this.comparator=n,this.root=o||le.EMPTY}return o.prototype.insert=function(t,e){return new o(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,le.BLACK,null,null))},o.prototype.remove=function(t){return new o(this.comparator,this.root.remove(t,this.comparator).copy(null,null,le.BLACK,null,null))},o.prototype.get=function(o){for(var t=this.root,e;!t.isEmpty();){if(e=this.comparator(o,t.key),0===e)return t.value;0>e?t=t.left:0<e&&(t=t.right)}return null},o.prototype.getPredecessorKey=function(o){for(var t=this.root,e=null,n;!t.isEmpty();){if(n=this.comparator(o,t.key),0===n){if(t.left.isEmpty())return e?e.key:null;for(t=t.left;!t.right.isEmpty();)t=t.right;return t.key}0>n?t=t.left:0<n&&(e=t,t=t.right)}throw Wo("Attempted to find predecessor key for a nonexistent key. What gives?")},o.prototype.indexOf=function(o){for(var t=0,e=this.root,n;!e.isEmpty();){if(n=this.comparator(o,e.key),0===n)return t+e.left.size;0>n?e=e.left:(t+=e.left.size+1,e=e.right)}return-1},o.prototype.isEmpty=function(){return this.root.isEmpty()},Object.defineProperty(o.prototype,"size",{get:function(){return this.root.size},enumerable:!0,configurable:!0}),o.prototype.minKey=function(){return this.root.minKey()},o.prototype.maxKey=function(){return this.root.maxKey()},o.prototype.inorderTraversal=function(e){return this.root.inorderTraversal(e)},o.prototype.forEach=function(o){this.inorderTraversal(function(t,e){return o(t,e),!1})},o.prototype.reverseTraversal=function(e){return this.root.reverseTraversal(e)},o.prototype.getIterator=function(e){return new he(this.root,null,this.comparator,!1,e)},o.prototype.getIteratorFrom=function(n,t){return new he(this.root,n,this.comparator,!1,t)},o.prototype.getReverseIterator=function(e){return new he(this.root,null,this.comparator,!0,e)},o.prototype.getReverseIteratorFrom=function(n,t){return new he(this.root,n,this.comparator,!0,t)},o}(),he=function(){function e(a,s,e,n,r){this.resultGenerator=r||null,this.isReverse=n,this.nodeStack=[];for(var o=1;!a.isEmpty();)if(o=s?e(a.key,s):1,n&&(o*=-1),0>o)a=this.isReverse?a.left:a.right;else{if(0===o){this.nodeStack.push(a);break}this.nodeStack.push(a),a=this.isReverse?a.right:a.left}}return e.prototype.getNext=function(){Ho(0<this.nodeStack.length,"getNext() called on iterator when hasNext() is false.");var n=this.nodeStack.pop(),e;if(e=this.resultGenerator?this.resultGenerator(n.key,n.value):{key:n.key,value:n.value},this.isReverse)for(n=n.left;!n.isEmpty();)this.nodeStack.push(n),n=n.right;else for(n=n.right;!n.isEmpty();)this.nodeStack.push(n),n=n.left;return e},e.prototype.hasNext=function(){return 0<this.nodeStack.length},e.prototype.peek=function(){if(0===this.nodeStack.length)return null;var e=this.nodeStack[this.nodeStack.length-1];return this.resultGenerator?this.resultGenerator(e.key,e.value):{key:e.key,value:e.value}},e}(),le=function(){function a(t,e,n,r,o){this.key=t,this.value=e,this.color=null==n?a.RED:n,this.left=null==r?a.EMPTY:r,this.right=null==o?a.EMPTY:o,this.size=this.left.size+1+this.right.size}return a.prototype.copy=function(t,e,n,r,o){return new a(null==t?this.key:t,null==e?this.value:e,null==n?this.color:n,null==r?this.left:r,null==o?this.right:o)},a.prototype.isEmpty=function(){return!1},a.prototype.inorderTraversal=function(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)},a.prototype.reverseTraversal=function(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)},a.prototype.min=function(){return this.left.isEmpty()?this:this.left.min()},a.prototype.minKey=function(){return this.min().key},a.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},a.prototype.insert=function(a,t,e){var n=this,r=e(a,n.key);return n=0>r?n.copy(null,null,null,n.left.insert(a,t,e),null):0===r?n.copy(null,t,null,null,null):n.copy(null,null,null,null,n.right.insert(a,t,e)),n.fixUp()},a.prototype.removeMin=function(){if(this.left.isEmpty())return a.EMPTY;var t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()},a.prototype.remove=function(t,e){var n=this,o;if(0>e(t,n.key))n.left.isEmpty()||n.left.isRed()||n.left.left.isRed()||(n=n.moveRedLeft()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.isRed()&&(n=n.rotateRight()),n.right.isEmpty()||n.right.isRed()||n.right.left.isRed()||(n=n.moveRedRight()),0===e(t,n.key)){if(n.right.isEmpty())return a.EMPTY;o=n.right.min(),n=n.copy(o.key,o.value,null,null,n.right.removeMin())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.fixUp()},a.prototype.isRed=function(){return this.color},a.prototype.fixUp=function(){var e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e},a.prototype.moveRedLeft=function(){var e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e},a.prototype.moveRedRight=function(){var e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e},a.prototype.rotateLeft=function(){var t=this.copy(null,null,a.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},a.prototype.rotateRight=function(){var t=this.copy(null,null,a.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},a.prototype.colorFlip=function(){var n=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,n,t)},a.prototype.checkMaxDepth=function(){var e=this.check();return Math.pow(2,e)<=this.size+1},a.prototype.check=function(){if(this.isRed()&&this.left.isRed())throw Wo("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed())throw Wo("Right child of ("+this.key+","+this.value+") is red");var e=this.left.check();if(e!==this.right.check())throw Wo("Black depths differ");return e+(this.isRed()?0:1)},a.EMPTY=null,a.RED=!0,a.BLACK=!1,a}(),fe=function(){function e(){this.size=0}return e.prototype.copy=function(){return this},e.prototype.insert=function(n,t){return new le(n,t)},e.prototype.remove=function(){return this},e.prototype.isEmpty=function(){return!0},e.prototype.inorderTraversal=function(){return!1},e.prototype.reverseTraversal=function(){return!1},e.prototype.minKey=function(){return null},e.prototype.maxKey=function(){return null},e.prototype.isRed=function(){return!1},e.prototype.checkMaxDepth=function(){return!0},e.prototype.check=function(){return 0},e}();le.EMPTY=new fe;var de=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),ye;!function(e){e[e.NullValue=0]="NullValue",e[e.BooleanValue=1]="BooleanValue",e[e.NumberValue=2]="NumberValue",e[e.TimestampValue=3]="TimestampValue",e[e.StringValue=4]="StringValue",e[e.BlobValue=5]="BlobValue",e[e.RefValue=6]="RefValue",e[e.GeoPointValue=7]="GeoPointValue",e[e.ArrayValue=8]="ArrayValue",e[e.ObjectValue=9]="ObjectValue"}(ye||(ye={}));var pe=function(){function e(){}return e.prototype.toString=function(){var e=this.value();return null===e?"null":""+e},e.prototype.defaultCompareTo=function(e){return Ho(this.typeOrder!==e.typeOrder,"Default compareTo should not be used for values of same type."),P(this.typeOrder,e.typeOrder)},e}(),ge=function(n){function o(){var t=n.call(this)||this;return t.typeOrder=ye.NullValue,t.internalValue=null,t}return de(o,n),o.prototype.value=function(){return null},o.prototype.equals=function(e){return e instanceof o},o.prototype.compareTo=function(e){return e instanceof o?0:this.defaultCompareTo(e)},o.INSTANCE=new o,o}(pe),ve=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.BooleanValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue},n.prototype.equals=function(e){return e instanceof n&&this.internalValue===e.internalValue},n.prototype.compareTo=function(e){return e instanceof n?P(this,e):this.defaultCompareTo(e)},n.of=function(e){return e?n.TRUE:n.FALSE},n.TRUE=new n(!0),n.FALSE=new n(!1),n}(pe),be=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.NumberValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue},n.prototype.compareTo=function(e){return e instanceof n?B(this.internalValue,e.internalValue):this.defaultCompareTo(e)},n}(pe),we=function(n){function o(t){return n.call(this,t)||this}return de(o,n),o.prototype.equals=function(e){return e instanceof o&&U(this.internalValue,e.internalValue)},o}(be),Ie=function(o){function n(t){var r=o.call(this,t)||this;return r.internalValue=t,r}return de(n,o),n.prototype.equals=function(e){return e instanceof n&&U(this.internalValue,e.internalValue)},n.NAN=new n(NaN),n.POSITIVE_INFINITY=new n(1/0),n.NEGATIVE_INFINITY=new n(-1/0),n}(be),Te=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.StringValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue},n.prototype.equals=function(e){return e instanceof n&&this.internalValue===e.internalValue},n.prototype.compareTo=function(e){return e instanceof n?P(this.internalValue,e.internalValue):this.defaultCompareTo(e)},n}(pe),Ee=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.TimestampValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue.toDate()},n.prototype.equals=function(e){return e instanceof n&&this.internalValue.equals(e.internalValue)},n.prototype.compareTo=function(e){return e instanceof n?this.internalValue.compareTo(e.internalValue):e instanceof Se?-1:this.defaultCompareTo(e)},n}(pe),Se=function(o){function n(t){var r=o.call(this)||this;return r.localWriteTime=t,r.typeOrder=ye.TimestampValue,r}return de(n,o),n.prototype.value=function(){return null},n.prototype.equals=function(e){return e instanceof n&&this.localWriteTime.equals(e.localWriteTime)},n.prototype.compareTo=function(e){return e instanceof n?this.localWriteTime.compareTo(e.localWriteTime):e instanceof Ee?1:this.defaultCompareTo(e)},n.prototype.toString=function(){return"<ServerTimestamp localTime="+this.localWriteTime+">"},n}(pe),Ce=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.BlobValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue},n.prototype.equals=function(e){return e instanceof n&&this.internalValue.n(e.internalValue)},n.prototype.compareTo=function(e){return e instanceof n?this.internalValue.r(e.internalValue):this.defaultCompareTo(e)},n}(pe),De=function(o){function r(t,a){var n=o.call(this)||this;return n.databaseId=t,n.key=a,n.typeOrder=ye.RefValue,n}return de(r,o),r.prototype.value=function(){return this.key},r.prototype.equals=function(e){return e instanceof r&&this.key.equals(e.key)&&this.databaseId.equals(e.databaseId)},r.prototype.compareTo=function(e){if(e instanceof r){var t=this.databaseId.compareTo(e.databaseId);return 0===t?ae.comparator(this.key,e.key):t}return this.defaultCompareTo(e)},r}(pe),ke=function(o){function n(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.GeoPointValue,r}return de(n,o),n.prototype.value=function(){return this.internalValue},n.prototype.equals=function(e){return e instanceof n&&this.internalValue.n(e.internalValue)},n.prototype.compareTo=function(e){return e instanceof n?this.internalValue.r(e.internalValue):this.defaultCompareTo(e)},n}(pe),Ne=function(o){function s(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.ObjectValue,r}return de(s,o),s.prototype.value=function(){var o={};return this.internalValue.inorderTraversal(function(t,e){o[t]=e.value()}),o},s.prototype.forEach=function(e){this.internalValue.inorderTraversal(e)},s.prototype.equals=function(e){if(e instanceof s){for(var t=this.internalValue.getIterator(),n=e.internalValue.getIterator();t.hasNext()&&n.hasNext();){var r=t.getNext(),o=n.getNext();if(r.key!==o.key||!r.value.equals(o.value))return!1}return!t.hasNext()&&!n.hasNext()}return!1},s.prototype.compareTo=function(e){if(e instanceof s){for(var t=this.internalValue.getIterator(),n=e.internalValue.getIterator();t.hasNext()&&n.hasNext();){var r=t.getNext(),o=n.getNext(),i=P(r.key,o.key)||r.value.compareTo(o.value);if(i)return i}return P(t.hasNext(),n.hasNext())}return this.defaultCompareTo(e)},s.prototype.set=function(e,t){if(Ho(!e.isEmpty(),"Cannot set field for empty path on ObjectValue"),1===e.length)return this.setChild(e.firstSegment(),t);var n=this.child(e.firstSegment());n instanceof s||(n=s.EMPTY);var r=n.set(e.popFirst(),t);return this.setChild(e.firstSegment(),r)},s.prototype.delete=function(e){if(Ho(!e.isEmpty(),"Cannot delete field for empty path on ObjectValue"),1===e.length)return new s(this.internalValue.remove(e.firstSegment()));var t=this.child(e.firstSegment());if(t instanceof s){var n=t.delete(e.popFirst());return new s(this.internalValue.insert(e.firstSegment(),n))}return this},s.prototype.contains=function(e){return void 0!==this.field(e)},s.prototype.field=function(e){Ho(!e.isEmpty(),"Can't get field of empty path");var o=this;return e.forEach(function(e){o=o instanceof s?o.internalValue.get(e)||void 0:void 0}),o},s.prototype.toString=function(){return JSON.stringify(this.value())},s.prototype.child=function(e){return this.internalValue.get(e)||void 0},s.prototype.setChild=function(e,t){return new s(this.internalValue.insert(e,t))},s.EMPTY=new s(new ce(P)),s}(pe),Ae=function(o){function a(t){var r=o.call(this)||this;return r.internalValue=t,r.typeOrder=ye.ArrayValue,r}return de(a,o),a.prototype.value=function(){return this.internalValue.map(function(e){return e.value()})},a.prototype.forEach=function(e){this.internalValue.forEach(e)},a.prototype.equals=function(e){if(e instanceof a){if(this.internalValue.length!==e.internalValue.length)return!1;for(var t=0;t<this.internalValue.length;t++)if(!this.internalValue[t].equals(e.internalValue[t]))return!1;return!0}return!1},a.prototype.compareTo=function(e){if(e instanceof a){for(var t=Ut(this.internalValue.length,e.internalValue.length),n=0,r;n<t;n++)if(r=this.internalValue[n].compareTo(e.internalValue[n]),r)return r;return P(this.internalValue.length,e.internalValue.length)}return this.defaultCompareTo(e)},a.prototype.toString=function(){return JSON.stringify(this.value())},a}(pe),Re=Number,Oe=Re.MIN_SAFE_INTEGER||-9007199254740991,Me=Re.MAX_SAFE_INTEGER||9007199254740991,_e=Re.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Vt(e)===e},Pe=function(){function o(a,s,e,n,r,o){void 0===s&&(s=[]),void 0===e&&(e=[]),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),this.path=a,this.explicitOrderBy=s,this.filters=e,this.limit=n,this.startAt=r,this.endAt=o,this.memoizedCanonicalId=null,this.memoizedOrderBy=null,this.startAt&&this.assertValidBound(this.startAt),this.endAt&&this.assertValidBound(this.endAt)}return o.atPath=function(t){return new o(t)},Object.defineProperty(o.prototype,"orderBy",{get:function(){if(null===this.memoizedOrderBy){var s=this.getInequalityFilterField(),t=this.getFirstOrderByField();if(null!==s&&null===t)this.memoizedOrderBy=s.isKeyField()?[je]:[new qe(s),je];else{Ho(null===s||null!==t&&s.equals(t),"First orderBy should match inequality field."),this.memoizedOrderBy=[];for(var e=!1,d=0,r=this.explicitOrderBy,o;d<r.length;d++)o=r[d],this.memoizedOrderBy.push(o),o.field.isKeyField()&&(e=!0);if(!e){var i=0<this.explicitOrderBy.length?this.explicitOrderBy[this.explicitOrderBy.length-1].dir:Fe.ASCENDING;this.memoizedOrderBy.push(i===Fe.ASCENDING?je:Qe)}}}return this.memoizedOrderBy},enumerable:!0,configurable:!0}),o.prototype.addFilter=function(t){Ho(null==this.getInequalityFilterField()||!(t instanceof xe)||!t.isInequality()||t.field.equals(this.getInequalityFilterField()),"Query must only have one inequality field."),Ho(!ae.isDocumentKey(this.path),"No filtering allowed for document query");var e=this.filters.concat([t]);return new o(this.path,this.explicitOrderBy.slice(),e,this.limit,this.startAt,this.endAt)},o.prototype.addOrderBy=function(t){Ho(!ae.isDocumentKey(this.path),"No ordering allowed for document query"),Ho(!this.startAt&&!this.endAt,"Bounds must be set after orderBy");var e=this.explicitOrderBy.concat([t]);return new o(this.path,e,this.filters.slice(),this.limit,this.startAt,this.endAt)},o.prototype.withLimit=function(t){return new o(this.path,this.explicitOrderBy.slice(),this.filters.slice(),t,this.startAt,this.endAt)},o.prototype.withStartAt=function(t){return new o(this.path,this.explicitOrderBy.slice(),this.filters.slice(),this.limit,t,this.endAt)},o.prototype.withEndAt=function(t){return new o(this.path,this.explicitOrderBy.slice(),this.filters.slice(),this.limit,this.startAt,t)},o.prototype.canonicalId=function(){if(null===this.memoizedCanonicalId){var a=this.path.canonicalString();a+="|f:";for(var t=0,e=this.filters;t<e.length;t++)a+=e[t].canonicalId(),a+=",";a+="|ob:";for(var n=0,r=this.orderBy;n<r.length;n++)a+=r[n].canonicalId(),a+=",";V(this.limit)||(a+="|l:",a+=this.limit),this.startAt&&(a+="|lb:",a+=this.startAt.canonicalId()),this.endAt&&(a+="|ub:",a+=this.endAt.canonicalId()),this.memoizedCanonicalId=a}return this.memoizedCanonicalId},o.prototype.toString=function(){var e="Query("+this.path.canonicalString();return 0<this.filters.length&&(e+=", filters: ["+this.filters.join(", ")+"]"),V(this.limit)||(e+=", limit: "+this.limit),0<this.explicitOrderBy.length&&(e+=", orderBy: ["+this.explicitOrderBy.join(", ")+"]"),this.startAt&&(e+=", startAt: "+this.startAt.canonicalId()),this.endAt&&(e+=", endAt: "+this.endAt.canonicalId()),e+")"},o.prototype.equals=function(n){if(this.limit!==n.limit)return!1;if(this.orderBy.length!==n.orderBy.length)return!1;for(var t=0;t<this.orderBy.length;t++)if(!this.orderBy[t].equals(n.orderBy[t]))return!1;if(this.filters.length!==n.filters.length)return!1;for(var t=0;t<this.filters.length;t++)if(!this.filters[t].equals(n.filters[t]))return!1;return!!this.path.equals(n.path)&&(null===this.startAt?null===n.startAt:!!this.startAt.equals(n.startAt))&&(null===this.endAt?null===n.endAt:this.endAt.equals(n.endAt))},o.prototype.docComparator=function(s,t){for(var e=!1,n=0,r=this.orderBy;n<r.length;n++){var o=r[n],i=o.compare(s,t);if(0!==i)return i;e=e||o.field.isKeyField()}return Ho(e,"orderBy used that doesn't compare on key field"),0},o.prototype.matches=function(e){return this.matchesAncestor(e)&&this.matchesOrderBy(e)&&this.matchesFilters(e)&&this.matchesBounds(e)},o.prototype.hasLimit=function(){return!V(this.limit)},o.prototype.getFirstOrderByField=function(){return 0<this.explicitOrderBy.length?this.explicitOrderBy[0].field:null},o.prototype.getInequalityFilterField=function(){for(var o=0,t=this.filters,e;o<t.length;o++)if(e=t[o],e instanceof xe&&e.isInequality())return e.field;return null},o.prototype.isDocumentQuery=function(){return ae.isDocumentKey(this.path)&&0===this.filters.length},o.prototype.matchesAncestor=function(n){var t=n.key.path;return ae.isDocumentKey(this.path)?this.path.equals(t):this.path.isPrefixOf(t)&&this.path.length===t.length-1},o.prototype.matchesOrderBy=function(o){for(var t=0,e=this.explicitOrderBy,n;t<e.length;t++)if(n=e[t],!n.field.isKeyField()&&void 0===o.field(n.field))return!1;return!0},o.prototype.matchesFilters=function(o){for(var t=0,e=this.filters;t<e.length;t++)if(!e[t].matches(o))return!1;return!0},o.prototype.matchesBounds=function(e){return!(this.startAt&&!this.startAt.sortsBeforeDocument(this.orderBy,e)||this.endAt&&this.endAt.sortsBeforeDocument(this.orderBy,e))},o.prototype.assertValidBound=function(e){Ho(e.position.length<=this.orderBy.length,"Bound is longer than orderBy")},o}(),Le=function(){function n(e){this.name=e}return n.fromString=function(t){return"<"===t?n.LESS_THAN:"<="===t?n.LESS_THAN_OR_EQUAL:"=="===t?n.EQUAL:">="===t?n.GREATER_THAN_OR_EQUAL:">"===t?n.GREATER_THAN:Wo("Unknown relation: "+t)},n.prototype.toString=function(){return this.name},n.prototype.equals=function(e){return this.name===e.name},n.LESS_THAN=new n("<"),n.LESS_THAN_OR_EQUAL=new n("<="),n.EQUAL=new n("=="),n.GREATER_THAN=new n(">"),n.GREATER_THAN_OR_EQUAL=new n(">="),n}(),xe=function(){function n(o,r,e){this.field=o,this.op=r,this.value=e}return n.prototype.matches=function(o){if(this.field.isKeyField()){Ho(this.value instanceof De,"Comparing on key, but filter value not a RefValue");var t=this.value,e=ae.comparator(o.key,t.key);return this.matchesComparison(e)}var n=o.field(this.field);return void 0!==n&&this.matchesValue(n)},n.prototype.matchesValue=function(e){return this.value.typeOrder===e.typeOrder&&this.matchesComparison(e.compareTo(this.value))},n.prototype.matchesComparison=function(e){switch(this.op){case Le.LESS_THAN:return 0>e;case Le.LESS_THAN_OR_EQUAL:return 0>=e;case Le.EQUAL:return 0===e;case Le.GREATER_THAN:return 0<e;case Le.GREATER_THAN_OR_EQUAL:return 0<=e;default:return Wo("Unknown relation op"+this.op);}},n.prototype.isInequality=function(){return this.op!==Le.EQUAL},n.prototype.canonicalId=function(){return this.field.canonicalString()+""+this.op+this.value},n.prototype.equals=function(t){return t instanceof n&&this.op.equals(t.op)&&this.field.equals(t.field)&&this.value.equals(t.value)},n.prototype.toString=function(){return this.field.canonicalString()+" "+this.op+" "+this.value.value()},n}(),Be=function(){function n(e){this.field=e}return n.prototype.matches=function(n){var t=n.field(this.field);return void 0!==t&&null===t.value()},n.prototype.canonicalId=function(){return this.field.canonicalString()+" IS null"},n.prototype.toString=function(){return this.field.canonicalString()+" IS null"},n.prototype.equals=function(t){return t instanceof n&&this.field.equals(t.field)},n}(),Ue=function(){function n(e){this.field=e}return n.prototype.matches=function(n){var t=n.field(this.field).value();return"number"==typeof t&&isNaN(t)},n.prototype.canonicalId=function(){return this.field.canonicalString()+" IS NaN"},n.prototype.toString=function(){return this.field.canonicalString()+" IS NaN"},n.prototype.equals=function(t){return t instanceof n&&this.field.equals(t.field)},n}(),Fe=function(){function e(e){this.name=e}return e.prototype.toString=function(){return this.name},e.ASCENDING=new e("asc"),e.DESCENDING=new e("desc"),e}(),Ve=function(){function e(n,o){this.position=n,this.before=o}return e.prototype.canonicalId=function(){for(var o=this.before?"b:":"a:",t=0,e=this.position;t<e.length;t++)o+=""+e[t];return o},e.prototype.sortsBeforeDocument=function(s,t){Ho(this.position.length<=s.length,"Bound has more components than query's orderBy");for(var e=0,n=0;n<this.position.length;n++){var r=s[n],o=this.position[n];if(r.field.isKeyField())Ho(o instanceof De,"Bound has a non-key value where the key path is being used."),e=ae.comparator(o.key,t.key);else{var i=t.field(r.field);Ho(void 0!==i,"Field should exist since document matched the orderBy already."),e=o.compareTo(i)}if(r.dir===Fe.DESCENDING&&(e*=-1),0!==e)break}return this.before?0>=e:0>e},e.prototype.equals=function(o){if(null===o)return!1;if(this.before!==o.before||this.position.length!==o.position.length)return!1;for(var t=0;t<this.position.length;t++){var e=this.position[t],n=o.position[t];return e.equals(n)}return!0},e}(),qe=function(){function e(n,o){this.field=n,void 0===o&&(o=Fe.ASCENDING),this.dir=o,this.isKeyOrderBy=n.isKeyField()}return e.prototype.compare=function(o,t){var e=this.isKeyOrderBy?se.compareByKey(o,t):se.compareByField(this.field,o,t);switch(this.dir){case Fe.ASCENDING:return e;case Fe.DESCENDING:return-1*e;default:return Wo("Unknown direction: "+this.dir);}},e.prototype.canonicalId=function(){return this.field.canonicalString()+""+this.dir},e.prototype.toString=function(){return this.field.canonicalString()+" ("+this.dir+")"},e.prototype.equals=function(e){return this.dir===e.dir&&this.field.equals(e.field)},e}(),je=new qe(ie.keyField(),Fe.ASCENDING),Qe=new qe(ie.keyField(),Fe.DESCENDING),Ke=RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/),We=function(){function a(n,o){this.seconds=n,this.nanos=o,Ho(0<=o,"timestamp nanoseconds out of range: "+o),Ho(1e9>o,"timestamp nanoseconds out of range"+o),Ho(-62135596800<=n,"timestamp seconds out of range: "+n),Ho(253402300800>n,"timestamp seconds out of range"+n)}return a.now=function(){return a.fromEpochMilliseconds(Date.now())},a.fromDate=function(t){return a.fromEpochMilliseconds(t.getTime())},a.fromEpochMilliseconds=function(t){var e=Vt(t/1e3);return new a(e,1e6*(t-1e3*e))},a.fromISOString=function(t){var e=0,n=Ke.exec(t);if(Ho(!!n,"invalid timestamp: "+t),n[1]){var s=n[1];s=(s+"000000000").substr(0,9),e=parseInt(s,10)}var o=new Date(t);return new a(Vt(o.getTime()/1e3),e)},a.prototype.toDate=function(){return new Date(this.toEpochMilliseconds())},a.prototype.toEpochMilliseconds=function(){return 1e3*this.seconds+this.nanos/1e6},a.prototype.compareTo=function(e){return this.seconds===e.seconds?P(this.nanos,e.nanos):P(this.seconds,e.seconds)},a.prototype.equals=function(e){return e.seconds===this.seconds&&e.nanos===this.nanos},a.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanos="+this.nanos+")"},a}(),Ge=function(){function o(e){this.timestamp=e}return o.fromMicroseconds=function(t){var e=Vt(t/1e6);return new o(new We(e,1e3*(t%1e6)))},o.fromTimestamp=function(t){return new o(t)},o.forDeletedDoc=function(){return o.MIN},o.prototype.compareTo=function(e){return this.timestamp.compareTo(e.timestamp)},o.prototype.equals=function(e){return this.timestamp.equals(e.timestamp)},o.prototype.toMicroseconds=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanos/1e3},o.prototype.toString=function(){return"SnapshotVersion("+this.timestamp+")"},o.prototype.toTimestamp=function(){return this.timestamp},o.MIN=new o(new We(0,0)),o}(),He;!function(e){e[e.Listen=0]="Listen",e[e.ExistenceFilterMismatch=1]="ExistenceFilterMismatch",e[e.LimboResolution=2]="LimboResolution"}(He||(He={}));var me=function(){function n(a,s,e,n,r){void 0===n&&(n=Ge.MIN),void 0===r&&(r=i()),this.query=a,this.targetId=s,this.purpose=e,this.snapshotVersion=n,this.resumeToken=r}return n.prototype.update=function(t){return new n(this.query,this.targetId,this.purpose,t.snapshotVersion,t.resumeToken)},n.prototype.equals=function(e){return this.targetId===e.targetId&&this.purpose===e.purpose&&this.snapshotVersion.equals(e.snapshotVersion)&&this.resumeToken===e.resumeToken&&this.query.equals(e.query)},n}(),Xe=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),Ye=function(){function e(e){this.fields=e}return e.prototype.equals=function(e){return x(this.fields,e.fields)},e}(),Je=function(){function n(){}return n.prototype.equals=function(t){return t instanceof n},n.instance=new n,n}(),$e=function(){function e(n,o){this.field=n,this.transform=o}return e.prototype.equals=function(e){return this.field.equals(e.field)&&this.transform.equals(e.transform)},e}(),Ze=function(){function e(n,o){this.version=n,this.transformResults=o}return e}(),tn;!function(e){e[e.Set=0]="Set",e[e.Patch=1]="Patch",e[e.Transform=2]="Transform",e[e.Delete=3]="Delete"}(tn||(tn={}));var ze=function(){function n(n,o){this.updateTime=n,this.exists=o,Ho(void 0===n||void 0===o,"Precondition can specify \"exists\" or \"updateTime\" but not both")}return n.exists=function(t){return new n(void 0,t)},n.updateTime=function(t){return new n(t)},Object.defineProperty(n.prototype,"isNone",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!0,configurable:!0}),n.prototype.isValidFor=function(e){return void 0===this.updateTime?void 0===this.exists?(Ho(this.isNone,"Precondition should be empty"),!0):this.exists?e instanceof se:null===e||e instanceof ue:e instanceof se&&e.version.equals(this.updateTime)},n.prototype.equals=function(e){return L(this.updateTime,e.updateTime)&&this.exists===e.exists},n.NONE=new n,n}(),nn=function(){function e(){}return e.prototype.verifyKeyMatches=function(e){null!=e&&Ho(e.key.equals(this.key),"Can only apply a mutation to a document with the same key")},e.getPostMutationVersion=function(e){return e instanceof se?e.version:Ge.MIN},e}(),rn=function(a){function n(t,i,n){var r=a.call(this)||this;return r.key=t,r.value=i,r.precondition=n,r.type=tn.Set,r}return Xe(n,a),n.prototype.applyToRemoteDocument=function(o,t){this.verifyKeyMatches(o),Ho(null==t.transformResults,"Transform results received by SetMutation.");var e=nn.getPostMutationVersion(o);return new se(this.key,e,this.value,{hasLocalMutations:!1})},n.prototype.applyToLocalView=function(e){if(this.verifyKeyMatches(e),!this.precondition.isValidFor(e))return e;var t=nn.getPostMutationVersion(e);return new se(this.key,t,this.value,{hasLocalMutations:!0})},n.prototype.equals=function(e){return e instanceof n&&this.key.equals(e.key)&&this.value.equals(e.value)&&this.precondition.equals(e.precondition)},n}(nn),on=function(a){function n(t,s,n,r){var o=a.call(this)||this;return o.key=t,o.data=s,o.fieldMask=n,o.precondition=r,o.type=tn.Patch,o}return Xe(n,a),n.prototype.applyToRemoteDocument=function(o,t){if(this.verifyKeyMatches(o),Ho(null==t.transformResults,"Transform results received by PatchMutation."),!this.precondition.isValidFor(o))return o;var e=nn.getPostMutationVersion(o),n=this.patchDocument(o);return new se(this.key,e,n,{hasLocalMutations:!1})},n.prototype.applyToLocalView=function(e){if(this.verifyKeyMatches(e),!this.precondition.isValidFor(e))return e;var t=nn.getPostMutationVersion(e),n=this.patchDocument(e);return new se(this.key,t,n,{hasLocalMutations:!0})},n.prototype.equals=function(e){return e instanceof n&&this.key.equals(e.key)&&this.fieldMask.equals(e.fieldMask)&&this.precondition.equals(e.precondition)},n.prototype.patchDocument=function(n){var t;return t=n instanceof se?n.data:Ne.EMPTY,this.patchObject(t)},n.prototype.patchObject=function(a){for(var t=0,e=this.fieldMask.fields;t<e.length;t++){var n=e[t],r=this.data.field(n);a=void 0===r?a.delete(n):a.set(n,r)}return a},n}(nn),an=function(o){function n(t,a){var n=o.call(this)||this;return n.key=t,n.fieldTransforms=a,n.type=tn.Transform,n.precondition=ze.exists(!0),n}return Xe(n,o),n.prototype.applyToRemoteDocument=function(a,t){this.verifyKeyMatches(a),Ho(null!=t.transformResults,"Transform results missing for TransformMutation.");var e=t.transformResults;if(!this.precondition.isValidFor(a))return a;var n=this.requireDocument(a),r=this.transformObject(n.data,e);return new se(this.key,n.version,r,{hasLocalMutations:!1})},n.prototype.applyToLocalView=function(a,t){if(this.verifyKeyMatches(a),!this.precondition.isValidFor(a))return a;var e=this.requireDocument(a),n=this.localTransformResults(t),r=this.transformObject(e.data,n);return new se(this.key,e.version,r,{hasLocalMutations:!0})},n.prototype.equals=function(e){return e instanceof n&&this.key.equals(e.key)&&x(this.fieldTransforms,e.fieldTransforms)&&this.precondition.equals(e.precondition)},n.prototype.requireDocument=function(n){Ho(n instanceof se,"Unknown MaybeDocument type "+n);var t=n;return Ho(t.key.equals(this.key),"Can only transform a document with the same key"),t},n.prototype.localTransformResults=function(a){for(var t=[],e=0,n=this.fieldTransforms;e<n.length;e++){var r=n[e],o=r.transform;if(!(o instanceof Je))return Wo("Encountered unknown transform: "+o);t.push(new Se(a))}return t},n.prototype.transformObject=function(a,t){Ho(t.length===this.fieldTransforms.length,"TransformResults length mismatch.");for(var e=0;e<this.fieldTransforms.length;e++){var n=this.fieldTransforms[e],r=n.transform,o=n.field;if(!(r instanceof Je))return Wo("Encountered unknown transform: "+r);a=a.set(o,t[e])}return a},n}(nn),sn=function(o){function n(t,a){var n=o.call(this)||this;return n.key=t,n.precondition=a,n.type=tn.Delete,n}return Xe(n,o),n.prototype.applyToRemoteDocument=function(n,t){return this.verifyKeyMatches(n),Ho(null==t.transformResults,"Transform results received by DeleteMutation."),new ue(this.key,Ge.MIN)},n.prototype.applyToLocalView=function(e){return this.verifyKeyMatches(e),this.precondition.isValidFor(e)?(e&&Ho(e.key.equals(this.key),"Can only apply mutation to document with same key"),new ue(this.key,Ge.forDeletedDoc())):e},n.prototype.equals=function(e){return e instanceof n&&this.key.equals(e.key)&&this.precondition.equals(e.precondition)},n}(nn),un=function(){function e(e){this.count=e}return e.prototype.equals=function(e){return e&&e.count===this.count},e}(),cn;!function(e){e[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.ALREADY_EXISTS=6]="ALREADY_EXISTS",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED",e[e.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",e[e.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",e[e.ABORTED=10]="ABORTED",e[e.OUT_OF_RANGE=11]="OUT_OF_RANGE",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.DATA_LOSS=15]="DATA_LOSS"}(cn||(cn={}));var en=function(){function a(e){this.comparator=e,this.data=new ce(this.comparator)}return a.fromMapKeys=function(t){var e=new a(t.comparator);return t.forEach(function(n){e=e.add(n)}),e},a.prototype.has=function(e){return null!==this.data.get(e)},a.prototype.first=function(){return this.data.minKey()},a.prototype.last=function(){return this.data.maxKey()},Object.defineProperty(a.prototype,"size",{get:function(){return this.data.size},enumerable:!0,configurable:!0}),a.prototype.indexOf=function(e){return this.data.indexOf(e)},a.prototype.forEach=function(n){this.data.inorderTraversal(function(t){return n(t),!1})},a.prototype.forEachInRange=function(o,t){for(var e=this.data.getIteratorFrom(o[0]),n;e.hasNext();){if(n=e.getNext(),0<=this.comparator(n.key,o[1]))return;t(n.key)}},a.prototype.forEachWhile=function(o,t){var e;for(e=void 0===t?this.data.getIterator():this.data.getIteratorFrom(t);e.hasNext();)if(!o(e.getNext().key))return},a.prototype.firstAfterOrEqual=function(n){var t=this.data.getIteratorFrom(n);return t.hasNext()?t.getNext().key:null},a.prototype.add=function(e){return this.copy(this.data.remove(e).insert(e,!0))},a.prototype.delete=function(e){return this.has(e)?this.copy(this.data.remove(e)):this},a.prototype.isEmpty=function(){return this.data.isEmpty()},a.prototype.unionWith=function(n){var o=this;return n.forEach(function(e){o=o.add(e)}),o},a.prototype.equals=function(t){if(!(t instanceof a))return!1;if(this.size!==t.size)return!1;for(var e=this.data.getIterator(),n=t.data.getIterator();e.hasNext();){var r=e.getNext().key,o=n.getNext().key;if(0!==this.comparator(r,o))return!1}return!0},a.prototype.toString=function(){var n=[];return this.forEach(function(t){return n.push(t)}),"SortedSet("+n+")"},a.prototype.copy=function(t){var e=new a(this.comparator);return e.data=t,e},a}(),ln=new ce(ae.comparator),fn=new ce(ae.comparator),dn=new ce(ae.comparator),pn=new en(ae.comparator),yn=function(){function e(o,r,e){this.snapshotVersion=o,this.targetChanges=r,this.documentUpdates=e}return e.prototype.addDocumentUpdate=function(e){this.documentUpdates=this.documentUpdates.insert(e.key,e)},e.prototype.handleExistenceFilterMismatch=function(e){this.targetChanges[e]={mapping:new vn,snapshotVersion:Ge.MIN,currentStatusUpdate:mn.MarkNotCurrent,resumeToken:i()}},e}(),mn;!function(e){e[e.None=0]="None",e[e.MarkNotCurrent=1]="MarkNotCurrent",e[e.MarkCurrent=2]="MarkCurrent"}(mn||(mn={}));var hn=J(),vn=function(){function e(){this.docs=hn}return Object.defineProperty(e.prototype,"documents",{get:function(){return this.docs},enumerable:!0,configurable:!0}),e.prototype.add=function(e){this.docs=this.docs.add(e)},e.prototype.delete=function(e){this.docs=this.docs.delete(e)},e.prototype.equals=function(e){return null!==e&&this.docs.equals(e.docs)},e}(),bn=function(){function e(){this.addedDocuments=hn,this.removedDocuments=hn}return e.prototype.applyToKeySet=function(n){var o=n;return this.addedDocuments.forEach(function(e){return o=o.add(e)}),this.removedDocuments.forEach(function(e){return o=o.delete(e)}),o},e.prototype.add=function(e){this.addedDocuments=this.addedDocuments.add(e),this.removedDocuments=this.removedDocuments.delete(e)},e.prototype.delete=function(e){this.addedDocuments=this.addedDocuments.delete(e),this.removedDocuments=this.removedDocuments.add(e)},e.prototype.equals=function(e){return null!==e&&this.addedDocuments.equals(e.addedDocuments)&&this.removedDocuments.equals(e.removedDocuments)},e}(),wn=function(){function e(o,a,e,n){this.updatedTargetIds=o,this.removedTargetIds=a,this.key=e,this.newDoc=n}return e}(),In=function(){function e(n,o){this.targetId=n,this.existenceFilter=o}return e}(),Tn;!function(e){e[e.NoChange=0]="NoChange",e[e.Added=1]="Added",e[e.Removed=2]="Removed",e[e.Current=3]="Current",e[e.Reset=4]="Reset"}(Tn||(Tn={}));var gn=function(){function e(o,a,e,n){void 0===e&&(e=i()),void 0===n&&(n=null),this.state=o,this.targetIds=a,this.resumeToken=e,this.cause=n}return e}(),En=function(){function e(o,r,e){this.snapshotVersion=o,this.listenTargets=r,this.existenceFilters={},this.targetChanges={},this.documentUpdates=X(),this.frozen=!1,this.pendingTargetResponses=h(e)}return e.prototype.add=function(e){Ho(!this.frozen,"Trying to modify frozen WatchChangeAggregator."),e instanceof wn?this.addDocumentChange(e):e instanceof gn?this.addTargetChange(e):e instanceof In?this.addExistenceFilterChange(e):Wo("Unknown watch change: "+e)},e.prototype.addChanges=function(n){var o=this;Ho(!this.frozen,"Trying to modify frozen WatchChangeAggregator."),n.forEach(function(e){return o.add(e)})},e.prototype.createRemoteEvent=function(){var o=this,t=this.targetChanges;return d(this.targetChanges,function(e){o.isActiveTarget(e)||delete t[e]}),this.frozen=!0,new yn(this.snapshotVersion,t,this.documentUpdates)},e.prototype.ensureTargetChange=function(n){var t=this.targetChanges[n];return t||(t={currentStatusUpdate:mn.None,snapshotVersion:this.snapshotVersion,mapping:new bn,resumeToken:i()},this.targetChanges[n]=t),t},e.prototype.isActiveTarget=function(e){return!l(this.pendingTargetResponses,e)&&l(this.listenTargets,e)},e.prototype.addDocumentChange=function(d){for(var t=!1,e=0,n=d.updatedTargetIds,r;e<n.length;e++)if(r=n[e],this.isActiveTarget(r)){var o=this.ensureTargetChange(r);o.mapping.add(d.key),t=!0}for(var i=0,a=d.removedTargetIds,r;i<a.length;i++)if(r=a[i],this.isActiveTarget(r)){var o=this.ensureTargetChange(r);o.mapping.delete(d.key),t=!0}d.newDoc&&t&&(this.documentUpdates=this.documentUpdates.insert(d.key,d.newDoc))},e.prototype.addTargetChange=function(o){var t=this;o.targetIds.forEach(function(e){var n=t.ensureTargetChange(e);switch(o.state){case Tn.NoChange:t.isActiveTarget(e)&&$(n,o.resumeToken);break;case Tn.Added:t.recordTargetResponse(e),l(t.pendingTargetResponses,e)||(n.mapping=new bn,n.currentStatusUpdate=mn.None,delete t.existenceFilters[e]),$(n,o.resumeToken);break;case Tn.Removed:t.recordTargetResponse(e),Ho(!o.cause,"WatchChangeAggregator does not handle errored targets");break;case Tn.Current:t.isActiveTarget(e)&&(n.currentStatusUpdate=mn.MarkCurrent,$(n,o.resumeToken));break;case Tn.Reset:t.isActiveTarget(e)&&(n.mapping=new vn,$(n,o.resumeToken));break;default:Wo("Unknown target watch change state: "+o.state);}})},e.prototype.recordTargetResponse=function(n){var t=(this.pendingTargetResponses[n]||0)-1;0==t?delete this.pendingTargetResponses[n]:this.pendingTargetResponses[n]=t},e.prototype.addExistenceFilterChange=function(e){this.isActiveTarget(e.targetId)&&(this.existenceFilters[e.targetId]=e.existenceFilter)},e}(),Sn=function(){var e={};return e[Fe.ASCENDING.name]="ASCENDING",e[Fe.DESCENDING.name]="DESCENDING",e}(),Cn=function(){var e={};return e[Le.LESS_THAN.name]="LESS_THAN",e[Le.LESS_THAN_OR_EQUAL.name]="LESS_THAN_OR_EQUAL",e[Le.GREATER_THAN.name]="GREATER_THAN",e[Le.GREATER_THAN_OR_EQUAL.name]="GREATER_THAN_OR_EQUAL",e[Le.EQUAL.name]="EQUAL",e}(),Dn=function(){function e(n,o){this.databaseId=n,this.options=o}return e.prototype.emptyByteString=function(){return this.options.useProto3Json?"":new Uint8Array(0)},e.prototype.unsafeCastProtoByteString=function(e){return e},e.prototype.fromRpcStatus=function(n){var t=void 0===n.code?Gt.UNKNOWN:z(n.code);return new Ht(t,n.message||"")},e.prototype.toInt32Value=function(e){return V(e)?void 0:{value:e}},e.prototype.fromInt32Value=function(n){var o;return o="object"==typeof n?n.value:n,V(o)?null:o},e.prototype.toTimestamp=function(e){return{seconds:e.seconds,nanos:e.nanos}},e.prototype.fromTimestamp=function(o){if("string"==typeof o)return We.fromISOString(o);Ho(!!o,"Cannot deserialize null or undefined timestamp.");var r=et(o.seconds||"0"),e=o.nanos||0;return new We(r,e)},e.prototype.toBytes=function(e){return this.options.useProto3Json?e.toBase64():this.unsafeCastProtoByteString(e.toUint8Array())},e.prototype.fromBlob=function(e){return"string"==typeof e?(Ho(this.options.useProto3Json,"Expected bytes to be passed in as Uint8Array, but got a string instead."),Xt.fromBase64String(e)):(Ho(!this.options.useProto3Json,"Expected bytes to be passed in as string, but got something else instead."),Xt.fromUint8Array(e))},e.prototype.toVersion=function(e){return this.toTimestamp(e.toTimestamp())},e.prototype.fromVersion=function(e){return Ho(!!e,"Trying to deserialize version that isn't set"),Ge.fromTimestamp(this.fromTimestamp(e))},e.prototype.toResourceName=function(n,t){return this.fullyQualifiedPrefixPath(n).child("documents").child(t).canonicalString()},e.prototype.fromResourceName=function(n){var t=re.fromString(n);return Ho(this.isValidResourceName(t),"Tried to deserialize invalid key "+t),t},e.prototype.toName=function(e){return this.toResourceName(this.databaseId,e.path)},e.prototype.fromName=function(n){var t=this.fromResourceName(n);return Ho(t.get(1)===this.databaseId.projectId,"Tried to deserialize key from different project: "+t.get(1)+" vs "+this.databaseId.projectId),Ho(!t.get(3)&&!this.databaseId.database||t.get(3)===this.databaseId.database,"Tried to deserialize key from different database: "+t.get(3)+" vs "+this.databaseId.database),new ae(this.extractLocalPathFromResourceName(t))},e.prototype.toQueryPath=function(e){return 0===e.length?this.encodedDatabaseId:this.toResourceName(this.databaseId,e)},e.prototype.fromQueryPath=function(n){var t=this.fromResourceName(n);return 4===t.length?re.EMPTY_PATH:this.extractLocalPathFromResourceName(t)},Object.defineProperty(e.prototype,"encodedDatabaseId",{get:function(){return new re(["projects",this.databaseId.projectId,"databases",this.databaseId.database]).canonicalString()},enumerable:!0,configurable:!0}),e.prototype.fullyQualifiedPrefixPath=function(e){return new re(["projects",e.projectId,"databases",e.database])},e.prototype.extractLocalPathFromResourceName=function(e){return Ho(4<e.length&&"documents"===e.get(4),"tried to deserialize invalid key "+e),e.popFirst(5)},e.prototype.isValidResourceName=function(e){return 4<=e.length&&"projects"===e.get(0)&&"databases"===e.get(2)},e.prototype.toValue=function(n){if(n instanceof ge)return{nullValue:"NULL_VALUE"};if(n instanceof ve)return{booleanValue:n.value()};if(n instanceof we)return{integerValue:""+n.value()};if(n instanceof Ie){var t=n.value();if(this.options.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:n.value()}}return n instanceof Te?{stringValue:n.value()}:n instanceof Ne?{mapValue:this.toMapValue(n)}:n instanceof Ae?{arrayValue:this.toArrayValue(n)}:n instanceof Ee?{timestampValue:this.toTimestamp(n.internalValue)}:n instanceof ke?{geoPointValue:{latitude:n.value().latitude,longitude:n.value().longitude}}:n instanceof Ce?{bytesValue:this.toBytes(n.value())}:n instanceof De?{referenceValue:this.toResourceName(n.databaseId,n.key.path)}:Wo("Unknown FieldValue "+JSON.stringify(n))},e.prototype.fromValue=function(d){var l=this,e=d.value_type;if(tt(d,e,"nullValue"))return ge.INSTANCE;if(tt(d,e,"booleanValue"))return ve.of(d.booleanValue);if(tt(d,e,"integerValue"))return new we(et(d.integerValue));if(tt(d,e,"doubleValue")){if(this.options.useProto3Json){if("NaN"===d.doubleValue)return Ie.NAN;if("Infinity"===d.doubleValue)return Ie.POSITIVE_INFINITY;if("-Infinity"===d.doubleValue)return Ie.NEGATIVE_INFINITY}return new Ie(d.doubleValue)}if(tt(d,e,"stringValue"))return new Te(d.stringValue);if(tt(d,e,"mapValue"))return this.fromFields(d.mapValue.fields||{});if(tt(d,e,"arrayValue")){Z(d.arrayValue,"arrayValue");var t=d.arrayValue.values||[];return new Ae(t.map(function(e){return l.fromValue(e)}))}if(tt(d,e,"timestampValue"))return Z(d.timestampValue,"timestampValue"),new Ee(this.fromTimestamp(d.timestampValue));if(tt(d,e,"geoPointValue")){Z(d.geoPointValue,"geoPointValue");var n=d.geoPointValue.latitude||0,o=d.geoPointValue.longitude||0;return new ke(new Go(n,o))}if(tt(d,e,"bytesValue")){Z(d.bytesValue,"bytesValue");var r=this.fromBlob(d.bytesValue);return new Ce(r)}if(tt(d,e,"referenceValue")){Z(d.referenceValue,"referenceValue");var a=this.fromResourceName(d.referenceValue),i=new te(a.get(1),a.get(3)),s=new ae(this.extractLocalPathFromResourceName(a));return new De(i,s)}return Wo("Unknown Value proto "+JSON.stringify(d))},e.prototype.toMutationDocument=function(n,t){return{name:this.toName(n),fields:this.toFields(t)}},e.prototype.toDocument=function(e){return Ho(!e.hasLocalMutations,"Can't serialize documents with mutations."),{name:this.toName(e.key),fields:this.toFields(e.data),updateTime:this.toTimestamp(e.version.toTimestamp())}},e.prototype.fromDocument=function(e){return new se(this.fromName(e.name),this.fromVersion(e.updateTime),this.fromFields(e.fields||{}),{hasLocalMutations:!1})},e.prototype.toFields=function(o){var a=this,e={};return o.forEach(function(n,t){e[n]=a.toValue(t)}),e},e.prototype.fromFields=function(n){var o=this,e=Ne.EMPTY;return p(n,function(r,t){e=e.set(new ie([r]),o.fromValue(t))}),e},e.prototype.toMapValue=function(e){return{fields:this.toFields(e)}},e.prototype.toArrayValue=function(o){var r=this,e=[];return o.forEach(function(n){e.push(r.toValue(n))}),{values:e}},e.prototype.fromFound=function(o){Ho(!!o.found,"Tried to deserialize a found document from a missing document."),Z(o.found.name,"doc.found.name"),Z(o.found.updateTime,"doc.found.updateTime");var t=this.fromName(o.found.name),e=this.fromVersion(o.found.updateTime),n=this.fromFields(o.found.fields||{});return new se(t,e,n,{hasLocalMutations:!1})},e.prototype.fromMissing=function(o){Ho(!!o.missing,"Tried to deserialize a missing document from a found document."),Ho(!!o.readTime,"Tried to deserialize a missing document without a read time.");var t=this.fromName(o.missing),e=this.fromVersion(o.readTime);return new ue(t,e)},e.prototype.fromMaybeDocument=function(n){var t=n.result;return tt(n,t,"found")?this.fromFound(n):tt(n,t,"missing")?this.fromMissing(n):Wo("invalid batch get response: "+JSON.stringify(n))},e.prototype.toWatchTargetChangeState=function(e){return e===Tn.Added?"ADD":e===Tn.Current?"CURRENT":e===Tn.NoChange?"NO_CHANGE":e===Tn.Removed?"REMOVE":e===Tn.Reset?"RESET":Wo("Unknown WatchTargetChangeState: "+e)},e.prototype.toTestWatchChange=function(o){if(o instanceof In)return{filter:{count:o.existenceFilter.count,targetId:o.targetId}};if(o instanceof wn){if(o.newDoc instanceof se){var t=o.newDoc;return{documentChange:{document:{name:this.toName(t.key),fields:this.toFields(t.data),updateTime:this.toVersion(t.version)},targetIds:o.updatedTargetIds,removedTargetIds:o.removedTargetIds}}}if(o.newDoc instanceof ue){var t=o.newDoc;return{documentDelete:{document:this.toName(t.key),readTime:this.toVersion(t.version),removedTargetIds:o.removedTargetIds}}}if(null===o.newDoc)return{documentRemove:{document:this.toName(o.key),removedTargetIds:o.removedTargetIds}}}if(o instanceof gn){var e;return o.cause&&(e={code:K(o.cause.code),message:o.cause.message}),{targetChange:{targetChangeType:this.toWatchTargetChangeState(o.state),targetIds:o.targetIds,resumeToken:this.unsafeCastProtoByteString(o.resumeToken),cause:e}}}return Wo("Unrecognized watch change: "+JSON.stringify(o))},e.prototype.fromWatchChange=function(u){var t=u.response_type,n;if(tt(u,t,"targetChange")){Z(u.targetChange,"targetChange");var e=this.fromWatchTargetChangeState(u.targetChange.targetChangeType||"NO_CHANGE"),r=u.targetChange.targetIds||[],o=u.targetChange.resumeToken||this.emptyByteString(),i=u.targetChange.cause,a=i&&this.fromRpcStatus(i);n=new gn(e,r,o,a||null)}else if(tt(u,t,"documentChange")){Z(u.documentChange,"documentChange"),Z(u.documentChange.document,"documentChange.name"),Z(u.documentChange.document.name,"documentChange.document.name"),Z(u.documentChange.document.updateTime,"documentChange.document.updateTime");var s=u.documentChange,c=this.fromName(s.document.name),h=this.fromVersion(s.document.updateTime),l=this.fromFields(s.document.fields||{}),f=new se(c,h,l,{hasLocalMutations:!1}),d=s.targetIds||[],p=s.removedTargetIds||[];n=new wn(d,p,f.key,f)}else if(tt(u,t,"documentDelete")){Z(u.documentDelete,"documentDelete"),Z(u.documentDelete.document,"documentDelete.document");var y=u.documentDelete,c=this.fromName(y.document),h=y.readTime?this.fromVersion(y.readTime):Ge.forDeletedDoc(),f=new ue(c,h),p=y.removedTargetIds||[];n=new wn([],p,f.key,f)}else if(tt(u,t,"documentRemove")){Z(u.documentRemove,"documentRemove"),Z(u.documentRemove.document,"documentRemove");var m=u.documentRemove,c=this.fromName(m.document),p=m.removedTargetIds||[];n=new wn([],p,c,null)}else{if(!tt(u,t,"filter"))return Wo("Unknown change type "+JSON.stringify(u));Z(u.filter,"filter"),Z(u.filter.targetId,"filter.targetId");var g=u.filter,v=g.count||0,b=new un(v),x=g.targetId;n=new In(x,b)}return n},e.prototype.fromWatchTargetChangeState=function(e){return"NO_CHANGE"===e?Tn.NoChange:"ADD"===e?Tn.Added:"REMOVE"===e?Tn.Removed:"CURRENT"===e?Tn.Current:"RESET"===e?Tn.Reset:Wo("Got unexpected TargetChange.state: "+e)},e.prototype.versionFromListenResponse=function(n){if(!tt(n,n.response_type,"targetChange"))return Ge.MIN;var t=n.targetChange;return t.targetIds&&t.targetIds.length?Ge.MIN:t.readTime?this.fromVersion(t.readTime):Ge.MIN},e.prototype.toMutation=function(o){var r=this,t;if(o instanceof rn)t={update:this.toMutationDocument(o.key,o.value)};else if(o instanceof sn)t={delete:this.toName(o.key)};else if(o instanceof on)t={update:this.toMutationDocument(o.key,o.data),updateMask:this.toDocumentMask(o.fieldMask)};else{if(!(o instanceof an))return Wo("Unknown mutation type "+o.type);t={transform:{document:this.toName(o.key),fieldTransforms:o.fieldTransforms.map(function(e){return r.toFieldTransform(e)})}}}return o.precondition.isNone||(t.currentDocument=this.toPrecondition(o.precondition)),t},e.prototype.fromMutation=function(s){var d=this,e=s.currentDocument?this.fromPrecondition(s.currentDocument):ze.NONE;if(s.update){Z(s.update.name,"name");var t=this.fromName(s.update.name),n=this.fromFields(s.update.fields||{});if(s.updateMask){var o=this.fromDocumentMask(s.updateMask);return new on(t,n,o,e)}return new rn(t,n,e)}if(s.delete){var t=this.fromName(s.delete);return new sn(t,e)}if(s.transform){var t=this.fromName(s.transform.document),r=s.transform.fieldTransforms.map(function(e){return d.fromFieldTransform(e)});return Ho(!0===e.exists,"Transforms only support precondition \"exists == true\""),new an(t,r)}return Wo("unknown mutation proto: "+JSON.stringify(s))},e.prototype.toPrecondition=function(e){return Ho(!e.isNone,"Can't serialize an empty precondition"),void 0===e.updateTime?void 0===e.exists?Wo("Unknown precondition"):{exists:e.exists}:{updateTime:this.toVersion(e.updateTime)}},e.prototype.fromPrecondition=function(e){return void 0===e.updateTime?void 0===e.exists?ze.NONE:ze.exists(e.exists):ze.updateTime(this.fromVersion(e.updateTime))},e.prototype.fromWriteResult=function(o){var a=this,e=o.updateTime?this.fromVersion(o.updateTime):null,t=null;return o.transformResults&&0<o.transformResults.length&&(t=o.transformResults.map(function(e){return a.fromValue(e)})),new Ze(e,t)},e.prototype.fromWriteResults=function(n){var o=this;return(n||[]).map(function(e){return o.fromWriteResult(e)})},e.prototype.toFieldTransform=function(e){return Ho(e.transform instanceof Je,"Unknown transform: "+e.transform),{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"}},e.prototype.fromFieldTransform=function(n){Ho("REQUEST_TIME"===n.setToServerValue,"Unknown transform proto: "+JSON.stringify(n));var t=ie.fromServerFormat(n.fieldPath);return new $e(t,Je.instance)},e.prototype.toDocumentsTarget=function(e){return{documents:[this.toQueryPath(e.path)]}},e.prototype.fromDocumentsTarget=function(o){var t=o.documents.length;Ho(1===t,"DocumentsTarget contained other than 1 document: "+t);var e=o.documents[0];return Pe.atPath(this.fromQueryPath(e))},e.prototype.toQueryTarget=function(a){var t={structuredQuery:{}};if(a.path.isEmpty())t.parent=this.toQueryPath(re.EMPTY_PATH);else{var e=a.path;Ho(0!=e.length%2,"Document queries with filters are not supported."),t.parent=this.toQueryPath(e.popLast()),t.structuredQuery.from=[{collectionId:e.lastSegment()}]}var n=this.toFilter(a.filters);n&&(t.structuredQuery.where=n);var r=this.toOrder(a.orderBy);r&&(t.structuredQuery.orderBy=r);var o=this.toInt32Value(a.limit);return void 0!==o&&(t.structuredQuery.limit=o),a.startAt&&(t.structuredQuery.startAt=this.toCursor(a.startAt)),a.endAt&&(t.structuredQuery.endAt=this.toCursor(a.endAt)),t},e.prototype.fromQueryTarget=function(d){var t=this.fromQueryPath(d.parent),e=d.structuredQuery,n=e.from?e.from.length:0;if(0<n){Ho(1===n,"StructuredQuery.from with more than one collection is not supported.");var r=e.from[0];t=t.child(r.collectionId)}var o=[];e.where&&(o=this.fromFilter(e.where));var i=[];e.orderBy&&(i=this.fromOrder(e.orderBy));var a=null;e.limit&&(a=this.fromInt32Value(e.limit));var s=null;e.startAt&&(s=this.fromCursor(e.startAt));var l=null;return e.endAt&&(l=this.fromCursor(e.endAt)),new Pe(t,i,o,a,s,l)},e.prototype.toListenRequestLabels=function(n){var t=this.toLabel(n.purpose);return null==t?null:{"goog-listen-tags":t}},e.prototype.toLabel=function(e){return e===He.Listen?null:e===He.ExistenceFilterMismatch?"existence-filter-mismatch":e===He.LimboResolution?"limbo-document":Wo("Unrecognized query purpose: "+e)},e.prototype.toTarget=function(o){var t=o.query,n;return n=t.isDocumentQuery()?{documents:this.toDocumentsTarget(t)}:{query:this.toQueryTarget(t)},n.targetId=o.targetId,0<o.resumeToken.length&&(n.resumeToken=this.unsafeCastProtoByteString(o.resumeToken)),n},e.prototype.toFilter=function(o){var r=this;if(0!==o.length){var e=o.map(function(e){return e instanceof xe?r.toRelationFilter(e):r.toUnaryFilter(e)});return 1===e.length?e[0]:{compositeFilter:{op:"AND",filters:e}}}},e.prototype.fromFilter=function(n){var o=this;return n?void 0===n.unaryFilter?void 0===n.fieldFilter?void 0===n.compositeFilter?Wo("Unknown filter: "+JSON.stringify(n)):n.compositeFilter.filters.map(function(e){return o.fromFilter(e)}).reduce(function(n,t){return n.concat(t)}):[this.fromRelationFilter(n)]:[this.fromUnaryFilter(n)]:[]},e.prototype.toOrder=function(n){var o=this;if(0!==n.length)return n.map(function(e){return o.toPropertyOrder(e)})},e.prototype.fromOrder=function(n){var o=this;return n.map(function(e){return o.fromPropertyOrder(e)})},e.prototype.toCursor=function(n){var o=this;return{before:n.before,values:n.position.map(function(e){return o.toValue(e)})}},e.prototype.fromCursor=function(o){var a=this,e=!!o.before,t=o.values.map(function(e){return a.fromValue(e)});return new Ve(t,e)},e.prototype.toDirection=function(e){return Sn[e.name]},e.prototype.fromDirection=function(e){return"ASCENDING"===e?Fe.ASCENDING:"DESCENDING"===e?Fe.DESCENDING:void 0},e.prototype.toOperatorName=function(e){return Cn[e.name]},e.prototype.fromOperatorName=function(e){return"EQUAL"===e?Le.EQUAL:"GREATER_THAN"===e?Le.GREATER_THAN:"GREATER_THAN_OR_EQUAL"===e?Le.GREATER_THAN_OR_EQUAL:"LESS_THAN"===e?Le.LESS_THAN:"LESS_THAN_OR_EQUAL"===e?Le.LESS_THAN_OR_EQUAL:"OPERATOR_UNSPECIFIED"===e?Wo("Unspecified relation"):Wo("Unknown relation")},e.prototype.toFieldPathReference=function(e){return{fieldPath:e.canonicalString()}},e.prototype.fromFieldPathReference=function(e){return ie.fromServerFormat(e.fieldPath)},e.prototype.toPropertyOrder=function(e){return{field:this.toFieldPathReference(e.field),direction:this.toDirection(e.dir)}},e.prototype.fromPropertyOrder=function(e){return new qe(this.fromFieldPathReference(e.field),this.fromDirection(e.direction))},e.prototype.toRelationFilter=function(e){return e instanceof xe?{fieldFilter:{field:this.toFieldPathReference(e.field),op:this.toOperatorName(e.op),value:this.toValue(e.value)}}:Wo("Unrecognized filter: "+JSON.stringify(e))},e.prototype.fromRelationFilter=function(e){return new xe(this.fromFieldPathReference(e.fieldFilter.field),this.fromOperatorName(e.fieldFilter.op),this.fromValue(e.fieldFilter.value))},e.prototype.toUnaryFilter=function(e){return e instanceof Ue?{unaryFilter:{field:this.toFieldPathReference(e.field),op:"IS_NAN"}}:e instanceof Be?{unaryFilter:{field:this.toFieldPathReference(e.field),op:"IS_NULL"}}:Wo("Unrecognized filter: "+JSON.stringify(e))},e.prototype.fromUnaryFilter=function(o){switch(o.unaryFilter.op){case"IS_NAN":var t=this.fromFieldPathReference(o.unaryFilter.field);return new Ue(t);case"IS_NULL":var e=this.fromFieldPathReference(o.unaryFilter.field);return new Be(e);case"OPERATOR_UNSPECIFIED":return Wo("Unspecified filter");default:return Wo("Unknown filter");}},e.prototype.toDocumentMask=function(e){return{fieldPaths:e.fields.map(function(e){return e.canonicalString()})}},e.prototype.fromDocumentMask=function(o){var t=o.fieldPaths||[],e=t.map(function(e){return ie.fromServerFormat(e)});return new Ye(e)},e}(),kn=e(115),Nn=function(){function e(e){this.wrappedOnOpen=null,this.wrappedOnClose=null,this.wrappedOnMessage=null,this.sendFn=e.sendFn,this.closeFn=e.closeFn}return e.prototype.onOpen=function(e){Ho(!this.wrappedOnOpen,"Called onOpen on stream twice!"),this.wrappedOnOpen=e},e.prototype.onClose=function(e){Ho(!this.wrappedOnClose,"Called onClose on stream twice!"),this.wrappedOnClose=e},e.prototype.onMessage=function(e){Ho(!this.wrappedOnMessage,"Called onMessage on stream twice!"),this.wrappedOnMessage=e},e.prototype.close=function(){this.closeFn()},e.prototype.send=function(e){this.sendFn(e)},e.prototype.callOnOpen=function(){Ho(null!==this.wrappedOnOpen,"Cannot call onOpen because no callback was set"),this.wrappedOnOpen()},e.prototype.callOnClose=function(e){Ho(null!==this.wrappedOnClose,"Cannot call onClose because no callback was set"),this.wrappedOnClose(e)},e.prototype.callOnMessage=function(e){Ho(null!==this.wrappedOnMessage,"Cannot call onMessage because no callback was set"),this.wrappedOnMessage(e)},e}(),An="Connection",Rn={BatchGetDocuments:"batchGet",Commit:"commit"},On=function(){function e(n){this.databaseId=n.databaseId,this.pool=new kn.XhrIoPool;var o=n.ssl?"https":"http";this.baseUrl=o+"://"+n.host}return e.prototype.modifyHeadersForRequest=function(o,t){if(t)for(var e in t.authHeaders)t.authHeaders.hasOwnProperty(e)&&(o[e]=t.authHeaders[e]);o["X-Goog-Api-Client"]="gl-js/ fire/"+jt,o["google-cloud-resource-prefix"]="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database},e.prototype.invokeRPC=function(i,t,e){var n=this,r=this.makeUrl(i);return new Promise(function(o,a){n.pool.getObject(function(s){s.listenOnce(kn.EventType.COMPLETE,function(){try{switch(s.getLastErrorCode()){case kn.ErrorCode.NO_ERROR:var t=s.getResponseJson();So(An,"XHR received:",JSON.stringify(t)),o(t);break;case kn.ErrorCode.TIMEOUT:So(An,"RPC \""+i+"\" timed out"),a(new Ht(Gt.DEADLINE_EXCEEDED,"Request time out"));break;case kn.ErrorCode.HTTP_ERROR:var e=s.getStatus();So(An,"RPC \""+i+"\" failed with status:",e,"response text:",s.getResponseText()),0<e?a(new Ht(G(e),"Server responded with status "+s.getStatusText())):(So(An,"RPC \""+i+"\" failed"),a(new Ht(Gt.UNAVAILABLE,"Connection failed.")));break;default:Wo("RPC \""+i+"\" failed with unanticipated webchannel error "+s.getLastErrorCode()+": "+s.getLastError()+", giving up.");}}finally{So(An,"RPC \""+i+"\" completed."),n.pool.releaseObject(s)}});var d=JSON.stringify(t);So(An,"XHR sending: ",r+" "+d);var p={"Content-Type":"text/plain"};n.modifyHeadersForRequest(p,e),s.send(r,"POST",d,p,15)})})},e.prototype.invokeStreamingRPC=function(o,t,e){return this.invokeRPC(o,t,e)},e.prototype.openStream=function(i,t){var e=[this.baseUrl,"/","google.firestore.v1beta1.Firestore","/",i,"/channel"],n=Object(kn.createWebChannelTransport)(),r={backgroundChannelTest:!0,httpSessionIdParam:"gsessionid",initMessageHeaders:{},httpHeadersOverwriteParam:"$httpHeaders",sendRawJson:!0,supportsCrossDomainXhr:!0};this.modifyHeadersForRequest(r.initMessageHeaders,t);var o=e.join("");So(An,"Creating WebChannel: "+o+" "+r);var d=n.createWebChannel(o,r),a=!1,s=!1,p=new Nn({sendFn:function(e){s?So(An,"Not sending because WebChannel is closed:",e):(a||(So(An,"Opening WebChannel transport."),d.open(),a=!0),So(An,"WebChannel sending:",e),d.send(e))},closeFn:function(){return d.close()}}),l=function(n,o){d.listen(n,function(e){try{o(e)}catch(e){setTimeout(function(){throw e},0)}})};return l(kn.WebChannel.EventType.OPEN,function(){s||So(An,"WebChannel transport opened.")}),l(kn.WebChannel.EventType.CLOSE,function(){s||(s=!0,So(An,"WebChannel transport closed"),p.callOnClose())}),l(kn.WebChannel.EventType.ERROR,function(e){s||(s=!0,So(An,"WebChannel transport errored:",e),p.callOnClose(new Ht(Gt.UNAVAILABLE,"The operation could not be completed")))}),l(kn.WebChannel.EventType.MESSAGE,function(i){if(!s){var t=i.data[0];Ho(!!t,"Got a webchannel message without data.");var l=t.error||t[0]&&t[0].error;if(l){So(An,"WebChannel received error:",l);var n=l.status,r=H(n),o=l.message;void 0===r&&(r=Gt.INTERNAL,o="Unknown error status: "+n+" with message "+l.message),s=!0,p.callOnClose(new Ht(r,o)),d.close()}else So(An,"WebChannel received:",t),p.callOnMessage(t)}}),setTimeout(function(){p.callOnOpen()},0),p},e.prototype.makeUrl=function(o){var t=Rn[o];Ho(void 0!==t,"Unknown REST mapping for: "+o);var e=[this.baseUrl,"/","v1beta1"];return e.push("/projects/"),e.push(this.databaseId.projectId),e.push("/databases/"),e.push(this.databaseId.database),e.push("/documents"),e.push(":"),e.push(t),e.join("")},e}(),_n=function(){function e(){this.emptyByteString="",this.base64Available="undefined"!=typeof atob}return e.prototype.loadConnection=function(e){return Promise.resolve(new On(e))},e.prototype.newSerializer=function(e){return new Dn(e,{useProto3Json:!0})},e.prototype.formatJSON=function(e){return JSON.stringify(e)},e.prototype.atob=function(e){return atob(e)},e.prototype.btoa=function(e){return btoa(e)},e}();Kt.setPlatform(new _n);var Pn=function(){function e(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];y("FieldPath",o,"fieldNames",1);for(var e=0;e<o.length;++e)if(b("FieldPath","string",e,o[e]),0===o[e].length)throw new Ht(Gt.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this.t=new ie(o)}return e.documentId=function(){return e.p},e.p=new e(ie.keyField().canonicalString()),e}(),Yo=/[~\*\/\[\]]/,Bn;!function(e){e[e.Unknown=0]="Unknown",e[e.Healthy=1]="Healthy",e[e.Failed=2]="Failed"}(Bn||(Bn={}));var Ln;!function(e){e[e.Added=0]="Added",e[e.Removed=1]="Removed",e[e.Modified=2]="Modified",e[e.Metadata=3]="Metadata"}(Ln||(Ln={}));var Un;!function(e){e[e.Local=0]="Local",e[e.Synced=1]="Synced"}(Un||(Un={}));var Fn=function(){function e(){this.changeMap=new ce(ae.comparator)}return e.prototype.track=function(o){var t=o.doc.key,e=this.changeMap.get(t);return e?void(o.type!==Ln.Added&&e.type===Ln.Metadata?this.changeMap=this.changeMap.insert(t,o):o.type===Ln.Metadata&&e.type!==Ln.Removed?this.changeMap=this.changeMap.insert(t,{type:e.type,doc:o.doc}):o.type===Ln.Modified&&e.type===Ln.Modified?this.changeMap=this.changeMap.insert(t,{type:Ln.Modified,doc:o.doc}):o.type===Ln.Modified&&e.type===Ln.Added?this.changeMap=this.changeMap.insert(t,{type:Ln.Added,doc:o.doc}):o.type===Ln.Removed&&e.type===Ln.Added?this.changeMap=this.changeMap.remove(t):o.type===Ln.Removed&&e.type===Ln.Modified?this.changeMap=this.changeMap.insert(t,{type:Ln.Removed,doc:e.doc}):o.type===Ln.Added&&e.type===Ln.Removed?this.changeMap=this.changeMap.insert(t,{type:Ln.Modified,doc:o.doc}):Wo("unsupported combination of changes: "+JSON.stringify(o)+" after "+JSON.stringify(e))):void(this.changeMap=this.changeMap.insert(t,o))},e.prototype.getChanges=function(){var o=[];return this.changeMap.inorderTraversal(function(t,e){o.push(e)}),o},e}(),qn=function(){function a(o){this.comparator=o?function(t,e){return o(t,e)||ae.comparator(t.key,e.key)}:function(n,t){return ae.comparator(n.key,t.key)},this.keyedMap=Q(),this.sortedSet=new ce(this.comparator)}return a.emptySet=function(t){return new a(t.comparator)},a.prototype.has=function(e){return null!=this.keyedMap.get(e)},a.prototype.get=function(e){return this.keyedMap.get(e)},a.prototype.first=function(){return this.sortedSet.minKey()},a.prototype.last=function(){return this.sortedSet.maxKey()},a.prototype.isEmpty=function(){return this.sortedSet.isEmpty()},a.prototype.prevDoc=function(n){Ho(this.has(n),"Trying to get a previous document to non-existing key: "+n);var t=this.keyedMap.get(n);return this.sortedSet.getPredecessorKey(t)},a.prototype.indexOf=function(n){var t=this.keyedMap.get(n);return t?this.sortedSet.indexOf(t):-1},Object.defineProperty(a.prototype,"size",{get:function(){return this.sortedSet.size},enumerable:!0,configurable:!0}),a.prototype.forEach=function(n){this.sortedSet.inorderTraversal(function(t){return n(t),!1})},a.prototype.add=function(n){var t=this.delete(n.key);return t.copy(t.keyedMap.insert(n.key,n),t.sortedSet.insert(n,null))},a.prototype.delete=function(n){var t=this.get(n);return t?this.copy(this.keyedMap.remove(n),this.sortedSet.remove(t)):this},a.prototype.equals=function(t){if(!(t instanceof a))return!1;if(this.size!==t.size)return!1;for(var e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();e.hasNext();){var r=e.getNext().key,o=n.getNext().key;if(!r.equals(o))return!1}return!0},a.prototype.toString=function(){var n=[];return this.forEach(function(t){n.push(""+t)}),0===n.length?"DocumentSet ()":"DocumentSet (\n "+n.join(" \n")+"\n)"},a.prototype.copy=function(t,e){var n=new a;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n},a}(),jn=function(){function e(e){this.mapKeyFn=e,this.inner={}}return e.prototype.get=function(d){var t=this.mapKeyFn(d),e=this.inner[t];if(void 0!==e)for(var n=0,r=e;n<r.length;n++){var o=r[n],i=o[0],a=o[1];if(i.equals(d))return a}},e.prototype.has=function(e){return void 0!==this.get(e)},e.prototype.set=function(a,t){var e=this.mapKeyFn(a),n=this.inner[e];if(void 0===n)return void(this.inner[e]=[[a,t]]);for(var r=0;r<n.length;r++)if(n[r][0].equals(a))return void(n[r]=[a,t]);n.push([a,t])},e.prototype.delete=function(o){var t=this.mapKeyFn(o),e=this.inner[t];if(void 0===e)return!1;for(var n=0;n<e.length;n++)if(e[n][0].equals(o))return 1===e.length?delete this.inner[t]:e.splice(n,1),!0;return!1},e.prototype.forEach=function(e){p(this.inner,function(t,d){for(var n=0,r=d;n<r.length;n++){var o=r[n],i=o[0],a=o[1];e(i,a)}})},e.prototype.isEmpty=function(){return u(this.inner)},e}(),Qn=function(){return function(){this.listeners=[]}}(),Kn=function(){function e(e){this.syncEngine=e,this.queries=new jn(function(e){return e.canonicalId()}),this.onlineState=Bn.Unknown,this.syncEngine.subscribe(this.onChange.bind(this),this.onError.bind(this))}return e.prototype.listen=function(o){var t=o.query,e=!1,n=this.queries.get(t);return n||(e=!0,n=new Qn,this.queries.set(t,n)),n.listeners.push(o),o.onOnlineStateChanged(this.onlineState),n.viewSnap&&o.onViewSnapshot(n.viewSnap),e?this.syncEngine.listen(t).then(function(e){return n.targetId=e,e}):Promise.resolve(n.targetId)},e.prototype.unlisten=function(a){var t=a.query,e=!1,n=this.queries.get(t);if(n){var r=n.listeners.indexOf(a);0<=r&&(n.listeners.splice(r,1),e=0===n.listeners.length)}return e?(this.queries.delete(t),this.syncEngine.unlisten(t)):Promise.resolve()},e.prototype.onChange=function(d){for(var t=0,e=d;t<e.length;t++){var n=e[t],r=n.query,o=this.queries.get(r);if(o){for(var i=0,a=o.listeners;i<a.length;i++)a[i].onViewSnapshot(n);o.viewSnap=n}}},e.prototype.onError=function(a,t){var e=this.queries.get(a);if(e)for(var n=0,r=e.listeners,o;n<r.length;n++)o=r[n],o.onError(t);this.queries.delete(a)},e.prototype.onOnlineStateChanged=function(e){this.onlineState=e,this.queries.forEach(function(t,a){for(var n=0,r=a.listeners;n<r.length;n++)r[n].onOnlineStateChanged(e)})},e}(),Wn=function(){function n(o,r,e){this.query=o,this.queryObserver=r,this.raisedInitialEvent=!1,this.onlineState=Bn.Unknown,this.options=e||{}}return n.prototype.onViewSnapshot=function(a){if(Ho(0<a.docChanges.length||a.syncStateChanged,"We got a new snapshot with no changes?"),!this.options.includeDocumentMetadataChanges){for(var t=[],i=0,n=a.docChanges,r;i<n.length;i++)r=n[i],r.type!==Ln.Metadata&&t.push(r);a={query:a.query,docs:a.docs,oldDocs:a.oldDocs,docChanges:t,fromCache:a.fromCache,hasPendingWrites:a.hasPendingWrites,syncStateChanged:a.syncStateChanged}}this.raisedInitialEvent?this.shouldRaiseEvent(a)&&this.queryObserver.next(a):this.shouldRaiseInitialEvent(a,this.onlineState)&&this.raiseInitialEvent(a),this.snap=a},n.prototype.onError=function(e){this.queryObserver.error(e)},n.prototype.onOnlineStateChanged=function(e){this.onlineState=e,this.snap&&!this.raisedInitialEvent&&this.shouldRaiseInitialEvent(this.snap,e)&&this.raiseInitialEvent(this.snap)},n.prototype.shouldRaiseInitialEvent=function(o,t){if(Ho(!this.raisedInitialEvent,"Determining whether to raise first event but already had first event"),!o.fromCache)return!0;var e=t!==Bn.Failed;return this.options.waitForSyncWhenOnline&&e?(Ho(o.fromCache,"Waiting for sync, but snapshot is not from cache"),!1):!o.docs.isEmpty()||t===Bn.Failed},n.prototype.shouldRaiseEvent=function(n){if(0<n.docChanges.length)return!0;var t=this.snap&&this.snap.hasPendingWrites!==n.hasPendingWrites;return(n.syncStateChanged||t)&&!0===this.options.includeQueryMetadataChanges},n.prototype.raiseInitialEvent=function(t){Ho(!this.raisedInitialEvent,"Trying to raise initial events for second time"),t={query:t.query,docs:t.docs,oldDocs:qn.emptySet(t.docs),docChanges:n.getInitialViewChanges(t),fromCache:t.fromCache,hasPendingWrites:t.hasPendingWrites,syncStateChanged:!0},this.raisedInitialEvent=!0,this.queryObserver.next(t)},n.getInitialViewChanges=function(n){var o=[];return n.docs.forEach(function(e){o.push({type:Ln.Added,doc:e})}),o},n}(),Gn=function(){function a(n){var o=this;this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=null,this.isDone=!1,this.callbackAttached=!1,n(function(e){o.isDone=!0,o.result=e,o.nextCallback&&o.nextCallback(e)},function(e){o.isDone=!0,o.error=e,o.catchCallback&&o.catchCallback(e)})}return a.prototype.catch=function(e){return this.next(void 0,e)},a.prototype.next=function(i,s){var d=this;return this.callbackAttached&&Wo("Called next() or catch() twice for PersistencePromise"),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(s,this.error):this.wrapSuccess(i,this.result):new a(function(r,t){d.nextCallback=function(e){d.wrapSuccess(i,e).next(r,t)},d.catchCallback=function(n){d.wrapFailure(s,n).next(r,t)}})},a.prototype.toPromise=function(){var o=this;return new Promise(function(t,e){o.next(t,e)})},a.prototype.wrapUserFunction=function(t){try{var e=t();return e instanceof a?e:a.resolve(e)}catch(t){return a.reject(t)}},a.prototype.wrapSuccess=function(t,e){return t?this.wrapUserFunction(function(){return t(e)}):a.resolve(e)},a.prototype.wrapFailure=function(t,e){return t?this.wrapUserFunction(function(){return t(e)}):a.reject(e)},a.resolve=function(n){return new a(function(e){e(n)})},a.reject=function(o){return new a(function(e,t){t(o)})},a.waitFor=function(t){return t.reduce(function(n,t){return n.next(function(){return t})},a.resolve())},a.map=function(t){var i=[],n=!0,e=a.resolve(null);return t.reduce(function(o,r){return o.next(function(e){return n||i.push(e),n=!1,r})},e).next(function(e){return i.push(e),i})},a}(),Hn=function(){function e(){this.isEager=!0,this.sources=[],this.potentialGarbage=J()}return e.prototype.addGarbageSource=function(e){this.sources.push(e),e.setGarbageCollector(this)},e.prototype.removeGarbageSource=function(e){this.sources.splice(this.sources.indexOf(e),1),e.setGarbageCollector(null)},e.prototype.addPotentialGarbageKey=function(e){this.potentialGarbage=this.potentialGarbage.add(e)},e.prototype.collectGarbage=function(a){var t=this,e=[],n=J();return this.potentialGarbage.forEach(function(r){var o=t.documentHasAnyReferences(a,r);e.push(o.next(function(e){return e||(n=n.add(r)),Gn.resolve()}))}),this.potentialGarbage=J(),Gn.waitFor(e).next(function(){return n})},e.prototype.documentHasAnyReferences=function(o,t){var e=Gn.resolve(!1);return this.sources.map(function(e){return function(){return e.containsKey(o,t)}}).reduce(function(n,o){return n.next(function(e){return e?Gn.resolve(!0):o()})},e)},e}(),zn=function(){function s(o,r,e){this.query=o,this.addedKeys=r,this.removedKeys=e}return s.fromSnapshot=function(t){for(var e=J(),n=J(),r=0,o=t.docChanges,i;r<o.length;r++)switch(i=o[r],i.type){case Ln.Added:e=e.add(i.doc.key);break;case Ln.Removed:n=n.add(i.doc.key);}return new s(t.query,e,n)},s}(),Xn=function(){function e(){this.refsByKey=new en(Yn.compareByKey),this.refsByTarget=new en(Yn.compareByTargetId),this.garbageCollector=null}return e.prototype.isEmpty=function(){return this.refsByKey.isEmpty()},e.prototype.addReference=function(o,t){var e=new Yn(o,t);this.refsByKey=this.refsByKey.add(e),this.refsByTarget=this.refsByTarget.add(e)},e.prototype.addReferences=function(o,r){var e=this;o.forEach(function(n){return e.addReference(n,r)})},e.prototype.removeReference=function(n,t){this.removeRef(new Yn(n,t))},e.prototype.removeReferences=function(o,r){var e=this;o.forEach(function(n){return e.removeReference(n,r)})},e.prototype.removeReferencesForId=function(a){var i=this,e=ae.EMPTY,t=new Yn(e,a),n=new Yn(e,a+1);this.refsByTarget.forEachInRange([t,n],function(e){i.removeRef(e)})},e.prototype.removeAllReferences=function(){var n=this;this.refsByKey.forEach(function(t){return n.removeRef(t)})},e.prototype.removeRef=function(e){this.refsByKey=this.refsByKey.delete(e),this.refsByTarget=this.refsByTarget.delete(e),null!==this.garbageCollector&&this.garbageCollector.addPotentialGarbageKey(e.key)},e.prototype.referencesForId=function(a){var t=ae.EMPTY,e=new Yn(t,a),n=new Yn(t,a+1),r=J();return this.refsByTarget.forEachInRange([e,n],function(e){r=r.add(e.key)}),r},e.prototype.setGarbageCollector=function(e){this.garbageCollector=e},e.prototype.containsKey=function(o,t){var e=new Yn(t,0),n=this.refsByKey.firstAfterOrEqual(e);return Gn.resolve(null!==n&&t.equals(n.key))},e}(),Yn=function(){function e(n,o){this.key=n,this.targetOrBatchId=o}return e.compareByKey=function(n,t){return ae.comparator(n.key,t.key)||P(n.targetOrBatchId,t.targetOrBatchId)},e.compareByTargetId=function(n,t){return P(n.targetOrBatchId,t.targetOrBatchId)||ae.comparator(n.key,t.key)},e}(),Jn=1,$n;!function(e){e[e.LocalStore=0]="LocalStore",e[e.SyncEngine=1]="SyncEngine"}($n||($n={}));var Vn=function(){function n(o,a){void 0===a&&(a=0),this.generatorId=o;var e=a>>Jn<<Jn,n=a-e;this.previousId=n>=o?e|this.generatorId:(e|this.generatorId)-(1<<Jn)}return n.prototype.next=function(){return this.previousId+=1<<Jn,this.previousId},n.forLocalStore=function(t){return void 0===t&&(t=0),new n($n.LocalStore,t)},n.forSyncEngine=function(){return new n($n.SyncEngine)},n}(),Jo=function(){function e(e){this.key=e}return e}(),$o=function(){function e(e){this.key=e}return e}(),Zo=function(){function e(n,o){this.query=n,this.syncedDocuments=o,this.syncState=null,this.current=!1,this.limboDocuments=J(),this.mutatedKeys=J(),this.documentSet=new qn(n.docComparator.bind(n))}return e.prototype.computeDocChanges=function(d,t){var p=this,n=t?t.changeSet:new Fn,c=t?t.documentSet:this.documentSet,o=t?t.mutatedKeys:this.mutatedKeys,m=c,g=!1,y=this.query.hasLimit()&&c.size===this.query.limit?c.last():null;if(d.inorderTraversal(function(r,t){var e=c.get(r),a=t instanceof se?t:null;if(a&&(Ho(r.equals(a.key),"Mismatching keys found in document changes: "+r+" != "+a.key),a=p.query.matches(a)?a:null),a?(m=m.add(a),o=a.hasLocalMutations?o.add(r):o.delete(r)):(m=m.delete(r),o=o.delete(r)),e&&a){var i=e.data.equals(a.data);i&&e.hasLocalMutations===a.hasLocalMutations||(i?n.track({type:Ln.Metadata,doc:a}):n.track({type:Ln.Modified,doc:a}),y&&0<p.query.docComparator(a,y)&&(g=!0))}else!e&&a?n.track({type:Ln.Added,doc:a}):e&&!a&&(n.track({type:Ln.Removed,doc:e}),y&&(g=!0))}),this.query.hasLimit())for(;m.size>this.query.limit;){var l=m.last();m=m.delete(l.key),n.track({type:Ln.Removed,doc:l})}return Ho(!g||!t,"View was refilled using docs that themselves needed refilling."),{documentSet:m,changeSet:n,needsRefill:g,mutatedKeys:o}},e.prototype.applyChanges=function(d,t){var l=this;Ho(!d.needsRefill,"Cannot apply changes that need a refill");var e=this.documentSet;this.documentSet=d.documentSet,this.mutatedKeys=d.mutatedKeys;var n=d.changeSet.getChanges();n.sort(function(n,t){return ot(n.type,t.type)||l.query.docComparator(n.doc,t.doc)});var p=this.applyTargetChange(t),c=0===this.limboDocuments.size&&this.current,a=c?Un.Synced:Un.Local,s=a!==this.syncState;return this.syncState=a,0!==n.length||s?{snapshot:{query:this.query,docs:d.documentSet,oldDocs:e,docChanges:n,fromCache:a===Un.Local,syncStateChanged:s,hasPendingWrites:!d.mutatedKeys.isEmpty()},limboChanges:p}:{limboChanges:p}},e.prototype.shouldBeInLimbo=function(e){return!this.syncedDocuments.has(e)&&!!this.documentSet.has(e)&&!this.documentSet.get(e).hasLocalMutations},e.prototype.applyTargetChange=function(a){var i=this;if(a){var e=a.mapping;switch(e instanceof vn?this.syncedDocuments=e.documents:e instanceof bn&&(this.syncedDocuments=e.applyToKeySet(this.syncedDocuments)),a.currentStatusUpdate){case mn.MarkCurrent:this.current=!0;break;case mn.MarkNotCurrent:this.current=!1;break;case mn.None:break;default:Wo("Unknown current status update: "+a.currentStatusUpdate);}}var n=this.limboDocuments;this.limboDocuments=J(),this.current&&this.documentSet.forEach(function(e){i.shouldBeInLimbo(e.key)&&(i.limboDocuments=i.limboDocuments.add(e.key))});var r=[];return n.forEach(function(e){i.limboDocuments.has(e)||r.push(new $o(e))}),this.limboDocuments.forEach(function(e){n.has(e)||r.push(new Jo(e))}),r},e}(),er=function(){function e(o,a,e,n){this.query=o,this.targetId=a,this.resumeToken=e,this.view=n}return e}(),tr=function(){function e(o,r,e){this.localStore=o,this.remoteStore=r,this.currentUser=e,this.viewHandler=null,this.errorHandler=null,this.queryViewsByQuery=new jn(function(e){return e.canonicalId()}),this.queryViewsByTarget={},this.limboTargetsByKey=new ce(ae.comparator),this.limboKeysByTarget={},this.limboDocumentRefs=new Xn,this.limboCollector=new Hn,this.mutationUserCallbacks={},this.targetIdGenerator=Vn.forSyncEngine()}return e.prototype.subscribe=function(n,t){Ho(null!==n&&null!==t,"View and error handlers cannot be null"),Ho(null===this.viewHandler&&null===this.errorHandler,"SyncEngine already has a subscriber."),this.viewHandler=n,this.errorHandler=t,this.limboCollector.addGarbageSource(this.limboDocumentRefs)},e.prototype.listen=function(d){var t=this;return this.assertSubscribed("listen()"),Ho(!this.queryViewsByQuery.has(d),"We already listen to the query: "+d),this.localStore.allocateQuery(d).then(function(e){return t.localStore.executeQuery(d).then(function(n){return t.localStore.remoteDocumentKeys(e.targetId).then(function(r){var o=new Zo(d,r),i=o.computeDocChanges(n),a=o.applyChanges(i);Ho(0===a.limboChanges.length,"View returned limbo docs before target ack from the server."),Ho(!!a.snapshot,"applyChanges for new view should always return a snapshot");var s=new er(d,e.targetId,e.resumeToken,o);t.queryViewsByQuery.set(d,s),t.queryViewsByTarget[e.targetId]=s,t.viewHandler([a.snapshot]),t.remoteStore.listen(e)})}).then(function(){return e.targetId})})},e.prototype.unlisten=function(o){var t=this;this.assertSubscribed("unlisten()");var e=this.queryViewsByQuery.get(o);return Ho(!!e,"Trying to unlisten on query not found:"+o),this.localStore.releaseQuery(o).then(function(){return t.remoteStore.unlisten(e.targetId),t.removeAndCleanupQuery(e).then(function(){return t.localStore.collectGarbage()})})},e.prototype.write=function(o,r){var e=this;return this.assertSubscribed("write()"),this.localStore.localWrite(o).then(function(n){return e.addMutationCallback(n.batchId,r),e.emitNewSnapsAndNotifyLocalStore(n.changes)}).then(function(){return e.remoteStore.fillWritePipeline()})},e.prototype.wrapUpdateFunctionError=function(e){return e},e.prototype.runTransaction=function(o,t){var e=this;void 0===t&&(t=5),Ho(0<=t,"Got negative number of retries for transaction.");var n=this.remoteStore.createTransaction();return function(){try{var t=o(n);return!V(t)&&t.catch&&t.then?t.catch(function(n){return Promise.reject(e.wrapUpdateFunctionError(n))}):Promise.reject(Error("Transaction callback must return a Promise"))}catch(n){return Promise.reject(e.wrapUpdateFunctionError(n))}}().then(function(r){return n.commit().then(function(){return r}).catch(function(n){return 0===t?Promise.reject(n):e.runTransaction(o,t-1)})})},e.prototype.applyRemoteEvent=function(a){var t=this;return this.assertSubscribed("applyRemoteEvent()"),d(a.targetChanges,function(e,n){var r=t.limboKeysByTarget[e];r&&n.currentStatusUpdate===mn.MarkCurrent&&!a.documentUpdates.get(r)&&a.addDocumentUpdate(new ue(r,a.snapshotVersion))}),this.localStore.applyRemoteEvent(a).then(function(e){return t.emitNewSnapsAndNotifyLocalStore(e,a)})},e.prototype.rejectListen=function(s,t){var e=this;this.assertSubscribed("rejectListens()");var n=this.limboKeysByTarget[s];if(n){this.limboTargetsByKey=this.limboTargetsByKey.remove(n),delete this.limboKeysByTarget[s];var r=new ce(ae.comparator);r=r.insert(n,new ue(n,Ge.forDeletedDoc()));var o=new yn(Ge.MIN,{},r);return this.applyRemoteEvent(o)}var i=this.queryViewsByTarget[s];return Ho(!!i,"Unknown targetId: "+s),this.localStore.releaseQuery(i.query).then(function(){return e.removeAndCleanupQuery(i).then(function(){e.errorHandler(i.query,t)})})},e.prototype.applySuccessfulWrite=function(n){var o=this;return this.assertSubscribed("applySuccessfulWrite()"),this.processUserCallback(n.batch.batchId,null),this.localStore.acknowledgeBatch(n).then(function(e){return o.emitNewSnapsAndNotifyLocalStore(e)})},e.prototype.rejectFailedWrite=function(o,t){var e=this;return this.assertSubscribed("rejectFailedWrite()"),this.processUserCallback(o,t),this.localStore.rejectBatch(o).then(function(n){return e.emitNewSnapsAndNotifyLocalStore(n)})},e.prototype.addMutationCallback=function(o,t){var e=this.mutationUserCallbacks[this.currentUser.toKey()];e||(e=new ce(P)),e=e.insert(o,t),this.mutationUserCallbacks[this.currentUser.toKey()]=e},e.prototype.processUserCallback=function(o,t){var e=this.mutationUserCallbacks[this.currentUser.toKey()];if(e){var n=e.get(o);n&&(Ho(o===e.minKey(),"Mutation callbacks processed out-of-order?"),t?n.reject(t):n.resolve(),e=e.remove(o)),this.mutationUserCallbacks[this.currentUser.toKey()]=e}},e.prototype.removeAndCleanupQuery=function(e){return this.queryViewsByQuery.delete(e.query),delete this.queryViewsByTarget[e.targetId],this.limboDocumentRefs.removeReferencesForId(e.targetId),this.gcLimboDocuments()},e.prototype.updateTrackedLimbos=function(a,t){for(var e=0,n=t,r;e<n.length;e++)r=n[e],r instanceof Jo?(this.limboDocumentRefs.addReference(r.key,a),this.trackLimboChange(r)):r instanceof $o?(So("SyncEngine","Document no longer in limbo: "+r.key),this.limboDocumentRefs.removeReference(r.key,a)):Wo("Unknown limbo change: "+JSON.stringify(r));return this.gcLimboDocuments()},e.prototype.trackLimboChange=function(o){var t=o.key;if(!this.limboTargetsByKey.get(t)){So("SyncEngine","New document in limbo: "+t);var e=this.targetIdGenerator.next(),n=Pe.atPath(t.path);this.limboKeysByTarget[e]=t,this.remoteStore.listen(new me(n,e,He.Listen)),this.limboTargetsByKey=this.limboTargetsByKey.insert(t,e)}},e.prototype.gcLimboDocuments=function(){var o=this;return this.limboCollector.collectGarbage(null).next(function(t){t.forEach(function(t){var e=o.limboTargetsByKey.get(t);null!==e&&(o.remoteStore.unlisten(e),o.limboTargetsByKey=o.limboTargetsByKey.remove(t),delete o.limboKeysByTarget[e])})}).toPromise()},e.prototype.currentLimboDocs=function(){return this.limboTargetsByKey},e.prototype.emitNewSnapsAndNotifyLocalStore=function(a,d){var l=this,e=[],n=[],t=[];return this.queryViewsByQuery.forEach(function(o,r){t.push(Promise.resolve().then(function(){var n=r.view.computeDocChanges(a);return n.needsRefill?l.localStore.executeQuery(r.query).then(function(e){return r.view.computeDocChanges(e,n)}):n}).then(function(o){var t=d&&d.targetChanges[r.targetId],i=r.view.applyChanges(o,t);return l.updateTrackedLimbos(r.targetId,i.limboChanges).then(function(){if(i.snapshot){e.push(i.snapshot);var o=zn.fromSnapshot(i.snapshot);n.push(o)}})}))}),Promise.all(t).then(function(){return l.viewHandler(e),l.localStore.notifyLocalViewChanges(n)}).then(function(){return l.localStore.collectGarbage()})},e.prototype.assertSubscribed=function(e){Ho(null!==this.viewHandler&&null!==this.errorHandler,"Trying to call "+e+" before calling subscribe().")},e.prototype.handleUserChange=function(n){var o=this;return this.currentUser=n,this.localStore.handleUserChange(n).then(function(e){return o.emitNewSnapsAndNotifyLocalStore(e)}).then(function(){return o.remoteStore.handleUserChange(n)})},e}(),nr=-1,or=function(){function e(o,r,e){this.batchId=o,this.localWriteTime=r,this.mutations=e}return e.prototype.applyToRemoteDocument=function(s,t,e){t&&Ho(t.key.equals(s),"applyToRemoteDocument: key "+s+" should match maybeDoc key\n "+t.key);var n=e.mutationResults;Ho(n.length===this.mutations.length,"Mismatch between mutations length\n ("+this.mutations.length+") and mutation results length\n ("+n.length+").");for(var r=0,o;r<this.mutations.length;r++)if(o=this.mutations[r],o.key.equals(s)){var i=n[r];t=o.applyToRemoteDocument(t,i)}return t},e.prototype.applyToLocalView=function(o,t){t&&Ho(t.key.equals(o),"applyToLocalDocument: key "+o+" should match maybeDoc key\n "+t.key);for(var e=0,n;e<this.mutations.length;e++)n=this.mutations[e],n.key.equals(o)&&(t=n.applyToLocalView(t,this.localWriteTime));return t},e.prototype.keys=function(){for(var o=J(),t=0,e=this.mutations,n;t<e.length;t++)n=e[t],o=o.add(n.key);return o},e.prototype.equals=function(e){return this.batchId===e.batchId&&x(this.mutations,e.mutations)},e.prototype.isTombstone=function(){return 0===this.mutations.length},e.prototype.toTombstone=function(){return new e(this.batchId,this.localWriteTime,[])},e}(),rr=function(){function d(a,i,e,n,r){this.batch=a,this.commitVersion=i,this.mutationResults=e,this.streamToken=n,this.docVersions=r}return d.from=function(t,e,n,r){Ho(t.mutations.length===n.length,"Mutations sent "+t.mutations.length+" must equal results received "+n.length);for(var o=Y(),i=t.mutations,a=0,s;a<i.length;a++)s=n[a].version,null===s&&(s=e),o=o.insert(i[a].key,s);return new d(t,e,n,r,o)},d}(),ar="\x01",ir="\x01",sr="\x10",lr="\x11",cr=function(){function e(n,o){this.seconds=n,this.nanos=o}return e}(),dr=function(){function e(n,o){this.ownerId=n,this.leaseTimestampMs=o}return e.store="owner",e}(),pr=function(){function e(o,r,e){this.userId=o,this.lastAcknowledgedBatchId=r,this.lastStreamToken=e}return e.store="mutationQueues",e.keyPath="userId",e}(),ur=function(){function e(o,a,e,n){this.userId=o,this.batchId=a,this.localWriteTimeMs=e,this.mutations=n}return e.store="mutations",e.keyPath=["userId","batchId"],e}(),hr=function(){function e(){}return e.prefixForUser=function(e){return[e]},e.prefixForPath=function(n,t){return[n,rt(t)]},e.key=function(o,t,e){return[o,rt(t),e]},e.store="documentMutations",e.PLACEHOLDER=new e,e}(),mr=function(){function e(n,o){this.path=n,this.readTime=o}return e}(),gr=function(){function e(n,o){this.noDocument=n,this.document=o}return e.store="remoteDocuments",e}(),fr=function(){function e(a,s,e,n,r,o){this.targetId=a,this.canonicalId=s,this.readTime=e,this.resumeToken=n,this.lastListenSequenceNumber=r,this.query=o}return e.store="targets",e.keyPath="targetId",e.queryTargetsIndexName="queryTargetsIndex",e.queryTargetsKeyPath=["canonicalId","targetId"],e}(),yr=function(){function e(n,o){this.targetId=n,this.path=o}return e.store="targetDocuments",e.keyPath=["targetId","path"],e.documentTargetsIndex="documentTargetsIndex",e.documentTargetsKeyPath=["path","targetId"],e}(),br=function(){function e(o,r,e){this.highestTargetId=o,this.highestListenSequenceNumber=r,this.lastRemoteSnapshotVersion=e}return e.key="targetGlobalKey",e.store="targetGlobal",e}(),vr=[pr.store,ur.store,hr.store,gr.store,fr.store,dr.store,br.store,yr.store],Er=function(){function a(e){this.db=e}return a.openOrCreate=function(i,e,o){return Ho(a.isAvailable(),"IndexedDB not supported in current environment."),So("SimpleDb","Opening database:",i),new Gn(function(t,n){var r=window.indexedDB.open(i,e);r.onsuccess=function(o){var e=o.target.result;t(new a(e))},r.onerror=function(e){n(e.target.error)},r.onupgradeneeded=function(e){So("SimpleDb","Database \""+i+"\" requires upgrade from version:",e.oldVersion);var t=e.target.result;o(t,e.oldVersion)}}).toPromise()},a.delete=function(e){return So("SimpleDb","Removing database:",e),ct(window.indexedDB.deleteDatabase(e)).toPromise()},a.isAvailable=function(){if("undefined"==typeof window||null==window.indexedDB)return!1;var e=window.navigator.userAgent;return!(0<e.indexOf("MSIE ")||0<e.indexOf("Trident/")||0<e.indexOf("Edge/"))},a.prototype.runTransaction=function(a,t,e){var n=new Cr(this.db,a,t),r=e(n).catch(function(e){return n.abort(),Gn.reject(e)}).toPromise();return n.completionPromise.then(function(){return r})},a.prototype.close=function(){this.db.close()},a}(),Sr=function(){function e(e){this.dbCursor=e,this.shouldStop=!1,this.nextKey=null}return Object.defineProperty(e.prototype,"isDone",{get:function(){return this.shouldStop},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"skipToKey",{get:function(){return this.nextKey},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cursor",{set:function(e){this.dbCursor=e},enumerable:!0,configurable:!0}),e.prototype.done=function(){this.shouldStop=!0},e.prototype.skip=function(e){this.nextKey=e},e.prototype.delete=function(){return ct(this.dbCursor.delete())},e}(),Cr=function(){function e(o,a,e){var n=this;this.aborted=!1,this.transaction=o.transaction(e,a),this.completionPromise=new Promise(function(o,r){n.transaction.onabort=n.transaction.oncomplete=function(){o()},n.transaction.onerror=function(e){r(e.target.error)}})}return e.prototype.abort=function(){this.aborted||(So("SimpleDb","Aborting transaction."),this.aborted=!0,this.transaction.abort())},e.prototype.store=function(n){var t=this.transaction.objectStore(n);return Ho(!!t,"Object store not part of transaction: "+n),new Tr(t)},e}(),Tr=function(){function e(e){this.store=e}return e.prototype.put=function(o,t){var e;return void 0===t?(So("SimpleDb","PUT",this.store.name,"<auto-key>",o),e=this.store.put(o)):(So("SimpleDb","PUT",this.store.name,o,t),e=this.store.put(t,o)),ct(e)},e.prototype.get=function(o){var t=this;return ct(this.store.get(o)).next(function(e){return void 0===e&&(e=null),So("SimpleDb","GET",t.store.name,o,e),e})},e.prototype.delete=function(e){return So("SimpleDb","DELETE",this.store.name,e),ct(this.store.delete(e))},e.prototype.loadAll=function(o,t){var e=this.cursor(this.options(o,t)),n=[];return this.iterateCursor(e,function(o,t){n.push(t)}).next(function(){return n})},e.prototype.deleteAll=function(o,t){So("SimpleDb","DELETE ALL",this.store.name);var e=this.options(o,t);e.keysOnly=!1;var n=this.cursor(e);return this.iterateCursor(n,function(o,t,e){return e.delete()})},e.prototype.iterate=function(o,t){var e;t?e=o:(e={},t=o);var n=this.cursor(e);return this.iterateCursor(n,t)},e.prototype.iterateCursor=function(a,s){var e=[];return new Gn(function(n,r){a.onerror=function(e){r(e.target.error)},a.onsuccess=function(r){var t=r.target.result;if(!t)return void n();var d=new Sr(t),i=s(t.primaryKey,t.value,d);i instanceof Gn&&e.push(i),d.isDone?n():null===d.skipToKey?t.continue():t.continue(d.skipToKey)}}).next(function(){return Gn.waitFor(e)})},e.prototype.options=function(o,r){var a;return void 0!==o&&("string"==typeof o?a=o:(Ho(void 0===r,"3rd argument must not be defined if 2nd is a range."),r=o)),{index:a,range:r}},e.prototype.cursor=function(o){var t="next";if(o.reverse&&(t="prev"),o.index){var e=this.store.index(o.index);return o.keysOnly?e.openKeyCursor(o.range,t):e.openCursor(o.range,t)}return this.store.openCursor(o.range,t)},e}(),kr=function(){function o(n,o){this.userId=n,this.serializer=o,this.garbageCollector=null}return o.forUser=function(t,e){return Ho(""!==t.uid,"UserID must not be an empty string."),new o(t.isUnauthenticated()?"":t.uid,e)},o.prototype.start=function(r){var e=this;return o.loadNextBatchIdFromDb(r).next(function(n){return e.nextBatchId=n,ht(r).get(e.userId)}).next(function(n){return n||(n=new pr(e.userId,nr,"")),e.metadata=n,e.metadata.lastAcknowledgedBatchId>=e.nextBatchId?e.checkEmpty(r).next(function(n){return Ho(n,"Reset nextBatchID is only possible when the queue is empty"),e.metadata.lastAcknowledgedBatchId=nr,ht(r).put(e.metadata)}):Gn.resolve()})},o.loadNextBatchIdFromDb=function(n){var a=nr;return pt(n).iterate({reverse:!0},function(e,t,n){var r=e[0];if(e[1]>a&&(a=t.batchId),""===r)n.done();else{var o=_(r);n.skip([o])}}).next(function(){return a+1})},o.prototype.checkEmpty=function(o){var a=!0,e=IDBKeyRange.bound(this.keyForBatchId(Number.NEGATIVE_INFINITY),this.keyForBatchId(Number.POSITIVE_INFINITY));return pt(o).iterate({range:e},function(e,t,n){a=!1,n.done()}).next(function(){return a})},o.prototype.getNextBatchId=function(){return Gn.resolve(this.nextBatchId)},o.prototype.getHighestAcknowledgedBatchId=function(){return Gn.resolve(this.metadata.lastAcknowledgedBatchId)},o.prototype.acknowledgeBatch=function(o,t,e){var n=t.batchId;return Ho(n>this.metadata.lastAcknowledgedBatchId,"Mutation batchIDs must be acknowledged in order"),this.metadata.lastAcknowledgedBatchId=n,this.metadata.lastStreamToken=dt(e),ht(o).put(this.metadata)},o.prototype.getLastStreamToken=function(){return Gn.resolve(this.metadata.lastStreamToken)},o.prototype.setLastStreamToken=function(n,t){return this.metadata.lastStreamToken=dt(t),ht(n).put(this.metadata)},o.prototype.addMutationBatch=function(d,t,e){var n=this,r=this.nextBatchId;this.nextBatchId++;var o=new or(r,t,e),i=this.serializer.toDbMutationBatch(this.userId,o);return pt(d).put(i).next(function(){for(var t=[],o=0,i=e;o<i.length;o++){var a=i[o],s=(rt(a.key.path),hr.key(n.userId,a.key.path,r));ut(d).put(s,hr.PLACEHOLDER)}return Gn.waitFor(t)}).next(function(){return o})},o.prototype.lookupMutationBatch=function(o,t){var e=this;return pt(o).get(this.keyForBatchId(t)).next(function(n){return n?e.serializer.fromDbMutationBatch(n):null})},o.prototype.getNextMutationBatchAfterBatchId=function(a,s){var e=this,t=IDBKeyRange.lowerBound(this.keyForBatchId(s+1)),n=null;return pt(a).iterate({range:t},function(o,t,r){t.userId===e.userId&&(Ho(t.batchId>s,"Should have found mutation after "+s),n=e.serializer.fromDbMutationBatch(t)),r.done()}).next(function(){return n})},o.prototype.getAllMutationBatches=function(o){var r=this,e=IDBKeyRange.bound(this.keyForBatchId(nr),this.keyForBatchId(Number.POSITIVE_INFINITY));return pt(o).loadAll(e).next(function(e){return e.map(function(e){return r.serializer.fromDbMutationBatch(e)})})},o.prototype.getAllMutationBatchesThroughBatchId=function(o,t){var e=this,n=IDBKeyRange.bound(this.keyForBatchId(nr),this.keyForBatchId(t));return pt(o).loadAll(n).next(function(n){return n.map(function(n){return e.serializer.fromDbMutationBatch(n)})})},o.prototype.getAllMutationBatchesAffectingDocumentKey=function(d,t){var e=this,n=hr.prefixForPath(this.userId,t.path),r=IDBKeyRange.lowerBound(n),a=[];return ut(d).iterate({range:r},function(n,r,o){var i=n[0],s=n[1],p=n[2],c=st(s);if(i!==e.userId||!t.path.equals(c))return void o.done();var l=e.keyForBatchId(p);return pt(d).get(l).next(function(o){null===o&&Wo("Dangling document-mutation reference found: "+n+" which points to "+l),a.push(e.serializer.fromDbMutationBatch(o))})}).next(function(){return a})},o.prototype.getAllMutationBatchesAffectingQuery=function(d,t){var l=this;Ho(!t.isDocumentQuery(),"Document queries shouldn't go down this path");var n=t.path,r=n.length+1,e=hr.prefixForPath(this.userId,n),o=(e[1],IDBKeyRange.lowerBound(e)),p=new en(P);return ut(d).iterate({range:o},function(o,t,e){var i=o[0],a=o[1],s=o[2],d=st(a);return i===l.userId&&n.isPrefixOf(d)?void(d.length===r&&(p=p.add(s))):void e.done()}).next(function(){var n=[],e=[];return p.forEach(function(t){var o=l.keyForBatchId(t);e.push(pt(d).get(o).next(function(e){null===e&&Wo("Dangling document-mutation reference found, which points to "+o),n.push(l.serializer.fromDbMutationBatch(e))}))}),Gn.waitFor(e).next(function(){return n})})},o.prototype.removeMutationBatches=function(d,t){for(var p=pt(d),e=ut(d),n=[],o=this,r=0,a=t,i;r<a.length;r++)i=a[r],!function(r){var t=IDBKeyRange.only(o.keyForBatchId(r.batchId)),i=0,a=p.iterate({range:t},function(o,t,e){return i++,e.delete()});n.push(a.next(function(){Ho(1==i,"Dangling document-mutation reference found: Missing batch "+r.batchId)}));for(var s=0,d=r.mutations;s<d.length;s++){var c=d[s],l=hr.key(o.userId,c.key.path,r.batchId);n.push(e.delete(l)),null!==o.garbageCollector&&o.garbageCollector.addPotentialGarbageKey(c.key)}}(i);return Gn.waitFor(n)},o.prototype.performConsistencyCheck=function(a){var s=this;return this.checkEmpty(a).next(function(e){if(!e)return Gn.resolve();var t=IDBKeyRange.lowerBound(hr.prefixForUser(s.userId)),d=[];return ut(a).iterate({range:t},function(e,t,n){if(e[0]!==s.userId)return void n.done();var o=st(e[1]);d.push(o)}).next(function(){Ho(0===d.length,"Document leak -- detected dangling mutation references when queue is empty. Dangling keys: "+d.map(function(e){return e.canonicalString()}))})})},o.prototype.setGarbageCollector=function(e){this.garbageCollector=e},o.prototype.containsKey=function(s,t){var d=this,e=hr.prefixForPath(this.userId,t.path),n=e[1],o=IDBKeyRange.lowerBound(e),l=!1;return ut(s).iterate({range:o,keysOnly:!0},function(o,t,e){var r=o[0],a=o[1];o[2],r===d.userId&&a===n&&(l=!0),e.done()}).next(function(){return l})},o.prototype.keyForBatchId=function(e){return[this.userId,e]},o}(),wr=function(){function e(e){this.serializer=e,this.lastRemoteSnapshotVersion=Ge.MIN,this.metadata=new br(0,0,Ge.MIN.toTimestamp()),this.garbageCollector=null}return e.prototype.start=function(n){var o=this;return ft(n).get(br.key).next(function(e){if(null!==e){o.metadata=e;var t=e.lastRemoteSnapshotVersion;o.lastRemoteSnapshotVersion=Ge.fromTimestamp(new We(t.seconds,t.nanos))}return Gn.resolve()})},e.prototype.getHighestTargetId=function(){return this.metadata.highestTargetId},e.prototype.getLastRemoteSnapshotVersion=function(){return this.lastRemoteSnapshotVersion},e.prototype.setLastRemoteSnapshotVersion=function(n,t){return this.lastRemoteSnapshotVersion=t,this.metadata.lastRemoteSnapshotVersion=t.toTimestamp(),ft(n).put(br.key,this.metadata)},e.prototype.addQueryData=function(a,t){var e=this,n=t.targetId,r=gt(a).put(this.serializer.toDbTarget(t));return n>this.metadata.highestTargetId?(this.metadata.highestTargetId=n,r.next(function(){return ft(a).put(br.key,e.metadata)})):r},e.prototype.removeQueryData=function(n,t){return this.removeMatchingKeysForTargetId(n,t.targetId).next(function(){gt(n).delete(t.targetId)})},e.prototype.getQueryData=function(a,s){var e=this,t=s.canonicalId(),n=IDBKeyRange.bound([t,Number.NEGATIVE_INFINITY],[t,Ft]),d=null;return gt(a).iterate({range:n,index:fr.queryTargetsIndexName},function(n,t,r){var o=e.serializer.fromDbTarget(t);s.equals(o.query)&&(d=o,r.done())}).next(function(){return d})},e.prototype.addMatchingKeys=function(a,t,i){var n=[],r=yt(a);return t.forEach(function(o){var t=rt(o.path);n.push(r.put(new yr(i,t)))}),Gn.waitFor(n)},e.prototype.removeMatchingKeys=function(a,t,s){var n=this,r=[],o=yt(a);return t.forEach(function(a){var t=rt(a.path);r.push(o.delete([s,t])),null!==n.garbageCollector&&n.garbageCollector.addPotentialGarbageKey(a)}),Gn.waitFor(r)},e.prototype.removeMatchingKeysForTargetId=function(o,t){var e=yt(o),n=IDBKeyRange.bound([t],[t+1],!1,!0);return this.notifyGCForRemovedKeys(o,n).next(function(){return e.delete(n)})},e.prototype.notifyGCForRemovedKeys=function(o,t){var a=this,n=yt(o);return null!==this.garbageCollector&&this.garbageCollector.isEager?n.iterate({range:t,keysOnly:!0},function(e){var t=st(e[1]),n=new ae(t);Ho(null!==a.garbageCollector,"GarbageCollector for query cache set to null during key removal."),a.garbageCollector.addPotentialGarbageKey(n)}):Gn.resolve()},e.prototype.getMatchingKeysForTargetId=function(a,t){var e=IDBKeyRange.bound([t],[t+1],!1,!0),i=yt(a),s=J();return i.iterate({range:e,keysOnly:!0},function(e){var t=st(e[1]),n=new ae(t);s=s.add(n)}).next(function(){return s})},e.prototype.setGarbageCollector=function(e){this.garbageCollector=e},e.prototype.containsKey=function(a,t){Ho(null!==a,"Persistence Transaction cannot be null for query cache containsKey");var e=rt(t.path),n=IDBKeyRange.bound([e],[D(e)],!1,!0),i=0;return yt(a).iterate({index:yr.documentTargetsIndex,keysOnly:!0,range:n},function(o,t,e){i++,e.done()}).next(function(){return 0<i})},e}(),Ir=function(){function e(e){this.serializer=e}return e.prototype.addEntry=function(n,t){return vt(n).put(Et(t.key),this.serializer.toDbRemoteDocument(t))},e.prototype.removeEntry=function(n,t){return vt(n).delete(Et(t))},e.prototype.getEntry=function(o,t){var e=this;return vt(o).get(Et(t)).next(function(n){return n?e.serializer.fromDbRemoteDocument(n):null})},e.prototype.getDocumentsMatchingQuery=function(a,s){var e=this,n=Q(),t=s.path.toArray(),o=IDBKeyRange.lowerBound(t);return vt(a).iterate({range:o},function(r,t,o){var i=e.serializer.fromDbRemoteDocument(t);s.path.isPrefixOf(i.key.path)?i instanceof se&&s.matches(i)&&(n=n.insert(i.key,i)):o.done()}).next(function(){return n})},e}(),Nr=function(){function e(e){this.remoteSerializer=e}return e.prototype.fromDbRemoteDocument=function(o){if(o.document)return this.remoteSerializer.fromDocument(o.document);if(o.noDocument){var t=ae.fromSegments(o.noDocument.path),e=o.noDocument.readTime,n=new We(e.seconds,e.nanos);return new ue(t,Ge.fromTimestamp(n))}return Wo("Unexpected DbRemoteDocument")},e.prototype.toDbRemoteDocument=function(a){if(a instanceof se){var t=this.remoteSerializer.toDocument(a);return new gr(null,t)}var e=a.key.path.toArray(),n=a.version.toTimestamp(),r=new cr(n.seconds,n.nanos);return new gr(new mr(e,r),null)},e.prototype.toDbMutationBatch=function(o,t){var e=this,n=t.mutations.map(function(n){return e.remoteSerializer.toMutation(n)});return new ur(o,t.batchId,t.localWriteTime.toEpochMilliseconds(),n)},e.prototype.fromDbMutationBatch=function(o){var a=this,e=o.mutations.map(function(e){return a.remoteSerializer.fromMutation(e)}),t=We.fromEpochMilliseconds(o.localWriteTimeMs);return new or(o.batchId,t,e)},e.prototype.fromDbTarget=function(o){var t=new We(o.readTime.seconds,o.readTime.nanos),n=Ge.fromTimestamp(t),r;return r=St(o.query)?this.remoteSerializer.fromDocumentsTarget(o.query):this.remoteSerializer.fromQueryTarget(o.query),new me(r,o.targetId,He.Listen,n,o.resumeToken)},e.prototype.toDbTarget=function(a){Ho(He.Listen===a.purpose,"Only queries with purpose "+He.Listen+" may be stored, got "+a.purpose);var t=a.snapshotVersion.toTimestamp(),n=new cr(t.seconds,t.nanos),r;r=a.query.isDocumentQuery()?this.remoteSerializer.toDocumentsTarget(a.query):this.remoteSerializer.toQueryTarget(a.query),Ho("string"==typeof a.resumeToken,"Persisting non-string resume token not supported.");var e=a.resumeToken;return new fr(a.targetId,a.query.canonicalId(),n,e,0,r)},e}(),Ar="There is another tab open with offline persistence enabled. Only one such tab is allowed at a time. The other tab must be closed or persistence must be disabled.",Rr=function(){function r(t,e){this.ownerId=this.generateOwnerId(),this.dbName=t+r.MAIN_DATABASE,this.serializer=new Nr(e),this.localStoragePrefix=t}return r.prototype.start=function(){var n=this;return r.isAvailable()?(Ho(!this.started,"IndexedDbPersistence double-started!"),this.started=!0,Er.openOrCreate(this.dbName,1,lt).then(function(e){n.simpleDb=e}).then(function(){return n.tryAcquireOwnerLease()}).then(function(){n.scheduleOwnerLeaseRefreshes(),n.attachWindowUnloadHook()})):(this.persistenceError=new Ht(Gt.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled."),Promise.reject(this.persistenceError))},r.prototype.shutdown=function(){var e=this;return Ho(this.started,"IndexedDbPersistence shutdown without start!"),this.started=!1,this.detachWindowUnloadHook(),this.stopOwnerLeaseRefreshes(),this.releaseOwnerLease().then(function(){e.simpleDb.close()})},r.prototype.getMutationQueue=function(e){return kr.forUser(e,this.serializer)},r.prototype.getQueryCache=function(){return new wr(this.serializer)},r.prototype.getRemoteDocumentCache=function(){return new Ir(this.serializer)},r.prototype.runTransaction=function(o,r){var e=this;return this.persistenceError?Promise.reject(this.persistenceError):(So("IndexedDbPersistence","Starting transaction:",o),this.simpleDb.runTransaction("readwrite",vr,function(n){return e.ensureOwnerLease(n).next(function(){return r(n)})}))},r.isAvailable=function(){return Er.isAvailable()},r.buildStoragePrefix=function(n){var t=n.databaseId.projectId;return n.databaseId.isDefaultDatabase||(t+="."+n.databaseId.database),"firestore/"+n.persistenceKey+"/"+t+"/"},r.prototype.tryAcquireOwnerLease=function(){var o=this;return this.simpleDb.runTransaction("readwrite",[dr.store],function(t){var a=t.store(dr.store);return a.get("owner").next(function(t){if(o.validOwner(t))return So("IndexedDbPersistence","Valid owner already. Failing. Current owner:",t),o.persistenceError=new Ht(Gt.FAILED_PRECONDITION,Ar),Gn.reject(o.persistenceError);var e=new dr(o.ownerId,Date.now());return So("IndexedDbPersistence","No valid owner. Acquiring owner lease. Current owner:",t,"New owner:",e),a.put("owner",e)})})},r.prototype.releaseOwnerLease=function(){var o=this;return this.simpleDb.runTransaction("readwrite",[dr.store],function(t){var r=t.store(dr.store);return r.get("owner").next(function(t){return null!==t&&t.ownerId===o.ownerId?(So("IndexedDbPersistence","Releasing owner lease."),r.delete("owner")):Gn.resolve()})})},r.prototype.ensureOwnerLease=function(n){var o=this;return n.store(dr.store).get("owner").next(function(e){return null===e||e.ownerId!==o.ownerId?(o.persistenceError=new Ht(Gt.FAILED_PRECONDITION,Ar),Gn.reject(o.persistenceError)):Gn.resolve()})},r.prototype.validOwner=function(n){var t=Date.now();return!(null===n||n.leaseTimestampMs<t-5e3||(n.leaseTimestampMs>t?(o("Persistence owner-lease is in the future. Discarding.",n),1):n.ownerId===this.getZombiedOwnerId()))},r.prototype.scheduleOwnerLeaseRefreshes=function(){var n=this;this.ownerLeaseRefreshHandle=setInterval(function(){n.runTransaction("Refresh owner timestamp",function(t){return t.store(dr.store).put("owner",new dr(n.ownerId,Date.now()))}).catch(function(t){o(t),n.stopOwnerLeaseRefreshes()})},4e3)},r.prototype.stopOwnerLeaseRefreshes=function(){this.ownerLeaseRefreshHandle&&(clearInterval(this.ownerLeaseRefreshHandle),this.ownerLeaseRefreshHandle=null)},r.prototype.attachWindowUnloadHook=function(){var e=this;this.windowUnloadHandler=function(){e.setZombiedOwnerId(e.ownerId),e.shutdown()},window.addEventListener("unload",this.windowUnloadHandler)},r.prototype.detachWindowUnloadHook=function(){this.windowUnloadHandler&&(window.removeEventListener("unload",this.windowUnloadHandler),this.windowUnloadHandler=null)},r.prototype.getZombiedOwnerId=function(){try{var e=window.localStorage.getItem(this.zombiedOwnerLocalStorageKey());return So("IndexedDbPersistence","Zombied ownerID from LocalStorage:",e),e}catch(e){return o("Failed to get zombie owner id.",e),null}},r.prototype.setZombiedOwnerId=function(e){try{null===e?window.localStorage.removeItem(this.zombiedOwnerLocalStorageKey()):window.localStorage.setItem(this.zombiedOwnerLocalStorageKey(),e)}catch(e){o("Failed to set zombie owner id.",e)}},r.prototype.zombiedOwnerLocalStorageKey=function(){return this.localStoragePrefix+"zombiedOwnerId"},r.prototype.generateOwnerId=function(){return zt.newId()},r.MAIN_DATABASE="main",r}(),Or=function(){function e(n,o){this.remoteDocumentCache=n,this.mutationQueue=o}return e.prototype.getDocument=function(o,t){var e=this;return this.remoteDocumentCache.getEntry(o,t).next(function(n){return e.computeLocalDocument(o,t,n)})},e.prototype.getDocuments=function(a,t){var i=this,n=[],r=X();return t.forEach(function(o){n.push(i.getDocument(a,o).next(function(e){e||(e=new ue(o,Ge.forDeletedDoc())),r=r.insert(o,e)}))}),Gn.waitFor(n).next(function(){return r})},e.prototype.getDocumentsMatchingQuery=function(n,t){return ae.isDocumentKey(t.path)?this.getDocumentsMatchingDocumentQuery(n,t.path):this.getDocumentsMatchingCollectionQuery(n,t)},e.prototype.getDocumentsMatchingDocumentQuery=function(n,t){return this.getDocument(n,new ae(t)).next(function(n){var t=Q();return n instanceof se&&(t=t.insert(n.key,n)),t})},e.prototype.getDocumentsMatchingCollectionQuery=function(a,i){var t=this,e;return this.remoteDocumentCache.getDocumentsMatchingQuery(a,i).next(function(n){return t.computeLocalDocuments(a,n)}).next(function(n){return e=n,t.mutationQueue.getAllMutationBatchesAffectingQuery(a,i)}).next(function(n){for(var r=J(),o=0,i=n;o<i.length;o++)for(var d=i[o],s=0,p=d.mutations,c;s<p.length;s++)c=p[s],e.get(c.key)||(r=r.add(c.key));var u=[];return r.forEach(function(n){u.push(t.getDocument(a,n).next(function(n){n instanceof se&&(e=e.insert(n.key,n))}))}),Gn.waitFor(u)}).next(function(){return e.forEach(function(n,t){i.matches(t)||(e=e.remove(n))}),e})},e.prototype.computeLocalDocument=function(o,a,e){return this.mutationQueue.getAllMutationBatchesAffectingDocumentKey(o,a).next(function(n){for(var t=0,r=n,o;t<r.length;t++)o=r[t],e=o.applyToLocalView(a,e);return e})},e.prototype.computeLocalDocuments=function(a,o){var e=this,t=[];return o.forEach(function(n,r){t.push(e.computeLocalDocument(a,n,r).next(function(e){e instanceof se?o=o.insert(e.key,e):e instanceof ue?o=o.remove(e.key):Wo("Unknown MaybeDocument: "+e)}))}),Gn.waitFor(t).next(function(){return o})},e}(),Pr=function(){function e(e){this.remoteDocumentCache=e,this.changes=X()}return e.prototype.addEntry=function(n){var t=this.assertChanges();this.changes=t.insert(n.key,n)},e.prototype.getEntry=function(o,t){var e=this.assertChanges(),n=e.get(t);return n?Gn.resolve(n):this.remoteDocumentCache.getEntry(o,t)},e.prototype.apply=function(a){var t=this,e=this.assertChanges(),i=[];return e.forEach(function(e,n){i.push(t.remoteDocumentCache.addEntry(a,n))}),this.changes=null,Gn.waitFor(i)},e.prototype.assertChanges=function(){return Ho(null!==this.changes,"Changes have already been applied."),this.changes},e}(),Lr=function(){function e(o,r,e){this.persistence=o,this.garbageCollector=e,this.localViewReferences=new Xn,this.targetIds={},this.targetIdGenerator=Vn.forLocalStore(),this.heldBatchResults=[],this.mutationQueue=o.getMutationQueue(r),this.remoteDocuments=o.getRemoteDocumentCache(),this.queryCache=o.getQueryCache(),this.localDocuments=new Or(this.remoteDocuments,this.mutationQueue),this.garbageCollector.addGarbageSource(this.localViewReferences),this.garbageCollector.addGarbageSource(this.queryCache),this.garbageCollector.addGarbageSource(this.mutationQueue)}return e.prototype.start=function(){var n=this;return this.persistence.runTransaction("Start LocalStore",function(t){return n.startMutationQueue(t).next(function(){return n.startQueryCache(t)})})},e.prototype.handleUserChange=function(a){var p=this;return this.persistence.runTransaction("Handle user change",function(e){var n;return p.mutationQueue.getAllMutationBatches(e).next(function(t){return n=t,p.garbageCollector.removeGarbageSource(p.mutationQueue),p.mutationQueue=p.persistence.getMutationQueue(a),p.garbageCollector.addGarbageSource(p.mutationQueue),p.startMutationQueue(e)}).next(function(){return p.localDocuments=new Or(p.remoteDocuments,p.mutationQueue),p.mutationQueue.getAllMutationBatches(e)}).next(function(r){for(var t=J(),o=0,i=[n,r];o<i.length;o++)for(var a=i[o],s=0,u=a;s<u.length;s++)for(var c=u[s],h=0,l=c.mutations,m;h<l.length;h++)m=l[h],t=t.add(m.key);return p.localDocuments.getDocuments(e,t)})})},e.prototype.startQueryCache=function(n){var o=this;return this.queryCache.start(n).next(function(){var e=o.queryCache.getHighestTargetId();o.targetIdGenerator=Vn.forLocalStore(e)})},e.prototype.startMutationQueue=function(o){var t=this;return this.mutationQueue.start(o).next(function(){return t.heldBatchResults=[],t.mutationQueue.getHighestAcknowledgedBatchId(o)}).next(function(e){return e===nr?Gn.resolve([]):t.mutationQueue.getAllMutationBatchesThroughBatchId(o,e)}).next(function(e){return 0<e.length?t.mutationQueue.removeMutationBatches(o,e):Gn.resolve()})},e.prototype.localWrite=function(a){var i=this;return this.persistence.runTransaction("Locally write mutations",function(e){var t=We.now(),n;return i.mutationQueue.addMutationBatch(e,t,a).next(function(r){n=r;var t=n.keys();return i.localDocuments.getDocuments(e,t)}).next(function(e){return{batchId:n.batchId,changes:e}})})},e.prototype.acknowledgeBatch=function(a){var t=this;return this.persistence.runTransaction("Acknowledge batch",function(e){var n;return t.mutationQueue.acknowledgeBatch(e,a.batch,a.streamToken).next(function(){if(t.shouldHoldBatchResult(a.commitVersion))return t.heldBatchResults.push(a),n=J(),Gn.resolve();var r=new Pr(t.remoteDocuments);return t.releaseBatchResults(e,[a],r).next(function(o){return n=o,r.apply(e)})}).next(function(){return t.mutationQueue.performConsistencyCheck(e)}).next(function(){return t.localDocuments.getDocuments(e,n)})})},e.prototype.rejectBatch=function(a){var i=this;return this.persistence.runTransaction("Reject batch",function(e){var t,n;return i.mutationQueue.lookupMutationBatch(e,a).next(function(n){return Ho(null!=n,"Attempt to reject nonexistent batch!"),t=n,i.mutationQueue.getHighestAcknowledgedBatchId(e).next(function(n){return Ho(a>n,"Acknowledged batches can't be rejected."),t})}).next(function(){return i.removeMutationBatch(e,t)}).next(function(o){return n=o,i.mutationQueue.performConsistencyCheck(e)}).next(function(){return i.localDocuments.getDocuments(e,n)})})},e.prototype.getLastStreamToken=function(){var n=this;return this.persistence.runTransaction("Get last stream token",function(t){return n.mutationQueue.getLastStreamToken(t)})},e.prototype.setLastStreamToken=function(o){var t=this;return this.persistence.runTransaction("Set last stream token",function(e){return t.mutationQueue.setLastStreamToken(e,o)})},e.prototype.getLastRemoteSnapshotVersion=function(){return this.queryCache.getLastRemoteSnapshotVersion()},e.prototype.applyRemoteEvent=function(i){var p=this,e=new Pr(this.remoteDocuments);return this.persistence.runTransaction("Apply remote event",function(c){var r=[];d(i.targetChanges,function(e,t){var n=p.targetIds[e];if(n){var o=t.mapping;if(o)if(o instanceof vn)r.push(p.queryCache.removeMatchingKeysForTargetId(c,e).next(function(){return p.queryCache.addMatchingKeys(c,o.documents,e)}));else{if(!(o instanceof bn))return Wo("Unknown mapping type: "+JSON.stringify(o));r.push(p.queryCache.removeMatchingKeys(c,o.removedDocuments,e).next(function(){return p.queryCache.addMatchingKeys(c,o.addedDocuments,e)}))}var a=t.resumeToken;0<a.length&&(n=n.update({resumeToken:a,snapshotVersion:t.snapshotVersion}),p.targetIds[e]=n,r.push(p.queryCache.addQueryData(c,n)))}});var n=J();i.documentUpdates.forEach(function(o,t){n=n.add(o),r.push(e.getEntry(c,o).next(function(n){null==n||t.version.equals(Ge.MIN)||0<=t.version.compareTo(n.version)?e.addEntry(t):So("LocalStore","Ignoring outdated watch update for ",o,". Current version:",n.version," Watch version:",t.version),p.garbageCollector.addPotentialGarbageKey(o)}))});var t=p.queryCache.getLastRemoteSnapshotVersion(),o=i.snapshotVersion;o.equals(Ge.MIN)||(Ho(0<=o.compareTo(t),"Watch stream reverted to previous snapshot?? "+o+" < "+t),r.push(p.queryCache.setLastRemoteSnapshotVersion(c,o)));var a;return Gn.waitFor(r).next(function(){return p.releaseHeldBatchResults(c,e)}).next(function(n){return a=n,e.apply(c)}).next(function(){return p.localDocuments.getDocuments(c,n.unionWith(a))})})},e.prototype.notifyLocalViewChanges=function(s){var o=this;return this.persistence.runTransaction("Notify local view changes",function(e){for(var n=[],t=0,r=s,i;t<r.length;t++)i=r[t],!function(a){n.push(o.queryCache.getQueryData(e,a.query).next(function(e){Ho(null!==e,"Local view changes contain unallocated query.");var t=e.targetId;o.localViewReferences.addReferences(a.addedKeys,t),o.localViewReferences.removeReferences(a.removedKeys,t)}))}(i);return Gn.waitFor(n)})},e.prototype.nextMutationBatch=function(o){var t=this;return this.persistence.runTransaction("Get next mutation batch",function(e){return void 0===o&&(o=nr),t.mutationQueue.getNextMutationBatchAfterBatchId(e,o)})},e.prototype.readDocument=function(o){var t=this;return this.persistence.runTransaction("read document",function(e){return t.localDocuments.getDocument(e,o)})},e.prototype.allocateQuery=function(a){var t=this;return this.persistence.runTransaction("Allocate query",function(e){var n;return t.queryCache.getQueryData(e,a).next(function(r){if(r)return n=r,Gn.resolve();var o=t.targetIdGenerator.next();return n=new me(a,o,He.Listen),t.queryCache.addQueryData(e,n)}).next(function(){return Ho(!t.targetIds[n.targetId],"Tried to allocate an already allocated query: "+a),t.targetIds[n.targetId]=n,n})})},e.prototype.releaseQuery=function(o){var a=this;return this.persistence.runTransaction("Release query",function(e){return a.queryCache.getQueryData(e,o).next(function(t){return Ho(null!=t,"Tried to release nonexistent query: "+o),a.localViewReferences.removeReferencesForId(t.targetId),delete a.targetIds[t.targetId],a.garbageCollector.isEager?a.queryCache.removeQueryData(e,t):Gn.resolve()}).next(function(){if(u(a.targetIds)){var n=new Pr(a.remoteDocuments);return a.releaseHeldBatchResults(e,n).next(function(){n.apply(e)})}return Gn.resolve()})})},e.prototype.executeQuery=function(o){var t=this;return this.persistence.runTransaction("Execute query",function(e){return t.localDocuments.getDocumentsMatchingQuery(e,o)})},e.prototype.remoteDocumentKeys=function(o){var t=this;return this.persistence.runTransaction("Remote document keys",function(e){return t.queryCache.getMatchingKeysForTargetId(e,o)})},e.prototype.collectGarbage=function(){var o=this;return this.persistence.runTransaction("Garbage collection",function(t){return o.garbageCollector.collectGarbage(t).next(function(e){var a=[];return e.forEach(function(e){a.push(o.remoteDocuments.removeEntry(t,e))}),Gn.waitFor(a)})})},e.prototype.releaseHeldBatchResults=function(a,t){for(var e=[],n=0,r=this.heldBatchResults,o;n<r.length&&(o=r[n],!!this.isRemoteUpToVersion(o.commitVersion));n++)e.push(o);return 0===e.length?Gn.resolve(J()):(this.heldBatchResults.splice(0,e.length),this.releaseBatchResults(a,e,t))},e.prototype.isRemoteUpToVersion=function(n){var t=this.queryCache.getLastRemoteSnapshotVersion();return 0>=n.compareTo(t)||u(this.targetIds)},e.prototype.shouldHoldBatchResult=function(e){return!this.isRemoteUpToVersion(e)||0<this.heldBatchResults.length},e.prototype.releaseBatchResults=function(d,t,l){for(var n=this,r=Gn.resolve(),e=0,o=t,a;e<o.length;e++)a=o[e],!function(t){r=r.next(function(){return n.applyWriteToRemoteDocuments(d,t,l)})}(a);return r.next(function(){return n.removeMutationBatches(d,t.map(function(e){return e.batch}))})},e.prototype.removeMutationBatch=function(n,t){return this.removeMutationBatches(n,[t])},e.prototype.removeMutationBatches=function(d,t){for(var e=J(),n=0,r=t;n<r.length;n++)for(var o=r[n],i=0,a=o.mutations;i<a.length;i++){var s=a[i],l=s.key;e=e.add(l)}return this.mutationQueue.removeMutationBatches(d,t).next(function(){return e})},e.prototype.applyWriteToRemoteDocuments=function(a,s,e){var n=s.batch,t=n.keys(),r=Gn.resolve();return t.forEach(function(d){r=r.next(function(){return e.getEntry(a,d)}).next(function(o){var r=o,l=s.docVersions.get(d);Ho(null!==l,"ackVersions should contain every doc in the write."),(!r||0>r.version.compareTo(l))&&(r=n.applyToRemoteDocument(d,r,s),r?e.addEntry(r):Ho(!o,"Mutation batch "+n+" applied to document "+o+" resulted in null"))})}),r},e}(),xr=function(){function e(){this.mutationQueue=[],this.nextBatchId=1,this.highestAcknowledgedBatchId=nr,this.lastStreamToken=i(),this.garbageCollector=null,this.batchesByDocumentKey=new en(Yn.compareByKey)}return e.prototype.start=function(){return 0===this.mutationQueue.length&&(this.nextBatchId=1,this.highestAcknowledgedBatchId=nr),Ho(this.highestAcknowledgedBatchId<this.nextBatchId,"highestAcknowledgedBatchId must be less than the nextBatchId"),Gn.resolve()},e.prototype.checkEmpty=function(){return Gn.resolve(0===this.mutationQueue.length)},e.prototype.getNextBatchId=function(){return Gn.resolve(this.nextBatchId)},e.prototype.getHighestAcknowledgedBatchId=function(){return Gn.resolve(this.highestAcknowledgedBatchId)},e.prototype.acknowledgeBatch=function(a,t,e){var n=t.batchId;Ho(n>this.highestAcknowledgedBatchId,"Mutation batchIDs must be acknowledged in order");var r=this.indexOfExistingBatchId(n,"acknowledged"),o=this.mutationQueue[r];return Ho(n===o.batchId,"Queue ordering failure: expected batch "+n+", got batch "+o.batchId),Ho(!o.isTombstone(),"Can't acknowledge a previously removed batch"),this.highestAcknowledgedBatchId=n,this.lastStreamToken=e,Gn.resolve()},e.prototype.getLastStreamToken=function(){return Gn.resolve(this.lastStreamToken)},e.prototype.setLastStreamToken=function(n,t){return this.lastStreamToken=t,Gn.resolve()},e.prototype.addMutationBatch=function(d,t,e){Ho(0!==e.length,"Mutation batches should not be empty");var n=this.nextBatchId;this.nextBatchId++,0<this.mutationQueue.length&&Ho(this.mutationQueue[this.mutationQueue.length-1].batchId<n,"Mutation batchIDs must be monotonically increasing order");var r=new or(n,t,e);this.mutationQueue.push(r);for(var o=0,i=e,a;o<i.length;o++)a=i[o],this.batchesByDocumentKey=this.batchesByDocumentKey.add(new Yn(a.key,n));return Gn.resolve(r)},e.prototype.lookupMutationBatch=function(n,t){return Gn.resolve(this.findMutationBatch(t))},e.prototype.getNextMutationBatchAfterBatchId=function(a,t){var e=this.mutationQueue.length;t=Math.max(t+1,this.highestAcknowledgedBatchId);for(var n=this.indexOfBatchId(t),r=0>n?0:n,o;r<e;r++)if(o=this.mutationQueue[r],!o.isTombstone())return Gn.resolve(o);return Gn.resolve(null)},e.prototype.getAllMutationBatches=function(){return Gn.resolve(this.getAllLiveMutationBatchesBeforeIndex(this.mutationQueue.length))},e.prototype.getAllMutationBatchesThroughBatchId=function(o,t){var e=this.mutationQueue.length,n=this.indexOfBatchId(t);return 0>n?n=0:n>=e?n=e:n++,Gn.resolve(this.getAllLiveMutationBatchesBeforeIndex(n))},e.prototype.getAllMutationBatchesAffectingDocumentKey=function(a,s){var e=this,t=new Yn(s,0),n=new Yn(s,Ft),o=[];return this.batchesByDocumentKey.forEachInRange([t,n],function(n){Ho(s.equals(n.key),"Should only iterate over a single key's batches");var t=e.findMutationBatch(n.targetOrBatchId);Ho(null!==t,"Batches in the index must exist in the main table"),o.push(t)}),Gn.resolve(o)},e.prototype.getAllMutationBatchesAffectingQuery=function(d,t){var l=this,n=t.path,r=n.length+1,e=n;ae.isDocumentKey(e)||(e=e.child(""));var o=new Yn(new ae(e),0),a=new en(P);this.batchesByDocumentKey.forEachWhile(function(o){var t=o.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(a=a.add(o.targetOrBatchId)),!0)},o);var i=[];return a.forEach(function(n){var t=l.findMutationBatch(n);null!==t&&i.push(t)}),Gn.resolve(i)},e.prototype.removeMutationBatches=function(c,t){var e=t.length;Ho(0<e,"Should not remove mutations when none exist.");var n=t[0].batchId,r=this.mutationQueue.length,o=this.indexOfExistingBatchId(n,"removed");Ho(this.mutationQueue[o].batchId===n,"Removed batches must exist in the queue");for(var i=1,a=o+1,s;i<e&&a<r;)s=this.mutationQueue[a],s.isTombstone()?a++:(Ho(s.batchId===t[i].batchId,"Removed batches must be contiguous in the queue"),i++,a++);if(0===o){for(;a<r;a++){var s=this.mutationQueue[a];if(!s.isTombstone())break}var u=a-o;this.mutationQueue.splice(o,u)}else for(var h=o;h<a;h++)this.mutationQueue[h]=this.mutationQueue[h].toTombstone();for(var l=this.batchesByDocumentKey,f=0,d=t;f<d.length;f++)for(var s=d[f],p=s.batchId,y=0,m=s.mutations;y<m.length;y++){var g=m[y],v=g.key;null!==this.garbageCollector&&this.garbageCollector.addPotentialGarbageKey(v);var b=new Yn(v,p);l=l.delete(b)}return this.batchesByDocumentKey=l,Gn.resolve()},e.prototype.setGarbageCollector=function(e){this.garbageCollector=e},e.prototype.containsKey=function(o,t){var e=new Yn(t,0),n=this.batchesByDocumentKey.firstAfterOrEqual(e);return Gn.resolve(t.equals(n&&n.key))},e.prototype.performConsistencyCheck=function(){return 0===this.mutationQueue.length&&Ho(this.batchesByDocumentKey.isEmpty(),"Document leak -- detected dangling mutation references when queue is empty."),Gn.resolve()},e.prototype.getAllLiveMutationBatchesBeforeIndex=function(o){for(var t=[],e=0,n;e<o;e++)n=this.mutationQueue[e],n.isTombstone()||t.push(n);return t},e.prototype.indexOfExistingBatchId=function(o,t){var e=this.indexOfBatchId(o);return Ho(0<=e&&e<this.mutationQueue.length,"Batches must exist to be "+t),e},e.prototype.indexOfBatchId=function(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId},e.prototype.findMutationBatch=function(o){var t=this.indexOfBatchId(o);if(0>t||t>=this.mutationQueue.length)return null;var e=this.mutationQueue[t];return Ho(e.batchId===o,"If found batch must match"),e.isTombstone()?null:e},e}(),_r=function(){function e(){this.queries=new jn(function(e){return e.canonicalId()}),this.lastRemoteSnapshotVersion=Ge.MIN,this.highestTargetId=0,this.references=new Xn}return e.prototype.start=function(){return Gn.resolve()},e.prototype.getLastRemoteSnapshotVersion=function(){return this.lastRemoteSnapshotVersion},e.prototype.getHighestTargetId=function(){return this.highestTargetId},e.prototype.setLastRemoteSnapshotVersion=function(n,t){return this.lastRemoteSnapshotVersion=t,Gn.resolve()},e.prototype.addQueryData=function(o,t){this.queries.set(t.query,t);var e=t.targetId;return e>this.highestTargetId&&(this.highestTargetId=e),Gn.resolve()},e.prototype.removeQueryData=function(n,t){return this.queries.delete(t.query),this.references.removeReferencesForId(t.targetId),Gn.resolve()},e.prototype.getQueryData=function(o,t){var e=this.queries.get(t)||null;return Gn.resolve(e)},e.prototype.addMatchingKeys=function(o,t,e){return this.references.addReferences(t,e),Gn.resolve()},e.prototype.removeMatchingKeys=function(o,t,e){return this.references.removeReferences(t,e),Gn.resolve()},e.prototype.removeMatchingKeysForTargetId=function(n,t){return this.references.removeReferencesForId(t),Gn.resolve()},e.prototype.getMatchingKeysForTargetId=function(o,t){var e=this.references.referencesForId(t);return Gn.resolve(e)},e.prototype.setGarbageCollector=function(e){this.references.setGarbageCollector(e)},e.prototype.containsKey=function(n,t){return this.references.containsKey(n,t)},e}(),Dr=function(){function e(){this.docs=X()}return e.prototype.addEntry=function(n,t){return this.docs=this.docs.insert(t.key,t),Gn.resolve()},e.prototype.removeEntry=function(n,t){return this.docs=this.docs.remove(t),Gn.resolve()},e.prototype.getEntry=function(n,t){return Gn.resolve(this.docs.get(t))},e.prototype.getDocumentsMatchingQuery=function(d,t){for(var e=Q(),n=new ae(t.path.child("")),r=this.docs.getIteratorFrom(n);r.hasNext();){var o=r.getNext(),i=o.key,a=o.value;if(!t.path.isPrefixOf(i.path))break;a instanceof se&&t.matches(a)&&(e=e.insert(a.key,a))}return Gn.resolve(e)},e}(),Mr=function(){function e(){this.mutationQueues={},this.remoteDocumentCache=new Dr,this.queryCache=new _r,this.started=!1}return e.prototype.start=function(){return Ho(!this.started,"MemoryPersistence double-started!"),this.started=!0,Promise.resolve()},e.prototype.shutdown=function(){return Ho(this.started,"MemoryPersistence shutdown without start!"),this.started=!1,Promise.resolve()},e.prototype.getMutationQueue=function(n){var t=this.mutationQueues[n.toKey()];return t||(t=new xr,this.mutationQueues[n.toKey()]=t),t},e.prototype.getQueryCache=function(){return this.queryCache},e.prototype.getRemoteDocumentCache=function(){return this.remoteDocumentCache},e.prototype.runTransaction=function(n,t){return So("MemoryPersistence","Starting transaction:",n),t(new Fr).toPromise()},e}(),Fr=function(){return function(){}}(),Br=function(){function e(){this.isEager=!1}return e.prototype.addGarbageSource=function(){},e.prototype.removeGarbageSource=function(){},e.prototype.addPotentialGarbageKey=function(){},e.prototype.collectGarbage=function(){return Gn.resolve(J())},e}(),Ur=function(){function e(){var o=this;this.promise=new Promise(function(t,e){o.resolve=t,o.reject=e})}return e}(),Vr=function(){function e(o,r,e){this.initialDelayMs=o,this.backoffFactor=r,this.maxDelayMs=e,this.reset()}return e.prototype.reset=function(){this.currentBaseMs=0},e.prototype.resetToMax=function(){this.currentBaseMs=this.maxDelayMs},e.prototype.backoffAndWait=function(){var n=new Ur,t=this.currentBaseMs+this.jitterDelayMs();return 0<this.currentBaseMs&&So("ExponentialBackoff","Backing off for "+t+" ms (base delay: "+this.currentBaseMs+" ms)"),setTimeout(function(){n.resolve()},t),this.currentBaseMs*=this.backoffFactor,this.currentBaseMs<this.initialDelayMs&&(this.currentBaseMs=this.initialDelayMs),this.currentBaseMs>this.maxDelayMs&&(this.currentBaseMs=this.maxDelayMs),n.promise},e.prototype.jitterDelayMs=function(){return(Math.random()-.5)*this.currentBaseMs},e}(),Hr=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),Wr;!function(e){e[e.Initial=0]="Initial",e[e.Auth=1]="Auth",e[e.Open=2]="Open",e[e.Error=3]="Error",e[e.Backoff=4]="Backoff",e[e.Stopped=5]="Stopped"}(Wr||(Wr={}));var Zn=function(){function e(o,a,e,n){this.queue=o,this.connection=a,this.credentialsProvider=e,this.idle=!1,this.stream=null,this.listener=null,this.backoff=new Vr(n||1e3,1.5,6e4),this.state=Wr.Initial}return e.prototype.isStarted=function(){return this.state===Wr.Backoff||this.state===Wr.Auth||this.state===Wr.Open},e.prototype.isOpen=function(){return this.state===Wr.Open},e.prototype.start=function(e){return this.state===Wr.Error?void this.performBackoff(e):void(Ho(this.state===Wr.Initial,"Already started"),this.listener=e,this.auth())},e.prototype.stop=function(){this.isStarted()&&this.close(Wr.Stopped)},e.prototype.inhibitBackoff=function(){Ho(!this.isStarted(),"Can only inhibit backoff in a stopped state"),this.state=Wr.Initial,this.backoff.reset()},e.prototype.markIdle=function(){var e=this;this.idle=!0,this.queue.schedule(function(){return e.handleIdleCloseTimer()},6e4).catch(function(e){Ho(e.code===Gt.CANCELLED,"Received unexpected error in idle timeout closure. Expected CANCELLED, but was: "+e)})},e.prototype.sendRequest=function(e){this.cancelIdleCheck(),this.stream.send(e)},e.prototype.handleIdleCloseTimer=function(){return this.isOpen()&&this.idle?this.close(Wr.Initial):Promise.resolve()},e.prototype.cancelIdleCheck=function(){this.idle=!1},e.prototype.close=function(r,t){Ho(r==Wr.Error||V(t),"Can't provide an error when not in an error state."),this.cancelIdleCheck(),r==Wr.Error?t&&t.code===Gt.RESOURCE_EXHAUSTED&&(o(""+t),o("Using maximum backoff delay to prevent overloading the backend."),this.backoff.resetToMax()):this.backoff.reset(),null!==this.stream&&(this.tearDown(),this.stream.close(),this.stream=null),this.state=r;var e=this.listener;return this.listener=null,r==Wr.Stopped?Promise.resolve():e.onClose(t)},e.prototype.tearDown=function(){},e.prototype.auth=function(){var o=this;Ho(this.state===Wr.Initial,"Must be in initial state to auth"),this.state=Wr.Auth,this.credentialsProvider.getToken(!1).then(function(t){o.startStream(t)},function(t){o.queue.schedule(function(){if(o.state!==Wr.Stopped){var e=new Ht(Gt.UNKNOWN,"Fetching auth token failed: "+t.message);return o.handleStreamClose(e)}return Promise.resolve()})})},e.prototype.startStream=function(o){var a=this;if(this.state!==Wr.Stopped){Ho(this.state===Wr.Auth,"Trying to start stream in a non-auth state");var e=function(e,t){a.queue.schedule(function(){return a.stream===e?t():Promise.resolve()})};if(null!==this.listener){var n=this.startRpc(o);this.stream=n,this.stream.onOpen(function(){e(n,function(){return Ho(a.state===Wr.Auth,"Expected stream to be in state auth, but was "+a.state),a.state=Wr.Open,a.listener.onOpen()})}),this.stream.onClose(function(o){e(n,function(){return a.handleStreamClose(o)})}),this.stream.onMessage(function(o){e(n,function(){return a.onMessage(o)})})}}},e.prototype.performBackoff=function(n){var t=this;Ho(this.state===Wr.Error,"Should only perform backoff in an error case"),this.state=Wr.Backoff,this.backoff.backoffAndWait().then(function(){t.queue.schedule(function(){return t.state===Wr.Stopped?Promise.resolve():(t.state=Wr.Initial,t.start(n),Ho(t.isStarted(),"PersistentStream should have started"),Promise.resolve())})})},e.prototype.handleStreamClose=function(e){return Ho(this.isStarted(),"Can't handle server close on non-started stream"),So("PersistentStream","close with error: "+e),this.stream=null,this.close(Wr.Error,e)},e}(),jr=function(d){function t(t,l,n,r,o,i){var a=d.call(this,l,n,r,i)||this;return a.databaseInfo=t,a.serializer=o,a}return Hr(t,d),t.prototype.startRpc=function(e){return this.connection.openStream("Listen",e)},t.prototype.onMessage=function(o){this.backoff.reset();var t=this.serializer.fromWatchChange(o),e=this.serializer.versionFromListenResponse(o);return this.listener.onWatchChange(t,e)},t.prototype.watch=function(o){var t={database:this.serializer.encodedDatabaseId,addTarget:this.serializer.toTarget(o)},e=this.serializer.toListenRequestLabels(o);e&&(t.labels=e),this.sendRequest(t)},t.prototype.unwatch=function(n){var t={};t.database=this.serializer.encodedDatabaseId,t.removeTarget=n,this.sendRequest(t)},t}(Zn),qr=function(d){function t(t,l,n,r,o,i){var a=d.call(this,l,n,r,i)||this;return a.databaseInfo=t,a.serializer=o,a.y=!1,a}return Hr(t,d),Object.defineProperty(t.prototype,"handshakeComplete",{get:function(){return this.y},enumerable:!0,configurable:!0}),t.prototype.start=function(t){this.y=!1,d.prototype.start.call(this,t)},t.prototype.tearDown=function(){this.y&&this.writeMutations([])},t.prototype.startRpc=function(e){return this.connection.openStream("Write",e)},t.prototype.onMessage=function(o){if(Ho(!!o.streamToken,"Got a write response without a stream token"),this.lastStreamToken=o.streamToken,this.y){this.backoff.reset();var t=this.serializer.fromWriteResults(o.writeResults),e=this.serializer.fromVersion(o.commitTime);return this.listener.onMutationResult(e,t)}return Ho(!o.writeResults||0===o.writeResults.length,"Got mutation results for handshake"),this.y=!0,this.listener.onHandshakeComplete()},t.prototype.writeHandshake=function(){Ho(this.isOpen(),"Writing handshake requires an opened stream"),Ho(!this.y,"Handshake already completed");var e={};e.database=this.serializer.encodedDatabaseId,this.sendRequest(e)},t.prototype.writeMutations=function(o){var r=this;Ho(this.isOpen(),"Writing mutations requires an opened stream"),Ho(this.y,"Handshake must be complete before writing mutations"),Ho(0<this.lastStreamToken.length,"Trying to write mutation without a token");var e={streamToken:this.lastStreamToken,writes:o.map(function(e){return r.serializer.toMutation(e)})};this.sendRequest(e)},t}(Zn),zr=function(){function e(a,s,e,n,r,o){this.databaseInfo=a,this.queue=s,this.connection=e,this.credentials=n,this.serializer=r,this.initialBackoffDelay=o}return e.prototype.newPersistentWriteStream=function(){return new qr(this.databaseInfo,this.queue,this.connection,this.credentials,this.serializer,this.initialBackoffDelay)},e.prototype.newPersistentWatchStream=function(){return new jr(this.databaseInfo,this.queue,this.connection,this.credentials,this.serializer,this.initialBackoffDelay)},e.prototype.commit=function(o){var r=this,e={database:this.serializer.encodedDatabaseId,writes:o.map(function(e){return r.serializer.toMutation(e)})};return this.invokeRPC("Commit",e).then(function(e){return r.serializer.fromWriteResults(e.writeResults)})},e.prototype.lookup=function(a){var o=this,e={database:this.serializer.encodedDatabaseId,documents:a.map(function(e){return o.serializer.toName(e)})};return this.invokeStreamingRPC("BatchGetDocuments",e).then(function(e){var i=X();e.forEach(function(e){var t=o.serializer.fromMaybeDocument(e);i=i.insert(t.key,t)});var n=[];return a.forEach(function(o){var t=i.get(o);Ho(!!t,"Missing entity in write response for "+o),n.push(t)}),n})},e.prototype.invokeRPC=function(o,t){var e=this;return this.credentials.getToken(!1).then(function(n){return e.connection.invokeRPC(o,t,n)})},e.prototype.invokeStreamingRPC=function(o,t){var e=this;return this.credentials.getToken(!1).then(function(n){return e.connection.invokeStreamingRPC(o,t,n)})},e}(),Kr=function(){function e(e){this.datastore=e,this.readVersions=Y(),this.mutations=[],this.committed=!1}return e.prototype.recordVersion=function(o){var t=o.version;o instanceof ue&&(t=Ge.forDeletedDoc());var e=this.readVersions.get(o.key);if(!(null!==e))this.readVersions=this.readVersions.insert(o.key,t);else if(!t.equals(e))throw new Ht(Gt.ABORTED,"Document version changed between two reads.")},e.prototype.lookup=function(n){var o=this;return this.committed?Promise.reject("Transaction has already completed."):0<this.mutations.length?Promise.reject("Transactions lookups are invalid after writes."):this.datastore.lookup(n).then(function(e){return e.forEach(function(e){return o.recordVersion(e)}),e})},e.prototype.write=function(e){if(this.committed)throw new Ht(Gt.FAILED_PRECONDITION,"Transaction has already completed.");this.mutations=this.mutations.concat(e)},e.prototype.precondition=function(n){var t=this.readVersions.get(n);return t?ze.updateTime(t):ze.NONE},e.prototype.preconditionForUpdate=function(n){var t=this.readVersions.get(n);if(t&&t.equals(Ge.forDeletedDoc()))throw new Ht(Gt.FAILED_PRECONDITION,"Can't update a document that doesn't exist.");return t?ze.updateTime(t):ze.exists(!0)},e.prototype.set=function(n,t){this.write(t.toMutations(n,this.precondition(n)))},e.prototype.update=function(n,t){this.write(t.toMutations(n,this.preconditionForUpdate(n)))},e.prototype.delete=function(e){this.write([new sn(e,this.precondition(e))]),this.readVersions=this.readVersions.insert(e,Ge.forDeletedDoc())},e.prototype.commit=function(){var n=this,o=this.readVersions;return this.mutations.forEach(function(e){o=o.remove(e.key)}),o.isEmpty()?this.datastore.commit(this.mutations).then(function(){n.committed=!0}):Promise.reject(Error("Every document read in a transaction must also be written."))},e}(),to=function(){function e(o,r,e){this.localStore=o,this.datastore=r,this.onlineStateHandler=e,this.pendingWrites=[],this.lastBatchSeen=nr,this.listenTargets={},this.pendingTargetResponses={},this.accumulatedWatchChanges=[],this.watchStream=null,this.writeStream=null,this.watchStreamOnlineState=Bn.Unknown,this.watchStreamFailures=0,this.shouldWarnOffline=!0}return e.prototype.start=function(){return this.enableNetwork()},e.prototype.setOnlineStateToHealthy=function(){this.shouldWarnOffline=!1,this.updateAndBroadcastOnlineState(Bn.Healthy)},e.prototype.setOnlineStateToUnknown=function(){this.watchStreamFailures=0,this.updateAndBroadcastOnlineState(Bn.Unknown)},e.prototype.updateOnlineStateAfterFailure=function(){this.watchStreamOnlineState===Bn.Healthy?this.setOnlineStateToUnknown():2<=++this.watchStreamFailures&&(this.shouldWarnOffline&&(o("Could not reach Firestore backend."),this.shouldWarnOffline=!1),this.updateAndBroadcastOnlineState(Bn.Failed))},e.prototype.updateAndBroadcastOnlineState=function(n){var t=this.watchStreamOnlineState!==n;this.watchStreamOnlineState=n,t&&this.onlineStateHandler(n)},e.prototype.isNetworkEnabled=function(){return Ho(null==this.watchStream==(null==this.writeStream),"WatchStream and WriteStream should both be null or non-null"),null!=this.watchStream},e.prototype.enableNetwork=function(){var n=this;return Ho(null==this.watchStream,"enableNetwork() called with non-null watchStream."),Ho(null==this.writeStream,"enableNetwork() called with non-null writeStream."),this.watchStream=this.datastore.newPersistentWatchStream(),this.writeStream=this.datastore.newPersistentWriteStream(),this.localStore.getLastStreamToken().then(function(t){return n.writeStream.lastStreamToken=t,n.shouldStartWatchStream()&&n.startWatchStream(),n.updateAndBroadcastOnlineState(Bn.Unknown),n.fillWritePipeline()})},e.prototype.disableNetwork=function(){return this.updateAndBroadcastOnlineState(Bn.Failed),this.watchStream.stop(),this.writeStream.stop(),this.cleanUpWatchStreamState(),this.cleanUpWriteStreamState(),this.writeStream=null,this.watchStream=null,Promise.resolve()},e.prototype.shutdown=function(){return So("RemoteStore","RemoteStore shutting down."),this.disableNetwork(),Promise.resolve(void 0)},e.prototype.listen=function(e){Ho(!l(this.listenTargets,e.targetId),"listen called with duplicate targetId!"),this.listenTargets[e.targetId]=e,this.shouldStartWatchStream()?this.startWatchStream():this.isNetworkEnabled()&&this.watchStream.isOpen()&&this.sendWatchRequest(e)},e.prototype.unlisten=function(e){Ho(l(this.listenTargets,e),"unlisten called without assigned target ID!"),this.listenTargets[e],delete this.listenTargets[e],this.isNetworkEnabled()&&this.watchStream.isOpen()&&(this.sendUnwatchRequest(e),u(this.listenTargets)&&this.watchStream.markIdle())},e.prototype.sendWatchRequest=function(e){this.recordPendingTargetRequest(e.targetId),this.watchStream.watch(e)},e.prototype.sendUnwatchRequest=function(e){this.recordPendingTargetRequest(e),this.watchStream.unwatch(e)},e.prototype.recordPendingTargetRequest=function(e){this.pendingTargetResponses[e]=(this.pendingTargetResponses[e]||0)+1},e.prototype.startWatchStream=function(){Ho(this.shouldStartWatchStream(),"startWriteStream() called when shouldStartWatchStream() is false."),this.watchStream.start({onOpen:this.onWatchStreamOpen.bind(this),onClose:this.onWatchStreamClose.bind(this),onWatchChange:this.onWatchStreamChange.bind(this)})},e.prototype.shouldStartWatchStream=function(){return this.isNetworkEnabled()&&!this.watchStream.isStarted()&&!u(this.listenTargets)},e.prototype.cleanUpWatchStreamState=function(){this.accumulatedWatchChanges=[],this.pendingTargetResponses={}},e.prototype.onWatchStreamOpen=function(){var o=this;return d(this.listenTargets,function(t,e){o.sendWatchRequest(e)}),Promise.resolve()},e.prototype.onWatchStreamClose=function(){return Ho(this.isNetworkEnabled(),"onWatchStreamClose() should only be called when the network is enabled"),this.cleanUpWatchStreamState(),this.shouldStartWatchStream()?(this.updateOnlineStateAfterFailure(),this.startWatchStream()):this.setOnlineStateToUnknown(),Promise.resolve()},e.prototype.onWatchStreamChange=function(o,t){if(this.setOnlineStateToHealthy(),o instanceof gn&&o.state===Tn.Removed&&o.cause)return this.handleTargetError(o);if(this.accumulatedWatchChanges.push(o),!t.equals(Ge.MIN)&&0<=t.compareTo(this.localStore.getLastRemoteSnapshotVersion())){var e=this.accumulatedWatchChanges;return this.accumulatedWatchChanges=[],this.handleWatchChangeBatch(t,e)}return Promise.resolve()},e.prototype.handleWatchChangeBatch=function(a,t){var p=this,e=new En(a,this.listenTargets,this.pendingTargetResponses);e.addChanges(t);var n=e.createRemoteEvent();this.pendingTargetResponses=e.pendingTargetResponses;var o=[];return d(e.existenceFilters,function(d,e){var t=p.listenTargets[d];if(t){var r=t.query;if(!r.isDocumentQuery()){var i=p.localStore.remoteDocumentKeys(d).then(function(o){if(n.targetChanges[d]){var a=n.targetChanges[d].mapping;null!==a&&(a instanceof bn?o=a.applyToKeySet(o):(Ho(a instanceof vn,"Expected either reset or update mapping but got something else: "+a),o=a.documents))}if(o.size!==e.count){n.handleExistenceFilterMismatch(d);var i=new me(r,d,t.purpose);p.listenTargets[d]=i,p.sendUnwatchRequest(d);var s=new me(r,d,He.ExistenceFilterMismatch);p.sendWatchRequest(s)}});o.push(i)}else if(0===e.count){var s=new ae(r.path),l=new ue(s,a);n.addDocumentUpdate(l)}else Ho(1===e.count,"Single document existence filter with count: "+e.count)}}),Promise.all(o).then(function(){return d(n.targetChanges,function(n,t){if(0<t.resumeToken.length){var e=p.listenTargets[n];e&&(p.listenTargets[n]=e.update({resumeToken:t.resumeToken,snapshotVersion:t.snapshotVersion}))}}),p.syncEngine.applyRemoteEvent(n)})},e.prototype.handleTargetError=function(o){var a=this;Ho(!!o.cause,"Handling target error without a cause");var e=o.cause,n=Promise.resolve();return o.targetIds.forEach(function(o){n=n.then(function(){return l(a.listenTargets,o)?(delete a.listenTargets[o],a.syncEngine.rejectListen(o,e)):Promise.resolve()})}),n},e.prototype.cleanUpWriteStreamState=function(){this.lastBatchSeen=nr,this.pendingWrites=[]},e.prototype.fillWritePipeline=function(){var n=this;return this.canWriteMutations()?this.localStore.nextMutationBatch(this.lastBatchSeen).then(function(t){return null===t?(0==n.pendingWrites.length&&n.writeStream.markIdle(),Promise.resolve()):(n.commit(t),n.fillWritePipeline())}):Promise.resolve()},e.prototype.canWriteMutations=function(){return this.isNetworkEnabled()&&10>this.pendingWrites.length},e.prototype.outstandingWrites=function(){return this.pendingWrites.length},e.prototype.commit=function(e){Ho(this.canWriteMutations(),"commit called when batches can't be written"),this.lastBatchSeen=e.batchId,this.pendingWrites.push(e),this.shouldStartWriteStream()?this.startWriteStream():this.isNetworkEnabled()&&this.writeStream.handshakeComplete&&this.writeStream.writeMutations(e.mutations)},e.prototype.shouldStartWriteStream=function(){return this.isNetworkEnabled()&&!this.writeStream.isStarted()&&0<this.pendingWrites.length},e.prototype.startWriteStream=function(){Ho(this.shouldStartWriteStream(),"startWriteStream() called when shouldStartWriteStream() is false."),this.writeStream.start({onOpen:this.onWriteStreamOpen.bind(this),onClose:this.onWriteStreamClose.bind(this),onHandshakeComplete:this.onWriteHandshakeComplete.bind(this),onMutationResult:this.onMutationResult.bind(this)})},e.prototype.onWriteStreamOpen=function(){return this.writeStream.writeHandshake(),Promise.resolve()},e.prototype.onWriteHandshakeComplete=function(){var o=this;return this.localStore.setLastStreamToken(this.writeStream.lastStreamToken).then(function(){for(var t=0,e=o.pendingWrites,n;t<e.length;t++)n=e[t],o.writeStream.writeMutations(n.mutations)})},e.prototype.onMutationResult=function(a,t){var e=this;Ho(0<this.pendingWrites.length,"Got result for empty pending writes");var n=this.pendingWrites.shift(),r=rr.from(n,a,t,this.writeStream.lastStreamToken);return this.syncEngine.applySuccessfulWrite(r).then(function(){return e.fillWritePipeline()})},e.prototype.onWriteStreamClose=function(o){var r=this;if(Ho(this.isNetworkEnabled(),"onWriteStreamClose() should only be called when the network is enabled"),o&&0<this.pendingWrites.length){Ho(!!o,"We have pending writes, but the write stream closed without an error");var e;return e=this.writeStream.handshakeComplete?this.handleWriteError(o):this.handleHandshakeError(o),e.then(function(){r.shouldStartWriteStream()&&r.startWriteStream()})}return Promise.resolve()},e.prototype.handleHandshakeError=function(e){return q(e.code)||e.code===Gt.ABORTED?(So("RemoteStore","RemoteStore error before completed handshake; resetting stream token: ",this.writeStream.lastStreamToken),this.writeStream.lastStreamToken=i(),this.localStore.setLastStreamToken(i())):Promise.resolve()},e.prototype.handleWriteError=function(o){var t=this;if(q(o.code)){var e=this.pendingWrites.shift();return this.writeStream.inhibitBackoff(),this.syncEngine.rejectFailedWrite(e.batchId,o).then(function(){return t.fillWritePipeline()})}return Promise.resolve()},e.prototype.createTransaction=function(){return new Kr(this.datastore)},e.prototype.handleUserChange=function(e){return So("RemoteStore","RemoteStore changing users: uid=",e.uid),this.disableNetwork(),this.enableNetwork()},e}(),eo=function(){function e(o,a,e,n){this.platform=o,this.databaseInfo=a,this.credentials=e,this.asyncQueue=n}return e.prototype.start=function(a){var t=this,e=new Ur,n=new Ur,r=!1;return this.credentials.setUserChangeListener(function(o){r?t.asyncQueue.schedule(function(){return t.handleUserChange(o)}):(r=!0,t.initializePersistence(a,n).then(function(){return t.initializeRest(o)}).then(e.resolve,e.reject))}),this.asyncQueue.schedule(function(){return e.promise}),n.promise},e.prototype.enableNetwork=function(){var e=this;return this.asyncQueue.schedule(function(){return e.remoteStore.enableNetwork()})},e.prototype.initializePersistence=function(o,r){var e=this;return o?this.startIndexedDbPersistence().then(r.resolve).catch(function(n){return r.reject(n),e.canFallback(n)?(console.warn("Error enabling offline storage. Falling back to storage disabled: "+n),e.startMemoryPersistence()):Promise.reject(n)}):(r.resolve(),this.startMemoryPersistence())},e.prototype.canFallback=function(e){return e.code===Gt.FAILED_PRECONDITION||e.code===Gt.UNIMPLEMENTED},e.prototype.startIndexedDbPersistence=function(){this.garbageCollector=new Br;var n=Rr.buildStoragePrefix(this.databaseInfo),t=new Dn(this.databaseInfo.databaseId,{useProto3Json:!0});return this.persistence=new Rr(n,t),this.persistence.start()},e.prototype.startMemoryPersistence=function(){return this.garbageCollector=new Hn,this.persistence=new Mr,this.persistence.start()},e.prototype.initializeRest=function(a){var i=this;return this.platform.loadConnection(this.databaseInfo).then(function(e){i.localStore=new Lr(i.persistence,a,i.garbageCollector);var t=i.platform.newSerializer(i.databaseInfo.databaseId),n=new zr(i.databaseInfo,i.asyncQueue,e,i.credentials,t);return i.remoteStore=new to(i.localStore,n,function(e){i.eventMgr.onOnlineStateChanged(e)}),i.syncEngine=new tr(i.localStore,i.remoteStore,a),i.remoteStore.syncEngine=i.syncEngine,i.eventMgr=new Kn(i.syncEngine),i.localStore.start()}).then(function(){return i.remoteStore.start()})},e.prototype.handleUserChange=function(e){return this.asyncQueue.verifyOperationInProgress(),So("FirestoreClient","User Changed: "+e.uid),this.syncEngine.handleUserChange(e)},e.prototype.disableNetwork=function(){var e=this;return this.asyncQueue.schedule(function(){return e.remoteStore.disableNetwork()})},e.prototype.shutdown=function(){var e=this;return this.asyncQueue.schedule(function(){return e.credentials.removeUserChangeListener(),e.remoteStore.shutdown()}).then(function(){return e.persistence.shutdown()})},e.prototype.listen=function(a,t,e){var n=this,r=new Wn(a,t,e);return this.asyncQueue.schedule(function(){return n.eventMgr.listen(r)}),r},e.prototype.unlisten=function(n){var t=this;this.asyncQueue.schedule(function(){return t.eventMgr.unlisten(n)})},e.prototype.write=function(o){var t=this,e=new Ur;return this.asyncQueue.schedule(function(){return t.syncEngine.write(o,e)}),e.promise},e.prototype.databaseId=function(){return this.databaseInfo.databaseId},e.prototype.transaction=function(n){var t=this;return this.asyncQueue.schedule(function(){return Promise.resolve()}).then(function(){return t.syncEngine.runTransaction(n)})},e}(),no=function(){function e(e){this.observer=e,this.muted=!1}return e.prototype.next=function(e){this.scheduleEvent(this.observer.next,e)},e.prototype.error=function(e){this.scheduleEvent(this.observer.error,e)},e.prototype.mute=function(){this.muted=!0},e.prototype.scheduleEvent=function(o,t){var e=this;this.muted||setTimeout(function(){e.muted||o(t)},0)},e}(),ro=function(){function e(){this.tail=Promise.resolve(),this.delayedOperations=[],this.delayedOperationsCount=0,this.operationInProgress=!1}return e.prototype.schedule=function(o,a){var e=this;if(this.failure&&Wo("AsyncQueue is already failed: "+(this.failure.stack||this.failure.message)),0<(a||0)){this.delayedOperationsCount++;var n={handle:null,op:o,deferred:new Ur};return n.handle=setTimeout(function(){e.scheduleInternal(function(){return n.op().then(function(e){n.deferred.resolve(e)})}),n.handle=null,0==--e.delayedOperationsCount&&(e.delayedOperations=[])},a),this.delayedOperations.push(n),n.deferred.promise}return this.scheduleInternal(o)},e.prototype.scheduleInternal=function(n){var r=this;return this.tail=this.tail.then(function(){return r.operationInProgress=!0,n().catch(function(e){r.failure=e,r.operationInProgress=!1;var t=e.stack||e.message||"";throw o("INTERNAL UNHANDLED ERROR: ",t),0>t.indexOf("Firestore Test Simulated Error")&&setTimeout(function(){throw e},0),e}).then(function(){r.operationInProgress=!1})}),this.tail},e.prototype.verifyOperationInProgress=function(){Ho(this.operationInProgress,"verifyOpInProgress() called when no op in progress on this queue.")},e.prototype.drain=function(o){var t=this;return this.delayedOperations.forEach(function(e){e.handle&&(clearTimeout(e.handle),o?t.scheduleInternal(e.op).then(e.deferred.resolve,e.deferred.reject):e.deferred.reject(new Ht(Gt.CANCELLED,"Operation cancelled by shutdown")))}),this.delayedOperations=[],this.delayedOperationsCount=0,this.schedule(function(){return Promise.resolve()})},e}(),oo=function(){function e(e){this.uid=e}return e.prototype.isUnauthenticated=function(){return null==this.uid},e.prototype.toKey=function(){return this.isUnauthenticated()?"anonymous-user":"uid:"+this.uid},e.prototype.equals=function(e){return e.uid===this.uid},e.UNAUTHENTICATED=new e(null),e.GOOGLE_CREDENTIALS=new e("google-credentials-uid"),e.FIRST_PARTY=new e("first-party-uid"),e}(),io=function(){function e(n,o){this.user=o,this.type="OAuth",this.authHeaders={Authorization:"Bearer "+n}}return e}(),ao=function(){function e(){this.userListener=null}return e.prototype.getToken=function(){return Promise.resolve(null)},e.prototype.setUserChangeListener=function(e){Ho(!this.userListener,"Can only call setUserChangeListener() once."),this.userListener=e,e(oo.UNAUTHENTICATED)},e.prototype.removeUserChangeListener=function(){Ho(null!==this.userListener,"removeUserChangeListener() when no listener registered"),this.userListener=null},e}(),so=function(){function e(n){var o=this;this.app=n,this.tokenListener=null,this.userCounter=0,this.userListener=null,this.tokenListener=function(){var e=o.getUser();o.currentUser&&e.equals(o.currentUser)||(o.currentUser=e,o.userCounter++,o.userListener&&o.userListener(o.currentUser))},this.userCounter=0,this.app.INTERNAL.addAuthTokenListener(this.tokenListener)}return e.prototype.getToken=function(o){var r=this;Ho(null!=this.tokenListener,"getToken cannot be called after listener removed.");var e=this.userCounter;return this.app.INTERNAL.getToken(o).then(function(n){if(r.userCounter!==e)throw new Ht(Gt.ABORTED,"getToken aborted due to uid change.");return n?(Ho("string"==typeof n.accessToken,"Invalid tokenData returned from getToken():"+n),new io(n.accessToken,r.currentUser)):null})},e.prototype.setUserChangeListener=function(e){Ho(!this.userListener,"Can only call setUserChangeListener() once."),this.userListener=e,this.currentUser&&e(this.currentUser)},e.prototype.removeUserChangeListener=function(){Ho(null!=this.tokenListener,"removeUserChangeListener() called twice"),Ho(null!==this.userListener,"removeUserChangeListener() called when no listener registered"),this.app.INTERNAL.removeAuthTokenListener(this.tokenListener),this.tokenListener=null,this.userListener=null},e.prototype.getUser=function(){"function"!=typeof this.app.INTERNAL.getUid&&Wo("This version of the Firestore SDK requires at least version 3.7.0 of firebase.js.");var e=this.app.INTERNAL.getUid();return Ho(null===e||"string"==typeof e,"Received invalid UID: "+e),new oo(e)},e}(),uo=function(){function e(n,o){this.gapi=n,this.sessionIndex=o,this.type="FirstParty",this.user=oo.FIRST_PARTY,Ho(this.gapi&&this.gapi.auth&&this.gapi.auth.getAuthHeaderValueForFirstParty,"unexpected gapi interface")}return Object.defineProperty(e.prototype,"authHeaders",{get:function(){return{Authorization:this.gapi.auth.getAuthHeaderValueForFirstParty([]),"X-Goog-AuthUser":this.sessionIndex}},enumerable:!0,configurable:!0}),e}(),co=function(){function e(n,o){this.gapi=n,this.sessionIndex=o,Ho(this.gapi&&this.gapi.auth&&this.gapi.auth.getAuthHeaderValueForFirstParty,"unexpected gapi interface")}return e.prototype.getToken=function(){return Promise.resolve(new uo(this.gapi,this.sessionIndex))},e.prototype.setUserChangeListener=function(e){e(oo.FIRST_PARTY)},e.prototype.removeUserChangeListener=function(){},e}(),ho=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),lo=function(){function e(){}return e.delete=function(){return fo.instance},e.serverTimestamp=function(){return po.instance},e}(),fo=function(n){function t(){return n.call(this)||this}return ho(t,n),t.instance=new t,t}(lo),po=function(n){function t(){return n.call(this)||this}return ho(t,n),t.instance=new t,t}(lo),yo=s(lo,"Use FieldValue.<field>() instead."),Xr=/^__.*__$/,go=function(){function e(o,r,e){this.data=o,this.fieldMask=r,this.fieldTransforms=e}return e.prototype.toMutations=function(o,t){var e=[];return null===this.fieldMask?e.push(new rn(o,this.data,t)):e.push(new on(o,this.data,this.fieldMask,t)),0<this.fieldTransforms.length&&e.push(new an(o,this.fieldTransforms)),e},e}(),vo=function(){function e(o,r,e){this.data=o,this.fieldMask=r,this.fieldTransforms=e}return e.prototype.toMutations=function(o,t){var e=[new on(o,this.data,this.fieldMask,t)];return 0<this.fieldTransforms.length&&e.push(new an(o,this.fieldTransforms)),e},e}(),bo;!function(e){e[e.Set=0]="Set",e[e.Update=1]="Update",e[e.MergeSet=2]="MergeSet",e[e.QueryValue=3]="QueryValue"}(bo||(bo={}));var Gr=function(){function o(a,s,e,n,r,o){this.dataSource=a,this.methodName=s,this.path=e,this.arrayElement=n,void 0===r&&this.validatePath(),this.arrayElement=void 0!==n&&n,this.fieldTransforms=r||[],this.fieldMask=o||[]}return o.prototype.childContextForField=function(t){var e=null==this.path?null:this.path.child(t),n=new o(this.dataSource,this.methodName,e,!1,this.fieldTransforms,this.fieldMask);return n.validatePathSegment(t),n},o.prototype.childContextForFieldPath=function(t){var e=null==this.path?null:this.path.child(t),n=new o(this.dataSource,this.methodName,e,!1,this.fieldTransforms,this.fieldMask);return n.validatePath(),n},o.prototype.childContextForArray=function(){return new o(this.dataSource,this.methodName,null,!0,this.fieldTransforms,this.fieldMask)},o.prototype.createError=function(n){var t=null===this.path||this.path.isEmpty()?"":" (found in field "+this.path+")";return new Ht(Gt.INVALID_ARGUMENT,"Function "+this.methodName+"() called with invalid data. "+n+t)},o.prototype.validatePath=function(){if(null!==this.path)for(var e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))},o.prototype.validatePathSegment=function(e){if(wt(this.dataSource)&&Xr.test(e))throw this.createError("Document fields cannot begin and end with __")},o.prototype.isWrite=function(){return this.dataSource===bo.Set||this.dataSource===bo.Update},o}(),wo=function(){function e(n,o){this.databaseId=n,this.key=o}return e}(),Io=function(){function e(e){this.preConverter=e}return e.prototype.parseSetData=function(o,t){var e=new Gr(bo.Set,o,ie.EMPTY_PATH);Nt("Data must be an object, but it was:",e,t);var n=this.parseData(t,e);return new go(n,null,e.fieldTransforms)},e.prototype.parseMergeData=function(a,t){var e=new Gr(bo.MergeSet,a,ie.EMPTY_PATH);Nt("Data must be an object, but it was:",e,t);var n=this.parseData(t,e),r=new Ye(e.fieldMask);return new go(n,r,e.fieldTransforms)},e.prototype.parseUpdateData=function(d,t){var l=this,n=new Gr(bo.Update,d,ie.EMPTY_PATH);Nt("Data must be an object, but it was:",n,t);var r=[],e=Ne.EMPTY;p(t,function(t,o){var a=Rt(d,t),i=n.childContextForFieldPath(a);if((o=l.runPreConverter(o,i))instanceof fo)r.push(a);else{var s=l.parseData(o,i);null!=s&&(r.push(a),e=e.set(a,s))}});var o=new Ye(r);return new vo(e,o,n.fieldTransforms)},e.prototype.parseUpdateVarargs=function(m,t,e,n){var r=new Gr(bo.Update,m,ie.EMPTY_PATH),o=[At(m,t)],i=[e];if(0!=n.length%2)throw new Ht(Gt.INVALID_ARGUMENT,"Function "+m+"() needs to be called with an even number of arguments that alternate between field names and values.");for(var a=0;a<n.length;a+=2)o.push(At(m,n[a])),i.push(n[a+1]);for(var s=[],u=Ne.EMPTY,a=0;a<o.length;++a){var c=o[a],h=r.childContextForFieldPath(c),l=this.runPreConverter(i[a],h);if(l instanceof fo)s.push(c);else{var g=this.parseData(l,h);null!=g&&(s.push(c),u=u.set(c,g))}}var d=new Ye(s);return new vo(u,d,r.fieldTransforms)},e.prototype.parseQueryValue=function(o,t){var e=new Gr(bo.QueryValue,o,ie.EMPTY_PATH),n=this.parseData(t,e);return Ho(null!=n,"Parsed data should not be null."),Ho(0===e.fieldTransforms.length,"Field transforms should have been disallowed."),n},e.prototype.runPreConverter=function(o,r){try{return this.preConverter(o)}catch(n){var e=Ot(n);throw r.createError(e)}},e.prototype.parseData=function(n,t){if((n=this.runPreConverter(n,t))instanceof Array){if(t.arrayElement)throw t.createError("Nested arrays are not supported");return t.path&&t.fieldMask.push(t.path),this.parseArray(n,t)}return It(n)?(Nt("Unsupported field value:",t,n),this.parseObject(n,t)):(t.path&&t.fieldMask.push(t.path),this.parseScalarValue(n,t))},e.prototype.parseArray=function(d,t){for(var e=[],n=0,r=0,o=d;r<o.length;r++){var i=o[r],a=this.parseData(i,t.childContextForArray(n));null==a&&(a=ge.INSTANCE),e.push(a),n++}return new Ae(e)},e.prototype.parseObject=function(o,a){var e=this,n=new ce(P);return p(o,function(r,t){var o=e.parseData(t,a.childContextForField(r));null!=o&&(n=n.insert(r,o))}),new Ne(n)},e.prototype.parseScalarValue=function(n,o){if(null===n)return ge.INSTANCE;if("number"==typeof n)return j(n)?new we(n):new Ie(n);if("boolean"==typeof n)return ve.of(n);if("string"==typeof n)return new Te(n);if(n instanceof Date)return new Ee(We.fromDate(n));if(n instanceof Go)return new ke(n);if(n instanceof Xt)return new Ce(n);if(n instanceof wo)return new De(n.databaseId,n.key);if(n instanceof lo){if(n instanceof fo){if(o.dataSource==bo.MergeSet)return null;throw o.dataSource===bo.Update?(Ho(null==o.path||0<o.path.length,"FieldValue.delete() at the top level should have already been handled."),o.createError("FieldValue.delete() can only appear at the top level of your update data")):o.createError("FieldValue.delete() can only be used with update() and set() with {merge:true}")}if(n instanceof po){if(!wt(o.dataSource))throw o.createError("FieldValue.serverTimestamp() can only be used with set() and update()");if(null===o.path)throw o.createError("FieldValue.serverTimestamp() is not currently supported inside arrays");return o.fieldTransforms.push(new $e(o.path,Je.instance)),null}return Wo("Unknown FieldValue type: "+n)}throw o.createError("Unsupported field value: "+k(n))},e}(),To=this&&this.__extends||function(){var o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(o,t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e])};return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}}(),Eo=!0,Co=function(){function e(e){if(void 0===e.host){if(void 0!==e.ssl)throw new Ht(Gt.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=Eo}else E("settings","string","host",e.host),this.host=e.host,S("settings","boolean","ssl",e.ssl),this.ssl=c(e.ssl,Eo);N("settings",e,["host","ssl","credentials"]),S("settings","object","credentials",e.credentials),this.credentials=e.credentials}return e.prototype.equals=function(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials},e}(),Do=function(){return function(){}}(),ko=function(){function a(t){var e=this;this.k=new ro,this.INTERNAL={delete:function(){return e._?e._.shutdown():Promise.resolve()},disableNetwork:function(){return e._.disableNetwork()},enableNetwork:function(){return e._.enableNetwork()},drainAsyncQueue:function(n){return e.k.drain(n)}};var n=new Do;if("object"==typeof t.options){var r=t;n.firebaseApp=r,n.databaseId=a.databaseIdFromApp(r),n.persistenceKey=n.firebaseApp.name,n.credentials=new so(r)}else{var o=t;if(!o.projectId)throw new Ht(Gt.INVALID_ARGUMENT,"Must provide projectId");n.databaseId=new te(o.projectId,o.database),n.persistenceKey="[DEFAULT]",n.credentials=new ao}n.settings=new Co({}),this.x=n,this._databaseId=n.databaseId}return a.prototype.settings=function(n){if(m("Firestore.settings",arguments,1),b("Firestore.settings","object",1,n),l(n,"persistence"))throw new Ht(Gt.INVALID_ARGUMENT,"\"persistence\" is now specified with a separate call to firestore.enablePersistence().");var t=new Co(n);if(this._&&!this.x.settings.equals(t))throw new Ht(Gt.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.");this.x.settings=t,void 0!==t.credentials&&(this.x.credentials=Ct(t.credentials))},a.prototype.enablePersistence=function(){if(this._)throw new Ht(Gt.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.");return this.configureClient(!0)},a.prototype.ensureClientConfigured=function(){return this._||this.configureClient(!1),this._},a.prototype.configureClient=function(o){var a=this;Ho(!!this.x.settings.host,"FirestoreSettings.host cannot be falsey"),Ho(!this._,"configureClient() called multiple times");var e=new Xo(this.x.databaseId,this.x.persistenceKey,this.x.settings.host,this.x.settings.ssl);return this._dataConverter=new Io(function(e){if(e instanceof Ro){var t=a.x.databaseId,n=e.firestore.x.databaseId;if(!n.equals(t))throw new Ht(Gt.INVALID_ARGUMENT,"Document reference is for database "+n.projectId+"/"+n.database+" but should be for database "+t.projectId+"/"+t.database);return new wo(a.x.databaseId,e.q)}return e}),this._=new eo(Kt.getPlatform(),e,this.x.credentials,this.k),this._.start(o)},a.databaseIdFromApp=function(o){var t=o.options;if(!l(t,"projectId")){if(l(t,"firestoreId"))throw new Ht(Gt.INVALID_ARGUMENT,"\"firestoreId\" is now specified as \"projectId\" in firebase.initializeApp.");throw new Ht(Gt.INVALID_ARGUMENT,"\"projectId\" not provided in firebase.initializeApp.")}if(l(t,"firestoreOptions"))throw new Ht(Gt.INVALID_ARGUMENT,"\"firestoreOptions\" values are now specified with Firestore.settings()");var e=t.projectId;if(!e||"string"!=typeof e)throw new Ht(Gt.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new te(e)},Object.defineProperty(a.prototype,"app",{get:function(){if(!this.x.firebaseApp)throw new Ht(Gt.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.x.firebaseApp},enumerable:!0,configurable:!0}),a.prototype.collection=function(e){if(m("Firestore.collection",arguments,1),b("Firestore.collection","string",1,e),!e)throw new Ht(Gt.INVALID_ARGUMENT,"Must provide a non-empty collection path to collection()");return this.ensureClientConfigured(),new Po(re.fromString(e),this)},a.prototype.doc=function(e){if(m("Firestore.doc",arguments,1),b("Firestore.doc","string",1,e),!e)throw new Ht(Gt.INVALID_ARGUMENT,"Must provide a non-empty document path to doc()");return this.ensureClientConfigured(),Ro.forPath(re.fromString(e),this)},a.prototype.runTransaction=function(o){var t=this;return m("Firestore.runTransaction",arguments,1),b("Firestore.runTransaction","function",1,o),this.ensureClientConfigured().transaction(function(e){return o(new No(t,e))})},a.prototype.batch=function(){return this.ensureClientConfigured(),new Ao(this)},Object.defineProperty(a,"logLevel",{get:function(){switch(n()){case Qt.DEBUG:return"debug";case Qt.ERROR:return"error";case Qt.SILENT:return"silent";default:return Wo("Unknown log level: "+n());}},enumerable:!0,configurable:!0}),a.setLogLevel=function(e){switch(m("Firestore.setLogLevel",arguments,1),b("Firestore.setLogLevel","string",1,e),e){case"debug":r(Qt.DEBUG);break;case"error":r(Qt.ERROR);break;case"silent":r(Qt.SILENT);break;default:throw new Ht(Gt.INVALID_ARGUMENT,"Invalid log level: "+e);}},a}(),No=function(){function e(n,o){this.Q=n,this.z=o}return e.prototype.get=function(o){var a=this;m("Transaction.get",arguments,1);var e=Lt("Transaction.get",o,this.Q);return this.z.lookup([e.q]).then(function(n){if(!n||1!==n.length)return Wo("Mismatch in docs returned from document lookup.");var o=n[0];return o instanceof ue?new Oo(a.Q,e.q,null,!1):new Oo(a.Q,e.q,o,!1)})},e.prototype.set=function(a,t,e){f("Transaction.set",arguments,2,3);var n=Lt("Transaction.set",a,this.Q);e=Pt("Transaction.set",e);var r=e.merge?this.Q._dataConverter.parseMergeData("Transaction.set",t):this.Q._dataConverter.parseSetData("Transaction.set",t);return this.z.set(n.q,r),this},e.prototype.update=function(s,t,d){for(var n=[],r=3;r<arguments.length;r++)n[r-3]=arguments[r];var o,i;return"string"==typeof t||t instanceof Pn?(g("Transaction.update",arguments,3),o=Lt("Transaction.update",s,this.Q),i=this.Q._dataConverter.parseUpdateVarargs("Transaction.update",t,d,n)):(m("Transaction.update",arguments,2),o=Lt("Transaction.update",s,this.Q),i=this.Q._dataConverter.parseUpdateData("Transaction.update",t)),this.z.update(o.q,i),this},e.prototype.delete=function(n){m("Transaction.delete",arguments,1);var t=Lt("Transaction.delete",n,this.Q);return this.z.delete(t.q),this},e}(),Ao=function(){function e(e){this.Q=e,this.tt=[],this.et=!1}return e.prototype.set=function(a,t,e){f("WriteBatch.set",arguments,2,3),this.verifyNotCommitted();var n=Lt("WriteBatch.set",a,this.Q);e=Pt("WriteBatch.set",e);var r=e.merge?this.Q._dataConverter.parseMergeData("WriteBatch.set",t):this.Q._dataConverter.parseSetData("WriteBatch.set",t);return this.tt=this.tt.concat(r.toMutations(n.q,ze.NONE)),this},e.prototype.update=function(s,t,d){for(var n=[],r=3;r<arguments.length;r++)n[r-3]=arguments[r];this.verifyNotCommitted();var o,i;return"string"==typeof t||t instanceof Pn?(g("WriteBatch.update",arguments,3),o=Lt("WriteBatch.update",s,this.Q),i=this.Q._dataConverter.parseUpdateVarargs("WriteBatch.update",t,d,n)):(m("WriteBatch.update",arguments,2),o=Lt("WriteBatch.update",s,this.Q),i=this.Q._dataConverter.parseUpdateData("WriteBatch.update",t)),this.tt=this.tt.concat(i.toMutations(o.q,ze.exists(!0))),this},e.prototype.delete=function(n){m("WriteBatch.delete",arguments,1),this.verifyNotCommitted();var t=Lt("WriteBatch.delete",n,this.Q);return this.tt=this.tt.concat(new sn(t.q,ze.NONE)),this},e.prototype.commit=function(){return this.verifyNotCommitted(),this.et=!0,0<this.tt.length?this.Q.ensureClientConfigured().write(this.tt):Promise.resolve()},e.prototype.verifyNotCommitted=function(){if(this.et)throw new Ht(Gt.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},e}(),Ro=function(){function o(n,o){this.q=n,this.firestore=o,this._=this.firestore.ensureClientConfigured()}return o.forPath=function(t,e){if(0!=t.length%2)throw new Ht(Gt.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.canonicalString()+" has "+t.length);return new o(new ae(t),e)},Object.defineProperty(o.prototype,"id",{get:function(){return this.q.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"parent",{get:function(){return new Po(this.q.path.popLast(),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"path",{get:function(){return this.q.path.canonicalString()},enumerable:!0,configurable:!0}),o.prototype.collection=function(n){if(m("DocumentReference.collection",arguments,1),b("DocumentReference.collection","string",1,n),!n)throw new Ht(Gt.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var o=re.fromString(n);return new Po(this.q.path.child(o),this.firestore)},o.prototype.isEqual=function(t){if(!(t instanceof o))throw A("isEqual","DocumentReference",1,t);return this.firestore===t.firestore&&this.q.equals(t.q)},o.prototype.set=function(o,t){f("DocumentReference.set",arguments,1,2),t=Pt("DocumentReference.set",t);var e=t.merge?this.firestore._dataConverter.parseMergeData("DocumentReference.set",o):this.firestore._dataConverter.parseSetData("DocumentReference.set",o);return this._.write(e.toMutations(this.q,ze.NONE))},o.prototype.update=function(a,i){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];var r;return"string"==typeof a||a instanceof Pn?(g("DocumentReference.update",arguments,2),r=this.firestore._dataConverter.parseUpdateVarargs("DocumentReference.update",a,i,e)):(m("DocumentReference.update",arguments,1),r=this.firestore._dataConverter.parseUpdateData("DocumentReference.update",a)),this._.write(r.toMutations(this.q,ze.exists(!0)))},o.prototype.delete=function(){return m("DocumentReference.delete",arguments,0),this._.write([new sn(this.q,ze.NONE)])},o.prototype.onSnapshot=function(){for(var a=[],t=0;t<arguments.length;t++)a[t]=arguments[t];f("DocumentReference.onSnapshot",arguments,1,4);var e={includeMetadataChanges:!1},r=0,o;"object"!=typeof a[r]||Tt(a[r])||(e=a[r],N("DocumentReference.onSnapshot",e,["includeMetadataChanges"]),S("DocumentReference.onSnapshot","boolean","includeMetadataChanges",e.includeMetadataChanges),r++);var n={includeDocumentMetadataChanges:e.includeMetadataChanges,includeQueryMetadataChanges:e.includeMetadataChanges};return Tt(a[r])?o=a[r]:(b("DocumentReference.onSnapshot","function",r,a[r]),v("DocumentReference.onSnapshot","function",r+1,a[r+1]),v("DocumentReference.onSnapshot","function",r+2,a[r+2]),o={next:a[r],error:a[r+1],complete:a[r+2]}),this.onSnapshotInternal(n,o)},o.prototype.onSnapshotInternal=function(a,s){var e=this,t=function(e){console.error("Uncaught Error in onSnapshot:",e)};s.error&&(t=s.error.bind(s));var n=new no({next:function(n){if(s.next){Ho(1>=n.docs.size,"Too many documents returned on a document query");var t=n.docs.get(e.q);s.next(new Oo(e.firestore,e.q,t,n.fromCache))}},error:t}),o=this._.listen(Pe.atPath(this.q.path),n,a);return function(){n.mute(),e._.unlisten(o)}},o.prototype.get=function(){var o=this;return m("DocumentReference.get",arguments,0),new Promise(function(a,e){var i=o.onSnapshotInternal({includeQueryMetadataChanges:!0,includeDocumentMetadataChanges:!0,waitForSyncWhenOnline:!0},{next:function(n){i(),!n.exists&&n.metadata.fromCache?e(new Ht(Gt.ABORTED,"Failed to get document because the client is offline.")):a(n)},error:e})})},o}(),Oo=function(){function e(o,a,e,n){this.Q=o,this.q=a,this.nt=e,this.rt=n}return e.prototype.data=function(){if(m("DocumentSnapshot.data",arguments,0),!this.nt)throw new Ht(Gt.NOT_FOUND,"This document doesn't exist. Check doc.exists to make sure the document exists before calling doc.data().");return this.convertObject(this.nt.data)},e.prototype.get=function(n){if(m("DocumentSnapshot.get",arguments,1),!this.nt)throw new Ht(Gt.NOT_FOUND,"This document doesn't exist. Check doc.exists to make sure the document exists before calling doc.get().");var t=this.nt.data.field(At("DocumentSnapshot.get",n));return void 0===t?void 0:this.convertValue(t)},Object.defineProperty(e.prototype,"id",{get:function(){return this.q.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ref",{get:function(){return new Ro(this.q,this.Q)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exists",{get:function(){return null!==this.nt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"metadata",{get:function(){return{hasPendingWrites:null!==this.nt&&this.nt.hasLocalMutations,fromCache:this.rt}},enumerable:!0,configurable:!0}),e.prototype.convertObject=function(o){var a=this,e={};return o.forEach(function(n,t){e[n]=a.convertValue(t)}),e},e.prototype.convertValue=function(r){if(r instanceof Ne)return this.convertObject(r);if(r instanceof Ae)return this.convertArray(r);if(r instanceof De){var t=r.value(),e=this.Q.ensureClientConfigured().databaseId();return r.databaseId.equals(e)||o("Document "+this.q.path+" contains a document reference within a different database ("+r.databaseId.projectId+"/"+r.databaseId.database+") which is not supported. It will be treated as a reference in the current database ("+e.projectId+"/"+e.database+") instead."),new Ro(t,this.Q)}return r.value()},e.prototype.convertArray=function(n){var o=this;return n.internalValue.map(function(e){return o.convertValue(e)})},e}(),Mo=function(){function s(n,o){this.ot=n,this.firestore=o}return s.prototype.where=function(t,e,n){m("Query.where",arguments,3),b("Query.where","string",2,e),I("Query.where",3,n);var d=At("Query.where",t),i;if(!d.isKeyField())i=this.firestore._dataConverter.parseQueryValue("Query.where",n);else if("string"==typeof n){if(-1!==n.indexOf("/"))throw new Ht(Gt.INVALID_ARGUMENT,"Function Query.where() requires its third parameter to be a valid document ID if the first parameter is FieldPath.documentId(), but it contains a slash.");if(""===n)throw new Ht(Gt.INVALID_ARGUMENT,"Function Query.where() requires its third parameter to be a valid document ID if the first parameter is FieldPath.documentId(), but it was an empty string.");var o=this.ot.path.child(new re([n]));Ho(0==o.length%2,"Path should be a document key"),i=new De(this.firestore._databaseId,new ae(o))}else{if(!(n instanceof Ro))throw new Ht(Gt.INVALID_ARGUMENT,"Function Query.where() requires its third parameter to be a string or a DocumentReference if the first parameter is FieldPath.documentId(), but it was: "+k(n)+".");i=new De(this.firestore._databaseId,n.q)}var a=W(d,Le.fromString(e),i);return this.validateNewFilter(a),new s(this.ot.addFilter(a),this.firestore)},s.prototype.orderBy=function(t,e){f("Query.orderBy",arguments,1,2),v("Query.orderBy","string",2,e);var n;if(void 0===e||"asc"===e)n=Fe.ASCENDING;else{if("desc"!==e)throw new Ht(Gt.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+e+"', expected 'asc' or 'desc'.");n=Fe.DESCENDING}if(null!==this.ot.startAt)throw new Ht(Gt.INVALID_ARGUMENT,"Invalid query. You must not call Query.startAt() or Query.startAfter() before calling Query.orderBy().");if(null!==this.ot.endAt)throw new Ht(Gt.INVALID_ARGUMENT,"Invalid query. You must not call Query.endAt() or Query.endBefore() before calling Query.orderBy().");var r=At("Query.orderBy",t),o=new qe(r,n);return this.validateNewOrderBy(o),new s(this.ot.addOrderBy(o),this.firestore)},s.prototype.limit=function(t){if(m("Query.limit",arguments,1),b("Query.limit","number",1,t),0>=t)throw new Ht(Gt.INVALID_ARGUMENT,"Invalid Query. Query limit ("+t+") is invalid. Limit must be positive.");return new s(this.ot.withLimit(t),this.firestore)},s.prototype.startAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];g("Query.startAt",arguments,1);var r=this.boundFromDocOrFields("Query.startAt",t,e,!0);return new s(this.ot.withStartAt(r),this.firestore)},s.prototype.startAfter=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];g("Query.startAfter",arguments,1);var r=this.boundFromDocOrFields("Query.startAfter",t,e,!1);return new s(this.ot.withStartAt(r),this.firestore)},s.prototype.endBefore=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];g("Query.endBefore",arguments,1);var r=this.boundFromDocOrFields("Query.endBefore",t,e,!0);return new s(this.ot.withEndAt(r),this.firestore)},s.prototype.endAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];g("Query.endAt",arguments,1);var r=this.boundFromDocOrFields("Query.endAt",t,e,!1);return new s(this.ot.withEndAt(r),this.firestore)},s.prototype.isEqual=function(t){if(!(t instanceof s))throw A("isEqual","Query",1,t);return this.firestore===t.firestore&&this.ot.equals(t.ot)},s.prototype.boundFromDocOrFields=function(a,t,e,n){if(I(a,1,t),t instanceof Oo){if(0<e.length)throw new Ht(Gt.INVALID_ARGUMENT,"Too many arguments provided to "+a+"().");var r=t;if(!r.exists)throw new Ht(Gt.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+a+"().");return this.boundFromDocument(a,r.nt,n)}var o=[t].concat(e);return this.boundFromFields(a,o,n)},s.prototype.boundFromDocument=function(d,t,e){for(var n=[],r=0,o=this.ot.orderBy,i;r<o.length;r++)if(i=o[r],i.field.isKeyField())n.push(new De(this.firestore._databaseId,t.key));else{var a=t.field(i.field);if(void 0===a){var s=i.field.canonicalString();throw new Ht(Gt.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+s+"' (used as the orderBy) does not exist.")}n.push(a)}return new Ve(n,e)},s.prototype.boundFromFields=function(d,t,e){var n=this.ot.explicitOrderBy;if(t.length>n.length)throw new Ht(Gt.INVALID_ARGUMENT,"Too many arguments provided to "+d+"(). The number of arguments must be less than or equal to the number of Query.orderBy() clauses");for(var r=[],o=0,i;o<t.length;o++)if(i=t[o],n[o].field.isKeyField()){if("string"!=typeof i)throw new Ht(Gt.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+d+"(), but got a "+typeof i);if(-1!==i.indexOf("/"))throw new Ht(Gt.INVALID_ARGUMENT,"Invalid query. Document ID '"+i+"' contains a slash in "+d+"()");var l=new ae(this.ot.path.child(i));r.push(new De(this.firestore._databaseId,l))}else{var s=this.firestore._dataConverter.parseQueryValue(d,i);r.push(s)}return new Ve(r,e)},s.prototype.onSnapshot=function(){for(var a=[],t=0;t<arguments.length;t++)a[t]=arguments[t];f("Query.onSnapshot",arguments,1,4);var e={},r=0,o;return"object"!=typeof a[r]||Tt(a[r])||(e=a[r],N("Query.onSnapshot",e,["includeQueryMetadataChanges","includeDocumentMetadataChanges"]),S("Query.onSnapshot","boolean","includeDocumentMetadataChanges",e.includeDocumentMetadataChanges),S("Query.onSnapshot","boolean","includeQueryMetadataChanges",e.includeQueryMetadataChanges),r++),Tt(a[r])?o=a[r]:(b("Query.onSnapshot","function",r,a[r]),v("Query.onSnapshot","function",r+1,a[r+1]),v("Query.onSnapshot","function",r+2,a[r+2]),o={next:a[r],error:a[r+1],complete:a[r+2]}),this.onSnapshotInternal(e,o)},s.prototype.onSnapshotInternal=function(s,d){var e=this,t=function(e){console.error("Uncaught Error in onSnapshot:",e)};d.error&&(t=d.error.bind(d));var n=new no({next:function(n){d.next&&d.next(new _o(e.firestore,e.ot,n))},error:t}),o=this.firestore.ensureClientConfigured(),i=o.listen(this.ot,n,s);return function(){n.mute(),o.unlisten(i)}},s.prototype.get=function(){var o=this;return m("Query.get",arguments,0),new Promise(function(a,e){var i=o.onSnapshotInternal({includeDocumentMetadataChanges:!1,includeQueryMetadataChanges:!0,waitForSyncWhenOnline:!0},{next:function(e){i(),a(e)},error:e})})},s.prototype.validateNewFilter=function(o){if(o instanceof xe&&o.isInequality()){var t=this.ot.getInequalityFilterField();if(null!==t&&!t.equals(o.field))throw new Ht(Gt.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+t+"' and '"+o.field+"'");var e=this.ot.getFirstOrderByField();null!==e&&this.validateOrderByAndInequalityMatch(o.field,e)}},s.prototype.validateNewOrderBy=function(n){if(null===this.ot.getFirstOrderByField()){var t=this.ot.getInequalityFilterField();null!==t&&this.validateOrderByAndInequalityMatch(t,n.field)}},s.prototype.validateOrderByAndInequalityMatch=function(n,t){if(!t.equals(n))throw new Ht(Gt.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+n+"' and so you must also use '"+n+"' as your first Query.orderBy(), but your first Query.orderBy() is on field '"+t+"' instead.")},s}(),_o=function(){function e(o,r,e){this.Q=o,this.it=r,this.at=e,this._cachedChanges=null,this.metadata={fromCache:e.fromCache,hasPendingWrites:e.hasPendingWrites}}return Object.defineProperty(e.prototype,"docs",{get:function(){var n=[];return this.forEach(function(t){return n.push(t)}),n},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"empty",{get:function(){return this.at.docs.isEmpty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.at.docs.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(o,t){var e=this;f("QuerySnapshot.forEach",arguments,1,2),b("QuerySnapshot.forEach","function",1,o),this.at.docs.forEach(function(n){o.call(t,e.convertToDocumentImpl(n))})},Object.defineProperty(e.prototype,"query",{get:function(){return new Mo(this.it,this.Q)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"docChanges",{get:function(){return this._cachedChanges||(this._cachedChanges=xt(this.Q,this.at)),this._cachedChanges},enumerable:!0,configurable:!0}),e.prototype.convertToDocumentImpl=function(e){return new Oo(this.Q,e.key,e,this.metadata.fromCache)},e}(),Po=function(o){function t(t,a){var n=o.call(this,Pe.atPath(t),a)||this;if(1!=t.length%2)throw new Ht(Gt.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.canonicalString()+" has "+t.length);return n}return To(t,o),Object.defineProperty(t.prototype,"id",{get:function(){return this.ot.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){var e=this.ot.path.popLast();return e.isEmpty()?null:new Ro(new ae(e),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return this.ot.path.canonicalString()},enumerable:!0,configurable:!0}),t.prototype.doc=function(n){if(f("CollectionReference.doc",arguments,0,1),0===arguments.length&&(n=zt.newId()),b("CollectionReference.doc","string",1,n),""===n)throw new Ht(Gt.INVALID_ARGUMENT,"Document path must be a non-empty string");var t=re.fromString(n);return Ro.forPath(this.ot.path.child(t),this.firestore)},t.prototype.add=function(n){m("CollectionReference.add",arguments,1),b("CollectionReference.add","object",1,n);var t=this.doc();return t.set(n).then(function(){return t})},t}(Mo),Lo=s(ko,"Use firebase.firestore() instead."),Qr=s(No,"Use firebase.firestore().runTransaction() instead."),Yr=s(Ao,"Use firebase.firestore().batch() instead."),Jr=s(Ro,"Use firebase.firestore().doc() instead."),$r=s(Oo),Zr=s(Mo),ea=s(_o),ta=s(Po,"Use firebase.firestore().collection() instead."),na={Firestore:Lo,GeoPoint:Go,Blob:Yt,Transaction:Qr,WriteBatch:Yr,DocumentReference:Jr,DocumentSnapshot:$r,Query:Zr,QuerySnapshot:ea,CollectionReference:ta,FieldPath:Pn,FieldValue:yo,setLogLevel:ko.setLogLevel};t.registerFirestore=Mt,Mt(zo.default)},115:function(e,t,n){var a=Math.floor,d=Math.max;(function(t){(function(){function s(e){return"string"==typeof e}function o(){}function i(o){var r=typeof o;if("object"==r){if(!o)return"null";if(o instanceof Array)return"array";if(o instanceof Object)return r;var e=Object.prototype.toString.call(o);if("[object Window]"==e)return"object";if("[object Array]"==e||"number"==typeof o.length&&void 0!==o.splice&&void 0!==o.propertyIsEnumerable&&!o.propertyIsEnumerable("splice"))return"array";if("[object Function]"==e||void 0!==o.call&&void 0!==o.propertyIsEnumerable&&!o.propertyIsEnumerable("call"))return"function"}else if("function"==r&&void 0===o.call)return"object";return r}function l(e){return"array"==i(e)}function c(n){var t=i(n);return"array"==t||"object"==t&&"number"==typeof n.length}function h(e){return"function"==i(e)}function m(n){var o=typeof n;return"object"==o&&null!=n||"function"==o}function n(e){return e.call.apply(e.bind,arguments)}function p(o,a){if(!o)throw Error();if(2<arguments.length){var e=Array.prototype.slice.call(arguments,2);return function(){var t=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(t,e),o.apply(a,t)}}return function(){return o.apply(a,arguments)}}function f(){return f=Function.prototype.bind&&-1!=(""+Function.prototype.bind).indexOf("native code")?n:p,f.apply(null,arguments)}function b(o){var t=Array.prototype.slice.call(arguments,1);return function(){var n=t.slice();return n.push.apply(n,arguments),o.apply(this,n)}}function r(o,r){function e(){}e.prototype=r.prototype,o.L=r.prototype,o.prototype=new e,o.prototype.constructor=o,o.Ab=function(e,t){for(var n=Array(arguments.length-2),o=2;o<arguments.length;o++)n[o-2]=arguments[o];return r.prototype[t].apply(e,n)}}function u(n){if(Error.captureStackTrace)Error.captureStackTrace(this,u);else{var t=Error().stack;t&&(this.stack=t)}n&&(this.message=n+"")}function v(e){for(var t=e.split("%s"),n="",r=Array.prototype.slice.call(arguments,1);r.length&&1<t.length;)n+=t.shift()+r.shift();return n+t.join("%s")}function _(n,t){return n<t?-1:n>t?1:0}function j(n,t){t.unshift(n),u.call(this,v.apply(null,t)),t.shift()}function G(e){throw new j("Failure"+(e?": "+e:""),Array.prototype.slice.call(arguments,1))}function $(){0!=Ao&&(Lo[this[k]||(this[k]=++q)]=this),this.i=this.i,this.w=this.w}function w(a){t:{for(var t=qe,e=a.length,n=s(a)?a.split(""):a,r=0;r<e;r++)if(r in n&&t.call(void 0,n[r],r,a)){t=r;break t}t=-1}return 0>t?null:s(a)?a.charAt(t):a[t]}function Z(n){if(!l(n))for(var t=n.length-1;0<=t;t--)delete n[t];n.length=0}function _e(){return Array.prototype.concat.apply([],arguments)}function et(o){var t=o.length;if(0<t){for(var e=Array(t),n=0;n<t;n++)e[n]=o[n];return e}return[]}function tt(e){return-1!=Po.indexOf(e)}function y(o,t,e){for(var n in o)t.call(e,o[n],n,o)}function nt(o){var t=[],n=0,r;for(r in o)t[n++]=o[r];return t}function ot(o){var t=[],n=0,r;for(r in o)t[n++]=r;return t}function rt(o){var t={},n;for(n in o)t[n]=o[n];return t}function at(e){for(var t=1,o,n;t<arguments.length;t++){for(o in n=arguments[t],n)e[o]=n[o];for(var r=0;r<Do.length;r++)o=Do[r],Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}}function it(e){return it[" "](e),e}function st(o,t){var e=zo;return Object.prototype.hasOwnProperty.call(e,o)?e[o]:e[o]=t(o)}function dt(){var e=Io.document;return e?e.documentMode:void 0}function lt(l){return st(l,function(){for(var t=0,e=g(Wo+"").split("."),n=g(l+"").split("."),r=d(e.length,n.length),o=0;0==t&&o<r;o++){var i=e[o]||"",a=n[o]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],a=/(\d*)(\D*)(.*)/.exec(a)||["","","",""],0==i[0].length&&0==a[0].length)break;t=_(0==i[1].length?0:parseInt(i[1],10),0==a[1].length?0:parseInt(a[1],10))||_(0==i[2].length,0==a[2].length)||_(i[2],a[2]),i=i[3],a=a[3]}while(0==t)}return 0<=t})}function pt(n,t){this.type=n,this.a=this.target=t,this.Pa=!0}function A(a,t){if(pt.call(this,a?a.type:""),this.relatedTarget=this.a=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.pointerId=0,this.pointerType="",this.c=null,a){var e=this.type=a.type,n=a.changedTouches?a.changedTouches[0]:null;if(!(this.target=a.target||a.srcElement,this.a=t,t=a.relatedTarget))"mouseover"==e?t=a.fromElement:"mouseout"==e&&(t=a.toElement);else if(Uo){t:{try{it(t.nodeName);var r=!0;break t}catch(e){}r=!1}r||(t=null)}this.relatedTarget=t,null===n?(this.clientX=void 0===a.clientX?a.pageX:a.clientX,this.clientY=void 0===a.clientY?a.pageY:a.clientY,this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.clientX=void 0===n.clientX?n.pageX:n.clientX,this.clientY=void 0===n.clientY?n.pageY:n.clientY,this.screenX=n.screenX||0,this.screenY=n.screenY||0),this.button=a.button,this.key=a.key||"",this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.pointerId=a.pointerId||0,this.pointerType=s(a.pointerType)?a.pointerType:$o[a.pointerType]||"",this.c=a,a.defaultPrevented&&this.b()}}function ct(e){return e&&e[Zo]}function ut(a,t,e,n,i){this.listener=a,this.a=null,this.src=t,this.type=e,this.capture=!!n,this.ga=i,this.key=++er,this.Y=this.ca=!1}function ht(e){e.Y=!0,e.listener=null,e.a=null,e.src=null,e.ga=null}function mt(e){this.src=e,this.a={},this.b=0}function gt(a,t){var e=t.type;if(e in a.a){var n=a.a[e],o=Ro(n,t),i;(i=0<=o)&&Array.prototype.splice.call(n,o,1),i&&(ht(t),0==a.a[e].length&&(delete a.a[e],a.b--))}}function ft(a,t,e,n,r){return a=a.a[""+t],t=-1,a&&(t=yt(a,e,n,r)),-1<t?a[t]:null}function yt(a,t,e,s){for(var r=0,o;r<a.length;++r)if(o=a[r],!o.Y&&o.listener==t&&o.capture==!!e&&o.ga==s)return r;return-1}function bt(n,t,e,r,s){if(r&&r.once)return Ct(n,t,e,r,s);if(l(t)){for(var i=0;i<t.length;i++)bt(n,t[i],e,r,s);return null}return e=At(e),ct(n)?n.aa(t,e,m(r)?!!r.capture:!!r,s):vt(n,t,e,!1,r,s)}function vt(d,t,l,n,r,p){if(!t)throw Error("Invalid event type");var i=m(r)?!!r.capture:!!r,a=Nt(d);if(a||(d[tr]=a=new mt(d)),l=a.add(t,l,n,i,p),l.a)return l;if(n=xt(),l.a=n,n.src=d,n.listener=l,d.addEventListener)Jo||(r=i),void 0===r&&(r=!1),d.addEventListener(""+t,n,r);else if(d.attachEvent)d.attachEvent(kt(""+t),n);else{if(!d.addListener||!d.removeListener)throw Error("addEventListener and attachEvent are unavailable.");d.addListener(n)}return or++,l}function xt(){var o=It,t=Qo?function(e){return o.call(t.src,t.listener,e)}:function(e){if(!(e=o.call(t.src,t.listener,e)))return e};return t}function Ct(n,t,e,r,s){if(l(t)){for(var i=0;i<t.length;i++)Ct(n,t[i],e,r,s);return null}return e=At(e),ct(n)?n.Ha(t,e,m(r)?!!r.capture:!!r,s):vt(n,t,e,!0,r,s)}function St(n,t,e,r,s){if(l(t))for(var i=0;i<t.length;i++)St(n,t[i],e,r,s);else r=m(r)?!!r.capture:!!r,e=At(e),ct(n)?n.va(t,e,r,s):n&&(n=Nt(n))&&(t=ft(n,t,e,r,s))&&Et(t)}function Et(o){if("number"!=typeof o&&o&&!o.Y){var a=o.src;if(ct(a))gt(a.c,o);else{var e=o.type,n=o.a;a.removeEventListener?a.removeEventListener(e,n,o.capture):a.detachEvent?a.detachEvent(kt(e),n):a.addListener&&a.removeListener&&a.removeListener(n),or--,(e=Nt(a))?(gt(e,o),0==e.b&&(e.src=null,a[tr]=null)):ht(o)}}}function kt(e){return e in nr?nr[e]:nr[e]="on"+e}function Tt(a,t,e,n){var r=!0;if((a=Nt(a))&&(t=a.a[""+t]))for(t=t.concat(),a=0;a<t.length;a++){var o=t[a];o&&o.capture==e&&!o.Y&&(o=wt(o,n),r=r&&!1!==o)}return r}function wt(o,t){var e=o.listener,n=o.ga||o.src;return o.ca&&Et(o),e.call(n,t)}function It(a,t){if(a.Y)return!0;if(!Qo){if(!t)t:{t=["window","event"];for(var s=Io,n=0;n<t.length;n++)if(null==(s=s[t[n]])){t=null;break t}t=s}if(n=t,t=new A(n,this),s=!0,!(0>n.keyCode||void 0!=n.returnValue)){t:{var r=!1;if(0==n.keyCode)try{n.keyCode=-1;break t}catch(e){r=!0}(r||void 0==n.returnValue)&&(n.returnValue=!0)}for(n=[],r=t.a;r;r=r.parentNode)n.push(r);for(a=a.type,r=n.length-1;0<=r;r--){t.a=n[r];var o=Tt(n[r],a,!0,t);s=s&&o}for(r=0;r<n.length;r++)t.a=n[r],o=Tt(n[r],a,!1,t),s=s&&o}return s}return wt(a,new A(t,this))}function Nt(e){return e=e[tr],e instanceof mt?e:null}function At(n){return h(n)?n:(n[rr]||(n[rr]=function(t){return n.handleEvent(t)}),n[rr])}function Lt(){$.call(this),this.c=new mt(this),this.P=this,this.J=null}function B(d,t,e,n){if(!(t=d.c.a[t+""]))return!0;t=t.concat();for(var r=!0,o=0,i;o<t.length;++o)if(i=t[o],i&&!i.Y&&i.capture==e){var a=i.listener,s=i.ga||i.src;i.ca&>(d.c,i),r=!1!==a.call(s,n)&&r}return r&&0!=n.Pa}function Rt(e){return!/^\s*$/.test(e)&&/^[\],:{}\s\u2028\u2029]*$/.test(e.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,""))}function Ot(e){if(e+="",Rt(e))try{return eval("("+e+")")}catch(e){}throw Error("Invalid JSON string: "+e)}function Pt(n){var t=[];return Dt(new _t,n,t),t.join("")}function _t(){}function Dt(n,t,s){if(null==t)s.push("null");else{if("object"==typeof t){if(l(t)){var r=t;t=r.length,s.push("[");for(var o="",i=0;i<t;i++)s.push(o),Dt(n,r[i],s),o=",";return void s.push("]")}if(!(t instanceof String||t instanceof Number||t instanceof Boolean)){for(r in s.push("{"),o="",t)Object.prototype.hasOwnProperty.call(t,r)&&"function"!=typeof(i=t[r])&&(s.push(o),Mt(r,s),s.push(":"),Dt(n,i,s),o=",");return void s.push("}")}t=t.valueOf()}switch(typeof t){case"string":Mt(t,s);break;case"number":s.push(isFinite(t)&&!isNaN(t)?t+"":"null");break;case"boolean":s.push(t+"");break;case"function":s.push("null");break;default:throw Error("Unknown type: "+typeof t);}}}function Mt(n,t){t.push("\"",n.replace(ir,function(n){var t=ar[n];return t||(t="\\u"+(65536|n.charCodeAt(0)).toString(16).substr(1),ar[n]=t),t}),"\"")}function Ft(n,t){this.c=n,this.f=t,this.b=0,this.a=null}function Bt(){this.b=this.a=null}function Ut(){var n=lr,t=null;return n.a&&(t=n.a,n.a=n.a.next,n.a||(n.b=null),t.next=null),t}function Vt(){this.next=this.b=this.a=null}function Wt(e){Io.setTimeout(function(){throw e},0)}function Ht(){var r=Io.MessageChannel;if(void 0===r&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!tt("Presto")&&(r=function(){var r=document.createElement("IFRAME");r.style.display="none",r.src="",document.documentElement.appendChild(r);var t=r.contentWindow;r=t.document,r.open(),r.write(""),r.close();var e="callImmediate"+Math.random(),n="file:"==t.location.protocol?"*":t.location.protocol+"//"+t.location.host;r=f(function(o){"*"!=n&&o.origin!=n||o.data!=e||this.port1.onmessage()},this),t.addEventListener("message",r,!1),this.port1={},this.port2={postMessage:function(){t.postMessage(e,n)}}}),void 0!==r&&!tt("Trident")&&!tt("MSIE")){var a=new r,e={},n=e;return a.port1.onmessage=function(){if(void 0!==e.next){e=e.next;var n=e.za;e.za=null,n()}},function(e){n.next={za:e},n=n.next,a.port2.postMessage(0)}}return"undefined"!=typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(n){var t=document.createElement("SCRIPT");t.onreadystatechange=function(){t.onreadystatechange=null,t.parentNode.removeChild(t),t=null,n(),n=null},document.documentElement.appendChild(t)}:function(e){Io.setTimeout(e,0)}}function jt(){if(-1!=(Io.Promise+"").indexOf("[native code]")){var e=Io.Promise.resolve(void 0);cr=function(){e.then(qt)}}else cr=function(){var e=qt;!h(Io.setImmediate)||Io.Window&&Io.Window.prototype&&!tt("Edge")&&Io.Window.prototype.setImmediate==Io.setImmediate?(pr||(pr=Ht()),pr(e)):Io.setImmediate(e)}}function qt(){for(var n;n=Ut();){try{n.a.call(n.b)}catch(e){Wt(e)}var t=sr;t.f(n),100>t.b&&(t.b++,n.next=t.a,t.a=n)}dr=!1}function zt(t,e){Lt.call(this),this.b=t||1,this.a=e||Io,this.f=f(this.ib,this),this.g=No()}function Kt(e){e.$=!1,e.K&&(e.a.clearTimeout(e.K),e.K=null)}function Gt(o,r,a){if(h(o))a&&(o=f(o,a));else{if(!o||"function"!=typeof o.handleEvent)throw Error("Invalid listener argument");o=f(o.handleEvent,o)}return 2147483647<+r?-1:Io.setTimeout(o,r||0)}function Xt(o,t,e){$.call(this),this.f=null==e?o:f(o,e),this.c=t,this.b=f(this.bb,this),this.a=[]}function Qt(e){e.X=Gt(e.b,e.c),e.f.apply(null,e.a)}function Yt(e){$.call(this),this.b=e,this.a={}}function C(e){y(e.a,function(n,t){this.a.hasOwnProperty(t)&&Et(n)},e),e.a={}}function Jt(o,t,e){this.reset(o,t,e,void 0,void 0)}function $t(e){this.f=e,this.b=this.c=this.a=null}function Zt(n,t){this.name=n,this.value=t}function D(e){return e.c?e.c:e.a?D(e.a):(G("Root logger has no level set."),null)}function en(o){xr||(xr=new $t(""),vr[""]=xr,xr.c=yr);var t;if(!(t=vr[o])){t=new $t(o);var e=o.lastIndexOf("."),n=o.substr(e+1);e=en(o.substr(0,e)),e.b||(e.b={}),e.b[n]=t,t.a=e,vr[o]=t}return t}function tn(n,t){n&&n.log(gr,t,void 0)}function E(n,t){n&&n.log(fr,t,void 0)}function nn(n,t){n&&n.log(br,t,void 0)}function F(){this.a=en("goog.labs.net.webChannel.WebChannelDebug"),this.b=!0}function on(d,t,e,n,r,o){ln(d,function(){if(!d.b)i=o;else if(o){for(var i="",a=o.split("&"),s=0,p;s<a.length;s++)if(p=a[s].split("="),1<p.length){var c=p[0];p=p[1];var u=c.split("_");i=2<=u.length&&"type"==u[1]?i+(c+"=")+p+"&":i+(c+"=redacted&")}}else i=null;return"XMLHTTP REQ ("+n+") [attempt "+r+"]: "+t+"\n"+e+"\n"+i})}function rn(s,t,e,n,r,o,i){ln(s,function(){return"XMLHTTP RESP ("+n+") [ attempt "+r+"]: "+t+"\n"+e+"\n"+o+" "+i})}function an(o,t,e,n){ln(o,function(){return"XMLHTTP TEXT ("+t+"): "+pn(o,e)+(n?" "+n:"")})}function sn(n,t){ln(n,function(){return"TIMEOUT: "+t})}function dn(n,t){nn(n.a,t)}function I(o,t,e){(o=o.a)&&o.log(mr,e||"Exception",t)}function ln(n,t){E(n.a,t)}function H(n,t){(n=n.a)&&n.log(mr,t,void 0)}function pn(n,t){if(!n.b)return t;if(!t)return null;try{var d=JSON.parse(t);if(d)for(var r=0;r<d.length;r++)if(l(d[r])){var o=d[r];if(!(2>o.length)){var i=o[1];if(l(i)&&!(1>i.length)){var a=i[0];if("noop"!=a&&"stop"!=a&&"close"!=a)for(var s=1;s<i.length;s++)i[s]=""}}}return Pt(d)}catch(e){return dn(n,"Exception parsing expected JS array - probably was not JS"),t}}function cn(e){pt.call(this,"serverreachability",e)}function un(e){Cr.dispatchEvent(new cn(Cr,e))}function hn(e){pt.call(this,"statevent",e)}function mn(e){Cr.dispatchEvent(new hn(Cr,e))}function J(e){pt.call(this,"timingevent",e)}function gn(o,t,e){Cr.dispatchEvent(new J(Cr,o,t,e))}function fn(n,t){if(!h(n))throw Error("Fn must not be null and must be a function");return Io.setTimeout(function(){n()},t)}function yn(){}function bn(n){var t;return(t=n.a)||(t={},Cn(n)&&(t[0]=!0,t[1]=!0),t=n.a=t),t}function vn(){}function xn(e){return(e=Cn(e))?new ActiveXObject(e):new XMLHttpRequest}function Cn(o){if(!o.b&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var t=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],e=0,n;4>e;e++){n=t[e];try{return new ActiveXObject(n),o.b=n}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return o.b}function Sn(o,t,e,n){this.i=o,this.b=t,this.f=e,this.T=n||1,this.N=new Yt(this),this.S=Tr,o=this.H=new zt,o.b=wr,o.K&&o.$?(Kt(o),o.start()):o.K&&Kt(o),this.j=null,this.c=!1,this.m=this.g=this.h=this.J=this.D=this.U=this.w=null,this.s=[],this.a=null,this.F=0,this.l=this.o=null,this.C=-1,this.B=!1,this.P=0,this.I=null,this.M=!1}function K(n,t){return 0===n?"Non-200 return code ("+t+")":1===n?"XMLHTTP failure (no data)":2===n?"HttpConnection timeout":"Unknown error"}function En(o,t,e){o.J=1,o.h=Gn(P(t)),o.m=e,o.M=!0,Tn(o,null)}function kn(o,t,e,n){o.J=1,o.h=Gn(P(t)),o.m=null,o.M=e,Tn(o,n)}function Tn(t,e){t.D=No(),Ln(t),t.g=P(t.h),Q(t.g,"t",t.T),t.F=0,t.a=t.i.da(t.i.ia()?e:null),0<t.P&&(t.I=new Xt(f(t.Qa,t,t.a),t.P)),t.N.aa(t.a,"readystatechange",t.fb),e=t.j?rt(t.j):{},t.m?(t.o||(t.o="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.a.fa(t.g,t.o,t.m,e)):(t.o="GET",t.a.fa(t.g,t.o,null,e)),un(1),on(t.b,t.o,t.g,t.f,t.T,t.m)}function wn(a){var t=pe(a.a),e=a.a.Fa(),n=a.a.W();if(!(3>t)&&(3!=t||Mo||a.a.V())){a.B||4!=t||7==e||un(8==e||0>=n?3:2),On(a);var r=a.a.W();a.C=r,(e=a.a.V())||dn(a.b,function(){return"No response text for uri "+a.g+" status "+r}),a.c=200==r,rn(a.b,a.o,a.g,a.f,a.T,t,r),a.c?(a.M?(In(a,t,e),Mo&&a.c&&3==t&&Nn(a)):(an(a.b,a.f,e,null),Dn(a,e)),4==t&&_n(a),a.c&&!a.B&&(4==t?a.i.ua(a):(a.c=!1,Ln(a)))):(400==r&&0<e.indexOf("Unknown SID")?(a.l=3,mn(12),tn(a.b.a,"XMLHTTP Unknown SID ("+a.f+")")):(a.l=0,mn(13),tn(a.b.a,"XMLHTTP Bad status "+r+" ("+a.f+")")),_n(a),Pn(a))}}function In(a,t,e){for(var n=!0,r;!a.B&&a.F<e.length;){if(r=An(a,e),r==Nr){4==t&&(a.l=4,mn(14),n=!1),an(a.b,a.f,null,"[Incomplete Response]");break}if(r==Ir){a.l=4,mn(15),an(a.b,a.f,e,"[Invalid Chunk]"),n=!1;break}an(a.b,a.f,r,null),Dn(a,r)}4==t&&0==e.length&&(a.l=1,mn(16),n=!1),a.c=a.c&&n,n||(an(a.b,a.f,e,"[Invalid Chunked Response]"),_n(a),Pn(a))}function Nn(e){e.N.aa(e.H,"tick",e.eb),e.H.start()}function An(o,t){var e=o.F,n=t.indexOf("\n",e);return-1==n?Nr:(e=+t.substring(e,n),isNaN(e)?Ir:(n+=1)+e>t.length?Nr:(t=t.substr(n,e),o.F=n+e,t))}function Ln(t){t.U=No()+t.S,Rn(t,t.S)}function Rn(n,t){if(null!=n.w)throw Error("WatchDog timer not null");n.w=fn(f(n.cb,n),t)}function On(e){e.w&&(Io.clearTimeout(e.w),e.w=null)}function Pn(e){e.i.Ja()||e.B||e.i.ua(e)}function _n(n){On(n);var t=n.I;t&&"function"==typeof t.Z&&t.Z(),n.I=null,Kt(n.H),C(n.N),n.a&&(t=n.a,n.a=null,t.abort(),t.Z())}function Dn(n,t){try{n.i.Ma(n,t),un(4)}catch(t){I(n.b,t,"Error in httprequest callback")}}function Mn(o){if(o.v&&"function"==typeof o.v)return o.v();if(s(o))return o.split("");if(c(o)){for(var t=[],e=o.length,n=0;n<e;n++)t.push(o[n]);return t}return nt(o)}function Fn(a,t){if(a.forEach&&"function"==typeof a.forEach)a.forEach(t,void 0);else if(c(a)||s(a))Oo(a,t,void 0);else{if(a.O&&"function"==typeof a.O)var e=a.O();else if(a.v&&"function"==typeof a.v)e=void 0;else if(c(a)||s(a)){e=[];for(var n=a.length,r=0;r<n;r++)e.push(r)}else e=ot(a);n=Mn(a),r=n.length;for(var o=0;o<r;o++)t.call(void 0,n[o],e&&e[o],a)}}function Bn(e){this.b={},this.a=[],this.c=0;var t=arguments.length;if(1<t){if(t%2)throw Error("Uneven number of arguments");for(var n=0;n<t;n+=2)this.set(arguments[n],arguments[n+1])}else if(e){e instanceof Bn?(t=e.O(),n=e.v()):(t=ot(e),n=nt(e));for(var r=0;r<t.length;r++)this.set(t[r],n[r])}}function N(e){e.b={},e.a.length=0,e.c=0}function Un(n,t){return!!Wn(n.b,t)&&(delete n.b[t],n.c--,n.a.length>2*n.c&&Vn(n),!0)}function Vn(a){if(a.c!=a.a.length){for(var t=0,e=0,n;t<a.a.length;)n=a.a[t],Wn(a.b,n)&&(a.a[e++]=n),t++;a.a.length=e}if(a.c!=a.a.length){var r={};for(e=t=0;t<a.a.length;)n=a.a[t],Wn(r,n)||(a.a[e++]=n,r[n]=1),t++;a.a.length=e}}function Wn(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function O(a,t){if(a){a=a.split("&");for(var e=0;e<a.length;e++){var n=a[e].indexOf("="),r=null;if(0<=n){var o=a[e].substring(0,n);r=a[e].substring(n+1)}else o=a[e];t(o,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}function Hn(o,t){this.b=this.j=this.f="",this.i=null,this.g=this.a="",this.h=!1;var r;o instanceof Hn?(this.h=void 0===t?o.h:t,L(this,o.f),this.j=o.j,jn(this,o.b),qn(this,o.i),this.a=o.a,zn(this,oo(o.c)),this.g=o.g):o&&(r=(o+"").match(Ar))?(this.h=!!t,L(this,r[1]||"",!0),this.j=Yn(r[2]||""),jn(this,r[3]||"",!0),qn(this,r[4]),this.a=Yn(r[5]||"",!0),zn(this,r[6]||"",!0),this.g=Yn(r[7]||"")):(this.h=!!t,this.c=new Zn(null,this.h))}function P(e){return new Hn(e)}function L(o,t,e){o.f=e?Yn(t,!0):t,o.f&&(o.f=o.f.replace(/:$/,""))}function jn(o,t,e){o.b=e?Yn(t,!0):t}function qn(n,t){if(t){if(t=+t,isNaN(t)||0>t)throw Error("Bad port number "+t);n.i=t}else n.i=null}function zn(o,t,e){t instanceof Zn?(o.c=t,ao(o.c,o.h)):(e||(t=Jn(t,Pr)),o.c=new Zn(t,o.h))}function Kn(o,t,e){o.c.set(t,e)}function Q(n,t,e){l(e)||(e=[e+""]),no(n.c,t,e)}function Gn(t){return Kn(t,"zx",a(2147483648*Math.random()).toString(36)+Math.abs(a(2147483648*Math.random())^No()).toString(36)),t}function Xn(e){return e instanceof Hn?P(e):new Hn(e,void 0)}function Qn(a,t,e,n){var r=new Hn(null,void 0);return a&&L(r,a),t&&jn(r,t),e&&qn(r,e),n&&(r.a=n),r}function Yn(n,t){return n?t?decodeURI(n.replace(/%25/g,"%2525")):decodeURIComponent(n):""}function Jn(o,t,e){return s(o)?(o=encodeURI(o).replace(t,$n),e&&(o=o.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),o):null}function $n(e){return e=e.charCodeAt(0),"%"+(15&e>>4).toString(16)+(15&e).toString(16)}function Zn(n,t){this.b=this.a=null,this.c=n||null,this.f=!!t}function eo(o){o.a||(o.a=new Bn,o.b=0,o.c&&O(o.c,function(t,e){o.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function R(n,t){eo(n),t=ro(n,t),Wn(n.a.b,t)&&(n.c=null,n.b-=n.a.get(t).length,Un(n.a,t))}function to(n,t){return eo(n),t=ro(n,t),Wn(n.a.b,t)}function no(o,t,e){R(o,t),0<e.length&&(o.c=null,o.a.set(ro(o,t),et(e)),o.b+=e.length)}function oo(n){var t=new Zn;return t.c=n.c,n.a&&(t.a=new Bn(n.a),t.b=n.b),t}function ro(n,t){return t+="",n.f&&(t=t.toLowerCase()),t}function ao(n,t){t&&!n.f&&(eo(n),n.c=null,n.a.forEach(function(o,t){var e=t.toLowerCase();t!=e&&(R(this,t),no(this,e,o))},n)),n.f=t}function io(){this.a=No()}function so(){Dr||(Dr=new io)}function lo(){Dr||(Dr=new io)}function po(){}function co(){pt.call(this,"d")}function uo(){pt.call(this,"c")}function ho(n,t){this.a=n,this.b=t,this.c=this.i=null,this.h=!1,this.l=null,this.f=-1,this.m=this.g=null}function mo(a){dn(a.b,"TestConnection: starting stage 2");var t=a.a.H.a;if(null!=t)dn(a.b,function(){return"Buffered"}),mn(4),t?(mn(10),Je(a.a,a,!1)):(mn(11),Je(a.a,a,!0));else{a.c=new Sn(a,a.b,void 0,void 0),a.c.j=a.i;var e=Ke(a.a,a.g,a.l);mn(4),Q(e,"TYPE","xmlhttp");var n=a.a.j,r=a.a.J;n&&r&&Kn(e,n,r),kn(a.c,e,!1,a.g)}}function go(){this.a=this.b=null}function fo(){this.a=new Bn}function S(n){var o=typeof n;return"object"==o&&n||"function"==o?"o"+(n[k]||(n[k]=++q)):o.charAt(0)+n}function yo(n,t){this.a=n,this.b=t}function bo(e){this.g=e||Fr,this.f=Io.pa&&Io.pa.Ka&&Io.pa.Ka()&&Io.pa.Ka().Bb?this.g:1,this.a=null,1<this.f&&(this.a=new fo),this.b=null,this.c=[]}function vo(n,t){n.a||-1==t.indexOf("spdy")&&-1==t.indexOf("quic")&&-1==t.indexOf("h2")||(n.f=n.g,n.a=new fo,n.b&&(ce(n,n.b),n.b=null))}function xo(e){return!!e.b||!!e.a&&e.a.u()>=e.f}function be(n,t){return n.b?n.b==t:!!n.a&&n.a.contains(t)}function ce(n,t){n.a?n.a.add(t):n.b=t}function ae(n,t){n.b&&n.b==t?n.b=null:n.a&&n.a.contains(t)&&Un(n.a.a,S(t))}function de(n){if(null!=n.b)return n.c.concat(n.b.s);if(null!=n.a&&0!=n.a.a.c){var o=n.c;return Oo(n.a.v(),function(e){o=o.concat(e.s)}),o}return et(n.c)}function ee(n,t){n.c=n.c.concat(t)}function fe(){}function ge(){this.a=new fe}function he(o,a,e){var i=e||"";try{Fn(o,function(e,t){var n=e;m(e)&&(n=Pt(e)),a.push(i+t+"="+encodeURIComponent(n))})}catch(e){throw a.push(i+"type="+encodeURIComponent("_badmap")),e}}function ie(o,t){var e=new F;dn(e,"TestLoadImage: loading "+o);var n=new Image;n.onload=b(je,e,n,"TestLoadImage: loaded",!0,t),n.onerror=b(je,e,n,"TestLoadImage: error",!1,t),n.onabort=b(je,e,n,"TestLoadImage: abort",!1,t),n.ontimeout=b(je,e,n,"TestLoadImage: timeout",!1,t),Io.setTimeout(function(){n.ontimeout&&n.ontimeout()},1e4),n.src=o}function je(a,t,e,n,r){try{dn(a,e),t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,r(n)}catch(t){I(a,t)}}function ke(e){Lt.call(this),this.headers=new Bn,this.F=e||null,this.f=!1,this.D=this.a=null,this.M=this.s="",this.j=0,this.g="",this.h=this.I=this.o=this.H=!1,this.l=0,this.B=null,this.N=Br,this.C=this.m=!1}function T(e){return Fo&<(9)&&"number"==typeof e.timeout&&void 0!==e.ontimeout}function qe(e){return"content-type"==e.toLowerCase()}function Co(n,t){n.f=!1,n.a&&(n.h=!0,n.a.abort(),n.h=!1),n.g=t,n.j=5,oe(n),te(n)}function oe(e){e.H||(e.H=!0,e.dispatchEvent("complete"),e.dispatchEvent("error"))}function re(s){if(s.f&&void 0!==wo)if(s.D[1]&&4==pe(s)&&2==s.W())nn(s.b,M(s,"Local request error detected and ignored"));else if(s.o&&4==pe(s))Gt(s.La,0,s);else if(s.dispatchEvent("readystatechange"),4==pe(s)){nn(s.b,M(s,"Request complete")),s.f=!1;try{var t=s.W();t:switch(t){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break t;default:e=!1;}var n;if(!(n=e)){var r;if(r=0===t){var o=(s.s+"").match(Ar)[1]||null;if(!o&&Io.self&&Io.self.location){var d=Io.self.location.protocol;o=d.substr(0,d.length-1)}r=!le.test(o?o.toLowerCase():"")}n=r}n?(s.dispatchEvent("complete"),s.dispatchEvent("success")):(s.j=6,s.g=s.Ga()+" ["+s.W()+"]",oe(s))}finally{te(s)}}}function te(a,t){if(a.a){se(a);var e=a.a,n=a.D[0]?o:null;a.a=null,a.D=null,t||a.dispatchEvent("ready");try{e.onreadystatechange=n}catch(t){(a=a.b)&&a.log(mr,"Problem encountered resetting onreadystatechange: "+t.message,void 0)}}}function se(e){e.a&&e.C&&(e.a.ontimeout=null),e.B&&(Io.clearTimeout(e.B),e.B=null)}function pe(e){return e.a?e.a.readyState:0}function M(n,t){return t+" ["+n.M+" "+n.s+" "+n.W()+"]"}function U(n){var o="";return y(n,function(e,t){o+=t,o+=":",o+=e,o+="\r\n"}),o}function ue(a,t,e){t:{for(n in e){var n=!1;break t}n=!0}if(n)return a;if(e=U(e),s(a)){if(t=encodeURIComponent(t+""),e=null==e?"":"="+encodeURIComponent(e+""),t+=e){if(e=a.indexOf("#"),0>e&&(e=a.length),0>(n=a.indexOf("?"))||n>e){n=e;var r=""}else r=a.substring(n+1,e);a=[a.substr(0,n),r,a.substr(e)],e=a[1],a[1]=t?e?e+"&"+t:t:e,a=a[0]+(a[1]?"?"+a[1]:"")+a[2]}return a}return Kn(a,t,e),a}function ve(e){this.ya=0,this.g=[],this.a=new F,this.H=new go,this.ja=this.wa=this.F=this.ka=this.b=this.J=this.j=this.U=this.h=this.M=this.i=null,this.Ua=this.P=0,this.la=this.B=this.o=this.m=this.l=this.f=null,this.s=this.xa=this.N=-1,this.T=this.w=this.C=0,this.S=e&&e.supportsCrossDomainXhr||!1,this.I="",this.c=new bo(e&&e.concurrentRequestLimit),this.ma=new ge,this.D=!e||void 0===e.backgroundChannelTest||e.backgroundChannelTest,this.Ta=e&&e.fastHandshake||!1,e&&e.Ea&&this.a.Ea()}function we(t){if(dn(t.a,"disconnect()"),xe(t),3==t.G){var e=t.P++,n=P(t.F);Kn(n,"SID",t.I),Kn(n,"RID",e),Kn(n,"TYPE","terminate"),He(t,n),e=new Sn(t,t.a,e,void 0),e.J=2,e.h=Gn(P(n)),n=!1,Io.navigator&&Io.navigator.sendBeacon&&(n=Io.navigator.sendBeacon(""+e.h,"")),!n&&Io.Image&&(new Image().src=e.h,n=!0),n||(e.a=e.i.da(null),e.a.fa(e.h)),e.D=No(),Ln(e)}V(t)}function xe(e){e.B&&(e.B.abort(),e.B=null),e.b&&(e.b.cancel(),e.b=null),e.m&&(Io.clearTimeout(e.m),e.m=null),Eo(e),e.c.cancel(),e.l&&(Io.clearTimeout(e.l),e.l=null)}function ye(n,t){1e3==n.g.length&&H(n.a,function(){return"Already have 1000 queued maps upon queueing "+Pt(t)}),n.g.push(new yo(n.Ua++,t)),3==n.G&&Ce(n)}function Ce(e){xo(e.c)||e.l||(e.l=fn(f(e.Oa,e),0),e.C=0)}function De(o,t){var e=o.c;return(e.b?1:e.a?e.a.u():0)>=o.c.f-(o.l?1:0)?(H(o.a,"Unexpected retry request is scheduled."),!1):o.l?(dn(o.a,"Use the retry request that is already scheduled."),o.g=t.s.concat(o.g),!0):!(1==o.G||2==o.G||2<=o.C||(dn(o.a,"Going to retry POST"),o.l=fn(f(o.Oa,o,t),Be(o,o.C)),o.C++,0))}function Ee(o,t){var e=t?t.f:o.P++;var n=P(o.F);Kn(n,"SID",o.I),Kn(n,"RID",e),Kn(n,"AID",o.N),He(o,n),o.h&&o.i&&ue(n,o.h,o.i),e=new Sn(o,o.a,e,o.C+1),null===o.h&&(e.j=o.i),t&&(o.g=t.s.concat(o.g)),t=ze(o,e),e.setTimeout(10000+Math.round(1e4*Math.random())),ce(o.c,e),En(e,n,t)}function He(n,o){n.f&&Fn({},function(e,t){Kn(o,t,e)})}function ze(r,t){var e=Math.min(r.g.length,1e3),n=r.f?f(r.f.Va,r.f,r):null;t:for(var o=r.g,i=-1,a;;){a=["count="+e],-1==i?0<e?(i=o[0].a,a.push("ofs="+i)):i=0:a.push("ofs="+i);for(var s=!0,p=0;p<e;p++){var c=o[p].a,u=o[p].b;if(0>(c-=i))i=d(0,o[p].a-100),s=!1;else try{he(u,a,"req"+c+"_")}catch(e){n&&n(u)}}if(s){n=a.join("&");break t}}return r=r.g.splice(0,e),t.s=r,n}function Ge(n){if(!n.b&&!n.m){n.T=1;var t=n.Na;cr||jt(),dr||(cr(),dr=!0),lr.add(t,n),n.w=0}}function Ie(e){return e.b||e.m?(H(e.a,"Request already in progress"),!1):!(3<=e.w||(dn(e.a,"Going to retry GET"),e.T++,e.m=fn(f(e.Na,e),Be(e,e.w)),e.w++,0))}function Je(o,t,e){dn(o.a,"Test Connection Finished");var n=t.m;n&&vo(o.c,n),o.la=e,o.s=t.f,dn(o.a,"connectChannel_()"),o.F=Ae(o,o.ka),Ce(o)}function So(n,t){dn(n.a,"Test Connection Failed"),n.s=t.f,Fe(n,2)}function Eo(e){null!=e.o&&(Io.clearTimeout(e.o),e.o=null)}function Be(o,t){var e=5e3+a(1e4*Math.random());return o.ra()||(dn(o.a,"Inactive channel"),e*=2),e*t}function Fe(r,t){if(ln(r.a,"Error code "+t),2==t){var e=null;r.f&&(e=null);var n=f(r.hb,r);e||(e=new Hn("//www.google.com/images/cleardot.gif"),Io.location&&"http"==Io.location.protocol||L(e,"https"),Gn(e)),ie(""+e,n)}else mn(2);dn(r.a,"HttpChannel: error - "+t),r.G=0,r.f&&r.f.Ba(t),V(r),xe(r)}function V(n){if(n.G=0,n.s=-1,n.f){var t=de(n.c);0==t.length&&0==n.g.length||(dn(n.a,function(){return"Number of undelivered maps, pending: "+t.length+", outgoing: "+n.g.length}),n.c.c.length=0,et(n.g),n.g.length=0),n.f.Aa()}}function Ae(n,t){return t=ko(n,null,t),dn(n.a,"GetForwardChannelUri: "+t),t}function Ke(o,t,e){return t=ko(o,o.ia()?t:null,e),dn(o.a,"GetBackChannelUri: "+t),t}function ko(a,t,e){var n=Xn(e);if(""!=n.b)t&&jn(n,t+"."+n.b),qn(n,n.i);else{var r=Io.location,i;i=t?t+"."+r.hostname:r.hostname,n=Qn(r.protocol,i,r.port,e)}return a.U&&y(a.U,function(o,t){Kn(n,t,o)}),t=a.j,e=a.J,t&&e&&Kn(n,t,e),Kn(n,"VER",a.oa),He(a,n),n}function Le(){}function Me(){for(var t=arguments[0],e=1,n;e<arguments.length;e++)if(n=arguments[e],0==n.lastIndexOf("/",0))t=n;else{var r;(r=""==t)||(r=t.length-1,r=0<=r&&t.indexOf("/",r)==r),t+=r?n:"/"+n}return t}function Ne(){if(Fo&&!(10<=+Go))throw Error("Environmental error: no available transport.")}function Oe(n,t){Lt.call(this),this.a=new ve(t),this.b=n,this.s=t&&t.testUrl?t.testUrl:Me(this.b,"test"),this.f=en("goog.labs.net.webChannel.WebChannelBaseTransport"),this.g=t&&t.messageUrlParams||null,n=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(n?n["X-Client-Protocol"]="webchannel":n={"X-Client-Protocol":"webchannel"}),this.a.i=n,n=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(n?n["X-WebChannel-Content-Type"]=t.messageContentType:n={"X-WebChannel-Content-Type":t.messageContentType}),this.a.M=n,(n=t&&t.httpHeadersOverwriteParam)&&!/^[\s\xa0]*$/.test(n)&&(this.a.h=n),this.o=t&&t.supportsCrossDomainXhr||!1,this.m=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!/^[\s\xa0]*$/.test(t)&&(this.a.j=t,null!==(n=this.g)&&t in n&&(n=this.g,t in n&&delete n[t],tn(this.f,"Ignore httpSessionIdParam also specified with messageUrlParams: "+t))),this.h=new Re(this)}function W(o){co.call(this);var t=o.__sm__;if(t){t:{for(var e in t){o=e;break t}o=void 0}(this.c=o)?(o=this.c,this.data=null!==t&&o in t?t[o]:void 0):this.data=t}else this.data=o}function Qe(){uo.call(this),this.status=1}function Re(e){this.a=e}function Pe(){this.b=[],this.a=[]}function Te(e){return 0==e.b.length&&(e.b=e.a,e.b.reverse(),e.a=[]),e.b.pop()}function Ue(n,t){if($.call(this),this.h=n||0,this.c=t||10,this.h>this.c)throw Error(Ur);this.a=new Pe,this.b=new fo,this.g=null,this.ba()}function Ve(n){if("function"==typeof n.Z)n.Z();else for(var t in n)n[t]=null}function Xe(n,t){this.a=n,this.b=t}function Ye(o){if(this.a=[],o)t:{if(o instanceof Ye){var t=o.O();if(o=o.v(),0>=this.u()){for(var e=this.a,n=0;n<t.length;n++)e.push(new Xe(t[n],o[n]));break t}}else t=ot(o),o=nt(o);for(n=0;n<t.length;n++)Ze(this,t[n],o[n])}}function Ze(o,t,e){var n=o.a;for(n.push(new Xe(t,e)),t=n.length-1,o=o.a,e=o[t];0<t&&(n=t-1>>1,o[n].a>e.a);)o[t]=o[n],t=n;o[t]=e}function $e(){Ye.call(this)}function To(n,t){this.f=new $e,Ue.call(this,n,t)}function X(o,t,e,n){this.l=o,this.j=!!n,To.call(this,t,e)}var wo=wo||{},Io=this,k="closure_uid_"+(1e9*Math.random()>>>0),q=0,No=Date.now||function(){return+new Date},t;r(u,Error),u.prototype.name="CustomError";var g=String.prototype.trim?function(e){return e.trim()}:function(e){return e.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};r(j,u),j.prototype.name="AssertionError";var Ao=0,Lo={};$.prototype.i=!1,$.prototype.Z=function(){},$.prototype.A=function(){if(this.w)for(;this.w.length;)this.w.shift()()};var Ro=Array.prototype.indexOf?function(n,t){return Array.prototype.indexOf.call(n,t,void 0)}:function(o,t){if(s(o))return s(t)&&1==t.length?o.indexOf(t,0):-1;for(var e=0;e<o.length;e++)if(e in o&&o[e]===t)return e;return-1},Oo=Array.prototype.forEach?function(o,t,e){Array.prototype.forEach.call(o,t,e)}:function(a,t,e){for(var n=a.length,r=s(a)?a.split(""):a,o=0;o<n;o++)o in r&&t.call(e,r[o],o,a)},Po;t:{var x=Io.navigator;if(x){var _o=x.userAgent;if(_o){Po=_o;break t}}Po=""}var Do=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];it[" "]=o;var Mo=tt("Opera"),Fo=tt("Trident")||tt("MSIE"),Bo=tt("Edge"),Uo=tt("Gecko")&&(-1==Po.toLowerCase().indexOf("webkit")||tt("Edge"))&&!(tt("Trident")||tt("MSIE"))&&!tt("Edge"),Vo=-1!=Po.toLowerCase().indexOf("webkit")&&!tt("Edge"),Wo;t:{var Ho="",jo=function(){var e=Po;return Uo?/rv:([^\);]+)(\)|;)/.exec(e):Bo?/Edge\/([\d\.]+)/.exec(e):Fo?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):Vo?/WebKit\/(\S+)/.exec(e):Mo?/(?:Version)[ \/]?(\S+)/.exec(e):void 0}();if(jo&&(Ho=jo?jo[1]:""),Fo){var qo=dt();if(null!=qo&&qo>parseFloat(Ho)){Wo=qo+"";break t}}Wo=Ho}var zo={},Ko=Io.document,Go;Go=Ko&&Fo?dt()||("CSS1Compat"==Ko.compatMode?parseInt(Wo,10):5):void 0;var Xo=Object.freeze||function(e){return e},Qo=!Fo||9<=+Go,Yo=Fo&&!lt("9"),Jo=function(){if(!Io.addEventListener||!Object.defineProperty)return!1;var n=!1,t=Object.defineProperty({},"passive",{get:function(){n=!0}});return Io.addEventListener("test",o,t),Io.removeEventListener("test",o,t),n}();pt.prototype.b=function(){this.Pa=!1},r(A,pt);var $o=Xo({2:"touch",3:"pen",4:"mouse"});A.prototype.b=function(){A.L.b.call(this);var e=this.c;if(e.preventDefault)e.preventDefault();else if(e.returnValue=!1,Yo)try{(e.ctrlKey||112<=e.keyCode&&123>=e.keyCode)&&(e.keyCode=-1)}catch(e){}};var Zo="closure_listenable_"+(0|1e6*Math.random()),er=0;mt.prototype.add=function(s,t,e,n,d){var o=""+s;(s=this.a[o])||(s=this.a[o]=[],this.b++);var i=yt(s,t,n,d);return-1<i?(t=s[i],e||(t.ca=!1)):(t=new ut(t,this.src,o,!!n,d),t.ca=e,s.push(t)),t};var tr="closure_lm_"+(0|1e6*Math.random()),nr={},or=0,rr="__closure_events_fn_"+(1e9*Math.random()>>>0);r(Lt,$),Lt.prototype[Zo]=!0,t=Lt.prototype,t.addEventListener=function(o,t,e,n){bt(this,o,t,e,n)},t.removeEventListener=function(o,t,e,n){St(this,o,t,e,n)},t.dispatchEvent=function(d){var t=this.J,n;if(t)for(n=[];t;t=t.J)n.push(t);t=this.P;var e=d.type||d;if(s(d))d=new pt(d,t);else if(d instanceof pt)d.target=d.target||t;else{var r=d;d=new pt(e,t),at(d,r)}if(r=!0,n)for(var o=n.length-1,i;0<=o;o--)i=d.a=n[o],r=B(i,e,!0,d)&&r;if(i=d.a=t,r=B(i,e,!0,d)&&r,r=B(i,e,!1,d)&&r,n)for(o=0;o<n.length;o++)i=d.a=n[o],r=B(i,e,!1,d)&&r;return r},t.A=function(){if(Lt.L.A.call(this),this.c){var a=this.c,e=0,n;for(n in a.a){for(var t=a.a[n],r=0;r<t.length;r++)++e,ht(t[r]);delete a.a[n],a.b--}}this.J=null},t.aa=function(o,t,e,n){return this.c.add(o+"",t,!1,e,n)},t.Ha=function(o,t,e,n){return this.c.add(o+"",t,!0,e,n)},t.va=function(a,t,e,n){var r=this.c;if((a+="")in r.a){var o=r.a[a];-1<(t=yt(o,t,e,n))&&(ht(o[t]),Array.prototype.splice.call(o,t,1),0==o.length&&(delete r.a[a],r.b--))}};var ar={'"':"\\\"","\\":"\\\\","/":"\\/","":"\\b","":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","":"\\u000b"},ir=/\uffff/.test("\uFFFF")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g;Ft.prototype.get=function(){if(0<this.b){this.b--;var e=this.a;this.a=e.next,e.next=null}else e=this.c();return e};var sr=new Ft(function(){return new Vt},function(e){e.reset()});Bt.prototype.add=function(o,t){var e=sr.get();e.set(o,t),this.b?this.b.next=e:this.a=e,this.b=e},Vt.prototype.set=function(n,t){this.a=n,this.b=t,this.next=null},Vt.prototype.reset=function(){this.next=this.b=this.a=null};var dr=!1,lr=new Bt,pr,cr;r(zt,Lt),t=zt.prototype,t.$=!1,t.K=null,t.ib=function(){if(this.$){var t=No()-this.g;0<t&&t<.8*this.b?this.K=this.a.setTimeout(this.f,this.b-t):(this.K&&(this.a.clearTimeout(this.K),this.K=null),this.dispatchEvent("tick"),this.$&&(this.K=this.a.setTimeout(this.f,this.b),this.g=No()))}},t.start=function(){this.$=!0,this.K||(this.K=this.a.setTimeout(this.f,this.b),this.g=No())},t.A=function(){zt.L.A.call(this),Kt(this),delete this.a},r(Xt,$),t=Xt.prototype,t.ha=!1,t.X=null,t.Xa=function(){this.a=arguments,this.X?this.ha=!0:Qt(this)},t.A=function(){Xt.L.A.call(this),this.X&&(Io.clearTimeout(this.X),this.X=null,this.ha=!1,this.a=[])},t.bb=function(){this.X=null,this.ha&&(this.ha=!1,Qt(this))},r(Yt,$);var ur=[];Yt.prototype.aa=function(n,t,e,r){l(t)||(t&&(ur[0]=""+t),t=ur);for(var o=0,i;o<t.length&&(i=bt(n,t[o],e||this.handleEvent,r||!1,this.b||this),!!i);o++)this.a[i.key]=i;return this},Yt.prototype.va=function(n,t,e,r,s){if(l(t))for(var i=0;i<t.length;i++)this.va(n,t[i],e,r,s);else e=e||this.handleEvent,r=m(r)?!!r.capture:!!r,s=s||this.b||this,e=At(e),r=!!r,(t=ct(n)?ft(n.c,t+"",e,r,s):n&&(n=Nt(n))?ft(n,t,e,r,s):null)&&(Et(t),delete this.a[t.key])},Yt.prototype.A=function(){Yt.L.A.call(this),C(this)},Yt.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},Jt.prototype.a=null;var hr=0;Jt.prototype.reset=function(t,e,n,r,o){"number"==typeof o||hr++,r||No(),delete this.a},Zt.prototype.toString=function(){return this.name};var mr=new Zt("SEVERE",1e3),gr=new Zt("WARNING",900),fr=new Zt("INFO",800),yr=new Zt("CONFIG",700),br=new Zt("FINE",500);$t.prototype.log=function(o,t,e){if(o.value>=D(this).value)for(h(t)&&(t=t()),o=new Jt(o,t+"",this.f),e&&(o.a=e),e=this;e;)e=e.a};var vr={},xr=null;F.prototype.Ea=function(){this.b=!1};var Cr=new Lt;r(cn,pt),r(hn,pt),r(J,pt);var Sr={NO_ERROR:0,jb:1,qb:2,pb:3,mb:4,ob:5,rb:6,Ra:7,TIMEOUT:8,ub:9},Er={lb:"complete",yb:"success",Sa:"error",Ra:"abort",wb:"ready",xb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",vb:"progress",nb:"downloadprogress",zb:"uploadprogress"};yn.prototype.a=null;var kr;r(vn,yn),kr=new vn;var Tr=45e3,wr=250,Ir={},Nr={};t=Sn.prototype,t.setTimeout=function(e){this.S=e},t.fb=function(n){n=n.target;var t=this.I;t&&3==pe(n)?(dn(this.b,"Throttling readystatechange."),t.Xa()):this.Qa(n)},t.Qa=function(n){try{n==this.a?wn(this):tn(this.b.a,"Called back with an unexpected xmlhttp")}catch(e){if(dn(this.b,"Failed call to OnXmlHttpReadyStateChanged_"),this.a&&this.a.V()){var t=this;I(this.b,e,function(){return"ResponseText: "+t.a.V()})}else I(this.b,e,"No response text")}},t.eb=function(){var n=pe(this.a),t=this.a.V();this.F<t.length&&(On(this),In(this,n,t),this.c&&4!=n&&Ln(this))},t.cancel=function(){this.B=!0,_n(this)},t.cb=function(){this.w=null;var t=No();0<=t-this.U?(this.c&&H(this.b,"Received watchdog timeout even though request loaded successfully"),sn(this.b,this.g),2!=this.J&&(un(3),mn(17)),_n(this),this.l=2,Pn(this)):(tn(this.b.a,"WatchDog timer called too early"),Rn(this,this.U-t))},t=Bn.prototype,t.u=function(){return this.c},t.v=function(){Vn(this);for(var n=[],t=0;t<this.a.length;t++)n.push(this.b[this.a[t]]);return n},t.O=function(){return Vn(this),this.a.concat()},t.get=function(n,t){return Wn(this.b,n)?this.b[n]:t},t.set=function(n,t){Wn(this.b,n)||(this.c++,this.a.push(n)),this.b[n]=t},t.forEach=function(a,t){for(var e=this.O(),n=0;n<e.length;n++){var r=e[n],o=this.get(r);a.call(t,o,r,this)}};var Ar=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;Hn.prototype.toString=function(){var o=[],t=this.f;t&&o.push(Jn(t,Lr,!0),":");var e=this.b;return(e||"file"==t)&&(o.push("//"),(t=this.j)&&o.push(Jn(t,Lr,!0),"@"),o.push(encodeURIComponent(e+"").replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(e=this.i)&&o.push(":",e+"")),(e=this.a)&&(this.b&&"/"!=e.charAt(0)&&o.push("/"),o.push(Jn(e,"/"==e.charAt(0)?Or:Rr,!0))),(e=""+this.c)&&o.push("?",e),(e=this.g)&&o.push("#",Jn(e,_r)),o.join("")},Hn.prototype.resolve=function(d){var t=P(this),e=!!d.f;e?L(t,d.f):e=!!d.j,e?t.j=d.j:e=!!d.b,e?jn(t,d.b):e=null!=d.i;var n=d.a;if(e)qn(t,d.i);else if(e=!!d.a){if("/"!=n.charAt(0))if(this.b&&!this.a)n="/"+n;else{var r=t.a.lastIndexOf("/");-1!=r&&(n=t.a.substr(0,r+1)+n)}if(".."==(r=n)||"."==r)n="";else if(-1!=r.indexOf("./")||-1!=r.indexOf("/.")){n=0==r.lastIndexOf("/",0),r=r.split("/");for(var o=[],i=0,a;i<r.length;)a=r[i++],"."==a?n&&i==r.length&&o.push(""):".."==a?((1<o.length||1==o.length&&""!=o[0])&&o.pop(),n&&i==r.length&&o.push("")):(o.push(a),n=!0);n=o.join("/")}else n=r}return e?t.a=n:e=""+d.c,e?zn(t,oo(d.c)):e=!!d.g,e&&(t.g=d.g),t};var Lr=/[#\/\?@]/g,Rr=/[#\?:]/g,Or=/[#\?]/g,Pr=/[#\?@]/g,_r=/#/g;t=Zn.prototype,t.u=function(){return eo(this),this.b},t.add=function(o,t){eo(this),this.c=null,o=ro(this,o);var e=this.a.get(o);return e||this.a.set(o,e=[]),e.push(t),this.b+=1,this},t.forEach=function(o,t){eo(this),this.a.forEach(function(e,a){Oo(e,function(e){o.call(t,e,a,this)},this)},this)},t.O=function(){eo(this);for(var a=this.a.v(),t=this.a.O(),e=[],n=0;n<t.length;n++)for(var r=a[n],o=0;o<r.length;o++)e.push(t[n]);return e},t.v=function(o){eo(this);var t=[];if(s(o))to(this,o)&&(t=_e(t,this.a.get(ro(this,o))));else{o=this.a.v();for(var e=0;e<o.length;e++)t=_e(t,o[e])}return t},t.set=function(n,t){return eo(this),this.c=null,n=ro(this,n),to(this,n)&&(this.b-=this.a.get(n).length),this.a.set(n,[t]),this.b+=1,this},t.get=function(n,t){return n=n?this.v(n):[],0<n.length?n[0]+"":t},t.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var s=[],t=this.a.O(),e=0;e<t.length;e++){var n=t[e],r=encodeURIComponent(n+"");n=this.v(n);for(var o=0,i;o<n.length;o++)i=r,""!==n[o]&&(i+="="+encodeURIComponent(n[o]+"")),s.push(i)}return this.c=s.join("&")};var Dr=null;io.prototype.set=function(e){this.a=e},io.prototype.reset=function(){this.set(No())},io.prototype.get=function(){return this.a},r(lo,so);var Mr={OPEN:"a",kb:"b",Sa:"c",tb:"d"};r(co,pt),r(uo,pt),t=ho.prototype,t.R=null,t.da=function(e){return this.a.da(e)},t.abort=function(){this.c&&(this.c.cancel(),this.c=null),this.f=-1},t.Ja=function(){return!1},t.Ma=function(o,t){if(this.f=o.C,0==this.R){if(dn(this.b,"TestConnection: Got data for stage 1"),!this.a.D&&(o=o.a)){var e=o.a?o.a.getResponseHeader("X-Client-Wire-Protocol"):null;this.m=e||null,this.a.j&&((o=o.a?o.a.getResponseHeader("X-HTTP-Session-Id"):null)?this.a.J=o:tn(this.b.a,"Missing X_HTTP_SESSION_ID in the handshake response"))}if(t){try{var n=this.a.ma.a.parse(t)}catch(e){return I(this.b,e),void So(this.a,this)}this.g=n[0]}else dn(this.b,"TestConnection: Null responseText"),So(this.a,this)}else 1==this.R&&(this.h?mn(6):"11111"==t?(mn(5),this.h=!0,(!Fo||10<=+Go)&&(this.f=200,this.c.cancel(),dn(this.b,"Test connection succeeded; using streaming connection"),mn(11),Je(this.a,this,!0))):(mn(7),this.h=!1))},t.ua=function(){this.f=this.c.C,this.c.c?0==this.R?(this.R=1,dn(this.b,"TestConnection: request complete for initial check"),mo(this)):1==this.R&&(dn(this.b,"TestConnection: request complete for stage 2"),this.h?(dn(this.b,"Test connection succeeded; using streaming connection"),mn(11),Je(this.a,this,!0)):(dn(this.b,"Test connection failed; not using streaming"),mn(10),Je(this.a,this,!1))):(dn(this.b,"TestConnection: request failed, in state "+this.R),0==this.R?mn(8):1==this.R&&mn(9),So(this.a,this))},t.ia=function(){return this.a.ia()},t.ra=function(){return this.a.ra()},fo.prototype.u=function(){return this.a.u()},fo.prototype.add=function(e){this.a.set(S(e),e)},fo.prototype.contains=function(e){return e=S(e),Wn(this.a.b,e)},fo.prototype.v=function(){return this.a.v()};var Fr=10;bo.prototype.cancel=function(){this.c=de(this),this.b?(this.b.cancel(),this.b=null):this.a&&0!=this.a.a.c&&(Oo(this.a.v(),function(e){e.cancel()}),N(this.a.a))},fe.prototype.stringify=function(e){return Io.JSON.stringify(e,void 0)},fe.prototype.parse=function(e){return Io.JSON.parse(e,void 0)},r(ke,Lt);var Br="";ke.prototype.b=en("goog.net.XhrIo");var le=/^https?$/i,me=["POST","PUT"];t=ke.prototype,t.fa=function(r,t,e,n){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.s+"; newUri="+r);t=t?t.toUpperCase():"GET",this.s=r,this.g="",this.j=0,this.M=t,this.H=!1,this.f=!0,this.a=xn(this.F?this.F:kr),this.D=bn(this.F?this.F:kr),this.a.onreadystatechange=f(this.La,this);try{nn(this.b,M(this,"Opening Xhr")),this.I=!0,this.a.open(t,r+"",!0),this.I=!1}catch(e){return nn(this.b,M(this,"Error opening Xhr: "+e.message)),void Co(this,e)}r=e||"";var o=new Bn(this.headers);n&&Fn(n,function(n,t){o.set(t,n)}),n=w(o.O()),e=Io.FormData&&r instanceof Io.FormData,!(0<=Ro(me,t))||n||e||o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach(function(n,t){this.a.setRequestHeader(t,n)},this),this.N&&(this.a.responseType=this.N),"withCredentials"in this.a&&this.a.withCredentials!==this.m&&(this.a.withCredentials=this.m);try{se(this),0<this.l&&(this.C=T(this.a),nn(this.b,M(this,"Will abort after "+this.l+"ms if incomplete, xhr2 "+this.C)),this.C?(this.a.timeout=this.l,this.a.ontimeout=f(this.Ia,this)):this.B=Gt(this.Ia,this.l,this)),nn(this.b,M(this,"Sending request")),this.o=!0,this.a.send(r),this.o=!1}catch(e){nn(this.b,M(this,"Send error: "+e.message)),Co(this,e)}},t.Ia=function(){void 0!==wo&&this.a&&(this.g="Timed out after "+this.l+"ms, aborting",this.j=8,nn(this.b,M(this,this.g)),this.dispatchEvent("timeout"),this.abort(8))},t.abort=function(e){this.a&&this.f&&(nn(this.b,M(this,"Aborting")),this.f=!1,this.h=!0,this.a.abort(),this.h=!1,this.j=e||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),te(this))},t.A=function(){this.a&&(this.f&&(this.f=!1,this.h=!0,this.a.abort(),this.h=!1),te(this,!0)),ke.L.A.call(this)},t.La=function(){this.i||(this.I||this.o||this.h?re(this):this.ab())},t.ab=function(){re(this)},t.W=function(){try{return 2<pe(this)?this.a.status:-1}catch(e){return-1}},t.Ga=function(){try{return 2<pe(this)?this.a.statusText:""}catch(e){return nn(this.b,"Can not get status: "+e.message),""}},t.V=function(){try{return this.a?this.a.responseText:""}catch(e){return nn(this.b,"Can not get responseText: "+e.message),""}},t.Ya=function(o){if(this.a){var t=this.a.responseText;o&&0==t.indexOf(o)&&(t=t.substring(o.length));t:{if(o=t,Io.JSON)try{var e=Io.JSON.parse(o);break t}catch(e){}e=Ot(o)}return e}},t.Fa=function(){return this.j},t.Za=function(){return s(this.g)?this.g:this.g+""},t=ve.prototype,t.oa=8,t.G=1,t.Ja=function(){return 0==this.G},t.Oa=function(i){if(!(this.l=null,dn(this.a,"startForwardChannel_"),1==this.G))3==this.G&&(i?Ee(this,i):0==this.g.length?dn(this.a,"startForwardChannel_ returned: nothing to send"):xo(this.c)?H(this.a,"startForwardChannel_ returned: connection already in progress"):(Ee(this),dn(this.a,"startForwardChannel_ finished, sent request")));else if(i)H(this.a,"Not supposed to retry the open");else{dn(this.a,"open_()"),this.P=a(1e5*Math.random()),i=this.P++;var t=new Sn(this,this.a,i,void 0),e=this.i;this.M&&(e?(e=rt(e),at(e,this.M)):e=this.M),null===this.h&&(t.j=e);var n=ze(this,t),r=P(this.F);Kn(r,"RID",i),Kn(r,"CVER",21),this.D&&this.j&&Kn(r,"X-HTTP-Session-Id",this.j),He(this,r),this.h&&e&&ue(r,this.h,e),ce(this.c,t),this.Ta?(Kn(r,"$req",n),En(t,r,null)):En(t,r,n),this.G=2}},t.Na=function(){this.m=null,dn(this.a,"Creating new HttpRequest"),this.b=new Sn(this,this.a,"rpc",this.T),null===this.h&&(this.b.j=this.i),this.b.P=0;var e=P(this.wa);Kn(e,"RID","rpc"),Kn(e,"SID",this.I),Kn(e,"CI",this.la?"0":"1"),Kn(e,"AID",this.N),He(this,e),Kn(e,"TYPE","xmlhttp"),this.h&&this.i&&ue(e,this.h,this.i),kn(this.b,e,!0,this.ja),dn(this.a,"New Request created")},t.Ma=function(n,t){if(0!=this.G&&(this.b==n||be(this.c,n)))if(this.s=n.C,be(this.c,n)&&3==this.G){try{var e=this.ma.a.parse(t)}catch(n){e=null}if(!(l(e)&&3==e.length))dn(this.a,"Bad POST response data returned"),Fe(this,11);else if(t=e,0==t[0]){t:if(dn(this.a,"Server claims our backchannel is missing."),this.m)dn(this.a,"But we are currently starting the request.");else{if(this.b){if(!(this.b.D+3e3<n.D))break t;Eo(this),this.b.cancel(),this.b=null}else tn(this.a.a,"We do not have a BackChannel established");Ie(this),mn(18)}}else this.xa=t[1],0<(n=this.xa-this.N)&&(t=t[2],dn(this.a,t+" bytes (in "+n+" arrays) are outstanding on the BackChannel"),37500>t&&this.la&&0==this.w&&!this.o&&(this.o=fn(f(this.$a,this),6e3)))}else if(this.b==n&&Eo(this),!/^[\s\xa0]*$/.test(t))for(t=e=this.ma.a.parse(t),e=0;e<t.length;e++){var o=t[e];if(!(this.N=o[0],o=o[1],2==this.G))3==this.G&&("stop"==o[0]||"close"==o[0]?"stop"==o[0]?Fe(this,7):we(this):"noop"!=o[0]&&this.f&&this.f.Ca(o),this.w=0);else if("c"==o[0]){this.I=o[1],this.ja=o[2];var r=o[3];null!=r&&(this.oa=r,ln(this.a,"VER="+this.oa)),o=o[4],null!=o&&(this.ya=o,ln(this.a,"SVER="+this.ya)),this.D&&(o=n.a)&&((r=o.a?o.a.getResponseHeader("X-Client-Wire-Protocol"):null)&&vo(this.c,r),this.j&&((o=o.a?o.a.getResponseHeader("X-HTTP-Session-Id"):null)?(this.J=o,Kn(this.F,this.j,o)):tn(this.a.a,"Missing X_HTTP_SESSION_ID in the handshake response"))),this.G=3,this.f&&this.f.Da(),this.wa=Ke(this,this.ja,this.ka),Ge(this)}else"stop"!=o[0]&&"close"!=o[0]||Fe(this,7)}},t.$a=function(){null!=this.o&&(this.o=null,this.b.cancel(),this.b=null,Ie(this),mn(19))},t.ua=function(t){dn(this.a,"Request complete");var e=null;if(this.b==t){Eo(this),this.b=null;var n=2}else{if(!be(this.c,t))return;e=t.s,ae(this.c,t),n=1}if(this.s=t.C,0!=this.G)if(t.c)1==n?(gn(t.m?t.m.length:0,No()-t.D,this.C),Ce(this)):Ge(this);else{var r=t.l;if(3==r||0==r&&0<this.s)dn(this.a,"Not retrying due to error type");else{var o=this;if(dn(this.a,function(){return"Maybe retrying, last error: "+K(r,o.s)}),1==n&&De(this,t)||2==n&&Ie(this))return;dn(this.a,"Exceeded max number of retries")}switch(e&&0<e.length&&ee(this.c,e),dn(this.a,"Error: HTTP request failed"),r){case 1:Fe(this,5);break;case 4:Fe(this,10);break;case 3:Fe(this,6);break;default:Fe(this,2);}}},t.hb=function(e){e?(ln(this.a,"Successfully pinged google.com"),mn(2)):(ln(this.a,"Failed to ping google.com"),mn(1))},t.da=function(e){if(e&&!this.S)throw Error("Can't create secondary domain capable XhrIo object.");return e=new ke,e.m=this.S,e},t.ra=function(){return!!this.f&&!0},t.ia=function(){return this.S},new lo,t=Le.prototype,t.Da=function(){},t.Ca=function(){},t.Ba=function(){},t.Aa=function(){},t.Va=function(){},Ne.prototype.a=function(n,t){return new Oe(n,t)},r(Oe,Lt),Oe.prototype.j=function(){this.a.f=this.h,this.o&&(this.a.S=!0);var o=this.a,t=this.s,e=this.b,n=this.g||void 0;dn(o.a,"connect()"),mn(0),o.ka=e,o.U=n||{},o.D&&(dn(o.a,"connect() bypassed channel-test."),o.H.b=[],o.H.a=!1),dn(o.a,"connectTest_()"),o.B=new ho(o,o.a),null===o.h&&(o.B.i=o.i),e=t,o.h&&o.i&&(e=ue(t,o.h,o.i)),o=o.B,o.l=e,t=Ae(o.a,o.l),mn(3),e=o.a.H.b,null==e?(Q(t,"MODE","init"),!o.a.D&&o.a.j&&Q(t,"X-HTTP-Session-Id",o.a.j),o.c=new Sn(o,o.b,void 0,void 0),o.c.j=o.i,kn(o.c,t,!1,null),o.R=0):(o.g=e[0],o.R=1,mo(o))},Oe.prototype.close=function(){we(this.a)},Oe.prototype.l=function(n){if(s(n)){var t={};t.__data__=n,ye(this.a,t)}else this.m?(t={},t.__data__=Pt(n),ye(this.a,t)):ye(this.a,n)},Oe.prototype.A=function(){this.a.f=null,delete this.h,we(this.a),delete this.a,Oe.L.A.call(this)},r(W,co),r(Qe,uo),r(Re,Le),Re.prototype.Da=function(){E(this.a.f,"WebChannel opened on "+this.a.b),this.a.dispatchEvent("a")},Re.prototype.Ca=function(e){this.a.dispatchEvent(new W(e))},Re.prototype.Ba=function(e){E(this.a.f,"WebChannel aborted on "+this.a.b+" due to channel error: "+e),this.a.dispatchEvent(new Qe(e))},Re.prototype.Aa=function(){E(this.a.f,"WebChannel closed on "+this.a.b),this.a.dispatchEvent("b")};var ne=b(function(e){function t(){}t.prototype=e.prototype;var n=new t;return e.apply(n,Array.prototype.slice.call(arguments,1)),n},Ne);Pe.prototype.u=function(){return this.b.length+this.a.length},Pe.prototype.contains=function(e){return 0<=Ro(this.b,e)||0<=Ro(this.a,e)},Pe.prototype.v=function(){for(var o=[],t=this.b.length-1;0<=t;--t)o.push(this.b[t]);var e=this.a.length;for(t=0;t<e;++t)o.push(this.a[t]);return o},r(Ue,$);var Ur="[goog.structs.Pool] Min can not be greater than max";t=Ue.prototype,t.ea=function(){var t=No();if(!(null!=this.g&&0>t-this.g)){for(var e;0<this.a.u()&&(e=Te(this.a),!this.ta(e));)this.ba();return!e&&this.u()<this.c&&(e=this.qa()),e&&(this.g=t,this.b.add(e)),e}},t.gb=function(e){return!!Un(this.b.a,S(e))&&(this.na(e),!0)},t.na=function(e){Un(this.b.a,S(e)),this.ta(e)&&this.u()<this.c?this.a.a.push(e):Ve(e)},t.ba=function(){for(var n=this.a,t;this.u()<this.h;)t=this.qa(),n.a.push(t);for(;this.u()>this.c&&0<this.a.u();)Ve(Te(n))},t.qa=function(){return{}},t.ta=function(e){return"function"!=typeof e.Wa||e.Wa()},t.contains=function(e){return this.a.contains(e)||this.b.contains(e)},t.u=function(){return this.a.u()+this.b.u()},t.A=function(){if(Ue.L.A.call(this),0<this.b.u())throw Error("[goog.structs.Pool] Objects not released");delete this.b;for(var e=this.a;0!=e.b.length||0!=e.a.length;)Ve(Te(e));delete this.a},Ye.prototype.v=function(){for(var o=this.a,t=[],e=o.length,n=0;n<e;n++)t.push(o[n].b);return t},Ye.prototype.O=function(){for(var o=this.a,t=[],e=o.length,n=0;n<e;n++)t.push(o[n].a);return t},Ye.prototype.u=function(){return this.a.length},r($e,Ye),r(To,Ue),t=To.prototype,t.ea=function(n,t){return n?void(Ze(this.f,void 0===t?100:t,n),this.sa()):To.L.ea.call(this)},t.sa=function(){for(var d=this.f,t;0<d.u()&&(t=this.ea(),!!t);){var l=d,n=l.a,r=n.length,o=n[0];if(0>=r)o=void 0;else{if(1==r)Z(n);else{n[0]=n.pop(),n=0,l=l.a,r=l.length;for(var i=l[n];n<r>>1;){var a=2*n+1,s=2*n+2;if(a=s<r&&l[s].a<l[a].a?s:a,l[a].a>i.a)break;l[n]=l[a],n=a}l[n]=i}o=o.b}o.apply(this,[t])}},t.na=function(e){To.L.na.call(this,e),this.sa()},t.ba=function(){To.L.ba.call(this),this.sa()},t.A=function(){To.L.A.call(this),Io.clearTimeout(void 0),Z(this.f.a),this.f=null},r(X,To),X.prototype.qa=function(){var o=new ke,t=this.l;return t&&t.forEach(function(t,e){o.headers.set(e,t)}),this.j&&(o.m=!0),o},X.prototype.ta=function(e){return!e.i&&!e.a},Ne.prototype.createWebChannel=Ne.prototype.a,Oe.prototype.send=Oe.prototype.l,Oe.prototype.open=Oe.prototype.j,Oe.prototype.close=Oe.prototype.close,Sr.NO_ERROR=0,Sr.TIMEOUT=8,Sr.HTTP_ERROR=6,Er.COMPLETE="complete",po.EventType=Mr,Mr.OPEN="a",Mr.CLOSE="b",Mr.ERROR="c",Mr.MESSAGE="d",Lt.prototype.listen=Lt.prototype.aa,X.prototype.getObject=X.prototype.ea,X.prototype.releaseObject=X.prototype.gb,ke.prototype.listenOnce=ke.prototype.Ha,ke.prototype.getLastError=ke.prototype.Za,ke.prototype.getLastErrorCode=ke.prototype.Fa,ke.prototype.getStatus=ke.prototype.W,ke.prototype.getStatusText=ke.prototype.Ga,ke.prototype.getResponseJson=ke.prototype.Ya,ke.prototype.getResponseText=ke.prototype.V,ke.prototype.getResponseText=ke.prototype.V,ke.prototype.send=ke.prototype.fa,e.exports={createWebChannelTransport:ne,ErrorCode:Sr,EventType:Er,WebChannel:po,XhrIoPool:X}}).call(void 0===t?"undefined"==typeof self?"undefined"==typeof window?{}:window:self:t)}).call(t,n(12))}},[113])}catch(e){throw Error("Cannot instantiate firebase-firestore.js - be sure to load firebase-app.js first.")} |